aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig3
-rw-r--r--arch/alpha/include/asm/mmzone.h2
-rw-r--r--arch/alpha/include/asm/pgtable.h3
-rw-r--r--arch/alpha/include/uapi/asm/fcntl.h1
-rw-r--r--arch/alpha/kernel/console.c4
-rw-r--r--arch/alpha/kernel/osf_sys.c15
-rw-r--r--arch/alpha/kernel/pci-sysfs.c1
-rw-r--r--arch/alpha/kernel/process.c4
-rw-r--r--arch/alpha/kernel/sys_nautilus.c4
-rw-r--r--arch/alpha/mm/init.c41
-rw-r--r--arch/alpha/mm/numa.c40
-rw-r--r--arch/arc/Kconfig9
-rw-r--r--arch/arc/Kconfig.debug7
-rw-r--r--arch/arc/Makefile28
-rw-r--r--arch/arc/boot/dts/abilis_tb100_dvk.dts10
-rw-r--r--arch/arc/boot/dts/abilis_tb101_dvk.dts10
-rw-r--r--arch/arc/configs/fpga_defconfig2
-rw-r--r--arch/arc/configs/nsimosci_defconfig2
-rw-r--r--arch/arc/configs/tb10x_defconfig2
-rw-r--r--arch/arc/include/asm/arcregs.h127
-rw-r--r--arch/arc/include/asm/bug.h5
-rw-r--r--arch/arc/include/asm/cache.h26
-rw-r--r--arch/arc/include/asm/cacheflush.h13
-rw-r--r--arch/arc/include/asm/defines.h56
-rw-r--r--arch/arc/include/asm/entry.h521
-rw-r--r--arch/arc/include/asm/irq.h2
-rw-r--r--arch/arc/include/asm/irqflags.h20
-rw-r--r--arch/arc/include/asm/kgdb.h4
-rw-r--r--arch/arc/include/asm/kprobes.h6
-rw-r--r--arch/arc/include/asm/mmu.h44
-rw-r--r--arch/arc/include/asm/page.h7
-rw-r--r--arch/arc/include/asm/pgtable.h9
-rw-r--r--arch/arc/include/asm/processor.h17
-rw-r--r--arch/arc/include/asm/ptrace.h47
-rw-r--r--arch/arc/include/asm/syscall.h5
-rw-r--r--arch/arc/include/asm/tlb-mmu1.h4
-rw-r--r--arch/arc/include/asm/tlb.h26
-rw-r--r--arch/arc/include/asm/unaligned.h4
-rw-r--r--arch/arc/include/uapi/asm/ptrace.h15
-rw-r--r--arch/arc/kernel/asm-offsets.c7
-rw-r--r--arch/arc/kernel/ctx_sw.c14
-rw-r--r--arch/arc/kernel/entry.S103
-rw-r--r--arch/arc/kernel/head.S2
-rw-r--r--arch/arc/kernel/irq.c16
-rw-r--r--arch/arc/kernel/kgdb.c4
-rw-r--r--arch/arc/kernel/kprobes.c5
-rw-r--r--arch/arc/kernel/process.c9
-rw-r--r--arch/arc/kernel/ptrace.c14
-rw-r--r--arch/arc/kernel/setup.c18
-rw-r--r--arch/arc/kernel/smp.c4
-rw-r--r--arch/arc/kernel/stacktrace.c2
-rw-r--r--arch/arc/kernel/time.c17
-rw-r--r--arch/arc/kernel/traps.c52
-rw-r--r--arch/arc/kernel/troubleshoot.c33
-rw-r--r--arch/arc/kernel/unaligned.c2
-rw-r--r--arch/arc/kernel/unwind.c2
-rw-r--r--arch/arc/kernel/vmlinux.lds.S24
-rw-r--r--arch/arc/mm/cache_arc700.c126
-rw-r--r--arch/arc/mm/fault.c12
-rw-r--r--arch/arc/mm/init.c42
-rw-r--r--arch/arc/mm/tlb.c38
-rw-r--r--arch/arc/mm/tlbex.S35
-rw-r--r--arch/arc/plat-arcfpga/platform.c12
-rw-r--r--arch/arm/Kconfig163
-rw-r--r--arch/arm/Kconfig-nommu14
-rw-r--r--arch/arm/Kconfig.debug162
-rw-r--r--arch/arm/Makefile67
-rw-r--r--arch/arm/boot/compressed/Makefile7
-rw-r--r--arch/arm/boot/compressed/atags_to_fdt.c44
-rw-r--r--arch/arm/boot/compressed/debug.S28
-rw-r--r--arch/arm/boot/compressed/head-sa1100.S1
-rw-r--r--arch/arm/boot/compressed/head-shark.S1
-rw-r--r--arch/arm/boot/compressed/head-shmobile.S21
-rw-r--r--arch/arm/boot/compressed/head.S45
-rw-r--r--arch/arm/boot/dts/Makefile43
-rw-r--r--arch/arm/boot/dts/aks-cdu.dts12
-rw-r--r--arch/arm/boot/dts/am335x-bone.dts118
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts264
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts184
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi130
-rw-r--r--arch/arm/boot/dts/am3517-evm.dts2
-rw-r--r--arch/arm/boot/dts/am3517_mt_ventoux.dts2
-rw-r--r--arch/arm/boot/dts/am4372.dtsi68
-rw-r--r--arch/arm/boot/dts/am43x-epos-evm.dts18
-rw-r--r--arch/arm/boot/dts/animeo_ip.dts18
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts1
-rw-r--r--arch/arm/boot/dts/armada-370-mirabox.dts1
-rw-r--r--arch/arm/boot/dts/armada-370-rd.dts17
-rw-r--r--arch/arm/boot/dts/armada-370-xp.dtsi23
-rw-r--r--arch/arm/boot/dts/armada-370.dtsi4
-rw-r--r--arch/arm/boot/dts/armada-xp-db.dts34
-rw-r--r--arch/arm/boot/dts/armada-xp-gp.dts15
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78260.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-xp-mv78460.dtsi5
-rw-r--r--arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts14
-rw-r--r--arch/arm/boot/dts/armada-xp.dtsi8
-rw-r--r--arch/arm/boot/dts/at91-ariag25.dts27
-rw-r--r--arch/arm/boot/dts/at91-foxg20.dts157
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi309
-rw-r--r--arch/arm/boot/dts/at91rm9200ek.dts20
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi309
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi249
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts28
-rw-r--r--arch/arm/boot/dts/at91sam9g15.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g15ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek.dts6
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_2mmc.dts10
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi32
-rw-r--r--arch/arm/boot/dts/at91sam9g25.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g25ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9g35.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9g35ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi364
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts47
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi248
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts18
-rw-r--r--arch/arm/boot/dts/at91sam9x25.dtsi22
-rw-r--r--arch/arm/boot/dts/at91sam9x25ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9x35.dtsi2
-rw-r--r--arch/arm/boot/dts/at91sam9x35ek.dts4
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi474
-rw-r--r--arch/arm/boot/dts/at91sam9x5cm.dtsi8
-rw-r--r--arch/arm/boot/dts/at91sam9x5ek.dtsi23
-rw-r--r--arch/arm/boot/dts/atlas6.dtsi2
-rw-r--r--arch/arm/boot/dts/bcm11351-brt.dts19
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi47
-rw-r--r--arch/arm/boot/dts/bcm2835-rpi-b.dts11
-rw-r--r--arch/arm/boot/dts/ccu8540.dts41
-rw-r--r--arch/arm/boot/dts/ccu9540.dts6
-rw-r--r--arch/arm/boot/dts/da850-enbw-cmc.dts2
-rw-r--r--arch/arm/boot/dts/da850-evm.dts2
-rw-r--r--arch/arm/boot/dts/da850.dtsi4
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi231
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts51
-rw-r--r--arch/arm/boot/dts/ecx-common.dtsi2
-rw-r--r--arch/arm/boot/dts/ethernut5.dts6
-rw-r--r--arch/arm/boot/dts/evk-pro3.dts6
-rw-r--r--arch/arm/boot/dts/exynos4.dtsi4
-rw-r--r--arch/arm/boot/dts/exynos4210-origen.dts171
-rw-r--r--arch/arm/boot/dts/exynos4210-pinctrl.dtsi89
-rw-r--r--arch/arm/boot/dts/exynos4210-smdkv310.dts2
-rw-r--r--arch/arm/boot/dts/exynos4210-trats.dts2
-rw-r--r--arch/arm/boot/dts/exynos4210-universal_c210.dts2
-rw-r--r--arch/arm/boot/dts/exynos4210.dtsi9
-rw-r--r--arch/arm/boot/dts/exynos4212.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos4412-odroidx.dts199
-rw-r--r--arch/arm/boot/dts/exynos4412-origen.dts68
-rw-r--r--arch/arm/boot/dts/exynos4412-smdk4412.dts87
-rw-r--r--arch/arm/boot/dts/exynos4412.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos4x12-pinctrl.dtsi56
-rw-r--r--arch/arm/boot/dts/exynos4x12.dtsi14
-rw-r--r--arch/arm/boot/dts/exynos5.dtsi111
-rw-r--r--arch/arm/boot/dts/exynos5250-arndale.dts33
-rw-r--r--arch/arm/boot/dts/exynos5250-pinctrl.dtsi9
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts42
-rw-r--r--arch/arm/boot/dts/exynos5250-snow.dts8
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi130
-rw-r--r--arch/arm/boot/dts/exynos5420-pinctrl.dtsi680
-rw-r--r--arch/arm/boot/dts/exynos5420-smdk5420.dts33
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi148
-rw-r--r--arch/arm/boot/dts/exynos5440-sd5v1.dts4
-rw-r--r--arch/arm/boot/dts/exynos5440-ssdk5440.dts51
-rw-r--r--arch/arm/boot/dts/exynos5440.dtsi112
-rw-r--r--arch/arm/boot/dts/ge863-pro3.dtsi2
-rw-r--r--arch/arm/boot/dts/href.dtsi61
-rw-r--r--arch/arm/boot/dts/hrefprev60.dts10
-rw-r--r--arch/arm/boot/dts/hrefv60plus.dts20
-rw-r--r--arch/arm/boot/dts/imx23.dtsi8
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts37
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore-som.dts179
-rw-r--r--arch/arm/boot/dts/imx27-phytec-phycore.dts79
-rw-r--r--arch/arm/boot/dts/imx27.dtsi80
-rw-r--r--arch/arm/boot/dts/imx28-apf28dev.dts1
-rw-r--r--arch/arm/boot/dts/imx28-cfa10036.dts38
-rw-r--r--arch/arm/boot/dts/imx28-cfa10049.dts8
-rw-r--r--arch/arm/boot/dts/imx28-cfa10055.dts179
-rw-r--r--arch/arm/boot/dts/imx28-cfa10057.dts191
-rw-r--r--arch/arm/boot/dts/imx28-m28evk.dts14
-rw-r--r--arch/arm/boot/dts/imx28.dtsi45
-rw-r--r--arch/arm/boot/dts/imx51-apf51.dts7
-rw-r--r--arch/arm/boot/dts/imx51.dtsi23
-rw-r--r--arch/arm/boot/dts/imx53-m53evk.dts259
-rw-r--r--arch/arm/boot/dts/imx53-mba53.dts175
-rw-r--r--arch/arm/boot/dts/imx53-qsb.dts36
-rw-r--r--arch/arm/boot/dts/imx53-tqma53.dtsi45
-rw-r--r--arch/arm/boot/dts/imx53-tx53.dtsi122
-rw-r--r--arch/arm/boot/dts/imx53.dtsi297
-rw-r--r--arch/arm/boot/dts/imx6dl-sabreauto.dts8
-rw-r--r--arch/arm/boot/dts/imx6dl-sabresd.dts1
-rw-r--r--arch/arm/boot/dts/imx6dl.dtsi114
-rw-r--r--arch/arm/boot/dts/imx6q-phytec-pbab01.dts34
-rw-r--r--arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi74
-rw-r--r--arch/arm/boot/dts/imx6q-sabreauto.dts8
-rw-r--r--arch/arm/boot/dts/imx6q-sabresd.dts1
-rw-r--r--arch/arm/boot/dts/imx6q.dtsi104
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabreauto.dtsi41
-rw-r--r--arch/arm/boot/dts/imx6qdl-sabresd.dtsi66
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi13
-rw-r--r--arch/arm/boot/dts/imx6sl-evk.dts74
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi779
-rw-r--r--arch/arm/boot/dts/integratorap.dts41
-rw-r--r--arch/arm/boot/dts/keystone.dts117
-rw-r--r--arch/arm/boot/dts/kirkwood-6281.dtsi59
-rw-r--r--arch/arm/boot/dts/kirkwood-6282.dtsi76
-rw-r--r--arch/arm/boot/dts/kirkwood-cloudbox.dts10
-rw-r--r--arch/arm/boot/dts/kirkwood-db-88f6281.dts30
-rw-r--r--arch/arm/boot/dts/kirkwood-db-88f6282.dts34
-rw-r--r--arch/arm/boot/dts/kirkwood-db.dtsi89
-rw-r--r--arch/arm/boot/dts/kirkwood-dns320.dts7
-rw-r--r--arch/arm/boot/dts/kirkwood-dns325.dts5
-rw-r--r--arch/arm/boot/dts/kirkwood-dnskw.dtsi32
-rw-r--r--arch/arm/boot/dts/kirkwood-dockstar.dts9
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts12
-rw-r--r--arch/arm/boot/dts/kirkwood-goflexnet.dts18
-rw-r--r--arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts10
-rw-r--r--arch/arm/boot/dts/kirkwood-ib62x0.dts17
-rw-r--r--arch/arm/boot/dts/kirkwood-iconnect.dts44
-rw-r--r--arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts15
-rw-r--r--arch/arm/boot/dts/kirkwood-is2.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-km_kirkwood.dts13
-rw-r--r--arch/arm/boot/dts/kirkwood-lsxl.dtsi26
-rw-r--r--arch/arm/boot/dts/kirkwood-mplcec4.dts33
-rw-r--r--arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts30
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2-common.dtsi10
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2lite.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2max.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-ns2mini.dts2
-rw-r--r--arch/arm/boot/dts/kirkwood-nsa310.dts38
-rw-r--r--arch/arm/boot/dts/kirkwood-openblocks_a6.dts108
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi93
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts43
-rw-r--r--arch/arm/boot/dts/kirkwood-sheevaplug.dts43
-rw-r--r--arch/arm/boot/dts/kirkwood-topkick.dts52
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6281.dts11
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219-6282.dts19
-rw-r--r--arch/arm/boot/dts/kirkwood-ts219.dtsi24
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi42
-rw-r--r--arch/arm/boot/dts/kizbox.dts16
-rw-r--r--arch/arm/boot/dts/lpc32xx.dtsi8
-rw-r--r--arch/arm/boot/dts/mpa1600.dts4
-rw-r--r--arch/arm/boot/dts/msm8660-surf.dts15
-rw-r--r--arch/arm/boot/dts/msm8960-cdp.dts13
-rw-r--r--arch/arm/boot/dts/nspire-classic.dtsi74
-rw-r--r--arch/arm/boot/dts/nspire-clp.dts45
-rw-r--r--arch/arm/boot/dts/nspire-cx.dts112
-rw-r--r--arch/arm/boot/dts/nspire-tp.dts44
-rw-r--r--arch/arm/boot/dts/nspire.dtsi175
-rw-r--r--arch/arm/boot/dts/omap2.dtsi11
-rw-r--r--arch/arm/boot/dts/omap2420-h4.dts2
-rw-r--r--arch/arm/boot/dts/omap2420.dtsi2
-rw-r--r--arch/arm/boot/dts/omap2430.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-beagle-xm.dts48
-rw-r--r--arch/arm/boot/dts/omap3-beagle.dts72
-rw-r--r--arch/arm/boot/dts/omap3-devkit8000.dts40
-rw-r--r--arch/arm/boot/dts/omap3-evm.dts7
-rw-r--r--arch/arm/boot/dts/omap3-igep.dtsi43
-rw-r--r--arch/arm/boot/dts/omap3-igep0020.dts111
-rw-r--r--arch/arm/boot/dts/omap3-igep0030.dts60
-rw-r--r--arch/arm/boot/dts/omap3-overo.dtsi20
-rw-r--r--arch/arm/boot/dts/omap3-tobi.dts52
-rw-r--r--arch/arm/boot/dts/omap3.dtsi11
-rw-r--r--arch/arm/boot/dts/omap3430-sdp.dts6
-rw-r--r--arch/arm/boot/dts/omap34xx.dtsi2
-rw-r--r--arch/arm/boot/dts/omap36xx.dtsi2
-rw-r--r--arch/arm/boot/dts/omap4-panda-a4.dts10
-rw-r--r--arch/arm/boot/dts/omap4-panda-common.dtsi178
-rw-r--r--arch/arm/boot/dts/omap4-panda-es.dts38
-rw-r--r--arch/arm/boot/dts/omap4-panda.dts4
-rw-r--r--arch/arm/boot/dts/omap4-sdp-es23plus.dts8
-rw-r--r--arch/arm/boot/dts/omap4-sdp.dts142
-rw-r--r--arch/arm/boot/dts/omap4-var-som.dts8
-rw-r--r--arch/arm/boot/dts/omap4.dtsi131
-rw-r--r--arch/arm/boot/dts/omap443x.dtsi8
-rw-r--r--arch/arm/boot/dts/omap4460.dtsi15
-rw-r--r--arch/arm/boot/dts/omap5-evm.dts261
-rw-r--r--arch/arm/boot/dts/omap5-uevm.dts485
-rw-r--r--arch/arm/boot/dts/omap5.dtsi183
-rw-r--r--arch/arm/boot/dts/picoxcell-pc3x2.dtsi8
-rw-r--r--arch/arm/boot/dts/picoxcell-pc3x3.dtsi8
-rw-r--r--arch/arm/boot/dts/pm9g45.dts22
-rw-r--r--arch/arm/boot/dts/prima2.dtsi4
-rw-r--r--arch/arm/boot/dts/pxa2xx.dtsi7
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi6
-rw-r--r--arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts45
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi121
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi17
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi6
-rw-r--r--arch/arm/boot/dts/rk3066a-clocks.dtsi299
-rw-r--r--arch/arm/boot/dts/rk3066a.dtsi390
-rw-r--r--arch/arm/boot/dts/s3c2416-pinctrl.dtsi173
-rw-r--r--arch/arm/boot/dts/s3c2416-smdk2416.dts72
-rw-r--r--arch/arm/boot/dts/s3c2416.dtsi79
-rw-r--r--arch/arm/boot/dts/s3c24xx.dtsi92
-rw-r--r--arch/arm/boot/dts/sama5d3.dtsi553
-rw-r--r--arch/arm/boot/dts/sama5d31ek.dts6
-rw-r--r--arch/arm/boot/dts/sama5d33ek.dts4
-rw-r--r--arch/arm/boot/dts/sama5d34ek.dts6
-rw-r--r--arch/arm/boot/dts/sama5d35ek.dts4
-rw-r--r--arch/arm/boot/dts/sama5d3xcm.dtsi4
-rw-r--r--arch/arm/boot/dts/sama5d3xdm.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d3xmb.dtsi26
-rw-r--r--arch/arm/boot/dts/sh7372.dtsi5
-rw-r--r--arch/arm/boot/dts/sh73a0-kzm9g-reference.dts86
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi18
-rw-r--r--arch/arm/boot/dts/snowball.dts93
-rw-r--r--arch/arm/boot/dts/socfpga.dtsi217
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5.dts13
-rw-r--r--arch/arm/boot/dts/socfpga_vt.dts5
-rw-r--r--arch/arm/boot/dts/spear13xx.dtsi2
-rw-r--r--arch/arm/boot/dts/spear3xx.dtsi8
-rw-r--r--arch/arm/boot/dts/spear600.dtsi8
-rw-r--r--arch/arm/boot/dts/st-pincfg.h71
-rw-r--r--arch/arm/boot/dts/ste-nomadik-s8815.dts69
-rw-r--r--arch/arm/boot/dts/ste-nomadik-stn8815.dtsi574
-rw-r--r--arch/arm/boot/dts/ste-u300.dts473
-rw-r--r--arch/arm/boot/dts/stih415-b2000.dts15
-rw-r--r--arch/arm/boot/dts/stih415-b2020.dts15
-rw-r--r--arch/arm/boot/dts/stih415-clock.dtsi38
-rw-r--r--arch/arm/boot/dts/stih415-pinctrl.dtsi268
-rw-r--r--arch/arm/boot/dts/stih415.dtsi87
-rw-r--r--arch/arm/boot/dts/stih416-b2000.dts16
-rw-r--r--arch/arm/boot/dts/stih416-b2020.dts16
-rw-r--r--arch/arm/boot/dts/stih416-clock.dtsi41
-rw-r--r--arch/arm/boot/dts/stih416-pinctrl.dtsi295
-rw-r--r--arch/arm/boot/dts/stih416.dtsi96
-rw-r--r--arch/arm/boot/dts/stih41x-b2000.dtsi41
-rw-r--r--arch/arm/boot/dts/stih41x-b2020.dtsi42
-rw-r--r--arch/arm/boot/dts/stih41x.dtsi38
-rw-r--r--arch/arm/boot/dts/stuib.dtsi26
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts12
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi54
-rw-r--r--arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts76
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi286
-rw-r--r--arch/arm/boot/dts/sun5i-a13-olinuxino.dts18
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi89
-rw-r--r--arch/arm/boot/dts/tegra114-dalmore.dts71
-rw-r--r--arch/arm/boot/dts/tegra114-pluto.dts2
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi277
-rw-r--r--arch/arm/boot/dts/tegra20-colibri-512.dtsi29
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts67
-rw-r--r--arch/arm/boot/dts/tegra20-iris-512.dts13
-rw-r--r--arch/arm/boot/dts/tegra20-medcom-wide.dts12
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts48
-rw-r--r--arch/arm/boot/dts/tegra20-plutux.dts12
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts69
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi15
-rw-r--r--arch/arm/boot/dts/tegra20-tec.dts13
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts46
-rw-r--r--arch/arm/boot/dts/tegra20-ventana.dts60
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts47
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi285
-rw-r--r--arch/arm/boot/dts/tegra30-beaver.dts68
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu-a02.dts16
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu-a04.dts18
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi47
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi288
-rw-r--r--arch/arm/boot/dts/tny_a9260.dts4
-rw-r--r--arch/arm/boot/dts/tny_a9263.dts4
-rw-r--r--arch/arm/boot/dts/tny_a9g20.dts4
-rw-r--r--arch/arm/boot/dts/twl4030_omap3.dtsi25
-rw-r--r--arch/arm/boot/dts/usb_a9260.dts13
-rw-r--r--arch/arm/boot/dts/usb_a9260_common.dtsi6
-rw-r--r--arch/arm/boot/dts/usb_a9263.dts22
-rw-r--r--arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi22
-rw-r--r--arch/arm/boot/dts/usb_a9g20.dts18
-rw-r--r--arch/arm/boot/dts/usb_a9g20_common.dtsi27
-rw-r--r--arch/arm/boot/dts/usb_a9g20_lpw.dts31
-rw-r--r--arch/arm/boot/dts/vf610-pinfunc.h810
-rw-r--r--arch/arm/boot/dts/vf610-twr.dts57
-rw-r--r--arch/arm/boot/dts/vf610.dtsi464
-rw-r--r--arch/arm/boot/dts/vt8500-bv07.dts4
-rw-r--r--arch/arm/boot/dts/vt8500.dtsi29
-rw-r--r--arch/arm/boot/dts/wm8505-ref.dts4
-rw-r--r--arch/arm/boot/dts/wm8505.dtsi84
-rw-r--r--arch/arm/boot/dts/wm8650-mid.dts3
-rw-r--r--arch/arm/boot/dts/wm8650.dtsi79
-rw-r--r--arch/arm/boot/dts/wm8750-apc8750.dts30
-rw-r--r--arch/arm/boot/dts/wm8750.dtsi347
-rw-r--r--arch/arm/boot/dts/wm8850-w70v2.dts4
-rw-r--r--arch/arm/boot/dts/wm8850.dtsi94
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi73
-rw-r--r--arch/arm/boot/dts/zynq-zc702.dts6
-rw-r--r--arch/arm/boot/dts/zynq-zc706.dts35
-rw-r--r--arch/arm/boot/dts/zynq-zed.dts35
-rw-r--r--arch/arm/common/Kconfig3
-rw-r--r--arch/arm/common/Makefile1
-rw-r--r--arch/arm/common/edma.c (renamed from arch/arm/mach-davinci/dma.c)368
-rw-r--r--arch/arm/common/mcpm_head.S4
-rw-r--r--arch/arm/common/mcpm_platsmp.c5
-rw-r--r--arch/arm/configs/ap4evb_defconfig56
-rw-r--r--arch/arm/configs/armadillo800eva_defconfig2
-rw-r--r--arch/arm/configs/at91_dt_defconfig57
-rw-r--r--arch/arm/configs/at91rm9200_defconfig219
-rw-r--r--arch/arm/configs/at91sam9260_9g20_defconfig (renamed from arch/arm/configs/at91sam9g20_defconfig)66
-rw-r--r--arch/arm/configs/at91sam9260_defconfig91
-rw-r--r--arch/arm/configs/at91sam9261_9g10_defconfig (renamed from arch/arm/configs/at91sam9261_defconfig)19
-rw-r--r--arch/arm/configs/at91sam9263_defconfig40
-rw-r--r--arch/arm/configs/at91sam9g45_defconfig94
-rw-r--r--arch/arm/configs/bcm2835_defconfig19
-rw-r--r--arch/arm/configs/bockw_defconfig27
-rw-r--r--arch/arm/configs/bonito_defconfig72
-rw-r--r--arch/arm/configs/clps711x_defconfig8
-rw-r--r--arch/arm/configs/exynos_defconfig3
-rw-r--r--arch/arm/configs/imx_v6_v7_defconfig10
-rw-r--r--arch/arm/configs/keystone_defconfig157
-rw-r--r--arch/arm/configs/kirkwood_defconfig10
-rw-r--r--arch/arm/configs/kzm9g_defconfig3
-rw-r--r--arch/arm/configs/multi_v7_defconfig5
-rw-r--r--arch/arm/configs/mvebu_defconfig6
-rw-r--r--arch/arm/configs/nhk8815_defconfig6
-rw-r--r--arch/arm/configs/omap1_defconfig3
-rw-r--r--arch/arm/configs/omap2plus_defconfig2
-rw-r--r--arch/arm/configs/sama5_defconfig35
-rw-r--r--arch/arm/configs/tegra_defconfig23
-rw-r--r--arch/arm/configs/u300_defconfig14
-rw-r--r--arch/arm/include/asm/arch_timer.h9
-rw-r--r--arch/arm/include/asm/assembler.h17
-rw-r--r--arch/arm/include/asm/cacheflush.h4
-rw-r--r--arch/arm/include/asm/cp15.h19
-rw-r--r--arch/arm/include/asm/cputype.h47
-rw-r--r--arch/arm/include/asm/div64.h2
-rw-r--r--arch/arm/include/asm/glue-cache.h27
-rw-r--r--arch/arm/include/asm/glue-df.h8
-rw-r--r--arch/arm/include/asm/glue-proc.h18
-rw-r--r--arch/arm/include/asm/hardware/pci_v3.h186
-rw-r--r--arch/arm/include/asm/hugetlb-3level.h71
-rw-r--r--arch/arm/include/asm/hugetlb.h84
-rw-r--r--arch/arm/include/asm/io.h8
-rw-r--r--arch/arm/include/asm/irqflags.h22
-rw-r--r--arch/arm/include/asm/kvm_arch_timer.h85
-rw-r--r--arch/arm/include/asm/kvm_arm.h1
-rw-r--r--arch/arm/include/asm/kvm_asm.h24
-rw-r--r--arch/arm/include/asm/kvm_emulate.h5
-rw-r--r--arch/arm/include/asm/kvm_host.h13
-rw-r--r--arch/arm/include/asm/kvm_vgic.h220
-rw-r--r--arch/arm/include/asm/mach/arch.h5
-rw-r--r--arch/arm/include/asm/mach/pci.h17
-rw-r--r--arch/arm/include/asm/memory.h24
-rw-r--r--arch/arm/include/asm/mmu_context.h23
-rw-r--r--arch/arm/include/asm/mpu.h76
-rw-r--r--arch/arm/include/asm/page.h2
-rw-r--r--arch/arm/include/asm/percpu.h11
-rw-r--r--arch/arm/include/asm/pgtable-3level-hwdef.h24
-rw-r--r--arch/arm/include/asm/pgtable-3level.h96
-rw-r--r--arch/arm/include/asm/pgtable-nommu.h2
-rw-r--r--arch/arm/include/asm/pgtable.h10
-rw-r--r--arch/arm/include/asm/proc-fns.h30
-rw-r--r--arch/arm/include/asm/psci.h9
-rw-r--r--arch/arm/include/asm/ptrace.h4
-rw-r--r--arch/arm/include/asm/smp.h5
-rw-r--r--arch/arm/include/asm/smp_plat.h24
-rw-r--r--arch/arm/include/asm/spinlock.h25
-rw-r--r--arch/arm/include/asm/suspend.h5
-rw-r--r--arch/arm/include/asm/system_info.h1
-rw-r--r--arch/arm/include/asm/thread_info.h2
-rw-r--r--arch/arm/include/asm/tlb.h6
-rw-r--r--arch/arm/include/asm/tlbflush.h27
-rw-r--r--arch/arm/include/asm/tls.h40
-rw-r--r--arch/arm/include/asm/v7m.h44
-rw-r--r--arch/arm/include/asm/xen/page.h3
-rw-r--r--arch/arm/include/debug/imx-uart.h10
-rw-r--r--arch/arm/include/debug/keystone.S43
-rw-r--r--arch/arm/include/debug/mvebu.S5
-rw-r--r--arch/arm/include/debug/nspire.S28
-rw-r--r--arch/arm/include/debug/rockchip.S42
-rw-r--r--arch/arm/include/debug/sti.S61
-rw-r--r--arch/arm/include/debug/u300.S (renamed from arch/arm/mach-u300/include/mach/debug-macro.S)9
-rw-r--r--arch/arm/include/debug/vexpress.S10
-rw-r--r--arch/arm/include/uapi/asm/hwcap.h2
-rw-r--r--arch/arm/include/uapi/asm/ptrace.h35
-rw-r--r--arch/arm/kernel/Makefile18
-rw-r--r--arch/arm/kernel/asm-offsets.c6
-rw-r--r--arch/arm/kernel/bios32.c9
-rw-r--r--arch/arm/kernel/devtree.c10
-rw-r--r--arch/arm/kernel/entry-armv.S5
-rw-r--r--arch/arm/kernel/entry-common.S46
-rw-r--r--arch/arm/kernel/entry-header.S124
-rw-r--r--arch/arm/kernel/entry-v7m.S143
-rw-r--r--arch/arm/kernel/head-nommu.S170
-rw-r--r--arch/arm/kernel/head.S10
-rw-r--r--arch/arm/kernel/hyp-stub.S7
-rw-r--r--arch/arm/kernel/machine_kexec.c4
-rw-r--r--arch/arm/kernel/module.c8
-rw-r--r--arch/arm/kernel/perf_event.c1
-rw-r--r--arch/arm/kernel/process.c47
-rw-r--r--arch/arm/kernel/psci.c7
-rw-r--r--arch/arm/kernel/psci_smp.c84
-rw-r--r--arch/arm/kernel/ptrace.c2
-rw-r--r--arch/arm/kernel/setup.c110
-rw-r--r--arch/arm/kernel/signal.c9
-rw-r--r--arch/arm/kernel/sleep.S97
-rw-r--r--arch/arm/kernel/smp.c34
-rw-r--r--arch/arm/kernel/smp_tlb.c18
-rw-r--r--arch/arm/kernel/suspend.c76
-rw-r--r--arch/arm/kernel/topology.c2
-rw-r--r--arch/arm/kernel/traps.c12
-rw-r--r--arch/arm/kernel/vmlinux.lds.S4
-rw-r--r--arch/arm/kvm/Kconfig8
-rw-r--r--arch/arm/kvm/Makefile7
-rw-r--r--arch/arm/kvm/arch_timer.c272
-rw-r--r--arch/arm/kvm/arm.c8
-rw-r--r--arch/arm/kvm/coproc.c4
-rw-r--r--arch/arm/kvm/handle_exit.c3
-rw-r--r--arch/arm/kvm/interrupts.S16
-rw-r--r--arch/arm/kvm/interrupts_head.S14
-rw-r--r--arch/arm/kvm/mmio.c6
-rw-r--r--arch/arm/kvm/mmu.c3
-rw-r--r--arch/arm/kvm/psci.c2
-rw-r--r--arch/arm/kvm/reset.c12
-rw-r--r--arch/arm/kvm/vgic.c1499
-rw-r--r--arch/arm/mach-at91/Kconfig1
-rw-r--r--arch/arm/mach-at91/Kconfig.non_dt169
-rw-r--r--arch/arm/mach-at91/Makefile6
-rw-r--r--arch/arm/mach-at91/at91rm9200.c8
-rw-r--r--arch/arm/mach-at91/at91sam9260.c4
-rw-r--r--arch/arm/mach-at91/at91sam9261.c4
-rw-r--r--arch/arm/mach-at91/at91sam9263.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c4
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c2
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c2
-rw-r--r--arch/arm/mach-at91/at91x40.c7
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c3
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c228
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c28
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c384
-rw-r--r--arch/arm/mach-at91/clock.c30
-rw-r--r--arch/arm/mach-at91/cpuidle.c2
-rw-r--r--arch/arm/mach-at91/generic.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h3
-rw-r--r--arch/arm/mach-at91/irq.c9
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-at91/setup.c4
-rw-r--r--arch/arm/mach-at91/soc.h1
-rw-r--r--arch/arm/mach-bcm/board_bcm.c2
-rw-r--r--arch/arm/mach-clps711x/Kconfig3
-rw-r--r--arch/arm/mach-clps711x/Makefile5
-rw-r--r--arch/arm/mach-clps711x/board-autcpu12.c133
-rw-r--r--arch/arm/mach-clps711x/board-cdb89712.c3
-rw-r--r--arch/arm/mach-clps711x/board-clep7312.c1
-rw-r--r--arch/arm/mach-clps711x/board-edb7211.c34
-rw-r--r--arch/arm/mach-clps711x/board-fortunet.c1
-rw-r--r--arch/arm/mach-clps711x/board-p720t.c254
-rw-r--r--arch/arm/mach-clps711x/common.c89
-rw-r--r--arch/arm/mach-clps711x/common.h1
-rw-r--r--arch/arm/mach-clps711x/devices.c68
-rw-r--r--arch/arm/mach-clps711x/devices.h12
-rw-r--r--arch/arm/mach-clps711x/include/mach/autcpu12.h59
-rw-r--r--arch/arm/mach-clps711x/include/mach/clps711x.h88
-rw-r--r--arch/arm/mach-clps711x/include/mach/hardware.h7
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h41
-rw-r--r--arch/arm/mach-clps711x/include/mach/syspld.h116
-rw-r--r--arch/arm/mach-davinci/Kconfig1
-rw-r--r--arch/arm/mach-davinci/Makefile2
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c1
-rw-r--r--arch/arm/mach-davinci/board-tnetv107x-evm.c2
-rw-r--r--arch/arm/mach-davinci/da850.c8
-rw-r--r--arch/arm/mach-davinci/davinci.h30
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c8
-rw-r--r--arch/arm/mach-davinci/devices-tnetv107x.c6
-rw-r--r--arch/arm/mach-davinci/devices.c6
-rw-r--r--arch/arm/mach-davinci/dm355.c6
-rw-r--r--arch/arm/mach-davinci/dm365.c6
-rw-r--r--arch/arm/mach-davinci/dm644x.c6
-rw-r--r--arch/arm/mach-davinci/dm646x.c6
-rw-r--r--arch/arm/mach-davinci/include/mach/cp_intc.h4
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h18
-rw-r--r--arch/arm/mach-davinci/include/mach/edma.h267
-rw-r--r--arch/arm/mach-davinci/include/mach/tnetv107x.h6
-rw-r--r--arch/arm/mach-dove/Kconfig3
-rw-r--r--arch/arm/mach-dove/board-dt.c3
-rw-r--r--arch/arm/mach-dove/common.c1
-rw-r--r--arch/arm/mach-ebsa110/core.c2
-rw-r--r--arch/arm/mach-exynos/Kconfig364
-rw-r--r--arch/arm/mach-exynos/Makefile33
-rw-r--r--arch/arm/mach-exynos/common.c565
-rw-r--r--arch/arm/mach-exynos/common.h4
-rw-r--r--arch/arm/mach-exynos/dev-ahci.c255
-rw-r--r--arch/arm/mach-exynos/dev-audio.c254
-rw-r--r--arch/arm/mach-exynos/dev-ohci.c52
-rw-r--r--arch/arm/mach-exynos/dev-uart.c55
-rw-r--r--arch/arm/mach-exynos/dma.c322
-rw-r--r--arch/arm/mach-exynos/firmware.c22
-rw-r--r--arch/arm/mach-exynos/include/mach/gpio.h289
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h476
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h214
-rw-r--r--arch/arm/mach-exynos/include/mach/pm-core.h12
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-gpio.h40
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-usb-phy.h74
-rw-r--r--arch/arm/mach-exynos/include/mach/uncompress.h10
-rw-r--r--arch/arm/mach-exynos/mach-armlex4210.c207
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c8
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c9
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c1388
-rw-r--r--arch/arm/mach-exynos/mach-origen.c823
-rw-r--r--arch/arm/mach-exynos/mach-smdk4x12.c396
-rw-r--r--arch/arm/mach-exynos/mach-smdkv310.c444
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c1159
-rw-r--r--arch/arm/mach-exynos/platsmp.c14
-rw-r--r--arch/arm/mach-exynos/pm.c1
-rw-r--r--arch/arm/mach-exynos/pm_domains.c101
-rw-r--r--arch/arm/mach-exynos/setup-fimc.c44
-rw-r--r--arch/arm/mach-exynos/setup-fimd0.c43
-rw-r--r--arch/arm/mach-exynos/setup-i2c0.c29
-rw-r--r--arch/arm/mach-exynos/setup-i2c1.c23
-rw-r--r--arch/arm/mach-exynos/setup-i2c2.c23
-rw-r--r--arch/arm/mach-exynos/setup-i2c3.c23
-rw-r--r--arch/arm/mach-exynos/setup-i2c4.c23
-rw-r--r--arch/arm/mach-exynos/setup-i2c5.c23
-rw-r--r--arch/arm/mach-exynos/setup-i2c6.c23
-rw-r--r--arch/arm/mach-exynos/setup-i2c7.c23
-rw-r--r--arch/arm/mach-exynos/setup-keypad.c36
-rw-r--r--arch/arm/mach-exynos/setup-sdhci-gpio.c152
-rw-r--r--arch/arm/mach-exynos/setup-spi.c45
-rw-r--r--arch/arm/mach-exynos/setup-usb-phy.c223
-rw-r--r--arch/arm/mach-highbank/highbank.c1
-rw-r--r--arch/arm/mach-imx/Kconfig65
-rw-r--r--arch/arm/mach-imx/Makefile4
-rw-r--r--arch/arm/mach-imx/clk-imx51-imx53.c75
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c48
-rw-r--r--arch/arm/mach-imx/clk-imx6sl.c267
-rw-r--r--arch/arm/mach-imx/clk-pllv3.c10
-rw-r--r--arch/arm/mach-imx/clk-vf610.c319
-rw-r--r--arch/arm/mach-imx/clk.c35
-rw-r--r--arch/arm/mach-imx/clk.h4
-rw-r--r--arch/arm/mach-imx/common.h2
-rw-r--r--arch/arm/mach-imx/hardware.h1
-rw-r--r--arch/arm/mach-imx/imx25-dt.c2
-rw-r--r--arch/arm/mach-imx/imx27-dt.c2
-rw-r--r--arch/arm/mach-imx/imx31-dt.c2
-rw-r--r--arch/arm/mach-imx/imx51-dt.c2
-rw-r--r--arch/arm/mach-imx/irq-common.c1
-rw-r--r--arch/arm/mach-imx/mach-imx53.c17
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c81
-rw-r--r--arch/arm/mach-imx/mach-imx6sl.c52
-rw-r--r--arch/arm/mach-imx/mach-mx31moboard.c9
-rw-r--r--arch/arm/mach-imx/mach-pca100.c4
-rw-r--r--arch/arm/mach-imx/mach-vf610.c48
-rw-r--r--arch/arm/mach-imx/mm-imx1.c2
-rw-r--r--arch/arm/mach-imx/mm-imx21.c2
-rw-r--r--arch/arm/mach-imx/mm-imx25.c2
-rw-r--r--arch/arm/mach-imx/mm-imx27.c2
-rw-r--r--arch/arm/mach-imx/mm-imx3.c6
-rw-r--r--arch/arm/mach-imx/mm-imx5.c3
-rw-r--r--arch/arm/mach-imx/system.c47
-rw-r--r--arch/arm/mach-imx/ulpi.c118
-rw-r--r--arch/arm/mach-imx/ulpi.h11
-rw-r--r--arch/arm/mach-integrator/Makefile2
-rw-r--r--arch/arm/mach-integrator/include/mach/platform.h23
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c31
-rw-r--r--arch/arm/mach-integrator/pci.c113
-rw-r--r--arch/arm/mach-integrator/pci_v3.c564
-rw-r--r--arch/arm/mach-integrator/pci_v3.h2
-rw-r--r--arch/arm/mach-iop13xx/io.c2
-rw-r--r--arch/arm/mach-iop13xx/setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig1
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-keystone/Kconfig15
-rw-r--r--arch/arm/mach-keystone/Makefile6
-rw-r--r--arch/arm/mach-keystone/Makefile.boot1
-rw-r--r--arch/arm/mach-keystone/keystone.c75
-rw-r--r--arch/arm/mach-keystone/keystone.h23
-rw-r--r--arch/arm/mach-keystone/platsmp.c43
-rw-r--r--arch/arm/mach-keystone/smc.S29
-rw-r--r--arch/arm/mach-kirkwood/Kconfig33
-rw-r--r--arch/arm/mach-kirkwood/Makefile4
-rw-r--r--arch/arm/mach-kirkwood/board-db88f628x-bp.c24
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c22
-rw-r--r--arch/arm/mach-kirkwood/board-iconnect.c8
-rw-r--r--arch/arm/mach-kirkwood/board-lsxl.c16
-rw-r--r--arch/arm/mach-kirkwood/board-mplcec4.c1
-rw-r--r--arch/arm/mach-kirkwood/board-nsa310.c25
-rw-r--r--arch/arm/mach-kirkwood/board-readynas.c1
-rw-r--r--arch/arm/mach-kirkwood/board-sheevaplug.c27
-rw-r--r--arch/arm/mach-kirkwood/board-ts219.c3
-rw-r--r--arch/arm/mach-kirkwood/common.c47
-rw-r--r--arch/arm/mach-kirkwood/common.h13
-rw-r--r--arch/arm/mach-kirkwood/db88f6281-bp-setup.c108
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h2
-rw-r--r--arch/arm/mach-kirkwood/mpp.c5
-rw-r--r--arch/arm/mach-kirkwood/pcie.c22
-rw-r--r--arch/arm/mach-mmp/aspenite.c10
-rw-r--r--arch/arm/mach-mmp/teton_bga.c8
-rw-r--r--arch/arm/mach-msm/Kconfig13
-rw-r--r--arch/arm/mach-msm/Makefile16
-rw-r--r--arch/arm/mach-msm/board-dt-8660.c2
-rw-r--r--arch/arm/mach-msm/board-dt-8960.c2
-rw-r--r--arch/arm/mach-msm/board-halibut.c2
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c2
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c2
-rw-r--r--arch/arm/mach-msm/board-trout-panel.c19
-rw-r--r--arch/arm/mach-msm/board-trout.c3
-rw-r--r--arch/arm/mach-msm/clock-7x30.h155
-rw-r--r--arch/arm/mach-msm/clock-debug.c130
-rw-r--r--arch/arm/mach-msm/clock-pcom.c149
-rw-r--r--arch/arm/mach-msm/clock-pcom.h31
-rw-r--r--arch/arm/mach-msm/clock.c166
-rw-r--r--arch/arm/mach-msm/clock.h51
-rw-r--r--arch/arm/mach-msm/common.h2
-rw-r--r--arch/arm/mach-msm/core.h2
-rw-r--r--arch/arm/mach-msm/devices-msm7x00.c12
-rw-r--r--arch/arm/mach-msm/devices-msm7x30.c15
-rw-r--r--arch/arm/mach-msm/devices-qsd8x50.c12
-rw-r--r--arch/arm/mach-msm/devices.h15
-rw-r--r--arch/arm/mach-msm/dma.c5
-rw-r--r--arch/arm/mach-msm/gpiomux-v2.c25
-rw-r--r--arch/arm/mach-msm/gpiomux-v2.h61
-rw-r--r--arch/arm/mach-msm/gpiomux.c15
-rw-r--r--arch/arm/mach-msm/gpiomux.h5
-rw-r--r--arch/arm/mach-msm/include/mach/board.h5
-rw-r--r--arch/arm/mach-msm/include/mach/clk.h9
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8960.h7
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8x60.h6
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap.h2
-rw-r--r--arch/arm/mach-msm/io.c6
-rw-r--r--arch/arm/mach-mvebu/Kconfig7
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.c57
-rw-r--r--arch/arm/mach-mvebu/armada-370-xp.h10
-rw-r--r--arch/arm/mach-mvebu/coherency.c45
-rw-r--r--arch/arm/mach-mvebu/coherency.h4
-rw-r--r--arch/arm/mach-mvebu/common.h2
-rw-r--r--arch/arm/mach-mvebu/headsmp.S16
-rw-r--r--arch/arm/mach-mvebu/platsmp.c10
-rw-r--r--arch/arm/mach-mxs/Kconfig3
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c130
-rw-r--r--arch/arm/mach-mxs/pm.h4
-rw-r--r--arch/arm/mach-nomadik/Kconfig1
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c75
-rw-r--r--arch/arm/mach-nspire/Kconfig16
-rw-r--r--arch/arm/mach-nspire/Makefile2
-rw-r--r--arch/arm/mach-nspire/Makefile.boot0
-rw-r--r--arch/arm/mach-nspire/clcd.c119
-rw-r--r--arch/arm/mach-nspire/clcd.h14
-rw-r--r--arch/arm/mach-nspire/mmio.h20
-rw-r--r--arch/arm/mach-nspire/nspire.c89
-rw-r--r--arch/arm/mach-omap1/Makefile4
-rw-r--r--arch/arm/mach-omap1/board-h2.c36
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c10
-rw-r--r--arch/arm/mach-omap1/board-palmte.c31
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c30
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c31
-rw-r--r--arch/arm/mach-omap1/board-sx1.c36
-rw-r--r--arch/arm/mach-omap1/devices.c9
-rw-r--r--arch/arm/mach-omap1/dma.c2
-rw-r--r--arch/arm/mach-omap1/dma.h42
-rw-r--r--arch/arm/mach-omap1/include/mach/irda.h33
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c2
-rw-r--r--arch/arm/mach-omap1/mailbox.c199
-rw-r--r--arch/arm/mach-omap1/mcbsp.c33
-rw-r--r--arch/arm/mach-omap2/Kconfig32
-rw-r--r--arch/arm/mach-omap2/Makefile26
-rw-r--r--arch/arm/mach-omap2/am33xx.h1
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c765
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c3
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c1
-rw-r--r--arch/arm/mach-omap2/board-flash.c3
-rw-r--r--arch/arm/mach-omap2/board-generic.c16
-rw-r--r--arch/arm/mach-omap2/board-ldp.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c4
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c455
-rw-r--r--arch/arm/mach-omap2/board-overo.c3
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c1
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c79
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c11
-rw-r--r--arch/arm/mach-omap2/clock36xx.c18
-rw-r--r--arch/arm/mach-omap2/clockdomain.h1
-rw-r--r--arch/arm/mach-omap2/clockdomains54xx_data.c464
-rw-r--r--arch/arm/mach-omap2/cm-regbits-54xx.h1737
-rw-r--r--arch/arm/mach-omap2/cm1_44xx.h7
-rw-r--r--arch/arm/mach-omap2/cm1_54xx.h213
-rw-r--r--arch/arm/mach-omap2/cm2_44xx.h7
-rw-r--r--arch/arm/mach-omap2/cm2_54xx.h389
-rw-r--r--arch/arm/mach-omap2/cm33xx.h2
-rw-r--r--arch/arm/mach-omap2/cm_44xx_54xx.h36
-rw-r--r--arch/arm/mach-omap2/common.h5
-rw-r--r--arch/arm/mach-omap2/control.c1
-rw-r--r--arch/arm/mach-omap2/control.h12
-rw-r--r--arch/arm/mach-omap2/devices.c158
-rw-r--r--arch/arm/mach-omap2/dma.h61
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c44
-rw-r--r--arch/arm/mach-omap2/gpmc.c82
-rw-r--r--arch/arm/mach-omap2/hsmmc.c103
-rw-r--r--arch/arm/mach-omap2/id.c34
-rw-r--r--arch/arm/mach-omap2/io.c26
-rw-r--r--arch/arm/mach-omap2/mailbox.c430
-rw-r--r--arch/arm/mach-omap2/mux.h3
-rw-r--r--arch/arm/mach-omap2/mux44xx.c1356
-rw-r--r--arch/arm/mach-omap2/mux44xx.h298
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S8
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c69
-rw-r--r--arch/arm/mach-omap2/omap-smp.c6
-rw-r--r--arch/arm/mach-omap2/omap4-common.c16
-rw-r--r--arch/arm/mach-omap2/omap4-restart.c27
-rw-r--r--arch/arm/mach-omap2/omap_device.c16
-rw-r--r--arch/arm/mach-omap2/omap_device.h10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h1
-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_ipblock_data.c21
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c1070
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c32
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c1544
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c2150
-rw-r--r--arch/arm/mach-omap2/pm34xx.c6
-rw-r--r--arch/arm/mach-omap2/pm44xx.c58
-rw-r--r--arch/arm/mach-omap2/powerdomain.c5
-rw-r--r--arch/arm/mach-omap2/powerdomain.h3
-rw-r--r--arch/arm/mach-omap2/powerdomains3xxx_data.c62
-rw-r--r--arch/arm/mach-omap2/powerdomains54xx_data.c331
-rw-r--r--arch/arm/mach-omap2/prcm-common.h11
-rw-r--r--arch/arm/mach-omap2/prcm44xx.h6
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h14
-rw-r--r--arch/arm/mach-omap2/prcm_mpu54xx.h87
-rw-r--r--arch/arm/mach-omap2/prcm_mpu_44xx_54xx.h36
-rw-r--r--arch/arm/mach-omap2/prm-regbits-54xx.h2701
-rw-r--r--arch/arm/mach-omap2/prm33xx.c7
-rw-r--r--arch/arm/mach-omap2/prm44xx.h33
-rw-r--r--arch/arm/mach-omap2/prm44xx_54xx.h58
-rw-r--r--arch/arm/mach-omap2/prm54xx.h421
-rw-r--r--arch/arm/mach-omap2/scrm54xx.h231
-rw-r--r--arch/arm/mach-omap2/serial.c10
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c8
-rw-r--r--arch/arm/mach-omap2/soc.h26
-rw-r--r--arch/arm/mach-omap2/sram.c3
-rw-r--r--arch/arm/mach-omap2/timer.c2
-rw-r--r--arch/arm/mach-omap2/twl-common.c1
-rw-r--r--arch/arm/mach-omap2/usb-host.c300
-rw-r--r--arch/arm/mach-omap2/usb-musb.c3
-rw-r--r--arch/arm/mach-omap2/voltage.h2
-rw-r--r--arch/arm/mach-omap2/voltagedomains33xx_data.c43
-rw-r--r--arch/arm/mach-omap2/voltagedomains54xx_data.c92
-rw-r--r--arch/arm/mach-picoxcell/Kconfig1
-rw-r--r--arch/arm/mach-picoxcell/common.c10
-rw-r--r--arch/arm/mach-picoxcell/common.h17
-rw-r--r--arch/arm/mach-prima2/common.c21
-rw-r--r--arch/arm/mach-prima2/pm.c8
-rw-r--r--arch/arm/mach-prima2/rstc.c6
-rw-r--r--arch/arm/mach-pxa/Kconfig3
-rw-r--r--arch/arm/mach-pxa/em-x270.c20
-rw-r--r--arch/arm/mach-pxa/ezx.c60
-rw-r--r--arch/arm/mach-pxa/littleton.c10
-rw-r--r--arch/arm/mach-pxa/mainstone.c10
-rw-r--r--arch/arm/mach-pxa/mioa701.c11
-rw-r--r--arch/arm/mach-pxa/palmld.c10
-rw-r--r--arch/arm/mach-pxa/palmt5.c10
-rw-r--r--arch/arm/mach-pxa/palmtreo.c23
-rw-r--r--arch/arm/mach-pxa/palmtx.c10
-rw-r--r--arch/arm/mach-pxa/palmz72.c10
-rw-r--r--arch/arm/mach-pxa/tavorevb.c10
-rw-r--r--arch/arm/mach-pxa/z2.c10
-rw-r--r--arch/arm/mach-pxa/zylonite.c10
-rw-r--r--arch/arm/mach-rockchip/Kconfig16
-rw-r--r--arch/arm/mach-rockchip/Makefile1
-rw-r--r--arch/arm/mach-rockchip/rockchip.c52
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig80
-rw-r--r--arch/arm/mach-s3c24xx/Makefile7
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-debugfs.c198
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-s3c2410.c160
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-s3c2412.c258
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-s3c2440.c312
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq-utils.c2
-rw-r--r--arch/arm/mach-s3c24xx/cpufreq.c711
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2412.c56
-rw-r--r--arch/arm/mach-s3c24xx/dma-s3c2443.c3
-rw-r--r--arch/arm/mach-s3c24xx/dma.c3
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/s3c2412.h (renamed from arch/arm/mach-s3c24xx/s3c2412.h)0
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/uncompress.h3
-rw-r--r--arch/arm/mach-s3c24xx/iotiming-s3c2412.c2
-rw-r--r--arch/arm/mach-s3c24xx/mach-s3c2416-dt.c91
-rw-r--r--arch/arm/mach-s3c24xx/pll-s3c2410.c54
-rw-r--r--arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c54
-rw-r--r--arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c110
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c3
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c3
-rw-r--r--arch/arm/mach-s3c64xx/common.c8
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/uncompress.h3
-rw-r--r--arch/arm/mach-s5p64x0/common.c4
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/uncompress.h162
-rw-r--r--arch/arm/mach-s5pc100/common.c3
-rw-r--r--arch/arm/mach-s5pc100/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-s5pv210/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-shmobile/Kconfig79
-rw-r--r--arch/arm/mach-shmobile/Makefile3
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot18
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c1332
-rw-r--r--arch/arm/mach-shmobile/board-ape6evm.c15
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva-reference.c213
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c116
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c180
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c495
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c2
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g-reference.c1
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c204
-rw-r--r--arch/arm/mach-shmobile/board-lager.c64
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c171
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c191
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c387
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c11
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c183
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c255
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c6
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c111
-rw-r--r--arch/arm/mach-shmobile/headsmp-scu.S29
-rw-r--r--arch/arm/mach-shmobile/headsmp.S13
-rw-r--r--arch/arm/mach-shmobile/include/mach/clock.h8
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h6
-rw-r--r--arch/arm/mach-shmobile/include/mach/head-ap4evb.txt93
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h5
-rw-r--r--arch/arm/mach-shmobile/include/mach/memory.h7
-rw-r--r--arch/arm/mach-shmobile/include/mach/mmc-ap4eb.h29
-rw-r--r--arch/arm/mach-shmobile/include/mach/mmc.h4
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7740.h491
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7778.h11
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h3
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h393
-rw-r--r--arch/arm/mach-shmobile/include/mach/zboot.h6
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7740.c24
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c3
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c78
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c262
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c215
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c60
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c95
-rw-r--r--arch/arm/mach-shmobile/sleep-sh7372.S5
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c6
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c6
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c6
-rw-r--r--arch/arm/mach-socfpga/Kconfig2
-rw-r--r--arch/arm/mach-socfpga/socfpga.c2
-rw-r--r--arch/arm/mach-spear/spear1310.c2
-rw-r--r--arch/arm/mach-spear/spear1340.c2
-rw-r--r--arch/arm/mach-spear/spear300.c2
-rw-r--r--arch/arm/mach-spear/spear310.c2
-rw-r--r--arch/arm/mach-spear/spear320.c2
-rw-r--r--arch/arm/mach-spear/spear6xx.c2
-rw-r--r--arch/arm/mach-sti/Kconfig45
-rw-r--r--arch/arm/mach-sti/Makefile2
-rw-r--r--arch/arm/mach-sti/board-dt.c48
-rw-r--r--arch/arm/mach-sti/headsmp.S44
-rw-r--r--arch/arm/mach-sti/platsmp.c117
-rw-r--r--arch/arm/mach-sti/smp.h17
-rw-r--r--arch/arm/mach-sunxi/sunxi.c20
-rw-r--r--arch/arm/mach-sunxi/sunxi.h20
-rw-r--r--arch/arm/mach-tegra/Kconfig5
-rw-r--r--arch/arm/mach-tegra/Makefile1
-rw-r--r--arch/arm/mach-tegra/common.c6
-rw-r--r--arch/arm/mach-tegra/common.h1
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra20.c10
-rw-r--r--arch/arm/mach-tegra/cpuidle-tegra30.c10
-rw-r--r--arch/arm/mach-tegra/cpuidle.c19
-rw-r--r--arch/arm/mach-tegra/cpuidle.h15
-rw-r--r--arch/arm/mach-tegra/flowctrl.h1
-rw-r--r--arch/arm/mach-tegra/fuse.h22
-rw-r--r--arch/arm/mach-tegra/hotplug.c13
-rw-r--r--arch/arm/mach-tegra/platsmp.c26
-rw-r--r--arch/arm/mach-tegra/pm.c25
-rw-r--r--arch/arm/mach-tegra/pm.h4
-rw-r--r--arch/arm/mach-tegra/pmc.c2
-rw-r--r--arch/arm/mach-tegra/reset-handler.S51
-rw-r--r--arch/arm/mach-tegra/sleep-tegra30.S30
-rw-r--r--arch/arm/mach-tegra/sleep.S8
-rw-r--r--arch/arm/mach-tegra/sleep.h35
-rw-r--r--arch/arm/mach-tegra/tegra2_emc.c2
-rw-r--r--arch/arm/mach-u300/Kconfig32
-rw-r--r--arch/arm/mach-u300/Makefile2
-rw-r--r--arch/arm/mach-u300/core.c759
-rw-r--r--arch/arm/mach-u300/dummyspichip.c20
-rw-r--r--arch/arm/mach-u300/i2c.c285
-rw-r--r--arch/arm/mach-u300/i2c.h23
-rw-r--r--arch/arm/mach-u300/include/mach/hardware.h5
-rw-r--r--arch/arm/mach-u300/include/mach/irqs.h80
-rw-r--r--arch/arm/mach-u300/include/mach/syscon.h592
-rw-r--r--arch/arm/mach-u300/include/mach/timex.h17
-rw-r--r--arch/arm/mach-u300/include/mach/u300-regs.h165
-rw-r--r--arch/arm/mach-u300/include/mach/uncompress.h45
-rw-r--r--arch/arm/mach-u300/regulator.c67
-rw-r--r--arch/arm/mach-u300/spi.c102
-rw-r--r--arch/arm/mach-u300/spi.h26
-rw-r--r--arch/arm/mach-u300/timer.c113
-rw-r--r--arch/arm/mach-u300/timer.h1
-rw-r--r--arch/arm/mach-u300/u300-gpio.h70
-rw-r--r--arch/arm/mach-ux500/board-mop500-audio.c68
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c283
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c1
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c90
-rw-r--r--arch/arm/mach-ux500/board-mop500.c94
-rw-r--r--arch/arm/mach-ux500/board-mop500.h2
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c3
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c92
-rw-r--r--arch/arm/mach-ux500/cpu.c6
-rw-r--r--arch/arm/mach-ux500/db8500-regs.h3
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c125
-rw-r--r--arch/arm/mach-ux500/id.c6
-rw-r--r--arch/arm/mach-ux500/ste-dma40-db8500.h193
-rw-r--r--arch/arm/mach-ux500/usb.c47
-rw-r--r--arch/arm/mach-vexpress/Kconfig9
-rw-r--r--arch/arm/mach-vexpress/Makefile1
-rw-r--r--arch/arm/mach-vexpress/core.h2
-rw-r--r--arch/arm/mach-vexpress/dcscb.c253
-rw-r--r--arch/arm/mach-vexpress/dcscb_setup.S38
-rw-r--r--arch/arm/mach-vexpress/platsmp.c20
-rw-r--r--arch/arm/mach-vexpress/v2m.c3
-rw-r--r--arch/arm/mach-virt/Kconfig2
-rw-r--r--arch/arm/mach-virt/Makefile1
-rw-r--r--arch/arm/mach-virt/platsmp.c50
-rw-r--r--arch/arm/mach-virt/virt.c5
-rw-r--r--arch/arm/mach-vt8500/vt8500.c2
-rw-r--r--arch/arm/mach-zynq/common.c3
-rw-r--r--arch/arm/mach-zynq/platsmp.c52
-rw-r--r--arch/arm/mach-zynq/slcr.c2
-rw-r--r--arch/arm/mm/Kconfig24
-rw-r--r--arch/arm/mm/Makefile3
-rw-r--r--arch/arm/mm/cache-l2x0.c158
-rw-r--r--arch/arm/mm/cache-nop.S50
-rw-r--r--arch/arm/mm/cache-v7.S8
-rw-r--r--arch/arm/mm/context.c64
-rw-r--r--arch/arm/mm/dma-mapping.c22
-rw-r--r--arch/arm/mm/fault.c2
-rw-r--r--arch/arm/mm/flush.c60
-rw-r--r--arch/arm/mm/fsr-3level.c4
-rw-r--r--arch/arm/mm/hugetlbpage.c101
-rw-r--r--arch/arm/mm/init.c77
-rw-r--r--arch/arm/mm/ioremap.c10
-rw-r--r--arch/arm/mm/mmu.c59
-rw-r--r--arch/arm/mm/nommu.c276
-rw-r--r--arch/arm/mm/proc-fa526.S1
-rw-r--r--arch/arm/mm/proc-macros.S5
-rw-r--r--arch/arm/mm/proc-v6.S6
-rw-r--r--arch/arm/mm/proc-v7-3level.S53
-rw-r--r--arch/arm/mm/proc-v7.S65
-rw-r--r--arch/arm/mm/proc-v7m.S157
-rw-r--r--arch/arm/plat-iop/adma.c2
-rw-r--r--arch/arm/plat-omap/Kconfig16
-rw-r--r--arch/arm/plat-omap/Makefile3
-rw-r--r--arch/arm/plat-omap/dma.c11
-rw-r--r--arch/arm/plat-omap/include/plat/mailbox.h105
-rw-r--r--arch/arm/plat-omap/mailbox.c435
-rw-r--r--arch/arm/plat-orion/common.c10
-rw-r--r--arch/arm/plat-orion/gpio.c2
-rw-r--r--arch/arm/plat-samsung/Kconfig53
-rw-r--r--arch/arm/plat-samsung/Makefile12
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu-freq-core.h12
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu-freq.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h8
-rw-r--r--arch/arm/plat-samsung/include/plat/dma-s3c24xx.h5
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h5
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-watchdog.h41
-rw-r--r--arch/arm/plat-samsung/include/plat/uncompress.h21
-rw-r--r--arch/arm/plat-samsung/include/plat/watchdog-reset.h38
-rw-r--r--arch/arm/plat-samsung/init.c8
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c5
-rw-r--r--arch/arm/plat-samsung/pm.c26
-rw-r--r--arch/arm/plat-samsung/s5p-dev-mfc.c11
-rw-r--r--arch/arm/plat-samsung/watchdog-reset.c97
-rw-r--r--arch/arm/plat-versatile/headsmp.S2
-rw-r--r--arch/arm64/Kconfig35
-rw-r--r--arch/arm64/Makefile6
-rw-r--r--arch/arm64/boot/dts/Makefile1
-rw-r--r--arch/arm64/boot/dts/apm-mustang.dts26
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi116
-rw-r--r--arch/arm64/configs/defconfig4
-rw-r--r--arch/arm64/include/asm/arch_timer.h10
-rw-r--r--arch/arm64/include/asm/cacheflush.h3
-rw-r--r--arch/arm64/include/asm/cputype.h3
-rw-r--r--arch/arm64/include/asm/debug-monitors.h9
-rw-r--r--arch/arm64/include/asm/device.h3
-rw-r--r--arch/arm64/include/asm/dma-mapping.h17
-rw-r--r--arch/arm64/include/asm/hugetlb.h117
-rw-r--r--arch/arm64/include/asm/hypervisor.h6
-rw-r--r--arch/arm64/include/asm/io.h2
-rw-r--r--arch/arm64/include/asm/kvm_arm.h245
-rw-r--r--arch/arm64/include/asm/kvm_asm.h104
-rw-r--r--arch/arm64/include/asm/kvm_coproc.h56
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h180
-rw-r--r--arch/arm64/include/asm/kvm_host.h202
-rw-r--r--arch/arm64/include/asm/kvm_mmio.h59
-rw-r--r--arch/arm64/include/asm/kvm_mmu.h135
-rw-r--r--arch/arm64/include/asm/kvm_psci.h (renamed from arch/arm/mach-msm/gpiomux-8x60.c)20
-rw-r--r--arch/arm64/include/asm/memory.h6
-rw-r--r--arch/arm64/include/asm/mmu_context.h6
-rw-r--r--arch/arm64/include/asm/pgtable-hwdef.h30
-rw-r--r--arch/arm64/include/asm/pgtable.h119
-rw-r--r--arch/arm64/include/asm/ptrace.h2
-rw-r--r--arch/arm64/include/asm/spinlock.h3
-rw-r--r--arch/arm64/include/asm/sync_bitops.h26
-rw-r--r--arch/arm64/include/asm/timex.h6
-rw-r--r--arch/arm64/include/asm/tlb.h6
-rw-r--r--arch/arm64/include/asm/tlbflush.h2
-rw-r--r--arch/arm64/include/asm/uaccess.h4
-rw-r--r--arch/arm64/include/asm/xen/events.h21
-rw-r--r--arch/arm64/include/asm/xen/hypercall.h1
-rw-r--r--arch/arm64/include/asm/xen/hypervisor.h1
-rw-r--r--arch/arm64/include/asm/xen/interface.h1
-rw-r--r--arch/arm64/include/asm/xen/page.h1
-rw-r--r--arch/arm64/include/uapi/asm/kvm.h168
-rw-r--r--arch/arm64/kernel/asm-offsets.c33
-rw-r--r--arch/arm64/kernel/debug-monitors.c66
-rw-r--r--arch/arm64/kernel/perf_event.c1
-rw-r--r--arch/arm64/kernel/ptrace.c59
-rw-r--r--arch/arm64/kernel/time.c6
-rw-r--r--arch/arm64/kernel/traps.c5
-rw-r--r--arch/arm64/kernel/vmlinux.lds.S30
-rw-r--r--arch/arm64/kvm/Makefile23
-rw-r--r--arch/arm64/kvm/emulate.c158
-rw-r--r--arch/arm64/kvm/guest.c265
-rw-r--r--arch/arm64/kvm/handle_exit.c124
-rw-r--r--arch/arm64/kvm/hyp-init.S107
-rw-r--r--arch/arm64/kvm/hyp.S831
-rw-r--r--arch/arm64/kvm/inject_fault.c203
-rw-r--r--arch/arm64/kvm/regmap.c168
-rw-r--r--arch/arm64/kvm/reset.c112
-rw-r--r--arch/arm64/kvm/sys_regs.c1050
-rw-r--r--arch/arm64/kvm/sys_regs.h138
-rw-r--r--arch/arm64/kvm/sys_regs_generic_v8.c95
-rw-r--r--arch/arm64/mm/Makefile1
-rw-r--r--arch/arm64/mm/fault.c19
-rw-r--r--arch/arm64/mm/flush.c37
-rw-r--r--arch/arm64/mm/hugetlbpage.c70
-rw-r--r--arch/arm64/mm/init.c65
-rw-r--r--arch/arm64/mm/mm.h1
-rw-r--r--arch/arm64/mm/mmu.c20
-rw-r--r--arch/arm64/xen/Makefile2
-rw-r--r--arch/arm64/xen/hypercall.S92
-rw-r--r--arch/avr32/include/asm/pgtable.h3
-rw-r--r--arch/avr32/kernel/process.c2
-rw-r--r--arch/avr32/kernel/setup.c2
-rw-r--r--arch/avr32/kernel/vmlinux.lds.S4
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c2
-rw-r--r--arch/avr32/mm/init.c52
-rw-r--r--arch/blackfin/Kconfig3
-rw-r--r--arch/blackfin/Kconfig.debug7
-rw-r--r--arch/blackfin/include/asm/pgtable.h1
-rw-r--r--arch/blackfin/mach-bf527/boards/ad7160eval.c12
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c32
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c12
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c35
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c30
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c28
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c14
-rw-r--r--arch/blackfin/mach-bf609/boards/ezkit.c2
-rw-r--r--arch/blackfin/mm/init.c44
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/c6x/include/asm/pgtable.h1
-rw-r--r--arch/c6x/kernel/vmlinux.lds.S4
-rw-r--r--arch/c6x/mm/init.c18
-rw-r--r--arch/cris/Kconfig34
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c870
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig8
-rw-r--r--arch/cris/include/arch-v10/arch/bitops.h2
-rw-r--r--arch/cris/include/asm/Kbuild4
-rw-r--r--arch/cris/include/asm/io.h3
-rw-r--r--arch/cris/include/asm/linkage.h6
-rw-r--r--arch/cris/include/asm/page.h1
-rw-r--r--arch/cris/include/asm/pgtable.h3
-rw-r--r--arch/cris/mm/init.c37
-rw-r--r--arch/frv/Kconfig1
-rw-r--r--arch/frv/Kconfig.debug4
-rw-r--r--arch/frv/include/asm/pgtable.h3
-rw-r--r--arch/frv/include/asm/uaccess.h4
-rw-r--r--arch/frv/kernel/head.S5
-rw-r--r--arch/frv/kernel/pm.c8
-rw-r--r--arch/frv/kernel/setup.c15
-rw-r--r--arch/frv/kernel/sysctl.c4
-rw-r--r--arch/frv/kernel/traps.c2
-rw-r--r--arch/frv/mm/init.c57
-rw-r--r--arch/h8300/Kconfig118
-rw-r--r--arch/h8300/Kconfig.cpu4
-rw-r--r--arch/h8300/boot/compressed/Makefile2
-rw-r--r--arch/h8300/boot/compressed/misc.c1
-rw-r--r--arch/h8300/include/asm/Kbuild2
-rw-r--r--arch/h8300/include/asm/barrier.h2
-rw-r--r--arch/h8300/include/asm/linkage.h6
-rw-r--r--arch/h8300/include/asm/pgtable.h3
-rw-r--r--arch/h8300/include/asm/tlb.h15
-rw-r--r--arch/h8300/kernel/entry.S118
-rw-r--r--arch/h8300/kernel/syscalls.S648
-rw-r--r--arch/h8300/kernel/vmlinux.lds.S2
-rw-r--r--arch/h8300/lib/abs.S4
-rw-r--r--arch/h8300/lib/memcpy.S4
-rw-r--r--arch/h8300/lib/memset.S4
-rw-r--r--arch/h8300/mm/init.c44
-rw-r--r--arch/h8300/platform/h8300h/aki3068net/crt0_ram.S16
-rw-r--r--arch/h8300/platform/h8300h/generic/crt0_ram.S14
-rw-r--r--arch/h8300/platform/h8300h/generic/crt0_rom.S14
-rw-r--r--arch/h8300/platform/h8300h/h8max/crt0_ram.S16
-rw-r--r--arch/h8300/platform/h8s/edosk2674/crt0_ram.S16
-rw-r--r--arch/h8300/platform/h8s/edosk2674/crt0_rom.S14
-rw-r--r--arch/h8300/platform/h8s/generic/crt0_ram.S16
-rw-r--r--arch/h8300/platform/h8s/generic/crt0_rom.S12
-rw-r--r--arch/hexagon/include/asm/pgtable.h4
-rw-r--r--arch/hexagon/mm/init.c6
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/hp/common/sba_iommu.c24
-rw-r--r--arch/ia64/hp/sim/simscsi.c4
-rw-r--r--arch/ia64/include/asm/irqflags.h1
-rw-r--r--arch/ia64/include/asm/mutex.h10
-rw-r--r--arch/ia64/include/asm/pci.h10
-rw-r--r--arch/ia64/include/asm/pgtable.h3
-rw-r--r--arch/ia64/kernel/acpi.c4
-rw-r--r--arch/ia64/kernel/efi.c5
-rw-r--r--arch/ia64/kernel/err_inject.c8
-rw-r--r--arch/ia64/kernel/head.S2
-rw-r--r--arch/ia64/kernel/mca.c12
-rw-r--r--arch/ia64/kernel/numa.c4
-rw-r--r--arch/ia64/kernel/palinfo.c4
-rw-r--r--arch/ia64/kernel/pci-dma.c9
-rw-r--r--arch/ia64/kernel/perfmon.c20
-rw-r--r--arch/ia64/kernel/salinfo.c4
-rw-r--r--arch/ia64/kernel/setup.c10
-rw-r--r--arch/ia64/kernel/smpboot.c8
-rw-r--r--arch/ia64/kernel/topology.c18
-rw-r--r--arch/ia64/kernel/traps.c2
-rw-r--r--arch/ia64/kvm/Makefile7
-rw-r--r--arch/ia64/mm/contig.c14
-rw-r--r--arch/ia64/mm/discontig.c5
-rw-r--r--arch/ia64/mm/init.c41
-rw-r--r--arch/ia64/mm/numa.c2
-rw-r--r--arch/ia64/pci/pci.c239
-rw-r--r--arch/ia64/sn/kernel/io_init.c122
-rw-r--r--arch/ia64/sn/kernel/setup.c8
-rw-r--r--arch/ia64/xen/hypervisor.c2
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/m32r/Kconfig.debug7
-rw-r--r--arch/m32r/include/asm/pgtable.h3
-rw-r--r--arch/m32r/include/asm/uaccess.h12
-rw-r--r--arch/m32r/mm/discontig.c6
-rw-r--r--arch/m32r/mm/init.c68
-rw-r--r--arch/m68k/Kconfig.debug3
-rw-r--r--arch/m68k/configs/multi_defconfig2
-rw-r--r--arch/m68k/configs/q40_defconfig6
-rw-r--r--arch/m68k/include/asm/parport.h2
-rw-r--r--arch/m68k/include/asm/pgtable_mm.h3
-rw-r--r--arch/m68k/include/asm/pgtable_no.h3
-rw-r--r--arch/m68k/include/asm/string.h32
-rw-r--r--arch/m68k/include/asm/uaccess_mm.h8
-rw-r--r--arch/m68k/kernel/asm-offsets.c2
-rw-r--r--arch/m68k/kernel/ints.c2
-rw-r--r--arch/m68k/lib/Makefile2
-rw-r--r--arch/m68k/lib/string.c22
-rw-r--r--arch/m68k/lib/uaccess.c6
-rw-r--r--arch/m68k/math-emu/fp_arith.c2
-rw-r--r--arch/m68k/mm/init.c48
-rw-r--r--arch/m68k/platform/coldfire/pci.c1
-rw-r--r--arch/m68k/sun3/sun3dvma.c2
-rw-r--r--arch/metag/Kconfig1
-rw-r--r--arch/metag/Kconfig.debug7
-rw-r--r--arch/metag/include/asm/hugetlb.h1
-rw-r--r--arch/metag/include/asm/pgtable.h3
-rw-r--r--arch/metag/kernel/perf/perf_event.c2
-rw-r--r--arch/metag/mm/init.c32
-rw-r--r--arch/microblaze/include/asm/page.h1
-rw-r--r--arch/microblaze/include/asm/pgtable.h3
-rw-r--r--arch/microblaze/include/asm/uaccess.h6
-rw-r--r--arch/microblaze/mm/init.c57
-rw-r--r--arch/mips/Kconfig3
-rw-r--r--arch/mips/Kconfig.debug9
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c2
-rw-r--r--arch/mips/include/asm/mmu_context.h2
-rw-r--r--arch/mips/include/asm/pgtable.h4
-rw-r--r--arch/mips/include/uapi/asm/kvm.h81
-rw-r--r--arch/mips/kernel/crash_dump.c10
-rw-r--r--arch/mips/kernel/ftrace.c4
-rw-r--r--arch/mips/kernel/idle.c13
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c4
-rw-r--r--arch/mips/kernel/scall32-o32.S5
-rw-r--r--arch/mips/kvm/kvm_mips.c83
-rw-r--r--arch/mips/loongson/lemote-2f/clock.c3
-rw-r--r--arch/mips/mm/init.c62
-rw-r--r--arch/mips/pci/pci-bcm1480.c4
-rw-r--r--arch/mips/pci/pci-lantiq.c2
-rw-r--r--arch/mips/pci/pci-sb1250.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c33
-rw-r--r--arch/mn10300/Kconfig1
-rw-r--r--arch/mn10300/Kconfig.debug4
-rw-r--r--arch/mn10300/include/asm/irqflags.h5
-rw-r--r--arch/mn10300/include/asm/pgtable.h3
-rw-r--r--arch/mn10300/include/asm/smp.h4
-rw-r--r--arch/mn10300/include/asm/uaccess.h6
-rw-r--r--arch/mn10300/kernel/setup.c54
-rw-r--r--arch/mn10300/mm/init.c33
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c2
-rw-r--r--arch/openrisc/Kconfig11
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/include/asm/pgtable.h3
-rw-r--r--arch/openrisc/mm/init.c48
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/parisc/Kconfig.debug11
-rw-r--r--arch/parisc/hpux/fs.c16
-rw-r--r--arch/parisc/include/asm/mmzone.h4
-rw-r--r--arch/parisc/include/asm/pci.h5
-rw-r--r--arch/parisc/include/asm/pgtable.h3
-rw-r--r--arch/parisc/include/uapi/asm/fcntl.h1
-rw-r--r--arch/parisc/kernel/hardware.c1
-rw-r--r--arch/parisc/kernel/pacache.S76
-rw-r--r--arch/parisc/kernel/pci.c27
-rw-r--r--arch/parisc/kernel/setup.c2
-rw-r--r--arch/parisc/mm/init.c62
-rw-r--r--arch/powerpc/Kconfig20
-rw-r--r--arch/powerpc/Kconfig.debug14
-rw-r--r--arch/powerpc/boot/dts/currituck.dts5
-rw-r--r--arch/powerpc/boot/dts/fsl/interlaken-lac-portals.dtsi156
-rw-r--r--arch/powerpc/boot/dts/fsl/interlaken-lac.dtsi45
-rw-r--r--arch/powerpc/configs/c2k_defconfig2
-rw-r--r--arch/powerpc/configs/g5_defconfig2
-rw-r--r--arch/powerpc/configs/maple_defconfig2
-rw-r--r--arch/powerpc/configs/mpc512x_defconfig27
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig1
-rw-r--r--arch/powerpc/configs/pmac32_defconfig2
-rw-r--r--arch/powerpc/configs/ppc64_defconfig2
-rw-r--r--arch/powerpc/configs/ppc6xx_defconfig2
-rw-r--r--arch/powerpc/configs/pseries_defconfig1
-rw-r--r--arch/powerpc/include/asm/cputable.h17
-rw-r--r--arch/powerpc/include/asm/eeh.h36
-rw-r--r--arch/powerpc/include/asm/eeh_event.h2
-rw-r--r--arch/powerpc/include/asm/exception-64s.h10
-rw-r--r--arch/powerpc/include/asm/hugetlb.h8
-rw-r--r--arch/powerpc/include/asm/ibmebus.h4
-rw-r--r--arch/powerpc/include/asm/iommu.h33
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h16
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h6
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64.h58
-rw-r--r--arch/powerpc/include/asm/lppaca.h3
-rw-r--r--arch/powerpc/include/asm/machdep.h11
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h14
-rw-r--r--arch/powerpc/include/asm/mmu_context.h2
-rw-r--r--arch/powerpc/include/asm/mpc5121.h1
-rw-r--r--arch/powerpc/include/asm/mpc52xx_psc.h49
-rw-r--r--arch/powerpc/include/asm/mpic.h5
-rw-r--r--arch/powerpc/include/asm/mpic_timer.h46
-rw-r--r--arch/powerpc/include/asm/mutex.h10
-rw-r--r--arch/powerpc/include/asm/opal.h140
-rw-r--r--arch/powerpc/include/asm/perf_event_server.h6
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h6
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64-64k.h3
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h241
-rw-r--r--arch/powerpc/include/asm/pgtable.h9
-rw-r--r--arch/powerpc/include/asm/probes.h25
-rw-r--r--arch/powerpc/include/asm/processor.h16
-rw-r--r--arch/powerpc/include/asm/reg.h9
-rw-r--r--arch/powerpc/include/asm/rtas.h4
-rw-r--r--arch/powerpc/include/asm/switch_to.h14
-rw-r--r--arch/powerpc/include/asm/tlbflush.h3
-rw-r--r--arch/powerpc/include/asm/uaccess.h16
-rw-r--r--arch/powerpc/include/asm/vdso.h2
-rw-r--r--arch/powerpc/kernel/Makefile4
-rw-r--r--arch/powerpc/kernel/asm-offsets.c7
-rw-r--r--arch/powerpc/kernel/cacheinfo.c36
-rw-r--r--arch/powerpc/kernel/cputable.c8
-rw-r--r--arch/powerpc/kernel/crash_dump.c10
-rw-r--r--arch/powerpc/kernel/eeh.c (renamed from arch/powerpc/platforms/pseries/eeh.c)196
-rw-r--r--arch/powerpc/kernel/eeh_cache.c (renamed from arch/powerpc/platforms/pseries/eeh_cache.c)9
-rw-r--r--arch/powerpc/kernel/eeh_dev.c (renamed from arch/powerpc/platforms/pseries/eeh_dev.c)0
-rw-r--r--arch/powerpc/kernel/eeh_driver.c (renamed from arch/powerpc/platforms/pseries/eeh_driver.c)169
-rw-r--r--arch/powerpc/kernel/eeh_event.c (renamed from arch/powerpc/platforms/pseries/eeh_event.c)134
-rw-r--r--arch/powerpc/kernel/eeh_pe.c (renamed from arch/powerpc/platforms/pseries/eeh_pe.c)240
-rw-r--r--arch/powerpc/kernel/eeh_sysfs.c (renamed from arch/powerpc/platforms/pseries/eeh_sysfs.c)1
-rw-r--r--arch/powerpc/kernel/entry_64.S58
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S148
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c3
-rw-r--r--arch/powerpc/kernel/ibmebus.c22
-rw-r--r--arch/powerpc/kernel/idle.c4
-rw-r--r--arch/powerpc/kernel/io-workarounds.c11
-rw-r--r--arch/powerpc/kernel/iommu.c323
-rw-r--r--arch/powerpc/kernel/irq.c4
-rw-r--r--arch/powerpc/kernel/kprobes.c20
-rw-r--r--arch/powerpc/kernel/kvm.c9
-rw-r--r--arch/powerpc/kernel/nvram_64.c20
-rw-r--r--arch/powerpc/kernel/pci-common.c21
-rw-r--r--arch/powerpc/kernel/pci-hotplug.c111
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c5
-rw-r--r--arch/powerpc/kernel/proc_powerpc.c20
-rw-r--r--arch/powerpc/kernel/process.c11
-rw-r--r--arch/powerpc/kernel/prom.c42
-rw-r--r--arch/powerpc/kernel/ptrace.c4
-rw-r--r--arch/powerpc/kernel/reloc_32.S3
-rw-r--r--arch/powerpc/kernel/rtas.c4
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/kernel/signal_32.c70
-rw-r--r--arch/powerpc/kernel/signal_64.c8
-rw-r--r--arch/powerpc/kernel/smp.c12
-rw-r--r--arch/powerpc/kernel/sysfs.c6
-rw-r--r--arch/powerpc/kernel/time.c1
-rw-r--r--arch/powerpc/kernel/tm.S18
-rw-r--r--arch/powerpc/kernel/traps.c89
-rw-r--r--arch/powerpc/kernel/udbg.c2
-rw-r--r--arch/powerpc/kernel/vdso.c2
-rw-r--r--arch/powerpc/kvm/44x_tlb.c5
-rw-r--r--arch/powerpc/kvm/Makefile13
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu.c81
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c23
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c8
-rw-r--r--arch/powerpc/kvm/book3s_64_slb.S13
-rw-r--r--arch/powerpc/kvm/book3s_hv.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c14
-rw-r--r--arch/powerpc/kvm/book3s_pr.c3
-rw-r--r--arch/powerpc/kvm/booke.c23
-rw-r--r--arch/powerpc/kvm/e500_mmu.c5
-rw-r--r--arch/powerpc/kvm/e500mc.c2
-rw-r--r--arch/powerpc/kvm/emulate.c3
-rw-r--r--arch/powerpc/lib/sstep.c2
-rw-r--r--arch/powerpc/math-emu/Makefile3
-rw-r--r--arch/powerpc/math-emu/fre.c11
-rw-r--r--arch/powerpc/math-emu/frsqrtes.c11
-rw-r--r--arch/powerpc/math-emu/math.c14
-rw-r--r--arch/powerpc/mm/44x_mmu.c6
-rw-r--r--arch/powerpc/mm/Makefile8
-rw-r--r--arch/powerpc/mm/gup.c18
-rw-r--r--arch/powerpc/mm/hash_low_64.S21
-rw-r--r--arch/powerpc/mm/hash_native_64.c195
-rw-r--r--arch/powerpc/mm/hash_utils_64.c67
-rw-r--r--arch/powerpc/mm/hugepage-hash64.c175
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c2
-rw-r--r--arch/powerpc/mm/hugetlbpage.c309
-rw-r--r--arch/powerpc/mm/init_64.c9
-rw-r--r--arch/powerpc/mm/mem.c63
-rw-r--r--arch/powerpc/mm/mmap.c (renamed from arch/powerpc/mm/mmap_64.c)0
-rw-r--r--arch/powerpc/mm/mmu_context_nohash.c15
-rw-r--r--arch/powerpc/mm/numa.c12
-rw-r--r--arch/powerpc/mm/pgtable.c8
-rw-r--r--arch/powerpc/mm/pgtable_64.c414
-rw-r--r--arch/powerpc/mm/subpage-prot.c48
-rw-r--r--arch/powerpc/mm/tlb_hash64.c40
-rw-r--r--arch/powerpc/mm/tlb_nohash.c2
-rw-r--r--arch/powerpc/perf/core-book3s.c203
-rw-r--r--arch/powerpc/perf/power7-pmu.c73
-rw-r--r--arch/powerpc/perf/power8-pmu.c62
-rw-r--r--arch/powerpc/platforms/44x/currituck.c43
-rw-r--r--arch/powerpc/platforms/44x/iss4xx.c4
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads.c6
-rw-r--r--arch/powerpc/platforms/512x/mpc512x.h12
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_generic.c4
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c31
-rw-r--r--arch/powerpc/platforms/512x/pdm360ng.c4
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c12
-rw-r--r--arch/powerpc/platforms/85xx/p5020_ds.c5
-rw-r--r--arch/powerpc/platforms/85xx/p5040_ds.c5
-rw-r--r--arch/powerpc/platforms/85xx/smp.c6
-rw-r--r--arch/powerpc/platforms/85xx/t4240_qds.c5
-rw-r--r--arch/powerpc/platforms/8xx/m8xx_setup.c14
-rw-r--r--arch/powerpc/platforms/Kconfig57
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype2
-rw-r--r--arch/powerpc/platforms/cell/beat_htab.c16
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c2
-rw-r--r--arch/powerpc/platforms/pasemi/Makefile1
-rw-r--r--arch/powerpc/platforms/pasemi/cpufreq.c330
-rw-r--r--arch/powerpc/platforms/powermac/Makefile2
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c721
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c746
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/powerpc/platforms/powernv/Makefile1
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c916
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c379
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S3
-rw-r--r--arch/powerpc/platforms/powernv/opal.c69
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c62
-rw-r--r--arch/powerpc/platforms/powernv/pci-p5ioc2.c11
-rw-r--r--arch/powerpc/platforms/powernv/pci.c139
-rw-r--r--arch/powerpc/platforms/powernv/pci.h35
-rw-r--r--arch/powerpc/platforms/powernv/setup.c4
-rw-r--r--arch/powerpc/platforms/powernv/smp.c4
-rw-r--r--arch/powerpc/platforms/ps3/htab.c5
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig5
-rw-r--r--arch/powerpc/platforms/pseries/Makefile4
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c12
-rw-r--r--arch/powerpc/platforms/pseries/io_event_irq.c2
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c4
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c142
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c554
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c85
-rw-r--r--arch/powerpc/platforms/pseries/ras.c8
-rw-r--r--arch/powerpc/platforms/pseries/smp.c2
-rwxr-xr-xarch/powerpc/relocs_check.pl10
-rw-r--r--arch/powerpc/sysdev/Makefile2
-rw-r--r--arch/powerpc/sysdev/cpm1.c1
-rw-r--r--arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c161
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c24
-rw-r--r--arch/powerpc/sysdev/mpic.c58
-rw-r--r--arch/powerpc/sysdev/mpic_timer.c593
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/appldata/appldata_mem.c18
-rw-r--r--arch/s390/appldata/appldata_net_sum.c18
-rw-r--r--arch/s390/hypfs/hypfs_diag.c8
-rw-r--r--arch/s390/include/asm/airq.h15
-rw-r--r--arch/s390/include/asm/dma-mapping.h3
-rw-r--r--arch/s390/include/asm/facility.h17
-rw-r--r--arch/s390/include/asm/io.h22
-rw-r--r--arch/s390/include/asm/kvm_host.h18
-rw-r--r--arch/s390/include/asm/pci.h2
-rw-r--r--arch/s390/include/asm/perf_event.h10
-rw-r--r--arch/s390/include/asm/pgalloc.h3
-rw-r--r--arch/s390/include/asm/pgtable.h121
-rw-r--r--arch/s390/include/asm/ptrace.h1
-rw-r--r--arch/s390/include/uapi/asm/Kbuild1
-rw-r--r--arch/s390/include/uapi/asm/chsc.h13
-rw-r--r--arch/s390/include/uapi/asm/dasd.h4
-rw-r--r--arch/s390/include/uapi/asm/sclp_ctl.h24
-rw-r--r--arch/s390/kernel/asm-offsets.c4
-rw-r--r--arch/s390/kernel/dumpstack.c12
-rw-r--r--arch/s390/kernel/entry.S12
-rw-r--r--arch/s390/kernel/entry.h2
-rw-r--r--arch/s390/kernel/entry64.S97
-rw-r--r--arch/s390/kernel/ipl.c8
-rw-r--r--arch/s390/kernel/irq.c74
-rw-r--r--arch/s390/kernel/perf_event.c52
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/kernel/sclp.S2
-rw-r--r--arch/s390/kernel/setup.c4
-rw-r--r--arch/s390/kernel/smp.c5
-rw-r--r--arch/s390/kvm/Makefile3
-rw-r--r--arch/s390/kvm/diag.c3
-rw-r--r--arch/s390/kvm/intercept.c124
-rw-r--r--arch/s390/kvm/interrupt.c18
-rw-r--r--arch/s390/kvm/kvm-s390.c105
-rw-r--r--arch/s390/kvm/kvm-s390.h14
-rw-r--r--arch/s390/kvm/priv.c274
-rw-r--r--arch/s390/kvm/sigp.c19
-rw-r--r--arch/s390/mm/init.c24
-rw-r--r--arch/s390/mm/mem_detect.c3
-rw-r--r--arch/s390/mm/pgtable.c55
-rw-r--r--arch/s390/oprofile/hwsampler.h4
-rw-r--r--arch/s390/pci/pci.c116
-rw-r--r--arch/s390/pci/pci_clp.c1
-rw-r--r--arch/s390/pci/pci_debug.c29
-rw-r--r--arch/s390/pci/pci_dma.c6
-rw-r--r--arch/s390/pci/pci_sysfs.c20
-rw-r--r--arch/score/include/asm/Kbuild1
-rw-r--r--arch/score/include/asm/dma-mapping.h6
-rw-r--r--arch/score/include/asm/pgtable.h3
-rw-r--r--arch/score/kernel/vmlinux.lds.S1
-rw-r--r--arch/score/mm/init.c31
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/include/asm/mutex-llsc.h4
-rw-r--r--arch/sh/include/asm/pgtable.h3
-rw-r--r--arch/sh/mm/init.c43
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/leon.h2
-rw-r--r--arch/sparc/include/asm/leon_amba.h1
-rw-r--r--arch/sparc/include/asm/linkage.h6
-rw-r--r--arch/sparc/include/asm/pgtable_32.h1
-rw-r--r--arch/sparc/include/asm/pgtable_64.h6
-rw-r--r--arch/sparc/include/uapi/asm/fcntl.h1
-rw-r--r--arch/sparc/kernel/ds.c3
-rw-r--r--arch/sparc/kernel/leon_kernel.c54
-rw-r--r--arch/sparc/kernel/leon_pci_grpci1.c8
-rw-r--r--arch/sparc/kernel/leon_pmc.c7
-rw-r--r--arch/sparc/kernel/leon_smp.c3
-rw-r--r--arch/sparc/kernel/pci.c15
-rw-r--r--arch/sparc/kernel/prom_common.c5
-rw-r--r--arch/sparc/kernel/setup_32.c2
-rw-r--r--arch/sparc/kernel/setup_64.c2
-rw-r--r--arch/sparc/mm/init_32.c37
-rw-r--r--arch/sparc/mm/init_64.c35
-rw-r--r--arch/sparc/mm/tlb.c7
-rw-r--r--arch/sparc/prom/bootstr_32.c12
-rw-r--r--arch/sparc/prom/tree_64.c16
-rw-r--r--arch/tile/Kconfig1
-rw-r--r--arch/tile/Kconfig.debug7
-rw-r--r--arch/tile/include/asm/pgtable.h3
-rw-r--r--arch/tile/include/asm/processor.h2
-rw-r--r--arch/tile/include/asm/sections.h2
-rw-r--r--arch/tile/include/asm/uaccess.h2
-rw-r--r--arch/tile/kernel/setup.c20
-rw-r--r--arch/tile/kernel/stack.c2
-rw-r--r--arch/tile/kernel/vmlinux.lds.S4
-rw-r--r--arch/tile/lib/exports.c2
-rw-r--r--arch/tile/mm/init.c26
-rw-r--r--arch/um/drivers/mconsole_kern.c2
-rw-r--r--arch/um/include/asm/common.lds.S1
-rw-r--r--arch/um/include/asm/pgtable.h2
-rw-r--r--arch/um/kernel/dyn.lds.S6
-rw-r--r--arch/um/kernel/mem.c8
-rw-r--r--arch/um/kernel/sysrq.c2
-rw-r--r--arch/um/kernel/uml.lds.S7
-rw-r--r--arch/unicore32/boot/compressed/Makefile2
-rw-r--r--arch/unicore32/include/asm/memory.h6
-rw-r--r--arch/unicore32/include/asm/pgtable.h7
-rw-r--r--arch/unicore32/kernel/pci.c5
-rw-r--r--arch/unicore32/mm/init.c55
-rw-r--r--arch/x86/Kconfig31
-rw-r--r--arch/x86/Kconfig.debug21
-rw-r--r--arch/x86/Makefile7
-rw-r--r--arch/x86/boot/compressed/eboot.c67
-rw-r--r--arch/x86/boot/compressed/head_64.S2
-rw-r--r--arch/x86/boot/tools/build.c1
-rw-r--r--arch/x86/configs/kvm_guest.config28
-rw-r--r--arch/x86/crypto/Makefile8
-rw-r--r--arch/x86/crypto/aesni-intel_asm.S48
-rw-r--r--arch/x86/crypto/blowfish-avx2-asm_64.S449
-rw-r--r--arch/x86/crypto/blowfish_avx2_glue.c585
-rw-r--r--arch/x86/crypto/blowfish_glue.c32
-rw-r--r--arch/x86/crypto/camellia-aesni-avx2-asm_64.S160
-rw-r--r--arch/x86/crypto/crct10dif-pcl-asm_64.S643
-rw-r--r--arch/x86/crypto/crct10dif-pclmul_glue.c151
-rw-r--r--arch/x86/crypto/sha256_ssse3_glue.c57
-rw-r--r--arch/x86/crypto/sha512_ssse3_glue.c58
-rw-r--r--arch/x86/crypto/twofish-avx2-asm_64.S600
-rw-r--r--arch/x86/crypto/twofish_avx2_glue.c584
-rw-r--r--arch/x86/crypto/twofish_avx_glue.c14
-rw-r--r--arch/x86/ia32/ia32_aout.c2
-rw-r--r--arch/x86/ia32/ia32_signal.c2
-rw-r--r--arch/x86/include/asm/acpi.h2
-rw-r--r--arch/x86/include/asm/apic.h27
-rw-r--r--arch/x86/include/asm/cpufeature.h118
-rw-r--r--arch/x86/include/asm/crypto/blowfish.h43
-rw-r--r--arch/x86/include/asm/crypto/twofish.h18
-rw-r--r--arch/x86/include/asm/desc.h117
-rw-r--r--arch/x86/include/asm/efi.h35
-rw-r--r--arch/x86/include/asm/entry_arch.h8
-rw-r--r--arch/x86/include/asm/fixmap.h2
-rw-r--r--arch/x86/include/asm/fpu-internal.h4
-rw-r--r--arch/x86/include/asm/hw_irq.h17
-rw-r--r--arch/x86/include/asm/irq.h5
-rw-r--r--arch/x86/include/asm/kvm_host.h17
-rw-r--r--arch/x86/include/asm/mce.h2
-rw-r--r--arch/x86/include/asm/microcode.h4
-rw-r--r--arch/x86/include/asm/microcode_amd.h78
-rw-r--r--arch/x86/include/asm/microcode_intel.h2
-rw-r--r--arch/x86/include/asm/mshyperv.h3
-rw-r--r--arch/x86/include/asm/mutex_32.h11
-rw-r--r--arch/x86/include/asm/mutex_64.h11
-rw-r--r--arch/x86/include/asm/nmi.h4
-rw-r--r--arch/x86/include/asm/perf_event.h3
-rw-r--r--arch/x86/include/asm/pgtable.h27
-rw-r--r--arch/x86/include/asm/pgtable_types.h12
-rw-r--r--arch/x86/include/asm/processor.h5
-rw-r--r--arch/x86/include/asm/sighandling.h4
-rw-r--r--arch/x86/include/asm/special_insns.h2
-rw-r--r--arch/x86/include/asm/thread_info.h4
-rw-r--r--arch/x86/include/asm/tlbflush.h2
-rw-r--r--arch/x86/include/asm/trace/irq_vectors.h104
-rw-r--r--arch/x86/include/asm/uaccess_64.h2
-rw-r--r--arch/x86/include/asm/uv/uv_bau.h3
-rw-r--r--arch/x86/include/uapi/asm/bootparam.h1
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h3
-rw-r--r--arch/x86/include/uapi/asm/processor-flags.h154
-rw-r--r--arch/x86/kernel/Makefile6
-rw-r--r--arch/x86/kernel/acpi/boot.c7
-rw-r--r--arch/x86/kernel/acpi/sleep.c4
-rw-r--r--arch/x86/kernel/acpi/sleep.h2
-rw-r--r--arch/x86/kernel/apic/apic.c71
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c1
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c66
-rw-r--r--arch/x86/kernel/asm-offsets_32.c1
-rw-r--r--arch/x86/kernel/cpu/Makefile4
-rw-r--r--arch/x86/kernel/cpu/amd.c2
-rw-r--r--arch/x86/kernel/cpu/bugs.c21
-rw-r--r--arch/x86/kernel/cpu/common.c39
-rw-r--r--arch/x86/kernel/cpu/cyrix.c2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c52
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-inject.c4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-severity.c15
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c5
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c12
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c67
-rw-r--r--arch/x86/kernel/cpu/mcheck/threshold.c24
-rw-r--r--arch/x86/kernel/cpu/mtrr/cleanup.c8
-rw-r--r--arch/x86/kernel/cpu/mtrr/cyrix.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c23
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c16
-rw-r--r--arch/x86/kernel/cpu/perf_event.c69
-rw-r--r--arch/x86/kernel/cpu/perf_event.h24
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c34
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_iommu.c504
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_iommu.h40
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c138
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c178
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c69
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c16
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h4
-rw-r--r--arch/x86/kernel/cpu/powerflags.c8
-rw-r--r--arch/x86/kernel/cpu/proc.c4
-rw-r--r--arch/x86/kernel/doublefault.c (renamed from arch/x86/kernel/doublefault_32.c)15
-rw-r--r--arch/x86/kernel/entry_32.S12
-rw-r--r--arch/x86/kernel/entry_64.S38
-rw-r--r--arch/x86/kernel/head_32.S21
-rw-r--r--arch/x86/kernel/head_64.S8
-rw-r--r--arch/x86/kernel/i387.c59
-rw-r--r--arch/x86/kernel/irq.c33
-rw-r--r--arch/x86/kernel/irq_work.c24
-rw-r--r--arch/x86/kernel/kprobes/core.c14
-rw-r--r--arch/x86/kernel/kvmclock.c1
-rw-r--r--arch/x86/kernel/microcode_amd.c133
-rw-r--r--arch/x86/kernel/microcode_amd_early.c302
-rw-r--r--arch/x86/kernel/microcode_core_early.c49
-rw-r--r--arch/x86/kernel/microcode_intel_early.c6
-rw-r--r--arch/x86/kernel/nmi.c36
-rw-r--r--arch/x86/kernel/process.c12
-rw-r--r--arch/x86/kernel/process_32.c13
-rw-r--r--arch/x86/kernel/process_64.c11
-rw-r--r--arch/x86/kernel/relocate_kernel_32.S2
-rw-r--r--arch/x86/kernel/relocate_kernel_64.S34
-rw-r--r--arch/x86/kernel/setup.c2
-rw-r--r--arch/x86/kernel/signal.c16
-rw-r--r--arch/x86/kernel/smp.c65
-rw-r--r--arch/x86/kernel/smpboot.c8
-rw-r--r--arch/x86/kernel/tboot.c73
-rw-r--r--arch/x86/kernel/tracepoint.c61
-rw-r--r--arch/x86/kernel/traps.c7
-rw-r--r--arch/x86/kernel/xsave.c5
-rw-r--r--arch/x86/kvm/Makefile13
-rw-r--r--arch/x86/kvm/emulate.c391
-rw-r--r--arch/x86/kvm/lapic.c4
-rw-r--r--arch/x86/kvm/mmu.c301
-rw-r--r--arch/x86/kvm/mmu.h18
-rw-r--r--arch/x86/kvm/mmutrace.h76
-rw-r--r--arch/x86/kvm/paging_tmpl.h10
-rw-r--r--arch/x86/kvm/svm.c10
-rw-r--r--arch/x86/kvm/trace.h21
-rw-r--r--arch/x86/kvm/vmx.c21
-rw-r--r--arch/x86/kvm/x86.c87
-rw-r--r--arch/x86/lguest/Makefile2
-rw-r--r--arch/x86/lguest/boot.c2
-rw-r--r--arch/x86/lguest/head_32.S (renamed from arch/x86/lguest/i386_head.S)0
-rw-r--r--arch/x86/mm/highmem_32.c6
-rw-r--r--arch/x86/mm/hugetlbpage.c187
-rw-r--r--arch/x86/mm/init.c20
-rw-r--r--arch/x86/mm/init_32.c32
-rw-r--r--arch/x86/mm/init_64.c47
-rw-r--r--arch/x86/mm/ioremap.c8
-rw-r--r--arch/x86/mm/numa_32.c2
-rw-r--r--arch/x86/pci/acpi.c7
-rw-r--r--arch/x86/platform/efi/efi.c200
-rw-r--r--arch/x86/tools/relocs.c4
-rw-r--r--arch/x86/vdso/vdso32-setup.c4
-rw-r--r--arch/x86/xen/enlighten.c2
-rw-r--r--arch/x86/xen/smp.c99
-rw-r--r--arch/x86/xen/spinlock.c7
-rw-r--r--arch/x86/xen/time.c58
-rw-r--r--arch/xtensa/include/asm/pgtable.h8
-rw-r--r--arch/xtensa/mm/init.c33
1736 files changed, 60567 insertions, 46800 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index a4429bcd609e..8d2ae24b9f4a 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -365,6 +365,9 @@ config HAVE_IRQ_TIME_ACCOUNTING
365config HAVE_ARCH_TRANSPARENT_HUGEPAGE 365config HAVE_ARCH_TRANSPARENT_HUGEPAGE
366 bool 366 bool
367 367
368config HAVE_ARCH_SOFT_DIRTY
369 bool
370
368config HAVE_MOD_ARCH_SPECIFIC 371config HAVE_MOD_ARCH_SPECIFIC
369 bool 372 bool
370 help 373 help
diff --git a/arch/alpha/include/asm/mmzone.h b/arch/alpha/include/asm/mmzone.h
index c5b5d6bac9ed..14ce27bccd24 100644
--- a/arch/alpha/include/asm/mmzone.h
+++ b/arch/alpha/include/asm/mmzone.h
@@ -71,8 +71,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
71 71
72#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 72#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
73 73
74#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr)
75
76#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32)) 74#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> 32))
77#define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32)) 75#define pgd_page(pgd) (pfn_to_page(pgd_val(pgd) >> 32))
78#define pte_pfn(pte) (pte_val(pte) >> 32) 76#define pte_pfn(pte) (pte_val(pte) >> 32)
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index 81a4342d5a3f..d8f9b7e89234 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -354,9 +354,6 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
354#define kern_addr_valid(addr) (1) 354#define kern_addr_valid(addr) (1)
355#endif 355#endif
356 356
357#define io_remap_pfn_range(vma, start, pfn, size, prot) \
358 remap_pfn_range(vma, start, pfn, size, prot)
359
360#define pte_ERROR(e) \ 357#define pte_ERROR(e) \
361 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e)) 358 printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
362#define pmd_ERROR(e) \ 359#define pmd_ERROR(e) \
diff --git a/arch/alpha/include/uapi/asm/fcntl.h b/arch/alpha/include/uapi/asm/fcntl.h
index 6d9e805f18a7..dfdadb0b4bef 100644
--- a/arch/alpha/include/uapi/asm/fcntl.h
+++ b/arch/alpha/include/uapi/asm/fcntl.h
@@ -32,6 +32,7 @@
32#define O_SYNC (__O_SYNC|O_DSYNC) 32#define O_SYNC (__O_SYNC|O_DSYNC)
33 33
34#define O_PATH 040000000 34#define O_PATH 040000000
35#define O_TMPFILE 0100000000
35 36
36#define F_GETLK 7 37#define F_GETLK 7
37#define F_SETLK 8 38#define F_SETLK 8
diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c
index da711e37fc97..6a61deed4a85 100644
--- a/arch/alpha/kernel/console.c
+++ b/arch/alpha/kernel/console.c
@@ -61,7 +61,9 @@ locate_and_init_vga(void *(*sel_func)(void *, void *))
61 61
62 /* Set the VGA hose and init the new console. */ 62 /* Set the VGA hose and init the new console. */
63 pci_vga_hose = hose; 63 pci_vga_hose = hose;
64 take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1); 64 console_lock();
65 do_take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1);
66 console_unlock();
65} 67}
66 68
67void __init 69void __init
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index b9e37ad6fa19..1402fcc11c2c 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -96,6 +96,7 @@ struct osf_dirent {
96}; 96};
97 97
98struct osf_dirent_callback { 98struct osf_dirent_callback {
99 struct dir_context ctx;
99 struct osf_dirent __user *dirent; 100 struct osf_dirent __user *dirent;
100 long __user *basep; 101 long __user *basep;
101 unsigned int count; 102 unsigned int count;
@@ -146,17 +147,17 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
146{ 147{
147 int error; 148 int error;
148 struct fd arg = fdget(fd); 149 struct fd arg = fdget(fd);
149 struct osf_dirent_callback buf; 150 struct osf_dirent_callback buf = {
151 .ctx.actor = osf_filldir,
152 .dirent = dirent,
153 .basep = basep,
154 .count = count
155 };
150 156
151 if (!arg.file) 157 if (!arg.file)
152 return -EBADF; 158 return -EBADF;
153 159
154 buf.dirent = dirent; 160 error = iterate_dir(arg.file, &buf.ctx);
155 buf.basep = basep;
156 buf.count = count;
157 buf.error = 0;
158
159 error = vfs_readdir(arg.file, osf_filldir, &buf);
160 if (error >= 0) 161 if (error >= 0)
161 error = buf.error; 162 error = buf.error;
162 if (count != buf.count) 163 if (count != buf.count)
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index b51f7b4818cd..2b183b0d3207 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -26,7 +26,6 @@ static int hose_mmap_page_range(struct pci_controller *hose,
26 base = sparse ? hose->sparse_io_base : hose->dense_io_base; 26 base = sparse ? hose->sparse_io_base : hose->dense_io_base;
27 27
28 vma->vm_pgoff += base >> PAGE_SHIFT; 28 vma->vm_pgoff += base >> PAGE_SHIFT;
29 vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
30 29
31 return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 30 return io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
32 vma->vm_end - vma->vm_start, 31 vma->vm_end - vma->vm_start,
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index ab80a80d38a2..f2360a74e5d5 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -117,7 +117,9 @@ common_shutdown_1(void *generic_ptr)
117 if (in_interrupt()) 117 if (in_interrupt())
118 irq_exit(); 118 irq_exit();
119 /* This has the effect of resetting the VGA video origin. */ 119 /* This has the effect of resetting the VGA video origin. */
120 take_over_console(&dummy_con, 0, MAX_NR_CONSOLES-1, 1); 120 console_lock();
121 do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES-1, 1);
122 console_unlock();
121#endif 123#endif
122 pci_restore_srm_config(); 124 pci_restore_srm_config();
123 set_hae(srm_hae); 125 set_hae(srm_hae);
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 1d4aabfcf9a1..837c0fa58317 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -238,8 +238,8 @@ nautilus_init_pci(void)
238 if (pci_mem < memtop) 238 if (pci_mem < memtop)
239 memtop = pci_mem; 239 memtop = pci_mem;
240 if (memtop > alpha_mv.min_mem_address) { 240 if (memtop > alpha_mv.min_mem_address) {
241 free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address), 241 free_reserved_area(__va(alpha_mv.min_mem_address),
242 (unsigned long)__va(memtop), 0, NULL); 242 __va(memtop), -1, NULL);
243 printk("nautilus_init_pci: %ldk freed\n", 243 printk("nautilus_init_pci: %ldk freed\n",
244 (memtop - alpha_mv.min_mem_address) >> 10); 244 (memtop - alpha_mv.min_mem_address) >> 10);
245 } 245 }
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 0ba85ee4a466..a1bea91df56a 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -276,56 +276,25 @@ srm_paging_stop (void)
276} 276}
277#endif 277#endif
278 278
279#ifndef CONFIG_DISCONTIGMEM
280static void __init
281printk_memory_info(void)
282{
283 unsigned long codesize, reservedpages, datasize, initsize, tmp;
284 extern int page_is_ram(unsigned long) __init;
285
286 /* printk all informations */
287 reservedpages = 0;
288 for (tmp = 0; tmp < max_low_pfn; tmp++)
289 /*
290 * Only count reserved RAM pages
291 */
292 if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
293 reservedpages++;
294
295 codesize = (unsigned long) &_etext - (unsigned long) &_text;
296 datasize = (unsigned long) &_edata - (unsigned long) &_data;
297 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
298
299 printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, %luk data, %luk init)\n",
300 nr_free_pages() << (PAGE_SHIFT-10),
301 max_mapnr << (PAGE_SHIFT-10),
302 codesize >> 10,
303 reservedpages << (PAGE_SHIFT-10),
304 datasize >> 10,
305 initsize >> 10);
306}
307
308void __init 279void __init
309mem_init(void) 280mem_init(void)
310{ 281{
311 max_mapnr = num_physpages = max_low_pfn; 282 set_max_mapnr(max_low_pfn);
312 totalram_pages += free_all_bootmem();
313 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); 283 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
314 284 free_all_bootmem();
315 printk_memory_info(); 285 mem_init_print_info(NULL);
316} 286}
317#endif /* CONFIG_DISCONTIGMEM */
318 287
319void 288void
320free_initmem(void) 289free_initmem(void)
321{ 290{
322 free_initmem_default(0); 291 free_initmem_default(-1);
323} 292}
324 293
325#ifdef CONFIG_BLK_DEV_INITRD 294#ifdef CONFIG_BLK_DEV_INITRD
326void 295void
327free_initrd_mem(unsigned long start, unsigned long end) 296free_initrd_mem(unsigned long start, unsigned long end)
328{ 297{
329 free_reserved_area(start, end, 0, "initrd"); 298 free_reserved_area((void *)start, (void *)end, -1, "initrd");
330} 299}
331#endif 300#endif
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 33885048fa36..d543d71c28b4 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -129,8 +129,6 @@ setup_memory_node(int nid, void *kernel_end)
129 if (node_max_pfn > max_low_pfn) 129 if (node_max_pfn > max_low_pfn)
130 max_pfn = max_low_pfn = node_max_pfn; 130 max_pfn = max_low_pfn = node_max_pfn;
131 131
132 num_physpages += node_max_pfn - node_min_pfn;
133
134#if 0 /* we'll try this one again in a little while */ 132#if 0 /* we'll try this one again in a little while */
135 /* Cute trick to make sure our local node data is on local memory */ 133 /* Cute trick to make sure our local node data is on local memory */
136 node_data[nid] = (pg_data_t *)(__va(node_min_pfn << PAGE_SHIFT)); 134 node_data[nid] = (pg_data_t *)(__va(node_min_pfn << PAGE_SHIFT));
@@ -321,41 +319,3 @@ void __init paging_init(void)
321 /* Initialize the kernel's ZERO_PGE. */ 319 /* Initialize the kernel's ZERO_PGE. */
322 memset((void *)ZERO_PGE, 0, PAGE_SIZE); 320 memset((void *)ZERO_PGE, 0, PAGE_SIZE);
323} 321}
324
325void __init mem_init(void)
326{
327 unsigned long codesize, reservedpages, datasize, initsize, pfn;
328 extern int page_is_ram(unsigned long) __init;
329 unsigned long nid, i;
330 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
331
332 reservedpages = 0;
333 for_each_online_node(nid) {
334 /*
335 * This will free up the bootmem, ie, slot 0 memory
336 */
337 totalram_pages += free_all_bootmem_node(NODE_DATA(nid));
338
339 pfn = NODE_DATA(nid)->node_start_pfn;
340 for (i = 0; i < node_spanned_pages(nid); i++, pfn++)
341 if (page_is_ram(pfn) &&
342 PageReserved(nid_page_nr(nid, i)))
343 reservedpages++;
344 }
345
346 codesize = (unsigned long) &_etext - (unsigned long) &_text;
347 datasize = (unsigned long) &_edata - (unsigned long) &_data;
348 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
349
350 printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, "
351 "%luk data, %luk init)\n",
352 nr_free_pages() << (PAGE_SHIFT-10),
353 num_physpages << (PAGE_SHIFT-10),
354 codesize >> 10,
355 reservedpages << (PAGE_SHIFT-10),
356 datasize >> 10,
357 initsize >> 10);
358#if 0
359 mem_stress();
360#endif
361}
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 5917099470ea..68fcbb2d59e2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -34,6 +34,7 @@ config ARC
34 select OF 34 select OF
35 select OF_EARLY_FLATTREE 35 select OF_EARLY_FLATTREE
36 select PERF_USE_VMALLOC 36 select PERF_USE_VMALLOC
37 select HAVE_DEBUG_STACKOVERFLOW
37 38
38config SCHED_OMIT_FRAME_POINTER 39config SCHED_OMIT_FRAME_POINTER
39 def_bool y 40 def_bool y
@@ -184,6 +185,7 @@ config ARC_CACHE_PAGES
184 185
185config ARC_CACHE_VIPT_ALIASING 186config ARC_CACHE_VIPT_ALIASING
186 bool "Support VIPT Aliasing D$" 187 bool "Support VIPT Aliasing D$"
188 depends on ARC_HAS_DCACHE
187 default n 189 default n
188 190
189endif #ARC_CACHE 191endif #ARC_CACHE
@@ -361,13 +363,6 @@ config ARC_MISALIGN_ACCESS
361 Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide 363 Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
362 potential bugs in code 364 potential bugs in code
363 365
364config ARC_STACK_NONEXEC
365 bool "Make stack non-executable"
366 default n
367 help
368 To disable the execute permissions of stack/heap of processes
369 which are enabled by default.
370
371config HZ 366config HZ
372 int "Timer Frequency" 367 int "Timer Frequency"
373 default 100 368 default 100
diff --git a/arch/arc/Kconfig.debug b/arch/arc/Kconfig.debug
index 962c6099659e..a7fc0da25650 100644
--- a/arch/arc/Kconfig.debug
+++ b/arch/arc/Kconfig.debug
@@ -15,13 +15,6 @@ config EARLY_PRINTK
15 with klogd/syslogd or the X server. You should normally N here, 15 with klogd/syslogd or the X server. You should normally N here,
16 unless you want to debug such a crash. 16 unless you want to debug such a crash.
17 17
18config DEBUG_STACKOVERFLOW
19 bool "Check for stack overflows"
20 depends on DEBUG_KERNEL
21 help
22 This option will cause messages to be printed if free stack space
23 drops below a certain limit.
24
25config 16KSTACKS 18config 16KSTACKS
26 bool "Use 16Kb for kernel stacks instead of 8Kb" 19 bool "Use 16Kb for kernel stacks instead of 8Kb"
27 help 20 help
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 183397fd289e..8c0b1aa56f7e 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -9,25 +9,27 @@
9UTS_MACHINE := arc 9UTS_MACHINE := arc
10 10
11ifeq ($(CROSS_COMPILE),) 11ifeq ($(CROSS_COMPILE),)
12CROSS_COMPILE := arc-elf32- 12CROSS_COMPILE := arc-linux-uclibc-
13endif 13endif
14 14
15KBUILD_DEFCONFIG := fpga_defconfig 15KBUILD_DEFCONFIG := fpga_defconfig
16 16
17cflags-y += -mA7 -fno-common -pipe -fno-builtin -D__linux__ 17cflags-y += -mA7 -fno-common -pipe -fno-builtin -D__linux__
18 18
19LINUXINCLUDE += -include ${src}/arch/arc/include/asm/defines.h
20
21ifdef CONFIG_ARC_CURR_IN_REG 19ifdef CONFIG_ARC_CURR_IN_REG
22# For a global register defintion, make sure it gets passed to every file 20# For a global register defintion, make sure it gets passed to every file
23# We had a customer reported bug where some code built in kernel was NOT using 21# We had a customer reported bug where some code built in kernel was NOT using
24# any kernel headers, and missing the r25 global register 22# any kernel headers, and missing the r25 global register
25# Can't do unconditionally (like above) because of recursive include issues 23# Can't do unconditionally because of recursive include issues
26# due to <linux/thread_info.h> 24# due to <linux/thread_info.h>
27LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h 25LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
28endif 26endif
29 27
30atleast_gcc44 := $(call cc-ifversion, -gt, 0402, y) 28upto_gcc42 := $(call cc-ifversion, -le, 0402, y)
29upto_gcc44 := $(call cc-ifversion, -le, 0404, y)
30atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y)
31atleast_gcc48 := $(call cc-ifversion, -ge, 0408, y)
32
31cflags-$(atleast_gcc44) += -fsection-anchors 33cflags-$(atleast_gcc44) += -fsection-anchors
32 34
33cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 35cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
@@ -35,6 +37,11 @@ cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
35cflags-$(CONFIG_ARC_HAS_RTSC) += -mrtsc 37cflags-$(CONFIG_ARC_HAS_RTSC) += -mrtsc
36cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables 38cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
37 39
40# By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok
41ifeq ($(atleast_gcc48),y)
42cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2
43endif
44
38ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE 45ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
39# Generic build system uses -O2, we want -O3 46# Generic build system uses -O2, we want -O3
40cflags-y += -O3 47cflags-y += -O3
@@ -48,11 +55,10 @@ cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
48cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian 55cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
49ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 56ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
50 57
51# STAR 9000518362: 58# STAR 9000518362: (fixed with binutils shipping with gcc 4.8)
52# arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept 59# arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
53# --build-id w/o "-marclinux". 60# --build-id w/o "-marclinux". Default arc-elf32-ld is OK
54# Default arc-elf32-ld is OK 61ldflags-$(upto_gcc44) += -marclinux
55ldflags-y += -marclinux
56 62
57ARC_LIBGCC := -mA7 63ARC_LIBGCC := -mA7
58cflags-$(CONFIG_ARC_HAS_HW_MPY) += -multcost=16 64cflags-$(CONFIG_ARC_HAS_HW_MPY) += -multcost=16
@@ -66,8 +72,8 @@ ifndef CONFIG_ARC_HAS_HW_MPY
66# With gcc 4.4.7, -mno-mpy is enough to make any other related adjustments, 72# With gcc 4.4.7, -mno-mpy is enough to make any other related adjustments,
67# e.g. increased cost of MPY. With gcc 4.2.1 this had to be explicitly hinted 73# e.g. increased cost of MPY. With gcc 4.2.1 this had to be explicitly hinted
68 74
69 ARC_LIBGCC := -marc600 75 ifeq ($(upto_gcc42),y)
70 ifneq ($(atleast_gcc44),y) 76 ARC_LIBGCC := -marc600
71 cflags-y += -multcost=30 77 cflags-y += -multcost=30
72 endif 78 endif
73endif 79endif
diff --git a/arch/arc/boot/dts/abilis_tb100_dvk.dts b/arch/arc/boot/dts/abilis_tb100_dvk.dts
index 0fa0d4abe795..ebc313a9f5b2 100644
--- a/arch/arc/boot/dts/abilis_tb100_dvk.dts
+++ b/arch/arc/boot/dts/abilis_tb100_dvk.dts
@@ -45,19 +45,19 @@
45 }; 45 };
46 46
47 i2c0: i2c@FF120000 { 47 i2c0: i2c@FF120000 {
48 sda-hold-time = <432>; 48 i2c-sda-hold-time-ns = <432>;
49 }; 49 };
50 i2c1: i2c@FF121000 { 50 i2c1: i2c@FF121000 {
51 sda-hold-time = <432>; 51 i2c-sda-hold-time-ns = <432>;
52 }; 52 };
53 i2c2: i2c@FF122000 { 53 i2c2: i2c@FF122000 {
54 sda-hold-time = <432>; 54 i2c-sda-hold-time-ns = <432>;
55 }; 55 };
56 i2c3: i2c@FF123000 { 56 i2c3: i2c@FF123000 {
57 sda-hold-time = <432>; 57 i2c-sda-hold-time-ns = <432>;
58 }; 58 };
59 i2c4: i2c@FF124000 { 59 i2c4: i2c@FF124000 {
60 sda-hold-time = <432>; 60 i2c-sda-hold-time-ns = <432>;
61 }; 61 };
62 62
63 leds { 63 leds {
diff --git a/arch/arc/boot/dts/abilis_tb101_dvk.dts b/arch/arc/boot/dts/abilis_tb101_dvk.dts
index a4d80ce283ae..b204657993aa 100644
--- a/arch/arc/boot/dts/abilis_tb101_dvk.dts
+++ b/arch/arc/boot/dts/abilis_tb101_dvk.dts
@@ -45,19 +45,19 @@
45 }; 45 };
46 46
47 i2c0: i2c@FF120000 { 47 i2c0: i2c@FF120000 {
48 sda-hold-time = <432>; 48 i2c-sda-hold-time-ns = <432>;
49 }; 49 };
50 i2c1: i2c@FF121000 { 50 i2c1: i2c@FF121000 {
51 sda-hold-time = <432>; 51 i2c-sda-hold-time-ns = <432>;
52 }; 52 };
53 i2c2: i2c@FF122000 { 53 i2c2: i2c@FF122000 {
54 sda-hold-time = <432>; 54 i2c-sda-hold-time-ns = <432>;
55 }; 55 };
56 i2c3: i2c@FF123000 { 56 i2c3: i2c@FF123000 {
57 sda-hold-time = <432>; 57 i2c-sda-hold-time-ns = <432>;
58 }; 58 };
59 i2c4: i2c@FF124000 { 59 i2c4: i2c@FF124000 {
60 sda-hold-time = <432>; 60 i2c-sda-hold-time-ns = <432>;
61 }; 61 };
62 62
63 leds { 63 leds {
diff --git a/arch/arc/configs/fpga_defconfig b/arch/arc/configs/fpga_defconfig
index 95350be6ef6f..c109af320274 100644
--- a/arch/arc/configs/fpga_defconfig
+++ b/arch/arc/configs/fpga_defconfig
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-elf32-" 1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
2# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux" 3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_SWAP is not set 4# CONFIG_SWAP is not set
diff --git a/arch/arc/configs/nsimosci_defconfig b/arch/arc/configs/nsimosci_defconfig
index 446c96c24eff..451af30914f6 100644
--- a/arch/arc/configs/nsimosci_defconfig
+++ b/arch/arc/configs/nsimosci_defconfig
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-elf32-" 1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
2# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="ARCLinux" 3CONFIG_DEFAULT_HOSTNAME="ARCLinux"
4# CONFIG_SWAP is not set 4# CONFIG_SWAP is not set
diff --git a/arch/arc/configs/tb10x_defconfig b/arch/arc/configs/tb10x_defconfig
index 4fa5cd9f2202..6be6492442d6 100644
--- a/arch/arc/configs/tb10x_defconfig
+++ b/arch/arc/configs/tb10x_defconfig
@@ -1,4 +1,4 @@
1CONFIG_CROSS_COMPILE="arc-elf32-" 1CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
2# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_DEFAULT_HOSTNAME="tb10x" 3CONFIG_DEFAULT_HOSTNAME="tb10x"
4CONFIG_SYSVIPC=y 4CONFIG_SYSVIPC=y
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 1b907c465666..355cb470c2a4 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -20,7 +20,6 @@
20#define ARC_REG_PERIBASE_BCR 0x69 20#define ARC_REG_PERIBASE_BCR 0x69
21#define ARC_REG_FP_BCR 0x6B /* Single-Precision FPU */ 21#define ARC_REG_FP_BCR 0x6B /* Single-Precision FPU */
22#define ARC_REG_DPFP_BCR 0x6C /* Dbl Precision FPU */ 22#define ARC_REG_DPFP_BCR 0x6C /* Dbl Precision FPU */
23#define ARC_REG_MMU_BCR 0x6f
24#define ARC_REG_DCCM_BCR 0x74 /* DCCM Present + SZ */ 23#define ARC_REG_DCCM_BCR 0x74 /* DCCM Present + SZ */
25#define ARC_REG_TIMERS_BCR 0x75 24#define ARC_REG_TIMERS_BCR 0x75
26#define ARC_REG_ICCM_BCR 0x78 25#define ARC_REG_ICCM_BCR 0x78
@@ -34,22 +33,12 @@
34#define ARC_REG_D_UNCACH_BCR 0x6A 33#define ARC_REG_D_UNCACH_BCR 0x6A
35 34
36/* status32 Bits Positions */ 35/* status32 Bits Positions */
37#define STATUS_H_BIT 0 /* CPU Halted */
38#define STATUS_E1_BIT 1 /* Int 1 enable */
39#define STATUS_E2_BIT 2 /* Int 2 enable */
40#define STATUS_A1_BIT 3 /* Int 1 active */
41#define STATUS_A2_BIT 4 /* Int 2 active */
42#define STATUS_AE_BIT 5 /* Exception active */ 36#define STATUS_AE_BIT 5 /* Exception active */
43#define STATUS_DE_BIT 6 /* PC is in delay slot */ 37#define STATUS_DE_BIT 6 /* PC is in delay slot */
44#define STATUS_U_BIT 7 /* User/Kernel mode */ 38#define STATUS_U_BIT 7 /* User/Kernel mode */
45#define STATUS_L_BIT 12 /* Loop inhibit */ 39#define STATUS_L_BIT 12 /* Loop inhibit */
46 40
47/* These masks correspond to the status word(STATUS_32) bits */ 41/* These masks correspond to the status word(STATUS_32) bits */
48#define STATUS_H_MASK (1<<STATUS_H_BIT)
49#define STATUS_E1_MASK (1<<STATUS_E1_BIT)
50#define STATUS_E2_MASK (1<<STATUS_E2_BIT)
51#define STATUS_A1_MASK (1<<STATUS_A1_BIT)
52#define STATUS_A2_MASK (1<<STATUS_A2_BIT)
53#define STATUS_AE_MASK (1<<STATUS_AE_BIT) 42#define STATUS_AE_MASK (1<<STATUS_AE_BIT)
54#define STATUS_DE_MASK (1<<STATUS_DE_BIT) 43#define STATUS_DE_MASK (1<<STATUS_DE_BIT)
55#define STATUS_U_MASK (1<<STATUS_U_BIT) 44#define STATUS_U_MASK (1<<STATUS_U_BIT)
@@ -71,6 +60,7 @@
71#define ECR_V_ITLB_MISS 0x21 60#define ECR_V_ITLB_MISS 0x21
72#define ECR_V_DTLB_MISS 0x22 61#define ECR_V_DTLB_MISS 0x22
73#define ECR_V_PROTV 0x23 62#define ECR_V_PROTV 0x23
63#define ECR_V_TRAP 0x25
74 64
75/* Protection Violation Exception Cause Code Values */ 65/* Protection Violation Exception Cause Code Values */
76#define ECR_C_PROTV_INST_FETCH 0x00 66#define ECR_C_PROTV_INST_FETCH 0x00
@@ -79,94 +69,23 @@
79#define ECR_C_PROTV_XCHG 0x03 69#define ECR_C_PROTV_XCHG 0x03
80#define ECR_C_PROTV_MISALIG_DATA 0x04 70#define ECR_C_PROTV_MISALIG_DATA 0x04
81 71
72#define ECR_C_BIT_PROTV_MISALIG_DATA 10
73
74/* Machine Check Cause Code Values */
75#define ECR_C_MCHK_DUP_TLB 0x01
76
82/* DTLB Miss Exception Cause Code Values */ 77/* DTLB Miss Exception Cause Code Values */
83#define ECR_C_BIT_DTLB_LD_MISS 8 78#define ECR_C_BIT_DTLB_LD_MISS 8
84#define ECR_C_BIT_DTLB_ST_MISS 9 79#define ECR_C_BIT_DTLB_ST_MISS 9
85 80
81/* Dummy ECR values for Interrupts */
82#define event_IRQ1 0x0031abcd
83#define event_IRQ2 0x0032abcd
86 84
87/* Auxiliary registers */ 85/* Auxiliary registers */
88#define AUX_IDENTITY 4 86#define AUX_IDENTITY 4
89#define AUX_INTR_VEC_BASE 0x25 87#define AUX_INTR_VEC_BASE 0x25
90#define AUX_IRQ_LEV 0x200 /* IRQ Priority: L1 or L2 */
91#define AUX_IRQ_HINT 0x201 /* For generating Soft Interrupts */
92#define AUX_IRQ_LV12 0x43 /* interrupt level register */
93
94#define AUX_IENABLE 0x40c
95#define AUX_ITRIGGER 0x40d
96#define AUX_IPULSE 0x415
97
98/* Timer related Aux registers */
99#define ARC_REG_TIMER0_LIMIT 0x23 /* timer 0 limit */
100#define ARC_REG_TIMER0_CTRL 0x22 /* timer 0 control */
101#define ARC_REG_TIMER0_CNT 0x21 /* timer 0 count */
102#define ARC_REG_TIMER1_LIMIT 0x102 /* timer 1 limit */
103#define ARC_REG_TIMER1_CTRL 0x101 /* timer 1 control */
104#define ARC_REG_TIMER1_CNT 0x100 /* timer 1 count */
105
106#define TIMER_CTRL_IE (1 << 0) /* Interupt when Count reachs limit */
107#define TIMER_CTRL_NH (1 << 1) /* Count only when CPU NOT halted */
108
109/* MMU Management regs */
110#define ARC_REG_TLBPD0 0x405
111#define ARC_REG_TLBPD1 0x406
112#define ARC_REG_TLBINDEX 0x407
113#define ARC_REG_TLBCOMMAND 0x408
114#define ARC_REG_PID 0x409
115#define ARC_REG_SCRATCH_DATA0 0x418
116
117/* Bits in MMU PID register */
118#define MMU_ENABLE (1 << 31) /* Enable MMU for process */
119
120/* Error code if probe fails */
121#define TLB_LKUP_ERR 0x80000000
122
123/* TLB Commands */
124#define TLBWrite 0x1
125#define TLBRead 0x2
126#define TLBGetIndex 0x3
127#define TLBProbe 0x4
128
129#if (CONFIG_ARC_MMU_VER >= 2)
130#define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */
131#define TLBIVUTLB 0x6 /* explicitly inv uTLBs */
132#else
133#undef TLBWriteNI /* These cmds don't exist on older MMU */
134#undef TLBIVUTLB
135#endif
136 88
137/* Instruction cache related Auxiliary registers */
138#define ARC_REG_IC_BCR 0x77 /* Build Config reg */
139#define ARC_REG_IC_IVIC 0x10
140#define ARC_REG_IC_CTRL 0x11
141#define ARC_REG_IC_IVIL 0x19
142#if (CONFIG_ARC_MMU_VER > 2)
143#define ARC_REG_IC_PTAG 0x1E
144#endif
145
146/* Bit val in IC_CTRL */
147#define IC_CTRL_CACHE_DISABLE 0x1
148
149/* Data cache related Auxiliary registers */
150#define ARC_REG_DC_BCR 0x72
151#define ARC_REG_DC_IVDC 0x47
152#define ARC_REG_DC_CTRL 0x48
153#define ARC_REG_DC_IVDL 0x4A
154#define ARC_REG_DC_FLSH 0x4B
155#define ARC_REG_DC_FLDL 0x4C
156#if (CONFIG_ARC_MMU_VER > 2)
157#define ARC_REG_DC_PTAG 0x5C
158#endif
159
160/* Bit val in DC_CTRL */
161#define DC_CTRL_INV_MODE_FLUSH 0x40
162#define DC_CTRL_FLUSH_STATUS 0x100
163
164/* MMU Management regs */
165#define ARC_REG_PID 0x409
166#define ARC_REG_SCRATCH_DATA0 0x418
167
168/* Bits in MMU PID register */
169#define MMU_ENABLE (1 << 31) /* Enable MMU for process */
170 89
171/* 90/*
172 * Floating Pt Registers 91 * Floating Pt Registers
@@ -293,24 +212,6 @@ struct bcr_identity {
293#endif 212#endif
294}; 213};
295 214
296struct bcr_mmu_1_2 {
297#ifdef CONFIG_CPU_BIG_ENDIAN
298 unsigned int ver:8, ways:4, sets:4, u_itlb:8, u_dtlb:8;
299#else
300 unsigned int u_dtlb:8, u_itlb:8, sets:4, ways:4, ver:8;
301#endif
302};
303
304struct bcr_mmu_3 {
305#ifdef CONFIG_CPU_BIG_ENDIAN
306 unsigned int ver:8, ways:4, sets:4, osm:1, reserv:3, pg_sz:4,
307 u_itlb:4, u_dtlb:4;
308#else
309 unsigned int u_dtlb:4, u_itlb:4, pg_sz:4, reserv:3, osm:1, sets:4,
310 ways:4, ver:8;
311#endif
312};
313
314#define EXTN_SWAP_VALID 0x1 215#define EXTN_SWAP_VALID 0x1
315#define EXTN_NORM_VALID 0x2 216#define EXTN_NORM_VALID 0x2
316#define EXTN_MINMAX_VALID 0x2 217#define EXTN_MINMAX_VALID 0x2
@@ -343,14 +244,6 @@ struct bcr_extn_xymem {
343#endif 244#endif
344}; 245};
345 246
346struct bcr_cache {
347#ifdef CONFIG_CPU_BIG_ENDIAN
348 unsigned int pad:12, line_len:4, sz:4, config:4, ver:8;
349#else
350 unsigned int ver:8, config:4, sz:4, line_len:4, pad:12;
351#endif
352};
353
354struct bcr_perip { 247struct bcr_perip {
355#ifdef CONFIG_CPU_BIG_ENDIAN 248#ifdef CONFIG_CPU_BIG_ENDIAN
356 unsigned int start:8, pad2:8, sz:8, pad:8; 249 unsigned int start:8, pad2:8, sz:8, pad:8;
@@ -403,7 +296,7 @@ struct cpuinfo_arc_mmu {
403}; 296};
404 297
405struct cpuinfo_arc_cache { 298struct cpuinfo_arc_cache {
406 unsigned int has_aliasing, sz, line_len, assoc, ver; 299 unsigned int sz, line_len, assoc, ver;
407}; 300};
408 301
409struct cpuinfo_arc_ccm { 302struct cpuinfo_arc_ccm {
diff --git a/arch/arc/include/asm/bug.h b/arch/arc/include/asm/bug.h
index 2ad8f9b1c54b..5b18e94c6678 100644
--- a/arch/arc/include/asm/bug.h
+++ b/arch/arc/include/asm/bug.h
@@ -18,9 +18,8 @@ struct task_struct;
18void show_regs(struct pt_regs *regs); 18void show_regs(struct pt_regs *regs);
19void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs); 19void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs);
20void show_kernel_fault_diag(const char *str, struct pt_regs *regs, 20void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
21 unsigned long address, unsigned long cause_reg); 21 unsigned long address);
22void die(const char *str, struct pt_regs *regs, unsigned long address, 22void die(const char *str, struct pt_regs *regs, unsigned long address);
23 unsigned long cause_reg);
24 23
25#define BUG() do { \ 24#define BUG() do { \
26 dump_stack(); \ 25 dump_stack(); \
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h
index d5555fe4742a..5802849a6cae 100644
--- a/arch/arc/include/asm/cache.h
+++ b/arch/arc/include/asm/cache.h
@@ -18,21 +18,19 @@
18 18
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
20 20
21#define ARC_ICACHE_WAYS 2 21/* For a rare case where customers have differently config I/D */
22#define ARC_DCACHE_WAYS 4
23
24/* Helpers */
25#define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES 22#define ARC_ICACHE_LINE_LEN L1_CACHE_BYTES
26#define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES 23#define ARC_DCACHE_LINE_LEN L1_CACHE_BYTES
27 24
28#define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1)) 25#define ICACHE_LINE_MASK (~(ARC_ICACHE_LINE_LEN - 1))
29#define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1)) 26#define DCACHE_LINE_MASK (~(ARC_DCACHE_LINE_LEN - 1))
30 27
31#if ARC_ICACHE_LINE_LEN != ARC_DCACHE_LINE_LEN 28/*
32#error "Need to fix some code as I/D cache lines not same" 29 * ARC700 doesn't cache any access in top 256M.
33#else 30 * Ideal for wiring memory mapped peripherals as we don't need to do
34#define is_not_cache_aligned(p) ((unsigned long)p & (~DCACHE_LINE_MASK)) 31 * explicit uncached accesses (LD.di/ST.di) hence more portable drivers
35#endif 32 */
33#define ARC_UNCACHED_ADDR_SPACE 0xc0000000
36 34
37#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
38 36
@@ -57,16 +55,10 @@
57 55
58#define ARCH_DMA_MINALIGN L1_CACHE_BYTES 56#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
59 57
60/*
61 * ARC700 doesn't cache any access in top 256M.
62 * Ideal for wiring memory mapped peripherals as we don't need to do
63 * explicit uncached accesses (LD.di/ST.di) hence more portable drivers
64 */
65#define ARC_UNCACHED_ADDR_SPACE 0xc0000000
66
67extern void arc_cache_init(void); 58extern void arc_cache_init(void);
68extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); 59extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
69extern void __init read_decode_cache_bcr(void); 60extern void __init read_decode_cache_bcr(void);
70#endif 61
62#endif /* !__ASSEMBLY__ */
71 63
72#endif /* _ASM_CACHE_H */ 64#endif /* _ASM_CACHE_H */
diff --git a/arch/arc/include/asm/cacheflush.h b/arch/arc/include/asm/cacheflush.h
index ef62682e8d95..6abc4972bc93 100644
--- a/arch/arc/include/asm/cacheflush.h
+++ b/arch/arc/include/asm/cacheflush.h
@@ -81,16 +81,19 @@ void flush_anon_page(struct vm_area_struct *vma,
81#endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */ 81#endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */
82 82
83/* 83/*
84 * A new pagecache page has PG_arch_1 clear - thus dcache dirty by default
85 * This works around some PIO based drivers which don't call flush_dcache_page
86 * to record that they dirtied the dcache
87 */
88#define PG_dc_clean PG_arch_1
89
90/*
84 * Simple wrapper over config option 91 * Simple wrapper over config option
85 * Bootup code ensures that hardware matches kernel configuration 92 * Bootup code ensures that hardware matches kernel configuration
86 */ 93 */
87static inline int cache_is_vipt_aliasing(void) 94static inline int cache_is_vipt_aliasing(void)
88{ 95{
89#ifdef CONFIG_ARC_CACHE_VIPT_ALIASING 96 return IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
90 return 1;
91#else
92 return 0;
93#endif
94} 97}
95 98
96#define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1) 99#define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1)
diff --git a/arch/arc/include/asm/defines.h b/arch/arc/include/asm/defines.h
deleted file mode 100644
index 6097bb439cc5..000000000000
--- a/arch/arc/include/asm/defines.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.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#ifndef __ARC_ASM_DEFINES_H__
10#define __ARC_ASM_DEFINES_H__
11
12#if defined(CONFIG_ARC_MMU_V1)
13#define CONFIG_ARC_MMU_VER 1
14#elif defined(CONFIG_ARC_MMU_V2)
15#define CONFIG_ARC_MMU_VER 2
16#elif defined(CONFIG_ARC_MMU_V3)
17#define CONFIG_ARC_MMU_VER 3
18#endif
19
20#ifdef CONFIG_ARC_HAS_LLSC
21#define __CONFIG_ARC_HAS_LLSC_VAL 1
22#else
23#define __CONFIG_ARC_HAS_LLSC_VAL 0
24#endif
25
26#ifdef CONFIG_ARC_HAS_SWAPE
27#define __CONFIG_ARC_HAS_SWAPE_VAL 1
28#else
29#define __CONFIG_ARC_HAS_SWAPE_VAL 0
30#endif
31
32#ifdef CONFIG_ARC_HAS_RTSC
33#define __CONFIG_ARC_HAS_RTSC_VAL 1
34#else
35#define __CONFIG_ARC_HAS_RTSC_VAL 0
36#endif
37
38#ifdef CONFIG_ARC_MMU_SASID
39#define __CONFIG_ARC_MMU_SASID_VAL 1
40#else
41#define __CONFIG_ARC_MMU_SASID_VAL 0
42#endif
43
44#ifdef CONFIG_ARC_HAS_ICACHE
45#define __CONFIG_ARC_HAS_ICACHE 1
46#else
47#define __CONFIG_ARC_HAS_ICACHE 0
48#endif
49
50#ifdef CONFIG_ARC_HAS_DCACHE
51#define __CONFIG_ARC_HAS_DCACHE 1
52#else
53#define __CONFIG_ARC_HAS_DCACHE 0
54#endif
55
56#endif /* __ARC_ASM_DEFINES_H__ */
diff --git a/arch/arc/include/asm/entry.h b/arch/arc/include/asm/entry.h
index eb2ae53187d9..8943c028d4bb 100644
--- a/arch/arc/include/asm/entry.h
+++ b/arch/arc/include/asm/entry.h
@@ -50,194 +50,177 @@
50 * Eff Addr for load = [reg2] 50 * Eff Addr for load = [reg2]
51 */ 51 */
52 52
53.macro PUSH reg
54 st.a \reg, [sp, -4]
55.endm
56
57.macro PUSHAX aux
58 lr r9, [\aux]
59 PUSH r9
60.endm
61
62.macro POP reg
63 ld.ab \reg, [sp, 4]
64.endm
65
66.macro POPAX aux
67 POP r9
68 sr r9, [\aux]
69.endm
70
53/*-------------------------------------------------------------- 71/*--------------------------------------------------------------
54 * Save caller saved registers (scratch registers) ( r0 - r12 ) 72 * Helpers to save/restore Scratch Regs:
55 * Registers are pushed / popped in the order defined in struct ptregs 73 * used by Interrupt/Exception Prologue/Epilogue
56 * in asm/ptrace.h
57 *-------------------------------------------------------------*/ 74 *-------------------------------------------------------------*/
58.macro SAVE_CALLER_SAVED 75.macro SAVE_R0_TO_R12
59 st.a r0, [sp, -4] 76 PUSH r0
60 st.a r1, [sp, -4] 77 PUSH r1
61 st.a r2, [sp, -4] 78 PUSH r2
62 st.a r3, [sp, -4] 79 PUSH r3
63 st.a r4, [sp, -4] 80 PUSH r4
64 st.a r5, [sp, -4] 81 PUSH r5
65 st.a r6, [sp, -4] 82 PUSH r6
66 st.a r7, [sp, -4] 83 PUSH r7
67 st.a r8, [sp, -4] 84 PUSH r8
68 st.a r9, [sp, -4] 85 PUSH r9
69 st.a r10, [sp, -4] 86 PUSH r10
70 st.a r11, [sp, -4] 87 PUSH r11
71 st.a r12, [sp, -4] 88 PUSH r12
89.endm
90
91.macro RESTORE_R12_TO_R0
92 POP r12
93 POP r11
94 POP r10
95 POP r9
96 POP r8
97 POP r7
98 POP r6
99 POP r5
100 POP r4
101 POP r3
102 POP r2
103 POP r1
104 POP r0
105
106#ifdef CONFIG_ARC_CURR_IN_REG
107 ld r25, [sp, 12]
108#endif
72.endm 109.endm
73 110
74/*-------------------------------------------------------------- 111/*--------------------------------------------------------------
75 * Restore caller saved registers (scratch registers) 112 * Helpers to save/restore callee-saved regs:
113 * used by several macros below
76 *-------------------------------------------------------------*/ 114 *-------------------------------------------------------------*/
77.macro RESTORE_CALLER_SAVED 115.macro SAVE_R13_TO_R24
78 ld.ab r12, [sp, 4] 116 PUSH r13
79 ld.ab r11, [sp, 4] 117 PUSH r14
80 ld.ab r10, [sp, 4] 118 PUSH r15
81 ld.ab r9, [sp, 4] 119 PUSH r16
82 ld.ab r8, [sp, 4] 120 PUSH r17
83 ld.ab r7, [sp, 4] 121 PUSH r18
84 ld.ab r6, [sp, 4] 122 PUSH r19
85 ld.ab r5, [sp, 4] 123 PUSH r20
86 ld.ab r4, [sp, 4] 124 PUSH r21
87 ld.ab r3, [sp, 4] 125 PUSH r22
88 ld.ab r2, [sp, 4] 126 PUSH r23
89 ld.ab r1, [sp, 4] 127 PUSH r24
90 ld.ab r0, [sp, 4] 128.endm
129
130.macro RESTORE_R24_TO_R13
131 POP r24
132 POP r23
133 POP r22
134 POP r21
135 POP r20
136 POP r19
137 POP r18
138 POP r17
139 POP r16
140 POP r15
141 POP r14
142 POP r13
91.endm 143.endm
92 144
145#define OFF_USER_R25_FROM_R24 (SZ_CALLEE_REGS + SZ_PT_REGS - 8)/4
93 146
94/*-------------------------------------------------------------- 147/*--------------------------------------------------------------
95 * Save callee saved registers (non scratch registers) ( r13 - r25 ) 148 * Collect User Mode callee regs as struct callee_regs - needed by
96 * on kernel stack. 149 * fork/do_signal/unaligned-access-emulation.
97 * User mode callee regs need to be saved in case of 150 * (By default only scratch regs are saved on entry to kernel)
98 * -fork and friends for replicating from parent to child 151 *
99 * -before going into do_signal( ) for ptrace/core-dump 152 * Special handling for r25 if used for caching Task Pointer.
100 * Special case handling is required for r25 in case it is used by kernel 153 * It would have been saved in task->thread.user_r25 already, but to keep
101 * for caching task ptr. Low level exception/ISR save user mode r25 154 * the interface same it is copied into regular r25 placeholder in
102 * into task->thread.user_r25. So it needs to be retrieved from there and 155 * struct callee_regs.
103 * saved into kernel stack with rest of callee reg-file
104 *-------------------------------------------------------------*/ 156 *-------------------------------------------------------------*/
105.macro SAVE_CALLEE_SAVED_USER 157.macro SAVE_CALLEE_SAVED_USER
106 st.a r13, [sp, -4] 158
107 st.a r14, [sp, -4] 159 SAVE_R13_TO_R24
108 st.a r15, [sp, -4]
109 st.a r16, [sp, -4]
110 st.a r17, [sp, -4]
111 st.a r18, [sp, -4]
112 st.a r19, [sp, -4]
113 st.a r20, [sp, -4]
114 st.a r21, [sp, -4]
115 st.a r22, [sp, -4]
116 st.a r23, [sp, -4]
117 st.a r24, [sp, -4]
118 160
119#ifdef CONFIG_ARC_CURR_IN_REG 161#ifdef CONFIG_ARC_CURR_IN_REG
120 ; Retrieve orig r25 and save it on stack 162 ; Retrieve orig r25 and save it on stack
121 ld r12, [r25, TASK_THREAD + THREAD_USER_R25] 163 ld.as r12, [sp, OFF_USER_R25_FROM_R24]
122 st.a r12, [sp, -4] 164 st.a r12, [sp, -4]
123#else 165#else
124 st.a r25, [sp, -4] 166 PUSH r25
125#endif 167#endif
126 168
127 /* move up by 1 word to "create" callee_regs->"stack_place_holder" */
128 sub sp, sp, 4
129.endm 169.endm
130 170
131/*-------------------------------------------------------------- 171/*--------------------------------------------------------------
132 * Save callee saved registers (non scratch registers) ( r13 - r25 ) 172 * Save kernel Mode callee regs at the time of Contect Switch.
133 * kernel mode callee regs needed to be saved in case of context switch 173 *
134 * If r25 is used for caching task pointer then that need not be saved 174 * Special handling for r25 if used for caching Task Pointer.
135 * as it can be re-created from current task global 175 * Kernel simply skips saving it since it will be loaded with
176 * incoming task pointer anyways
136 *-------------------------------------------------------------*/ 177 *-------------------------------------------------------------*/
137.macro SAVE_CALLEE_SAVED_KERNEL 178.macro SAVE_CALLEE_SAVED_KERNEL
138 st.a r13, [sp, -4] 179
139 st.a r14, [sp, -4] 180 SAVE_R13_TO_R24
140 st.a r15, [sp, -4] 181
141 st.a r16, [sp, -4]
142 st.a r17, [sp, -4]
143 st.a r18, [sp, -4]
144 st.a r19, [sp, -4]
145 st.a r20, [sp, -4]
146 st.a r21, [sp, -4]
147 st.a r22, [sp, -4]
148 st.a r23, [sp, -4]
149 st.a r24, [sp, -4]
150#ifdef CONFIG_ARC_CURR_IN_REG 182#ifdef CONFIG_ARC_CURR_IN_REG
151 sub sp, sp, 8
152#else
153 st.a r25, [sp, -4]
154 sub sp, sp, 4 183 sub sp, sp, 4
184#else
185 PUSH r25
155#endif 186#endif
156.endm 187.endm
157 188
158/*-------------------------------------------------------------- 189/*--------------------------------------------------------------
159 * RESTORE_CALLEE_SAVED_KERNEL: 190 * Opposite of SAVE_CALLEE_SAVED_KERNEL
160 * Loads callee (non scratch) Reg File by popping from Kernel mode stack.
161 * This is reverse of SAVE_CALLEE_SAVED,
162 *
163 * NOTE:
164 * Ideally this shd only be called in switch_to for loading
165 * switched-IN task's CALLEE Reg File.
166 * For all other cases RESTORE_CALLEE_SAVED_FAST must be used
167 * which simply pops the stack w/o touching regs.
168 *-------------------------------------------------------------*/ 191 *-------------------------------------------------------------*/
169.macro RESTORE_CALLEE_SAVED_KERNEL 192.macro RESTORE_CALLEE_SAVED_KERNEL
170 193
171
172#ifdef CONFIG_ARC_CURR_IN_REG 194#ifdef CONFIG_ARC_CURR_IN_REG
173 add sp, sp, 8 /* skip callee_reg gutter and user r25 placeholder */ 195 add sp, sp, 4 /* skip usual r25 placeholder */
174#else 196#else
175 add sp, sp, 4 /* skip "callee_regs->stack_place_holder" */ 197 POP r25
176 ld.ab r25, [sp, 4]
177#endif 198#endif
178 199 RESTORE_R24_TO_R13
179 ld.ab r24, [sp, 4]
180 ld.ab r23, [sp, 4]
181 ld.ab r22, [sp, 4]
182 ld.ab r21, [sp, 4]
183 ld.ab r20, [sp, 4]
184 ld.ab r19, [sp, 4]
185 ld.ab r18, [sp, 4]
186 ld.ab r17, [sp, 4]
187 ld.ab r16, [sp, 4]
188 ld.ab r15, [sp, 4]
189 ld.ab r14, [sp, 4]
190 ld.ab r13, [sp, 4]
191
192.endm 200.endm
193 201
194/*-------------------------------------------------------------- 202/*--------------------------------------------------------------
195 * RESTORE_CALLEE_SAVED_USER: 203 * Opposite of SAVE_CALLEE_SAVED_USER
196 * This is called after do_signal where tracer might have changed callee regs 204 *
197 * thus we need to restore the reg file. 205 * ptrace tracer or unaligned-access fixup might have changed a user mode
198 * Special case handling is required for r25 in case it is used by kernel 206 * callee reg which is saved back to usual r25 storage location
199 * for caching task ptr. Ptrace would have modified on-kernel-stack value of
200 * r25, which needs to be shoved back into task->thread.user_r25 where from
201 * Low level exception/ISR return code will retrieve to populate with rest of
202 * callee reg-file.
203 *-------------------------------------------------------------*/ 207 *-------------------------------------------------------------*/
204.macro RESTORE_CALLEE_SAVED_USER 208.macro RESTORE_CALLEE_SAVED_USER
205 209
206 add sp, sp, 4 /* skip "callee_regs->stack_place_holder" */
207
208#ifdef CONFIG_ARC_CURR_IN_REG 210#ifdef CONFIG_ARC_CURR_IN_REG
209 ld.ab r12, [sp, 4] 211 ld.ab r12, [sp, 4]
210 st r12, [r25, TASK_THREAD + THREAD_USER_R25] 212 st.as r12, [sp, OFF_USER_R25_FROM_R24]
211#else 213#else
212 ld.ab r25, [sp, 4] 214 POP r25
213#endif 215#endif
214 216 RESTORE_R24_TO_R13
215 ld.ab r24, [sp, 4]
216 ld.ab r23, [sp, 4]
217 ld.ab r22, [sp, 4]
218 ld.ab r21, [sp, 4]
219 ld.ab r20, [sp, 4]
220 ld.ab r19, [sp, 4]
221 ld.ab r18, [sp, 4]
222 ld.ab r17, [sp, 4]
223 ld.ab r16, [sp, 4]
224 ld.ab r15, [sp, 4]
225 ld.ab r14, [sp, 4]
226 ld.ab r13, [sp, 4]
227.endm 217.endm
228 218
229/*-------------------------------------------------------------- 219/*--------------------------------------------------------------
230 * Super FAST Restore callee saved regs by simply re-adjusting SP 220 * Super FAST Restore callee saved regs by simply re-adjusting SP
231 *-------------------------------------------------------------*/ 221 *-------------------------------------------------------------*/
232.macro DISCARD_CALLEE_SAVED_USER 222.macro DISCARD_CALLEE_SAVED_USER
233 add sp, sp, 14 * 4 223 add sp, sp, SZ_CALLEE_REGS
234.endm
235
236/*--------------------------------------------------------------
237 * Restore User mode r25 saved in task_struct->thread.user_r25
238 *-------------------------------------------------------------*/
239.macro RESTORE_USER_R25
240 ld r25, [r25, TASK_THREAD + THREAD_USER_R25]
241.endm 224.endm
242 225
243/*------------------------------------------------------------- 226/*-------------------------------------------------------------
@@ -252,7 +235,7 @@
252 ld \out, [\tsk, TASK_THREAD_INFO] 235 ld \out, [\tsk, TASK_THREAD_INFO]
253 236
254 /* Go to end of page where stack begins (grows upwards) */ 237 /* Go to end of page where stack begins (grows upwards) */
255 add2 \out, \out, (THREAD_SIZE - 4)/4 /* one word GUTTER */ 238 add2 \out, \out, (THREAD_SIZE)/4
256 239
257.endm 240.endm
258 241
@@ -305,33 +288,28 @@
305 * safe-keeping not really needed, but it keeps the epilogue code 288 * safe-keeping not really needed, but it keeps the epilogue code
306 * (SP restore) simpler/uniform. 289 * (SP restore) simpler/uniform.
307 */ 290 */
308 b.d 77f 291 b.d 66f
309 292 mov r9, sp
310 st.a sp, [sp, -12] ; Make room for orig_r0 and orig_r8
311 293
31288: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */ 29488: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */
313 295
314 GET_CURR_TASK_ON_CPU r9 296 GET_CURR_TASK_ON_CPU r9
315 297
316#ifdef CONFIG_ARC_CURR_IN_REG
317
318 /* If current task pointer cached in r25, time to
319 * -safekeep USER r25 in task->thread_struct->user_r25
320 * -load r25 with current task ptr
321 */
322 st.as r25, [r9, (TASK_THREAD + THREAD_USER_R25)/4]
323 mov r25, r9
324#endif
325
326 /* With current tsk in r9, get it's kernel mode stack base */ 298 /* With current tsk in r9, get it's kernel mode stack base */
327 GET_TSK_STACK_BASE r9, r9 299 GET_TSK_STACK_BASE r9, r9
328 300
329#ifdef PT_REGS_CANARY 30166:
330 st 0xabcdabcd, [r9, 0] 302#ifdef CONFIG_ARC_CURR_IN_REG
303 /*
304 * Treat r25 as scratch reg, save it on stack first
305 * Load it with current task pointer
306 */
307 st r25, [r9, -4]
308 GET_CURR_TASK_ON_CPU r25
331#endif 309#endif
332 310
333 /* Save Pre Intr/Exception User SP on kernel stack */ 311 /* Save Pre Intr/Exception User SP on kernel stack */
334 st.a sp, [r9, -12] ; Make room for orig_r0 and orig_r8 312 st.a sp, [r9, -16] ; Make room for orig_r0, ECR, user_r25
335 313
336 /* CAUTION: 314 /* CAUTION:
337 * SP should be set at the very end when we are done with everything 315 * SP should be set at the very end when we are done with everything
@@ -342,7 +320,7 @@
342 /* set SP to point to kernel mode stack */ 320 /* set SP to point to kernel mode stack */
343 mov sp, r9 321 mov sp, r9
344 322
34577: /* ----- Stack Switched to kernel Mode, Now save REG FILE ----- */ 323 /* ----- Stack Switched to kernel Mode, Now save REG FILE ----- */
346 324
347.endm 325.endm
348 326
@@ -369,7 +347,7 @@
369 * @reg [OUT] &thread_info of "current" 347 * @reg [OUT] &thread_info of "current"
370 */ 348 */
371.macro GET_CURR_THR_INFO_FROM_SP reg 349.macro GET_CURR_THR_INFO_FROM_SP reg
372 and \reg, sp, ~(THREAD_SIZE - 1) 350 bic \reg, sp, (THREAD_SIZE - 1)
373.endm 351.endm
374 352
375/* 353/*
@@ -413,62 +391,25 @@
413 * Note that syscalls are implemented via TRAP which is also a exception 391 * Note that syscalls are implemented via TRAP which is also a exception
414 * from CPU's point of view 392 * from CPU's point of view
415 *-------------------------------------------------------------*/ 393 *-------------------------------------------------------------*/
416.macro SAVE_ALL_EXCEPTION marker 394.macro SAVE_ALL_SYS
417 395
418 st \marker, [sp, 8] /* orig_r8 */ 396 lr r9, [ecr]
397 st r9, [sp, 8] /* ECR */
419 st r0, [sp, 4] /* orig_r0, needed only for sys calls */ 398 st r0, [sp, 4] /* orig_r0, needed only for sys calls */
420 399
421 /* Restore r9 used to code the early prologue */ 400 /* Restore r9 used to code the early prologue */
422 EXCPN_PROLOG_RESTORE_REG r9 401 EXCPN_PROLOG_RESTORE_REG r9
423 402
424 SAVE_CALLER_SAVED 403 SAVE_R0_TO_R12
425 st.a r26, [sp, -4] /* gp */ 404 PUSH gp
426 st.a fp, [sp, -4] 405 PUSH fp
427 st.a blink, [sp, -4] 406 PUSH blink
428 lr r9, [eret] 407 PUSHAX eret
429 st.a r9, [sp, -4] 408 PUSHAX erstatus
430 lr r9, [erstatus] 409 PUSH lp_count
431 st.a r9, [sp, -4] 410 PUSHAX lp_end
432 st.a lp_count, [sp, -4] 411 PUSHAX lp_start
433 lr r9, [lp_end] 412 PUSHAX erbta
434 st.a r9, [sp, -4]
435 lr r9, [lp_start]
436 st.a r9, [sp, -4]
437 lr r9, [erbta]
438 st.a r9, [sp, -4]
439
440#ifdef PT_REGS_CANARY
441 mov r9, 0xdeadbeef
442 st r9, [sp, -4]
443#endif
444
445 /* move up by 1 word to "create" pt_regs->"stack_place_holder" */
446 sub sp, sp, 4
447.endm
448
449/*--------------------------------------------------------------
450 * Save scratch regs for exceptions
451 *-------------------------------------------------------------*/
452.macro SAVE_ALL_SYS
453 SAVE_ALL_EXCEPTION orig_r8_IS_EXCPN
454.endm
455
456/*--------------------------------------------------------------
457 * Save scratch regs for sys calls
458 *-------------------------------------------------------------*/
459.macro SAVE_ALL_TRAP
460 /*
461 * Setup pt_regs->orig_r8.
462 * Encode syscall number (r8) in upper short word of event type (r9)
463 * N.B. #1: This is already endian safe (see ptrace.h)
464 * #2: Only r9 can be used as scratch as it is already clobbered
465 * and it's contents are no longer needed by the latter part
466 * of exception prologue
467 */
468 lsl r9, r8, 16
469 or r9, r9, orig_r8_IS_SCALL
470
471 SAVE_ALL_EXCEPTION r9
472.endm 413.endm
473 414
474/*-------------------------------------------------------------- 415/*--------------------------------------------------------------
@@ -483,28 +424,22 @@
483 * by hardware and that is not good. 424 * by hardware and that is not good.
484 *-------------------------------------------------------------*/ 425 *-------------------------------------------------------------*/
485.macro RESTORE_ALL_SYS 426.macro RESTORE_ALL_SYS
427 POPAX erbta
428 POPAX lp_start
429 POPAX lp_end
430
431 POP r9
432 mov lp_count, r9 ;LD to lp_count is not allowed
486 433
487 add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ 434 POPAX erstatus
488 435 POPAX eret
489 ld.ab r9, [sp, 4] 436 POP blink
490 sr r9, [erbta] 437 POP fp
491 ld.ab r9, [sp, 4] 438 POP gp
492 sr r9, [lp_start] 439 RESTORE_R12_TO_R0
493 ld.ab r9, [sp, 4]
494 sr r9, [lp_end]
495 ld.ab r9, [sp, 4]
496 mov lp_count, r9
497 ld.ab r9, [sp, 4]
498 sr r9, [erstatus]
499 ld.ab r9, [sp, 4]
500 sr r9, [eret]
501 ld.ab blink, [sp, 4]
502 ld.ab fp, [sp, 4]
503 ld.ab r26, [sp, 4] /* gp */
504 RESTORE_CALLER_SAVED
505 440
506 ld sp, [sp] /* restore original sp */ 441 ld sp, [sp] /* restore original sp */
507 /* orig_r0 and orig_r8 skipped automatically */ 442 /* orig_r0, ECR, user_r25 skipped automatically */
508.endm 443.endm
509 444
510 445
@@ -513,9 +448,7 @@
513 *-------------------------------------------------------------*/ 448 *-------------------------------------------------------------*/
514.macro SAVE_ALL_INT1 449.macro SAVE_ALL_INT1
515 450
516 /* restore original r9 , saved in int1_saved_reg 451 /* restore original r9 to be saved as part of reg-file */
517 * It will be saved on stack in macro: SAVE_CALLER_SAVED
518 */
519#ifdef CONFIG_SMP 452#ifdef CONFIG_SMP
520 lr r9, [ARC_REG_SCRATCH_DATA0] 453 lr r9, [ARC_REG_SCRATCH_DATA0]
521#else 454#else
@@ -523,29 +456,19 @@
523#endif 456#endif
524 457
525 /* now we are ready to save the remaining context :) */ 458 /* now we are ready to save the remaining context :) */
526 st orig_r8_IS_IRQ1, [sp, 8] /* Event Type */ 459 st event_IRQ1, [sp, 8] /* Dummy ECR */
527 st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ 460 st 0, [sp, 4] /* orig_r0 , N/A for IRQ */
528 SAVE_CALLER_SAVED 461
529 st.a r26, [sp, -4] /* gp */ 462 SAVE_R0_TO_R12
530 st.a fp, [sp, -4] 463 PUSH gp
531 st.a blink, [sp, -4] 464 PUSH fp
532 st.a ilink1, [sp, -4] 465 PUSH blink
533 lr r9, [status32_l1] 466 PUSH ilink1
534 st.a r9, [sp, -4] 467 PUSHAX status32_l1
535 st.a lp_count, [sp, -4] 468 PUSH lp_count
536 lr r9, [lp_end] 469 PUSHAX lp_end
537 st.a r9, [sp, -4] 470 PUSHAX lp_start
538 lr r9, [lp_start] 471 PUSHAX bta_l1
539 st.a r9, [sp, -4]
540 lr r9, [bta_l1]
541 st.a r9, [sp, -4]
542
543#ifdef PT_REGS_CANARY
544 mov r9, 0xdeadbee1
545 st r9, [sp, -4]
546#endif
547 /* move up by 1 word to "create" pt_regs->"stack_place_holder" */
548 sub sp, sp, 4
549.endm 472.endm
550 473
551.macro SAVE_ALL_INT2 474.macro SAVE_ALL_INT2
@@ -558,30 +481,19 @@
558 ld r9, [@int2_saved_reg] 481 ld r9, [@int2_saved_reg]
559 482
560 /* now we are ready to save the remaining context :) */ 483 /* now we are ready to save the remaining context :) */
561 st orig_r8_IS_IRQ2, [sp, 8] /* Event Type */ 484 st event_IRQ2, [sp, 8] /* Dummy ECR */
562 st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ 485 st 0, [sp, 4] /* orig_r0 , N/A for IRQ */
563 SAVE_CALLER_SAVED
564 st.a r26, [sp, -4] /* gp */
565 st.a fp, [sp, -4]
566 st.a blink, [sp, -4]
567 st.a ilink2, [sp, -4]
568 lr r9, [status32_l2]
569 st.a r9, [sp, -4]
570 st.a lp_count, [sp, -4]
571 lr r9, [lp_end]
572 st.a r9, [sp, -4]
573 lr r9, [lp_start]
574 st.a r9, [sp, -4]
575 lr r9, [bta_l2]
576 st.a r9, [sp, -4]
577
578#ifdef PT_REGS_CANARY
579 mov r9, 0xdeadbee2
580 st r9, [sp, -4]
581#endif
582 486
583 /* move up by 1 word to "create" pt_regs->"stack_place_holder" */ 487 SAVE_R0_TO_R12
584 sub sp, sp, 4 488 PUSH gp
489 PUSH fp
490 PUSH blink
491 PUSH ilink2
492 PUSHAX status32_l2
493 PUSH lp_count
494 PUSHAX lp_end
495 PUSHAX lp_start
496 PUSHAX bta_l2
585.endm 497.endm
586 498
587/*-------------------------------------------------------------- 499/*--------------------------------------------------------------
@@ -595,52 +507,41 @@
595 *-------------------------------------------------------------*/ 507 *-------------------------------------------------------------*/
596 508
597.macro RESTORE_ALL_INT1 509.macro RESTORE_ALL_INT1
598 add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ 510 POPAX bta_l1
599 511 POPAX lp_start
600 ld.ab r9, [sp, 4] /* Actual reg file */ 512 POPAX lp_end
601 sr r9, [bta_l1] 513
602 ld.ab r9, [sp, 4] 514 POP r9
603 sr r9, [lp_start] 515 mov lp_count, r9 ;LD to lp_count is not allowed
604 ld.ab r9, [sp, 4] 516
605 sr r9, [lp_end] 517 POPAX status32_l1
606 ld.ab r9, [sp, 4] 518 POP ilink1
607 mov lp_count, r9 519 POP blink
608 ld.ab r9, [sp, 4] 520 POP fp
609 sr r9, [status32_l1] 521 POP gp
610 ld.ab r9, [sp, 4] 522 RESTORE_R12_TO_R0
611 mov ilink1, r9
612 ld.ab blink, [sp, 4]
613 ld.ab fp, [sp, 4]
614 ld.ab r26, [sp, 4] /* gp */
615 RESTORE_CALLER_SAVED
616 523
617 ld sp, [sp] /* restore original sp */ 524 ld sp, [sp] /* restore original sp */
618 /* orig_r0 and orig_r8 skipped automatically */ 525 /* orig_r0, ECR, user_r25 skipped automatically */
619.endm 526.endm
620 527
621.macro RESTORE_ALL_INT2 528.macro RESTORE_ALL_INT2
622 add sp, sp, 4 /* hop over unused "pt_regs->stack_place_holder" */ 529 POPAX bta_l2
623 530 POPAX lp_start
624 ld.ab r9, [sp, 4] 531 POPAX lp_end
625 sr r9, [bta_l2]
626 ld.ab r9, [sp, 4]
627 sr r9, [lp_start]
628 ld.ab r9, [sp, 4]
629 sr r9, [lp_end]
630 ld.ab r9, [sp, 4]
631 mov lp_count, r9
632 ld.ab r9, [sp, 4]
633 sr r9, [status32_l2]
634 ld.ab r9, [sp, 4]
635 mov ilink2, r9
636 ld.ab blink, [sp, 4]
637 ld.ab fp, [sp, 4]
638 ld.ab r26, [sp, 4] /* gp */
639 RESTORE_CALLER_SAVED
640 532
641 ld sp, [sp] /* restore original sp */ 533 POP r9
642 /* orig_r0 and orig_r8 skipped automatically */ 534 mov lp_count, r9 ;LD to lp_count is not allowed
643 535
536 POPAX status32_l2
537 POP ilink2
538 POP blink
539 POP fp
540 POP gp
541 RESTORE_R12_TO_R0
542
543 ld sp, [sp] /* restore original sp */
544 /* orig_r0, ECR, user_r25 skipped automatically */
644.endm 545.endm
645 546
646 547
diff --git a/arch/arc/include/asm/irq.h b/arch/arc/include/asm/irq.h
index 57898a17eb82..c0a72105ee0b 100644
--- a/arch/arc/include/asm/irq.h
+++ b/arch/arc/include/asm/irq.h
@@ -21,6 +21,6 @@
21extern void __init arc_init_IRQ(void); 21extern void __init arc_init_IRQ(void);
22extern int __init get_hw_config_num_irq(void); 22extern int __init get_hw_config_num_irq(void);
23 23
24void __cpuinit arc_local_timer_setup(unsigned int cpu); 24void arc_local_timer_setup(unsigned int cpu);
25 25
26#endif 26#endif
diff --git a/arch/arc/include/asm/irqflags.h b/arch/arc/include/asm/irqflags.h
index eac071668201..d99f79bcf865 100644
--- a/arch/arc/include/asm/irqflags.h
+++ b/arch/arc/include/asm/irqflags.h
@@ -19,6 +19,26 @@
19 19
20#include <asm/arcregs.h> 20#include <asm/arcregs.h>
21 21
22/* status32 Reg bits related to Interrupt Handling */
23#define STATUS_E1_BIT 1 /* Int 1 enable */
24#define STATUS_E2_BIT 2 /* Int 2 enable */
25#define STATUS_A1_BIT 3 /* Int 1 active */
26#define STATUS_A2_BIT 4 /* Int 2 active */
27
28#define STATUS_E1_MASK (1<<STATUS_E1_BIT)
29#define STATUS_E2_MASK (1<<STATUS_E2_BIT)
30#define STATUS_A1_MASK (1<<STATUS_A1_BIT)
31#define STATUS_A2_MASK (1<<STATUS_A2_BIT)
32
33/* Other Interrupt Handling related Aux regs */
34#define AUX_IRQ_LEV 0x200 /* IRQ Priority: L1 or L2 */
35#define AUX_IRQ_HINT 0x201 /* For generating Soft Interrupts */
36#define AUX_IRQ_LV12 0x43 /* interrupt level register */
37
38#define AUX_IENABLE 0x40c
39#define AUX_ITRIGGER 0x40d
40#define AUX_IPULSE 0x415
41
22#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
23 43
24/****************************************************************** 44/******************************************************************
diff --git a/arch/arc/include/asm/kgdb.h b/arch/arc/include/asm/kgdb.h
index 4930957ca3d3..b65fca7ffeb5 100644
--- a/arch/arc/include/asm/kgdb.h
+++ b/arch/arc/include/asm/kgdb.h
@@ -31,7 +31,7 @@ static inline void arch_kgdb_breakpoint(void)
31 __asm__ __volatile__ ("trap_s 0x4\n"); 31 __asm__ __volatile__ ("trap_s 0x4\n");
32} 32}
33 33
34extern void kgdb_trap(struct pt_regs *regs, int param); 34extern void kgdb_trap(struct pt_regs *regs);
35 35
36enum arc700_linux_regnums { 36enum arc700_linux_regnums {
37 _R0 = 0, 37 _R0 = 0,
@@ -53,7 +53,7 @@ enum arc700_linux_regnums {
53}; 53};
54 54
55#else 55#else
56#define kgdb_trap(regs, param) 56#define kgdb_trap(regs)
57#endif 57#endif
58 58
59#endif /* __ARC_KGDB_H__ */ 59#endif /* __ARC_KGDB_H__ */
diff --git a/arch/arc/include/asm/kprobes.h b/arch/arc/include/asm/kprobes.h
index 4d9c211fce70..944dbedb38b5 100644
--- a/arch/arc/include/asm/kprobes.h
+++ b/arch/arc/include/asm/kprobes.h
@@ -50,11 +50,9 @@ struct kprobe_ctlblk {
50 50
51int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause); 51int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause);
52void kretprobe_trampoline(void); 52void kretprobe_trampoline(void);
53void trap_is_kprobe(unsigned long cause, unsigned long address, 53void trap_is_kprobe(unsigned long address, struct pt_regs *regs);
54 struct pt_regs *regs);
55#else 54#else
56static void trap_is_kprobe(unsigned long cause, unsigned long address, 55static void trap_is_kprobe(unsigned long address, struct pt_regs *regs)
57 struct pt_regs *regs)
58{ 56{
59} 57}
60#endif 58#endif
diff --git a/arch/arc/include/asm/mmu.h b/arch/arc/include/asm/mmu.h
index 56b02320f1a9..7c03fe61759c 100644
--- a/arch/arc/include/asm/mmu.h
+++ b/arch/arc/include/asm/mmu.h
@@ -9,6 +9,40 @@
9#ifndef _ASM_ARC_MMU_H 9#ifndef _ASM_ARC_MMU_H
10#define _ASM_ARC_MMU_H 10#define _ASM_ARC_MMU_H
11 11
12#if defined(CONFIG_ARC_MMU_V1)
13#define CONFIG_ARC_MMU_VER 1
14#elif defined(CONFIG_ARC_MMU_V2)
15#define CONFIG_ARC_MMU_VER 2
16#elif defined(CONFIG_ARC_MMU_V3)
17#define CONFIG_ARC_MMU_VER 3
18#endif
19
20/* MMU Management regs */
21#define ARC_REG_MMU_BCR 0x06f
22#define ARC_REG_TLBPD0 0x405
23#define ARC_REG_TLBPD1 0x406
24#define ARC_REG_TLBINDEX 0x407
25#define ARC_REG_TLBCOMMAND 0x408
26#define ARC_REG_PID 0x409
27#define ARC_REG_SCRATCH_DATA0 0x418
28
29/* Bits in MMU PID register */
30#define MMU_ENABLE (1 << 31) /* Enable MMU for process */
31
32/* Error code if probe fails */
33#define TLB_LKUP_ERR 0x80000000
34
35/* TLB Commands */
36#define TLBWrite 0x1
37#define TLBRead 0x2
38#define TLBGetIndex 0x3
39#define TLBProbe 0x4
40
41#if (CONFIG_ARC_MMU_VER >= 2)
42#define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */
43#define TLBIVUTLB 0x6 /* explicitly inv uTLBs */
44#endif
45
12#ifndef __ASSEMBLY__ 46#ifndef __ASSEMBLY__
13 47
14typedef struct { 48typedef struct {
@@ -18,6 +52,16 @@ typedef struct {
18#endif 52#endif
19} mm_context_t; 53} mm_context_t;
20 54
55#ifdef CONFIG_ARC_DBG_TLB_PARANOIA
56void tlb_paranoid_check(unsigned int pid_sw, unsigned long address);
57#else
58#define tlb_paranoid_check(a, b)
21#endif 59#endif
22 60
61void arc_mmu_init(void);
62extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
63void __init read_decode_mmu_bcr(void);
64
65#endif /* !__ASSEMBLY__ */
66
23#endif 67#endif
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h
index ab84bf131fe1..9c8aa41e45c2 100644
--- a/arch/arc/include/asm/page.h
+++ b/arch/arc/include/asm/page.h
@@ -96,13 +96,8 @@ typedef unsigned long pgtable_t;
96 96
97#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 97#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
98 98
99/* Default Permissions for page, used in mmap.c */ 99/* Default Permissions for stack/heaps pages (Non Executable) */
100#ifdef CONFIG_ARC_STACK_NONEXEC
101#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE) 100#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE)
102#else
103#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
104 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
105#endif
106 101
107#define WANT_PAGE_VIRTUAL 1 102#define WANT_PAGE_VIRTUAL 1
108 103
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 95b1522212a7..4749a0eee1cf 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -135,6 +135,12 @@
135/* ioremap */ 135/* ioremap */
136#define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS) 136#define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS)
137 137
138/* Masks for actual TLB "PD"s */
139#define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT)
140#define PTE_BITS_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE | \
141 _PAGE_U_EXECUTE | _PAGE_U_WRITE | _PAGE_U_READ | \
142 _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ)
143
138/************************************************************************** 144/**************************************************************************
139 * Mapping of vm_flags (Generic VM) to PTE flags (arch specific) 145 * Mapping of vm_flags (Generic VM) to PTE flags (arch specific)
140 * 146 *
@@ -394,9 +400,6 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
394 * remap a physical page `pfn' of size `size' with page protection `prot' 400 * remap a physical page `pfn' of size `size' with page protection `prot'
395 * into virtual address `from' 401 * into virtual address `from'
396 */ 402 */
397#define io_remap_pfn_range(vma, from, pfn, size, prot) \
398 remap_pfn_range(vma, from, pfn, size, prot)
399
400#include <asm-generic/pgtable.h> 403#include <asm-generic/pgtable.h>
401 404
402/* to cope with aliasing VIPT cache */ 405/* to cope with aliasing VIPT cache */
diff --git a/arch/arc/include/asm/processor.h b/arch/arc/include/asm/processor.h
index 5f26b2c1cba0..15334ab66b56 100644
--- a/arch/arc/include/asm/processor.h
+++ b/arch/arc/include/asm/processor.h
@@ -19,6 +19,7 @@
19#ifndef __ASSEMBLY__ 19#ifndef __ASSEMBLY__
20 20
21#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */ 21#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */
22#include <asm/ptrace.h>
22 23
23/* Arch specific stuff which needs to be saved per task. 24/* Arch specific stuff which needs to be saved per task.
24 * However these items are not so important so as to earn a place in 25 * However these items are not so important so as to earn a place in
@@ -28,10 +29,6 @@ struct thread_struct {
28 unsigned long ksp; /* kernel mode stack pointer */ 29 unsigned long ksp; /* kernel mode stack pointer */
29 unsigned long callee_reg; /* pointer to callee regs */ 30 unsigned long callee_reg; /* pointer to callee regs */
30 unsigned long fault_address; /* dbls as brkpt holder as well */ 31 unsigned long fault_address; /* dbls as brkpt holder as well */
31 unsigned long cause_code; /* Exception Cause Code (ECR) */
32#ifdef CONFIG_ARC_CURR_IN_REG
33 unsigned long user_r25;
34#endif
35#ifdef CONFIG_ARC_FPU_SAVE_RESTORE 32#ifdef CONFIG_ARC_FPU_SAVE_RESTORE
36 struct arc_fpu fpu; 33 struct arc_fpu fpu;
37#endif 34#endif
@@ -50,7 +47,7 @@ struct task_struct;
50unsigned long thread_saved_pc(struct task_struct *t); 47unsigned long thread_saved_pc(struct task_struct *t);
51 48
52#define task_pt_regs(p) \ 49#define task_pt_regs(p) \
53 ((struct pt_regs *)(THREAD_SIZE - 4 + (void *)task_stack_page(p)) - 1) 50 ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
54 51
55/* Free all resources held by a thread. */ 52/* Free all resources held by a thread. */
56#define release_thread(thread) do { } while (0) 53#define release_thread(thread) do { } while (0)
@@ -75,11 +72,15 @@ unsigned long thread_saved_pc(struct task_struct *t);
75 72
76/* 73/*
77 * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode. 74 * Where abouts of Task's sp, fp, blink when it was last seen in kernel mode.
78 * These can't be derived from pt_regs as that would give correp user-mode val 75 * Look in process.c for details of kernel stack layout
79 */ 76 */
80#define KSTK_ESP(tsk) (tsk->thread.ksp) 77#define KSTK_ESP(tsk) (tsk->thread.ksp)
81#define KSTK_BLINK(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1+1)*4))) 78
82#define KSTK_FP(tsk) (*((unsigned int *)((KSTK_ESP(tsk)) + (13+1)*4))) 79#define KSTK_REG(tsk, off) (*((unsigned int *)(KSTK_ESP(tsk) + \
80 sizeof(struct callee_regs) + off)))
81
82#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4)
83#define KSTK_FP(tsk) KSTK_REG(tsk, 0)
83 84
84/* 85/*
85 * Do necessary setup to start up a newly executed thread. 86 * Do necessary setup to start up a newly executed thread.
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
index 6179de7e07c2..c9938e7a7dbd 100644
--- a/arch/arc/include/asm/ptrace.h
+++ b/arch/arc/include/asm/ptrace.h
@@ -17,12 +17,6 @@
17/* THE pt_regs: Defines how regs are saved during entry into kernel */ 17/* THE pt_regs: Defines how regs are saved during entry into kernel */
18 18
19struct pt_regs { 19struct pt_regs {
20 /*
21 * 1 word gutter after reg-file has been saved
22 * Technically not needed, Since SP always points to a "full" location
23 * (vs. "empty"). But pt_regs is shared with tools....
24 */
25 long res;
26 20
27 /* Real registers */ 21 /* Real registers */
28 long bta; /* bta_l1, bta_l2, erbta */ 22 long bta; /* bta_l1, bta_l2, erbta */
@@ -50,22 +44,32 @@ struct pt_regs {
50 long sp; /* user/kernel sp depending on where we came from */ 44 long sp; /* user/kernel sp depending on where we came from */
51 long orig_r0; 45 long orig_r0;
52 46
53 /*to distinguish bet excp, syscall, irq */ 47 /*
48 * To distinguish bet excp, syscall, irq
49 * For traps and exceptions, Exception Cause Register.
50 * ECR: <00> <VV> <CC> <PP>
51 * Last word used by Linux for extra state mgmt (syscall-restart)
52 * For interrupts, use artificial ECR values to note current prio-level
53 */
54 union { 54 union {
55 struct {
55#ifdef CONFIG_CPU_BIG_ENDIAN 56#ifdef CONFIG_CPU_BIG_ENDIAN
56 /* so that assembly code is same for LE/BE */ 57 unsigned long state:8, ecr_vec:8,
57 unsigned long orig_r8:16, event:16; 58 ecr_cause:8, ecr_param:8;
58#else 59#else
59 unsigned long event:16, orig_r8:16; 60 unsigned long ecr_param:8, ecr_cause:8,
61 ecr_vec:8, state:8;
60#endif 62#endif
61 long orig_r8_word; 63 };
64 unsigned long event;
62 }; 65 };
66
67 long user_r25;
63}; 68};
64 69
65/* Callee saved registers - need to be saved only when you are scheduled out */ 70/* Callee saved registers - need to be saved only when you are scheduled out */
66 71
67struct callee_regs { 72struct callee_regs {
68 long res; /* Again this is not needed */
69 long r25; 73 long r25;
70 long r24; 74 long r24;
71 long r23; 75 long r23;
@@ -99,18 +103,20 @@ struct callee_regs {
99/* return 1 if PC in delay slot */ 103/* return 1 if PC in delay slot */
100#define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK) 104#define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK)
101 105
102#define in_syscall(regs) (regs->event & orig_r8_IS_SCALL) 106#define in_syscall(regs) ((regs->ecr_vec == ECR_V_TRAP) && !regs->ecr_param)
103#define in_brkpt_trap(regs) (regs->event & orig_r8_IS_BRKPT) 107#define in_brkpt_trap(regs) ((regs->ecr_vec == ECR_V_TRAP) && regs->ecr_param)
108
109#define STATE_SCALL_RESTARTED 0x01
104 110
105#define syscall_wont_restart(regs) (regs->event |= orig_r8_IS_SCALL_RESTARTED) 111#define syscall_wont_restart(reg) (reg->state |= STATE_SCALL_RESTARTED)
106#define syscall_restartable(regs) !(regs->event & orig_r8_IS_SCALL_RESTARTED) 112#define syscall_restartable(reg) !(reg->state & STATE_SCALL_RESTARTED)
107 113
108#define current_pt_regs() \ 114#define current_pt_regs() \
109({ \ 115({ \
110 /* open-coded current_thread_info() */ \ 116 /* open-coded current_thread_info() */ \
111 register unsigned long sp asm ("sp"); \ 117 register unsigned long sp asm ("sp"); \
112 unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \ 118 unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \
113 (struct pt_regs *)(pg_start + THREAD_SIZE - 4) - 1; \ 119 (struct pt_regs *)(pg_start + THREAD_SIZE) - 1; \
114}) 120})
115 121
116static inline long regs_return_value(struct pt_regs *regs) 122static inline long regs_return_value(struct pt_regs *regs)
@@ -120,11 +126,4 @@ static inline long regs_return_value(struct pt_regs *regs)
120 126
121#endif /* !__ASSEMBLY__ */ 127#endif /* !__ASSEMBLY__ */
122 128
123#define orig_r8_IS_SCALL 0x0001
124#define orig_r8_IS_SCALL_RESTARTED 0x0002
125#define orig_r8_IS_BRKPT 0x0004
126#define orig_r8_IS_EXCPN 0x0008
127#define orig_r8_IS_IRQ1 0x0010
128#define orig_r8_IS_IRQ2 0x0020
129
130#endif /* __ASM_PTRACE_H */ 129#endif /* __ASM_PTRACE_H */
diff --git a/arch/arc/include/asm/syscall.h b/arch/arc/include/asm/syscall.h
index 33ab3048e9b2..29de09804306 100644
--- a/arch/arc/include/asm/syscall.h
+++ b/arch/arc/include/asm/syscall.h
@@ -18,7 +18,7 @@ static inline long
18syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 18syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
19{ 19{
20 if (user_mode(regs) && in_syscall(regs)) 20 if (user_mode(regs) && in_syscall(regs))
21 return regs->orig_r8; 21 return regs->r8;
22 else 22 else
23 return -1; 23 return -1;
24} 24}
@@ -26,8 +26,7 @@ syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
26static inline void 26static inline void
27syscall_rollback(struct task_struct *task, struct pt_regs *regs) 27syscall_rollback(struct task_struct *task, struct pt_regs *regs)
28{ 28{
29 /* XXX: I can't fathom how pt_regs->r8 will be clobbered ? */ 29 regs->r0 = regs->orig_r0;
30 regs->r8 = regs->orig_r8;
31} 30}
32 31
33static inline long 32static inline long
diff --git a/arch/arc/include/asm/tlb-mmu1.h b/arch/arc/include/asm/tlb-mmu1.h
index a5ff961b1efc..8a1ec96012ae 100644
--- a/arch/arc/include/asm/tlb-mmu1.h
+++ b/arch/arc/include/asm/tlb-mmu1.h
@@ -9,9 +9,9 @@
9#ifndef __ASM_TLB_MMU_V1_H__ 9#ifndef __ASM_TLB_MMU_V1_H__
10#define __ASM_TLB_MMU_V1_H__ 10#define __ASM_TLB_MMU_V1_H__
11 11
12#if defined(__ASSEMBLY__) && defined(CONFIG_ARC_MMU_VER == 1) 12#include <asm/mmu.h>
13 13
14#include <asm/tlb.h> 14#if defined(__ASSEMBLY__) && (CONFIG_ARC_MMU_VER == 1)
15 15
16.macro TLB_WRITE_HEURISTICS 16.macro TLB_WRITE_HEURISTICS
17 17
diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h
index cb0c708ca665..a9db5f62aaf3 100644
--- a/arch/arc/include/asm/tlb.h
+++ b/arch/arc/include/asm/tlb.h
@@ -9,18 +9,6 @@
9#ifndef _ASM_ARC_TLB_H 9#ifndef _ASM_ARC_TLB_H
10#define _ASM_ARC_TLB_H 10#define _ASM_ARC_TLB_H
11 11
12#ifdef __KERNEL__
13
14#include <asm/pgtable.h>
15
16/* Masks for actual TLB "PD"s */
17#define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT)
18#define PTE_BITS_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE | \
19 _PAGE_U_EXECUTE | _PAGE_U_WRITE | _PAGE_U_READ | \
20 _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ)
21
22#ifndef __ASSEMBLY__
23
24#define tlb_flush(tlb) \ 12#define tlb_flush(tlb) \
25do { \ 13do { \
26 if (tlb->fullmm) \ 14 if (tlb->fullmm) \
@@ -56,18 +44,4 @@ do { \
56#include <linux/pagemap.h> 44#include <linux/pagemap.h>
57#include <asm-generic/tlb.h> 45#include <asm-generic/tlb.h>
58 46
59#ifdef CONFIG_ARC_DBG_TLB_PARANOIA
60void tlb_paranoid_check(unsigned int pid_sw, unsigned long address);
61#else
62#define tlb_paranoid_check(a, b)
63#endif
64
65void arc_mmu_init(void);
66extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
67void __init read_decode_mmu_bcr(void);
68
69#endif /* __ASSEMBLY__ */
70
71#endif /* __KERNEL__ */
72
73#endif /* _ASM_ARC_TLB_H */ 47#endif /* _ASM_ARC_TLB_H */
diff --git a/arch/arc/include/asm/unaligned.h b/arch/arc/include/asm/unaligned.h
index 5dbe63f17b66..60702f3751d2 100644
--- a/arch/arc/include/asm/unaligned.h
+++ b/arch/arc/include/asm/unaligned.h
@@ -16,11 +16,11 @@
16 16
17#ifdef CONFIG_ARC_MISALIGN_ACCESS 17#ifdef CONFIG_ARC_MISALIGN_ACCESS
18int misaligned_fixup(unsigned long address, struct pt_regs *regs, 18int misaligned_fixup(unsigned long address, struct pt_regs *regs,
19 unsigned long cause, struct callee_regs *cregs); 19 struct callee_regs *cregs);
20#else 20#else
21static inline int 21static inline int
22misaligned_fixup(unsigned long address, struct pt_regs *regs, 22misaligned_fixup(unsigned long address, struct pt_regs *regs,
23 unsigned long cause, struct callee_regs *cregs) 23 struct callee_regs *cregs)
24{ 24{
25 return 0; 25 return 0;
26} 26}
diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h
index 30333cec0fef..2618cc13ba75 100644
--- a/arch/arc/include/uapi/asm/ptrace.h
+++ b/arch/arc/include/uapi/asm/ptrace.h
@@ -20,28 +20,31 @@
20 * 20 *
21 * This is to decouple pt_regs from user-space ABI, to be able to change it 21 * This is to decouple pt_regs from user-space ABI, to be able to change it
22 * w/o affecting the ABI. 22 * w/o affecting the ABI.
23 * Although the layout (initial padding) is similar to pt_regs to have some 23 *
24 * optimizations when copying pt_regs to/from user_regs_struct. 24 * The intermediate pad,pad2 are relics of initial layout based on pt_regs
25 * for optimizations when copying pt_regs to/from user_regs_struct.
26 * We no longer need them, but can't be changed as they are part of ABI now.
25 * 27 *
26 * Also, sigcontext only care about the scratch regs as that is what we really 28 * Also, sigcontext only care about the scratch regs as that is what we really
27 * save/restore for signal handling. 29 * save/restore for signal handling. However gdb also uses the same struct
30 * hence callee regs need to be in there too.
28*/ 31*/
29struct user_regs_struct { 32struct user_regs_struct {
30 33
34 long pad;
31 struct { 35 struct {
32 long pad;
33 long bta, lp_start, lp_end, lp_count; 36 long bta, lp_start, lp_end, lp_count;
34 long status32, ret, blink, fp, gp; 37 long status32, ret, blink, fp, gp;
35 long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; 38 long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;
36 long sp; 39 long sp;
37 } scratch; 40 } scratch;
41 long pad2;
38 struct { 42 struct {
39 long pad;
40 long r25, r24, r23, r22, r21, r20; 43 long r25, r24, r23, r22, r21, r20;
41 long r19, r18, r17, r16, r15, r14, r13; 44 long r19, r18, r17, r16, r15, r14, r13;
42 } callee; 45 } callee;
43 long efa; /* break pt addr, for break points in delay slots */ 46 long efa; /* break pt addr, for break points in delay slots */
44 long stop_pc; /* give dbg stop_pc directly after checking orig_r8 */ 47 long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */
45}; 48};
46#endif /* !__ASSEMBLY__ */ 49#endif /* !__ASSEMBLY__ */
47 50
diff --git a/arch/arc/kernel/asm-offsets.c b/arch/arc/kernel/asm-offsets.c
index 7dcda7025241..6c3aa0edb9b5 100644
--- a/arch/arc/kernel/asm-offsets.c
+++ b/arch/arc/kernel/asm-offsets.c
@@ -24,9 +24,6 @@ int main(void)
24 24
25 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); 25 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
26 DEFINE(THREAD_CALLEE_REG, offsetof(struct thread_struct, callee_reg)); 26 DEFINE(THREAD_CALLEE_REG, offsetof(struct thread_struct, callee_reg));
27#ifdef CONFIG_ARC_CURR_IN_REG
28 DEFINE(THREAD_USER_R25, offsetof(struct thread_struct, user_r25));
29#endif
30 DEFINE(THREAD_FAULT_ADDR, 27 DEFINE(THREAD_FAULT_ADDR,
31 offsetof(struct thread_struct, fault_address)); 28 offsetof(struct thread_struct, fault_address));
32 29
@@ -49,7 +46,7 @@ int main(void)
49 BLANK(); 46 BLANK();
50 47
51 DEFINE(PT_status32, offsetof(struct pt_regs, status32)); 48 DEFINE(PT_status32, offsetof(struct pt_regs, status32));
52 DEFINE(PT_orig_r8, offsetof(struct pt_regs, orig_r8_word)); 49 DEFINE(PT_event, offsetof(struct pt_regs, event));
53 DEFINE(PT_sp, offsetof(struct pt_regs, sp)); 50 DEFINE(PT_sp, offsetof(struct pt_regs, sp));
54 DEFINE(PT_r0, offsetof(struct pt_regs, r0)); 51 DEFINE(PT_r0, offsetof(struct pt_regs, r0));
55 DEFINE(PT_r1, offsetof(struct pt_regs, r1)); 52 DEFINE(PT_r1, offsetof(struct pt_regs, r1));
@@ -60,5 +57,7 @@ int main(void)
60 DEFINE(PT_r6, offsetof(struct pt_regs, r6)); 57 DEFINE(PT_r6, offsetof(struct pt_regs, r6));
61 DEFINE(PT_r7, offsetof(struct pt_regs, r7)); 58 DEFINE(PT_r7, offsetof(struct pt_regs, r7));
62 59
60 DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs));
61 DEFINE(SZ_PT_REGS, sizeof(struct pt_regs));
63 return 0; 62 return 0;
64} 63}
diff --git a/arch/arc/kernel/ctx_sw.c b/arch/arc/kernel/ctx_sw.c
index 60844dac6132..34410eb1a308 100644
--- a/arch/arc/kernel/ctx_sw.c
+++ b/arch/arc/kernel/ctx_sw.c
@@ -23,10 +23,6 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
23 unsigned int tmp; 23 unsigned int tmp;
24 unsigned int prev = (unsigned int)prev_task; 24 unsigned int prev = (unsigned int)prev_task;
25 unsigned int next = (unsigned int)next_task; 25 unsigned int next = (unsigned int)next_task;
26 int num_words_to_skip = 1;
27#ifdef CONFIG_ARC_CURR_IN_REG
28 num_words_to_skip++;
29#endif
30 26
31 __asm__ __volatile__( 27 __asm__ __volatile__(
32 /* FP/BLINK save generated by gcc (standard function prologue */ 28 /* FP/BLINK save generated by gcc (standard function prologue */
@@ -44,8 +40,9 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
44 "st.a r24, [sp, -4] \n\t" 40 "st.a r24, [sp, -4] \n\t"
45#ifndef CONFIG_ARC_CURR_IN_REG 41#ifndef CONFIG_ARC_CURR_IN_REG
46 "st.a r25, [sp, -4] \n\t" 42 "st.a r25, [sp, -4] \n\t"
43#else
44 "sub sp, sp, 4 \n\t" /* usual r25 placeholder */
47#endif 45#endif
48 "sub sp, sp, %4 \n\t" /* create gutter at top */
49 46
50 /* set ksp of outgoing task in tsk->thread.ksp */ 47 /* set ksp of outgoing task in tsk->thread.ksp */
51 "st.as sp, [%3, %1] \n\t" 48 "st.as sp, [%3, %1] \n\t"
@@ -76,10 +73,10 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
76 73
77 /* start loading it's CALLEE reg file */ 74 /* start loading it's CALLEE reg file */
78 75
79 "add sp, sp, %4 \n\t" /* skip gutter at top */
80
81#ifndef CONFIG_ARC_CURR_IN_REG 76#ifndef CONFIG_ARC_CURR_IN_REG
82 "ld.ab r25, [sp, 4] \n\t" 77 "ld.ab r25, [sp, 4] \n\t"
78#else
79 "add sp, sp, 4 \n\t"
83#endif 80#endif
84 "ld.ab r24, [sp, 4] \n\t" 81 "ld.ab r24, [sp, 4] \n\t"
85 "ld.ab r23, [sp, 4] \n\t" 82 "ld.ab r23, [sp, 4] \n\t"
@@ -100,8 +97,7 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
100 /* FP/BLINK restore generated by gcc (standard func epilogue */ 97 /* FP/BLINK restore generated by gcc (standard func epilogue */
101 98
102 : "=r"(tmp) 99 : "=r"(tmp)
103 : "n"((TASK_THREAD + THREAD_KSP) / 4), "r"(next), "r"(prev), 100 : "n"((TASK_THREAD + THREAD_KSP) / 4), "r"(next), "r"(prev)
104 "n"(num_words_to_skip * 4)
105 : "blink" 101 : "blink"
106 ); 102 );
107 103
diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S
index 0c6d664d4a83..1d7165156e17 100644
--- a/arch/arc/kernel/entry.S
+++ b/arch/arc/kernel/entry.S
@@ -142,7 +142,7 @@ VECTOR reserved ; Reserved Exceptions
142.endr 142.endr
143 143
144#include <linux/linkage.h> /* ARC_{EXTRY,EXIT} */ 144#include <linux/linkage.h> /* ARC_{EXTRY,EXIT} */
145#include <asm/entry.h> /* SAVE_ALL_{INT1,INT2,TRAP...} */ 145#include <asm/entry.h> /* SAVE_ALL_{INT1,INT2,SYS...} */
146#include <asm/errno.h> 146#include <asm/errno.h>
147#include <asm/arcregs.h> 147#include <asm/arcregs.h>
148#include <asm/irqflags.h> 148#include <asm/irqflags.h>
@@ -274,10 +274,8 @@ ARC_ENTRY instr_service
274 SWITCH_TO_KERNEL_STK 274 SWITCH_TO_KERNEL_STK
275 SAVE_ALL_SYS 275 SAVE_ALL_SYS
276 276
277 lr r0, [ecr] 277 lr r0, [efa]
278 lr r1, [efa] 278 mov r1, sp
279
280 mov r2, sp
281 279
282 FAKE_RET_FROM_EXCPN r9 280 FAKE_RET_FROM_EXCPN r9
283 281
@@ -298,9 +296,8 @@ ARC_ENTRY mem_service
298 SWITCH_TO_KERNEL_STK 296 SWITCH_TO_KERNEL_STK
299 SAVE_ALL_SYS 297 SAVE_ALL_SYS
300 298
301 lr r0, [ecr] 299 lr r0, [efa]
302 lr r1, [efa] 300 mov r1, sp
303 mov r2, sp
304 bl do_memory_error 301 bl do_memory_error
305 b ret_from_exception 302 b ret_from_exception
306ARC_EXIT mem_service 303ARC_EXIT mem_service
@@ -317,11 +314,14 @@ ARC_ENTRY EV_MachineCheck
317 SWITCH_TO_KERNEL_STK 314 SWITCH_TO_KERNEL_STK
318 SAVE_ALL_SYS 315 SAVE_ALL_SYS
319 316
320 lr r0, [ecr] 317 lr r2, [ecr]
321 lr r1, [efa] 318 lr r0, [efa]
322 mov r2, sp 319 mov r1, sp
320
321 lsr r3, r2, 8
322 bmsk r3, r3, 7
323 brne r3, ECR_C_MCHK_DUP_TLB, 1f
323 324
324 brne r0, 0x200100, 1f
325 bl do_tlb_overlap_fault 325 bl do_tlb_overlap_fault
326 b ret_from_exception 326 b ret_from_exception
327 327
@@ -355,8 +355,8 @@ ARC_ENTRY EV_TLBProtV
355 ; ecr and efa were not saved in case an Intr sneaks in 355 ; ecr and efa were not saved in case an Intr sneaks in
356 ; after fake rtie 356 ; after fake rtie
357 ; 357 ;
358 lr r3, [ecr] 358 lr r2, [ecr]
359 lr r4, [efa] 359 lr r1, [efa] ; Faulting Data address
360 360
361 ; --------(4) Return from CPU Exception Mode --------- 361 ; --------(4) Return from CPU Exception Mode ---------
362 ; Fake a rtie, but rtie to next label 362 ; Fake a rtie, but rtie to next label
@@ -368,31 +368,25 @@ ARC_ENTRY EV_TLBProtV
368 ;------ (5) Type of Protection Violation? ---------- 368 ;------ (5) Type of Protection Violation? ----------
369 ; 369 ;
370 ; ProtV Hardware Exception is triggered for Access Faults of 2 types 370 ; ProtV Hardware Exception is triggered for Access Faults of 2 types
371 ; -Access Violaton (WRITE to READ ONLY Page) - for linux COW 371 ; -Access Violaton : 00_23_(00|01|02|03)_00
372 ; -Unaligned Access (READ/WRITE on odd boundary) 372 ; x r w r+w
373 ; -Unaligned Access : 00_23_04_00
373 ; 374 ;
374 cmp r3, 0x230400 ; Misaligned data access ? 375 bbit1 r2, ECR_C_BIT_PROTV_MISALIG_DATA, 4f
375 beq 4f
376 376
377 ;========= (6a) Access Violation Processing ======== 377 ;========= (6a) Access Violation Processing ========
378 cmp r3, 0x230100
379 mov r1, 0x0 ; if LD exception ? write = 0
380 mov.ne r1, 0x1 ; else write = 1
381
382 mov r2, r4 ; faulting address
383 mov r0, sp ; pt_regs 378 mov r0, sp ; pt_regs
384 bl do_page_fault 379 bl do_page_fault
385 b ret_from_exception 380 b ret_from_exception
386 381
387 ;========== (6b) Non aligned access ============ 382 ;========== (6b) Non aligned access ============
3884: 3834:
389 mov r0, r3 ; cause code 384 mov r0, r1
390 mov r1, r4 ; faulting address 385 mov r1, sp ; pt_regs
391 mov r2, sp ; pt_regs
392 386
393#ifdef CONFIG_ARC_MISALIGN_ACCESS 387#ifdef CONFIG_ARC_MISALIGN_ACCESS
394 SAVE_CALLEE_SAVED_USER 388 SAVE_CALLEE_SAVED_USER
395 mov r3, sp ; callee_regs 389 mov r2, sp ; callee_regs
396 390
397 bl do_misaligned_access 391 bl do_misaligned_access
398 392
@@ -419,9 +413,8 @@ ARC_ENTRY EV_PrivilegeV
419 SWITCH_TO_KERNEL_STK 413 SWITCH_TO_KERNEL_STK
420 SAVE_ALL_SYS 414 SAVE_ALL_SYS
421 415
422 lr r0, [ecr] 416 lr r0, [efa]
423 lr r1, [efa] 417 mov r1, sp
424 mov r2, sp
425 418
426 FAKE_RET_FROM_EXCPN r9 419 FAKE_RET_FROM_EXCPN r9
427 420
@@ -440,9 +433,8 @@ ARC_ENTRY EV_Extension
440 SWITCH_TO_KERNEL_STK 433 SWITCH_TO_KERNEL_STK
441 SAVE_ALL_SYS 434 SAVE_ALL_SYS
442 435
443 lr r0, [ecr] 436 lr r0, [efa]
444 lr r1, [efa] 437 mov r1, sp
445 mov r2, sp
446 bl do_extension_fault 438 bl do_extension_fault
447 b ret_from_exception 439 b ret_from_exception
448ARC_EXIT EV_Extension 440ARC_EXIT EV_Extension
@@ -498,11 +490,8 @@ tracesys_exit:
498trap_with_param: 490trap_with_param:
499 491
500 ; stop_pc info by gdb needs this info 492 ; stop_pc info by gdb needs this info
501 stw orig_r8_IS_BRKPT, [sp, PT_orig_r8] 493 lr r0, [efa]
502 494 mov r1, sp
503 mov r0, r12
504 lr r1, [efa]
505 mov r2, sp
506 495
507 ; Now that we have read EFA, its safe to do "fake" rtie 496 ; Now that we have read EFA, its safe to do "fake" rtie
508 ; and get out of CPU exception mode 497 ; and get out of CPU exception mode
@@ -544,11 +533,11 @@ ARC_ENTRY EV_Trap
544 lr r9, [erstatus] 533 lr r9, [erstatus]
545 534
546 SWITCH_TO_KERNEL_STK 535 SWITCH_TO_KERNEL_STK
547 SAVE_ALL_TRAP 536 SAVE_ALL_SYS
548 537
549 ;------- (4) What caused the Trap -------------- 538 ;------- (4) What caused the Trap --------------
550 lr r12, [ecr] 539 lr r12, [ecr]
551 and.f 0, r12, ECR_PARAM_MASK 540 bmsk.f 0, r12, 7
552 bnz trap_with_param 541 bnz trap_with_param
553 542
554 ; ======= (5a) Trap is due to System Call ======== 543 ; ======= (5a) Trap is due to System Call ========
@@ -589,11 +578,7 @@ ARC_ENTRY ret_from_exception
589 ; Pre-{IRQ,Trap,Exception} K/U mode from pt_regs->status32 578 ; Pre-{IRQ,Trap,Exception} K/U mode from pt_regs->status32
590 ld r8, [sp, PT_status32] ; returning to User/Kernel Mode 579 ld r8, [sp, PT_status32] ; returning to User/Kernel Mode
591 580
592#ifdef CONFIG_PREEMPT
593 bbit0 r8, STATUS_U_BIT, resume_kernel_mode 581 bbit0 r8, STATUS_U_BIT, resume_kernel_mode
594#else
595 bbit0 r8, STATUS_U_BIT, restore_regs
596#endif
597 582
598 ; Before returning to User mode check-for-and-complete any pending work 583 ; Before returning to User mode check-for-and-complete any pending work
599 ; such as rescheduling/signal-delivery etc. 584 ; such as rescheduling/signal-delivery etc.
@@ -653,10 +638,10 @@ resume_user_mode_begin:
653 b resume_user_mode_begin ; unconditionally back to U mode ret chks 638 b resume_user_mode_begin ; unconditionally back to U mode ret chks
654 ; for single exit point from this block 639 ; for single exit point from this block
655 640
656#ifdef CONFIG_PREEMPT
657
658resume_kernel_mode: 641resume_kernel_mode:
659 642
643#ifdef CONFIG_PREEMPT
644
660 ; Can't preempt if preemption disabled 645 ; Can't preempt if preemption disabled
661 GET_CURR_THR_INFO_FROM_SP r10 646 GET_CURR_THR_INFO_FROM_SP r10
662 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] 647 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT]
@@ -687,17 +672,6 @@ restore_regs :
687 ; XXX can this be optimised out 672 ; XXX can this be optimised out
688 IRQ_DISABLE_SAVE r9, r10 ;@r10 has prisitine (pre-disable) copy 673 IRQ_DISABLE_SAVE r9, r10 ;@r10 has prisitine (pre-disable) copy
689 674
690#ifdef CONFIG_ARC_CURR_IN_REG
691 ; Restore User R25
692 ; Earlier this used to be only for returning to user mode
693 ; However with 2 levels of IRQ this can also happen even if
694 ; in kernel mode
695 ld r9, [sp, PT_sp]
696 brhs r9, VMALLOC_START, 8f
697 RESTORE_USER_R25
6988:
699#endif
700
701 ; Restore REG File. In case multiple Events outstanding, 675 ; Restore REG File. In case multiple Events outstanding,
702 ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None 676 ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None
703 ; Note that we use realtime STATUS32 (not pt_regs->status32) to 677 ; Note that we use realtime STATUS32 (not pt_regs->status32) to
@@ -714,28 +688,33 @@ not_exception:
714 688
715#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 689#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
716 690
691 ; Level 2 interrupt return Path - from hardware standpoint
717 bbit0 r10, STATUS_A2_BIT, not_level2_interrupt 692 bbit0 r10, STATUS_A2_BIT, not_level2_interrupt
718 693
719 ;------------------------------------------------------------------ 694 ;------------------------------------------------------------------
695 ; However the context returning might not have taken L2 intr itself
696 ; e.g. Task'A' user-code -> L2 intr -> schedule -> 'B' user-code ret
697 ; Special considerations needed for the context which took L2 intr
698
699 ld r9, [sp, PT_event] ; Ensure this is L2 intr context
700 brne r9, event_IRQ2, 149f
701
702 ;------------------------------------------------------------------
720 ; if L2 IRQ interrupted a L1 ISR, we'd disbaled preemption earlier 703 ; if L2 IRQ interrupted a L1 ISR, we'd disbaled preemption earlier
721 ; so that sched doesnt move to new task, causing L1 to be delayed 704 ; so that sched doesnt move to new task, causing L1 to be delayed
722 ; undeterministically. Now that we've achieved that, lets reset 705 ; undeterministically. Now that we've achieved that, lets reset
723 ; things to what they were, before returning from L2 context 706 ; things to what they were, before returning from L2 context
724 ;---------------------------------------------------------------- 707 ;----------------------------------------------------------------
725 708
726 ldw r9, [sp, PT_orig_r8] ; get orig_r8 to make sure it is
727 brne r9, orig_r8_IS_IRQ2, 149f ; infact a L2 ISR ret path
728
729 ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) 709 ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs)
730 bbit0 r9, STATUS_A1_BIT, 149f ; L1 not active when L2 IRQ, so normal 710 bbit0 r9, STATUS_A1_BIT, 149f ; L1 not active when L2 IRQ, so normal
731 711
732 ; A1 is set in status32_l2
733 ; decrement thread_info->preempt_count (re-enable preemption) 712 ; decrement thread_info->preempt_count (re-enable preemption)
734 GET_CURR_THR_INFO_FROM_SP r10 713 GET_CURR_THR_INFO_FROM_SP r10
735 ld r9, [r10, THREAD_INFO_PREEMPT_COUNT] 714 ld r9, [r10, THREAD_INFO_PREEMPT_COUNT]
736 715
737 ; paranoid check, given A1 was active when A2 happened, preempt count 716 ; paranoid check, given A1 was active when A2 happened, preempt count
738 ; must not be 0 beccause we would have incremented it. 717 ; must not be 0 because we would have incremented it.
739 ; If this does happen we simply HALT as it means a BUG !!! 718 ; If this does happen we simply HALT as it means a BUG !!!
740 cmp r9, 0 719 cmp r9, 0
741 bnz 2f 720 bnz 2f
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 006dec3fc353..2a913f85a747 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -27,6 +27,8 @@ stext:
27 ; Don't clobber r0-r4 yet. It might have bootloader provided info 27 ; Don't clobber r0-r4 yet. It might have bootloader provided info
28 ;------------------------------------------------------------------- 28 ;-------------------------------------------------------------------
29 29
30 sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]
31
30#ifdef CONFIG_SMP 32#ifdef CONFIG_SMP
31 ; Only Boot (Master) proceeds. Others wait in platform dependent way 33 ; Only Boot (Master) proceeds. Others wait in platform dependent way
32 ; IDENTITY Reg [ 3 2 1 0 ] 34 ; IDENTITY Reg [ 3 2 1 0 ]
diff --git a/arch/arc/kernel/irq.c b/arch/arc/kernel/irq.c
index 8115fa531575..305b3f866aa7 100644
--- a/arch/arc/kernel/irq.c
+++ b/arch/arc/kernel/irq.c
@@ -28,25 +28,17 @@
28 * -Disable all IRQs (on CPU side) 28 * -Disable all IRQs (on CPU side)
29 * -Optionally, setup the High priority Interrupts as Level 2 IRQs 29 * -Optionally, setup the High priority Interrupts as Level 2 IRQs
30 */ 30 */
31void __cpuinit arc_init_IRQ(void) 31void arc_init_IRQ(void)
32{ 32{
33 int level_mask = 0; 33 int level_mask = 0;
34 34
35 write_aux_reg(AUX_INTR_VEC_BASE, _int_vec_base_lds);
36
37 /* Disable all IRQs: enable them as devices request */ 35 /* Disable all IRQs: enable them as devices request */
38 write_aux_reg(AUX_IENABLE, 0); 36 write_aux_reg(AUX_IENABLE, 0);
39 37
40 /* setup any high priority Interrupts (Level2 in ARCompact jargon) */ 38 /* setup any high priority Interrupts (Level2 in ARCompact jargon) */
41#ifdef CONFIG_ARC_IRQ3_LV2 39 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ3_LV2) << 3;
42 level_mask |= (1 << 3); 40 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5;
43#endif 41 level_mask |= IS_ENABLED(CONFIG_ARC_IRQ6_LV2) << 6;
44#ifdef CONFIG_ARC_IRQ5_LV2
45 level_mask |= (1 << 5);
46#endif
47#ifdef CONFIG_ARC_IRQ6_LV2
48 level_mask |= (1 << 6);
49#endif
50 42
51 if (level_mask) { 43 if (level_mask) {
52 pr_info("Level-2 interrupts bitset %x\n", level_mask); 44 pr_info("Level-2 interrupts bitset %x\n", level_mask);
diff --git a/arch/arc/kernel/kgdb.c b/arch/arc/kernel/kgdb.c
index 52bdc83c1495..a7698fb14818 100644
--- a/arch/arc/kernel/kgdb.c
+++ b/arch/arc/kernel/kgdb.c
@@ -169,7 +169,7 @@ int kgdb_arch_init(void)
169 return 0; 169 return 0;
170} 170}
171 171
172void kgdb_trap(struct pt_regs *regs, int param) 172void kgdb_trap(struct pt_regs *regs)
173{ 173{
174 /* trap_s 3 is used for breakpoints that overwrite existing 174 /* trap_s 3 is used for breakpoints that overwrite existing
175 * instructions, while trap_s 4 is used for compiled breakpoints. 175 * instructions, while trap_s 4 is used for compiled breakpoints.
@@ -181,7 +181,7 @@ void kgdb_trap(struct pt_regs *regs, int param)
181 * with trap_s 4 (compiled) breakpoints, continuation needs to 181 * with trap_s 4 (compiled) breakpoints, continuation needs to
182 * start after the breakpoint. 182 * start after the breakpoint.
183 */ 183 */
184 if (param == 3) 184 if (regs->ecr_param == 3)
185 instruction_pointer(regs) -= BREAK_INSTR_SIZE; 185 instruction_pointer(regs) -= BREAK_INSTR_SIZE;
186 186
187 kgdb_handle_exception(1, SIGTRAP, 0, regs); 187 kgdb_handle_exception(1, SIGTRAP, 0, regs);
diff --git a/arch/arc/kernel/kprobes.c b/arch/arc/kernel/kprobes.c
index 5a7b80e2d883..72f97822784a 100644
--- a/arch/arc/kernel/kprobes.c
+++ b/arch/arc/kernel/kprobes.c
@@ -517,8 +517,7 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p)
517 return 0; 517 return 0;
518} 518}
519 519
520void trap_is_kprobe(unsigned long cause, unsigned long address, 520void trap_is_kprobe(unsigned long address, struct pt_regs *regs)
521 struct pt_regs *regs)
522{ 521{
523 notify_die(DIE_TRAP, "kprobe_trap", regs, address, cause, SIGTRAP); 522 notify_die(DIE_TRAP, "kprobe_trap", regs, address, 0, SIGTRAP);
524} 523}
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
index cad66851e0c4..07a3a968fe49 100644
--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -55,10 +55,8 @@ asmlinkage void ret_from_fork(void);
55 * | ... | 55 * | ... |
56 * | unused | 56 * | unused |
57 * | | 57 * | |
58 * ------------------ <==== top of Stack (thread.ksp)
59 * | UNUSED 1 word|
60 * ------------------ 58 * ------------------
61 * | r25 | 59 * | r25 | <==== top of Stack (thread.ksp)
62 * ~ ~ 60 * ~ ~
63 * | --to-- | (CALLEE Regs of user mode) 61 * | --to-- | (CALLEE Regs of user mode)
64 * | r13 | 62 * | r13 |
@@ -76,7 +74,10 @@ asmlinkage void ret_from_fork(void);
76 * | --to-- | (scratch Regs of user mode) 74 * | --to-- | (scratch Regs of user mode)
77 * | r0 | 75 * | r0 |
78 * ------------------ 76 * ------------------
79 * | UNUSED 1 word| 77 * | SP |
78 * | orig_r0 |
79 * | event/ECR |
80 * | user_r25 |
80 * ------------------ <===== END of PAGE 81 * ------------------ <===== END of PAGE
81 */ 82 */
82int copy_thread(unsigned long clone_flags, 83int copy_thread(unsigned long clone_flags,
diff --git a/arch/arc/kernel/ptrace.c b/arch/arc/kernel/ptrace.c
index c6a81c58d0f3..333238564b67 100644
--- a/arch/arc/kernel/ptrace.c
+++ b/arch/arc/kernel/ptrace.c
@@ -40,7 +40,15 @@ static int genregs_get(struct task_struct *target,
40 offsetof(struct user_regs_struct, LOC), \ 40 offsetof(struct user_regs_struct, LOC), \
41 offsetof(struct user_regs_struct, LOC) + 4); 41 offsetof(struct user_regs_struct, LOC) + 4);
42 42
43#define REG_O_ZERO(LOC) \
44 if (!ret) \
45 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, \
46 offsetof(struct user_regs_struct, LOC), \
47 offsetof(struct user_regs_struct, LOC) + 4);
48
49 REG_O_ZERO(pad);
43 REG_O_CHUNK(scratch, callee, ptregs); 50 REG_O_CHUNK(scratch, callee, ptregs);
51 REG_O_ZERO(pad2);
44 REG_O_CHUNK(callee, efa, cregs); 52 REG_O_CHUNK(callee, efa, cregs);
45 REG_O_CHUNK(efa, stop_pc, &target->thread.fault_address); 53 REG_O_CHUNK(efa, stop_pc, &target->thread.fault_address);
46 54
@@ -88,8 +96,10 @@ static int genregs_set(struct task_struct *target,
88 offsetof(struct user_regs_struct, LOC), \ 96 offsetof(struct user_regs_struct, LOC), \
89 offsetof(struct user_regs_struct, LOC) + 4); 97 offsetof(struct user_regs_struct, LOC) + 4);
90 98
91 /* TBD: disallow updates to STATUS32, orig_r8 etc*/ 99 REG_IGNORE_ONE(pad);
92 REG_IN_CHUNK(scratch, callee, ptregs); /* pt_regs[bta..orig_r8] */ 100 /* TBD: disallow updates to STATUS32 etc*/
101 REG_IN_CHUNK(scratch, pad2, ptregs); /* pt_regs[bta..sp] */
102 REG_IGNORE_ONE(pad2);
93 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */ 103 REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */
94 REG_IGNORE_ONE(efa); /* efa update invalid */ 104 REG_IGNORE_ONE(efa); /* efa update invalid */
95 REG_IN_ONE(stop_pc, &ptregs->ret); /* stop_pc: PC update */ 105 REG_IN_ONE(stop_pc, &ptregs->ret); /* stop_pc: PC update */
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index b2b3731dd1e9..6b083454d039 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -31,14 +31,14 @@
31int running_on_hw = 1; /* vs. on ISS */ 31int running_on_hw = 1; /* vs. on ISS */
32 32
33char __initdata command_line[COMMAND_LINE_SIZE]; 33char __initdata command_line[COMMAND_LINE_SIZE];
34struct machine_desc *machine_desc __cpuinitdata; 34struct machine_desc *machine_desc;
35 35
36struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 36struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
37 37
38struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; 38struct cpuinfo_arc cpuinfo_arc700[NR_CPUS];
39 39
40 40
41void __cpuinit read_arc_build_cfg_regs(void) 41void read_arc_build_cfg_regs(void)
42{ 42{
43 struct bcr_perip uncached_space; 43 struct bcr_perip uncached_space;
44 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 44 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
@@ -182,7 +182,7 @@ char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
182 FIX_PTR(cpu); 182 FIX_PTR(cpu);
183#define IS_AVAIL1(var, str) ((var) ? str : "") 183#define IS_AVAIL1(var, str) ((var) ? str : "")
184#define IS_AVAIL2(var, str) ((var == 0x2) ? str : "") 184#define IS_AVAIL2(var, str) ((var == 0x2) ? str : "")
185#define IS_USED(var) ((var) ? "(in-use)" : "(not used)") 185#define IS_USED(cfg) (IS_ENABLED(cfg) ? "(in-use)" : "(not used)")
186 186
187 n += scnprintf(buf + n, len - n, 187 n += scnprintf(buf + n, len - n,
188 "Extn [700-Base]\t: %s %s %s %s %s %s\n", 188 "Extn [700-Base]\t: %s %s %s %s %s %s\n",
@@ -202,9 +202,9 @@ char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
202 if (cpu->core.family == 0x34) { 202 if (cpu->core.family == 0x34) {
203 n += scnprintf(buf + n, len - n, 203 n += scnprintf(buf + n, len - n,
204 "Extn [700-4.10]\t: LLOCK/SCOND %s, SWAPE %s, RTSC %s\n", 204 "Extn [700-4.10]\t: LLOCK/SCOND %s, SWAPE %s, RTSC %s\n",
205 IS_USED(__CONFIG_ARC_HAS_LLSC_VAL), 205 IS_USED(CONFIG_ARC_HAS_LLSC),
206 IS_USED(__CONFIG_ARC_HAS_SWAPE_VAL), 206 IS_USED(CONFIG_ARC_HAS_SWAPE),
207 IS_USED(__CONFIG_ARC_HAS_RTSC_VAL)); 207 IS_USED(CONFIG_ARC_HAS_RTSC));
208 } 208 }
209 209
210 n += scnprintf(buf + n, len - n, "Extn [CCM]\t: %s", 210 n += scnprintf(buf + n, len - n, "Extn [CCM]\t: %s",
@@ -237,7 +237,7 @@ char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len)
237 return buf; 237 return buf;
238} 238}
239 239
240void __cpuinit arc_chk_ccms(void) 240void arc_chk_ccms(void)
241{ 241{
242#if defined(CONFIG_ARC_HAS_DCCM) || defined(CONFIG_ARC_HAS_ICCM) 242#if defined(CONFIG_ARC_HAS_DCCM) || defined(CONFIG_ARC_HAS_ICCM)
243 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 243 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
@@ -272,7 +272,7 @@ void __cpuinit arc_chk_ccms(void)
272 * hardware has dedicated regs which need to be saved/restored on ctx-sw 272 * hardware has dedicated regs which need to be saved/restored on ctx-sw
273 * (Single Precision uses core regs), thus kernel is kind of oblivious to it 273 * (Single Precision uses core regs), thus kernel is kind of oblivious to it
274 */ 274 */
275void __cpuinit arc_chk_fpu(void) 275void arc_chk_fpu(void)
276{ 276{
277 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 277 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()];
278 278
@@ -293,7 +293,7 @@ void __cpuinit arc_chk_fpu(void)
293 * such as only for boot CPU etc 293 * such as only for boot CPU etc
294 */ 294 */
295 295
296void __cpuinit setup_processor(void) 296void setup_processor(void)
297{ 297{
298 char str[512]; 298 char str[512];
299 int cpu_id = smp_processor_id(); 299 int cpu_id = smp_processor_id();
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c
index 5c7fd603d216..bca3052c956d 100644
--- a/arch/arc/kernel/smp.c
+++ b/arch/arc/kernel/smp.c
@@ -117,7 +117,7 @@ const char *arc_platform_smp_cpuinfo(void)
117 * Called from asm stub in head.S 117 * Called from asm stub in head.S
118 * "current"/R25 already setup by low level boot code 118 * "current"/R25 already setup by low level boot code
119 */ 119 */
120void __cpuinit start_kernel_secondary(void) 120void start_kernel_secondary(void)
121{ 121{
122 struct mm_struct *mm = &init_mm; 122 struct mm_struct *mm = &init_mm;
123 unsigned int cpu = smp_processor_id(); 123 unsigned int cpu = smp_processor_id();
@@ -154,7 +154,7 @@ void __cpuinit start_kernel_secondary(void)
154 * 154 *
155 * Essential requirements being where to run from (PC) and stack (SP) 155 * Essential requirements being where to run from (PC) and stack (SP)
156*/ 156*/
157int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 157int __cpu_up(unsigned int cpu, struct task_struct *idle)
158{ 158{
159 unsigned long wait_till; 159 unsigned long wait_till;
160 160
diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c
index ca0207b9d5b6..f8b7d880304d 100644
--- a/arch/arc/kernel/stacktrace.c
+++ b/arch/arc/kernel/stacktrace.c
@@ -79,7 +79,7 @@ static void seed_unwind_frame_info(struct task_struct *tsk,
79 * assembly code 79 * assembly code
80 */ 80 */
81 frame_info->regs.r27 = 0; 81 frame_info->regs.r27 = 0;
82 frame_info->regs.r28 += 64; 82 frame_info->regs.r28 += 60;
83 frame_info->call_frame = 0; 83 frame_info->call_frame = 0;
84 84
85 } else { 85 } else {
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c
index 09f4309aa2c0..0e51e69cf30d 100644
--- a/arch/arc/kernel/time.c
+++ b/arch/arc/kernel/time.c
@@ -44,13 +44,24 @@
44#include <asm/clk.h> 44#include <asm/clk.h>
45#include <asm/mach_desc.h> 45#include <asm/mach_desc.h>
46 46
47/* Timer related Aux registers */
48#define ARC_REG_TIMER0_LIMIT 0x23 /* timer 0 limit */
49#define ARC_REG_TIMER0_CTRL 0x22 /* timer 0 control */
50#define ARC_REG_TIMER0_CNT 0x21 /* timer 0 count */
51#define ARC_REG_TIMER1_LIMIT 0x102 /* timer 1 limit */
52#define ARC_REG_TIMER1_CTRL 0x101 /* timer 1 control */
53#define ARC_REG_TIMER1_CNT 0x100 /* timer 1 count */
54
55#define TIMER_CTRL_IE (1 << 0) /* Interupt when Count reachs limit */
56#define TIMER_CTRL_NH (1 << 1) /* Count only when CPU NOT halted */
57
47#define ARC_TIMER_MAX 0xFFFFFFFF 58#define ARC_TIMER_MAX 0xFFFFFFFF
48 59
49/********** Clock Source Device *********/ 60/********** Clock Source Device *********/
50 61
51#ifdef CONFIG_ARC_HAS_RTSC 62#ifdef CONFIG_ARC_HAS_RTSC
52 63
53int __cpuinit arc_counter_setup(void) 64int arc_counter_setup(void)
54{ 65{
55 /* RTSC insn taps into cpu clk, needs no setup */ 66 /* RTSC insn taps into cpu clk, needs no setup */
56 67
@@ -105,7 +116,7 @@ static bool is_usable_as_clocksource(void)
105/* 116/*
106 * set 32bit TIMER1 to keep counting monotonically and wraparound 117 * set 32bit TIMER1 to keep counting monotonically and wraparound
107 */ 118 */
108int __cpuinit arc_counter_setup(void) 119int arc_counter_setup(void)
109{ 120{
110 write_aux_reg(ARC_REG_TIMER1_LIMIT, ARC_TIMER_MAX); 121 write_aux_reg(ARC_REG_TIMER1_LIMIT, ARC_TIMER_MAX);
111 write_aux_reg(ARC_REG_TIMER1_CNT, 0); 122 write_aux_reg(ARC_REG_TIMER1_CNT, 0);
@@ -212,7 +223,7 @@ static struct irqaction arc_timer_irq = {
212 * Setup the local event timer for @cpu 223 * Setup the local event timer for @cpu
213 * N.B. weak so that some exotic ARC SoCs can completely override it 224 * N.B. weak so that some exotic ARC SoCs can completely override it
214 */ 225 */
215void __attribute__((weak)) __cpuinit arc_local_timer_setup(unsigned int cpu) 226void __attribute__((weak)) arc_local_timer_setup(unsigned int cpu)
216{ 227{
217 struct clock_event_device *clk = &per_cpu(arc_clockevent_device, cpu); 228 struct clock_event_device *clk = &per_cpu(arc_clockevent_device, cpu);
218 229
diff --git a/arch/arc/kernel/traps.c b/arch/arc/kernel/traps.c
index 0471d9c9dd54..e21692d2fdab 100644
--- a/arch/arc/kernel/traps.c
+++ b/arch/arc/kernel/traps.c
@@ -28,10 +28,9 @@ void __init trap_init(void)
28 return; 28 return;
29} 29}
30 30
31void die(const char *str, struct pt_regs *regs, unsigned long address, 31void die(const char *str, struct pt_regs *regs, unsigned long address)
32 unsigned long cause_reg)
33{ 32{
34 show_kernel_fault_diag(str, regs, address, cause_reg); 33 show_kernel_fault_diag(str, regs, address);
35 34
36 /* DEAD END */ 35 /* DEAD END */
37 __asm__("flag 1"); 36 __asm__("flag 1");
@@ -42,14 +41,13 @@ void die(const char *str, struct pt_regs *regs, unsigned long address,
42 * -for user faults enqueues requested signal 41 * -for user faults enqueues requested signal
43 * -for kernel, chk if due to copy_(to|from)_user, otherwise die() 42 * -for kernel, chk if due to copy_(to|from)_user, otherwise die()
44 */ 43 */
45static noinline int handle_exception(unsigned long cause, char *str, 44static noinline int
46 struct pt_regs *regs, siginfo_t *info) 45handle_exception(const char *str, struct pt_regs *regs, siginfo_t *info)
47{ 46{
48 if (user_mode(regs)) { 47 if (user_mode(regs)) {
49 struct task_struct *tsk = current; 48 struct task_struct *tsk = current;
50 49
51 tsk->thread.fault_address = (__force unsigned int)info->si_addr; 50 tsk->thread.fault_address = (__force unsigned int)info->si_addr;
52 tsk->thread.cause_code = cause;
53 51
54 force_sig_info(info->si_signo, info, tsk); 52 force_sig_info(info->si_signo, info, tsk);
55 53
@@ -58,14 +56,14 @@ static noinline int handle_exception(unsigned long cause, char *str,
58 if (fixup_exception(regs)) 56 if (fixup_exception(regs))
59 return 0; 57 return 0;
60 58
61 die(str, regs, (unsigned long)info->si_addr, cause); 59 die(str, regs, (unsigned long)info->si_addr);
62 } 60 }
63 61
64 return 1; 62 return 1;
65} 63}
66 64
67#define DO_ERROR_INFO(signr, str, name, sicode) \ 65#define DO_ERROR_INFO(signr, str, name, sicode) \
68int name(unsigned long cause, unsigned long address, struct pt_regs *regs) \ 66int name(unsigned long address, struct pt_regs *regs) \
69{ \ 67{ \
70 siginfo_t info = { \ 68 siginfo_t info = { \
71 .si_signo = signr, \ 69 .si_signo = signr, \
@@ -73,7 +71,7 @@ int name(unsigned long cause, unsigned long address, struct pt_regs *regs) \
73 .si_code = sicode, \ 71 .si_code = sicode, \
74 .si_addr = (void __user *)address, \ 72 .si_addr = (void __user *)address, \
75 }; \ 73 }; \
76 return handle_exception(cause, str, regs, &info);\ 74 return handle_exception(str, regs, &info);\
77} 75}
78 76
79/* 77/*
@@ -90,11 +88,11 @@ DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
90/* 88/*
91 * Entry Point for Misaligned Data access Exception, for emulating in software 89 * Entry Point for Misaligned Data access Exception, for emulating in software
92 */ 90 */
93int do_misaligned_access(unsigned long cause, unsigned long address, 91int do_misaligned_access(unsigned long address, struct pt_regs *regs,
94 struct pt_regs *regs, struct callee_regs *cregs) 92 struct callee_regs *cregs)
95{ 93{
96 if (misaligned_fixup(address, regs, cause, cregs) != 0) 94 if (misaligned_fixup(address, regs, cregs) != 0)
97 return do_misaligned_error(cause, address, regs); 95 return do_misaligned_error(address, regs);
98 96
99 return 0; 97 return 0;
100} 98}
@@ -104,10 +102,9 @@ int do_misaligned_access(unsigned long cause, unsigned long address,
104 * Entry point for miscll errors such as Nested Exceptions 102 * Entry point for miscll errors such as Nested Exceptions
105 * -Duplicate TLB entry is handled seperately though 103 * -Duplicate TLB entry is handled seperately though
106 */ 104 */
107void do_machine_check_fault(unsigned long cause, unsigned long address, 105void do_machine_check_fault(unsigned long address, struct pt_regs *regs)
108 struct pt_regs *regs)
109{ 106{
110 die("Machine Check Exception", regs, address, cause); 107 die("Machine Check Exception", regs, address);
111} 108}
112 109
113 110
@@ -120,23 +117,22 @@ void do_machine_check_fault(unsigned long cause, unsigned long address,
120 * -1 used for software breakpointing (gdb) 117 * -1 used for software breakpointing (gdb)
121 * -2 used by kprobes 118 * -2 used by kprobes
122 */ 119 */
123void do_non_swi_trap(unsigned long cause, unsigned long address, 120void do_non_swi_trap(unsigned long address, struct pt_regs *regs)
124 struct pt_regs *regs)
125{ 121{
126 unsigned int param = cause & 0xff; 122 unsigned int param = regs->ecr_param;
127 123
128 switch (param) { 124 switch (param) {
129 case 1: 125 case 1:
130 trap_is_brkpt(cause, address, regs); 126 trap_is_brkpt(address, regs);
131 break; 127 break;
132 128
133 case 2: 129 case 2:
134 trap_is_kprobe(param, address, regs); 130 trap_is_kprobe(address, regs);
135 break; 131 break;
136 132
137 case 3: 133 case 3:
138 case 4: 134 case 4:
139 kgdb_trap(regs, param); 135 kgdb_trap(regs);
140 break; 136 break;
141 137
142 default: 138 default:
@@ -149,14 +145,14 @@ void do_non_swi_trap(unsigned long cause, unsigned long address,
149 * -For a corner case, ARC kprobes implementation resorts to using 145 * -For a corner case, ARC kprobes implementation resorts to using
150 * this exception, hence the check 146 * this exception, hence the check
151 */ 147 */
152void do_insterror_or_kprobe(unsigned long cause, 148void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs)
153 unsigned long address,
154 struct pt_regs *regs)
155{ 149{
150 int rc;
151
156 /* Check if this exception is caused by kprobes */ 152 /* Check if this exception is caused by kprobes */
157 if (notify_die(DIE_IERR, "kprobe_ierr", regs, address, 153 rc = notify_die(DIE_IERR, "kprobe_ierr", regs, address, 0, SIGILL);
158 cause, SIGILL) == NOTIFY_STOP) 154 if (rc == NOTIFY_STOP)
159 return; 155 return;
160 156
161 insterror_is_error(cause, address, regs); 157 insterror_is_error(address, regs);
162} 158}
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 11c301b81c92..73a7450ee622 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -101,7 +101,7 @@ static void show_faulting_vma(unsigned long address, char *buf)
101 if (file) { 101 if (file) {
102 struct path *path = &file->f_path; 102 struct path *path = &file->f_path;
103 nm = d_path(path, buf, PAGE_SIZE - 1); 103 nm = d_path(path, buf, PAGE_SIZE - 1);
104 inode = vma->vm_file->f_path.dentry->d_inode; 104 inode = file_inode(vma->vm_file);
105 dev = inode->i_sb->s_dev; 105 dev = inode->i_sb->s_dev;
106 ino = inode->i_ino; 106 ino = inode->i_ino;
107 } 107 }
@@ -117,23 +117,22 @@ static void show_faulting_vma(unsigned long address, char *buf)
117 117
118static void show_ecr_verbose(struct pt_regs *regs) 118static void show_ecr_verbose(struct pt_regs *regs)
119{ 119{
120 unsigned int vec, cause_code, cause_reg; 120 unsigned int vec, cause_code;
121 unsigned long address; 121 unsigned long address;
122 122
123 cause_reg = current->thread.cause_code; 123 pr_info("\n[ECR ]: 0x%08lx => ", regs->event);
124 pr_info("\n[ECR ]: 0x%08x => ", cause_reg);
125 124
126 /* For Data fault, this is data address not instruction addr */ 125 /* For Data fault, this is data address not instruction addr */
127 address = current->thread.fault_address; 126 address = current->thread.fault_address;
128 127
129 vec = cause_reg >> 16; 128 vec = regs->ecr_vec;
130 cause_code = (cause_reg >> 8) & 0xFF; 129 cause_code = regs->ecr_cause;
131 130
132 /* For DTLB Miss or ProtV, display the memory involved too */ 131 /* For DTLB Miss or ProtV, display the memory involved too */
133 if (vec == ECR_V_DTLB_MISS) { 132 if (vec == ECR_V_DTLB_MISS) {
134 pr_cont("Invalid %s 0x%08lx by insn @ 0x%08lx\n", 133 pr_cont("Invalid %s @ 0x%08lx by insn @ 0x%08lx\n",
135 (cause_code == 0x01) ? "Read From" : 134 (cause_code == 0x01) ? "Read" :
136 ((cause_code == 0x02) ? "Write to" : "EX"), 135 ((cause_code == 0x02) ? "Write" : "EX"),
137 address, regs->ret); 136 address, regs->ret);
138 } else if (vec == ECR_V_ITLB_MISS) { 137 } else if (vec == ECR_V_ITLB_MISS) {
139 pr_cont("Insn could not be fetched\n"); 138 pr_cont("Insn could not be fetched\n");
@@ -144,14 +143,12 @@ static void show_ecr_verbose(struct pt_regs *regs)
144 } else if (vec == ECR_V_PROTV) { 143 } else if (vec == ECR_V_PROTV) {
145 if (cause_code == ECR_C_PROTV_INST_FETCH) 144 if (cause_code == ECR_C_PROTV_INST_FETCH)
146 pr_cont("Execute from Non-exec Page\n"); 145 pr_cont("Execute from Non-exec Page\n");
147 else if (cause_code == ECR_C_PROTV_LOAD)
148 pr_cont("Read from Non-readable Page\n");
149 else if (cause_code == ECR_C_PROTV_STORE)
150 pr_cont("Write to Non-writable Page\n");
151 else if (cause_code == ECR_C_PROTV_XCHG)
152 pr_cont("Data exchange protection violation\n");
153 else if (cause_code == ECR_C_PROTV_MISALIG_DATA) 146 else if (cause_code == ECR_C_PROTV_MISALIG_DATA)
154 pr_cont("Misaligned r/w from 0x%08lx\n", address); 147 pr_cont("Misaligned r/w from 0x%08lx\n", address);
148 else
149 pr_cont("%s access not allowed on page\n",
150 (cause_code == 0x01) ? "Read" :
151 ((cause_code == 0x02) ? "Write" : "EX"));
155 } else if (vec == ECR_V_INSN_ERR) { 152 } else if (vec == ECR_V_INSN_ERR) {
156 pr_cont("Illegal Insn\n"); 153 pr_cont("Illegal Insn\n");
157 } else { 154 } else {
@@ -176,8 +173,7 @@ void show_regs(struct pt_regs *regs)
176 print_task_path_n_nm(tsk, buf); 173 print_task_path_n_nm(tsk, buf);
177 show_regs_print_info(KERN_INFO); 174 show_regs_print_info(KERN_INFO);
178 175
179 if (current->thread.cause_code) 176 show_ecr_verbose(regs);
180 show_ecr_verbose(regs);
181 177
182 pr_info("[EFA ]: 0x%08lx\n[BLINK ]: %pS\n[ERET ]: %pS\n", 178 pr_info("[EFA ]: 0x%08lx\n[BLINK ]: %pS\n[ERET ]: %pS\n",
183 current->thread.fault_address, 179 current->thread.fault_address,
@@ -213,10 +209,9 @@ void show_regs(struct pt_regs *regs)
213} 209}
214 210
215void show_kernel_fault_diag(const char *str, struct pt_regs *regs, 211void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
216 unsigned long address, unsigned long cause_reg) 212 unsigned long address)
217{ 213{
218 current->thread.fault_address = address; 214 current->thread.fault_address = address;
219 current->thread.cause_code = cause_reg;
220 215
221 /* Caller and Callee regs */ 216 /* Caller and Callee regs */
222 show_regs(regs); 217 show_regs(regs);
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c
index 4cd81633febd..c0f832f595d3 100644
--- a/arch/arc/kernel/unaligned.c
+++ b/arch/arc/kernel/unaligned.c
@@ -187,7 +187,7 @@ fault: state->fault = 1;
187 * Returns 0 if successfully handled, 1 if some error happened 187 * Returns 0 if successfully handled, 1 if some error happened
188 */ 188 */
189int misaligned_fixup(unsigned long address, struct pt_regs *regs, 189int misaligned_fixup(unsigned long address, struct pt_regs *regs,
190 unsigned long cause, struct callee_regs *cregs) 190 struct callee_regs *cregs)
191{ 191{
192 struct disasm_state state; 192 struct disasm_state state;
193 char buf[TASK_COMM_LEN]; 193 char buf[TASK_COMM_LEN];
diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index a8d02223da44..e550b117ec4f 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -289,6 +289,8 @@ static void __init setup_unwind_table(struct unwind_table *table,
289 * instead of the initial loc addr 289 * instead of the initial loc addr
290 * return; 290 * return;
291 */ 291 */
292 WARN(1, "unwinder: FDE->initial_location NULL %p\n",
293 (const u8 *)(fde + 1) + *fde);
292 } 294 }
293 ++n; 295 ++n;
294 } 296 }
diff --git a/arch/arc/kernel/vmlinux.lds.S b/arch/arc/kernel/vmlinux.lds.S
index d3c92f52d444..2555f5886af6 100644
--- a/arch/arc/kernel/vmlinux.lds.S
+++ b/arch/arc/kernel/vmlinux.lds.S
@@ -125,6 +125,11 @@ SECTIONS
125 *(.debug_frame) 125 *(.debug_frame)
126 __end_unwind = .; 126 __end_unwind = .;
127 } 127 }
128 /*
129 * gcc 4.8 generates this for -fasynchonous-unwind-tables,
130 * while we still use the .debug_frame based unwinder
131 */
132 /DISCARD/ : { *(.eh_frame) }
128#else 133#else
129 /DISCARD/ : { *(.debug_frame) } 134 /DISCARD/ : { *(.debug_frame) }
130#endif 135#endif
@@ -142,15 +147,18 @@ SECTIONS
142 *(.arcextmap.*) 147 *(.arcextmap.*)
143 } 148 }
144 149
150#ifndef CONFIG_DEBUG_INFO
145 /* open-coded because we need .debug_frame seperately for unwinding */ 151 /* open-coded because we need .debug_frame seperately for unwinding */
146 .debug_aranges 0 : { *(.debug_aranges) } 152 /DISCARD/ : { *(.debug_aranges) }
147 .debug_pubnames 0 : { *(.debug_pubnames) } 153 /DISCARD/ : { *(.debug_pubnames) }
148 .debug_info 0 : { *(.debug_info) } 154 /DISCARD/ : { *(.debug_info) }
149 .debug_abbrev 0 : { *(.debug_abbrev) } 155 /DISCARD/ : { *(.debug_abbrev) }
150 .debug_line 0 : { *(.debug_line) } 156 /DISCARD/ : { *(.debug_line) }
151 .debug_str 0 : { *(.debug_str) } 157 /DISCARD/ : { *(.debug_str) }
152 .debug_loc 0 : { *(.debug_loc) } 158 /DISCARD/ : { *(.debug_loc) }
153 .debug_macinfo 0 : { *(.debug_macinfo) } 159 /DISCARD/ : { *(.debug_macinfo) }
160 /DISCARD/ : { *(.debug_ranges) }
161#endif
154 162
155#ifdef CONFIG_ARC_HAS_DCCM 163#ifdef CONFIG_ARC_HAS_DCCM
156 . = CONFIG_ARC_DCCM_BASE; 164 . = CONFIG_ARC_DCCM_BASE;
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index aedce1905441..f415d851b765 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -73,6 +73,33 @@
73#include <asm/cachectl.h> 73#include <asm/cachectl.h>
74#include <asm/setup.h> 74#include <asm/setup.h>
75 75
76/* Instruction cache related Auxiliary registers */
77#define ARC_REG_IC_BCR 0x77 /* Build Config reg */
78#define ARC_REG_IC_IVIC 0x10
79#define ARC_REG_IC_CTRL 0x11
80#define ARC_REG_IC_IVIL 0x19
81#if (CONFIG_ARC_MMU_VER > 2)
82#define ARC_REG_IC_PTAG 0x1E
83#endif
84
85/* Bit val in IC_CTRL */
86#define IC_CTRL_CACHE_DISABLE 0x1
87
88/* Data cache related Auxiliary registers */
89#define ARC_REG_DC_BCR 0x72 /* Build Config reg */
90#define ARC_REG_DC_IVDC 0x47
91#define ARC_REG_DC_CTRL 0x48
92#define ARC_REG_DC_IVDL 0x4A
93#define ARC_REG_DC_FLSH 0x4B
94#define ARC_REG_DC_FLDL 0x4C
95#if (CONFIG_ARC_MMU_VER > 2)
96#define ARC_REG_DC_PTAG 0x5C
97#endif
98
99/* Bit val in DC_CTRL */
100#define DC_CTRL_INV_MODE_FLUSH 0x40
101#define DC_CTRL_FLUSH_STATUS 0x100
102
76char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len) 103char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len)
77{ 104{
78 int n = 0; 105 int n = 0;
@@ -89,8 +116,10 @@ char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len)
89 enb ? "" : "DISABLED (kernel-build)"); \ 116 enb ? "" : "DISABLED (kernel-build)"); \
90} 117}
91 118
92 PR_CACHE(&cpuinfo_arc700[c].icache, __CONFIG_ARC_HAS_ICACHE, "I-Cache"); 119 PR_CACHE(&cpuinfo_arc700[c].icache, IS_ENABLED(CONFIG_ARC_HAS_ICACHE),
93 PR_CACHE(&cpuinfo_arc700[c].dcache, __CONFIG_ARC_HAS_DCACHE, "D-Cache"); 120 "I-Cache");
121 PR_CACHE(&cpuinfo_arc700[c].dcache, IS_ENABLED(CONFIG_ARC_HAS_DCACHE),
122 "D-Cache");
94 123
95 return buf; 124 return buf;
96} 125}
@@ -100,17 +129,23 @@ char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len)
100 * the cpuinfo structure for later use. 129 * the cpuinfo structure for later use.
101 * No Validation done here, simply read/convert the BCRs 130 * No Validation done here, simply read/convert the BCRs
102 */ 131 */
103void __cpuinit read_decode_cache_bcr(void) 132void read_decode_cache_bcr(void)
104{ 133{
105 struct bcr_cache ibcr, dbcr;
106 struct cpuinfo_arc_cache *p_ic, *p_dc; 134 struct cpuinfo_arc_cache *p_ic, *p_dc;
107 unsigned int cpu = smp_processor_id(); 135 unsigned int cpu = smp_processor_id();
136 struct bcr_cache {
137#ifdef CONFIG_CPU_BIG_ENDIAN
138 unsigned int pad:12, line_len:4, sz:4, config:4, ver:8;
139#else
140 unsigned int ver:8, config:4, sz:4, line_len:4, pad:12;
141#endif
142 } ibcr, dbcr;
108 143
109 p_ic = &cpuinfo_arc700[cpu].icache; 144 p_ic = &cpuinfo_arc700[cpu].icache;
110 READ_BCR(ARC_REG_IC_BCR, ibcr); 145 READ_BCR(ARC_REG_IC_BCR, ibcr);
111 146
112 if (ibcr.config == 0x3) 147 BUG_ON(ibcr.config != 3);
113 p_ic->assoc = 2; 148 p_ic->assoc = 2; /* Fixed to 2w set assoc */
114 p_ic->line_len = 8 << ibcr.line_len; 149 p_ic->line_len = 8 << ibcr.line_len;
115 p_ic->sz = 0x200 << ibcr.sz; 150 p_ic->sz = 0x200 << ibcr.sz;
116 p_ic->ver = ibcr.ver; 151 p_ic->ver = ibcr.ver;
@@ -118,8 +153,8 @@ void __cpuinit read_decode_cache_bcr(void)
118 p_dc = &cpuinfo_arc700[cpu].dcache; 153 p_dc = &cpuinfo_arc700[cpu].dcache;
119 READ_BCR(ARC_REG_DC_BCR, dbcr); 154 READ_BCR(ARC_REG_DC_BCR, dbcr);
120 155
121 if (dbcr.config == 0x2) 156 BUG_ON(dbcr.config != 2);
122 p_dc->assoc = 4; 157 p_dc->assoc = 4; /* Fixed to 4w set assoc */
123 p_dc->line_len = 16 << dbcr.line_len; 158 p_dc->line_len = 16 << dbcr.line_len;
124 p_dc->sz = 0x200 << dbcr.sz; 159 p_dc->sz = 0x200 << dbcr.sz;
125 p_dc->ver = dbcr.ver; 160 p_dc->ver = dbcr.ver;
@@ -132,14 +167,12 @@ void __cpuinit read_decode_cache_bcr(void)
132 * 3. Enable the Caches, setup default flush mode for D-Cache 167 * 3. Enable the Caches, setup default flush mode for D-Cache
133 * 3. Calculate the SHMLBA used by user space 168 * 3. Calculate the SHMLBA used by user space
134 */ 169 */
135void __cpuinit arc_cache_init(void) 170void arc_cache_init(void)
136{ 171{
137 unsigned int temp;
138 unsigned int cpu = smp_processor_id(); 172 unsigned int cpu = smp_processor_id();
139 struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; 173 struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache;
140 struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache; 174 struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache;
141 int way_pg_ratio = way_pg_ratio; 175 unsigned int dcache_does_alias, temp;
142 int dcache_does_alias;
143 char str[256]; 176 char str[256];
144 177
145 printk(arc_cache_mumbojumbo(0, str, sizeof(str))); 178 printk(arc_cache_mumbojumbo(0, str, sizeof(str)));
@@ -149,20 +182,11 @@ void __cpuinit arc_cache_init(void)
149 182
150#ifdef CONFIG_ARC_HAS_ICACHE 183#ifdef CONFIG_ARC_HAS_ICACHE
151 /* 1. Confirm some of I-cache params which Linux assumes */ 184 /* 1. Confirm some of I-cache params which Linux assumes */
152 if ((ic->assoc != ARC_ICACHE_WAYS) || 185 if (ic->line_len != ARC_ICACHE_LINE_LEN)
153 (ic->line_len != ARC_ICACHE_LINE_LEN)) {
154 panic("Cache H/W doesn't match kernel Config"); 186 panic("Cache H/W doesn't match kernel Config");
155 }
156#if (CONFIG_ARC_MMU_VER > 2)
157 if (ic->ver != 3) {
158 if (running_on_hw)
159 panic("Cache ver doesn't match MMU ver\n");
160
161 /* For ISS - suggest the toggles to use */
162 pr_err("Use -prop=icache_version=3,-prop=dcache_version=3\n");
163 187
164 } 188 if (ic->ver != CONFIG_ARC_MMU_VER)
165#endif 189 panic("Cache ver doesn't match MMU ver\n");
166#endif 190#endif
167 191
168 /* Enable/disable I-Cache */ 192 /* Enable/disable I-Cache */
@@ -181,14 +205,12 @@ chk_dc:
181 return; 205 return;
182 206
183#ifdef CONFIG_ARC_HAS_DCACHE 207#ifdef CONFIG_ARC_HAS_DCACHE
184 if ((dc->assoc != ARC_DCACHE_WAYS) || 208 if (dc->line_len != ARC_DCACHE_LINE_LEN)
185 (dc->line_len != ARC_DCACHE_LINE_LEN)) {
186 panic("Cache H/W doesn't match kernel Config"); 209 panic("Cache H/W doesn't match kernel Config");
187 }
188
189 dcache_does_alias = (dc->sz / ARC_DCACHE_WAYS) > PAGE_SIZE;
190 210
191 /* check for D-Cache aliasing */ 211 /* check for D-Cache aliasing */
212 dcache_does_alias = (dc->sz / dc->assoc) > PAGE_SIZE;
213
192 if (dcache_does_alias && !cache_is_vipt_aliasing()) 214 if (dcache_does_alias && !cache_is_vipt_aliasing())
193 panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 215 panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n");
194 else if (!dcache_does_alias && cache_is_vipt_aliasing()) 216 else if (!dcache_does_alias && cache_is_vipt_aliasing())
@@ -239,11 +261,9 @@ static inline void wait_for_flush(void)
239 */ 261 */
240static inline void __dc_entire_op(const int cacheop) 262static inline void __dc_entire_op(const int cacheop)
241{ 263{
242 unsigned long flags, tmp = tmp; 264 unsigned int tmp = tmp;
243 int aux; 265 int aux;
244 266
245 local_irq_save(flags);
246
247 if (cacheop == OP_FLUSH_N_INV) { 267 if (cacheop == OP_FLUSH_N_INV) {
248 /* Dcache provides 2 cmd: FLUSH or INV 268 /* Dcache provides 2 cmd: FLUSH or INV
249 * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE 269 * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE
@@ -267,8 +287,6 @@ static inline void __dc_entire_op(const int cacheop)
267 /* Switch back the DISCARD ONLY Invalidate mode */ 287 /* Switch back the DISCARD ONLY Invalidate mode */
268 if (cacheop == OP_FLUSH_N_INV) 288 if (cacheop == OP_FLUSH_N_INV)
269 write_aux_reg(ARC_REG_DC_CTRL, tmp & ~DC_CTRL_INV_MODE_FLUSH); 289 write_aux_reg(ARC_REG_DC_CTRL, tmp & ~DC_CTRL_INV_MODE_FLUSH);
270
271 local_irq_restore(flags);
272} 290}
273 291
274/* 292/*
@@ -459,8 +477,15 @@ static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
459 local_irq_restore(flags); 477 local_irq_restore(flags);
460} 478}
461 479
480static inline void __ic_entire_inv(void)
481{
482 write_aux_reg(ARC_REG_IC_IVIC, 1);
483 read_aux_reg(ARC_REG_IC_CTRL); /* blocks */
484}
485
462#else 486#else
463 487
488#define __ic_entire_inv()
464#define __ic_line_inv_vaddr(pstart, vstart, sz) 489#define __ic_line_inv_vaddr(pstart, vstart, sz)
465 490
466#endif /* CONFIG_ARC_HAS_ICACHE */ 491#endif /* CONFIG_ARC_HAS_ICACHE */
@@ -487,7 +512,7 @@ void flush_dcache_page(struct page *page)
487 struct address_space *mapping; 512 struct address_space *mapping;
488 513
489 if (!cache_is_vipt_aliasing()) { 514 if (!cache_is_vipt_aliasing()) {
490 set_bit(PG_arch_1, &page->flags); 515 clear_bit(PG_dc_clean, &page->flags);
491 return; 516 return;
492 } 517 }
493 518
@@ -501,7 +526,7 @@ void flush_dcache_page(struct page *page)
501 * Make a note that K-mapping is dirty 526 * Make a note that K-mapping is dirty
502 */ 527 */
503 if (!mapping_mapped(mapping)) { 528 if (!mapping_mapped(mapping)) {
504 set_bit(PG_arch_1, &page->flags); 529 clear_bit(PG_dc_clean, &page->flags);
505 } else if (page_mapped(page)) { 530 } else if (page_mapped(page)) {
506 531
507 /* kernel reading from page with U-mapping */ 532 /* kernel reading from page with U-mapping */
@@ -629,26 +654,13 @@ void ___flush_dcache_page(unsigned long paddr, unsigned long vaddr)
629 __dc_line_op(paddr, vaddr & PAGE_MASK, PAGE_SIZE, OP_FLUSH_N_INV); 654 __dc_line_op(paddr, vaddr & PAGE_MASK, PAGE_SIZE, OP_FLUSH_N_INV);
630} 655}
631 656
632void flush_icache_all(void)
633{
634 unsigned long flags;
635
636 local_irq_save(flags);
637
638 write_aux_reg(ARC_REG_IC_IVIC, 1);
639
640 /* lr will not complete till the icache inv operation is not over */
641 read_aux_reg(ARC_REG_IC_CTRL);
642 local_irq_restore(flags);
643}
644
645noinline void flush_cache_all(void) 657noinline void flush_cache_all(void)
646{ 658{
647 unsigned long flags; 659 unsigned long flags;
648 660
649 local_irq_save(flags); 661 local_irq_save(flags);
650 662
651 flush_icache_all(); 663 __ic_entire_inv();
652 __dc_entire_op(OP_FLUSH_N_INV); 664 __dc_entire_op(OP_FLUSH_N_INV);
653 665
654 local_irq_restore(flags); 666 local_irq_restore(flags);
@@ -667,7 +679,12 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long u_vaddr,
667{ 679{
668 unsigned int paddr = pfn << PAGE_SHIFT; 680 unsigned int paddr = pfn << PAGE_SHIFT;
669 681
670 __sync_icache_dcache(paddr, u_vaddr, PAGE_SIZE); 682 u_vaddr &= PAGE_MASK;
683
684 ___flush_dcache_page(paddr, u_vaddr);
685
686 if (vma->vm_flags & VM_EXEC)
687 __inv_icache_page(paddr, u_vaddr);
671} 688}
672 689
673void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 690void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
@@ -717,7 +734,7 @@ void copy_user_highpage(struct page *to, struct page *from,
717 * non copied user pages (e.g. read faults which wire in pagecache page 734 * non copied user pages (e.g. read faults which wire in pagecache page
718 * directly). 735 * directly).
719 */ 736 */
720 set_bit(PG_arch_1, &to->flags); 737 clear_bit(PG_dc_clean, &to->flags);
721 738
722 /* 739 /*
723 * if SRC was already usermapped and non-congruent to kernel mapping 740 * if SRC was already usermapped and non-congruent to kernel mapping
@@ -725,15 +742,16 @@ void copy_user_highpage(struct page *to, struct page *from,
725 */ 742 */
726 if (clean_src_k_mappings) { 743 if (clean_src_k_mappings) {
727 __flush_dcache_page(kfrom, kfrom); 744 __flush_dcache_page(kfrom, kfrom);
745 set_bit(PG_dc_clean, &from->flags);
728 } else { 746 } else {
729 set_bit(PG_arch_1, &from->flags); 747 clear_bit(PG_dc_clean, &from->flags);
730 } 748 }
731} 749}
732 750
733void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) 751void clear_user_page(void *to, unsigned long u_vaddr, struct page *page)
734{ 752{
735 clear_page(to); 753 clear_page(to);
736 set_bit(PG_arch_1, &page->flags); 754 clear_bit(PG_dc_clean, &page->flags);
737} 755}
738 756
739 757
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 689ffd86d5e9..318164cabdfc 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -15,6 +15,7 @@
15#include <linux/uaccess.h> 15#include <linux/uaccess.h>
16#include <linux/kdebug.h> 16#include <linux/kdebug.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm/mmu.h>
18 19
19static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address) 20static int handle_vmalloc_fault(struct mm_struct *mm, unsigned long address)
20{ 21{
@@ -51,14 +52,14 @@ bad_area:
51 return 1; 52 return 1;
52} 53}
53 54
54void do_page_fault(struct pt_regs *regs, int write, unsigned long address, 55void do_page_fault(struct pt_regs *regs, unsigned long address)
55 unsigned long cause_code)
56{ 56{
57 struct vm_area_struct *vma = NULL; 57 struct vm_area_struct *vma = NULL;
58 struct task_struct *tsk = current; 58 struct task_struct *tsk = current;
59 struct mm_struct *mm = tsk->mm; 59 struct mm_struct *mm = tsk->mm;
60 siginfo_t info; 60 siginfo_t info;
61 int fault, ret; 61 int fault, ret;
62 int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */
62 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 63 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
63 (write ? FAULT_FLAG_WRITE : 0); 64 (write ? FAULT_FLAG_WRITE : 0);
64 65
@@ -109,7 +110,8 @@ good_area:
109 110
110 /* Handle protection violation, execute on heap or stack */ 111 /* Handle protection violation, execute on heap or stack */
111 112
112 if (cause_code == ((ECR_V_PROTV << 16) | ECR_C_PROTV_INST_FETCH)) 113 if ((regs->ecr_vec == ECR_V_PROTV) &&
114 (regs->ecr_cause == ECR_C_PROTV_INST_FETCH))
113 goto bad_area; 115 goto bad_area;
114 116
115 if (write) { 117 if (write) {
@@ -176,7 +178,6 @@ bad_area_nosemaphore:
176 /* User mode accesses just cause a SIGSEGV */ 178 /* User mode accesses just cause a SIGSEGV */
177 if (user_mode(regs)) { 179 if (user_mode(regs)) {
178 tsk->thread.fault_address = address; 180 tsk->thread.fault_address = address;
179 tsk->thread.cause_code = cause_code;
180 info.si_signo = SIGSEGV; 181 info.si_signo = SIGSEGV;
181 info.si_errno = 0; 182 info.si_errno = 0;
182 /* info.si_code has been set above */ 183 /* info.si_code has been set above */
@@ -197,7 +198,7 @@ no_context:
197 if (fixup_exception(regs)) 198 if (fixup_exception(regs))
198 return; 199 return;
199 200
200 die("Oops", regs, address, cause_code); 201 die("Oops", regs, address);
201 202
202out_of_memory: 203out_of_memory:
203 if (is_global_init(tsk)) { 204 if (is_global_init(tsk)) {
@@ -218,7 +219,6 @@ do_sigbus:
218 goto no_context; 219 goto no_context;
219 220
220 tsk->thread.fault_address = address; 221 tsk->thread.fault_address = address;
221 tsk->thread.cause_code = cause_code;
222 info.si_signo = SIGBUS; 222 info.si_signo = SIGBUS;
223 info.si_errno = 0; 223 info.si_errno = 0;
224 info.si_code = BUS_ADRERR; 224 info.si_code = BUS_ADRERR;
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 4a177365b2c4..a08ce7185423 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -74,7 +74,7 @@ void __init setup_arch_memory(void)
74 /* Last usable page of low mem (no HIGHMEM yet for ARC port) */ 74 /* Last usable page of low mem (no HIGHMEM yet for ARC port) */
75 max_low_pfn = max_pfn = PFN_DOWN(end_mem); 75 max_low_pfn = max_pfn = PFN_DOWN(end_mem);
76 76
77 max_mapnr = num_physpages = max_low_pfn - min_low_pfn; 77 max_mapnr = max_low_pfn - min_low_pfn;
78 78
79 /*------------- reserve kernel image -----------------------*/ 79 /*------------- reserve kernel image -----------------------*/
80 memblock_reserve(CONFIG_LINUX_LINK_BASE, 80 memblock_reserve(CONFIG_LINUX_LINK_BASE,
@@ -84,7 +84,7 @@ void __init setup_arch_memory(void)
84 84
85 /*-------------- node setup --------------------------------*/ 85 /*-------------- node setup --------------------------------*/
86 memset(zones_size, 0, sizeof(zones_size)); 86 memset(zones_size, 0, sizeof(zones_size));
87 zones_size[ZONE_NORMAL] = num_physpages; 87 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
88 88
89 /* 89 /*
90 * We can't use the helper free_area_init(zones[]) because it uses 90 * We can't use the helper free_area_init(zones[]) because it uses
@@ -106,39 +106,9 @@ void __init setup_arch_memory(void)
106 */ 106 */
107void __init mem_init(void) 107void __init mem_init(void)
108{ 108{
109 int codesize, datasize, initsize, reserved_pages, free_pages;
110 int tmp;
111
112 high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz); 109 high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
113 110 free_all_bootmem();
114 totalram_pages = free_all_bootmem(); 111 mem_init_print_info(NULL);
115
116 /* count all reserved pages [kernel code/data/mem_map..] */
117 reserved_pages = 0;
118 for (tmp = 0; tmp < max_mapnr; tmp++)
119 if (PageReserved(mem_map + tmp))
120 reserved_pages++;
121
122 /* XXX: nr_free_pages() is equivalent */
123 free_pages = max_mapnr - reserved_pages;
124
125 /*
126 * For the purpose of display below, split the "reserve mem"
127 * kernel code/data is already shown explicitly,
128 * Show any other reservations (mem_map[ ] et al)
129 */
130 reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >>
131 PAGE_SHIFT);
132
133 codesize = _etext - _text;
134 datasize = _end - _etext;
135 initsize = __init_end - __init_begin;
136
137 pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n",
138 PAGES_TO_MB(free_pages),
139 TO_MB(arc_mem_sz),
140 TO_KB(codesize), TO_KB(datasize), TO_KB(initsize),
141 PAGES_TO_KB(reserved_pages));
142} 112}
143 113
144/* 114/*
@@ -146,13 +116,13 @@ void __init mem_init(void)
146 */ 116 */
147void __init_refok free_initmem(void) 117void __init_refok free_initmem(void)
148{ 118{
149 free_initmem_default(0); 119 free_initmem_default(-1);
150} 120}
151 121
152#ifdef CONFIG_BLK_DEV_INITRD 122#ifdef CONFIG_BLK_DEV_INITRD
153void __init free_initrd_mem(unsigned long start, unsigned long end) 123void __init free_initrd_mem(unsigned long start, unsigned long end)
154{ 124{
155 free_reserved_area(start, end, 0, "initrd"); 125 free_reserved_area((void *)start, (void *)end, -1, "initrd");
156} 126}
157#endif 127#endif
158 128
diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
index fe1c5a073afe..7957dc4e4d4a 100644
--- a/arch/arc/mm/tlb.c
+++ b/arch/arc/mm/tlb.c
@@ -55,7 +55,7 @@
55#include <asm/arcregs.h> 55#include <asm/arcregs.h>
56#include <asm/setup.h> 56#include <asm/setup.h>
57#include <asm/mmu_context.h> 57#include <asm/mmu_context.h>
58#include <asm/tlb.h> 58#include <asm/mmu.h>
59 59
60/* Need for ARC MMU v2 60/* Need for ARC MMU v2
61 * 61 *
@@ -97,6 +97,7 @@
97 * J-TLB entry got evicted/replaced. 97 * J-TLB entry got evicted/replaced.
98 */ 98 */
99 99
100
100/* A copy of the ASID from the PID reg is kept in asid_cache */ 101/* A copy of the ASID from the PID reg is kept in asid_cache */
101int asid_cache = FIRST_ASID; 102int asid_cache = FIRST_ASID;
102 103
@@ -432,9 +433,14 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned,
432{ 433{
433 unsigned long vaddr = vaddr_unaligned & PAGE_MASK; 434 unsigned long vaddr = vaddr_unaligned & PAGE_MASK;
434 unsigned long paddr = pte_val(*ptep) & PAGE_MASK; 435 unsigned long paddr = pte_val(*ptep) & PAGE_MASK;
436 struct page *page = pfn_to_page(pte_pfn(*ptep));
435 437
436 create_tlb(vma, vaddr, ptep); 438 create_tlb(vma, vaddr, ptep);
437 439
440 if (page == ZERO_PAGE(0)) {
441 return;
442 }
443
438 /* 444 /*
439 * Exec page : Independent of aliasing/page-color considerations, 445 * Exec page : Independent of aliasing/page-color considerations,
440 * since icache doesn't snoop dcache on ARC, any dirty 446 * since icache doesn't snoop dcache on ARC, any dirty
@@ -446,9 +452,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned,
446 */ 452 */
447 if ((vma->vm_flags & VM_EXEC) || 453 if ((vma->vm_flags & VM_EXEC) ||
448 addr_not_cache_congruent(paddr, vaddr)) { 454 addr_not_cache_congruent(paddr, vaddr)) {
449 struct page *page = pfn_to_page(pte_pfn(*ptep));
450 455
451 int dirty = test_and_clear_bit(PG_arch_1, &page->flags); 456 int dirty = !test_and_set_bit(PG_dc_clean, &page->flags);
452 if (dirty) { 457 if (dirty) {
453 /* wback + inv dcache lines */ 458 /* wback + inv dcache lines */
454 __flush_dcache_page(paddr, paddr); 459 __flush_dcache_page(paddr, paddr);
@@ -464,12 +469,27 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned,
464 * the cpuinfo structure for later use. 469 * the cpuinfo structure for later use.
465 * No Validation is done here, simply read/convert the BCRs 470 * No Validation is done here, simply read/convert the BCRs
466 */ 471 */
467void __cpuinit read_decode_mmu_bcr(void) 472void read_decode_mmu_bcr(void)
468{ 473{
469 unsigned int tmp;
470 struct bcr_mmu_1_2 *mmu2; /* encoded MMU2 attr */
471 struct bcr_mmu_3 *mmu3; /* encoded MMU3 attr */
472 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; 474 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
475 unsigned int tmp;
476 struct bcr_mmu_1_2 {
477#ifdef CONFIG_CPU_BIG_ENDIAN
478 unsigned int ver:8, ways:4, sets:4, u_itlb:8, u_dtlb:8;
479#else
480 unsigned int u_dtlb:8, u_itlb:8, sets:4, ways:4, ver:8;
481#endif
482 } *mmu2;
483
484 struct bcr_mmu_3 {
485#ifdef CONFIG_CPU_BIG_ENDIAN
486 unsigned int ver:8, ways:4, sets:4, osm:1, reserv:3, pg_sz:4,
487 u_itlb:4, u_dtlb:4;
488#else
489 unsigned int u_dtlb:4, u_itlb:4, pg_sz:4, reserv:3, osm:1, sets:4,
490 ways:4, ver:8;
491#endif
492 } *mmu3;
473 493
474 tmp = read_aux_reg(ARC_REG_MMU_BCR); 494 tmp = read_aux_reg(ARC_REG_MMU_BCR);
475 mmu->ver = (tmp >> 24); 495 mmu->ver = (tmp >> 24);
@@ -505,12 +525,12 @@ char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len)
505 "J-TLB %d (%dx%d), uDTLB %d, uITLB %d, %s\n", 525 "J-TLB %d (%dx%d), uDTLB %d, uITLB %d, %s\n",
506 p_mmu->num_tlb, p_mmu->sets, p_mmu->ways, 526 p_mmu->num_tlb, p_mmu->sets, p_mmu->ways,
507 p_mmu->u_dtlb, p_mmu->u_itlb, 527 p_mmu->u_dtlb, p_mmu->u_itlb,
508 __CONFIG_ARC_MMU_SASID_VAL ? "SASID" : ""); 528 IS_ENABLED(CONFIG_ARC_MMU_SASID) ? "SASID" : "");
509 529
510 return buf; 530 return buf;
511} 531}
512 532
513void __cpuinit arc_mmu_init(void) 533void arc_mmu_init(void)
514{ 534{
515 char str[256]; 535 char str[256];
516 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; 536 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S
index 3357d26ffe54..5c5bb23001b0 100644
--- a/arch/arc/mm/tlbex.S
+++ b/arch/arc/mm/tlbex.S
@@ -39,7 +39,7 @@
39 39
40#include <linux/linkage.h> 40#include <linux/linkage.h>
41#include <asm/entry.h> 41#include <asm/entry.h>
42#include <asm/tlb.h> 42#include <asm/mmu.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/arcregs.h> 44#include <asm/arcregs.h>
45#include <asm/cache.h> 45#include <asm/cache.h>
@@ -147,9 +147,9 @@ ex_saved_reg1:
147#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT 147#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
148 and.f 0, r0, _PAGE_PRESENT 148 and.f 0, r0, _PAGE_PRESENT
149 bz 1f 149 bz 1f
150 ld r2, [num_pte_not_present] 150 ld r3, [num_pte_not_present]
151 add r2, r2, 1 151 add r3, r3, 1
152 st r2, [num_pte_not_present] 152 st r3, [num_pte_not_present]
1531: 1531:
154#endif 154#endif
155 155
@@ -271,22 +271,22 @@ ARC_ENTRY EV_TLBMissI
271#endif 271#endif
272 272
273 ;---------------------------------------------------------------- 273 ;----------------------------------------------------------------
274 ; Get the PTE corresponding to V-addr accessed 274 ; Get the PTE corresponding to V-addr accessed, r2 is setup with EFA
275 LOAD_FAULT_PTE 275 LOAD_FAULT_PTE
276 276
277 ;---------------------------------------------------------------- 277 ;----------------------------------------------------------------
278 ; VERIFY_PTE: Check if PTE permissions approp for executing code 278 ; VERIFY_PTE: Check if PTE permissions approp for executing code
279 cmp_s r2, VMALLOC_START 279 cmp_s r2, VMALLOC_START
280 mov.lo r2, (_PAGE_PRESENT | _PAGE_U_READ | _PAGE_U_EXECUTE) 280 mov.lo r2, (_PAGE_PRESENT | _PAGE_U_EXECUTE)
281 mov.hs r2, (_PAGE_PRESENT | _PAGE_K_READ | _PAGE_K_EXECUTE) 281 mov.hs r2, (_PAGE_PRESENT | _PAGE_K_EXECUTE)
282 282
283 and r3, r0, r2 ; Mask out NON Flag bits from PTE 283 and r3, r0, r2 ; Mask out NON Flag bits from PTE
284 xor.f r3, r3, r2 ; check ( ( pte & flags_test ) == flags_test ) 284 xor.f r3, r3, r2 ; check ( ( pte & flags_test ) == flags_test )
285 bnz do_slow_path_pf 285 bnz do_slow_path_pf
286 286
287 ; Let Linux VM know that the page was accessed 287 ; Let Linux VM know that the page was accessed
288 or r0, r0, (_PAGE_PRESENT | _PAGE_ACCESSED) ; set Accessed Bit 288 or r0, r0, _PAGE_ACCESSED ; set Accessed Bit
289 st_s r0, [r1] ; Write back PTE 289 st_s r0, [r1] ; Write back PTE
290 290
291 CONV_PTE_TO_TLB 291 CONV_PTE_TO_TLB
292 COMMIT_ENTRY_TO_MMU 292 COMMIT_ENTRY_TO_MMU
@@ -311,7 +311,7 @@ ARC_ENTRY EV_TLBMissD
311 311
312 ;---------------------------------------------------------------- 312 ;----------------------------------------------------------------
313 ; Get the PTE corresponding to V-addr accessed 313 ; Get the PTE corresponding to V-addr accessed
314 ; If PTE exists, it will setup, r0 = PTE, r1 = Ptr to PTE 314 ; If PTE exists, it will setup, r0 = PTE, r1 = Ptr to PTE, r2 = EFA
315 LOAD_FAULT_PTE 315 LOAD_FAULT_PTE
316 316
317 ;---------------------------------------------------------------- 317 ;----------------------------------------------------------------
@@ -345,7 +345,7 @@ ARC_ENTRY EV_TLBMissD
345 ;---------------------------------------------------------------- 345 ;----------------------------------------------------------------
346 ; UPDATE_PTE: Let Linux VM know that page was accessed/dirty 346 ; UPDATE_PTE: Let Linux VM know that page was accessed/dirty
347 lr r3, [ecr] 347 lr r3, [ecr]
348 or r0, r0, (_PAGE_PRESENT | _PAGE_ACCESSED) ; Accessed bit always 348 or r0, r0, _PAGE_ACCESSED ; Accessed bit always
349 btst_s r3, ECR_C_BIT_DTLB_ST_MISS ; See if it was a Write Access ? 349 btst_s r3, ECR_C_BIT_DTLB_ST_MISS ; See if it was a Write Access ?
350 or.nz r0, r0, _PAGE_MODIFIED ; if Write, set Dirty bit as well 350 or.nz r0, r0, _PAGE_MODIFIED ; if Write, set Dirty bit as well
351 st_s r0, [r1] ; Write back PTE 351 st_s r0, [r1] ; Write back PTE
@@ -381,18 +381,7 @@ do_slow_path_pf:
381 381
382 ; ------- setup args for Linux Page fault Hanlder --------- 382 ; ------- setup args for Linux Page fault Hanlder ---------
383 mov_s r0, sp 383 mov_s r0, sp
384 lr r2, [efa] 384 lr r1, [efa]
385 lr r3, [ecr]
386
387 ; Both st and ex imply WRITE access of some sort, hence do_page_fault( )
388 ; invoked with write=1 for DTLB-st/ex Miss and write=0 for ITLB miss or
389 ; DTLB-ld Miss
390 ; DTLB Miss Cause code is ld = 0x01 , st = 0x02, ex = 0x03
391 ; Following code uses that fact that st/ex have one bit in common
392
393 btst_s r3, ECR_C_BIT_DTLB_ST_MISS
394 mov.z r1, 0
395 mov.nz r1, 1
396 385
397 ; We don't want exceptions to be disabled while the fault is handled. 386 ; We don't want exceptions to be disabled while the fault is handled.
398 ; Now that we have saved the context we return from exception hence 387 ; Now that we have saved the context we return from exception hence
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c
index b3700c064c06..d71f3c3bcf24 100644
--- a/arch/arc/plat-arcfpga/platform.c
+++ b/arch/arc/plat-arcfpga/platform.c
@@ -77,6 +77,7 @@ static void __init setup_bvci_lat_unit(void)
77 77
78/*----------------------- Platform Devices -----------------------------*/ 78/*----------------------- Platform Devices -----------------------------*/
79 79
80#if IS_ENABLED(CONFIG_SERIAL_ARC)
80static unsigned long arc_uart_info[] = { 81static unsigned long arc_uart_info[] = {
81 0, /* uart->is_emulated (runtime @running_on_hw) */ 82 0, /* uart->is_emulated (runtime @running_on_hw) */
82 0, /* uart->port.uartclk */ 83 0, /* uart->port.uartclk */
@@ -115,7 +116,7 @@ static struct platform_device arc_uart0_dev = {
115static struct platform_device *fpga_early_devs[] __initdata = { 116static struct platform_device *fpga_early_devs[] __initdata = {
116 &arc_uart0_dev, 117 &arc_uart0_dev,
117}; 118};
118#endif 119#endif /* CONFIG_SERIAL_ARC_CONSOLE */
119 120
120static void arc_fpga_serial_init(void) 121static void arc_fpga_serial_init(void)
121{ 122{
@@ -152,8 +153,13 @@ static void arc_fpga_serial_init(void)
152 * otherwise the early console never gets a chance to run. 153 * otherwise the early console never gets a chance to run.
153 */ 154 */
154 add_preferred_console("ttyARC", 0, "115200"); 155 add_preferred_console("ttyARC", 0, "115200");
155#endif 156#endif /* CONFIG_SERIAL_ARC_CONSOLE */
157}
158#else /* !IS_ENABLED(CONFIG_SERIAL_ARC) */
159static void arc_fpga_serial_init(void)
160{
156} 161}
162#endif
157 163
158static void __init plat_fpga_early_init(void) 164static void __init plat_fpga_early_init(void)
159{ 165{
@@ -169,7 +175,7 @@ static void __init plat_fpga_early_init(void)
169} 175}
170 176
171static struct of_dev_auxdata plat_auxdata_lookup[] __initdata = { 177static struct of_dev_auxdata plat_auxdata_lookup[] __initdata = {
172#if defined(CONFIG_SERIAL_ARC) || defined(CONFIG_SERIAL_ARC_MODULE) 178#if IS_ENABLED(CONFIG_SERIAL_ARC)
173 OF_DEV_AUXDATA("snps,arc-uart", UART0_BASE, "arc-uart", arc_uart_info), 179 OF_DEV_AUXDATA("snps,arc-uart", UART0_BASE, "arc-uart", arc_uart_info),
174#endif 180#endif
175 {} 181 {}
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 49d993cee512..531cdda016f9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -9,7 +9,7 @@ config ARM
9 select BUILDTIME_EXTABLE_SORT if MMU 9 select BUILDTIME_EXTABLE_SORT if MMU
10 select CPU_PM if (SUSPEND || CPU_IDLE) 10 select CPU_PM if (SUSPEND || CPU_IDLE)
11 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU 11 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU
12 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) 12 select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
13 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 13 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
14 select GENERIC_IRQ_PROBE 14 select GENERIC_IRQ_PROBE
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
@@ -175,6 +175,9 @@ config ARCH_HAS_CPUFREQ
175 and that the relevant menu configurations are displayed for 175 and that the relevant menu configurations are displayed for
176 it. 176 it.
177 177
178config ARCH_HAS_BANDGAP
179 bool
180
178config GENERIC_HWEIGHT 181config GENERIC_HWEIGHT
179 bool 182 bool
180 default y 183 default y
@@ -366,11 +369,12 @@ config ARCH_CLPS711X
366 select ARCH_REQUIRE_GPIOLIB 369 select ARCH_REQUIRE_GPIOLIB
367 select AUTO_ZRELADDR 370 select AUTO_ZRELADDR
368 select CLKDEV_LOOKUP 371 select CLKDEV_LOOKUP
372 select CLKSRC_MMIO
369 select COMMON_CLK 373 select COMMON_CLK
370 select CPU_ARM720T 374 select CPU_ARM720T
371 select GENERIC_CLOCKEVENTS 375 select GENERIC_CLOCKEVENTS
376 select MFD_SYSCON
372 select MULTI_IRQ_HANDLER 377 select MULTI_IRQ_HANDLER
373 select NEED_MACH_MEMORY_H
374 select SPARSE_IRQ 378 select SPARSE_IRQ
375 help 379 help
376 Support for Cirrus Logic 711x/721x/731x based boards. 380 Support for Cirrus Logic 711x/721x/731x based boards.
@@ -502,6 +506,7 @@ config ARCH_DOVE
502 506
503config ARCH_KIRKWOOD 507config ARCH_KIRKWOOD
504 bool "Marvell Kirkwood" 508 bool "Marvell Kirkwood"
509 select ARCH_HAS_CPUFREQ
505 select ARCH_REQUIRE_GPIOLIB 510 select ARCH_REQUIRE_GPIOLIB
506 select CPU_FEROCEON 511 select CPU_FEROCEON
507 select GENERIC_CLOCKEVENTS 512 select GENERIC_CLOCKEVENTS
@@ -623,8 +628,8 @@ config ARCH_MSM
623 bool "Qualcomm MSM" 628 bool "Qualcomm MSM"
624 select ARCH_REQUIRE_GPIOLIB 629 select ARCH_REQUIRE_GPIOLIB
625 select CLKDEV_LOOKUP 630 select CLKDEV_LOOKUP
631 select COMMON_CLK
626 select GENERIC_CLOCKEVENTS 632 select GENERIC_CLOCKEVENTS
627 select HAVE_CLK
628 help 633 help
629 Support for Qualcomm MSM/QSD based systems. This runs on the 634 Support for Qualcomm MSM/QSD based systems. This runs on the
630 apps processor of the MSM/QSD and depends on a shared memory 635 apps processor of the MSM/QSD and depends on a shared memory
@@ -634,6 +639,7 @@ config ARCH_MSM
634 639
635config ARCH_SHMOBILE 640config ARCH_SHMOBILE
636 bool "Renesas SH-Mobile / R-Mobile" 641 bool "Renesas SH-Mobile / R-Mobile"
642 select ARM_PATCH_PHYS_VIRT
637 select CLKDEV_LOOKUP 643 select CLKDEV_LOOKUP
638 select GENERIC_CLOCKEVENTS 644 select GENERIC_CLOCKEVENTS
639 select HAVE_ARM_SCU if SMP 645 select HAVE_ARM_SCU if SMP
@@ -643,9 +649,8 @@ config ARCH_SHMOBILE
643 select HAVE_SMP 649 select HAVE_SMP
644 select MIGHT_HAVE_CACHE_L2X0 650 select MIGHT_HAVE_CACHE_L2X0
645 select MULTI_IRQ_HANDLER 651 select MULTI_IRQ_HANDLER
646 select NEED_MACH_MEMORY_H
647 select NO_IOPORT 652 select NO_IOPORT
648 select PINCTRL if ARCH_WANT_OPTIONAL_GPIOLIB 653 select PINCTRL
649 select PM_GENERIC_DOMAINS if PM 654 select PM_GENERIC_DOMAINS if PM
650 select SPARSE_IRQ 655 select SPARSE_IRQ
651 help 656 help
@@ -695,6 +700,7 @@ config ARCH_S3C24XX
695 select CLKDEV_LOOKUP 700 select CLKDEV_LOOKUP
696 select CLKSRC_MMIO 701 select CLKSRC_MMIO
697 select GENERIC_CLOCKEVENTS 702 select GENERIC_CLOCKEVENTS
703 select GPIO_SAMSUNG
698 select HAVE_CLK 704 select HAVE_CLK
699 select HAVE_S3C2410_I2C if I2C 705 select HAVE_S3C2410_I2C if I2C
700 select HAVE_S3C2410_WATCHDOG if WATCHDOG 706 select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -702,6 +708,7 @@ config ARCH_S3C24XX
702 select MULTI_IRQ_HANDLER 708 select MULTI_IRQ_HANDLER
703 select NEED_MACH_GPIO_H 709 select NEED_MACH_GPIO_H
704 select NEED_MACH_IO_H 710 select NEED_MACH_IO_H
711 select SAMSUNG_ATAGS
705 help 712 help
706 Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443 713 Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443
707 and S3C2450 SoCs based systems, such as the Simtec Electronics BAST 714 and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
@@ -717,6 +724,7 @@ config ARCH_S3C64XX
717 select CLKSRC_MMIO 724 select CLKSRC_MMIO
718 select CPU_V6 725 select CPU_V6
719 select GENERIC_CLOCKEVENTS 726 select GENERIC_CLOCKEVENTS
727 select GPIO_SAMSUNG
720 select HAVE_CLK 728 select HAVE_CLK
721 select HAVE_S3C2410_I2C if I2C 729 select HAVE_S3C2410_I2C if I2C
722 select HAVE_S3C2410_WATCHDOG if WATCHDOG 730 select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -726,9 +734,11 @@ config ARCH_S3C64XX
726 select PLAT_SAMSUNG 734 select PLAT_SAMSUNG
727 select S3C_DEV_NAND 735 select S3C_DEV_NAND
728 select S3C_GPIO_TRACK 736 select S3C_GPIO_TRACK
737 select SAMSUNG_ATAGS
729 select SAMSUNG_CLKSRC 738 select SAMSUNG_CLKSRC
730 select SAMSUNG_GPIOLIB_4BIT 739 select SAMSUNG_GPIOLIB_4BIT
731 select SAMSUNG_IRQ_VIC_TIMER 740 select SAMSUNG_IRQ_VIC_TIMER
741 select SAMSUNG_WDT_RESET
732 select USB_ARCH_HAS_OHCI 742 select USB_ARCH_HAS_OHCI
733 help 743 help
734 Samsung S3C64XX series based systems 744 Samsung S3C64XX series based systems
@@ -739,11 +749,14 @@ config ARCH_S5P64X0
739 select CLKSRC_MMIO 749 select CLKSRC_MMIO
740 select CPU_V6 750 select CPU_V6
741 select GENERIC_CLOCKEVENTS 751 select GENERIC_CLOCKEVENTS
752 select GPIO_SAMSUNG
742 select HAVE_CLK 753 select HAVE_CLK
743 select HAVE_S3C2410_I2C if I2C 754 select HAVE_S3C2410_I2C if I2C
744 select HAVE_S3C2410_WATCHDOG if WATCHDOG 755 select HAVE_S3C2410_WATCHDOG if WATCHDOG
745 select HAVE_S3C_RTC if RTC_CLASS 756 select HAVE_S3C_RTC if RTC_CLASS
746 select NEED_MACH_GPIO_H 757 select NEED_MACH_GPIO_H
758 select SAMSUNG_WDT_RESET
759 select SAMSUNG_ATAGS
747 help 760 help
748 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440, 761 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
749 SMDK6450. 762 SMDK6450.
@@ -755,11 +768,14 @@ config ARCH_S5PC100
755 select CLKSRC_MMIO 768 select CLKSRC_MMIO
756 select CPU_V7 769 select CPU_V7
757 select GENERIC_CLOCKEVENTS 770 select GENERIC_CLOCKEVENTS
771 select GPIO_SAMSUNG
758 select HAVE_CLK 772 select HAVE_CLK
759 select HAVE_S3C2410_I2C if I2C 773 select HAVE_S3C2410_I2C if I2C
760 select HAVE_S3C2410_WATCHDOG if WATCHDOG 774 select HAVE_S3C2410_WATCHDOG if WATCHDOG
761 select HAVE_S3C_RTC if RTC_CLASS 775 select HAVE_S3C_RTC if RTC_CLASS
762 select NEED_MACH_GPIO_H 776 select NEED_MACH_GPIO_H
777 select SAMSUNG_WDT_RESET
778 select SAMSUNG_ATAGS
763 help 779 help
764 Samsung S5PC100 series based systems 780 Samsung S5PC100 series based systems
765 781
@@ -772,12 +788,14 @@ config ARCH_S5PV210
772 select CLKSRC_MMIO 788 select CLKSRC_MMIO
773 select CPU_V7 789 select CPU_V7
774 select GENERIC_CLOCKEVENTS 790 select GENERIC_CLOCKEVENTS
791 select GPIO_SAMSUNG
775 select HAVE_CLK 792 select HAVE_CLK
776 select HAVE_S3C2410_I2C if I2C 793 select HAVE_S3C2410_I2C if I2C
777 select HAVE_S3C2410_WATCHDOG if WATCHDOG 794 select HAVE_S3C2410_WATCHDOG if WATCHDOG
778 select HAVE_S3C_RTC if RTC_CLASS 795 select HAVE_S3C_RTC if RTC_CLASS
779 select NEED_MACH_GPIO_H 796 select NEED_MACH_GPIO_H
780 select NEED_MACH_MEMORY_H 797 select NEED_MACH_MEMORY_H
798 select SAMSUNG_ATAGS
781 help 799 help
782 Samsung S5PV210/S5PC110 series based systems 800 Samsung S5PV210/S5PC110 series based systems
783 801
@@ -785,7 +803,9 @@ config ARCH_EXYNOS
785 bool "Samsung EXYNOS" 803 bool "Samsung EXYNOS"
786 select ARCH_HAS_CPUFREQ 804 select ARCH_HAS_CPUFREQ
787 select ARCH_HAS_HOLES_MEMORYMODEL 805 select ARCH_HAS_HOLES_MEMORYMODEL
806 select ARCH_REQUIRE_GPIOLIB
788 select ARCH_SPARSEMEM_ENABLE 807 select ARCH_SPARSEMEM_ENABLE
808 select ARM_GIC
789 select CLKDEV_LOOKUP 809 select CLKDEV_LOOKUP
790 select COMMON_CLK 810 select COMMON_CLK
791 select CPU_V7 811 select CPU_V7
@@ -794,8 +814,9 @@ config ARCH_EXYNOS
794 select HAVE_S3C2410_I2C if I2C 814 select HAVE_S3C2410_I2C if I2C
795 select HAVE_S3C2410_WATCHDOG if WATCHDOG 815 select HAVE_S3C2410_WATCHDOG if WATCHDOG
796 select HAVE_S3C_RTC if RTC_CLASS 816 select HAVE_S3C_RTC if RTC_CLASS
797 select NEED_MACH_GPIO_H
798 select NEED_MACH_MEMORY_H 817 select NEED_MACH_MEMORY_H
818 select SPARSE_IRQ
819 select USE_OF
799 help 820 help
800 Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5) 821 Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5)
801 822
@@ -813,23 +834,6 @@ config ARCH_SHARK
813 Support for the StrongARM based Digital DNARD machine, also known 834 Support for the StrongARM based Digital DNARD machine, also known
814 as "Shark" (<http://www.shark-linux.de/shark.html>). 835 as "Shark" (<http://www.shark-linux.de/shark.html>).
815 836
816config ARCH_U300
817 bool "ST-Ericsson U300 Series"
818 depends on MMU
819 select ARCH_REQUIRE_GPIOLIB
820 select ARM_AMBA
821 select ARM_PATCH_PHYS_VIRT
822 select ARM_VIC
823 select CLKDEV_LOOKUP
824 select CLKSRC_MMIO
825 select COMMON_CLK
826 select CPU_ARM926T
827 select GENERIC_CLOCKEVENTS
828 select HAVE_TCM
829 select SPARSE_IRQ
830 help
831 Support for ST-Ericsson U300 series mobile platforms.
832
833config ARCH_DAVINCI 837config ARCH_DAVINCI
834 bool "TI DaVinci" 838 bool "TI DaVinci"
835 select ARCH_HAS_HOLES_MEMORYMODEL 839 select ARCH_HAS_HOLES_MEMORYMODEL
@@ -840,6 +844,7 @@ config ARCH_DAVINCI
840 select GENERIC_IRQ_CHIP 844 select GENERIC_IRQ_CHIP
841 select HAVE_IDE 845 select HAVE_IDE
842 select NEED_MACH_GPIO_H 846 select NEED_MACH_GPIO_H
847 select TI_PRIV_EDMA
843 select USE_OF 848 select USE_OF
844 select ZONE_DMA 849 select ZONE_DMA
845 help 850 help
@@ -871,20 +876,21 @@ menu "Multiple platform selection"
871 876
872comment "CPU Core family selection" 877comment "CPU Core family selection"
873 878
874config ARCH_MULTI_V4
875 bool "ARMv4 based platforms (FA526, StrongARM)"
876 depends on !ARCH_MULTI_V6_V7
877 select ARCH_MULTI_V4_V5
878
879config ARCH_MULTI_V4T 879config ARCH_MULTI_V4T
880 bool "ARMv4T based platforms (ARM720T, ARM920T, ...)" 880 bool "ARMv4T based platforms (ARM720T, ARM920T, ...)"
881 depends on !ARCH_MULTI_V6_V7 881 depends on !ARCH_MULTI_V6_V7
882 select ARCH_MULTI_V4_V5 882 select ARCH_MULTI_V4_V5
883 select CPU_ARM920T if !(CPU_ARM7TDMI || CPU_ARM720T || \
884 CPU_ARM740T || CPU_ARM9TDMI || CPU_ARM922T || \
885 CPU_ARM925T || CPU_ARM940T)
883 886
884config ARCH_MULTI_V5 887config ARCH_MULTI_V5
885 bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)" 888 bool "ARMv5 based platforms (ARM926T, XSCALE, PJ1, ...)"
886 depends on !ARCH_MULTI_V6_V7 889 depends on !ARCH_MULTI_V6_V7
887 select ARCH_MULTI_V4_V5 890 select ARCH_MULTI_V4_V5
891 select CPU_ARM926T if (!CPU_ARM946E || CPU_ARM1020 || \
892 CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \
893 CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_FEROCEON)
888 894
889config ARCH_MULTI_V4_V5 895config ARCH_MULTI_V4_V5
890 bool 896 bool
@@ -948,6 +954,8 @@ source "arch/arm/mach-iop13xx/Kconfig"
948 954
949source "arch/arm/mach-ixp4xx/Kconfig" 955source "arch/arm/mach-ixp4xx/Kconfig"
950 956
957source "arch/arm/mach-keystone/Kconfig"
958
951source "arch/arm/mach-kirkwood/Kconfig" 959source "arch/arm/mach-kirkwood/Kconfig"
952 960
953source "arch/arm/mach-ks8695/Kconfig" 961source "arch/arm/mach-ks8695/Kconfig"
@@ -964,6 +972,8 @@ source "arch/arm/mach-netx/Kconfig"
964 972
965source "arch/arm/mach-nomadik/Kconfig" 973source "arch/arm/mach-nomadik/Kconfig"
966 974
975source "arch/arm/mach-nspire/Kconfig"
976
967source "arch/arm/plat-omap/Kconfig" 977source "arch/arm/plat-omap/Kconfig"
968 978
969source "arch/arm/mach-omap1/Kconfig" 979source "arch/arm/mach-omap1/Kconfig"
@@ -981,6 +991,8 @@ source "arch/arm/mach-mmp/Kconfig"
981 991
982source "arch/arm/mach-realview/Kconfig" 992source "arch/arm/mach-realview/Kconfig"
983 993
994source "arch/arm/mach-rockchip/Kconfig"
995
984source "arch/arm/mach-sa1100/Kconfig" 996source "arch/arm/mach-sa1100/Kconfig"
985 997
986source "arch/arm/plat-samsung/Kconfig" 998source "arch/arm/plat-samsung/Kconfig"
@@ -989,6 +1001,8 @@ source "arch/arm/mach-socfpga/Kconfig"
989 1001
990source "arch/arm/mach-spear/Kconfig" 1002source "arch/arm/mach-spear/Kconfig"
991 1003
1004source "arch/arm/mach-sti/Kconfig"
1005
992source "arch/arm/mach-s3c24xx/Kconfig" 1006source "arch/arm/mach-s3c24xx/Kconfig"
993 1007
994if ARCH_S3C64XX 1008if ARCH_S3C64XX
@@ -1087,6 +1101,20 @@ if !MMU
1087source "arch/arm/Kconfig-nommu" 1101source "arch/arm/Kconfig-nommu"
1088endif 1102endif
1089 1103
1104config PJ4B_ERRATA_4742
1105 bool "PJ4B Errata 4742: IDLE Wake Up Commands can Cause the CPU Core to Cease Operation"
1106 depends on CPU_PJ4B && MACH_ARMADA_370
1107 default y
1108 help
1109 When coming out of either a Wait for Interrupt (WFI) or a Wait for
1110 Event (WFE) IDLE states, a specific timing sensitivity exists between
1111 the retiring WFI/WFE instructions and the newly issued subsequent
1112 instructions. This sensitivity can result in a CPU hang scenario.
1113 Workaround:
1114 The software must insert either a Data Synchronization Barrier (DSB)
1115 or Data Memory Barrier (DMB) command immediately after the WFI/WFE
1116 instruction
1117
1090config ARM_ERRATA_326103 1118config ARM_ERRATA_326103
1091 bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory" 1119 bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory"
1092 depends on CPU_V6 1120 depends on CPU_V6
@@ -1189,6 +1217,16 @@ config PL310_ERRATA_588369
1189 is not correctly implemented in PL310 as clean lines are not 1217 is not correctly implemented in PL310 as clean lines are not
1190 invalidated as a result of these operations. 1218 invalidated as a result of these operations.
1191 1219
1220config ARM_ERRATA_643719
1221 bool "ARM errata: LoUIS bit field in CLIDR register is incorrect"
1222 depends on CPU_V7 && SMP
1223 help
1224 This option enables the workaround for the 643719 Cortex-A9 (prior to
1225 r1p0) erratum. On affected cores the LoUIS bit field of the CLIDR
1226 register returns zero when it should return one. The workaround
1227 corrects this value, ensuring cache maintenance operations which use
1228 it behave as intended and avoiding data corruption.
1229
1192config ARM_ERRATA_720789 1230config ARM_ERRATA_720789
1193 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" 1231 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID"
1194 depends on CPU_V7 1232 depends on CPU_V7
@@ -1393,6 +1431,7 @@ config PCI_HOST_ITE8152
1393 select DMABOUNCE 1431 select DMABOUNCE
1394 1432
1395source "drivers/pci/Kconfig" 1433source "drivers/pci/Kconfig"
1434source "drivers/pci/pcie/Kconfig"
1396 1435
1397source "drivers/pcmcia/Kconfig" 1436source "drivers/pcmcia/Kconfig"
1398 1437
@@ -1414,7 +1453,7 @@ config SMP
1414 depends on CPU_V6K || CPU_V7 1453 depends on CPU_V6K || CPU_V7
1415 depends on GENERIC_CLOCKEVENTS 1454 depends on GENERIC_CLOCKEVENTS
1416 depends on HAVE_SMP 1455 depends on HAVE_SMP
1417 depends on MMU 1456 depends on MMU || ARM_MPU
1418 select USE_GENERIC_SMP_HELPERS 1457 select USE_GENERIC_SMP_HELPERS
1419 help 1458 help
1420 This enables support for systems with more than one CPU. If you have 1459 This enables support for systems with more than one CPU. If you have
@@ -1435,7 +1474,7 @@ config SMP
1435 1474
1436config SMP_ON_UP 1475config SMP_ON_UP
1437 bool "Allow booting SMP kernel on uniprocessor systems (EXPERIMENTAL)" 1476 bool "Allow booting SMP kernel on uniprocessor systems (EXPERIMENTAL)"
1438 depends on SMP && !XIP_KERNEL 1477 depends on SMP && !XIP_KERNEL && MMU
1439 default y 1478 default y
1440 help 1479 help
1441 SMP kernels contain instructions which fail on non-SMP processors. 1480 SMP kernels contain instructions which fail on non-SMP processors.
@@ -1528,7 +1567,7 @@ config NR_CPUS
1528 1567
1529config HOTPLUG_CPU 1568config HOTPLUG_CPU
1530 bool "Support for hot-pluggable CPUs" 1569 bool "Support for hot-pluggable CPUs"
1531 depends on SMP && HOTPLUG 1570 depends on SMP
1532 help 1571 help
1533 Say Y here to experiment with turning CPUs off and on. CPUs 1572 Say Y here to experiment with turning CPUs off and on. CPUs
1534 can be controlled through /sys/devices/system/cpu. 1573 can be controlled through /sys/devices/system/cpu.
@@ -1560,6 +1599,7 @@ config ARCH_NR_GPIO
1560 int 1599 int
1561 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA 1600 default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
1562 default 512 if SOC_OMAP5 1601 default 512 if SOC_OMAP5
1602 default 512 if ARCH_KEYSTONE
1563 default 392 if ARCH_U8500 1603 default 392 if ARCH_U8500
1564 default 352 if ARCH_VT8500 1604 default 352 if ARCH_VT8500
1565 default 288 if ARCH_SUNXI 1605 default 288 if ARCH_SUNXI
@@ -1585,7 +1625,7 @@ config SCHED_HRTICK
1585 1625
1586config THUMB2_KERNEL 1626config THUMB2_KERNEL
1587 bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY 1627 bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY
1588 depends on CPU_V7 && !CPU_V6 && !CPU_V6K 1628 depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K
1589 default y if CPU_THUMBONLY 1629 default y if CPU_THUMBONLY
1590 select AEABI 1630 select AEABI
1591 select ARM_ASM_UNIFIED 1631 select ARM_ASM_UNIFIED
@@ -1707,6 +1747,14 @@ config HW_PERF_EVENTS
1707 Enable hardware performance counter support for perf events. If 1747 Enable hardware performance counter support for perf events. If
1708 disabled, perf events will use software events only. 1748 disabled, perf events will use software events only.
1709 1749
1750config SYS_SUPPORTS_HUGETLBFS
1751 def_bool y
1752 depends on ARM_LPAE
1753
1754config HAVE_ARCH_TRANSPARENT_HUGEPAGE
1755 def_bool y
1756 depends on ARM_LPAE
1757
1710source "mm/Kconfig" 1758source "mm/Kconfig"
1711 1759
1712config FORCE_MAX_ZONEORDER 1760config FORCE_MAX_ZONEORDER
@@ -2006,7 +2054,7 @@ config XIP_PHYS_ADDR
2006 2054
2007config KEXEC 2055config KEXEC
2008 bool "Kexec system call (EXPERIMENTAL)" 2056 bool "Kexec system call (EXPERIMENTAL)"
2009 depends on (!SMP || HOTPLUG_CPU) 2057 depends on (!SMP || PM_SLEEP_SMP)
2010 help 2058 help
2011 kexec is a system call that implements the ability to shutdown your 2059 kexec is a system call that implements the ability to shutdown your
2012 current kernel, and to start another kernel. It is like a reboot 2060 current kernel, and to start another kernel. It is like a reboot
@@ -2040,7 +2088,7 @@ config CRASH_DUMP
2040 2088
2041config AUTO_ZRELADDR 2089config AUTO_ZRELADDR
2042 bool "Auto calculation of the decompressed kernel image address" 2090 bool "Auto calculation of the decompressed kernel image address"
2043 depends on !ZBOOT_ROM && !ARCH_U300 2091 depends on !ZBOOT_ROM
2044 help 2092 help
2045 ZRELADDR is the physical address where the decompressed kernel 2093 ZRELADDR is the physical address where the decompressed kernel
2046 image will be placed. If AUTO_ZRELADDR is selected, the address 2094 image will be placed. If AUTO_ZRELADDR is selected, the address
@@ -2054,53 +2102,6 @@ menu "CPU Power Management"
2054 2102
2055if ARCH_HAS_CPUFREQ 2103if ARCH_HAS_CPUFREQ
2056source "drivers/cpufreq/Kconfig" 2104source "drivers/cpufreq/Kconfig"
2057
2058config CPU_FREQ_S3C
2059 bool
2060 help
2061 Internal configuration node for common cpufreq on Samsung SoC
2062
2063config CPU_FREQ_S3C24XX
2064 bool "CPUfreq driver for Samsung S3C24XX series CPUs (EXPERIMENTAL)"
2065 depends on ARCH_S3C24XX && CPU_FREQ
2066 select CPU_FREQ_S3C
2067 help
2068 This enables the CPUfreq driver for the Samsung S3C24XX family
2069 of CPUs.
2070
2071 For details, take a look at <file:Documentation/cpu-freq>.
2072
2073 If in doubt, say N.
2074
2075config CPU_FREQ_S3C24XX_PLL
2076 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
2077 depends on CPU_FREQ_S3C24XX
2078 help
2079 Compile in support for changing the PLL frequency from the
2080 S3C24XX series CPUfreq driver. The PLL takes time to settle
2081 after a frequency change, so by default it is not enabled.
2082
2083 This also means that the PLL tables for the selected CPU(s) will
2084 be built which may increase the size of the kernel image.
2085
2086config CPU_FREQ_S3C24XX_DEBUG
2087 bool "Debug CPUfreq Samsung driver core"
2088 depends on CPU_FREQ_S3C24XX
2089 help
2090 Enable s3c_freq_dbg for the Samsung S3C CPUfreq core
2091
2092config CPU_FREQ_S3C24XX_IODEBUG
2093 bool "Debug CPUfreq Samsung driver IO timing"
2094 depends on CPU_FREQ_S3C24XX
2095 help
2096 Enable s3c_freq_iodbg for the Samsung S3C CPUfreq core
2097
2098config CPU_FREQ_S3C24XX_DEBUGFS
2099 bool "Export debugfs for CPUFreq"
2100 depends on CPU_FREQ_S3C24XX && DEBUG_FS
2101 help
2102 Export status information via debugfs.
2103
2104endif 2105endif
2105 2106
2106source "drivers/cpuidle/Kconfig" 2107source "drivers/cpuidle/Kconfig"
diff --git a/arch/arm/Kconfig-nommu b/arch/arm/Kconfig-nommu
index 2cef8e13f9f8..aed66d5df7f1 100644
--- a/arch/arm/Kconfig-nommu
+++ b/arch/arm/Kconfig-nommu
@@ -28,7 +28,7 @@ config FLASH_SIZE
28config PROCESSOR_ID 28config PROCESSOR_ID
29 hex 'Hard wire the processor ID' 29 hex 'Hard wire the processor ID'
30 default 0x00007700 30 default 0x00007700
31 depends on !CPU_CP15 31 depends on !(CPU_CP15 || CPU_V7M)
32 help 32 help
33 If processor has no CP15 register, this processor ID is 33 If processor has no CP15 register, this processor ID is
34 used instead of the auto-probing which utilizes the register. 34 used instead of the auto-probing which utilizes the register.
@@ -50,3 +50,15 @@ config REMAP_VECTORS_TO_RAM
50 Otherwise, say 'y' here. In this case, the kernel will require 50 Otherwise, say 'y' here. In this case, the kernel will require
51 external support to redirect the hardware exception vectors to 51 external support to redirect the hardware exception vectors to
52 the writable versions located at DRAM_BASE. 52 the writable versions located at DRAM_BASE.
53
54config ARM_MPU
55 bool 'Use the ARM v7 PMSA Compliant MPU'
56 depends on CPU_V7
57 default y
58 help
59 Some ARM systems without an MMU have instead a Memory Protection
60 Unit (MPU) that defines the type and permissions for regions of
61 memory.
62
63 If your CPU has an MPU then you should choose 'y' here unless you
64 know that you do not want to use the MPU.
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 1d41908d5cda..5b7be8d975b5 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -251,6 +251,27 @@ choice
251 Say Y here if you want kernel low-level debugging support 251 Say Y here if you want kernel low-level debugging support
252 on i.MX6Q/DL. 252 on i.MX6Q/DL.
253 253
254 config DEBUG_IMX6SL_UART
255 bool "i.MX6SL Debug UART"
256 depends on SOC_IMX6SL
257 help
258 Say Y here if you want kernel low-level debugging support
259 on i.MX6SL.
260
261 config DEBUG_KEYSTONE_UART0
262 bool "Kernel low-level debugging on KEYSTONE2 using UART0"
263 depends on ARCH_KEYSTONE
264 help
265 Say Y here if you want the debug print routines to direct
266 their output to UART0 serial port on KEYSTONE2 devices.
267
268 config DEBUG_KEYSTONE_UART1
269 bool "Kernel low-level debugging on KEYSTONE2 using UART1"
270 depends on ARCH_KEYSTONE
271 help
272 Say Y here if you want the debug print routines to direct
273 their output to UART1 serial port on KEYSTONE2 devices.
274
254 config DEBUG_MMP_UART2 275 config DEBUG_MMP_UART2
255 bool "Kernel low-level debugging message via MMP UART2" 276 bool "Kernel low-level debugging message via MMP UART2"
256 depends on ARCH_MMP 277 depends on ARCH_MMP
@@ -303,12 +324,37 @@ choice
303 their output to the serial port on MSM 8960 devices. 324 their output to the serial port on MSM 8960 devices.
304 325
305 config DEBUG_MVEBU_UART 326 config DEBUG_MVEBU_UART
306 bool "Kernel low-level debugging messages via MVEBU UART" 327 bool "Kernel low-level debugging messages via MVEBU UART (old bootloaders)"
328 depends on ARCH_MVEBU
329 help
330 Say Y here if you want kernel low-level debugging support
331 on MVEBU based platforms.
332
333 This option should be used with the old bootloaders
334 that left the internal registers mapped at
335 0xd0000000. As of today, this is the case on
336 platforms such as the Globalscale Mirabox or the
337 Plathome OpenBlocks AX3, when using the original
338 bootloader.
339
340 If the wrong DEBUG_MVEBU_UART* option is selected,
341 when u-boot hands over to the kernel, the system
342 silently crashes, with no serial output at all.
343
344 config DEBUG_MVEBU_UART_ALTERNATE
345 bool "Kernel low-level debugging messages via MVEBU UART (new bootloaders)"
307 depends on ARCH_MVEBU 346 depends on ARCH_MVEBU
308 help 347 help
309 Say Y here if you want kernel low-level debugging support 348 Say Y here if you want kernel low-level debugging support
310 on MVEBU based platforms. 349 on MVEBU based platforms.
311 350
351 This option should be used with the new bootloaders
352 that remap the internal registers at 0xf1000000.
353
354 If the wrong DEBUG_MVEBU_UART* option is selected,
355 when u-boot hands over to the kernel, the system
356 silently crashes, with no serial output at all.
357
312 config DEBUG_NOMADIK_UART 358 config DEBUG_NOMADIK_UART
313 bool "Kernel low-level debugging messages via NOMADIK UART" 359 bool "Kernel low-level debugging messages via NOMADIK UART"
314 depends on ARCH_NOMADIK 360 depends on ARCH_NOMADIK
@@ -316,6 +362,20 @@ choice
316 Say Y here if you want kernel low-level debugging support 362 Say Y here if you want kernel low-level debugging support
317 on NOMADIK based platforms. 363 on NOMADIK based platforms.
318 364
365 config DEBUG_NSPIRE_CLASSIC_UART
366 bool "Kernel low-level debugging via TI-NSPIRE 8250 UART"
367 depends on ARCH_NSPIRE
368 help
369 Say Y here if you want kernel low-level debugging support
370 on TI-NSPIRE classic models.
371
372 config DEBUG_NSPIRE_CX_UART
373 bool "Kernel low-level debugging via TI-NSPIRE PL011 UART"
374 depends on ARCH_NSPIRE
375 help
376 Say Y here if you want kernel low-level debugging support
377 on TI-NSPIRE CX models.
378
319 config DEBUG_OMAP2PLUS_UART 379 config DEBUG_OMAP2PLUS_UART
320 bool "Kernel low-level debugging messages via OMAP2PLUS UART" 380 bool "Kernel low-level debugging messages via OMAP2PLUS UART"
321 depends on ARCH_OMAP2PLUS 381 depends on ARCH_OMAP2PLUS
@@ -353,6 +413,13 @@ choice
353 their output to the standard serial port on the RealView 413 their output to the standard serial port on the RealView
354 PB1176 platform. 414 PB1176 platform.
355 415
416 config DEBUG_ROCKCHIP_UART
417 bool "Kernel low-level debugging messages via Rockchip UART"
418 depends on ARCH_ROCKCHIP
419 help
420 Say Y here if you want kernel low-level debugging support
421 on Rockchip based platforms.
422
356 config DEBUG_S3C_UART0 423 config DEBUG_S3C_UART0
357 depends on PLAT_SAMSUNG 424 depends on PLAT_SAMSUNG
358 select DEBUG_EXYNOS_UART if ARCH_EXYNOS 425 select DEBUG_EXYNOS_UART if ARCH_EXYNOS
@@ -443,6 +510,13 @@ choice
443 Say Y here if you want the debug print routines to direct 510 Say Y here if you want the debug print routines to direct
444 their output to the uart1 port on SiRFmarco devices. 511 their output to the uart1 port on SiRFmarco devices.
445 512
513 config DEBUG_U300_UART
514 bool "Kernel low-level debugging messages via U300 UART0"
515 depends on ARCH_U300
516 help
517 Say Y here if you want the debug print routines to direct
518 their output to the uart port on U300 devices.
519
446 config DEBUG_UX500_UART 520 config DEBUG_UX500_UART
447 depends on ARCH_U8500 521 depends on ARCH_U8500
448 bool "Use Ux500 UART for low-level debug" 522 bool "Use Ux500 UART for low-level debug"
@@ -476,6 +550,13 @@ choice
476 of the tiles using the RS1 memory map, including all new A-class 550 of the tiles using the RS1 memory map, including all new A-class
477 core tiles, FPGA-based SMMs and software models. 551 core tiles, FPGA-based SMMs and software models.
478 552
553 config DEBUG_VEXPRESS_UART0_CRX
554 bool "Use PL011 UART0 at 0xb0090000 (Cortex-R compliant tiles)"
555 depends on ARCH_VEXPRESS && !MMU
556 help
557 This option selects UART0 at 0xb0090000. This is appropriate for
558 Cortex-R series tiles and SMMs, such as Cortex-R5 and Cortex-R7
559
479 config DEBUG_VT8500_UART0 560 config DEBUG_VT8500_UART0
480 bool "Use UART0 on VIA/Wondermedia SoCs" 561 bool "Use UART0 on VIA/Wondermedia SoCs"
481 depends on ARCH_VT8500 562 depends on ARCH_VT8500
@@ -483,6 +564,16 @@ choice
483 This option selects UART0 on VIA/Wondermedia System-on-a-chip 564 This option selects UART0 on VIA/Wondermedia System-on-a-chip
484 devices, including VT8500, WM8505, WM8650 and WM8850. 565 devices, including VT8500, WM8505, WM8650 and WM8850.
485 566
567 config DEBUG_STI_UART
568 depends on ARCH_STI
569 bool "Use StiH415/416 ASC for low-level debug"
570 help
571 Say Y here if you want kernel low-level debugging support
572 on StiH415/416 based platforms like B2000, B2020.
573 It support UART2 and SBC_UART1.
574
575 If unsure, say N.
576
486 config DEBUG_LL_UART_NONE 577 config DEBUG_LL_UART_NONE
487 bool "No low-level debugging UART" 578 bool "No low-level debugging UART"
488 depends on !ARCH_MULTIPLATFORM 579 depends on !ARCH_MULTIPLATFORM
@@ -532,7 +623,8 @@ config DEBUG_IMX_UART_PORT
532 DEBUG_IMX35_UART || \ 623 DEBUG_IMX35_UART || \
533 DEBUG_IMX51_UART || \ 624 DEBUG_IMX51_UART || \
534 DEBUG_IMX53_UART || \ 625 DEBUG_IMX53_UART || \
535 DEBUG_IMX6Q_UART 626 DEBUG_IMX6Q_UART || \
627 DEBUG_IMX6SL_UART
536 default 1 628 default 1
537 depends on ARCH_MXC 629 depends on ARCH_MXC
538 help 630 help
@@ -589,6 +681,32 @@ endchoice
589 681
590choice 682choice
591 prompt "Low-level debug console UART" 683 prompt "Low-level debug console UART"
684 depends on DEBUG_ROCKCHIP_UART
685
686 config DEBUG_RK29_UART0
687 bool "RK29 UART0"
688
689 config DEBUG_RK29_UART1
690 bool "RK29 UART1"
691
692 config DEBUG_RK29_UART2
693 bool "RK29 UART2"
694
695 config DEBUG_RK3X_UART0
696 bool "RK3X UART0"
697
698 config DEBUG_RK3X_UART1
699 bool "RK3X UART1"
700
701 config DEBUG_RK3X_UART2
702 bool "RK3X UART2"
703
704 config DEBUG_RK3X_UART3
705 bool "RK3X UART3"
706endchoice
707
708choice
709 prompt "Low-level debug console UART"
592 depends on DEBUG_LL && DEBUG_TEGRA_UART 710 depends on DEBUG_LL && DEBUG_TEGRA_UART
593 711
594 config TEGRA_DEBUG_UART_AUTO_ODMDATA 712 config TEGRA_DEBUG_UART_AUTO_ODMDATA
@@ -617,6 +735,30 @@ choice
617 735
618endchoice 736endchoice
619 737
738choice
739 prompt "Low-level debug console UART"
740 depends on DEBUG_LL && DEBUG_STI_UART
741
742 config STIH41X_DEBUG_ASC2
743 bool "ASC2 UART"
744 help
745 Say Y here if you want kernel low-level debugging support
746 on STiH415/416 based platforms like b2000, which has
747 default UART wired up to ASC2.
748
749 If unsure, say N.
750
751 config STIH41X_DEBUG_SBC_ASC1
752 bool "SBC ASC1 UART"
753 help
754 Say Y here if you want kernel low-level debugging support
755 on STiH415/416 based platforms like b2020. which has
756 default UART wired up to SBC ASC1.
757
758 If unsure, say N.
759
760endchoice
761
620config DEBUG_LL_INCLUDE 762config DEBUG_LL_INCLUDE
621 string 763 string
622 default "debug/bcm2835.S" if DEBUG_BCM2835 764 default "debug/bcm2835.S" if DEBUG_BCM2835
@@ -631,21 +773,31 @@ config DEBUG_LL_INCLUDE
631 DEBUG_IMX35_UART || \ 773 DEBUG_IMX35_UART || \
632 DEBUG_IMX51_UART || \ 774 DEBUG_IMX51_UART || \
633 DEBUG_IMX53_UART ||\ 775 DEBUG_IMX53_UART ||\
634 DEBUG_IMX6Q_UART 776 DEBUG_IMX6Q_UART || \
635 default "debug/mvebu.S" if DEBUG_MVEBU_UART 777 DEBUG_IMX6SL_UART
778 default "debug/keystone.S" if DEBUG_KEYSTONE_UART0 || \
779 DEBUG_KEYSTONE_UART1
780 default "debug/mvebu.S" if DEBUG_MVEBU_UART || \
781 DEBUG_MVEBU_UART_ALTERNATE
636 default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART 782 default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART
637 default "debug/nomadik.S" if DEBUG_NOMADIK_UART 783 default "debug/nomadik.S" if DEBUG_NOMADIK_UART
784 default "debug/nspire.S" if DEBUG_NSPIRE_CX_UART || \
785 DEBUG_NSPIRE_CLASSIC_UART
638 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 786 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
639 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART 787 default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
640 default "debug/pxa.S" if DEBUG_PXA_UART1 || DEBUG_MMP_UART2 || \ 788 default "debug/pxa.S" if DEBUG_PXA_UART1 || DEBUG_MMP_UART2 || \
641 DEBUG_MMP_UART3 789 DEBUG_MMP_UART3
790 default "debug/rockchip.S" if DEBUG_ROCKCHIP_UART
642 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1 791 default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
643 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART 792 default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
793 default "debug/sti.S" if DEBUG_STI_UART
644 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1 794 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
645 default "debug/tegra.S" if DEBUG_TEGRA_UART 795 default "debug/tegra.S" if DEBUG_TEGRA_UART
796 default "debug/u300.S" if DEBUG_U300_UART
646 default "debug/ux500.S" if DEBUG_UX500_UART 797 default "debug/ux500.S" if DEBUG_UX500_UART
647 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ 798 default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
648 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 799 DEBUG_VEXPRESS_UART0_CA9 || DEBUG_VEXPRESS_UART0_RS1 || \
800 DEBUG_VEXPRESS_UART0_CRX
649 default "debug/vt8500.S" if DEBUG_VT8500_UART0 801 default "debug/vt8500.S" if DEBUG_VT8500_UART0
650 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1 802 default "debug/zynq.S" if DEBUG_ZYNQ_UART0 || DEBUG_ZYNQ_UART1
651 default "mach/debug-macro.S" 803 default "mach/debug-macro.S"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 1ba358ba16b8..c0ac0f5e5e5c 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -59,37 +59,44 @@ comma = ,
59# Note that GCC does not numerically define an architecture version 59# Note that GCC does not numerically define an architecture version
60# macro, but instead defines a whole series of macros which makes 60# macro, but instead defines a whole series of macros which makes
61# testing for a specific architecture or later rather impossible. 61# testing for a specific architecture or later rather impossible.
62arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) 62arch-$(CONFIG_CPU_32v7M) =-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m
63arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) 63arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
64arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
64# Only override the compiler option if ARMv6. The ARMv6K extensions are 65# Only override the compiler option if ARMv6. The ARMv6K extensions are
65# always available in ARMv7 66# always available in ARMv7
66ifeq ($(CONFIG_CPU_32v6),y) 67ifeq ($(CONFIG_CPU_32v6),y)
67arch-$(CONFIG_CPU_32v6K) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k) 68arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
68endif 69endif
69arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t) 70arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
70arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4t 71arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t
71arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4 72arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4
72arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3 73arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3
74
75# Evaluate arch cc-option calls now
76arch-y := $(arch-y)
73 77
74# This selects how we optimise for the processor. 78# This selects how we optimise for the processor.
75tune-$(CONFIG_CPU_ARM7TDMI) :=-mtune=arm7tdmi 79tune-$(CONFIG_CPU_ARM7TDMI) =-mtune=arm7tdmi
76tune-$(CONFIG_CPU_ARM720T) :=-mtune=arm7tdmi 80tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7tdmi
77tune-$(CONFIG_CPU_ARM740T) :=-mtune=arm7tdmi 81tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi
78tune-$(CONFIG_CPU_ARM9TDMI) :=-mtune=arm9tdmi 82tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi
79tune-$(CONFIG_CPU_ARM940T) :=-mtune=arm9tdmi 83tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi
80tune-$(CONFIG_CPU_ARM946E) :=$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi) 84tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
81tune-$(CONFIG_CPU_ARM920T) :=-mtune=arm9tdmi 85tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi
82tune-$(CONFIG_CPU_ARM922T) :=-mtune=arm9tdmi 86tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi
83tune-$(CONFIG_CPU_ARM925T) :=-mtune=arm9tdmi 87tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi
84tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi 88tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9tdmi
85tune-$(CONFIG_CPU_FA526) :=-mtune=arm9tdmi 89tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi
86tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110 90tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110
87tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 91tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100
88tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 92tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
89tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 93tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
90tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale) 94tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale)
91tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 95tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
92tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 96tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
97
98# Evaluate tune cc-option calls now
99tune-y := $(tune-y)
93 100
94ifeq ($(CONFIG_AEABI),y) 101ifeq ($(CONFIG_AEABI),y)
95CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork 102CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
@@ -164,13 +171,15 @@ machine-$(CONFIG_ARCH_MXS) += mxs
164machine-$(CONFIG_ARCH_MVEBU) += mvebu 171machine-$(CONFIG_ARCH_MVEBU) += mvebu
165machine-$(CONFIG_ARCH_NETX) += netx 172machine-$(CONFIG_ARCH_NETX) += netx
166machine-$(CONFIG_ARCH_NOMADIK) += nomadik 173machine-$(CONFIG_ARCH_NOMADIK) += nomadik
174machine-$(CONFIG_ARCH_NSPIRE) += nspire
167machine-$(CONFIG_ARCH_OMAP1) += omap1 175machine-$(CONFIG_ARCH_OMAP1) += omap1
168machine-$(CONFIG_ARCH_OMAP2PLUS) += omap2 176machine-$(CONFIG_ARCH_OMAP2PLUS) += omap2
169machine-$(CONFIG_ARCH_ORION5X) += orion5x 177machine-$(CONFIG_ARCH_ORION5X) += orion5x
170machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell 178machine-$(CONFIG_ARCH_PICOXCELL) += picoxcell
171machine-$(CONFIG_ARCH_PRIMA2) += prima2 179machine-$(CONFIG_ARCH_SIRF) += prima2
172machine-$(CONFIG_ARCH_PXA) += pxa 180machine-$(CONFIG_ARCH_PXA) += pxa
173machine-$(CONFIG_ARCH_REALVIEW) += realview 181machine-$(CONFIG_ARCH_REALVIEW) += realview
182machine-$(CONFIG_ARCH_ROCKCHIP) += rockchip
174machine-$(CONFIG_ARCH_RPC) += rpc 183machine-$(CONFIG_ARCH_RPC) += rpc
175machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx 184machine-$(CONFIG_ARCH_S3C24XX) += s3c24xx
176machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx 185machine-$(CONFIG_ARCH_S3C64XX) += s3c64xx
@@ -191,12 +200,15 @@ machine-$(CONFIG_ARCH_W90X900) += w90x900
191machine-$(CONFIG_FOOTBRIDGE) += footbridge 200machine-$(CONFIG_FOOTBRIDGE) += footbridge
192machine-$(CONFIG_ARCH_SOCFPGA) += socfpga 201machine-$(CONFIG_ARCH_SOCFPGA) += socfpga
193machine-$(CONFIG_PLAT_SPEAR) += spear 202machine-$(CONFIG_PLAT_SPEAR) += spear
203machine-$(CONFIG_ARCH_STI) += sti
194machine-$(CONFIG_ARCH_VIRT) += virt 204machine-$(CONFIG_ARCH_VIRT) += virt
195machine-$(CONFIG_ARCH_ZYNQ) += zynq 205machine-$(CONFIG_ARCH_ZYNQ) += zynq
196machine-$(CONFIG_ARCH_SUNXI) += sunxi 206machine-$(CONFIG_ARCH_SUNXI) += sunxi
207machine-$(CONFIG_ARCH_KEYSTONE) += keystone
197 208
198# Platform directory name. This list is sorted alphanumerically 209# Platform directory name. This list is sorted alphanumerically
199# by CONFIG_* macro name. 210# by CONFIG_* macro name.
211plat-$(CONFIG_ARCH_EXYNOS) += samsung
200plat-$(CONFIG_ARCH_OMAP) += omap 212plat-$(CONFIG_ARCH_OMAP) += omap
201plat-$(CONFIG_ARCH_S3C64XX) += samsung 213plat-$(CONFIG_ARCH_S3C64XX) += samsung
202plat-$(CONFIG_PLAT_IOP) += iop 214plat-$(CONFIG_PLAT_IOP) += iop
@@ -289,9 +301,10 @@ zImage Image xipImage bootpImage uImage: vmlinux
289zinstall uinstall install: vmlinux 301zinstall uinstall install: vmlinux
290 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 302 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
291 303
292%.dtb: scripts 304%.dtb: | scripts
293 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@ 305 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
294 306
307PHONY += dtbs
295dtbs: scripts 308dtbs: scripts
296 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs 309 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
297 310
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 3580d57ea218..48d0a44270bd 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -27,7 +27,7 @@ OBJS += misc.o decompress.o
27ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y) 27ifeq ($(CONFIG_DEBUG_UNCOMPRESS),y)
28OBJS += debug.o 28OBJS += debug.o
29endif 29endif
30FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 30FONTC = $(srctree)/lib/fonts/font_acorn_8x8.c
31 31
32# string library code (-Os is enforced to keep it much smaller) 32# string library code (-Os is enforced to keep it much smaller)
33OBJS += string.o 33OBJS += string.o
@@ -116,7 +116,8 @@ targets := vmlinux vmlinux.lds \
116 116
117# Make sure files are removed during clean 117# Make sure files are removed during clean
118extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \ 118extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \
119 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) 119 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \
120 hyp-stub.S
120 121
121ifeq ($(CONFIG_FUNCTION_TRACER),y) 122ifeq ($(CONFIG_FUNCTION_TRACER),y)
122ORIG_CFLAGS := $(KBUILD_CFLAGS) 123ORIG_CFLAGS := $(KBUILD_CFLAGS)
@@ -124,7 +125,7 @@ KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
124endif 125endif
125 126
126ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) 127ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj)
127asflags-y := -Wa,-march=all -DZIMAGE 128asflags-y := -DZIMAGE
128 129
129# Supply kernel BSS size to the decompressor via a linker symbol. 130# Supply kernel BSS size to the decompressor via a linker symbol.
130KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \ 131KBSS_SZ = $(shell $(CROSS_COMPILE)size $(obj)/../../../../vmlinux | \
diff --git a/arch/arm/boot/compressed/atags_to_fdt.c b/arch/arm/boot/compressed/atags_to_fdt.c
index aabc02a68482..d1153c8a765a 100644
--- a/arch/arm/boot/compressed/atags_to_fdt.c
+++ b/arch/arm/boot/compressed/atags_to_fdt.c
@@ -53,6 +53,17 @@ static const void *getprop(const void *fdt, const char *node_path,
53 return fdt_getprop(fdt, offset, property, len); 53 return fdt_getprop(fdt, offset, property, len);
54} 54}
55 55
56static uint32_t get_cell_size(const void *fdt)
57{
58 int len;
59 uint32_t cell_size = 1;
60 const uint32_t *size_len = getprop(fdt, "/", "#size-cells", &len);
61
62 if (size_len)
63 cell_size = fdt32_to_cpu(*size_len);
64 return cell_size;
65}
66
56static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline) 67static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
57{ 68{
58 char cmdline[COMMAND_LINE_SIZE]; 69 char cmdline[COMMAND_LINE_SIZE];
@@ -95,9 +106,11 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
95int atags_to_fdt(void *atag_list, void *fdt, int total_space) 106int atags_to_fdt(void *atag_list, void *fdt, int total_space)
96{ 107{
97 struct tag *atag = atag_list; 108 struct tag *atag = atag_list;
98 uint32_t mem_reg_property[2 * NR_BANKS]; 109 /* In the case of 64 bits memory size, need to reserve 2 cells for
110 * address and size for each bank */
111 uint32_t mem_reg_property[2 * 2 * NR_BANKS];
99 int memcount = 0; 112 int memcount = 0;
100 int ret; 113 int ret, memsize;
101 114
102 /* make sure we've got an aligned pointer */ 115 /* make sure we've got an aligned pointer */
103 if ((u32)atag_list & 0x3) 116 if ((u32)atag_list & 0x3)
@@ -137,8 +150,25 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
137 continue; 150 continue;
138 if (!atag->u.mem.size) 151 if (!atag->u.mem.size)
139 continue; 152 continue;
140 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start); 153 memsize = get_cell_size(fdt);
141 mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size); 154
155 if (memsize == 2) {
156 /* if memsize is 2, that means that
157 * each data needs 2 cells of 32 bits,
158 * so the data are 64 bits */
159 uint64_t *mem_reg_prop64 =
160 (uint64_t *)mem_reg_property;
161 mem_reg_prop64[memcount++] =
162 cpu_to_fdt64(atag->u.mem.start);
163 mem_reg_prop64[memcount++] =
164 cpu_to_fdt64(atag->u.mem.size);
165 } else {
166 mem_reg_property[memcount++] =
167 cpu_to_fdt32(atag->u.mem.start);
168 mem_reg_property[memcount++] =
169 cpu_to_fdt32(atag->u.mem.size);
170 }
171
142 } else if (atag->hdr.tag == ATAG_INITRD2) { 172 } else if (atag->hdr.tag == ATAG_INITRD2) {
143 uint32_t initrd_start, initrd_size; 173 uint32_t initrd_start, initrd_size;
144 initrd_start = atag->u.initrd.start; 174 initrd_start = atag->u.initrd.start;
@@ -150,8 +180,10 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
150 } 180 }
151 } 181 }
152 182
153 if (memcount) 183 if (memcount) {
154 setprop(fdt, "/memory", "reg", mem_reg_property, 4*memcount); 184 setprop(fdt, "/memory", "reg", mem_reg_property,
185 4 * memcount * memsize);
186 }
155 187
156 return fdt_pack(fdt); 188 return fdt_pack(fdt);
157} 189}
diff --git a/arch/arm/boot/compressed/debug.S b/arch/arm/boot/compressed/debug.S
index 6e8382d5b7a4..5392ee63338f 100644
--- a/arch/arm/boot/compressed/debug.S
+++ b/arch/arm/boot/compressed/debug.S
@@ -1,6 +1,8 @@
1#include <linux/linkage.h> 1#include <linux/linkage.h>
2#include <asm/assembler.h> 2#include <asm/assembler.h>
3 3
4#ifndef CONFIG_DEBUG_SEMIHOSTING
5
4#include CONFIG_DEBUG_LL_INCLUDE 6#include CONFIG_DEBUG_LL_INCLUDE
5 7
6ENTRY(putc) 8ENTRY(putc)
@@ -10,3 +12,29 @@ ENTRY(putc)
10 busyuart r3, r1 12 busyuart r3, r1
11 mov pc, lr 13 mov pc, lr
12ENDPROC(putc) 14ENDPROC(putc)
15
16#else
17
18ENTRY(putc)
19 adr r1, 1f
20 ldmia r1, {r2, r3}
21 add r2, r2, r1
22 ldr r1, [r2, r3]
23 strb r0, [r1]
24 mov r0, #0x03 @ SYS_WRITEC
25 ARM( svc #0x123456 )
26 THUMB( svc #0xab )
27 mov pc, lr
28 .align 2
291: .word _GLOBAL_OFFSET_TABLE_ - .
30 .word semi_writec_buf(GOT)
31ENDPROC(putc)
32
33 .bss
34 .global semi_writec_buf
35 .type semi_writec_buf, %object
36semi_writec_buf:
37 .space 4
38 .size semi_writec_buf, 4
39
40#endif
diff --git a/arch/arm/boot/compressed/head-sa1100.S b/arch/arm/boot/compressed/head-sa1100.S
index 6179d94dd5c6..3115e313d9f6 100644
--- a/arch/arm/boot/compressed/head-sa1100.S
+++ b/arch/arm/boot/compressed/head-sa1100.S
@@ -11,6 +11,7 @@
11#include <asm/mach-types.h> 11#include <asm/mach-types.h>
12 12
13 .section ".start", "ax" 13 .section ".start", "ax"
14 .arch armv4
14 15
15__SA1100_start: 16__SA1100_start:
16 17
diff --git a/arch/arm/boot/compressed/head-shark.S b/arch/arm/boot/compressed/head-shark.S
index 089c560e07f1..92b56897ed64 100644
--- a/arch/arm/boot/compressed/head-shark.S
+++ b/arch/arm/boot/compressed/head-shark.S
@@ -18,6 +18,7 @@
18 18
19 .section ".start", "ax" 19 .section ".start", "ax"
20 20
21 .arch armv4
21 b __beginning 22 b __beginning
22 23
23__ofw_data: .long 0 @ the number of memory blocks 24__ofw_data: .long 0 @ the number of memory blocks
diff --git a/arch/arm/boot/compressed/head-shmobile.S b/arch/arm/boot/compressed/head-shmobile.S
index fe3719b516fd..e2d636336b7c 100644
--- a/arch/arm/boot/compressed/head-shmobile.S
+++ b/arch/arm/boot/compressed/head-shmobile.S
@@ -46,7 +46,7 @@ __image_start:
46__image_end: 46__image_end:
47 .long _got_end 47 .long _got_end
48__load_base: 48__load_base:
49 .long CONFIG_MEMORY_START + 0x02000000 @ Load at 32Mb into SDRAM 49 .long MEMORY_START + 0x02000000 @ Load at 32Mb into SDRAM
50__loaded: 50__loaded:
51 .long __continue 51 .long __continue
52 .align 52 .align
@@ -55,26 +55,9 @@ __tmp_stack:
55__continue: 55__continue:
56#endif /* CONFIG_ZBOOT_ROM_MMC || CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI */ 56#endif /* CONFIG_ZBOOT_ROM_MMC || CONFIG_ZBOOT_ROM_SH_MOBILE_SDHI */
57 57
58 b 1f
59__atags:@ tag #1
60 .long 12 @ tag->hdr.size = tag_size(tag_core);
61 .long 0x54410001 @ tag->hdr.tag = ATAG_CORE;
62 .long 0 @ tag->u.core.flags = 0;
63 .long 0 @ tag->u.core.pagesize = 0;
64 .long 0 @ tag->u.core.rootdev = 0;
65 @ tag #2
66 .long 8 @ tag->hdr.size = tag_size(tag_mem32);
67 .long 0x54410002 @ tag->hdr.tag = ATAG_MEM;
68 .long CONFIG_MEMORY_SIZE @ tag->u.mem.size = CONFIG_MEMORY_SIZE;
69 .long CONFIG_MEMORY_START @ @ tag->u.mem.start = CONFIG_MEMORY_START;
70 @ tag #3
71 .long 0 @ tag->hdr.size = 0
72 .long 0 @ tag->hdr.tag = ATAG_NONE;
731:
74
75 /* Set board ID necessary for boot */ 58 /* Set board ID necessary for boot */
76 ldr r7, 1f @ Set machine type register 59 ldr r7, 1f @ Set machine type register
77 adr r8, __atags @ Set atag register 60 mov r8, #0 @ pass null pointer as atag
78 b 2f 61 b 2f
79 62
801 : .long MACH_TYPE 631 : .long MACH_TYPE
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index fe4d9c3ad761..75189f13cf54 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -11,6 +11,7 @@
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/assembler.h> 12#include <asm/assembler.h>
13 13
14 .arch armv7-a
14/* 15/*
15 * Debugging stuff 16 * Debugging stuff
16 * 17 *
@@ -141,7 +142,6 @@ start:
141 mov r7, r1 @ save architecture ID 142 mov r7, r1 @ save architecture ID
142 mov r8, r2 @ save atags pointer 143 mov r8, r2 @ save atags pointer
143 144
144#ifndef __ARM_ARCH_2__
145 /* 145 /*
146 * Booting from Angel - need to enter SVC mode and disable 146 * Booting from Angel - need to enter SVC mode and disable
147 * FIQs/IRQs (numeric definitions from angel arm.h source). 147 * FIQs/IRQs (numeric definitions from angel arm.h source).
@@ -157,10 +157,6 @@ not_angel:
157 safe_svcmode_maskall r0 157 safe_svcmode_maskall r0
158 msr spsr_cxsf, r9 @ Save the CPU boot mode in 158 msr spsr_cxsf, r9 @ Save the CPU boot mode in
159 @ SPSR 159 @ SPSR
160#else
161 teqp pc, #0x0c000003 @ turn off interrupts
162#endif
163
164 /* 160 /*
165 * Note that some cache flushing and other stuff may 161 * Note that some cache flushing and other stuff may
166 * be needed here - is there an Angel SWI call for this? 162 * be needed here - is there an Angel SWI call for this?
@@ -182,7 +178,19 @@ not_angel:
182 ldr r4, =zreladdr 178 ldr r4, =zreladdr
183#endif 179#endif
184 180
185 bl cache_on 181 /*
182 * Set up a page table only if it won't overwrite ourself.
183 * That means r4 < pc && r4 - 16k page directory > &_end.
184 * Given that r4 > &_end is most unfrequent, we add a rough
185 * additional 1MB of room for a possible appended DTB.
186 */
187 mov r0, pc
188 cmp r0, r4
189 ldrcc r0, LC0+32
190 addcc r0, r0, pc
191 cmpcc r4, r0
192 orrcc r4, r4, #1 @ remember we skipped cache_on
193 blcs cache_on
186 194
187restart: adr r0, LC0 195restart: adr r0, LC0
188 ldmia r0, {r1, r2, r3, r6, r10, r11, r12} 196 ldmia r0, {r1, r2, r3, r6, r10, r11, r12}
@@ -228,7 +236,7 @@ restart: adr r0, LC0
228 * r0 = delta 236 * r0 = delta
229 * r2 = BSS start 237 * r2 = BSS start
230 * r3 = BSS end 238 * r3 = BSS end
231 * r4 = final kernel address 239 * r4 = final kernel address (possibly with LSB set)
232 * r5 = appended dtb size (still unknown) 240 * r5 = appended dtb size (still unknown)
233 * r6 = _edata 241 * r6 = _edata
234 * r7 = architecture ID 242 * r7 = architecture ID
@@ -276,6 +284,7 @@ restart: adr r0, LC0
276 */ 284 */
277 cmp r0, #1 285 cmp r0, #1
278 sub r0, r4, #TEXT_OFFSET 286 sub r0, r4, #TEXT_OFFSET
287 bic r0, r0, #1
279 add r0, r0, #0x100 288 add r0, r0, #0x100
280 mov r1, r6 289 mov r1, r6
281 sub r2, sp, r6 290 sub r2, sp, r6
@@ -322,12 +331,13 @@ dtb_check_done:
322 331
323/* 332/*
324 * Check to see if we will overwrite ourselves. 333 * Check to see if we will overwrite ourselves.
325 * r4 = final kernel address 334 * r4 = final kernel address (possibly with LSB set)
326 * r9 = size of decompressed image 335 * r9 = size of decompressed image
327 * r10 = end of this image, including bss/stack/malloc space if non XIP 336 * r10 = end of this image, including bss/stack/malloc space if non XIP
328 * We basically want: 337 * We basically want:
329 * r4 - 16k page directory >= r10 -> OK 338 * r4 - 16k page directory >= r10 -> OK
330 * r4 + image length <= address of wont_overwrite -> OK 339 * r4 + image length <= address of wont_overwrite -> OK
340 * Note: the possible LSB in r4 is harmless here.
331 */ 341 */
332 add r10, r10, #16384 342 add r10, r10, #16384
333 cmp r4, r10 343 cmp r4, r10
@@ -389,7 +399,8 @@ dtb_check_done:
389 add sp, sp, r6 399 add sp, sp, r6
390#endif 400#endif
391 401
392 bl cache_clean_flush 402 tst r4, #1
403 bleq cache_clean_flush
393 404
394 adr r0, BSYM(restart) 405 adr r0, BSYM(restart)
395 add r0, r0, r6 406 add r0, r0, r6
@@ -401,7 +412,7 @@ wont_overwrite:
401 * r0 = delta 412 * r0 = delta
402 * r2 = BSS start 413 * r2 = BSS start
403 * r3 = BSS end 414 * r3 = BSS end
404 * r4 = kernel execution address 415 * r4 = kernel execution address (possibly with LSB set)
405 * r5 = appended dtb size (0 if not present) 416 * r5 = appended dtb size (0 if not present)
406 * r7 = architecture ID 417 * r7 = architecture ID
407 * r8 = atags pointer 418 * r8 = atags pointer
@@ -464,6 +475,15 @@ not_relocated: mov r0, #0
464 cmp r2, r3 475 cmp r2, r3
465 blo 1b 476 blo 1b
466 477
478 /*
479 * Did we skip the cache setup earlier?
480 * That is indicated by the LSB in r4.
481 * Do it now if so.
482 */
483 tst r4, #1
484 bic r4, r4, #1
485 blne cache_on
486
467/* 487/*
468 * The C runtime environment should now be setup sufficiently. 488 * The C runtime environment should now be setup sufficiently.
469 * Set up some pointers, and start decompressing. 489 * Set up some pointers, and start decompressing.
@@ -512,6 +532,7 @@ LC0: .word LC0 @ r1
512 .word _got_start @ r11 532 .word _got_start @ r11
513 .word _got_end @ ip 533 .word _got_end @ ip
514 .word .L_user_stack_end @ sp 534 .word .L_user_stack_end @ sp
535 .word _end - restart + 16384 + 1024*1024
515 .size LC0, . - LC0 536 .size LC0, . - LC0
516 537
517#ifdef CONFIG_ARCH_RPC 538#ifdef CONFIG_ARCH_RPC
@@ -805,8 +826,8 @@ call_cache_fn: adr r12, proc_types
805 .align 2 826 .align 2
806 .type proc_types,#object 827 .type proc_types,#object
807proc_types: 828proc_types:
808 .word 0x00000000 @ old ARM ID 829 .word 0x41000000 @ old ARM ID
809 .word 0x0000f000 830 .word 0xff00f000
810 mov pc, lr 831 mov pc, lr
811 THUMB( nop ) 832 THUMB( nop )
812 mov pc, lr 833 mov pc, lr
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index f0895c581a89..641b3c9a7028 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -16,11 +16,13 @@ dtb-$(CONFIG_ARCH_AT91) += at91sam9263ek.dtb
16dtb-$(CONFIG_ARCH_AT91) += tny_a9263.dtb 16dtb-$(CONFIG_ARCH_AT91) += tny_a9263.dtb
17dtb-$(CONFIG_ARCH_AT91) += usb_a9263.dtb 17dtb-$(CONFIG_ARCH_AT91) += usb_a9263.dtb
18# sam9g20 18# sam9g20
19dtb-$(CONFIG_ARCH_AT91) += at91-foxg20.dtb
19dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek.dtb 20dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek.dtb
20dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek_2mmc.dtb 21dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek_2mmc.dtb
21dtb-$(CONFIG_ARCH_AT91) += kizbox.dtb 22dtb-$(CONFIG_ARCH_AT91) += kizbox.dtb
22dtb-$(CONFIG_ARCH_AT91) += tny_a9g20.dtb 23dtb-$(CONFIG_ARCH_AT91) += tny_a9g20.dtb
23dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb 24dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb
25dtb-$(CONFIG_ARCH_AT91) += usb_a9g20_lpw.dtb
24# sam9g45 26# sam9g45
25dtb-$(CONFIG_ARCH_AT91) += at91sam9m10g45ek.dtb 27dtb-$(CONFIG_ARCH_AT91) += at91sam9m10g45ek.dtb
26dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb 28dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
@@ -57,6 +59,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
57 exynos5440-sd5v1.dtb \ 59 exynos5440-sd5v1.dtb \
58 exynos5250-smdk5250.dtb \ 60 exynos5250-smdk5250.dtb \
59 exynos5250-snow.dtb \ 61 exynos5250-snow.dtb \
62 exynos5420-smdk5420.dtb \
60 exynos5440-ssdk5440.dtb 63 exynos5440-ssdk5440.dtb
61dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ 64dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
62 ecx-2000.dtb 65 ecx-2000.dtb
@@ -64,6 +67,8 @@ dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
64 integratorcp.dtb 67 integratorcp.dtb
65dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 68dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
66dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \ 69dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
70 kirkwood-db-88f6281.dtb \
71 kirkwood-db-88f6282.dtb \
67 kirkwood-dns320.dtb \ 72 kirkwood-dns320.dtb \
68 kirkwood-dns325.dtb \ 73 kirkwood-dns325.dtb \
69 kirkwood-dockstar.dtb \ 74 kirkwood-dockstar.dtb \
@@ -84,6 +89,8 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
84 kirkwood-ns2max.dtb \ 89 kirkwood-ns2max.dtb \
85 kirkwood-ns2mini.dtb \ 90 kirkwood-ns2mini.dtb \
86 kirkwood-nsa310.dtb \ 91 kirkwood-nsa310.dtb \
92 kirkwood-sheevaplug.dtb \
93 kirkwood-sheevaplug-esata.dtb \
87 kirkwood-topkick.dtb \ 94 kirkwood-topkick.dtb \
88 kirkwood-ts219-6281.dtb \ 95 kirkwood-ts219-6281.dtb \
89 kirkwood-ts219-6282.dtb \ 96 kirkwood-ts219-6282.dtb \
@@ -103,13 +110,15 @@ dtb-$(CONFIG_ARCH_MXC) += \
103 imx27-apf27.dtb \ 110 imx27-apf27.dtb \
104 imx27-apf27dev.dtb \ 111 imx27-apf27dev.dtb \
105 imx27-pdk.dtb \ 112 imx27-pdk.dtb \
106 imx27-phytec-phycore.dtb \ 113 imx27-phytec-phycore-som.dtb \
114 imx27-phytec-phycore-rdk.dtb \
107 imx31-bug.dtb \ 115 imx31-bug.dtb \
108 imx51-apf51.dtb \ 116 imx51-apf51.dtb \
109 imx51-apf51dev.dtb \ 117 imx51-apf51dev.dtb \
110 imx51-babbage.dtb \ 118 imx51-babbage.dtb \
111 imx53-ard.dtb \ 119 imx53-ard.dtb \
112 imx53-evk.dtb \ 120 imx53-evk.dtb \
121 imx53-m53evk.dtb \
113 imx53-mba53.dtb \ 122 imx53-mba53.dtb \
114 imx53-qsb.dtb \ 123 imx53-qsb.dtb \
115 imx53-smd.dtb \ 124 imx53-smd.dtb \
@@ -117,10 +126,13 @@ dtb-$(CONFIG_ARCH_MXC) += \
117 imx6dl-sabresd.dtb \ 126 imx6dl-sabresd.dtb \
118 imx6dl-wandboard.dtb \ 127 imx6dl-wandboard.dtb \
119 imx6q-arm2.dtb \ 128 imx6q-arm2.dtb \
129 imx6q-phytec-pbab01.dtb \
120 imx6q-sabreauto.dtb \ 130 imx6q-sabreauto.dtb \
121 imx6q-sabrelite.dtb \ 131 imx6q-sabrelite.dtb \
122 imx6q-sabresd.dtb \ 132 imx6q-sabresd.dtb \
123 imx6q-sbc6x.dtb 133 imx6q-sbc6x.dtb \
134 imx6sl-evk.dtb \
135 vf610-twr.dtb
124dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \ 136dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
125 imx23-olinuxino.dtb \ 137 imx23-olinuxino.dtb \
126 imx23-stmp378x_devb.dtb \ 138 imx23-stmp378x_devb.dtb \
@@ -130,11 +142,16 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
130 imx28-cfa10036.dtb \ 142 imx28-cfa10036.dtb \
131 imx28-cfa10037.dtb \ 143 imx28-cfa10037.dtb \
132 imx28-cfa10049.dtb \ 144 imx28-cfa10049.dtb \
145 imx28-cfa10055.dtb \
146 imx28-cfa10057.dtb \
133 imx28-evk.dtb \ 147 imx28-evk.dtb \
134 imx28-m28evk.dtb \ 148 imx28-m28evk.dtb \
135 imx28-sps1.dtb \ 149 imx28-sps1.dtb \
136 imx28-tx28.dtb 150 imx28-tx28.dtb
137dtb-$(CONFIG_ARCH_NOMADIK) += ste-nomadik-s8815.dtb 151dtb-$(CONFIG_ARCH_NOMADIK) += ste-nomadik-s8815.dtb
152dtb-$(CONFIG_ARCH_NSPIRE) += nspire-cx.dtb \
153 nspire-tp.dtb \
154 nspire-clp.dtb
138dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ 155dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
139 omap3430-sdp.dtb \ 156 omap3430-sdp.dtb \
140 omap3-beagle.dtb \ 157 omap3-beagle.dtb \
@@ -149,19 +166,26 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
149 omap4-panda-es.dtb \ 166 omap4-panda-es.dtb \
150 omap4-var-som.dtb \ 167 omap4-var-som.dtb \
151 omap4-sdp.dtb \ 168 omap4-sdp.dtb \
152 omap5-evm.dtb \ 169 omap4-sdp-es23plus.dtb \
170 omap5-uevm.dtb \
153 am335x-evm.dtb \ 171 am335x-evm.dtb \
154 am335x-evmsk.dtb \ 172 am335x-evmsk.dtb \
155 am335x-bone.dtb 173 am335x-bone.dtb \
174 am3517-evm.dtb \
175 am3517_mt_ventoux.dtb \
176 am43x-epos-evm.dtb
156dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb 177dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb
157dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb 178dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
158dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \ 179dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
159 hrefprev60.dtb \ 180 hrefprev60.dtb \
160 hrefv60plus.dtb \ 181 hrefv60plus.dtb \
182 ccu8540.dtb \
161 ccu9540.dtb 183 ccu9540.dtb
184dtb-$(CONFIG_ARCH_S3C24XX) += s3c2416-smdk2416.dtb
162dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ 185dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
163 r8a7740-armadillo800eva.dtb \ 186 r8a7740-armadillo800eva.dtb \
164 r8a7778-bockw.dtb \ 187 r8a7778-bockw.dtb \
188 r8a7740-armadillo800eva-reference.dtb \
165 r8a7779-marzen-reference.dtb \ 189 r8a7779-marzen-reference.dtb \
166 r8a7790-lager.dtb \ 190 r8a7790-lager.dtb \
167 sh73a0-kzm9g.dtb \ 191 sh73a0-kzm9g.dtb \
@@ -177,10 +201,15 @@ dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
177 spear320-evb.dtb \ 201 spear320-evb.dtb \
178 spear320-hmi.dtb 202 spear320-hmi.dtb
179dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb 203dtb-$(CONFIG_ARCH_SPEAR6XX)+= spear600-evb.dtb
204dtb-$(CONFIG_ARCH_STI)+= stih415-b2000.dtb \
205 stih416-b2000.dtb \
206 stih415-b2020.dtb \
207 stih416-b2020.dtb
180dtb-$(CONFIG_ARCH_SUNXI) += \ 208dtb-$(CONFIG_ARCH_SUNXI) += \
181 sun4i-a10-cubieboard.dtb \ 209 sun4i-a10-cubieboard.dtb \
182 sun4i-a10-mini-xplus.dtb \ 210 sun4i-a10-mini-xplus.dtb \
183 sun4i-a10-hackberry.dtb \ 211 sun4i-a10-hackberry.dtb \
212 sun5i-a10s-olinuxino-micro.dtb \
184 sun5i-a13-olinuxino.dtb 213 sun5i-a13-olinuxino.dtb
185dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ 214dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
186 tegra20-iris-512.dtb \ 215 tegra20-iris-512.dtb \
@@ -199,6 +228,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \
199 tegra114-pluto.dtb 228 tegra114-pluto.dtb
200dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ 229dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \
201 versatile-pb.dtb 230 versatile-pb.dtb
231dtb-$(CONFIG_ARCH_U300) += ste-u300.dtb
202dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ 232dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \
203 vexpress-v2p-ca9.dtb \ 233 vexpress-v2p-ca9.dtb \
204 vexpress-v2p-ca15-tc1.dtb \ 234 vexpress-v2p-ca15-tc1.dtb \
@@ -207,8 +237,11 @@ dtb-$(CONFIG_ARCH_VIRT) += xenvm-4.2.dtb
207dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \ 237dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
208 wm8505-ref.dtb \ 238 wm8505-ref.dtb \
209 wm8650-mid.dtb \ 239 wm8650-mid.dtb \
240 wm8750-apc8750.dtb \
210 wm8850-w70v2.dtb 241 wm8850-w70v2.dtb
211dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb 242dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb \
243 zynq-zc706.dtb \
244 zynq-zed.dtb
212 245
213targets += dtbs 246targets += dtbs
214targets += $(dtb-y) 247targets += $(dtb-y)
diff --git a/arch/arm/boot/dts/aks-cdu.dts b/arch/arm/boot/dts/aks-cdu.dts
index 29b9f15e7599..54cb5cf8604a 100644
--- a/arch/arm/boot/dts/aks-cdu.dts
+++ b/arch/arm/boot/dts/aks-cdu.dts
@@ -9,7 +9,7 @@
9 9
10/dts-v1/; 10/dts-v1/;
11 11
12/include/ "ge863-pro3.dtsi" 12#include "ge863-pro3.dtsi"
13 13
14/ { 14/ {
15 chosen { 15 chosen {
@@ -46,7 +46,7 @@
46 }; 46 };
47 47
48 usb1: gadget@fffa4000 { 48 usb1: gadget@fffa4000 {
49 atmel,vbus-gpio = <&pioC 15 0>; 49 atmel,vbus-gpio = <&pioC 15 GPIO_ACTIVE_HIGH>;
50 status = "okay"; 50 status = "okay";
51 }; 51 };
52 }; 52 };
@@ -90,23 +90,23 @@
90 compatible = "gpio-leds"; 90 compatible = "gpio-leds";
91 91
92 red { 92 red {
93 gpios = <&pioC 10 0>; 93 gpios = <&pioC 10 GPIO_ACTIVE_HIGH>;
94 linux,default-trigger = "none"; 94 linux,default-trigger = "none";
95 }; 95 };
96 96
97 green { 97 green {
98 gpios = <&pioA 5 1>; 98 gpios = <&pioA 5 GPIO_ACTIVE_LOW>;
99 linux,default-trigger = "none"; 99 linux,default-trigger = "none";
100 default-state = "on"; 100 default-state = "on";
101 }; 101 };
102 102
103 yellow { 103 yellow {
104 gpios = <&pioB 20 1>; 104 gpios = <&pioB 20 GPIO_ACTIVE_LOW>;
105 linux,default-trigger = "none"; 105 linux,default-trigger = "none";
106 }; 106 };
107 107
108 blue { 108 blue {
109 gpios = <&pioB 21 1>; 109 gpios = <&pioB 21 GPIO_ACTIVE_LOW>;
110 linux,default-trigger = "none"; 110 linux,default-trigger = "none";
111 }; 111 };
112 }; 112 };
diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 5302f79c05b7..04feaf8f1420 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "am33xx.dtsi" 10#include "am33xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI AM335x BeagleBone"; 13 model = "TI AM335x BeagleBone";
@@ -26,24 +26,104 @@
26 26
27 am33xx_pinmux: pinmux@44e10800 { 27 am33xx_pinmux: pinmux@44e10800 {
28 pinctrl-names = "default"; 28 pinctrl-names = "default";
29 pinctrl-0 = <&user_leds_s0>; 29 pinctrl-0 = <&clkout2_pin>;
30 30
31 user_leds_s0: user_leds_s0 { 31 user_leds_s0: user_leds_s0 {
32 pinctrl-single,pins = < 32 pinctrl-single,pins = <
33 0x54 0x7 /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */ 33 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
34 0x58 0x17 /* gpmc_a6.gpio1_22, OUTPUT_PULLUP | MODE7 */ 34 0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1_22 */
35 0x5c 0x7 /* gpmc_a7.gpio1_23, OUTPUT | MODE7 */ 35 0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */
36 0x60 0x17 /* gpmc_a8.gpio1_24, OUTPUT_PULLUP | MODE7 */ 36 0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio1_24 */
37 >;
38 };
39
40 i2c0_pins: pinmux_i2c0_pins {
41 pinctrl-single,pins = <
42 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
43 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
44 >;
45 };
46
47 uart0_pins: pinmux_uart0_pins {
48 pinctrl-single,pins = <
49 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
50 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
51 >;
52 };
53
54 clkout2_pin: pinmux_clkout2_pin {
55 pinctrl-single,pins = <
56 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
57 >;
58 };
59
60 cpsw_default: cpsw_default {
61 pinctrl-single,pins = <
62 /* Slave 1 */
63 0x110 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxerr.mii1_rxerr */
64 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txen.mii1_txen */
65 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxdv.mii1_rxdv */
66 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd3.mii1_txd3 */
67 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd2.mii1_txd2 */
68 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd1.mii1_txd1 */
69 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* mii1_txd0.mii1_txd0 */
70 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_txclk.mii1_txclk */
71 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxclk.mii1_rxclk */
72 0x134 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd3.mii1_rxd3 */
73 0x138 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd2.mii1_rxd2 */
74 0x13c (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd1.mii1_rxd1 */
75 0x140 (PIN_INPUT_PULLUP | MUX_MODE0) /* mii1_rxd0.mii1_rxd0 */
76 >;
77 };
78
79 cpsw_sleep: cpsw_sleep {
80 pinctrl-single,pins = <
81 /* Slave 1 reset value */
82 0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7)
83 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
84 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
85 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
86 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
87 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
88 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
89 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
90 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
91 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
92 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
93 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
94 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
95 >;
96 };
97
98 davinci_mdio_default: davinci_mdio_default {
99 pinctrl-single,pins = <
100 /* MDIO */
101 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
102 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
103 >;
104 };
105
106 davinci_mdio_sleep: davinci_mdio_sleep {
107 pinctrl-single,pins = <
108 /* MDIO reset value */
109 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
110 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
37 >; 111 >;
38 }; 112 };
39 }; 113 };
40 114
41 ocp { 115 ocp {
42 uart1: serial@44e09000 { 116 uart0: serial@44e09000 {
117 pinctrl-names = "default";
118 pinctrl-0 = <&uart0_pins>;
119
43 status = "okay"; 120 status = "okay";
44 }; 121 };
45 122
46 i2c0: i2c@44e0b000 { 123 i2c0: i2c@44e0b000 {
124 pinctrl-names = "default";
125 pinctrl-0 = <&i2c0_pins>;
126
47 status = "okay"; 127 status = "okay";
48 clock-frequency = <400000>; 128 clock-frequency = <400000>;
49 129
@@ -55,31 +135,34 @@
55 }; 135 };
56 136
57 leds { 137 leds {
138 pinctrl-names = "default";
139 pinctrl-0 = <&user_leds_s0>;
140
58 compatible = "gpio-leds"; 141 compatible = "gpio-leds";
59 142
60 led@2 { 143 led@2 {
61 label = "beaglebone:green:heartbeat"; 144 label = "beaglebone:green:heartbeat";
62 gpios = <&gpio1 21 0>; 145 gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
63 linux,default-trigger = "heartbeat"; 146 linux,default-trigger = "heartbeat";
64 default-state = "off"; 147 default-state = "off";
65 }; 148 };
66 149
67 led@3 { 150 led@3 {
68 label = "beaglebone:green:mmc0"; 151 label = "beaglebone:green:mmc0";
69 gpios = <&gpio1 22 0>; 152 gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
70 linux,default-trigger = "mmc0"; 153 linux,default-trigger = "mmc0";
71 default-state = "off"; 154 default-state = "off";
72 }; 155 };
73 156
74 led@4 { 157 led@4 {
75 label = "beaglebone:green:usr2"; 158 label = "beaglebone:green:usr2";
76 gpios = <&gpio1 23 0>; 159 gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
77 default-state = "off"; 160 default-state = "off";
78 }; 161 };
79 162
80 led@5 { 163 led@5 {
81 label = "beaglebone:green:usr3"; 164 label = "beaglebone:green:usr3";
82 gpios = <&gpio1 24 0>; 165 gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
83 default-state = "off"; 166 default-state = "off";
84 }; 167 };
85 }; 168 };
@@ -136,3 +219,16 @@
136&cpsw_emac1 { 219&cpsw_emac1 {
137 phy_id = <&davinci_mdio>, <1>; 220 phy_id = <&davinci_mdio>, <1>;
138}; 221};
222
223&mac {
224 pinctrl-names = "default", "sleep";
225 pinctrl-0 = <&cpsw_default>;
226 pinctrl-1 = <&cpsw_sleep>;
227
228};
229
230&davinci_mdio {
231 pinctrl-names = "default", "sleep";
232 pinctrl-0 = <&davinci_mdio_default>;
233 pinctrl-1 = <&davinci_mdio_sleep>;
234};
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index 0423298a26fe..a16bb9691cc6 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "am33xx.dtsi" 10#include "am33xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI AM335x EVM"; 13 model = "TI AM335x EVM";
@@ -26,32 +26,143 @@
26 26
27 am33xx_pinmux: pinmux@44e10800 { 27 am33xx_pinmux: pinmux@44e10800 {
28 pinctrl-names = "default"; 28 pinctrl-names = "default";
29 pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0>; 29 pinctrl-0 = <&matrix_keypad_s0 &volume_keys_s0 &clkout2_pin>;
30 30
31 matrix_keypad_s0: matrix_keypad_s0 { 31 matrix_keypad_s0: matrix_keypad_s0 {
32 pinctrl-single,pins = < 32 pinctrl-single,pins = <
33 0x54 0x7 /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */ 33 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */
34 0x58 0x7 /* gpmc_a6.gpio1_22, OUTPUT | MODE7 */ 34 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a6.gpio1_22 */
35 0x64 0x27 /* gpmc_a9.gpio1_25, INPUT | MODE7 */ 35 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a9.gpio1_25 */
36 0x68 0x27 /* gpmc_a10.gpio1_26, INPUT | MODE7 */ 36 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a10.gpio1_26 */
37 0x6c 0x27 /* gpmc_a11.gpio1_27, INPUT | MODE7 */ 37 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_a11.gpio1_27 */
38 >; 38 >;
39 }; 39 };
40 40
41 volume_keys_s0: volume_keys_s0 { 41 volume_keys_s0: volume_keys_s0 {
42 pinctrl-single,pins = < 42 pinctrl-single,pins = <
43 0x150 0x27 /* spi0_sclk.gpio0_2, INPUT | MODE7 */ 43 0x150 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_sclk.gpio0_2 */
44 0x154 0x27 /* spi0_d0.gpio0_3, INPUT | MODE7 */ 44 0x154 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* spi0_d0.gpio0_3 */
45 >;
46 };
47
48 i2c0_pins: pinmux_i2c0_pins {
49 pinctrl-single,pins = <
50 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
51 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
52 >;
53 };
54
55 i2c1_pins: pinmux_i2c1_pins {
56 pinctrl-single,pins = <
57 0x158 (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_d1.i2c1_sda */
58 0x15c (PIN_INPUT_PULLUP | MUX_MODE2) /* spi0_cs0.i2c1_scl */
59 >;
60 };
61
62 uart0_pins: pinmux_uart0_pins {
63 pinctrl-single,pins = <
64 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
65 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
66 >;
67 };
68
69 clkout2_pin: pinmux_clkout2_pin {
70 pinctrl-single,pins = <
71 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
72 >;
73 };
74
75 nandflash_pins_s0: nandflash_pins_s0 {
76 pinctrl-single,pins = <
77 0x0 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
78 0x4 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
79 0x8 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
80 0xc (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
81 0x10 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
82 0x14 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
83 0x18 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
84 0x1c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
85 0x70 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
86 0x74 (PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_wpn.gpio0_30 */
87 0x7c (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
88 0x90 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
89 0x94 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
90 0x98 (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
91 0x9c (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */
92 >;
93 };
94
95 ecap0_pins: backlight_pins {
96 pinctrl-single,pins = <
97 0x164 0x0 /* eCAP0_in_PWM0_out.eCAP0_in_PWM0_out MODE0 */
98 >;
99 };
100
101 cpsw_default: cpsw_default {
102 pinctrl-single,pins = <
103 /* Slave 1 */
104 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
105 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
106 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii1_td3 */
107 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii1_td2 */
108 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
109 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
110 0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii1_tclk */
111 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxclk.rgmii1_rclk */
112 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd3.rgmii1_rd3 */
113 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd2.rgmii1_rd2 */
114 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd1 */
115 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd0 */
116 >;
117 };
118
119 cpsw_sleep: cpsw_sleep {
120 pinctrl-single,pins = <
121 /* Slave 1 reset value */
122 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
123 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
124 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
125 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
126 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
127 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
128 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
129 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
130 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
131 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
132 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
133 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
134 >;
135 };
136
137 davinci_mdio_default: davinci_mdio_default {
138 pinctrl-single,pins = <
139 /* MDIO */
140 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
141 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
142 >;
143 };
144
145 davinci_mdio_sleep: davinci_mdio_sleep {
146 pinctrl-single,pins = <
147 /* MDIO reset value */
148 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
149 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
45 >; 150 >;
46 }; 151 };
47 }; 152 };
48 153
49 ocp { 154 ocp {
50 uart1: serial@44e09000 { 155 uart0: serial@44e09000 {
156 pinctrl-names = "default";
157 pinctrl-0 = <&uart0_pins>;
158
51 status = "okay"; 159 status = "okay";
52 }; 160 };
53 161
54 i2c0: i2c@44e0b000 { 162 i2c0: i2c@44e0b000 {
163 pinctrl-names = "default";
164 pinctrl-0 = <&i2c0_pins>;
165
55 status = "okay"; 166 status = "okay";
56 clock-frequency = <400000>; 167 clock-frequency = <400000>;
57 168
@@ -61,6 +172,9 @@
61 }; 172 };
62 173
63 i2c1: i2c@4802a000 { 174 i2c1: i2c@4802a000 {
175 pinctrl-names = "default";
176 pinctrl-0 = <&i2c1_pins>;
177
64 status = "okay"; 178 status = "okay";
65 clock-frequency = <100000>; 179 clock-frequency = <100000>;
66 180
@@ -102,6 +216,101 @@
102 reg = <0x48>; 216 reg = <0x48>;
103 }; 217 };
104 }; 218 };
219
220 elm: elm@48080000 {
221 status = "okay";
222 };
223
224 epwmss0: epwmss@48300000 {
225 status = "okay";
226
227 ecap0: ecap@48300100 {
228 status = "okay";
229 pinctrl-names = "default";
230 pinctrl-0 = <&ecap0_pins>;
231 };
232 };
233
234 gpmc: gpmc@50000000 {
235 status = "okay";
236 pinctrl-names = "default";
237 pinctrl-0 = <&nandflash_pins_s0>;
238 ranges = <0 0 0x08000000 0x10000000>; /* CS0: NAND */
239 nand@0,0 {
240 reg = <0 0 0>; /* CS0, offset 0 */
241 nand-bus-width = <8>;
242 ti,nand-ecc-opt = "bch8";
243 gpmc,device-nand = "true";
244 gpmc,device-width = <1>;
245 gpmc,sync-clk-ps = <0>;
246 gpmc,cs-on-ns = <0>;
247 gpmc,cs-rd-off-ns = <44>;
248 gpmc,cs-wr-off-ns = <44>;
249 gpmc,adv-on-ns = <6>;
250 gpmc,adv-rd-off-ns = <34>;
251 gpmc,adv-wr-off-ns = <44>;
252 gpmc,we-on-ns = <0>;
253 gpmc,we-off-ns = <40>;
254 gpmc,oe-on-ns = <0>;
255 gpmc,oe-off-ns = <54>;
256 gpmc,access-ns = <64>;
257 gpmc,rd-cycle-ns = <82>;
258 gpmc,wr-cycle-ns = <82>;
259 gpmc,wait-on-read = "true";
260 gpmc,wait-on-write = "true";
261 gpmc,bus-turnaround-ns = <0>;
262 gpmc,cycle2cycle-delay-ns = <0>;
263 gpmc,clk-activation-ns = <0>;
264 gpmc,wait-monitoring-ns = <0>;
265 gpmc,wr-access-ns = <40>;
266 gpmc,wr-data-mux-bus-ns = <0>;
267
268 #address-cells = <1>;
269 #size-cells = <1>;
270 elm_id = <&elm>;
271
272 /* MTD partition table */
273 partition@0 {
274 label = "SPL1";
275 reg = <0x00000000 0x000020000>;
276 };
277
278 partition@1 {
279 label = "SPL2";
280 reg = <0x00020000 0x00020000>;
281 };
282
283 partition@2 {
284 label = "SPL3";
285 reg = <0x00040000 0x00020000>;
286 };
287
288 partition@3 {
289 label = "SPL4";
290 reg = <0x00060000 0x00020000>;
291 };
292
293 partition@4 {
294 label = "U-boot";
295 reg = <0x00080000 0x001e0000>;
296 };
297
298 partition@5 {
299 label = "environment";
300 reg = <0x00260000 0x00020000>;
301 };
302
303 partition@6 {
304 label = "Kernel";
305 reg = <0x00280000 0x00500000>;
306 };
307
308 partition@7 {
309 label = "File-System";
310 reg = <0x00780000 0x0F880000>;
311 };
312 };
313 };
105 }; 314 };
106 315
107 vbat: fixedregulator@0 { 316 vbat: fixedregulator@0 {
@@ -123,12 +332,12 @@
123 debounce-delay-ms = <5>; 332 debounce-delay-ms = <5>;
124 col-scan-delay-us = <2>; 333 col-scan-delay-us = <2>;
125 334
126 row-gpios = <&gpio1 25 0 /* Bank1, pin25 */ 335 row-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH /* Bank1, pin25 */
127 &gpio1 26 0 /* Bank1, pin26 */ 336 &gpio1 26 GPIO_ACTIVE_HIGH /* Bank1, pin26 */
128 &gpio1 27 0>; /* Bank1, pin27 */ 337 &gpio1 27 GPIO_ACTIVE_HIGH>; /* Bank1, pin27 */
129 338
130 col-gpios = <&gpio1 21 0 /* Bank1, pin21 */ 339 col-gpios = <&gpio1 21 GPIO_ACTIVE_HIGH /* Bank1, pin21 */
131 &gpio1 22 0>; /* Bank1, pin22 */ 340 &gpio1 22 GPIO_ACTIVE_HIGH>; /* Bank1, pin22 */
132 341
133 linux,keymap = <0x0000008b /* MENU */ 342 linux,keymap = <0x0000008b /* MENU */
134 0x0100009e /* BACK */ 343 0x0100009e /* BACK */
@@ -147,20 +356,27 @@
147 switch@9 { 356 switch@9 {
148 label = "volume-up"; 357 label = "volume-up";
149 linux,code = <115>; 358 linux,code = <115>;
150 gpios = <&gpio0 2 1>; 359 gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
151 gpio-key,wakeup; 360 gpio-key,wakeup;
152 }; 361 };
153 362
154 switch@10 { 363 switch@10 {
155 label = "volume-down"; 364 label = "volume-down";
156 linux,code = <114>; 365 linux,code = <114>;
157 gpios = <&gpio0 3 1>; 366 gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
158 gpio-key,wakeup; 367 gpio-key,wakeup;
159 }; 368 };
160 }; 369 };
370
371 backlight {
372 compatible = "pwm-backlight";
373 pwms = <&ecap0 0 50000 0>;
374 brightness-levels = <0 51 53 56 62 75 101 152 255>;
375 default-brightness-level = <8>;
376 };
161}; 377};
162 378
163/include/ "tps65910.dtsi" 379#include "tps65910.dtsi"
164 380
165&tps { 381&tps {
166 vcc1-supply = <&vbat>; 382 vcc1-supply = <&vbat>;
@@ -237,6 +453,18 @@
237 }; 453 };
238}; 454};
239 455
456&mac {
457 pinctrl-names = "default", "sleep";
458 pinctrl-0 = <&cpsw_default>;
459 pinctrl-1 = <&cpsw_sleep>;
460};
461
462&davinci_mdio {
463 pinctrl-names = "default", "sleep";
464 pinctrl-0 = <&davinci_mdio_default>;
465 pinctrl-1 = <&davinci_mdio_sleep>;
466};
467
240&cpsw_emac0 { 468&cpsw_emac0 {
241 phy_id = <&davinci_mdio>, <0>; 469 phy_id = <&davinci_mdio>, <0>;
242}; 470};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index f67c360844f4..9e00eef9b74b 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -13,7 +13,7 @@
13 13
14/dts-v1/; 14/dts-v1/;
15 15
16/include/ "am33xx.dtsi" 16#include "am33xx.dtsi"
17 17
18/ { 18/ {
19 model = "TI AM335x EVM-SK"; 19 model = "TI AM335x EVM-SK";
@@ -32,33 +32,145 @@
32 32
33 am33xx_pinmux: pinmux@44e10800 { 33 am33xx_pinmux: pinmux@44e10800 {
34 pinctrl-names = "default"; 34 pinctrl-names = "default";
35 pinctrl-0 = <&user_leds_s0 &gpio_keys_s0>; 35 pinctrl-0 = <&gpio_keys_s0 &clkout2_pin>;
36 36
37 user_leds_s0: user_leds_s0 { 37 user_leds_s0: user_leds_s0 {
38 pinctrl-single,pins = < 38 pinctrl-single,pins = <
39 0x10 0x7 /* gpmc_ad4.gpio1_4, OUTPUT | MODE7 */ 39 0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad4.gpio1_4 */
40 0x14 0x7 /* gpmc_ad5.gpio1_5, OUTPUT | MODE7 */ 40 0x14 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad5.gpio1_5 */
41 0x18 0x7 /* gpmc_ad6.gpio1_6, OUTPUT | MODE7 */ 41 0x18 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad6.gpio1_6 */
42 0x1c 0x7 /* gpmc_ad7.gpio1_7, OUTPUT | MODE7 */ 42 0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad7.gpio1_7 */
43 >; 43 >;
44 }; 44 };
45 45
46 gpio_keys_s0: gpio_keys_s0 { 46 gpio_keys_s0: gpio_keys_s0 {
47 pinctrl-single,pins = < 47 pinctrl-single,pins = <
48 0x94 0x27 /* gpmc_oen_ren.gpio2_3, INPUT | MODE7 */ 48 0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_oen_ren.gpio2_3 */
49 0x90 0x27 /* gpmc_advn_ale.gpio2_2, INPUT | MODE7 */ 49 0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2 */
50 0x70 0x27 /* gpmc_wait0.gpio0_30, INPUT | MODE7 */ 50 0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_wait0.gpio0_30 */
51 0x9c 0x27 /* gpmc_ben0_cle.gpio2_5, INPUT | MODE7 */ 51 0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ben0_cle.gpio2_5 */
52 >;
53 };
54
55 i2c0_pins: pinmux_i2c0_pins {
56 pinctrl-single,pins = <
57 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */
58 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */
59 >;
60 };
61
62 uart0_pins: pinmux_uart0_pins {
63 pinctrl-single,pins = <
64 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */
65 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */
66 >;
67 };
68
69 clkout2_pin: pinmux_clkout2_pin {
70 pinctrl-single,pins = <
71 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */
72 >;
73 };
74
75 ecap2_pins: backlight_pins {
76 pinctrl-single,pins = <
77 0x19c 0x4 /* mcasp0_ahclkr.ecap2_in_pwm2_out MODE4 */
78 >;
79 };
80
81 cpsw_default: cpsw_default {
82 pinctrl-single,pins = <
83 /* Slave 1 */
84 0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txen.rgmii1_tctl */
85 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxdv.rgmii1_rctl */
86 0x11c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd3.rgmii1_td3 */
87 0x120 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd2.rgmii1_td2 */
88 0x124 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd1.rgmii1_td1 */
89 0x128 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txd0.rgmii1_td0 */
90 0x12c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* mii1_txclk.rgmii1_tclk */
91 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxclk.rgmii1_rclk */
92 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd3.rgmii1_rd3 */
93 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd2.rgmii1_rd2 */
94 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd1.rgmii1_rd1 */
95 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* mii1_rxd0.rgmii1_rd0 */
96
97 /* Slave 2 */
98 0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a0.rgmii2_tctl */
99 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a1.rgmii2_rctl */
100 0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a2.rgmii2_td3 */
101 0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a3.rgmii2_td2 */
102 0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a4.rgmii2_td1 */
103 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a5.rgmii2_td0 */
104 0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2) /* gpmc_a6.rgmii2_tclk */
105 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a7.rgmii2_rclk */
106 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a8.rgmii2_rd3 */
107 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a9.rgmii2_rd2 */
108 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a10.rgmii2_rd1 */
109 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2) /* gpmc_a11.rgmii2_rd0 */
110 >;
111 };
112
113 cpsw_sleep: cpsw_sleep {
114 pinctrl-single,pins = <
115 /* Slave 1 reset value */
116 0x114 (PIN_INPUT_PULLDOWN | MUX_MODE7)
117 0x118 (PIN_INPUT_PULLDOWN | MUX_MODE7)
118 0x11c (PIN_INPUT_PULLDOWN | MUX_MODE7)
119 0x120 (PIN_INPUT_PULLDOWN | MUX_MODE7)
120 0x124 (PIN_INPUT_PULLDOWN | MUX_MODE7)
121 0x128 (PIN_INPUT_PULLDOWN | MUX_MODE7)
122 0x12c (PIN_INPUT_PULLDOWN | MUX_MODE7)
123 0x130 (PIN_INPUT_PULLDOWN | MUX_MODE7)
124 0x134 (PIN_INPUT_PULLDOWN | MUX_MODE7)
125 0x138 (PIN_INPUT_PULLDOWN | MUX_MODE7)
126 0x13c (PIN_INPUT_PULLDOWN | MUX_MODE7)
127 0x140 (PIN_INPUT_PULLDOWN | MUX_MODE7)
128
129 /* Slave 2 reset value*/
130 0x40 (PIN_INPUT_PULLDOWN | MUX_MODE7)
131 0x44 (PIN_INPUT_PULLDOWN | MUX_MODE7)
132 0x48 (PIN_INPUT_PULLDOWN | MUX_MODE7)
133 0x4c (PIN_INPUT_PULLDOWN | MUX_MODE7)
134 0x50 (PIN_INPUT_PULLDOWN | MUX_MODE7)
135 0x54 (PIN_INPUT_PULLDOWN | MUX_MODE7)
136 0x58 (PIN_INPUT_PULLDOWN | MUX_MODE7)
137 0x5c (PIN_INPUT_PULLDOWN | MUX_MODE7)
138 0x60 (PIN_INPUT_PULLDOWN | MUX_MODE7)
139 0x64 (PIN_INPUT_PULLDOWN | MUX_MODE7)
140 0x68 (PIN_INPUT_PULLDOWN | MUX_MODE7)
141 0x6c (PIN_INPUT_PULLDOWN | MUX_MODE7)
142 >;
143 };
144
145 davinci_mdio_default: davinci_mdio_default {
146 pinctrl-single,pins = <
147 /* MDIO */
148 0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0) /* mdio_data.mdio_data */
149 0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* mdio_clk.mdio_clk */
150 >;
151 };
152
153 davinci_mdio_sleep: davinci_mdio_sleep {
154 pinctrl-single,pins = <
155 /* MDIO reset value */
156 0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
157 0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
52 >; 158 >;
53 }; 159 };
54 }; 160 };
55 161
56 ocp { 162 ocp {
57 uart1: serial@44e09000 { 163 uart0: serial@44e09000 {
164 pinctrl-names = "default";
165 pinctrl-0 = <&uart0_pins>;
166
58 status = "okay"; 167 status = "okay";
59 }; 168 };
60 169
61 i2c0: i2c@44e0b000 { 170 i2c0: i2c@44e0b000 {
171 pinctrl-names = "default";
172 pinctrl-0 = <&i2c0_pins>;
173
62 status = "okay"; 174 status = "okay";
63 clock-frequency = <400000>; 175 clock-frequency = <400000>;
64 176
@@ -94,6 +206,16 @@
94 st,max-limit-z = <750>; 206 st,max-limit-z = <750>;
95 }; 207 };
96 }; 208 };
209
210 epwmss2: epwmss@48304000 {
211 status = "okay";
212
213 ecap2: ecap@48304100 {
214 status = "okay";
215 pinctrl-names = "default";
216 pinctrl-0 = <&ecap2_pins>;
217 };
218 };
97 }; 219 };
98 220
99 vbat: fixedregulator@0 { 221 vbat: fixedregulator@0 {
@@ -111,30 +233,33 @@
111 }; 233 };
112 234
113 leds { 235 leds {
236 pinctrl-names = "default";
237 pinctrl-0 = <&user_leds_s0>;
238
114 compatible = "gpio-leds"; 239 compatible = "gpio-leds";
115 240
116 led@1 { 241 led@1 {
117 label = "evmsk:green:usr0"; 242 label = "evmsk:green:usr0";
118 gpios = <&gpio1 4 0>; 243 gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
119 default-state = "off"; 244 default-state = "off";
120 }; 245 };
121 246
122 led@2 { 247 led@2 {
123 label = "evmsk:green:usr1"; 248 label = "evmsk:green:usr1";
124 gpios = <&gpio1 5 0>; 249 gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
125 default-state = "off"; 250 default-state = "off";
126 }; 251 };
127 252
128 led@3 { 253 led@3 {
129 label = "evmsk:green:mmc0"; 254 label = "evmsk:green:mmc0";
130 gpios = <&gpio1 6 0>; 255 gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
131 linux,default-trigger = "mmc0"; 256 linux,default-trigger = "mmc0";
132 default-state = "off"; 257 default-state = "off";
133 }; 258 };
134 259
135 led@4 { 260 led@4 {
136 label = "evmsk:green:heartbeat"; 261 label = "evmsk:green:heartbeat";
137 gpios = <&gpio1 7 0>; 262 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
138 linux,default-trigger = "heartbeat"; 263 linux,default-trigger = "heartbeat";
139 default-state = "off"; 264 default-state = "off";
140 }; 265 };
@@ -148,31 +273,38 @@
148 switch@1 { 273 switch@1 {
149 label = "button0"; 274 label = "button0";
150 linux,code = <0x100>; 275 linux,code = <0x100>;
151 gpios = <&gpio2 3 0>; 276 gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>;
152 }; 277 };
153 278
154 switch@2 { 279 switch@2 {
155 label = "button1"; 280 label = "button1";
156 linux,code = <0x101>; 281 linux,code = <0x101>;
157 gpios = <&gpio2 2 0>; 282 gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
158 }; 283 };
159 284
160 switch@3 { 285 switch@3 {
161 label = "button2"; 286 label = "button2";
162 linux,code = <0x102>; 287 linux,code = <0x102>;
163 gpios = <&gpio0 30 0>; 288 gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
164 gpio-key,wakeup; 289 gpio-key,wakeup;
165 }; 290 };
166 291
167 switch@4 { 292 switch@4 {
168 label = "button3"; 293 label = "button3";
169 linux,code = <0x103>; 294 linux,code = <0x103>;
170 gpios = <&gpio2 5 0>; 295 gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
171 }; 296 };
172 }; 297 };
298
299 backlight {
300 compatible = "pwm-backlight";
301 pwms = <&ecap2 0 50000 1>;
302 brightness-levels = <0 58 61 66 75 90 125 170 255>;
303 default-brightness-level = <8>;
304 };
173}; 305};
174 306
175/include/ "tps65910.dtsi" 307#include "tps65910.dtsi"
176 308
177&tps { 309&tps {
178 vcc1-supply = <&vbat>; 310 vcc1-supply = <&vbat>;
@@ -248,3 +380,15 @@
248 }; 380 };
249 }; 381 };
250}; 382};
383
384&mac {
385 pinctrl-names = "default", "sleep";
386 pinctrl-0 = <&cpsw_default>;
387 pinctrl-1 = <&cpsw_sleep>;
388};
389
390&davinci_mdio {
391 pinctrl-names = "default", "sleep";
392 pinctrl-0 = <&davinci_mdio_default>;
393 pinctrl-1 = <&davinci_mdio_sleep>;
394};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 1460d9b88adf..0d4df90477f7 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -8,26 +8,33 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "skeleton.dtsi" 11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/pinctrl/am33xx.h>
13
14#include "skeleton.dtsi"
12 15
13/ { 16/ {
14 compatible = "ti,am33xx"; 17 compatible = "ti,am33xx";
15 interrupt-parent = <&intc>; 18 interrupt-parent = <&intc>;
16 19
17 aliases { 20 aliases {
18 serial0 = &uart1; 21 serial0 = &uart0;
19 serial1 = &uart2; 22 serial1 = &uart1;
20 serial2 = &uart3; 23 serial2 = &uart2;
21 serial3 = &uart4; 24 serial3 = &uart3;
22 serial4 = &uart5; 25 serial4 = &uart4;
23 serial5 = &uart6; 26 serial5 = &uart5;
24 d_can0 = &dcan0; 27 d_can0 = &dcan0;
25 d_can1 = &dcan1; 28 d_can1 = &dcan1;
26 }; 29 };
27 30
28 cpus { 31 cpus {
32 #address-cells = <1>;
33 #size-cells = <0>;
29 cpu@0 { 34 cpu@0 {
30 compatible = "arm,cortex-a8"; 35 compatible = "arm,cortex-a8";
36 device_type = "cpu";
37 reg = <0>;
31 38
32 /* 39 /*
33 * To consider voltage drop between PMIC and SoC, 40 * To consider voltage drop between PMIC and SoC,
@@ -133,7 +140,7 @@
133 interrupts = <62>; 140 interrupts = <62>;
134 }; 141 };
135 142
136 uart1: serial@44e09000 { 143 uart0: serial@44e09000 {
137 compatible = "ti,omap3-uart"; 144 compatible = "ti,omap3-uart";
138 ti,hwmods = "uart1"; 145 ti,hwmods = "uart1";
139 clock-frequency = <48000000>; 146 clock-frequency = <48000000>;
@@ -142,7 +149,7 @@
142 status = "disabled"; 149 status = "disabled";
143 }; 150 };
144 151
145 uart2: serial@48022000 { 152 uart1: serial@48022000 {
146 compatible = "ti,omap3-uart"; 153 compatible = "ti,omap3-uart";
147 ti,hwmods = "uart2"; 154 ti,hwmods = "uart2";
148 clock-frequency = <48000000>; 155 clock-frequency = <48000000>;
@@ -151,7 +158,7 @@
151 status = "disabled"; 158 status = "disabled";
152 }; 159 };
153 160
154 uart3: serial@48024000 { 161 uart2: serial@48024000 {
155 compatible = "ti,omap3-uart"; 162 compatible = "ti,omap3-uart";
156 ti,hwmods = "uart3"; 163 ti,hwmods = "uart3";
157 clock-frequency = <48000000>; 164 clock-frequency = <48000000>;
@@ -160,7 +167,7 @@
160 status = "disabled"; 167 status = "disabled";
161 }; 168 };
162 169
163 uart4: serial@481a6000 { 170 uart3: serial@481a6000 {
164 compatible = "ti,omap3-uart"; 171 compatible = "ti,omap3-uart";
165 ti,hwmods = "uart4"; 172 ti,hwmods = "uart4";
166 clock-frequency = <48000000>; 173 clock-frequency = <48000000>;
@@ -169,7 +176,7 @@
169 status = "disabled"; 176 status = "disabled";
170 }; 177 };
171 178
172 uart5: serial@481a8000 { 179 uart4: serial@481a8000 {
173 compatible = "ti,omap3-uart"; 180 compatible = "ti,omap3-uart";
174 ti,hwmods = "uart5"; 181 ti,hwmods = "uart5";
175 clock-frequency = <48000000>; 182 clock-frequency = <48000000>;
@@ -178,7 +185,7 @@
178 status = "disabled"; 185 status = "disabled";
179 }; 186 };
180 187
181 uart6: serial@481aa000 { 188 uart5: serial@481aa000 {
182 compatible = "ti,omap3-uart"; 189 compatible = "ti,omap3-uart";
183 ti,hwmods = "uart6"; 190 ti,hwmods = "uart6";
184 clock-frequency = <48000000>; 191 clock-frequency = <48000000>;
@@ -343,6 +350,90 @@
343 ti,hwmods = "usb_otg_hs"; 350 ti,hwmods = "usb_otg_hs";
344 }; 351 };
345 352
353 epwmss0: epwmss@48300000 {
354 compatible = "ti,am33xx-pwmss";
355 reg = <0x48300000 0x10>;
356 ti,hwmods = "epwmss0";
357 #address-cells = <1>;
358 #size-cells = <1>;
359 status = "disabled";
360 ranges = <0x48300100 0x48300100 0x80 /* ECAP */
361 0x48300180 0x48300180 0x80 /* EQEP */
362 0x48300200 0x48300200 0x80>; /* EHRPWM */
363
364 ecap0: ecap@48300100 {
365 compatible = "ti,am33xx-ecap";
366 #pwm-cells = <3>;
367 reg = <0x48300100 0x80>;
368 ti,hwmods = "ecap0";
369 status = "disabled";
370 };
371
372 ehrpwm0: ehrpwm@48300200 {
373 compatible = "ti,am33xx-ehrpwm";
374 #pwm-cells = <3>;
375 reg = <0x48300200 0x80>;
376 ti,hwmods = "ehrpwm0";
377 status = "disabled";
378 };
379 };
380
381 epwmss1: epwmss@48302000 {
382 compatible = "ti,am33xx-pwmss";
383 reg = <0x48302000 0x10>;
384 ti,hwmods = "epwmss1";
385 #address-cells = <1>;
386 #size-cells = <1>;
387 status = "disabled";
388 ranges = <0x48302100 0x48302100 0x80 /* ECAP */
389 0x48302180 0x48302180 0x80 /* EQEP */
390 0x48302200 0x48302200 0x80>; /* EHRPWM */
391
392 ecap1: ecap@48302100 {
393 compatible = "ti,am33xx-ecap";
394 #pwm-cells = <3>;
395 reg = <0x48302100 0x80>;
396 ti,hwmods = "ecap1";
397 status = "disabled";
398 };
399
400 ehrpwm1: ehrpwm@48302200 {
401 compatible = "ti,am33xx-ehrpwm";
402 #pwm-cells = <3>;
403 reg = <0x48302200 0x80>;
404 ti,hwmods = "ehrpwm1";
405 status = "disabled";
406 };
407 };
408
409 epwmss2: epwmss@48304000 {
410 compatible = "ti,am33xx-pwmss";
411 reg = <0x48304000 0x10>;
412 ti,hwmods = "epwmss2";
413 #address-cells = <1>;
414 #size-cells = <1>;
415 status = "disabled";
416 ranges = <0x48304100 0x48304100 0x80 /* ECAP */
417 0x48304180 0x48304180 0x80 /* EQEP */
418 0x48304200 0x48304200 0x80>; /* EHRPWM */
419
420 ecap2: ecap@48304100 {
421 compatible = "ti,am33xx-ecap";
422 #pwm-cells = <3>;
423 reg = <0x48304100 0x80>;
424 ti,hwmods = "ecap2";
425 status = "disabled";
426 };
427
428 ehrpwm2: ehrpwm@48304200 {
429 compatible = "ti,am33xx-ehrpwm";
430 #pwm-cells = <3>;
431 reg = <0x48304200 0x80>;
432 ti,hwmods = "ehrpwm2";
433 status = "disabled";
434 };
435 };
436
346 mac: ethernet@4a100000 { 437 mac: ethernet@4a100000 {
347 compatible = "ti,cpsw"; 438 compatible = "ti,cpsw";
348 ti,hwmods = "cpgmac0"; 439 ti,hwmods = "cpgmac0";
@@ -394,7 +485,6 @@
394 compatible = "ti,am3352-ocmcram"; 485 compatible = "ti,am3352-ocmcram";
395 reg = <0x40300000 0x10000>; 486 reg = <0x40300000 0x10000>;
396 ti,hwmods = "ocmcram"; 487 ti,hwmods = "ocmcram";
397 ti,no_idle_on_suspend;
398 }; 488 };
399 489
400 wkup_m3: wkup_m3@44d00000 { 490 wkup_m3: wkup_m3@44d00000 {
@@ -404,13 +494,21 @@
404 ti,hwmods = "wkup_m3"; 494 ti,hwmods = "wkup_m3";
405 }; 495 };
406 496
497 elm: elm@48080000 {
498 compatible = "ti,am3352-elm";
499 reg = <0x48080000 0x2000>;
500 interrupts = <4>;
501 ti,hwmods = "elm";
502 status = "disabled";
503 };
504
407 gpmc: gpmc@50000000 { 505 gpmc: gpmc@50000000 {
408 compatible = "ti,am3352-gpmc"; 506 compatible = "ti,am3352-gpmc";
409 ti,hwmods = "gpmc"; 507 ti,hwmods = "gpmc";
410 reg = <0x50000000 0x2000>; 508 reg = <0x50000000 0x2000>;
411 interrupts = <100>; 509 interrupts = <100>;
412 num-cs = <7>; 510 gpmc,num-cs = <7>;
413 num-waitpins = <2>; 511 gpmc,num-waitpins = <2>;
414 #address-cells = <2>; 512 #address-cells = <2>;
415 #size-cells = <1>; 513 #size-cells = <1>;
416 status = "disabled"; 514 status = "disabled";
diff --git a/arch/arm/boot/dts/am3517-evm.dts b/arch/arm/boot/dts/am3517-evm.dts
index e9b5bdae4908..e99dfaf70052 100644
--- a/arch/arm/boot/dts/am3517-evm.dts
+++ b/arch/arm/boot/dts/am3517-evm.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI AM3517 EVM (AM3517/05)"; 13 model = "TI AM3517 EVM (AM3517/05)";
diff --git a/arch/arm/boot/dts/am3517_mt_ventoux.dts b/arch/arm/boot/dts/am3517_mt_ventoux.dts
index 556868388a23..fdf5ce63c8e6 100644
--- a/arch/arm/boot/dts/am3517_mt_ventoux.dts
+++ b/arch/arm/boot/dts/am3517_mt_ventoux.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11 11
12/ { 12/ {
13 model = "TeeJet Mt.Ventoux"; 13 model = "TeeJet Mt.Ventoux";
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
new file mode 100644
index 000000000000..ddc1df77ac52
--- /dev/null
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -0,0 +1,68 @@
1/*
2 * Device Tree Source for AM4372 SoC
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#include <dt-bindings/interrupt-controller/arm-gic.h>
12
13#include "skeleton.dtsi"
14
15/ {
16 compatible = "ti,am4372", "ti,am43";
17 interrupt-parent = <&gic>;
18
19
20 aliases {
21 serial0 = &uart0;
22 };
23
24 cpus {
25 cpu@0 {
26 compatible = "arm,cortex-a9";
27 };
28 };
29
30 gic: interrupt-controller@48241000 {
31 compatible = "arm,cortex-a9-gic";
32 interrupt-controller;
33 #interrupt-cells = <3>;
34 reg = <0x48241000 0x1000>,
35 <0x48240100 0x0100>;
36 };
37
38 ocp {
39 compatible = "simple-bus";
40 #address-cells = <1>;
41 #size-cells = <1>;
42 ranges;
43
44 uart0: serial@44e09000 {
45 compatible = "ti,am4372-uart","ti,omap2-uart";
46 reg = <0x44e09000 0x2000>;
47 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
48 };
49
50 timer1: timer@44e31000 {
51 compatible = "ti,am4372-timer-1ms","ti,am335x-timer-1ms";
52 reg = <0x44e31000 0x400>;
53 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
54 ti,timer-alwon;
55 };
56
57 timer2: timer@48040000 {
58 compatible = "ti,am4372-timer","ti,am335x-timer";
59 reg = <0x48040000 0x400>;
60 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
61 };
62
63 counter32k: counter@44e86000 {
64 compatible = "ti,am4372-counter32k","ti,omap-counter32k";
65 reg = <0x44e86000 0x40>;
66 };
67 };
68};
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts
new file mode 100644
index 000000000000..74174d48f476
--- /dev/null
+++ b/arch/arm/boot/dts/am43x-epos-evm.dts
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/* AM43x EPOS EVM */
10
11/dts-v1/;
12
13#include "am4372.dtsi"
14
15/ {
16 model = "TI AM43x EPOS EVM";
17 compatible = "ti,am43x-epos-evm","ti,am4372","ti,am43";
18};
diff --git a/arch/arm/boot/dts/animeo_ip.dts b/arch/arm/boot/dts/animeo_ip.dts
index 5160210f74da..3a1de9eb5111 100644
--- a/arch/arm/boot/dts/animeo_ip.dts
+++ b/arch/arm/boot/dts/animeo_ip.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9260.dtsi" 10#include "at91sam9260.dtsi"
11 11
12/ { 12/ {
13 model = "Somfy Animeo IP"; 13 model = "Somfy Animeo IP";
@@ -123,7 +123,7 @@
123 123
124 usb0: ohci@00500000 { 124 usb0: ohci@00500000 {
125 num-ports = <2>; 125 num-ports = <2>;
126 atmel,vbus-gpio = <&pioB 15 1>; 126 atmel,vbus-gpio = <&pioB 15 GPIO_ACTIVE_LOW>;
127 status = "okay"; 127 status = "okay";
128 }; 128 };
129 }; 129 };
@@ -133,23 +133,23 @@
133 133
134 power_green { 134 power_green {
135 label = "power_green"; 135 label = "power_green";
136 gpios = <&pioC 17 0>; 136 gpios = <&pioC 17 GPIO_ACTIVE_HIGH>;
137 linux,default-trigger = "heartbeat"; 137 linux,default-trigger = "heartbeat";
138 }; 138 };
139 139
140 power_red { 140 power_red {
141 label = "power_red"; 141 label = "power_red";
142 gpios = <&pioA 2 0>; 142 gpios = <&pioA 2 GPIO_ACTIVE_HIGH>;
143 }; 143 };
144 144
145 tx_green { 145 tx_green {
146 label = "tx_green"; 146 label = "tx_green";
147 gpios = <&pioC 19 0>; 147 gpios = <&pioC 19 GPIO_ACTIVE_HIGH>;
148 }; 148 };
149 149
150 tx_red { 150 tx_red {
151 label = "tx_red"; 151 label = "tx_red";
152 gpios = <&pioC 18 0>; 152 gpios = <&pioC 18 GPIO_ACTIVE_HIGH>;
153 }; 153 };
154 }; 154 };
155 155
@@ -160,21 +160,21 @@
160 160
161 keyswitch_in { 161 keyswitch_in {
162 label = "keyswitch_in"; 162 label = "keyswitch_in";
163 gpios = <&pioB 1 0>; 163 gpios = <&pioB 1 GPIO_ACTIVE_HIGH>;
164 linux,code = <28>; 164 linux,code = <28>;
165 gpio-key,wakeup; 165 gpio-key,wakeup;
166 }; 166 };
167 167
168 error_in { 168 error_in {
169 label = "error_in"; 169 label = "error_in";
170 gpios = <&pioB 2 0>; 170 gpios = <&pioB 2 GPIO_ACTIVE_HIGH>;
171 linux,code = <29>; 171 linux,code = <29>;
172 gpio-key,wakeup; 172 gpio-key,wakeup;
173 }; 173 };
174 174
175 btn { 175 btn {
176 label = "btn"; 176 label = "btn";
177 gpios = <&pioC 23 0>; 177 gpios = <&pioC 23 GPIO_ACTIVE_HIGH>;
178 linux,code = <31>; 178 linux,code = <31>;
179 gpio-key,wakeup; 179 gpio-key,wakeup;
180 }; 180 };
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 2353b1f13704..beee1699d49e 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -74,6 +74,7 @@
74 */ 74 */
75 status = "disabled"; 75 status = "disabled";
76 /* No CD or WP GPIOs */ 76 /* No CD or WP GPIOs */
77 broken-cd;
77 }; 78 };
78 79
79 usb@50000 { 80 usb@50000 {
diff --git a/arch/arm/boot/dts/armada-370-mirabox.dts b/arch/arm/boot/dts/armada-370-mirabox.dts
index 14e36e19d515..45b107763e3b 100644
--- a/arch/arm/boot/dts/armada-370-mirabox.dts
+++ b/arch/arm/boot/dts/armada-370-mirabox.dts
@@ -99,6 +99,7 @@
99 * No CD or WP GPIOs: SDIO interface used for 99 * No CD or WP GPIOs: SDIO interface used for
100 * Wifi/Bluetooth chip 100 * Wifi/Bluetooth chip
101 */ 101 */
102 broken-cd;
102 }; 103 };
103 104
104 usb@50000 { 105 usb@50000 {
diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index 130f8390a7e4..a3a2fedb8726 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -64,6 +64,7 @@
64 pinctrl-names = "default"; 64 pinctrl-names = "default";
65 status = "okay"; 65 status = "okay";
66 /* No CD or WP GPIOs */ 66 /* No CD or WP GPIOs */
67 broken-cd;
67 }; 68 };
68 69
69 usb@50000 { 70 usb@50000 {
@@ -84,6 +85,22 @@
84 gpios = <&gpio0 6 1>; 85 gpios = <&gpio0 6 1>;
85 }; 86 };
86 }; 87 };
88
89 pcie-controller {
90 status = "okay";
91
92 /* Internal mini-PCIe connector */
93 pcie@1,0 {
94 /* Port 0, Lane 0 */
95 status = "okay";
96 };
97
98 /* Internal mini-PCIe connector */
99 pcie@2,0 {
100 /* Port 1, Lane 0 */
101 status = "okay";
102 };
103 };
87 }; 104 };
88 }; 105 };
89 }; 106 };
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
index 550eb772c30e..90b117624abb 100644
--- a/arch/arm/boot/dts/armada-370-xp.dtsi
+++ b/arch/arm/boot/dts/armada-370-xp.dtsi
@@ -22,9 +22,18 @@
22 model = "Marvell Armada 370 and XP SoC"; 22 model = "Marvell Armada 370 and XP SoC";
23 compatible = "marvell,armada-370-xp"; 23 compatible = "marvell,armada-370-xp";
24 24
25 aliases {
26 eth0 = &eth0;
27 eth1 = &eth1;
28 };
29
25 cpus { 30 cpus {
31 #address-cells = <1>;
32 #size-cells = <0>;
26 cpu@0 { 33 cpu@0 {
27 compatible = "marvell,sheeva-v7"; 34 compatible = "marvell,sheeva-v7";
35 device_type = "cpu";
36 reg = <0>;
28 }; 37 };
29 }; 38 };
30 39
@@ -80,7 +89,7 @@
80 89
81 sata@a0000 { 90 sata@a0000 {
82 compatible = "marvell,orion-sata"; 91 compatible = "marvell,orion-sata";
83 reg = <0xa0000 0x2400>; 92 reg = <0xa0000 0x5000>;
84 interrupts = <55>; 93 interrupts = <55>;
85 clocks = <&gateclk 15>, <&gateclk 30>; 94 clocks = <&gateclk 15>, <&gateclk 30>;
86 clock-names = "0", "1"; 95 clock-names = "0", "1";
@@ -94,17 +103,17 @@
94 reg = <0x72004 0x4>; 103 reg = <0x72004 0x4>;
95 }; 104 };
96 105
97 ethernet@70000 { 106 eth0: ethernet@70000 {
98 compatible = "marvell,armada-370-neta"; 107 compatible = "marvell,armada-370-neta";
99 reg = <0x70000 0x2500>; 108 reg = <0x70000 0x4000>;
100 interrupts = <8>; 109 interrupts = <8>;
101 clocks = <&gateclk 4>; 110 clocks = <&gateclk 4>;
102 status = "disabled"; 111 status = "disabled";
103 }; 112 };
104 113
105 ethernet@74000 { 114 eth1: ethernet@74000 {
106 compatible = "marvell,armada-370-neta"; 115 compatible = "marvell,armada-370-neta";
107 reg = <0x74000 0x2500>; 116 reg = <0x74000 0x4000>;
108 interrupts = <10>; 117 interrupts = <10>;
109 clocks = <&gateclk 3>; 118 clocks = <&gateclk 3>;
110 status = "disabled"; 119 status = "disabled";
@@ -143,6 +152,10 @@
143 reg = <0xd4000 0x200>; 152 reg = <0xd4000 0x200>;
144 interrupts = <54>; 153 interrupts = <54>;
145 clocks = <&gateclk 17>; 154 clocks = <&gateclk 17>;
155 bus-width = <4>;
156 cap-sdio-irq;
157 cap-sd-highspeed;
158 cap-mmc-highspeed;
146 status = "disabled"; 159 status = "disabled";
147 }; 160 };
148 161
diff --git a/arch/arm/boot/dts/armada-370.dtsi b/arch/arm/boot/dts/armada-370.dtsi
index aee2b1866ce2..fa3dfc6b4c6a 100644
--- a/arch/arm/boot/dts/armada-370.dtsi
+++ b/arch/arm/boot/dts/armada-370.dtsi
@@ -180,10 +180,6 @@
180 180
181 bus-range = <0x00 0xff>; 181 bus-range = <0x00 0xff>;
182 182
183 reg = <0x40000 0x2000>, <0x80000 0x2000>;
184
185 reg-names = "pcie0.0", "pcie1.0";
186
187 ranges = <0x82000000 0 0x40000 0x40000 0 0x00002000 /* Port 0.0 registers */ 183 ranges = <0x82000000 0 0x40000 0x40000 0 0x00002000 /* Port 0.0 registers */
188 0x82000000 0 0x80000 0x80000 0 0x00002000 /* Port 1.0 registers */ 184 0x82000000 0 0x80000 0x80000 0 0x00002000 /* Port 1.0 registers */
189 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */ 185 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts
index d6cc8bf8272e..e28e68ff864d 100644
--- a/arch/arm/boot/dts/armada-xp-db.dts
+++ b/arch/arm/boot/dts/armada-xp-db.dts
@@ -30,6 +30,10 @@
30 }; 30 };
31 31
32 soc { 32 soc {
33 ranges = <0 0 0xd0000000 0x100000 /* Internal registers 1MiB */
34 0xe0000000 0 0xe0000000 0x8100000 /* PCIe */
35 0xf0000000 0 0xf0000000 0x1000000>; /* Device Bus, NOR 16MiB */
36
33 internal-regs { 37 internal-regs {
34 serial@12000 { 38 serial@12000 {
35 clock-frequency = <250000000>; 39 clock-frequency = <250000000>;
@@ -97,6 +101,7 @@
97 pinctrl-names = "default"; 101 pinctrl-names = "default";
98 status = "okay"; 102 status = "okay";
99 /* No CD or WP GPIOs */ 103 /* No CD or WP GPIOs */
104 broken-cd;
100 }; 105 };
101 106
102 usb@50000 { 107 usb@50000 {
@@ -155,6 +160,35 @@
155 status = "okay"; 160 status = "okay";
156 }; 161 };
157 }; 162 };
163
164 devbus-bootcs@10400 {
165 status = "okay";
166 ranges = <0 0xf0000000 0x1000000>;
167
168 /* Device Bus parameters are required */
169
170 /* Read parameters */
171 devbus,bus-width = <8>;
172 devbus,turn-off-ps = <60000>;
173 devbus,badr-skew-ps = <0>;
174 devbus,acc-first-ps = <124000>;
175 devbus,acc-next-ps = <248000>;
176 devbus,rd-setup-ps = <0>;
177 devbus,rd-hold-ps = <0>;
178
179 /* Write parameters */
180 devbus,sync-enable = <0>;
181 devbus,wr-high-ps = <60000>;
182 devbus,wr-low-ps = <60000>;
183 devbus,ale-wr-ps = <60000>;
184
185 /* NOR 16 MiB */
186 nor@0 {
187 compatible = "cfi-flash";
188 reg = <0 0x1000000>;
189 bank-width = <2>;
190 };
191 };
158 }; 192 };
159 }; 193 };
160}; 194};
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts
index 3ee63d128e27..c87b2de29c30 100644
--- a/arch/arm/boot/dts/armada-xp-gp.dts
+++ b/arch/arm/boot/dts/armada-xp-gp.dts
@@ -39,8 +39,9 @@
39 }; 39 };
40 40
41 soc { 41 soc {
42 ranges = <0 0 0xd0000000 0x100000 42 ranges = <0 0 0xd0000000 0x100000 /* Internal registers 1MiB */
43 0xf0000000 0 0xf0000000 0x1000000>; 43 0xe0000000 0 0xe0000000 0x8100000 /* PCIe */
44 0xf0000000 0 0xf0000000 0x1000000 /* Device Bus, NOR 16MiB */>;
44 45
45 internal-regs { 46 internal-regs {
46 serial@12000 { 47 serial@12000 {
@@ -104,6 +105,16 @@
104 phy-mode = "rgmii-id"; 105 phy-mode = "rgmii-id";
105 }; 106 };
106 107
108 /* Front-side USB slot */
109 usb@50000 {
110 status = "okay";
111 };
112
113 /* Back-side USB slot */
114 usb@51000 {
115 status = "okay";
116 };
117
107 spi0: spi@10600 { 118 spi0: spi@10600 {
108 status = "okay"; 119 status = "okay";
109 120
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
index f4029f015aff..2d9335da210c 100644
--- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi
@@ -92,7 +92,7 @@
92 92
93 ethernet@34000 { 93 ethernet@34000 {
94 compatible = "marvell,armada-370-neta"; 94 compatible = "marvell,armada-370-neta";
95 reg = <0x34000 0x2500>; 95 reg = <0x34000 0x4000>;
96 interrupts = <14>; 96 interrupts = <14>;
97 clocks = <&gateclk 1>; 97 clocks = <&gateclk 1>;
98 status = "disabled"; 98 status = "disabled";
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
index 6ab56bd35de9..c7b1f4d5c1c7 100644
--- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi
+++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi
@@ -23,6 +23,7 @@
23 gpio0 = &gpio0; 23 gpio0 = &gpio0;
24 gpio1 = &gpio1; 24 gpio1 = &gpio1;
25 gpio2 = &gpio2; 25 gpio2 = &gpio2;
26 eth3 = &eth3;
26 }; 27 };
27 28
28 29
@@ -105,9 +106,9 @@
105 interrupts = <91>; 106 interrupts = <91>;
106 }; 107 };
107 108
108 ethernet@34000 { 109 eth3: ethernet@34000 {
109 compatible = "marvell,armada-370-neta"; 110 compatible = "marvell,armada-370-neta";
110 reg = <0x34000 0x2500>; 111 reg = <0x34000 0x4000>;
111 interrupts = <14>; 112 interrupts = <14>;
112 clocks = <&gateclk 1>; 113 clocks = <&gateclk 1>;
113 status = "disabled"; 114 status = "disabled";
diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
index 46b785064dd8..8f510458ea86 100644
--- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts
@@ -27,8 +27,9 @@
27 }; 27 };
28 28
29 soc { 29 soc {
30 ranges = <0 0 0xd0000000 0x100000 30 ranges = <0 0 0xd0000000 0x100000 /* Internal registers 1MiB */
31 0xf0000000 0 0xf0000000 0x8000000>; 31 0xe0000000 0 0xe0000000 0x8100000 /* PCIe */
32 0xf0000000 0 0xf0000000 0x8000000 /* Device Bus, NOR 128MiB */>;
32 33
33 internal-regs { 34 internal-regs {
34 serial@12000 { 35 serial@12000 {
@@ -137,13 +138,22 @@
137 nr-ports = <2>; 138 nr-ports = <2>;
138 status = "okay"; 139 status = "okay";
139 }; 140 };
141
142 /* Front side USB 0 */
140 usb@50000 { 143 usb@50000 {
141 status = "okay"; 144 status = "okay";
142 }; 145 };
146
147 /* Front side USB 1 */
143 usb@51000 { 148 usb@51000 {
144 status = "okay"; 149 status = "okay";
145 }; 150 };
146 151
152 /* USB interface in the mini-PCIe connector */
153 usb@52000 {
154 status = "okay";
155 };
156
147 devbus-bootcs@10400 { 157 devbus-bootcs@10400 {
148 status = "okay"; 158 status = "okay";
149 ranges = <0 0xf0000000 0x8000000>; /* @addr 0xf000000, size 0x8000000 */ 159 ranges = <0 0xf0000000 0x8000000>; /* @addr 0xf000000, size 0x8000000 */
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi
index 5b902f9a3af2..416eb9481844 100644
--- a/arch/arm/boot/dts/armada-xp.dtsi
+++ b/arch/arm/boot/dts/armada-xp.dtsi
@@ -22,6 +22,10 @@
22 model = "Marvell Armada XP family SoC"; 22 model = "Marvell Armada XP family SoC";
23 compatible = "marvell,armadaxp", "marvell,armada-370-xp"; 23 compatible = "marvell,armadaxp", "marvell,armada-370-xp";
24 24
25 aliases {
26 eth2 = &eth2;
27 };
28
25 soc { 29 soc {
26 internal-regs { 30 internal-regs {
27 L2: l2-cache { 31 L2: l2-cache {
@@ -86,9 +90,9 @@
86 reg = <0x18200 0x500>; 90 reg = <0x18200 0x500>;
87 }; 91 };
88 92
89 ethernet@30000 { 93 eth2: ethernet@30000 {
90 compatible = "marvell,armada-370-neta"; 94 compatible = "marvell,armada-370-neta";
91 reg = <0x30000 0x2500>; 95 reg = <0x30000 0x4000>;
92 interrupts = <12>; 96 interrupts = <12>;
93 clocks = <&gateclk 2>; 97 clocks = <&gateclk 2>;
94 status = "disabled"; 98 status = "disabled";
diff --git a/arch/arm/boot/dts/at91-ariag25.dts b/arch/arm/boot/dts/at91-ariag25.dts
index c7aebba4e8e7..cce45f5177f9 100644
--- a/arch/arm/boot/dts/at91-ariag25.dts
+++ b/arch/arm/boot/dts/at91-ariag25.dts
@@ -7,7 +7,7 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9g25.dtsi" 10#include "at91sam9g25.dtsi"
11 11
12/ { 12/ {
13 model = "Acme Systems Aria G25"; 13 model = "Acme Systems Aria G25";
@@ -21,6 +21,7 @@
21 serial3 = &usart2; 21 serial3 = &usart2;
22 serial4 = &usart3; 22 serial4 = &usart3;
23 serial5 = &uart0; 23 serial5 = &uart0;
24 serial6 = &uart1;
24 }; 25 };
25 26
26 chosen { 27 chosen {
@@ -112,13 +113,17 @@
112 status = "okay"; 113 status = "okay";
113 }; 114 };
114 115
116 /*
117 * UART0/1 pins are marked as GPIO on
118 * Aria documentation.
119 * Change to "okay" if you need additional serial ports
120 */
115 uart0: serial@f8040000 { 121 uart0: serial@f8040000 {
116 compatible = "atmel,at91sam9260-usart"; 122 status = "disabled";
117 reg = <0xf8040000 0x200>; 123 };
118 interrupts = <15 4 5>; 124
119 pinctrl-names = "default"; 125 uart1: serial@f8044000 {
120 pinctrl-0 = <&pinctrl_uart0>; 126 status = "disabled";
121 status = "okay";
122 }; 127 };
123 128
124 adc0: adc@f804c000 { 129 adc0: adc@f804c000 {
@@ -138,6 +143,10 @@
138 }; 143 };
139 }; 144 };
140 }; 145 };
146
147 rtc@fffffeb0 {
148 status = "okay";
149 };
141 }; 150 };
142 151
143 usb0: ohci@00600000 { 152 usb0: ohci@00600000 {
@@ -156,7 +165,7 @@
156 /* little green LED in middle of Aria G25 module */ 165 /* little green LED in middle of Aria G25 module */
157 aria_led { 166 aria_led {
158 label = "aria_led"; 167 label = "aria_led";
159 gpios = <&pioB 8 0>; /* PB8 */ 168 gpios = <&pioB 8 GPIO_ACTIVE_HIGH>; /* PB8 */
160 linux,default-trigger = "heartbeat"; 169 linux,default-trigger = "heartbeat";
161 }; 170 };
162 171
@@ -164,7 +173,7 @@
164 173
165 onewire@0 { 174 onewire@0 {
166 compatible = "w1-gpio"; 175 compatible = "w1-gpio";
167 gpios = <&pioA 21 1>; 176 gpios = <&pioA 21 GPIO_ACTIVE_LOW>;
168 pinctrl-names = "default"; 177 pinctrl-names = "default";
169 pinctrl-0 = <&pinctrl_w1_0>; 178 pinctrl-0 = <&pinctrl_w1_0>;
170 }; 179 };
diff --git a/arch/arm/boot/dts/at91-foxg20.dts b/arch/arm/boot/dts/at91-foxg20.dts
new file mode 100644
index 000000000000..cbe967343997
--- /dev/null
+++ b/arch/arm/boot/dts/at91-foxg20.dts
@@ -0,0 +1,157 @@
1/*
2 * at91-foxg20.dts - Device Tree file for Acme Systems FoxG20 board
3 *
4 * Based on DT files for at91sam9g20ek evaluation board (AT91SAM9G20 SoC)
5 *
6 * Copyright (C) 2013 Douglas Gilbert <dgilbert@interlog.com>
7 *
8 * Licensed under GPLv2 or later.
9 */
10/dts-v1/;
11#include "at91sam9g20.dtsi"
12
13/ {
14 model = "Acme Systems FoxG20";
15 compatible = "acme,foxg20", "atmel,at91sam9g20", "atmel,at91sam9";
16
17 chosen {
18 bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait";
19 };
20
21 memory {
22 reg = <0x20000000 0x4000000>;
23 };
24
25 clocks {
26 #address-cells = <1>;
27 #size-cells = <1>;
28 ranges;
29
30 main_clock: clock@0 {
31 compatible = "atmel,osc", "fixed-clock";
32 clock-frequency = <18432000>;
33 };
34 };
35
36 ahb {
37 apb {
38 usb1: gadget@fffa4000 {
39 atmel,vbus-gpio = <&pioC 6 GPIO_ACTIVE_HIGH>;
40 status = "okay";
41 };
42
43 mmc0: mmc@fffa8000 {
44 pinctrl-0 = <
45 &pinctrl_mmc0_clk
46 &pinctrl_mmc0_slot1_cmd_dat0
47 &pinctrl_mmc0_slot1_dat1_3>;
48 status = "okay";
49
50 slot@1 {
51 reg = <1>;
52 bus-width = <4>;
53 };
54 };
55
56 usart0: serial@fffb0000 {
57 pinctrl-0 =
58 <&pinctrl_usart0
59 &pinctrl_usart0_rts
60 &pinctrl_usart0_cts
61 >;
62 status = "okay";
63 };
64
65 usart1: serial@fffb4000 {
66 status = "okay";
67 };
68
69 usart2: serial@fffb8000 {
70 status = "okay";
71 };
72
73 macb0: ethernet@fffc4000 {
74 phy-mode = "rmii";
75 status = "okay";
76 };
77
78 usart3: serial@fffd0000 {
79 status = "okay";
80 };
81
82 uart0: serial@fffd4000 {
83 status = "okay";
84 };
85
86 uart1: serial@fffd8000 {
87 status = "okay";
88 };
89
90 dbgu: serial@fffff200 {
91 status = "okay";
92 };
93
94 pinctrl@fffff400 {
95 board {
96 pinctrl_pck0_as_mck: pck0_as_mck {
97 atmel,pins =
98 <AT91_PIOC 1 AT91_PERIPH_B AT91_PINCTRL_NONE>;
99 };
100 };
101
102 mmc0_slot1 {
103 pinctrl_board_mmc0_slot1: mmc0_slot1-board {
104 atmel,pins =
105 <AT91_PIOC 9 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* CD pin */
106 };
107 };
108
109 i2c0 {
110 pinctrl_i2c0: i2c0-0 {
111 atmel,pins =
112 <AT91_PIOA 23 AT91_PERIPH_A AT91_PINCTRL_MULTI_DRIVE /* TWD (SDA), open drain */
113 AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_MULTI_DRIVE>; /* TWCK (SCL), open drain */
114 };
115 };
116 };
117
118 watchdog@fffffd40 {
119 status = "okay";
120 };
121 };
122
123 usb0: ohci@00500000 {
124 num-ports = <2>;
125 status = "okay";
126 };
127 };
128
129 i2c@0 {
130 pinctrl-names = "default";
131 pinctrl-0 = <&pinctrl_i2c0>;
132 i2c-gpio,delay-us = <5>; /* ~85 kHz */
133 status = "okay";
134 };
135
136 leds {
137 compatible = "gpio-leds";
138
139 /* red LED marked "PC7" near mini USB (device) receptacle */
140 user_led {
141 label = "user_led";
142 gpios = <&pioC 7 GPIO_ACTIVE_HIGH>; /* PC7 */
143 linux,default-trigger = "heartbeat";
144 };
145 };
146
147 gpio_keys {
148 compatible = "gpio-keys";
149
150 btn {
151 label = "Button";
152 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;
153 linux,code = <0x103>;
154 gpio-key,wakeup;
155 };
156 };
157};
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
index 5d3ed5aafc69..92b9e21389db 100644
--- a/arch/arm/boot/dts/at91rm9200.dtsi
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -10,7 +10,10 @@
10 * Licensed under GPLv2 or later. 10 * Licensed under GPLv2 or later.
11 */ 11 */
12 12
13/include/ "skeleton.dtsi" 13#include "skeleton.dtsi"
14#include <dt-bindings/pinctrl/at91.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/gpio/gpio.h>
14 17
15/ { 18/ {
16 model = "Atmel AT91RM9200 family SoC"; 19 model = "Atmel AT91RM9200 family SoC";
@@ -35,8 +38,12 @@
35 ssc2 = &ssc2; 38 ssc2 = &ssc2;
36 }; 39 };
37 cpus { 40 cpus {
38 cpu@0 { 41 #address-cells = <0>;
42 #size-cells = <0>;
43
44 cpu {
39 compatible = "arm,arm920t"; 45 compatible = "arm,arm920t";
46 device_type = "cpu";
40 }; 47 };
41 }; 48 };
42 49
@@ -77,25 +84,29 @@
77 st: timer@fffffd00 { 84 st: timer@fffffd00 {
78 compatible = "atmel,at91rm9200-st"; 85 compatible = "atmel,at91rm9200-st";
79 reg = <0xfffffd00 0x100>; 86 reg = <0xfffffd00 0x100>;
80 interrupts = <1 4 7>; 87 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
81 }; 88 };
82 89
83 tcb0: timer@fffa0000 { 90 tcb0: timer@fffa0000 {
84 compatible = "atmel,at91rm9200-tcb"; 91 compatible = "atmel,at91rm9200-tcb";
85 reg = <0xfffa0000 0x100>; 92 reg = <0xfffa0000 0x100>;
86 interrupts = <17 4 0 18 4 0 19 4 0>; 93 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
94 18 IRQ_TYPE_LEVEL_HIGH 0
95 19 IRQ_TYPE_LEVEL_HIGH 0>;
87 }; 96 };
88 97
89 tcb1: timer@fffa4000 { 98 tcb1: timer@fffa4000 {
90 compatible = "atmel,at91rm9200-tcb"; 99 compatible = "atmel,at91rm9200-tcb";
91 reg = <0xfffa4000 0x100>; 100 reg = <0xfffa4000 0x100>;
92 interrupts = <20 4 0 21 4 0 22 4 0>; 101 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0
102 21 IRQ_TYPE_LEVEL_HIGH 0
103 22 IRQ_TYPE_LEVEL_HIGH 0>;
93 }; 104 };
94 105
95 i2c0: i2c@fffb8000 { 106 i2c0: i2c@fffb8000 {
96 compatible = "atmel,at91rm9200-i2c"; 107 compatible = "atmel,at91rm9200-i2c";
97 reg = <0xfffb8000 0x4000>; 108 reg = <0xfffb8000 0x4000>;
98 interrupts = <12 4 6>; 109 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>;
99 pinctrl-names = "default"; 110 pinctrl-names = "default";
100 pinctrl-0 = <&pinctrl_twi>; 111 pinctrl-0 = <&pinctrl_twi>;
101 #address-cells = <1>; 112 #address-cells = <1>;
@@ -106,7 +117,7 @@
106 mmc0: mmc@fffb4000 { 117 mmc0: mmc@fffb4000 {
107 compatible = "atmel,hsmci"; 118 compatible = "atmel,hsmci";
108 reg = <0xfffb4000 0x4000>; 119 reg = <0xfffb4000 0x4000>;
109 interrupts = <10 4 0>; 120 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
110 #address-cells = <1>; 121 #address-cells = <1>;
111 #size-cells = <0>; 122 #size-cells = <0>;
112 status = "disabled"; 123 status = "disabled";
@@ -115,7 +126,7 @@
115 ssc0: ssc@fffd0000 { 126 ssc0: ssc@fffd0000 {
116 compatible = "atmel,at91rm9200-ssc"; 127 compatible = "atmel,at91rm9200-ssc";
117 reg = <0xfffd0000 0x4000>; 128 reg = <0xfffd0000 0x4000>;
118 interrupts = <14 4 5>; 129 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
119 pinctrl-names = "default"; 130 pinctrl-names = "default";
120 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 131 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
121 status = "disable"; 132 status = "disable";
@@ -124,7 +135,7 @@
124 ssc1: ssc@fffd4000 { 135 ssc1: ssc@fffd4000 {
125 compatible = "atmel,at91rm9200-ssc"; 136 compatible = "atmel,at91rm9200-ssc";
126 reg = <0xfffd4000 0x4000>; 137 reg = <0xfffd4000 0x4000>;
127 interrupts = <15 4 5>; 138 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
128 pinctrl-names = "default"; 139 pinctrl-names = "default";
129 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 140 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
130 status = "disable"; 141 status = "disable";
@@ -133,7 +144,7 @@
133 ssc2: ssc@fffd8000 { 144 ssc2: ssc@fffd8000 {
134 compatible = "atmel,at91rm9200-ssc"; 145 compatible = "atmel,at91rm9200-ssc";
135 reg = <0xfffd8000 0x4000>; 146 reg = <0xfffd8000 0x4000>;
136 interrupts = <16 4 5>; 147 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
137 pinctrl-names = "default"; 148 pinctrl-names = "default";
138 pinctrl-0 = <&pinctrl_ssc2_tx &pinctrl_ssc2_rx>; 149 pinctrl-0 = <&pinctrl_ssc2_tx &pinctrl_ssc2_rx>;
139 status = "disable"; 150 status = "disable";
@@ -142,7 +153,7 @@
142 macb0: ethernet@fffbc000 { 153 macb0: ethernet@fffbc000 {
143 compatible = "cdns,at91rm9200-emac", "cdns,emac"; 154 compatible = "cdns,at91rm9200-emac", "cdns,emac";
144 reg = <0xfffbc000 0x4000>; 155 reg = <0xfffbc000 0x4000>;
145 interrupts = <24 4 3>; 156 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
146 phy-mode = "rmii"; 157 phy-mode = "rmii";
147 pinctrl-names = "default"; 158 pinctrl-names = "default";
148 pinctrl-0 = <&pinctrl_macb_rmii>; 159 pinctrl-0 = <&pinctrl_macb_rmii>;
@@ -167,234 +178,319 @@
167 dbgu { 178 dbgu {
168 pinctrl_dbgu: dbgu-0 { 179 pinctrl_dbgu: dbgu-0 {
169 atmel,pins = 180 atmel,pins =
170 <0 30 0x1 0x0 /* PA30 periph A */ 181 <AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA30 periph A */
171 0 31 0x1 0x1>; /* PA31 periph with pullup */ 182 AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA31 periph with pullup */
172 }; 183 };
173 }; 184 };
174 185
175 uart0 { 186 uart0 {
176 pinctrl_uart0: uart0-0 { 187 pinctrl_uart0: uart0-0 {
177 atmel,pins = 188 atmel,pins =
178 <0 17 0x1 0x0 /* PA17 periph A */ 189 <AT91_PIOA 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA17 periph A */
179 0 18 0x1 0x0>; /* PA18 periph A */ 190 AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA18 periph A */
180 }; 191 };
181 192
182 pinctrl_uart0_rts: uart0_rts-0 { 193 pinctrl_uart0_rts: uart0_rts-0 {
183 atmel,pins = 194 atmel,pins =
184 <0 20 0x1 0x0>; /* PA20 periph A */ 195 <AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA20 periph A */
185 }; 196 };
186 197
187 pinctrl_uart0_cts: uart0_cts-0 { 198 pinctrl_uart0_cts: uart0_cts-0 {
188 atmel,pins = 199 atmel,pins =
189 <0 21 0x1 0x0>; /* PA21 periph A */ 200 <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA21 periph A */
190 }; 201 };
191 }; 202 };
192 203
193 uart1 { 204 uart1 {
194 pinctrl_uart1: uart1-0 { 205 pinctrl_uart1: uart1-0 {
195 atmel,pins = 206 atmel,pins =
196 <1 20 0x1 0x1 /* PB20 periph A with pullup */ 207 <AT91_PIOB 20 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB20 periph A with pullup */
197 1 21 0x1 0x0>; /* PB21 periph A */ 208 AT91_PIOB 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB21 periph A */
198 }; 209 };
199 210
200 pinctrl_uart1_rts: uart1_rts-0 { 211 pinctrl_uart1_rts: uart1_rts-0 {
201 atmel,pins = 212 atmel,pins =
202 <1 24 0x1 0x0>; /* PB24 periph A */ 213 <AT91_PIOB 24 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB24 periph A */
203 }; 214 };
204 215
205 pinctrl_uart1_cts: uart1_cts-0 { 216 pinctrl_uart1_cts: uart1_cts-0 {
206 atmel,pins = 217 atmel,pins =
207 <1 26 0x1 0x0>; /* PB26 periph A */ 218 <AT91_PIOB 26 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB26 periph A */
208 }; 219 };
209 220
210 pinctrl_uart1_dtr_dsr: uart1_dtr_dsr-0 { 221 pinctrl_uart1_dtr_dsr: uart1_dtr_dsr-0 {
211 atmel,pins = 222 atmel,pins =
212 <1 19 0x1 0x0 /* PB19 periph A */ 223 <AT91_PIOB 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB19 periph A */
213 1 25 0x1 0x0>; /* PB25 periph A */ 224 AT91_PIOB 25 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB25 periph A */
214 }; 225 };
215 226
216 pinctrl_uart1_dcd: uart1_dcd-0 { 227 pinctrl_uart1_dcd: uart1_dcd-0 {
217 atmel,pins = 228 atmel,pins =
218 <1 23 0x1 0x0>; /* PB23 periph A */ 229 <AT91_PIOB 23 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB23 periph A */
219 }; 230 };
220 231
221 pinctrl_uart1_ri: uart1_ri-0 { 232 pinctrl_uart1_ri: uart1_ri-0 {
222 atmel,pins = 233 atmel,pins =
223 <1 18 0x1 0x0>; /* PB18 periph A */ 234 <AT91_PIOB 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB18 periph A */
224 }; 235 };
225 }; 236 };
226 237
227 uart2 { 238 uart2 {
228 pinctrl_uart2: uart2-0 { 239 pinctrl_uart2: uart2-0 {
229 atmel,pins = 240 atmel,pins =
230 <0 22 0x1 0x0 /* PA22 periph A */ 241 <AT91_PIOA 22 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA22 periph A */
231 0 23 0x1 0x1>; /* PA23 periph A with pullup */ 242 AT91_PIOA 23 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA23 periph A with pullup */
232 }; 243 };
233 244
234 pinctrl_uart2_rts: uart2_rts-0 { 245 pinctrl_uart2_rts: uart2_rts-0 {
235 atmel,pins = 246 atmel,pins =
236 <0 30 0x2 0x0>; /* PA30 periph B */ 247 <AT91_PIOA 30 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA30 periph B */
237 }; 248 };
238 249
239 pinctrl_uart2_cts: uart2_cts-0 { 250 pinctrl_uart2_cts: uart2_cts-0 {
240 atmel,pins = 251 atmel,pins =
241 <0 31 0x2 0x0>; /* PA31 periph B */ 252 <AT91_PIOA 31 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA31 periph B */
242 }; 253 };
243 }; 254 };
244 255
245 uart3 { 256 uart3 {
246 pinctrl_uart3: uart3-0 { 257 pinctrl_uart3: uart3-0 {
247 atmel,pins = 258 atmel,pins =
248 <0 5 0x2 0x1 /* PA5 periph B with pullup */ 259 <AT91_PIOA 5 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA5 periph B with pullup */
249 0 6 0x2 0x0>; /* PA6 periph B */ 260 AT91_PIOA 6 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA6 periph B */
250 }; 261 };
251 262
252 pinctrl_uart3_rts: uart3_rts-0 { 263 pinctrl_uart3_rts: uart3_rts-0 {
253 atmel,pins = 264 atmel,pins =
254 <1 0 0x2 0x0>; /* PB0 periph B */ 265 <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB0 periph B */
255 }; 266 };
256 267
257 pinctrl_uart3_cts: uart3_cts-0 { 268 pinctrl_uart3_cts: uart3_cts-0 {
258 atmel,pins = 269 atmel,pins =
259 <1 1 0x2 0x0>; /* PB1 periph B */ 270 <AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB1 periph B */
260 }; 271 };
261 }; 272 };
262 273
263 nand { 274 nand {
264 pinctrl_nand: nand-0 { 275 pinctrl_nand: nand-0 {
265 atmel,pins = 276 atmel,pins =
266 <2 2 0x0 0x1 /* PC2 gpio RDY pin pull_up */ 277 <AT91_PIOC 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PC2 gpio RDY pin pull_up */
267 1 1 0x0 0x1>; /* PB1 gpio CD pin pull_up */ 278 AT91_PIOB 1 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PB1 gpio CD pin pull_up */
268 }; 279 };
269 }; 280 };
270 281
271 macb { 282 macb {
272 pinctrl_macb_rmii: macb_rmii-0 { 283 pinctrl_macb_rmii: macb_rmii-0 {
273 atmel,pins = 284 atmel,pins =
274 <0 7 0x1 0x0 /* PA7 periph A */ 285 <AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA7 periph A */
275 0 8 0x1 0x0 /* PA8 periph A */ 286 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA8 periph A */
276 0 9 0x1 0x0 /* PA9 periph A */ 287 AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA9 periph A */
277 0 10 0x1 0x0 /* PA10 periph A */ 288 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA10 periph A */
278 0 11 0x1 0x0 /* PA11 periph A */ 289 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A */
279 0 12 0x1 0x0 /* PA12 periph A */ 290 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A */
280 0 13 0x1 0x0 /* PA13 periph A */ 291 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA13 periph A */
281 0 14 0x1 0x0 /* PA14 periph A */ 292 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA14 periph A */
282 0 15 0x1 0x0 /* PA15 periph A */ 293 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA15 periph A */
283 0 16 0x1 0x0>; /* PA16 periph A */ 294 AT91_PIOA 16 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA16 periph A */
284 }; 295 };
285 296
286 pinctrl_macb_rmii_mii: macb_rmii_mii-0 { 297 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
287 atmel,pins = 298 atmel,pins =
288 <1 12 0x2 0x0 /* PB12 periph B */ 299 <AT91_PIOB 12 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB12 periph B */
289 1 13 0x2 0x0 /* PB13 periph B */ 300 AT91_PIOB 13 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB13 periph B */
290 1 14 0x2 0x0 /* PB14 periph B */ 301 AT91_PIOB 14 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB14 periph B */
291 1 15 0x2 0x0 /* PB15 periph B */ 302 AT91_PIOB 15 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB15 periph B */
292 1 16 0x2 0x0 /* PB16 periph B */ 303 AT91_PIOB 16 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB16 periph B */
293 1 17 0x2 0x0 /* PB17 periph B */ 304 AT91_PIOB 17 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB17 periph B */
294 1 18 0x2 0x0 /* PB18 periph B */ 305 AT91_PIOB 18 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB18 periph B */
295 1 19 0x2 0x0>; /* PB19 periph B */ 306 AT91_PIOB 19 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB19 periph B */
296 }; 307 };
297 }; 308 };
298 309
299 mmc0 { 310 mmc0 {
300 pinctrl_mmc0_clk: mmc0_clk-0 { 311 pinctrl_mmc0_clk: mmc0_clk-0 {
301 atmel,pins = 312 atmel,pins =
302 <0 27 0x1 0x0>; /* PA27 periph A */ 313 <AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA27 periph A */
303 }; 314 };
304 315
305 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 { 316 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
306 atmel,pins = 317 atmel,pins =
307 <0 28 0x1 0x1 /* PA28 periph A with pullup */ 318 <AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA28 periph A with pullup */
308 0 29 0x1 0x1>; /* PA29 periph A with pullup */ 319 AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA29 periph A with pullup */
309 }; 320 };
310 321
311 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 { 322 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
312 atmel,pins = 323 atmel,pins =
313 <1 3 0x2 0x1 /* PB3 periph B with pullup */ 324 <AT91_PIOB 3 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PB3 periph B with pullup */
314 1 4 0x2 0x1 /* PB4 periph B with pullup */ 325 AT91_PIOB 4 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PB4 periph B with pullup */
315 1 5 0x2 0x1>; /* PB5 periph B with pullup */ 326 AT91_PIOB 5 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PB5 periph B with pullup */
316 }; 327 };
317 328
318 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 { 329 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
319 atmel,pins = 330 atmel,pins =
320 <0 8 0x2 0x1 /* PA8 periph B with pullup */ 331 <AT91_PIOA 8 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA8 periph B with pullup */
321 0 9 0x2 0x1>; /* PA9 periph B with pullup */ 332 AT91_PIOA 9 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA9 periph B with pullup */
322 }; 333 };
323 334
324 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 { 335 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
325 atmel,pins = 336 atmel,pins =
326 <0 10 0x2 0x1 /* PA10 periph B with pullup */ 337 <AT91_PIOA 10 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA10 periph B with pullup */
327 0 11 0x2 0x1 /* PA11 periph B with pullup */ 338 AT91_PIOA 11 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA11 periph B with pullup */
328 0 12 0x2 0x1>; /* PA12 periph B with pullup */ 339 AT91_PIOA 12 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA12 periph B with pullup */
329 }; 340 };
330 }; 341 };
331 342
332 ssc0 { 343 ssc0 {
333 pinctrl_ssc0_tx: ssc0_tx-0 { 344 pinctrl_ssc0_tx: ssc0_tx-0 {
334 atmel,pins = 345 atmel,pins =
335 <1 0 0x1 0x0 /* PB0 periph A */ 346 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A */
336 1 1 0x1 0x0 /* PB1 periph A */ 347 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A */
337 1 2 0x1 0x0>; /* PB2 periph A */ 348 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB2 periph A */
338 }; 349 };
339 350
340 pinctrl_ssc0_rx: ssc0_rx-0 { 351 pinctrl_ssc0_rx: ssc0_rx-0 {
341 atmel,pins = 352 atmel,pins =
342 <1 3 0x1 0x0 /* PB3 periph A */ 353 <AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A */
343 1 4 0x1 0x0 /* PB4 periph A */ 354 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A */
344 1 5 0x1 0x0>; /* PB5 periph A */ 355 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB5 periph A */
345 }; 356 };
346 }; 357 };
347 358
348 ssc1 { 359 ssc1 {
349 pinctrl_ssc1_tx: ssc1_tx-0 { 360 pinctrl_ssc1_tx: ssc1_tx-0 {
350 atmel,pins = 361 atmel,pins =
351 <1 6 0x1 0x0 /* PB6 periph A */ 362 <AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A */
352 1 7 0x1 0x0 /* PB7 periph A */ 363 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB7 periph A */
353 1 8 0x1 0x0>; /* PB8 periph A */ 364 AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB8 periph A */
354 }; 365 };
355 366
356 pinctrl_ssc1_rx: ssc1_rx-0 { 367 pinctrl_ssc1_rx: ssc1_rx-0 {
357 atmel,pins = 368 atmel,pins =
358 <1 9 0x1 0x0 /* PB9 periph A */ 369 <AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A */
359 1 10 0x1 0x0 /* PB10 periph A */ 370 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB10 periph A */
360 1 11 0x1 0x0>; /* PB11 periph A */ 371 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB11 periph A */
361 }; 372 };
362 }; 373 };
363 374
364 ssc2 { 375 ssc2 {
365 pinctrl_ssc2_tx: ssc2_tx-0 { 376 pinctrl_ssc2_tx: ssc2_tx-0 {
366 atmel,pins = 377 atmel,pins =
367 <1 12 0x1 0x0 /* PB12 periph A */ 378 <AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A */
368 1 13 0x1 0x0 /* PB13 periph A */ 379 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A */
369 1 14 0x1 0x0>; /* PB14 periph A */ 380 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB14 periph A */
370 }; 381 };
371 382
372 pinctrl_ssc2_rx: ssc2_rx-0 { 383 pinctrl_ssc2_rx: ssc2_rx-0 {
373 atmel,pins = 384 atmel,pins =
374 <1 15 0x1 0x0 /* PB15 periph A */ 385 <AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A */
375 1 16 0x1 0x0 /* PB16 periph A */ 386 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A */
376 1 17 0x1 0x0>; /* PB17 periph A */ 387 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB17 periph A */
377 }; 388 };
378 }; 389 };
379 390
380 twi { 391 twi {
381 pinctrl_twi: twi-0 { 392 pinctrl_twi: twi-0 {
382 atmel,pins = 393 atmel,pins =
383 <0 25 0x1 0x2 /* PA25 periph A with multi drive */ 394 <AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_MULTI_DRIVE /* PA25 periph A with multi drive */
384 0 26 0x1 0x2>; /* PA26 periph A with multi drive */ 395 AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_MULTI_DRIVE>; /* PA26 periph A with multi drive */
385 }; 396 };
386 397
387 pinctrl_twi_gpio: twi_gpio-0 { 398 pinctrl_twi_gpio: twi_gpio-0 {
388 atmel,pins = 399 atmel,pins =
389 <0 25 0x0 0x2 /* PA25 GPIO with multi drive */ 400 <AT91_PIOA 25 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE /* PA25 GPIO with multi drive */
390 0 26 0x0 0x2>; /* PA26 GPIO with multi drive */ 401 AT91_PIOA 26 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE>; /* PA26 GPIO with multi drive */
402 };
403 };
404
405 tcb0 {
406 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
407 atmel,pins = <AT91_PIOA 13 AT91_PERIPH_B AT91_PINCTRL_NONE>;
408 };
409
410 pinctrl_tcb0_tclk1: tcb0_tclk1-0 {
411 atmel,pins = <AT91_PIOA 14 AT91_PERIPH_B AT91_PINCTRL_NONE>;
412 };
413
414 pinctrl_tcb0_tclk2: tcb0_tclk2-0 {
415 atmel,pins = <AT91_PIOA 15 AT91_PERIPH_B AT91_PINCTRL_NONE>;
416 };
417
418 pinctrl_tcb0_tioa0: tcb0_tioa0-0 {
419 atmel,pins = <AT91_PIOA 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;
420 };
421
422 pinctrl_tcb0_tioa1: tcb0_tioa1-0 {
423 atmel,pins = <AT91_PIOA 19 AT91_PERIPH_B AT91_PINCTRL_NONE>;
424 };
425
426 pinctrl_tcb0_tioa2: tcb0_tioa2-0 {
427 atmel,pins = <AT91_PIOA 21 AT91_PERIPH_B AT91_PINCTRL_NONE>;
428 };
429
430 pinctrl_tcb0_tiob0: tcb0_tiob0-0 {
431 atmel,pins = <AT91_PIOA 18 AT91_PERIPH_B AT91_PINCTRL_NONE>;
432 };
433
434 pinctrl_tcb0_tiob1: tcb0_tiob1-0 {
435 atmel,pins = <AT91_PIOA 20 AT91_PERIPH_B AT91_PINCTRL_NONE>;
436 };
437
438 pinctrl_tcb0_tiob2: tcb0_tiob2-0 {
439 atmel,pins = <AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_NONE>;
440 };
441 };
442
443 tcb1 {
444 pinctrl_tcb1_tclk0: tcb1_tclk0-0 {
445 atmel,pins = <AT91_PIOA 27 AT91_PERIPH_B AT91_PINCTRL_NONE>;
446 };
447
448 pinctrl_tcb1_tclk1: tcb1_tclk1-0 {
449 atmel,pins = <AT91_PIOA 28 AT91_PERIPH_B AT91_PINCTRL_NONE>;
450 };
451
452 pinctrl_tcb1_tclk2: tcb1_tclk2-0 {
453 atmel,pins = <AT91_PIOA 29 AT91_PERIPH_B AT91_PINCTRL_NONE>;
454 };
455
456 pinctrl_tcb1_tioa0: tcb1_tioa0-0 {
457 atmel,pins = <AT91_PIOB 6 AT91_PERIPH_B AT91_PINCTRL_NONE>;
458 };
459
460 pinctrl_tcb1_tioa1: tcb1_tioa1-0 {
461 atmel,pins = <AT91_PIOB 8 AT91_PERIPH_B AT91_PINCTRL_NONE>;
462 };
463
464 pinctrl_tcb1_tioa2: tcb1_tioa2-0 {
465 atmel,pins = <AT91_PIOB 10 AT91_PERIPH_B AT91_PINCTRL_NONE>;
466 };
467
468 pinctrl_tcb1_tiob0: tcb1_tiob0-0 {
469 atmel,pins = <AT91_PIOB 7 AT91_PERIPH_B AT91_PINCTRL_NONE>;
470 };
471
472 pinctrl_tcb1_tiob1: tcb1_tiob1-0 {
473 atmel,pins = <AT91_PIOB 9 AT91_PERIPH_B AT91_PINCTRL_NONE>;
474 };
475
476 pinctrl_tcb1_tiob2: tcb1_tiob2-0 {
477 atmel,pins = <AT91_PIOB 11 AT91_PERIPH_B AT91_PINCTRL_NONE>;
478 };
479 };
480
481 spi0 {
482 pinctrl_spi0: spi0-0 {
483 atmel,pins =
484 <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA0 periph A SPI0_MISO pin */
485 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA1 periph A SPI0_MOSI pin */
486 AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA2 periph A SPI0_SPCK pin */
391 }; 487 };
392 }; 488 };
393 489
394 pioA: gpio@fffff400 { 490 pioA: gpio@fffff400 {
395 compatible = "atmel,at91rm9200-gpio"; 491 compatible = "atmel,at91rm9200-gpio";
396 reg = <0xfffff400 0x200>; 492 reg = <0xfffff400 0x200>;
397 interrupts = <2 4 1>; 493 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
398 #gpio-cells = <2>; 494 #gpio-cells = <2>;
399 gpio-controller; 495 gpio-controller;
400 interrupt-controller; 496 interrupt-controller;
@@ -404,7 +500,7 @@
404 pioB: gpio@fffff600 { 500 pioB: gpio@fffff600 {
405 compatible = "atmel,at91rm9200-gpio"; 501 compatible = "atmel,at91rm9200-gpio";
406 reg = <0xfffff600 0x200>; 502 reg = <0xfffff600 0x200>;
407 interrupts = <3 4 1>; 503 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
408 #gpio-cells = <2>; 504 #gpio-cells = <2>;
409 gpio-controller; 505 gpio-controller;
410 interrupt-controller; 506 interrupt-controller;
@@ -414,7 +510,7 @@
414 pioC: gpio@fffff800 { 510 pioC: gpio@fffff800 {
415 compatible = "atmel,at91rm9200-gpio"; 511 compatible = "atmel,at91rm9200-gpio";
416 reg = <0xfffff800 0x200>; 512 reg = <0xfffff800 0x200>;
417 interrupts = <4 4 1>; 513 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 1>;
418 #gpio-cells = <2>; 514 #gpio-cells = <2>;
419 gpio-controller; 515 gpio-controller;
420 interrupt-controller; 516 interrupt-controller;
@@ -424,7 +520,7 @@
424 pioD: gpio@fffffa00 { 520 pioD: gpio@fffffa00 {
425 compatible = "atmel,at91rm9200-gpio"; 521 compatible = "atmel,at91rm9200-gpio";
426 reg = <0xfffffa00 0x200>; 522 reg = <0xfffffa00 0x200>;
427 interrupts = <5 4 1>; 523 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 1>;
428 #gpio-cells = <2>; 524 #gpio-cells = <2>;
429 gpio-controller; 525 gpio-controller;
430 interrupt-controller; 526 interrupt-controller;
@@ -435,7 +531,7 @@
435 dbgu: serial@fffff200 { 531 dbgu: serial@fffff200 {
436 compatible = "atmel,at91rm9200-usart"; 532 compatible = "atmel,at91rm9200-usart";
437 reg = <0xfffff200 0x200>; 533 reg = <0xfffff200 0x200>;
438 interrupts = <1 4 7>; 534 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
439 pinctrl-names = "default"; 535 pinctrl-names = "default";
440 pinctrl-0 = <&pinctrl_dbgu>; 536 pinctrl-0 = <&pinctrl_dbgu>;
441 status = "disabled"; 537 status = "disabled";
@@ -444,7 +540,7 @@
444 usart0: serial@fffc0000 { 540 usart0: serial@fffc0000 {
445 compatible = "atmel,at91rm9200-usart"; 541 compatible = "atmel,at91rm9200-usart";
446 reg = <0xfffc0000 0x200>; 542 reg = <0xfffc0000 0x200>;
447 interrupts = <6 4 5>; 543 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>;
448 atmel,use-dma-rx; 544 atmel,use-dma-rx;
449 atmel,use-dma-tx; 545 atmel,use-dma-tx;
450 pinctrl-names = "default"; 546 pinctrl-names = "default";
@@ -455,7 +551,7 @@
455 usart1: serial@fffc4000 { 551 usart1: serial@fffc4000 {
456 compatible = "atmel,at91rm9200-usart"; 552 compatible = "atmel,at91rm9200-usart";
457 reg = <0xfffc4000 0x200>; 553 reg = <0xfffc4000 0x200>;
458 interrupts = <7 4 5>; 554 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
459 atmel,use-dma-rx; 555 atmel,use-dma-rx;
460 atmel,use-dma-tx; 556 atmel,use-dma-tx;
461 pinctrl-names = "default"; 557 pinctrl-names = "default";
@@ -466,7 +562,7 @@
466 usart2: serial@fffc8000 { 562 usart2: serial@fffc8000 {
467 compatible = "atmel,at91rm9200-usart"; 563 compatible = "atmel,at91rm9200-usart";
468 reg = <0xfffc8000 0x200>; 564 reg = <0xfffc8000 0x200>;
469 interrupts = <8 4 5>; 565 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
470 atmel,use-dma-rx; 566 atmel,use-dma-rx;
471 atmel,use-dma-tx; 567 atmel,use-dma-tx;
472 pinctrl-names = "default"; 568 pinctrl-names = "default";
@@ -477,7 +573,7 @@
477 usart3: serial@fffcc000 { 573 usart3: serial@fffcc000 {
478 compatible = "atmel,at91rm9200-usart"; 574 compatible = "atmel,at91rm9200-usart";
479 reg = <0xfffcc000 0x200>; 575 reg = <0xfffcc000 0x200>;
480 interrupts = <23 4 5>; 576 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>;
481 atmel,use-dma-rx; 577 atmel,use-dma-rx;
482 atmel,use-dma-tx; 578 atmel,use-dma-tx;
483 pinctrl-names = "default"; 579 pinctrl-names = "default";
@@ -488,7 +584,18 @@
488 usb1: gadget@fffb0000 { 584 usb1: gadget@fffb0000 {
489 compatible = "atmel,at91rm9200-udc"; 585 compatible = "atmel,at91rm9200-udc";
490 reg = <0xfffb0000 0x4000>; 586 reg = <0xfffb0000 0x4000>;
491 interrupts = <11 4 2>; 587 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 2>;
588 status = "disabled";
589 };
590
591 spi0: spi@fffe0000 {
592 #address-cells = <1>;
593 #size-cells = <0>;
594 compatible = "atmel,at91rm9200-spi";
595 reg = <0xfffe0000 0x200>;
596 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>;
597 pinctrl-names = "default";
598 pinctrl-0 = <&pinctrl_spi0>;
492 status = "disabled"; 599 status = "disabled";
493 }; 600 };
494 }; 601 };
@@ -503,9 +610,9 @@
503 pinctrl-names = "default"; 610 pinctrl-names = "default";
504 pinctrl-0 = <&pinctrl_nand>; 611 pinctrl-0 = <&pinctrl_nand>;
505 nand-ecc-mode = "soft"; 612 nand-ecc-mode = "soft";
506 gpios = <&pioC 2 0 613 gpios = <&pioC 2 GPIO_ACTIVE_HIGH
507 0 614 0
508 &pioB 1 0 615 &pioB 1 GPIO_ACTIVE_HIGH
509 >; 616 >;
510 status = "disabled"; 617 status = "disabled";
511 }; 618 };
@@ -513,15 +620,15 @@
513 usb0: ohci@00300000 { 620 usb0: ohci@00300000 {
514 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 621 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
515 reg = <0x00300000 0x100000>; 622 reg = <0x00300000 0x100000>;
516 interrupts = <23 4 2>; 623 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>;
517 status = "disabled"; 624 status = "disabled";
518 }; 625 };
519 }; 626 };
520 627
521 i2c@0 { 628 i2c@0 {
522 compatible = "i2c-gpio"; 629 compatible = "i2c-gpio";
523 gpios = <&pioA 25 0 /* sda */ 630 gpios = <&pioA 25 GPIO_ACTIVE_HIGH /* sda */
524 &pioA 26 0 /* scl */ 631 &pioA 26 GPIO_ACTIVE_HIGH /* scl */
525 >; 632 >;
526 i2c-gpio,sda-open-drain; 633 i2c-gpio,sda-open-drain;
527 i2c-gpio,scl-open-drain; 634 i2c-gpio,scl-open-drain;
diff --git a/arch/arm/boot/dts/at91rm9200ek.dts b/arch/arm/boot/dts/at91rm9200ek.dts
index e586d85f8e23..d2d72c3b44c4 100644
--- a/arch/arm/boot/dts/at91rm9200ek.dts
+++ b/arch/arm/boot/dts/at91rm9200ek.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2 only 6 * Licensed under GPLv2 only
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91rm9200.dtsi" 9#include "at91rm9200.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91RM9200 evaluation kit"; 12 model = "Atmel AT91RM9200 evaluation kit";
@@ -50,9 +50,19 @@
50 }; 50 };
51 51
52 usb1: gadget@fffb0000 { 52 usb1: gadget@fffb0000 {
53 atmel,vbus-gpio = <&pioD 4 0>; 53 atmel,vbus-gpio = <&pioD 4 GPIO_ACTIVE_HIGH>;
54 status = "okay"; 54 status = "okay";
55 }; 55 };
56
57 spi0: spi@fffe0000 {
58 status = "okay";
59 cs-gpios = <&pioA 3 0>, <0>, <0>, <0>;
60 mtd_dataflash@0 {
61 compatible = "atmel,at45", "atmel,dataflash";
62 spi-max-frequency = <15000000>;
63 reg = <0>;
64 };
65 };
56 }; 66 };
57 67
58 usb0: ohci@00300000 { 68 usb0: ohci@00300000 {
@@ -66,19 +76,19 @@
66 76
67 ds2 { 77 ds2 {
68 label = "green"; 78 label = "green";
69 gpios = <&pioB 0 0x1>; 79 gpios = <&pioB 0 GPIO_ACTIVE_LOW>;
70 linux,default-trigger = "mmc0"; 80 linux,default-trigger = "mmc0";
71 }; 81 };
72 82
73 ds4 { 83 ds4 {
74 label = "yellow"; 84 label = "yellow";
75 gpios = <&pioB 1 0x1>; 85 gpios = <&pioB 1 GPIO_ACTIVE_LOW>;
76 linux,default-trigger = "heartbeat"; 86 linux,default-trigger = "heartbeat";
77 }; 87 };
78 88
79 ds6 { 89 ds6 {
80 label = "red"; 90 label = "red";
81 gpios = <&pioB 2 0x1>; 91 gpios = <&pioB 2 GPIO_ACTIVE_LOW>;
82 }; 92 };
83 }; 93 };
84}; 94};
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index 84c4bef2d726..c7ccbcbffb3e 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -8,7 +8,10 @@
8 * Licensed under GPLv2 or later. 8 * Licensed under GPLv2 or later.
9 */ 9 */
10 10
11/include/ "skeleton.dtsi" 11#include "skeleton.dtsi"
12#include <dt-bindings/pinctrl/at91.h>
13#include <dt-bindings/interrupt-controller/irq.h>
14#include <dt-bindings/gpio/gpio.h>
12 15
13/ { 16/ {
14 model = "Atmel AT91SAM9260 family SoC"; 17 model = "Atmel AT91SAM9260 family SoC";
@@ -32,8 +35,12 @@
32 ssc0 = &ssc0; 35 ssc0 = &ssc0;
33 }; 36 };
34 cpus { 37 cpus {
35 cpu@0 { 38 #address-cells = <0>;
36 compatible = "arm,arm926ejs"; 39 #size-cells = <0>;
40
41 cpu {
42 compatible = "arm,arm926ej-s";
43 device_type = "cpu";
37 }; 44 };
38 }; 45 };
39 46
@@ -84,19 +91,23 @@
84 pit: timer@fffffd30 { 91 pit: timer@fffffd30 {
85 compatible = "atmel,at91sam9260-pit"; 92 compatible = "atmel,at91sam9260-pit";
86 reg = <0xfffffd30 0xf>; 93 reg = <0xfffffd30 0xf>;
87 interrupts = <1 4 7>; 94 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
88 }; 95 };
89 96
90 tcb0: timer@fffa0000 { 97 tcb0: timer@fffa0000 {
91 compatible = "atmel,at91rm9200-tcb"; 98 compatible = "atmel,at91rm9200-tcb";
92 reg = <0xfffa0000 0x100>; 99 reg = <0xfffa0000 0x100>;
93 interrupts = <17 4 0 18 4 0 19 4 0>; 100 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0
101 18 IRQ_TYPE_LEVEL_HIGH 0
102 19 IRQ_TYPE_LEVEL_HIGH 0>;
94 }; 103 };
95 104
96 tcb1: timer@fffdc000 { 105 tcb1: timer@fffdc000 {
97 compatible = "atmel,at91rm9200-tcb"; 106 compatible = "atmel,at91rm9200-tcb";
98 reg = <0xfffdc000 0x100>; 107 reg = <0xfffdc000 0x100>;
99 interrupts = <26 4 0 27 4 0 28 4 0>; 108 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0
109 27 IRQ_TYPE_LEVEL_HIGH 0
110 28 IRQ_TYPE_LEVEL_HIGH 0>;
100 }; 111 };
101 112
102 pinctrl@fffff400 { 113 pinctrl@fffff400 {
@@ -116,234 +127,318 @@
116 dbgu { 127 dbgu {
117 pinctrl_dbgu: dbgu-0 { 128 pinctrl_dbgu: dbgu-0 {
118 atmel,pins = 129 atmel,pins =
119 <1 14 0x1 0x0 /* PB14 periph A */ 130 <AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A */
120 1 15 0x1 0x1>; /* PB15 periph with pullup */ 131 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PB15 periph with pullup */
121 }; 132 };
122 }; 133 };
123 134
124 usart0 { 135 usart0 {
125 pinctrl_usart0: usart0-0 { 136 pinctrl_usart0: usart0-0 {
126 atmel,pins = 137 atmel,pins =
127 <1 4 0x1 0x0 /* PB4 periph A */ 138 <AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A */
128 1 5 0x1 0x0>; /* PB5 periph A */ 139 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB5 periph A */
129 }; 140 };
130 141
131 pinctrl_usart0_rts: usart0_rts-0 { 142 pinctrl_usart0_rts: usart0_rts-0 {
132 atmel,pins = 143 atmel,pins =
133 <1 26 0x1 0x0>; /* PB26 periph A */ 144 <AT91_PIOB 26 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB26 periph A */
134 }; 145 };
135 146
136 pinctrl_usart0_cts: usart0_cts-0 { 147 pinctrl_usart0_cts: usart0_cts-0 {
137 atmel,pins = 148 atmel,pins =
138 <1 27 0x1 0x0>; /* PB27 periph A */ 149 <AT91_PIOB 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB27 periph A */
139 }; 150 };
140 151
141 pinctrl_usart0_dtr_dsr: usart0_dtr_dsr-0 { 152 pinctrl_usart0_dtr_dsr: usart0_dtr_dsr-0 {
142 atmel,pins = 153 atmel,pins =
143 <1 24 0x1 0x0 /* PB24 periph A */ 154 <AT91_PIOB 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB24 periph A */
144 1 22 0x1 0x0>; /* PB22 periph A */ 155 AT91_PIOB 22 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB22 periph A */
145 }; 156 };
146 157
147 pinctrl_usart0_dcd: usart0_dcd-0 { 158 pinctrl_usart0_dcd: usart0_dcd-0 {
148 atmel,pins = 159 atmel,pins =
149 <1 23 0x1 0x0>; /* PB23 periph A */ 160 <AT91_PIOB 23 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB23 periph A */
150 }; 161 };
151 162
152 pinctrl_usart0_ri: usart0_ri-0 { 163 pinctrl_usart0_ri: usart0_ri-0 {
153 atmel,pins = 164 atmel,pins =
154 <1 25 0x1 0x0>; /* PB25 periph A */ 165 <AT91_PIOB 25 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB25 periph A */
155 }; 166 };
156 }; 167 };
157 168
158 usart1 { 169 usart1 {
159 pinctrl_usart1: usart1-0 { 170 pinctrl_usart1: usart1-0 {
160 atmel,pins = 171 atmel,pins =
161 <1 6 0x1 0x1 /* PB6 periph A with pullup */ 172 <AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB6 periph A with pullup */
162 1 7 0x1 0x0>; /* PB7 periph A */ 173 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB7 periph A */
163 }; 174 };
164 175
165 pinctrl_usart1_rts: usart1_rts-0 { 176 pinctrl_usart1_rts: usart1_rts-0 {
166 atmel,pins = 177 atmel,pins =
167 <1 28 0x1 0x0>; /* PB28 periph A */ 178 <AT91_PIOB 28 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB28 periph A */
168 }; 179 };
169 180
170 pinctrl_usart1_cts: usart1_cts-0 { 181 pinctrl_usart1_cts: usart1_cts-0 {
171 atmel,pins = 182 atmel,pins =
172 <1 29 0x1 0x0>; /* PB29 periph A */ 183 <AT91_PIOB 29 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB29 periph A */
173 }; 184 };
174 }; 185 };
175 186
176 usart2 { 187 usart2 {
177 pinctrl_usart2: usart2-0 { 188 pinctrl_usart2: usart2-0 {
178 atmel,pins = 189 atmel,pins =
179 <1 8 0x1 0x1 /* PB8 periph A with pullup */ 190 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB8 periph A with pullup */
180 1 9 0x1 0x0>; /* PB9 periph A */ 191 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB9 periph A */
181 }; 192 };
182 193
183 pinctrl_usart2_rts: usart2_rts-0 { 194 pinctrl_usart2_rts: usart2_rts-0 {
184 atmel,pins = 195 atmel,pins =
185 <0 4 0x1 0x0>; /* PA4 periph A */ 196 <AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA4 periph A */
186 }; 197 };
187 198
188 pinctrl_usart2_cts: usart2_cts-0 { 199 pinctrl_usart2_cts: usart2_cts-0 {
189 atmel,pins = 200 atmel,pins =
190 <0 5 0x1 0x0>; /* PA5 periph A */ 201 <AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA5 periph A */
191 }; 202 };
192 }; 203 };
193 204
194 usart3 { 205 usart3 {
195 pinctrl_usart3: usart3-0 { 206 pinctrl_usart3: usart3-0 {
196 atmel,pins = 207 atmel,pins =
197 <1 10 0x1 0x1 /* PB10 periph A with pullup */ 208 <AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB10 periph A with pullup */
198 1 11 0x1 0x0>; /* PB11 periph A */ 209 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB11 periph A */
199 }; 210 };
200 211
201 pinctrl_usart3_rts: usart3_rts-0 { 212 pinctrl_usart3_rts: usart3_rts-0 {
202 atmel,pins = 213 atmel,pins =
203 <2 8 0x2 0x0>; /* PC8 periph B */ 214 <AT91_PIOB 8 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC8 periph B */
204 }; 215 };
205 216
206 pinctrl_usart3_cts: usart3_cts-0 { 217 pinctrl_usart3_cts: usart3_cts-0 {
207 atmel,pins = 218 atmel,pins =
208 <2 10 0x2 0x0>; /* PC10 periph B */ 219 <AT91_PIOB 10 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC10 periph B */
209 }; 220 };
210 }; 221 };
211 222
212 uart0 { 223 uart0 {
213 pinctrl_uart0: uart0-0 { 224 pinctrl_uart0: uart0-0 {
214 atmel,pins = 225 atmel,pins =
215 <0 31 0x2 0x1 /* PA31 periph B with pullup */ 226 <AT91_PIOA 31 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA31 periph B with pullup */
216 0 30 0x2 0x0>; /* PA30 periph B */ 227 AT91_PIOA 30 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA30 periph B */
217 }; 228 };
218 }; 229 };
219 230
220 uart1 { 231 uart1 {
221 pinctrl_uart1: uart1-0 { 232 pinctrl_uart1: uart1-0 {
222 atmel,pins = 233 atmel,pins =
223 <1 12 0x1 0x1 /* PB12 periph A with pullup */ 234 <AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB12 periph A with pullup */
224 1 13 0x1 0x0>; /* PB13 periph A */ 235 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB13 periph A */
225 }; 236 };
226 }; 237 };
227 238
228 nand { 239 nand {
229 pinctrl_nand: nand-0 { 240 pinctrl_nand: nand-0 {
230 atmel,pins = 241 atmel,pins =
231 <2 13 0x0 0x1 /* PC13 gpio RDY pin pull_up */ 242 <AT91_PIOC 13 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PC13 gpio RDY pin pull_up */
232 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */ 243 AT91_PIOC 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PC14 gpio enable pin pull_up */
233 }; 244 };
234 }; 245 };
235 246
236 macb { 247 macb {
237 pinctrl_macb_rmii: macb_rmii-0 { 248 pinctrl_macb_rmii: macb_rmii-0 {
238 atmel,pins = 249 atmel,pins =
239 <0 12 0x1 0x0 /* PA12 periph A */ 250 <AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A */
240 0 13 0x1 0x0 /* PA13 periph A */ 251 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA13 periph A */
241 0 14 0x1 0x0 /* PA14 periph A */ 252 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA14 periph A */
242 0 15 0x1 0x0 /* PA15 periph A */ 253 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA15 periph A */
243 0 16 0x1 0x0 /* PA16 periph A */ 254 AT91_PIOA 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA16 periph A */
244 0 17 0x1 0x0 /* PA17 periph A */ 255 AT91_PIOA 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA17 periph A */
245 0 18 0x1 0x0 /* PA18 periph A */ 256 AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA18 periph A */
246 0 19 0x1 0x0 /* PA19 periph A */ 257 AT91_PIOA 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA19 periph A */
247 0 20 0x1 0x0 /* PA20 periph A */ 258 AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA20 periph A */
248 0 21 0x1 0x0>; /* PA21 periph A */ 259 AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA21 periph A */
249 }; 260 };
250 261
251 pinctrl_macb_rmii_mii: macb_rmii_mii-0 { 262 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
252 atmel,pins = 263 atmel,pins =
253 <0 22 0x2 0x0 /* PA22 periph B */ 264 <AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA22 periph B */
254 0 23 0x2 0x0 /* PA23 periph B */ 265 AT91_PIOA 23 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA23 periph B */
255 0 24 0x2 0x0 /* PA24 periph B */ 266 AT91_PIOA 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA24 periph B */
256 0 25 0x2 0x0 /* PA25 periph B */ 267 AT91_PIOA 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA25 periph B */
257 0 26 0x2 0x0 /* PA26 periph B */ 268 AT91_PIOA 26 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA26 periph B */
258 0 27 0x2 0x0 /* PA27 periph B */ 269 AT91_PIOA 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA27 periph B */
259 0 28 0x2 0x0 /* PA28 periph B */ 270 AT91_PIOA 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA28 periph B */
260 0 29 0x2 0x0>; /* PA29 periph B */ 271 AT91_PIOA 29 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA29 periph B */
261 }; 272 };
262 273
263 pinctrl_macb_rmii_mii_alt: macb_rmii_mii-1 { 274 pinctrl_macb_rmii_mii_alt: macb_rmii_mii-1 {
264 atmel,pins = 275 atmel,pins =
265 <0 10 0x2 0x0 /* PA10 periph B */ 276 <AT91_PIOA 10 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA10 periph B */
266 0 11 0x2 0x0 /* PA11 periph B */ 277 AT91_PIOA 11 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA11 periph B */
267 0 22 0x2 0x0 /* PA22 periph B */ 278 AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA22 periph B */
268 0 25 0x2 0x0 /* PA25 periph B */ 279 AT91_PIOA 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA25 periph B */
269 0 26 0x2 0x0 /* PA26 periph B */ 280 AT91_PIOA 26 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA26 periph B */
270 0 27 0x2 0x0 /* PA27 periph B */ 281 AT91_PIOA 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA27 periph B */
271 0 28 0x2 0x0 /* PA28 periph B */ 282 AT91_PIOA 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA28 periph B */
272 0 29 0x2 0x0>; /* PA29 periph B */ 283 AT91_PIOA 29 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA29 periph B */
273 }; 284 };
274 }; 285 };
275 286
276 mmc0 { 287 mmc0 {
277 pinctrl_mmc0_clk: mmc0_clk-0 { 288 pinctrl_mmc0_clk: mmc0_clk-0 {
278 atmel,pins = 289 atmel,pins =
279 <0 8 0x1 0x0>; /* PA8 periph A */ 290 <AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA8 periph A */
280 }; 291 };
281 292
282 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 { 293 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
283 atmel,pins = 294 atmel,pins =
284 <0 7 0x1 0x1 /* PA7 periph A with pullup */ 295 <AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA7 periph A with pullup */
285 0 6 0x1 0x1>; /* PA6 periph A with pullup */ 296 AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA6 periph A with pullup */
286 }; 297 };
287 298
288 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 { 299 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
289 atmel,pins = 300 atmel,pins =
290 <0 9 0x1 0x1 /* PA9 periph A with pullup */ 301 <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA9 periph A with pullup */
291 0 10 0x1 0x1 /* PA10 periph A with pullup */ 302 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA10 periph A with pullup */
292 0 11 0x1 0x1>; /* PA11 periph A with pullup */ 303 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA11 periph A with pullup */
293 }; 304 };
294 305
295 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 { 306 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
296 atmel,pins = 307 atmel,pins =
297 <0 1 0x2 0x1 /* PA1 periph B with pullup */ 308 <AT91_PIOA 1 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA1 periph B with pullup */
298 0 0 0x2 0x1>; /* PA0 periph B with pullup */ 309 AT91_PIOA 0 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA0 periph B with pullup */
299 }; 310 };
300 311
301 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 { 312 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
302 atmel,pins = 313 atmel,pins =
303 <0 5 0x2 0x1 /* PA5 periph B with pullup */ 314 <AT91_PIOA 5 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA5 periph B with pullup */
304 0 4 0x2 0x1 /* PA4 periph B with pullup */ 315 AT91_PIOA 4 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA4 periph B with pullup */
305 0 3 0x2 0x1>; /* PA3 periph B with pullup */ 316 AT91_PIOA 3 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA3 periph B with pullup */
306 }; 317 };
307 }; 318 };
308 319
309 ssc0 { 320 ssc0 {
310 pinctrl_ssc0_tx: ssc0_tx-0 { 321 pinctrl_ssc0_tx: ssc0_tx-0 {
311 atmel,pins = 322 atmel,pins =
312 <1 16 0x1 0x0 /* PB16 periph A */ 323 <AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A */
313 1 17 0x1 0x0 /* PB17 periph A */ 324 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A */
314 1 18 0x1 0x0>; /* PB18 periph A */ 325 AT91_PIOB 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB18 periph A */
315 }; 326 };
316 327
317 pinctrl_ssc0_rx: ssc0_rx-0 { 328 pinctrl_ssc0_rx: ssc0_rx-0 {
318 atmel,pins = 329 atmel,pins =
319 <1 19 0x1 0x0 /* PB19 periph A */ 330 <AT91_PIOB 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB19 periph A */
320 1 20 0x1 0x0 /* PB20 periph A */ 331 AT91_PIOB 20 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB20 periph A */
321 1 21 0x1 0x0>; /* PB21 periph A */ 332 AT91_PIOB 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB21 periph A */
322 }; 333 };
323 }; 334 };
324 335
325 spi0 { 336 spi0 {
326 pinctrl_spi0: spi0-0 { 337 pinctrl_spi0: spi0-0 {
327 atmel,pins = 338 atmel,pins =
328 <0 0 0x1 0x0 /* PA0 periph A SPI0_MISO pin */ 339 <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA0 periph A SPI0_MISO pin */
329 0 1 0x1 0x0 /* PA1 periph A SPI0_MOSI pin */ 340 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA1 periph A SPI0_MOSI pin */
330 0 2 0x1 0x0>; /* PA2 periph A SPI0_SPCK pin */ 341 AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA2 periph A SPI0_SPCK pin */
331 }; 342 };
332 }; 343 };
333 344
334 spi1 { 345 spi1 {
335 pinctrl_spi1: spi1-0 { 346 pinctrl_spi1: spi1-0 {
336 atmel,pins = 347 atmel,pins =
337 <1 0 0x1 0x0 /* PB0 periph A SPI1_MISO pin */ 348 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A SPI1_MISO pin */
338 1 1 0x1 0x0 /* PB1 periph A SPI1_MOSI pin */ 349 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A SPI1_MOSI pin */
339 1 2 0x1 0x0>; /* PB2 periph A SPI1_SPCK pin */ 350 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB2 periph A SPI1_SPCK pin */
351 };
352 };
353
354 i2c_gpio0 {
355 pinctrl_i2c_gpio0: i2c_gpio0-0 {
356 atmel,pins =
357 <AT91_PIOA 23 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE
358 AT91_PIOA 24 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE>;
359 };
360 };
361
362 tcb0 {
363 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
364 atmel,pins = <AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_NONE>;
365 };
366
367 pinctrl_tcb0_tclk1: tcb0_tclk1-0 {
368 atmel,pins = <AT91_PIOB 6 AT91_PERIPH_B AT91_PINCTRL_NONE>;
369 };
370
371 pinctrl_tcb0_tclk2: tcb0_tclk2-0 {
372 atmel,pins = <AT91_PIOB 7 AT91_PERIPH_B AT91_PINCTRL_NONE>;
373 };
374
375 pinctrl_tcb0_tioa0: tcb0_tioa0-0 {
376 atmel,pins = <AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_NONE>;
377 };
378
379 pinctrl_tcb0_tioa1: tcb0_tioa1-0 {
380 atmel,pins = <AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE>;
381 };
382
383 pinctrl_tcb0_tioa2: tcb0_tioa2-0 {
384 atmel,pins = <AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE>;
385 };
386
387 pinctrl_tcb0_tiob0: tcb0_tiob0-0 {
388 atmel,pins = <AT91_PIOC 9 AT91_PERIPH_B AT91_PINCTRL_NONE>;
389 };
390
391 pinctrl_tcb0_tiob1: tcb0_tiob1-0 {
392 atmel,pins = <AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE>;
393 };
394
395 pinctrl_tcb0_tiob2: tcb0_tiob2-0 {
396 atmel,pins = <AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE>;
397 };
398 };
399
400 tcb1 {
401 pinctrl_tcb1_tclk0: tcb1_tclk0-0 {
402 atmel,pins = <AT91_PIOB 16 AT91_PERIPH_B AT91_PINCTRL_NONE>;
403 };
404
405 pinctrl_tcb1_tclk1: tcb1_tclk1-0 {
406 atmel,pins = <AT91_PIOB 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;
407 };
408
409 pinctrl_tcb1_tclk2: tcb1_tclk2-0 {
410 atmel,pins = <AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_NONE>;
411 };
412
413 pinctrl_tcb1_tioa0: tcb1_tioa0-0 {
414 atmel,pins = <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE>;
415 };
416
417 pinctrl_tcb1_tioa1: tcb1_tioa1-0 {
418 atmel,pins = <AT91_PIOB 2 AT91_PERIPH_B AT91_PINCTRL_NONE>;
419 };
420
421 pinctrl_tcb1_tioa2: tcb1_tioa2-0 {
422 atmel,pins = <AT91_PIOB 3 AT91_PERIPH_B AT91_PINCTRL_NONE>;
423 };
424
425 pinctrl_tcb1_tiob0: tcb1_tiob0-0 {
426 atmel,pins = <AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE>;
427 };
428
429 pinctrl_tcb1_tiob1: tcb1_tiob1-0 {
430 atmel,pins = <AT91_PIOB 18 AT91_PERIPH_B AT91_PINCTRL_NONE>;
431 };
432
433 pinctrl_tcb1_tiob2: tcb1_tiob2-0 {
434 atmel,pins = <AT91_PIOB 19 AT91_PERIPH_B AT91_PINCTRL_NONE>;
340 }; 435 };
341 }; 436 };
342 437
343 pioA: gpio@fffff400 { 438 pioA: gpio@fffff400 {
344 compatible = "atmel,at91rm9200-gpio"; 439 compatible = "atmel,at91rm9200-gpio";
345 reg = <0xfffff400 0x200>; 440 reg = <0xfffff400 0x200>;
346 interrupts = <2 4 1>; 441 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
347 #gpio-cells = <2>; 442 #gpio-cells = <2>;
348 gpio-controller; 443 gpio-controller;
349 interrupt-controller; 444 interrupt-controller;
@@ -353,7 +448,7 @@
353 pioB: gpio@fffff600 { 448 pioB: gpio@fffff600 {
354 compatible = "atmel,at91rm9200-gpio"; 449 compatible = "atmel,at91rm9200-gpio";
355 reg = <0xfffff600 0x200>; 450 reg = <0xfffff600 0x200>;
356 interrupts = <3 4 1>; 451 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
357 #gpio-cells = <2>; 452 #gpio-cells = <2>;
358 gpio-controller; 453 gpio-controller;
359 interrupt-controller; 454 interrupt-controller;
@@ -363,7 +458,7 @@
363 pioC: gpio@fffff800 { 458 pioC: gpio@fffff800 {
364 compatible = "atmel,at91rm9200-gpio"; 459 compatible = "atmel,at91rm9200-gpio";
365 reg = <0xfffff800 0x200>; 460 reg = <0xfffff800 0x200>;
366 interrupts = <4 4 1>; 461 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 1>;
367 #gpio-cells = <2>; 462 #gpio-cells = <2>;
368 gpio-controller; 463 gpio-controller;
369 interrupt-controller; 464 interrupt-controller;
@@ -374,7 +469,7 @@
374 dbgu: serial@fffff200 { 469 dbgu: serial@fffff200 {
375 compatible = "atmel,at91sam9260-usart"; 470 compatible = "atmel,at91sam9260-usart";
376 reg = <0xfffff200 0x200>; 471 reg = <0xfffff200 0x200>;
377 interrupts = <1 4 7>; 472 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
378 pinctrl-names = "default"; 473 pinctrl-names = "default";
379 pinctrl-0 = <&pinctrl_dbgu>; 474 pinctrl-0 = <&pinctrl_dbgu>;
380 status = "disabled"; 475 status = "disabled";
@@ -383,7 +478,7 @@
383 usart0: serial@fffb0000 { 478 usart0: serial@fffb0000 {
384 compatible = "atmel,at91sam9260-usart"; 479 compatible = "atmel,at91sam9260-usart";
385 reg = <0xfffb0000 0x200>; 480 reg = <0xfffb0000 0x200>;
386 interrupts = <6 4 5>; 481 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>;
387 atmel,use-dma-rx; 482 atmel,use-dma-rx;
388 atmel,use-dma-tx; 483 atmel,use-dma-tx;
389 pinctrl-names = "default"; 484 pinctrl-names = "default";
@@ -394,7 +489,7 @@
394 usart1: serial@fffb4000 { 489 usart1: serial@fffb4000 {
395 compatible = "atmel,at91sam9260-usart"; 490 compatible = "atmel,at91sam9260-usart";
396 reg = <0xfffb4000 0x200>; 491 reg = <0xfffb4000 0x200>;
397 interrupts = <7 4 5>; 492 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
398 atmel,use-dma-rx; 493 atmel,use-dma-rx;
399 atmel,use-dma-tx; 494 atmel,use-dma-tx;
400 pinctrl-names = "default"; 495 pinctrl-names = "default";
@@ -405,7 +500,7 @@
405 usart2: serial@fffb8000 { 500 usart2: serial@fffb8000 {
406 compatible = "atmel,at91sam9260-usart"; 501 compatible = "atmel,at91sam9260-usart";
407 reg = <0xfffb8000 0x200>; 502 reg = <0xfffb8000 0x200>;
408 interrupts = <8 4 5>; 503 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
409 atmel,use-dma-rx; 504 atmel,use-dma-rx;
410 atmel,use-dma-tx; 505 atmel,use-dma-tx;
411 pinctrl-names = "default"; 506 pinctrl-names = "default";
@@ -416,7 +511,7 @@
416 usart3: serial@fffd0000 { 511 usart3: serial@fffd0000 {
417 compatible = "atmel,at91sam9260-usart"; 512 compatible = "atmel,at91sam9260-usart";
418 reg = <0xfffd0000 0x200>; 513 reg = <0xfffd0000 0x200>;
419 interrupts = <23 4 5>; 514 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 5>;
420 atmel,use-dma-rx; 515 atmel,use-dma-rx;
421 atmel,use-dma-tx; 516 atmel,use-dma-tx;
422 pinctrl-names = "default"; 517 pinctrl-names = "default";
@@ -427,7 +522,7 @@
427 uart0: serial@fffd4000 { 522 uart0: serial@fffd4000 {
428 compatible = "atmel,at91sam9260-usart"; 523 compatible = "atmel,at91sam9260-usart";
429 reg = <0xfffd4000 0x200>; 524 reg = <0xfffd4000 0x200>;
430 interrupts = <24 4 5>; 525 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 5>;
431 atmel,use-dma-rx; 526 atmel,use-dma-rx;
432 atmel,use-dma-tx; 527 atmel,use-dma-tx;
433 pinctrl-names = "default"; 528 pinctrl-names = "default";
@@ -438,7 +533,7 @@
438 uart1: serial@fffd8000 { 533 uart1: serial@fffd8000 {
439 compatible = "atmel,at91sam9260-usart"; 534 compatible = "atmel,at91sam9260-usart";
440 reg = <0xfffd8000 0x200>; 535 reg = <0xfffd8000 0x200>;
441 interrupts = <25 4 5>; 536 interrupts = <25 IRQ_TYPE_LEVEL_HIGH 5>;
442 atmel,use-dma-rx; 537 atmel,use-dma-rx;
443 atmel,use-dma-tx; 538 atmel,use-dma-tx;
444 pinctrl-names = "default"; 539 pinctrl-names = "default";
@@ -449,7 +544,7 @@
449 macb0: ethernet@fffc4000 { 544 macb0: ethernet@fffc4000 {
450 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 545 compatible = "cdns,at32ap7000-macb", "cdns,macb";
451 reg = <0xfffc4000 0x100>; 546 reg = <0xfffc4000 0x100>;
452 interrupts = <21 4 3>; 547 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
453 pinctrl-names = "default"; 548 pinctrl-names = "default";
454 pinctrl-0 = <&pinctrl_macb_rmii>; 549 pinctrl-0 = <&pinctrl_macb_rmii>;
455 status = "disabled"; 550 status = "disabled";
@@ -458,14 +553,14 @@
458 usb1: gadget@fffa4000 { 553 usb1: gadget@fffa4000 {
459 compatible = "atmel,at91rm9200-udc"; 554 compatible = "atmel,at91rm9200-udc";
460 reg = <0xfffa4000 0x4000>; 555 reg = <0xfffa4000 0x4000>;
461 interrupts = <10 4 2>; 556 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 2>;
462 status = "disabled"; 557 status = "disabled";
463 }; 558 };
464 559
465 i2c0: i2c@fffac000 { 560 i2c0: i2c@fffac000 {
466 compatible = "atmel,at91sam9260-i2c"; 561 compatible = "atmel,at91sam9260-i2c";
467 reg = <0xfffac000 0x100>; 562 reg = <0xfffac000 0x100>;
468 interrupts = <11 4 6>; 563 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 6>;
469 #address-cells = <1>; 564 #address-cells = <1>;
470 #size-cells = <0>; 565 #size-cells = <0>;
471 status = "disabled"; 566 status = "disabled";
@@ -474,7 +569,7 @@
474 mmc0: mmc@fffa8000 { 569 mmc0: mmc@fffa8000 {
475 compatible = "atmel,hsmci"; 570 compatible = "atmel,hsmci";
476 reg = <0xfffa8000 0x600>; 571 reg = <0xfffa8000 0x600>;
477 interrupts = <9 4 0>; 572 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 0>;
478 #address-cells = <1>; 573 #address-cells = <1>;
479 #size-cells = <0>; 574 #size-cells = <0>;
480 status = "disabled"; 575 status = "disabled";
@@ -483,7 +578,7 @@
483 ssc0: ssc@fffbc000 { 578 ssc0: ssc@fffbc000 {
484 compatible = "atmel,at91rm9200-ssc"; 579 compatible = "atmel,at91rm9200-ssc";
485 reg = <0xfffbc000 0x4000>; 580 reg = <0xfffbc000 0x4000>;
486 interrupts = <14 4 5>; 581 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
487 pinctrl-names = "default"; 582 pinctrl-names = "default";
488 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 583 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
489 status = "disabled"; 584 status = "disabled";
@@ -494,7 +589,7 @@
494 #size-cells = <0>; 589 #size-cells = <0>;
495 compatible = "atmel,at91rm9200-spi"; 590 compatible = "atmel,at91rm9200-spi";
496 reg = <0xfffc8000 0x200>; 591 reg = <0xfffc8000 0x200>;
497 interrupts = <12 4 3>; 592 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 3>;
498 pinctrl-names = "default"; 593 pinctrl-names = "default";
499 pinctrl-0 = <&pinctrl_spi0>; 594 pinctrl-0 = <&pinctrl_spi0>;
500 status = "disabled"; 595 status = "disabled";
@@ -505,7 +600,7 @@
505 #size-cells = <0>; 600 #size-cells = <0>;
506 compatible = "atmel,at91rm9200-spi"; 601 compatible = "atmel,at91rm9200-spi";
507 reg = <0xfffcc000 0x200>; 602 reg = <0xfffcc000 0x200>;
508 interrupts = <13 4 3>; 603 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>;
509 pinctrl-names = "default"; 604 pinctrl-names = "default";
510 pinctrl-0 = <&pinctrl_spi1>; 605 pinctrl-0 = <&pinctrl_spi1>;
511 status = "disabled"; 606 status = "disabled";
@@ -514,7 +609,7 @@
514 adc0: adc@fffe0000 { 609 adc0: adc@fffe0000 {
515 compatible = "atmel,at91sam9260-adc"; 610 compatible = "atmel,at91sam9260-adc";
516 reg = <0xfffe0000 0x100>; 611 reg = <0xfffe0000 0x100>;
517 interrupts = <5 4 0>; 612 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 0>;
518 atmel,adc-use-external-triggers; 613 atmel,adc-use-external-triggers;
519 atmel,adc-channels-used = <0xf>; 614 atmel,adc-channels-used = <0xf>;
520 atmel,adc-vref = <3300>; 615 atmel,adc-vref = <3300>;
@@ -567,8 +662,8 @@
567 atmel,nand-cmd-offset = <22>; 662 atmel,nand-cmd-offset = <22>;
568 pinctrl-names = "default"; 663 pinctrl-names = "default";
569 pinctrl-0 = <&pinctrl_nand>; 664 pinctrl-0 = <&pinctrl_nand>;
570 gpios = <&pioC 13 0 665 gpios = <&pioC 13 GPIO_ACTIVE_HIGH
571 &pioC 14 0 666 &pioC 14 GPIO_ACTIVE_HIGH
572 0 667 0
573 >; 668 >;
574 status = "disabled"; 669 status = "disabled";
@@ -577,21 +672,23 @@
577 usb0: ohci@00500000 { 672 usb0: ohci@00500000 {
578 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 673 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
579 reg = <0x00500000 0x100000>; 674 reg = <0x00500000 0x100000>;
580 interrupts = <20 4 2>; 675 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 2>;
581 status = "disabled"; 676 status = "disabled";
582 }; 677 };
583 }; 678 };
584 679
585 i2c@0 { 680 i2c@0 {
586 compatible = "i2c-gpio"; 681 compatible = "i2c-gpio";
587 gpios = <&pioA 23 0 /* sda */ 682 gpios = <&pioA 23 GPIO_ACTIVE_HIGH /* sda */
588 &pioA 24 0 /* scl */ 683 &pioA 24 GPIO_ACTIVE_HIGH /* scl */
589 >; 684 >;
590 i2c-gpio,sda-open-drain; 685 i2c-gpio,sda-open-drain;
591 i2c-gpio,scl-open-drain; 686 i2c-gpio,scl-open-drain;
592 i2c-gpio,delay-us = <2>; /* ~100 kHz */ 687 i2c-gpio,delay-us = <2>; /* ~100 kHz */
593 #address-cells = <1>; 688 #address-cells = <1>;
594 #size-cells = <0>; 689 #size-cells = <0>;
690 pinctrl-names = "default";
691 pinctrl-0 = <&pinctrl_i2c_gpio0>;
595 status = "disabled"; 692 status = "disabled";
596 }; 693 };
597}; 694};
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 94b58ab2cc08..d5bd65f74602 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -6,7 +6,10 @@
6 * Licensed under GPLv2 only. 6 * Licensed under GPLv2 only.
7 */ 7 */
8 8
9/include/ "skeleton.dtsi" 9#include "skeleton.dtsi"
10#include <dt-bindings/pinctrl/at91.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/gpio/gpio.h>
10 13
11/ { 14/ {
12 model = "Atmel AT91SAM9263 family SoC"; 15 model = "Atmel AT91SAM9263 family SoC";
@@ -29,8 +32,12 @@
29 ssc1 = &ssc1; 32 ssc1 = &ssc1;
30 }; 33 };
31 cpus { 34 cpus {
32 cpu@0 { 35 #address-cells = <0>;
33 compatible = "arm,arm926ejs"; 36 #size-cells = <0>;
37
38 cpu {
39 compatible = "arm,arm926ej-s";
40 device_type = "cpu";
34 }; 41 };
35 }; 42 };
36 43
@@ -72,13 +79,13 @@
72 pit: timer@fffffd30 { 79 pit: timer@fffffd30 {
73 compatible = "atmel,at91sam9260-pit"; 80 compatible = "atmel,at91sam9260-pit";
74 reg = <0xfffffd30 0xf>; 81 reg = <0xfffffd30 0xf>;
75 interrupts = <1 4 7>; 82 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
76 }; 83 };
77 84
78 tcb0: timer@fff7c000 { 85 tcb0: timer@fff7c000 {
79 compatible = "atmel,at91rm9200-tcb"; 86 compatible = "atmel,at91rm9200-tcb";
80 reg = <0xfff7c000 0x100>; 87 reg = <0xfff7c000 0x100>;
81 interrupts = <19 4 0>; 88 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>;
82 }; 89 };
83 90
84 rstc@fffffd00 { 91 rstc@fffffd00 {
@@ -110,221 +117,259 @@
110 dbgu { 117 dbgu {
111 pinctrl_dbgu: dbgu-0 { 118 pinctrl_dbgu: dbgu-0 {
112 atmel,pins = 119 atmel,pins =
113 <2 30 0x1 0x0 /* PC30 periph A */ 120 <AT91_PIOC 30 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC30 periph A */
114 2 31 0x1 0x1>; /* PC31 periph with pullup */ 121 AT91_PIOC 31 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC31 periph with pullup */
115 }; 122 };
116 }; 123 };
117 124
118 usart0 { 125 usart0 {
119 pinctrl_usart0: usart0-0 { 126 pinctrl_usart0: usart0-0 {
120 atmel,pins = 127 atmel,pins =
121 <0 26 0x1 0x1 /* PA26 periph A with pullup */ 128 <AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA26 periph A with pullup */
122 0 27 0x1 0x0>; /* PA27 periph A */ 129 AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA27 periph A */
123 }; 130 };
124 131
125 pinctrl_usart0_rts: usart0_rts-0 { 132 pinctrl_usart0_rts: usart0_rts-0 {
126 atmel,pins = 133 atmel,pins =
127 <0 28 0x1 0x0>; /* PA28 periph A */ 134 <AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA28 periph A */
128 }; 135 };
129 136
130 pinctrl_usart0_cts: usart0_cts-0 { 137 pinctrl_usart0_cts: usart0_cts-0 {
131 atmel,pins = 138 atmel,pins =
132 <0 29 0x1 0x0>; /* PA29 periph A */ 139 <AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA29 periph A */
133 }; 140 };
134 }; 141 };
135 142
136 usart1 { 143 usart1 {
137 pinctrl_usart1: usart1-0 { 144 pinctrl_usart1: usart1-0 {
138 atmel,pins = 145 atmel,pins =
139 <3 0 0x1 0x1 /* PD0 periph A with pullup */ 146 <AT91_PIOD 0 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD0 periph A with pullup */
140 3 1 0x1 0x0>; /* PD1 periph A */ 147 AT91_PIOD 1 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD1 periph A */
141 }; 148 };
142 149
143 pinctrl_usart1_rts: usart1_rts-0 { 150 pinctrl_usart1_rts: usart1_rts-0 {
144 atmel,pins = 151 atmel,pins =
145 <3 7 0x2 0x0>; /* PD7 periph B */ 152 <AT91_PIOD 7 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PD7 periph B */
146 }; 153 };
147 154
148 pinctrl_usart1_cts: usart1_cts-0 { 155 pinctrl_usart1_cts: usart1_cts-0 {
149 atmel,pins = 156 atmel,pins =
150 <3 8 0x2 0x0>; /* PD8 periph B */ 157 <AT91_PIOD 8 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PD8 periph B */
151 }; 158 };
152 }; 159 };
153 160
154 usart2 { 161 usart2 {
155 pinctrl_usart2: usart2-0 { 162 pinctrl_usart2: usart2-0 {
156 atmel,pins = 163 atmel,pins =
157 <3 2 0x1 0x1 /* PD2 periph A with pullup */ 164 <AT91_PIOD 2 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD2 periph A with pullup */
158 3 3 0x1 0x0>; /* PD3 periph A */ 165 AT91_PIOD 3 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD3 periph A */
159 }; 166 };
160 167
161 pinctrl_usart2_rts: usart2_rts-0 { 168 pinctrl_usart2_rts: usart2_rts-0 {
162 atmel,pins = 169 atmel,pins =
163 <3 5 0x2 0x0>; /* PD5 periph B */ 170 <AT91_PIOD 5 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PD5 periph B */
164 }; 171 };
165 172
166 pinctrl_usart2_cts: usart2_cts-0 { 173 pinctrl_usart2_cts: usart2_cts-0 {
167 atmel,pins = 174 atmel,pins =
168 <4 6 0x2 0x0>; /* PD6 periph B */ 175 <AT91_PIOD 6 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PD6 periph B */
169 }; 176 };
170 }; 177 };
171 178
172 nand { 179 nand {
173 pinctrl_nand: nand-0 { 180 pinctrl_nand: nand-0 {
174 atmel,pins = 181 atmel,pins =
175 <0 22 0x0 0x1 /* PA22 gpio RDY pin pull_up*/ 182 <AT91_PIOA 22 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PA22 gpio RDY pin pull_up*/
176 3 15 0x0 0x1>; /* PD15 gpio enable pin pull_up */ 183 AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PD15 gpio enable pin pull_up */
177 }; 184 };
178 }; 185 };
179 186
180 macb { 187 macb {
181 pinctrl_macb_rmii: macb_rmii-0 { 188 pinctrl_macb_rmii: macb_rmii-0 {
182 atmel,pins = 189 atmel,pins =
183 <2 25 0x2 0x0 /* PC25 periph B */ 190 <AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC25 periph B */
184 4 21 0x1 0x0 /* PE21 periph A */ 191 AT91_PIOE 21 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE21 periph A */
185 4 23 0x1 0x0 /* PE23 periph A */ 192 AT91_PIOE 23 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE23 periph A */
186 4 24 0x1 0x0 /* PE24 periph A */ 193 AT91_PIOE 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE24 periph A */
187 4 25 0x1 0x0 /* PE25 periph A */ 194 AT91_PIOE 25 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE25 periph A */
188 4 26 0x1 0x0 /* PE26 periph A */ 195 AT91_PIOE 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE26 periph A */
189 4 27 0x1 0x0 /* PE27 periph A */ 196 AT91_PIOE 27 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE27 periph A */
190 4 28 0x1 0x0 /* PE28 periph A */ 197 AT91_PIOE 28 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE28 periph A */
191 4 29 0x1 0x0 /* PE29 periph A */ 198 AT91_PIOE 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PE29 periph A */
192 4 30 0x1 0x0>; /* PE30 periph A */ 199 AT91_PIOE 30 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PE30 periph A */
193 }; 200 };
194 201
195 pinctrl_macb_rmii_mii: macb_rmii_mii-0 { 202 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
196 atmel,pins = 203 atmel,pins =
197 <2 20 0x2 0x0 /* PC20 periph B */ 204 <AT91_PIOC 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC20 periph B */
198 2 21 0x2 0x0 /* PC21 periph B */ 205 AT91_PIOC 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC21 periph B */
199 2 22 0x2 0x0 /* PC22 periph B */ 206 AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC22 periph B */
200 2 23 0x2 0x0 /* PC23 periph B */ 207 AT91_PIOC 23 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC23 periph B */
201 2 24 0x2 0x0 /* PC24 periph B */ 208 AT91_PIOC 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC24 periph B */
202 2 25 0x2 0x0 /* PC25 periph B */ 209 AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC25 periph B */
203 2 27 0x2 0x0 /* PC27 periph B */ 210 AT91_PIOC 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC27 periph B */
204 4 22 0x2 0x0>; /* PE22 periph B */ 211 AT91_PIOE 22 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE22 periph B */
205 }; 212 };
206 }; 213 };
207 214
208 mmc0 { 215 mmc0 {
209 pinctrl_mmc0_clk: mmc0_clk-0 { 216 pinctrl_mmc0_clk: mmc0_clk-0 {
210 atmel,pins = 217 atmel,pins =
211 <0 12 0x1 0x0>; /* PA12 periph A */ 218 <AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA12 periph A */
212 }; 219 };
213 220
214 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 { 221 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
215 atmel,pins = 222 atmel,pins =
216 <0 1 0x1 0x1 /* PA1 periph A with pullup */ 223 <AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA1 periph A with pullup */
217 0 0 0x1 0x1>; /* PA0 periph A with pullup */ 224 AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA0 periph A with pullup */
218 }; 225 };
219 226
220 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 { 227 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
221 atmel,pins = 228 atmel,pins =
222 <0 3 0x1 0x1 /* PA3 periph A with pullup */ 229 <AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA3 periph A with pullup */
223 0 4 0x1 0x1 /* PA4 periph A with pullup */ 230 AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA4 periph A with pullup */
224 0 5 0x1 0x1>; /* PA5 periph A with pullup */ 231 AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA5 periph A with pullup */
225 }; 232 };
226 233
227 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 { 234 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
228 atmel,pins = 235 atmel,pins =
229 <0 16 0x1 0x1 /* PA16 periph A with pullup */ 236 <AT91_PIOA 16 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA16 periph A with pullup */
230 0 17 0x1 0x1>; /* PA17 periph A with pullup */ 237 AT91_PIOA 17 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA17 periph A with pullup */
231 }; 238 };
232 239
233 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 { 240 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
234 atmel,pins = 241 atmel,pins =
235 <0 18 0x1 0x1 /* PA18 periph A with pullup */ 242 <AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA18 periph A with pullup */
236 0 19 0x1 0x1 /* PA19 periph A with pullup */ 243 AT91_PIOA 19 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA19 periph A with pullup */
237 0 20 0x1 0x1>; /* PA20 periph A with pullup */ 244 AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA20 periph A with pullup */
238 }; 245 };
239 }; 246 };
240 247
241 mmc1 { 248 mmc1 {
242 pinctrl_mmc1_clk: mmc1_clk-0 { 249 pinctrl_mmc1_clk: mmc1_clk-0 {
243 atmel,pins = 250 atmel,pins =
244 <0 6 0x1 0x0>; /* PA6 periph A */ 251 <AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA6 periph A */
245 }; 252 };
246 253
247 pinctrl_mmc1_slot0_cmd_dat0: mmc1_slot0_cmd_dat0-0 { 254 pinctrl_mmc1_slot0_cmd_dat0: mmc1_slot0_cmd_dat0-0 {
248 atmel,pins = 255 atmel,pins =
249 <0 7 0x1 0x1 /* PA7 periph A with pullup */ 256 <AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA7 periph A with pullup */
250 0 8 0x1 0x1>; /* PA8 periph A with pullup */ 257 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA8 periph A with pullup */
251 }; 258 };
252 259
253 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 { 260 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
254 atmel,pins = 261 atmel,pins =
255 <0 9 0x1 0x1 /* PA9 periph A with pullup */ 262 <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA9 periph A with pullup */
256 0 10 0x1 0x1 /* PA10 periph A with pullup */ 263 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA10 periph A with pullup */
257 0 11 0x1 0x1>; /* PA11 periph A with pullup */ 264 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA11 periph A with pullup */
258 }; 265 };
259 266
260 pinctrl_mmc1_slot1_cmd_dat0: mmc1_slot1_cmd_dat0-0 { 267 pinctrl_mmc1_slot1_cmd_dat0: mmc1_slot1_cmd_dat0-0 {
261 atmel,pins = 268 atmel,pins =
262 <0 21 0x1 0x1 /* PA21 periph A with pullup */ 269 <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA21 periph A with pullup */
263 0 22 0x1 0x1>; /* PA22 periph A with pullup */ 270 AT91_PIOA 22 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA22 periph A with pullup */
264 }; 271 };
265 272
266 pinctrl_mmc1_slot1_dat1_3: mmc1_slot1_dat1_3-0 { 273 pinctrl_mmc1_slot1_dat1_3: mmc1_slot1_dat1_3-0 {
267 atmel,pins = 274 atmel,pins =
268 <0 23 0x1 0x1 /* PA23 periph A with pullup */ 275 <AT91_PIOA 23 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA23 periph A with pullup */
269 0 24 0x1 0x1 /* PA24 periph A with pullup */ 276 AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA24 periph A with pullup */
270 0 25 0x1 0x1>; /* PA25 periph A with pullup */ 277 AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA25 periph A with pullup */
271 }; 278 };
272 }; 279 };
273 280
274 ssc0 { 281 ssc0 {
275 pinctrl_ssc0_tx: ssc0_tx-0 { 282 pinctrl_ssc0_tx: ssc0_tx-0 {
276 atmel,pins = 283 atmel,pins =
277 <1 0 0x2 0x0 /* PB0 periph B */ 284 <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB0 periph B */
278 1 1 0x2 0x0 /* PB1 periph B */ 285 AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB1 periph B */
279 1 2 0x2 0x0>; /* PB2 periph B */ 286 AT91_PIOB 2 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB2 periph B */
280 }; 287 };
281 288
282 pinctrl_ssc0_rx: ssc0_rx-0 { 289 pinctrl_ssc0_rx: ssc0_rx-0 {
283 atmel,pins = 290 atmel,pins =
284 <1 3 0x2 0x0 /* PB3 periph B */ 291 <AT91_PIOB 3 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB3 periph B */
285 1 4 0x2 0x0 /* PB4 periph B */ 292 AT91_PIOB 4 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB4 periph B */
286 1 5 0x2 0x0>; /* PB5 periph B */ 293 AT91_PIOB 5 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB5 periph B */
287 }; 294 };
288 }; 295 };
289 296
290 ssc1 { 297 ssc1 {
291 pinctrl_ssc1_tx: ssc1_tx-0 { 298 pinctrl_ssc1_tx: ssc1_tx-0 {
292 atmel,pins = 299 atmel,pins =
293 <1 6 0x1 0x0 /* PB6 periph A */ 300 <AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A */
294 1 7 0x1 0x0 /* PB7 periph A */ 301 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB7 periph A */
295 1 8 0x1 0x0>; /* PB8 periph A */ 302 AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB8 periph A */
296 }; 303 };
297 304
298 pinctrl_ssc1_rx: ssc1_rx-0 { 305 pinctrl_ssc1_rx: ssc1_rx-0 {
299 atmel,pins = 306 atmel,pins =
300 <1 9 0x1 0x0 /* PB9 periph A */ 307 <AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A */
301 1 10 0x1 0x0 /* PB10 periph A */ 308 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB10 periph A */
302 1 11 0x1 0x0>; /* PB11 periph A */ 309 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB11 periph A */
303 }; 310 };
304 }; 311 };
305 312
306 spi0 { 313 spi0 {
307 pinctrl_spi0: spi0-0 { 314 pinctrl_spi0: spi0-0 {
308 atmel,pins = 315 atmel,pins =
309 <0 0 0x2 0x0 /* PA0 periph B SPI0_MISO pin */ 316 <AT91_PIOA 0 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA0 periph B SPI0_MISO pin */
310 0 1 0x2 0x0 /* PA1 periph B SPI0_MOSI pin */ 317 AT91_PIOA 1 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA1 periph B SPI0_MOSI pin */
311 0 2 0x2 0x0>; /* PA2 periph B SPI0_SPCK pin */ 318 AT91_PIOA 2 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA2 periph B SPI0_SPCK pin */
312 }; 319 };
313 }; 320 };
314 321
315 spi1 { 322 spi1 {
316 pinctrl_spi1: spi1-0 { 323 pinctrl_spi1: spi1-0 {
317 atmel,pins = 324 atmel,pins =
318 <1 12 0x1 0x0 /* PB12 periph A SPI1_MISO pin */ 325 <AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A SPI1_MISO pin */
319 1 13 0x1 0x0 /* PB13 periph A SPI1_MOSI pin */ 326 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A SPI1_MOSI pin */
320 1 14 0x1 0x0>; /* PB14 periph A SPI1_SPCK pin */ 327 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB14 periph A SPI1_SPCK pin */
328 };
329 };
330
331 tcb0 {
332 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
333 atmel,pins = <AT91_PIOB 28 AT91_PERIPH_B AT91_PINCTRL_NONE>;
334 };
335
336 pinctrl_tcb0_tclk1: tcb0_tclk1-0 {
337 atmel,pins = <AT91_PIOC 28 AT91_PERIPH_B AT91_PINCTRL_NONE>;
338 };
339
340 pinctrl_tcb0_tclk2: tcb0_tclk2-0 {
341 atmel,pins = <AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE>;
342 };
343
344 pinctrl_tcb0_tioa0: tcb0_tioa0-0 {
345 atmel,pins = <AT91_PIOE 18 AT91_PERIPH_B AT91_PINCTRL_NONE>;
346 };
347
348 pinctrl_tcb0_tioa1: tcb0_tioa1-0 {
349 atmel,pins = <AT91_PIOE 8 AT91_PERIPH_B AT91_PINCTRL_NONE>;
350 };
351
352 pinctrl_tcb0_tioa2: tcb0_tioa2-0 {
353 atmel,pins = <AT91_PIOB 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;
354 };
355
356 pinctrl_tcb0_tiob0: tcb0_tiob0-0 {
357 atmel,pins = <AT91_PIOE 19 AT91_PERIPH_B AT91_PINCTRL_NONE>;
358 };
359
360 pinctrl_tcb0_tiob1: tcb0_tiob1-0 {
361 atmel,pins = <AT91_PIOE 9 AT91_PERIPH_B AT91_PINCTRL_NONE>;
362 };
363
364 pinctrl_tcb0_tiob2: tcb0_tiob2-0 {
365 atmel,pins = <AT91_PIOB 18 AT91_PERIPH_B AT91_PINCTRL_NONE>;
321 }; 366 };
322 }; 367 };
323 368
324 pioA: gpio@fffff200 { 369 pioA: gpio@fffff200 {
325 compatible = "atmel,at91rm9200-gpio"; 370 compatible = "atmel,at91rm9200-gpio";
326 reg = <0xfffff200 0x200>; 371 reg = <0xfffff200 0x200>;
327 interrupts = <2 4 1>; 372 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
328 #gpio-cells = <2>; 373 #gpio-cells = <2>;
329 gpio-controller; 374 gpio-controller;
330 interrupt-controller; 375 interrupt-controller;
@@ -334,7 +379,7 @@
334 pioB: gpio@fffff400 { 379 pioB: gpio@fffff400 {
335 compatible = "atmel,at91rm9200-gpio"; 380 compatible = "atmel,at91rm9200-gpio";
336 reg = <0xfffff400 0x200>; 381 reg = <0xfffff400 0x200>;
337 interrupts = <3 4 1>; 382 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
338 #gpio-cells = <2>; 383 #gpio-cells = <2>;
339 gpio-controller; 384 gpio-controller;
340 interrupt-controller; 385 interrupt-controller;
@@ -344,7 +389,7 @@
344 pioC: gpio@fffff600 { 389 pioC: gpio@fffff600 {
345 compatible = "atmel,at91rm9200-gpio"; 390 compatible = "atmel,at91rm9200-gpio";
346 reg = <0xfffff600 0x200>; 391 reg = <0xfffff600 0x200>;
347 interrupts = <4 4 1>; 392 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 1>;
348 #gpio-cells = <2>; 393 #gpio-cells = <2>;
349 gpio-controller; 394 gpio-controller;
350 interrupt-controller; 395 interrupt-controller;
@@ -354,7 +399,7 @@
354 pioD: gpio@fffff800 { 399 pioD: gpio@fffff800 {
355 compatible = "atmel,at91rm9200-gpio"; 400 compatible = "atmel,at91rm9200-gpio";
356 reg = <0xfffff800 0x200>; 401 reg = <0xfffff800 0x200>;
357 interrupts = <4 4 1>; 402 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 1>;
358 #gpio-cells = <2>; 403 #gpio-cells = <2>;
359 gpio-controller; 404 gpio-controller;
360 interrupt-controller; 405 interrupt-controller;
@@ -364,7 +409,7 @@
364 pioE: gpio@fffffa00 { 409 pioE: gpio@fffffa00 {
365 compatible = "atmel,at91rm9200-gpio"; 410 compatible = "atmel,at91rm9200-gpio";
366 reg = <0xfffffa00 0x200>; 411 reg = <0xfffffa00 0x200>;
367 interrupts = <4 4 1>; 412 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 1>;
368 #gpio-cells = <2>; 413 #gpio-cells = <2>;
369 gpio-controller; 414 gpio-controller;
370 interrupt-controller; 415 interrupt-controller;
@@ -375,7 +420,7 @@
375 dbgu: serial@ffffee00 { 420 dbgu: serial@ffffee00 {
376 compatible = "atmel,at91sam9260-usart"; 421 compatible = "atmel,at91sam9260-usart";
377 reg = <0xffffee00 0x200>; 422 reg = <0xffffee00 0x200>;
378 interrupts = <1 4 7>; 423 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
379 pinctrl-names = "default"; 424 pinctrl-names = "default";
380 pinctrl-0 = <&pinctrl_dbgu>; 425 pinctrl-0 = <&pinctrl_dbgu>;
381 status = "disabled"; 426 status = "disabled";
@@ -384,7 +429,7 @@
384 usart0: serial@fff8c000 { 429 usart0: serial@fff8c000 {
385 compatible = "atmel,at91sam9260-usart"; 430 compatible = "atmel,at91sam9260-usart";
386 reg = <0xfff8c000 0x200>; 431 reg = <0xfff8c000 0x200>;
387 interrupts = <7 4 5>; 432 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
388 atmel,use-dma-rx; 433 atmel,use-dma-rx;
389 atmel,use-dma-tx; 434 atmel,use-dma-tx;
390 pinctrl-names = "default"; 435 pinctrl-names = "default";
@@ -395,7 +440,7 @@
395 usart1: serial@fff90000 { 440 usart1: serial@fff90000 {
396 compatible = "atmel,at91sam9260-usart"; 441 compatible = "atmel,at91sam9260-usart";
397 reg = <0xfff90000 0x200>; 442 reg = <0xfff90000 0x200>;
398 interrupts = <8 4 5>; 443 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
399 atmel,use-dma-rx; 444 atmel,use-dma-rx;
400 atmel,use-dma-tx; 445 atmel,use-dma-tx;
401 pinctrl-names = "default"; 446 pinctrl-names = "default";
@@ -406,7 +451,7 @@
406 usart2: serial@fff94000 { 451 usart2: serial@fff94000 {
407 compatible = "atmel,at91sam9260-usart"; 452 compatible = "atmel,at91sam9260-usart";
408 reg = <0xfff94000 0x200>; 453 reg = <0xfff94000 0x200>;
409 interrupts = <9 4 5>; 454 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>;
410 atmel,use-dma-rx; 455 atmel,use-dma-rx;
411 atmel,use-dma-tx; 456 atmel,use-dma-tx;
412 pinctrl-names = "default"; 457 pinctrl-names = "default";
@@ -417,7 +462,7 @@
417 ssc0: ssc@fff98000 { 462 ssc0: ssc@fff98000 {
418 compatible = "atmel,at91rm9200-ssc"; 463 compatible = "atmel,at91rm9200-ssc";
419 reg = <0xfff98000 0x4000>; 464 reg = <0xfff98000 0x4000>;
420 interrupts = <16 4 5>; 465 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
421 pinctrl-names = "default"; 466 pinctrl-names = "default";
422 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 467 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
423 status = "disabled"; 468 status = "disabled";
@@ -426,7 +471,7 @@
426 ssc1: ssc@fff9c000 { 471 ssc1: ssc@fff9c000 {
427 compatible = "atmel,at91rm9200-ssc"; 472 compatible = "atmel,at91rm9200-ssc";
428 reg = <0xfff9c000 0x4000>; 473 reg = <0xfff9c000 0x4000>;
429 interrupts = <17 4 5>; 474 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
430 pinctrl-names = "default"; 475 pinctrl-names = "default";
431 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 476 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
432 status = "disabled"; 477 status = "disabled";
@@ -435,7 +480,7 @@
435 macb0: ethernet@fffbc000 { 480 macb0: ethernet@fffbc000 {
436 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 481 compatible = "cdns,at32ap7000-macb", "cdns,macb";
437 reg = <0xfffbc000 0x100>; 482 reg = <0xfffbc000 0x100>;
438 interrupts = <21 4 3>; 483 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 3>;
439 pinctrl-names = "default"; 484 pinctrl-names = "default";
440 pinctrl-0 = <&pinctrl_macb_rmii>; 485 pinctrl-0 = <&pinctrl_macb_rmii>;
441 status = "disabled"; 486 status = "disabled";
@@ -444,14 +489,14 @@
444 usb1: gadget@fff78000 { 489 usb1: gadget@fff78000 {
445 compatible = "atmel,at91rm9200-udc"; 490 compatible = "atmel,at91rm9200-udc";
446 reg = <0xfff78000 0x4000>; 491 reg = <0xfff78000 0x4000>;
447 interrupts = <24 4 2>; 492 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 2>;
448 status = "disabled"; 493 status = "disabled";
449 }; 494 };
450 495
451 i2c0: i2c@fff88000 { 496 i2c0: i2c@fff88000 {
452 compatible = "atmel,at91sam9263-i2c"; 497 compatible = "atmel,at91sam9263-i2c";
453 reg = <0xfff88000 0x100>; 498 reg = <0xfff88000 0x100>;
454 interrupts = <13 4 6>; 499 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>;
455 #address-cells = <1>; 500 #address-cells = <1>;
456 #size-cells = <0>; 501 #size-cells = <0>;
457 status = "disabled"; 502 status = "disabled";
@@ -460,7 +505,7 @@
460 mmc0: mmc@fff80000 { 505 mmc0: mmc@fff80000 {
461 compatible = "atmel,hsmci"; 506 compatible = "atmel,hsmci";
462 reg = <0xfff80000 0x600>; 507 reg = <0xfff80000 0x600>;
463 interrupts = <10 4 0>; 508 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 0>;
464 #address-cells = <1>; 509 #address-cells = <1>;
465 #size-cells = <0>; 510 #size-cells = <0>;
466 status = "disabled"; 511 status = "disabled";
@@ -469,7 +514,7 @@
469 mmc1: mmc@fff84000 { 514 mmc1: mmc@fff84000 {
470 compatible = "atmel,hsmci"; 515 compatible = "atmel,hsmci";
471 reg = <0xfff84000 0x600>; 516 reg = <0xfff84000 0x600>;
472 interrupts = <11 4 0>; 517 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
473 #address-cells = <1>; 518 #address-cells = <1>;
474 #size-cells = <0>; 519 #size-cells = <0>;
475 status = "disabled"; 520 status = "disabled";
@@ -486,7 +531,7 @@
486 #size-cells = <0>; 531 #size-cells = <0>;
487 compatible = "atmel,at91rm9200-spi"; 532 compatible = "atmel,at91rm9200-spi";
488 reg = <0xfffa4000 0x200>; 533 reg = <0xfffa4000 0x200>;
489 interrupts = <14 4 3>; 534 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 3>;
490 pinctrl-names = "default"; 535 pinctrl-names = "default";
491 pinctrl-0 = <&pinctrl_spi0>; 536 pinctrl-0 = <&pinctrl_spi0>;
492 status = "disabled"; 537 status = "disabled";
@@ -497,7 +542,7 @@
497 #size-cells = <0>; 542 #size-cells = <0>;
498 compatible = "atmel,at91rm9200-spi"; 543 compatible = "atmel,at91rm9200-spi";
499 reg = <0xfffa8000 0x200>; 544 reg = <0xfffa8000 0x200>;
500 interrupts = <15 4 3>; 545 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 3>;
501 pinctrl-names = "default"; 546 pinctrl-names = "default";
502 pinctrl-0 = <&pinctrl_spi1>; 547 pinctrl-0 = <&pinctrl_spi1>;
503 status = "disabled"; 548 status = "disabled";
@@ -515,8 +560,8 @@
515 atmel,nand-cmd-offset = <22>; 560 atmel,nand-cmd-offset = <22>;
516 pinctrl-names = "default"; 561 pinctrl-names = "default";
517 pinctrl-0 = <&pinctrl_nand>; 562 pinctrl-0 = <&pinctrl_nand>;
518 gpios = <&pioA 22 0 563 gpios = <&pioA 22 GPIO_ACTIVE_HIGH
519 &pioD 15 0 564 &pioD 15 GPIO_ACTIVE_HIGH
520 0 565 0
521 >; 566 >;
522 status = "disabled"; 567 status = "disabled";
@@ -525,15 +570,15 @@
525 usb0: ohci@00a00000 { 570 usb0: ohci@00a00000 {
526 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 571 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
527 reg = <0x00a00000 0x100000>; 572 reg = <0x00a00000 0x100000>;
528 interrupts = <29 4 2>; 573 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 2>;
529 status = "disabled"; 574 status = "disabled";
530 }; 575 };
531 }; 576 };
532 577
533 i2c@0 { 578 i2c@0 {
534 compatible = "i2c-gpio"; 579 compatible = "i2c-gpio";
535 gpios = <&pioB 4 0 /* sda */ 580 gpios = <&pioB 4 GPIO_ACTIVE_HIGH /* sda */
536 &pioB 5 0 /* scl */ 581 &pioB 5 GPIO_ACTIVE_HIGH /* scl */
537 >; 582 >;
538 i2c-gpio,sda-open-drain; 583 i2c-gpio,sda-open-drain;
539 i2c-gpio,scl-open-drain; 584 i2c-gpio,scl-open-drain;
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index 3b82d91e7fcc..70f835b55c0b 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2 only 6 * Licensed under GPLv2 only
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9263.dtsi" 9#include "at91sam9263.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel at91sam9263ek"; 12 model = "Atmel at91sam9263ek";
@@ -51,7 +51,7 @@
51 }; 51 };
52 52
53 usb1: gadget@fff78000 { 53 usb1: gadget@fff78000 {
54 atmel,vbus-gpio = <&pioA 25 0>; 54 atmel,vbus-gpio = <&pioA 25 GPIO_ACTIVE_HIGH>;
55 status = "okay"; 55 status = "okay";
56 }; 56 };
57 57
@@ -65,8 +65,8 @@
65 slot@0 { 65 slot@0 {
66 reg = <0>; 66 reg = <0>;
67 bus-width = <4>; 67 bus-width = <4>;
68 cd-gpios = <&pioE 18 0>; 68 cd-gpios = <&pioE 18 GPIO_ACTIVE_HIGH>;
69 wp-gpios = <&pioE 19 0>; 69 wp-gpios = <&pioE 19 GPIO_ACTIVE_HIGH>;
70 }; 70 };
71 }; 71 };
72 72
@@ -74,8 +74,8 @@
74 mmc0 { 74 mmc0 {
75 pinctrl_board_mmc0: mmc0-board { 75 pinctrl_board_mmc0: mmc0-board {
76 atmel,pins = 76 atmel,pins =
77 <5 18 0x0 0x5 /* PE18 gpio CD pin pull up and deglitch */ 77 <AT91_PIOE 18 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH /* PE18 gpio CD pin pull up and deglitch */
78 5 19 0x0 0x1>; /* PE19 gpio WP pin pull up */ 78 AT91_PIOE 19 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PE19 gpio WP pin pull up */
79 }; 79 };
80 }; 80 };
81 }; 81 };
@@ -89,6 +89,10 @@
89 reg = <0>; 89 reg = <0>;
90 }; 90 };
91 }; 91 };
92
93 watchdog@fffffd40 {
94 status = "okay";
95 };
92 }; 96 };
93 97
94 nand0: nand@40000000 { 98 nand0: nand@40000000 {
@@ -141,8 +145,8 @@
141 usb0: ohci@00a00000 { 145 usb0: ohci@00a00000 {
142 num-ports = <2>; 146 num-ports = <2>;
143 status = "okay"; 147 status = "okay";
144 atmel,vbus-gpio = <&pioA 24 0 148 atmel,vbus-gpio = <&pioA 24 GPIO_ACTIVE_HIGH
145 &pioA 21 0 149 &pioA 21 GPIO_ACTIVE_HIGH
146 >; 150 >;
147 }; 151 };
148 }; 152 };
@@ -152,13 +156,13 @@
152 156
153 d3 { 157 d3 {
154 label = "d3"; 158 label = "d3";
155 gpios = <&pioB 7 0>; 159 gpios = <&pioB 7 GPIO_ACTIVE_HIGH>;
156 linux,default-trigger = "heartbeat"; 160 linux,default-trigger = "heartbeat";
157 }; 161 };
158 162
159 d2 { 163 d2 {
160 label = "d2"; 164 label = "d2";
161 gpios = <&pioC 29 1>; 165 gpios = <&pioC 29 GPIO_ACTIVE_LOW>;
162 linux,default-trigger = "nand-disk"; 166 linux,default-trigger = "nand-disk";
163 }; 167 };
164 }; 168 };
@@ -168,14 +172,14 @@
168 172
169 left_click { 173 left_click {
170 label = "left_click"; 174 label = "left_click";
171 gpios = <&pioC 5 1>; 175 gpios = <&pioC 5 GPIO_ACTIVE_LOW>;
172 linux,code = <272>; 176 linux,code = <272>;
173 gpio-key,wakeup; 177 gpio-key,wakeup;
174 }; 178 };
175 179
176 right_click { 180 right_click {
177 label = "right_click"; 181 label = "right_click";
178 gpios = <&pioC 4 1>; 182 gpios = <&pioC 4 GPIO_ACTIVE_LOW>;
179 linux,code = <273>; 183 linux,code = <273>;
180 gpio-key,wakeup; 184 gpio-key,wakeup;
181 }; 185 };
diff --git a/arch/arm/boot/dts/at91sam9g15.dtsi b/arch/arm/boot/dts/at91sam9g15.dtsi
index 28467fd6bf96..cfd7044616d7 100644
--- a/arch/arm/boot/dts/at91sam9g15.dtsi
+++ b/arch/arm/boot/dts/at91sam9g15.dtsi
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8 8
9/include/ "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G15 SoC"; 12 model = "Atmel AT91SAM9G15 SoC";
diff --git a/arch/arm/boot/dts/at91sam9g15ek.dts b/arch/arm/boot/dts/at91sam9g15ek.dts
index 5427b2dba87e..26b0444b0f96 100644
--- a/arch/arm/boot/dts/at91sam9g15ek.dts
+++ b/arch/arm/boot/dts/at91sam9g15ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9g15.dtsi" 10#include "at91sam9g15.dtsi"
11/include/ "at91sam9x5ek.dtsi" 11#include "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9G15-EK"; 14 model = "Atmel AT91SAM9G15-EK";
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index 75ce6e760016..b8e79466014f 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8 8
9/include/ "at91sam9260.dtsi" 9#include "at91sam9260.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G20 family SoC"; 12 model = "Atmel AT91SAM9G20 family SoC";
diff --git a/arch/arm/boot/dts/at91sam9g20ek.dts b/arch/arm/boot/dts/at91sam9g20ek.dts
index e5324bf9d529..bbfd753112c9 100644
--- a/arch/arm/boot/dts/at91sam9g20ek.dts
+++ b/arch/arm/boot/dts/at91sam9g20ek.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g20ek_common.dtsi" 9#include "at91sam9g20ek_common.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel at91sam9g20ek"; 12 model = "Atmel at91sam9g20ek";
@@ -17,13 +17,13 @@
17 17
18 ds1 { 18 ds1 {
19 label = "ds1"; 19 label = "ds1";
20 gpios = <&pioA 9 0>; 20 gpios = <&pioA 9 GPIO_ACTIVE_HIGH>;
21 linux,default-trigger = "heartbeat"; 21 linux,default-trigger = "heartbeat";
22 }; 22 };
23 23
24 ds5 { 24 ds5 {
25 label = "ds5"; 25 label = "ds5";
26 gpios = <&pioA 6 1>; 26 gpios = <&pioA 6 GPIO_ACTIVE_LOW>;
27 }; 27 };
28 }; 28 };
29}; 29};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
index 66467b113126..bdb799bad179 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
+++ b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g20ek_common.dtsi" 9#include "at91sam9g20ek_common.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel at91sam9g20ek 2 mmc"; 12 model = "Atmel at91sam9g20ek 2 mmc";
@@ -23,7 +23,7 @@
23 slot@0 { 23 slot@0 {
24 reg = <0>; 24 reg = <0>;
25 bus-width = <4>; 25 bus-width = <4>;
26 cd-gpios = <&pioC 2 0>; 26 cd-gpios = <&pioC 2 GPIO_ACTIVE_HIGH>;
27 }; 27 };
28 }; 28 };
29 29
@@ -31,7 +31,7 @@
31 mmc0_slot0 { 31 mmc0_slot0 {
32 pinctrl_board_mmc0_slot0: mmc0_slot0-board { 32 pinctrl_board_mmc0_slot0: mmc0_slot0-board {
33 atmel,pins = 33 atmel,pins =
34 <2 2 0x0 0x5>; /* PC2 gpio CD pin pull up and deglitch */ 34 <AT91_PIOC 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PC2 gpio CD pin pull up and deglitch */
35 }; 35 };
36 }; 36 };
37 }; 37 };
@@ -43,13 +43,13 @@
43 43
44 ds1 { 44 ds1 {
45 label = "ds1"; 45 label = "ds1";
46 gpios = <&pioB 9 0>; 46 gpios = <&pioB 9 GPIO_ACTIVE_HIGH>;
47 linux,default-trigger = "heartbeat"; 47 linux,default-trigger = "heartbeat";
48 }; 48 };
49 49
50 ds5 { 50 ds5 {
51 label = "ds5"; 51 label = "ds5";
52 gpios = <&pioB 8 1>; 52 gpios = <&pioB 8 GPIO_ACTIVE_LOW>;
53 }; 53 };
54 }; 54 };
55}; 55};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index 6a92c5baef8c..137354689ad0 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -5,7 +5,7 @@
5 * 5 *
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/include/ "at91sam9g20.dtsi" 8#include "at91sam9g20.dtsi"
9 9
10/ { 10/ {
11 11
@@ -34,10 +34,17 @@
34 board { 34 board {
35 pinctrl_pck0_as_mck: pck0_as_mck { 35 pinctrl_pck0_as_mck: pck0_as_mck {
36 atmel,pins = 36 atmel,pins =
37 <2 1 0x2 0x0>; /* PC1 periph B */ 37 <AT91_PIOC 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC1 periph B */
38 }; 38 };
39 39
40 }; 40 };
41
42 mmc0_slot1 {
43 pinctrl_board_mmc0_slot1: mmc0_slot1-board {
44 atmel,pins =
45 <AT91_PIOC 9 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PC9 gpio CD pin pull up and deglitch */
46 };
47 };
41 }; 48 };
42 49
43 dbgu: serial@fffff200 { 50 dbgu: serial@fffff200 {
@@ -65,7 +72,7 @@
65 }; 72 };
66 73
67 usb1: gadget@fffa4000 { 74 usb1: gadget@fffa4000 {
68 atmel,vbus-gpio = <&pioC 5 0>; 75 atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
69 status = "okay"; 76 status = "okay";
70 }; 77 };
71 78
@@ -79,16 +86,7 @@
79 slot@1 { 86 slot@1 {
80 reg = <1>; 87 reg = <1>;
81 bus-width = <4>; 88 bus-width = <4>;
82 cd-gpios = <&pioC 9 0>; 89 cd-gpios = <&pioC 9 GPIO_ACTIVE_HIGH>;
83 };
84 };
85
86 pinctrl@fffff400 {
87 mmc0_slot1 {
88 pinctrl_board_mmc0_slot1: mmc0_slot1-board {
89 atmel,pins =
90 <2 9 0x0 0x5>; /* PC9 gpio CD pin pull up and deglitch */
91 };
92 }; 90 };
93 }; 91 };
94 92
@@ -106,6 +104,10 @@
106 reg = <1>; 104 reg = <1>;
107 }; 105 };
108 }; 106 };
107
108 watchdog@fffffd40 {
109 status = "okay";
110 };
109 }; 111 };
110 112
111 nand0: nand@40000000 { 113 nand0: nand@40000000 {
@@ -180,14 +182,14 @@
180 182
181 btn3 { 183 btn3 {
182 label = "Button 3"; 184 label = "Button 3";
183 gpios = <&pioA 30 1>; 185 gpios = <&pioA 30 GPIO_ACTIVE_LOW>;
184 linux,code = <0x103>; 186 linux,code = <0x103>;
185 gpio-key,wakeup; 187 gpio-key,wakeup;
186 }; 188 };
187 189
188 btn4 { 190 btn4 {
189 label = "Button 4"; 191 label = "Button 4";
190 gpios = <&pioA 31 1>; 192 gpios = <&pioA 31 GPIO_ACTIVE_LOW>;
191 linux,code = <0x104>; 193 linux,code = <0x104>;
192 gpio-key,wakeup; 194 gpio-key,wakeup;
193 }; 195 };
diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
index 5fd32df03f25..b4ec6fe53fc7 100644
--- a/arch/arm/boot/dts/at91sam9g25.dtsi
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8 8
9/include/ "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G25 SoC"; 12 model = "Atmel AT91SAM9G25 SoC";
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index a1c511fecdc1..1e4c49c584d3 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9g25.dtsi" 10#include "at91sam9g25.dtsi"
11/include/ "at91sam9x5ek.dtsi" 11#include "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9G25-EK"; 14 model = "Atmel AT91SAM9G25-EK";
diff --git a/arch/arm/boot/dts/at91sam9g35.dtsi b/arch/arm/boot/dts/at91sam9g35.dtsi
index d6fa8af50724..bebf9f55614b 100644
--- a/arch/arm/boot/dts/at91sam9g35.dtsi
+++ b/arch/arm/boot/dts/at91sam9g35.dtsi
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8 8
9/include/ "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9G35 SoC"; 12 model = "Atmel AT91SAM9G35 SoC";
diff --git a/arch/arm/boot/dts/at91sam9g35ek.dts b/arch/arm/boot/dts/at91sam9g35ek.dts
index 6f58ab8d21f5..641a9bf89ed1 100644
--- a/arch/arm/boot/dts/at91sam9g35ek.dts
+++ b/arch/arm/boot/dts/at91sam9g35ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9g35.dtsi" 10#include "at91sam9g35.dtsi"
11/include/ "at91sam9x5ek.dtsi" 11#include "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9G35-EK"; 14 model = "Atmel AT91SAM9G35-EK";
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index bf18a735c37d..c3e514837074 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -9,7 +9,11 @@
9 * Licensed under GPLv2 or later. 9 * Licensed under GPLv2 or later.
10 */ 10 */
11 11
12/include/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13#include <dt-bindings/dma/at91.h>
14#include <dt-bindings/pinctrl/at91.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/gpio/gpio.h>
13 17
14/ { 18/ {
15 model = "Atmel AT91SAM9G45 family SoC"; 19 model = "Atmel AT91SAM9G45 family SoC";
@@ -35,8 +39,12 @@
35 ssc1 = &ssc1; 39 ssc1 = &ssc1;
36 }; 40 };
37 cpus { 41 cpus {
38 cpu@0 { 42 #address-cells = <0>;
39 compatible = "arm,arm926ejs"; 43 #size-cells = <0>;
44
45 cpu {
46 compatible = "arm,arm926ej-s";
47 device_type = "cpu";
40 }; 48 };
41 }; 49 };
42 50
@@ -83,7 +91,7 @@
83 pit: timer@fffffd30 { 91 pit: timer@fffffd30 {
84 compatible = "atmel,at91sam9260-pit"; 92 compatible = "atmel,at91sam9260-pit";
85 reg = <0xfffffd30 0xf>; 93 reg = <0xfffffd30 0xf>;
86 interrupts = <1 4 7>; 94 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
87 }; 95 };
88 96
89 97
@@ -95,19 +103,19 @@
95 tcb0: timer@fff7c000 { 103 tcb0: timer@fff7c000 {
96 compatible = "atmel,at91rm9200-tcb"; 104 compatible = "atmel,at91rm9200-tcb";
97 reg = <0xfff7c000 0x100>; 105 reg = <0xfff7c000 0x100>;
98 interrupts = <18 4 0>; 106 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
99 }; 107 };
100 108
101 tcb1: timer@fffd4000 { 109 tcb1: timer@fffd4000 {
102 compatible = "atmel,at91rm9200-tcb"; 110 compatible = "atmel,at91rm9200-tcb";
103 reg = <0xfffd4000 0x100>; 111 reg = <0xfffd4000 0x100>;
104 interrupts = <18 4 0>; 112 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 0>;
105 }; 113 };
106 114
107 dma: dma-controller@ffffec00 { 115 dma: dma-controller@ffffec00 {
108 compatible = "atmel,at91sam9g45-dma"; 116 compatible = "atmel,at91sam9g45-dma";
109 reg = <0xffffec00 0x200>; 117 reg = <0xffffec00 0x200>;
110 interrupts = <21 4 0>; 118 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 0>;
111 #dma-cells = <2>; 119 #dma-cells = <2>;
112 }; 120 };
113 121
@@ -130,221 +138,297 @@
130 dbgu { 138 dbgu {
131 pinctrl_dbgu: dbgu-0 { 139 pinctrl_dbgu: dbgu-0 {
132 atmel,pins = 140 atmel,pins =
133 <1 12 0x1 0x0 /* PB12 periph A */ 141 <AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A */
134 1 13 0x1 0x0>; /* PB13 periph A */ 142 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB13 periph A */
135 }; 143 };
136 }; 144 };
137 145
138 usart0 { 146 usart0 {
139 pinctrl_usart0: usart0-0 { 147 pinctrl_usart0: usart0-0 {
140 atmel,pins = 148 atmel,pins =
141 <1 19 0x1 0x1 /* PB19 periph A with pullup */ 149 <AT91_PIOB 19 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB19 periph A with pullup */
142 1 18 0x1 0x0>; /* PB18 periph A */ 150 AT91_PIOB 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB18 periph A */
143 }; 151 };
144 152
145 pinctrl_usart0_rts: usart0_rts-0 { 153 pinctrl_usart0_rts: usart0_rts-0 {
146 atmel,pins = 154 atmel,pins =
147 <1 17 0x2 0x0>; /* PB17 periph B */ 155 <AT91_PIOB 17 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB17 periph B */
148 }; 156 };
149 157
150 pinctrl_usart0_cts: usart0_cts-0 { 158 pinctrl_usart0_cts: usart0_cts-0 {
151 atmel,pins = 159 atmel,pins =
152 <1 15 0x2 0x0>; /* PB15 periph B */ 160 <AT91_PIOB 15 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB15 periph B */
153 }; 161 };
154 }; 162 };
155 163
156 uart1 { 164 uart1 {
157 pinctrl_usart1: usart1-0 { 165 pinctrl_usart1: usart1-0 {
158 atmel,pins = 166 atmel,pins =
159 <1 4 0x1 0x1 /* PB4 periph A with pullup */ 167 <AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB4 periph A with pullup */
160 1 5 0x1 0x0>; /* PB5 periph A */ 168 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB5 periph A */
161 }; 169 };
162 170
163 pinctrl_usart1_rts: usart1_rts-0 { 171 pinctrl_usart1_rts: usart1_rts-0 {
164 atmel,pins = 172 atmel,pins =
165 <3 16 0x1 0x0>; /* PD16 periph A */ 173 <AT91_PIOD 16 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD16 periph A */
166 }; 174 };
167 175
168 pinctrl_usart1_cts: usart1_cts-0 { 176 pinctrl_usart1_cts: usart1_cts-0 {
169 atmel,pins = 177 atmel,pins =
170 <3 17 0x1 0x0>; /* PD17 periph A */ 178 <AT91_PIOD 17 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD17 periph A */
171 }; 179 };
172 }; 180 };
173 181
174 usart2 { 182 usart2 {
175 pinctrl_usart2: usart2-0 { 183 pinctrl_usart2: usart2-0 {
176 atmel,pins = 184 atmel,pins =
177 <1 6 0x1 0x1 /* PB6 periph A with pullup */ 185 <AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB6 periph A with pullup */
178 1 7 0x1 0x0>; /* PB7 periph A */ 186 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB7 periph A */
179 }; 187 };
180 188
181 pinctrl_usart2_rts: usart2_rts-0 { 189 pinctrl_usart2_rts: usart2_rts-0 {
182 atmel,pins = 190 atmel,pins =
183 <2 9 0x2 0x0>; /* PC9 periph B */ 191 <AT91_PIOC 9 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC9 periph B */
184 }; 192 };
185 193
186 pinctrl_usart2_cts: usart2_cts-0 { 194 pinctrl_usart2_cts: usart2_cts-0 {
187 atmel,pins = 195 atmel,pins =
188 <2 11 0x2 0x0>; /* PC11 periph B */ 196 <AT91_PIOC 11 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC11 periph B */
189 }; 197 };
190 }; 198 };
191 199
192 usart3 { 200 usart3 {
193 pinctrl_usart3: usart3-0 { 201 pinctrl_usart3: usart3-0 {
194 atmel,pins = 202 atmel,pins =
195 <1 8 0x1 0x1 /* PB9 periph A with pullup */ 203 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB9 periph A with pullup */
196 1 9 0x1 0x0>; /* PB8 periph A */ 204 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB8 periph A */
197 }; 205 };
198 206
199 pinctrl_usart3_rts: usart3_rts-0 { 207 pinctrl_usart3_rts: usart3_rts-0 {
200 atmel,pins = 208 atmel,pins =
201 <0 23 0x2 0x0>; /* PA23 periph B */ 209 <AT91_PIOA 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA23 periph B */
202 }; 210 };
203 211
204 pinctrl_usart3_cts: usart3_cts-0 { 212 pinctrl_usart3_cts: usart3_cts-0 {
205 atmel,pins = 213 atmel,pins =
206 <0 24 0x2 0x0>; /* PA24 periph B */ 214 <AT91_PIOA 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA24 periph B */
207 }; 215 };
208 }; 216 };
209 217
210 nand { 218 nand {
211 pinctrl_nand: nand-0 { 219 pinctrl_nand: nand-0 {
212 atmel,pins = 220 atmel,pins =
213 <2 8 0x0 0x1 /* PC8 gpio RDY pin pull_up*/ 221 <AT91_PIOC 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PC8 gpio RDY pin pull_up*/
214 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */ 222 AT91_PIOC 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PC14 gpio enable pin pull_up */
215 }; 223 };
216 }; 224 };
217 225
218 macb { 226 macb {
219 pinctrl_macb_rmii: macb_rmii-0 { 227 pinctrl_macb_rmii: macb_rmii-0 {
220 atmel,pins = 228 atmel,pins =
221 <0 10 0x1 0x0 /* PA10 periph A */ 229 <AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA10 periph A */
222 0 11 0x1 0x0 /* PA11 periph A */ 230 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A */
223 0 12 0x1 0x0 /* PA12 periph A */ 231 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A */
224 0 13 0x1 0x0 /* PA13 periph A */ 232 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA13 periph A */
225 0 14 0x1 0x0 /* PA14 periph A */ 233 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA14 periph A */
226 0 15 0x1 0x0 /* PA15 periph A */ 234 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA15 periph A */
227 0 16 0x1 0x0 /* PA16 periph A */ 235 AT91_PIOA 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA16 periph A */
228 0 17 0x1 0x0 /* PA17 periph A */ 236 AT91_PIOA 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA17 periph A */
229 0 18 0x1 0x0 /* PA18 periph A */ 237 AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA18 periph A */
230 0 19 0x1 0x0>; /* PA19 periph A */ 238 AT91_PIOA 19 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA19 periph A */
231 }; 239 };
232 240
233 pinctrl_macb_rmii_mii: macb_rmii_mii-0 { 241 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
234 atmel,pins = 242 atmel,pins =
235 <0 6 0x2 0x0 /* PA6 periph B */ 243 <AT91_PIOA 6 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA6 periph B */
236 0 7 0x2 0x0 /* PA7 periph B */ 244 AT91_PIOA 7 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA7 periph B */
237 0 8 0x2 0x0 /* PA8 periph B */ 245 AT91_PIOA 8 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA8 periph B */
238 0 9 0x2 0x0 /* PA9 periph B */ 246 AT91_PIOA 9 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA9 periph B */
239 0 27 0x2 0x0 /* PA27 periph B */ 247 AT91_PIOA 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA27 periph B */
240 0 28 0x2 0x0 /* PA28 periph B */ 248 AT91_PIOA 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA28 periph B */
241 0 29 0x2 0x0 /* PA29 periph B */ 249 AT91_PIOA 29 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA29 periph B */
242 0 30 0x2 0x0>; /* PA30 periph B */ 250 AT91_PIOA 30 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA30 periph B */
243 }; 251 };
244 }; 252 };
245 253
246 mmc0 { 254 mmc0 {
247 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 { 255 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
248 atmel,pins = 256 atmel,pins =
249 <0 0 0x1 0x0 /* PA0 periph A */ 257 <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA0 periph A */
250 0 1 0x1 0x1 /* PA1 periph A with pullup */ 258 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA1 periph A with pullup */
251 0 2 0x1 0x1>; /* PA2 periph A with pullup */ 259 AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA2 periph A with pullup */
252 }; 260 };
253 261
254 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 { 262 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
255 atmel,pins = 263 atmel,pins =
256 <0 3 0x1 0x1 /* PA3 periph A with pullup */ 264 <AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA3 periph A with pullup */
257 0 4 0x1 0x1 /* PA4 periph A with pullup */ 265 AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA4 periph A with pullup */
258 0 5 0x1 0x1>; /* PA5 periph A with pullup */ 266 AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA5 periph A with pullup */
259 }; 267 };
260 268
261 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 { 269 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 {
262 atmel,pins = 270 atmel,pins =
263 <0 6 0x1 0x1 /* PA6 periph A with pullup */ 271 <AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA6 periph A with pullup */
264 0 7 0x1 0x1 /* PA7 periph A with pullup */ 272 AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA7 periph A with pullup */
265 0 8 0x1 0x1 /* PA8 periph A with pullup */ 273 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA8 periph A with pullup */
266 0 9 0x1 0x1>; /* PA9 periph A with pullup */ 274 AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA9 periph A with pullup */
267 }; 275 };
268 }; 276 };
269 277
270 mmc1 { 278 mmc1 {
271 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 { 279 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 {
272 atmel,pins = 280 atmel,pins =
273 <0 31 0x1 0x0 /* PA31 periph A */ 281 <AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA31 periph A */
274 0 22 0x1 0x1 /* PA22 periph A with pullup */ 282 AT91_PIOA 22 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA22 periph A with pullup */
275 0 23 0x1 0x1>; /* PA23 periph A with pullup */ 283 AT91_PIOA 23 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA23 periph A with pullup */
276 }; 284 };
277 285
278 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 { 286 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
279 atmel,pins = 287 atmel,pins =
280 <0 24 0x1 0x1 /* PA24 periph A with pullup */ 288 <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA24 periph A with pullup */
281 0 25 0x1 0x1 /* PA25 periph A with pullup */ 289 AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA25 periph A with pullup */
282 0 26 0x1 0x1>; /* PA26 periph A with pullup */ 290 AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA26 periph A with pullup */
283 }; 291 };
284 292
285 pinctrl_mmc1_slot0_dat4_7: mmc1_slot0_dat4_7-0 { 293 pinctrl_mmc1_slot0_dat4_7: mmc1_slot0_dat4_7-0 {
286 atmel,pins = 294 atmel,pins =
287 <0 27 0x1 0x1 /* PA27 periph A with pullup */ 295 <AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA27 periph A with pullup */
288 0 28 0x1 0x1 /* PA28 periph A with pullup */ 296 AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA28 periph A with pullup */
289 0 29 0x1 0x1 /* PA29 periph A with pullup */ 297 AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA29 periph A with pullup */
290 0 20 0x1 0x1>; /* PA30 periph A with pullup */ 298 AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA30 periph A with pullup */
291 }; 299 };
292 }; 300 };
293 301
294 ssc0 { 302 ssc0 {
295 pinctrl_ssc0_tx: ssc0_tx-0 { 303 pinctrl_ssc0_tx: ssc0_tx-0 {
296 atmel,pins = 304 atmel,pins =
297 <3 0 0x1 0x0 /* PD0 periph A */ 305 <AT91_PIOD 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD0 periph A */
298 3 1 0x1 0x0 /* PD1 periph A */ 306 AT91_PIOD 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD1 periph A */
299 3 2 0x1 0x0>; /* PD2 periph A */ 307 AT91_PIOD 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD2 periph A */
300 }; 308 };
301 309
302 pinctrl_ssc0_rx: ssc0_rx-0 { 310 pinctrl_ssc0_rx: ssc0_rx-0 {
303 atmel,pins = 311 atmel,pins =
304 <3 3 0x1 0x0 /* PD3 periph A */ 312 <AT91_PIOD 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD3 periph A */
305 3 4 0x1 0x0 /* PD4 periph A */ 313 AT91_PIOD 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD4 periph A */
306 3 5 0x1 0x0>; /* PD5 periph A */ 314 AT91_PIOD 5 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD5 periph A */
307 }; 315 };
308 }; 316 };
309 317
310 ssc1 { 318 ssc1 {
311 pinctrl_ssc1_tx: ssc1_tx-0 { 319 pinctrl_ssc1_tx: ssc1_tx-0 {
312 atmel,pins = 320 atmel,pins =
313 <3 10 0x1 0x0 /* PD10 periph A */ 321 <AT91_PIOD 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD10 periph A */
314 3 11 0x1 0x0 /* PD11 periph A */ 322 AT91_PIOD 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD11 periph A */
315 3 12 0x1 0x0>; /* PD12 periph A */ 323 AT91_PIOD 12 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD12 periph A */
316 }; 324 };
317 325
318 pinctrl_ssc1_rx: ssc1_rx-0 { 326 pinctrl_ssc1_rx: ssc1_rx-0 {
319 atmel,pins = 327 atmel,pins =
320 <3 13 0x1 0x0 /* PD13 periph A */ 328 <AT91_PIOD 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD13 periph A */
321 3 14 0x1 0x0 /* PD14 periph A */ 329 AT91_PIOD 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD14 periph A */
322 3 15 0x1 0x0>; /* PD15 periph A */ 330 AT91_PIOD 15 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD15 periph A */
323 }; 331 };
324 }; 332 };
325 333
326 spi0 { 334 spi0 {
327 pinctrl_spi0: spi0-0 { 335 pinctrl_spi0: spi0-0 {
328 atmel,pins = 336 atmel,pins =
329 <1 0 0x1 0x0 /* PB0 periph A SPI0_MISO pin */ 337 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A SPI0_MISO pin */
330 1 1 0x1 0x0 /* PB1 periph A SPI0_MOSI pin */ 338 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A SPI0_MOSI pin */
331 1 2 0x1 0x0>; /* PB2 periph A SPI0_SPCK pin */ 339 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB2 periph A SPI0_SPCK pin */
332 }; 340 };
333 }; 341 };
334 342
335 spi1 { 343 spi1 {
336 pinctrl_spi1: spi1-0 { 344 pinctrl_spi1: spi1-0 {
337 atmel,pins = 345 atmel,pins =
338 <1 14 0x1 0x0 /* PB14 periph A SPI1_MISO pin */ 346 <AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A SPI1_MISO pin */
339 1 15 0x1 0x0 /* PB15 periph A SPI1_MOSI pin */ 347 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A SPI1_MOSI pin */
340 1 16 0x1 0x0>; /* PB16 periph A SPI1_SPCK pin */ 348 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB16 periph A SPI1_SPCK pin */
349 };
350 };
351
352 tcb0 {
353 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
354 atmel,pins = <AT91_PIOD 23 AT91_PERIPH_A AT91_PINCTRL_NONE>;
355 };
356
357 pinctrl_tcb0_tclk1: tcb0_tclk1-0 {
358 atmel,pins = <AT91_PIOD 29 AT91_PERIPH_A AT91_PINCTRL_NONE>;
359 };
360
361 pinctrl_tcb0_tclk2: tcb0_tclk2-0 {
362 atmel,pins = <AT91_PIOC 10 AT91_PERIPH_B AT91_PINCTRL_NONE>;
363 };
364
365 pinctrl_tcb0_tioa0: tcb0_tioa0-0 {
366 atmel,pins = <AT91_PIOD 20 AT91_PERIPH_A AT91_PINCTRL_NONE>;
367 };
368
369 pinctrl_tcb0_tioa1: tcb0_tioa1-0 {
370 atmel,pins = <AT91_PIOD 21 AT91_PERIPH_A AT91_PINCTRL_NONE>;
371 };
372
373 pinctrl_tcb0_tioa2: tcb0_tioa2-0 {
374 atmel,pins = <AT91_PIOD 22 AT91_PERIPH_A AT91_PINCTRL_NONE>;
375 };
376
377 pinctrl_tcb0_tiob0: tcb0_tiob0-0 {
378 atmel,pins = <AT91_PIOD 30 AT91_PERIPH_A AT91_PINCTRL_NONE>;
379 };
380
381 pinctrl_tcb0_tiob1: tcb0_tiob1-0 {
382 atmel,pins = <AT91_PIOD 31 AT91_PERIPH_A AT91_PINCTRL_NONE>;
383 };
384
385 pinctrl_tcb0_tiob2: tcb0_tiob2-0 {
386 atmel,pins = <AT91_PIOA 26 AT91_PERIPH_B AT91_PINCTRL_NONE>;
387 };
388 };
389
390 tcb1 {
391 pinctrl_tcb1_tclk0: tcb1_tclk0-0 {
392 atmel,pins = <AT91_PIOA 0 AT91_PERIPH_B AT91_PINCTRL_NONE>;
393 };
394
395 pinctrl_tcb1_tclk1: tcb1_tclk1-0 {
396 atmel,pins = <AT91_PIOA 3 AT91_PERIPH_B AT91_PINCTRL_NONE>;
397 };
398
399 pinctrl_tcb1_tclk2: tcb1_tclk2-0 {
400 atmel,pins = <AT91_PIOD 9 AT91_PERIPH_B AT91_PINCTRL_NONE>;
401 };
402
403 pinctrl_tcb1_tioa0: tcb1_tioa0-0 {
404 atmel,pins = <AT91_PIOA 1 AT91_PERIPH_B AT91_PINCTRL_NONE>;
405 };
406
407 pinctrl_tcb1_tioa1: tcb1_tioa1-0 {
408 atmel,pins = <AT91_PIOA 4 AT91_PERIPH_B AT91_PINCTRL_NONE>;
409 };
410
411 pinctrl_tcb1_tioa2: tcb1_tioa2-0 {
412 atmel,pins = <AT91_PIOD 7 AT91_PERIPH_B AT91_PINCTRL_NONE>;
413 };
414
415 pinctrl_tcb1_tiob0: tcb1_tiob0-0 {
416 atmel,pins = <AT91_PIOA 2 AT91_PERIPH_B AT91_PINCTRL_NONE>;
417 };
418
419 pinctrl_tcb1_tiob1: tcb1_tiob1-0 {
420 atmel,pins = <AT91_PIOA 5 AT91_PERIPH_B AT91_PINCTRL_NONE>;
421 };
422
423 pinctrl_tcb1_tiob2: tcb1_tiob2-0 {
424 atmel,pins = <AT91_PIOD 8 AT91_PERIPH_B AT91_PINCTRL_NONE>;
341 }; 425 };
342 }; 426 };
343 427
344 pioA: gpio@fffff200 { 428 pioA: gpio@fffff200 {
345 compatible = "atmel,at91rm9200-gpio"; 429 compatible = "atmel,at91rm9200-gpio";
346 reg = <0xfffff200 0x200>; 430 reg = <0xfffff200 0x200>;
347 interrupts = <2 4 1>; 431 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
348 #gpio-cells = <2>; 432 #gpio-cells = <2>;
349 gpio-controller; 433 gpio-controller;
350 interrupt-controller; 434 interrupt-controller;
@@ -354,7 +438,7 @@
354 pioB: gpio@fffff400 { 438 pioB: gpio@fffff400 {
355 compatible = "atmel,at91rm9200-gpio"; 439 compatible = "atmel,at91rm9200-gpio";
356 reg = <0xfffff400 0x200>; 440 reg = <0xfffff400 0x200>;
357 interrupts = <3 4 1>; 441 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
358 #gpio-cells = <2>; 442 #gpio-cells = <2>;
359 gpio-controller; 443 gpio-controller;
360 interrupt-controller; 444 interrupt-controller;
@@ -364,7 +448,7 @@
364 pioC: gpio@fffff600 { 448 pioC: gpio@fffff600 {
365 compatible = "atmel,at91rm9200-gpio"; 449 compatible = "atmel,at91rm9200-gpio";
366 reg = <0xfffff600 0x200>; 450 reg = <0xfffff600 0x200>;
367 interrupts = <4 4 1>; 451 interrupts = <4 IRQ_TYPE_LEVEL_HIGH 1>;
368 #gpio-cells = <2>; 452 #gpio-cells = <2>;
369 gpio-controller; 453 gpio-controller;
370 interrupt-controller; 454 interrupt-controller;
@@ -374,7 +458,7 @@
374 pioD: gpio@fffff800 { 458 pioD: gpio@fffff800 {
375 compatible = "atmel,at91rm9200-gpio"; 459 compatible = "atmel,at91rm9200-gpio";
376 reg = <0xfffff800 0x200>; 460 reg = <0xfffff800 0x200>;
377 interrupts = <5 4 1>; 461 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 1>;
378 #gpio-cells = <2>; 462 #gpio-cells = <2>;
379 gpio-controller; 463 gpio-controller;
380 interrupt-controller; 464 interrupt-controller;
@@ -384,7 +468,7 @@
384 pioE: gpio@fffffa00 { 468 pioE: gpio@fffffa00 {
385 compatible = "atmel,at91rm9200-gpio"; 469 compatible = "atmel,at91rm9200-gpio";
386 reg = <0xfffffa00 0x200>; 470 reg = <0xfffffa00 0x200>;
387 interrupts = <5 4 1>; 471 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 1>;
388 #gpio-cells = <2>; 472 #gpio-cells = <2>;
389 gpio-controller; 473 gpio-controller;
390 interrupt-controller; 474 interrupt-controller;
@@ -395,7 +479,7 @@
395 dbgu: serial@ffffee00 { 479 dbgu: serial@ffffee00 {
396 compatible = "atmel,at91sam9260-usart"; 480 compatible = "atmel,at91sam9260-usart";
397 reg = <0xffffee00 0x200>; 481 reg = <0xffffee00 0x200>;
398 interrupts = <1 4 7>; 482 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
399 pinctrl-names = "default"; 483 pinctrl-names = "default";
400 pinctrl-0 = <&pinctrl_dbgu>; 484 pinctrl-0 = <&pinctrl_dbgu>;
401 status = "disabled"; 485 status = "disabled";
@@ -404,7 +488,7 @@
404 usart0: serial@fff8c000 { 488 usart0: serial@fff8c000 {
405 compatible = "atmel,at91sam9260-usart"; 489 compatible = "atmel,at91sam9260-usart";
406 reg = <0xfff8c000 0x200>; 490 reg = <0xfff8c000 0x200>;
407 interrupts = <7 4 5>; 491 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
408 atmel,use-dma-rx; 492 atmel,use-dma-rx;
409 atmel,use-dma-tx; 493 atmel,use-dma-tx;
410 pinctrl-names = "default"; 494 pinctrl-names = "default";
@@ -415,7 +499,7 @@
415 usart1: serial@fff90000 { 499 usart1: serial@fff90000 {
416 compatible = "atmel,at91sam9260-usart"; 500 compatible = "atmel,at91sam9260-usart";
417 reg = <0xfff90000 0x200>; 501 reg = <0xfff90000 0x200>;
418 interrupts = <8 4 5>; 502 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
419 atmel,use-dma-rx; 503 atmel,use-dma-rx;
420 atmel,use-dma-tx; 504 atmel,use-dma-tx;
421 pinctrl-names = "default"; 505 pinctrl-names = "default";
@@ -426,7 +510,7 @@
426 usart2: serial@fff94000 { 510 usart2: serial@fff94000 {
427 compatible = "atmel,at91sam9260-usart"; 511 compatible = "atmel,at91sam9260-usart";
428 reg = <0xfff94000 0x200>; 512 reg = <0xfff94000 0x200>;
429 interrupts = <9 4 5>; 513 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 5>;
430 atmel,use-dma-rx; 514 atmel,use-dma-rx;
431 atmel,use-dma-tx; 515 atmel,use-dma-tx;
432 pinctrl-names = "default"; 516 pinctrl-names = "default";
@@ -437,7 +521,7 @@
437 usart3: serial@fff98000 { 521 usart3: serial@fff98000 {
438 compatible = "atmel,at91sam9260-usart"; 522 compatible = "atmel,at91sam9260-usart";
439 reg = <0xfff98000 0x200>; 523 reg = <0xfff98000 0x200>;
440 interrupts = <10 4 5>; 524 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 5>;
441 atmel,use-dma-rx; 525 atmel,use-dma-rx;
442 atmel,use-dma-tx; 526 atmel,use-dma-tx;
443 pinctrl-names = "default"; 527 pinctrl-names = "default";
@@ -448,7 +532,7 @@
448 macb0: ethernet@fffbc000 { 532 macb0: ethernet@fffbc000 {
449 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 533 compatible = "cdns,at32ap7000-macb", "cdns,macb";
450 reg = <0xfffbc000 0x100>; 534 reg = <0xfffbc000 0x100>;
451 interrupts = <25 4 3>; 535 interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>;
452 pinctrl-names = "default"; 536 pinctrl-names = "default";
453 pinctrl-0 = <&pinctrl_macb_rmii>; 537 pinctrl-0 = <&pinctrl_macb_rmii>;
454 status = "disabled"; 538 status = "disabled";
@@ -457,7 +541,7 @@
457 i2c0: i2c@fff84000 { 541 i2c0: i2c@fff84000 {
458 compatible = "atmel,at91sam9g10-i2c"; 542 compatible = "atmel,at91sam9g10-i2c";
459 reg = <0xfff84000 0x100>; 543 reg = <0xfff84000 0x100>;
460 interrupts = <12 4 6>; 544 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 6>;
461 #address-cells = <1>; 545 #address-cells = <1>;
462 #size-cells = <0>; 546 #size-cells = <0>;
463 status = "disabled"; 547 status = "disabled";
@@ -466,7 +550,7 @@
466 i2c1: i2c@fff88000 { 550 i2c1: i2c@fff88000 {
467 compatible = "atmel,at91sam9g10-i2c"; 551 compatible = "atmel,at91sam9g10-i2c";
468 reg = <0xfff88000 0x100>; 552 reg = <0xfff88000 0x100>;
469 interrupts = <13 4 6>; 553 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 6>;
470 #address-cells = <1>; 554 #address-cells = <1>;
471 #size-cells = <0>; 555 #size-cells = <0>;
472 status = "disabled"; 556 status = "disabled";
@@ -475,7 +559,7 @@
475 ssc0: ssc@fff9c000 { 559 ssc0: ssc@fff9c000 {
476 compatible = "atmel,at91sam9g45-ssc"; 560 compatible = "atmel,at91sam9g45-ssc";
477 reg = <0xfff9c000 0x4000>; 561 reg = <0xfff9c000 0x4000>;
478 interrupts = <16 4 5>; 562 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
479 pinctrl-names = "default"; 563 pinctrl-names = "default";
480 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 564 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
481 status = "disabled"; 565 status = "disabled";
@@ -484,7 +568,7 @@
484 ssc1: ssc@fffa0000 { 568 ssc1: ssc@fffa0000 {
485 compatible = "atmel,at91sam9g45-ssc"; 569 compatible = "atmel,at91sam9g45-ssc";
486 reg = <0xfffa0000 0x4000>; 570 reg = <0xfffa0000 0x4000>;
487 interrupts = <17 4 5>; 571 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>;
488 pinctrl-names = "default"; 572 pinctrl-names = "default";
489 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 573 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
490 status = "disabled"; 574 status = "disabled";
@@ -493,7 +577,7 @@
493 adc0: adc@fffb0000 { 577 adc0: adc@fffb0000 {
494 compatible = "atmel,at91sam9260-adc"; 578 compatible = "atmel,at91sam9260-adc";
495 reg = <0xfffb0000 0x100>; 579 reg = <0xfffb0000 0x100>;
496 interrupts = <20 4 0>; 580 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0>;
497 atmel,adc-use-external-triggers; 581 atmel,adc-use-external-triggers;
498 atmel,adc-channels-used = <0xff>; 582 atmel,adc-channels-used = <0xff>;
499 atmel,adc-vref = <3300>; 583 atmel,adc-vref = <3300>;
@@ -533,8 +617,8 @@
533 mmc0: mmc@fff80000 { 617 mmc0: mmc@fff80000 {
534 compatible = "atmel,hsmci"; 618 compatible = "atmel,hsmci";
535 reg = <0xfff80000 0x600>; 619 reg = <0xfff80000 0x600>;
536 interrupts = <11 4 0>; 620 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 0>;
537 dmas = <&dma 1 0>; 621 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>;
538 dma-names = "rxtx"; 622 dma-names = "rxtx";
539 #address-cells = <1>; 623 #address-cells = <1>;
540 #size-cells = <0>; 624 #size-cells = <0>;
@@ -544,8 +628,8 @@
544 mmc1: mmc@fffd0000 { 628 mmc1: mmc@fffd0000 {
545 compatible = "atmel,hsmci"; 629 compatible = "atmel,hsmci";
546 reg = <0xfffd0000 0x600>; 630 reg = <0xfffd0000 0x600>;
547 interrupts = <29 4 0>; 631 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 0>;
548 dmas = <&dma 1 13>; 632 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>;
549 dma-names = "rxtx"; 633 dma-names = "rxtx";
550 #address-cells = <1>; 634 #address-cells = <1>;
551 #size-cells = <0>; 635 #size-cells = <0>;
@@ -579,6 +663,68 @@
579 pinctrl-0 = <&pinctrl_spi1>; 663 pinctrl-0 = <&pinctrl_spi1>;
580 status = "disabled"; 664 status = "disabled";
581 }; 665 };
666
667 usb2: gadget@fff78000 {
668 #address-cells = <1>;
669 #size-cells = <0>;
670 compatible = "atmel,at91sam9rl-udc";
671 reg = <0x00600000 0x80000
672 0xfff78000 0x400>;
673 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
674 status = "disabled";
675
676 ep0 {
677 reg = <0>;
678 atmel,fifo-size = <64>;
679 atmel,nb-banks = <1>;
680 };
681
682 ep1 {
683 reg = <1>;
684 atmel,fifo-size = <1024>;
685 atmel,nb-banks = <2>;
686 atmel,can-dma;
687 atmel,can-isoc;
688 };
689
690 ep2 {
691 reg = <2>;
692 atmel,fifo-size = <1024>;
693 atmel,nb-banks = <2>;
694 atmel,can-dma;
695 atmel,can-isoc;
696 };
697
698 ep3 {
699 reg = <3>;
700 atmel,fifo-size = <1024>;
701 atmel,nb-banks = <3>;
702 atmel,can-dma;
703 };
704
705 ep4 {
706 reg = <4>;
707 atmel,fifo-size = <1024>;
708 atmel,nb-banks = <3>;
709 atmel,can-dma;
710 };
711
712 ep5 {
713 reg = <5>;
714 atmel,fifo-size = <1024>;
715 atmel,nb-banks = <3>;
716 atmel,can-dma;
717 atmel,can-isoc;
718 };
719
720 ep6 {
721 reg = <6>;
722 atmel,fifo-size = <1024>;
723 atmel,nb-banks = <3>;
724 atmel,can-dma;
725 atmel,can-isoc;
726 };
727 };
582 }; 728 };
583 729
584 nand0: nand@40000000 { 730 nand0: nand@40000000 {
@@ -592,8 +738,8 @@
592 atmel,nand-cmd-offset = <22>; 738 atmel,nand-cmd-offset = <22>;
593 pinctrl-names = "default"; 739 pinctrl-names = "default";
594 pinctrl-0 = <&pinctrl_nand>; 740 pinctrl-0 = <&pinctrl_nand>;
595 gpios = <&pioC 8 0 741 gpios = <&pioC 8 GPIO_ACTIVE_HIGH
596 &pioC 14 0 742 &pioC 14 GPIO_ACTIVE_HIGH
597 0 743 0
598 >; 744 >;
599 status = "disabled"; 745 status = "disabled";
@@ -602,22 +748,22 @@
602 usb0: ohci@00700000 { 748 usb0: ohci@00700000 {
603 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 749 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
604 reg = <0x00700000 0x100000>; 750 reg = <0x00700000 0x100000>;
605 interrupts = <22 4 2>; 751 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
606 status = "disabled"; 752 status = "disabled";
607 }; 753 };
608 754
609 usb1: ehci@00800000 { 755 usb1: ehci@00800000 {
610 compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; 756 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
611 reg = <0x00800000 0x100000>; 757 reg = <0x00800000 0x100000>;
612 interrupts = <22 4 2>; 758 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
613 status = "disabled"; 759 status = "disabled";
614 }; 760 };
615 }; 761 };
616 762
617 i2c@0 { 763 i2c@0 {
618 compatible = "i2c-gpio"; 764 compatible = "i2c-gpio";
619 gpios = <&pioA 20 0 /* sda */ 765 gpios = <&pioA 20 GPIO_ACTIVE_HIGH /* sda */
620 &pioA 21 0 /* scl */ 766 &pioA 21 GPIO_ACTIVE_HIGH /* scl */
621 >; 767 >;
622 i2c-gpio,sda-open-drain; 768 i2c-gpio,sda-open-drain;
623 i2c-gpio,scl-open-drain; 769 i2c-gpio,scl-open-drain;
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 51d9251b5bbe..a4b00e5c61c0 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -7,7 +7,7 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9g45.dtsi" 10#include "at91sam9g45.dtsi"
11 11
12/ { 12/ {
13 model = "Atmel AT91SAM9M10G45-EK"; 13 model = "Atmel AT91SAM9M10G45-EK";
@@ -59,6 +59,10 @@
59 status = "okay"; 59 status = "okay";
60 }; 60 };
61 61
62 watchdog@fffffd40 {
63 status = "okay";
64 };
65
62 mmc0: mmc@fff80000 { 66 mmc0: mmc@fff80000 {
63 pinctrl-0 = < 67 pinctrl-0 = <
64 &pinctrl_board_mmc0 68 &pinctrl_board_mmc0
@@ -68,7 +72,7 @@
68 slot@0 { 72 slot@0 {
69 reg = <0>; 73 reg = <0>;
70 bus-width = <4>; 74 bus-width = <4>;
71 cd-gpios = <&pioD 10 0>; 75 cd-gpios = <&pioD 10 GPIO_ACTIVE_HIGH>;
72 }; 76 };
73 }; 77 };
74 78
@@ -81,8 +85,8 @@
81 slot@0 { 85 slot@0 {
82 reg = <0>; 86 reg = <0>;
83 bus-width = <4>; 87 bus-width = <4>;
84 cd-gpios = <&pioD 11 0>; 88 cd-gpios = <&pioD 11 GPIO_ACTIVE_HIGH>;
85 wp-gpios = <&pioD 29 0>; 89 wp-gpios = <&pioD 29 GPIO_ACTIVE_HIGH>;
86 }; 90 };
87 }; 91 };
88 92
@@ -90,15 +94,15 @@
90 mmc0 { 94 mmc0 {
91 pinctrl_board_mmc0: mmc0-board { 95 pinctrl_board_mmc0: mmc0-board {
92 atmel,pins = 96 atmel,pins =
93 <3 10 0x0 0x5>; /* PD10 gpio CD pin pull up and deglitch */ 97 <AT91_PIOD 10 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD10 gpio CD pin pull up and deglitch */
94 }; 98 };
95 }; 99 };
96 100
97 mmc1 { 101 mmc1 {
98 pinctrl_board_mmc1: mmc1-board { 102 pinctrl_board_mmc1: mmc1-board {
99 atmel,pins = 103 atmel,pins =
100 <3 11 0x0 0x5 /* PD11 gpio CD pin pull up and deglitch */ 104 <AT91_PIOD 11 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH /* PD11 gpio CD pin pull up and deglitch */
101 3 29 0x0 0x1>; /* PD29 gpio WP pin pull up */ 105 AT91_PIOD 29 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PD29 gpio WP pin pull up */
102 }; 106 };
103 }; 107 };
104 }; 108 };
@@ -112,6 +116,11 @@
112 reg = <0>; 116 reg = <0>;
113 }; 117 };
114 }; 118 };
119
120 usb2: gadget@fff78000 {
121 atmel,vbus-gpio = <&pioB 19 GPIO_ACTIVE_HIGH>;
122 status = "okay";
123 };
115 }; 124 };
116 125
117 nand0: nand@40000000 { 126 nand0: nand@40000000 {
@@ -139,8 +148,8 @@
139 usb0: ohci@00700000 { 148 usb0: ohci@00700000 {
140 status = "okay"; 149 status = "okay";
141 num-ports = <2>; 150 num-ports = <2>;
142 atmel,vbus-gpio = <&pioD 1 1 151 atmel,vbus-gpio = <&pioD 1 GPIO_ACTIVE_LOW
143 &pioD 3 1>; 152 &pioD 3 GPIO_ACTIVE_LOW>;
144 }; 153 };
145 154
146 usb1: ehci@00800000 { 155 usb1: ehci@00800000 {
@@ -153,19 +162,19 @@
153 162
154 d8 { 163 d8 {
155 label = "d8"; 164 label = "d8";
156 gpios = <&pioD 30 0>; 165 gpios = <&pioD 30 GPIO_ACTIVE_HIGH>;
157 linux,default-trigger = "heartbeat"; 166 linux,default-trigger = "heartbeat";
158 }; 167 };
159 168
160 d6 { 169 d6 {
161 label = "d6"; 170 label = "d6";
162 gpios = <&pioD 0 1>; 171 gpios = <&pioD 0 GPIO_ACTIVE_LOW>;
163 linux,default-trigger = "nand-disk"; 172 linux,default-trigger = "nand-disk";
164 }; 173 };
165 174
166 d7 { 175 d7 {
167 label = "d7"; 176 label = "d7";
168 gpios = <&pioD 31 1>; 177 gpios = <&pioD 31 GPIO_ACTIVE_LOW>;
169 linux,default-trigger = "mmc0"; 178 linux,default-trigger = "mmc0";
170 }; 179 };
171 }; 180 };
@@ -175,45 +184,45 @@
175 184
176 left_click { 185 left_click {
177 label = "left_click"; 186 label = "left_click";
178 gpios = <&pioB 6 1>; 187 gpios = <&pioB 6 GPIO_ACTIVE_LOW>;
179 linux,code = <272>; 188 linux,code = <272>;
180 gpio-key,wakeup; 189 gpio-key,wakeup;
181 }; 190 };
182 191
183 right_click { 192 right_click {
184 label = "right_click"; 193 label = "right_click";
185 gpios = <&pioB 7 1>; 194 gpios = <&pioB 7 GPIO_ACTIVE_LOW>;
186 linux,code = <273>; 195 linux,code = <273>;
187 gpio-key,wakeup; 196 gpio-key,wakeup;
188 }; 197 };
189 198
190 left { 199 left {
191 label = "Joystick Left"; 200 label = "Joystick Left";
192 gpios = <&pioB 14 1>; 201 gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
193 linux,code = <105>; 202 linux,code = <105>;
194 }; 203 };
195 204
196 right { 205 right {
197 label = "Joystick Right"; 206 label = "Joystick Right";
198 gpios = <&pioB 15 1>; 207 gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
199 linux,code = <106>; 208 linux,code = <106>;
200 }; 209 };
201 210
202 up { 211 up {
203 label = "Joystick Up"; 212 label = "Joystick Up";
204 gpios = <&pioB 16 1>; 213 gpios = <&pioB 16 GPIO_ACTIVE_LOW>;
205 linux,code = <103>; 214 linux,code = <103>;
206 }; 215 };
207 216
208 down { 217 down {
209 label = "Joystick Down"; 218 label = "Joystick Down";
210 gpios = <&pioB 17 1>; 219 gpios = <&pioB 17 GPIO_ACTIVE_LOW>;
211 linux,code = <108>; 220 linux,code = <108>;
212 }; 221 };
213 222
214 enter { 223 enter {
215 label = "Joystick Press"; 224 label = "Joystick Press";
216 gpios = <&pioB 18 1>; 225 gpios = <&pioB 18 GPIO_ACTIVE_LOW>;
217 linux,code = <28>; 226 linux,code = <28>;
218 }; 227 };
219 }; 228 };
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 8d25f889928e..bb7f564b3a55 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -7,7 +7,11 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9 9
10/include/ "skeleton.dtsi" 10#include "skeleton.dtsi"
11#include <dt-bindings/dma/at91.h>
12#include <dt-bindings/pinctrl/at91.h>
13#include <dt-bindings/interrupt-controller/irq.h>
14#include <dt-bindings/gpio/gpio.h>
11 15
12/ { 16/ {
13 model = "Atmel AT91SAM9N12 SoC"; 17 model = "Atmel AT91SAM9N12 SoC";
@@ -31,8 +35,12 @@
31 ssc0 = &ssc0; 35 ssc0 = &ssc0;
32 }; 36 };
33 cpus { 37 cpus {
34 cpu@0 { 38 #address-cells = <0>;
35 compatible = "arm,arm926ejs"; 39 #size-cells = <0>;
40
41 cpu {
42 compatible = "arm,arm926ej-s";
43 device_type = "cpu";
36 }; 44 };
37 }; 45 };
38 46
@@ -78,7 +86,7 @@
78 pit: timer@fffffe30 { 86 pit: timer@fffffe30 {
79 compatible = "atmel,at91sam9260-pit"; 87 compatible = "atmel,at91sam9260-pit";
80 reg = <0xfffffe30 0xf>; 88 reg = <0xfffffe30 0xf>;
81 interrupts = <1 4 7>; 89 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
82 }; 90 };
83 91
84 shdwc@fffffe10 { 92 shdwc@fffffe10 {
@@ -89,8 +97,8 @@
89 mmc0: mmc@f0008000 { 97 mmc0: mmc@f0008000 {
90 compatible = "atmel,hsmci"; 98 compatible = "atmel,hsmci";
91 reg = <0xf0008000 0x600>; 99 reg = <0xf0008000 0x600>;
92 interrupts = <12 4 0>; 100 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>;
93 dmas = <&dma 1 0>; 101 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(0)>;
94 dma-names = "rxtx"; 102 dma-names = "rxtx";
95 #address-cells = <1>; 103 #address-cells = <1>;
96 #size-cells = <0>; 104 #size-cells = <0>;
@@ -100,19 +108,19 @@
100 tcb0: timer@f8008000 { 108 tcb0: timer@f8008000 {
101 compatible = "atmel,at91sam9x5-tcb"; 109 compatible = "atmel,at91sam9x5-tcb";
102 reg = <0xf8008000 0x100>; 110 reg = <0xf8008000 0x100>;
103 interrupts = <17 4 0>; 111 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
104 }; 112 };
105 113
106 tcb1: timer@f800c000 { 114 tcb1: timer@f800c000 {
107 compatible = "atmel,at91sam9x5-tcb"; 115 compatible = "atmel,at91sam9x5-tcb";
108 reg = <0xf800c000 0x100>; 116 reg = <0xf800c000 0x100>;
109 interrupts = <17 4 0>; 117 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
110 }; 118 };
111 119
112 dma: dma-controller@ffffec00 { 120 dma: dma-controller@ffffec00 {
113 compatible = "atmel,at91sam9g45-dma"; 121 compatible = "atmel,at91sam9g45-dma";
114 reg = <0xffffec00 0x200>; 122 reg = <0xffffec00 0x200>;
115 interrupts = <20 4 0>; 123 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0>;
116 #dma-cells = <2>; 124 #dma-cells = <2>;
117 }; 125 };
118 126
@@ -134,159 +142,235 @@
134 dbgu { 142 dbgu {
135 pinctrl_dbgu: dbgu-0 { 143 pinctrl_dbgu: dbgu-0 {
136 atmel,pins = 144 atmel,pins =
137 <0 9 0x1 0x0 /* PA9 periph A */ 145 <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA9 periph A */
138 0 10 0x1 0x1>; /* PA10 periph with pullup */ 146 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA10 periph with pullup */
139 }; 147 };
140 }; 148 };
141 149
142 usart0 { 150 usart0 {
143 pinctrl_usart0: usart0-0 { 151 pinctrl_usart0: usart0-0 {
144 atmel,pins = 152 atmel,pins =
145 <0 1 0x1 0x1 /* PA1 periph A with pullup */ 153 <AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA1 periph A with pullup */
146 0 0 0x1 0x0>; /* PA0 periph A */ 154 AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA0 periph A */
147 }; 155 };
148 156
149 pinctrl_usart0_rts: usart0_rts-0 { 157 pinctrl_usart0_rts: usart0_rts-0 {
150 atmel,pins = 158 atmel,pins =
151 <0 2 0x1 0x0>; /* PA2 periph A */ 159 <AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA2 periph A */
152 }; 160 };
153 161
154 pinctrl_usart0_cts: usart0_cts-0 { 162 pinctrl_usart0_cts: usart0_cts-0 {
155 atmel,pins = 163 atmel,pins =
156 <0 3 0x1 0x0>; /* PA3 periph A */ 164 <AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA3 periph A */
157 }; 165 };
158 }; 166 };
159 167
160 usart1 { 168 usart1 {
161 pinctrl_usart1: usart1-0 { 169 pinctrl_usart1: usart1-0 {
162 atmel,pins = 170 atmel,pins =
163 <0 6 0x1 0x1 /* PA6 periph A with pullup */ 171 <AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA6 periph A with pullup */
164 0 5 0x1 0x0>; /* PA5 periph A */ 172 AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA5 periph A */
165 }; 173 };
166 }; 174 };
167 175
168 usart2 { 176 usart2 {
169 pinctrl_usart2: usart2-0 { 177 pinctrl_usart2: usart2-0 {
170 atmel,pins = 178 atmel,pins =
171 <0 8 0x1 0x1 /* PA8 periph A with pullup */ 179 <AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA8 periph A with pullup */
172 0 7 0x1 0x0>; /* PA7 periph A */ 180 AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA7 periph A */
173 }; 181 };
174 182
175 pinctrl_usart2_rts: usart2_rts-0 { 183 pinctrl_usart2_rts: usart2_rts-0 {
176 atmel,pins = 184 atmel,pins =
177 <1 0 0x2 0x0>; /* PB0 periph B */ 185 <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB0 periph B */
178 }; 186 };
179 187
180 pinctrl_usart2_cts: usart2_cts-0 { 188 pinctrl_usart2_cts: usart2_cts-0 {
181 atmel,pins = 189 atmel,pins =
182 <1 1 0x2 0x0>; /* PB1 periph B */ 190 <AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB1 periph B */
183 }; 191 };
184 }; 192 };
185 193
186 usart3 { 194 usart3 {
187 pinctrl_usart3: usart3-0 { 195 pinctrl_usart3: usart3-0 {
188 atmel,pins = 196 atmel,pins =
189 <2 23 0x2 0x1 /* PC23 periph B with pullup */ 197 <AT91_PIOC 23 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PC23 periph B with pullup */
190 2 22 0x2 0x0>; /* PC22 periph B */ 198 AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC22 periph B */
191 }; 199 };
192 200
193 pinctrl_usart3_rts: usart3_rts-0 { 201 pinctrl_usart3_rts: usart3_rts-0 {
194 atmel,pins = 202 atmel,pins =
195 <2 24 0x2 0x0>; /* PC24 periph B */ 203 <AT91_PIOC 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC24 periph B */
196 }; 204 };
197 205
198 pinctrl_usart3_cts: usart3_cts-0 { 206 pinctrl_usart3_cts: usart3_cts-0 {
199 atmel,pins = 207 atmel,pins =
200 <2 25 0x2 0x0>; /* PC25 periph B */ 208 <AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC25 periph B */
201 }; 209 };
202 }; 210 };
203 211
204 uart0 { 212 uart0 {
205 pinctrl_uart0: uart0-0 { 213 pinctrl_uart0: uart0-0 {
206 atmel,pins = 214 atmel,pins =
207 <2 9 0x3 0x1 /* PC9 periph C with pullup */ 215 <AT91_PIOC 9 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* PC9 periph C with pullup */
208 2 8 0x3 0x0>; /* PC8 periph C */ 216 AT91_PIOC 8 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC8 periph C */
209 }; 217 };
210 }; 218 };
211 219
212 uart1 { 220 uart1 {
213 pinctrl_uart1: uart1-0 { 221 pinctrl_uart1: uart1-0 {
214 atmel,pins = 222 atmel,pins =
215 <2 16 0x3 0x1 /* PC17 periph C with pullup */ 223 <AT91_PIOC 16 AT91_PERIPH_C AT91_PINCTRL_PULL_UP /* PC17 periph C with pullup */
216 2 17 0x3 0x0>; /* PC16 periph C */ 224 AT91_PIOC 17 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC16 periph C */
217 }; 225 };
218 }; 226 };
219 227
220 nand { 228 nand {
221 pinctrl_nand: nand-0 { 229 pinctrl_nand: nand-0 {
222 atmel,pins = 230 atmel,pins =
223 <3 5 0x0 0x1 /* PD5 gpio RDY pin pull_up*/ 231 <AT91_PIOD 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PD5 gpio RDY pin pull_up*/
224 3 4 0x0 0x1>; /* PD4 gpio enable pin pull_up */ 232 AT91_PIOD 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PD4 gpio enable pin pull_up */
225 }; 233 };
226 }; 234 };
227 235
228 mmc0 { 236 mmc0 {
229 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 { 237 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
230 atmel,pins = 238 atmel,pins =
231 <0 17 0x1 0x0 /* PA17 periph A */ 239 <AT91_PIOA 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA17 periph A */
232 0 16 0x1 0x1 /* PA16 periph A with pullup */ 240 AT91_PIOA 16 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA16 periph A with pullup */
233 0 15 0x1 0x1>; /* PA15 periph A with pullup */ 241 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA15 periph A with pullup */
234 }; 242 };
235 243
236 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 { 244 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
237 atmel,pins = 245 atmel,pins =
238 <0 18 0x1 0x1 /* PA18 periph A with pullup */ 246 <AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA18 periph A with pullup */
239 0 19 0x1 0x1 /* PA19 periph A with pullup */ 247 AT91_PIOA 19 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA19 periph A with pullup */
240 0 20 0x1 0x1>; /* PA20 periph A with pullup */ 248 AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA20 periph A with pullup */
241 }; 249 };
242 250
243 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 { 251 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 {
244 atmel,pins = 252 atmel,pins =
245 <0 11 0x2 0x1 /* PA11 periph B with pullup */ 253 <AT91_PIOA 11 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA11 periph B with pullup */
246 0 12 0x2 0x1 /* PA12 periph B with pullup */ 254 AT91_PIOA 12 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA12 periph B with pullup */
247 0 13 0x2 0x1 /* PA13 periph B with pullup */ 255 AT91_PIOA 13 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA13 periph B with pullup */
248 0 14 0x2 0x1>; /* PA14 periph B with pullup */ 256 AT91_PIOA 14 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA14 periph B with pullup */
249 }; 257 };
250 }; 258 };
251 259
252 ssc0 { 260 ssc0 {
253 pinctrl_ssc0_tx: ssc0_tx-0 { 261 pinctrl_ssc0_tx: ssc0_tx-0 {
254 atmel,pins = 262 atmel,pins =
255 <0 24 0x2 0x0 /* PA24 periph B */ 263 <AT91_PIOA 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA24 periph B */
256 0 25 0x2 0x0 /* PA25 periph B */ 264 AT91_PIOA 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA25 periph B */
257 0 26 0x2 0x0>; /* PA26 periph B */ 265 AT91_PIOA 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA26 periph B */
258 }; 266 };
259 267
260 pinctrl_ssc0_rx: ssc0_rx-0 { 268 pinctrl_ssc0_rx: ssc0_rx-0 {
261 atmel,pins = 269 atmel,pins =
262 <0 27 0x2 0x0 /* PA27 periph B */ 270 <AT91_PIOA 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA27 periph B */
263 0 28 0x2 0x0 /* PA28 periph B */ 271 AT91_PIOA 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA28 periph B */
264 0 29 0x2 0x0>; /* PA29 periph B */ 272 AT91_PIOA 29 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA29 periph B */
265 }; 273 };
266 }; 274 };
267 275
268 spi0 { 276 spi0 {
269 pinctrl_spi0: spi0-0 { 277 pinctrl_spi0: spi0-0 {
270 atmel,pins = 278 atmel,pins =
271 <0 11 0x1 0x0 /* PA11 periph A SPI0_MISO pin */ 279 <AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A SPI0_MISO pin */
272 0 12 0x1 0x0 /* PA12 periph A SPI0_MOSI pin */ 280 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A SPI0_MOSI pin */
273 0 13 0x1 0x0>; /* PA13 periph A SPI0_SPCK pin */ 281 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA13 periph A SPI0_SPCK pin */
274 }; 282 };
275 }; 283 };
276 284
277 spi1 { 285 spi1 {
278 pinctrl_spi1: spi1-0 { 286 pinctrl_spi1: spi1-0 {
279 atmel,pins = 287 atmel,pins =
280 <0 21 0x2 0x0 /* PA21 periph B SPI1_MISO pin */ 288 <AT91_PIOA 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA21 periph B SPI1_MISO pin */
281 0 22 0x2 0x0 /* PA22 periph B SPI1_MOSI pin */ 289 AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA22 periph B SPI1_MOSI pin */
282 0 23 0x2 0x0>; /* PA23 periph B SPI1_SPCK pin */ 290 AT91_PIOA 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA23 periph B SPI1_SPCK pin */
291 };
292 };
293
294 tcb0 {
295 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
296 atmel,pins = <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE>;
297 };
298
299 pinctrl_tcb0_tclk1: tcb0_tclk1-0 {
300 atmel,pins = <AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_NONE>;
301 };
302
303 pinctrl_tcb0_tclk2: tcb0_tclk2-0 {
304 atmel,pins = <AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_NONE>;
305 };
306
307 pinctrl_tcb0_tioa0: tcb0_tioa0-0 {
308 atmel,pins = <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>;
309 };
310
311 pinctrl_tcb0_tioa1: tcb0_tioa1-0 {
312 atmel,pins = <AT91_PIOA 22 AT91_PERIPH_A AT91_PINCTRL_NONE>;
313 };
314
315 pinctrl_tcb0_tioa2: tcb0_tioa2-0 {
316 atmel,pins = <AT91_PIOA 23 AT91_PERIPH_A AT91_PINCTRL_NONE>;
317 };
318
319 pinctrl_tcb0_tiob0: tcb0_tiob0-0 {
320 atmel,pins = <AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE>;
321 };
322
323 pinctrl_tcb0_tiob1: tcb0_tiob1-0 {
324 atmel,pins = <AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE>;
325 };
326
327 pinctrl_tcb0_tiob2: tcb0_tiob2-0 {
328 atmel,pins = <AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_NONE>;
329 };
330 };
331
332 tcb1 {
333 pinctrl_tcb1_tclk0: tcb1_tclk0-0 {
334 atmel,pins = <AT91_PIOC 4 AT91_PERIPH_C AT91_PINCTRL_NONE>;
335 };
336
337 pinctrl_tcb1_tclk1: tcb1_tclk1-0 {
338 atmel,pins = <AT91_PIOC 7 AT91_PERIPH_C AT91_PINCTRL_NONE>;
339 };
340
341 pinctrl_tcb1_tclk2: tcb1_tclk2-0 {
342 atmel,pins = <AT91_PIOC 14 AT91_PERIPH_C AT91_PINCTRL_NONE>;
343 };
344
345 pinctrl_tcb1_tioa0: tcb1_tioa0-0 {
346 atmel,pins = <AT91_PIOC 2 AT91_PERIPH_C AT91_PINCTRL_NONE>;
347 };
348
349 pinctrl_tcb1_tioa1: tcb1_tioa1-0 {
350 atmel,pins = <AT91_PIOC 5 AT91_PERIPH_C AT91_PINCTRL_NONE>;
351 };
352
353 pinctrl_tcb1_tioa2: tcb1_tioa2-0 {
354 atmel,pins = <AT91_PIOC 12 AT91_PERIPH_C AT91_PINCTRL_NONE>;
355 };
356
357 pinctrl_tcb1_tiob0: tcb1_tiob0-0 {
358 atmel,pins = <AT91_PIOC 3 AT91_PERIPH_C AT91_PINCTRL_NONE>;
359 };
360
361 pinctrl_tcb1_tiob1: tcb1_tiob1-0 {
362 atmel,pins = <AT91_PIOC 6 AT91_PERIPH_C AT91_PINCTRL_NONE>;
363 };
364
365 pinctrl_tcb1_tiob2: tcb1_tiob2-0 {
366 atmel,pins = <AT91_PIOC 13 AT91_PERIPH_C AT91_PINCTRL_NONE>;
283 }; 367 };
284 }; 368 };
285 369
286 pioA: gpio@fffff400 { 370 pioA: gpio@fffff400 {
287 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 371 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
288 reg = <0xfffff400 0x200>; 372 reg = <0xfffff400 0x200>;
289 interrupts = <2 4 1>; 373 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
290 #gpio-cells = <2>; 374 #gpio-cells = <2>;
291 gpio-controller; 375 gpio-controller;
292 interrupt-controller; 376 interrupt-controller;
@@ -296,7 +380,7 @@
296 pioB: gpio@fffff600 { 380 pioB: gpio@fffff600 {
297 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 381 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
298 reg = <0xfffff600 0x200>; 382 reg = <0xfffff600 0x200>;
299 interrupts = <2 4 1>; 383 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
300 #gpio-cells = <2>; 384 #gpio-cells = <2>;
301 gpio-controller; 385 gpio-controller;
302 interrupt-controller; 386 interrupt-controller;
@@ -306,7 +390,7 @@
306 pioC: gpio@fffff800 { 390 pioC: gpio@fffff800 {
307 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 391 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
308 reg = <0xfffff800 0x200>; 392 reg = <0xfffff800 0x200>;
309 interrupts = <3 4 1>; 393 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
310 #gpio-cells = <2>; 394 #gpio-cells = <2>;
311 gpio-controller; 395 gpio-controller;
312 interrupt-controller; 396 interrupt-controller;
@@ -316,7 +400,7 @@
316 pioD: gpio@fffffa00 { 400 pioD: gpio@fffffa00 {
317 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 401 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
318 reg = <0xfffffa00 0x200>; 402 reg = <0xfffffa00 0x200>;
319 interrupts = <3 4 1>; 403 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
320 #gpio-cells = <2>; 404 #gpio-cells = <2>;
321 gpio-controller; 405 gpio-controller;
322 interrupt-controller; 406 interrupt-controller;
@@ -327,7 +411,7 @@
327 dbgu: serial@fffff200 { 411 dbgu: serial@fffff200 {
328 compatible = "atmel,at91sam9260-usart"; 412 compatible = "atmel,at91sam9260-usart";
329 reg = <0xfffff200 0x200>; 413 reg = <0xfffff200 0x200>;
330 interrupts = <1 4 7>; 414 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
331 pinctrl-names = "default"; 415 pinctrl-names = "default";
332 pinctrl-0 = <&pinctrl_dbgu>; 416 pinctrl-0 = <&pinctrl_dbgu>;
333 status = "disabled"; 417 status = "disabled";
@@ -336,7 +420,7 @@
336 ssc0: ssc@f0010000 { 420 ssc0: ssc@f0010000 {
337 compatible = "atmel,at91sam9g45-ssc"; 421 compatible = "atmel,at91sam9g45-ssc";
338 reg = <0xf0010000 0x4000>; 422 reg = <0xf0010000 0x4000>;
339 interrupts = <28 4 5>; 423 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>;
340 pinctrl-names = "default"; 424 pinctrl-names = "default";
341 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 425 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
342 status = "disabled"; 426 status = "disabled";
@@ -345,7 +429,7 @@
345 usart0: serial@f801c000 { 429 usart0: serial@f801c000 {
346 compatible = "atmel,at91sam9260-usart"; 430 compatible = "atmel,at91sam9260-usart";
347 reg = <0xf801c000 0x4000>; 431 reg = <0xf801c000 0x4000>;
348 interrupts = <5 4 5>; 432 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 5>;
349 pinctrl-names = "default"; 433 pinctrl-names = "default";
350 pinctrl-0 = <&pinctrl_usart0>; 434 pinctrl-0 = <&pinctrl_usart0>;
351 status = "disabled"; 435 status = "disabled";
@@ -354,7 +438,7 @@
354 usart1: serial@f8020000 { 438 usart1: serial@f8020000 {
355 compatible = "atmel,at91sam9260-usart"; 439 compatible = "atmel,at91sam9260-usart";
356 reg = <0xf8020000 0x4000>; 440 reg = <0xf8020000 0x4000>;
357 interrupts = <6 4 5>; 441 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>;
358 pinctrl-names = "default"; 442 pinctrl-names = "default";
359 pinctrl-0 = <&pinctrl_usart1>; 443 pinctrl-0 = <&pinctrl_usart1>;
360 status = "disabled"; 444 status = "disabled";
@@ -363,7 +447,7 @@
363 usart2: serial@f8024000 { 447 usart2: serial@f8024000 {
364 compatible = "atmel,at91sam9260-usart"; 448 compatible = "atmel,at91sam9260-usart";
365 reg = <0xf8024000 0x4000>; 449 reg = <0xf8024000 0x4000>;
366 interrupts = <7 4 5>; 450 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
367 pinctrl-names = "default"; 451 pinctrl-names = "default";
368 pinctrl-0 = <&pinctrl_usart2>; 452 pinctrl-0 = <&pinctrl_usart2>;
369 status = "disabled"; 453 status = "disabled";
@@ -372,7 +456,7 @@
372 usart3: serial@f8028000 { 456 usart3: serial@f8028000 {
373 compatible = "atmel,at91sam9260-usart"; 457 compatible = "atmel,at91sam9260-usart";
374 reg = <0xf8028000 0x4000>; 458 reg = <0xf8028000 0x4000>;
375 interrupts = <8 4 5>; 459 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
376 pinctrl-names = "default"; 460 pinctrl-names = "default";
377 pinctrl-0 = <&pinctrl_usart3>; 461 pinctrl-0 = <&pinctrl_usart3>;
378 status = "disabled"; 462 status = "disabled";
@@ -381,9 +465,9 @@
381 i2c0: i2c@f8010000 { 465 i2c0: i2c@f8010000 {
382 compatible = "atmel,at91sam9x5-i2c"; 466 compatible = "atmel,at91sam9x5-i2c";
383 reg = <0xf8010000 0x100>; 467 reg = <0xf8010000 0x100>;
384 interrupts = <9 4 6>; 468 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 6>;
385 dmas = <&dma 1 13>, 469 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(13)>,
386 <&dma 1 14>; 470 <&dma 1 AT91_DMA_CFG_PER_ID(14)>;
387 dma-names = "tx", "rx"; 471 dma-names = "tx", "rx";
388 #address-cells = <1>; 472 #address-cells = <1>;
389 #size-cells = <0>; 473 #size-cells = <0>;
@@ -393,9 +477,9 @@
393 i2c1: i2c@f8014000 { 477 i2c1: i2c@f8014000 {
394 compatible = "atmel,at91sam9x5-i2c"; 478 compatible = "atmel,at91sam9x5-i2c";
395 reg = <0xf8014000 0x100>; 479 reg = <0xf8014000 0x100>;
396 interrupts = <10 4 6>; 480 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 6>;
397 dmas = <&dma 1 15>, 481 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(15)>,
398 <&dma 1 16>; 482 <&dma 1 AT91_DMA_CFG_PER_ID(16)>;
399 dma-names = "tx", "rx"; 483 dma-names = "tx", "rx";
400 #address-cells = <1>; 484 #address-cells = <1>;
401 #size-cells = <0>; 485 #size-cells = <0>;
@@ -407,7 +491,10 @@
407 #size-cells = <0>; 491 #size-cells = <0>;
408 compatible = "atmel,at91rm9200-spi"; 492 compatible = "atmel,at91rm9200-spi";
409 reg = <0xf0000000 0x100>; 493 reg = <0xf0000000 0x100>;
410 interrupts = <13 4 3>; 494 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>;
495 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(1)>,
496 <&dma 1 AT91_DMA_CFG_PER_ID(2)>;
497 dma-names = "tx", "rx";
411 pinctrl-names = "default"; 498 pinctrl-names = "default";
412 pinctrl-0 = <&pinctrl_spi0>; 499 pinctrl-0 = <&pinctrl_spi0>;
413 status = "disabled"; 500 status = "disabled";
@@ -418,11 +505,20 @@
418 #size-cells = <0>; 505 #size-cells = <0>;
419 compatible = "atmel,at91rm9200-spi"; 506 compatible = "atmel,at91rm9200-spi";
420 reg = <0xf0004000 0x100>; 507 reg = <0xf0004000 0x100>;
421 interrupts = <14 4 3>; 508 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 3>;
509 dmas = <&dma 1 AT91_DMA_CFG_PER_ID(3)>,
510 <&dma 1 AT91_DMA_CFG_PER_ID(4)>;
511 dma-names = "tx", "rx";
422 pinctrl-names = "default"; 512 pinctrl-names = "default";
423 pinctrl-0 = <&pinctrl_spi1>; 513 pinctrl-0 = <&pinctrl_spi1>;
424 status = "disabled"; 514 status = "disabled";
425 }; 515 };
516
517 watchdog@fffffe40 {
518 compatible = "atmel,at91sam9260-wdt";
519 reg = <0xfffffe40 0x10>;
520 status = "disabled";
521 };
426 }; 522 };
427 523
428 nand0: nand@40000000 { 524 nand0: nand@40000000 {
@@ -439,8 +535,8 @@
439 atmel,nand-cmd-offset = <22>; 535 atmel,nand-cmd-offset = <22>;
440 pinctrl-names = "default"; 536 pinctrl-names = "default";
441 pinctrl-0 = <&pinctrl_nand>; 537 pinctrl-0 = <&pinctrl_nand>;
442 gpios = <&pioD 5 0 538 gpios = <&pioD 5 GPIO_ACTIVE_HIGH
443 &pioD 4 0 539 &pioD 4 GPIO_ACTIVE_HIGH
444 0 540 0
445 >; 541 >;
446 status = "disabled"; 542 status = "disabled";
@@ -449,15 +545,15 @@
449 usb0: ohci@00500000 { 545 usb0: ohci@00500000 {
450 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 546 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
451 reg = <0x00500000 0x00100000>; 547 reg = <0x00500000 0x00100000>;
452 interrupts = <22 4 2>; 548 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
453 status = "disabled"; 549 status = "disabled";
454 }; 550 };
455 }; 551 };
456 552
457 i2c@0 { 553 i2c@0 {
458 compatible = "i2c-gpio"; 554 compatible = "i2c-gpio";
459 gpios = <&pioA 30 0 /* sda */ 555 gpios = <&pioA 30 GPIO_ACTIVE_HIGH /* sda */
460 &pioA 31 0 /* scl */ 556 &pioA 31 GPIO_ACTIVE_HIGH /* scl */
461 >; 557 >;
462 i2c-gpio,sda-open-drain; 558 i2c-gpio,sda-open-drain;
463 i2c-gpio,scl-open-drain; 559 i2c-gpio,scl-open-drain;
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index d30e48bd1e9d..d59b70c6a6a0 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -7,7 +7,7 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9n12.dtsi" 10#include "at91sam9n12.dtsi"
11 11
12/ { 12/ {
13 model = "Atmel AT91SAM9N12-EK"; 13 model = "Atmel AT91SAM9N12-EK";
@@ -55,7 +55,7 @@
55 slot@0 { 55 slot@0 {
56 reg = <0>; 56 reg = <0>;
57 bus-width = <4>; 57 bus-width = <4>;
58 cd-gpios = <&pioA 7 0>; 58 cd-gpios = <&pioA 7 GPIO_ACTIVE_HIGH>;
59 }; 59 };
60 }; 60 };
61 61
@@ -63,7 +63,7 @@
63 mmc0 { 63 mmc0 {
64 pinctrl_board_mmc0: mmc0-board { 64 pinctrl_board_mmc0: mmc0-board {
65 atmel,pins = 65 atmel,pins =
66 <0 7 0x0 0x5>; /* PA7 gpio CD pin pull up and deglitch */ 66 <AT91_PIOA 7 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PA7 gpio CD pin pull up and deglitch */
67 }; 67 };
68 }; 68 };
69 }; 69 };
@@ -77,6 +77,10 @@
77 reg = <0>; 77 reg = <0>;
78 }; 78 };
79 }; 79 };
80
81 watchdog@fffffe40 {
82 status = "okay";
83 };
80 }; 84 };
81 85
82 nand0: nand@40000000 { 86 nand0: nand@40000000 {
@@ -95,19 +99,19 @@
95 99
96 d8 { 100 d8 {
97 label = "d8"; 101 label = "d8";
98 gpios = <&pioB 4 1>; 102 gpios = <&pioB 4 GPIO_ACTIVE_LOW>;
99 linux,default-trigger = "mmc0"; 103 linux,default-trigger = "mmc0";
100 }; 104 };
101 105
102 d9 { 106 d9 {
103 label = "d6"; 107 label = "d6";
104 gpios = <&pioB 5 1>; 108 gpios = <&pioB 5 GPIO_ACTIVE_LOW>;
105 linux,default-trigger = "nand-disk"; 109 linux,default-trigger = "nand-disk";
106 }; 110 };
107 111
108 d10 { 112 d10 {
109 label = "d7"; 113 label = "d7";
110 gpios = <&pioB 6 0>; 114 gpios = <&pioB 6 GPIO_ACTIVE_HIGH>;
111 linux,default-trigger = "heartbeat"; 115 linux,default-trigger = "heartbeat";
112 }; 116 };
113 }; 117 };
@@ -117,7 +121,7 @@
117 121
118 enter { 122 enter {
119 label = "Enter"; 123 label = "Enter";
120 gpios = <&pioB 4 1>; 124 gpios = <&pioB 4 GPIO_ACTIVE_LOW>;
121 linux,code = <28>; 125 linux,code = <28>;
122 gpio-key,wakeup; 126 gpio-key,wakeup;
123 }; 127 };
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
index 9ac2bc2b4f07..49e94aba938f 100644
--- a/arch/arm/boot/dts/at91sam9x25.dtsi
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8 8
9/include/ "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9X25 SoC"; 12 model = "Atmel AT91SAM9X25 SoC";
@@ -26,16 +26,16 @@
26 macb1 { 26 macb1 {
27 pinctrl_macb1_rmii: macb1_rmii-0 { 27 pinctrl_macb1_rmii: macb1_rmii-0 {
28 atmel,pins = 28 atmel,pins =
29 <2 16 0x2 0x0 /* PC16 periph B */ 29 <AT91_PIOC 16 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC16 periph B */
30 2 18 0x2 0x0 /* PC18 periph B */ 30 AT91_PIOC 18 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC18 periph B */
31 2 19 0x2 0x0 /* PC19 periph B */ 31 AT91_PIOC 19 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC19 periph B */
32 2 20 0x2 0x0 /* PC20 periph B */ 32 AT91_PIOC 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC20 periph B */
33 2 21 0x2 0x0 /* PC21 periph B */ 33 AT91_PIOC 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC21 periph B */
34 2 27 0x2 0x0 /* PC27 periph B */ 34 AT91_PIOC 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC27 periph B */
35 2 28 0x2 0x0 /* PC28 periph B */ 35 AT91_PIOC 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC28 periph B */
36 2 29 0x2 0x0 /* PC29 periph B */ 36 AT91_PIOC 29 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC29 periph B */
37 2 30 0x2 0x0 /* PC30 periph B */ 37 AT91_PIOC 30 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC30 periph B */
38 2 31 0x2 0x0>; /* PC31 periph B */ 38 AT91_PIOC 31 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC31 periph B */
39 }; 39 };
40 }; 40 };
41 }; 41 };
diff --git a/arch/arm/boot/dts/at91sam9x25ek.dts b/arch/arm/boot/dts/at91sam9x25ek.dts
index 315250b4995e..494864836e83 100644
--- a/arch/arm/boot/dts/at91sam9x25ek.dts
+++ b/arch/arm/boot/dts/at91sam9x25ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9x25.dtsi" 10#include "at91sam9x25.dtsi"
11/include/ "at91sam9x5ek.dtsi" 11#include "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9X25-EK"; 14 model = "Atmel AT91SAM9X25-EK";
diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
index ba67d83d17ac..1a3d525a1f5d 100644
--- a/arch/arm/boot/dts/at91sam9x35.dtsi
+++ b/arch/arm/boot/dts/at91sam9x35.dtsi
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8 8
9/include/ "at91sam9x5.dtsi" 9#include "at91sam9x5.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9X35 SoC"; 12 model = "Atmel AT91SAM9X35 SoC";
diff --git a/arch/arm/boot/dts/at91sam9x35ek.dts b/arch/arm/boot/dts/at91sam9x35ek.dts
index 6ad19a0d5424..343d32818ca3 100644
--- a/arch/arm/boot/dts/at91sam9x35ek.dts
+++ b/arch/arm/boot/dts/at91sam9x35ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9x35.dtsi" 10#include "at91sam9x35.dtsi"
11/include/ "at91sam9x5ek.dtsi" 11#include "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9X35-EK"; 14 model = "Atmel AT91SAM9X35-EK";
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 1145ac330fb7..57d45f5bea09 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -9,7 +9,11 @@
9 * Licensed under GPLv2 or later. 9 * Licensed under GPLv2 or later.
10 */ 10 */
11 11
12/include/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13#include <dt-bindings/dma/at91.h>
14#include <dt-bindings/pinctrl/at91.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/gpio/gpio.h>
13 17
14/ { 18/ {
15 model = "Atmel AT91SAM9x5 family SoC"; 19 model = "Atmel AT91SAM9x5 family SoC";
@@ -33,8 +37,12 @@
33 ssc0 = &ssc0; 37 ssc0 = &ssc0;
34 }; 38 };
35 cpus { 39 cpus {
36 cpu@0 { 40 #address-cells = <0>;
37 compatible = "arm,arm926ejs"; 41 #size-cells = <0>;
42
43 cpu {
44 compatible = "arm,arm926ej-s";
45 device_type = "cpu";
38 }; 46 };
39 }; 47 };
40 48
@@ -85,32 +93,32 @@
85 pit: timer@fffffe30 { 93 pit: timer@fffffe30 {
86 compatible = "atmel,at91sam9260-pit"; 94 compatible = "atmel,at91sam9260-pit";
87 reg = <0xfffffe30 0xf>; 95 reg = <0xfffffe30 0xf>;
88 interrupts = <1 4 7>; 96 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
89 }; 97 };
90 98
91 tcb0: timer@f8008000 { 99 tcb0: timer@f8008000 {
92 compatible = "atmel,at91sam9x5-tcb"; 100 compatible = "atmel,at91sam9x5-tcb";
93 reg = <0xf8008000 0x100>; 101 reg = <0xf8008000 0x100>;
94 interrupts = <17 4 0>; 102 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
95 }; 103 };
96 104
97 tcb1: timer@f800c000 { 105 tcb1: timer@f800c000 {
98 compatible = "atmel,at91sam9x5-tcb"; 106 compatible = "atmel,at91sam9x5-tcb";
99 reg = <0xf800c000 0x100>; 107 reg = <0xf800c000 0x100>;
100 interrupts = <17 4 0>; 108 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 0>;
101 }; 109 };
102 110
103 dma0: dma-controller@ffffec00 { 111 dma0: dma-controller@ffffec00 {
104 compatible = "atmel,at91sam9g45-dma"; 112 compatible = "atmel,at91sam9g45-dma";
105 reg = <0xffffec00 0x200>; 113 reg = <0xffffec00 0x200>;
106 interrupts = <20 4 0>; 114 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 0>;
107 #dma-cells = <2>; 115 #dma-cells = <2>;
108 }; 116 };
109 117
110 dma1: dma-controller@ffffee00 { 118 dma1: dma-controller@ffffee00 {
111 compatible = "atmel,at91sam9g45-dma"; 119 compatible = "atmel,at91sam9g45-dma";
112 reg = <0xffffee00 0x200>; 120 reg = <0xffffee00 0x200>;
113 interrupts = <21 4 0>; 121 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 0>;
114 #dma-cells = <2>; 122 #dma-cells = <2>;
115 }; 123 };
116 124
@@ -124,297 +132,373 @@
124 dbgu { 132 dbgu {
125 pinctrl_dbgu: dbgu-0 { 133 pinctrl_dbgu: dbgu-0 {
126 atmel,pins = 134 atmel,pins =
127 <0 9 0x1 0x0 /* PA9 periph A */ 135 <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA9 periph A */
128 0 10 0x1 0x1>; /* PA10 periph A with pullup */ 136 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA10 periph A with pullup */
129 }; 137 };
130 }; 138 };
131 139
132 usart0 { 140 usart0 {
133 pinctrl_usart0: usart0-0 { 141 pinctrl_usart0: usart0-0 {
134 atmel,pins = 142 atmel,pins =
135 <0 0 0x1 0x1 /* PA0 periph A with pullup */ 143 <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA0 periph A with pullup */
136 0 1 0x1 0x0>; /* PA1 periph A */ 144 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA1 periph A */
137 }; 145 };
138 146
139 pinctrl_usart0_rts: usart0_rts-0 { 147 pinctrl_usart0_rts: usart0_rts-0 {
140 atmel,pins = 148 atmel,pins =
141 <0 2 0x1 0x0>; /* PA2 periph A */ 149 <AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA2 periph A */
142 }; 150 };
143 151
144 pinctrl_usart0_cts: usart0_cts-0 { 152 pinctrl_usart0_cts: usart0_cts-0 {
145 atmel,pins = 153 atmel,pins =
146 <0 3 0x1 0x0>; /* PA3 periph A */ 154 <AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA3 periph A */
147 }; 155 };
148 156
149 pinctrl_usart0_sck: usart0_sck-0 { 157 pinctrl_usart0_sck: usart0_sck-0 {
150 atmel,pins = 158 atmel,pins =
151 <0 4 0x1 0x0>; /* PA4 periph A */ 159 <AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA4 periph A */
152 }; 160 };
153 }; 161 };
154 162
155 usart1 { 163 usart1 {
156 pinctrl_usart1: usart1-0 { 164 pinctrl_usart1: usart1-0 {
157 atmel,pins = 165 atmel,pins =
158 <0 5 0x1 0x1 /* PA5 periph A with pullup */ 166 <AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA5 periph A with pullup */
159 0 6 0x1 0x0>; /* PA6 periph A */ 167 AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA6 periph A */
160 }; 168 };
161 169
162 pinctrl_usart1_rts: usart1_rts-0 { 170 pinctrl_usart1_rts: usart1_rts-0 {
163 atmel,pins = 171 atmel,pins =
164 <2 27 0x3 0x0>; /* PC27 periph C */ 172 <AT91_PIOC 27 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC27 periph C */
165 }; 173 };
166 174
167 pinctrl_usart1_cts: usart1_cts-0 { 175 pinctrl_usart1_cts: usart1_cts-0 {
168 atmel,pins = 176 atmel,pins =
169 <2 28 0x3 0x0>; /* PC28 periph C */ 177 <AT91_PIOC 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC28 periph C */
170 }; 178 };
171 179
172 pinctrl_usart1_sck: usart1_sck-0 { 180 pinctrl_usart1_sck: usart1_sck-0 {
173 atmel,pins = 181 atmel,pins =
174 <2 28 0x3 0x0>; /* PC29 periph C */ 182 <AT91_PIOC 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC29 periph C */
175 }; 183 };
176 }; 184 };
177 185
178 usart2 { 186 usart2 {
179 pinctrl_usart2: usart2-0 { 187 pinctrl_usart2: usart2-0 {
180 atmel,pins = 188 atmel,pins =
181 <0 7 0x1 0x1 /* PA7 periph A with pullup */ 189 <AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA7 periph A with pullup */
182 0 8 0x1 0x0>; /* PA8 periph A */ 190 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA8 periph A */
183 }; 191 };
184 192
185 pinctrl_uart2_rts: uart2_rts-0 { 193 pinctrl_uart2_rts: uart2_rts-0 {
186 atmel,pins = 194 atmel,pins =
187 <1 0 0x2 0x0>; /* PB0 periph B */ 195 <AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB0 periph B */
188 }; 196 };
189 197
190 pinctrl_uart2_cts: uart2_cts-0 { 198 pinctrl_uart2_cts: uart2_cts-0 {
191 atmel,pins = 199 atmel,pins =
192 <1 1 0x2 0x0>; /* PB1 periph B */ 200 <AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB1 periph B */
193 }; 201 };
194 202
195 pinctrl_usart2_sck: usart2_sck-0 { 203 pinctrl_usart2_sck: usart2_sck-0 {
196 atmel,pins = 204 atmel,pins =
197 <1 2 0x2 0x0>; /* PB2 periph B */ 205 <AT91_PIOB 2 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB2 periph B */
198 }; 206 };
199 }; 207 };
200 208
201 usart3 { 209 usart3 {
202 pinctrl_usart3: usart3-0 { 210 pinctrl_usart3: usart3-0 {
203 atmel,pins = 211 atmel,pins =
204 <2 22 0x2 0x1 /* PC22 periph B with pullup */ 212 <AT91_PIOC 22 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PC22 periph B with pullup */
205 2 23 0x2 0x0>; /* PC23 periph B */ 213 AT91_PIOC 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC23 periph B */
206 }; 214 };
207 215
208 pinctrl_usart3_rts: usart3_rts-0 { 216 pinctrl_usart3_rts: usart3_rts-0 {
209 atmel,pins = 217 atmel,pins =
210 <2 24 0x2 0x0>; /* PC24 periph B */ 218 <AT91_PIOC 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC24 periph B */
211 }; 219 };
212 220
213 pinctrl_usart3_cts: usart3_cts-0 { 221 pinctrl_usart3_cts: usart3_cts-0 {
214 atmel,pins = 222 atmel,pins =
215 <2 25 0x2 0x0>; /* PC25 periph B */ 223 <AT91_PIOC 25 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC25 periph B */
216 }; 224 };
217 225
218 pinctrl_usart3_sck: usart3_sck-0 { 226 pinctrl_usart3_sck: usart3_sck-0 {
219 atmel,pins = 227 atmel,pins =
220 <2 26 0x2 0x0>; /* PC26 periph B */ 228 <AT91_PIOC 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC26 periph B */
221 }; 229 };
222 }; 230 };
223 231
224 uart0 { 232 uart0 {
225 pinctrl_uart0: uart0-0 { 233 pinctrl_uart0: uart0-0 {
226 atmel,pins = 234 atmel,pins =
227 <2 8 0x3 0x0 /* PC8 periph C */ 235 <AT91_PIOC 8 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC8 periph C */
228 2 9 0x3 0x1>; /* PC9 periph C with pullup */ 236 AT91_PIOC 9 AT91_PERIPH_C AT91_PINCTRL_PULL_UP>; /* PC9 periph C with pullup */
229 }; 237 };
230 }; 238 };
231 239
232 uart1 { 240 uart1 {
233 pinctrl_uart1: uart1-0 { 241 pinctrl_uart1: uart1-0 {
234 atmel,pins = 242 atmel,pins =
235 <2 16 0x3 0x0 /* PC16 periph C */ 243 <AT91_PIOC 16 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC16 periph C */
236 2 17 0x3 0x1>; /* PC17 periph C with pullup */ 244 AT91_PIOC 17 AT91_PERIPH_C AT91_PINCTRL_PULL_UP>; /* PC17 periph C with pullup */
237 }; 245 };
238 }; 246 };
239 247
240 nand { 248 nand {
241 pinctrl_nand: nand-0 { 249 pinctrl_nand: nand-0 {
242 atmel,pins = 250 atmel,pins =
243 <3 0 0x1 0x0 /* PD0 periph A Read Enable */ 251 <AT91_PIOD 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD0 periph A Read Enable */
244 3 1 0x1 0x0 /* PD1 periph A Write Enable */ 252 AT91_PIOD 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD1 periph A Write Enable */
245 3 2 0x1 0x0 /* PD2 periph A Address Latch Enable */ 253 AT91_PIOD 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD2 periph A Address Latch Enable */
246 3 3 0x1 0x0 /* PD3 periph A Command Latch Enable */ 254 AT91_PIOD 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD3 periph A Command Latch Enable */
247 3 4 0x0 0x1 /* PD4 gpio Chip Enable pin pull_up */ 255 AT91_PIOD 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PD4 gpio Chip Enable pin pull_up */
248 3 5 0x0 0x1 /* PD5 gpio RDY/BUSY pin pull_up */ 256 AT91_PIOD 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PD5 gpio RDY/BUSY pin pull_up */
249 3 6 0x1 0x0 /* PD6 periph A Data bit 0 */ 257 AT91_PIOD 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD6 periph A Data bit 0 */
250 3 7 0x1 0x0 /* PD7 periph A Data bit 1 */ 258 AT91_PIOD 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD7 periph A Data bit 1 */
251 3 8 0x1 0x0 /* PD8 periph A Data bit 2 */ 259 AT91_PIOD 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD8 periph A Data bit 2 */
252 3 9 0x1 0x0 /* PD9 periph A Data bit 3 */ 260 AT91_PIOD 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD9 periph A Data bit 3 */
253 3 10 0x1 0x0 /* PD10 periph A Data bit 4 */ 261 AT91_PIOD 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD10 periph A Data bit 4 */
254 3 11 0x1 0x0 /* PD11 periph A Data bit 5 */ 262 AT91_PIOD 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD11 periph A Data bit 5 */
255 3 12 0x1 0x0 /* PD12 periph A Data bit 6 */ 263 AT91_PIOD 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD12 periph A Data bit 6 */
256 3 13 0x1 0x0>; /* PD13 periph A Data bit 7 */ 264 AT91_PIOD 13 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD13 periph A Data bit 7 */
257 }; 265 };
258 266
259 pinctrl_nand_16bits: nand_16bits-0 { 267 pinctrl_nand_16bits: nand_16bits-0 {
260 atmel,pins = 268 atmel,pins =
261 <3 14 0x1 0x0 /* PD14 periph A Data bit 8 */ 269 <AT91_PIOD 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD14 periph A Data bit 8 */
262 3 15 0x1 0x0 /* PD15 periph A Data bit 9 */ 270 AT91_PIOD 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD15 periph A Data bit 9 */
263 3 16 0x1 0x0 /* PD16 periph A Data bit 10 */ 271 AT91_PIOD 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD16 periph A Data bit 10 */
264 3 17 0x1 0x0 /* PD17 periph A Data bit 11 */ 272 AT91_PIOD 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD17 periph A Data bit 11 */
265 3 18 0x1 0x0 /* PD18 periph A Data bit 12 */ 273 AT91_PIOD 18 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD18 periph A Data bit 12 */
266 3 19 0x1 0x0 /* PD19 periph A Data bit 13 */ 274 AT91_PIOD 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD19 periph A Data bit 13 */
267 3 20 0x1 0x0 /* PD20 periph A Data bit 14 */ 275 AT91_PIOD 20 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD20 periph A Data bit 14 */
268 3 21 0x1 0x0>; /* PD21 periph A Data bit 15 */ 276 AT91_PIOD 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD21 periph A Data bit 15 */
269 }; 277 };
270 }; 278 };
271 279
272 macb0 { 280 macb0 {
273 pinctrl_macb0_rmii: macb0_rmii-0 { 281 pinctrl_macb0_rmii: macb0_rmii-0 {
274 atmel,pins = 282 atmel,pins =
275 <1 0 0x1 0x0 /* PB0 periph A */ 283 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A */
276 1 1 0x1 0x0 /* PB1 periph A */ 284 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A */
277 1 2 0x1 0x0 /* PB2 periph A */ 285 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB2 periph A */
278 1 3 0x1 0x0 /* PB3 periph A */ 286 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A */
279 1 4 0x1 0x0 /* PB4 periph A */ 287 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A */
280 1 5 0x1 0x0 /* PB5 periph A */ 288 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB5 periph A */
281 1 6 0x1 0x0 /* PB6 periph A */ 289 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A */
282 1 7 0x1 0x0 /* PB7 periph A */ 290 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB7 periph A */
283 1 9 0x1 0x0 /* PB9 periph A */ 291 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A */
284 1 10 0x1 0x0>; /* PB10 periph A */ 292 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB10 periph A */
285 }; 293 };
286 294
287 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 { 295 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 {
288 atmel,pins = 296 atmel,pins =
289 <1 8 0x1 0x0 /* PB8 periph A */ 297 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB8 periph A */
290 1 11 0x1 0x0 /* PB11 periph A */ 298 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A */
291 1 12 0x1 0x0 /* PB12 periph A */ 299 AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A */
292 1 13 0x1 0x0 /* PB13 periph A */ 300 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A */
293 1 14 0x1 0x0 /* PB14 periph A */ 301 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A */
294 1 15 0x1 0x0 /* PB15 periph A */ 302 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A */
295 1 16 0x1 0x0 /* PB16 periph A */ 303 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A */
296 1 17 0x1 0x0>; /* PB17 periph A */ 304 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB17 periph A */
297 }; 305 };
298 }; 306 };
299 307
300 mmc0 { 308 mmc0 {
301 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 { 309 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
302 atmel,pins = 310 atmel,pins =
303 <0 17 0x1 0x0 /* PA17 periph A */ 311 <AT91_PIOA 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA17 periph A */
304 0 16 0x1 0x1 /* PA16 periph A with pullup */ 312 AT91_PIOA 16 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA16 periph A with pullup */
305 0 15 0x1 0x1>; /* PA15 periph A with pullup */ 313 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA15 periph A with pullup */
306 }; 314 };
307 315
308 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 { 316 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
309 atmel,pins = 317 atmel,pins =
310 <0 18 0x1 0x1 /* PA18 periph A with pullup */ 318 <AT91_PIOA 18 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA18 periph A with pullup */
311 0 19 0x1 0x1 /* PA19 periph A with pullup */ 319 AT91_PIOA 19 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PA19 periph A with pullup */
312 0 20 0x1 0x1>; /* PA20 periph A with pullup */ 320 AT91_PIOA 20 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PA20 periph A with pullup */
313 }; 321 };
314 }; 322 };
315 323
316 mmc1 { 324 mmc1 {
317 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 { 325 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 {
318 atmel,pins = 326 atmel,pins =
319 <0 13 0x2 0x0 /* PA13 periph B */ 327 <AT91_PIOA 13 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA13 periph B */
320 0 12 0x2 0x1 /* PA12 periph B with pullup */ 328 AT91_PIOA 12 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA12 periph B with pullup */
321 0 11 0x2 0x1>; /* PA11 periph B with pullup */ 329 AT91_PIOA 11 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA11 periph B with pullup */
322 }; 330 };
323 331
324 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 { 332 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
325 atmel,pins = 333 atmel,pins =
326 <0 2 0x2 0x1 /* PA2 periph B with pullup */ 334 <AT91_PIOA 2 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA2 periph B with pullup */
327 0 3 0x2 0x1 /* PA3 periph B with pullup */ 335 AT91_PIOA 3 AT91_PERIPH_B AT91_PINCTRL_PULL_UP /* PA3 periph B with pullup */
328 0 4 0x2 0x1>; /* PA4 periph B with pullup */ 336 AT91_PIOA 4 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA4 periph B with pullup */
329 }; 337 };
330 }; 338 };
331 339
332 ssc0 { 340 ssc0 {
333 pinctrl_ssc0_tx: ssc0_tx-0 { 341 pinctrl_ssc0_tx: ssc0_tx-0 {
334 atmel,pins = 342 atmel,pins =
335 <0 24 0x2 0x0 /* PA24 periph B */ 343 <AT91_PIOA 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA24 periph B */
336 0 25 0x2 0x0 /* PA25 periph B */ 344 AT91_PIOA 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA25 periph B */
337 0 26 0x2 0x0>; /* PA26 periph B */ 345 AT91_PIOA 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA26 periph B */
338 }; 346 };
339 347
340 pinctrl_ssc0_rx: ssc0_rx-0 { 348 pinctrl_ssc0_rx: ssc0_rx-0 {
341 atmel,pins = 349 atmel,pins =
342 <0 27 0x2 0x0 /* PA27 periph B */ 350 <AT91_PIOA 27 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA27 periph B */
343 0 28 0x2 0x0 /* PA28 periph B */ 351 AT91_PIOA 28 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA28 periph B */
344 0 29 0x2 0x0>; /* PA29 periph B */ 352 AT91_PIOA 29 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA29 periph B */
345 }; 353 };
346 }; 354 };
347 355
348 spi0 { 356 spi0 {
349 pinctrl_spi0: spi0-0 { 357 pinctrl_spi0: spi0-0 {
350 atmel,pins = 358 atmel,pins =
351 <0 11 0x1 0x0 /* PA11 periph A SPI0_MISO pin */ 359 <AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A SPI0_MISO pin */
352 0 12 0x1 0x0 /* PA12 periph A SPI0_MOSI pin */ 360 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A SPI0_MOSI pin */
353 0 13 0x1 0x0>; /* PA13 periph A SPI0_SPCK pin */ 361 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA13 periph A SPI0_SPCK pin */
354 }; 362 };
355 }; 363 };
356 364
357 spi1 { 365 spi1 {
358 pinctrl_spi1: spi1-0 { 366 pinctrl_spi1: spi1-0 {
359 atmel,pins = 367 atmel,pins =
360 <0 21 0x2 0x0 /* PA21 periph B SPI1_MISO pin */ 368 <AT91_PIOA 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA21 periph B SPI1_MISO pin */
361 0 22 0x2 0x0 /* PA22 periph B SPI1_MOSI pin */ 369 AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA22 periph B SPI1_MOSI pin */
362 0 23 0x2 0x0>; /* PA23 periph B SPI1_SPCK pin */ 370 AT91_PIOA 23 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PA23 periph B SPI1_SPCK pin */
363 }; 371 };
364 }; 372 };
365 373
366 i2c0 { 374 i2c0 {
367 pinctrl_i2c0: i2c0-0 { 375 pinctrl_i2c0: i2c0-0 {
368 atmel,pins = 376 atmel,pins =
369 <0 30 0x1 0x0 /* PA30 periph A I2C0 data */ 377 <AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA30 periph A I2C0 data */
370 0 31 0x1 0x0>; /* PA31 periph A I2C0 clock */ 378 AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA31 periph A I2C0 clock */
371 }; 379 };
372 }; 380 };
373 381
374 i2c1 { 382 i2c1 {
375 pinctrl_i2c1: i2c1-0 { 383 pinctrl_i2c1: i2c1-0 {
376 atmel,pins = 384 atmel,pins =
377 <2 0 0x3 0x0 /* PC0 periph C I2C1 data */ 385 <AT91_PIOC 0 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC0 periph C I2C1 data */
378 2 1 0x3 0x0>; /* PC1 periph C I2C1 clock */ 386 AT91_PIOC 1 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC1 periph C I2C1 clock */
379 }; 387 };
380 }; 388 };
381 389
382 i2c2 { 390 i2c2 {
383 pinctrl_i2c2: i2c2-0 { 391 pinctrl_i2c2: i2c2-0 {
384 atmel,pins = 392 atmel,pins =
385 <1 4 0x2 0x0 /* PB4 periph B I2C2 data */ 393 <AT91_PIOB 4 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB4 periph B I2C2 data */
386 1 5 0x2 0x0>; /* PB5 periph B I2C2 clock */ 394 AT91_PIOB 5 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB5 periph B I2C2 clock */
387 }; 395 };
388 }; 396 };
389 397
390 i2c_gpio0 { 398 i2c_gpio0 {
391 pinctrl_i2c_gpio0: i2c_gpio0-0 { 399 pinctrl_i2c_gpio0: i2c_gpio0-0 {
392 atmel,pins = 400 atmel,pins =
393 <0 30 0x0 0x2 /* PA30 gpio multidrive I2C0 data */ 401 <AT91_PIOA 30 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE /* PA30 gpio multidrive I2C0 data */
394 0 31 0x0 0x2>; /* PA31 gpio multidrive I2C0 clock */ 402 AT91_PIOA 31 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE>; /* PA31 gpio multidrive I2C0 clock */
395 }; 403 };
396 }; 404 };
397 405
398 i2c_gpio1 { 406 i2c_gpio1 {
399 pinctrl_i2c_gpio1: i2c_gpio1-0 { 407 pinctrl_i2c_gpio1: i2c_gpio1-0 {
400 atmel,pins = 408 atmel,pins =
401 <2 0 0x0 0x2 /* PC0 gpio multidrive I2C1 data */ 409 <AT91_PIOC 0 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE /* PC0 gpio multidrive I2C1 data */
402 2 1 0x0 0x2>; /* PC1 gpio multidrive I2C1 clock */ 410 AT91_PIOC 1 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE>; /* PC1 gpio multidrive I2C1 clock */
403 }; 411 };
404 }; 412 };
405 413
406 i2c_gpio2 { 414 i2c_gpio2 {
407 pinctrl_i2c_gpio2: i2c_gpio2-0 { 415 pinctrl_i2c_gpio2: i2c_gpio2-0 {
408 atmel,pins = 416 atmel,pins =
409 <1 4 0x0 0x2 /* PB4 gpio multidrive I2C2 data */ 417 <AT91_PIOB 4 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE /* PB4 gpio multidrive I2C2 data */
410 1 5 0x0 0x2>; /* PB5 gpio multidrive I2C2 clock */ 418 AT91_PIOB 5 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE>; /* PB5 gpio multidrive I2C2 clock */
419 };
420 };
421
422 tcb0 {
423 pinctrl_tcb0_tclk0: tcb0_tclk0-0 {
424 atmel,pins = <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE>;
425 };
426
427 pinctrl_tcb0_tclk1: tcb0_tclk1-0 {
428 atmel,pins = <AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_NONE>;
429 };
430
431 pinctrl_tcb0_tclk2: tcb0_tclk2-0 {
432 atmel,pins = <AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_NONE>;
433 };
434
435 pinctrl_tcb0_tioa0: tcb0_tioa0-0 {
436 atmel,pins = <AT91_PIOA 21 AT91_PERIPH_A AT91_PINCTRL_NONE>;
437 };
438
439 pinctrl_tcb0_tioa1: tcb0_tioa1-0 {
440 atmel,pins = <AT91_PIOA 22 AT91_PERIPH_A AT91_PINCTRL_NONE>;
441 };
442
443 pinctrl_tcb0_tioa2: tcb0_tioa2-0 {
444 atmel,pins = <AT91_PIOA 23 AT91_PERIPH_A AT91_PINCTRL_NONE>;
445 };
446
447 pinctrl_tcb0_tiob0: tcb0_tiob0-0 {
448 atmel,pins = <AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE>;
449 };
450
451 pinctrl_tcb0_tiob1: tcb0_tiob1-0 {
452 atmel,pins = <AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE>;
453 };
454
455 pinctrl_tcb0_tiob2: tcb0_tiob2-0 {
456 atmel,pins = <AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_NONE>;
457 };
458 };
459
460 tcb1 {
461 pinctrl_tcb1_tclk0: tcb1_tclk0-0 {
462 atmel,pins = <AT91_PIOC 4 AT91_PERIPH_C AT91_PINCTRL_NONE>;
463 };
464
465 pinctrl_tcb1_tclk1: tcb1_tclk1-0 {
466 atmel,pins = <AT91_PIOC 7 AT91_PERIPH_C AT91_PINCTRL_NONE>;
467 };
468
469 pinctrl_tcb1_tclk2: tcb1_tclk2-0 {
470 atmel,pins = <AT91_PIOC 14 AT91_PERIPH_C AT91_PINCTRL_NONE>;
471 };
472
473 pinctrl_tcb1_tioa0: tcb1_tioa0-0 {
474 atmel,pins = <AT91_PIOC 2 AT91_PERIPH_C AT91_PINCTRL_NONE>;
475 };
476
477 pinctrl_tcb1_tioa1: tcb1_tioa1-0 {
478 atmel,pins = <AT91_PIOC 5 AT91_PERIPH_C AT91_PINCTRL_NONE>;
479 };
480
481 pinctrl_tcb1_tioa2: tcb1_tioa2-0 {
482 atmel,pins = <AT91_PIOC 12 AT91_PERIPH_C AT91_PINCTRL_NONE>;
483 };
484
485 pinctrl_tcb1_tiob0: tcb1_tiob0-0 {
486 atmel,pins = <AT91_PIOC 3 AT91_PERIPH_C AT91_PINCTRL_NONE>;
487 };
488
489 pinctrl_tcb1_tiob1: tcb1_tiob1-0 {
490 atmel,pins = <AT91_PIOC 6 AT91_PERIPH_C AT91_PINCTRL_NONE>;
491 };
492
493 pinctrl_tcb1_tiob2: tcb1_tiob2-0 {
494 atmel,pins = <AT91_PIOC 13 AT91_PERIPH_C AT91_PINCTRL_NONE>;
411 }; 495 };
412 }; 496 };
413 497
414 pioA: gpio@fffff400 { 498 pioA: gpio@fffff400 {
415 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 499 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
416 reg = <0xfffff400 0x200>; 500 reg = <0xfffff400 0x200>;
417 interrupts = <2 4 1>; 501 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
418 #gpio-cells = <2>; 502 #gpio-cells = <2>;
419 gpio-controller; 503 gpio-controller;
420 interrupt-controller; 504 interrupt-controller;
@@ -424,7 +508,7 @@
424 pioB: gpio@fffff600 { 508 pioB: gpio@fffff600 {
425 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 509 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
426 reg = <0xfffff600 0x200>; 510 reg = <0xfffff600 0x200>;
427 interrupts = <2 4 1>; 511 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>;
428 #gpio-cells = <2>; 512 #gpio-cells = <2>;
429 gpio-controller; 513 gpio-controller;
430 #gpio-lines = <19>; 514 #gpio-lines = <19>;
@@ -435,7 +519,7 @@
435 pioC: gpio@fffff800 { 519 pioC: gpio@fffff800 {
436 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 520 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
437 reg = <0xfffff800 0x200>; 521 reg = <0xfffff800 0x200>;
438 interrupts = <3 4 1>; 522 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
439 #gpio-cells = <2>; 523 #gpio-cells = <2>;
440 gpio-controller; 524 gpio-controller;
441 interrupt-controller; 525 interrupt-controller;
@@ -445,7 +529,7 @@
445 pioD: gpio@fffffa00 { 529 pioD: gpio@fffffa00 {
446 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 530 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
447 reg = <0xfffffa00 0x200>; 531 reg = <0xfffffa00 0x200>;
448 interrupts = <3 4 1>; 532 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 1>;
449 #gpio-cells = <2>; 533 #gpio-cells = <2>;
450 gpio-controller; 534 gpio-controller;
451 #gpio-lines = <22>; 535 #gpio-lines = <22>;
@@ -457,7 +541,7 @@
457 ssc0: ssc@f0010000 { 541 ssc0: ssc@f0010000 {
458 compatible = "atmel,at91sam9g45-ssc"; 542 compatible = "atmel,at91sam9g45-ssc";
459 reg = <0xf0010000 0x4000>; 543 reg = <0xf0010000 0x4000>;
460 interrupts = <28 4 5>; 544 interrupts = <28 IRQ_TYPE_LEVEL_HIGH 5>;
461 pinctrl-names = "default"; 545 pinctrl-names = "default";
462 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 546 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
463 status = "disabled"; 547 status = "disabled";
@@ -466,8 +550,8 @@
466 mmc0: mmc@f0008000 { 550 mmc0: mmc@f0008000 {
467 compatible = "atmel,hsmci"; 551 compatible = "atmel,hsmci";
468 reg = <0xf0008000 0x600>; 552 reg = <0xf0008000 0x600>;
469 interrupts = <12 4 0>; 553 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 0>;
470 dmas = <&dma0 1 0>; 554 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(0)>;
471 dma-names = "rxtx"; 555 dma-names = "rxtx";
472 #address-cells = <1>; 556 #address-cells = <1>;
473 #size-cells = <0>; 557 #size-cells = <0>;
@@ -477,8 +561,8 @@
477 mmc1: mmc@f000c000 { 561 mmc1: mmc@f000c000 {
478 compatible = "atmel,hsmci"; 562 compatible = "atmel,hsmci";
479 reg = <0xf000c000 0x600>; 563 reg = <0xf000c000 0x600>;
480 interrupts = <26 4 0>; 564 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
481 dmas = <&dma1 1 0>; 565 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(0)>;
482 dma-names = "rxtx"; 566 dma-names = "rxtx";
483 #address-cells = <1>; 567 #address-cells = <1>;
484 #size-cells = <0>; 568 #size-cells = <0>;
@@ -488,7 +572,7 @@
488 dbgu: serial@fffff200 { 572 dbgu: serial@fffff200 {
489 compatible = "atmel,at91sam9260-usart"; 573 compatible = "atmel,at91sam9260-usart";
490 reg = <0xfffff200 0x200>; 574 reg = <0xfffff200 0x200>;
491 interrupts = <1 4 7>; 575 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
492 pinctrl-names = "default"; 576 pinctrl-names = "default";
493 pinctrl-0 = <&pinctrl_dbgu>; 577 pinctrl-0 = <&pinctrl_dbgu>;
494 status = "disabled"; 578 status = "disabled";
@@ -497,7 +581,7 @@
497 usart0: serial@f801c000 { 581 usart0: serial@f801c000 {
498 compatible = "atmel,at91sam9260-usart"; 582 compatible = "atmel,at91sam9260-usart";
499 reg = <0xf801c000 0x200>; 583 reg = <0xf801c000 0x200>;
500 interrupts = <5 4 5>; 584 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 5>;
501 pinctrl-names = "default"; 585 pinctrl-names = "default";
502 pinctrl-0 = <&pinctrl_usart0>; 586 pinctrl-0 = <&pinctrl_usart0>;
503 status = "disabled"; 587 status = "disabled";
@@ -506,7 +590,7 @@
506 usart1: serial@f8020000 { 590 usart1: serial@f8020000 {
507 compatible = "atmel,at91sam9260-usart"; 591 compatible = "atmel,at91sam9260-usart";
508 reg = <0xf8020000 0x200>; 592 reg = <0xf8020000 0x200>;
509 interrupts = <6 4 5>; 593 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 5>;
510 pinctrl-names = "default"; 594 pinctrl-names = "default";
511 pinctrl-0 = <&pinctrl_usart1>; 595 pinctrl-0 = <&pinctrl_usart1>;
512 status = "disabled"; 596 status = "disabled";
@@ -515,7 +599,7 @@
515 usart2: serial@f8024000 { 599 usart2: serial@f8024000 {
516 compatible = "atmel,at91sam9260-usart"; 600 compatible = "atmel,at91sam9260-usart";
517 reg = <0xf8024000 0x200>; 601 reg = <0xf8024000 0x200>;
518 interrupts = <7 4 5>; 602 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 5>;
519 pinctrl-names = "default"; 603 pinctrl-names = "default";
520 pinctrl-0 = <&pinctrl_usart2>; 604 pinctrl-0 = <&pinctrl_usart2>;
521 status = "disabled"; 605 status = "disabled";
@@ -524,7 +608,7 @@
524 macb0: ethernet@f802c000 { 608 macb0: ethernet@f802c000 {
525 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 609 compatible = "cdns,at32ap7000-macb", "cdns,macb";
526 reg = <0xf802c000 0x100>; 610 reg = <0xf802c000 0x100>;
527 interrupts = <24 4 3>; 611 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
528 pinctrl-names = "default"; 612 pinctrl-names = "default";
529 pinctrl-0 = <&pinctrl_macb0_rmii>; 613 pinctrl-0 = <&pinctrl_macb0_rmii>;
530 status = "disabled"; 614 status = "disabled";
@@ -533,16 +617,16 @@
533 macb1: ethernet@f8030000 { 617 macb1: ethernet@f8030000 {
534 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 618 compatible = "cdns,at32ap7000-macb", "cdns,macb";
535 reg = <0xf8030000 0x100>; 619 reg = <0xf8030000 0x100>;
536 interrupts = <27 4 3>; 620 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 3>;
537 status = "disabled"; 621 status = "disabled";
538 }; 622 };
539 623
540 i2c0: i2c@f8010000 { 624 i2c0: i2c@f8010000 {
541 compatible = "atmel,at91sam9x5-i2c"; 625 compatible = "atmel,at91sam9x5-i2c";
542 reg = <0xf8010000 0x100>; 626 reg = <0xf8010000 0x100>;
543 interrupts = <9 4 6>; 627 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 6>;
544 dmas = <&dma0 1 7>, 628 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(7)>,
545 <&dma0 1 8>; 629 <&dma0 1 AT91_DMA_CFG_PER_ID(8)>;
546 dma-names = "tx", "rx"; 630 dma-names = "tx", "rx";
547 #address-cells = <1>; 631 #address-cells = <1>;
548 #size-cells = <0>; 632 #size-cells = <0>;
@@ -554,9 +638,9 @@
554 i2c1: i2c@f8014000 { 638 i2c1: i2c@f8014000 {
555 compatible = "atmel,at91sam9x5-i2c"; 639 compatible = "atmel,at91sam9x5-i2c";
556 reg = <0xf8014000 0x100>; 640 reg = <0xf8014000 0x100>;
557 interrupts = <10 4 6>; 641 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 6>;
558 dmas = <&dma1 1 5>, 642 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(5)>,
559 <&dma1 1 6>; 643 <&dma1 1 AT91_DMA_CFG_PER_ID(6)>;
560 dma-names = "tx", "rx"; 644 dma-names = "tx", "rx";
561 #address-cells = <1>; 645 #address-cells = <1>;
562 #size-cells = <0>; 646 #size-cells = <0>;
@@ -568,9 +652,9 @@
568 i2c2: i2c@f8018000 { 652 i2c2: i2c@f8018000 {
569 compatible = "atmel,at91sam9x5-i2c"; 653 compatible = "atmel,at91sam9x5-i2c";
570 reg = <0xf8018000 0x100>; 654 reg = <0xf8018000 0x100>;
571 interrupts = <11 4 6>; 655 interrupts = <11 IRQ_TYPE_LEVEL_HIGH 6>;
572 dmas = <&dma0 1 9>, 656 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(9)>,
573 <&dma0 1 10>; 657 <&dma0 1 AT91_DMA_CFG_PER_ID(10)>;
574 dma-names = "tx", "rx"; 658 dma-names = "tx", "rx";
575 #address-cells = <1>; 659 #address-cells = <1>;
576 #size-cells = <0>; 660 #size-cells = <0>;
@@ -579,10 +663,28 @@
579 status = "disabled"; 663 status = "disabled";
580 }; 664 };
581 665
666 uart0: serial@f8040000 {
667 compatible = "atmel,at91sam9260-usart";
668 reg = <0xf8040000 0x200>;
669 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
670 pinctrl-names = "default";
671 pinctrl-0 = <&pinctrl_uart0>;
672 status = "disabled";
673 };
674
675 uart1: serial@f8044000 {
676 compatible = "atmel,at91sam9260-usart";
677 reg = <0xf8044000 0x200>;
678 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>;
679 pinctrl-names = "default";
680 pinctrl-0 = <&pinctrl_uart1>;
681 status = "disabled";
682 };
683
582 adc0: adc@f804c000 { 684 adc0: adc@f804c000 {
583 compatible = "atmel,at91sam9260-adc"; 685 compatible = "atmel,at91sam9260-adc";
584 reg = <0xf804c000 0x100>; 686 reg = <0xf804c000 0x100>;
585 interrupts = <19 4 0>; 687 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 0>;
586 atmel,adc-use-external; 688 atmel,adc-use-external;
587 atmel,adc-channels-used = <0xffff>; 689 atmel,adc-channels-used = <0xffff>;
588 atmel,adc-vref = <3300>; 690 atmel,adc-vref = <3300>;
@@ -625,7 +727,10 @@
625 #size-cells = <0>; 727 #size-cells = <0>;
626 compatible = "atmel,at91rm9200-spi"; 728 compatible = "atmel,at91rm9200-spi";
627 reg = <0xf0000000 0x100>; 729 reg = <0xf0000000 0x100>;
628 interrupts = <13 4 3>; 730 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 3>;
731 dmas = <&dma0 1 AT91_DMA_CFG_PER_ID(1)>,
732 <&dma0 1 AT91_DMA_CFG_PER_ID(2)>;
733 dma-names = "tx", "rx";
629 pinctrl-names = "default"; 734 pinctrl-names = "default";
630 pinctrl-0 = <&pinctrl_spi0>; 735 pinctrl-0 = <&pinctrl_spi0>;
631 status = "disabled"; 736 status = "disabled";
@@ -636,16 +741,87 @@
636 #size-cells = <0>; 741 #size-cells = <0>;
637 compatible = "atmel,at91rm9200-spi"; 742 compatible = "atmel,at91rm9200-spi";
638 reg = <0xf0004000 0x100>; 743 reg = <0xf0004000 0x100>;
639 interrupts = <14 4 3>; 744 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 3>;
745 dmas = <&dma1 1 AT91_DMA_CFG_PER_ID(1)>,
746 <&dma1 1 AT91_DMA_CFG_PER_ID(2)>;
747 dma-names = "tx", "rx";
640 pinctrl-names = "default"; 748 pinctrl-names = "default";
641 pinctrl-0 = <&pinctrl_spi1>; 749 pinctrl-0 = <&pinctrl_spi1>;
642 status = "disabled"; 750 status = "disabled";
643 }; 751 };
644 752
753 usb2: gadget@f803c000 {
754 #address-cells = <1>;
755 #size-cells = <0>;
756 compatible = "atmel,at91sam9rl-udc";
757 reg = <0x00500000 0x80000
758 0xf803c000 0x400>;
759 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>;
760 status = "disabled";
761
762 ep0 {
763 reg = <0>;
764 atmel,fifo-size = <64>;
765 atmel,nb-banks = <1>;
766 };
767
768 ep1 {
769 reg = <1>;
770 atmel,fifo-size = <1024>;
771 atmel,nb-banks = <2>;
772 atmel,can-dma;
773 atmel,can-isoc;
774 };
775
776 ep2 {
777 reg = <2>;
778 atmel,fifo-size = <1024>;
779 atmel,nb-banks = <2>;
780 atmel,can-dma;
781 atmel,can-isoc;
782 };
783
784 ep3 {
785 reg = <3>;
786 atmel,fifo-size = <1024>;
787 atmel,nb-banks = <3>;
788 atmel,can-dma;
789 };
790
791 ep4 {
792 reg = <4>;
793 atmel,fifo-size = <1024>;
794 atmel,nb-banks = <3>;
795 atmel,can-dma;
796 };
797
798 ep5 {
799 reg = <5>;
800 atmel,fifo-size = <1024>;
801 atmel,nb-banks = <3>;
802 atmel,can-dma;
803 atmel,can-isoc;
804 };
805
806 ep6 {
807 reg = <6>;
808 atmel,fifo-size = <1024>;
809 atmel,nb-banks = <3>;
810 atmel,can-dma;
811 atmel,can-isoc;
812 };
813 };
814
815 watchdog@fffffe40 {
816 compatible = "atmel,at91sam9260-wdt";
817 reg = <0xfffffe40 0x10>;
818 status = "disabled";
819 };
820
645 rtc@fffffeb0 { 821 rtc@fffffeb0 {
646 compatible = "atmel,at91rm9200-rtc"; 822 compatible = "atmel,at91sam9x5-rtc";
647 reg = <0xfffffeb0 0x40>; 823 reg = <0xfffffeb0 0x40>;
648 interrupts = <1 4 7>; 824 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
649 status = "disabled"; 825 status = "disabled";
650 }; 826 };
651 }; 827 };
@@ -664,8 +840,8 @@
664 atmel,nand-cmd-offset = <22>; 840 atmel,nand-cmd-offset = <22>;
665 pinctrl-names = "default"; 841 pinctrl-names = "default";
666 pinctrl-0 = <&pinctrl_nand>; 842 pinctrl-0 = <&pinctrl_nand>;
667 gpios = <&pioD 5 0 843 gpios = <&pioD 5 GPIO_ACTIVE_HIGH
668 &pioD 4 0 844 &pioD 4 GPIO_ACTIVE_HIGH
669 0 845 0
670 >; 846 >;
671 status = "disabled"; 847 status = "disabled";
@@ -674,22 +850,22 @@
674 usb0: ohci@00600000 { 850 usb0: ohci@00600000 {
675 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 851 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
676 reg = <0x00600000 0x100000>; 852 reg = <0x00600000 0x100000>;
677 interrupts = <22 4 2>; 853 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
678 status = "disabled"; 854 status = "disabled";
679 }; 855 };
680 856
681 usb1: ehci@00700000 { 857 usb1: ehci@00700000 {
682 compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; 858 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
683 reg = <0x00700000 0x100000>; 859 reg = <0x00700000 0x100000>;
684 interrupts = <22 4 2>; 860 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>;
685 status = "disabled"; 861 status = "disabled";
686 }; 862 };
687 }; 863 };
688 864
689 i2c@0 { 865 i2c@0 {
690 compatible = "i2c-gpio"; 866 compatible = "i2c-gpio";
691 gpios = <&pioA 30 0 /* sda */ 867 gpios = <&pioA 30 GPIO_ACTIVE_HIGH /* sda */
692 &pioA 31 0 /* scl */ 868 &pioA 31 GPIO_ACTIVE_HIGH /* scl */
693 >; 869 >;
694 i2c-gpio,sda-open-drain; 870 i2c-gpio,sda-open-drain;
695 i2c-gpio,scl-open-drain; 871 i2c-gpio,scl-open-drain;
@@ -703,8 +879,8 @@
703 879
704 i2c@1 { 880 i2c@1 {
705 compatible = "i2c-gpio"; 881 compatible = "i2c-gpio";
706 gpios = <&pioC 0 0 /* sda */ 882 gpios = <&pioC 0 GPIO_ACTIVE_HIGH /* sda */
707 &pioC 1 0 /* scl */ 883 &pioC 1 GPIO_ACTIVE_HIGH /* scl */
708 >; 884 >;
709 i2c-gpio,sda-open-drain; 885 i2c-gpio,sda-open-drain;
710 i2c-gpio,scl-open-drain; 886 i2c-gpio,scl-open-drain;
@@ -718,8 +894,8 @@
718 894
719 i2c@2 { 895 i2c@2 {
720 compatible = "i2c-gpio"; 896 compatible = "i2c-gpio";
721 gpios = <&pioB 4 0 /* sda */ 897 gpios = <&pioB 4 GPIO_ACTIVE_HIGH /* sda */
722 &pioB 5 0 /* scl */ 898 &pioB 5 GPIO_ACTIVE_HIGH /* scl */
723 >; 899 >;
724 i2c-gpio,sda-open-drain; 900 i2c-gpio,sda-open-drain;
725 i2c-gpio,scl-open-drain; 901 i2c-gpio,scl-open-drain;
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi
index 347a74a857f6..4a5ee5cc115a 100644
--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -28,7 +28,7 @@
28 pinctrl@fffff400 { 28 pinctrl@fffff400 {
29 1wire_cm { 29 1wire_cm {
30 pinctrl_1wire_cm: 1wire_cm-0 { 30 pinctrl_1wire_cm: 1wire_cm-0 {
31 atmel,pins = <1 18 0x0 0x2>; /* PB18 multidrive, conflicts with led */ 31 atmel,pins = <AT91_PIOB 18 AT91_PERIPH_GPIO AT91_PINCTRL_MULTI_DRIVE>; /* PB18 multidrive, conflicts with led */
32 }; 32 };
33 }; 33 };
34 }; 34 };
@@ -75,19 +75,19 @@
75 75
76 pb18 { 76 pb18 {
77 label = "pb18"; 77 label = "pb18";
78 gpios = <&pioB 18 1>; 78 gpios = <&pioB 18 GPIO_ACTIVE_LOW>;
79 linux,default-trigger = "heartbeat"; 79 linux,default-trigger = "heartbeat";
80 }; 80 };
81 81
82 pd21 { 82 pd21 {
83 label = "pd21"; 83 label = "pd21";
84 gpios = <&pioD 21 0>; 84 gpios = <&pioD 21 GPIO_ACTIVE_HIGH>;
85 }; 85 };
86 }; 86 };
87 87
88 1wire_cm { 88 1wire_cm {
89 compatible = "w1-gpio"; 89 compatible = "w1-gpio";
90 gpios = <&pioB 18 0>; 90 gpios = <&pioB 18 GPIO_ACTIVE_HIGH>;
91 linux,open-drain; 91 linux,open-drain;
92 pinctrl-names = "default"; 92 pinctrl-names = "default";
93 pinctrl-0 = <&pinctrl_1wire_cm>; 93 pinctrl-0 = <&pinctrl_1wire_cm>;
diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
index 1fa48d2bfd80..b753855b2058 100644
--- a/arch/arm/boot/dts/at91sam9x5ek.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -6,7 +6,7 @@
6 * 6 *
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/include/ "at91sam9x5cm.dtsi" 9#include "at91sam9x5cm.dtsi"
10 10
11/ { 11/ {
12 model = "Atmel AT91SAM9X5-EK"; 12 model = "Atmel AT91SAM9X5-EK";
@@ -27,7 +27,7 @@
27 slot@0 { 27 slot@0 {
28 reg = <0>; 28 reg = <0>;
29 bus-width = <4>; 29 bus-width = <4>;
30 cd-gpios = <&pioD 15 0>; 30 cd-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>;
31 }; 31 };
32 }; 32 };
33 33
@@ -40,7 +40,7 @@
40 slot@0 { 40 slot@0 {
41 reg = <0>; 41 reg = <0>;
42 bus-width = <4>; 42 bus-width = <4>;
43 cd-gpios = <&pioD 14 0>; 43 cd-gpios = <&pioD 14 GPIO_ACTIVE_HIGH>;
44 }; 44 };
45 }; 45 };
46 46
@@ -52,6 +52,11 @@
52 status = "okay"; 52 status = "okay";
53 }; 53 };
54 54
55 usb2: gadget@f803c000 {
56 atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
57 status = "okay";
58 };
59
55 i2c0: i2c@f8010000 { 60 i2c0: i2c@f8010000 {
56 status = "okay"; 61 status = "okay";
57 }; 62 };
@@ -60,14 +65,14 @@
60 mmc0 { 65 mmc0 {
61 pinctrl_board_mmc0: mmc0-board { 66 pinctrl_board_mmc0: mmc0-board {
62 atmel,pins = 67 atmel,pins =
63 <3 15 0x0 0x5>; /* PD15 gpio CD pin pull up and deglitch */ 68 <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD15 gpio CD pin pull up and deglitch */
64 }; 69 };
65 }; 70 };
66 71
67 mmc1 { 72 mmc1 {
68 pinctrl_board_mmc1: mmc1-board { 73 pinctrl_board_mmc1: mmc1-board {
69 atmel,pins = 74 atmel,pins =
70 <3 14 0x0 0x5>; /* PD14 gpio CD pin pull up and deglitch */ 75 <AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD14 gpio CD pin pull up and deglitch */
71 }; 76 };
72 }; 77 };
73 }; 78 };
@@ -81,13 +86,17 @@
81 reg = <0>; 86 reg = <0>;
82 }; 87 };
83 }; 88 };
89
90 watchdog@fffffe40 {
91 status = "okay";
92 };
84 }; 93 };
85 94
86 usb0: ohci@00600000 { 95 usb0: ohci@00600000 {
87 status = "okay"; 96 status = "okay";
88 num-ports = <2>; 97 num-ports = <2>;
89 atmel,vbus-gpio = <&pioD 19 1 98 atmel,vbus-gpio = <&pioD 19 GPIO_ACTIVE_LOW
90 &pioD 20 1 99 &pioD 20 GPIO_ACTIVE_LOW
91 >; 100 >;
92 }; 101 };
93 102
diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi
index 7d1a27949c13..9866cd736dee 100644
--- a/arch/arm/boot/dts/atlas6.dtsi
+++ b/arch/arm/boot/dts/atlas6.dtsi
@@ -613,7 +613,7 @@
613 }; 613 };
614 614
615 rtc-iobg { 615 rtc-iobg {
616 compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus"; 616 compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus", "simple-bus";
617 #address-cells = <1>; 617 #address-cells = <1>;
618 #size-cells = <1>; 618 #size-cells = <1>;
619 reg = <0x80030000 0x10000>; 619 reg = <0x80030000 0x10000>;
diff --git a/arch/arm/boot/dts/bcm11351-brt.dts b/arch/arm/boot/dts/bcm11351-brt.dts
index 248067cf7069..67ec524098b5 100644
--- a/arch/arm/boot/dts/bcm11351-brt.dts
+++ b/arch/arm/boot/dts/bcm11351-brt.dts
@@ -13,7 +13,7 @@
13 13
14/dts-v1/; 14/dts-v1/;
15 15
16/include/ "bcm11351.dtsi" 16#include "bcm11351.dtsi"
17 17
18/ { 18/ {
19 model = "BCM11351 BRT board"; 19 model = "BCM11351 BRT board";
@@ -27,4 +27,21 @@
27 status = "okay"; 27 status = "okay";
28 }; 28 };
29 29
30 sdio0: sdio@0x3f180000 {
31 max-frequency = <48000000>;
32 status = "okay";
33 };
34
35 sdio1: sdio@0x3f190000 {
36 non-removable;
37 max-frequency = <48000000>;
38 status = "okay";
39 };
40
41 sdio3: sdio@0x3f1b0000 {
42 max-frequency = <48000000>;
43 status = "okay";
44 };
45
46
30}; 47};
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index 41b2c6c33f09..c0cdf66f8964 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -11,7 +11,10 @@
11 * GNU General Public License for more details. 11 * GNU General Public License for more details.
12 */ 12 */
13 13
14/include/ "skeleton.dtsi" 14#include <dt-bindings/interrupt-controller/arm-gic.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16
17#include "skeleton.dtsi"
15 18
16/ { 19/ {
17 model = "BCM11351 SoC"; 20 model = "BCM11351 SoC";
@@ -33,7 +36,7 @@
33 36
34 smc@0x3404c000 { 37 smc@0x3404c000 {
35 compatible = "bcm,bcm11351-smc", "bcm,kona-smc"; 38 compatible = "bcm,bcm11351-smc", "bcm,kona-smc";
36 reg = <0x3404c000 0x400>; //1 KiB in SRAM 39 reg = <0x3404c000 0x400>; /* 1 KiB in SRAM */
37 }; 40 };
38 41
39 uart@3e000000 { 42 uart@3e000000 {
@@ -41,23 +44,51 @@
41 status = "disabled"; 44 status = "disabled";
42 reg = <0x3e000000 0x1000>; 45 reg = <0x3e000000 0x1000>;
43 clock-frequency = <13000000>; 46 clock-frequency = <13000000>;
44 interrupts = <0x0 67 0x4>; 47 interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
45 reg-shift = <2>; 48 reg-shift = <2>;
46 reg-io-width = <4>; 49 reg-io-width = <4>;
47 }; 50 };
48 51
49 L2: l2-cache { 52 L2: l2-cache {
50 compatible = "arm,pl310-cache"; 53 compatible = "bcm,bcm11351-a2-pl310-cache";
51 reg = <0x3ff20000 0x1000>; 54 reg = <0x3ff20000 0x1000>;
52 cache-unified; 55 cache-unified;
53 cache-level = <2>; 56 cache-level = <2>;
54 }; 57 };
55 58
56 timer@35006000 { 59 timer@35006000 {
57 compatible = "bcm,kona-timer"; 60 compatible = "bcm,kona-timer";
58 reg = <0x35006000 0x1000>; 61 reg = <0x35006000 0x1000>;
59 interrupts = <0x0 7 0x4>; 62 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
60 clock-frequency = <32768>; 63 clock-frequency = <32768>;
61 }; 64 };
62 65
66 sdio0: sdio@0x3f180000 {
67 compatible = "bcm,kona-sdhci";
68 reg = <0x3f180000 0x10000>;
69 interrupts = <0x0 77 0x4>;
70 status = "disabled";
71 };
72
73 sdio1: sdio@0x3f190000 {
74 compatible = "bcm,kona-sdhci";
75 reg = <0x3f190000 0x10000>;
76 interrupts = <0x0 76 0x4>;
77 status = "disabled";
78 };
79
80 sdio2: sdio@0x3f1a0000 {
81 compatible = "bcm,kona-sdhci";
82 reg = <0x3f1a0000 0x10000>;
83 interrupts = <0x0 74 0x4>;
84 status = "disabled";
85 };
86
87 sdio3: sdio@0x3f1b0000 {
88 compatible = "bcm,kona-sdhci";
89 reg = <0x3f1b0000 0x10000>;
90 interrupts = <0x0 73 0x4>;
91 status = "disabled";
92 };
93
63}; 94};
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index aafda174a605..6e9deb786a7d 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -8,6 +8,17 @@
8 memory { 8 memory {
9 reg = <0 0x10000000>; 9 reg = <0 0x10000000>;
10 }; 10 };
11
12 leds {
13 compatible = "gpio-leds";
14
15 act {
16 label = "ACT";
17 gpios = <&gpio 16 1>;
18 default-state = "keep";
19 linux,default-trigger = "heartbeat";
20 };
21 };
11}; 22};
12 23
13&gpio { 24&gpio {
diff --git a/arch/arm/boot/dts/ccu8540.dts b/arch/arm/boot/dts/ccu8540.dts
new file mode 100644
index 000000000000..48ff03441f5a
--- /dev/null
+++ b/arch/arm/boot/dts/ccu8540.dts
@@ -0,0 +1,41 @@
1/*
2 * Copyright 2013 ST-Ericsson AB
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 "dbx5x0.dtsi"
14
15/ {
16 model = "ST-Ericsson U8540 platform with Device Tree";
17 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
18
19 memory@0 {
20 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
21 };
22
23 soc {
24 prcmu@80157000 {
25 reg = <0x80157000 0x2000>, <0x801b0000 0x8000>, <0x801b8000 0x3000>;
26 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
27 };
28
29 uart@80120000 {
30 status = "okay";
31 };
32
33 uart@80121000 {
34 status = "okay";
35 };
36
37 uart@80007000 {
38 status = "okay";
39 };
40 };
41};
diff --git a/arch/arm/boot/dts/ccu9540.dts b/arch/arm/boot/dts/ccu9540.dts
index 04305463f00d..ed29ec7288e4 100644
--- a/arch/arm/boot/dts/ccu9540.dts
+++ b/arch/arm/boot/dts/ccu9540.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "dbx5x0.dtsi" 13#include "dbx5x0.dtsi"
14 14
15/ { 15/ {
16 model = "ST-Ericsson CCU9540 platform with Device Tree"; 16 model = "ST-Ericsson CCU9540 platform with Device Tree";
@@ -20,7 +20,7 @@
20 reg = <0x00000000 0x20000000>; 20 reg = <0x00000000 0x20000000>;
21 }; 21 };
22 22
23 soc-u9500 { 23 soc {
24 uart@80120000 { 24 uart@80120000 {
25 status = "okay"; 25 status = "okay";
26 }; 26 };
@@ -52,7 +52,7 @@
52 // WLAN SDIO channel 52 // WLAN SDIO channel
53 sdi1_per2@80118000 { 53 sdi1_per2@80118000 {
54 arm,primecell-periphid = <0x10480180>; 54 arm,primecell-periphid = <0x10480180>;
55 max-frequency = <50000000>; 55 max-frequency = <100000000>;
56 bus-width = <4>; 56 bus-width = <4>;
57 57
58 status = "okay"; 58 status = "okay";
diff --git a/arch/arm/boot/dts/da850-enbw-cmc.dts b/arch/arm/boot/dts/da850-enbw-cmc.dts
index 422fdb3fcfc1..e750ab9086d5 100644
--- a/arch/arm/boot/dts/da850-enbw-cmc.dts
+++ b/arch/arm/boot/dts/da850-enbw-cmc.dts
@@ -10,7 +10,7 @@
10 * option) any later version. 10 * option) any later version.
11 */ 11 */
12/dts-v1/; 12/dts-v1/;
13/include/ "da850.dtsi" 13#include "da850.dtsi"
14 14
15/ { 15/ {
16 compatible = "enbw,cmc", "ti,da850"; 16 compatible = "enbw,cmc", "ti,da850";
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index c914357c0d89..5bce7cc55cf3 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -8,7 +8,7 @@
8 * Free Software Foundation, version 2. 8 * Free Software Foundation, version 2.
9 */ 9 */
10/dts-v1/; 10/dts-v1/;
11/include/ "da850.dtsi" 11#include "da850.dtsi"
12 12
13/ { 13/ {
14 compatible = "ti,da850-evm", "ti,da850"; 14 compatible = "ti,da850-evm", "ti,da850";
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 2c88313d2c7a..d70ba5504481 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -7,7 +7,7 @@
7 * Free Software Foundation; either version 2 of the License, or (at your 7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. 8 * option) any later version.
9 */ 9 */
10/include/ "skeleton.dtsi" 10#include "skeleton.dtsi"
11 11
12/ { 12/ {
13 arm { 13 arm {
@@ -37,7 +37,7 @@
37 #size-cells = <0>; 37 #size-cells = <0>;
38 pinctrl-single,bit-per-mux; 38 pinctrl-single,bit-per-mux;
39 pinctrl-single,register-width = <32>; 39 pinctrl-single,register-width = <32>;
40 pinctrl-single,function-mask = <0xffffffff>; 40 pinctrl-single,function-mask = <0xf>;
41 status = "disabled"; 41 status = "disabled";
42 42
43 nand_cs3_pins: pinmux_nand_pins { 43 nand_cs3_pins: pinmux_nand_pins {
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index b6bc4ff17f26..a1529455f081 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -9,10 +9,11 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12/include/ "skeleton.dtsi" 12#include <dt-bindings/interrupt-controller/irq.h>
13#include "skeleton.dtsi"
13 14
14/ { 15/ {
15 soc-u9500 { 16 soc {
16 #address-cells = <1>; 17 #address-cells = <1>;
17 #size-cells = <1>; 18 #size-cells = <1>;
18 compatible = "stericsson,db8500"; 19 compatible = "stericsson,db8500";
@@ -31,33 +32,33 @@
31 L2: l2-cache { 32 L2: l2-cache {
32 compatible = "arm,pl310-cache"; 33 compatible = "arm,pl310-cache";
33 reg = <0xa0412000 0x1000>; 34 reg = <0xa0412000 0x1000>;
34 interrupts = <0 13 4>; 35 interrupts = <0 13 IRQ_TYPE_LEVEL_HIGH>;
35 cache-unified; 36 cache-unified;
36 cache-level = <2>; 37 cache-level = <2>;
37 }; 38 };
38 39
39 pmu { 40 pmu {
40 compatible = "arm,cortex-a9-pmu"; 41 compatible = "arm,cortex-a9-pmu";
41 interrupts = <0 7 0x4>; 42 interrupts = <0 7 IRQ_TYPE_LEVEL_HIGH>;
42 }; 43 };
43 44
44 timer@a0410600 { 45 timer@a0410600 {
45 compatible = "arm,cortex-a9-twd-timer"; 46 compatible = "arm,cortex-a9-twd-timer";
46 reg = <0xa0410600 0x20>; 47 reg = <0xa0410600 0x20>;
47 interrupts = <1 13 0x304>; 48 interrupts = <1 13 0x304>; /* IRQ level high per-CPU */
48 }; 49 };
49 50
50 rtc@80154000 { 51 rtc@80154000 {
51 compatible = "arm,rtc-pl031", "arm,primecell"; 52 compatible = "arm,rtc-pl031", "arm,primecell";
52 reg = <0x80154000 0x1000>; 53 reg = <0x80154000 0x1000>;
53 interrupts = <0 18 0x4>; 54 interrupts = <0 18 IRQ_TYPE_LEVEL_HIGH>;
54 }; 55 };
55 56
56 gpio0: gpio@8012e000 { 57 gpio0: gpio@8012e000 {
57 compatible = "stericsson,db8500-gpio", 58 compatible = "stericsson,db8500-gpio",
58 "st,nomadik-gpio"; 59 "st,nomadik-gpio";
59 reg = <0x8012e000 0x80>; 60 reg = <0x8012e000 0x80>;
60 interrupts = <0 119 0x4>; 61 interrupts = <0 119 IRQ_TYPE_LEVEL_HIGH>;
61 interrupt-controller; 62 interrupt-controller;
62 #interrupt-cells = <2>; 63 #interrupt-cells = <2>;
63 st,supports-sleepmode; 64 st,supports-sleepmode;
@@ -70,7 +71,7 @@
70 compatible = "stericsson,db8500-gpio", 71 compatible = "stericsson,db8500-gpio",
71 "st,nomadik-gpio"; 72 "st,nomadik-gpio";
72 reg = <0x8012e080 0x80>; 73 reg = <0x8012e080 0x80>;
73 interrupts = <0 120 0x4>; 74 interrupts = <0 120 IRQ_TYPE_LEVEL_HIGH>;
74 interrupt-controller; 75 interrupt-controller;
75 #interrupt-cells = <2>; 76 #interrupt-cells = <2>;
76 st,supports-sleepmode; 77 st,supports-sleepmode;
@@ -83,7 +84,7 @@
83 compatible = "stericsson,db8500-gpio", 84 compatible = "stericsson,db8500-gpio",
84 "st,nomadik-gpio"; 85 "st,nomadik-gpio";
85 reg = <0x8000e000 0x80>; 86 reg = <0x8000e000 0x80>;
86 interrupts = <0 121 0x4>; 87 interrupts = <0 121 IRQ_TYPE_LEVEL_HIGH>;
87 interrupt-controller; 88 interrupt-controller;
88 #interrupt-cells = <2>; 89 #interrupt-cells = <2>;
89 st,supports-sleepmode; 90 st,supports-sleepmode;
@@ -96,7 +97,7 @@
96 compatible = "stericsson,db8500-gpio", 97 compatible = "stericsson,db8500-gpio",
97 "st,nomadik-gpio"; 98 "st,nomadik-gpio";
98 reg = <0x8000e080 0x80>; 99 reg = <0x8000e080 0x80>;
99 interrupts = <0 122 0x4>; 100 interrupts = <0 122 IRQ_TYPE_LEVEL_HIGH>;
100 interrupt-controller; 101 interrupt-controller;
101 #interrupt-cells = <2>; 102 #interrupt-cells = <2>;
102 st,supports-sleepmode; 103 st,supports-sleepmode;
@@ -109,7 +110,7 @@
109 compatible = "stericsson,db8500-gpio", 110 compatible = "stericsson,db8500-gpio",
110 "st,nomadik-gpio"; 111 "st,nomadik-gpio";
111 reg = <0x8000e100 0x80>; 112 reg = <0x8000e100 0x80>;
112 interrupts = <0 123 0x4>; 113 interrupts = <0 123 IRQ_TYPE_LEVEL_HIGH>;
113 interrupt-controller; 114 interrupt-controller;
114 #interrupt-cells = <2>; 115 #interrupt-cells = <2>;
115 st,supports-sleepmode; 116 st,supports-sleepmode;
@@ -122,7 +123,7 @@
122 compatible = "stericsson,db8500-gpio", 123 compatible = "stericsson,db8500-gpio",
123 "st,nomadik-gpio"; 124 "st,nomadik-gpio";
124 reg = <0x8000e180 0x80>; 125 reg = <0x8000e180 0x80>;
125 interrupts = <0 124 0x4>; 126 interrupts = <0 124 IRQ_TYPE_LEVEL_HIGH>;
126 interrupt-controller; 127 interrupt-controller;
127 #interrupt-cells = <2>; 128 #interrupt-cells = <2>;
128 st,supports-sleepmode; 129 st,supports-sleepmode;
@@ -135,7 +136,7 @@
135 compatible = "stericsson,db8500-gpio", 136 compatible = "stericsson,db8500-gpio",
136 "st,nomadik-gpio"; 137 "st,nomadik-gpio";
137 reg = <0x8011e000 0x80>; 138 reg = <0x8011e000 0x80>;
138 interrupts = <0 125 0x4>; 139 interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>;
139 interrupt-controller; 140 interrupt-controller;
140 #interrupt-cells = <2>; 141 #interrupt-cells = <2>;
141 st,supports-sleepmode; 142 st,supports-sleepmode;
@@ -148,7 +149,7 @@
148 compatible = "stericsson,db8500-gpio", 149 compatible = "stericsson,db8500-gpio",
149 "st,nomadik-gpio"; 150 "st,nomadik-gpio";
150 reg = <0x8011e080 0x80>; 151 reg = <0x8011e080 0x80>;
151 interrupts = <0 126 0x4>; 152 interrupts = <0 126 IRQ_TYPE_LEVEL_HIGH>;
152 interrupt-controller; 153 interrupt-controller;
153 #interrupt-cells = <2>; 154 #interrupt-cells = <2>;
154 st,supports-sleepmode; 155 st,supports-sleepmode;
@@ -161,7 +162,7 @@
161 compatible = "stericsson,db8500-gpio", 162 compatible = "stericsson,db8500-gpio",
162 "st,nomadik-gpio"; 163 "st,nomadik-gpio";
163 reg = <0xa03fe000 0x80>; 164 reg = <0xa03fe000 0x80>;
164 interrupts = <0 127 0x4>; 165 interrupts = <0 127 IRQ_TYPE_LEVEL_HIGH>;
165 interrupt-controller; 166 interrupt-controller;
166 #interrupt-cells = <2>; 167 #interrupt-cells = <2>;
167 st,supports-sleepmode; 168 st,supports-sleepmode;
@@ -171,29 +172,61 @@
171 }; 172 };
172 173
173 pinctrl { 174 pinctrl {
174 compatible = "stericsson,nmk-pinctrl"; 175 compatible = "stericsson,db8500-pinctrl";
175 prcm = <&prcmu>; 176 prcm = <&prcmu>;
176 }; 177 };
177 178
178 usb@a03e0000 { 179 usb_per5@a03e0000 {
179 compatible = "stericsson,db8500-musb", 180 compatible = "stericsson,db8500-musb",
180 "mentor,musb"; 181 "mentor,musb";
181 reg = <0xa03e0000 0x10000>; 182 reg = <0xa03e0000 0x10000>;
182 interrupts = <0 23 0x4>; 183 interrupts = <0 23 IRQ_TYPE_LEVEL_HIGH>;
183 }; 184 interrupt-names = "mc";
184 185
185 dma-controller@801C0000 { 186 dr_mode = "otg";
186 compatible = "stericsson,db8500-dma40", 187
187 "stericsson,dma40"; 188 dmas = <&dma 38 0 0x2>, /* Logical - DevToMem */
189 <&dma 38 0 0x0>, /* Logical - MemToDev */
190 <&dma 37 0 0x2>, /* Logical - DevToMem */
191 <&dma 37 0 0x0>, /* Logical - MemToDev */
192 <&dma 36 0 0x2>, /* Logical - DevToMem */
193 <&dma 36 0 0x0>, /* Logical - MemToDev */
194 <&dma 19 0 0x2>, /* Logical - DevToMem */
195 <&dma 19 0 0x0>, /* Logical - MemToDev */
196 <&dma 18 0 0x2>, /* Logical - DevToMem */
197 <&dma 18 0 0x0>, /* Logical - MemToDev */
198 <&dma 17 0 0x2>, /* Logical - DevToMem */
199 <&dma 17 0 0x0>, /* Logical - MemToDev */
200 <&dma 16 0 0x2>, /* Logical - DevToMem */
201 <&dma 16 0 0x0>, /* Logical - MemToDev */
202 <&dma 39 0 0x2>, /* Logical - DevToMem */
203 <&dma 39 0 0x0>; /* Logical - MemToDev */
204
205 dma-names = "iep_1_9", "oep_1_9",
206 "iep_2_10", "oep_2_10",
207 "iep_3_11", "oep_3_11",
208 "iep_4_12", "oep_4_12",
209 "iep_5_13", "oep_5_13",
210 "iep_6_14", "oep_6_14",
211 "iep_7_15", "oep_7_15",
212 "iep_8", "oep_8";
213 };
214
215 dma: dma-controller@801C0000 {
216 compatible = "stericsson,db8500-dma40", "stericsson,dma40";
188 reg = <0x801C0000 0x1000 0x40010000 0x800>; 217 reg = <0x801C0000 0x1000 0x40010000 0x800>;
189 interrupts = <0 25 0x4>; 218 reg-names = "base", "lcpa";
219 interrupts = <0 25 IRQ_TYPE_LEVEL_HIGH>;
220
221 #dma-cells = <3>;
222 memcpy-channels = <56 57 58 59 60>;
190 }; 223 };
191 224
192 prcmu: prcmu@80157000 { 225 prcmu: prcmu@80157000 {
193 compatible = "stericsson,db8500-prcmu"; 226 compatible = "stericsson,db8500-prcmu";
194 reg = <0x80157000 0x2000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>; 227 reg = <0x80157000 0x2000>, <0x801b0000 0x8000>, <0x801b8000 0x1000>;
195 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm"; 228 reg-names = "prcmu", "prcmu-tcpm", "prcmu-tcdm";
196 interrupts = <0 47 0x4>; 229 interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>;
197 #address-cells = <1>; 230 #address-cells = <1>;
198 #size-cells = <1>; 231 #size-cells = <1>;
199 interrupt-controller; 232 interrupt-controller;
@@ -208,7 +241,8 @@
208 thermal@801573c0 { 241 thermal@801573c0 {
209 compatible = "stericsson,db8500-thermal"; 242 compatible = "stericsson,db8500-thermal";
210 reg = <0x801573c0 0x40>; 243 reg = <0x801573c0 0x40>;
211 interrupts = <21 0x4>, <22 0x4>; 244 interrupts = <21 IRQ_TYPE_LEVEL_HIGH>,
245 <22 IRQ_TYPE_LEVEL_HIGH>;
212 interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH"; 246 interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";
213 status = "disabled"; 247 status = "disabled";
214 }; 248 };
@@ -322,21 +356,26 @@
322 ab8500 { 356 ab8500 {
323 compatible = "stericsson,ab8500"; 357 compatible = "stericsson,ab8500";
324 interrupt-parent = <&intc>; 358 interrupt-parent = <&intc>;
325 interrupts = <0 40 0x4>; 359 interrupts = <0 40 IRQ_TYPE_LEVEL_HIGH>;
326 interrupt-controller; 360 interrupt-controller;
327 #interrupt-cells = <2>; 361 #interrupt-cells = <2>;
328 362
363 ab8500_gpio: ab8500-gpio {
364 gpio-controller;
365 #gpio-cells = <2>;
366 };
367
329 ab8500-rtc { 368 ab8500-rtc {
330 compatible = "stericsson,ab8500-rtc"; 369 compatible = "stericsson,ab8500-rtc";
331 interrupts = <17 0x4 370 interrupts = <17 IRQ_TYPE_LEVEL_HIGH
332 18 0x4>; 371 18 IRQ_TYPE_LEVEL_HIGH>;
333 interrupt-names = "60S", "ALARM"; 372 interrupt-names = "60S", "ALARM";
334 }; 373 };
335 374
336 ab8500-gpadc { 375 ab8500-gpadc {
337 compatible = "stericsson,ab8500-gpadc"; 376 compatible = "stericsson,ab8500-gpadc";
338 interrupts = <32 0x4 377 interrupts = <32 IRQ_TYPE_LEVEL_HIGH
339 39 0x4>; 378 39 IRQ_TYPE_LEVEL_HIGH>;
340 interrupt-names = "HW_CONV_END", "SW_CONV_END"; 379 interrupt-names = "HW_CONV_END", "SW_CONV_END";
341 vddadc-supply = <&ab8500_ldo_tvout_reg>; 380 vddadc-supply = <&ab8500_ldo_tvout_reg>;
342 }; 381 };
@@ -369,13 +408,13 @@
369 408
370 ab8500_usb { 409 ab8500_usb {
371 compatible = "stericsson,ab8500-usb"; 410 compatible = "stericsson,ab8500-usb";
372 interrupts = < 90 0x4 411 interrupts = < 90 IRQ_TYPE_LEVEL_HIGH
373 96 0x4 412 96 IRQ_TYPE_LEVEL_HIGH
374 14 0x4 413 14 IRQ_TYPE_LEVEL_HIGH
375 15 0x4 414 15 IRQ_TYPE_LEVEL_HIGH
376 79 0x4 415 79 IRQ_TYPE_LEVEL_HIGH
377 74 0x4 416 74 IRQ_TYPE_LEVEL_HIGH
378 75 0x4>; 417 75 IRQ_TYPE_LEVEL_HIGH>;
379 interrupt-names = "ID_WAKEUP_R", 418 interrupt-names = "ID_WAKEUP_R",
380 "ID_WAKEUP_F", 419 "ID_WAKEUP_F",
381 "VBUS_DET_F", 420 "VBUS_DET_F",
@@ -383,15 +422,15 @@
383 "USB_LINK_STATUS", 422 "USB_LINK_STATUS",
384 "USB_ADP_PROBE_PLUG", 423 "USB_ADP_PROBE_PLUG",
385 "USB_ADP_PROBE_UNPLUG"; 424 "USB_ADP_PROBE_UNPLUG";
386 vddulpivio18-supply = <&ab8500_ldo_initcore_reg>; 425 vddulpivio18-supply = <&ab8500_ldo_intcore_reg>;
387 v-ape-supply = <&db8500_vape_reg>; 426 v-ape-supply = <&db8500_vape_reg>;
388 musb_1v8-supply = <&db8500_vsmps2_reg>; 427 musb_1v8-supply = <&db8500_vsmps2_reg>;
389 }; 428 };
390 429
391 ab8500-ponkey { 430 ab8500-ponkey {
392 compatible = "stericsson,ab8500-poweron-key"; 431 compatible = "stericsson,ab8500-poweron-key";
393 interrupts = <6 0x4 432 interrupts = <6 IRQ_TYPE_LEVEL_HIGH
394 7 0x4>; 433 7 IRQ_TYPE_LEVEL_HIGH>;
395 interrupt-names = "ONKEY_DBF", "ONKEY_DBR"; 434 interrupt-names = "ONKEY_DBF", "ONKEY_DBR";
396 }; 435 };
397 436
@@ -410,6 +449,11 @@
410 codec: ab8500-codec { 449 codec: ab8500-codec {
411 compatible = "stericsson,ab8500-codec"; 450 compatible = "stericsson,ab8500-codec";
412 451
452 V-AUD-supply = <&ab8500_ldo_audio_reg>;
453 V-AMIC1-supply = <&ab8500_ldo_anamic1_reg>;
454 V-AMIC2-supply = <&ab8500_ldo_anamic2_reg>;
455 V-DMIC-supply = <&ab8500_ldo_dmic_reg>;
456
413 stericsson,earpeice-cmv = <950>; /* Units in mV. */ 457 stericsson,earpeice-cmv = <950>; /* Units in mV. */
414 }; 458 };
415 459
@@ -441,8 +485,8 @@
441 }; 485 };
442 486
443 // supply for v-intcore12; VINTCORE12 LDO 487 // supply for v-intcore12; VINTCORE12 LDO
444 ab8500_ldo_initcore_reg: ab8500_ldo_initcore { 488 ab8500_ldo_intcore_reg: ab8500_ldo_intcore {
445 regulator-compatible = "ab8500_ldo_initcore"; 489 regulator-compatible = "ab8500_ldo_intcore";
446 }; 490 };
447 491
448 // supply for tvout; gpadc; TVOUT LDO 492 // supply for tvout; gpadc; TVOUT LDO
@@ -460,14 +504,14 @@
460 regulator-compatible = "ab8500_ldo_audio"; 504 regulator-compatible = "ab8500_ldo_audio";
461 }; 505 };
462 506
463 // supply for v-anamic1 VAMic1-LDO 507 // supply for v-anamic1 VAMIC1 LDO
464 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 { 508 ab8500_ldo_anamic1_reg: ab8500_ldo_anamic1 {
465 regulator-compatible = "ab8500_ldo_anamic1"; 509 regulator-compatible = "ab8500_ldo_anamic1";
466 }; 510 };
467 511
468 // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1 512 // supply for v-amic2; VAMIC2 LDO; reuse constants for AMIC1
469 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { 513 ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 {
470 regulator-compatible = "ab8500_ldo_amamic2"; 514 regulator-compatible = "ab8500_ldo_anamic2";
471 }; 515 };
472 516
473 // supply for v-dmic; VDMIC LDO 517 // supply for v-dmic; VDMIC LDO
@@ -486,7 +530,7 @@
486 i2c@80004000 { 530 i2c@80004000 {
487 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 531 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
488 reg = <0x80004000 0x1000>; 532 reg = <0x80004000 0x1000>;
489 interrupts = <0 21 0x4>; 533 interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>;
490 arm,primecell-periphid = <0x180024>; 534 arm,primecell-periphid = <0x180024>;
491 535
492 #address-cells = <1>; 536 #address-cells = <1>;
@@ -499,7 +543,7 @@
499 i2c@80122000 { 543 i2c@80122000 {
500 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 544 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
501 reg = <0x80122000 0x1000>; 545 reg = <0x80122000 0x1000>;
502 interrupts = <0 22 0x4>; 546 interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>;
503 arm,primecell-periphid = <0x180024>; 547 arm,primecell-periphid = <0x180024>;
504 548
505 #address-cells = <1>; 549 #address-cells = <1>;
@@ -512,7 +556,7 @@
512 i2c@80128000 { 556 i2c@80128000 {
513 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 557 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
514 reg = <0x80128000 0x1000>; 558 reg = <0x80128000 0x1000>;
515 interrupts = <0 55 0x4>; 559 interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>;
516 arm,primecell-periphid = <0x180024>; 560 arm,primecell-periphid = <0x180024>;
517 561
518 #address-cells = <1>; 562 #address-cells = <1>;
@@ -525,7 +569,7 @@
525 i2c@80110000 { 569 i2c@80110000 {
526 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 570 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
527 reg = <0x80110000 0x1000>; 571 reg = <0x80110000 0x1000>;
528 interrupts = <0 12 0x4>; 572 interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>;
529 arm,primecell-periphid = <0x180024>; 573 arm,primecell-periphid = <0x180024>;
530 574
531 #address-cells = <1>; 575 #address-cells = <1>;
@@ -538,7 +582,7 @@
538 i2c@8012a000 { 582 i2c@8012a000 {
539 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; 583 compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
540 reg = <0x8012a000 0x1000>; 584 reg = <0x8012a000 0x1000>;
541 interrupts = <0 51 0x4>; 585 interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>;
542 arm,primecell-periphid = <0x180024>; 586 arm,primecell-periphid = <0x180024>;
543 587
544 #address-cells = <1>; 588 #address-cells = <1>;
@@ -551,82 +595,114 @@
551 ssp@80002000 { 595 ssp@80002000 {
552 compatible = "arm,pl022", "arm,primecell"; 596 compatible = "arm,pl022", "arm,primecell";
553 reg = <0x80002000 0x1000>; 597 reg = <0x80002000 0x1000>;
554 interrupts = <0 14 0x4>; 598 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
555 #address-cells = <1>; 599 #address-cells = <1>;
556 #size-cells = <0>; 600 #size-cells = <0>;
557 status = "disabled"; 601 status = "disabled";
558
559 // Add one of these for each child device
560 cs-gpios = <&gpio0 31 0x4 &gpio4 14 0x4 &gpio4 16 0x4
561 &gpio6 22 0x4 &gpio7 0 0x4>;
562
563 }; 602 };
564 603
565 uart@80120000 { 604 uart@80120000 {
566 compatible = "arm,pl011", "arm,primecell"; 605 compatible = "arm,pl011", "arm,primecell";
567 reg = <0x80120000 0x1000>; 606 reg = <0x80120000 0x1000>;
568 interrupts = <0 11 0x4>; 607 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
608
609 dmas = <&dma 13 0 0x2>, /* Logical - DevToMem */
610 <&dma 13 0 0x0>; /* Logical - MemToDev */
611 dma-names = "rx", "tx";
612
569 status = "disabled"; 613 status = "disabled";
570 }; 614 };
615
571 uart@80121000 { 616 uart@80121000 {
572 compatible = "arm,pl011", "arm,primecell"; 617 compatible = "arm,pl011", "arm,primecell";
573 reg = <0x80121000 0x1000>; 618 reg = <0x80121000 0x1000>;
574 interrupts = <0 19 0x4>; 619 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>;
620
621 dmas = <&dma 12 0 0x2>, /* Logical - DevToMem */
622 <&dma 12 0 0x0>; /* Logical - MemToDev */
623 dma-names = "rx", "tx";
624
575 status = "disabled"; 625 status = "disabled";
576 }; 626 };
627
577 uart@80007000 { 628 uart@80007000 {
578 compatible = "arm,pl011", "arm,primecell"; 629 compatible = "arm,pl011", "arm,primecell";
579 reg = <0x80007000 0x1000>; 630 reg = <0x80007000 0x1000>;
580 interrupts = <0 26 0x4>; 631 interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
632
633 dmas = <&dma 11 0 0x2>, /* Logical - DevToMem */
634 <&dma 11 0 0x0>; /* Logical - MemToDev */
635 dma-names = "rx", "tx";
636
581 status = "disabled"; 637 status = "disabled";
582 }; 638 };
583 639
584 sdi0_per1@80126000 { 640 sdi0_per1@80126000 {
585 compatible = "arm,pl18x", "arm,primecell"; 641 compatible = "arm,pl18x", "arm,primecell";
586 reg = <0x80126000 0x1000>; 642 reg = <0x80126000 0x1000>;
587 interrupts = <0 60 0x4>; 643 interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>;
644
645 dmas = <&dma 29 0 0x2>, /* Logical - DevToMem */
646 <&dma 29 0 0x0>; /* Logical - MemToDev */
647 dma-names = "rx", "tx";
648
588 status = "disabled"; 649 status = "disabled";
589 }; 650 };
590 651
591 sdi1_per2@80118000 { 652 sdi1_per2@80118000 {
592 compatible = "arm,pl18x", "arm,primecell"; 653 compatible = "arm,pl18x", "arm,primecell";
593 reg = <0x80118000 0x1000>; 654 reg = <0x80118000 0x1000>;
594 interrupts = <0 50 0x4>; 655 interrupts = <0 50 IRQ_TYPE_LEVEL_HIGH>;
656
657 dmas = <&dma 32 0 0x2>, /* Logical - DevToMem */
658 <&dma 32 0 0x0>; /* Logical - MemToDev */
659 dma-names = "rx", "tx";
660
595 status = "disabled"; 661 status = "disabled";
596 }; 662 };
597 663
598 sdi2_per3@80005000 { 664 sdi2_per3@80005000 {
599 compatible = "arm,pl18x", "arm,primecell"; 665 compatible = "arm,pl18x", "arm,primecell";
600 reg = <0x80005000 0x1000>; 666 reg = <0x80005000 0x1000>;
601 interrupts = <0 41 0x4>; 667 interrupts = <0 41 IRQ_TYPE_LEVEL_HIGH>;
668
669 dmas = <&dma 28 0 0x2>, /* Logical - DevToMem */
670 <&dma 28 0 0x0>; /* Logical - MemToDev */
671 dma-names = "rx", "tx";
672
602 status = "disabled"; 673 status = "disabled";
603 }; 674 };
604 675
605 sdi3_per2@80119000 { 676 sdi3_per2@80119000 {
606 compatible = "arm,pl18x", "arm,primecell"; 677 compatible = "arm,pl18x", "arm,primecell";
607 reg = <0x80119000 0x1000>; 678 reg = <0x80119000 0x1000>;
608 interrupts = <0 59 0x4>; 679 interrupts = <0 59 IRQ_TYPE_LEVEL_HIGH>;
609 status = "disabled"; 680 status = "disabled";
610 }; 681 };
611 682
612 sdi4_per2@80114000 { 683 sdi4_per2@80114000 {
613 compatible = "arm,pl18x", "arm,primecell"; 684 compatible = "arm,pl18x", "arm,primecell";
614 reg = <0x80114000 0x1000>; 685 reg = <0x80114000 0x1000>;
615 interrupts = <0 99 0x4>; 686 interrupts = <0 99 IRQ_TYPE_LEVEL_HIGH>;
687
688 dmas = <&dma 42 0 0x2>, /* Logical - DevToMem */
689 <&dma 42 0 0x0>; /* Logical - MemToDev */
690 dma-names = "rx", "tx";
691
616 status = "disabled"; 692 status = "disabled";
617 }; 693 };
618 694
619 sdi5_per3@80008000 { 695 sdi5_per3@80008000 {
620 compatible = "arm,pl18x", "arm,primecell"; 696 compatible = "arm,pl18x", "arm,primecell";
621 reg = <0x80008000 0x1000>; 697 reg = <0x80008000 0x1000>;
622 interrupts = <0 100 0x4>; 698 interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
623 status = "disabled"; 699 status = "disabled";
624 }; 700 };
625 701
626 msp0: msp@80123000 { 702 msp0: msp@80123000 {
627 compatible = "stericsson,ux500-msp-i2s"; 703 compatible = "stericsson,ux500-msp-i2s";
628 reg = <0x80123000 0x1000>; 704 reg = <0x80123000 0x1000>;
629 interrupts = <0 31 0x4>; 705 interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;
630 v-ape-supply = <&db8500_vape_reg>; 706 v-ape-supply = <&db8500_vape_reg>;
631 status = "disabled"; 707 status = "disabled";
632 }; 708 };
@@ -634,7 +710,7 @@
634 msp1: msp@80124000 { 710 msp1: msp@80124000 {
635 compatible = "stericsson,ux500-msp-i2s"; 711 compatible = "stericsson,ux500-msp-i2s";
636 reg = <0x80124000 0x1000>; 712 reg = <0x80124000 0x1000>;
637 interrupts = <0 62 0x4>; 713 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
638 v-ape-supply = <&db8500_vape_reg>; 714 v-ape-supply = <&db8500_vape_reg>;
639 status = "disabled"; 715 status = "disabled";
640 }; 716 };
@@ -643,7 +719,7 @@
643 msp2: msp@80117000 { 719 msp2: msp@80117000 {
644 compatible = "stericsson,ux500-msp-i2s"; 720 compatible = "stericsson,ux500-msp-i2s";
645 reg = <0x80117000 0x1000>; 721 reg = <0x80117000 0x1000>;
646 interrupts = <0 98 0x4>; 722 interrupts = <0 98 IRQ_TYPE_LEVEL_HIGH>;
647 v-ape-supply = <&db8500_vape_reg>; 723 v-ape-supply = <&db8500_vape_reg>;
648 status = "disabled"; 724 status = "disabled";
649 }; 725 };
@@ -651,7 +727,7 @@
651 msp3: msp@80125000 { 727 msp3: msp@80125000 {
652 compatible = "stericsson,ux500-msp-i2s"; 728 compatible = "stericsson,ux500-msp-i2s";
653 reg = <0x80125000 0x1000>; 729 reg = <0x80125000 0x1000>;
654 interrupts = <0 62 0x4>; 730 interrupts = <0 62 IRQ_TYPE_LEVEL_HIGH>;
655 v-ape-supply = <&db8500_vape_reg>; 731 v-ape-supply = <&db8500_vape_reg>;
656 status = "disabled"; 732 status = "disabled";
657 }; 733 };
@@ -686,5 +762,20 @@
686 762
687 status = "disabled"; 763 status = "disabled";
688 }; 764 };
765
766 cryp@a03cb000 {
767 compatible = "stericsson,ux500-cryp";
768 reg = <0xa03cb000 0x1000>;
769 interrupts = <0 15 IRQ_TYPE_LEVEL_HIGH>;
770
771 v-ape-supply = <&db8500_vape_reg>;
772 };
773
774 hash@a03c2000 {
775 compatible = "stericsson,ux500-hash";
776 reg = <0xa03c2000 0x1000>;
777
778 v-ape-supply = <&db8500_vape_reg>;
779 };
689 }; 780 };
690}; 781};
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index 7e3065abd751..5cae2ab69762 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -44,11 +44,60 @@
44 gpio = <&gpio0 1 0>; 44 gpio = <&gpio0 1 0>;
45 }; 45 };
46 }; 46 };
47
48 clocks {
49 /* 25MHz reference crystal */
50 ref25: oscillator {
51 compatible = "fixed-clock";
52 #clock-cells = <0>;
53 clock-frequency = <25000000>;
54 };
55 };
47}; 56};
48 57
49&uart0 { status = "okay"; }; 58&uart0 { status = "okay"; };
50&sata0 { status = "okay"; }; 59&sata0 { status = "okay"; };
51&i2c0 { status = "okay"; }; 60
61&i2c0 {
62 status = "okay";
63 clock-frequency = <100000>;
64
65 si5351: clock-generator {
66 compatible = "silabs,si5351a-msop";
67 reg = <0x60>;
68 #address-cells = <1>;
69 #size-cells = <0>;
70 #clock-cells = <1>;
71
72 /* connect xtal input to 25MHz reference */
73 clocks = <&ref25>;
74
75 /* connect xtal input as source of pll0 and pll1 */
76 silabs,pll-source = <0 0>, <1 0>;
77
78 clkout0 {
79 reg = <0>;
80 silabs,drive-strength = <8>;
81 silabs,multisynth-source = <0>;
82 silabs,clock-source = <0>;
83 silabs,pll-master;
84 };
85
86 clkout1 {
87 reg = <1>;
88 silabs,drive-strength = <8>;
89 silabs,multisynth-source = <1>;
90 silabs,clock-source = <0>;
91 silabs,pll-master;
92 };
93
94 clkout2 {
95 reg = <2>;
96 silabs,multisynth-source = <1>;
97 silabs,clock-source = <0>;
98 };
99 };
100};
52 101
53&sdio0 { 102&sdio0 {
54 status = "okay"; 103 status = "okay";
diff --git a/arch/arm/boot/dts/ecx-common.dtsi b/arch/arm/boot/dts/ecx-common.dtsi
index d61b535f682a..e8559b753c9d 100644
--- a/arch/arm/boot/dts/ecx-common.dtsi
+++ b/arch/arm/boot/dts/ecx-common.dtsi
@@ -33,6 +33,8 @@
33 calxeda,port-phys = <&combophy5 0 &combophy0 0 33 calxeda,port-phys = <&combophy5 0 &combophy0 0
34 &combophy0 1 &combophy0 2 34 &combophy0 1 &combophy0 2
35 &combophy0 3>; 35 &combophy0 3>;
36 calxeda,sgpio-gpio =<&gpioh 5 1 &gpioh 6 1 &gpioh 7 1>;
37 calxeda,led-order = <4 0 1 2 3>;
36 }; 38 };
37 39
38 sdhci@ffe0e000 { 40 sdhci@ffe0e000 {
diff --git a/arch/arm/boot/dts/ethernut5.dts b/arch/arm/boot/dts/ethernut5.dts
index 1ea9d34460a4..143b6d25bc80 100644
--- a/arch/arm/boot/dts/ethernut5.dts
+++ b/arch/arm/boot/dts/ethernut5.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9260.dtsi" 9#include "at91sam9260.dtsi"
10 10
11/ { 11/ {
12 model = "Ethernut 5"; 12 model = "Ethernut 5";
@@ -40,7 +40,7 @@
40 }; 40 };
41 41
42 usb1: gadget@fffa4000 { 42 usb1: gadget@fffa4000 {
43 atmel,vbus-gpio = <&pioC 5 0>; 43 atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
44 status = "okay"; 44 status = "okay";
45 }; 45 };
46 }; 46 };
@@ -52,7 +52,7 @@
52 status = "okay"; 52 status = "okay";
53 53
54 gpios = <0 54 gpios = <0
55 &pioC 14 0 55 &pioC 14 GPIO_ACTIVE_HIGH
56 0 56 0
57 >; 57 >;
58 58
diff --git a/arch/arm/boot/dts/evk-pro3.dts b/arch/arm/boot/dts/evk-pro3.dts
index 96e50f569433..4d829685fdfb 100644
--- a/arch/arm/boot/dts/evk-pro3.dts
+++ b/arch/arm/boot/dts/evk-pro3.dts
@@ -9,7 +9,7 @@
9 9
10/dts-v1/; 10/dts-v1/;
11 11
12/include/ "ge863-pro3.dtsi" 12#include "ge863-pro3.dtsi"
13 13
14/ { 14/ {
15 model = "Telit EVK-PRO3 for Telit GE863-PRO3"; 15 model = "Telit EVK-PRO3 for Telit GE863-PRO3";
@@ -31,7 +31,7 @@
31 }; 31 };
32 32
33 usb1: gadget@fffa4000 { 33 usb1: gadget@fffa4000 {
34 atmel,vbus-gpio = <&pioC 5 0>; 34 atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
35 status = "okay"; 35 status = "okay";
36 }; 36 };
37 37
@@ -50,4 +50,4 @@
50 status = "okay"; 50 status = "okay";
51 }; 51 };
52 52
53}; \ No newline at end of file 53};
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 359694c78918..3f94fe8e3706 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -19,7 +19,7 @@
19 * published by the Free Software Foundation. 19 * published by the Free Software Foundation.
20 */ 20 */
21 21
22/include/ "skeleton.dtsi" 22#include "skeleton.dtsi"
23 23
24/ { 24/ {
25 interrupt-parent = <&gic>; 25 interrupt-parent = <&gic>;
@@ -160,6 +160,8 @@
160 reg = <0x13400000 0x10000>; 160 reg = <0x13400000 0x10000>;
161 interrupts = <0 94 0>; 161 interrupts = <0 94 0>;
162 samsung,power-domain = <&pd_mfc>; 162 samsung,power-domain = <&pd_mfc>;
163 clocks = <&clock 170>, <&clock 273>;
164 clock-names = "sclk_mfc", "mfc";
163 status = "disabled"; 165 status = "disabled";
164 }; 166 };
165 167
diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts
index 524b90846df5..382d8c7e2906 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -15,7 +15,7 @@
15*/ 15*/
16 16
17/dts-v1/; 17/dts-v1/;
18/include/ "exynos4210.dtsi" 18#include "exynos4210.dtsi"
19 19
20/ { 20/ {
21 model = "Insignal Origen evaluation board based on Exynos4210"; 21 model = "Insignal Origen evaluation board based on Exynos4210";
@@ -41,6 +41,10 @@
41 enable-active-high; 41 enable-active-high;
42 }; 42 };
43 43
44 tmu@100C0000 {
45 status = "okay";
46 };
47
44 sdhci@12530000 { 48 sdhci@12530000 {
45 bus-width = <4>; 49 bus-width = <4>;
46 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>; 50 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>;
@@ -83,6 +87,150 @@
83 status = "okay"; 87 status = "okay";
84 }; 88 };
85 89
90 i2c@13860000 {
91 status = "okay";
92 samsung,i2c-sda-delay = <100>;
93 samsung,i2c-max-bus-freq = <20000>;
94 pinctrl-0 = <&i2c0_bus>;
95 pinctrl-names = "default";
96
97 max8997_pmic@66 {
98 compatible = "maxim,max8997-pmic";
99 reg = <0x66>;
100 interrupt-parent = <&gpx0>;
101 interrupts = <4 0>, <3 0>;
102
103 max8997,pmic-buck1-dvs-voltage = <1350000>;
104 max8997,pmic-buck2-dvs-voltage = <1100000>;
105 max8997,pmic-buck5-dvs-voltage = <1200000>;
106
107 regulators {
108 ldo1_reg: LDO1 {
109 regulator-name = "VDD_ABB_3.3V";
110 regulator-min-microvolt = <3300000>;
111 regulator-max-microvolt = <3300000>;
112 };
113
114 ldo2_reg: LDO2 {
115 regulator-name = "VDD_ALIVE_1.1V";
116 regulator-min-microvolt = <1100000>;
117 regulator-max-microvolt = <1100000>;
118 regulator-always-on;
119 };
120
121 ldo3_reg: LDO3 {
122 regulator-name = "VMIPI_1.1V";
123 regulator-min-microvolt = <1100000>;
124 regulator-max-microvolt = <1100000>;
125 };
126
127 ldo4_reg: LDO4 {
128 regulator-name = "VDD_RTC_1.8V";
129 regulator-min-microvolt = <1800000>;
130 regulator-max-microvolt = <1800000>;
131 regulator-always-on;
132 };
133
134 ldo6_reg: LDO6 {
135 regulator-name = "VMIPI_1.8V";
136 regulator-min-microvolt = <1800000>;
137 regulator-max-microvolt = <1800000>;
138 regulator-always-on;
139 };
140
141 ldo7_reg: LDO7 {
142 regulator-name = "VDD_AUD_1.8V";
143 regulator-min-microvolt = <1800000>;
144 regulator-max-microvolt = <1800000>;
145 };
146
147 ldo8_reg: LDO8 {
148 regulator-name = "VADC_3.3V";
149 regulator-min-microvolt = <3300000>;
150 regulator-max-microvolt = <3300000>;
151 };
152
153 ldo9_reg: LDO9 {
154 regulator-name = "DVDD_SWB_2.8V";
155 regulator-min-microvolt = <2800000>;
156 regulator-max-microvolt = <2800000>;
157 regulator-always-on;
158 };
159
160 ldo10_reg: LDO10 {
161 regulator-name = "VDD_PLL_1.1V";
162 regulator-min-microvolt = <1100000>;
163 regulator-max-microvolt = <1100000>;
164 regulator-always-on;
165 };
166
167 ldo11_reg: LDO11 {
168 regulator-name = "VDD_AUD_3V";
169 regulator-min-microvolt = <3000000>;
170 regulator-max-microvolt = <3000000>;
171 };
172
173 ldo14_reg: LDO14 {
174 regulator-name = "AVDD18_SWB_1.8V";
175 regulator-min-microvolt = <1800000>;
176 regulator-max-microvolt = <1800000>;
177 regulator-always-on;
178 };
179
180 ldo17_reg: LDO17 {
181 regulator-name = "VDD_SWB_3.3V";
182 regulator-min-microvolt = <3300000>;
183 regulator-max-microvolt = <3300000>;
184 regulator-always-on;
185 };
186
187 ldo21_reg: LDO21 {
188 regulator-name = "VDD_MIF_1.2V";
189 regulator-min-microvolt = <1200000>;
190 regulator-max-microvolt = <1200000>;
191 regulator-always-on;
192 };
193
194 buck1_reg: BUCK1 {
195 regulator-name = "VDD_ARM_1.2V";
196 regulator-min-microvolt = <950000>;
197 regulator-max-microvolt = <1350000>;
198 regulator-always-on;
199 regulator-boot-on;
200 };
201
202 buck2_reg: BUCK2 {
203 regulator-name = "VDD_INT_1.1V";
204 regulator-min-microvolt = <900000>;
205 regulator-max-microvolt = <1100000>;
206 regulator-always-on;
207 regulator-boot-on;
208 };
209
210 buck3_reg: BUCK3 {
211 regulator-name = "VDD_G3D_1.1V";
212 regulator-min-microvolt = <900000>;
213 regulator-max-microvolt = <1100000>;
214 };
215
216 buck5_reg: BUCK5 {
217 regulator-name = "VDDQ_M1M2_1.2V";
218 regulator-min-microvolt = <1200000>;
219 regulator-max-microvolt = <1200000>;
220 regulator-always-on;
221 };
222
223 buck7_reg: BUCK7 {
224 regulator-name = "VDD_LCD_3.3V";
225 regulator-min-microvolt = <3300000>;
226 regulator-max-microvolt = <3300000>;
227 regulator-boot-on;
228 regulator-always-on;
229 };
230 };
231 };
232 };
233
86 gpio_keys { 234 gpio_keys {
87 compatible = "gpio-keys"; 235 compatible = "gpio-keys";
88 #address-cells = <1>; 236 #address-cells = <1>;
@@ -143,4 +291,25 @@
143 clock-frequency = <24000000>; 291 clock-frequency = <24000000>;
144 }; 292 };
145 }; 293 };
294
295 fimd@11c00000 {
296 pinctrl-0 = <&lcd_en &lcd_clk &lcd_data24 &pwm0_out>;
297 pinctrl-names = "default";
298 status = "okay";
299 };
300
301 display-timings {
302 native-mode = <&timing0>;
303 timing0: timing {
304 clock-frequency = <50000>;
305 hactive = <1024>;
306 vactive = <600>;
307 hfront-porch = <64>;
308 hback-porch = <16>;
309 hsync-len = <48>;
310 vback-porch = <64>;
311 vfront-porch = <16>;
312 vsync-len = <3>;
313 };
314 };
146}; 315};
diff --git a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
index 55a2efb763d1..553bceae8967 100644
--- a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
@@ -330,6 +330,95 @@
330 samsung,pin-pud = <3>; 330 samsung,pin-pud = <3>;
331 samsung,pin-drv = <0>; 331 samsung,pin-drv = <0>;
332 }; 332 };
333
334 pwm0_out: pwm0-out {
335 samsung,pins = "gpd0-0";
336 samsung,pin-function = <2>;
337 samsung,pin-pud = <0>;
338 samsung,pin-drv = <0>;
339 };
340
341 pwm1_out: pwm1-out {
342 samsung,pins = "gpd0-1";
343 samsung,pin-function = <2>;
344 samsung,pin-pud = <0>;
345 samsung,pin-drv = <0>;
346 };
347
348 pwm2_out: pwm2-out {
349 samsung,pins = "gpd0-2";
350 samsung,pin-function = <2>;
351 samsung,pin-pud = <0>;
352 samsung,pin-drv = <0>;
353 };
354
355 pwm3_out: pwm3-out {
356 samsung,pins = "gpd0-3";
357 samsung,pin-function = <2>;
358 samsung,pin-pud = <0>;
359 samsung,pin-drv = <0>;
360 };
361
362 lcd_ctrl: lcd-ctrl {
363 samsung,pins = "gpd0-0", "gpd0-1";
364 samsung,pin-function = <3>;
365 samsung,pin-pud = <0>;
366 samsung,pin-drv = <0>;
367 };
368
369 lcd_sync: lcd-sync {
370 samsung,pins = "gpf0-0", "gpf0-1";
371 samsung,pin-function = <2>;
372 samsung,pin-pud = <0>;
373 samsung,pin-drv = <0>;
374 };
375
376 lcd_en: lcd-en {
377 samsung,pins = "gpe3-4";
378 samsung,pin-function = <2>;
379 samsung,pin-pud = <0>;
380 samsung,pin-drv = <0>;
381 };
382
383 lcd_clk: lcd-clk {
384 samsung,pins = "gpf0-0", "gpf0-1", "gpf0-2", "gpf0-3";
385 samsung,pin-function = <2>;
386 samsung,pin-pud = <0>;
387 samsung,pin-drv = <0>;
388 };
389
390 lcd_data16: lcd-data-width16 {
391 samsung,pins = "gpf0-7", "gpf1-0", "gpf1-1", "gpf1-2",
392 "gpf1-3", "gpf1-6", "gpf1-7", "gpf2-0",
393 "gpf2-1", "gpf2-2", "gpf2-3", "gpf2-7",
394 "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3";
395 samsung,pin-function = <2>;
396 samsung,pin-pud = <0>;
397 samsung,pin-drv = <0>;
398 };
399
400 lcd_data18: lcd-data-width18 {
401 samsung,pins = "gpf0-6", "gpf0-7", "gpf1-0", "gpf1-1",
402 "gpf1-2", "gpf1-3", "gpf1-6", "gpf1-7",
403 "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3",
404 "gpf2-6", "gpf2-7", "gpf3-0", "gpf3-1",
405 "gpf3-2", "gpf3-3";
406 samsung,pin-function = <2>;
407 samsung,pin-pud = <0>;
408 samsung,pin-drv = <0>;
409 };
410
411 lcd_data24: lcd-data-width24 {
412 samsung,pins = "gpf0-4", "gpf0-5", "gpf0-6", "gpf0-7",
413 "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3",
414 "gpf1-4", "gpf1-5", "gpf1-6", "gpf1-7",
415 "gpf2-0", "gpf2-1", "gpf2-2", "gpf2-3",
416 "gpf2-4", "gpf2-5", "gpf2-6", "gpf2-7",
417 "gpf3-0", "gpf3-1", "gpf3-2", "gpf3-3";
418 samsung,pin-function = <2>;
419 samsung,pin-pud = <0>;
420 samsung,pin-drv = <0>;
421 };
333 }; 422 };
334 423
335 pinctrl@11000000 { 424 pinctrl@11000000 {
diff --git a/arch/arm/boot/dts/exynos4210-smdkv310.dts b/arch/arm/boot/dts/exynos4210-smdkv310.dts
index 91332b72acf5..9c01b718d29d 100644
--- a/arch/arm/boot/dts/exynos4210-smdkv310.dts
+++ b/arch/arm/boot/dts/exynos4210-smdkv310.dts
@@ -15,7 +15,7 @@
15*/ 15*/
16 16
17/dts-v1/; 17/dts-v1/;
18/include/ "exynos4210.dtsi" 18#include "exynos4210.dtsi"
19 19
20/ { 20/ {
21 model = "Samsung smdkv310 evaluation board based on Exynos4210"; 21 model = "Samsung smdkv310 evaluation board based on Exynos4210";
diff --git a/arch/arm/boot/dts/exynos4210-trats.dts b/arch/arm/boot/dts/exynos4210-trats.dts
index 9a14484c7bb1..94eebffe3044 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -13,7 +13,7 @@
13*/ 13*/
14 14
15/dts-v1/; 15/dts-v1/;
16/include/ "exynos4210.dtsi" 16#include "exynos4210.dtsi"
17 17
18/ { 18/ {
19 model = "Samsung Trats based on Exynos4210"; 19 model = "Samsung Trats based on Exynos4210";
diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index 345cdb51dcb7..889cdada1ce9 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -13,7 +13,7 @@
13*/ 13*/
14 14
15/dts-v1/; 15/dts-v1/;
16/include/ "exynos4210.dtsi" 16#include "exynos4210.dtsi"
17 17
18/ { 18/ {
19 model = "Samsung Universal C210 based on Exynos4210 rev0"; 19 model = "Samsung Universal C210 based on Exynos4210 rev0";
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 54710de82908..b7f358a93bcb 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -19,8 +19,8 @@
19 * published by the Free Software Foundation. 19 * published by the Free Software Foundation.
20*/ 20*/
21 21
22/include/ "exynos4.dtsi" 22#include "exynos4.dtsi"
23/include/ "exynos4210-pinctrl.dtsi" 23#include "exynos4210-pinctrl.dtsi"
24 24
25/ { 25/ {
26 compatible = "samsung,exynos4210"; 26 compatible = "samsung,exynos4210";
@@ -112,12 +112,17 @@
112 interrupt-parent = <&combiner>; 112 interrupt-parent = <&combiner>;
113 reg = <0x100C0000 0x100>; 113 reg = <0x100C0000 0x100>;
114 interrupts = <2 4>; 114 interrupts = <2 4>;
115 clocks = <&clock 383>;
116 clock-names = "tmu_apbif";
117 status = "disabled";
115 }; 118 };
116 119
117 g2d@12800000 { 120 g2d@12800000 {
118 compatible = "samsung,s5pv210-g2d"; 121 compatible = "samsung,s5pv210-g2d";
119 reg = <0x12800000 0x1000>; 122 reg = <0x12800000 0x1000>;
120 interrupts = <0 89 0>; 123 interrupts = <0 89 0>;
124 clocks = <&clock 177>, <&clock 277>;
125 clock-names = "sclk_fimg2d", "fimg2d";
121 status = "disabled"; 126 status = "disabled";
122 }; 127 };
123}; 128};
diff --git a/arch/arm/boot/dts/exynos4212.dtsi b/arch/arm/boot/dts/exynos4212.dtsi
index c0f60f49cea6..6f34d7f6ba7e 100644
--- a/arch/arm/boot/dts/exynos4212.dtsi
+++ b/arch/arm/boot/dts/exynos4212.dtsi
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18*/ 18*/
19 19
20/include/ "exynos4x12.dtsi" 20#include "exynos4x12.dtsi"
21 21
22/ { 22/ {
23 compatible = "samsung,exynos4212"; 23 compatible = "samsung,exynos4212";
diff --git a/arch/arm/boot/dts/exynos4412-odroidx.dts b/arch/arm/boot/dts/exynos4412-odroidx.dts
index 53bc8bf77984..46c678ee119c 100644
--- a/arch/arm/boot/dts/exynos4412-odroidx.dts
+++ b/arch/arm/boot/dts/exynos4412-odroidx.dts
@@ -12,7 +12,7 @@
12*/ 12*/
13 13
14/dts-v1/; 14/dts-v1/;
15/include/ "exynos4412.dtsi" 15#include "exynos4412.dtsi"
16 16
17/ { 17/ {
18 model = "Hardkernel ODROID-X board based on Exynos4412"; 18 model = "Hardkernel ODROID-X board based on Exynos4412";
@@ -43,6 +43,7 @@
43 #size-cells = <0>; 43 #size-cells = <0>;
44 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>; 44 pinctrl-0 = <&sd4_clk &sd4_cmd &sd4_bus4 &sd4_bus8>;
45 pinctrl-names = "default"; 45 pinctrl-names = "default";
46 vmmc-supply = <&ldo20_reg &buck8_reg>;
46 status = "okay"; 47 status = "okay";
47 48
48 num-slots = <1>; 49 num-slots = <1>;
@@ -78,6 +79,7 @@
78 bus-width = <4>; 79 bus-width = <4>;
79 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>; 80 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_cd &sd2_bus4>;
80 pinctrl-names = "default"; 81 pinctrl-names = "default";
82 vmmc-supply = <&ldo4_reg &ldo21_reg>;
81 status = "okay"; 83 status = "okay";
82 }; 84 };
83 85
@@ -108,4 +110,199 @@
108 clock-frequency = <24000000>; 110 clock-frequency = <24000000>;
109 }; 111 };
110 }; 112 };
113
114 i2c@13860000 {
115 pinctrl-0 = <&i2c0_bus>;
116 pinctrl-names = "default";
117 status = "okay";
118
119 max77686: pmic@09 {
120 compatible = "maxim,max77686";
121 reg = <0x09>;
122
123 voltage-regulators {
124 ldo1_reg: LDO1 {
125 regulator-name = "VDD_ALIVE_1.0V";
126 regulator-min-microvolt = <1000000>;
127 regulator-max-microvolt = <1000000>;
128 regulator-always-on;
129 };
130
131 ldo2_reg: LDO2 {
132 regulator-name = "VDDQ_M1_2_1.8V";
133 regulator-min-microvolt = <1800000>;
134 regulator-max-microvolt = <1800000>;
135 regulator-always-on;
136 };
137
138 ldo3_reg: LDO3 {
139 regulator-name = "VDDQ_EXT_1.8V";
140 regulator-min-microvolt = <1800000>;
141 regulator-max-microvolt = <1800000>;
142 regulator-always-on;
143 };
144
145 ldo4_reg: LDO4 {
146 regulator-name = "VDDQ_MMC2_2.8V";
147 regulator-min-microvolt = <2800000>;
148 regulator-max-microvolt = <2800000>;
149 regulator-always-on;
150 regulator-boot-on;
151 };
152
153 ldo5_reg: LDO5 {
154 regulator-name = "VDDQ_MMC1_3_1.8V";
155 regulator-min-microvolt = <1800000>;
156 regulator-max-microvolt = <1800000>;
157 regulator-always-on;
158 regulator-boot-on;
159 };
160
161 ldo6_reg: LDO6 {
162 regulator-name = "VDD10_MPLL_1.0V";
163 regulator-min-microvolt = <1000000>;
164 regulator-max-microvolt = <1000000>;
165 regulator-always-on;
166 };
167
168 ldo7_reg: LDO7 {
169 regulator-name = "VDD10_XPLL_1.0V";
170 regulator-min-microvolt = <1000000>;
171 regulator-max-microvolt = <1000000>;
172 regulator-always-on;
173 };
174
175 ldo11_reg: LDO11 {
176 regulator-name = "VDD18_ABB1_1.8V";
177 regulator-min-microvolt = <1800000>;
178 regulator-max-microvolt = <1800000>;
179 regulator-always-on;
180 };
181
182 ldo12_reg: LDO12 {
183 regulator-name = "VDD33_USB_3.3V";
184 regulator-min-microvolt = <3300000>;
185 regulator-max-microvolt = <3300000>;
186 regulator-always-on;
187 regulator-boot-on;
188 };
189
190 ldo13_reg: LDO13 {
191 regulator-name = "VDDQ_C2C_W_1.8V";
192 regulator-min-microvolt = <1800000>;
193 regulator-max-microvolt = <1800000>;
194 regulator-always-on;
195 regulator-boot-on;
196 };
197
198 ldo14_reg: LDO14 {
199 regulator-name = "VDD18_ABB0_2_1.8V";
200 regulator-min-microvolt = <1800000>;
201 regulator-max-microvolt = <1800000>;
202 regulator-always-on;
203 regulator-boot-on;
204 };
205
206 ldo15_reg: LDO15 {
207 regulator-name = "VDD10_HSIC_1.0V";
208 regulator-min-microvolt = <1000000>;
209 regulator-max-microvolt = <1000000>;
210 regulator-always-on;
211 regulator-boot-on;
212 };
213
214 ldo16_reg: LDO16 {
215 regulator-name = "VDD18_HSIC_1.8V";
216 regulator-min-microvolt = <1800000>;
217 regulator-max-microvolt = <1800000>;
218 regulator-always-on;
219 regulator-boot-on;
220 };
221
222 ldo20_reg: LDO20 {
223 regulator-name = "LDO20_1.8V";
224 regulator-min-microvolt = <1800000>;
225 regulator-max-microvolt = <1800000>;
226 regulator-boot-on;
227 };
228
229 ldo21_reg: LDO21 {
230 regulator-name = "LDO21_3.3V";
231 regulator-min-microvolt = <3300000>;
232 regulator-max-microvolt = <3300000>;
233 regulator-always-on;
234 regulator-boot-on;
235 };
236
237 ldo25_reg: LDO25 {
238 regulator-name = "VDDQ_LCD_1.8V";
239 regulator-min-microvolt = <1800000>;
240 regulator-max-microvolt = <1800000>;
241 regulator-always-on;
242 regulator-boot-on;
243 };
244
245 buck1_reg: BUCK1 {
246 regulator-name = "vdd_mif";
247 regulator-min-microvolt = <1000000>;
248 regulator-max-microvolt = <1000000>;
249 regulator-always-on;
250 regulator-boot-on;
251 };
252
253 buck2_reg: BUCK2 {
254 regulator-name = "vdd_arm";
255 regulator-min-microvolt = <900000>;
256 regulator-max-microvolt = <1300000>;
257 regulator-always-on;
258 regulator-boot-on;
259 };
260
261 buck3_reg: BUCK3 {
262 regulator-name = "vdd_int";
263 regulator-min-microvolt = <1000000>;
264 regulator-max-microvolt = <1000000>;
265 regulator-always-on;
266 regulator-boot-on;
267 };
268
269 buck4_reg: BUCK4 {
270 regulator-name = "vdd_g3d";
271 regulator-min-microvolt = <900000>;
272 regulator-max-microvolt = <1100000>;
273 regulator-microvolt-offset = <50000>;
274 };
275
276 buck5_reg: BUCK5 {
277 regulator-name = "VDDQ_CKEM1_2_1.2V";
278 regulator-min-microvolt = <1200000>;
279 regulator-max-microvolt = <1200000>;
280 regulator-always-on;
281 regulator-boot-on;
282 };
283
284 buck6_reg: BUCK6 {
285 regulator-name = "BUCK6_1.35V";
286 regulator-min-microvolt = <1350000>;
287 regulator-max-microvolt = <1350000>;
288 regulator-always-on;
289 regulator-boot-on;
290 };
291
292 buck7_reg: BUCK7 {
293 regulator-name = "BUCK7_2.0V";
294 regulator-min-microvolt = <2000000>;
295 regulator-max-microvolt = <2000000>;
296 regulator-always-on;
297 };
298
299 buck8_reg: BUCK8 {
300 regulator-name = "BUCK8_2.8V";
301 regulator-min-microvolt = <2800000>;
302 regulator-max-microvolt = <2800000>;
303 regulator-always-on;
304 };
305 };
306 };
307 };
111}; 308};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index 1c21bad32ca9..7993641cb32a 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -13,7 +13,7 @@
13*/ 13*/
14 14
15/dts-v1/; 15/dts-v1/;
16/include/ "exynos4412.dtsi" 16#include "exynos4412.dtsi"
17 17
18/ { 18/ {
19 model = "Insignal Origen evaluation board based on Exynos4412"; 19 model = "Insignal Origen evaluation board based on Exynos4412";
@@ -36,6 +36,72 @@
36 enable-active-high; 36 enable-active-high;
37 }; 37 };
38 38
39 pinctrl@11000000 {
40 keypad_rows: keypad-rows {
41 samsung,pins = "gpx2-0", "gpx2-1", "gpx2-2";
42 samsung,pin-function = <3>;
43 samsung,pin-pud = <3>;
44 samsung,pin-drv = <0>;
45 };
46
47 keypad_cols: keypad-cols {
48 samsung,pins = "gpx1-0", "gpx1-1";
49 samsung,pin-function = <3>;
50 samsung,pin-pud = <0>;
51 samsung,pin-drv = <0>;
52 };
53 };
54
55 keypad@100A0000 {
56 samsung,keypad-num-rows = <3>;
57 samsung,keypad-num-columns = <2>;
58 linux,keypad-no-autorepeat;
59 linux,keypad-wakeup;
60 pinctrl-0 = <&keypad_rows &keypad_cols>;
61 pinctrl-names = "default";
62 status = "okay";
63
64 key_home {
65 keypad,row = <0>;
66 keypad,column = <0>;
67 linux,code = <102>;
68 };
69
70 key_down {
71 keypad,row = <0>;
72 keypad,column = <1>;
73 linux,code = <108>;
74 };
75
76 key_up {
77 keypad,row = <1>;
78 keypad,column = <0>;
79 linux,code = <103>;
80 };
81
82 key_menu {
83 keypad,row = <1>;
84 keypad,column = <1>;
85 linux,code = <139>;
86 };
87
88 key_back {
89 keypad,row = <2>;
90 keypad,column = <0>;
91 linux,code = <158>;
92 };
93
94 key_enter {
95 keypad,row = <2>;
96 keypad,column = <1>;
97 linux,code = <28>;
98 };
99 };
100
101 g2d@10800000 {
102 status = "okay";
103 };
104
39 sdhci@12530000 { 105 sdhci@12530000 {
40 bus-width = <4>; 106 bus-width = <4>;
41 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>; 107 pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &sd2_cd>;
diff --git a/arch/arm/boot/dts/exynos4412-smdk4412.dts b/arch/arm/boot/dts/exynos4412-smdk4412.dts
index dd564310d4a5..ad316a1ee9e0 100644
--- a/arch/arm/boot/dts/exynos4412-smdk4412.dts
+++ b/arch/arm/boot/dts/exynos4412-smdk4412.dts
@@ -13,7 +13,7 @@
13*/ 13*/
14 14
15/dts-v1/; 15/dts-v1/;
16/include/ "exynos4412.dtsi" 16#include "exynos4412.dtsi"
17 17
18/ { 18/ {
19 model = "Samsung SMDK evaluation board based on Exynos4412"; 19 model = "Samsung SMDK evaluation board based on Exynos4412";
@@ -31,8 +31,91 @@
31 status = "okay"; 31 status = "okay";
32 }; 32 };
33 33
34 g2d@10800000 { 34 pinctrl@11000000 {
35 keypad_rows: keypad-rows {
36 samsung,pins = "gpx2-0", "gpx2-1", "gpx2-2";
37 samsung,pin-function = <3>;
38 samsung,pin-pud = <3>;
39 samsung,pin-drv = <0>;
40 };
41
42 keypad_cols: keypad-cols {
43 samsung,pins = "gpx1-0", "gpx1-1", "gpx1-2", "gpx1-3",
44 "gpx1-4", "gpx1-5", "gpx1-6", "gpx1-7";
45 samsung,pin-function = <3>;
46 samsung,pin-pud = <0>;
47 samsung,pin-drv = <0>;
48 };
49 };
50
51 keypad@100A0000 {
52 samsung,keypad-num-rows = <3>;
53 samsung,keypad-num-columns = <8>;
54 linux,keypad-no-autorepeat;
55 linux,keypad-wakeup;
56 pinctrl-0 = <&keypad_rows &keypad_cols>;
57 pinctrl-names = "default";
35 status = "okay"; 58 status = "okay";
59
60 key_1 {
61 keypad,row = <1>;
62 keypad,column = <3>;
63 linux,code = <2>;
64 };
65
66 key_2 {
67 keypad,row = <1>;
68 keypad,column = <4>;
69 linux,code = <3>;
70 };
71
72 key_3 {
73 keypad,row = <1>;
74 keypad,column = <5>;
75 linux,code = <4>;
76 };
77
78 key_4 {
79 keypad,row = <1>;
80 keypad,column = <6>;
81 linux,code = <5>;
82 };
83
84 key_5 {
85 keypad,row = <1>;
86 keypad,column = <7>;
87 linux,code = <6>;
88 };
89
90 key_A {
91 keypad,row = <2>;
92 keypad,column = <6>;
93 linux,code = <30>;
94 };
95
96 key_B {
97 keypad,row = <2>;
98 keypad,column = <7>;
99 linux,code = <48>;
100 };
101
102 key_C {
103 keypad,row = <0>;
104 keypad,column = <5>;
105 linux,code = <46>;
106 };
107
108 key_D {
109 keypad,row = <2>;
110 keypad,column = <5>;
111 linux,code = <32>;
112 };
113
114 key_E {
115 keypad,row = <0>;
116 keypad,column = <7>;
117 linux,code = <18>;
118 };
36 }; 119 };
37 120
38 sdhci@12530000 { 121 sdhci@12530000 {
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index 270b389e0a1b..e743e677a9e2 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18*/ 18*/
19 19
20/include/ "exynos4x12.dtsi" 20#include "exynos4x12.dtsi"
21 21
22/ { 22/ {
23 compatible = "samsung,exynos4412"; 23 compatible = "samsung,exynos4412";
diff --git a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
index 099cec79e2ae..704290f7c5c0 100644
--- a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
@@ -778,62 +778,6 @@
778 samsung,pin-drv = <3>; 778 samsung,pin-drv = <3>;
779 }; 779 };
780 780
781 keypad_col0: keypad-col0 {
782 samsung,pins = "gpl2-0";
783 samsung,pin-function = <3>;
784 samsung,pin-pud = <0>;
785 samsung,pin-drv = <0>;
786 };
787
788 keypad_col1: keypad-col1 {
789 samsung,pins = "gpl2-1";
790 samsung,pin-function = <3>;
791 samsung,pin-pud = <0>;
792 samsung,pin-drv = <0>;
793 };
794
795 keypad_col2: keypad-col2 {
796 samsung,pins = "gpl2-2";
797 samsung,pin-function = <3>;
798 samsung,pin-pud = <0>;
799 samsung,pin-drv = <0>;
800 };
801
802 keypad_col3: keypad-col3 {
803 samsung,pins = "gpl2-3";
804 samsung,pin-function = <3>;
805 samsung,pin-pud = <0>;
806 samsung,pin-drv = <0>;
807 };
808
809 keypad_col4: keypad-col4 {
810 samsung,pins = "gpl2-4";
811 samsung,pin-function = <3>;
812 samsung,pin-pud = <0>;
813 samsung,pin-drv = <0>;
814 };
815
816 keypad_col5: keypad-col5 {
817 samsung,pins = "gpl2-5";
818 samsung,pin-function = <3>;
819 samsung,pin-pud = <0>;
820 samsung,pin-drv = <0>;
821 };
822
823 keypad_col6: keypad-col6 {
824 samsung,pins = "gpl2-6";
825 samsung,pin-function = <3>;
826 samsung,pin-pud = <0>;
827 samsung,pin-drv = <0>;
828 };
829
830 keypad_col7: keypad-col7 {
831 samsung,pins = "gpl2-7";
832 samsung,pin-function = <3>;
833 samsung,pin-pud = <0>;
834 samsung,pin-drv = <0>;
835 };
836
837 cam_port_b: cam-port-b { 781 cam_port_b: cam-port-b {
838 samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3", 782 samsung,pins = "gpm0-0", "gpm0-1", "gpm0-2", "gpm0-3",
839 "gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7", 783 "gpm0-4", "gpm0-5", "gpm0-6", "gpm0-7",
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index e3380a7a285c..01da194ba329 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -17,8 +17,8 @@
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18*/ 18*/
19 19
20/include/ "exynos4.dtsi" 20#include "exynos4.dtsi"
21/include/ "exynos4x12-pinctrl.dtsi" 21#include "exynos4x12-pinctrl.dtsi"
22 22
23/ { 23/ {
24 aliases { 24 aliases {
@@ -28,14 +28,6 @@
28 pinctrl3 = &pinctrl_3; 28 pinctrl3 = &pinctrl_3;
29 }; 29 };
30 30
31 combiner:interrupt-controller@10440000 {
32 interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
33 <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
34 <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
35 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
36 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>;
37 };
38
39 clock: clock-controller@0x10030000 { 31 clock: clock-controller@0x10030000 {
40 compatible = "samsung,exynos4412-clock"; 32 compatible = "samsung,exynos4412-clock";
41 reg = <0x10030000 0x20000>; 33 reg = <0x10030000 0x20000>;
@@ -77,6 +69,8 @@
77 compatible = "samsung,exynos4212-g2d"; 69 compatible = "samsung,exynos4212-g2d";
78 reg = <0x10800000 0x1000>; 70 reg = <0x10800000 0x1000>;
79 interrupts = <0 89 0>; 71 interrupts = <0 89 0>;
72 clocks = <&clock 177>, <&clock 277>;
73 clock-names = "sclk_fimg2d", "fimg2d";
80 status = "disabled"; 74 status = "disabled";
81 }; 75 };
82}; 76};
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
new file mode 100644
index 000000000000..f65e124c04a6
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -0,0 +1,111 @@
1/*
2 * Samsung's Exynos5 SoC series common device tree source
3 *
4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Samsung's Exynos5 SoC series device nodes are listed in this file. Particular
8 * SoCs from Exynos5 series can include this file and provide values for SoCs
9 * specfic bindings.
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 "skeleton.dtsi"
17
18/ {
19 interrupt-parent = <&gic>;
20
21 chipid@10000000 {
22 compatible = "samsung,exynos4210-chipid";
23 reg = <0x10000000 0x100>;
24 };
25
26 combiner:interrupt-controller@10440000 {
27 compatible = "samsung,exynos4210-combiner";
28 #interrupt-cells = <2>;
29 interrupt-controller;
30 samsung,combiner-nr = <32>;
31 reg = <0x10440000 0x1000>;
32 interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
33 <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
34 <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
35 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
36 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
37 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>,
38 <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
39 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
40 };
41
42 gic:interrupt-controller@10481000 {
43 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic";
44 #interrupt-cells = <3>;
45 interrupt-controller;
46 reg = <0x10481000 0x1000>,
47 <0x10482000 0x1000>,
48 <0x10484000 0x2000>,
49 <0x10486000 0x2000>;
50 interrupts = <1 9 0xf04>;
51 };
52
53 dwmmc_0: dwmmc0@12200000 {
54 compatible = "samsung,exynos5250-dw-mshc";
55 interrupts = <0 75 0>;
56 #address-cells = <1>;
57 #size-cells = <0>;
58 };
59
60 dwmmc_1: dwmmc1@12210000 {
61 compatible = "samsung,exynos5250-dw-mshc";
62 interrupts = <0 76 0>;
63 #address-cells = <1>;
64 #size-cells = <0>;
65 };
66
67 dwmmc_2: dwmmc2@12220000 {
68 compatible = "samsung,exynos5250-dw-mshc";
69 interrupts = <0 77 0>;
70 #address-cells = <1>;
71 #size-cells = <0>;
72 };
73
74 serial@12C00000 {
75 compatible = "samsung,exynos4210-uart";
76 reg = <0x12C00000 0x100>;
77 interrupts = <0 51 0>;
78 };
79
80 serial@12C10000 {
81 compatible = "samsung,exynos4210-uart";
82 reg = <0x12C10000 0x100>;
83 interrupts = <0 52 0>;
84 };
85
86 serial@12C20000 {
87 compatible = "samsung,exynos4210-uart";
88 reg = <0x12C20000 0x100>;
89 interrupts = <0 53 0>;
90 };
91
92 serial@12C30000 {
93 compatible = "samsung,exynos4210-uart";
94 reg = <0x12C30000 0x100>;
95 interrupts = <0 54 0>;
96 };
97
98 rtc {
99 compatible = "samsung,s3c6410-rtc";
100 reg = <0x101E0000 0x100>;
101 interrupts = <0 43 0>, <0 44 0>;
102 status = "disabled";
103 };
104
105 watchdog {
106 compatible = "samsung,s3c2410-wdt";
107 reg = <0x101D0000 0x100>;
108 interrupts = <0 42 0>;
109 status = "disabled";
110 };
111};
diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
index 02cfc76d002f..abc7272c7afd 100644
--- a/arch/arm/boot/dts/exynos5250-arndale.dts
+++ b/arch/arm/boot/dts/exynos5250-arndale.dts
@@ -10,7 +10,7 @@
10*/ 10*/
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "exynos5250.dtsi" 13#include "exynos5250.dtsi"
14 14
15/ { 15/ {
16 model = "Insignal Arndale evaluation board based on EXYNOS5250"; 16 model = "Insignal Arndale evaluation board based on EXYNOS5250";
@@ -449,4 +449,35 @@
449 clock-frequency = <24000000>; 449 clock-frequency = <24000000>;
450 }; 450 };
451 }; 451 };
452
453 dp-controller {
454 samsung,color-space = <0>;
455 samsung,dynamic-range = <0>;
456 samsung,ycbcr-coeff = <0>;
457 samsung,color-depth = <1>;
458 samsung,link-rate = <0x0a>;
459 samsung,lane-count = <4>;
460 };
461
462 fimd: fimd@14400000 {
463 display-timings {
464 native-mode = <&timing0>;
465 timing0: timing@0 {
466 /* 2560x1600 DP panel */
467 clock-frequency = <50000>;
468 hactive = <2560>;
469 vactive = <1600>;
470 hfront-porch = <48>;
471 hback-porch = <80>;
472 hsync-len = <32>;
473 vback-porch = <16>;
474 vfront-porch = <8>;
475 vsync-len = <6>;
476 };
477 };
478 };
479
480 rtc {
481 status = "okay";
482 };
452}; 483};
diff --git a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
index d1650fb34c0a..724a22f9b1c8 100644
--- a/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos5250-pinctrl.dtsi
@@ -553,6 +553,13 @@
553 samsung,pin-pud = <0>; 553 samsung,pin-pud = <0>;
554 samaung,pin-drv = <0>; 554 samaung,pin-drv = <0>;
555 }; 555 };
556
557 dp_hpd: dp_hpd {
558 samsung,pins = "gpx0-7";
559 samsung,pin-function = <3>;
560 samsung,pin-pud = <0>;
561 samaung,pin-drv = <0>;
562 };
556 }; 563 };
557 564
558 pinctrl@13400000 { 565 pinctrl@13400000 {
@@ -763,7 +770,7 @@
763 }; 770 };
764 }; 771 };
765 772
766 pinctrl@03680000 { 773 pinctrl@03860000 {
767 gpz: gpz { 774 gpz: gpz {
768 gpio-controller; 775 gpio-controller;
769 #gpio-cells = <2>; 776 #gpio-cells = <2>;
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 3e0c792e2767..35a66dee4011 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -10,7 +10,7 @@
10*/ 10*/
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "exynos5250.dtsi" 13#include "exynos5250.dtsi"
14 14
15/ { 15/ {
16 model = "SAMSUNG SMDK5250 board based on EXYNOS5250"; 16 model = "SAMSUNG SMDK5250 board based on EXYNOS5250";
@@ -37,6 +37,30 @@
37 }; 37 };
38 }; 38 };
39 39
40 vdd:fixed-regulator@0 {
41 compatible = "regulator-fixed";
42 regulator-name = "vdd-supply";
43 regulator-min-microvolt = <1800000>;
44 regulator-max-microvolt = <1800000>;
45 regulator-always-on;
46 };
47
48 dbvdd:fixed-regulator@1 {
49 compatible = "regulator-fixed";
50 regulator-name = "dbvdd-supply";
51 regulator-min-microvolt = <3300000>;
52 regulator-max-microvolt = <3300000>;
53 regulator-always-on;
54 };
55
56 spkvdd:fixed-regulator@2 {
57 compatible = "regulator-fixed";
58 regulator-name = "spkvdd-supply";
59 regulator-min-microvolt = <5000000>;
60 regulator-max-microvolt = <5000000>;
61 regulator-always-on;
62 };
63
40 i2c@12C70000 { 64 i2c@12C70000 {
41 samsung,i2c-sda-delay = <100>; 65 samsung,i2c-sda-delay = <100>;
42 samsung,i2c-max-bus-freq = <20000>; 66 samsung,i2c-max-bus-freq = <20000>;
@@ -47,8 +71,17 @@
47 }; 71 };
48 72
49 wm8994: wm8994@1a { 73 wm8994: wm8994@1a {
50 compatible = "wlf,wm8994"; 74 compatible = "wlf,wm8994";
51 reg = <0x1a>; 75 reg = <0x1a>;
76
77 gpio-controller;
78 #gpio-cells = <2>;
79
80 AVDD2-supply = <&vdd>;
81 CPVDD-supply = <&vdd>;
82 DBVDD-supply = <&dbvdd>;
83 SPKVDD1-supply = <&spkvdd>;
84 SPKVDD2-supply = <&spkvdd>;
52 }; 85 };
53 }; 86 };
54 87
@@ -224,6 +257,9 @@
224 samsung,color-depth = <1>; 257 samsung,color-depth = <1>;
225 samsung,link-rate = <0x0a>; 258 samsung,link-rate = <0x0a>;
226 samsung,lane-count = <4>; 259 samsung,lane-count = <4>;
260
261 pinctrl-names = "default";
262 pinctrl-0 = <&dp_hpd>;
227 }; 263 };
228 264
229 display-timings { 265 display-timings {
diff --git a/arch/arm/boot/dts/exynos5250-snow.dts b/arch/arm/boot/dts/exynos5250-snow.dts
index d449feb7e143..e79331dba12d 100644
--- a/arch/arm/boot/dts/exynos5250-snow.dts
+++ b/arch/arm/boot/dts/exynos5250-snow.dts
@@ -9,8 +9,8 @@
9*/ 9*/
10 10
11/dts-v1/; 11/dts-v1/;
12/include/ "exynos5250.dtsi" 12#include "exynos5250.dtsi"
13/include/ "cros5250-common.dtsi" 13#include "cros5250-common.dtsi"
14 14
15/ { 15/ {
16 model = "Google Snow"; 16 model = "Google Snow";
@@ -171,6 +171,10 @@
171 }; 171 };
172 }; 172 };
173 173
174 rtc {
175 status = "okay";
176 };
177
174 /* 178 /*
175 * On Snow we've got SIP WiFi and so can keep drive strengths low to 179 * On Snow we've got SIP WiFi and so can keep drive strengths low to
176 * reduce EMI. 180 * reduce EMI.
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 0673524238a6..41cd625b6020 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -17,12 +17,13 @@
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18*/ 18*/
19 19
20/include/ "skeleton.dtsi" 20#include "exynos5.dtsi"
21/include/ "exynos5250-pinctrl.dtsi" 21#include "exynos5250-pinctrl.dtsi"
22
23#include <dt-bindings/clk/exynos-audss-clk.h>
22 24
23/ { 25/ {
24 compatible = "samsung,exynos5250"; 26 compatible = "samsung,exynos5250";
25 interrupt-parent = <&gic>;
26 27
27 aliases { 28 aliases {
28 spi0 = &spi_0; 29 spi0 = &spi_0;
@@ -51,9 +52,20 @@
51 pinctrl3 = &pinctrl_3; 52 pinctrl3 = &pinctrl_3;
52 }; 53 };
53 54
54 chipid@10000000 { 55 cpus {
55 compatible = "samsung,exynos4210-chipid"; 56 #address-cells = <1>;
56 reg = <0x10000000 0x100>; 57 #size-cells = <0>;
58
59 cpu@0 {
60 device_type = "cpu";
61 compatible = "arm,cortex-a15";
62 reg = <0>;
63 };
64 cpu@1 {
65 device_type = "cpu";
66 compatible = "arm,cortex-a15";
67 reg = <1>;
68 };
57 }; 69 };
58 70
59 pd_gsc: gsc-power-domain@0x10044000 { 71 pd_gsc: gsc-power-domain@0x10044000 {
@@ -72,15 +84,10 @@
72 #clock-cells = <1>; 84 #clock-cells = <1>;
73 }; 85 };
74 86
75 gic:interrupt-controller@10481000 { 87 clock_audss: audss-clock-controller@3810000 {
76 compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; 88 compatible = "samsung,exynos5250-audss-clock";
77 #interrupt-cells = <3>; 89 reg = <0x03810000 0x0C>;
78 interrupt-controller; 90 #clock-cells = <1>;
79 reg = <0x10481000 0x1000>,
80 <0x10482000 0x1000>,
81 <0x10484000 0x2000>,
82 <0x10486000 0x2000>;
83 interrupts = <1 9 0xf04>;
84 }; 91 };
85 92
86 timer { 93 timer {
@@ -91,22 +98,6 @@
91 <1 10 0xf08>; 98 <1 10 0xf08>;
92 }; 99 };
93 100
94 combiner:interrupt-controller@10440000 {
95 compatible = "samsung,exynos4210-combiner";
96 #interrupt-cells = <2>;
97 interrupt-controller;
98 samsung,combiner-nr = <32>;
99 reg = <0x10440000 0x1000>;
100 interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
101 <0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
102 <0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
103 <0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
104 <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
105 <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>,
106 <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>,
107 <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>;
108 };
109
110 mct@101C0000 { 101 mct@101C0000 {
111 compatible = "samsung,exynos4210-mct"; 102 compatible = "samsung,exynos4210-mct";
112 reg = <0x101C0000 0x800>; 103 reg = <0x101C0000 0x800>;
@@ -161,16 +152,13 @@
161 interrupts = <0 50 0>; 152 interrupts = <0 50 0>;
162 }; 153 };
163 154
164 pinctrl_3: pinctrl@03680000 { 155 pinctrl_3: pinctrl@03860000 {
165 compatible = "samsung,exynos5250-pinctrl"; 156 compatible = "samsung,exynos5250-pinctrl";
166 reg = <0x0368000 0x1000>; 157 reg = <0x03860000 0x1000>;
167 interrupts = <0 47 0>; 158 interrupts = <0 47 0>;
168 }; 159 };
169 160
170 watchdog { 161 watchdog {
171 compatible = "samsung,s3c2410-wdt";
172 reg = <0x101D0000 0x100>;
173 interrupts = <0 42 0>;
174 clocks = <&clock 336>; 162 clocks = <&clock 336>;
175 clock-names = "watchdog"; 163 clock-names = "watchdog";
176 }; 164 };
@@ -183,12 +171,8 @@
183 }; 171 };
184 172
185 rtc { 173 rtc {
186 compatible = "samsung,s3c6410-rtc";
187 reg = <0x101E0000 0x100>;
188 interrupts = <0 43 0>, <0 44 0>;
189 clocks = <&clock 337>; 174 clocks = <&clock 337>;
190 clock-names = "rtc"; 175 clock-names = "rtc";
191 status = "disabled";
192 }; 176 };
193 177
194 tmu@10060000 { 178 tmu@10060000 {
@@ -200,33 +184,21 @@
200 }; 184 };
201 185
202 serial@12C00000 { 186 serial@12C00000 {
203 compatible = "samsung,exynos4210-uart";
204 reg = <0x12C00000 0x100>;
205 interrupts = <0 51 0>;
206 clocks = <&clock 289>, <&clock 146>; 187 clocks = <&clock 289>, <&clock 146>;
207 clock-names = "uart", "clk_uart_baud0"; 188 clock-names = "uart", "clk_uart_baud0";
208 }; 189 };
209 190
210 serial@12C10000 { 191 serial@12C10000 {
211 compatible = "samsung,exynos4210-uart";
212 reg = <0x12C10000 0x100>;
213 interrupts = <0 52 0>;
214 clocks = <&clock 290>, <&clock 147>; 192 clocks = <&clock 290>, <&clock 147>;
215 clock-names = "uart", "clk_uart_baud0"; 193 clock-names = "uart", "clk_uart_baud0";
216 }; 194 };
217 195
218 serial@12C20000 { 196 serial@12C20000 {
219 compatible = "samsung,exynos4210-uart";
220 reg = <0x12C20000 0x100>;
221 interrupts = <0 53 0>;
222 clocks = <&clock 291>, <&clock 148>; 197 clocks = <&clock 291>, <&clock 148>;
223 clock-names = "uart", "clk_uart_baud0"; 198 clock-names = "uart", "clk_uart_baud0";
224 }; 199 };
225 200
226 serial@12C30000 { 201 serial@12C30000 {
227 compatible = "samsung,exynos4210-uart";
228 reg = <0x12C30000 0x100>;
229 interrupts = <0 54 0>;
230 clocks = <&clock 292>, <&clock 149>; 202 clocks = <&clock 292>, <&clock 149>;
231 clock-names = "uart", "clk_uart_baud0"; 203 clock-names = "uart", "clk_uart_baud0";
232 }; 204 };
@@ -405,31 +377,19 @@
405 }; 377 };
406 378
407 dwmmc_0: dwmmc0@12200000 { 379 dwmmc_0: dwmmc0@12200000 {
408 compatible = "samsung,exynos5250-dw-mshc";
409 reg = <0x12200000 0x1000>; 380 reg = <0x12200000 0x1000>;
410 interrupts = <0 75 0>;
411 #address-cells = <1>;
412 #size-cells = <0>;
413 clocks = <&clock 280>, <&clock 139>; 381 clocks = <&clock 280>, <&clock 139>;
414 clock-names = "biu", "ciu"; 382 clock-names = "biu", "ciu";
415 }; 383 };
416 384
417 dwmmc_1: dwmmc1@12210000 { 385 dwmmc_1: dwmmc1@12210000 {
418 compatible = "samsung,exynos5250-dw-mshc";
419 reg = <0x12210000 0x1000>; 386 reg = <0x12210000 0x1000>;
420 interrupts = <0 76 0>;
421 #address-cells = <1>;
422 #size-cells = <0>;
423 clocks = <&clock 281>, <&clock 140>; 387 clocks = <&clock 281>, <&clock 140>;
424 clock-names = "biu", "ciu"; 388 clock-names = "biu", "ciu";
425 }; 389 };
426 390
427 dwmmc_2: dwmmc2@12220000 { 391 dwmmc_2: dwmmc2@12220000 {
428 compatible = "samsung,exynos5250-dw-mshc";
429 reg = <0x12220000 0x1000>; 392 reg = <0x12220000 0x1000>;
430 interrupts = <0 77 0>;
431 #address-cells = <1>;
432 #size-cells = <0>;
433 clocks = <&clock 282>, <&clock 141>; 393 clocks = <&clock 282>, <&clock 141>;
434 clock-names = "biu", "ciu"; 394 clock-names = "biu", "ciu";
435 }; 395 };
@@ -451,6 +411,10 @@
451 &pdma0 9 411 &pdma0 9
452 &pdma0 8>; 412 &pdma0 8>;
453 dma-names = "tx", "rx", "tx-sec"; 413 dma-names = "tx", "rx", "tx-sec";
414 clocks = <&clock_audss EXYNOS_I2S_BUS>,
415 <&clock_audss EXYNOS_I2S_BUS>,
416 <&clock_audss EXYNOS_SCLK_I2S>;
417 clock-names = "iis", "i2s_opclk0", "i2s_opclk1";
454 samsung,supports-6ch; 418 samsung,supports-6ch;
455 samsung,supports-rstclr; 419 samsung,supports-rstclr;
456 samsung,supports-secdai; 420 samsung,supports-secdai;
@@ -465,6 +429,8 @@
465 dmas = <&pdma1 12 429 dmas = <&pdma1 12
466 &pdma1 11>; 430 &pdma1 11>;
467 dma-names = "tx", "rx"; 431 dma-names = "tx", "rx";
432 clocks = <&clock 307>, <&clock 157>;
433 clock-names = "iis", "i2s_opclk0";
468 pinctrl-names = "default"; 434 pinctrl-names = "default";
469 pinctrl-0 = <&i2s1_bus>; 435 pinctrl-0 = <&i2s1_bus>;
470 }; 436 };
@@ -475,10 +441,42 @@
475 dmas = <&pdma0 12 441 dmas = <&pdma0 12
476 &pdma0 11>; 442 &pdma0 11>;
477 dma-names = "tx", "rx"; 443 dma-names = "tx", "rx";
444 clocks = <&clock 308>, <&clock 158>;
445 clock-names = "iis", "i2s_opclk0";
478 pinctrl-names = "default"; 446 pinctrl-names = "default";
479 pinctrl-0 = <&i2s2_bus>; 447 pinctrl-0 = <&i2s2_bus>;
480 }; 448 };
481 449
450 usb@12000000 {
451 compatible = "samsung,exynos5250-dwusb3";
452 clocks = <&clock 286>;
453 clock-names = "usbdrd30";
454 #address-cells = <1>;
455 #size-cells = <1>;
456 ranges;
457
458 dwc3 {
459 compatible = "synopsys,dwc3";
460 reg = <0x12000000 0x10000>;
461 interrupts = <0 72 0>;
462 usb-phy = <&usb2_phy &usb3_phy>;
463 };
464 };
465
466 usb3_phy: usbphy@12100000 {
467 compatible = "samsung,exynos5250-usb3phy";
468 reg = <0x12100000 0x100>;
469 clocks = <&clock 1>, <&clock 286>;
470 clock-names = "ext_xtal", "usbdrd30";
471 #address-cells = <1>;
472 #size-cells = <1>;
473 ranges;
474
475 usbphy-sys {
476 reg = <0x10040704 0x8>;
477 };
478 };
479
482 usb@12110000 { 480 usb@12110000 {
483 compatible = "samsung,exynos4210-ehci"; 481 compatible = "samsung,exynos4210-ehci";
484 reg = <0x12110000 0x100>; 482 reg = <0x12110000 0x100>;
@@ -497,7 +495,7 @@
497 clock-names = "usbhost"; 495 clock-names = "usbhost";
498 }; 496 };
499 497
500 usbphy@12130000 { 498 usb2_phy: usbphy@12130000 {
501 compatible = "samsung,exynos5250-usb2phy"; 499 compatible = "samsung,exynos5250-usb2phy";
502 reg = <0x12130000 0x100>; 500 reg = <0x12130000 0x100>;
503 clocks = <&clock 1>, <&clock 285>; 501 clocks = <&clock 1>, <&clock 285>;
@@ -621,6 +619,8 @@
621 reg = <0x145b0000 0x1000>; 619 reg = <0x145b0000 0x1000>;
622 interrupts = <10 3>; 620 interrupts = <10 3>;
623 interrupt-parent = <&combiner>; 621 interrupt-parent = <&combiner>;
622 clocks = <&clock 342>;
623 clock-names = "dp";
624 #address-cells = <1>; 624 #address-cells = <1>;
625 #size-cells = <0>; 625 #size-cells = <0>;
626 626
diff --git a/arch/arm/boot/dts/exynos5420-pinctrl.dtsi b/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
new file mode 100644
index 000000000000..5848c425ae4d
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5420-pinctrl.dtsi
@@ -0,0 +1,680 @@
1/*
2 * Samsung's Exynos5420 SoC pin-mux and pin-config device tree source
3 *
4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Samsung's Exynos5420 SoC pin-mux and pin-config options are listed as device
8 * tree nodes are listed in this file.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/ {
16 pinctrl@13400000 {
17 gpy7: gpy7 {
18 gpio-controller;
19 #gpio-cells = <2>;
20
21 interrupt-controller;
22 #interrupt-cells = <2>;
23 };
24
25 gpx0: gpx0 {
26 gpio-controller;
27 #gpio-cells = <2>;
28
29 interrupt-controller;
30 interrupt-parent = <&combiner>;
31 #interrupt-cells = <2>;
32 interrupts = <23 0>, <24 0>, <25 0>, <25 1>,
33 <26 0>, <26 1>, <27 0>, <27 1>;
34 };
35
36 gpx1: gpx1 {
37 gpio-controller;
38 #gpio-cells = <2>;
39
40 interrupt-controller;
41 interrupt-parent = <&combiner>;
42 #interrupt-cells = <2>;
43 interrupts = <28 0>, <28 1>, <29 0>, <29 1>,
44 <30 0>, <30 1>, <31 0>, <31 1>;
45 };
46
47 gpx2: gpx2 {
48 gpio-controller;
49 #gpio-cells = <2>;
50
51 interrupt-controller;
52 #interrupt-cells = <2>;
53 };
54
55 gpx3: gpx3 {
56 gpio-controller;
57 #gpio-cells = <2>;
58
59 interrupt-controller;
60 #interrupt-cells = <2>;
61 };
62 };
63
64 pinctrl@13410000 {
65 gpc0: gpc0 {
66 gpio-controller;
67 #gpio-cells = <2>;
68
69 interrupt-controller;
70 #interrupt-cells = <2>;
71 };
72
73 gpc1: gpc1 {
74 gpio-controller;
75 #gpio-cells = <2>;
76
77 interrupt-controller;
78 #interrupt-cells = <2>;
79 };
80
81 gpc2: gpc2 {
82 gpio-controller;
83 #gpio-cells = <2>;
84
85 interrupt-controller;
86 #interrupt-cells = <2>;
87 };
88
89 gpc3: gpc3 {
90 gpio-controller;
91 #gpio-cells = <2>;
92
93 interrupt-controller;
94 #interrupt-cells = <2>;
95 };
96
97 gpc4: gpc4 {
98 gpio-controller;
99 #gpio-cells = <2>;
100
101 interrupt-controller;
102 #interrupt-cells = <2>;
103 };
104
105 gpd1: gpd1 {
106 gpio-controller;
107 #gpio-cells = <2>;
108
109 interrupt-controller;
110 #interrupt-cells = <2>;
111 };
112
113 gpy0: gpy0 {
114 gpio-controller;
115 #gpio-cells = <2>;
116 };
117
118 gpy1: gpy1 {
119 gpio-controller;
120 #gpio-cells = <2>;
121 };
122
123 gpy2: gpy2 {
124 gpio-controller;
125 #gpio-cells = <2>;
126 };
127
128 gpy3: gpy3 {
129 gpio-controller;
130 #gpio-cells = <2>;
131 };
132
133 gpy4: gpy4 {
134 gpio-controller;
135 #gpio-cells = <2>;
136 };
137
138 gpy5: gpy5 {
139 gpio-controller;
140 #gpio-cells = <2>;
141 };
142
143 gpy6: gpy6 {
144 gpio-controller;
145 #gpio-cells = <2>;
146 };
147
148 sd0_clk: sd0-clk {
149 samsung,pins = "gpc0-0";
150 samsung,pin-function = <2>;
151 samsung,pin-pud = <0>;
152 samsung,pin-drv = <3>;
153 };
154
155 sd0_cmd: sd0-cmd {
156 samsung,pins = "gpc0-1";
157 samsung,pin-function = <2>;
158 samsung,pin-pud = <0>;
159 samsung,pin-drv = <3>;
160 };
161
162 sd0_cd: sd0-cd {
163 samsung,pins = "gpc0-2";
164 samsung,pin-function = <2>;
165 samsung,pin-pud = <3>;
166 samsung,pin-drv = <3>;
167 };
168
169 sd0_bus1: sd0-bus-width1 {
170 samsung,pins = "gpc0-3";
171 samsung,pin-function = <2>;
172 samsung,pin-pud = <3>;
173 samsung,pin-drv = <3>;
174 };
175
176 sd0_bus4: sd0-bus-width4 {
177 samsung,pins = "gpc0-4", "gpc0-5", "gpc0-6";
178 samsung,pin-function = <2>;
179 samsung,pin-pud = <3>;
180 samsung,pin-drv = <3>;
181 };
182
183 sd0_bus8: sd0-bus-width8 {
184 samsung,pins = "gpc3-0", "gpc3-1", "gpc3-2", "gpc3-3";
185 samsung,pin-function = <2>;
186 samsung,pin-pud = <3>;
187 samsung,pin-drv = <3>;
188 };
189
190 sd1_clk: sd1-clk {
191 samsung,pins = "gpc1-0";
192 samsung,pin-function = <2>;
193 samsung,pin-pud = <0>;
194 samsung,pin-drv = <3>;
195 };
196
197 sd1_cmd: sd1-cmd {
198 samsung,pins = "gpc1-1";
199 samsung,pin-function = <2>;
200 samsung,pin-pud = <0>;
201 samsung,pin-drv = <3>;
202 };
203
204 sd1_cd: sd1-cd {
205 samsung,pins = "gpc1-2";
206 samsung,pin-function = <2>;
207 samsung,pin-pud = <3>;
208 samsung,pin-drv = <3>;
209 };
210
211 sd1_int: sd1-int {
212 samsung,pins = "gpd1-1";
213 samsung,pin-function = <2>;
214 samsung,pin-pud = <3>;
215 samsung,pin-drv = <0>;
216 };
217
218 sd1_bus1: sd1-bus-width1 {
219 samsung,pins = "gpc1-3";
220 samsung,pin-function = <2>;
221 samsung,pin-pud = <3>;
222 samsung,pin-drv = <3>;
223 };
224
225 sd1_bus4: sd1-bus-width4 {
226 samsung,pins = "gpc1-4", "gpc1-5", "gpc1-6";
227 samsung,pin-function = <2>;
228 samsung,pin-pud = <3>;
229 samsung,pin-drv = <3>;
230 };
231
232 sd1_bus8: sd1-bus-width8 {
233 samsung,pins = "gpd1-4", "gpd1-5", "gpd1-6", "gpd1-7";
234 samsung,pin-function = <2>;
235 samsung,pin-pud = <3>;
236 samsung,pin-drv = <3>;
237 };
238
239 sd2_clk: sd2-clk {
240 samsung,pins = "gpc2-0";
241 samsung,pin-function = <2>;
242 samsung,pin-pud = <0>;
243 samsung,pin-drv = <3>;
244 };
245
246 sd2_cmd: sd2-cmd {
247 samsung,pins = "gpc2-1";
248 samsung,pin-function = <2>;
249 samsung,pin-pud = <0>;
250 samsung,pin-drv = <3>;
251 };
252
253 sd2_cd: sd2-cd {
254 samsung,pins = "gpc2-2";
255 samsung,pin-function = <2>;
256 samsung,pin-pud = <3>;
257 samsung,pin-drv = <3>;
258 };
259
260 sd2_bus1: sd2-bus-width1 {
261 samsung,pins = "gpc2-3";
262 samsung,pin-function = <2>;
263 samsung,pin-pud = <3>;
264 samsung,pin-drv = <3>;
265 };
266
267 sd2_bus4: sd2-bus-width4 {
268 samsung,pins = "gpc2-4", "gpc2-5", "gpc2-6";
269 samsung,pin-function = <2>;
270 samsung,pin-pud = <3>;
271 samsung,pin-drv = <3>;
272 };
273 };
274
275 pinctrl@14000000 {
276 gpe0: gpe0 {
277 gpio-controller;
278 #gpio-cells = <2>;
279
280 interrupt-controller;
281 #interrupt-cells = <2>;
282 };
283
284 gpe1: gpe1 {
285 gpio-controller;
286 #gpio-cells = <2>;
287
288 interrupt-controller;
289 #interrupt-cells = <2>;
290 };
291
292 gpf0: gpf0 {
293 gpio-controller;
294 #gpio-cells = <2>;
295
296 interrupt-controller;
297 #interrupt-cells = <2>;
298 };
299
300 gpf1: gpf1 {
301 gpio-controller;
302 #gpio-cells = <2>;
303
304 interrupt-controller;
305 #interrupt-cells = <2>;
306 };
307
308 gpg0: gpg0 {
309 gpio-controller;
310 #gpio-cells = <2>;
311
312 interrupt-controller;
313 #interrupt-cells = <2>;
314 };
315
316 gpg1: gpg1 {
317 gpio-controller;
318 #gpio-cells = <2>;
319
320 interrupt-controller;
321 #interrupt-cells = <2>;
322 };
323
324 gpg2: gpg2 {
325 gpio-controller;
326 #gpio-cells = <2>;
327
328 interrupt-controller;
329 #interrupt-cells = <2>;
330 };
331
332 gpj4: gpj4 {
333 gpio-controller;
334 #gpio-cells = <2>;
335
336 interrupt-controller;
337 #interrupt-cells = <2>;
338 };
339
340 cam_gpio_a: cam-gpio-a {
341 samsung,pins = "gpe0-0", "gpe0-1", "gpe0-2", "gpe0-3",
342 "gpe0-4", "gpe0-5", "gpe0-6", "gpe0-7",
343 "gpe1-0", "gpe1-1";
344 samsung,pin-function = <2>;
345 samsung,pin-pud = <0>;
346 samsung,pin-drv = <0>;
347 };
348
349 cam_gpio_b: cam-gpio-b {
350 samsung,pins = "gpf0-0", "gpf0-1", "gpf0-2", "gpf0-3",
351 "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3";
352 samsung,pin-function = <3>;
353 samsung,pin-pud = <0>;
354 samsung,pin-drv = <0>;
355 };
356
357 cam_i2c2_bus: cam-i2c2-bus {
358 samsung,pins = "gpf0-4", "gpf0-5";
359 samsung,pin-function = <2>;
360 samsung,pin-pud = <3>;
361 samsung,pin-drv = <0>;
362 };
363 cam_spi1_bus: cam-spi1-bus {
364 samsung,pins = "gpe0-4", "gpe0-5", "gpf0-2", "gpf0-3";
365 samsung,pin-function = <4>;
366 samsung,pin-pud = <0>;
367 samsung,pin-drv = <0>;
368 };
369
370 cam_i2c1_bus: cam-i2c1-bus {
371 samsung,pins = "gpf0-2", "gpf0-3";
372 samsung,pin-function = <2>;
373 samsung,pin-pud = <3>;
374 samsung,pin-drv = <0>;
375 };
376
377 cam_i2c0_bus: cam-i2c0-bus {
378 samsung,pins = "gpf0-0", "gpf0-1";
379 samsung,pin-function = <2>;
380 samsung,pin-pud = <3>;
381 samsung,pin-drv = <0>;
382 };
383
384 cam_spi0_bus: cam-spi0-bus {
385 samsung,pins = "gpf1-0", "gpf1-1", "gpf1-2", "gpf1-3";
386 samsung,pin-function = <2>;
387 samsung,pin-pud = <0>;
388 samsung,pin-drv = <0>;
389 };
390
391 cam_bayrgb_bus: cam-bayrgb-bus {
392 samsung,pins = "gpg0-0", "gpg0-1", "gpg0-2", "gpg0-3",
393 "gpg0-4", "gpg0-5", "gpg0-6", "gpg0-7",
394 "gpg1-0", "gpg1-1", "gpg1-2", "gpg1-3",
395 "gpg1-4", "gpg1-5", "gpg1-6", "gpg1-7",
396 "gpg2-0";
397 samsung,pin-function = <2>;
398 samsung,pin-pud = <0>;
399 samsung,pin-drv = <0>;
400 };
401 };
402
403 pinctrl@14010000 {
404 gpa0: gpa0 {
405 gpio-controller;
406 #gpio-cells = <2>;
407
408 interrupt-controller;
409 #interrupt-cells = <2>;
410 };
411
412 gpa1: gpa1 {
413 gpio-controller;
414 #gpio-cells = <2>;
415
416 interrupt-controller;
417 #interrupt-cells = <2>;
418 };
419
420 gpa2: gpa2 {
421 gpio-controller;
422 #gpio-cells = <2>;
423
424 interrupt-controller;
425 #interrupt-cells = <2>;
426 };
427
428 gpb0: gpb0 {
429 gpio-controller;
430 #gpio-cells = <2>;
431
432 interrupt-controller;
433 #interrupt-cells = <2>;
434 };
435
436 gpb1: gpb1 {
437 gpio-controller;
438 #gpio-cells = <2>;
439
440 interrupt-controller;
441 #interrupt-cells = <2>;
442 };
443
444 gpb2: gpb2 {
445 gpio-controller;
446 #gpio-cells = <2>;
447
448 interrupt-controller;
449 #interrupt-cells = <2>;
450 };
451
452 gpb3: gpb3 {
453 gpio-controller;
454 #gpio-cells = <2>;
455
456 interrupt-controller;
457 #interrupt-cells = <2>;
458 };
459
460 gpb4: gpb4 {
461 gpio-controller;
462 #gpio-cells = <2>;
463
464 interrupt-controller;
465 #interrupt-cells = <2>;
466 };
467
468 gph0: gph0 {
469 gpio-controller;
470 #gpio-cells = <2>;
471
472 interrupt-controller;
473 #interrupt-cells = <2>;
474 };
475
476 uart0_data: uart0-data {
477 samsung,pins = "gpa0-0", "gpa0-1";
478 samsung,pin-function = <2>;
479 samsung,pin-pud = <0>;
480 samsung,pin-drv = <0>;
481 };
482
483 uart0_fctl: uart0-fctl {
484 samsung,pins = "gpa0-2", "gpa0-3";
485 samsung,pin-function = <2>;
486 samsung,pin-pud = <0>;
487 samsung,pin-drv = <0>;
488 };
489
490 uart1_data: uart1-data {
491 samsung,pins = "gpa0-4", "gpa0-5";
492 samsung,pin-function = <2>;
493 samsung,pin-pud = <0>;
494 samsung,pin-drv = <0>;
495 };
496
497 uart1_fctl: uart1-fctl {
498 samsung,pins = "gpa0-6", "gpa0-7";
499 samsung,pin-function = <2>;
500 samsung,pin-pud = <0>;
501 samsung,pin-drv = <0>;
502 };
503
504 i2c2_bus: i2c2-bus {
505 samsung,pins = "gpa0-6", "gpa0-7";
506 samsung,pin-function = <3>;
507 samsung,pin-pud = <3>;
508 samsung,pin-drv = <0>;
509 };
510
511 uart2_data: uart2-data {
512 samsung,pins = "gpa1-0", "gpa1-1";
513 samsung,pin-function = <2>;
514 samsung,pin-pud = <0>;
515 samsung,pin-drv = <0>;
516 };
517
518 uart2_fctl: uart2-fctl {
519 samsung,pins = "gpa1-2", "gpa1-3";
520 samsung,pin-function = <2>;
521 samsung,pin-pud = <0>;
522 samsung,pin-drv = <0>;
523 };
524
525 i2c3_bus: i2c3-bus {
526 samsung,pins = "gpa1-2", "gpa1-3";
527 samsung,pin-function = <3>;
528 samsung,pin-pud = <3>;
529 samsung,pin-drv = <0>;
530 };
531
532 uart3_data: uart3-data {
533 samsung,pins = "gpa1-4", "gpa1-5";
534 samsung,pin-function = <2>;
535 samsung,pin-pud = <0>;
536 samsung,pin-drv = <0>;
537 };
538
539 spi0_bus: spi0-bus {
540 samsung,pins = "gpa2-0", "gpa2-1", "gpa2-2", "gpa2-3";
541 samsung,pin-function = <2>;
542 samsung,pin-pud = <3>;
543 samsung,pin-drv = <0>;
544 };
545
546 spi1_bus: spi1-bus {
547 samsung,pins = "gpa2-4", "gpa2-6", "gpa2-7";
548 samsung,pin-function = <2>;
549 samsung,pin-pud = <3>;
550 samsung,pin-drv = <0>;
551 };
552
553 i2c4_hs_bus: i2c4-hs-bus {
554 samsung,pins = "gpa2-0", "gpa2-1";
555 samsung,pin-function = <3>;
556 samsung,pin-pud = <3>;
557 samsung,pin-drv = <0>;
558 };
559
560 i2c5_hs_bus: i2c5-hs-bus {
561 samsung,pins = "gpa2-2", "gpa2-3";
562 samsung,pin-function = <3>;
563 samsung,pin-pud = <3>;
564 samsung,pin-drv = <0>;
565 };
566
567 i2s1_bus: i2s1-bus {
568 samsung,pins = "gpb0-0", "gpb0-1", "gpb0-2", "gpb0-3",
569 "gpb0-4";
570 samsung,pin-function = <2>;
571 samsung,pin-pud = <0>;
572 samsung,pin-drv = <0>;
573 };
574
575 pcm1_bus: pcm1-bus {
576 samsung,pins = "gpb0-0", "gpb0-1", "gpb0-2", "gpb0-3",
577 "gpb0-4";
578 samsung,pin-function = <3>;
579 samsung,pin-pud = <0>;
580 samsung,pin-drv = <0>;
581 };
582
583 i2s2_bus: i2s2-bus {
584 samsung,pins = "gpb1-0", "gpb1-1", "gpb1-2", "gpb1-3",
585 "gpb1-4";
586 samsung,pin-function = <2>;
587 samsung,pin-pud = <0>;
588 samsung,pin-drv = <0>;
589 };
590
591 pcm2_bus: pcm2-bus {
592 samsung,pins = "gpb1-0", "gpb1-1", "gpb1-2", "gpb1-3",
593 "gpb1-4";
594 samsung,pin-function = <3>;
595 samsung,pin-pud = <0>;
596 samsung,pin-drv = <0>;
597 };
598
599 spdif_bus: spdif-bus {
600 samsung,pins = "gpb1-0", "gpb1-1";
601 samsung,pin-function = <4>;
602 samsung,pin-pud = <0>;
603 samsung,pin-drv = <0>;
604 };
605
606 spi2_bus: spi2-bus {
607 samsung,pins = "gpb1-1", "gpb1-3", "gpb1-4";
608 samsung,pin-function = <5>;
609 samsung,pin-pud = <3>;
610 samsung,pin-drv = <0>;
611 };
612
613 i2c6_hs_bus: i2c6-hs-bus {
614 samsung,pins = "gpb1-3", "gpb1-4";
615 samsung,pin-function = <4>;
616 samsung,pin-pud = <3>;
617 samsung,pin-drv = <0>;
618 };
619
620 i2c7_hs_bus: i2c7-hs-bus {
621 samsung,pins = "gpb2-2", "gpb2-3";
622 samsung,pin-function = <3>;
623 samsung,pin-pud = <3>;
624 samsung,pin-drv = <0>;
625 };
626
627 i2c0_bus: i2c0-bus {
628 samsung,pins = "gpb3-0", "gpb3-1";
629 samsung,pin-function = <2>;
630 samsung,pin-pud = <3>;
631 samsung,pin-drv = <0>;
632 };
633
634 i2c1_bus: i2c1-bus {
635 samsung,pins = "gpb3-2", "gpb3-3";
636 samsung,pin-function = <2>;
637 samsung,pin-pud = <3>;
638 samsung,pin-drv = <0>;
639 };
640
641 i2c8_hs_bus: i2c8-hs-bus {
642 samsung,pins = "gpb3-4", "gpb3-5";
643 samsung,pin-function = <2>;
644 samsung,pin-pud = <3>;
645 samsung,pin-drv = <0>;
646 };
647
648 i2c9_hs_bus: i2c9-hs-bus {
649 samsung,pins = "gpb3-6", "gpb3-7";
650 samsung,pin-function = <2>;
651 samsung,pin-pud = <3>;
652 samsung,pin-drv = <0>;
653 };
654
655 i2c10_hs_bus: i2c10-hs-bus {
656 samsung,pins = "gpb4-0", "gpb4-1";
657 samsung,pin-function = <2>;
658 samsung,pin-pud = <3>;
659 samsung,pin-drv = <0>;
660 };
661 };
662
663 pinctrl@03860000 {
664 gpz: gpz {
665 gpio-controller;
666 #gpio-cells = <2>;
667
668 interrupt-controller;
669 #interrupt-cells = <2>;
670 };
671
672 i2s0_bus: i2s0-bus {
673 samsung,pins = "gpz-0", "gpz-1", "gpz-2", "gpz-3",
674 "gpz-4", "gpz-5", "gpz-6";
675 samsung,pin-function = <2>;
676 samsung,pin-pud = <0>;
677 samsung,pin-drv = <0>;
678 };
679 };
680};
diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts
new file mode 100644
index 000000000000..08607df6a180
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts
@@ -0,0 +1,33 @@
1/*
2 * SAMSUNG SMDK5420 board device tree source
3 *
4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12/dts-v1/;
13#include "exynos5420.dtsi"
14
15/ {
16 model = "Samsung SMDK5420 board based on EXYNOS5420";
17 compatible = "samsung,smdk5420", "samsung,exynos5420";
18
19 memory {
20 reg = <0x20000000 0x80000000>;
21 };
22
23 chosen {
24 bootargs = "console=ttySAC2,115200 init=/linuxrc";
25 };
26
27 fixed-rate-clocks {
28 oscclk {
29 compatible = "samsung,exynos5420-oscclk";
30 clock-frequency = <24000000>;
31 };
32 };
33};
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
new file mode 100644
index 000000000000..8c54c4b74f0e
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -0,0 +1,148 @@
1/*
2 * SAMSUNG EXYNOS5420 SoC device tree source
3 *
4 * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * SAMSUNG EXYNOS54200 SoC device nodes are listed in this file.
8 * EXYNOS5420 based board files can include this file and provide
9 * values for board specfic bindings.
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 "exynos5.dtsi"
17/include/ "exynos5420-pinctrl.dtsi"
18/ {
19 compatible = "samsung,exynos5420";
20
21 aliases {
22 pinctrl0 = &pinctrl_0;
23 pinctrl1 = &pinctrl_1;
24 pinctrl2 = &pinctrl_2;
25 pinctrl3 = &pinctrl_3;
26 pinctrl4 = &pinctrl_4;
27 };
28
29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
32
33 cpu0: cpu@0 {
34 device_type = "cpu";
35 compatible = "arm,cortex-a15";
36 reg = <0x0>;
37 clock-frequency = <1800000000>;
38 };
39
40 cpu1: cpu@1 {
41 device_type = "cpu";
42 compatible = "arm,cortex-a15";
43 reg = <0x1>;
44 clock-frequency = <1800000000>;
45 };
46
47 cpu2: cpu@2 {
48 device_type = "cpu";
49 compatible = "arm,cortex-a15";
50 reg = <0x2>;
51 clock-frequency = <1800000000>;
52 };
53
54 cpu3: cpu@3 {
55 device_type = "cpu";
56 compatible = "arm,cortex-a15";
57 reg = <0x3>;
58 clock-frequency = <1800000000>;
59 };
60 };
61
62 clock: clock-controller@0x10010000 {
63 compatible = "samsung,exynos5420-clock";
64 reg = <0x10010000 0x30000>;
65 #clock-cells = <1>;
66 };
67
68 mct@101C0000 {
69 compatible = "samsung,exynos4210-mct";
70 reg = <0x101C0000 0x800>;
71 interrupt-controller;
72 #interrups-cells = <1>;
73 interrupt-parent = <&mct_map>;
74 interrupts = <0>, <1>, <2>, <3>, <4>, <5>, <6>, <7>;
75 clocks = <&clock 1>, <&clock 315>;
76 clock-names = "fin_pll", "mct";
77
78 mct_map: mct-map {
79 #interrupt-cells = <1>;
80 #address-cells = <0>;
81 #size-cells = <0>;
82 interrupt-map = <0 &combiner 23 3>,
83 <1 &combiner 23 4>,
84 <2 &combiner 25 2>,
85 <3 &combiner 25 3>,
86 <4 &gic 0 120 0>,
87 <5 &gic 0 121 0>,
88 <6 &gic 0 122 0>,
89 <7 &gic 0 123 0>;
90 };
91 };
92
93 pinctrl_0: pinctrl@13400000 {
94 compatible = "samsung,exynos5420-pinctrl";
95 reg = <0x13400000 0x1000>;
96 interrupts = <0 45 0>;
97
98 wakeup-interrupt-controller {
99 compatible = "samsung,exynos4210-wakeup-eint";
100 interrupt-parent = <&gic>;
101 interrupts = <0 32 0>;
102 };
103 };
104
105 pinctrl_1: pinctrl@13410000 {
106 compatible = "samsung,exynos5420-pinctrl";
107 reg = <0x13410000 0x1000>;
108 interrupts = <0 78 0>;
109 };
110
111 pinctrl_2: pinctrl@14000000 {
112 compatible = "samsung,exynos5420-pinctrl";
113 reg = <0x14000000 0x1000>;
114 interrupts = <0 46 0>;
115 };
116
117 pinctrl_3: pinctrl@14010000 {
118 compatible = "samsung,exynos5420-pinctrl";
119 reg = <0x14010000 0x1000>;
120 interrupts = <0 50 0>;
121 };
122
123 pinctrl_4: pinctrl@03860000 {
124 compatible = "samsung,exynos5420-pinctrl";
125 reg = <0x03860000 0x1000>;
126 interrupts = <0 47 0>;
127 };
128
129 serial@12C00000 {
130 clocks = <&clock 257>, <&clock 128>;
131 clock-names = "uart", "clk_uart_baud0";
132 };
133
134 serial@12C10000 {
135 clocks = <&clock 258>, <&clock 129>;
136 clock-names = "uart", "clk_uart_baud0";
137 };
138
139 serial@12C20000 {
140 clocks = <&clock 259>, <&clock 130>;
141 clock-names = "uart", "clk_uart_baud0";
142 };
143
144 serial@12C30000 {
145 clocks = <&clock 260>, <&clock 131>;
146 clock-names = "uart", "clk_uart_baud0";
147 };
148};
diff --git a/arch/arm/boot/dts/exynos5440-sd5v1.dts b/arch/arm/boot/dts/exynos5440-sd5v1.dts
index ef747b52b674..5b22508050da 100644
--- a/arch/arm/boot/dts/exynos5440-sd5v1.dts
+++ b/arch/arm/boot/dts/exynos5440-sd5v1.dts
@@ -10,14 +10,14 @@
10*/ 10*/
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "exynos5440.dtsi" 13#include "exynos5440.dtsi"
14 14
15/ { 15/ {
16 model = "SAMSUNG SD5v1 board based on EXYNOS5440"; 16 model = "SAMSUNG SD5v1 board based on EXYNOS5440";
17 compatible = "samsung,sd5v1", "samsung,exynos5440"; 17 compatible = "samsung,sd5v1", "samsung,exynos5440";
18 18
19 chosen { 19 chosen {
20 bootargs = "root=/dev/sda2 rw rootwait ignore_loglevel early_printk no_console_suspend mem=2048M@0x80000000 console=ttySAC0,115200"; 20 bootargs = "root=/dev/sda2 rw rootwait ignore_loglevel early_printk no_console_suspend mem=2048M@0x80000000 mem=6144M@0x100000000 console=ttySAC0,115200";
21 }; 21 };
22 22
23 fixed-rate-clocks { 23 fixed-rate-clocks {
diff --git a/arch/arm/boot/dts/exynos5440-ssdk5440.dts b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
index d55042beb5c5..ede772741f81 100644
--- a/arch/arm/boot/dts/exynos5440-ssdk5440.dts
+++ b/arch/arm/boot/dts/exynos5440-ssdk5440.dts
@@ -10,18 +10,53 @@
10*/ 10*/
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "exynos5440.dtsi" 13#include "exynos5440.dtsi"
14 14
15/ { 15/ {
16 model = "SAMSUNG SSDK5440 board based on EXYNOS5440"; 16 model = "SAMSUNG SSDK5440 board based on EXYNOS5440";
17 compatible = "samsung,ssdk5440", "samsung,exynos5440"; 17 compatible = "samsung,ssdk5440", "samsung,exynos5440";
18 18
19 chosen { 19 chosen {
20 bootargs = "root=/dev/sda2 rw rootwait ignore_loglevel early_printk no_console_suspend mem=2048M@0x80000000 console=ttySAC0,115200"; 20 bootargs = "root=/dev/sda2 rw rootwait ignore_loglevel early_printk no_console_suspend mem=2048M@0x80000000 mem=6144M@0x100000000 console=ttySAC0,115200";
21 }; 21 };
22 22
23 spi { 23 spi_0: spi@D0000 {
24 status = "disabled"; 24
25 flash: w25q128@0 {
26 #address-cells = <1>;
27 #size-cells = <1>;
28 compatible = "winbond,w25q128";
29 spi-max-frequency = <15625000>;
30 reg = <0>;
31 controller-data {
32 samsung,spi-feedback-delay = <0>;
33 };
34
35 partition@00000 {
36 label = "BootLoader";
37 reg = <0x60000 0x80000>;
38 read-only;
39 };
40
41 partition@e0000 {
42 label = "Recovery-Kernel";
43 reg = <0xe0000 0x300000>;
44 read-only;
45 };
46
47 partition@3e0000 {
48 label = "CRAM-FS";
49 reg = <0x3e0000 0x700000>;
50 read-only;
51 };
52
53 partition@ae0000 {
54 label = "User-Data";
55 reg = <0xae0000 0x520000>;
56 };
57
58 };
59
25 }; 60 };
26 61
27 fixed-rate-clocks { 62 fixed-rate-clocks {
@@ -30,4 +65,12 @@
30 clock-frequency = <50000000>; 65 clock-frequency = <50000000>;
31 }; 66 };
32 }; 67 };
68
69 pcie@290000 {
70 reset-gpio = <&pin_ctrl 5 0>;
71 };
72
73 pcie@2a0000 {
74 reset-gpio = <&pin_ctrl 22 0>;
75 };
33}; 76};
diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index f6b1c8973845..ff7f5d855845 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -9,13 +9,17 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10*/ 10*/
11 11
12/include/ "skeleton.dtsi" 12#include "skeleton.dtsi"
13 13
14/ { 14/ {
15 compatible = "samsung,exynos5440"; 15 compatible = "samsung,exynos5440";
16 16
17 interrupt-parent = <&gic>; 17 interrupt-parent = <&gic>;
18 18
19 aliases {
20 spi0 = &spi_0;
21 };
22
19 clock: clock-controller@0x160000 { 23 clock: clock-controller@0x160000 {
20 compatible = "samsung,exynos5440-clock"; 24 compatible = "samsung,exynos5440-clock";
21 reg = <0x160000 0x1000>; 25 reg = <0x160000 0x1000>;
@@ -38,18 +42,22 @@
38 #size-cells = <0>; 42 #size-cells = <0>;
39 43
40 cpu@0 { 44 cpu@0 {
45 device_type = "cpu";
41 compatible = "arm,cortex-a15"; 46 compatible = "arm,cortex-a15";
42 reg = <0>; 47 reg = <0>;
43 }; 48 };
44 cpu@1 { 49 cpu@1 {
50 device_type = "cpu";
45 compatible = "arm,cortex-a15"; 51 compatible = "arm,cortex-a15";
46 reg = <1>; 52 reg = <1>;
47 }; 53 };
48 cpu@2 { 54 cpu@2 {
55 device_type = "cpu";
49 compatible = "arm,cortex-a15"; 56 compatible = "arm,cortex-a15";
50 reg = <2>; 57 reg = <2>;
51 }; 58 };
52 cpu@3 { 59 cpu@3 {
60 device_type = "cpu";
53 compatible = "arm,cortex-a15"; 61 compatible = "arm,cortex-a15";
54 reg = <3>; 62 reg = <3>;
55 }; 63 };
@@ -79,8 +87,13 @@
79 interrupts = <0 57 0>; 87 interrupts = <0 57 0>;
80 operating-points = < 88 operating-points = <
81 /* KHz uV */ 89 /* KHz uV */
90 1500000 1100000
91 1400000 1075000
92 1300000 1050000
82 1200000 1025000 93 1200000 1025000
94 1100000 1000000
83 1000000 975000 95 1000000 975000
96 900000 950000
84 800000 925000 97 800000 925000
85 >; 98 >;
86 }; 99 };
@@ -101,19 +114,19 @@
101 clock-names = "uart", "clk_uart_baud0"; 114 clock-names = "uart", "clk_uart_baud0";
102 }; 115 };
103 116
104 spi { 117 spi_0: spi@D0000 {
105 compatible = "samsung,exynos4210-spi"; 118 compatible = "samsung,exynos5440-spi";
106 reg = <0xD0000 0x1000>; 119 reg = <0xD0000 0x100>;
107 interrupts = <0 4 0>; 120 interrupts = <0 4 0>;
108 tx-dma-channel = <&pdma0 5>; /* preliminary */
109 rx-dma-channel = <&pdma0 4>; /* preliminary */
110 #address-cells = <1>; 121 #address-cells = <1>;
111 #size-cells = <0>; 122 #size-cells = <0>;
123 samsung,spi-src-clk = <0>;
124 num-cs = <1>;
112 clocks = <&clock 21>, <&clock 16>; 125 clocks = <&clock 21>, <&clock 16>;
113 clock-names = "spi", "spi_busclk0"; 126 clock-names = "spi", "spi_busclk0";
114 }; 127 };
115 128
116 pinctrl { 129 pin_ctrl: pinctrl {
117 compatible = "samsung,exynos5440-pinctrl"; 130 compatible = "samsung,exynos5440-pinctrl";
118 reg = <0xE0000 0x1000>; 131 reg = <0xE0000 0x1000>;
119 interrupts = <0 37 0>, <0 38 0>, <0 39 0>, <0 40 0>, 132 interrupts = <0 37 0>, <0 38 0>, <0 39 0>, <0 40 0>,
@@ -184,28 +197,6 @@
184 compatible = "arm,amba-bus"; 197 compatible = "arm,amba-bus";
185 interrupt-parent = <&gic>; 198 interrupt-parent = <&gic>;
186 ranges; 199 ranges;
187
188 pdma0: pdma@00121000 {
189 compatible = "arm,pl330", "arm,primecell";
190 reg = <0x121000 0x1000>;
191 interrupts = <0 46 0>;
192 clocks = <&clock 8>;
193 clock-names = "apb_pclk";
194 #dma-cells = <1>;
195 #dma-channels = <8>;
196 #dma-requests = <32>;
197 };
198
199 pdma1: pdma@00120000 {
200 compatible = "arm,pl330", "arm,primecell";
201 reg = <0x120000 0x1000>;
202 interrupts = <0 47 0>;
203 clocks = <&clock 8>;
204 clock-names = "apb_pclk";
205 #dma-cells = <1>;
206 #dma-channels = <8>;
207 #dma-requests = <32>;
208 };
209 }; 200 };
210 201
211 rtc { 202 rtc {
@@ -214,6 +205,67 @@
214 interrupts = <0 17 0>, <0 16 0>; 205 interrupts = <0 17 0>, <0 16 0>;
215 clocks = <&clock 21>; 206 clocks = <&clock 21>;
216 clock-names = "rtc"; 207 clock-names = "rtc";
217 status = "disabled"; 208 };
209
210 sata@210000 {
211 compatible = "snps,exynos5440-ahci";
212 reg = <0x210000 0x10000>;
213 interrupts = <0 30 0>;
214 clocks = <&clock 23>;
215 clock-names = "sata";
216 };
217
218 ohci@220000 {
219 compatible = "samsung,exynos5440-ohci";
220 reg = <0x220000 0x1000>;
221 interrupts = <0 29 0>;
222 clocks = <&clock 24>;
223 clock-names = "usbhost";
224 };
225
226 ehci@221000 {
227 compatible = "samsung,exynos5440-ehci";
228 reg = <0x221000 0x1000>;
229 interrupts = <0 29 0>;
230 clocks = <&clock 24>;
231 clock-names = "usbhost";
232 };
233
234 pcie@290000 {
235 compatible = "samsung,exynos5440-pcie", "snps,dw-pcie";
236 reg = <0x290000 0x1000
237 0x270000 0x1000
238 0x271000 0x40>;
239 interrupts = <0 20 0>, <0 21 0>, <0 22 0>;
240 clocks = <&clock 28>, <&clock 27>;
241 clock-names = "pcie", "pcie_bus";
242 #address-cells = <3>;
243 #size-cells = <2>;
244 device_type = "pci";
245 ranges = <0x00000800 0 0x40000000 0x40000000 0 0x00001000 /* configuration space */
246 0x81000000 0 0 0x40001000 0 0x00010000 /* downstream I/O */
247 0x82000000 0 0x40011000 0x40011000 0 0x1ffef000>; /* non-prefetchable memory */
248 #interrupt-cells = <1>;
249 interrupt-map-mask = <0 0 0 0>;
250 interrupt-map = <0x0 0 &gic 53>;
251 };
252
253 pcie@2a0000 {
254 compatible = "samsung,exynos5440-pcie", "snps,dw-pcie";
255 reg = <0x2a0000 0x1000
256 0x272000 0x1000
257 0x271040 0x40>;
258 interrupts = <0 23 0>, <0 24 0>, <0 25 0>;
259 clocks = <&clock 29>, <&clock 27>;
260 clock-names = "pcie", "pcie_bus";
261 #address-cells = <3>;
262 #size-cells = <2>;
263 device_type = "pci";
264 ranges = <0x00000800 0 0x60000000 0x60000000 0 0x00001000 /* configuration space */
265 0x81000000 0 0 0x60001000 0 0x00010000 /* downstream I/O */
266 0x82000000 0 0x60011000 0x60011000 0 0x1ffef000>; /* non-prefetchable memory */
267 #interrupt-cells = <1>;
268 interrupt-map-mask = <0 0 0 0>;
269 interrupt-map = <0x0 0 &gic 56>;
218 }; 270 };
219}; 271};
diff --git a/arch/arm/boot/dts/ge863-pro3.dtsi b/arch/arm/boot/dts/ge863-pro3.dtsi
index 17136fc7a516..230099bb31c8 100644
--- a/arch/arm/boot/dts/ge863-pro3.dtsi
+++ b/arch/arm/boot/dts/ge863-pro3.dtsi
@@ -7,7 +7,7 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9 9
10/include/ "at91sam9260.dtsi" 10#include "at91sam9260.dtsi"
11 11
12/ { 12/ {
13 clocks { 13 clocks {
diff --git a/arch/arm/boot/dts/href.dtsi b/arch/arm/boot/dts/href.dtsi
index c0bc426952ea..9db41b9d8358 100644
--- a/arch/arm/boot/dts/href.dtsi
+++ b/arch/arm/boot/dts/href.dtsi
@@ -9,7 +9,8 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12/include/ "dbx5x0.dtsi" 12#include <dt-bindings/interrupt-controller/irq.h>
13#include "dbx5x0.dtsi"
13 14
14/ { 15/ {
15 memory { 16 memory {
@@ -27,7 +28,7 @@
27 }; 28 };
28 }; 29 };
29 30
30 soc-u9500 { 31 soc {
31 uart@80120000 { 32 uart@80120000 {
32 status = "okay"; 33 status = "okay";
33 }; 34 };
@@ -45,14 +46,14 @@
45 compatible = "tc3589x"; 46 compatible = "tc3589x";
46 reg = <0x42>; 47 reg = <0x42>;
47 interrupt-parent = <&gpio6>; 48 interrupt-parent = <&gpio6>;
48 interrupts = <25 0x1>; 49 interrupts = <25 IRQ_TYPE_EDGE_RISING>;
49 50
50 interrupt-controller; 51 interrupt-controller;
51 #interrupt-cells = <2>; 52 #interrupt-cells = <2>;
52 53
53 tc3589x_gpio: tc3589x_gpio { 54 tc3589x_gpio: tc3589x_gpio {
54 compatible = "tc3589x-gpio"; 55 compatible = "tc3589x-gpio";
55 interrupts = <0 0x1>; 56 interrupts = <0 IRQ_TYPE_EDGE_RISING>;
56 57
57 interrupt-controller; 58 interrupt-controller;
58 #interrupt-cells = <2>; 59 #interrupt-cells = <2>;
@@ -63,17 +64,43 @@
63 }; 64 };
64 65
65 i2c@80128000 { 66 i2c@80128000 {
66 lp5521@0x33 { 67 lp5521@33 {
67 compatible = "lp5521"; 68 compatible = "national,lp5521";
68 reg = <0x33>; 69 reg = <0x33>;
70 label = "lp5521_pri";
71 clock-mode = /bits/ 8 <2>;
72 chan0 {
73 led-cur = /bits/ 8 <0x2f>;
74 max-cur = /bits/ 8 <0x5f>;
75 };
76 chan1 {
77 led-cur = /bits/ 8 <0x2f>;
78 max-cur = /bits/ 8 <0x5f>;
79 };
80 chan2 {
81 led-cur = /bits/ 8 <0x2f>;
82 max-cur = /bits/ 8 <0x5f>;
83 };
69 }; 84 };
70 85 lp5521@34 {
71 lp5521@0x34 { 86 compatible = "national,lp5521";
72 compatible = "lp5521";
73 reg = <0x34>; 87 reg = <0x34>;
88 label = "lp5521_sec";
89 clock-mode = /bits/ 8 <2>;
90 chan0 {
91 led-cur = /bits/ 8 <0x2f>;
92 max-cur = /bits/ 8 <0x5f>;
93 };
94 chan1 {
95 led-cur = /bits/ 8 <0x2f>;
96 max-cur = /bits/ 8 <0x5f>;
97 };
98 chan2 {
99 led-cur = /bits/ 8 <0x2f>;
100 max-cur = /bits/ 8 <0x5f>;
101 };
74 }; 102 };
75 103 bh1780@29 {
76 bh1780@0x29 {
77 compatible = "rohm,bh1780gli"; 104 compatible = "rohm,bh1780gli";
78 reg = <0x33>; 105 reg = <0x33>;
79 }; 106 };
@@ -82,7 +109,7 @@
82 // External Micro SD slot 109 // External Micro SD slot
83 sdi0_per1@80126000 { 110 sdi0_per1@80126000 {
84 arm,primecell-periphid = <0x10480180>; 111 arm,primecell-periphid = <0x10480180>;
85 max-frequency = <50000000>; 112 max-frequency = <100000000>;
86 bus-width = <4>; 113 bus-width = <4>;
87 mmc-cap-sd-highspeed; 114 mmc-cap-sd-highspeed;
88 mmc-cap-mmc-highspeed; 115 mmc-cap-mmc-highspeed;
@@ -97,7 +124,7 @@
97 // WLAN SDIO channel 124 // WLAN SDIO channel
98 sdi1_per2@80118000 { 125 sdi1_per2@80118000 {
99 arm,primecell-periphid = <0x10480180>; 126 arm,primecell-periphid = <0x10480180>;
100 max-frequency = <50000000>; 127 max-frequency = <100000000>;
101 bus-width = <4>; 128 bus-width = <4>;
102 129
103 status = "okay"; 130 status = "okay";
@@ -106,7 +133,7 @@
106 // PoP:ed eMMC 133 // PoP:ed eMMC
107 sdi2_per3@80005000 { 134 sdi2_per3@80005000 {
108 arm,primecell-periphid = <0x10480180>; 135 arm,primecell-periphid = <0x10480180>;
109 max-frequency = <50000000>; 136 max-frequency = <100000000>;
110 bus-width = <8>; 137 bus-width = <8>;
111 mmc-cap-mmc-highspeed; 138 mmc-cap-mmc-highspeed;
112 139
@@ -116,7 +143,7 @@
116 // On-board eMMC 143 // On-board eMMC
117 sdi4_per2@80114000 { 144 sdi4_per2@80114000 {
118 arm,primecell-periphid = <0x10480180>; 145 arm,primecell-periphid = <0x10480180>;
119 max-frequency = <50000000>; 146 max-frequency = <100000000>;
120 bus-width = <8>; 147 bus-width = <8>;
121 mmc-cap-mmc-highspeed; 148 mmc-cap-mmc-highspeed;
122 vmmc-supply = <&ab8500_ldo_aux2_reg>; 149 vmmc-supply = <&ab8500_ldo_aux2_reg>;
@@ -236,7 +263,7 @@
236 regulator-name = "V-MMC-SD"; 263 regulator-name = "V-MMC-SD";
237 }; 264 };
238 265
239 ab8500_ldo_initcore_reg: ab8500_ldo_initcore { 266 ab8500_ldo_intcore_reg: ab8500_ldo_intcore {
240 regulator-name = "V-INTCORE"; 267 regulator-name = "V-INTCORE";
241 }; 268 };
242 269
@@ -256,7 +283,7 @@
256 regulator-name = "V-AMIC1"; 283 regulator-name = "V-AMIC1";
257 }; 284 };
258 285
259 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { 286 ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 {
260 regulator-name = "V-AMIC2"; 287 regulator-name = "V-AMIC2";
261 }; 288 };
262 289
diff --git a/arch/arm/boot/dts/hrefprev60.dts b/arch/arm/boot/dts/hrefprev60.dts
index c2d274815923..c6bb07df2d1d 100644
--- a/arch/arm/boot/dts/hrefprev60.dts
+++ b/arch/arm/boot/dts/hrefprev60.dts
@@ -10,9 +10,9 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "dbx5x0.dtsi" 13#include "dbx5x0.dtsi"
14/include/ "href.dtsi" 14#include "href.dtsi"
15/include/ "stuib.dtsi" 15#include "stuib.dtsi"
16 16
17/ { 17/ {
18 model = "ST-Ericsson HREF (pre-v60) platform with Device Tree"; 18 model = "ST-Ericsson HREF (pre-v60) platform with Device Tree";
@@ -24,7 +24,7 @@
24 }; 24 };
25 }; 25 };
26 26
27 soc-u9500 { 27 soc {
28 prcmu@80157000 { 28 prcmu@80157000 {
29 ab8500@5 { 29 ab8500@5 {
30 ab8500-gpio { 30 ab8500-gpio {
@@ -41,7 +41,7 @@
41 }; 41 };
42 42
43 i2c@80110000 { 43 i2c@80110000 {
44 bu21013_tp@0x5c { 44 bu21013_tp@5c {
45 reset-gpio = <&tc3589x_gpio 13 0x4>; 45 reset-gpio = <&tc3589x_gpio 13 0x4>;
46 }; 46 };
47 }; 47 };
diff --git a/arch/arm/boot/dts/hrefv60plus.dts b/arch/arm/boot/dts/hrefv60plus.dts
index 2b587a74b813..3d580d6447f9 100644
--- a/arch/arm/boot/dts/hrefv60plus.dts
+++ b/arch/arm/boot/dts/hrefv60plus.dts
@@ -10,9 +10,9 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "dbx5x0.dtsi" 13#include "dbx5x0.dtsi"
14/include/ "href.dtsi" 14#include "href.dtsi"
15/include/ "stuib.dtsi" 15#include "stuib.dtsi"
16 16
17/ { 17/ {
18 model = "ST-Ericsson HREF (v60+) platform with Device Tree"; 18 model = "ST-Ericsson HREF (v60+) platform with Device Tree";
@@ -24,7 +24,7 @@
24 }; 24 };
25 }; 25 };
26 26
27 soc-u9500 { 27 soc {
28 i2c@80110000 { 28 i2c@80110000 {
29 bu21013_tp@0x5c { 29 bu21013_tp@0x5c {
30 reset-gpio = <&gpio4 15 0x4>; 30 reset-gpio = <&gpio4 15 0x4>;
@@ -34,7 +34,7 @@
34 // External Micro SD slot 34 // External Micro SD slot
35 sdi0_per1@80126000 { 35 sdi0_per1@80126000 {
36 arm,primecell-periphid = <0x10480180>; 36 arm,primecell-periphid = <0x10480180>;
37 max-frequency = <50000000>; 37 max-frequency = <100000000>;
38 bus-width = <4>; 38 bus-width = <4>;
39 mmc-cap-sd-highspeed; 39 mmc-cap-sd-highspeed;
40 mmc-cap-mmc-highspeed; 40 mmc-cap-mmc-highspeed;
@@ -48,7 +48,7 @@
48 // WLAN SDIO channel 48 // WLAN SDIO channel
49 sdi1_per2@80118000 { 49 sdi1_per2@80118000 {
50 arm,primecell-periphid = <0x10480180>; 50 arm,primecell-periphid = <0x10480180>;
51 max-frequency = <50000000>; 51 max-frequency = <100000000>;
52 bus-width = <4>; 52 bus-width = <4>;
53 53
54 status = "okay"; 54 status = "okay";
@@ -57,7 +57,7 @@
57 // PoP:ed eMMC 57 // PoP:ed eMMC
58 sdi2_per3@80005000 { 58 sdi2_per3@80005000 {
59 arm,primecell-periphid = <0x10480180>; 59 arm,primecell-periphid = <0x10480180>;
60 max-frequency = <50000000>; 60 max-frequency = <100000000>;
61 bus-width = <8>; 61 bus-width = <8>;
62 mmc-cap-mmc-highspeed; 62 mmc-cap-mmc-highspeed;
63 63
@@ -67,7 +67,7 @@
67 // On-board eMMC 67 // On-board eMMC
68 sdi4_per2@80114000 { 68 sdi4_per2@80114000 {
69 arm,primecell-periphid = <0x10480180>; 69 arm,primecell-periphid = <0x10480180>;
70 max-frequency = <50000000>; 70 max-frequency = <100000000>;
71 bus-width = <8>; 71 bus-width = <8>;
72 mmc-cap-mmc-highspeed; 72 mmc-cap-mmc-highspeed;
73 vmmc-supply = <&ab8500_ldo_aux2_reg>; 73 vmmc-supply = <&ab8500_ldo_aux2_reg>;
@@ -172,7 +172,7 @@
172 regulator-name = "V-MMC-SD"; 172 regulator-name = "V-MMC-SD";
173 }; 173 };
174 174
175 ab8500_ldo_initcore_reg: ab8500_ldo_initcore { 175 ab8500_ldo_intcore_reg: ab8500_ldo_intcore {
176 regulator-name = "V-INTCORE"; 176 regulator-name = "V-INTCORE";
177 }; 177 };
178 178
@@ -192,7 +192,7 @@
192 regulator-name = "V-AMIC1"; 192 regulator-name = "V-AMIC1";
193 }; 193 };
194 194
195 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { 195 ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 {
196 regulator-name = "V-AMIC2"; 196 regulator-name = "V-AMIC2";
197 }; 197 };
198 198
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 73fd7d0887b5..587ceef81e45 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -23,8 +23,12 @@
23 }; 23 };
24 24
25 cpus { 25 cpus {
26 cpu@0 { 26 #address-cells = <0>;
27 compatible = "arm,arm926ejs"; 27 #size-cells = <0>;
28
29 cpu {
30 compatible = "arm,arm926ej-s";
31 device_type = "cpu";
28 }; 32 };
29 }; 33 };
30 34
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts b/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
new file mode 100644
index 000000000000..e7ed9786920a
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycore-rdk.dts
@@ -0,0 +1,37 @@
1/*
2 * The code contained herein is licensed under the GNU General Public
3 * License. You may obtain a copy of the GNU General Public License
4 * Version 2 or later at the following locations:
5 *
6 * http://www.opensource.org/licenses/gpl-license.html
7 * http://www.gnu.org/copyleft/gpl.html
8 */
9
10#include "imx27-phytec-phycore-som.dts"
11
12/ {
13 model = "Phytec pcm970";
14 compatible = "phytec,imx27-pcm970", "phytec,imx27-pcm038", "fsl,imx27";
15};
16
17&cspi1 {
18 fsl,spi-num-chipselects = <2>;
19 cs-gpios = <&gpio4 28 0>, <&gpio4 27 0>;
20};
21
22&sdhci2 {
23 bus-width = <4>;
24 cd-gpios = <&gpio3 29 0>;
25 wp-gpios = <&gpio3 28 0>;
26 vmmc-supply = <&vmmc1_reg>;
27 status = "okay";
28};
29
30&uart1 {
31 fsl,uart-has-rtscts;
32};
33
34&uart2 {
35 fsl,uart-has-rtscts;
36 status = "okay";
37};
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore-som.dts b/arch/arm/boot/dts/imx27-phytec-phycore-som.dts
new file mode 100644
index 000000000000..f0105651869d
--- /dev/null
+++ b/arch/arm/boot/dts/imx27-phytec-phycore-som.dts
@@ -0,0 +1,179 @@
1/*
2 * Copyright 2012 Sascha Hauer, Pengutronix
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 = "Phytec pcm038";
17 compatible = "phytec,imx27-pcm038", "fsl,imx27";
18
19 memory {
20 reg = <0x0 0x0>;
21 };
22
23 soc {
24 aipi@10000000 { /* aipi1 */
25 serial@1000a000 {
26 status = "okay";
27 };
28
29 i2c@1001d000 {
30 clock-frequency = <400000>;
31 status = "okay";
32 at24@52 {
33 compatible = "at,24c32";
34 pagesize = <32>;
35 reg = <0x52>;
36 };
37 pcf8563@51 {
38 compatible = "nxp,pcf8563";
39 reg = <0x51>;
40 };
41 lm75@4a {
42 compatible = "national,lm75";
43 reg = <0x4a>;
44 };
45 };
46 };
47
48 aipi@10020000 { /* aipi2 */
49 ethernet@1002b000 {
50 phy-reset-gpios = <&gpio3 30 0>;
51 status = "okay";
52 };
53 };
54 };
55
56 nor_flash@c0000000 {
57 compatible = "cfi-flash";
58 bank-width = <2>;
59 reg = <0xc0000000 0x02000000>;
60 linux,mtd-name = "physmap-flash.0";
61 #address-cells = <1>;
62 #size-cells = <1>;
63 };
64};
65
66&cspi1 {
67 fsl,spi-num-chipselects = <1>;
68 cs-gpios = <&gpio4 28 0>;
69 status = "okay";
70
71 pmic: mc13783@0 {
72 #address-cells = <1>;
73 #size-cells = <0>;
74 compatible = "fsl,mc13783";
75 spi-max-frequency = <20000000>;
76 reg = <0>;
77 interrupt-parent = <&gpio2>;
78 interrupts = <23 0x4>;
79 fsl,mc13xxx-uses-adc;
80 fsl,mc13xxx-uses-rtc;
81
82 regulators {
83 sw1a_reg: sw1a {
84 regulator-min-microvolt = <1200000>;
85 regulator-max-microvolt = <1200000>;
86 regulator-always-on;
87 regulator-boot-on;
88 };
89
90 sw1b_reg: sw1b {
91 regulator-min-microvolt = <1200000>;
92 regulator-max-microvolt = <1200000>;
93 regulator-always-on;
94 regulator-boot-on;
95 };
96
97 sw2a_reg: sw2a {
98 regulator-min-microvolt = <1800000>;
99 regulator-max-microvolt = <1800000>;
100 regulator-always-on;
101 regulator-boot-on;
102 };
103
104 sw2b_reg: sw2b {
105 regulator-min-microvolt = <1800000>;
106 regulator-max-microvolt = <1800000>;
107 regulator-always-on;
108 regulator-boot-on;
109 };
110
111 sw3_reg: sw3 {
112 regulator-min-microvolt = <5000000>;
113 regulator-max-microvolt = <5000000>;
114 regulator-always-on;
115 regulator-boot-on;
116 };
117
118 vaudio_reg: vaudio {
119 regulator-always-on;
120 regulator-boot-on;
121 };
122
123 violo_reg: violo {
124 regulator-min-microvolt = <1800000>;
125 regulator-max-microvolt = <1800000>;
126 regulator-always-on;
127 regulator-boot-on;
128 };
129
130 viohi_reg: viohi {
131 regulator-always-on;
132 regulator-boot-on;
133 };
134
135 vgen_reg: vgen {
136 regulator-min-microvolt = <1500000>;
137 regulator-max-microvolt = <1500000>;
138 regulator-always-on;
139 regulator-boot-on;
140 };
141
142 vcam_reg: vcam {
143 regulator-min-microvolt = <2800000>;
144 regulator-max-microvolt = <2800000>;
145 };
146
147 vrf1_reg: vrf1 {
148 regulator-min-microvolt = <2775000>;
149 regulator-max-microvolt = <2775000>;
150 regulator-always-on;
151 regulator-boot-on;
152 };
153
154 vrf2_reg: vrf2 {
155 regulator-min-microvolt = <2775000>;
156 regulator-max-microvolt = <2775000>;
157 regulator-always-on;
158 regulator-boot-on;
159 };
160
161 vmmc1_reg: vmmc1 {
162 regulator-min-microvolt = <1600000>;
163 regulator-max-microvolt = <3000000>;
164 };
165
166 gpo1_reg: gpo1 { };
167
168 pwgt1spi_reg: pwgt1spi {
169 regulator-always-on;
170 };
171 };
172 };
173};
174
175&nfc {
176 nand-bus-width = <8>;
177 nand-ecc-mode = "hw";
178 status = "okay";
179};
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore.dts b/arch/arm/boot/dts/imx27-phytec-phycore.dts
deleted file mode 100644
index fe64e3a91df0..000000000000
--- a/arch/arm/boot/dts/imx27-phytec-phycore.dts
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Copyright 2012 Sascha Hauer, Pengutronix
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 = "Phytec pcm038";
17 compatible = "phytec,imx27-pcm038", "fsl,imx27";
18
19 memory {
20 reg = <0x0 0x0>;
21 };
22
23 soc {
24 aipi@10000000 { /* aipi1 */
25 serial@1000a000 {
26 fsl,uart-has-rtscts;
27 status = "okay";
28 };
29
30 serial@1000b000 {
31 fsl,uart-has-rtscts;
32 status = "okay";
33 };
34
35 serial@1000c000 {
36 fsl,uart-has-rtscts;
37 status = "okay";
38 };
39
40 i2c@1001d000 {
41 clock-frequency = <400000>;
42 status = "okay";
43 at24@52 {
44 compatible = "at,24c32";
45 pagesize = <32>;
46 reg = <0x52>;
47 };
48 pcf8563@51 {
49 compatible = "nxp,pcf8563";
50 reg = <0x51>;
51 };
52 lm75@4a {
53 compatible = "national,lm75";
54 reg = <0x4a>;
55 };
56 };
57 };
58
59 aipi@10020000 { /* aipi2 */
60 ethernet@1002b000 {
61 status = "okay";
62 };
63 };
64 };
65
66 nor_flash@c0000000 {
67 compatible = "cfi-flash";
68 bank-width = <2>;
69 reg = <0xc0000000 0x02000000>;
70 #address-cells = <1>;
71 #size-cells = <1>;
72 };
73};
74
75&nfc {
76 nand-bus-width = <8>;
77 nand-ecc-mode = "hw";
78 status = "okay";
79};
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 75bd11386516..0695264ddf1b 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -25,6 +25,9 @@
25 gpio3 = &gpio4; 25 gpio3 = &gpio4;
26 gpio4 = &gpio5; 26 gpio4 = &gpio5;
27 gpio5 = &gpio6; 27 gpio5 = &gpio6;
28 spi0 = &cspi1;
29 spi1 = &cspi2;
30 spi2 = &cspi3;
28 }; 31 };
29 32
30 avic: avic-interrupt-controller@e0000000 { 33 avic: avic-interrupt-controller@e0000000 {
@@ -58,6 +61,16 @@
58 reg = <0x10000000 0x20000>; 61 reg = <0x10000000 0x20000>;
59 ranges; 62 ranges;
60 63
64 dma: dma@10001000 {
65 compatible = "fsl,imx27-dma";
66 reg = <0x10001000 0x1000>;
67 interrupts = <32>;
68 clocks = <&clks 50>, <&clks 70>;
69 clock-names = "ipg", "ahb";
70 #dma-cells = <1>;
71 #dma-channels = <16>;
72 };
73
61 wdog: wdog@10002000 { 74 wdog: wdog@10002000 {
62 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt"; 75 compatible = "fsl,imx27-wdt", "fsl,imx21-wdt";
63 reg = <0x10002000 0x1000>; 76 reg = <0x10002000 0x1000>;
@@ -89,6 +102,14 @@
89 clock-names = "ipg", "per"; 102 clock-names = "ipg", "per";
90 }; 103 };
91 104
105 pwm0: pwm@10006000 {
106 compatible = "fsl,imx27-pwm";
107 reg = <0x10006000 0x1000>;
108 interrupts = <23>;
109 clocks = <&clks 34>, <&clks 61>;
110 clock-names = "ipg", "per";
111 };
112
92 uart1: serial@1000a000 { 113 uart1: serial@1000a000 {
93 compatible = "fsl,imx27-uart", "fsl,imx21-uart"; 114 compatible = "fsl,imx27-uart", "fsl,imx21-uart";
94 reg = <0x1000a000 0x1000>; 115 reg = <0x1000a000 0x1000>;
@@ -157,6 +178,28 @@
157 status = "disabled"; 178 status = "disabled";
158 }; 179 };
159 180
181 sdhci1: sdhci@10013000 {
182 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc";
183 reg = <0x10013000 0x1000>;
184 interrupts = <11>;
185 clocks = <&clks 30>, <&clks 60>;
186 clock-names = "ipg", "per";
187 dmas = <&dma 7>;
188 dma-names = "rx-tx";
189 status = "disabled";
190 };
191
192 sdhci2: sdhci@10014000 {
193 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc";
194 reg = <0x10014000 0x1000>;
195 interrupts = <10>;
196 clocks = <&clks 29>, <&clks 60>;
197 clock-names = "ipg", "per";
198 dmas = <&dma 6>;
199 dma-names = "rx-tx";
200 status = "disabled";
201 };
202
160 gpio1: gpio@10015000 { 203 gpio1: gpio@10015000 {
161 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio"; 204 compatible = "fsl,imx27-gpio", "fsl,imx21-gpio";
162 reg = <0x10015000 0x100>; 205 reg = <0x10015000 0x100>;
@@ -272,6 +315,17 @@
272 status = "disabled"; 315 status = "disabled";
273 }; 316 };
274 317
318 sdhci3: sdhci@1001e000 {
319 compatible = "fsl,imx27-mmc", "fsl,imx21-mmc";
320 reg = <0x1001e000 0x1000>;
321 interrupts = <9>;
322 clocks = <&clks 28>, <&clks 60>;
323 clock-names = "ipg", "per";
324 dmas = <&dma 36>;
325 dma-names = "rx-tx";
326 status = "disabled";
327 };
328
275 gpt6: timer@1001f000 { 329 gpt6: timer@1001f000 {
276 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 330 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt";
277 reg = <0x1001f000 0x1000>; 331 reg = <0x1001f000 0x1000>;
@@ -288,6 +342,21 @@
288 reg = <0x10020000 0x20000>; 342 reg = <0x10020000 0x20000>;
289 ranges; 343 ranges;
290 344
345 coda: coda@10023000 {
346 compatible = "fsl,imx27-vpu";
347 reg = <0x10023000 0x0200>;
348 interrupts = <53>;
349 clocks = <&clks 57>, <&clks 66>;
350 clock-names = "per", "ahb";
351 iram = <&iram>;
352 };
353
354 clks: ccm@10027000{
355 compatible = "fsl,imx27-ccm";
356 reg = <0x10027000 0x1000>;
357 #clock-cells = <1>;
358 };
359
291 fec: ethernet@1002b000 { 360 fec: ethernet@1002b000 {
292 compatible = "fsl,imx27-fec"; 361 compatible = "fsl,imx27-fec";
293 reg = <0x1002b000 0x4000>; 362 reg = <0x1002b000 0x4000>;
@@ -296,19 +365,16 @@
296 clock-names = "ipg", "ahb", "ptp"; 365 clock-names = "ipg", "ahb", "ptp";
297 status = "disabled"; 366 status = "disabled";
298 }; 367 };
299
300 clks: ccm@10027000{
301 compatible = "fsl,imx27-ccm";
302 reg = <0x10027000 0x1000>;
303 #clock-cells = <1>;
304 };
305 }; 368 };
306 369
370 iram: iram@ffff4c00 {
371 compatible = "mmio-sram";
372 reg = <0xffff4c00 0xb400>;
373 };
307 374
308 nfc: nand@d8000000 { 375 nfc: nand@d8000000 {
309 #address-cells = <1>; 376 #address-cells = <1>;
310 #size-cells = <1>; 377 #size-cells = <1>;
311
312 compatible = "fsl,imx27-nand"; 378 compatible = "fsl,imx27-nand";
313 reg = <0xd8000000 0x1000>; 379 reg = <0xd8000000 0x1000>;
314 interrupts = <29>; 380 interrupts = <29>;
diff --git a/arch/arm/boot/dts/imx28-apf28dev.dts b/arch/arm/boot/dts/imx28-apf28dev.dts
index 3d905d16cbec..b602494c152b 100644
--- a/arch/arm/boot/dts/imx28-apf28dev.dts
+++ b/arch/arm/boot/dts/imx28-apf28dev.dts
@@ -103,6 +103,7 @@
103 103
104 apbx@80040000 { 104 apbx@80040000 {
105 lradc@80050000 { 105 lradc@80050000 {
106 fsl,lradc-touchscreen-wires = <4>;
106 status = "okay"; 107 status = "okay";
107 }; 108 };
108 109
diff --git a/arch/arm/boot/dts/imx28-cfa10036.dts b/arch/arm/boot/dts/imx28-cfa10036.dts
index 1594694532b9..94c4476972c3 100644
--- a/arch/arm/boot/dts/imx28-cfa10036.dts
+++ b/arch/arm/boot/dts/imx28-cfa10036.dts
@@ -45,6 +45,17 @@
45 fsl,voltage = <1>; 45 fsl,voltage = <1>;
46 fsl,pull-up = <0>; 46 fsl,pull-up = <0>;
47 }; 47 };
48
49 usb0_otg_cfa10036: otg-10036@0 {
50 reg = <0>;
51 fsl,pinmux-ids = <
52 0x0142 /* MX28_PAD_GPMI_READY0__USB0_ID */
53 >;
54 fsl,drive-strength = <0>;
55 fsl,voltage = <1>;
56 fsl,pull-up = <0>;
57 };
58
48 }; 59 };
49 60
50 ssp0: ssp@80010000 { 61 ssp0: ssp@80010000 {
@@ -58,12 +69,6 @@
58 }; 69 };
59 70
60 apbx@80040000 { 71 apbx@80040000 {
61 pwm: pwm@80064000 {
62 pinctrl-names = "default";
63 pinctrl-0 = <&pwm4_pins_a>;
64 status = "okay";
65 };
66
67 duart: serial@80074000 { 72 duart: serial@80074000 {
68 pinctrl-names = "default"; 73 pinctrl-names = "default";
69 pinctrl-0 = <&duart_pins_b>; 74 pinctrl-0 = <&duart_pins_b>;
@@ -73,15 +78,30 @@
73 i2c0: i2c@80058000 { 78 i2c0: i2c@80058000 {
74 pinctrl-names = "default"; 79 pinctrl-names = "default";
75 pinctrl-0 = <&i2c0_pins_b>; 80 pinctrl-0 = <&i2c0_pins_b>;
81 clock-frequency = <400000>;
76 status = "okay"; 82 status = "okay";
77 83
78 ssd1307: oled@3c { 84 ssd1306: oled@3c {
79 compatible = "solomon,ssd1307fb-i2c"; 85 compatible = "solomon,ssd1306fb-i2c";
80 reg = <0x3c>; 86 reg = <0x3c>;
81 pwms = <&pwm 4 3000>;
82 reset-gpios = <&gpio2 7 0>; 87 reset-gpios = <&gpio2 7 0>;
88 solomon,height = <32>;
89 solomon,width = <128>;
90 solomon,page-offset = <0>;
83 }; 91 };
84 }; 92 };
93
94 usbphy0: usbphy@8007c000 {
95 status = "okay";
96 };
97 };
98 };
99
100 ahb@80080000 {
101 usb0: usb@80080000 {
102 pinctrl-names = "default";
103 pinctrl-0 = <&usb0_otg_cfa10036>;
104 status = "okay";
85 }; 105 };
86 }; 106 };
87 107
diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 063e62059890..04b2f769ffbd 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -33,7 +33,7 @@
33 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */ 33 0x1163 /* MX28_PAD_LCD_D22__GPIO_1_22 */
34 0x1173 /* MX28_PAD_LCD_D22__GPIO_1_23 */ 34 0x1173 /* MX28_PAD_LCD_D22__GPIO_1_23 */
35 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */ 35 0x2153 /* MX28_PAD_SSP2_D5__GPIO_2_21 */
36 0x3173 /* MX28_PAD_LCD_RESET__GPIO_3_23 */ 36 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
37 >; 37 >;
38 fsl,drive-strength = <0>; 38 fsl,drive-strength = <0>;
39 fsl,voltage = <1>; 39 fsl,voltage = <1>;
@@ -166,8 +166,8 @@
166 166
167 apbx@80040000 { 167 apbx@80040000 {
168 pwm: pwm@80064000 { 168 pwm: pwm@80064000 {
169 pinctrl-names = "default", "default"; 169 pinctrl-names = "default";
170 pinctrl-1 = <&pwm3_pins_b>; 170 pinctrl-0 = <&pwm3_pins_b>;
171 status = "okay"; 171 status = "okay";
172 }; 172 };
173 173
@@ -265,7 +265,7 @@
265 gpio-sck = <&gpio2 16 0>; 265 gpio-sck = <&gpio2 16 0>;
266 gpio-mosi = <&gpio2 17 0>; 266 gpio-mosi = <&gpio2 17 0>;
267 gpio-miso = <&gpio2 18 0>; 267 gpio-miso = <&gpio2 18 0>;
268 cs-gpios = <&gpio3 23 0>; 268 cs-gpios = <&gpio3 5 0>;
269 num-chipselects = <1>; 269 num-chipselects = <1>;
270 #address-cells = <1>; 270 #address-cells = <1>;
271 #size-cells = <0>; 271 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/imx28-cfa10055.dts b/arch/arm/boot/dts/imx28-cfa10055.dts
new file mode 100644
index 000000000000..158111244122
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-cfa10055.dts
@@ -0,0 +1,179 @@
1/*
2 * Copyright 2013 Crystalfontz America, Inc.
3 * Free Electrons
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/*
14 * The CFA-10055 is an expansion board for the CFA-10036 module and
15 * CFA-10037, thus we need to include the CFA-10037 DTS.
16 */
17/include/ "imx28-cfa10037.dts"
18
19/ {
20 model = "Crystalfontz CFA-10055 Board";
21 compatible = "crystalfontz,cfa10055", "crystalfontz,cfa10037", "crystalfontz,cfa10036", "fsl,imx28";
22
23 apb@80000000 {
24 apbh@80000000 {
25 pinctrl@80018000 {
26 pinctrl-names = "default", "default";
27 pinctrl-1 = <&hog_pins_cfa10055
28 &hog_pins_cfa10055_pullup>;
29
30 hog_pins_cfa10055: hog-10055@0 {
31 reg = <0>;
32 fsl,pinmux-ids = <
33 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
34 >;
35 fsl,drive-strength = <0>;
36 fsl,voltage = <1>;
37 fsl,pull-up = <0>;
38 };
39
40 hog_pins_cfa10055_pullup: hog-10055-pullup@0 {
41 reg = <0>;
42 fsl,pinmux-ids = <
43 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
44 >;
45 fsl,drive-strength = <0>;
46 fsl,voltage = <1>;
47 fsl,pull-up = <1>;
48 };
49
50 spi2_pins_cfa10055: spi2-cfa10055@0 {
51 reg = <0>;
52 fsl,pinmux-ids = <
53 0x2103 /* MX28_PAD_SSP2_SCK__GPIO_2_16 */
54 0x2113 /* MX28_PAD_SSP2_CMD__GPIO_2_17 */
55 0x2123 /* MX28_PAD_SSP2_D0__GPIO_2_18 */
56 >;
57 fsl,drive-strength = <1>;
58 fsl,voltage = <1>;
59 fsl,pull-up = <1>;
60 };
61
62 lcdif_18bit_pins_cfa10055: lcdif-18bit@0 {
63 reg = <0>;
64 fsl,pinmux-ids = <
65 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */
66 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */
67 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */
68 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */
69 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */
70 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */
71 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */
72 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */
73 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */
74 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */
75 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */
76 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */
77 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */
78 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */
79 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */
80 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */
81 0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */
82 0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */
83 >;
84 fsl,drive-strength = <0>;
85 fsl,voltage = <1>;
86 fsl,pull-up = <0>;
87 };
88
89 lcdif_pins_cfa10055: lcdif-evk@0 {
90 reg = <0>;
91 fsl,pinmux-ids = <
92 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
93 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
94 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
95 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
96 >;
97 fsl,drive-strength = <0>;
98 fsl,voltage = <1>;
99 fsl,pull-up = <0>;
100 };
101 };
102
103 lcdif@80030000 {
104 pinctrl-names = "default";
105 pinctrl-0 = <&lcdif_18bit_pins_cfa10055
106 &lcdif_pins_cfa10055>;
107 display = <&display>;
108 status = "okay";
109
110 display: display {
111 bits-per-pixel = <32>;
112 bus-width = <18>;
113
114 display-timings {
115 native-mode = <&timing0>;
116 timing0: timing0 {
117 clock-frequency = <9216000>;
118 hactive = <320>;
119 vactive = <480>;
120 hback-porch = <2>;
121 hfront-porch = <2>;
122 vback-porch = <2>;
123 vfront-porch = <2>;
124 hsync-len = <15>;
125 vsync-len = <15>;
126 hsync-active = <0>;
127 vsync-active = <0>;
128 de-active = <1>;
129 pixelclk-active = <1>;
130 };
131 };
132 };
133 };
134 };
135
136 apbx@80040000 {
137 lradc@80050000 {
138 fsl,lradc-touchscreen-wires = <4>;
139 status = "okay";
140 };
141
142 pwm: pwm@80064000 {
143 pinctrl-names = "default";
144 pinctrl-0 = <&pwm3_pins_b>;
145 status = "okay";
146 };
147 };
148 };
149
150 spi2 {
151 compatible = "spi-gpio";
152 pinctrl-names = "default";
153 pinctrl-0 = <&spi2_pins_cfa10055>;
154 status = "okay";
155 gpio-sck = <&gpio2 16 0>;
156 gpio-mosi = <&gpio2 17 0>;
157 gpio-miso = <&gpio2 18 0>;
158 cs-gpios = <&gpio3 5 0>;
159 num-chipselects = <1>;
160 #address-cells = <1>;
161 #size-cells = <0>;
162
163 hx8357: hx8357@0 {
164 compatible = "himax,hx8357b", "himax,hx8357";
165 reg = <0>;
166 spi-max-frequency = <100000>;
167 spi-cpol;
168 spi-cpha;
169 gpios-reset = <&gpio3 30 0>;
170 };
171 };
172
173 backlight {
174 compatible = "pwm-backlight";
175 pwms = <&pwm 3 5000000>;
176 brightness-levels = <0 4 8 16 32 64 128 255>;
177 default-brightness-level = <6>;
178 };
179};
diff --git a/arch/arm/boot/dts/imx28-cfa10057.dts b/arch/arm/boot/dts/imx28-cfa10057.dts
new file mode 100644
index 000000000000..2da713cdb42a
--- /dev/null
+++ b/arch/arm/boot/dts/imx28-cfa10057.dts
@@ -0,0 +1,191 @@
1/*
2 * Copyright 2013 Crystalfontz America, Inc.
3 * Copyright 2012 Free Electrons
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13/*
14 * The CFA-10057 is an expansion board for the CFA-10036 module, thus we
15 * need to include the CFA-10036 DTS.
16 */
17/include/ "imx28-cfa10036.dts"
18
19/ {
20 model = "Crystalfontz CFA-10057 Board";
21 compatible = "crystalfontz,cfa10057", "crystalfontz,cfa10036", "fsl,imx28";
22
23 apb@80000000 {
24 apbh@80000000 {
25 pinctrl@80018000 {
26 pinctrl-names = "default", "default";
27 pinctrl-1 = <&hog_pins_cfa10057
28 &hog_pins_cfa10057_pullup>;
29
30 hog_pins_cfa10057: hog-10057@0 {
31 reg = <0>;
32 fsl,pinmux-ids = <
33 0x0073 /* MX28_PAD_GPMI_D7__GPIO_0_7 */
34 0x3053 /* MX28_PAD_AUART1_TX__GPIO_3_5 */
35 >;
36 fsl,drive-strength = <0>;
37 fsl,voltage = <1>;
38 fsl,pull-up = <0>;
39 };
40
41 hog_pins_cfa10057_pullup: hog-10057-pullup@0 {
42 reg = <0>;
43 fsl,pinmux-ids = <
44 0x2133 /* MX28_PAD_SSP2_D3__GPIO_2_19 */
45 0x3183 /* MX28_PAD_I2C0_SCL__GPIO_3_24 */
46 0x3193 /* MX28_PAD_I2C0_SDA__GPIO_3_25 */
47 0x31a3 /* MX28_PAD_SAIF_SDATA0__GPIO_3_26 */
48 0x31e3 /* MX28_PAD_LCD_RESET__GPIO_3_30 */
49 >;
50 fsl,drive-strength = <0>;
51 fsl,voltage = <1>;
52 fsl,pull-up = <1>;
53 };
54
55 lcdif_18bit_pins_cfa10057: lcdif-18bit@0 {
56 reg = <0>;
57 fsl,pinmux-ids = <
58 0x1000 /* MX28_PAD_LCD_D00__LCD_D0 */
59 0x1010 /* MX28_PAD_LCD_D01__LCD_D1 */
60 0x1020 /* MX28_PAD_LCD_D02__LCD_D2 */
61 0x1030 /* MX28_PAD_LCD_D03__LCD_D3 */
62 0x1040 /* MX28_PAD_LCD_D04__LCD_D4 */
63 0x1050 /* MX28_PAD_LCD_D05__LCD_D5 */
64 0x1060 /* MX28_PAD_LCD_D06__LCD_D6 */
65 0x1070 /* MX28_PAD_LCD_D07__LCD_D7 */
66 0x1080 /* MX28_PAD_LCD_D08__LCD_D8 */
67 0x1090 /* MX28_PAD_LCD_D09__LCD_D9 */
68 0x10a0 /* MX28_PAD_LCD_D10__LCD_D10 */
69 0x10b0 /* MX28_PAD_LCD_D11__LCD_D11 */
70 0x10c0 /* MX28_PAD_LCD_D12__LCD_D12 */
71 0x10d0 /* MX28_PAD_LCD_D13__LCD_D13 */
72 0x10e0 /* MX28_PAD_LCD_D14__LCD_D14 */
73 0x10f0 /* MX28_PAD_LCD_D15__LCD_D15 */
74 0x1100 /* MX28_PAD_LCD_D16__LCD_D16 */
75 0x1110 /* MX28_PAD_LCD_D17__LCD_D17 */
76 >;
77 fsl,drive-strength = <0>;
78 fsl,voltage = <1>;
79 fsl,pull-up = <0>;
80 };
81
82 lcdif_pins_cfa10057: lcdif-evk@0 {
83 reg = <0>;
84 fsl,pinmux-ids = <
85 0x1181 /* MX28_PAD_LCD_RD_E__LCD_VSYNC */
86 0x1191 /* MX28_PAD_LCD_WR_RWN__LCD_HSYNC */
87 0x11a1 /* MX28_PAD_LCD_RS__LCD_DOTCLK */
88 0x11b1 /* MX28_PAD_LCD_CS__LCD_ENABLE */
89 >;
90 fsl,drive-strength = <0>;
91 fsl,voltage = <1>;
92 fsl,pull-up = <0>;
93 };
94 };
95
96 lcdif@80030000 {
97 pinctrl-names = "default";
98 pinctrl-0 = <&lcdif_18bit_pins_cfa10057
99 &lcdif_pins_cfa10057>;
100 display = <&display>;
101 status = "okay";
102
103 display: display {
104 bits-per-pixel = <32>;
105 bus-width = <18>;
106
107 display-timings {
108 native-mode = <&timing0>;
109 timing0: timing0 {
110 clock-frequency = <30000000>;
111 hactive = <480>;
112 vactive = <800>;
113 hfront-porch = <12>;
114 hback-porch = <2>;
115 vfront-porch = <5>;
116 vback-porch = <3>;
117 hsync-len = <2>;
118 vsync-len = <2>;
119 hsync-active = <0>;
120 vsync-active = <0>;
121 de-active = <1>;
122 pixelclk-active = <1>;
123 };
124 };
125 };
126 };
127 };
128
129 apbx@80040000 {
130 lradc@80050000 {
131 fsl,lradc-touchscreen-wires = <4>;
132 status = "okay";
133 };
134
135 pwm: pwm@80064000 {
136 pinctrl-names = "default";
137 pinctrl-0 = <&pwm3_pins_b>;
138 status = "okay";
139 };
140
141 i2c1: i2c@8005a000 {
142 pinctrl-names = "default";
143 pinctrl-0 = <&i2c1_pins_a>;
144 status = "okay";
145 };
146
147 usbphy1: usbphy@8007e000 {
148 status = "okay";
149 };
150 };
151 };
152
153 ahb@80080000 {
154 usb1: usb@80090000 {
155 vbus-supply = <&reg_usb1_vbus>;
156 pinctrl-0 = <&usbphy1_pins_a>;
157 pinctrl-names = "default";
158 status = "okay";
159 };
160 };
161
162 regulators {
163 compatible = "simple-bus";
164
165 reg_usb1_vbus: usb1_vbus {
166 compatible = "regulator-fixed";
167 regulator-name = "usb1_vbus";
168 regulator-min-microvolt = <5000000>;
169 regulator-max-microvolt = <5000000>;
170 gpio = <&gpio0 7 1>;
171 };
172 };
173
174 ahb@80080000 {
175 mac0: ethernet@800f0000 {
176 phy-mode = "rmii";
177 pinctrl-names = "default";
178 pinctrl-0 = <&mac0_pins_a>;
179 phy-reset-gpios = <&gpio2 21 0>;
180 phy-reset-duration = <100>;
181 status = "okay";
182 };
183 };
184
185 backlight {
186 compatible = "pwm-backlight";
187 pwms = <&pwm 3 5000000>;
188 brightness-levels = <0 4 8 16 32 64 128 255>;
189 default-brightness-level = <7>;
190 };
191};
diff --git a/arch/arm/boot/dts/imx28-m28evk.dts b/arch/arm/boot/dts/imx28-m28evk.dts
index 5aa44e05c9f5..880df2f13be8 100644
--- a/arch/arm/boot/dts/imx28-m28evk.dts
+++ b/arch/arm/boot/dts/imx28-m28evk.dts
@@ -220,7 +220,19 @@
220 220
221 auart0: serial@8006a000 { 221 auart0: serial@8006a000 {
222 pinctrl-names = "default"; 222 pinctrl-names = "default";
223 pinctrl-0 = <&auart0_2pins_a>; 223 pinctrl-0 = <&auart0_pins_a>;
224 status = "okay";
225 };
226
227 auart1: serial@8006c000 {
228 pinctrl-names = "default";
229 pinctrl-0 = <&auart1_pins_a>;
230 status = "okay";
231 };
232
233 auart2: serial@8006e000 {
234 pinctrl-names = "default";
235 pinctrl-0 = <&auart2_2pins_b>;
224 status = "okay"; 236 status = "okay";
225 }; 237 };
226 }; 238 };
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 600f7cb51f3e..6a8acb01b1d3 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -32,8 +32,12 @@
32 }; 32 };
33 33
34 cpus { 34 cpus {
35 cpu@0 { 35 #address-cells = <0>;
36 compatible = "arm,arm926ejs"; 36 #size-cells = <0>;
37
38 cpu {
39 compatible = "arm,arm926ej-s";
40 device_type = "cpu";
37 }; 41 };
38 }; 42 };
39 43
@@ -330,6 +334,17 @@
330 fsl,pull-up = <0>; 334 fsl,pull-up = <0>;
331 }; 335 };
332 336
337 auart2_2pins_b: auart2-2pins@1 {
338 reg = <1>;
339 fsl,pinmux-ids = <
340 0x3080 /* MX28_PAD_AUART2_RX__AUART2_RX */
341 0x3090 /* MX28_PAD_AUART2_TX__AUART2_TX */
342 >;
343 fsl,drive-strength = <0>;
344 fsl,voltage = <1>;
345 fsl,pull-up = <0>;
346 };
347
333 auart3_pins_a: auart3@0 { 348 auart3_pins_a: auart3@0 {
334 reg = <0>; 349 reg = <0>;
335 fsl,pinmux-ids = < 350 fsl,pinmux-ids = <
@@ -354,6 +369,28 @@
354 fsl,pull-up = <0>; 369 fsl,pull-up = <0>;
355 }; 370 };
356 371
372 auart3_2pins_b: auart3-2pins@1 {
373 reg = <1>;
374 fsl,pinmux-ids = <
375 0x30c0 /* MX28_PAD_AUART3_RX__AUART3_RX */
376 0x30d0 /* MX28_PAD_AUART3_TX__AUART3_TX */
377 >;
378 fsl,drive-strength = <0>;
379 fsl,voltage = <1>;
380 fsl,pull-up = <0>;
381 };
382
383 auart4_2pins_a: auart4@0 {
384 reg = <0>;
385 fsl,pinmux-ids = <
386 0x2181 /* MX28_PAD_SSP3_SCK__AUART4_TX */
387 0x2191 /* MX28_PAD_SSP3_MOSI__AUART4_RX */
388 >;
389 fsl,drive-strength = <0>;
390 fsl,voltage = <1>;
391 fsl,pull-up = <0>;
392 };
393
357 mac0_pins_a: mac0@0 { 394 mac0_pins_a: mac0@0 {
358 reg = <0>; 395 reg = <0>;
359 fsl,pinmux-ids = < 396 fsl,pinmux-ids = <
@@ -669,7 +706,7 @@
669 }; 706 };
670 707
671 digctl@8001c000 { 708 digctl@8001c000 {
672 compatible = "fsl,imx28-digctl"; 709 compatible = "fsl,imx28-digctl", "fsl,imx23-digctl";
673 reg = <0x8001c000 0x2000>; 710 reg = <0x8001c000 0x2000>;
674 interrupts = <89>; 711 interrupts = <89>;
675 status = "disabled"; 712 status = "disabled";
@@ -699,7 +736,7 @@
699 dcp@80028000 { 736 dcp@80028000 {
700 reg = <0x80028000 0x2000>; 737 reg = <0x80028000 0x2000>;
701 interrupts = <52 53 54>; 738 interrupts = <52 53 54>;
702 status = "disabled"; 739 compatible = "fsl-dcp";
703 }; 740 };
704 741
705 pxp@8002a000 { 742 pxp@8002a000 {
diff --git a/arch/arm/boot/dts/imx51-apf51.dts b/arch/arm/boot/dts/imx51-apf51.dts
index 2bcf6981d490..8f7f9ac0b989 100644
--- a/arch/arm/boot/dts/imx51-apf51.dts
+++ b/arch/arm/boot/dts/imx51-apf51.dts
@@ -45,6 +45,13 @@
45 status = "okay"; 45 status = "okay";
46}; 46};
47 47
48&nfc {
49 nand-bus-width = <8>;
50 nand-ecc-mode = "hw";
51 nand-on-flash-bbt;
52 status = "okay";
53};
54
48&uart3 { 55&uart3 {
49 pinctrl-names = "default"; 56 pinctrl-names = "default";
50 pinctrl-0 = <&pinctrl_uart3_2>; 57 pinctrl-0 = <&pinctrl_uart3_2>;
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 53fdde69bbf4..25764b505a61 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -175,10 +175,20 @@
175 }; 175 };
176 }; 176 };
177 177
178 usbphy0: usbphy@0 {
179 compatible = "usb-nop-xceiv";
180 clocks = <&clks 124>;
181 clock-names = "main_clk";
182 status = "okay";
183 };
184
178 usbotg: usb@73f80000 { 185 usbotg: usb@73f80000 {
179 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 186 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
180 reg = <0x73f80000 0x0200>; 187 reg = <0x73f80000 0x0200>;
181 interrupts = <18>; 188 interrupts = <18>;
189 clocks = <&clks 108>;
190 fsl,usbmisc = <&usbmisc 0>;
191 fsl,usbphy = <&usbphy0>;
182 status = "disabled"; 192 status = "disabled";
183 }; 193 };
184 194
@@ -186,6 +196,8 @@
186 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 196 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
187 reg = <0x73f80200 0x0200>; 197 reg = <0x73f80200 0x0200>;
188 interrupts = <14>; 198 interrupts = <14>;
199 clocks = <&clks 108>;
200 fsl,usbmisc = <&usbmisc 1>;
189 status = "disabled"; 201 status = "disabled";
190 }; 202 };
191 203
@@ -193,6 +205,8 @@
193 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 205 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
194 reg = <0x73f80400 0x0200>; 206 reg = <0x73f80400 0x0200>;
195 interrupts = <16>; 207 interrupts = <16>;
208 clocks = <&clks 108>;
209 fsl,usbmisc = <&usbmisc 2>;
196 status = "disabled"; 210 status = "disabled";
197 }; 211 };
198 212
@@ -200,9 +214,18 @@
200 compatible = "fsl,imx51-usb", "fsl,imx27-usb"; 214 compatible = "fsl,imx51-usb", "fsl,imx27-usb";
201 reg = <0x73f80600 0x0200>; 215 reg = <0x73f80600 0x0200>;
202 interrupts = <17>; 216 interrupts = <17>;
217 clocks = <&clks 108>;
218 fsl,usbmisc = <&usbmisc 3>;
203 status = "disabled"; 219 status = "disabled";
204 }; 220 };
205 221
222 usbmisc: usbmisc@73f80800 {
223 #index-cells = <1>;
224 compatible = "fsl,imx51-usbmisc";
225 reg = <0x73f80800 0x200>;
226 clocks = <&clks 108>;
227 };
228
206 gpio1: gpio@73f84000 { 229 gpio1: gpio@73f84000 {
207 compatible = "fsl,imx51-gpio", "fsl,imx35-gpio"; 230 compatible = "fsl,imx51-gpio", "fsl,imx35-gpio";
208 reg = <0x73f84000 0x4000>; 231 reg = <0x73f84000 0x4000>;
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts
new file mode 100644
index 000000000000..7d304d02ed38
--- /dev/null
+++ b/arch/arm/boot/dts/imx53-m53evk.dts
@@ -0,0 +1,259 @@
1/*
2 * Copyright (C) 2013 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/dts-v1/;
13#include "imx53.dtsi"
14
15/ {
16 model = "DENX M53EVK";
17 compatible = "denx,imx53-m53evk", "fsl,imx53";
18
19 memory {
20 reg = <0x70000000 0x20000000>;
21 };
22
23 soc {
24 display@di1 {
25 compatible = "fsl,imx-parallel-display";
26 crtcs = <&ipu 1>;
27 interface-pix-fmt = "bgr666";
28 pinctrl-names = "default";
29 pinctrl-0 = <&pinctrl_ipu_disp2_1>;
30
31 display-timings {
32 800x480p60 {
33 native-mode;
34 clock-frequency = <31500000>;
35 hactive = <800>;
36 vactive = <480>;
37 hfront-porch = <40>;
38 hback-porch = <88>;
39 hsync-len = <128>;
40 vback-porch = <33>;
41 vfront-porch = <9>;
42 vsync-len = <3>;
43 vsync-active = <1>;
44 };
45 };
46 };
47 };
48
49 backlight {
50 compatible = "pwm-backlight";
51 pwms = <&pwm1 0 3000>;
52 brightness-levels = <0 4 8 16 32 64 128 255>;
53 default-brightness-level = <6>;
54 };
55
56 leds {
57 compatible = "gpio-leds";
58 pinctrl-names = "default";
59 pinctrl-0 = <&led_pin_gpio>;
60
61 user1 {
62 label = "user1";
63 gpios = <&gpio2 8 0>;
64 linux,default-trigger = "heartbeat";
65 };
66
67 user2 {
68 label = "user2";
69 gpios = <&gpio2 9 0>;
70 linux,default-trigger = "heartbeat";
71 };
72 };
73
74 regulators {
75 compatible = "simple-bus";
76
77 reg_3p2v: 3p2v {
78 compatible = "regulator-fixed";
79 regulator-name = "3P2V";
80 regulator-min-microvolt = <3200000>;
81 regulator-max-microvolt = <3200000>;
82 regulator-always-on;
83 };
84 };
85
86 sound {
87 compatible = "fsl,imx53-m53evk-sgtl5000",
88 "fsl,imx-audio-sgtl5000";
89 model = "imx53-m53evk-sgtl5000";
90 ssi-controller = <&ssi2>;
91 audio-codec = <&sgtl5000>;
92 audio-routing =
93 "MIC_IN", "Mic Jack",
94 "Mic Jack", "Mic Bias",
95 "LINE_IN", "Line In Jack",
96 "Headphone Jack", "HP_OUT",
97 "Ext Spk", "LINE_OUT";
98 mux-int-port = <2>;
99 mux-ext-port = <4>;
100 };
101};
102
103&audmux {
104 pinctrl-names = "default";
105 pinctrl-0 = <&pinctrl_audmux_2>;
106 status = "okay";
107};
108
109&can1 {
110 pinctrl-names = "default";
111 pinctrl-0 = <&pinctrl_can1_3>;
112 status = "okay";
113};
114
115&can2 {
116 pinctrl-names = "default";
117 pinctrl-0 = <&pinctrl_can2_1>;
118 status = "okay";
119};
120
121&esdhc1 {
122 pinctrl-names = "default";
123 pinctrl-0 = <&pinctrl_esdhc1_1>;
124 cd-gpios = <&gpio1 1 0>;
125 wp-gpios = <&gpio1 9 0>;
126 status = "okay";
127};
128
129&fec {
130 pinctrl-names = "default";
131 pinctrl-0 = <&pinctrl_fec_1>;
132 phy-mode = "rmii";
133 status = "okay";
134};
135
136&i2c1 {
137 pinctrl-names = "default";
138 pinctrl-0 = <&pinctrl_i2c1_2>;
139 status = "okay";
140
141 sgtl5000: codec@0a {
142 compatible = "fsl,sgtl5000";
143 reg = <0x0a>;
144 VDDA-supply = <&reg_3p2v>;
145 VDDIO-supply = <&reg_3p2v>;
146 clocks = <&clks 150>;
147 };
148};
149
150&i2c2 {
151 pinctrl-names = "default";
152 pinctrl-0 = <&pinctrl_i2c2_2>;
153 clock-frequency = <400000>;
154 status = "okay";
155
156 stmpe610@41 {
157 compatible = "st,stmpe610";
158 #address-cells = <1>;
159 #size-cells = <0>;
160 reg = <0x41>;
161 id = <0>;
162 blocks = <0x5>;
163 interrupts = <6 0x0>;
164 interrupt-parent = <&gpio7>;
165 irq-trigger = <0x1>;
166
167 stmpe_touchscreen {
168 compatible = "stmpe,ts";
169 reg = <0>;
170 ts,sample-time = <4>;
171 ts,mod-12b = <1>;
172 ts,ref-sel = <0>;
173 ts,adc-freq = <1>;
174 ts,ave-ctrl = <3>;
175 ts,touch-det-delay = <3>;
176 ts,settling = <4>;
177 ts,fraction-z = <7>;
178 ts,i-drive = <1>;
179 };
180 };
181
182 eeprom: eeprom@50 {
183 compatible = "atmel,24c128";
184 reg = <0x50>;
185 pagesize = <32>;
186 };
187
188 rtc: rtc@68 {
189 compatible = "stm,m41t62";
190 reg = <0x68>;
191 };
192};
193
194&i2c3 {
195 pinctrl-names = "default";
196 pinctrl-0 = <&pinctrl_i2c3_1>;
197 status = "okay";
198};
199
200&iomuxc {
201 pinctrl-names = "default";
202 pinctrl-0 = <&pinctrl_hog>;
203
204 hog {
205 pinctrl_hog: hoggrp {
206 fsl,pins = <
207 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000
208 MX53_PAD_EIM_EB3__GPIO2_31 0x80000000
209 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000
210 MX53_PAD_DISP0_DAT8__PWM1_PWMO 0x5
211
212 >;
213 };
214
215 led_pin_gpio: led_gpio@0 {
216 fsl,pins = <
217 MX53_PAD_PATA_DATA8__GPIO2_8 0x80000000
218 MX53_PAD_PATA_DATA9__GPIO2_9 0x80000000
219 >;
220 };
221 };
222};
223
224&nfc {
225 pinctrl-names = "default";
226 pinctrl-0 = <&pinctrl_nand_1>;
227 nand-bus-width = <8>;
228 nand-ecc-mode = "hw";
229 status = "okay";
230};
231
232&pwm1 {
233 pinctrl-names = "default";
234 pinctrl-0 = <&pinctrl_pwm1_1>;
235 status = "okay";
236};
237
238&ssi2 {
239 fsl,mode = "i2s-slave";
240 status = "okay";
241};
242
243&uart1 {
244 pinctrl-names = "default";
245 pinctrl-0 = <&pinctrl_uart1_2>;
246 status = "okay";
247};
248
249&uart2 {
250 pinctrl-names = "default";
251 pinctrl-0 = <&pinctrl_uart2_1>;
252 status = "okay";
253};
254
255&uart3 {
256 pinctrl-names = "default";
257 pinctrl-0 = <&pinctrl_uart3_1>;
258 status = "okay";
259};
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts
index 445a01119cc5..aaa33bc99f78 100644
--- a/arch/arm/boot/dts/imx53-mba53.dts
+++ b/arch/arm/boot/dts/imx53-mba53.dts
@@ -16,27 +16,81 @@
16/ { 16/ {
17 model = "TQ MBa53 starter kit"; 17 model = "TQ MBa53 starter kit";
18 compatible = "tq,mba53", "tq,tqma53", "fsl,imx53"; 18 compatible = "tq,mba53", "tq,tqma53", "fsl,imx53";
19
20 reg_backlight: fixed@0 {
21 compatible = "regulator-fixed";
22 regulator-name = "lcd-supply";
23 gpio = <&gpio2 5 0>;
24 startup-delay-us = <5000>;
25 enable-active-low;
26 };
27
28 backlight {
29 compatible = "pwm-backlight";
30 pwms = <&pwm2 0 50000 0 0>;
31 brightness-levels = <0 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100>;
32 default-brightness-level = <10>;
33 enable-gpios = <&gpio7 7 0>;
34 power-supply = <&reg_backlight>;
35 };
36
37 disp1: display@disp1 {
38 compatible = "fsl,imx-parallel-display";
39 pinctrl-names = "default";
40 pinctrl-0 = <&pinctrl_disp1_1>;
41 crtcs = <&ipu 1>;
42 interface-pix-fmt = "rgb24";
43 status = "disabled";
44 };
45
46 reg_3p2v: 3p2v {
47 compatible = "regulator-fixed";
48 regulator-name = "3P2V";
49 regulator-min-microvolt = <3200000>;
50 regulator-max-microvolt = <3200000>;
51 regulator-always-on;
52 };
53
54 sound {
55 compatible = "tq,imx53-mba53-sgtl5000",
56 "fsl,imx-audio-sgtl5000";
57 model = "imx53-mba53-sgtl5000";
58 ssi-controller = <&ssi2>;
59 audio-codec = <&codec>;
60 audio-routing =
61 "MIC_IN", "Mic Jack",
62 "Mic Jack", "Mic Bias",
63 "Headphone Jack", "HP_OUT";
64 mux-int-port = <2>;
65 mux-ext-port = <5>;
66 };
67};
68
69&ldb {
70 pinctrl-names = "default";
71 pinctrl-0 = <&pinctrl_lvds1_1>;
72 status = "disabled";
19}; 73};
20 74
21&iomuxc { 75&iomuxc {
22 lvds1 { 76 lvds1 {
23 pinctrl_lvds1_1: lvds1-grp1 { 77 pinctrl_lvds1_1: lvds1-grp1 {
24 fsl,pins = < 78 fsl,pins = <
25 MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x10000 79 MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x80000000
26 MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK 0x10000 80 MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK 0x80000000
27 MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2 0x10000 81 MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2 0x80000000
28 MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1 0x10000 82 MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1 0x80000000
29 MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0 0x10000 83 MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0 0x80000000
30 >; 84 >;
31 }; 85 };
32 86
33 pinctrl_lvds1_2: lvds1-grp2 { 87 pinctrl_lvds1_2: lvds1-grp2 {
34 fsl,pins = < 88 fsl,pins = <
35 MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3 0x10000 89 MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3 0x80000000
36 MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2 0x10000 90 MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2 0x80000000
37 MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK 0x10000 91 MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK 0x80000000
38 MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1 0x10000 92 MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1 0x80000000
39 MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0 0x10000 93 MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0 0x80000000
40 >; 94 >;
41 }; 95 };
42 }; 96 };
@@ -44,33 +98,44 @@
44 disp1 { 98 disp1 {
45 pinctrl_disp1_1: disp1-grp1 { 99 pinctrl_disp1_1: disp1-grp1 {
46 fsl,pins = < 100 fsl,pins = <
47 MX53_PAD_EIM_DA10__IPU_DI1_PIN15 0x10000 /* DISP1_DRDY */ 101 MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK 0x80000000 /* DISP1_CLK */
48 MX53_PAD_EIM_D23__IPU_DI1_PIN2 0x10000 /* DISP1_HSYNC */ 102 MX53_PAD_EIM_DA10__IPU_DI1_PIN15 0x80000000 /* DISP1_DRDY */
49 MX53_PAD_EIM_EB3__IPU_DI1_PIN3 0x10000 /* DISP1_VSYNC */ 103 MX53_PAD_EIM_D23__IPU_DI1_PIN2 0x80000000 /* DISP1_HSYNC */
50 MX53_PAD_EIM_D26__IPU_DISP1_DAT_22 0x10000 104 MX53_PAD_EIM_EB3__IPU_DI1_PIN3 0x80000000 /* DISP1_VSYNC */
51 MX53_PAD_EIM_D27__IPU_DISP1_DAT_23 0x10000 105 MX53_PAD_EIM_D26__IPU_DISP1_DAT_22 0x80000000
52 MX53_PAD_EIM_D30__IPU_DISP1_DAT_21 0x10000 106 MX53_PAD_EIM_D27__IPU_DISP1_DAT_23 0x80000000
53 MX53_PAD_EIM_D31__IPU_DISP1_DAT_20 0x10000 107 MX53_PAD_EIM_D30__IPU_DISP1_DAT_21 0x80000000
54 MX53_PAD_EIM_A24__IPU_DISP1_DAT_19 0x10000 108 MX53_PAD_EIM_D31__IPU_DISP1_DAT_20 0x80000000
55 MX53_PAD_EIM_A23__IPU_DISP1_DAT_18 0x10000 109 MX53_PAD_EIM_A24__IPU_DISP1_DAT_19 0x80000000
56 MX53_PAD_EIM_A22__IPU_DISP1_DAT_17 0x10000 110 MX53_PAD_EIM_A23__IPU_DISP1_DAT_18 0x80000000
57 MX53_PAD_EIM_A21__IPU_DISP1_DAT_16 0x10000 111 MX53_PAD_EIM_A22__IPU_DISP1_DAT_17 0x80000000
58 MX53_PAD_EIM_A20__IPU_DISP1_DAT_15 0x10000 112 MX53_PAD_EIM_A21__IPU_DISP1_DAT_16 0x80000000
59 MX53_PAD_EIM_A19__IPU_DISP1_DAT_14 0x10000 113 MX53_PAD_EIM_A20__IPU_DISP1_DAT_15 0x80000000
60 MX53_PAD_EIM_A18__IPU_DISP1_DAT_13 0x10000 114 MX53_PAD_EIM_A19__IPU_DISP1_DAT_14 0x80000000
61 MX53_PAD_EIM_A17__IPU_DISP1_DAT_12 0x10000 115 MX53_PAD_EIM_A18__IPU_DISP1_DAT_13 0x80000000
62 MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11 0x10000 116 MX53_PAD_EIM_A17__IPU_DISP1_DAT_12 0x80000000
63 MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10 0x10000 117 MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11 0x80000000
64 MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9 0x10000 118 MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10 0x80000000
65 MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8 0x10000 119 MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9 0x80000000
66 MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7 0x10000 120 MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8 0x80000000
67 MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6 0x10000 121 MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7 0x80000000
68 MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5 0x10000 122 MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6 0x80000000
69 MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4 0x10000 123 MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5 0x80000000
70 MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3 0x10000 124 MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4 0x80000000
71 MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2 0x10000 125 MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3 0x80000000
72 MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1 0x10000 126 MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2 0x80000000
73 MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0 0x10000 127 MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1 0x80000000
128 MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0 0x80000000
129 >;
130 };
131 };
132
133 tve {
134 pinctrl_vga_sync_1: vgasync-grp1 {
135 fsl,pins = <
136 /* VGA_VSYNC, HSYNC with max drive strength */
137 MX53_PAD_EIM_CS1__IPU_DI1_PIN6 0xe6
138 MX53_PAD_EIM_DA15__IPU_DI1_PIN4 0xe6
74 >; 139 >;
75 }; 140 };
76 }; 141 };
@@ -80,16 +145,27 @@
80 status = "okay"; 145 status = "okay";
81}; 146};
82 147
148&audmux {
149 status = "okay";
150 pinctrl-names = "default";
151 pinctrl-0 = <&pinctrl_audmux_1>;
152};
153
83&i2c2 { 154&i2c2 {
84 codec: sgtl5000@a { 155 codec: sgtl5000@a {
85 compatible = "fsl,sgtl5000"; 156 compatible = "fsl,sgtl5000";
86 reg = <0x0a>; 157 reg = <0x0a>;
158 clocks = <&clks 150>;
159 VDDA-supply = <&reg_3p2v>;
160 VDDIO-supply = <&reg_3p2v>;
87 }; 161 };
88 162
89 expander: pca9554@20 { 163 expander: pca9554@20 {
90 compatible = "pca9554"; 164 compatible = "pca9554";
91 reg = <0x20>; 165 reg = <0x20>;
92 interrupts = <109>; 166 interrupts = <109>;
167 #gpio-cells = <2>;
168 gpio-controller;
93 }; 169 };
94 170
95 sensor2: lm75@49 { 171 sensor2: lm75@49 {
@@ -99,6 +175,7 @@
99}; 175};
100 176
101&fec { 177&fec {
178 phy-reset-gpios = <&gpio7 6 0>;
102 status = "okay"; 179 status = "okay";
103}; 180};
104 181
@@ -114,10 +191,24 @@
114 status = "okay"; 191 status = "okay";
115}; 192};
116 193
194&usbotg {
195 dr_mode = "host";
196 status = "okay";
197};
198
199&usbh1 {
200 status = "okay";
201};
202
117&uart1 { 203&uart1 {
118 status = "okay"; 204 status = "okay";
119}; 205};
120 206
207&ssi2 {
208 fsl,mode = "i2s-slave";
209 status = "okay";
210};
211
121&uart2 { 212&uart2 {
122 status = "okay"; 213 status = "okay";
123}; 214};
@@ -133,3 +224,13 @@
133&i2c3 { 224&i2c3 {
134 status = "okay"; 225 status = "okay";
135}; 226};
227
228&tve {
229 pinctrl-names = "default";
230 pinctrl-0 = <&pinctrl_vga_sync_1>;
231 ddc = <&i2c3>;
232 fsl,tve-mode = "vga";
233 fsl,hsync-pin = <4>;
234 fsl,vsync-pin = <6>;
235 status = "okay";
236};
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dts
index 8f0e9ae0e3e6..512a1f608253 100644
--- a/arch/arm/boot/dts/imx53-qsb.dts
+++ b/arch/arm/boot/dts/imx53-qsb.dts
@@ -21,6 +21,33 @@
21 reg = <0x70000000 0x40000000>; 21 reg = <0x70000000 0x40000000>;
22 }; 22 };
23 23
24 display@di0 {
25 compatible = "fsl,imx-parallel-display";
26 crtcs = <&ipu 0>;
27 interface-pix-fmt = "rgb565";
28 pinctrl-names = "default";
29 pinctrl-0 = <&pinctrl_ipu_disp0_1>;
30 status = "disabled";
31 display-timings {
32 claawvga {
33 native-mode;
34 clock-frequency = <27000000>;
35 hactive = <800>;
36 vactive = <480>;
37 hback-porch = <40>;
38 hfront-porch = <60>;
39 vback-porch = <10>;
40 vfront-porch = <10>;
41 hsync-len = <20>;
42 vsync-len = <10>;
43 hsync-active = <0>;
44 vsync-active = <0>;
45 de-active = <1>;
46 pixelclk-active = <0>;
47 };
48 };
49 };
50
24 gpio-keys { 51 gpio-keys {
25 compatible = "gpio-keys"; 52 compatible = "gpio-keys";
26 53
@@ -147,6 +174,7 @@
147 reg = <0x0a>; 174 reg = <0x0a>;
148 VDDA-supply = <&reg_3p2v>; 175 VDDA-supply = <&reg_3p2v>;
149 VDDIO-supply = <&reg_3p2v>; 176 VDDIO-supply = <&reg_3p2v>;
177 clocks = <&clks 150>;
150 }; 178 };
151}; 179};
152 180
@@ -268,3 +296,11 @@
268 phy-reset-gpios = <&gpio7 6 0>; 296 phy-reset-gpios = <&gpio7 6 0>;
269 status = "okay"; 297 status = "okay";
270}; 298};
299
300&usbh1 {
301 status = "okay";
302};
303
304&usbotg {
305 status = "okay";
306};
diff --git a/arch/arm/boot/dts/imx53-tqma53.dtsi b/arch/arm/boot/dts/imx53-tqma53.dtsi
index 38bed3ed7c1a..abd72af545bf 100644
--- a/arch/arm/boot/dts/imx53-tqma53.dtsi
+++ b/arch/arm/boot/dts/imx53-tqma53.dtsi
@@ -35,7 +35,9 @@
35 35
36&esdhc2 { 36&esdhc2 {
37 pinctrl-names = "default"; 37 pinctrl-names = "default";
38 pinctrl-0 = <&pinctrl_esdhc2_1>; 38 pinctrl-0 = <&pinctrl_esdhc2_1>,
39 <&pinctrl_tqma53_esdhc2_2>;
40 vmmc-supply = <&reg_3p3v>;
39 wp-gpios = <&gpio1 2 0>; 41 wp-gpios = <&gpio1 2 0>;
40 cd-gpios = <&gpio1 4 0>; 42 cd-gpios = <&gpio1 4 0>;
41 status = "disabled"; 43 status = "disabled";
@@ -69,14 +71,22 @@
69 pinctrl-names = "default"; 71 pinctrl-names = "default";
70 pinctrl-0 = <&pinctrl_hog>; 72 pinctrl-0 = <&pinctrl_hog>;
71 73
74 esdhc2_2 {
75 pinctrl_tqma53_esdhc2_2: esdhc2-tqma53-grp2 {
76 fsl,pins = <
77 MX53_PAD_GPIO_4__GPIO1_4 0x80000000 /* SD2_CD */
78 MX53_PAD_GPIO_2__GPIO1_2 0x80000000 /* SD2_WP */
79 >;
80 };
81 };
82
72 i2s { 83 i2s {
73 pinctrl_i2s_1: i2s-grp1 { 84 pinctrl_i2s_1: i2s-grp1 {
74 fsl,pins = < 85 fsl,pins = <
75 MX53_PAD_GPIO_19__GPIO4_5 0x10000 /* I2S_MCLK */ 86 MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC 0x80000000 /* I2S_SCLK */
76 MX53_PAD_KEY_COL0__AUDMUX_AUD5_TXC 0x10000 /* I2S_SCLK */ 87 MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x80000000 /* I2S_DOUT */
77 MX53_PAD_KEY_ROW0__AUDMUX_AUD5_TXD 0x10000 /* I2S_DOUT */ 88 MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x80000000 /* I2S_LRCLK */
78 MX53_PAD_KEY_COL1__AUDMUX_AUD5_TXFS 0x10000 /* I2S_LRCLK */ 89 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x80000000 /* I2S_DIN */
79 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x10000 /* I2S_DIN */
80 >; 90 >;
81 }; 91 };
82 }; 92 };
@@ -84,16 +94,17 @@
84 hog { 94 hog {
85 pinctrl_hog: hoggrp { 95 pinctrl_hog: hoggrp {
86 fsl,pins = < 96 fsl,pins = <
87 MX53_PAD_EIM_CS1__IPU_DI1_PIN6 0x10000 /* VSYNC */ 97 MX53_PAD_GPIO_0__CCM_SSI_EXT1_CLK 0x80000000 /* SSI_MCLK */
88 MX53_PAD_EIM_DA15__IPU_DI1_PIN4 0x10000 /* HSYNC */ 98 MX53_PAD_PATA_DA_1__GPIO7_7 0x80000000 /* LCD_BLT_EN */
89 MX53_PAD_PATA_DA_1__GPIO7_7 0x10000 /* LCD_BLT_EN */ 99 MX53_PAD_PATA_DA_2__GPIO7_8 0x80000000 /* LCD_RESET */
90 MX53_PAD_PATA_DA_2__GPIO7_8 0x10000 /* LCD_RESET */ 100 MX53_PAD_PATA_DATA5__GPIO2_5 0x80000000 /* LCD_POWER */
91 MX53_PAD_PATA_DATA5__GPIO2_5 0x10000 /* LCD_POWER */ 101 MX53_PAD_PATA_DATA6__GPIO2_6 0x80000000 /* PMIC_INT */
92 MX53_PAD_PATA_DATA6__GPIO2_6 0x10000 /* PMIC_INT */ 102 MX53_PAD_PATA_DATA14__GPIO2_14 0x80000000 /* CSI_RST */
93 MX53_PAD_PATA_DATA14__GPIO2_14 0x10000 /* CSI_RST */ 103 MX53_PAD_PATA_DATA15__GPIO2_15 0x80000000 /* CSI_PWDN */
94 MX53_PAD_PATA_DATA15__GPIO2_15 0x10000 /* CSI_PWDN */ 104 MX53_PAD_GPIO_19__GPIO4_5 0x80000000 /* #SYSTEM_DOWN */
95 MX53_PAD_GPIO_0__GPIO1_0 0x10000 /* SYSTEM_DOWN */ 105 MX53_PAD_GPIO_3__GPIO1_3 0x80000000
96 MX53_PAD_GPIO_3__GPIO1_3 0x10000 106 MX53_PAD_PATA_DA_0__GPIO7_6 0x80000000 /* #PHY_RESET */
107 MX53_PAD_GPIO_1__PWM2_PWMO 0x80000000 /* LCD_CONTRAST */
97 >; 108 >;
98 }; 109 };
99 }; 110 };
@@ -149,7 +160,7 @@
149 reg = <0x8>; 160 reg = <0x8>;
150 fsl,mc13xxx-uses-rtc; 161 fsl,mc13xxx-uses-rtc;
151 interrupt-parent = <&gpio2>; 162 interrupt-parent = <&gpio2>;
152 interrupts = <6 8>; /* PDATA_DATA6, low active */ 163 interrupts = <6 4>; /* PATA_DATA6, active high */
153 }; 164 };
154 165
155 sensor1: lm75@48 { 166 sensor1: lm75@48 {
diff --git a/arch/arm/boot/dts/imx53-tx53.dtsi b/arch/arm/boot/dts/imx53-tx53.dtsi
new file mode 100644
index 000000000000..f494766700a3
--- /dev/null
+++ b/arch/arm/boot/dts/imx53-tx53.dtsi
@@ -0,0 +1,122 @@
1/*
2 * Copyright 2013 Steffen Trumtrar <s.trumtrar@pengutronix.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 = "Ka-Ro TX53";
16 compatible = "karo,tx53", "fsl,imx53";
17
18 memory {
19 reg = <0x70000000 0x40000000>; /* Up to 1GiB */
20 };
21
22 regulators {
23 compatible = "simple-bus";
24
25 reg_3p3v: 3p3v {
26 compatible = "regulator-fixed";
27 regulator-name = "3P3V";
28 regulator-min-microvolt = <3300000>;
29 regulator-max-microvolt = <3300000>;
30 regulator-always-on;
31 };
32 };
33};
34
35&can1 {
36 pinctrl-names = "default";
37 pinctrl-0 = <&pinctrl_can1_2>;
38 status = "disabled";
39};
40
41&can2 {
42 pinctrl-names = "default";
43 pinctrl-0 = <&pinctrl_can2_1>;
44 status = "disabled";
45};
46
47&ecspi1 {
48 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_ecspi1_2>;
50 status = "disabled";
51};
52
53&esdhc1 {
54 pinctrl-names = "default";
55 pinctrl-0 = <&pinctrl_esdhc1_2>;
56 status = "disabled";
57};
58
59&esdhc2 {
60 pinctrl-names = "default";
61 pinctrl-0 = <&pinctrl_esdhc2_1>;
62 status = "disabled";
63};
64
65&fec {
66 pinctrl-names = "default";
67 pinctrl-0 = <&pinctrl_fec_1>;
68 phy-mode = "rmii";
69 status = "disabled";
70};
71
72&i2c3 {
73 pinctrl-names = "default";
74 pinctrl-0 = <&pinctrl_i2c3_2>;
75 status = "disabled";
76};
77
78&owire {
79 pinctrl-names = "default";
80 pinctrl-0 = <&pinctrl_owire_1>;
81 status = "disabled";
82};
83
84&pwm2 {
85 pinctrl-names = "default";
86 pinctrl-0 = <&pinctrl_pwm2_1>;
87 status = "disabled";
88};
89
90&ssi1 {
91 pinctrl-names = "default";
92 pinctrl-0 = <&pinctrl_audmux_1>;
93 status = "disabled";
94};
95
96&ssi2 {
97 pinctrl-names = "default";
98 pinctrl-0 = <&pinctrl_audmux_2>;
99 status = "disabled";
100};
101
102&uart1 {
103 pinctrl-names = "default";
104 pinctrl-0 = <&pinctrl_uart1_2>,
105 <&pinctrl_uart1_3>;
106 fsl,uart-has-rtscts;
107 status = "disabled";
108};
109
110&uart2 {
111 pinctrl-names = "default";
112 pinctrl-0 = <&pinctrl_uart2_2>;
113 fsl,uart-has-rtscts;
114 status = "disabled";
115};
116
117&uart3 {
118 pinctrl-names = "default";
119 pinctrl-0 = <&pinctrl_uart3_1>;
120 fsl,uart-has-rtscts;
121 status = "disabled";
122};
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index eb83aa039b8b..3895fbba8fce 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -27,6 +27,9 @@
27 gpio4 = &gpio5; 27 gpio4 = &gpio5;
28 gpio5 = &gpio6; 28 gpio5 = &gpio6;
29 gpio6 = &gpio7; 29 gpio6 = &gpio7;
30 i2c0 = &i2c1;
31 i2c1 = &i2c2;
32 i2c2 = &i2c3;
30 }; 33 };
31 34
32 tzic: tz-interrupt-controller@0fffc000 { 35 tzic: tz-interrupt-controller@0fffc000 {
@@ -163,10 +166,27 @@
163 }; 166 };
164 }; 167 };
165 168
169 usbphy0: usbphy@0 {
170 compatible = "usb-nop-xceiv";
171 clocks = <&clks 124>;
172 clock-names = "main_clk";
173 status = "okay";
174 };
175
176 usbphy1: usbphy@1 {
177 compatible = "usb-nop-xceiv";
178 clocks = <&clks 125>;
179 clock-names = "main_clk";
180 status = "okay";
181 };
182
166 usbotg: usb@53f80000 { 183 usbotg: usb@53f80000 {
167 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 184 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
168 reg = <0x53f80000 0x0200>; 185 reg = <0x53f80000 0x0200>;
169 interrupts = <18>; 186 interrupts = <18>;
187 clocks = <&clks 108>;
188 fsl,usbmisc = <&usbmisc 0>;
189 fsl,usbphy = <&usbphy0>;
170 status = "disabled"; 190 status = "disabled";
171 }; 191 };
172 192
@@ -174,6 +194,9 @@
174 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 194 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
175 reg = <0x53f80200 0x0200>; 195 reg = <0x53f80200 0x0200>;
176 interrupts = <14>; 196 interrupts = <14>;
197 clocks = <&clks 108>;
198 fsl,usbmisc = <&usbmisc 1>;
199 fsl,usbphy = <&usbphy1>;
177 status = "disabled"; 200 status = "disabled";
178 }; 201 };
179 202
@@ -181,6 +204,8 @@
181 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 204 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
182 reg = <0x53f80400 0x0200>; 205 reg = <0x53f80400 0x0200>;
183 interrupts = <16>; 206 interrupts = <16>;
207 clocks = <&clks 108>;
208 fsl,usbmisc = <&usbmisc 2>;
184 status = "disabled"; 209 status = "disabled";
185 }; 210 };
186 211
@@ -188,9 +213,18 @@
188 compatible = "fsl,imx53-usb", "fsl,imx27-usb"; 213 compatible = "fsl,imx53-usb", "fsl,imx27-usb";
189 reg = <0x53f80600 0x0200>; 214 reg = <0x53f80600 0x0200>;
190 interrupts = <17>; 215 interrupts = <17>;
216 clocks = <&clks 108>;
217 fsl,usbmisc = <&usbmisc 3>;
191 status = "disabled"; 218 status = "disabled";
192 }; 219 };
193 220
221 usbmisc: usbmisc@53f80800 {
222 #index-cells = <1>;
223 compatible = "fsl,imx53-usbmisc";
224 reg = <0x53f80800 0x200>;
225 clocks = <&clks 108>;
226 };
227
194 gpio1: gpio@53f84000 { 228 gpio1: gpio@53f84000 {
195 compatible = "fsl,imx53-gpio", "fsl,imx35-gpio"; 229 compatible = "fsl,imx53-gpio", "fsl,imx35-gpio";
196 reg = <0x53f84000 0x4000>; 230 reg = <0x53f84000 0x4000>;
@@ -267,6 +301,24 @@
267 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x80000000 301 MX53_PAD_KEY_ROW1__AUDMUX_AUD5_RXD 0x80000000
268 >; 302 >;
269 }; 303 };
304
305 pinctrl_audmux_2: audmuxgrp-2 {
306 fsl,pins = <
307 MX53_PAD_SD2_DATA3__AUDMUX_AUD4_TXC 0x80000000
308 MX53_PAD_SD2_DATA2__AUDMUX_AUD4_TXD 0x80000000
309 MX53_PAD_SD2_DATA1__AUDMUX_AUD4_TXFS 0x80000000
310 MX53_PAD_SD2_DATA0__AUDMUX_AUD4_RXD 0x80000000
311 >;
312 };
313
314 pinctrl_audmux_3: audmuxgrp-3 {
315 fsl,pins = <
316 MX53_PAD_CSI0_DAT4__AUDMUX_AUD3_TXC 0x80000000
317 MX53_PAD_CSI0_DAT5__AUDMUX_AUD3_TXD 0x80000000
318 MX53_PAD_CSI0_DAT6__AUDMUX_AUD3_TXFS 0x80000000
319 MX53_PAD_CSI0_DAT7__AUDMUX_AUD3_RXD 0x80000000
320 >;
321 };
270 }; 322 };
271 323
272 fec { 324 fec {
@@ -284,6 +336,29 @@
284 MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x80000000 336 MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x80000000
285 >; 337 >;
286 }; 338 };
339
340 pinctrl_fec_2: fecgrp-2 {
341 fsl,pins = <
342 MX53_PAD_FEC_MDC__FEC_MDC 0x80000000
343 MX53_PAD_FEC_MDIO__FEC_MDIO 0x80000000
344 MX53_PAD_FEC_REF_CLK__FEC_TX_CLK 0x80000000
345 MX53_PAD_FEC_RX_ER__FEC_RX_ER 0x80000000
346 MX53_PAD_FEC_CRS_DV__FEC_RX_DV 0x80000000
347 MX53_PAD_FEC_RXD1__FEC_RDATA_1 0x80000000
348 MX53_PAD_FEC_RXD0__FEC_RDATA_0 0x80000000
349 MX53_PAD_FEC_TX_EN__FEC_TX_EN 0x80000000
350 MX53_PAD_FEC_TXD1__FEC_TDATA_1 0x80000000
351 MX53_PAD_FEC_TXD0__FEC_TDATA_0 0x80000000
352 MX53_PAD_KEY_ROW1__FEC_COL 0x80000000
353 MX53_PAD_KEY_COL3__FEC_CRS 0x80000000
354 MX53_PAD_KEY_COL2__FEC_RDATA_2 0x80000000
355 MX53_PAD_KEY_COL0__FEC_RDATA_3 0x80000000
356 MX53_PAD_KEY_COL1__FEC_RX_CLK 0x80000000
357 MX53_PAD_KEY_ROW2__FEC_TDATA_2 0x80000000
358 MX53_PAD_GPIO_19__FEC_TDATA_3 0x80000000
359 MX53_PAD_KEY_ROW0__FEC_TX_ER 0x80000000
360 >;
361 };
287 }; 362 };
288 363
289 csi { 364 csi {
@@ -312,6 +387,22 @@
312 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK 0x1d5 387 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK 0x1d5
313 >; 388 >;
314 }; 389 };
390
391 pinctrl_csi_2: csigrp-2 {
392 fsl,pins = <
393 MX53_PAD_CSI0_VSYNC__IPU_CSI0_VSYNC 0x1d5
394 MX53_PAD_CSI0_MCLK__IPU_CSI0_HSYNC 0x1d5
395 MX53_PAD_CSI0_PIXCLK__IPU_CSI0_PIXCLK 0x1d5
396 MX53_PAD_CSI0_DAT19__IPU_CSI0_D_19 0x1d5
397 MX53_PAD_CSI0_DAT18__IPU_CSI0_D_18 0x1d5
398 MX53_PAD_CSI0_DAT17__IPU_CSI0_D_17 0x1d5
399 MX53_PAD_CSI0_DAT16__IPU_CSI0_D_16 0x1d5
400 MX53_PAD_CSI0_DAT15__IPU_CSI0_D_15 0x1d5
401 MX53_PAD_CSI0_DAT14__IPU_CSI0_D_14 0x1d5
402 MX53_PAD_CSI0_DAT13__IPU_CSI0_D_13 0x1d5
403 MX53_PAD_CSI0_DAT12__IPU_CSI0_D_12 0x1d5
404 >;
405 };
315 }; 406 };
316 407
317 cspi { 408 cspi {
@@ -322,6 +413,14 @@
322 MX53_PAD_SD1_CLK__CSPI_SCLK 0x1d5 413 MX53_PAD_SD1_CLK__CSPI_SCLK 0x1d5
323 >; 414 >;
324 }; 415 };
416
417 pinctrl_cspi_2: cspigrp-2 {
418 fsl,pins = <
419 MX53_PAD_EIM_D22__CSPI_MISO 0x1d5
420 MX53_PAD_EIM_D28__CSPI_MOSI 0x1d5
421 MX53_PAD_EIM_D21__CSPI_SCLK 0x1d5
422 >;
423 };
325 }; 424 };
326 425
327 ecspi1 { 426 ecspi1 {
@@ -332,6 +431,27 @@
332 MX53_PAD_EIM_D18__ECSPI1_MOSI 0x80000000 431 MX53_PAD_EIM_D18__ECSPI1_MOSI 0x80000000
333 >; 432 >;
334 }; 433 };
434
435 pinctrl_ecspi1_2: ecspi1grp-2 {
436 fsl,pins = <
437 MX53_PAD_GPIO_19__ECSPI1_RDY 0x80000000
438 MX53_PAD_EIM_EB2__ECSPI1_SS0 0x80000000
439 MX53_PAD_EIM_D16__ECSPI1_SCLK 0x80000000
440 MX53_PAD_EIM_D17__ECSPI1_MISO 0x80000000
441 MX53_PAD_EIM_D18__ECSPI1_MOSI 0x80000000
442 MX53_PAD_EIM_D19__ECSPI1_SS1 0x80000000
443 >;
444 };
445 };
446
447 ecspi2 {
448 pinctrl_ecspi2_1: ecspi2grp-1 {
449 fsl,pins = <
450 MX53_PAD_EIM_OE__ECSPI2_MISO 0x80000000
451 MX53_PAD_EIM_CS1__ECSPI2_MOSI 0x80000000
452 MX53_PAD_EIM_CS0__ECSPI2_SCLK 0x80000000
453 >;
454 };
335 }; 455 };
336 456
337 esdhc1 { 457 esdhc1 {
@@ -406,6 +526,13 @@
406 MX53_PAD_KEY_ROW2__CAN1_RXCAN 0x80000000 526 MX53_PAD_KEY_ROW2__CAN1_RXCAN 0x80000000
407 >; 527 >;
408 }; 528 };
529
530 pinctrl_can1_3: can1grp-3 {
531 fsl,pins = <
532 MX53_PAD_GPIO_7__CAN1_TXCAN 0x80000000
533 MX53_PAD_GPIO_8__CAN1_RXCAN 0x80000000
534 >;
535 };
409 }; 536 };
410 537
411 can2 { 538 can2 {
@@ -424,6 +551,13 @@
424 MX53_PAD_CSI0_DAT9__I2C1_SCL 0xc0000000 551 MX53_PAD_CSI0_DAT9__I2C1_SCL 0xc0000000
425 >; 552 >;
426 }; 553 };
554
555 pinctrl_i2c1_2: i2c1grp-2 {
556 fsl,pins = <
557 MX53_PAD_EIM_D21__I2C1_SCL 0xc0000000
558 MX53_PAD_EIM_D28__I2C1_SDA 0xc0000000
559 >;
560 };
427 }; 561 };
428 562
429 i2c2 { 563 i2c2 {
@@ -433,6 +567,13 @@
433 MX53_PAD_KEY_COL3__I2C2_SCL 0xc0000000 567 MX53_PAD_KEY_COL3__I2C2_SCL 0xc0000000
434 >; 568 >;
435 }; 569 };
570
571 pinctrl_i2c2_2: i2c2grp-2 {
572 fsl,pins = <
573 MX53_PAD_EIM_D16__I2C2_SDA 0xc0000000
574 MX53_PAD_EIM_EB2__I2C2_SCL 0xc0000000
575 >;
576 };
436 }; 577 };
437 578
438 i2c3 { 579 i2c3 {
@@ -444,6 +585,119 @@
444 }; 585 };
445 }; 586 };
446 587
588 ipu_disp0 {
589 pinctrl_ipu_disp0_1: ipudisp0grp-1 {
590 fsl,pins = <
591 MX53_PAD_DI0_DISP_CLK__IPU_DI0_DISP_CLK 0x5
592 MX53_PAD_DI0_PIN15__IPU_DI0_PIN15 0x5
593 MX53_PAD_DI0_PIN2__IPU_DI0_PIN2 0x5
594 MX53_PAD_DI0_PIN3__IPU_DI0_PIN3 0x5
595 MX53_PAD_DISP0_DAT0__IPU_DISP0_DAT_0 0x5
596 MX53_PAD_DISP0_DAT1__IPU_DISP0_DAT_1 0x5
597 MX53_PAD_DISP0_DAT2__IPU_DISP0_DAT_2 0x5
598 MX53_PAD_DISP0_DAT3__IPU_DISP0_DAT_3 0x5
599 MX53_PAD_DISP0_DAT4__IPU_DISP0_DAT_4 0x5
600 MX53_PAD_DISP0_DAT5__IPU_DISP0_DAT_5 0x5
601 MX53_PAD_DISP0_DAT6__IPU_DISP0_DAT_6 0x5
602 MX53_PAD_DISP0_DAT7__IPU_DISP0_DAT_7 0x5
603 MX53_PAD_DISP0_DAT8__IPU_DISP0_DAT_8 0x5
604 MX53_PAD_DISP0_DAT9__IPU_DISP0_DAT_9 0x5
605 MX53_PAD_DISP0_DAT10__IPU_DISP0_DAT_10 0x5
606 MX53_PAD_DISP0_DAT11__IPU_DISP0_DAT_11 0x5
607 MX53_PAD_DISP0_DAT12__IPU_DISP0_DAT_12 0x5
608 MX53_PAD_DISP0_DAT13__IPU_DISP0_DAT_13 0x5
609 MX53_PAD_DISP0_DAT14__IPU_DISP0_DAT_14 0x5
610 MX53_PAD_DISP0_DAT15__IPU_DISP0_DAT_15 0x5
611 MX53_PAD_DISP0_DAT16__IPU_DISP0_DAT_16 0x5
612 MX53_PAD_DISP0_DAT17__IPU_DISP0_DAT_17 0x5
613 MX53_PAD_DISP0_DAT18__IPU_DISP0_DAT_18 0x5
614 MX53_PAD_DISP0_DAT19__IPU_DISP0_DAT_19 0x5
615 MX53_PAD_DISP0_DAT20__IPU_DISP0_DAT_20 0x5
616 MX53_PAD_DISP0_DAT21__IPU_DISP0_DAT_21 0x5
617 MX53_PAD_DISP0_DAT22__IPU_DISP0_DAT_22 0x5
618 MX53_PAD_DISP0_DAT23__IPU_DISP0_DAT_23 0x5
619 >;
620 };
621 };
622
623 ipu_disp1 {
624 pinctrl_ipu_disp1_1: ipudisp1grp-1 {
625 fsl,pins = <
626 MX53_PAD_EIM_DA9__IPU_DISP1_DAT_0 0x5
627 MX53_PAD_EIM_DA8__IPU_DISP1_DAT_1 0x5
628 MX53_PAD_EIM_DA7__IPU_DISP1_DAT_2 0x5
629 MX53_PAD_EIM_DA6__IPU_DISP1_DAT_3 0x5
630 MX53_PAD_EIM_DA5__IPU_DISP1_DAT_4 0x5
631 MX53_PAD_EIM_DA4__IPU_DISP1_DAT_5 0x5
632 MX53_PAD_EIM_DA3__IPU_DISP1_DAT_6 0x5
633 MX53_PAD_EIM_DA2__IPU_DISP1_DAT_7 0x5
634 MX53_PAD_EIM_DA1__IPU_DISP1_DAT_8 0x5
635 MX53_PAD_EIM_DA0__IPU_DISP1_DAT_9 0x5
636 MX53_PAD_EIM_EB1__IPU_DISP1_DAT_10 0x5
637 MX53_PAD_EIM_EB0__IPU_DISP1_DAT_11 0x5
638 MX53_PAD_EIM_A17__IPU_DISP1_DAT_12 0x5
639 MX53_PAD_EIM_A18__IPU_DISP1_DAT_13 0x5
640 MX53_PAD_EIM_A19__IPU_DISP1_DAT_14 0x5
641 MX53_PAD_EIM_A20__IPU_DISP1_DAT_15 0x5
642 MX53_PAD_EIM_A21__IPU_DISP1_DAT_16 0x5
643 MX53_PAD_EIM_A22__IPU_DISP1_DAT_17 0x5
644 MX53_PAD_EIM_A23__IPU_DISP1_DAT_18 0x5
645 MX53_PAD_EIM_A24__IPU_DISP1_DAT_19 0x5
646 MX53_PAD_EIM_D31__IPU_DISP1_DAT_20 0x5
647 MX53_PAD_EIM_D30__IPU_DISP1_DAT_21 0x5
648 MX53_PAD_EIM_D26__IPU_DISP1_DAT_22 0x5
649 MX53_PAD_EIM_D27__IPU_DISP1_DAT_23 0x5
650 MX53_PAD_EIM_A16__IPU_DI1_DISP_CLK 0x5
651 MX53_PAD_EIM_DA13__IPU_DI1_D0_CS 0x5
652 MX53_PAD_EIM_DA14__IPU_DI1_D1_CS 0x5
653 MX53_PAD_EIM_DA15__IPU_DI1_PIN1 0x5
654 MX53_PAD_EIM_DA11__IPU_DI1_PIN2 0x5
655 MX53_PAD_EIM_DA12__IPU_DI1_PIN3 0x5
656 MX53_PAD_EIM_A25__IPU_DI1_PIN12 0x5
657 MX53_PAD_EIM_DA10__IPU_DI1_PIN15 0x5
658 >;
659 };
660 };
661
662 ipu_disp2 {
663 pinctrl_ipu_disp2_1: ipudisp2grp-1 {
664 fsl,pins = <
665 MX53_PAD_LVDS0_TX0_P__LDB_LVDS0_TX0 0x80000000
666 MX53_PAD_LVDS0_TX1_P__LDB_LVDS0_TX1 0x80000000
667 MX53_PAD_LVDS0_TX2_P__LDB_LVDS0_TX2 0x80000000
668 MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x80000000
669 MX53_PAD_LVDS0_CLK_P__LDB_LVDS0_CLK 0x80000000
670 MX53_PAD_LVDS1_TX0_P__LDB_LVDS1_TX0 0x80000000
671 MX53_PAD_LVDS1_TX1_P__LDB_LVDS1_TX1 0x80000000
672 MX53_PAD_LVDS1_TX2_P__LDB_LVDS1_TX2 0x80000000
673 MX53_PAD_LVDS1_TX3_P__LDB_LVDS1_TX3 0x80000000
674 MX53_PAD_LVDS1_CLK_P__LDB_LVDS1_CLK 0x80000000
675 >;
676 };
677 };
678
679 nand {
680 pinctrl_nand_1: nandgrp-1 {
681 fsl,pins = <
682 MX53_PAD_NANDF_WE_B__EMI_NANDF_WE_B 0x4
683 MX53_PAD_NANDF_RE_B__EMI_NANDF_RE_B 0x4
684 MX53_PAD_NANDF_CLE__EMI_NANDF_CLE 0x4
685 MX53_PAD_NANDF_ALE__EMI_NANDF_ALE 0x4
686 MX53_PAD_NANDF_WP_B__EMI_NANDF_WP_B 0xe0
687 MX53_PAD_NANDF_RB0__EMI_NANDF_RB_0 0xe0
688 MX53_PAD_NANDF_CS0__EMI_NANDF_CS_0 0x4
689 MX53_PAD_PATA_DATA0__EMI_NANDF_D_0 0xa4
690 MX53_PAD_PATA_DATA1__EMI_NANDF_D_1 0xa4
691 MX53_PAD_PATA_DATA2__EMI_NANDF_D_2 0xa4
692 MX53_PAD_PATA_DATA3__EMI_NANDF_D_3 0xa4
693 MX53_PAD_PATA_DATA4__EMI_NANDF_D_4 0xa4
694 MX53_PAD_PATA_DATA5__EMI_NANDF_D_5 0xa4
695 MX53_PAD_PATA_DATA6__EMI_NANDF_D_6 0xa4
696 MX53_PAD_PATA_DATA7__EMI_NANDF_D_7 0xa4
697 >;
698 };
699 };
700
447 owire { 701 owire {
448 pinctrl_owire_1: owiregrp-1 { 702 pinctrl_owire_1: owiregrp-1 {
449 fsl,pins = < 703 fsl,pins = <
@@ -452,6 +706,22 @@
452 }; 706 };
453 }; 707 };
454 708
709 pwm1 {
710 pinctrl_pwm1_1: pwm1grp-1 {
711 fsl,pins = <
712 MX53_PAD_DISP0_DAT8__PWM1_PWMO 0x5
713 >;
714 };
715 };
716
717 pwm2 {
718 pinctrl_pwm2_1: pwm2grp-1 {
719 fsl,pins = <
720 MX53_PAD_GPIO_1__PWM2_PWMO 0x80000000
721 >;
722 };
723 };
724
455 uart1 { 725 uart1 {
456 pinctrl_uart1_1: uart1grp-1 { 726 pinctrl_uart1_1: uart1grp-1 {
457 fsl,pins = < 727 fsl,pins = <
@@ -466,6 +736,13 @@
466 MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x1c5 736 MX53_PAD_PATA_DMACK__UART1_RXD_MUX 0x1c5
467 >; 737 >;
468 }; 738 };
739
740 pinctrl_uart1_3: uart1grp-3 {
741 fsl,pins = <
742 MX53_PAD_PATA_RESET_B__UART1_CTS 0x1c5
743 MX53_PAD_PATA_IORDY__UART1_RTS 0x1c5
744 >;
745 };
469 }; 746 };
470 747
471 uart2 { 748 uart2 {
@@ -475,6 +752,15 @@
475 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1c5 752 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1c5
476 >; 753 >;
477 }; 754 };
755
756 pinctrl_uart2_2: uart2grp-2 {
757 fsl,pins = <
758 MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX 0x1c5
759 MX53_PAD_PATA_DMARQ__UART2_TXD_MUX 0x1c5
760 MX53_PAD_PATA_DIOR__UART2_RTS 0x1c5
761 MX53_PAD_PATA_INTRQ__UART2_CTS 0x1c5
762 >;
763 };
478 }; 764 };
479 765
480 uart3 { 766 uart3 {
@@ -513,7 +799,6 @@
513 >; 799 >;
514 }; 800 };
515 }; 801 };
516
517 }; 802 };
518 803
519 gpr: iomuxc-gpr@53fa8000 { 804 gpr: iomuxc-gpr@53fa8000 {
@@ -781,6 +1066,16 @@
781 clock-names = "ipg", "ahb", "ptp"; 1066 clock-names = "ipg", "ahb", "ptp";
782 status = "disabled"; 1067 status = "disabled";
783 }; 1068 };
1069
1070 tve: tve@63ff0000 {
1071 compatible = "fsl,imx53-tve";
1072 reg = <0x63ff0000 0x1000>;
1073 interrupts = <92>;
1074 clocks = <&clks 69>, <&clks 116>;
1075 clock-names = "tve", "di_sel";
1076 crtcs = <&ipu 1>;
1077 status = "disabled";
1078 };
784 }; 1079 };
785 }; 1080 };
786}; 1081};
diff --git a/arch/arm/boot/dts/imx6dl-sabreauto.dts b/arch/arm/boot/dts/imx6dl-sabreauto.dts
index 7adcec360213..95da71185a4a 100644
--- a/arch/arm/boot/dts/imx6dl-sabreauto.dts
+++ b/arch/arm/boot/dts/imx6dl-sabreauto.dts
@@ -28,4 +28,12 @@
28 >; 28 >;
29 }; 29 };
30 }; 30 };
31
32 ecspi1 {
33 pinctrl_ecspi1_sabreauto: ecspi1-sabreauto {
34 fsl,pins = <
35 MX6DL_PAD_EIM_D19__GPIO3_IO19 0x80000000
36 >;
37 };
38 };
31}; 39};
diff --git a/arch/arm/boot/dts/imx6dl-sabresd.dts b/arch/arm/boot/dts/imx6dl-sabresd.dts
index 7efb05db4783..8989df2b89e5 100644
--- a/arch/arm/boot/dts/imx6dl-sabresd.dts
+++ b/arch/arm/boot/dts/imx6dl-sabresd.dts
@@ -29,6 +29,7 @@
29 MX6DL_PAD_NANDF_D1__GPIO2_IO01 0x80000000 29 MX6DL_PAD_NANDF_D1__GPIO2_IO01 0x80000000
30 MX6DL_PAD_NANDF_D2__GPIO2_IO02 0x80000000 30 MX6DL_PAD_NANDF_D2__GPIO2_IO02 0x80000000
31 MX6DL_PAD_NANDF_D3__GPIO2_IO03 0x80000000 31 MX6DL_PAD_NANDF_D3__GPIO2_IO03 0x80000000
32 MX6DL_PAD_GPIO_0__CCM_CLKO1 0x130b0
32 >; 33 >;
33 }; 34 };
34 }; 35 };
diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi
index 5bcdf3a90bb3..2b3ecd679350 100644
--- a/arch/arm/boot/dts/imx6dl.dtsi
+++ b/arch/arm/boot/dts/imx6dl.dtsi
@@ -18,12 +18,14 @@
18 18
19 cpu@0 { 19 cpu@0 {
20 compatible = "arm,cortex-a9"; 20 compatible = "arm,cortex-a9";
21 device_type = "cpu";
21 reg = <0>; 22 reg = <0>;
22 next-level-cache = <&L2>; 23 next-level-cache = <&L2>;
23 }; 24 };
24 25
25 cpu@1 { 26 cpu@1 {
26 compatible = "arm,cortex-a9"; 27 compatible = "arm,cortex-a9";
28 device_type = "cpu";
27 reg = <1>; 29 reg = <1>;
28 next-level-cache = <&L2>; 30 next-level-cache = <&L2>;
29 }; 31 };
@@ -35,6 +37,27 @@
35 compatible = "fsl,imx6dl-iomuxc"; 37 compatible = "fsl,imx6dl-iomuxc";
36 reg = <0x020e0000 0x4000>; 38 reg = <0x020e0000 0x4000>;
37 39
40 audmux {
41 pinctrl_audmux_2: audmux-2 {
42 fsl,pins = <
43 MX6DL_PAD_CSI0_DAT7__AUD3_RXD 0x80000000
44 MX6DL_PAD_CSI0_DAT4__AUD3_TXC 0x80000000
45 MX6DL_PAD_CSI0_DAT5__AUD3_TXD 0x80000000
46 MX6DL_PAD_CSI0_DAT6__AUD3_TXFS 0x80000000
47 >;
48 };
49 };
50
51 ecspi1 {
52 pinctrl_ecspi1_1: ecspi1grp-1 {
53 fsl,pins = <
54 MX6DL_PAD_EIM_D17__ECSPI1_MISO 0x100b1
55 MX6DL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1
56 MX6DL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1
57 >;
58 };
59 };
60
38 enet { 61 enet {
39 pinctrl_enet_1: enetgrp-1 { 62 pinctrl_enet_1: enetgrp-1 {
40 fsl,pins = < 63 fsl,pins = <
@@ -78,6 +101,39 @@
78 }; 101 };
79 }; 102 };
80 103
104 gpmi-nand {
105 pinctrl_gpmi_nand_1: gpmi-nand-1 {
106 fsl,pins = <
107 MX6DL_PAD_NANDF_CLE__NAND_CLE 0xb0b1
108 MX6DL_PAD_NANDF_ALE__NAND_ALE 0xb0b1
109 MX6DL_PAD_NANDF_WP_B__NAND_WP_B 0xb0b1
110 MX6DL_PAD_NANDF_RB0__NAND_READY_B 0xb000
111 MX6DL_PAD_NANDF_CS0__NAND_CE0_B 0xb0b1
112 MX6DL_PAD_NANDF_CS1__NAND_CE1_B 0xb0b1
113 MX6DL_PAD_SD4_CMD__NAND_RE_B 0xb0b1
114 MX6DL_PAD_SD4_CLK__NAND_WE_B 0xb0b1
115 MX6DL_PAD_NANDF_D0__NAND_DATA00 0xb0b1
116 MX6DL_PAD_NANDF_D1__NAND_DATA01 0xb0b1
117 MX6DL_PAD_NANDF_D2__NAND_DATA02 0xb0b1
118 MX6DL_PAD_NANDF_D3__NAND_DATA03 0xb0b1
119 MX6DL_PAD_NANDF_D4__NAND_DATA04 0xb0b1
120 MX6DL_PAD_NANDF_D5__NAND_DATA05 0xb0b1
121 MX6DL_PAD_NANDF_D6__NAND_DATA06 0xb0b1
122 MX6DL_PAD_NANDF_D7__NAND_DATA07 0xb0b1
123 MX6DL_PAD_SD4_DAT0__NAND_DQS 0x00b1
124 >;
125 };
126 };
127
128 i2c1 {
129 pinctrl_i2c1_2: i2c1grp-2 {
130 fsl,pins = <
131 MX6DL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
132 MX6DL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
133 >;
134 };
135 };
136
81 uart1 { 137 uart1 {
82 pinctrl_uart1_1: uart1grp-1 { 138 pinctrl_uart1_1: uart1grp-1 {
83 fsl,pins = < 139 fsl,pins = <
@@ -149,6 +205,64 @@
149 }; 205 };
150 }; 206 };
151 207
208 weim {
209 pinctrl_weim_cs0_1: weim_cs0grp-1 {
210 fsl,pins = <
211 MX6DL_PAD_EIM_CS0__EIM_CS0_B 0xb0b1
212 >;
213 };
214
215 pinctrl_weim_nor_1: weim_norgrp-1 {
216 fsl,pins = <
217 MX6DL_PAD_EIM_OE__EIM_OE_B 0xb0b1
218 MX6DL_PAD_EIM_RW__EIM_RW 0xb0b1
219 MX6DL_PAD_EIM_WAIT__EIM_WAIT_B 0xb060
220 /* data */
221 MX6DL_PAD_EIM_D16__EIM_DATA16 0x1b0b0
222 MX6DL_PAD_EIM_D17__EIM_DATA17 0x1b0b0
223 MX6DL_PAD_EIM_D18__EIM_DATA18 0x1b0b0
224 MX6DL_PAD_EIM_D19__EIM_DATA19 0x1b0b0
225 MX6DL_PAD_EIM_D20__EIM_DATA20 0x1b0b0
226 MX6DL_PAD_EIM_D21__EIM_DATA21 0x1b0b0
227 MX6DL_PAD_EIM_D22__EIM_DATA22 0x1b0b0
228 MX6DL_PAD_EIM_D23__EIM_DATA23 0x1b0b0
229 MX6DL_PAD_EIM_D24__EIM_DATA24 0x1b0b0
230 MX6DL_PAD_EIM_D25__EIM_DATA25 0x1b0b0
231 MX6DL_PAD_EIM_D26__EIM_DATA26 0x1b0b0
232 MX6DL_PAD_EIM_D27__EIM_DATA27 0x1b0b0
233 MX6DL_PAD_EIM_D28__EIM_DATA28 0x1b0b0
234 MX6DL_PAD_EIM_D29__EIM_DATA29 0x1b0b0
235 MX6DL_PAD_EIM_D30__EIM_DATA30 0x1b0b0
236 MX6DL_PAD_EIM_D31__EIM_DATA31 0x1b0b0
237 /* address */
238 MX6DL_PAD_EIM_A23__EIM_ADDR23 0xb0b1
239 MX6DL_PAD_EIM_A22__EIM_ADDR22 0xb0b1
240 MX6DL_PAD_EIM_A21__EIM_ADDR21 0xb0b1
241 MX6DL_PAD_EIM_A20__EIM_ADDR20 0xb0b1
242 MX6DL_PAD_EIM_A19__EIM_ADDR19 0xb0b1
243 MX6DL_PAD_EIM_A18__EIM_ADDR18 0xb0b1
244 MX6DL_PAD_EIM_A17__EIM_ADDR17 0xb0b1
245 MX6DL_PAD_EIM_A16__EIM_ADDR16 0xb0b1
246 MX6DL_PAD_EIM_DA15__EIM_AD15 0xb0b1
247 MX6DL_PAD_EIM_DA14__EIM_AD14 0xb0b1
248 MX6DL_PAD_EIM_DA13__EIM_AD13 0xb0b1
249 MX6DL_PAD_EIM_DA12__EIM_AD12 0xb0b1
250 MX6DL_PAD_EIM_DA11__EIM_AD11 0xb0b1
251 MX6DL_PAD_EIM_DA10__EIM_AD10 0xb0b1
252 MX6DL_PAD_EIM_DA9__EIM_AD09 0xb0b1
253 MX6DL_PAD_EIM_DA8__EIM_AD08 0xb0b1
254 MX6DL_PAD_EIM_DA7__EIM_AD07 0xb0b1
255 MX6DL_PAD_EIM_DA6__EIM_AD06 0xb0b1
256 MX6DL_PAD_EIM_DA5__EIM_AD05 0xb0b1
257 MX6DL_PAD_EIM_DA4__EIM_AD04 0xb0b1
258 MX6DL_PAD_EIM_DA3__EIM_AD03 0xb0b1
259 MX6DL_PAD_EIM_DA2__EIM_AD02 0xb0b1
260 MX6DL_PAD_EIM_DA1__EIM_AD01 0xb0b1
261 MX6DL_PAD_EIM_DA0__EIM_AD00 0xb0b1
262 >;
263 };
264
265 };
152 266
153 }; 267 };
154 268
diff --git a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
new file mode 100644
index 000000000000..7d37ec60d58d
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
@@ -0,0 +1,34 @@
1/*
2 * Copyright 2013 Christian Hemp, Phytec Messtechnik GmbH
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 "imx6q-phytec-pfla02.dtsi"
14
15/ {
16 model = "Phytec phyFLEX-i.MX6 Quad Carrier-Board";
17 compatible = "phytec,imx6q-pbab01", "phytec,imx6q-pfla02", "fsl,imx6q";
18};
19
20&fec {
21 status = "okay";
22};
23
24&uart4 {
25 status = "okay";
26};
27
28&usdhc2 {
29 status = "okay";
30};
31
32&usdhc3 {
33 status = "okay";
34};
diff --git a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
new file mode 100644
index 000000000000..f5e1981025ed
--- /dev/null
+++ b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
@@ -0,0 +1,74 @@
1/*
2 * Copyright 2013 Christian Hemp, Phytec Messtechnik GmbH
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 "imx6q.dtsi"
13
14/ {
15 model = "Phytec phyFLEX-i.MX6 Ouad";
16 compatible = "phytec,imx6q-pfla02", "fsl,imx6q";
17
18 memory {
19 reg = <0x10000000 0x80000000>;
20 };
21};
22
23&iomuxc {
24 pinctrl-names = "default";
25 pinctrl-0 = <&pinctrl_hog>;
26
27 hog {
28 pinctrl_hog: hoggrp {
29 fsl,pins = <
30 MX6Q_PAD_EIM_D23__GPIO3_IO23 0x80000000
31 >;
32 };
33 };
34
35 pfla02 {
36 pinctrl_usdhc3_pfla02: usdhc3grp-pfla02 {
37 fsl,pins = <
38 MX6Q_PAD_ENET_RXD0__GPIO1_IO27 0x80000000
39 MX6Q_PAD_ENET_TXD1__GPIO1_IO29 0x80000000
40 >;
41 };
42 };
43};
44
45&fec {
46 pinctrl-names = "default";
47 pinctrl-0 = <&pinctrl_enet_3>;
48 phy-mode = "rgmii";
49 phy-reset-gpios = <&gpio3 23 0>;
50 status = "disabled";
51};
52
53&uart4 {
54 pinctrl-names = "default";
55 pinctrl-0 = <&pinctrl_uart4_1>;
56 status = "disabled";
57};
58
59&usdhc2 {
60 pinctrl-names = "default";
61 pinctrl-0 = <&pinctrl_usdhc2_2>;
62 cd-gpios = <&gpio1 4 0>;
63 wp-gpios = <&gpio1 2 0>;
64 status = "disabled";
65};
66
67&usdhc3 {
68 pinctrl-names = "default";
69 pinctrl-0 = <&pinctrl_usdhc3_2
70 &pinctrl_usdhc3_pfla02>;
71 cd-gpios = <&gpio1 27 0>;
72 wp-gpios = <&gpio1 29 0>;
73 status = "disabled";
74};
diff --git a/arch/arm/boot/dts/imx6q-sabreauto.dts b/arch/arm/boot/dts/imx6q-sabreauto.dts
index 49d6f2831ec9..09a75807bc6d 100644
--- a/arch/arm/boot/dts/imx6q-sabreauto.dts
+++ b/arch/arm/boot/dts/imx6q-sabreauto.dts
@@ -32,4 +32,12 @@
32 >; 32 >;
33 }; 33 };
34 }; 34 };
35
36 ecspi1 {
37 pinctrl_ecspi1_sabreauto: ecspi1-sabreauto {
38 fsl,pins = <
39 MX6Q_PAD_EIM_D19__GPIO3_IO19 0x80000000
40 >;
41 };
42 };
35}; 43};
diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dts
index 442051350225..0038228c508c 100644
--- a/arch/arm/boot/dts/imx6q-sabresd.dts
+++ b/arch/arm/boot/dts/imx6q-sabresd.dts
@@ -33,6 +33,7 @@
33 MX6Q_PAD_NANDF_D1__GPIO2_IO01 0x80000000 33 MX6Q_PAD_NANDF_D1__GPIO2_IO01 0x80000000
34 MX6Q_PAD_NANDF_D2__GPIO2_IO02 0x80000000 34 MX6Q_PAD_NANDF_D2__GPIO2_IO02 0x80000000
35 MX6Q_PAD_NANDF_D3__GPIO2_IO03 0x80000000 35 MX6Q_PAD_NANDF_D3__GPIO2_IO03 0x80000000
36 MX6Q_PAD_GPIO_0__CCM_CLKO1 0x130b0
36 >; 37 >;
37 }; 38 };
38 }; 39 };
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 21e675848bd1..ba09dc32324e 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -18,6 +18,7 @@
18 18
19 cpu@0 { 19 cpu@0 {
20 compatible = "arm,cortex-a9"; 20 compatible = "arm,cortex-a9";
21 device_type = "cpu";
21 reg = <0>; 22 reg = <0>;
22 next-level-cache = <&L2>; 23 next-level-cache = <&L2>;
23 operating-points = < 24 operating-points = <
@@ -39,18 +40,21 @@
39 40
40 cpu@1 { 41 cpu@1 {
41 compatible = "arm,cortex-a9"; 42 compatible = "arm,cortex-a9";
43 device_type = "cpu";
42 reg = <1>; 44 reg = <1>;
43 next-level-cache = <&L2>; 45 next-level-cache = <&L2>;
44 }; 46 };
45 47
46 cpu@2 { 48 cpu@2 {
47 compatible = "arm,cortex-a9"; 49 compatible = "arm,cortex-a9";
50 device_type = "cpu";
48 reg = <2>; 51 reg = <2>;
49 next-level-cache = <&L2>; 52 next-level-cache = <&L2>;
50 }; 53 };
51 54
52 cpu@3 { 55 cpu@3 {
53 compatible = "arm,cortex-a9"; 56 compatible = "arm,cortex-a9";
57 device_type = "cpu";
54 reg = <3>; 58 reg = <3>;
55 next-level-cache = <&L2>; 59 next-level-cache = <&L2>;
56 }; 60 };
@@ -157,6 +161,27 @@
157 MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 161 MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
158 >; 162 >;
159 }; 163 };
164
165 pinctrl_enet_3: enetgrp-3 {
166 fsl,pins = <
167 MX6Q_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
168 MX6Q_PAD_ENET_MDC__ENET_MDC 0x1b0b0
169 MX6Q_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
170 MX6Q_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
171 MX6Q_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
172 MX6Q_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
173 MX6Q_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
174 MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
175 MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
176 MX6Q_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
177 MX6Q_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
178 MX6Q_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
179 MX6Q_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
180 MX6Q_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
181 MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
182 MX6Q_PAD_ENET_TX_EN__ENET_TX_EN 0x1b0b0
183 >;
184 };
160 }; 185 };
161 186
162 gpmi-nand { 187 gpmi-nand {
@@ -168,8 +193,6 @@
168 MX6Q_PAD_NANDF_RB0__NAND_READY_B 0xb000 193 MX6Q_PAD_NANDF_RB0__NAND_READY_B 0xb000
169 MX6Q_PAD_NANDF_CS0__NAND_CE0_B 0xb0b1 194 MX6Q_PAD_NANDF_CS0__NAND_CE0_B 0xb0b1
170 MX6Q_PAD_NANDF_CS1__NAND_CE1_B 0xb0b1 195 MX6Q_PAD_NANDF_CS1__NAND_CE1_B 0xb0b1
171 MX6Q_PAD_NANDF_CS2__NAND_CE2_B 0xb0b1
172 MX6Q_PAD_NANDF_CS3__NAND_CE3_B 0xb0b1
173 MX6Q_PAD_SD4_CMD__NAND_RE_B 0xb0b1 196 MX6Q_PAD_SD4_CMD__NAND_RE_B 0xb0b1
174 MX6Q_PAD_SD4_CLK__NAND_WE_B 0xb0b1 197 MX6Q_PAD_SD4_CLK__NAND_WE_B 0xb0b1
175 MX6Q_PAD_NANDF_D0__NAND_DATA00 0xb0b1 198 MX6Q_PAD_NANDF_D0__NAND_DATA00 0xb0b1
@@ -192,6 +215,13 @@
192 MX6Q_PAD_EIM_D28__I2C1_SDA 0x4001b8b1 215 MX6Q_PAD_EIM_D28__I2C1_SDA 0x4001b8b1
193 >; 216 >;
194 }; 217 };
218
219 pinctrl_i2c1_2: i2c1grp-2 {
220 fsl,pins = <
221 MX6Q_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1
222 MX6Q_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
223 >;
224 };
195 }; 225 };
196 226
197 i2c2 { 227 i2c2 {
@@ -268,6 +298,17 @@
268 MX6Q_PAD_NANDF_D7__SD2_DATA7 0x17059 298 MX6Q_PAD_NANDF_D7__SD2_DATA7 0x17059
269 >; 299 >;
270 }; 300 };
301
302 pinctrl_usdhc2_2: usdhc2grp-2 {
303 fsl,pins = <
304 MX6Q_PAD_SD2_CMD__SD2_CMD 0x17059
305 MX6Q_PAD_SD2_CLK__SD2_CLK 0x10059
306 MX6Q_PAD_SD2_DAT0__SD2_DATA0 0x17059
307 MX6Q_PAD_SD2_DAT1__SD2_DATA1 0x17059
308 MX6Q_PAD_SD2_DAT2__SD2_DATA2 0x17059
309 MX6Q_PAD_SD2_DAT3__SD2_DATA3 0x17059
310 >;
311 };
271 }; 312 };
272 313
273 usdhc3 { 314 usdhc3 {
@@ -325,6 +366,65 @@
325 >; 366 >;
326 }; 367 };
327 }; 368 };
369
370 weim {
371 pinctrl_weim_cs0_1: weim_cs0grp-1 {
372 fsl,pins = <
373 MX6Q_PAD_EIM_CS0__EIM_CS0_B 0xb0b1
374 >;
375 };
376
377 pinctrl_weim_nor_1: weimnorgrp-1 {
378 fsl,pins = <
379 MX6Q_PAD_EIM_OE__EIM_OE_B 0xb0b1
380 MX6Q_PAD_EIM_RW__EIM_RW 0xb0b1
381 MX6Q_PAD_EIM_WAIT__EIM_WAIT_B 0xb060
382 /* data */
383 MX6Q_PAD_EIM_D16__EIM_DATA16 0x1b0b0
384 MX6Q_PAD_EIM_D17__EIM_DATA17 0x1b0b0
385 MX6Q_PAD_EIM_D18__EIM_DATA18 0x1b0b0
386 MX6Q_PAD_EIM_D19__EIM_DATA19 0x1b0b0
387 MX6Q_PAD_EIM_D20__EIM_DATA20 0x1b0b0
388 MX6Q_PAD_EIM_D21__EIM_DATA21 0x1b0b0
389 MX6Q_PAD_EIM_D22__EIM_DATA22 0x1b0b0
390 MX6Q_PAD_EIM_D23__EIM_DATA23 0x1b0b0
391 MX6Q_PAD_EIM_D24__EIM_DATA24 0x1b0b0
392 MX6Q_PAD_EIM_D25__EIM_DATA25 0x1b0b0
393 MX6Q_PAD_EIM_D26__EIM_DATA26 0x1b0b0
394 MX6Q_PAD_EIM_D27__EIM_DATA27 0x1b0b0
395 MX6Q_PAD_EIM_D28__EIM_DATA28 0x1b0b0
396 MX6Q_PAD_EIM_D29__EIM_DATA29 0x1b0b0
397 MX6Q_PAD_EIM_D30__EIM_DATA30 0x1b0b0
398 MX6Q_PAD_EIM_D31__EIM_DATA31 0x1b0b0
399 /* address */
400 MX6Q_PAD_EIM_A23__EIM_ADDR23 0xb0b1
401 MX6Q_PAD_EIM_A22__EIM_ADDR22 0xb0b1
402 MX6Q_PAD_EIM_A21__EIM_ADDR21 0xb0b1
403 MX6Q_PAD_EIM_A20__EIM_ADDR20 0xb0b1
404 MX6Q_PAD_EIM_A19__EIM_ADDR19 0xb0b1
405 MX6Q_PAD_EIM_A18__EIM_ADDR18 0xb0b1
406 MX6Q_PAD_EIM_A17__EIM_ADDR17 0xb0b1
407 MX6Q_PAD_EIM_A16__EIM_ADDR16 0xb0b1
408 MX6Q_PAD_EIM_DA15__EIM_AD15 0xb0b1
409 MX6Q_PAD_EIM_DA14__EIM_AD14 0xb0b1
410 MX6Q_PAD_EIM_DA13__EIM_AD13 0xb0b1
411 MX6Q_PAD_EIM_DA12__EIM_AD12 0xb0b1
412 MX6Q_PAD_EIM_DA11__EIM_AD11 0xb0b1
413 MX6Q_PAD_EIM_DA10__EIM_AD10 0xb0b1
414 MX6Q_PAD_EIM_DA9__EIM_AD09 0xb0b1
415 MX6Q_PAD_EIM_DA8__EIM_AD08 0xb0b1
416 MX6Q_PAD_EIM_DA7__EIM_AD07 0xb0b1
417 MX6Q_PAD_EIM_DA6__EIM_AD06 0xb0b1
418 MX6Q_PAD_EIM_DA5__EIM_AD05 0xb0b1
419 MX6Q_PAD_EIM_DA4__EIM_AD04 0xb0b1
420 MX6Q_PAD_EIM_DA3__EIM_AD03 0xb0b1
421 MX6Q_PAD_EIM_DA2__EIM_AD02 0xb0b1
422 MX6Q_PAD_EIM_DA1__EIM_AD01 0xb0b1
423 MX6Q_PAD_EIM_DA0__EIM_AD00 0xb0b1
424 >;
425 };
426
427 };
328 }; 428 };
329 }; 429 };
330 430
diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 4d237cffcc41..e994011220e7 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -16,6 +16,22 @@
16 }; 16 };
17}; 17};
18 18
19&ecspi1 {
20 fsl,spi-num-chipselects = <1>;
21 cs-gpios = <&gpio3 19 0>;
22 pinctrl-names = "default";
23 pinctrl-0 = <&pinctrl_ecspi1_1 &pinctrl_ecspi1_sabreauto>;
24 status = "disabled"; /* pin conflict with WEIM NOR */
25
26 flash: m25p80@0 {
27 #address-cells = <1>;
28 #size-cells = <1>;
29 compatible = "st,m25p32";
30 spi-max-frequency = <20000000>;
31 reg = <0>;
32 };
33};
34
19&fec { 35&fec {
20 pinctrl-names = "default"; 36 pinctrl-names = "default";
21 pinctrl-0 = <&pinctrl_enet_2>; 37 pinctrl-0 = <&pinctrl_enet_2>;
@@ -23,6 +39,12 @@
23 status = "okay"; 39 status = "okay";
24}; 40};
25 41
42&gpmi {
43 pinctrl-names = "default";
44 pinctrl-0 = <&pinctrl_gpmi_nand_1>;
45 status = "okay";
46};
47
26&uart4 { 48&uart4 {
27 pinctrl-names = "default"; 49 pinctrl-names = "default";
28 pinctrl-0 = <&pinctrl_uart4_1>; 50 pinctrl-0 = <&pinctrl_uart4_1>;
@@ -36,3 +58,22 @@
36 wp-gpios = <&gpio1 13 0>; 58 wp-gpios = <&gpio1 13 0>;
37 status = "okay"; 59 status = "okay";
38}; 60};
61
62&weim {
63 pinctrl-names = "default";
64 pinctrl-0 = <&pinctrl_weim_nor_1 &pinctrl_weim_cs0_1>;
65 #address-cells = <2>;
66 #size-cells = <1>;
67 ranges = <0 0 0x08000000 0x08000000>;
68 status = "disabled"; /* pin conflict with SPI NOR */
69
70 nor@0,0 {
71 compatible = "cfi-flash";
72 reg = <0 0 0x02000000>;
73 #address-cells = <1>;
74 #size-cells = <1>;
75 bank-width = <2>;
76 fsl,weim-cs-timing = <0x00620081 0x00000001 0x1c022000
77 0x0000c000 0x1404a38e 0x00000000>;
78 };
79};
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index e21f6a89cf0f..6e5dfdb32416 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -26,6 +26,13 @@
26 gpio = <&gpio3 22 0>; 26 gpio = <&gpio3 22 0>;
27 enable-active-high; 27 enable-active-high;
28 }; 28 };
29
30 reg_audio: wm8962_supply {
31 compatible = "regulator-fixed";
32 regulator-name = "wm8962-supply";
33 gpio = <&gpio4 10 0>;
34 enable-active-high;
35 };
29 }; 36 };
30 37
31 gpio-keys { 38 gpio-keys {
@@ -43,6 +50,31 @@
43 linux,code = <114>; /* KEY_VOLUMEDOWN */ 50 linux,code = <114>; /* KEY_VOLUMEDOWN */
44 }; 51 };
45 }; 52 };
53
54 sound {
55 compatible = "fsl,imx6q-sabresd-wm8962",
56 "fsl,imx-audio-wm8962";
57 model = "wm8962-audio";
58 ssi-controller = <&ssi2>;
59 audio-codec = <&codec>;
60 audio-routing =
61 "Headphone Jack", "HPOUTL",
62 "Headphone Jack", "HPOUTR",
63 "Ext Spk", "SPKOUTL",
64 "Ext Spk", "SPKOUTR",
65 "MICBIAS", "AMIC",
66 "IN3R", "MICBIAS",
67 "DMIC", "MICBIAS",
68 "DMICDAT", "DMIC";
69 mux-int-port = <2>;
70 mux-ext-port = <3>;
71 };
72};
73
74&audmux {
75 pinctrl-names = "default";
76 pinctrl-0 = <&pinctrl_audmux_2>;
77 status = "okay";
46}; 78};
47 79
48&fec { 80&fec {
@@ -52,6 +84,40 @@
52 status = "okay"; 84 status = "okay";
53}; 85};
54 86
87&i2c1 {
88 clock-frequency = <100000>;
89 pinctrl-names = "default";
90 pinctrl-0 = <&pinctrl_i2c1_2>;
91 status = "okay";
92
93 codec: wm8962@1a {
94 compatible = "wlf,wm8962";
95 reg = <0x1a>;
96 clocks = <&clks 169>;
97 DCVDD-supply = <&reg_audio>;
98 DBVDD-supply = <&reg_audio>;
99 AVDD-supply = <&reg_audio>;
100 CPVDD-supply = <&reg_audio>;
101 MICVDD-supply = <&reg_audio>;
102 PLLVDD-supply = <&reg_audio>;
103 SPKVDD1-supply = <&reg_audio>;
104 SPKVDD2-supply = <&reg_audio>;
105 gpio-cfg = <
106 0x0000 /* 0:Default */
107 0x0000 /* 1:Default */
108 0x0013 /* 2:FN_DMICCLK */
109 0x0000 /* 3:Default */
110 0x8014 /* 4:FN_DMICCDAT */
111 0x0000 /* 5:Default */
112 >;
113 };
114};
115
116&ssi2 {
117 fsl,mode = "i2s-slave";
118 status = "okay";
119};
120
55&uart1 { 121&uart1 {
56 pinctrl-names = "default"; 122 pinctrl-names = "default";
57 pinctrl-0 = <&pinctrl_uart1_1>; 123 pinctrl-0 = <&pinctrl_uart1_1>;
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 9e8296e4c343..f21d259080fd 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -106,6 +106,8 @@
106 interrupts = <0 92 0x04>; 106 interrupts = <0 92 0x04>;
107 cache-unified; 107 cache-unified;
108 cache-level = <2>; 108 cache-level = <2>;
109 arm,tag-latency = <4 2 3>;
110 arm,data-latency = <4 2 3>;
109 }; 111 };
110 112
111 pmu { 113 pmu {
@@ -638,7 +640,7 @@
638 status = "disabled"; 640 status = "disabled";
639 }; 641 };
640 642
641 usbmisc: usbmisc: usbmisc@02184800 { 643 usbmisc: usbmisc@02184800 {
642 #index-cells = <1>; 644 #index-cells = <1>;
643 compatible = "fsl,imx6q-usbmisc"; 645 compatible = "fsl,imx6q-usbmisc";
644 reg = <0x02184800 0x200>; 646 reg = <0x02184800 0x200>;
@@ -742,9 +744,11 @@
742 reg = <0x021b4000 0x4000>; 744 reg = <0x021b4000 0x4000>;
743 }; 745 };
744 746
745 weim@021b8000 { 747 weim: weim@021b8000 {
748 compatible = "fsl,imx6q-weim";
746 reg = <0x021b8000 0x4000>; 749 reg = <0x021b8000 0x4000>;
747 interrupts = <0 14 0x04>; 750 interrupts = <0 14 0x04>;
751 clocks = <&clks 196>;
748 }; 752 };
749 753
750 ocotp@021bc000 { 754 ocotp@021bc000 {
@@ -752,11 +756,6 @@
752 reg = <0x021bc000 0x4000>; 756 reg = <0x021bc000 0x4000>;
753 }; 757 };
754 758
755 ocotp@021c0000 {
756 reg = <0x021c0000 0x4000>;
757 interrupts = <0 21 0x04>;
758 };
759
760 tzasc@021d0000 { /* TZASC1 */ 759 tzasc@021d0000 { /* TZASC1 */
761 reg = <0x021d0000 0x4000>; 760 reg = <0x021d0000 0x4000>;
762 interrupts = <0 108 0x04>; 761 interrupts = <0 108 0x04>;
diff --git a/arch/arm/boot/dts/imx6sl-evk.dts b/arch/arm/boot/dts/imx6sl-evk.dts
new file mode 100644
index 000000000000..2886a590823d
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sl-evk.dts
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/dts-v1/;
10
11#include "imx6sl.dtsi"
12
13/ {
14 model = "Freescale i.MX6 SoloLite EVK Board";
15 compatible = "fsl,imx6sl-evk", "fsl,imx6sl";
16
17 memory {
18 reg = <0x80000000 0x40000000>;
19 };
20};
21
22&fec {
23 pinctrl-names = "default";
24 pinctrl-0 = <&pinctrl_fec_1>;
25 phy-mode = "rmii";
26 status = "okay";
27};
28
29&iomuxc {
30 pinctrl-names = "default";
31 pinctrl-0 = <&pinctrl_hog>;
32
33 hog {
34 pinctrl_hog: hoggrp {
35 fsl,pins = <
36 MX6SL_PAD_KEY_ROW7__GPIO4_IO07 0x17059
37 MX6SL_PAD_KEY_COL7__GPIO4_IO06 0x17059
38 MX6SL_PAD_SD2_DAT7__GPIO5_IO00 0x17059
39 MX6SL_PAD_SD2_DAT6__GPIO4_IO29 0x17059
40 MX6SL_PAD_REF_CLK_32K__GPIO3_IO22 0x17059
41 >;
42 };
43 };
44};
45
46&uart1 {
47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_uart1_1>;
49 status = "okay";
50};
51
52&usdhc1 {
53 pinctrl-names = "default";
54 pinctrl-0 = <&pinctrl_usdhc1_1>;
55 bus-width = <8>;
56 cd-gpios = <&gpio4 7 0>;
57 wp-gpios = <&gpio4 6 0>;
58 status = "okay";
59};
60
61&usdhc2 {
62 pinctrl-names = "default";
63 pinctrl-0 = <&pinctrl_usdhc2_1>;
64 cd-gpios = <&gpio5 0 0>;
65 wp-gpios = <&gpio4 29 0>;
66 status = "okay";
67};
68
69&usdhc3 {
70 pinctrl-names = "default";
71 pinctrl-0 = <&pinctrl_usdhc3_1>;
72 cd-gpios = <&gpio3 22 0>;
73 status = "okay";
74};
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
new file mode 100644
index 000000000000..c5e5da02d7e3
--- /dev/null
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -0,0 +1,779 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#include "skeleton.dtsi"
11#include "imx6sl-pinfunc.h"
12#include <dt-bindings/clock/imx6sl-clock.h>
13
14/ {
15 aliases {
16 serial0 = &uart1;
17 serial1 = &uart2;
18 serial2 = &uart3;
19 serial3 = &uart4;
20 serial4 = &uart5;
21 gpio0 = &gpio1;
22 gpio1 = &gpio2;
23 gpio2 = &gpio3;
24 gpio3 = &gpio4;
25 gpio4 = &gpio5;
26 };
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 cpu@0 {
33 compatible = "arm,cortex-a9";
34 device_type = "cpu";
35 reg = <0x0>;
36 next-level-cache = <&L2>;
37 };
38 };
39
40 intc: interrupt-controller@00a01000 {
41 compatible = "arm,cortex-a9-gic";
42 #interrupt-cells = <3>;
43 #address-cells = <1>;
44 #size-cells = <1>;
45 interrupt-controller;
46 reg = <0x00a01000 0x1000>,
47 <0x00a00100 0x100>;
48 };
49
50 clocks {
51 #address-cells = <1>;
52 #size-cells = <0>;
53
54 ckil {
55 compatible = "fixed-clock";
56 clock-frequency = <32768>;
57 };
58
59 osc {
60 compatible = "fixed-clock";
61 clock-frequency = <24000000>;
62 };
63 };
64
65 soc {
66 #address-cells = <1>;
67 #size-cells = <1>;
68 compatible = "simple-bus";
69 interrupt-parent = <&intc>;
70 ranges;
71
72 L2: l2-cache@00a02000 {
73 compatible = "arm,pl310-cache";
74 reg = <0x00a02000 0x1000>;
75 interrupts = <0 92 0x04>;
76 cache-unified;
77 cache-level = <2>;
78 arm,tag-latency = <4 2 3>;
79 arm,data-latency = <4 2 3>;
80 };
81
82 pmu {
83 compatible = "arm,cortex-a9-pmu";
84 interrupts = <0 94 0x04>;
85 };
86
87 aips1: aips-bus@02000000 {
88 compatible = "fsl,aips-bus", "simple-bus";
89 #address-cells = <1>;
90 #size-cells = <1>;
91 reg = <0x02000000 0x100000>;
92 ranges;
93
94 spba: spba-bus@02000000 {
95 compatible = "fsl,spba-bus", "simple-bus";
96 #address-cells = <1>;
97 #size-cells = <1>;
98 reg = <0x02000000 0x40000>;
99 ranges;
100
101 spdif: spdif@02004000 {
102 reg = <0x02004000 0x4000>;
103 interrupts = <0 52 0x04>;
104 };
105
106 ecspi1: ecspi@02008000 {
107 #address-cells = <1>;
108 #size-cells = <0>;
109 compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
110 reg = <0x02008000 0x4000>;
111 interrupts = <0 31 0x04>;
112 clocks = <&clks IMX6SL_CLK_ECSPI1>,
113 <&clks IMX6SL_CLK_ECSPI1>;
114 clock-names = "ipg", "per";
115 status = "disabled";
116 };
117
118 ecspi2: ecspi@0200c000 {
119 #address-cells = <1>;
120 #size-cells = <0>;
121 compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
122 reg = <0x0200c000 0x4000>;
123 interrupts = <0 32 0x04>;
124 clocks = <&clks IMX6SL_CLK_ECSPI2>,
125 <&clks IMX6SL_CLK_ECSPI2>;
126 clock-names = "ipg", "per";
127 status = "disabled";
128 };
129
130 ecspi3: ecspi@02010000 {
131 #address-cells = <1>;
132 #size-cells = <0>;
133 compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
134 reg = <0x02010000 0x4000>;
135 interrupts = <0 33 0x04>;
136 clocks = <&clks IMX6SL_CLK_ECSPI3>,
137 <&clks IMX6SL_CLK_ECSPI3>;
138 clock-names = "ipg", "per";
139 status = "disabled";
140 };
141
142 ecspi4: ecspi@02014000 {
143 #address-cells = <1>;
144 #size-cells = <0>;
145 compatible = "fsl,imx6sl-ecspi", "fsl,imx51-ecspi";
146 reg = <0x02014000 0x4000>;
147 interrupts = <0 34 0x04>;
148 clocks = <&clks IMX6SL_CLK_ECSPI4>,
149 <&clks IMX6SL_CLK_ECSPI4>;
150 clock-names = "ipg", "per";
151 status = "disabled";
152 };
153
154 uart5: serial@02018000 {
155 compatible = "fsl,imx6sl-uart", "fsl,imx21-uart";
156 reg = <0x02018000 0x4000>;
157 interrupts = <0 30 0x04>;
158 clocks = <&clks IMX6SL_CLK_UART>,
159 <&clks IMX6SL_CLK_UART_SERIAL>;
160 clock-names = "ipg", "per";
161 status = "disabled";
162 };
163
164 uart1: serial@02020000 {
165 compatible = "fsl,imx6sl-uart", "fsl,imx21-uart";
166 reg = <0x02020000 0x4000>;
167 interrupts = <0 26 0x04>;
168 clocks = <&clks IMX6SL_CLK_UART>,
169 <&clks IMX6SL_CLK_UART_SERIAL>;
170 clock-names = "ipg", "per";
171 status = "disabled";
172 };
173
174 uart2: serial@02024000 {
175 compatible = "fsl,imx6sl-uart", "fsl,imx21-uart";
176 reg = <0x02024000 0x4000>;
177 interrupts = <0 27 0x04>;
178 clocks = <&clks IMX6SL_CLK_UART>,
179 <&clks IMX6SL_CLK_UART_SERIAL>;
180 clock-names = "ipg", "per";
181 status = "disabled";
182 };
183
184 ssi1: ssi@02028000 {
185 compatible = "fsl,imx6sl-ssi","fsl,imx21-ssi";
186 reg = <0x02028000 0x4000>;
187 interrupts = <0 46 0x04>;
188 clocks = <&clks IMX6SL_CLK_SSI1>;
189 fsl,fifo-depth = <15>;
190 status = "disabled";
191 };
192
193 ssi2: ssi@0202c000 {
194 compatible = "fsl,imx6sl-ssi","fsl,imx21-ssi";
195 reg = <0x0202c000 0x4000>;
196 interrupts = <0 47 0x04>;
197 clocks = <&clks IMX6SL_CLK_SSI2>;
198 fsl,fifo-depth = <15>;
199 status = "disabled";
200 };
201
202 ssi3: ssi@02030000 {
203 compatible = "fsl,imx6sl-ssi","fsl,imx21-ssi";
204 reg = <0x02030000 0x4000>;
205 interrupts = <0 48 0x04>;
206 clocks = <&clks IMX6SL_CLK_SSI3>;
207 fsl,fifo-depth = <15>;
208 status = "disabled";
209 };
210
211 uart3: serial@02034000 {
212 compatible = "fsl,imx6sl-uart", "fsl,imx21-uart";
213 reg = <0x02034000 0x4000>;
214 interrupts = <0 28 0x04>;
215 clocks = <&clks IMX6SL_CLK_UART>,
216 <&clks IMX6SL_CLK_UART_SERIAL>;
217 clock-names = "ipg", "per";
218 status = "disabled";
219 };
220
221 uart4: serial@02038000 {
222 compatible = "fsl,imx6sl-uart", "fsl,imx21-uart";
223 reg = <0x02038000 0x4000>;
224 interrupts = <0 29 0x04>;
225 clocks = <&clks IMX6SL_CLK_UART>,
226 <&clks IMX6SL_CLK_UART_SERIAL>;
227 clock-names = "ipg", "per";
228 status = "disabled";
229 };
230 };
231
232 pwm1: pwm@02080000 {
233 #pwm-cells = <2>;
234 compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
235 reg = <0x02080000 0x4000>;
236 interrupts = <0 83 0x04>;
237 clocks = <&clks IMX6SL_CLK_PWM1>,
238 <&clks IMX6SL_CLK_PWM1>;
239 clock-names = "ipg", "per";
240 };
241
242 pwm2: pwm@02084000 {
243 #pwm-cells = <2>;
244 compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
245 reg = <0x02084000 0x4000>;
246 interrupts = <0 84 0x04>;
247 clocks = <&clks IMX6SL_CLK_PWM2>,
248 <&clks IMX6SL_CLK_PWM2>;
249 clock-names = "ipg", "per";
250 };
251
252 pwm3: pwm@02088000 {
253 #pwm-cells = <2>;
254 compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
255 reg = <0x02088000 0x4000>;
256 interrupts = <0 85 0x04>;
257 clocks = <&clks IMX6SL_CLK_PWM3>,
258 <&clks IMX6SL_CLK_PWM3>;
259 clock-names = "ipg", "per";
260 };
261
262 pwm4: pwm@0208c000 {
263 #pwm-cells = <2>;
264 compatible = "fsl,imx6sl-pwm", "fsl,imx27-pwm";
265 reg = <0x0208c000 0x4000>;
266 interrupts = <0 86 0x04>;
267 clocks = <&clks IMX6SL_CLK_PWM4>,
268 <&clks IMX6SL_CLK_PWM4>;
269 clock-names = "ipg", "per";
270 };
271
272 gpt: gpt@02098000 {
273 compatible = "fsl,imx6sl-gpt";
274 reg = <0x02098000 0x4000>;
275 interrupts = <0 55 0x04>;
276 clocks = <&clks IMX6SL_CLK_GPT>,
277 <&clks IMX6SL_CLK_GPT_SERIAL>;
278 clock-names = "ipg", "per";
279 };
280
281 gpio1: gpio@0209c000 {
282 compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
283 reg = <0x0209c000 0x4000>;
284 interrupts = <0 66 0x04 0 67 0x04>;
285 gpio-controller;
286 #gpio-cells = <2>;
287 interrupt-controller;
288 #interrupt-cells = <2>;
289 };
290
291 gpio2: gpio@020a0000 {
292 compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
293 reg = <0x020a0000 0x4000>;
294 interrupts = <0 68 0x04 0 69 0x04>;
295 gpio-controller;
296 #gpio-cells = <2>;
297 interrupt-controller;
298 #interrupt-cells = <2>;
299 };
300
301 gpio3: gpio@020a4000 {
302 compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
303 reg = <0x020a4000 0x4000>;
304 interrupts = <0 70 0x04 0 71 0x04>;
305 gpio-controller;
306 #gpio-cells = <2>;
307 interrupt-controller;
308 #interrupt-cells = <2>;
309 };
310
311 gpio4: gpio@020a8000 {
312 compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
313 reg = <0x020a8000 0x4000>;
314 interrupts = <0 72 0x04 0 73 0x04>;
315 gpio-controller;
316 #gpio-cells = <2>;
317 interrupt-controller;
318 #interrupt-cells = <2>;
319 };
320
321 gpio5: gpio@020ac000 {
322 compatible = "fsl,imx6sl-gpio", "fsl,imx35-gpio";
323 reg = <0x020ac000 0x4000>;
324 interrupts = <0 74 0x04 0 75 0x04>;
325 gpio-controller;
326 #gpio-cells = <2>;
327 interrupt-controller;
328 #interrupt-cells = <2>;
329 };
330
331 kpp: kpp@020b8000 {
332 reg = <0x020b8000 0x4000>;
333 interrupts = <0 82 0x04>;
334 };
335
336 wdog1: wdog@020bc000 {
337 compatible = "fsl,imx6sl-wdt", "fsl,imx21-wdt";
338 reg = <0x020bc000 0x4000>;
339 interrupts = <0 80 0x04>;
340 clocks = <&clks IMX6SL_CLK_DUMMY>;
341 };
342
343 wdog2: wdog@020c0000 {
344 compatible = "fsl,imx6sl-wdt", "fsl,imx21-wdt";
345 reg = <0x020c0000 0x4000>;
346 interrupts = <0 81 0x04>;
347 clocks = <&clks IMX6SL_CLK_DUMMY>;
348 status = "disabled";
349 };
350
351 clks: ccm@020c4000 {
352 compatible = "fsl,imx6sl-ccm";
353 reg = <0x020c4000 0x4000>;
354 interrupts = <0 87 0x04 0 88 0x04>;
355 #clock-cells = <1>;
356 };
357
358 anatop: anatop@020c8000 {
359 compatible = "fsl,imx6sl-anatop", "syscon", "simple-bus";
360 reg = <0x020c8000 0x1000>;
361 interrupts = <0 49 0x04 0 54 0x04 0 127 0x04>;
362
363 regulator-1p1@110 {
364 compatible = "fsl,anatop-regulator";
365 regulator-name = "vdd1p1";
366 regulator-min-microvolt = <800000>;
367 regulator-max-microvolt = <1375000>;
368 regulator-always-on;
369 anatop-reg-offset = <0x110>;
370 anatop-vol-bit-shift = <8>;
371 anatop-vol-bit-width = <5>;
372 anatop-min-bit-val = <4>;
373 anatop-min-voltage = <800000>;
374 anatop-max-voltage = <1375000>;
375 };
376
377 regulator-3p0@120 {
378 compatible = "fsl,anatop-regulator";
379 regulator-name = "vdd3p0";
380 regulator-min-microvolt = <2800000>;
381 regulator-max-microvolt = <3150000>;
382 regulator-always-on;
383 anatop-reg-offset = <0x120>;
384 anatop-vol-bit-shift = <8>;
385 anatop-vol-bit-width = <5>;
386 anatop-min-bit-val = <0>;
387 anatop-min-voltage = <2625000>;
388 anatop-max-voltage = <3400000>;
389 };
390
391 regulator-2p5@130 {
392 compatible = "fsl,anatop-regulator";
393 regulator-name = "vdd2p5";
394 regulator-min-microvolt = <2100000>;
395 regulator-max-microvolt = <2850000>;
396 regulator-always-on;
397 anatop-reg-offset = <0x130>;
398 anatop-vol-bit-shift = <8>;
399 anatop-vol-bit-width = <5>;
400 anatop-min-bit-val = <0>;
401 anatop-min-voltage = <2100000>;
402 anatop-max-voltage = <2850000>;
403 };
404
405 reg_arm: regulator-vddcore@140 {
406 compatible = "fsl,anatop-regulator";
407 regulator-name = "cpu";
408 regulator-min-microvolt = <725000>;
409 regulator-max-microvolt = <1450000>;
410 regulator-always-on;
411 anatop-reg-offset = <0x140>;
412 anatop-vol-bit-shift = <0>;
413 anatop-vol-bit-width = <5>;
414 anatop-delay-reg-offset = <0x170>;
415 anatop-delay-bit-shift = <24>;
416 anatop-delay-bit-width = <2>;
417 anatop-min-bit-val = <1>;
418 anatop-min-voltage = <725000>;
419 anatop-max-voltage = <1450000>;
420 };
421
422 reg_pu: regulator-vddpu@140 {
423 compatible = "fsl,anatop-regulator";
424 regulator-name = "vddpu";
425 regulator-min-microvolt = <725000>;
426 regulator-max-microvolt = <1450000>;
427 regulator-always-on;
428 anatop-reg-offset = <0x140>;
429 anatop-vol-bit-shift = <9>;
430 anatop-vol-bit-width = <5>;
431 anatop-delay-reg-offset = <0x170>;
432 anatop-delay-bit-shift = <26>;
433 anatop-delay-bit-width = <2>;
434 anatop-min-bit-val = <1>;
435 anatop-min-voltage = <725000>;
436 anatop-max-voltage = <1450000>;
437 };
438
439 reg_soc: regulator-vddsoc@140 {
440 compatible = "fsl,anatop-regulator";
441 regulator-name = "vddsoc";
442 regulator-min-microvolt = <725000>;
443 regulator-max-microvolt = <1450000>;
444 regulator-always-on;
445 anatop-reg-offset = <0x140>;
446 anatop-vol-bit-shift = <18>;
447 anatop-vol-bit-width = <5>;
448 anatop-delay-reg-offset = <0x170>;
449 anatop-delay-bit-shift = <28>;
450 anatop-delay-bit-width = <2>;
451 anatop-min-bit-val = <1>;
452 anatop-min-voltage = <725000>;
453 anatop-max-voltage = <1450000>;
454 };
455 };
456
457 usbphy1: usbphy@020c9000 {
458 compatible = "fsl,imx6sl-usbphy", "fsl,imx23-usbphy";
459 reg = <0x020c9000 0x1000>;
460 interrupts = <0 44 0x04>;
461 clocks = <&clks IMX6SL_CLK_USBPHY1>;
462 };
463
464 usbphy2: usbphy@020ca000 {
465 compatible = "fsl,imx6sl-usbphy", "fsl,imx23-usbphy";
466 reg = <0x020ca000 0x1000>;
467 interrupts = <0 45 0x04>;
468 clocks = <&clks IMX6SL_CLK_USBPHY2>;
469 };
470
471 snvs@020cc000 {
472 compatible = "fsl,sec-v4.0-mon", "simple-bus";
473 #address-cells = <1>;
474 #size-cells = <1>;
475 ranges = <0 0x020cc000 0x4000>;
476
477 snvs-rtc-lp@34 {
478 compatible = "fsl,sec-v4.0-mon-rtc-lp";
479 reg = <0x34 0x58>;
480 interrupts = <0 19 0x04 0 20 0x04>;
481 };
482 };
483
484 epit1: epit@020d0000 {
485 reg = <0x020d0000 0x4000>;
486 interrupts = <0 56 0x04>;
487 };
488
489 epit2: epit@020d4000 {
490 reg = <0x020d4000 0x4000>;
491 interrupts = <0 57 0x04>;
492 };
493
494 src: src@020d8000 {
495 compatible = "fsl,imx6sl-src", "fsl,imx51-src";
496 reg = <0x020d8000 0x4000>;
497 interrupts = <0 91 0x04 0 96 0x04>;
498 #reset-cells = <1>;
499 };
500
501 gpc: gpc@020dc000 {
502 compatible = "fsl,imx6sl-gpc", "fsl,imx6q-gpc";
503 reg = <0x020dc000 0x4000>;
504 interrupts = <0 89 0x04>;
505 };
506
507 iomuxc: iomuxc@020e0000 {
508 compatible = "fsl,imx6sl-iomuxc";
509 reg = <0x020e0000 0x4000>;
510
511 fec {
512 pinctrl_fec_1: fecgrp-1 {
513 fsl,pins = <
514 MX6SL_PAD_FEC_MDC__FEC_MDC 0x1b0b0
515 MX6SL_PAD_FEC_MDIO__FEC_MDIO 0x1b0b0
516 MX6SL_PAD_FEC_CRS_DV__FEC_RX_DV 0x1b0b0
517 MX6SL_PAD_FEC_RXD0__FEC_RX_DATA0 0x1b0b0
518 MX6SL_PAD_FEC_RXD1__FEC_RX_DATA1 0x1b0b0
519 MX6SL_PAD_FEC_TX_EN__FEC_TX_EN 0x1b0b0
520 MX6SL_PAD_FEC_TXD0__FEC_TX_DATA0 0x1b0b0
521 MX6SL_PAD_FEC_TXD1__FEC_TX_DATA1 0x1b0b0
522 MX6SL_PAD_FEC_REF_CLK__FEC_REF_OUT 0x4001b0a8
523 >;
524 };
525 };
526
527 uart1 {
528 pinctrl_uart1_1: uart1grp-1 {
529 fsl,pins = <
530 MX6SL_PAD_UART1_RXD__UART1_RX_DATA 0x1b0b1
531 MX6SL_PAD_UART1_TXD__UART1_TX_DATA 0x1b0b1
532 >;
533 };
534 };
535
536 usdhc1 {
537 pinctrl_usdhc1_1: usdhc1grp-1 {
538 fsl,pins = <
539 MX6SL_PAD_SD1_CMD__SD1_CMD 0x17059
540 MX6SL_PAD_SD1_CLK__SD1_CLK 0x10059
541 MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x17059
542 MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x17059
543 MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x17059
544 MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x17059
545 MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x17059
546 MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x17059
547 MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x17059
548 MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x17059
549 >;
550 };
551 };
552
553 usdhc2 {
554 pinctrl_usdhc2_1: usdhc2grp-1 {
555 fsl,pins = <
556 MX6SL_PAD_SD2_CMD__SD2_CMD 0x17059
557 MX6SL_PAD_SD2_CLK__SD2_CLK 0x10059
558 MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x17059
559 MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x17059
560 MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x17059
561 MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x17059
562 >;
563 };
564 };
565
566 usdhc3 {
567 pinctrl_usdhc3_1: usdhc3grp-1 {
568 fsl,pins = <
569 MX6SL_PAD_SD3_CMD__SD3_CMD 0x17059
570 MX6SL_PAD_SD3_CLK__SD3_CLK 0x10059
571 MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x17059
572 MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x17059
573 MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x17059
574 MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059
575 >;
576 };
577 };
578 };
579
580 csi: csi@020e4000 {
581 reg = <0x020e4000 0x4000>;
582 interrupts = <0 7 0x04>;
583 };
584
585 spdc: spdc@020e8000 {
586 reg = <0x020e8000 0x4000>;
587 interrupts = <0 6 0x04>;
588 };
589
590 sdma: sdma@020ec000 {
591 compatible = "fsl,imx6sl-sdma", "fsl,imx35-sdma";
592 reg = <0x020ec000 0x4000>;
593 interrupts = <0 2 0x04>;
594 clocks = <&clks IMX6SL_CLK_SDMA>,
595 <&clks IMX6SL_CLK_SDMA>;
596 clock-names = "ipg", "ahb";
597 fsl,sdma-ram-script-name = "imx/sdma/sdma-imx6sl.bin";
598 };
599
600 pxp: pxp@020f0000 {
601 reg = <0x020f0000 0x4000>;
602 interrupts = <0 98 0x04>;
603 };
604
605 epdc: epdc@020f4000 {
606 reg = <0x020f4000 0x4000>;
607 interrupts = <0 97 0x04>;
608 };
609
610 lcdif: lcdif@020f8000 {
611 reg = <0x020f8000 0x4000>;
612 interrupts = <0 39 0x04>;
613 };
614
615 dcp: dcp@020fc000 {
616 reg = <0x020fc000 0x4000>;
617 interrupts = <0 99 0x04>;
618 };
619 };
620
621 aips2: aips-bus@02100000 {
622 compatible = "fsl,aips-bus", "simple-bus";
623 #address-cells = <1>;
624 #size-cells = <1>;
625 reg = <0x02100000 0x100000>;
626 ranges;
627
628 usbotg1: usb@02184000 {
629 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
630 reg = <0x02184000 0x200>;
631 interrupts = <0 43 0x04>;
632 clocks = <&clks IMX6SL_CLK_USBOH3>;
633 fsl,usbphy = <&usbphy1>;
634 fsl,usbmisc = <&usbmisc 0>;
635 status = "disabled";
636 };
637
638 usbotg2: usb@02184200 {
639 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
640 reg = <0x02184200 0x200>;
641 interrupts = <0 40 0x04>;
642 clocks = <&clks IMX6SL_CLK_USBOH3>;
643 fsl,usbphy = <&usbphy2>;
644 fsl,usbmisc = <&usbmisc 1>;
645 status = "disabled";
646 };
647
648 usbh: usb@02184400 {
649 compatible = "fsl,imx6sl-usb", "fsl,imx27-usb";
650 reg = <0x02184400 0x200>;
651 interrupts = <0 42 0x04>;
652 clocks = <&clks IMX6SL_CLK_USBOH3>;
653 fsl,usbmisc = <&usbmisc 2>;
654 status = "disabled";
655 };
656
657 usbmisc: usbmisc@02184800 {
658 #index-cells = <1>;
659 compatible = "fsl,imx6sl-usbmisc", "fsl,imx6q-usbmisc";
660 reg = <0x02184800 0x200>;
661 clocks = <&clks IMX6SL_CLK_USBOH3>;
662 };
663
664 fec: ethernet@02188000 {
665 compatible = "fsl,imx6sl-fec", "fsl,imx25-fec";
666 reg = <0x02188000 0x4000>;
667 interrupts = <0 114 0x04>;
668 clocks = <&clks IMX6SL_CLK_ENET_REF>,
669 <&clks IMX6SL_CLK_ENET_REF>;
670 clock-names = "ipg", "ahb";
671 status = "disabled";
672 };
673
674 usdhc1: usdhc@02190000 {
675 compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
676 reg = <0x02190000 0x4000>;
677 interrupts = <0 22 0x04>;
678 clocks = <&clks IMX6SL_CLK_USDHC1>,
679 <&clks IMX6SL_CLK_USDHC1>,
680 <&clks IMX6SL_CLK_USDHC1>;
681 clock-names = "ipg", "ahb", "per";
682 bus-width = <4>;
683 status = "disabled";
684 };
685
686 usdhc2: usdhc@02194000 {
687 compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
688 reg = <0x02194000 0x4000>;
689 interrupts = <0 23 0x04>;
690 clocks = <&clks IMX6SL_CLK_USDHC2>,
691 <&clks IMX6SL_CLK_USDHC2>,
692 <&clks IMX6SL_CLK_USDHC2>;
693 clock-names = "ipg", "ahb", "per";
694 bus-width = <4>;
695 status = "disabled";
696 };
697
698 usdhc3: usdhc@02198000 {
699 compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
700 reg = <0x02198000 0x4000>;
701 interrupts = <0 24 0x04>;
702 clocks = <&clks IMX6SL_CLK_USDHC3>,
703 <&clks IMX6SL_CLK_USDHC3>,
704 <&clks IMX6SL_CLK_USDHC3>;
705 clock-names = "ipg", "ahb", "per";
706 bus-width = <4>;
707 status = "disabled";
708 };
709
710 usdhc4: usdhc@0219c000 {
711 compatible = "fsl,imx6sl-usdhc", "fsl,imx6q-usdhc";
712 reg = <0x0219c000 0x4000>;
713 interrupts = <0 25 0x04>;
714 clocks = <&clks IMX6SL_CLK_USDHC4>,
715 <&clks IMX6SL_CLK_USDHC4>,
716 <&clks IMX6SL_CLK_USDHC4>;
717 clock-names = "ipg", "ahb", "per";
718 bus-width = <4>;
719 status = "disabled";
720 };
721
722 i2c1: i2c@021a0000 {
723 #address-cells = <1>;
724 #size-cells = <0>;
725 compatible = "fsl,imx6sl-i2c", "fsl,imx21-i2c";
726 reg = <0x021a0000 0x4000>;
727 interrupts = <0 36 0x04>;
728 clocks = <&clks IMX6SL_CLK_I2C1>;
729 status = "disabled";
730 };
731
732 i2c2: i2c@021a4000 {
733 #address-cells = <1>;
734 #size-cells = <0>;
735 compatible = "fsl,imx6sl-i2c", "fsl,imx21-i2c";
736 reg = <0x021a4000 0x4000>;
737 interrupts = <0 37 0x04>;
738 clocks = <&clks IMX6SL_CLK_I2C2>;
739 status = "disabled";
740 };
741
742 i2c3: i2c@021a8000 {
743 #address-cells = <1>;
744 #size-cells = <0>;
745 compatible = "fsl,imx6sl-i2c", "fsl,imx21-i2c";
746 reg = <0x021a8000 0x4000>;
747 interrupts = <0 38 0x04>;
748 clocks = <&clks IMX6SL_CLK_I2C3>;
749 status = "disabled";
750 };
751
752 mmdc: mmdc@021b0000 {
753 compatible = "fsl,imx6sl-mmdc", "fsl,imx6q-mmdc";
754 reg = <0x021b0000 0x4000>;
755 };
756
757 rngb: rngb@021b4000 {
758 reg = <0x021b4000 0x4000>;
759 interrupts = <0 5 0x04>;
760 };
761
762 weim: weim@021b8000 {
763 reg = <0x021b8000 0x4000>;
764 interrupts = <0 14 0x04>;
765 };
766
767 ocotp: ocotp@021bc000 {
768 compatible = "fsl,imx6sl-ocotp";
769 reg = <0x021bc000 0x4000>;
770 };
771
772 audmux: audmux@021d8000 {
773 compatible = "fsl,imx6sl-audmux", "fsl,imx31-audmux";
774 reg = <0x021d8000 0x4000>;
775 status = "disabled";
776 };
777 };
778 };
779};
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
index c9c3fa344647..b6b82eca8d1e 100644
--- a/arch/arm/boot/dts/integratorap.dts
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -39,6 +39,47 @@
39 valid-mask = <0x003fffff>; 39 valid-mask = <0x003fffff>;
40 }; 40 };
41 41
42 pci: pciv3@62000000 {
43 compatible = "v3,v360epc-pci";
44 #interrupt-cells = <1>;
45 #size-cells = <2>;
46 #address-cells = <3>;
47 reg = <0x62000000 0x10000>;
48 interrupt-parent = <&pic>;
49 interrupts = <17>; /* Bus error IRQ */
50 ranges = <0x00000000 0 0x61000000 /* config space */
51 0x61000000 0 0x00100000 /* 16 MiB @ 61000000 */
52 0x01000000 0 0x0 /* I/O space */
53 0x60000000 0 0x00100000 /* 16 MiB @ 60000000 */
54 0x02000000 0 0x00000000 /* non-prefectable memory */
55 0x40000000 0 0x10000000 /* 256 MiB @ 40000000 */
56 0x42000000 0 0x10000000 /* prefetchable memory */
57 0x50000000 0 0x10000000>; /* 256 MiB @ 50000000 */
58 interrupt-map-mask = <0xf800 0 0 0x7>;
59 interrupt-map = <
60 /* IDSEL 9 */
61 0x4800 0 0 1 &pic 13 /* INT A on slot 9 is irq 13 */
62 0x4800 0 0 2 &pic 14 /* INT B on slot 9 is irq 14 */
63 0x4800 0 0 3 &pic 15 /* INT C on slot 9 is irq 15 */
64 0x4800 0 0 4 &pic 16 /* INT D on slot 9 is irq 16 */
65 /* IDSEL 10 */
66 0x5000 0 0 1 &pic 14 /* INT A on slot 10 is irq 14 */
67 0x5000 0 0 2 &pic 15 /* INT B on slot 10 is irq 15 */
68 0x5000 0 0 3 &pic 16 /* INT C on slot 10 is irq 16 */
69 0x5000 0 0 4 &pic 13 /* INT D on slot 10 is irq 13 */
70 /* IDSEL 11 */
71 0x5800 0 0 1 &pic 15 /* INT A on slot 11 is irq 15 */
72 0x5800 0 0 2 &pic 16 /* INT B on slot 11 is irq 16 */
73 0x5800 0 0 3 &pic 13 /* INT C on slot 11 is irq 13 */
74 0x5800 0 0 4 &pic 14 /* INT D on slot 11 is irq 14 */
75 /* IDSEL 12 */
76 0x6000 0 0 1 &pic 16 /* INT A on slot 12 is irq 16 */
77 0x6000 0 0 2 &pic 13 /* INT B on slot 12 is irq 13 */
78 0x6000 0 0 3 &pic 14 /* INT C on slot 12 is irq 14 */
79 0x6000 0 0 4 &pic 15 /* INT D on slot 12 is irq 15 */
80 >;
81 };
82
42 fpga { 83 fpga {
43 /* 84 /*
44 * The Integator/AP predates the idea to have magic numbers 85 * The Integator/AP predates the idea to have magic numbers
diff --git a/arch/arm/boot/dts/keystone.dts b/arch/arm/boot/dts/keystone.dts
new file mode 100644
index 000000000000..1334b42c6b77
--- /dev/null
+++ b/arch/arm/boot/dts/keystone.dts
@@ -0,0 +1,117 @@
1/*
2 * Copyright 2013 Texas Instruments, 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/include/ "skeleton.dtsi"
11
12/ {
13 model = "Texas Instruments Keystone 2 SoC";
14 compatible = "ti,keystone-evm";
15 #address-cells = <2>;
16 #size-cells = <2>;
17 interrupt-parent = <&gic>;
18
19 aliases {
20 serial0 = &uart0;
21 };
22
23 memory {
24 reg = <0x00000000 0x80000000 0x00000000 0x40000000>;
25 };
26
27 cpus {
28 #address-cells = <1>;
29 #size-cells = <0>;
30
31 interrupt-parent = <&gic>;
32
33 cpu@0 {
34 compatible = "arm,cortex-a15";
35 device_type = "cpu";
36 reg = <0>;
37 };
38
39 cpu@1 {
40 compatible = "arm,cortex-a15";
41 device_type = "cpu";
42 reg = <1>;
43 };
44
45 cpu@2 {
46 compatible = "arm,cortex-a15";
47 device_type = "cpu";
48 reg = <2>;
49 };
50
51 cpu@3 {
52 compatible = "arm,cortex-a15";
53 device_type = "cpu";
54 reg = <3>;
55 };
56 };
57
58 gic: interrupt-controller {
59 compatible = "arm,cortex-a15-gic";
60 #interrupt-cells = <3>;
61 #size-cells = <0>;
62 #address-cells = <1>;
63 interrupt-controller;
64 reg = <0x0 0x02561000 0x0 0x1000>,
65 <0x0 0x02562000 0x0 0x2000>;
66 };
67
68 timer {
69 compatible = "arm,armv7-timer";
70 interrupts = <1 13 0xf08>,
71 <1 14 0xf08>,
72 <1 11 0xf08>,
73 <1 10 0x308>;
74 };
75
76 pmu {
77 compatible = "arm,cortex-a15-pmu";
78 interrupts = <0 20 0xf01>,
79 <0 21 0xf01>,
80 <0 22 0xf01>,
81 <0 23 0xf01>;
82 };
83
84 soc {
85 #address-cells = <1>;
86 #size-cells = <1>;
87 compatible = "ti,keystone","simple-bus";
88 interrupt-parent = <&gic>;
89 ranges = <0x0 0x0 0x0 0xc0000000>;
90
91 rstctrl: reset-controller {
92 compatible = "ti,keystone-reset";
93 reg = <0x023100e8 4>; /* pll reset control reg */
94 };
95
96 uart0: serial@02530c00 {
97 compatible = "ns16550a";
98 current-speed = <115200>;
99 reg-shift = <2>;
100 reg-io-width = <4>;
101 reg = <0x02530c00 0x100>;
102 clock-frequency = <133120000>;
103 interrupts = <0 277 0xf01>;
104 };
105
106 uart1: serial@02531000 {
107 compatible = "ns16550a";
108 current-speed = <115200>;
109 reg-shift = <2>;
110 reg-io-width = <4>;
111 reg = <0x02531000 0x100>;
112 clock-frequency = <133120000>;
113 interrupts = <0 280 0xf01>;
114 };
115
116 };
117};
diff --git a/arch/arm/boot/dts/kirkwood-6281.dtsi b/arch/arm/boot/dts/kirkwood-6281.dtsi
index d6c9d65cbaeb..1e5bef0bead7 100644
--- a/arch/arm/boot/dts/kirkwood-6281.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6281.dtsi
@@ -40,5 +40,64 @@
40 marvell,function = "sdio"; 40 marvell,function = "sdio";
41 }; 41 };
42 }; 42 };
43
44 pcie-controller {
45 compatible = "marvell,kirkwood-pcie";
46 status = "disabled";
47 device_type = "pci";
48
49 #address-cells = <3>;
50 #size-cells = <2>;
51
52 bus-range = <0x00 0xff>;
53
54 ranges = <0x82000000 0 0x00040000 0x00040000 0 0x00002000 /* Port 0.0 registers */
55 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
56 0x81000000 0 0 0xe8000000 0 0x00100000>; /* downstream I/O */
57
58 pcie@1,0 {
59 device_type = "pci";
60 assigned-addresses = <0x82000800 0 0x00040000 0 0x2000>;
61 reg = <0x0800 0 0 0 0>;
62 #address-cells = <3>;
63 #size-cells = <2>;
64 #interrupt-cells = <1>;
65 ranges;
66 interrupt-map-mask = <0 0 0 0>;
67 interrupt-map = <0 0 0 0 &intc 9>;
68 marvell,pcie-port = <0>;
69 marvell,pcie-lane = <0>;
70 clocks = <&gate_clk 2>;
71 status = "disabled";
72 };
73 };
74
75 rtc@10300 {
76 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
77 reg = <0x10300 0x20>;
78 interrupts = <53>;
79 clocks = <&gate_clk 7>;
80 };
81
82 sata@80000 {
83 compatible = "marvell,orion-sata";
84 reg = <0x80000 0x5000>;
85 interrupts = <21>;
86 clocks = <&gate_clk 14>, <&gate_clk 15>;
87 clock-names = "0", "1";
88 status = "disabled";
89 };
90
91 mvsdio@90000 {
92 compatible = "marvell,orion-sdio";
93 reg = <0x90000 0x200>;
94 interrupts = <28>;
95 clocks = <&gate_clk 4>;
96 bus-width = <4>;
97 cap-sdio-irq;
98 cap-sd-highspeed;
99 cap-mmc-highspeed;
100 status = "disabled";
101 };
43 }; 102 };
44}; 103};
diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi
index 23991e45bc55..a63a11137262 100644
--- a/arch/arm/boot/dts/kirkwood-6282.dtsi
+++ b/arch/arm/boot/dts/kirkwood-6282.dtsi
@@ -49,6 +49,34 @@
49 }; 49 };
50 }; 50 };
51 51
52 rtc@10300 {
53 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
54 reg = <0x10300 0x20>;
55 interrupts = <53>;
56 clocks = <&gate_clk 7>;
57 };
58
59 sata@80000 {
60 compatible = "marvell,orion-sata";
61 reg = <0x80000 0x5000>;
62 interrupts = <21>;
63 clocks = <&gate_clk 14>, <&gate_clk 15>;
64 clock-names = "0", "1";
65 status = "disabled";
66 };
67
68 mvsdio@90000 {
69 compatible = "marvell,orion-sdio";
70 reg = <0x90000 0x200>;
71 interrupts = <28>;
72 clocks = <&gate_clk 4>;
73 bus-width = <4>;
74 cap-sdio-irq;
75 cap-sd-highspeed;
76 cap-mmc-highspeed;
77 status = "disabled";
78 };
79
52 thermal@10078 { 80 thermal@10078 {
53 compatible = "marvell,kirkwood-thermal"; 81 compatible = "marvell,kirkwood-thermal";
54 reg = <0x10078 0x4>; 82 reg = <0x10078 0x4>;
@@ -65,5 +93,53 @@
65 clocks = <&gate_clk 7>; 93 clocks = <&gate_clk 7>;
66 status = "disabled"; 94 status = "disabled";
67 }; 95 };
96
97 pcie-controller {
98 compatible = "marvell,kirkwood-pcie";
99 status = "disabled";
100 device_type = "pci";
101
102 #address-cells = <3>;
103 #size-cells = <2>;
104
105 bus-range = <0x00 0xff>;
106
107 ranges = <0x82000000 0 0x00040000 0x00040000 0 0x00002000 /* Port 0.0 registers */
108 0x82000000 0 0x00044000 0x00044000 0 0x00002000 /* Port 1.0 registers */
109 0x82000000 0 0xe0000000 0xe0000000 0 0x08000000 /* non-prefetchable memory */
110 0x81000000 0 0 0xe8000000 0 0x00100000>; /* downstream I/O */
111
112 pcie@1,0 {
113 device_type = "pci";
114 assigned-addresses = <0x82000800 0 0x00040000 0 0x2000>;
115 reg = <0x0800 0 0 0 0>;
116 #address-cells = <3>;
117 #size-cells = <2>;
118 #interrupt-cells = <1>;
119 ranges;
120 interrupt-map-mask = <0 0 0 0>;
121 interrupt-map = <0 0 0 0 &intc 9>;
122 marvell,pcie-port = <0>;
123 marvell,pcie-lane = <0>;
124 clocks = <&gate_clk 2>;
125 status = "disabled";
126 };
127
128 pcie@2,0 {
129 device_type = "pci";
130 assigned-addresses = <0x82001000 0 0x00044000 0 0x2000>;
131 reg = <0x1000 0 0 0 0>;
132 #address-cells = <3>;
133 #size-cells = <2>;
134 #interrupt-cells = <1>;
135 ranges;
136 interrupt-map-mask = <0 0 0 0>;
137 interrupt-map = <0 0 0 0 &intc 10>;
138 marvell,pcie-port = <1>;
139 marvell,pcie-lane = <0>;
140 clocks = <&gate_clk 18>;
141 status = "disabled";
142 };
143 };
68 }; 144 };
69}; 145};
diff --git a/arch/arm/boot/dts/kirkwood-cloudbox.dts b/arch/arm/boot/dts/kirkwood-cloudbox.dts
index 5f21d4e427b0..00c48d26de68 100644
--- a/arch/arm/boot/dts/kirkwood-cloudbox.dts
+++ b/arch/arm/boot/dts/kirkwood-cloudbox.dts
@@ -18,10 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21 pinctrl-0 = < &pmx_spi &pmx_uart0
22 &pmx_cloudbox_sata0 >;
23 pinctrl-names = "default";
24
25 pmx_cloudbox_sata0: pmx-cloudbox-sata0 { 21 pmx_cloudbox_sata0: pmx-cloudbox-sata0 {
26 marvell,pins = "mpp15"; 22 marvell,pins = "mpp15";
27 marvell,function = "sata0"; 23 marvell,function = "sata0";
@@ -29,16 +25,22 @@
29 }; 25 };
30 26
31 serial@12000 { 27 serial@12000 {
28 pinctrl-0 = <&pmx_uart0>;
29 pinctrl-names = "default";
32 clock-frequency = <166666667>; 30 clock-frequency = <166666667>;
33 status = "okay"; 31 status = "okay";
34 }; 32 };
35 33
36 sata@80000 { 34 sata@80000 {
35 pinctrl-0 = <&pmx_cloudbox_sata0>;
36 pinctrl-names = "default";
37 status = "okay"; 37 status = "okay";
38 nr-ports = <1>; 38 nr-ports = <1>;
39 }; 39 };
40 40
41 spi@10600 { 41 spi@10600 {
42 pinctrl-0 = <&pmx_spi>;
43 pinctrl-names = "default";
42 status = "okay"; 44 status = "okay";
43 45
44 flash@0 { 46 flash@0 {
diff --git a/arch/arm/boot/dts/kirkwood-db-88f6281.dts b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
new file mode 100644
index 000000000000..9d777edd1f36
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-db-88f6281.dts
@@ -0,0 +1,30 @@
1/*
2 * Marvell DB-88F6281-BP Development Board Setup
3 *
4 * Saeed Bishara <saeed@marvell.com>
5 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
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/dts-v1/;
13
14/include/ "kirkwood-db.dtsi"
15/include/ "kirkwood-6281.dtsi"
16
17/ {
18 model = "Marvell DB-88F6281-BP Development Board";
19 compatible = "marvell,db-88f6281-bp", "marvell,kirkwood-88f6281", "marvell,kirkwood";
20
21 ocp@f1000000 {
22 pcie-controller {
23 status = "okay";
24
25 pcie@1,0 {
26 status = "okay";
27 };
28 };
29 };
30};
diff --git a/arch/arm/boot/dts/kirkwood-db-88f6282.dts b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
new file mode 100644
index 000000000000..f4c852886d23
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-db-88f6282.dts
@@ -0,0 +1,34 @@
1/*
2 * Marvell DB-88F6282-BP Development Board Setup
3 *
4 * Saeed Bishara <saeed@marvell.com>
5 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
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/dts-v1/;
13
14/include/ "kirkwood-db.dtsi"
15/include/ "kirkwood-6282.dtsi"
16
17/ {
18 model = "Marvell DB-88F6282-BP Development Board";
19 compatible = "marvell,db-88f6282-bp", "marvell,kirkwood-88f6282", "marvell,kirkwood";
20
21 ocp@f1000000 {
22 pcie-controller {
23 status = "okay";
24
25 pcie@1,0 {
26 status = "okay";
27 };
28
29 pcie@2,0 {
30 status = "okay";
31 };
32 };
33 };
34};
diff --git a/arch/arm/boot/dts/kirkwood-db.dtsi b/arch/arm/boot/dts/kirkwood-db.dtsi
new file mode 100644
index 000000000000..c87cfb816120
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-db.dtsi
@@ -0,0 +1,89 @@
1/*
2 * Marvell DB-{88F6281,88F6282}-BP Development Board Setup
3 *
4 * Saeed Bishara <saeed@marvell.com>
5 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
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 * This file contains the definitions that are common between the 6281
12 * and 6282 variants of the Marvell Kirkwood Development Board.
13 */
14
15/include/ "kirkwood.dtsi"
16
17/ {
18 memory {
19 device_type = "memory";
20 reg = <0x00000000 0x20000000>; /* 512 MB */
21 };
22
23 chosen {
24 bootargs = "console=ttyS0,115200n8 earlyprintk";
25 };
26
27 ocp@f1000000 {
28 pinctrl@10000 {
29 pmx_sdio_gpios: pmx-sdio-gpios {
30 marvell,pins = "mpp37", "mpp38";
31 marvell,function = "gpio";
32 };
33 };
34
35 serial@12000 {
36 pinctrl-0 = <&pmx_uart0>;
37 pinctrl-names = "default";
38 clock-frequency = <200000000>;
39 status = "ok";
40 };
41
42 nand@3000000 {
43 pinctrl-0 = <&pmx_nand>;
44 pinctrl-names = "default";
45 chip-delay = <25>;
46 status = "okay";
47
48 partition@0 {
49 label = "uboot";
50 reg = <0x0 0x100000>;
51 };
52
53 partition@100000 {
54 label = "uImage";
55 reg = <0x100000 0x400000>;
56 };
57
58 partition@500000 {
59 label = "root";
60 reg = <0x500000 0x1fb00000>;
61 };
62 };
63
64 sata@80000 {
65 nr-ports = <2>;
66 status = "okay";
67 };
68
69 ehci@50000 {
70 status = "okay";
71 };
72
73 mvsdio@90000 {
74 pinctrl-0 = <&pmx_sdio_gpios>;
75 pinctrl-names = "default";
76 wp-gpios = <&gpio1 5 0>;
77 cd-gpios = <&gpio1 6 0>;
78 status = "okay";
79 };
80
81 pcie-controller {
82 status = "okay";
83
84 pcie@1,0 {
85 status = "okay";
86 };
87 };
88 };
89};
diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
index c9c44b2f62d7..14d4ceea3057 100644
--- a/arch/arm/boot/dts/kirkwood-dns320.dts
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -17,6 +17,11 @@
17 17
18 gpio-leds { 18 gpio-leds {
19 compatible = "gpio-leds"; 19 compatible = "gpio-leds";
20 pinctrl-0 = <&pmx_led_power &pmx_led_red_usb_320
21 &pmx_led_red_left_hdd &pmx_led_red_right_hdd
22 &pmx_led_white_usb>;
23 pinctrl-names = "default";
24
20 blue-power { 25 blue-power {
21 label = "dns320:blue:power"; 26 label = "dns320:blue:power";
22 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */ 27 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
@@ -46,6 +51,8 @@
46 }; 51 };
47 52
48 serial@12100 { 53 serial@12100 {
54 pinctrl-0 = <&pmx_uart1>;
55 pinctrl-names = "default";
49 status = "okay"; 56 status = "okay";
50 }; 57 };
51 }; 58 };
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
index e4e4930dc5cf..63872570e6ce 100644
--- a/arch/arm/boot/dts/kirkwood-dns325.dts
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -17,6 +17,11 @@
17 17
18 gpio-leds { 18 gpio-leds {
19 compatible = "gpio-leds"; 19 compatible = "gpio-leds";
20 pinctrl-0 = <&pmx_led_power &pmx_led_red_usb_325
21 &pmx_led_red_left_hdd &pmx_led_red_right_hdd
22 &pmx_led_white_usb>;
23 pinctrl-names = "default";
24
20 white-power { 25 white-power {
21 label = "dns325:white:power"; 26 label = "dns325:white:power";
22 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */ 27 gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index 6875ac00c174..0afe1d07c803 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -9,6 +9,10 @@
9 compatible = "gpio-keys"; 9 compatible = "gpio-keys";
10 #address-cells = <1>; 10 #address-cells = <1>;
11 #size-cells = <0>; 11 #size-cells = <0>;
12 pinctrl-0 = <&pmx_button_power &pmx_button_unmount
13 &pmx_button_reset>;
14 pinctrl-names = "default";
15
12 button@1 { 16 button@1 {
13 label = "Power button"; 17 label = "Power button";
14 linux,code = <116>; 18 linux,code = <116>;
@@ -29,6 +33,8 @@
29 gpio_fan { 33 gpio_fan {
30 /* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */ 34 /* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
31 compatible = "gpio-fan"; 35 compatible = "gpio-fan";
36 pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>;
37 pinctrl-names = "default";
32 gpios = <&gpio1 14 1 38 gpios = <&gpio1 14 1
33 &gpio1 13 1>; 39 &gpio1 13 1>;
34 gpio-fan,speed-map = <0 0 40 gpio-fan,speed-map = <0 0
@@ -38,27 +44,17 @@
38 44
39 gpio_poweroff { 45 gpio_poweroff {
40 compatible = "gpio-poweroff"; 46 compatible = "gpio-poweroff";
47 pinctrl-0 = <&pmx_power_off>;
48 pinctrl-names = "default";
41 gpios = <&gpio1 4 0>; 49 gpios = <&gpio1 4 0>;
42 }; 50 };
43 51
44 ocp@f1000000 { 52 ocp@f1000000 {
45 pinctrl: pinctrl@10000 { 53 pinctrl: pinctrl@10000 {
46 54
47 pinctrl-0 = < &pmx_nand &pmx_uart1 55 pinctrl-0 = <&pmx_power_back_on &pmx_present_sata0
48 &pmx_sata0 &pmx_sata1 56 &pmx_present_sata1 &pmx_fan_tacho
49 &pmx_led_power 57 &pmx_temp_alarm>;
50 &pmx_led_red_right_hdd
51 &pmx_led_red_left_hdd
52 &pmx_led_red_usb_325
53 &pmx_button_power
54 &pmx_led_red_usb_320
55 &pmx_power_off &pmx_power_back_on
56 &pmx_power_sata0 &pmx_power_sata1
57 &pmx_present_sata0 &pmx_present_sata1
58 &pmx_led_white_usb &pmx_fan_tacho
59 &pmx_fan_high_speed &pmx_fan_low_speed
60 &pmx_button_unmount &pmx_button_reset
61 &pmx_temp_alarm >;
62 pinctrl-names = "default"; 58 pinctrl-names = "default";
63 59
64 pmx_sata0: pmx-sata0 { 60 pmx_sata0: pmx-sata0 {
@@ -147,11 +143,15 @@
147 }; 143 };
148 }; 144 };
149 sata@80000 { 145 sata@80000 {
146 pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
147 pinctrl-names = "default";
150 status = "okay"; 148 status = "okay";
151 nr-ports = <2>; 149 nr-ports = <2>;
152 }; 150 };
153 151
154 nand@3000000 { 152 nand@3000000 {
153 pinctrl-0 = <&pmx_nand>;
154 pinctrl-names = "default";
155 status = "okay"; 155 status = "okay";
156 chip-delay = <35>; 156 chip-delay = <35>;
157 157
@@ -192,6 +192,8 @@
192 compatible = "simple-bus"; 192 compatible = "simple-bus";
193 #address-cells = <1>; 193 #address-cells = <1>;
194 #size-cells = <0>; 194 #size-cells = <0>;
195 pinctrl-0 = <&pmx_power_sata0 &pmx_power_sata1>;
196 pinctrl-names = "default";
195 197
196 sata0_power: regulator@1 { 198 sata0_power: regulator@1 {
197 compatible = "regulator-fixed"; 199 compatible = "regulator-fixed";
diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 0196cf6b0ef2..7714742bb8d8 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -18,11 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_usb_power_enable
23 &pmx_led_green &pmx_led_orange >;
24 pinctrl-names = "default";
25
26 pmx_usb_power_enable: pmx-usb-power-enable { 21 pmx_usb_power_enable: pmx-usb-power-enable {
27 marvell,pins = "mpp29"; 22 marvell,pins = "mpp29";
28 marvell,function = "gpio"; 23 marvell,function = "gpio";
@@ -62,6 +57,8 @@
62 }; 57 };
63 gpio-leds { 58 gpio-leds {
64 compatible = "gpio-leds"; 59 compatible = "gpio-leds";
60 pinctrl-0 = <&pmx_led_green &pmx_led_orange>;
61 pinctrl-names = "default";
65 62
66 health { 63 health {
67 label = "status:green:health"; 64 label = "status:green:health";
@@ -77,6 +74,8 @@
77 compatible = "simple-bus"; 74 compatible = "simple-bus";
78 #address-cells = <1>; 75 #address-cells = <1>;
79 #size-cells = <0>; 76 #size-cells = <0>;
77 pinctrl-0 = <&pmx_usb_power_enable>;
78 pinctrl-names = "default";
80 79
81 usb_power: regulator@1 { 80 usb_power: regulator@1 {
82 compatible = "regulator-fixed"; 81 compatible = "regulator-fixed";
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index 289e51d86372..36c7ba38d500 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -18,12 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_spi
23 &pmx_led_bluetooth &pmx_led_wifi
24 &pmx_led_wifi_ap >;
25 pinctrl-names = "default";
26
27 pmx_led_bluetooth: pmx-led-bluetooth { 21 pmx_led_bluetooth: pmx-led-bluetooth {
28 marvell,pins = "mpp47"; 22 marvell,pins = "mpp47";
29 marvell,function = "gpio"; 23 marvell,function = "gpio";
@@ -43,6 +37,8 @@
43 37
44 spi@10600 { 38 spi@10600 {
45 status = "okay"; 39 status = "okay";
40 pinctrl-0 = <&pmx_spi>;
41 pinctrl-names = "default";
46 42
47 m25p40@0 { 43 m25p40@0 {
48 #address-cells = <1>; 44 #address-cells = <1>;
@@ -79,11 +75,15 @@
79 pinctrl-names = "default"; 75 pinctrl-names = "default";
80 status = "okay"; 76 status = "okay";
81 /* No CD or WP GPIOs */ 77 /* No CD or WP GPIOs */
78 broken-cd;
82 }; 79 };
83 }; 80 };
84 81
85 gpio-leds { 82 gpio-leds {
86 compatible = "gpio-leds"; 83 compatible = "gpio-leds";
84 pinctrl-0 = <&pmx_led_bluetooth &pmx_led_wifi
85 &pmx_led_wifi_ap >;
86 pinctrl-names = "default";
87 87
88 bluetooth { 88 bluetooth {
89 label = "dreamplug:blue:bluetooth"; 89 label = "dreamplug:blue:bluetooth";
diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index c3573be7b92c..31caa6405065 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -18,15 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_usb_power_enable &pmx_led_orange
23 &pmx_led_left_cap_0 &pmx_led_left_cap_1
24 &pmx_led_left_cap_2 &pmx_led_left_cap_3
25 &pmx_led_right_cap_0 &pmx_led_right_cap_1
26 &pmx_led_right_cap_2 &pmx_led_right_cap_3
27 >;
28 pinctrl-names = "default";
29
30 pmx_usb_power_enable: pmx-usb-power-enable { 21 pmx_usb_power_enable: pmx-usb-power-enable {
31 marvell,pins = "mpp29"; 22 marvell,pins = "mpp29";
32 marvell,function = "gpio"; 23 marvell,function = "gpio";
@@ -109,6 +100,13 @@
109 }; 100 };
110 gpio-leds { 101 gpio-leds {
111 compatible = "gpio-leds"; 102 compatible = "gpio-leds";
103 pinctrl-0 = < &pmx_led_orange
104 &pmx_led_left_cap_0 &pmx_led_left_cap_1
105 &pmx_led_left_cap_2 &pmx_led_left_cap_3
106 &pmx_led_right_cap_0 &pmx_led_right_cap_1
107 &pmx_led_right_cap_2 &pmx_led_right_cap_3
108 >;
109 pinctrl-names = "default";
112 110
113 health { 111 health {
114 label = "status:green:health"; 112 label = "status:green:health";
@@ -156,6 +154,8 @@
156 compatible = "simple-bus"; 154 compatible = "simple-bus";
157 #address-cells = <1>; 155 #address-cells = <1>;
158 #size-cells = <0>; 156 #size-cells = <0>;
157 pinctrl-0 = <&pmx_usb_power_enable>;
158 pinctrl-names = "default";
159 159
160 usb_power: regulator@1 { 160 usb_power: regulator@1 {
161 compatible = "regulator-fixed"; 161 compatible = "regulator-fixed";
diff --git a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
index 44fd97dfc1f3..1e642f39b154 100644
--- a/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
+++ b/arch/arm/boot/dts/kirkwood-guruplug-server-plus.dts
@@ -18,11 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_led_health_r &pmx_led_health_g
23 &pmx_led_wmode_r &pmx_led_wmode_g >;
24 pinctrl-names = "default";
25
26 pmx_led_health_r: pmx-led-health-r { 21 pmx_led_health_r: pmx-led-health-r {
27 marvell,pins = "mpp46"; 22 marvell,pins = "mpp46";
28 marvell,function = "gpio"; 23 marvell,function = "gpio";
@@ -72,11 +67,16 @@
72 67
73 mvsdio@90000 { 68 mvsdio@90000 {
74 status = "okay"; 69 status = "okay";
70 /* No CD or WP GPIOs */
71 broken-cd;
75 }; 72 };
76 }; 73 };
77 74
78 gpio-leds { 75 gpio-leds {
79 compatible = "gpio-leds"; 76 compatible = "gpio-leds";
77 pinctrl-0 = < &pmx_led_health_r &pmx_led_health_g
78 &pmx_led_wmode_r &pmx_led_wmode_g >;
79 pinctrl-names = "default";
80 80
81 health-r { 81 health-r {
82 label = "guruplug:red:health"; 82 label = "guruplug:red:health";
diff --git a/arch/arm/boot/dts/kirkwood-ib62x0.dts b/arch/arm/boot/dts/kirkwood-ib62x0.dts
index 5335b1aa8601..20c4b081f420 100644
--- a/arch/arm/boot/dts/kirkwood-ib62x0.dts
+++ b/arch/arm/boot/dts/kirkwood-ib62x0.dts
@@ -18,13 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_nand
23 &pmx_led_os_red &pmx_power_off
24 &pmx_led_os_green &pmx_led_usb_transfer
25 &pmx_button_reset &pmx_button_usb_copy >;
26 pinctrl-names = "default";
27
28 pmx_led_os_red: pmx-led-os-red { 21 pmx_led_os_red: pmx-led-os-red {
29 marvell,pins = "mpp22"; 22 marvell,pins = "mpp22";
30 marvell,function = "gpio"; 23 marvell,function = "gpio";
@@ -61,6 +54,8 @@
61 54
62 nand@3000000 { 55 nand@3000000 {
63 status = "okay"; 56 status = "okay";
57 pinctrl-0 = <&pmx_nand>;
58 pinctrl-names = "default";
64 59
65 partition@0 { 60 partition@0 {
66 label = "u-boot"; 61 label = "u-boot";
@@ -84,6 +79,9 @@
84 compatible = "gpio-keys"; 79 compatible = "gpio-keys";
85 #address-cells = <1>; 80 #address-cells = <1>;
86 #size-cells = <0>; 81 #size-cells = <0>;
82 pinctrl-0 = <&pmx_button_reset &pmx_button_usb_copy>;
83 pinctrl-names = "default";
84
87 button@1 { 85 button@1 {
88 label = "USB Copy"; 86 label = "USB Copy";
89 linux,code = <133>; 87 linux,code = <133>;
@@ -97,6 +95,9 @@
97 }; 95 };
98 gpio-leds { 96 gpio-leds {
99 compatible = "gpio-leds"; 97 compatible = "gpio-leds";
98 pinctrl-0 = <&pmx_led_os_red &pmx_led_os_green
99 &pmx_led_usb_transfer>;
100 pinctrl-names = "default";
100 101
101 green-os { 102 green-os {
102 label = "ib62x0:green:os"; 103 label = "ib62x0:green:os";
@@ -114,6 +115,8 @@
114 }; 115 };
115 gpio_poweroff { 116 gpio_poweroff {
116 compatible = "gpio-poweroff"; 117 compatible = "gpio-poweroff";
118 pinctrl-0 = <&pmx_power_off>;
119 pinctrl-names = "default";
117 gpios = <&gpio0 24 0>; 120 gpios = <&gpio0 24 0>;
118 }; 121 };
119 122
diff --git a/arch/arm/boot/dts/kirkwood-iconnect.dts b/arch/arm/boot/dts/kirkwood-iconnect.dts
index 12ccf74ac3c4..441204e8abc6 100644
--- a/arch/arm/boot/dts/kirkwood-iconnect.dts
+++ b/arch/arm/boot/dts/kirkwood-iconnect.dts
@@ -20,51 +20,43 @@
20 20
21 ocp@f1000000 { 21 ocp@f1000000 {
22 pinctrl: pinctrl@10000 { 22 pinctrl: pinctrl@10000 {
23 23 pmx_button_reset: pmx-button-reset {
24 pinctrl-0 = < &pmx_gpio_12 &pmx_gpio_35
25 &pmx_gpio_41 &pmx_gpio_42
26 &pmx_gpio_43 &pmx_gpio_44
27 &pmx_gpio_45 &pmx_gpio_46
28 &pmx_gpio_47 &pmx_gpio_48 >;
29 pinctrl-names = "default";
30
31 pmx_gpio_12: pmx-gpio-12 {
32 marvell,pins = "mpp12"; 24 marvell,pins = "mpp12";
33 marvell,function = "gpio"; 25 marvell,function = "gpio";
34 }; 26 };
35 pmx_gpio_35: pmx-gpio-35 { 27 pmx_button_otb: pmx-button-otb {
36 marvell,pins = "mpp35"; 28 marvell,pins = "mpp35";
37 marvell,function = "gpio"; 29 marvell,function = "gpio";
38 }; 30 };
39 pmx_gpio_41: pmx-gpio-41 { 31 pmx_led_level: pmx-led-level {
40 marvell,pins = "mpp41"; 32 marvell,pins = "mpp41";
41 marvell,function = "gpio"; 33 marvell,function = "gpio";
42 }; 34 };
43 pmx_gpio_42: pmx-gpio-42 { 35 pmx_led_power_blue: pmx-led-power-blue {
44 marvell,pins = "mpp42"; 36 marvell,pins = "mpp42";
45 marvell,function = "gpio"; 37 marvell,function = "gpio";
46 }; 38 };
47 pmx_gpio_43: pmx-gpio-43 { 39 pmx_led_power_red: pmx-power-red {
48 marvell,pins = "mpp43"; 40 marvell,pins = "mpp43";
49 marvell,function = "gpio"; 41 marvell,function = "gpio";
50 }; 42 };
51 pmx_gpio_44: pmx-gpio-44 { 43 pmx_led_usb1: pmx-led-usb1 {
52 marvell,pins = "mpp44"; 44 marvell,pins = "mpp44";
53 marvell,function = "gpio"; 45 marvell,function = "gpio";
54 }; 46 };
55 pmx_gpio_45: pmx-gpio-45 { 47 pmx_led_usb2: pmx-led-usb2 {
56 marvell,pins = "mpp45"; 48 marvell,pins = "mpp45";
57 marvell,function = "gpio"; 49 marvell,function = "gpio";
58 }; 50 };
59 pmx_gpio_46: pmx-gpio-46 { 51 pmx_led_usb3: pmx-led-usb3 {
60 marvell,pins = "mpp46"; 52 marvell,pins = "mpp46";
61 marvell,function = "gpio"; 53 marvell,function = "gpio";
62 }; 54 };
63 pmx_gpio_47: pmx-gpio-47 { 55 pmx_led_usb4: pmx-led-usb4 {
64 marvell,pins = "mpp47"; 56 marvell,pins = "mpp47";
65 marvell,function = "gpio"; 57 marvell,function = "gpio";
66 }; 58 };
67 pmx_gpio_48: pmx-gpio-48 { 59 pmx_led_otb: pmx-led-otb {
68 marvell,pins = "mpp48"; 60 marvell,pins = "mpp48";
69 marvell,function = "gpio"; 61 marvell,function = "gpio";
70 }; 62 };
@@ -109,10 +101,23 @@
109 reg = <0x980000 0x1f400000>; 101 reg = <0x980000 0x1f400000>;
110 }; 102 };
111 }; 103 };
104
105 pcie-controller {
106 status = "okay";
107
108 pcie@1,0 {
109 status = "okay";
110 };
111 };
112 }; 112 };
113 113
114 gpio-leds { 114 gpio-leds {
115 compatible = "gpio-leds"; 115 compatible = "gpio-leds";
116 pinctrl-0 = < &pmx_led_level &pmx_led_power_blue
117 &pmx_led_power_red &pmx_led_usb1
118 &pmx_led_usb2 &pmx_led_usb3
119 &pmx_led_usb4 &pmx_led_otb >;
120 pinctrl-names = "default";
116 121
117 led-level { 122 led-level {
118 label = "led_level"; 123 label = "led_level";
@@ -154,6 +159,9 @@
154 compatible = "gpio-keys"; 159 compatible = "gpio-keys";
155 #address-cells = <1>; 160 #address-cells = <1>;
156 #size-cells = <0>; 161 #size-cells = <0>;
162 pinctrl-0 = < &pmx_button_reset &pmx_button_otb >;
163 pinctrl-names = "default";
164
157 button@1 { 165 button@1 {
158 label = "OTB Button"; 166 label = "OTB Button";
159 linux,code = <133>; 167 linux,code = <133>;
diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
index 3694e94f6e99..00a7bfe5e83b 100644
--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -18,12 +18,7 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21 21 pinctrl-0 = < &pmx_led_sata_brt_ctrl_1
22 pinctrl-0 = < &pmx_button_reset &pmx_button_power
23 &pmx_led_backup &pmx_led_power
24 &pmx_button_otb &pmx_led_rebuild
25 &pmx_led_health
26 &pmx_led_sata_brt_ctrl_1
27 &pmx_led_sata_brt_ctrl_2 22 &pmx_led_sata_brt_ctrl_2
28 &pmx_led_backup_brt_ctrl_1 23 &pmx_led_backup_brt_ctrl_1
29 &pmx_led_backup_brt_ctrl_2 24 &pmx_led_backup_brt_ctrl_2
@@ -151,6 +146,9 @@
151 }; 146 };
152 gpio-leds { 147 gpio-leds {
153 compatible = "gpio-leds"; 148 compatible = "gpio-leds";
149 pinctrl-0 = < &pmx_led_backup &pmx_led_power
150 &pmx_led_rebuild &pmx_led_health >;
151 pinctrl-names = "default";
154 152
155 power_led { 153 power_led {
156 label = "status:white:power_led"; 154 label = "status:white:power_led";
@@ -174,6 +172,11 @@
174 compatible = "gpio-keys"; 172 compatible = "gpio-keys";
175 #address-cells = <1>; 173 #address-cells = <1>;
176 #size-cells = <0>; 174 #size-cells = <0>;
175 pinctrl-0 = <&pmx_button_reset &pmx_button_power
176 &pmx_button_otb>;
177 pinctrl-names = "default";
178
179
177 Power { 180 Power {
178 label = "Power Button"; 181 label = "Power Button";
179 linux,code = <116>; 182 linux,code = <116>;
diff --git a/arch/arm/boot/dts/kirkwood-is2.dts b/arch/arm/boot/dts/kirkwood-is2.dts
index 0bdce0ad7277..c3f036b86cca 100644
--- a/arch/arm/boot/dts/kirkwood-is2.dts
+++ b/arch/arm/boot/dts/kirkwood-is2.dts
@@ -13,6 +13,8 @@
13 13
14 ocp@f1000000 { 14 ocp@f1000000 {
15 sata@80000 { 15 sata@80000 {
16 pinctrl-0 = <&pmx_ns2_sata0>;
17 pinctrl-names = "default";
16 status = "okay"; 18 status = "okay";
17 nr-ports = <1>; 19 nr-ports = <1>;
18 }; 20 };
diff --git a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
index 5bbd0542cdd3..5d9f5ea78700 100644
--- a/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
+++ b/arch/arm/boot/dts/kirkwood-km_kirkwood.dts
@@ -18,9 +18,7 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21 21 pinctrl-0 = < &pmx_i2c_gpio_sda &pmx_i2c_gpio_scl >;
22 pinctrl-0 = < &pmx_nand &pmx_i2c_gpio_sda
23 &pmx_i2c_gpio_scl >;
24 pinctrl-names = "default"; 22 pinctrl-names = "default";
25 23
26 pmx_i2c_gpio_sda: pmx-gpio-sda { 24 pmx_i2c_gpio_sda: pmx-gpio-sda {
@@ -38,8 +36,17 @@
38 }; 36 };
39 37
40 nand@3000000 { 38 nand@3000000 {
39 pinctrl-0 = <&pmx_nand>;
40 pinctrl-names = "default";
41 status = "ok"; 41 status = "ok";
42 chip-delay = <25>; 42 chip-delay = <25>;
43 }; 43 };
44 }; 44 };
45
46 i2c@0 {
47 compatible = "i2c-gpio";
48 gpios = < &gpio0 8 0 /* sda */
49 &gpio0 9 0 >; /* scl */
50 i2c-gpio,delay-us = <2>; /* ~100 kHz */
51 };
45}; 52};
diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
index 37d45c4f88fb..31b17f5b9d28 100644
--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -8,16 +8,6 @@
8 8
9 ocp@f1000000 { 9 ocp@f1000000 {
10 pinctrl: pinctrl@10000 { 10 pinctrl: pinctrl@10000 {
11
12 pinctrl-0 = < &pmx_power_hdd &pmx_usb_vbus
13 &pmx_fan_low &pmx_fan_high
14 &pmx_led_function_red &pmx_led_alarm
15 &pmx_led_info &pmx_led_power
16 &pmx_fan_lock &pmx_button_function
17 &pmx_power_switch &pmx_power_auto_switch
18 &pmx_led_function_blue >;
19 pinctrl-names = "default";
20
21 pmx_power_hdd: pmx-power-hdd { 11 pmx_power_hdd: pmx-power-hdd {
22 marvell,pins = "mpp10"; 12 marvell,pins = "mpp10";
23 marvell,function = "gpo"; 13 marvell,function = "gpo";
@@ -112,6 +102,10 @@
112 compatible = "gpio-keys"; 102 compatible = "gpio-keys";
113 #address-cells = <1>; 103 #address-cells = <1>;
114 #size-cells = <0>; 104 #size-cells = <0>;
105 pinctrl-0 = <&pmx_button_function &pmx_power_switch
106 &pmx_power_auto_switch>;
107 pinctrl-names = "default";
108
115 button@1 { 109 button@1 {
116 label = "Function Button"; 110 label = "Function Button";
117 linux,code = <357>; 111 linux,code = <357>;
@@ -133,6 +127,10 @@
133 127
134 gpio_leds { 128 gpio_leds {
135 compatible = "gpio-leds"; 129 compatible = "gpio-leds";
130 pinctrl-0 = <&pmx_led_function_red &pmx_led_alarm
131 &pmx_led_info &pmx_led_power
132 &pmx_led_function_blue>;
133 pinctrl-names = "default";
136 134
137 led@1 { 135 led@1 {
138 label = "lsxl:blue:func"; 136 label = "lsxl:blue:func";
@@ -163,6 +161,8 @@
163 161
164 gpio_fan { 162 gpio_fan {
165 compatible = "gpio-fan"; 163 compatible = "gpio-fan";
164 pinctrl-0 = <&pmx_fan_low &pmx_fan_high &pmx_fan_lock>;
165 pinctrl-names = "default";
166 gpios = <&gpio0 19 1 166 gpios = <&gpio0 19 1
167 &gpio0 18 1>; 167 &gpio0 18 1>;
168 gpio-fan,speed-map = <0 3 168 gpio-fan,speed-map = <0 3
@@ -172,10 +172,16 @@
172 alarm-gpios = <&gpio1 8 0>; 172 alarm-gpios = <&gpio1 8 0>;
173 }; 173 };
174 174
175 restart_poweroff {
176 compatible = "restart-poweroff";
177 };
178
175 regulators { 179 regulators {
176 compatible = "simple-bus"; 180 compatible = "simple-bus";
177 #address-cells = <1>; 181 #address-cells = <1>;
178 #size-cells = <0>; 182 #size-cells = <0>;
183 pinctrl-0 = <&pmx_power_hdd &pmx_usb_vbus>;
184 pinctrl-names = "default";
179 185
180 usb_power: regulator@1 { 186 usb_power: regulator@1 {
181 compatible = "regulator-fixed"; 187 compatible = "regulator-fixed";
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index 758824118a9a..6179333fd71f 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -18,16 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_nand &pmx_uart0
23 &pmx_led_health
24 &pmx_sata0 &pmx_sata1
25 &pmx_led_user1o
26 &pmx_led_user1g &pmx_led_user0o
27 &pmx_led_user0g &pmx_led_misc
28 >;
29 pinctrl-names = "default";
30
31 pmx_led_health: pmx-led-health { 21 pmx_led_health: pmx-led-health {
32 marvell,pins = "mpp7"; 22 marvell,pins = "mpp7";
33 marvell,function = "gpo"; 23 marvell,function = "gpo";
@@ -91,9 +81,13 @@
91 81
92 serial@12000 { 82 serial@12000 {
93 status = "ok"; 83 status = "ok";
84 pinctrl-0 = <&pmx_uart0>;
85 pinctrl-names = "default";
94 }; 86 };
95 87
96 nand@3000000 { 88 nand@3000000 {
89 pinctrl-0 = <&pmx_nand>;
90 pinctrl-names = "default";
97 status = "okay"; 91 status = "okay";
98 92
99 partition@0 { 93 partition@0 {
@@ -127,22 +121,37 @@
127 }; 121 };
128 122
129 sata@80000 { 123 sata@80000 {
124 pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
125 pinctrl-names = "default";
130 nr-ports = <2>; 126 nr-ports = <2>;
131 status = "okay"; 127 status = "okay";
132
133 }; 128 };
134 129
135 mvsdio@90000 { 130 mvsdio@90000 {
136 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>; 131 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>;
137 pinctrl-names = "default"; 132 pinctrl-names = "default";
138 status = "okay"; 133 status = "okay";
139 cd-gpios = <&gpio1 15 0>; 134 cd-gpios = <&gpio1 15 1>;
140 /* No WP GPIO */ 135 /* No WP GPIO */
141 }; 136 };
137
138 pcie-controller {
139 status = "okay";
140
141 pcie@1,0 {
142 status = "okay";
143 };
144 };
142 }; 145 };
143 146
144 gpio-leds { 147 gpio-leds {
145 compatible = "gpio-leds"; 148 compatible = "gpio-leds";
149 pinctrl-0 = < &pmx_led_health
150 &pmx_led_user1o
151 &pmx_led_user1g &pmx_led_user0o
152 &pmx_led_user0g &pmx_led_misc
153 >;
154 pinctrl-names = "default";
146 155
147 health { 156 health {
148 label = "status:green:health"; 157 label = "status:green:health";
diff --git a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
index 1ca66ab83ad6..ad6ade7d9191 100644
--- a/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
+++ b/arch/arm/boot/dts/kirkwood-netgear_readynas_duo_v2.dts
@@ -18,18 +18,6 @@
18 18
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21
22 pinctrl-0 = < &pmx_uart0
23 &pmx_button_power
24 &pmx_button_backup
25 &pmx_button_reset
26 &pmx_led_blue_power
27 &pmx_led_blue_activity
28 &pmx_led_blue_disk1
29 &pmx_led_blue_disk2
30 &pmx_led_blue_backup >;
31 pinctrl-names = "default";
32
33 pmx_button_power: pmx-button-power { 21 pmx_button_power: pmx-button-power {
34 marvell,pins = "mpp47"; 22 marvell,pins = "mpp47";
35 marvell,function = "gpio"; 23 marvell,function = "gpio";
@@ -74,6 +62,8 @@
74 }; 62 };
75 63
76 serial@12000 { 64 serial@12000 {
65 pinctrl-0 = <&pmx_uart0>;
66 pinctrl-names = "default";
77 status = "okay"; 67 status = "okay";
78 }; 68 };
79 69
@@ -111,10 +101,22 @@
111 status = "okay"; 101 status = "okay";
112 nr-ports = <2>; 102 nr-ports = <2>;
113 }; 103 };
104
105 pcie-controller {
106 status = "okay";
107
108 pcie@1,0 {
109 status = "okay";
110 };
111 };
114 }; 112 };
115 113
116 gpio-leds { 114 gpio-leds {
117 compatible = "gpio-leds"; 115 compatible = "gpio-leds";
116 pinctrl-0 = < &pmx_led_blue_power &pmx_led_blue_activity
117 &pmx_led_blue_disk1 &pmx_led_blue_disk2
118 &pmx_led_blue_backup >;
119 pinctrl-names = "default";
118 120
119 power_led { 121 power_led {
120 label = "status:blue:power_led"; 122 label = "status:blue:power_led";
@@ -143,6 +145,10 @@
143 compatible = "gpio-keys"; 145 compatible = "gpio-keys";
144 #address-cells = <1>; 146 #address-cells = <1>;
145 #size-cells = <0>; 147 #size-cells = <0>;
148 pinctrl-0 = <&pmx_button_power &pmx_button_backup
149 &pmx_button_reset>;
150 pinctrl-names = "default";
151
146 button@1 { 152 button@1 {
147 label = "Power Button"; 153 label = "Power Button";
148 linux,code = <116>; /* KEY_POWER */ 154 linux,code = <116>; /* KEY_POWER */
diff --git a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
index 6affd924fe11..2afac0405816 100644
--- a/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ns2-common.dtsi
@@ -8,10 +8,6 @@
8 8
9 ocp@f1000000 { 9 ocp@f1000000 {
10 pinctrl: pinctrl@10000 { 10 pinctrl: pinctrl@10000 {
11 pinctrl-0 = < &pmx_spi &pmx_twsi0 &pmx_uart0
12 &pmx_ns2_sata0 &pmx_ns2_sata1>;
13 pinctrl-names = "default";
14
15 pmx_ns2_sata0: pmx-ns2-sata0 { 11 pmx_ns2_sata0: pmx-ns2-sata0 {
16 marvell,pins = "mpp21"; 12 marvell,pins = "mpp21";
17 marvell,function = "sata0"; 13 marvell,function = "sata0";
@@ -23,10 +19,14 @@
23 }; 19 };
24 20
25 serial@12000 { 21 serial@12000 {
22 pinctrl-0 = <&pmx_uart0>;
23 pinctrl-names = "default";
26 status = "okay"; 24 status = "okay";
27 }; 25 };
28 26
29 spi@10600 { 27 spi@10600 {
28 pinctrl-0 = <&pmx_spi>;
29 pinctrl-names = "default";
30 status = "okay"; 30 status = "okay";
31 31
32 flash@0 { 32 flash@0 {
@@ -45,6 +45,8 @@
45 }; 45 };
46 46
47 i2c@11000 { 47 i2c@11000 {
48 pinctrl-0 = <&pmx_twsi0>;
49 pinctrl-names = "default";
48 status = "okay"; 50 status = "okay";
49 51
50 eeprom@50 { 52 eeprom@50 {
diff --git a/arch/arm/boot/dts/kirkwood-ns2.dts b/arch/arm/boot/dts/kirkwood-ns2.dts
index f2d36ecf36d8..b50e93d7796c 100644
--- a/arch/arm/boot/dts/kirkwood-ns2.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2.dts
@@ -13,6 +13,8 @@
13 13
14 ocp@f1000000 { 14 ocp@f1000000 {
15 sata@80000 { 15 sata@80000 {
16 pinctrl-0 = <&pmx_ns2_sata0>;
17 pinctrl-names = "default";
16 status = "okay"; 18 status = "okay";
17 nr-ports = <1>; 19 nr-ports = <1>;
18 }; 20 };
diff --git a/arch/arm/boot/dts/kirkwood-ns2lite.dts b/arch/arm/boot/dts/kirkwood-ns2lite.dts
index b02eb4ea1bb4..af8259fe8955 100644
--- a/arch/arm/boot/dts/kirkwood-ns2lite.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2lite.dts
@@ -13,6 +13,8 @@
13 13
14 ocp@f1000000 { 14 ocp@f1000000 {
15 sata@80000 { 15 sata@80000 {
16 pinctrl-0 = <&pmx_ns2_sata0>;
17 pinctrl-names = "default";
16 status = "okay"; 18 status = "okay";
17 nr-ports = <1>; 19 nr-ports = <1>;
18 }; 20 };
diff --git a/arch/arm/boot/dts/kirkwood-ns2max.dts b/arch/arm/boot/dts/kirkwood-ns2max.dts
index bcec4d6cada7..85f24d227e17 100644
--- a/arch/arm/boot/dts/kirkwood-ns2max.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2max.dts
@@ -13,6 +13,8 @@
13 13
14 ocp@f1000000 { 14 ocp@f1000000 {
15 sata@80000 { 15 sata@80000 {
16 pinctrl-0 = <&pmx_ns2_sata0 &pmx_ns2_sata1>;
17 pinctrl-names = "default";
16 status = "okay"; 18 status = "okay";
17 nr-ports = <2>; 19 nr-ports = <2>;
18 }; 20 };
diff --git a/arch/arm/boot/dts/kirkwood-ns2mini.dts b/arch/arm/boot/dts/kirkwood-ns2mini.dts
index adab1ab25733..329e530bffe7 100644
--- a/arch/arm/boot/dts/kirkwood-ns2mini.dts
+++ b/arch/arm/boot/dts/kirkwood-ns2mini.dts
@@ -14,6 +14,8 @@
14 14
15 ocp@f1000000 { 15 ocp@f1000000 {
16 sata@80000 { 16 sata@80000 {
17 pinctrl-0 = <&pmx_ns2_sata0>;
18 pinctrl-names = "default";
17 status = "okay"; 19 status = "okay";
18 nr-ports = <1>; 20 nr-ports = <1>;
19 }; 21 };
diff --git a/arch/arm/boot/dts/kirkwood-nsa310.dts b/arch/arm/boot/dts/kirkwood-nsa310.dts
index a7412b937a8a..69003598f5fa 100644
--- a/arch/arm/boot/dts/kirkwood-nsa310.dts
+++ b/arch/arm/boot/dts/kirkwood-nsa310.dts
@@ -1,6 +1,7 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi"
4 5
5/ { 6/ {
6 model = "ZyXEL NSA310"; 7 model = "ZyXEL NSA310";
@@ -17,22 +18,7 @@
17 18
18 ocp@f1000000 { 19 ocp@f1000000 {
19 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
20 pinctrl-0 = < &pmx_led_esata_green 21 pinctrl-0 = <&pmx_unknown>;
21 &pmx_led_esata_red
22 &pmx_led_usb_green
23 &pmx_led_usb_red
24 &pmx_usb_power_off
25 &pmx_led_sys_green
26 &pmx_led_sys_red
27 &pmx_btn_reset
28 &pmx_btn_copy
29 &pmx_led_copy_green
30 &pmx_led_copy_red
31 &pmx_led_hdd_green
32 &pmx_led_hdd_red
33 &pmx_unknown
34 &pmx_btn_power
35 &pmx_pwr_off >;
36 pinctrl-names = "default"; 22 pinctrl-names = "default";
37 23
38 pmx_led_esata_green: pmx-led-esata-green { 24 pmx_led_esata_green: pmx-led-esata-green {
@@ -176,12 +162,22 @@
176 reg = <0x5040000 0x2fc0000>; 162 reg = <0x5040000 0x2fc0000>;
177 }; 163 };
178 }; 164 };
165
166 pcie-controller {
167 status = "okay";
168
169 pcie@1,0 {
170 status = "okay";
171 };
172 };
179 }; 173 };
180 174
181 gpio_keys { 175 gpio_keys {
182 compatible = "gpio-keys"; 176 compatible = "gpio-keys";
183 #address-cells = <1>; 177 #address-cells = <1>;
184 #size-cells = <0>; 178 #size-cells = <0>;
179 pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
180 pinctrl-names = "default";
185 181
186 button@1 { 182 button@1 {
187 label = "Power Button"; 183 label = "Power Button";
@@ -202,6 +198,12 @@
202 198
203 gpio-leds { 199 gpio-leds {
204 compatible = "gpio-leds"; 200 compatible = "gpio-leds";
201 pinctrl-0 = <&pmx_led_esata_green &pmx_led_esata_red
202 &pmx_led_usb_green &pmx_led_usb_red
203 &pmx_led_sys_green &pmx_led_sys_red
204 &pmx_led_copy_green &pmx_led_copy_red
205 &pmx_led_hdd_green &pmx_led_hdd_red>;
206 pinctrl-names = "default";
205 207
206 green-sys { 208 green-sys {
207 label = "nsa310:green:sys"; 209 label = "nsa310:green:sys";
@@ -247,6 +249,8 @@
247 249
248 gpio_poweroff { 250 gpio_poweroff {
249 compatible = "gpio-poweroff"; 251 compatible = "gpio-poweroff";
252 pinctrl-0 = <&pmx_pwr_off>;
253 pinctrl-names = "default";
250 gpios = <&gpio1 16 0>; 254 gpios = <&gpio1 16 0>;
251 }; 255 };
252 256
@@ -254,6 +258,8 @@
254 compatible = "simple-bus"; 258 compatible = "simple-bus";
255 #address-cells = <1>; 259 #address-cells = <1>;
256 #size-cells = <0>; 260 #size-cells = <0>;
261 pinctrl-0 = <&pmx_usb_power_off>;
262 pinctrl-names = "default";
257 263
258 usb0_power_off: regulator@1 { 264 usb0_power_off: regulator@1 {
259 compatible = "regulator-fixed"; 265 compatible = "regulator-fixed";
diff --git a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
index d27f7245f8e7..38dc8517d777 100644
--- a/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
+++ b/arch/arm/boot/dts/kirkwood-openblocks_a6.dts
@@ -19,15 +19,21 @@
19 ocp@f1000000 { 19 ocp@f1000000 {
20 serial@12000 { 20 serial@12000 {
21 status = "ok"; 21 status = "ok";
22 pinctrl-0 = <&pmx_uart0>;
23 pinctrl-names = "default";
22 }; 24 };
23 25
24 serial@12100 { 26 serial@12100 {
25 status = "ok"; 27 status = "ok";
28 pinctrl-0 = <&pmx_uart1>;
29 pinctrl-names = "default";
26 }; 30 };
27 31
28 nand@3000000 { 32 nand@3000000 {
29 chip-delay = <25>; 33 chip-delay = <25>;
30 status = "okay"; 34 status = "okay";
35 pinctrl-0 = <&pmx_nand>;
36 pinctrl-names = "default";
31 37
32 partition@0 { 38 partition@0 {
33 label = "uboot"; 39 label = "uboot";
@@ -67,6 +73,8 @@
67 73
68 i2c@11100 { 74 i2c@11100 {
69 status = "okay"; 75 status = "okay";
76 pinctrl-0 = <&pmx_twsi1>;
77 pinctrl-names = "default";
70 78
71 s35390a: s35390a@30 { 79 s35390a: s35390a@30 {
72 compatible = "s35390a"; 80 compatible = "s35390a";
@@ -75,16 +83,7 @@
75 }; 83 };
76 84
77 pinctrl: pinctrl@10000 { 85 pinctrl: pinctrl@10000 {
78 pinctrl-0 = < &pmx_nand &pmx_uart0 86 pinctrl-0 = <&pmx_dip_switches &pmx_gpio_header>;
79 &pmx_uart1 &pmx_twsi1
80 &pmx_dip_sw0 &pmx_dip_sw1
81 &pmx_dip_sw2 &pmx_dip_sw3
82 &pmx_gpio_0 &pmx_gpio_1
83 &pmx_gpio_2 &pmx_gpio_3
84 &pmx_gpio_4 &pmx_gpio_5
85 &pmx_gpio_6 &pmx_gpio_7
86 &pmx_led_red &pmx_led_green
87 &pmx_led_yellow >;
88 pinctrl-names = "default"; 87 pinctrl-names = "default";
89 88
90 pmx_uart0: pmx-uart0 { 89 pmx_uart0: pmx-uart0 {
@@ -104,63 +103,14 @@
104 marvell,function = "sysrst"; 103 marvell,function = "sysrst";
105 }; 104 };
106 105
107 pmx_dip_sw0: pmx-dip-sw0 { 106 pmx_dip_switches: pmx-dip-switches {
108 marvell,pins = "mpp20"; 107 marvell,pins = "mpp20", "mpp21", "mpp22", "mpp23";
109 marvell,function = "gpio";
110 };
111
112 pmx_dip_sw1: pmx-dip-sw1 {
113 marvell,pins = "mpp21";
114 marvell,function = "gpio";
115 };
116
117 pmx_dip_sw2: pmx-dip-sw2 {
118 marvell,pins = "mpp22";
119 marvell,function = "gpio";
120 };
121
122 pmx_dip_sw3: pmx-dip-sw3 {
123 marvell,pins = "mpp23";
124 marvell,function = "gpio";
125 };
126
127 pmx_gpio_0: pmx-gpio-0 {
128 marvell,pins = "mpp24";
129 marvell,function = "gpio";
130 };
131
132 pmx_gpio_1: pmx-gpio-1 {
133 marvell,pins = "mpp25";
134 marvell,function = "gpio";
135 };
136
137 pmx_gpio_2: pmx-gpio-2 {
138 marvell,pins = "mpp26";
139 marvell,function = "gpio"; 108 marvell,function = "gpio";
140 }; 109 };
141 110
142 pmx_gpio_3: pmx-gpio-3 { 111 pmx_gpio_header: pmx-gpio-header {
143 marvell,pins = "mpp27"; 112 marvell,pins = "mpp24", "mpp25", "mpp26", "mpp27",
144 marvell,function = "gpio"; 113 "mpp28", "mpp29", "mpp30", "mpp31";
145 };
146
147 pmx_gpio_4: pmx-gpio-4 {
148 marvell,pins = "mpp28";
149 marvell,function = "gpio";
150 };
151
152 pmx_gpio_5: pmx-gpio-5 {
153 marvell,pins = "mpp29";
154 marvell,function = "gpio";
155 };
156
157 pmx_gpio_6: pmx-gpio-6 {
158 marvell,pins = "mpp30";
159 marvell,function = "gpio";
160 };
161
162 pmx_gpio_7: pmx-gpio-7 {
163 marvell,pins = "mpp31";
164 marvell,function = "gpio"; 114 marvell,function = "gpio";
165 }; 115 };
166 116
@@ -174,18 +124,8 @@
174 marvell,function = "gpio"; 124 marvell,function = "gpio";
175 }; 125 };
176 126
177 pmx_led_red: pmx-led-red { 127 pmx_leds: pmx-leds {
178 marvell,pins = "mpp41"; 128 marvell,pins = "mpp41", "mpp42", "mpp43";
179 marvell,function = "gpio";
180 };
181
182 pmx_led_green: pmx-led-green {
183 marvell,pins = "mpp42";
184 marvell,function = "gpio";
185 };
186
187 pmx_led_yellow: pmx-led-yellow {
188 marvell,pins = "mpp43";
189 marvell,function = "gpio"; 129 marvell,function = "gpio";
190 }; 130 };
191 }; 131 };
@@ -193,6 +133,8 @@
193 133
194 gpio-leds { 134 gpio-leds {
195 compatible = "gpio-leds"; 135 compatible = "gpio-leds";
136 pinctrl-0 = <&pmx_leds>;
137 pinctrl-names = "default";
196 138
197 led-red { 139 led-red {
198 label = "obsa6:red:stat"; 140 label = "obsa6:red:stat";
@@ -209,4 +151,18 @@
209 gpios = <&gpio1 11 1>; 151 gpios = <&gpio1 11 1>;
210 }; 152 };
211 }; 153 };
154
155 gpio_keys {
156 compatible = "gpio-keys";
157 pinctrl-0 = <&pmx_gpio_init>;
158 pinctrl-names = "default";
159 #address-cells = <1>;
160 #size-cells = <0>;
161
162 button@1 {
163 label = "Init Button";
164 linux,code = <116>;
165 gpios = <&gpio1 6 0>;
166 };
167 };
212}; 168};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
new file mode 100644
index 000000000000..f7143f128504
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug-common.dtsi
@@ -0,0 +1,93 @@
1/*
2 * kirkwood-sheevaplug-common.dts - Common parts for Sheevaplugs
3 *
4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
5 *
6 * Licensed under GPLv2
7 */
8
9/include/ "kirkwood.dtsi"
10/include/ "kirkwood-6281.dtsi"
11
12/ {
13 memory {
14 device_type = "memory";
15 reg = <0x00000000 0x20000000>;
16 };
17
18 chosen {
19 bootargs = "console=ttyS0,115200n8 earlyprintk";
20 };
21
22 ocp@f1000000 {
23 pinctrl: pinctrl@10000 {
24
25 pmx_usb_power_enable: pmx-usb-power-enable {
26 marvell,pins = "mpp29";
27 marvell,function = "gpio";
28 };
29 pmx_led_red: pmx-led-red {
30 marvell,pins = "mpp46";
31 marvell,function = "gpio";
32 };
33 pmx_led_blue: pmx-led-blue {
34 marvell,pins = "mpp49";
35 marvell,function = "gpio";
36 };
37 pmx_sdio_cd: pmx-sdio-cd {
38 marvell,pins = "mpp44";
39 marvell,function = "gpio";
40 };
41 pmx_sdio_wp: pmx-sdio-wp {
42 marvell,pins = "mpp47";
43 marvell,function = "gpio";
44 };
45 };
46 serial@12000 {
47 pinctrl-0 = <&pmx_uart0>;
48 pinctrl-names = "default";
49 status = "okay";
50 };
51
52 nand@3000000 {
53 pinctrl-0 = <&pmx_nand>;
54 pinctrl-names = "default";
55 status = "okay";
56
57 partition@0 {
58 label = "u-boot";
59 reg = <0x0000000 0x100000>;
60 };
61
62 partition@100000 {
63 label = "uImage";
64 reg = <0x0100000 0x400000>;
65 };
66
67 partition@500000 {
68 label = "root";
69 reg = <0x0500000 0x1fb00000>;
70 };
71 };
72 };
73
74 regulators {
75 compatible = "simple-bus";
76 #address-cells = <1>;
77 #size-cells = <0>;
78 pinctrl-0 = <&pmx_usb_power_enable>;
79 pinctrl-names = "default";
80
81 usb_power: regulator@1 {
82 compatible = "regulator-fixed";
83 reg = <1>;
84 regulator-name = "USB Power";
85 regulator-min-microvolt = <5000000>;
86 regulator-max-microvolt = <5000000>;
87 enable-active-high;
88 regulator-always-on;
89 regulator-boot-on;
90 gpio = <&gpio0 29 0>;
91 };
92 };
93};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts b/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts
new file mode 100644
index 000000000000..f620ce48de97
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug-esata.dts
@@ -0,0 +1,43 @@
1/*
2 * kirkwood-sheevaplug-esata.dts - Device tree file for eSATA Sheevaplug
3 *
4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
5 *
6 * Licensed under GPLv2
7 */
8
9/dts-v1/;
10
11/include/ "kirkwood-sheevaplug-common.dtsi"
12
13/ {
14 model = "Globalscale Technologies eSATA SheevaPlug";
15 compatible = "globalscale,sheevaplug-esata-rev13", "globalscale,sheevaplug-esata", "globalscale,sheevaplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
16
17 ocp@f1000000 {
18 sata@80000 {
19 status = "okay";
20 nr-ports = <2>;
21 };
22
23 mvsdio@90000 {
24 pinctrl-0 = <&pmx_sdio &pmx_sdio_cd &pmx_sdio_wp>;
25 pinctrl-names = "default";
26 status = "okay";
27 cd-gpios = <&gpio1 12 1>;
28 wp-gpios = <&gpio1 15 0>;
29 };
30 };
31
32 gpio-leds {
33 compatible = "gpio-leds";
34 pinctrl-0 = <&pmx_led_blue>;
35 pinctrl-names = "default";
36
37 health {
38 label = "sheevaplug:blue:health";
39 gpios = <&gpio1 17 1>;
40 linux,default-trigger = "default-on";
41 };
42 };
43};
diff --git a/arch/arm/boot/dts/kirkwood-sheevaplug.dts b/arch/arm/boot/dts/kirkwood-sheevaplug.dts
new file mode 100644
index 000000000000..bf1dff251432
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-sheevaplug.dts
@@ -0,0 +1,43 @@
1/*
2 * kirkwood-sheevaplug-esata.dts - Device tree file for Sheevaplug
3 *
4 * Copyright (C) 2013 Simon Baatz <gmbnomis@gmail.com>
5 *
6 * Licensed under GPLv2
7 */
8
9/dts-v1/;
10
11/include/ "kirkwood-sheevaplug-common.dtsi"
12
13/ {
14 model = "Globalscale Technologies SheevaPlug";
15 compatible = "globalscale,sheevaplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
16
17 ocp@f1000000 {
18 mvsdio@90000 {
19 pinctrl-0 = <&pmx_sdio>;
20 pinctrl-names = "default";
21 status = "okay";
22 /* No CD or WP GPIOs */
23 broken-cd;
24 };
25 };
26
27 gpio-leds {
28 compatible = "gpio-leds";
29 pinctrl-0 = <&pmx_led_blue &pmx_led_red>;
30 pinctrl-names = "default";
31
32 health {
33 label = "sheevaplug:blue:health";
34 gpios = <&gpio1 17 1>;
35 linux,default-trigger = "default-on";
36 };
37
38 misc {
39 label = "sheevaplug:red:misc";
40 gpios = <&gpio1 14 1>;
41 };
42 };
43};
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts
index 66eb45b00b25..f2052d7bc10f 100644
--- a/arch/arm/boot/dts/kirkwood-topkick.dts
+++ b/arch/arm/boot/dts/kirkwood-topkick.dts
@@ -19,18 +19,6 @@
19 ocp@f1000000 { 19 ocp@f1000000 {
20 pinctrl: pinctrl@10000 { 20 pinctrl: pinctrl@10000 {
21 /* 21 /*
22 * GPIO LED layout
23 *
24 * /-SYS_LED(2)
25 * |
26 * | /-DISK_LED
27 * | |
28 * | | /-WLAN_LED(2)
29 * | | |
30 * [SW] [*] [*] [*]
31 */
32
33 /*
34 * Switch positions 22 * Switch positions
35 * 23 *
36 * /-SW_LEFT(2) 24 * /-SW_LEFT(2)
@@ -41,19 +29,8 @@
41 * | | | 29 * | | |
42 * PS [L] [I] [R] LEDS 30 * PS [L] [I] [R] LEDS
43 */ 31 */
44 pinctrl-0 = < &pmx_led_disk_yellow 32 pinctrl-0 = <&pmx_sw_left &pmx_sw_right
45 &pmx_sata0_pwr_enable 33 &pmx_sw_idle &pmx_sw_left2>;
46 &pmx_led_sys_red
47 &pmx_led_sys_blue
48 &pmx_led_wifi_green
49 &pmx_sw_left
50 &pmx_sw_right
51 &pmx_sw_idle
52 &pmx_sw_left2
53 &pmx_led_wifi_yellow
54 &pmx_uart0
55 &pmx_nand
56 &pmx_twsi0 >;
57 pinctrl-names = "default"; 34 pinctrl-names = "default";
58 35
59 pmx_led_disk_yellow: pmx-led-disk-yellow { 36 pmx_led_disk_yellow: pmx-led-disk-yellow {
@@ -109,10 +86,14 @@
109 86
110 serial@12000 { 87 serial@12000 {
111 status = "ok"; 88 status = "ok";
89 pinctrl-0 = <&pmx_uart0>;
90 pinctrl-names = "default";
112 }; 91 };
113 92
114 nand@3000000 { 93 nand@3000000 {
115 status = "okay"; 94 status = "okay";
95 pinctrl-0 = <&pmx_nand>;
96 pinctrl-names = "default";
116 97
117 partition@0 { 98 partition@0 {
118 label = "u-boot"; 99 label = "u-boot";
@@ -147,6 +128,8 @@
147 128
148 i2c@11000 { 129 i2c@11000 {
149 status = "ok"; 130 status = "ok";
131 pinctrl-0 = <&pmx_twsi0>;
132 pinctrl-names = "default";
150 }; 133 };
151 134
152 mvsdio@90000 { 135 mvsdio@90000 {
@@ -154,11 +137,28 @@
154 pinctrl-names = "default"; 137 pinctrl-names = "default";
155 status = "okay"; 138 status = "okay";
156 /* No CD or WP GPIOs */ 139 /* No CD or WP GPIOs */
140 broken-cd;
157 }; 141 };
158 }; 142 };
159 143
160 gpio-leds { 144 gpio-leds {
145 /*
146 * GPIO LED layout
147 *
148 * /-SYS_LED(2)
149 * |
150 * | /-DISK_LED
151 * | |
152 * | | /-WLAN_LED(2)
153 * | | |
154 * [SW] [*] [*] [*]
155 */
156
161 compatible = "gpio-leds"; 157 compatible = "gpio-leds";
158 pinctrl-0 = <&pmx_led_disk_yellow &pmx_led_sys_red
159 &pmx_led_sys_blue &pmx_led_wifi_green
160 &pmx_led_wifi_yellow>;
161 pinctrl-names = "default";
162 162
163 disk { 163 disk {
164 label = "topkick:yellow:disk"; 164 label = "topkick:yellow:disk";
@@ -187,6 +187,8 @@
187 compatible = "simple-bus"; 187 compatible = "simple-bus";
188 #address-cells = <1>; 188 #address-cells = <1>;
189 #size-cells = <0>; 189 #size-cells = <0>;
190 pinctrl-0 = <&pmx_sata0_pwr_enable>;
191 pinctrl-names = "default";
190 192
191 sata0_power: regulator@1 { 193 sata0_power: regulator@1 {
192 compatible = "regulator-fixed"; 194 compatible = "regulator-fixed";
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6281.dts b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
index 8295c833887f..6dd1038e4de4 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6281.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6281.dts
@@ -1,16 +1,14 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood-ts219.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6281.dtsi" 4/include/ "kirkwood-6281.dtsi"
5/include/ "kirkwood-ts219.dtsi"
5 6
6/ { 7/ {
7 ocp@f1000000 { 8 ocp@f1000000 {
8 pinctrl: pinctrl@10000 { 9 pinctrl: pinctrl@10000 {
9 10
10 pinctrl-0 = < &pmx_uart0 &pmx_uart1 &pmx_spi 11 pinctrl-0 = <&pmx_ram_size &pmx_board_id>;
11 &pmx_twsi0 &pmx_sata0 &pmx_sata1
12 &pmx_ram_size &pmx_reset_button
13 &pmx_USB_copy_button &pmx_board_id>;
14 pinctrl-names = "default"; 12 pinctrl-names = "default";
15 13
16 pmx_ram_size: pmx-ram-size { 14 pmx_ram_size: pmx-ram-size {
@@ -38,6 +36,9 @@
38 compatible = "gpio-keys"; 36 compatible = "gpio-keys";
39 #address-cells = <1>; 37 #address-cells = <1>;
40 #size-cells = <0>; 38 #size-cells = <0>;
39 pinctrl-0 = <&pmx_reset_button &pmx_USB_copy_button>;
40 pinctrl-names = "default";
41
41 button@1 { 42 button@1 {
42 label = "USB Copy"; 43 label = "USB Copy";
43 linux,code = <133>; 44 linux,code = <133>;
diff --git a/arch/arm/boot/dts/kirkwood-ts219-6282.dts b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
index df3f95dfba33..6fdc5ffcaae5 100644
--- a/arch/arm/boot/dts/kirkwood-ts219-6282.dts
+++ b/arch/arm/boot/dts/kirkwood-ts219-6282.dts
@@ -1,16 +1,14 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "kirkwood-ts219.dtsi" 3/include/ "kirkwood.dtsi"
4/include/ "kirkwood-6282.dtsi" 4/include/ "kirkwood-6282.dtsi"
5/include/ "kirkwood-ts219.dtsi"
5 6
6/ { 7/ {
7 ocp@f1000000 { 8 ocp@f1000000 {
8 pinctrl: pinctrl@10000 { 9 pinctrl: pinctrl@10000 {
9 10
10 pinctrl-0 = < &pmx_uart0 &pmx_uart1 &pmx_spi 11 pinctrl-0 = <&pmx_ram_size &pmx_board_id>;
11 &pmx_twsi0 &pmx_sata0 &pmx_sata1
12 &pmx_ram_size &pmx_reset_button
13 &pmx_USB_copy_button &pmx_board_id>;
14 pinctrl-names = "default"; 12 pinctrl-names = "default";
15 13
16 pmx_ram_size: pmx-ram-size { 14 pmx_ram_size: pmx-ram-size {
@@ -32,12 +30,23 @@
32 marvell,function = "gpio"; 30 marvell,function = "gpio";
33 }; 31 };
34 }; 32 };
33 pcie-controller {
34 status = "okay";
35
36 pcie@2,0 {
37 status = "okay";
38 };
39 };
40
35 }; 41 };
36 42
37 gpio_keys { 43 gpio_keys {
38 compatible = "gpio-keys"; 44 compatible = "gpio-keys";
39 #address-cells = <1>; 45 #address-cells = <1>;
40 #size-cells = <0>; 46 #size-cells = <0>;
47 pinctrl-0 = <&pmx_reset_button &pmx_USB_copy_button>;
48 pinctrl-names = "default";
49
41 button@1 { 50 button@1 {
42 label = "USB Copy"; 51 label = "USB Copy";
43 linux,code = <133>; 52 linux,code = <133>;
diff --git a/arch/arm/boot/dts/kirkwood-ts219.dtsi b/arch/arm/boot/dts/kirkwood-ts219.dtsi
index 64ea27cb3298..0c9a94cd666c 100644
--- a/arch/arm/boot/dts/kirkwood-ts219.dtsi
+++ b/arch/arm/boot/dts/kirkwood-ts219.dtsi
@@ -1,5 +1,3 @@
1/include/ "kirkwood.dtsi"
2
3/ { 1/ {
4 model = "QNAP TS219 family"; 2 model = "QNAP TS219 family";
5 compatible = "qnap,ts219", "marvell,kirkwood"; 3 compatible = "qnap,ts219", "marvell,kirkwood";
@@ -17,6 +15,8 @@
17 i2c@11000 { 15 i2c@11000 {
18 status = "okay"; 16 status = "okay";
19 clock-frequency = <400000>; 17 clock-frequency = <400000>;
18 pinctrl-0 = <&pmx_twsi0>;
19 pinctrl-names = "default";
20 20
21 s35390a: s35390a@30 { 21 s35390a: s35390a@30 {
22 compatible = "s35390a"; 22 compatible = "s35390a";
@@ -26,13 +26,24 @@
26 serial@12000 { 26 serial@12000 {
27 clock-frequency = <200000000>; 27 clock-frequency = <200000000>;
28 status = "okay"; 28 status = "okay";
29 pinctrl-0 = <&pmx_uart0>;
30 pinctrl-names = "default";
29 }; 31 };
30 serial@12100 { 32 serial@12100 {
31 clock-frequency = <200000000>; 33 clock-frequency = <200000000>;
32 status = "okay"; 34 status = "okay";
35 pinctrl-0 = <&pmx_uart1>;
36 pinctrl-names = "default";
37 };
38 poweroff@12100 {
39 compatible = "qnap,power-off";
40 reg = <0x12000 0x100>;
41 clocks = <&gate_clk 7>;
33 }; 42 };
34 spi@10600 { 43 spi@10600 {
35 status = "okay"; 44 status = "okay";
45 pinctrl-0 = <&pmx_spi>;
46 pinctrl-names = "default";
36 47
37 m25p128@0 { 48 m25p128@0 {
38 #address-cells = <1>; 49 #address-cells = <1>;
@@ -71,8 +82,17 @@
71 }; 82 };
72 }; 83 };
73 sata@80000 { 84 sata@80000 {
85 pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
86 pinctrl-names = "default";
74 status = "okay"; 87 status = "okay";
75 nr-ports = <2>; 88 nr-ports = <2>;
76 }; 89 };
90 pcie-controller {
91 status = "okay";
92
93 pcie@1,0 {
94 status = "okay";
95 };
96 };
77 }; 97 };
78}; 98};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index fada7e6d24d8..9809fc1f105c 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -4,6 +4,18 @@
4 compatible = "marvell,kirkwood"; 4 compatible = "marvell,kirkwood";
5 interrupt-parent = <&intc>; 5 interrupt-parent = <&intc>;
6 6
7 cpus {
8 #address-cells = <1>;
9 #size-cells = <0>;
10
11 cpu@0 {
12 device_type = "cpu";
13 compatible = "marvell,feroceon";
14 clocks = <&core_clk 1>, <&core_clk 3>, <&gate_clk 11>;
15 clock-names = "cpu_clk", "ddrclk", "powersave";
16 };
17 };
18
7 aliases { 19 aliases {
8 gpio0 = &gpio0; 20 gpio0 = &gpio0;
9 gpio1 = &gpio1; 21 gpio1 = &gpio1;
@@ -18,7 +30,9 @@
18 30
19 ocp@f1000000 { 31 ocp@f1000000 {
20 compatible = "simple-bus"; 32 compatible = "simple-bus";
21 ranges = <0x00000000 0xf1000000 0x4000000 33 ranges = <0x00000000 0xf1000000 0x0100000
34 0xe0000000 0xe0000000 0x8100000 /* PCIE */
35 0xf4000000 0xf4000000 0x0000400
22 0xf5000000 0xf5000000 0x0000400>; 36 0xf5000000 0xf5000000 0x0000400>;
23 #address-cells = <1>; 37 #address-cells = <1>;
24 #size-cells = <1>; 38 #size-cells = <1>;
@@ -71,13 +85,6 @@
71 status = "disabled"; 85 status = "disabled";
72 }; 86 };
73 87
74 rtc@10300 {
75 compatible = "marvell,kirkwood-rtc", "marvell,orion-rtc";
76 reg = <0x10300 0x20>;
77 interrupts = <53>;
78 clocks = <&gate_clk 7>;
79 };
80
81 spi@10600 { 88 spi@10600 {
82 compatible = "marvell,orion-spi"; 89 compatible = "marvell,orion-spi";
83 #address-cells = <1>; 90 #address-cells = <1>;
@@ -151,15 +158,6 @@
151 status = "okay"; 158 status = "okay";
152 }; 159 };
153 160
154 sata@80000 {
155 compatible = "marvell,orion-sata";
156 reg = <0x80000 0x5000>;
157 interrupts = <21>;
158 clocks = <&gate_clk 14>, <&gate_clk 15>;
159 clock-names = "0", "1";
160 status = "disabled";
161 };
162
163 nand@3000000 { 161 nand@3000000 {
164 #address-cells = <1>; 162 #address-cells = <1>;
165 #size-cells = <1>; 163 #size-cells = <1>;
@@ -167,7 +165,7 @@
167 ale = <1>; 165 ale = <1>;
168 bank-width = <1>; 166 bank-width = <1>;
169 compatible = "marvell,orion-nand"; 167 compatible = "marvell,orion-nand";
170 reg = <0x3000000 0x400>; 168 reg = <0xf4000000 0x400>;
171 chip-delay = <25>; 169 chip-delay = <25>;
172 /* set partition map and/or chip-delay in board dts */ 170 /* set partition map and/or chip-delay in board dts */
173 clocks = <&gate_clk 7>; 171 clocks = <&gate_clk 7>;
@@ -194,13 +192,5 @@
194 clocks = <&gate_clk 17>; 192 clocks = <&gate_clk 17>;
195 status = "okay"; 193 status = "okay";
196 }; 194 };
197
198 mvsdio@90000 {
199 compatible = "marvell,orion-sdio";
200 reg = <0x90000 0x200>;
201 interrupts = <28>;
202 clocks = <&gate_clk 4>;
203 status = "disabled";
204 };
205 }; 195 };
206}; 196};
diff --git a/arch/arm/boot/dts/kizbox.dts b/arch/arm/boot/dts/kizbox.dts
index b4dc3ed9a3ec..02df1914a47c 100644
--- a/arch/arm/boot/dts/kizbox.dts
+++ b/arch/arm/boot/dts/kizbox.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g20.dtsi" 9#include "at91sam9g20.dtsi"
10 10
11/ { 11/ {
12 12
@@ -94,26 +94,26 @@
94 94
95 led1g { 95 led1g {
96 label = "led1:green"; 96 label = "led1:green";
97 gpios = <&pioB 0 1>; 97 gpios = <&pioB 0 GPIO_ACTIVE_LOW>;
98 linux,default-trigger = "none"; 98 linux,default-trigger = "none";
99 }; 99 };
100 100
101 led1r { 101 led1r {
102 label = "led1:red"; 102 label = "led1:red";
103 gpios = <&pioB 1 1>; 103 gpios = <&pioB 1 GPIO_ACTIVE_LOW>;
104 linux,default-trigger = "none"; 104 linux,default-trigger = "none";
105 }; 105 };
106 106
107 led2g { 107 led2g {
108 label = "led2:green"; 108 label = "led2:green";
109 gpios = <&pioB 2 1>; 109 gpios = <&pioB 2 GPIO_ACTIVE_LOW>;
110 linux,default-trigger = "none"; 110 linux,default-trigger = "none";
111 default-state = "on"; 111 default-state = "on";
112 }; 112 };
113 113
114 led2r { 114 led2r {
115 label = "led2:red"; 115 label = "led2:red";
116 gpios = <&pioB 3 1>; 116 gpios = <&pioB 3 GPIO_ACTIVE_LOW>;
117 linux,default-trigger = "none"; 117 linux,default-trigger = "none";
118 }; 118 };
119 }; 119 };
@@ -125,16 +125,16 @@
125 125
126 reset { 126 reset {
127 label = "reset"; 127 label = "reset";
128 gpios = <&pioB 30 1>; 128 gpios = <&pioB 30 GPIO_ACTIVE_LOW>;
129 linux,code = <0x100>; 129 linux,code = <0x100>;
130 gpio-key,wakeup; 130 gpio-key,wakeup;
131 }; 131 };
132 132
133 mode { 133 mode {
134 label = "mode"; 134 label = "mode";
135 gpios = <&pioB 31 1>; 135 gpios = <&pioB 31 GPIO_ACTIVE_LOW>;
136 linux,code = <0x101>; 136 linux,code = <0x101>;
137 gpio-key,wakeup; 137 gpio-key,wakeup;
138 }; 138 };
139 }; 139 };
140}; \ No newline at end of file 140};
diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
index 1582f484a867..3abebb75fc57 100644
--- a/arch/arm/boot/dts/lpc32xx.dtsi
+++ b/arch/arm/boot/dts/lpc32xx.dtsi
@@ -18,8 +18,12 @@
18 interrupt-parent = <&mic>; 18 interrupt-parent = <&mic>;
19 19
20 cpus { 20 cpus {
21 cpu@0 { 21 #address-cells = <0>;
22 compatible = "arm,arm926ejs"; 22 #size-cells = <0>;
23
24 cpu {
25 compatible = "arm,arm926ej-s";
26 device_type = "cpu";
23 }; 27 };
24 }; 28 };
25 29
diff --git a/arch/arm/boot/dts/mpa1600.dts b/arch/arm/boot/dts/mpa1600.dts
index 317300875f34..ccf9ea242f72 100644
--- a/arch/arm/boot/dts/mpa1600.dts
+++ b/arch/arm/boot/dts/mpa1600.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2 only 6 * Licensed under GPLv2 only
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91rm9200.dtsi" 9#include "at91rm9200.dtsi"
10 10
11/ { 11/ {
12 model = "Phontech MPA 1600"; 12 model = "Phontech MPA 1600";
@@ -62,7 +62,7 @@
62 62
63 monitor_mute { 63 monitor_mute {
64 label = "Monitor mute"; 64 label = "Monitor mute";
65 gpios = <&pioC 1 1>; 65 gpios = <&pioC 1 GPIO_ACTIVE_LOW>;
66 linux,code = <113>; 66 linux,code = <113>;
67 }; 67 };
68 }; 68 };
diff --git a/arch/arm/boot/dts/msm8660-surf.dts b/arch/arm/boot/dts/msm8660-surf.dts
index 9bf49b3826ea..cdc010e0f93e 100644
--- a/arch/arm/boot/dts/msm8660-surf.dts
+++ b/arch/arm/boot/dts/msm8660-surf.dts
@@ -15,7 +15,7 @@
15 < 0x02081000 0x1000 >; 15 < 0x02081000 0x1000 >;
16 }; 16 };
17 17
18 timer@2000004 { 18 timer@2000000 {
19 compatible = "qcom,scss-timer", "qcom,msm-timer"; 19 compatible = "qcom,scss-timer", "qcom,msm-timer";
20 interrupts = <1 0 0x301>, 20 interrupts = <1 0 0x301>,
21 <1 1 0x301>, 21 <1 1 0x301>,
@@ -26,7 +26,18 @@
26 cpu-offset = <0x40000>; 26 cpu-offset = <0x40000>;
27 }; 27 };
28 28
29 serial@19c400000 { 29 msmgpio: gpio@800000 {
30 compatible = "qcom,msm-gpio";
31 reg = <0x00800000 0x1000>;
32 gpio-controller;
33 #gpio-cells = <2>;
34 ngpio = <173>;
35 interrupts = <0 32 0x4>;
36 interrupt-controller;
37 #interrupt-cells = <2>;
38 };
39
40 serial@19c40000 {
30 compatible = "qcom,msm-hsuart", "qcom,msm-uart"; 41 compatible = "qcom,msm-hsuart", "qcom,msm-uart";
31 reg = <0x19c40000 0x1000>, 42 reg = <0x19c40000 0x1000>,
32 <0x19c00000 0x1000>; 43 <0x19c00000 0x1000>;
diff --git a/arch/arm/boot/dts/msm8960-cdp.dts b/arch/arm/boot/dts/msm8960-cdp.dts
index 2e4d87a125d6..db2060c46540 100644
--- a/arch/arm/boot/dts/msm8960-cdp.dts
+++ b/arch/arm/boot/dts/msm8960-cdp.dts
@@ -26,7 +26,18 @@
26 cpu-offset = <0x80000>; 26 cpu-offset = <0x80000>;
27 }; 27 };
28 28
29 serial@19c400000 { 29 msmgpio: gpio@fd510000 {
30 compatible = "qcom,msm-gpio";
31 gpio-controller;
32 #gpio-cells = <2>;
33 ngpio = <150>;
34 interrupts = <0 32 0x4>;
35 interrupt-controller;
36 #interrupt-cells = <2>;
37 reg = <0xfd510000 0x4000>;
38 };
39
40 serial@16440000 {
30 compatible = "qcom,msm-hsuart", "qcom,msm-uart"; 41 compatible = "qcom,msm-hsuart", "qcom,msm-uart";
31 reg = <0x16440000 0x1000>, 42 reg = <0x16440000 0x1000>,
32 <0x16400000 0x1000>; 43 <0x16400000 0x1000>;
diff --git a/arch/arm/boot/dts/nspire-classic.dtsi b/arch/arm/boot/dts/nspire-classic.dtsi
new file mode 100644
index 000000000000..9565199bce7a
--- /dev/null
+++ b/arch/arm/boot/dts/nspire-classic.dtsi
@@ -0,0 +1,74 @@
1/*
2 * linux/arch/arm/boot/nspire-classic.dts
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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/ "nspire.dtsi"
13
14&lcd {
15 lcd-type = "classic";
16};
17
18&fast_timer {
19 /* compatible = "lsi,zevio-timer"; */
20 reg = <0x90010000 0x1000>, <0x900A0010 0x8>;
21};
22
23&uart {
24 compatible = "ns16550";
25 reg-shift = <2>;
26 reg-io-width = <4>;
27 clocks = <&apb_pclk>;
28 no-loopback-test;
29};
30
31&timer0 {
32 /* compatible = "lsi,zevio-timer"; */
33 reg = <0x900C0000 0x1000>, <0x900A0018 0x8>;
34};
35
36&timer1 {
37 compatible = "lsi,zevio-timer";
38 reg = <0x900D0000 0x1000>, <0x900A0020 0x8>;
39};
40
41&keypad {
42 active-low;
43
44};
45
46&base_clk {
47 compatible = "lsi,nspire-classic-clock";
48};
49
50&ahb_clk {
51 compatible = "lsi,nspire-classic-ahb-divider";
52};
53
54/ {
55 memory {
56 device_type = "memory";
57 reg = <0x10000000 0x2000000>; /* 32 MB */
58 };
59
60 ahb {
61 #address-cells = <1>;
62 #size-cells = <1>;
63
64 intc: interrupt-controller@DC000000 {
65 compatible = "lsi,zevio-intc";
66 interrupt-controller;
67 reg = <0xDC000000 0x1000>;
68 #interrupt-cells = <1>;
69 };
70 };
71 chosen {
72 bootargs = "debug earlyprintk console=tty0 console=ttyS0,115200n8 root=/dev/ram0";
73 };
74};
diff --git a/arch/arm/boot/dts/nspire-clp.dts b/arch/arm/boot/dts/nspire-clp.dts
new file mode 100644
index 000000000000..fa5a044656de
--- /dev/null
+++ b/arch/arm/boot/dts/nspire-clp.dts
@@ -0,0 +1,45 @@
1/*
2 * linux/arch/arm/boot/nspire-clp.dts
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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
13/include/ "nspire-classic.dtsi"
14
15&keypad {
16 linux,keymap = <
17 0x0000001c 0x0001001c 0x00020039
18 0x0004002c 0x00050034 0x00060015
19 0x0007000b 0x0008002d 0x01000033
20 0x0101004e 0x01020011 0x01030004
21 0x0104002f 0x01050003 0x01060016
22 0x01070002 0x01080014 0x02000062
23 0x0201000c 0x0202001f 0x02030007
24 0x02040013 0x02050006 0x02060010
25 0x02070005 0x02080019 0x03000027
26 0x03010037 0x03020018 0x0303000a
27 0x03040031 0x03050009 0x03060032
28 0x03070008 0x03080026 0x04000028
29 0x04010035 0x04020025 0x04040024
30 0x04060017 0x04080023 0x05000028
31 0x05020022 0x0503001b 0x05040021
32 0x0505001a 0x05060012 0x0507006f
33 0x05080020 0x0509002a 0x0601001c
34 0x0602002e 0x06030068 0x06040030
35 0x0605006d 0x0606001e 0x06070001
36 0x0608002b 0x0609000f 0x07000067
37 0x0702006a 0x0704006c 0x07060069
38 0x0707000e 0x0708001d 0x070a000d
39 >;
40};
41
42/ {
43 model = "TI-NSPIRE Clickpad";
44 compatible = "ti,nspire-clp";
45};
diff --git a/arch/arm/boot/dts/nspire-cx.dts b/arch/arm/boot/dts/nspire-cx.dts
new file mode 100644
index 000000000000..375b924f60d8
--- /dev/null
+++ b/arch/arm/boot/dts/nspire-cx.dts
@@ -0,0 +1,112 @@
1/*
2 * linux/arch/arm/boot/nspire-cx.dts
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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
13/include/ "nspire.dtsi"
14
15&lcd {
16 lcd-type = "cx";
17};
18
19&fast_timer {
20 /* compatible = "arm,sp804", "arm,primecell"; */
21};
22
23&uart {
24 compatible = "arm,pl011", "arm,primecell";
25
26 clocks = <&uart_clk>, <&apb_pclk>;
27 clock-names = "uart_clk", "apb_pclk";
28};
29
30&timer0 {
31 compatible = "arm,sp804", "arm,primecell";
32};
33
34&timer1 {
35 compatible = "arm,sp804", "arm,primecell";
36};
37
38&base_clk {
39 compatible = "lsi,nspire-cx-clock";
40};
41
42&ahb_clk {
43 compatible = "lsi,nspire-cx-ahb-divider";
44};
45
46&keypad {
47 linux,keymap = <
48 0x0000001c 0x0001001c 0x00040039
49 0x0005002c 0x00060015 0x0007000b
50 0x0008000f 0x0100002d 0x01010011
51 0x0102002f 0x01030004 0x01040016
52 0x01050014 0x0106001f 0x01070002
53 0x010a006a 0x02000013 0x02010010
54 0x02020019 0x02030007 0x02040018
55 0x02050031 0x02060032 0x02070005
56 0x02080028 0x0209006c 0x03000026
57 0x03010025 0x03020024 0x0303000a
58 0x03040017 0x03050023 0x03060022
59 0x03070008 0x03080035 0x03090069
60 0x04000021 0x04010012 0x04020020
61 0x0404002e 0x04050030 0x0406001e
62 0x0407000d 0x04080037 0x04090067
63 0x05010038 0x0502000c 0x0503001b
64 0x05040034 0x0505001a 0x05060006
65 0x05080027 0x0509000e 0x050a006f
66 0x0600002b 0x0602004e 0x06030068
67 0x06040003 0x0605006d 0x06060009
68 0x06070001 0x0609000f 0x0708002a
69 0x0709001d 0x070a0033 >;
70};
71
72/ {
73 model = "TI-NSPIRE CX";
74 compatible = "ti,nspire-cx";
75
76 memory {
77 device_type = "memory";
78 reg = <0x10000000 0x4000000>; /* 64 MB */
79 };
80
81 uart_clk: uart_clk {
82 #clock-cells = <0>;
83 compatible = "fixed-clock";
84 clock-frequency = <12000000>;
85 };
86
87 ahb {
88 #address-cells = <1>;
89 #size-cells = <1>;
90
91 intc: interrupt-controller@DC000000 {
92 compatible = "arm,pl190-vic";
93 interrupt-controller;
94 reg = <0xDC000000 0x1000>;
95 #interrupt-cells = <1>;
96 };
97
98 apb@90000000 {
99 #address-cells = <1>;
100 #size-cells = <1>;
101
102 i2c@90050000 {
103 compatible = "snps,designware-i2c";
104 reg = <0x90050000 0x1000>;
105 interrupts = <20>;
106 };
107 };
108 };
109 chosen {
110 bootargs = "debug earlyprintk console=tty0 console=ttyAMA0,115200n8 root=/dev/ram0";
111 };
112};
diff --git a/arch/arm/boot/dts/nspire-tp.dts b/arch/arm/boot/dts/nspire-tp.dts
new file mode 100644
index 000000000000..621391ce6ed6
--- /dev/null
+++ b/arch/arm/boot/dts/nspire-tp.dts
@@ -0,0 +1,44 @@
1/*
2 * linux/arch/arm/boot/nspire-tp.dts
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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
13/include/ "nspire-classic.dtsi"
14
15&keypad {
16 linux,keymap = <
17 0x0000001c 0x0001001c 0x00040039
18 0x0005002c 0x00060015 0x0007000b
19 0x0008000f 0x0100002d 0x01010011
20 0x0102002f 0x01030004 0x01040016
21 0x01050014 0x0106001f 0x01070002
22 0x010a006a 0x02000013 0x02010010
23 0x02020019 0x02030007 0x02040018
24 0x02050031 0x02060032 0x02070005
25 0x02080028 0x0209006c 0x03000026
26 0x03010025 0x03020024 0x0303000a
27 0x03040017 0x03050023 0x03060022
28 0x03070008 0x03080035 0x03090069
29 0x04000021 0x04010012 0x04020020
30 0x0404002e 0x04050030 0x0406001e
31 0x0407000d 0x04080037 0x04090067
32 0x05010038 0x0502000c 0x0503001b
33 0x05040034 0x0505001a 0x05060006
34 0x05080027 0x0509000e 0x050a006f
35 0x0600002b 0x0602004e 0x06030068
36 0x06040003 0x0605006d 0x06060009
37 0x06070001 0x0609000f 0x0708002a
38 0x0709001d 0x070a0033 >;
39};
40
41/ {
42 model = "TI-NSPIRE Touchpad";
43 compatible = "ti,nspire-tp";
44};
diff --git a/arch/arm/boot/dts/nspire.dtsi b/arch/arm/boot/dts/nspire.dtsi
new file mode 100644
index 000000000000..a22ffe633b49
--- /dev/null
+++ b/arch/arm/boot/dts/nspire.dtsi
@@ -0,0 +1,175 @@
1/*
2 * linux/arch/arm/boot/nspire.dtsi
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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/ "skeleton.dtsi"
13
14/ {
15 interrupt-parent = <&intc>;
16
17 cpus {
18 cpu@0 {
19 compatible = "arm,arm926ejs";
20 };
21 };
22
23 bootrom: bootrom@00000000 {
24 reg = <0x00000000 0x80000>;
25 };
26
27 sram: sram@A4000000 {
28 device = "memory";
29 reg = <0xA4000000 0x20000>;
30 };
31
32 timer_clk: timer_clk {
33 #clock-cells = <0>;
34 compatible = "fixed-clock";
35 clock-frequency = <32768>;
36 };
37
38 base_clk: base_clk {
39 #clock-cells = <0>;
40 reg = <0x900B0024 0x4>;
41 };
42
43 ahb_clk: ahb_clk {
44 #clock-cells = <0>;
45 reg = <0x900B0024 0x4>;
46 clocks = <&base_clk>;
47 };
48
49 apb_pclk: apb_pclk {
50 #clock-cells = <0>;
51 compatible = "fixed-factor-clock";
52 clock-div = <2>;
53 clock-mult = <1>;
54 clocks = <&ahb_clk>;
55 };
56
57 ahb {
58 compatible = "simple-bus";
59 #address-cells = <1>;
60 #size-cells = <1>;
61 ranges;
62
63 spi: spi@A9000000 {
64 reg = <0xA9000000 0x1000>;
65 };
66
67 usb0: usb@B0000000 {
68 reg = <0xB0000000 0x1000>;
69 interrupts = <8>;
70 };
71
72 usb1: usb@B4000000 {
73 reg = <0xB4000000 0x1000>;
74 interrupts = <9>;
75 status = "disabled";
76 };
77
78 lcd: lcd@C0000000 {
79 compatible = "arm,pl111", "arm,primecell";
80 reg = <0xC0000000 0x1000>;
81 interrupts = <21>;
82
83 clocks = <&apb_pclk>;
84 clock-names = "apb_pclk";
85 };
86
87 adc: adc@C4000000 {
88 reg = <0xC4000000 0x1000>;
89 interrupts = <11>;
90 };
91
92 tdes: crypto@C8010000 {
93 reg = <0xC8010000 0x1000>;
94 };
95
96 sha256: crypto@CC000000 {
97 reg = <0xCC000000 0x1000>;
98 };
99
100 apb@90000000 {
101 compatible = "simple-bus";
102 #address-cells = <1>;
103 #size-cells = <1>;
104 clock-ranges;
105 ranges;
106
107 gpio: gpio@90000000 {
108 reg = <0x90000000 0x1000>;
109 interrupts = <7>;
110 };
111
112 fast_timer: timer@90010000 {
113 reg = <0x90010000 0x1000>;
114 interrupts = <17>;
115 };
116
117 uart: serial@90020000 {
118 reg = <0x90020000 0x1000>;
119 interrupts = <1>;
120 };
121
122 timer0: timer@900C0000 {
123 reg = <0x900C0000 0x1000>;
124
125 clocks = <&timer_clk>;
126 };
127
128 timer1: timer@900D0000 {
129 reg = <0x900D0000 0x1000>;
130 interrupts = <19>;
131
132 clocks = <&timer_clk>;
133 };
134
135 watchdog: watchdog@90060000 {
136 compatible = "arm,amba-primecell";
137 reg = <0x90060000 0x1000>;
138 interrupts = <3>;
139 };
140
141 rtc: rtc@90090000 {
142 reg = <0x90090000 0x1000>;
143 interrupts = <4>;
144 };
145
146 misc: misc@900A0000 {
147 reg = <0x900A0000 0x1000>;
148 };
149
150 pwr: pwr@900B0000 {
151 reg = <0x900B0000 0x1000>;
152 interrupts = <15>;
153 };
154
155 keypad: input@900E0000 {
156 compatible = "ti,nspire-keypad";
157 reg = <0x900E0000 0x1000>;
158 interrupts = <16>;
159
160 scan-interval = <1000>;
161 row-delay = <200>;
162
163 clocks = <&apb_pclk>;
164 };
165
166 contrast: contrast@900F0000 {
167 reg = <0x900F0000 0x1000>;
168 };
169
170 led: led@90110000 {
171 reg = <0x90110000 0x1000>;
172 };
173 };
174 };
175};
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index 37aa7487d4d8..a2bfcde858a6 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -8,7 +8,10 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "skeleton.dtsi" 11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/pinctrl/omap.h>
13
14#include "skeleton.dtsi"
12 15
13/ { 16/ {
14 compatible = "ti,omap2430", "ti,omap2420", "ti,omap2"; 17 compatible = "ti,omap2430", "ti,omap2420", "ti,omap2";
@@ -21,8 +24,12 @@
21 }; 24 };
22 25
23 cpus { 26 cpus {
24 cpu@0 { 27 #address-cells = <0>;
28 #size-cells = <0>;
29
30 cpu {
25 compatible = "arm,arm1136jf-s"; 31 compatible = "arm,arm1136jf-s";
32 device_type = "cpu";
26 }; 33 };
27 }; 34 };
28 35
diff --git a/arch/arm/boot/dts/omap2420-h4.dts b/arch/arm/boot/dts/omap2420-h4.dts
index 68282ee13e26..224c08f472f4 100644
--- a/arch/arm/boot/dts/omap2420-h4.dts
+++ b/arch/arm/boot/dts/omap2420-h4.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap2420.dtsi" 10#include "omap2420.dtsi"
11 11
12/ { 12/ {
13 model = "TI OMAP2420 H4 board"; 13 model = "TI OMAP2420 H4 board";
diff --git a/arch/arm/boot/dts/omap2420.dtsi b/arch/arm/boot/dts/omap2420.dtsi
index da5b285b73be..c8f9c55169ea 100644
--- a/arch/arm/boot/dts/omap2420.dtsi
+++ b/arch/arm/boot/dts/omap2420.dtsi
@@ -8,7 +8,7 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "omap2.dtsi" 11#include "omap2.dtsi"
12 12
13/ { 13/ {
14 compatible = "ti,omap2420", "ti,omap2"; 14 compatible = "ti,omap2420", "ti,omap2";
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi
index 054bc4439568..c535a5a2b27f 100644
--- a/arch/arm/boot/dts/omap2430.dtsi
+++ b/arch/arm/boot/dts/omap2430.dtsi
@@ -8,7 +8,7 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "omap2.dtsi" 11#include "omap2.dtsi"
12 12
13/ { 13/ {
14 compatible = "ti,omap2430", "ti,omap2"; 14 compatible = "ti,omap2430", "ti,omap2";
diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index 3046d1f81be0..afdb16417d4e 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap36xx.dtsi" 10#include "omap36xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI OMAP3 BeagleBoard xM"; 13 model = "TI OMAP3 BeagleBoard xM";
@@ -29,13 +29,13 @@
29 29
30 heartbeat { 30 heartbeat {
31 label = "beagleboard::usr0"; 31 label = "beagleboard::usr0";
32 gpios = <&gpio5 22 0>; /* 150 -> D6 LED */ 32 gpios = <&gpio5 22 GPIO_ACTIVE_HIGH>; /* 150 -> D6 LED */
33 linux,default-trigger = "heartbeat"; 33 linux,default-trigger = "heartbeat";
34 }; 34 };
35 35
36 mmc { 36 mmc {
37 label = "beagleboard::usr1"; 37 label = "beagleboard::usr1";
38 gpios = <&gpio5 21 0>; /* 149 -> D7 LED */ 38 gpios = <&gpio5 21 GPIO_ACTIVE_HIGH>; /* 149 -> D7 LED */
39 linux,default-trigger = "mmc0"; 39 linux,default-trigger = "mmc0";
40 }; 40 };
41 }; 41 };
@@ -57,6 +57,26 @@
57 ti,mcbsp = <&mcbsp2>; 57 ti,mcbsp = <&mcbsp2>;
58 ti,codec = <&twl_audio>; 58 ti,codec = <&twl_audio>;
59 }; 59 };
60
61 gpio_keys {
62 compatible = "gpio-keys";
63
64 user {
65 label = "user";
66 gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
67 linux,code = <0x114>;
68 gpio-key,wakeup;
69 };
70
71 };
72};
73
74&omap3_pmx_wkup {
75 gpio1_pins: pinmux_gpio1_pins {
76 pinctrl-single,pins = <
77 0x0e (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE4) /* sys_boot2.gpio_4 */
78 >;
79 };
60}; 80};
61 81
62&i2c1 { 82&i2c1 {
@@ -75,7 +95,8 @@
75 }; 95 };
76}; 96};
77 97
78/include/ "twl4030.dtsi" 98#include "twl4030.dtsi"
99#include "twl4030_omap3.dtsi"
79 100
80&i2c2 { 101&i2c2 {
81 clock-frequency = <400000>; 102 clock-frequency = <400000>;
@@ -126,3 +147,22 @@
126 mode = <3>; 147 mode = <3>;
127 power = <50>; 148 power = <50>;
128}; 149};
150
151&omap3_pmx_core {
152 uart3_pins: pinmux_uart3_pins {
153 pinctrl-single,pins = <
154 0x16e (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
155 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx OUTPUT | MODE0 */
156 >;
157 };
158};
159
160&uart3 {
161 pinctrl-names = "default";
162 pinctrl-0 = <&uart3_pins>;
163};
164
165&gpio1 {
166 pinctrl-names = "default";
167 pinctrl-0 = <&gpio1_pins>;
168};
diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-beagle.dts
index 6eec69997607..dfd83103657a 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI OMAP3 BeagleBoard"; 13 model = "TI OMAP3 BeagleBoard";
@@ -28,18 +28,18 @@
28 compatible = "gpio-leds"; 28 compatible = "gpio-leds";
29 pmu_stat { 29 pmu_stat {
30 label = "beagleboard::pmu_stat"; 30 label = "beagleboard::pmu_stat";
31 gpios = <&twl_gpio 19 0>; /* LEDB */ 31 gpios = <&twl_gpio 19 GPIO_ACTIVE_HIGH>; /* LEDB */
32 }; 32 };
33 33
34 heartbeat { 34 heartbeat {
35 label = "beagleboard::usr0"; 35 label = "beagleboard::usr0";
36 gpios = <&gpio5 22 0>; /* 150 -> D6 LED */ 36 gpios = <&gpio5 22 GPIO_ACTIVE_HIGH>; /* 150 -> D6 LED */
37 linux,default-trigger = "heartbeat"; 37 linux,default-trigger = "heartbeat";
38 }; 38 };
39 39
40 mmc { 40 mmc {
41 label = "beagleboard::usr1"; 41 label = "beagleboard::usr1";
42 gpios = <&gpio5 21 0>; /* 149 -> D7 LED */ 42 gpios = <&gpio5 21 GPIO_ACTIVE_HIGH>; /* 149 -> D7 LED */
43 linux,default-trigger = "mmc0"; 43 linux,default-trigger = "mmc0";
44 }; 44 };
45 }; 45 };
@@ -71,6 +71,26 @@
71 reset-supply = <&hsusb2_reset>; 71 reset-supply = <&hsusb2_reset>;
72 vcc-supply = <&hsusb2_power>; 72 vcc-supply = <&hsusb2_power>;
73 }; 73 };
74
75 gpio_keys {
76 compatible = "gpio-keys";
77
78 user {
79 label = "user";
80 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
81 linux,code = <0x114>;
82 gpio-key,wakeup;
83 };
84
85 };
86};
87
88&omap3_pmx_wkup {
89 gpio1_pins: pinmux_gpio1_pins {
90 pinctrl-single,pins = <
91 0x14 (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE4) /* sys_boot5.gpio_7 */
92 >;
93 };
74}; 94};
75 95
76&omap3_pmx_core { 96&omap3_pmx_core {
@@ -81,18 +101,25 @@
81 101
82 hsusbb2_pins: pinmux_hsusbb2_pins { 102 hsusbb2_pins: pinmux_hsusbb2_pins {
83 pinctrl-single,pins = < 103 pinctrl-single,pins = <
84 0x5c0 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_clk OUTPUT */ 104 0x5c0 (PIN_OUTPUT | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_clk */
85 0x5c2 0x3 /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_stp OUTPUT */ 105 0x5c2 (PIN_OUTPUT | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_stp */
86 0x5c4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dir INPUT | PULLDOWN */ 106 0x5c4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dir */
87 0x5c6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_nxt INPUT | PULLDOWN */ 107 0x5c6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_nxt */
88 0x5c8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat0 INPUT | PULLDOWN */ 108 0x5c8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat0 */
89 0x5cA 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat1 INPUT | PULLDOWN */ 109 0x5cA (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat1 */
90 0x1a4 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat2 INPUT | PULLDOWN */ 110 0x1a4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat2 */
91 0x1a6 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat3 INPUT | PULLDOWN */ 111 0x1a6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat3 */
92 0x1a8 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat4 INPUT | PULLDOWN */ 112 0x1a8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat4 */
93 0x1aa 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat5 INPUT | PULLDOWN */ 113 0x1aa (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat5 */
94 0x1ac 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat6 INPUT | PULLDOWN */ 114 0x1ac (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat6 */
95 0x1ae 0x10b /* USBB2_ULPITLL_CLK_MUXMODE.usbb1_ulpiphy_dat7 INPUT | PULLDOWN */ 115 0x1ae (PIN_INPUT_PULLDOWN | MUX_MODE3) /* usbb2_ulpitll_clk.usbb1_ulpiphy_dat7 */
116 >;
117 };
118
119 uart3_pins: pinmux_uart3_pins {
120 pinctrl-single,pins = <
121 0x16e (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
122 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
96 >; 123 >;
97 }; 124 };
98}; 125};
@@ -107,7 +134,8 @@
107 }; 134 };
108}; 135};
109 136
110/include/ "twl4030.dtsi" 137#include "twl4030.dtsi"
138#include "twl4030_omap3.dtsi"
111 139
112&mmc1 { 140&mmc1 {
113 vmmc-supply = <&vmmc1>; 141 vmmc-supply = <&vmmc1>;
@@ -142,3 +170,13 @@
142 */ 170 */
143 ti,pulldowns = <0x03a1c4>; 171 ti,pulldowns = <0x03a1c4>;
144}; 172};
173
174&uart3 {
175 pinctrl-names = "default";
176 pinctrl-0 = <&uart3_pins>;
177};
178
179&gpio1 {
180 pinctrl-names = "default";
181 pinctrl-0 = <&gpio1_pins>;
182};
diff --git a/arch/arm/boot/dts/omap3-devkit8000.dts b/arch/arm/boot/dts/omap3-devkit8000.dts
index 8a5cdcc6debd..7ef282795dd4 100644
--- a/arch/arm/boot/dts/omap3-devkit8000.dts
+++ b/arch/arm/boot/dts/omap3-devkit8000.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11/ { 11/ {
12 model = "TimLL OMAP3 Devkit8000"; 12 model = "TimLL OMAP3 Devkit8000";
13 compatible = "timll,omap3-devkit8000", "ti,omap3"; 13 compatible = "timll,omap3-devkit8000", "ti,omap3";
@@ -22,21 +22,21 @@
22 22
23 heartbeat { 23 heartbeat {
24 label = "devkit8000::led1"; 24 label = "devkit8000::led1";
25 gpios = <&gpio6 26 0>; /* 186 -> LED1 */ 25 gpios = <&gpio6 26 GPIO_ACTIVE_HIGH>; /* 186 -> LED1 */
26 default-state = "on"; 26 default-state = "on";
27 linux,default-trigger = "heartbeat"; 27 linux,default-trigger = "heartbeat";
28 }; 28 };
29 29
30 mmc { 30 mmc {
31 label = "devkit8000::led2"; 31 label = "devkit8000::led2";
32 gpios = <&gpio6 3 0>; /* 163 -> LED2 */ 32 gpios = <&gpio6 3 GPIO_ACTIVE_HIGH>; /* 163 -> LED2 */
33 default-state = "on"; 33 default-state = "on";
34 linux,default-trigger = "none"; 34 linux,default-trigger = "none";
35 }; 35 };
36 36
37 usr { 37 usr {
38 label = "devkit8000::led3"; 38 label = "devkit8000::led3";
39 gpios = <&gpio6 4 0>; /* 164 -> LED3 */ 39 gpios = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* 164 -> LED3 */
40 default-state = "on"; 40 default-state = "on";
41 linux,default-trigger = "usr"; 41 linux,default-trigger = "usr";
42 }; 42 };
@@ -80,7 +80,8 @@
80 status = "disabled"; 80 status = "disabled";
81}; 81};
82 82
83/include/ "twl4030.dtsi" 83#include "twl4030.dtsi"
84#include "twl4030_omap3.dtsi"
84 85
85&mmc1 { 86&mmc1 {
86 vmmc-supply = <&vmmc1>; 87 vmmc-supply = <&vmmc1>;
@@ -123,20 +124,21 @@
123 reg = <0 0 0>; /* CS0, offset 0 */ 124 reg = <0 0 0>; /* CS0, offset 0 */
124 nand-bus-width = <16>; 125 nand-bus-width = <16>;
125 126
126 gpmc,sync-clk = <0>; 127 gpmc,device-nand;
127 gpmc,cs-on = <0>; 128 gpmc,sync-clki-ps = <0>;
128 gpmc,cs-rd-off = <44>; 129 gpmc,cs-on-ns = <0>;
129 gpmc,cs-wr-off = <44>; 130 gpmc,cs-rd-off-ns = <44>;
130 gpmc,adv-on = <6>; 131 gpmc,cs-wr-off-ns = <44>;
131 gpmc,adv-rd-off = <34>; 132 gpmc,adv-on-ns = <6>;
132 gpmc,adv-wr-off = <44>; 133 gpmc,adv-rd-off-ns = <34>;
133 gpmc,we-off = <40>; 134 gpmc,adv-wr-off-ns = <44>;
134 gpmc,oe-off = <54>; 135 gpmc,we-off-ns = <40>;
135 gpmc,access = <64>; 136 gpmc,oe-off-ns = <54>;
136 gpmc,rd-cycle = <82>; 137 gpmc,access-ns = <64>;
137 gpmc,wr-cycle = <82>; 138 gpmc,rd-cycle-ns = <82>;
138 gpmc,wr-access = <40>; 139 gpmc,wr-cycle-ns = <82>;
139 gpmc,wr-data-mux-bus = <0>; 140 gpmc,wr-access-ns = <40>;
141 gpmc,wr-data-mux-bus-ns = <0>;
140 142
141 #address-cells = <1>; 143 #address-cells = <1>;
142 #size-cells = <1>; 144 #size-cells = <1>;
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index 96d1c206a57b..7d4329d179c4 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI OMAP3 EVM (OMAP3530, AM/DM37x)"; 13 model = "TI OMAP3 EVM (OMAP3530, AM/DM37x)";
@@ -28,7 +28,7 @@
28 compatible = "gpio-leds"; 28 compatible = "gpio-leds";
29 ledb { 29 ledb {
30 label = "omap3evm::ledb"; 30 label = "omap3evm::ledb";
31 gpios = <&twl_gpio 19 0>; /* LEDB */ 31 gpios = <&twl_gpio 19 GPIO_ACTIVE_HIGH>; /* LEDB */
32 linux,default-trigger = "default-on"; 32 linux,default-trigger = "default-on";
33 }; 33 };
34 }; 34 };
@@ -44,7 +44,8 @@
44 }; 44 };
45}; 45};
46 46
47/include/ "twl4030.dtsi" 47#include "twl4030.dtsi"
48#include "twl4030_omap3.dtsi"
48 49
49&i2c2 { 50&i2c2 {
50 clock-frequency = <400000>; 51 clock-frequency = <400000>;
diff --git a/arch/arm/boot/dts/omap3-igep.dtsi b/arch/arm/boot/dts/omap3-igep.dtsi
index f8fe3b748c3e..bc48b114eae6 100644
--- a/arch/arm/boot/dts/omap3-igep.dtsi
+++ b/arch/arm/boot/dts/omap3-igep.dtsi
@@ -10,7 +10,7 @@
10 */ 10 */
11/dts-v1/; 11/dts-v1/;
12 12
13/include/ "omap34xx.dtsi" 13#include "omap34xx.dtsi"
14 14
15/ { 15/ {
16 memory { 16 memory {
@@ -29,37 +29,43 @@
29&omap3_pmx_core { 29&omap3_pmx_core {
30 uart1_pins: pinmux_uart1_pins { 30 uart1_pins: pinmux_uart1_pins {
31 pinctrl-single,pins = < 31 pinctrl-single,pins = <
32 0x152 0x100 /* uart1_rx.uart1_rx INPUT | MODE0 */ 32 0x152 (PIN_INPUT | MUX_MODE0) /* uart1_rx.uart1_rx */
33 0x14c 0 /* uart1_tx.uart1_tx OUTPUT | MODE0 */ 33 0x14c (PIN_OUTPUT |MUX_MODE0) /* uart1_tx.uart1_tx */
34 >; 34 >;
35 }; 35 };
36 36
37 uart2_pins: pinmux_uart2_pins { 37 uart2_pins: pinmux_uart2_pins {
38 pinctrl-single,pins = < 38 pinctrl-single,pins = <
39 0x14a 0x100 /* uart2_rx.uart2_rx INPUT | MODE0 */ 39 0x14a (PIN_INPUT | MUX_MODE0) /* uart2_rx.uart2_rx */
40 0x148 0 /* uart2_tx.uart2_tx OUTPUT | MODE0 */ 40 0x148 (PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
41 >; 41 >;
42 }; 42 };
43 43
44 uart3_pins: pinmux_uart3_pins { 44 uart3_pins: pinmux_uart3_pins {
45 pinctrl-single,pins = < 45 pinctrl-single,pins = <
46 0x16e 0x100 /* uart3_rx.uart3_rx INPUT | MODE0 */ 46 0x16e (PIN_INPUT | MUX_MODE0) /* uart3_rx.uart3_rx */
47 0x170 0 /* uart3_tx.uart3_tx OUTPUT | MODE0 */ 47 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx.uart3_tx */
48 >; 48 >;
49 }; 49 };
50 50
51 mmc1_pins: pinmux_mmc1_pins { 51 mmc1_pins: pinmux_mmc1_pins {
52 pinctrl-single,pins = < 52 pinctrl-single,pins = <
53 0x114 0x0118 /* sdmmc1_clk.sdmmc1_clk INPUT PULLUP | MODE 0 */ 53 0x114 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_clk.sdmmc1_clk */
54 0x116 0x0118 /* sdmmc1_cmd.sdmmc1_cmd INPUT PULLUP | MODE 0 */ 54 0x116 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_cmd.sdmmc1_cmd */
55 0x118 0x0118 /* sdmmc1_dat0.sdmmc1_dat0 INPUT PULLUP | MODE 0 */ 55 0x118 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat0.sdmmc1_dat0 */
56 0x11a 0x0118 /* sdmmc1_dat1.sdmmc1_dat1 INPUT PULLUP | MODE 0 */ 56 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */
57 0x11c 0x0118 /* sdmmc1_dat2.sdmmc1_dat2 INPUT PULLUP | MODE 0 */ 57 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */
58 0x11e 0x0118 /* sdmmc1_dat3.sdmmc1_dat3 INPUT PULLUP | MODE 0 */ 58 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */
59 0x120 0x0100 /* sdmmc1_dat4.sdmmc1_dat4 INPUT | MODE 0 */ 59 0x120 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat4.sdmmc1_dat4 */
60 0x122 0x0100 /* sdmmc1_dat5.sdmmc1_dat5 INPUT | MODE 0 */ 60 0x122 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat5.sdmmc1_dat5 */
61 0x124 0x0100 /* sdmmc1_dat6.sdmmc1_dat6 INPUT | MODE 0 */ 61 0x124 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat6.sdmmc1_dat6 */
62 0x126 0x0100 /* sdmmc1_dat7.sdmmc1_dat7 INPUT | MODE 0 */ 62 0x126 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat7.sdmmc1_dat7 */
63 >;
64 };
65
66 smsc911x_pins: pinmux_smsc911x_pins {
67 pinctrl-single,pins = <
68 0x1a2 (PIN_INPUT | MUX_MODE4) /* mcspi1_cs2.gpio_176 */
63 >; 69 >;
64 }; 70 };
65}; 71};
@@ -80,7 +86,8 @@
80 }; 86 };
81}; 87};
82 88
83/include/ "twl4030.dtsi" 89#include "twl4030.dtsi"
90#include "twl4030_omap3.dtsi"
84 91
85&i2c2 { 92&i2c2 {
86 clock-frequency = <400000>; 93 clock-frequency = <400000>;
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts
index e2b98490cc9a..e8c48284587c 100644
--- a/arch/arm/boot/dts/omap3-igep0020.dts
+++ b/arch/arm/boot/dts/omap3-igep0020.dts
@@ -9,7 +9,7 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12/include/ "omap3-igep.dtsi" 12#include "omap3-igep.dtsi"
13 13
14/ { 14/ {
15 model = "IGEPv2"; 15 model = "IGEPv2";
@@ -19,27 +19,39 @@
19 compatible = "gpio-leds"; 19 compatible = "gpio-leds";
20 boot { 20 boot {
21 label = "omap3:green:boot"; 21 label = "omap3:green:boot";
22 gpios = <&gpio1 26 0>; 22 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
23 default-state = "on"; 23 default-state = "on";
24 }; 24 };
25 25
26 user0 { 26 user0 {
27 label = "omap3:red:user0"; 27 label = "omap3:red:user0";
28 gpios = <&gpio1 27 0>; 28 gpios = <&gpio1 27 GPIO_ACTIVE_HIGH>;
29 default-state = "off"; 29 default-state = "off";
30 }; 30 };
31 31
32 user1 { 32 user1 {
33 label = "omap3:red:user1"; 33 label = "omap3:red:user1";
34 gpios = <&gpio1 28 0>; 34 gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
35 default-state = "off"; 35 default-state = "off";
36 }; 36 };
37 37
38 user2 { 38 user2 {
39 label = "omap3:green:user1"; 39 label = "omap3:green:user1";
40 gpios = <&twl_gpio 19 1>; 40 gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>;
41 }; 41 };
42 }; 42 };
43
44 vddvario: regulator-vddvario {
45 compatible = "regulator-fixed";
46 regulator-name = "vddvario";
47 regulator-always-on;
48 };
49
50 vdd33a: regulator-vdd33a {
51 compatible = "regulator-fixed";
52 regulator-name = "vdd33a";
53 regulator-always-on;
54 };
43}; 55};
44 56
45&i2c3 { 57&i2c3 {
@@ -54,3 +66,92 @@
54 reg = <0x50>; 66 reg = <0x50>;
55 }; 67 };
56}; 68};
69
70&gpmc {
71 ranges = <0 0 0x00000000 0x20000000>,
72 <5 0 0x2c000000 0x01000000>;
73
74 nand@0,0 {
75 linux,mtd-name= "micron,mt29c4g96maz";
76 reg = <0 0 0>;
77 nand-bus-width = <16>;
78 ti,nand-ecc-opt = "bch8";
79
80 gpmc,sync-clk-ps = <0>;
81 gpmc,cs-on-ns = <0>;
82 gpmc,cs-rd-off-ns = <44>;
83 gpmc,cs-wr-off-ns = <44>;
84 gpmc,adv-on-ns = <6>;
85 gpmc,adv-rd-off-ns = <34>;
86 gpmc,adv-wr-off-ns = <44>;
87 gpmc,we-off-ns = <40>;
88 gpmc,oe-off-ns = <54>;
89 gpmc,access-ns = <64>;
90 gpmc,rd-cycle-ns = <82>;
91 gpmc,wr-cycle-ns = <82>;
92 gpmc,wr-access-ns = <40>;
93 gpmc,wr-data-mux-bus-ns = <0>;
94
95 #address-cells = <1>;
96 #size-cells = <1>;
97
98 partition@0 {
99 label = "SPL";
100 reg = <0 0x100000>;
101 };
102 partition@0x80000 {
103 label = "U-Boot";
104 reg = <0x100000 0x180000>;
105 };
106 partition@0x1c0000 {
107 label = "Environment";
108 reg = <0x280000 0x100000>;
109 };
110 partition@0x280000 {
111 label = "Kernel";
112 reg = <0x380000 0x300000>;
113 };
114 partition@0x780000 {
115 label = "Filesystem";
116 reg = <0x680000 0x1f980000>;
117 };
118 };
119
120 ethernet@5,0 {
121 pinctrl-names = "default";
122 pinctrl-0 = <&smsc911x_pins>;
123 compatible = "smsc,lan9221", "smsc,lan9115";
124 reg = <5 0 0xff>;
125 bank-width = <2>;
126
127 gpmc,mux-add-data;
128 gpmc,cs-on-ns = <0>;
129 gpmc,cs-rd-off-ns = <186>;
130 gpmc,cs-wr-off-ns = <186>;
131 gpmc,adv-on-ns = <12>;
132 gpmc,adv-rd-off-ns = <48>;
133 gpmc,adv-wr-off-ns = <48>;
134 gpmc,oe-on-ns = <54>;
135 gpmc,oe-off-ns = <168>;
136 gpmc,we-on-ns = <54>;
137 gpmc,we-off-ns = <168>;
138 gpmc,rd-cycle-ns = <186>;
139 gpmc,wr-cycle-ns = <186>;
140 gpmc,access-ns = <114>;
141 gpmc,page-burst-access-ns = <6>;
142 gpmc,bus-turnaround-ns = <12>;
143 gpmc,cycle2cycle-delay-ns = <18>;
144 gpmc,wr-data-mux-bus-ns = <90>;
145 gpmc,wr-access-ns = <186>;
146 gpmc,cycle2cycle-samecsen;
147 gpmc,cycle2cycle-diffcsen;
148
149 interrupt-parent = <&gpio6>;
150 interrupts = <16 8>;
151 vmmc-supply = <&vddvario>;
152 vmmc_aux-supply = <&vdd33a>;
153 reg-io-width = <4>;
154
155 smsc,save-mac-address;
156 };
157};
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts
index 9dc48d262ffb..644d05383836 100644
--- a/arch/arm/boot/dts/omap3-igep0030.dts
+++ b/arch/arm/boot/dts/omap3-igep0030.dts
@@ -9,7 +9,7 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12/include/ "omap3-igep.dtsi" 12#include "omap3-igep.dtsi"
13 13
14/ { 14/ {
15 model = "IGEP COM Module"; 15 model = "IGEP COM Module";
@@ -19,26 +19,76 @@
19 compatible = "gpio-leds"; 19 compatible = "gpio-leds";
20 boot { 20 boot {
21 label = "omap3:green:boot"; 21 label = "omap3:green:boot";
22 gpios = <&twl_gpio 13 1>; 22 gpios = <&twl_gpio 13 GPIO_ACTIVE_LOW>;
23 default-state = "on"; 23 default-state = "on";
24 }; 24 };
25 25
26 user0 { 26 user0 {
27 label = "omap3:red:user0"; 27 label = "omap3:red:user0";
28 gpios = <&twl_gpio 18 1>; /* LEDA */ 28 gpios = <&twl_gpio 18 GPIO_ACTIVE_LOW>; /* LEDA */
29 default-state = "off"; 29 default-state = "off";
30 }; 30 };
31 31
32 user1 { 32 user1 {
33 label = "omap3:green:user1"; 33 label = "omap3:green:user1";
34 gpios = <&twl_gpio 19 1>; /* LEDB */ 34 gpios = <&twl_gpio 19 GPIO_ACTIVE_LOW>; /* LEDB */
35 default-state = "off"; 35 default-state = "off";
36 }; 36 };
37 37
38 user2 { 38 user2 {
39 label = "omap3:red:user1"; 39 label = "omap3:red:user1";
40 gpios = <&gpio1 16 1>; 40 gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
41 default-state = "off"; 41 default-state = "off";
42 }; 42 };
43 }; 43 };
44}; 44};
45
46&gpmc {
47 ranges = <0 0 0x00000000 0x20000000>;
48
49 nand@0,0 {
50 linux,mtd-name= "micron,mt29c4g96maz";
51 reg = <0 0 0>;
52 nand-bus-width = <16>;
53 ti,nand-ecc-opt = "bch8";
54
55 gpmc,sync-clk-ps = <0>;
56 gpmc,cs-on-ns = <0>;
57 gpmc,cs-rd-off-ns = <44>;
58 gpmc,cs-wr-off-ns = <44>;
59 gpmc,adv-on-ns = <6>;
60 gpmc,adv-rd-off-ns = <34>;
61 gpmc,adv-wr-off-ns = <44>;
62 gpmc,we-off-ns = <40>;
63 gpmc,oe-off-ns = <54>;
64 gpmc,access-ns = <64>;
65 gpmc,rd-cycle-ns = <82>;
66 gpmc,wr-cycle-ns = <82>;
67 gpmc,wr-access-ns = <40>;
68 gpmc,wr-data-mux-bus-ns = <0>;
69
70 #address-cells = <1>;
71 #size-cells = <1>;
72
73 partition@0 {
74 label = "SPL";
75 reg = <0 0x100000>;
76 };
77 partition@0x80000 {
78 label = "U-Boot";
79 reg = <0x100000 0x180000>;
80 };
81 partition@0x1c0000 {
82 label = "Environment";
83 reg = <0x280000 0x100000>;
84 };
85 partition@0x280000 {
86 label = "Kernel";
87 reg = <0x380000 0x300000>;
88 };
89 partition@0x780000 {
90 label = "Filesystem";
91 reg = <0x680000 0x1f980000>;
92 };
93 };
94};
diff --git a/arch/arm/boot/dts/omap3-overo.dtsi b/arch/arm/boot/dts/omap3-overo.dtsi
index a626c50041f6..8f1abec78275 100644
--- a/arch/arm/boot/dts/omap3-overo.dtsi
+++ b/arch/arm/boot/dts/omap3-overo.dtsi
@@ -11,7 +11,7 @@
11 */ 11 */
12/dts-v1/; 12/dts-v1/;
13 13
14/include/ "omap34xx.dtsi" 14#include "omap34xx.dtsi"
15 15
16/ { 16/ {
17 pwmleds { 17 pwmleds {
@@ -21,6 +21,7 @@
21 label = "overo:blue:COM"; 21 label = "overo:blue:COM";
22 pwms = <&twl_pwmled 1 7812500>; 22 pwms = <&twl_pwmled 1 7812500>;
23 max-brightness = <127>; 23 max-brightness = <127>;
24 linux,default-trigger = "mmc0";
24 }; 25 };
25 }; 26 };
26 27
@@ -49,7 +50,8 @@
49 }; 50 };
50}; 51};
51 52
52/include/ "twl4030.dtsi" 53#include "twl4030.dtsi"
54#include "twl4030_omap3.dtsi"
53 55
54/* i2c2 pins are used for gpio */ 56/* i2c2 pins are used for gpio */
55&i2c2 { 57&i2c2 {
@@ -77,3 +79,17 @@
77 mode = <3>; 79 mode = <3>;
78 power = <50>; 80 power = <50>;
79}; 81};
82
83&omap3_pmx_core {
84 uart3_pins: pinmux_uart3_pins {
85 pinctrl-single,pins = <
86 0x16e (PIN_INPUT | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
87 0x170 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
88 >;
89 };
90};
91
92&uart3 {
93 pinctrl-names = "default";
94 pinctrl-0 = <&uart3_pins>;
95};
diff --git a/arch/arm/boot/dts/omap3-tobi.dts b/arch/arm/boot/dts/omap3-tobi.dts
index a13d12de77ff..7e4ad2aec37a 100644
--- a/arch/arm/boot/dts/omap3-tobi.dts
+++ b/arch/arm/boot/dts/omap3-tobi.dts
@@ -10,7 +10,7 @@
10 * Tobi expansion board is manufactured by Gumstix Inc. 10 * Tobi expansion board is manufactured by Gumstix Inc.
11 */ 11 */
12 12
13/include/ "omap3-overo.dtsi" 13#include "omap3-overo.dtsi"
14 14
15/ { 15/ {
16 model = "TI OMAP3 Gumstix Overo on Tobi"; 16 model = "TI OMAP3 Gumstix Overo on Tobi";
@@ -20,10 +20,58 @@
20 compatible = "gpio-leds"; 20 compatible = "gpio-leds";
21 heartbeat { 21 heartbeat {
22 label = "overo:red:gpio21"; 22 label = "overo:red:gpio21";
23 gpios = <&gpio1 21 0>; 23 gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
24 linux,default-trigger = "heartbeat"; 24 linux,default-trigger = "heartbeat";
25 }; 25 };
26 }; 26 };
27
28 vddvario: regulator-vddvario {
29 compatible = "regulator-fixed";
30 regulator-name = "vddvario";
31 regulator-always-on;
32 };
33
34 vdd33a: regulator-vdd33a {
35 compatible = "regulator-fixed";
36 regulator-name = "vdd33a";
37 regulator-always-on;
38 };
39};
40
41&gpmc {
42 ranges = <5 0 0x2c000000 0x1000000>; /* CS5 */
43
44 ethernet@5,0 {
45 compatible = "smsc,lan9221", "smsc,lan9115";
46 reg = <5 0 0xff>;
47 bank-width = <2>;
48
49 gpmc,mux-add-data;
50 gpmc,cs-on-ns = <0>;
51 gpmc,cs-rd-off-ns = <42>;
52 gpmc,cs-wr-off-ns = <36>;
53 gpmc,adv-on-ns = <6>;
54 gpmc,adv-rd-off-ns = <12>;
55 gpmc,adv-wr-off-ns = <12>;
56 gpmc,oe-on-ns = <0>;
57 gpmc,oe-off-ns = <42>;
58 gpmc,we-on-ns = <0>;
59 gpmc,we-off-ns = <36>;
60 gpmc,rd-cycle-ns = <60>;
61 gpmc,wr-cycle-ns = <54>;
62 gpmc,access-ns = <36>;
63 gpmc,page-burst-access-ns = <0>;
64 gpmc,bus-turnaround-ns = <0>;
65 gpmc,cycle2cycle-delay-ns = <0>;
66 gpmc,wr-data-mux-bus-ns = <18>;
67 gpmc,wr-access-ns = <42>;
68 gpmc,cycle2cycle-samecsen;
69 gpmc,cycle2cycle-diffcsen;
70
71 interrupt-parent = <&gpio6>;
72 interrupts = <16 IRQ_TYPE_LEVEL_LOW>; /* GPIO 176 */
73 reg-io-width = <4>;
74 };
27}; 75};
28 76
29&i2c3 { 77&i2c3 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 99ba6e14ebf3..7d95cda1fae4 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -8,7 +8,11 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "skeleton.dtsi" 11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/interrupt-controller/irq.h>
13#include <dt-bindings/pinctrl/omap.h>
14
15#include "skeleton.dtsi"
12 16
13/ { 17/ {
14 compatible = "ti,omap3430", "ti,omap3"; 18 compatible = "ti,omap3430", "ti,omap3";
@@ -21,8 +25,13 @@
21 }; 25 };
22 26
23 cpus { 27 cpus {
28 #address-cells = <1>;
29 #size-cells = <0>;
30
24 cpu@0 { 31 cpu@0 {
25 compatible = "arm,cortex-a8"; 32 compatible = "arm,cortex-a8";
33 device_type = "cpu";
34 reg = <0x0>;
26 }; 35 };
27 }; 36 };
28 37
diff --git a/arch/arm/boot/dts/omap3430-sdp.dts b/arch/arm/boot/dts/omap3430-sdp.dts
index 144ae43453c4..e2249bcc3e63 100644
--- a/arch/arm/boot/dts/omap3430-sdp.dts
+++ b/arch/arm/boot/dts/omap3430-sdp.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap34xx.dtsi" 10#include "omap34xx.dtsi"
11 11
12/ { 12/ {
13 model = "TI OMAP3430 SDP"; 13 model = "TI OMAP3430 SDP";
@@ -28,7 +28,8 @@
28 }; 28 };
29}; 29};
30 30
31/include/ "twl4030.dtsi" 31#include "twl4030.dtsi"
32#include "twl4030_omap3.dtsi"
32 33
33&mmc1 { 34&mmc1 {
34 vmmc-supply = <&vmmc1>; 35 vmmc-supply = <&vmmc1>;
@@ -105,7 +106,6 @@
105 nand-bus-width = <8>; 106 nand-bus-width = <8>;
106 107
107 ti,nand-ecc-opt = "sw"; 108 ti,nand-ecc-opt = "sw";
108 gpmc,device-nand;
109 gpmc,cs-on-ns = <0>; 109 gpmc,cs-on-ns = <0>;
110 gpmc,cs-rd-off-ns = <36>; 110 gpmc,cs-rd-off-ns = <36>;
111 gpmc,cs-wr-off-ns = <36>; 111 gpmc,cs-wr-off-ns = <36>;
diff --git a/arch/arm/boot/dts/omap34xx.dtsi b/arch/arm/boot/dts/omap34xx.dtsi
index 75ed4ae2e631..5355d6173748 100644
--- a/arch/arm/boot/dts/omap34xx.dtsi
+++ b/arch/arm/boot/dts/omap34xx.dtsi
@@ -8,7 +8,7 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "omap3.dtsi" 11#include "omap3.dtsi"
12 12
13/ { 13/ {
14 cpus { 14 cpus {
diff --git a/arch/arm/boot/dts/omap36xx.dtsi b/arch/arm/boot/dts/omap36xx.dtsi
index f3447bc1b032..f8b3765eb9be 100644
--- a/arch/arm/boot/dts/omap36xx.dtsi
+++ b/arch/arm/boot/dts/omap36xx.dtsi
@@ -8,7 +8,7 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "omap3.dtsi" 11#include "omap3.dtsi"
12 12
13/ { 13/ {
14 aliases { 14 aliases {
diff --git a/arch/arm/boot/dts/omap4-panda-a4.dts b/arch/arm/boot/dts/omap4-panda-a4.dts
index e30cdf0f5ac1..133f1b74e8ae 100644
--- a/arch/arm/boot/dts/omap4-panda-a4.dts
+++ b/arch/arm/boot/dts/omap4-panda-a4.dts
@@ -7,14 +7,14 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap443x.dtsi" 10#include "omap443x.dtsi"
11/include/ "omap4-panda-common.dtsi" 11#include "omap4-panda-common.dtsi"
12 12
13/* Pandaboard Rev A4+ have external pullups on SCL & SDA */ 13/* Pandaboard Rev A4+ have external pullups on SCL & SDA */
14&dss_hdmi_pins { 14&dss_hdmi_pins {
15 pinctrl-single,pins = < 15 pinctrl-single,pins = <
16 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */ 16 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */
17 0x5c 0x100 /* hdmi_scl.hdmi_scl INPUT | MODE 0 */ 17 0x5c (PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */
18 0x5e 0x100 /* hdmi_sda.hdmi_sda INPUT | MODE 0 */ 18 0x5e (PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */
19 >; 19 >;
20}; 20};
diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
index 03bd60deb52b..faa95b5b242e 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -5,7 +5,7 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8/include/ "elpida_ecb240abacn.dtsi" 8#include "elpida_ecb240abacn.dtsi"
9 9
10/ { 10/ {
11 model = "TI OMAP4 PandaBoard"; 11 model = "TI OMAP4 PandaBoard";
@@ -16,17 +16,22 @@
16 reg = <0x80000000 0x40000000>; /* 1 GB */ 16 reg = <0x80000000 0x40000000>; /* 1 GB */
17 }; 17 };
18 18
19 leds { 19 leds: leds {
20 compatible = "gpio-leds"; 20 compatible = "gpio-leds";
21 pinctrl-names = "default";
22 pinctrl-0 = <
23 &led_wkgpio_pins
24 >;
25
21 heartbeat { 26 heartbeat {
22 label = "pandaboard::status1"; 27 label = "pandaboard::status1";
23 gpios = <&gpio1 7 0>; 28 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
24 linux,default-trigger = "heartbeat"; 29 linux,default-trigger = "heartbeat";
25 }; 30 };
26 31
27 mmc { 32 mmc {
28 label = "pandaboard::status2"; 33 label = "pandaboard::status2";
29 gpios = <&gpio1 8 0>; 34 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
30 linux,default-trigger = "mmc0"; 35 linux,default-trigger = "mmc0";
31 }; 36 };
32 }; 37 };
@@ -54,85 +59,180 @@
54 "AFML", "Line In", 59 "AFML", "Line In",
55 "AFMR", "Line In"; 60 "AFMR", "Line In";
56 }; 61 };
62
63 /*
64 * Temp hack: Need to be replaced with the proper gpio-controlled
65 * reset driver as soon it will be merged.
66 * http://thread.gmane.org/gmane.linux.drivers.devicetree/36830
67 */
68 /* HS USB Port 1 RESET */
69 hsusb1_reset: hsusb1_reset_reg {
70 compatible = "regulator-fixed";
71 regulator-name = "hsusb1_reset";
72 regulator-min-microvolt = <3300000>;
73 regulator-max-microvolt = <3300000>;
74 gpio = <&gpio2 30 0>; /* gpio_62 */
75 startup-delay-us = <70000>;
76 enable-active-high;
77 };
78
79 /* HS USB Port 1 Power */
80 hsusb1_power: hsusb1_power_reg {
81 compatible = "regulator-fixed";
82 regulator-name = "hsusb1_vbus";
83 regulator-min-microvolt = <3300000>;
84 regulator-max-microvolt = <3300000>;
85 gpio = <&gpio1 1 0>; /* gpio_1 */
86 startup-delay-us = <70000>;
87 enable-active-high;
88 /*
89 * boot-on is required along with always-on as the
90 * regulator framework doesn't enable the regulator
91 * if boot-on is not there.
92 */
93 regulator-always-on;
94 regulator-boot-on;
95 };
96
97 /* HS USB Host PHY on PORT 1 */
98 hsusb1_phy: hsusb1_phy {
99 compatible = "usb-nop-xceiv";
100 reset-supply = <&hsusb1_reset>;
101 vcc-supply = <&hsusb1_power>;
102 /**
103 * FIXME:
104 * put the right clock phandle here when available
105 * clocks = <&auxclk3>;
106 * clock-names = "main_clk";
107 */
108 clock-frequency = <19200000>;
109 };
110};
111
112&omap4_pmx_wkup {
113 pinctrl-names = "default";
114 pinctrl-0 = <
115 &twl6030_wkup_pins
116 >;
117
118 twl6030_wkup_pins: pinmux_twl6030_wkup_pins {
119 pinctrl-single,pins = <
120 0x14 (PIN_OUTPUT | MUX_MODE2) /* fref_clk0_out.sys_drm_msecure */
121 >;
122 };
57}; 123};
58 124
59&omap4_pmx_core { 125&omap4_pmx_core {
60 pinctrl-names = "default"; 126 pinctrl-names = "default";
61 pinctrl-0 = < 127 pinctrl-0 = <
128 &twl6030_pins
62 &twl6040_pins 129 &twl6040_pins
63 &mcpdm_pins 130 &mcpdm_pins
64 &mcbsp1_pins 131 &mcbsp1_pins
65 &dss_hdmi_pins 132 &dss_hdmi_pins
66 &tpd12s015_pins 133 &tpd12s015_pins
134 &hsusbb1_pins
67 >; 135 >;
68 136
137 twl6030_pins: pinmux_twl6030_pins {
138 pinctrl-single,pins = <
139 0x15e (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1.sys_nirq1 */
140 >;
141 };
142
69 twl6040_pins: pinmux_twl6040_pins { 143 twl6040_pins: pinmux_twl6040_pins {
70 pinctrl-single,pins = < 144 pinctrl-single,pins = <
71 0xe0 0x3 /* hdq_sio.gpio_127 OUTPUT | MODE3 */ 145 0xe0 (PIN_OUTPUT | MUX_MODE3) /* hdq_sio.gpio_127 */
72 0x160 0x100 /* sys_nirq2.sys_nirq2 INPUT | MODE0 */ 146 0x160 (PIN_INPUT | MUX_MODE0) /* sys_nirq2.sys_nirq2 */
73 >; 147 >;
74 }; 148 };
75 149
76 mcpdm_pins: pinmux_mcpdm_pins { 150 mcpdm_pins: pinmux_mcpdm_pins {
77 pinctrl-single,pins = < 151 pinctrl-single,pins = <
78 0xc6 0x108 /* abe_pdm_ul_data.abe_pdm_ul_data INPUT PULLDOWN | MODE0 */ 152 0xc6 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_pdm_ul_data.abe_pdm_ul_data */
79 0xc8 0x108 /* abe_pdm_dl_data.abe_pdm_dl_data INPUT PULLDOWN | MODE0 */ 153 0xc8 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_pdm_dl_data.abe_pdm_dl_data */
80 0xca 0x118 /* abe_pdm_frame.abe_pdm_frame INPUT PULLUP | MODE0 */ 154 0xca (PIN_INPUT_PULLUP | MUX_MODE0) /* abe_pdm_frame.abe_pdm_frame */
81 0xcc 0x108 /* abe_pdm_lb_clk.abe_pdm_lb_clk INPUT PULLDOWN | MODE0 */ 155 0xcc (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_pdm_lb_clk.abe_pdm_lb_clk */
82 0xce 0x108 /* abe_clks.abe_clks INPUT PULLDOWN | MODE0 */ 156 0xce (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_clks.abe_clks */
83 >; 157 >;
84 }; 158 };
85 159
86 mcbsp1_pins: pinmux_mcbsp1_pins { 160 mcbsp1_pins: pinmux_mcbsp1_pins {
87 pinctrl-single,pins = < 161 pinctrl-single,pins = <
88 0xbe 0x100 /* abe_mcbsp1_clkx.abe_mcbsp1_clkx INPUT | MODE0 */ 162 0xbe (PIN_INPUT | MUX_MODE0) /* abe_mcbsp1_clkx.abe_mcbsp1_clkx */
89 0xc0 0x108 /* abe_mcbsp1_dr.abe_mcbsp1_dr INPUT PULLDOWN | MODE0 */ 163 0xc0 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_mcbsp1_dr.abe_mcbsp1_dr */
90 0xc2 0x8 /* abe_mcbsp1_dx.abe_mcbsp1_dx OUTPUT PULLDOWN | MODE0 */ 164 0xc2 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* abe_mcbsp1_dx.abe_mcbsp1_dx */
91 0xc4 0x100 /* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */ 165 0xc4 (PIN_INPUT | MUX_MODE0) /* abe_mcbsp1_fsx.abe_mcbsp1_fsx */
92 >; 166 >;
93 }; 167 };
94 168
95 dss_hdmi_pins: pinmux_dss_hdmi_pins { 169 dss_hdmi_pins: pinmux_dss_hdmi_pins {
96 pinctrl-single,pins = < 170 pinctrl-single,pins = <
97 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */ 171 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */
98 0x5c 0x118 /* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */ 172 0x5c (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_scl.hdmi_scl */
99 0x5e 0x118 /* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */ 173 0x5e (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_sda.hdmi_sda */
100 >; 174 >;
101 }; 175 };
102 176
103 tpd12s015_pins: pinmux_tpd12s015_pins { 177 tpd12s015_pins: pinmux_tpd12s015_pins {
104 pinctrl-single,pins = < 178 pinctrl-single,pins = <
105 0x22 0x3 /* gpmc_a17.gpio_41 OUTPUT | MODE3 */ 179 0x22 (PIN_OUTPUT | MUX_MODE3) /* gpmc_a17.gpio_41 */
106 0x48 0x3 /* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */ 180 0x48 (PIN_OUTPUT | MUX_MODE3) /* gpmc_nbe1.gpio_60 */
107 0x58 0x10b /* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */ 181 0x58 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* hdmi_hpd.gpio_63 */
182 >;
183 };
184
185 hsusbb1_pins: pinmux_hsusbb1_pins {
186 pinctrl-single,pins = <
187 0x82 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_clk.usbb1_ulpiphy_clk */
188 0x84 (PIN_OUTPUT | MUX_MODE4) /* usbb1_ulpitll_stp.usbb1_ulpiphy_stp */
189 0x86 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dir.usbb1_ulpiphy_dir */
190 0x88 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_nxt.usbb1_ulpiphy_nxt */
191 0x8a (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat0.usbb1_ulpiphy_dat0 */
192 0x8c (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat1.usbb1_ulpiphy_dat1 */
193 0x8e (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat2.usbb1_ulpiphy_dat2 */
194 0x90 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat3.usbb1_ulpiphy_dat3 */
195 0x92 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat4.usbb1_ulpiphy_dat4 */
196 0x94 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat5.usbb1_ulpiphy_dat5 */
197 0x96 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat6.usbb1_ulpiphy_dat6 */
198 0x98 (PIN_INPUT_PULLDOWN | MUX_MODE4) /* usbb1_ulpitll_dat7.usbb1_ulpiphy_dat7 */
108 >; 199 >;
109 }; 200 };
110 201
111 i2c1_pins: pinmux_i2c1_pins { 202 i2c1_pins: pinmux_i2c1_pins {
112 pinctrl-single,pins = < 203 pinctrl-single,pins = <
113 0xe2 0x118 /* i2c1_scl PULLUP | INPUTENABLE | MODE0 */ 204 0xe2 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
114 0xe4 0x118 /* i2c1_sda PULLUP | INPUTENABLE | MODE0 */ 205 0xe4 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
115 >; 206 >;
116 }; 207 };
117 208
118 i2c2_pins: pinmux_i2c2_pins { 209 i2c2_pins: pinmux_i2c2_pins {
119 pinctrl-single,pins = < 210 pinctrl-single,pins = <
120 0xe6 0x118 /* i2c2_scl PULLUP | INPUTENABLE | MODE0 */ 211 0xe6 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */
121 0xe8 0x118 /* i2c2_sda PULLUP | INPUTENABLE | MODE0 */ 212 0xe8 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */
122 >; 213 >;
123 }; 214 };
124 215
125 i2c3_pins: pinmux_i2c3_pins { 216 i2c3_pins: pinmux_i2c3_pins {
126 pinctrl-single,pins = < 217 pinctrl-single,pins = <
127 0xea 0x118 /* i2c3_scl PULLUP | INPUTENABLE | MODE0 */ 218 0xea (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */
128 0xec 0x118 /* i2c3_sda PULLUP | INPUTENABLE | MODE0 */ 219 0xec (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */
129 >; 220 >;
130 }; 221 };
131 222
132 i2c4_pins: pinmux_i2c4_pins { 223 i2c4_pins: pinmux_i2c4_pins {
133 pinctrl-single,pins = < 224 pinctrl-single,pins = <
134 0xee 0x118 /* i2c4_scl PULLUP | INPUTENABLE | MODE0 */ 225 0xee (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_scl */
135 0xf0 0x118 /* i2c4_sda PULLUP | INPUTENABLE | MODE0 */ 226 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */
227 >;
228 };
229};
230
231&omap4_pmx_wkup {
232 led_wkgpio_pins: pinmux_leds_wkpins {
233 pinctrl-single,pins = <
234 0x1a (PIN_OUTPUT | MUX_MODE3) /* gpio_wk7 */
235 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */
136 >; 236 >;
137 }; 237 };
138}; 238};
@@ -145,18 +245,18 @@
145 245
146 twl: twl@48 { 246 twl: twl@48 {
147 reg = <0x48>; 247 reg = <0x48>;
148 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ 248 /* IRQ# = 7 */
149 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ 249 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
150 interrupt-parent = <&gic>; 250 interrupt-parent = <&gic>;
151 }; 251 };
152 252
153 twl6040: twl@4b { 253 twl6040: twl@4b {
154 compatible = "ti,twl6040"; 254 compatible = "ti,twl6040";
155 reg = <0x4b>; 255 reg = <0x4b>;
156 /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ 256 /* IRQ# = 119 */
157 interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ 257 interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_2N cascaded to gic */
158 interrupt-parent = <&gic>; 258 interrupt-parent = <&gic>;
159 ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ 259 ti,audpwron-gpio = <&gpio4 31 GPIO_ACTIVE_HIGH>; /* gpio line 127 */
160 260
161 vio-supply = <&v1v8>; 261 vio-supply = <&v1v8>;
162 v2v1-supply = <&v2v1>; 262 v2v1-supply = <&v2v1>;
@@ -164,7 +264,7 @@
164 }; 264 };
165}; 265};
166 266
167/include/ "twl6030.dtsi" 267#include "twl6030.dtsi"
168 268
169&i2c2 { 269&i2c2 {
170 pinctrl-names = "default"; 270 pinctrl-names = "default";
@@ -249,3 +349,11 @@
249 mode = <3>; 349 mode = <3>;
250 power = <50>; 350 power = <50>;
251}; 351};
352
353&usbhshost {
354 port1-mode = "ehci-phy";
355};
356
357&usbhsehci {
358 phys = <&hsusb1_phy>;
359};
diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts
index f1d8c217ce12..56c435468e94 100644
--- a/arch/arm/boot/dts/omap4-panda-es.dts
+++ b/arch/arm/boot/dts/omap4-panda-es.dts
@@ -7,8 +7,8 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap4460.dtsi" 10#include "omap4460.dtsi"
11/include/ "omap4-panda-common.dtsi" 11#include "omap4-panda-common.dtsi"
12 12
13/* Audio routing is differnet between PandaBoard4430 and PandaBoardES */ 13/* Audio routing is differnet between PandaBoard4430 and PandaBoardES */
14&sound { 14&sound {
@@ -29,8 +29,36 @@
29/* PandaboardES has external pullups on SCL & SDA */ 29/* PandaboardES has external pullups on SCL & SDA */
30&dss_hdmi_pins { 30&dss_hdmi_pins {
31 pinctrl-single,pins = < 31 pinctrl-single,pins = <
32 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */ 32 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */
33 0x5c 0x100 /* hdmi_scl.hdmi_scl INPUT | MODE 0 */ 33 0x5c (PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */
34 0x5e 0x100 /* hdmi_sda.hdmi_sda INPUT | MODE 0 */ 34 0x5e (PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */
35 >; 35 >;
36}; 36};
37
38&omap4_pmx_core {
39 led_gpio_pins: gpio_led_pmx {
40 pinctrl-single,pins = <
41 0xb6 (PIN_OUTPUT | MUX_MODE3) /* gpio_110 */
42 >;
43 };
44};
45
46&led_wkgpio_pins {
47 pinctrl-single,pins = <
48 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */
49 >;
50};
51
52&leds {
53 pinctrl-0 = <
54 &led_gpio_pins
55 &led_wkgpio_pins
56 >;
57
58 heartbeat {
59 gpios = <&gpio4 14 GPIO_ACTIVE_HIGH>;
60 };
61 mmc {
62 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
63 };
64};
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts
index f8b221f0168e..6189a8b77d7f 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -7,5 +7,5 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap443x.dtsi" 10#include "omap443x.dtsi"
11/include/ "omap4-panda-common.dtsi" 11#include "omap4-panda-common.dtsi"
diff --git a/arch/arm/boot/dts/omap4-sdp-es23plus.dts b/arch/arm/boot/dts/omap4-sdp-es23plus.dts
index b4a40ffbce31..aad5dda0f469 100644
--- a/arch/arm/boot/dts/omap4-sdp-es23plus.dts
+++ b/arch/arm/boot/dts/omap4-sdp-es23plus.dts
@@ -5,13 +5,13 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8/include/ "omap4-sdp.dts" 8#include "omap4-sdp.dts"
9 9
10/* SDP boards with 4430 ES2.3+ or 4460 have external pullups on SCL & SDA */ 10/* SDP boards with 4430 ES2.3+ or 4460 have external pullups on SCL & SDA */
11&dss_hdmi_pins { 11&dss_hdmi_pins {
12 pinctrl-single,pins = < 12 pinctrl-single,pins = <
13 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */ 13 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */
14 0x5c 0x100 /* hdmi_scl.hdmi_scl INPUT | MODE 0 */ 14 0x5c (PIN_INPUT | MUX_MODE0) /* hdmi_scl.hdmi_scl */
15 0x5e 0x100 /* hdmi_sda.hdmi_sda INPUT | MODE 0 */ 15 0x5e (PIN_INPUT | MUX_MODE0) /* hdmi_sda.hdmi_sda */
16 >; 16 >;
17}; 17};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index a35d9cd58063..7951b4ea500a 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -7,8 +7,8 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap443x.dtsi" 10#include "omap443x.dtsi"
11/include/ "elpida_ecb240abacn.dtsi" 11#include "elpida_ecb240abacn.dtsi"
12 12
13/ { 13/ {
14 model = "TI OMAP4 SDP board"; 14 model = "TI OMAP4 SDP board";
@@ -41,42 +41,42 @@
41 compatible = "gpio-leds"; 41 compatible = "gpio-leds";
42 debug0 { 42 debug0 {
43 label = "omap4:green:debug0"; 43 label = "omap4:green:debug0";
44 gpios = <&gpio2 29 0>; /* 61 */ 44 gpios = <&gpio2 29 GPIO_ACTIVE_HIGH>; /* 61 */
45 }; 45 };
46 46
47 debug1 { 47 debug1 {
48 label = "omap4:green:debug1"; 48 label = "omap4:green:debug1";
49 gpios = <&gpio1 30 0>; /* 30 */ 49 gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>; /* 30 */
50 }; 50 };
51 51
52 debug2 { 52 debug2 {
53 label = "omap4:green:debug2"; 53 label = "omap4:green:debug2";
54 gpios = <&gpio1 7 0>; /* 7 */ 54 gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; /* 7 */
55 }; 55 };
56 56
57 debug3 { 57 debug3 {
58 label = "omap4:green:debug3"; 58 label = "omap4:green:debug3";
59 gpios = <&gpio1 8 0>; /* 8 */ 59 gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; /* 8 */
60 }; 60 };
61 61
62 debug4 { 62 debug4 {
63 label = "omap4:green:debug4"; 63 label = "omap4:green:debug4";
64 gpios = <&gpio2 18 0>; /* 50 */ 64 gpios = <&gpio2 18 GPIO_ACTIVE_HIGH>; /* 50 */
65 }; 65 };
66 66
67 user1 { 67 user1 {
68 label = "omap4:blue:user"; 68 label = "omap4:blue:user";
69 gpios = <&gpio6 9 0>; /* 169 */ 69 gpios = <&gpio6 9 GPIO_ACTIVE_HIGH>; /* 169 */
70 }; 70 };
71 71
72 user2 { 72 user2 {
73 label = "omap4:red:user"; 73 label = "omap4:red:user";
74 gpios = <&gpio6 10 0>; /* 170 */ 74 gpios = <&gpio6 10 GPIO_ACTIVE_HIGH>; /* 170 */
75 }; 75 };
76 76
77 user3 { 77 user3 {
78 label = "omap4:green:user"; 78 label = "omap4:green:user";
79 gpios = <&gpio5 11 0>; /* 139 */ 79 gpios = <&gpio5 11 GPIO_ACTIVE_HIGH>; /* 139 */
80 }; 80 };
81 }; 81 };
82 82
@@ -142,9 +142,23 @@
142 }; 142 };
143}; 143};
144 144
145&omap4_pmx_wkup {
146 pinctrl-names = "default";
147 pinctrl-0 = <
148 &twl6030_wkup_pins
149 >;
150
151 twl6030_wkup_pins: pinmux_twl6030_wkup_pins {
152 pinctrl-single,pins = <
153 0x14 (PIN_OUTPUT | MUX_MODE2) /* fref_clk0_out.sys_drm_msecure */
154 >;
155 };
156};
157
145&omap4_pmx_core { 158&omap4_pmx_core {
146 pinctrl-names = "default"; 159 pinctrl-names = "default";
147 pinctrl-0 = < 160 pinctrl-0 = <
161 &twl6030_pins
148 &twl6040_pins 162 &twl6040_pins
149 &mcpdm_pins 163 &mcpdm_pins
150 &dmic_pins 164 &dmic_pins
@@ -156,123 +170,129 @@
156 170
157 uart2_pins: pinmux_uart2_pins { 171 uart2_pins: pinmux_uart2_pins {
158 pinctrl-single,pins = < 172 pinctrl-single,pins = <
159 0xd8 0x118 /* uart2_cts.uart2_cts INPUT_PULLUP | MODE0 */ 173 0xd8 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart2_cts.uart2_cts */
160 0xda 0 /* uart2_rts.uart2_rts OUTPUT | MODE0 */ 174 0xda (PIN_OUTPUT | MUX_MODE0) /* uart2_rts.uart2_rts */
161 0xdc 0x118 /* uart2_rx.uart2_rx INPUT_PULLUP | MODE0 */ 175 0xdc (PIN_INPUT_PULLUP | MUX_MODE0) /* uart2_rx.uart2_rx */
162 0xde 0 /* uart2_tx.uart2_tx OUTPUT | MODE0 */ 176 0xde (PIN_OUTPUT | MUX_MODE0) /* uart2_tx.uart2_tx */
163 >; 177 >;
164 }; 178 };
165 179
166 uart3_pins: pinmux_uart3_pins { 180 uart3_pins: pinmux_uart3_pins {
167 pinctrl-single,pins = < 181 pinctrl-single,pins = <
168 0x100 0x118 /* uart3_cts_rctx.uart3_cts_rctx INPUT_PULLUP | MODE0 */ 182 0x100 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart3_cts_rctx.uart3_cts_rctx */
169 0x102 0 /* uart3_rts_sd.uart3_rts_sd OUTPUT | MODE0 */ 183 0x102 (PIN_OUTPUT | MUX_MODE0) /* uart3_rts_sd.uart3_rts_sd */
170 0x104 0x100 /* uart3_rx_irrx.uart3_rx_irrx INPUT | MODE0 */ 184 0x104 (PIN_INPUT | MUX_MODE0) /* uart3_rx_irrx.uart3_rx_irrx */
171 0x106 0 /* uart3_tx_irtx.uart3_tx_irtx OUTPUT | MODE0 */ 185 0x106 (PIN_OUTPUT | MUX_MODE0) /* uart3_tx_irtx.uart3_tx_irtx */
172 >; 186 >;
173 }; 187 };
174 188
175 uart4_pins: pinmux_uart4_pins { 189 uart4_pins: pinmux_uart4_pins {
176 pinctrl-single,pins = < 190 pinctrl-single,pins = <
177 0x11c 0x100 /* uart4_rx.uart4_rx INPUT | MODE0 */ 191 0x11c (PIN_INPUT | MUX_MODE0) /* uart4_rx.uart4_rx */
178 0x11e 0 /* uart4_tx.uart4_tx OUTPUT | MODE0 */ 192 0x11e (PIN_OUTPUT | MUX_MODE0) /* uart4_tx.uart4_tx */
193 >;
194 };
195
196 twl6030_pins: pinmux_twl6030_pins {
197 pinctrl-single,pins = <
198 0x15e (WAKEUP_EN | PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1.sys_nirq1 */
179 >; 199 >;
180 }; 200 };
181 201
182 twl6040_pins: pinmux_twl6040_pins { 202 twl6040_pins: pinmux_twl6040_pins {
183 pinctrl-single,pins = < 203 pinctrl-single,pins = <
184 0xe0 0x3 /* hdq_sio.gpio_127 OUTPUT | MODE3 */ 204 0xe0 (PIN_OUTPUT | MUX_MODE3) /* hdq_sio.gpio_127 */
185 0x160 0x100 /* sys_nirq2.sys_nirq2 INPUT | MODE0 */ 205 0x160 (PIN_INPUT | MUX_MODE0) /* sys_nirq2.sys_nirq2 */
186 >; 206 >;
187 }; 207 };
188 208
189 mcpdm_pins: pinmux_mcpdm_pins { 209 mcpdm_pins: pinmux_mcpdm_pins {
190 pinctrl-single,pins = < 210 pinctrl-single,pins = <
191 0xc6 0x108 /* abe_pdm_ul_data.abe_pdm_ul_data INPUT PULLDOWN | MODE0 */ 211 0xc6 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_pdm_ul_data.abe_pdm_ul_data */
192 0xc8 0x108 /* abe_pdm_dl_data.abe_pdm_dl_data INPUT PULLDOWN | MODE0 */ 212 0xc8 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_pdm_dl_data.abe_pdm_dl_data */
193 0xca 0x118 /* abe_pdm_frame.abe_pdm_frame INPUT PULLUP | MODE0 */ 213 0xca (PIN_INPUT_PULLUP | MUX_MODE0) /* abe_pdm_frame.abe_pdm_frame */
194 0xcc 0x108 /* abe_pdm_lb_clk.abe_pdm_lb_clk INPUT PULLDOWN | MODE0 */ 214 0xcc (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_pdm_lb_clk.abe_pdm_lb_clk */
195 0xce 0x108 /* abe_clks.abe_clks INPUT PULLDOWN | MODE0 */ 215 0xce (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_clks.abe_clks */
196 >; 216 >;
197 }; 217 };
198 218
199 dmic_pins: pinmux_dmic_pins { 219 dmic_pins: pinmux_dmic_pins {
200 pinctrl-single,pins = < 220 pinctrl-single,pins = <
201 0xd0 0 /* abe_dmic_clk1.abe_dmic_clk1 OUTPUT | MODE0 */ 221 0xd0 (PIN_OUTPUT | MUX_MODE0) /* abe_dmic_clk1.abe_dmic_clk1 */
202 0xd2 0x100 /* abe_dmic_din1.abe_dmic_din1 INPUT | MODE0 */ 222 0xd2 (PIN_INPUT | MUX_MODE0) /* abe_dmic_din1.abe_dmic_din1 */
203 0xd4 0x100 /* abe_dmic_din2.abe_dmic_din2 INPUT | MODE0 */ 223 0xd4 (PIN_INPUT | MUX_MODE0) /* abe_dmic_din2.abe_dmic_din2 */
204 0xd6 0x100 /* abe_dmic_din3.abe_dmic_din3 INPUT | MODE0 */ 224 0xd6 (PIN_INPUT | MUX_MODE0) /* abe_dmic_din3.abe_dmic_din3 */
205 >; 225 >;
206 }; 226 };
207 227
208 mcbsp1_pins: pinmux_mcbsp1_pins { 228 mcbsp1_pins: pinmux_mcbsp1_pins {
209 pinctrl-single,pins = < 229 pinctrl-single,pins = <
210 0xbe 0x100 /* abe_mcbsp1_clkx.abe_mcbsp1_clkx INPUT | MODE0 */ 230 0xbe (PIN_INPUT | MUX_MODE0) /* abe_mcbsp1_clkx.abe_mcbsp1_clkx */
211 0xc0 0x108 /* abe_mcbsp1_dr.abe_mcbsp1_dr INPUT PULLDOWN | MODE0 */ 231 0xc0 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_mcbsp1_dr.abe_mcbsp1_dr */
212 0xc2 0x8 /* abe_mcbsp1_dx.abe_mcbsp1_dx OUTPUT PULLDOWN | MODE0 */ 232 0xc2 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* abe_mcbsp1_dx.abe_mcbsp1_dx */
213 0xc4 0x100 /* abe_mcbsp1_fsx.abe_mcbsp1_fsx INPUT | MODE0 */ 233 0xc4 (PIN_INPUT | MUX_MODE0) /* abe_mcbsp1_fsx.abe_mcbsp1_fsx */
214 >; 234 >;
215 }; 235 };
216 236
217 mcbsp2_pins: pinmux_mcbsp2_pins { 237 mcbsp2_pins: pinmux_mcbsp2_pins {
218 pinctrl-single,pins = < 238 pinctrl-single,pins = <
219 0xb6 0x100 /* abe_mcbsp2_clkx.abe_mcbsp2_clkx INPUT | MODE0 */ 239 0xb6 (PIN_INPUT | MUX_MODE0) /* abe_mcbsp2_clkx.abe_mcbsp2_clkx */
220 0xb8 0x108 /* abe_mcbsp2_dr.abe_mcbsp2_dr INPUT PULLDOWN | MODE0 */ 240 0xb8 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_mcbsp2_dr.abe_mcbsp2_dr */
221 0xba 0x8 /* abe_mcbsp2_dx.abe_mcbsp2_dx OUTPUT PULLDOWN | MODE0 */ 241 0xba (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* abe_mcbsp2_dx.abe_mcbsp2_dx */
222 0xbc 0x100 /* abe_mcbsp2_fsx.abe_mcbsp2_fsx INPUT | MODE0 */ 242 0xbc (PIN_INPUT | MUX_MODE0) /* abe_mcbsp2_fsx.abe_mcbsp2_fsx */
223 >; 243 >;
224 }; 244 };
225 245
226 mcspi1_pins: pinmux_mcspi1_pins { 246 mcspi1_pins: pinmux_mcspi1_pins {
227 pinctrl-single,pins = < 247 pinctrl-single,pins = <
228 0xf2 0x100 /* mcspi1_clk.mcspi1_clk INPUT | MODE0 */ 248 0xf2 (PIN_INPUT | MUX_MODE0) /* mcspi1_clk.mcspi1_clk */
229 0xf4 0x100 /* mcspi1_somi.mcspi1_somi INPUT | MODE0 */ 249 0xf4 (PIN_INPUT | MUX_MODE0) /* mcspi1_somi.mcspi1_somi */
230 0xf6 0x100 /* mcspi1_simo.mcspi1_simo INPUT | MODE0 */ 250 0xf6 (PIN_INPUT | MUX_MODE0) /* mcspi1_simo.mcspi1_simo */
231 0xf8 0x100 /* mcspi1_cs0.mcspi1_cs0 INPUT | MODE0*/ 251 0xf8 (PIN_INPUT | MUX_MODE0) /* mcspi1_cs0.mcspi1_cs0 */
232 >; 252 >;
233 }; 253 };
234 254
235 dss_hdmi_pins: pinmux_dss_hdmi_pins { 255 dss_hdmi_pins: pinmux_dss_hdmi_pins {
236 pinctrl-single,pins = < 256 pinctrl-single,pins = <
237 0x5a 0x118 /* hdmi_cec.hdmi_cec INPUT PULLUP | MODE 0 */ 257 0x5a (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_cec.hdmi_cec */
238 0x5c 0x118 /* hdmi_scl.hdmi_scl INPUT PULLUP | MODE 0 */ 258 0x5c (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_scl.hdmi_scl */
239 0x5e 0x118 /* hdmi_sda.hdmi_sda INPUT PULLUP | MODE 0 */ 259 0x5e (PIN_INPUT_PULLUP | MUX_MODE0) /* hdmi_sda.hdmi_sda */
240 >; 260 >;
241 }; 261 };
242 262
243 tpd12s015_pins: pinmux_tpd12s015_pins { 263 tpd12s015_pins: pinmux_tpd12s015_pins {
244 pinctrl-single,pins = < 264 pinctrl-single,pins = <
245 0x22 0x3 /* gpmc_a17.gpio_41 OUTPUT | MODE3 */ 265 0x22 (PIN_OUTPUT | MUX_MODE3) /* gpmc_a17.gpio_41 */
246 0x48 0x3 /* gpmc_nbe1.gpio_60 OUTPUT | MODE3 */ 266 0x48 (PIN_OUTPUT | MUX_MODE3) /* gpmc_nbe1.gpio_60 */
247 0x58 0x10b /* hdmi_hpd.gpio_63 INPUT PULLDOWN | MODE3 */ 267 0x58 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* hdmi_hpd.gpio_63 */
248 >; 268 >;
249 }; 269 };
250 270
251 i2c1_pins: pinmux_i2c1_pins { 271 i2c1_pins: pinmux_i2c1_pins {
252 pinctrl-single,pins = < 272 pinctrl-single,pins = <
253 0xe2 0x118 /* i2c1_scl PULLUP | INPUTENABLE | MODE0 */ 273 0xe2 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
254 0xe4 0x118 /* i2c1_sda PULLUP | INPUTENABLE | MODE0 */ 274 0xe4 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
255 >; 275 >;
256 }; 276 };
257 277
258 i2c2_pins: pinmux_i2c2_pins { 278 i2c2_pins: pinmux_i2c2_pins {
259 pinctrl-single,pins = < 279 pinctrl-single,pins = <
260 0xe6 0x118 /* i2c2_scl PULLUP | INPUTENABLE | MODE0 */ 280 0xe6 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_scl */
261 0xe8 0x118 /* i2c2_sda PULLUP | INPUTENABLE | MODE0 */ 281 0xe8 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c2_sda */
262 >; 282 >;
263 }; 283 };
264 284
265 i2c3_pins: pinmux_i2c3_pins { 285 i2c3_pins: pinmux_i2c3_pins {
266 pinctrl-single,pins = < 286 pinctrl-single,pins = <
267 0xea 0x118 /* i2c3_scl PULLUP | INPUTENABLE | MODE0 */ 287 0xea (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_scl */
268 0xec 0x118 /* i2c3_sda PULLUP | INPUTENABLE | MODE0 */ 288 0xec (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c3_sda */
269 >; 289 >;
270 }; 290 };
271 291
272 i2c4_pins: pinmux_i2c4_pins { 292 i2c4_pins: pinmux_i2c4_pins {
273 pinctrl-single,pins = < 293 pinctrl-single,pins = <
274 0xee 0x118 /* i2c4_scl PULLUP | INPUTENABLE | MODE0 */ 294 0xee (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_scl */
275 0xf0 0x118 /* i2c4_sda PULLUP | INPUTENABLE | MODE0 */ 295 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */
276 >; 296 >;
277 }; 297 };
278}; 298};
@@ -286,7 +306,7 @@
286 twl: twl@48 { 306 twl: twl@48 {
287 reg = <0x48>; 307 reg = <0x48>;
288 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ 308 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
289 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ 309 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
290 interrupt-parent = <&gic>; 310 interrupt-parent = <&gic>;
291 }; 311 };
292 312
@@ -294,7 +314,7 @@
294 compatible = "ti,twl6040"; 314 compatible = "ti,twl6040";
295 reg = <0x4b>; 315 reg = <0x4b>;
296 /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */ 316 /* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */
297 interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */ 317 interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_2N cascaded to gic */
298 interrupt-parent = <&gic>; 318 interrupt-parent = <&gic>;
299 ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */ 319 ti,audpwron-gpio = <&gpio4 31 0>; /* gpio line 127 */
300 320
@@ -316,7 +336,7 @@
316 }; 336 };
317}; 337};
318 338
319/include/ "twl6030.dtsi" 339#include "twl6030.dtsi"
320 340
321&i2c2 { 341&i2c2 {
322 pinctrl-names = "default"; 342 pinctrl-names = "default";
@@ -375,7 +395,7 @@
375 spi-max-frequency = <24000000>; 395 spi-max-frequency = <24000000>;
376 reg = <0>; 396 reg = <0>;
377 interrupt-parent = <&gpio2>; 397 interrupt-parent = <&gpio2>;
378 interrupts = <2 8>; /* gpio line 34, low triggered */ 398 interrupts = <2 IRQ_TYPE_LEVEL_LOW>; /* gpio line 34 */
379 vdd-supply = <&vdd_eth>; 399 vdd-supply = <&vdd_eth>;
380 }; 400 };
381}; 401};
diff --git a/arch/arm/boot/dts/omap4-var-som.dts b/arch/arm/boot/dts/omap4-var-som.dts
index 7e04103779c4..b41269e871dd 100644
--- a/arch/arm/boot/dts/omap4-var-som.dts
+++ b/arch/arm/boot/dts/omap4-var-som.dts
@@ -7,7 +7,7 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "omap443x.dtsi" 10#include "omap443x.dtsi"
11 11
12/ { 12/ {
13 model = "Variscite OMAP4 SOM"; 13 model = "Variscite OMAP4 SOM";
@@ -34,12 +34,12 @@
34 twl: twl@48 { 34 twl: twl@48 {
35 reg = <0x48>; 35 reg = <0x48>;
36 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */ 36 /* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
37 interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */ 37 interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
38 interrupt-parent = <&gic>; 38 interrupt-parent = <&gic>;
39 }; 39 };
40}; 40};
41 41
42/include/ "twl6030.dtsi" 42#include "twl6030.dtsi"
43 43
44&i2c2 { 44&i2c2 {
45 clock-frequency = <400000>; 45 clock-frequency = <400000>;
@@ -68,7 +68,7 @@
68 spi-max-frequency = <24000000>; 68 spi-max-frequency = <24000000>;
69 reg = <0>; 69 reg = <0>;
70 interrupt-parent = <&gpio6>; 70 interrupt-parent = <&gpio6>;
71 interrupts = <11 8>; /* gpio line 171, low triggered */ 71 interrupts = <11 IRQ_TYPE_LEVEL_LOW>; /* gpio line 171 */
72 vdd-supply = <&vdd_eth>; 72 vdd-supply = <&vdd_eth>;
73 }; 73 };
74}; 74};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 2a5642882c8a..22d9f2b593d4 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -6,15 +6,11 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9/* 9#include <dt-bindings/gpio/gpio.h>
10 * Carveout for multimedia usecases 10#include <dt-bindings/interrupt-controller/arm-gic.h>
11 * It should be the last 48MB of the first 512MB memory part 11#include <dt-bindings/pinctrl/omap.h>
12 * In theory, it should not even exist. That zone should be reserved
13 * dynamically during the .reserve callback.
14 */
15/memreserve/ 0x9d000000 0x03000000;
16 12
17/include/ "skeleton.dtsi" 13#include "skeleton.dtsi"
18 14
19/ { 15/ {
20 compatible = "ti,omap4430", "ti,omap4"; 16 compatible = "ti,omap4430", "ti,omap4";
@@ -28,13 +24,20 @@
28 }; 24 };
29 25
30 cpus { 26 cpus {
27 #address-cells = <1>;
28 #size-cells = <0>;
29
31 cpu@0 { 30 cpu@0 {
32 compatible = "arm,cortex-a9"; 31 compatible = "arm,cortex-a9";
32 device_type = "cpu";
33 next-level-cache = <&L2>; 33 next-level-cache = <&L2>;
34 reg = <0x0>;
34 }; 35 };
35 cpu@1 { 36 cpu@1 {
36 compatible = "arm,cortex-a9"; 37 compatible = "arm,cortex-a9";
38 device_type = "cpu";
37 next-level-cache = <&L2>; 39 next-level-cache = <&L2>;
40 reg = <0x1>;
38 }; 41 };
39 }; 42 };
40 43
@@ -56,7 +59,7 @@
56 local-timer@0x48240600 { 59 local-timer@0x48240600 {
57 compatible = "arm,cortex-a9-twd-timer"; 60 compatible = "arm,cortex-a9-twd-timer";
58 reg = <0x48240600 0x20>; 61 reg = <0x48240600 0x20>;
59 interrupts = <1 13 0x304>; 62 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_HIGH)>;
60 }; 63 };
61 64
62 /* 65 /*
@@ -97,8 +100,8 @@
97 reg = <0x44000000 0x1000>, 100 reg = <0x44000000 0x1000>,
98 <0x44800000 0x2000>, 101 <0x44800000 0x2000>,
99 <0x45000000 0x1000>; 102 <0x45000000 0x1000>;
100 interrupts = <0 9 0x4>, 103 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
101 <0 10 0x4>; 104 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
102 105
103 counter32k: counter@4a304000 { 106 counter32k: counter@4a304000 {
104 compatible = "ti,omap-counter32k"; 107 compatible = "ti,omap-counter32k";
@@ -126,10 +129,10 @@
126 sdma: dma-controller@4a056000 { 129 sdma: dma-controller@4a056000 {
127 compatible = "ti,omap4430-sdma"; 130 compatible = "ti,omap4430-sdma";
128 reg = <0x4a056000 0x1000>; 131 reg = <0x4a056000 0x1000>;
129 interrupts = <0 12 0x4>, 132 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
130 <0 13 0x4>, 133 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
131 <0 14 0x4>, 134 <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
132 <0 15 0x4>; 135 <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
133 #dma-cells = <1>; 136 #dma-cells = <1>;
134 #dma-channels = <32>; 137 #dma-channels = <32>;
135 #dma-requests = <127>; 138 #dma-requests = <127>;
@@ -138,7 +141,7 @@
138 gpio1: gpio@4a310000 { 141 gpio1: gpio@4a310000 {
139 compatible = "ti,omap4-gpio"; 142 compatible = "ti,omap4-gpio";
140 reg = <0x4a310000 0x200>; 143 reg = <0x4a310000 0x200>;
141 interrupts = <0 29 0x4>; 144 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
142 ti,hwmods = "gpio1"; 145 ti,hwmods = "gpio1";
143 ti,gpio-always-on; 146 ti,gpio-always-on;
144 gpio-controller; 147 gpio-controller;
@@ -150,7 +153,7 @@
150 gpio2: gpio@48055000 { 153 gpio2: gpio@48055000 {
151 compatible = "ti,omap4-gpio"; 154 compatible = "ti,omap4-gpio";
152 reg = <0x48055000 0x200>; 155 reg = <0x48055000 0x200>;
153 interrupts = <0 30 0x4>; 156 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
154 ti,hwmods = "gpio2"; 157 ti,hwmods = "gpio2";
155 gpio-controller; 158 gpio-controller;
156 #gpio-cells = <2>; 159 #gpio-cells = <2>;
@@ -161,7 +164,7 @@
161 gpio3: gpio@48057000 { 164 gpio3: gpio@48057000 {
162 compatible = "ti,omap4-gpio"; 165 compatible = "ti,omap4-gpio";
163 reg = <0x48057000 0x200>; 166 reg = <0x48057000 0x200>;
164 interrupts = <0 31 0x4>; 167 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
165 ti,hwmods = "gpio3"; 168 ti,hwmods = "gpio3";
166 gpio-controller; 169 gpio-controller;
167 #gpio-cells = <2>; 170 #gpio-cells = <2>;
@@ -172,7 +175,7 @@
172 gpio4: gpio@48059000 { 175 gpio4: gpio@48059000 {
173 compatible = "ti,omap4-gpio"; 176 compatible = "ti,omap4-gpio";
174 reg = <0x48059000 0x200>; 177 reg = <0x48059000 0x200>;
175 interrupts = <0 32 0x4>; 178 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
176 ti,hwmods = "gpio4"; 179 ti,hwmods = "gpio4";
177 gpio-controller; 180 gpio-controller;
178 #gpio-cells = <2>; 181 #gpio-cells = <2>;
@@ -183,7 +186,7 @@
183 gpio5: gpio@4805b000 { 186 gpio5: gpio@4805b000 {
184 compatible = "ti,omap4-gpio"; 187 compatible = "ti,omap4-gpio";
185 reg = <0x4805b000 0x200>; 188 reg = <0x4805b000 0x200>;
186 interrupts = <0 33 0x4>; 189 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
187 ti,hwmods = "gpio5"; 190 ti,hwmods = "gpio5";
188 gpio-controller; 191 gpio-controller;
189 #gpio-cells = <2>; 192 #gpio-cells = <2>;
@@ -194,7 +197,7 @@
194 gpio6: gpio@4805d000 { 197 gpio6: gpio@4805d000 {
195 compatible = "ti,omap4-gpio"; 198 compatible = "ti,omap4-gpio";
196 reg = <0x4805d000 0x200>; 199 reg = <0x4805d000 0x200>;
197 interrupts = <0 34 0x4>; 200 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
198 ti,hwmods = "gpio6"; 201 ti,hwmods = "gpio6";
199 gpio-controller; 202 gpio-controller;
200 #gpio-cells = <2>; 203 #gpio-cells = <2>;
@@ -207,7 +210,7 @@
207 reg = <0x50000000 0x1000>; 210 reg = <0x50000000 0x1000>;
208 #address-cells = <2>; 211 #address-cells = <2>;
209 #size-cells = <1>; 212 #size-cells = <1>;
210 interrupts = <0 20 0x4>; 213 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
211 gpmc,num-cs = <8>; 214 gpmc,num-cs = <8>;
212 gpmc,num-waitpins = <4>; 215 gpmc,num-waitpins = <4>;
213 ti,hwmods = "gpmc"; 216 ti,hwmods = "gpmc";
@@ -216,7 +219,7 @@
216 uart1: serial@4806a000 { 219 uart1: serial@4806a000 {
217 compatible = "ti,omap4-uart"; 220 compatible = "ti,omap4-uart";
218 reg = <0x4806a000 0x100>; 221 reg = <0x4806a000 0x100>;
219 interrupts = <0 72 0x4>; 222 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
220 ti,hwmods = "uart1"; 223 ti,hwmods = "uart1";
221 clock-frequency = <48000000>; 224 clock-frequency = <48000000>;
222 }; 225 };
@@ -224,7 +227,7 @@
224 uart2: serial@4806c000 { 227 uart2: serial@4806c000 {
225 compatible = "ti,omap4-uart"; 228 compatible = "ti,omap4-uart";
226 reg = <0x4806c000 0x100>; 229 reg = <0x4806c000 0x100>;
227 interrupts = <0 73 0x4>; 230 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
228 ti,hwmods = "uart2"; 231 ti,hwmods = "uart2";
229 clock-frequency = <48000000>; 232 clock-frequency = <48000000>;
230 }; 233 };
@@ -232,7 +235,7 @@
232 uart3: serial@48020000 { 235 uart3: serial@48020000 {
233 compatible = "ti,omap4-uart"; 236 compatible = "ti,omap4-uart";
234 reg = <0x48020000 0x100>; 237 reg = <0x48020000 0x100>;
235 interrupts = <0 74 0x4>; 238 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
236 ti,hwmods = "uart3"; 239 ti,hwmods = "uart3";
237 clock-frequency = <48000000>; 240 clock-frequency = <48000000>;
238 }; 241 };
@@ -240,7 +243,7 @@
240 uart4: serial@4806e000 { 243 uart4: serial@4806e000 {
241 compatible = "ti,omap4-uart"; 244 compatible = "ti,omap4-uart";
242 reg = <0x4806e000 0x100>; 245 reg = <0x4806e000 0x100>;
243 interrupts = <0 70 0x4>; 246 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
244 ti,hwmods = "uart4"; 247 ti,hwmods = "uart4";
245 clock-frequency = <48000000>; 248 clock-frequency = <48000000>;
246 }; 249 };
@@ -248,7 +251,7 @@
248 i2c1: i2c@48070000 { 251 i2c1: i2c@48070000 {
249 compatible = "ti,omap4-i2c"; 252 compatible = "ti,omap4-i2c";
250 reg = <0x48070000 0x100>; 253 reg = <0x48070000 0x100>;
251 interrupts = <0 56 0x4>; 254 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
252 #address-cells = <1>; 255 #address-cells = <1>;
253 #size-cells = <0>; 256 #size-cells = <0>;
254 ti,hwmods = "i2c1"; 257 ti,hwmods = "i2c1";
@@ -257,7 +260,7 @@
257 i2c2: i2c@48072000 { 260 i2c2: i2c@48072000 {
258 compatible = "ti,omap4-i2c"; 261 compatible = "ti,omap4-i2c";
259 reg = <0x48072000 0x100>; 262 reg = <0x48072000 0x100>;
260 interrupts = <0 57 0x4>; 263 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
261 #address-cells = <1>; 264 #address-cells = <1>;
262 #size-cells = <0>; 265 #size-cells = <0>;
263 ti,hwmods = "i2c2"; 266 ti,hwmods = "i2c2";
@@ -266,7 +269,7 @@
266 i2c3: i2c@48060000 { 269 i2c3: i2c@48060000 {
267 compatible = "ti,omap4-i2c"; 270 compatible = "ti,omap4-i2c";
268 reg = <0x48060000 0x100>; 271 reg = <0x48060000 0x100>;
269 interrupts = <0 61 0x4>; 272 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
270 #address-cells = <1>; 273 #address-cells = <1>;
271 #size-cells = <0>; 274 #size-cells = <0>;
272 ti,hwmods = "i2c3"; 275 ti,hwmods = "i2c3";
@@ -275,7 +278,7 @@
275 i2c4: i2c@48350000 { 278 i2c4: i2c@48350000 {
276 compatible = "ti,omap4-i2c"; 279 compatible = "ti,omap4-i2c";
277 reg = <0x48350000 0x100>; 280 reg = <0x48350000 0x100>;
278 interrupts = <0 62 0x4>; 281 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
279 #address-cells = <1>; 282 #address-cells = <1>;
280 #size-cells = <0>; 283 #size-cells = <0>;
281 ti,hwmods = "i2c4"; 284 ti,hwmods = "i2c4";
@@ -284,7 +287,7 @@
284 mcspi1: spi@48098000 { 287 mcspi1: spi@48098000 {
285 compatible = "ti,omap4-mcspi"; 288 compatible = "ti,omap4-mcspi";
286 reg = <0x48098000 0x200>; 289 reg = <0x48098000 0x200>;
287 interrupts = <0 65 0x4>; 290 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
288 #address-cells = <1>; 291 #address-cells = <1>;
289 #size-cells = <0>; 292 #size-cells = <0>;
290 ti,hwmods = "mcspi1"; 293 ti,hwmods = "mcspi1";
@@ -304,7 +307,7 @@
304 mcspi2: spi@4809a000 { 307 mcspi2: spi@4809a000 {
305 compatible = "ti,omap4-mcspi"; 308 compatible = "ti,omap4-mcspi";
306 reg = <0x4809a000 0x200>; 309 reg = <0x4809a000 0x200>;
307 interrupts = <0 66 0x4>; 310 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
308 #address-cells = <1>; 311 #address-cells = <1>;
309 #size-cells = <0>; 312 #size-cells = <0>;
310 ti,hwmods = "mcspi2"; 313 ti,hwmods = "mcspi2";
@@ -319,7 +322,7 @@
319 mcspi3: spi@480b8000 { 322 mcspi3: spi@480b8000 {
320 compatible = "ti,omap4-mcspi"; 323 compatible = "ti,omap4-mcspi";
321 reg = <0x480b8000 0x200>; 324 reg = <0x480b8000 0x200>;
322 interrupts = <0 91 0x4>; 325 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
323 #address-cells = <1>; 326 #address-cells = <1>;
324 #size-cells = <0>; 327 #size-cells = <0>;
325 ti,hwmods = "mcspi3"; 328 ti,hwmods = "mcspi3";
@@ -331,7 +334,7 @@
331 mcspi4: spi@480ba000 { 334 mcspi4: spi@480ba000 {
332 compatible = "ti,omap4-mcspi"; 335 compatible = "ti,omap4-mcspi";
333 reg = <0x480ba000 0x200>; 336 reg = <0x480ba000 0x200>;
334 interrupts = <0 48 0x4>; 337 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
335 #address-cells = <1>; 338 #address-cells = <1>;
336 #size-cells = <0>; 339 #size-cells = <0>;
337 ti,hwmods = "mcspi4"; 340 ti,hwmods = "mcspi4";
@@ -343,7 +346,7 @@
343 mmc1: mmc@4809c000 { 346 mmc1: mmc@4809c000 {
344 compatible = "ti,omap4-hsmmc"; 347 compatible = "ti,omap4-hsmmc";
345 reg = <0x4809c000 0x400>; 348 reg = <0x4809c000 0x400>;
346 interrupts = <0 83 0x4>; 349 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
347 ti,hwmods = "mmc1"; 350 ti,hwmods = "mmc1";
348 ti,dual-volt; 351 ti,dual-volt;
349 ti,needs-special-reset; 352 ti,needs-special-reset;
@@ -354,7 +357,7 @@
354 mmc2: mmc@480b4000 { 357 mmc2: mmc@480b4000 {
355 compatible = "ti,omap4-hsmmc"; 358 compatible = "ti,omap4-hsmmc";
356 reg = <0x480b4000 0x400>; 359 reg = <0x480b4000 0x400>;
357 interrupts = <0 86 0x4>; 360 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
358 ti,hwmods = "mmc2"; 361 ti,hwmods = "mmc2";
359 ti,needs-special-reset; 362 ti,needs-special-reset;
360 dmas = <&sdma 47>, <&sdma 48>; 363 dmas = <&sdma 47>, <&sdma 48>;
@@ -364,7 +367,7 @@
364 mmc3: mmc@480ad000 { 367 mmc3: mmc@480ad000 {
365 compatible = "ti,omap4-hsmmc"; 368 compatible = "ti,omap4-hsmmc";
366 reg = <0x480ad000 0x400>; 369 reg = <0x480ad000 0x400>;
367 interrupts = <0 94 0x4>; 370 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
368 ti,hwmods = "mmc3"; 371 ti,hwmods = "mmc3";
369 ti,needs-special-reset; 372 ti,needs-special-reset;
370 dmas = <&sdma 77>, <&sdma 78>; 373 dmas = <&sdma 77>, <&sdma 78>;
@@ -374,7 +377,7 @@
374 mmc4: mmc@480d1000 { 377 mmc4: mmc@480d1000 {
375 compatible = "ti,omap4-hsmmc"; 378 compatible = "ti,omap4-hsmmc";
376 reg = <0x480d1000 0x400>; 379 reg = <0x480d1000 0x400>;
377 interrupts = <0 96 0x4>; 380 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
378 ti,hwmods = "mmc4"; 381 ti,hwmods = "mmc4";
379 ti,needs-special-reset; 382 ti,needs-special-reset;
380 dmas = <&sdma 57>, <&sdma 58>; 383 dmas = <&sdma 57>, <&sdma 58>;
@@ -384,7 +387,7 @@
384 mmc5: mmc@480d5000 { 387 mmc5: mmc@480d5000 {
385 compatible = "ti,omap4-hsmmc"; 388 compatible = "ti,omap4-hsmmc";
386 reg = <0x480d5000 0x400>; 389 reg = <0x480d5000 0x400>;
387 interrupts = <0 59 0x4>; 390 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
388 ti,hwmods = "mmc5"; 391 ti,hwmods = "mmc5";
389 ti,needs-special-reset; 392 ti,needs-special-reset;
390 dmas = <&sdma 59>, <&sdma 60>; 393 dmas = <&sdma 59>, <&sdma 60>;
@@ -394,7 +397,7 @@
394 wdt2: wdt@4a314000 { 397 wdt2: wdt@4a314000 {
395 compatible = "ti,omap4-wdt", "ti,omap3-wdt"; 398 compatible = "ti,omap4-wdt", "ti,omap3-wdt";
396 reg = <0x4a314000 0x80>; 399 reg = <0x4a314000 0x80>;
397 interrupts = <0 80 0x4>; 400 interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
398 ti,hwmods = "wd_timer2"; 401 ti,hwmods = "wd_timer2";
399 }; 402 };
400 403
@@ -403,7 +406,7 @@
403 reg = <0x40132000 0x7f>, /* MPU private access */ 406 reg = <0x40132000 0x7f>, /* MPU private access */
404 <0x49032000 0x7f>; /* L3 Interconnect */ 407 <0x49032000 0x7f>; /* L3 Interconnect */
405 reg-names = "mpu", "dma"; 408 reg-names = "mpu", "dma";
406 interrupts = <0 112 0x4>; 409 interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
407 ti,hwmods = "mcpdm"; 410 ti,hwmods = "mcpdm";
408 dmas = <&sdma 65>, 411 dmas = <&sdma 65>,
409 <&sdma 66>; 412 <&sdma 66>;
@@ -415,7 +418,7 @@
415 reg = <0x4012e000 0x7f>, /* MPU private access */ 418 reg = <0x4012e000 0x7f>, /* MPU private access */
416 <0x4902e000 0x7f>; /* L3 Interconnect */ 419 <0x4902e000 0x7f>; /* L3 Interconnect */
417 reg-names = "mpu", "dma"; 420 reg-names = "mpu", "dma";
418 interrupts = <0 114 0x4>; 421 interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
419 ti,hwmods = "dmic"; 422 ti,hwmods = "dmic";
420 dmas = <&sdma 67>; 423 dmas = <&sdma 67>;
421 dma-names = "up_link"; 424 dma-names = "up_link";
@@ -426,7 +429,7 @@
426 reg = <0x40122000 0xff>, /* MPU private access */ 429 reg = <0x40122000 0xff>, /* MPU private access */
427 <0x49022000 0xff>; /* L3 Interconnect */ 430 <0x49022000 0xff>; /* L3 Interconnect */
428 reg-names = "mpu", "dma"; 431 reg-names = "mpu", "dma";
429 interrupts = <0 17 0x4>; 432 interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
430 interrupt-names = "common"; 433 interrupt-names = "common";
431 ti,buffer-size = <128>; 434 ti,buffer-size = <128>;
432 ti,hwmods = "mcbsp1"; 435 ti,hwmods = "mcbsp1";
@@ -440,7 +443,7 @@
440 reg = <0x40124000 0xff>, /* MPU private access */ 443 reg = <0x40124000 0xff>, /* MPU private access */
441 <0x49024000 0xff>; /* L3 Interconnect */ 444 <0x49024000 0xff>; /* L3 Interconnect */
442 reg-names = "mpu", "dma"; 445 reg-names = "mpu", "dma";
443 interrupts = <0 22 0x4>; 446 interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
444 interrupt-names = "common"; 447 interrupt-names = "common";
445 ti,buffer-size = <128>; 448 ti,buffer-size = <128>;
446 ti,hwmods = "mcbsp2"; 449 ti,hwmods = "mcbsp2";
@@ -454,7 +457,7 @@
454 reg = <0x40126000 0xff>, /* MPU private access */ 457 reg = <0x40126000 0xff>, /* MPU private access */
455 <0x49026000 0xff>; /* L3 Interconnect */ 458 <0x49026000 0xff>; /* L3 Interconnect */
456 reg-names = "mpu", "dma"; 459 reg-names = "mpu", "dma";
457 interrupts = <0 23 0x4>; 460 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
458 interrupt-names = "common"; 461 interrupt-names = "common";
459 ti,buffer-size = <128>; 462 ti,buffer-size = <128>;
460 ti,hwmods = "mcbsp3"; 463 ti,hwmods = "mcbsp3";
@@ -467,7 +470,7 @@
467 compatible = "ti,omap4-mcbsp"; 470 compatible = "ti,omap4-mcbsp";
468 reg = <0x48096000 0xff>; /* L4 Interconnect */ 471 reg = <0x48096000 0xff>; /* L4 Interconnect */
469 reg-names = "mpu"; 472 reg-names = "mpu";
470 interrupts = <0 16 0x4>; 473 interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
471 interrupt-names = "common"; 474 interrupt-names = "common";
472 ti,buffer-size = <128>; 475 ti,buffer-size = <128>;
473 ti,hwmods = "mcbsp4"; 476 ti,hwmods = "mcbsp4";
@@ -479,7 +482,7 @@
479 keypad: keypad@4a31c000 { 482 keypad: keypad@4a31c000 {
480 compatible = "ti,omap4-keypad"; 483 compatible = "ti,omap4-keypad";
481 reg = <0x4a31c000 0x80>; 484 reg = <0x4a31c000 0x80>;
482 interrupts = <0 120 0x4>; 485 interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
483 reg-names = "mpu"; 486 reg-names = "mpu";
484 ti,hwmods = "kbd"; 487 ti,hwmods = "kbd";
485 }; 488 };
@@ -487,7 +490,7 @@
487 emif1: emif@4c000000 { 490 emif1: emif@4c000000 {
488 compatible = "ti,emif-4d"; 491 compatible = "ti,emif-4d";
489 reg = <0x4c000000 0x100>; 492 reg = <0x4c000000 0x100>;
490 interrupts = <0 110 0x4>; 493 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
491 ti,hwmods = "emif1"; 494 ti,hwmods = "emif1";
492 phy-type = <1>; 495 phy-type = <1>;
493 hw-caps-read-idle-ctrl; 496 hw-caps-read-idle-ctrl;
@@ -498,7 +501,7 @@
498 emif2: emif@4d000000 { 501 emif2: emif@4d000000 {
499 compatible = "ti,emif-4d"; 502 compatible = "ti,emif-4d";
500 reg = <0x4d000000 0x100>; 503 reg = <0x4d000000 0x100>;
501 interrupts = <0 111 0x4>; 504 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
502 ti,hwmods = "emif2"; 505 ti,hwmods = "emif2";
503 phy-type = <1>; 506 phy-type = <1>;
504 hw-caps-read-idle-ctrl; 507 hw-caps-read-idle-ctrl;
@@ -523,7 +526,7 @@
523 timer1: timer@4a318000 { 526 timer1: timer@4a318000 {
524 compatible = "ti,omap3430-timer"; 527 compatible = "ti,omap3430-timer";
525 reg = <0x4a318000 0x80>; 528 reg = <0x4a318000 0x80>;
526 interrupts = <0 37 0x4>; 529 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
527 ti,hwmods = "timer1"; 530 ti,hwmods = "timer1";
528 ti,timer-alwon; 531 ti,timer-alwon;
529 }; 532 };
@@ -531,21 +534,21 @@
531 timer2: timer@48032000 { 534 timer2: timer@48032000 {
532 compatible = "ti,omap3430-timer"; 535 compatible = "ti,omap3430-timer";
533 reg = <0x48032000 0x80>; 536 reg = <0x48032000 0x80>;
534 interrupts = <0 38 0x4>; 537 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
535 ti,hwmods = "timer2"; 538 ti,hwmods = "timer2";
536 }; 539 };
537 540
538 timer3: timer@48034000 { 541 timer3: timer@48034000 {
539 compatible = "ti,omap4430-timer"; 542 compatible = "ti,omap4430-timer";
540 reg = <0x48034000 0x80>; 543 reg = <0x48034000 0x80>;
541 interrupts = <0 39 0x4>; 544 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
542 ti,hwmods = "timer3"; 545 ti,hwmods = "timer3";
543 }; 546 };
544 547
545 timer4: timer@48036000 { 548 timer4: timer@48036000 {
546 compatible = "ti,omap4430-timer"; 549 compatible = "ti,omap4430-timer";
547 reg = <0x48036000 0x80>; 550 reg = <0x48036000 0x80>;
548 interrupts = <0 40 0x4>; 551 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
549 ti,hwmods = "timer4"; 552 ti,hwmods = "timer4";
550 }; 553 };
551 554
@@ -553,7 +556,7 @@
553 compatible = "ti,omap4430-timer"; 556 compatible = "ti,omap4430-timer";
554 reg = <0x40138000 0x80>, 557 reg = <0x40138000 0x80>,
555 <0x49038000 0x80>; 558 <0x49038000 0x80>;
556 interrupts = <0 41 0x4>; 559 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
557 ti,hwmods = "timer5"; 560 ti,hwmods = "timer5";
558 ti,timer-dsp; 561 ti,timer-dsp;
559 }; 562 };
@@ -562,7 +565,7 @@
562 compatible = "ti,omap4430-timer"; 565 compatible = "ti,omap4430-timer";
563 reg = <0x4013a000 0x80>, 566 reg = <0x4013a000 0x80>,
564 <0x4903a000 0x80>; 567 <0x4903a000 0x80>;
565 interrupts = <0 42 0x4>; 568 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
566 ti,hwmods = "timer6"; 569 ti,hwmods = "timer6";
567 ti,timer-dsp; 570 ti,timer-dsp;
568 }; 571 };
@@ -571,7 +574,7 @@
571 compatible = "ti,omap4430-timer"; 574 compatible = "ti,omap4430-timer";
572 reg = <0x4013c000 0x80>, 575 reg = <0x4013c000 0x80>,
573 <0x4903c000 0x80>; 576 <0x4903c000 0x80>;
574 interrupts = <0 43 0x4>; 577 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
575 ti,hwmods = "timer7"; 578 ti,hwmods = "timer7";
576 ti,timer-dsp; 579 ti,timer-dsp;
577 }; 580 };
@@ -580,7 +583,7 @@
580 compatible = "ti,omap4430-timer"; 583 compatible = "ti,omap4430-timer";
581 reg = <0x4013e000 0x80>, 584 reg = <0x4013e000 0x80>,
582 <0x4903e000 0x80>; 585 <0x4903e000 0x80>;
583 interrupts = <0 44 0x4>; 586 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
584 ti,hwmods = "timer8"; 587 ti,hwmods = "timer8";
585 ti,timer-pwm; 588 ti,timer-pwm;
586 ti,timer-dsp; 589 ti,timer-dsp;
@@ -589,7 +592,7 @@
589 timer9: timer@4803e000 { 592 timer9: timer@4803e000 {
590 compatible = "ti,omap4430-timer"; 593 compatible = "ti,omap4430-timer";
591 reg = <0x4803e000 0x80>; 594 reg = <0x4803e000 0x80>;
592 interrupts = <0 45 0x4>; 595 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
593 ti,hwmods = "timer9"; 596 ti,hwmods = "timer9";
594 ti,timer-pwm; 597 ti,timer-pwm;
595 }; 598 };
@@ -597,7 +600,7 @@
597 timer10: timer@48086000 { 600 timer10: timer@48086000 {
598 compatible = "ti,omap3430-timer"; 601 compatible = "ti,omap3430-timer";
599 reg = <0x48086000 0x80>; 602 reg = <0x48086000 0x80>;
600 interrupts = <0 46 0x4>; 603 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
601 ti,hwmods = "timer10"; 604 ti,hwmods = "timer10";
602 ti,timer-pwm; 605 ti,timer-pwm;
603 }; 606 };
@@ -605,7 +608,7 @@
605 timer11: timer@48088000 { 608 timer11: timer@48088000 {
606 compatible = "ti,omap4430-timer"; 609 compatible = "ti,omap4430-timer";
607 reg = <0x48088000 0x80>; 610 reg = <0x48088000 0x80>;
608 interrupts = <0 47 0x4>; 611 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
609 ti,hwmods = "timer11"; 612 ti,hwmods = "timer11";
610 ti,timer-pwm; 613 ti,timer-pwm;
611 }; 614 };
@@ -613,7 +616,7 @@
613 usbhstll: usbhstll@4a062000 { 616 usbhstll: usbhstll@4a062000 {
614 compatible = "ti,usbhs-tll"; 617 compatible = "ti,usbhs-tll";
615 reg = <0x4a062000 0x1000>; 618 reg = <0x4a062000 0x1000>;
616 interrupts = <0 78 0x4>; 619 interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
617 ti,hwmods = "usb_tll_hs"; 620 ti,hwmods = "usb_tll_hs";
618 }; 621 };
619 622
@@ -629,14 +632,14 @@
629 compatible = "ti,ohci-omap3", "usb-ohci"; 632 compatible = "ti,ohci-omap3", "usb-ohci";
630 reg = <0x4a064800 0x400>; 633 reg = <0x4a064800 0x400>;
631 interrupt-parent = <&gic>; 634 interrupt-parent = <&gic>;
632 interrupts = <0 76 0x4>; 635 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
633 }; 636 };
634 637
635 usbhsehci: ehci@4a064c00 { 638 usbhsehci: ehci@4a064c00 {
636 compatible = "ti,ehci-omap", "usb-ehci"; 639 compatible = "ti,ehci-omap", "usb-ehci";
637 reg = <0x4a064c00 0x400>; 640 reg = <0x4a064c00 0x400>;
638 interrupt-parent = <&gic>; 641 interrupt-parent = <&gic>;
639 interrupts = <0 77 0x4>; 642 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
640 }; 643 };
641 }; 644 };
642 645
@@ -651,7 +654,7 @@
651 usb_otg_hs: usb_otg_hs@4a0ab000 { 654 usb_otg_hs: usb_otg_hs@4a0ab000 {
652 compatible = "ti,omap4-musb"; 655 compatible = "ti,omap4-musb";
653 reg = <0x4a0ab000 0x7ff>; 656 reg = <0x4a0ab000 0x7ff>;
654 interrupts = <0 92 0x4>, <0 93 0x4>; 657 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
655 interrupt-names = "mc", "dma"; 658 interrupt-names = "mc", "dma";
656 ti,hwmods = "usb_otg_hs"; 659 ti,hwmods = "usb_otg_hs";
657 usb-phy = <&usb2_phy>; 660 usb-phy = <&usb2_phy>;
diff --git a/arch/arm/boot/dts/omap443x.dtsi b/arch/arm/boot/dts/omap443x.dtsi
index cccf39af4925..bcf455efe18d 100644
--- a/arch/arm/boot/dts/omap443x.dtsi
+++ b/arch/arm/boot/dts/omap443x.dtsi
@@ -8,7 +8,7 @@
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 10
11/include/ "omap4.dtsi" 11#include "omap4.dtsi"
12 12
13/ { 13/ {
14 cpus { 14 cpus {
@@ -24,4 +24,10 @@
24 clock-latency = <300000>; /* From legacy driver */ 24 clock-latency = <300000>; /* From legacy driver */
25 }; 25 };
26 }; 26 };
27
28 bandgap {
29 reg = <0x4a002260 0x4
30 0x4a00232C 0x4>;
31 compatible = "ti,omap4430-bandgap";
32 };
27}; 33};
diff --git a/arch/arm/boot/dts/omap4460.dtsi b/arch/arm/boot/dts/omap4460.dtsi
index 2cf227c86099..c2f0f39b5a24 100644
--- a/arch/arm/boot/dts/omap4460.dtsi
+++ b/arch/arm/boot/dts/omap4460.dtsi
@@ -7,7 +7,7 @@
7 * version 2. This program is licensed "as is" without any warranty of any 7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10/include/ "omap4.dtsi" 10#include "omap4.dtsi"
11 11
12/ { 12/ {
13 cpus { 13 cpus {
@@ -25,8 +25,17 @@
25 25
26 pmu { 26 pmu {
27 compatible = "arm,cortex-a9-pmu"; 27 compatible = "arm,cortex-a9-pmu";
28 interrupts = <0 54 0x4>, 28 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
29 <0 55 0x4>; 29 <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
30 ti,hwmods = "debugss"; 30 ti,hwmods = "debugss";
31 }; 31 };
32
33 bandgap {
34 reg = <0x4a002260 0x4
35 0x4a00232C 0x4
36 0x4a002378 0x18>;
37 compatible = "ti,omap4460-bandgap";
38 interrupts = <0 126 IRQ_TYPE_LEVEL_HIGH>; /* talert */
39 gpios = <&gpio3 22 0>; /* tshut */
40 };
32}; 41};
diff --git a/arch/arm/boot/dts/omap5-evm.dts b/arch/arm/boot/dts/omap5-evm.dts
deleted file mode 100644
index 982acd19477d..000000000000
--- a/arch/arm/boot/dts/omap5-evm.dts
+++ /dev/null
@@ -1,261 +0,0 @@
1/*
2 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10/include/ "omap5.dtsi"
11/include/ "samsung_k3pe0e000b.dtsi"
12
13/ {
14 model = "TI OMAP5 EVM board";
15 compatible = "ti,omap5-evm", "ti,omap5";
16
17 memory {
18 device_type = "memory";
19 reg = <0x80000000 0x7F000000>; /* 2032 MB */
20 };
21
22 vmmcsd_fixed: fixedregulator-mmcsd {
23 compatible = "regulator-fixed";
24 regulator-name = "vmmcsd_fixed";
25 regulator-min-microvolt = <3000000>;
26 regulator-max-microvolt = <3000000>;
27 };
28
29};
30
31&omap5_pmx_core {
32 pinctrl-names = "default";
33 pinctrl-0 = <
34 &twl6040_pins
35 &mcpdm_pins
36 &dmic_pins
37 &mcbsp1_pins
38 &mcbsp2_pins
39 >;
40
41 twl6040_pins: pinmux_twl6040_pins {
42 pinctrl-single,pins = <
43 0x18a 0x6 /* perslimbus2_clock.gpio5_145 OUTPUT | MODE6 */
44 >;
45 };
46
47 mcpdm_pins: pinmux_mcpdm_pins {
48 pinctrl-single,pins = <
49 0x142 0x108 /* abe_clks.abe_clks INPUT PULLDOWN | MODE0 */
50 0x15c 0x108 /* abemcpdm_ul_data.abemcpdm_ul_data INPUT PULLDOWN | MODE0 */
51 0x15e 0x108 /* abemcpdm_dl_data.abemcpdm_dl_data INPUT PULLDOWN | MODE0 */
52 0x160 0x118 /* abemcpdm_frame.abemcpdm_frame INPUT PULLUP | MODE0 */
53 0x162 0x108 /* abemcpdm_lb_clk.abemcpdm_lb_clk INPUT PULLDOWN | MODE0 */
54 >;
55 };
56
57 dmic_pins: pinmux_dmic_pins {
58 pinctrl-single,pins = <
59 0x144 0x100 /* abedmic_din1.abedmic_din1 INPUT | MODE0 */
60 0x146 0x100 /* abedmic_din2.abedmic_din2 INPUT | MODE0 */
61 0x148 0x100 /* abedmic_din3.abedmic_din3 INPUT | MODE0 */
62 0x14a 0 /* abedmic_clk1.abedmic_clk1 OUTPUT | MODE0 */
63 >;
64 };
65
66 mcbsp1_pins: pinmux_mcbsp1_pins {
67 pinctrl-single,pins = <
68 0x14c 0x101 /* abedmic_clk2.abemcbsp1_fsx INPUT | MODE1 */
69 0x14e 0x9 /* abedmic_clk3.abemcbsp1_dx OUTPUT PULLDOWN | MODE1 */
70 0x150 0x101 /* abeslimbus1_clock.abemcbsp1_clkx INPUT | MODE0 */
71 0x152 0x109 /* abeslimbus1_data.abemcbsp1_dr INPUT PULLDOWN | MODE1 */
72 >;
73 };
74
75 mcbsp2_pins: pinmux_mcbsp2_pins {
76 pinctrl-single,pins = <
77 0x154 0x108 /* abemcbsp2_dr.abemcbsp2_dr INPUT PULLDOWN | MODE0 */
78 0x156 0x8 /* abemcbsp2_dx.abemcbsp2_dx OUTPUT PULLDOWN | MODE0 */
79 0x158 0x100 /* abemcbsp2_fsx.abemcbsp2_fsx INPUT | MODE0 */
80 0x15a 0x100 /* abemcbsp2_clkx.abemcbsp2_clkx INPUT | MODE0 */
81 >;
82 };
83
84 i2c1_pins: pinmux_i2c1_pins {
85 pinctrl-single,pins = <
86 0x1b2 0x118 /* i2c1_scl PULLUP | INPUTENABLE | MODE0 */
87 0x1b4 0x118 /* i2c1_sda PULLUP | INPUTENABLE | MODE0 */
88 >;
89 };
90
91 i2c2_pins: pinmux_i2c2_pins {
92 pinctrl-single,pins = <
93 0x178 0x100 /* i2c2_scl INPUTENABLE | MODE0 */
94 0x17a 0x100 /* i2c2_sda INPUTENABLE | MODE0 */
95 >;
96 };
97
98 i2c3_pins: pinmux_i2c3_pins {
99 pinctrl-single,pins = <
100 0x13a 0x100 /* i2c3_scl INPUTENABLE | MODE0 */
101 0x13c 0x100 /* i2c3_sda INPUTENABLE | MODE0 */
102 >;
103 };
104
105 i2c4_pins: pinmux_i2c4_pins {
106 pinctrl-single,pins = <
107 0xb8 0x100 /* i2c4_scl INPUTENABLE | MODE0 */
108 0xba 0x100 /* i2c4_sda INPUTENABLE | MODE0 */
109 >;
110 };
111
112 i2c5_pins: pinmux_i2c5_pins {
113 pinctrl-single,pins = <
114 0x184 0x100 /* i2c5_scl INPUTENABLE | MODE0 */
115 0x186 0x100 /* i2c5_sda INPUTENABLE | MODE0 */
116 >;
117 };
118
119 mcspi2_pins: pinmux_mcspi2_pins {
120 pinctrl-single,pins = <
121 0xbc 0x100 /* MCSPI2_CLK INPUTENABLE | MODE0 */
122 0xbe 0x100 /* MCSPI2_SIMO INPUTENABLE | MODE0 */
123 0xc0 0x118 /* MCSPI2_SOMI PULLUP | INPUTENABLE | MODE0*/
124 0xc2 0x0 /* MCSPI2_CS MODE0*/
125 >;
126 };
127
128 mcspi3_pins: pinmux_mcspi3_pins {
129 pinctrl-single,pins = <
130 0x78 0x101 /* MCSPI2_SOMI INPUTENABLE | MODE1 */
131 0x7a 0x101 /* MCSPI2_CS INPUTENABLE | MODE1 */
132 0x7c 0x101 /* MCSPI2_SIMO INPUTENABLE | MODE1 */
133 0x7e 0x101 /* MCSPI2_CLK INPUTENABLE | MODE1 */
134 >;
135 };
136
137 mcspi4_pins: pinmux_mcspi4_pins {
138 pinctrl-single,pins = <
139 0x164 0x101 /* MCSPI2_CLK INPUTENABLE | MODE1 */
140 0x168 0x101 /* MCSPI2_SIMO INPUTENABLE | MODE1 */
141 0x16a 0x101 /* MCSPI2_SOMI INPUTENABLE | MODE1 */
142 0x16c 0x101 /* MCSPI2_CS INPUTENABLE | MODE1 */
143 >;
144 };
145};
146
147&mmc1 {
148 vmmc-supply = <&vmmcsd_fixed>;
149 bus-width = <4>;
150};
151
152&mmc2 {
153 vmmc-supply = <&vmmcsd_fixed>;
154 bus-width = <8>;
155 ti,non-removable;
156};
157
158&mmc3 {
159 bus-width = <4>;
160 ti,non-removable;
161};
162
163&mmc4 {
164 status = "disabled";
165};
166
167&mmc5 {
168 status = "disabled";
169};
170
171&i2c1 {
172 pinctrl-names = "default";
173 pinctrl-0 = <&i2c1_pins>;
174
175 clock-frequency = <400000>;
176};
177
178&i2c2 {
179 pinctrl-names = "default";
180 pinctrl-0 = <&i2c2_pins>;
181
182 clock-frequency = <400000>;
183
184 /* Pressure Sensor */
185 bmp085@77 {
186 compatible = "bosch,bmp085";
187 reg = <0x77>;
188 };
189};
190
191&i2c3 {
192 pinctrl-names = "default";
193 pinctrl-0 = <&i2c3_pins>;
194
195 clock-frequency = <400000>;
196};
197
198&i2c4 {
199 pinctrl-names = "default";
200 pinctrl-0 = <&i2c4_pins>;
201
202 clock-frequency = <400000>;
203
204 /* Temperature Sensor */
205 tmp102@48{
206 compatible = "ti,tmp102";
207 reg = <0x48>;
208 };
209};
210
211&i2c5 {
212 pinctrl-names = "default";
213 pinctrl-0 = <&i2c5_pins>;
214
215 clock-frequency = <400000>;
216};
217
218&keypad {
219 keypad,num-rows = <8>;
220 keypad,num-columns = <8>;
221 linux,keymap = <0x02020073 /* VOLUP */
222 0x02030072 /* VOLDOWM */
223 0x020400e7 /* SEND */
224 0x02050066 /* HOME */
225 0x0206006b /* END */
226 0x020700d9>; /* SEARCH */
227 linux,input-no-autorepeat;
228};
229
230&mcbsp3 {
231 status = "disabled";
232};
233
234&emif1 {
235 cs1-used;
236 device-handle = <&samsung_K3PE0E000B>;
237};
238
239&emif2 {
240 cs1-used;
241 device-handle = <&samsung_K3PE0E000B>;
242};
243
244&mcspi1 {
245
246};
247
248&mcspi2 {
249 pinctrl-names = "default";
250 pinctrl-0 = <&mcspi2_pins>;
251};
252
253&mcspi3 {
254 pinctrl-names = "default";
255 pinctrl-0 = <&mcspi3_pins>;
256};
257
258&mcspi4 {
259 pinctrl-names = "default";
260 pinctrl-0 = <&mcspi4_pins>;
261};
diff --git a/arch/arm/boot/dts/omap5-uevm.dts b/arch/arm/boot/dts/omap5-uevm.dts
new file mode 100644
index 000000000000..08b72678abff
--- /dev/null
+++ b/arch/arm/boot/dts/omap5-uevm.dts
@@ -0,0 +1,485 @@
1/*
2 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10#include "omap5.dtsi"
11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13
14/ {
15 model = "TI OMAP5 uEVM board";
16 compatible = "ti,omap5-uevm", "ti,omap5";
17
18 memory {
19 device_type = "memory";
20 reg = <0x80000000 0x7F000000>; /* 2032 MB */
21 };
22
23 vmmcsd_fixed: fixedregulator-mmcsd {
24 compatible = "regulator-fixed";
25 regulator-name = "vmmcsd_fixed";
26 regulator-min-microvolt = <3000000>;
27 regulator-max-microvolt = <3000000>;
28 };
29
30 /* HS USB Port 2 RESET */
31 hsusb2_reset: hsusb2_reset_reg {
32 compatible = "regulator-fixed";
33 regulator-name = "hsusb2_reset";
34 regulator-min-microvolt = <3300000>;
35 regulator-max-microvolt = <3300000>;
36 gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>; /* gpio3_80 HUB_NRESET */
37 startup-delay-us = <70000>;
38 enable-active-high;
39 };
40
41 /* HS USB Host PHY on PORT 2 */
42 hsusb2_phy: hsusb2_phy {
43 compatible = "usb-nop-xceiv";
44 reset-supply = <&hsusb2_reset>;
45 /**
46 * FIXME
47 * Put the right clock phandle here when available
48 * clocks = <&auxclk1>;
49 * clock-names = "main_clk";
50 */
51 clock-frequency = <19200000>;
52 };
53
54 /* HS USB Port 3 RESET */
55 hsusb3_reset: hsusb3_reset_reg {
56 compatible = "regulator-fixed";
57 regulator-name = "hsusb3_reset";
58 regulator-min-microvolt = <3300000>;
59 regulator-max-microvolt = <3300000>;
60 gpio = <&gpio3 15 GPIO_ACTIVE_HIGH>; /* gpio3_79 ETH_NRESET */
61 startup-delay-us = <70000>;
62 enable-active-high;
63 };
64
65 /* HS USB Host PHY on PORT 3 */
66 hsusb3_phy: hsusb3_phy {
67 compatible = "usb-nop-xceiv";
68 reset-supply = <&hsusb3_reset>;
69 };
70
71 leds {
72 compatible = "gpio-leds";
73 led@1 {
74 label = "omap5:blue:usr1";
75 gpios = <&gpio5 25 GPIO_ACTIVE_HIGH>; /* gpio5_153 D1 LED */
76 linux,default-trigger = "heartbeat";
77 default-state = "off";
78 };
79 };
80};
81
82&omap5_pmx_core {
83 pinctrl-names = "default";
84 pinctrl-0 = <
85 &twl6040_pins
86 &mcpdm_pins
87 &dmic_pins
88 &mcbsp1_pins
89 &mcbsp2_pins
90 &usbhost_pins
91 &led_gpio_pins
92 >;
93
94 twl6040_pins: pinmux_twl6040_pins {
95 pinctrl-single,pins = <
96 0x18a (PIN_OUTPUT | MUX_MODE6) /* perslimbus2_clock.gpio5_145 */
97 >;
98 };
99
100 mcpdm_pins: pinmux_mcpdm_pins {
101 pinctrl-single,pins = <
102 0x142 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abe_clks.abe_clks */
103 0x15c (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abemcpdm_ul_data.abemcpdm_ul_data */
104 0x15e (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abemcpdm_dl_data.abemcpdm_dl_data */
105 0x160 (PIN_INPUT_PULLUP | MUX_MODE0) /* abemcpdm_frame.abemcpdm_frame */
106 0x162 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abemcpdm_lb_clk.abemcpdm_lb_clk */
107 >;
108 };
109
110 dmic_pins: pinmux_dmic_pins {
111 pinctrl-single,pins = <
112 0x144 (PIN_INPUT | MUX_MODE0) /* abedmic_din1.abedmic_din1 */
113 0x146 (PIN_INPUT | MUX_MODE0) /* abedmic_din2.abedmic_din2 */
114 0x148 (PIN_INPUT | MUX_MODE0) /* abedmic_din3.abedmic_din3 */
115 0x14a (PIN_OUTPUT | MUX_MODE0) /* abedmic_clk1.abedmic_clk1 */
116 >;
117 };
118
119 mcbsp1_pins: pinmux_mcbsp1_pins {
120 pinctrl-single,pins = <
121 0x14c (PIN_INPUT | MUX_MODE1) /* abedmic_clk2.abemcbsp1_fsx */
122 0x14e (PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* abedmic_clk3.abemcbsp1_dx */
123 0x150 (PIN_INPUT | MUX_MODE1) /* abeslimbus1_clock.abemcbsp1_clkx */
124 0x152 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* abeslimbus1_data.abemcbsp1_dr */
125 >;
126 };
127
128 mcbsp2_pins: pinmux_mcbsp2_pins {
129 pinctrl-single,pins = <
130 0x154 (PIN_INPUT_PULLDOWN | MUX_MODE0) /* abemcbsp2_dr.abemcbsp2_dr */
131 0x156 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* abemcbsp2_dx.abemcbsp2_dx */
132 0x158 (PIN_INPUT | MUX_MODE0) /* abemcbsp2_fsx.abemcbsp2_fsx */
133 0x15a (PIN_INPUT | MUX_MODE0) /* abemcbsp2_clkx.abemcbsp2_clkx */
134 >;
135 };
136
137 i2c1_pins: pinmux_i2c1_pins {
138 pinctrl-single,pins = <
139 0x1b2 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_scl */
140 0x1b4 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c1_sda */
141 >;
142 };
143
144 i2c5_pins: pinmux_i2c5_pins {
145 pinctrl-single,pins = <
146 0x184 (PIN_INPUT | MUX_MODE0) /* i2c5_scl */
147 0x186 (PIN_INPUT | MUX_MODE0) /* i2c5_sda */
148 >;
149 };
150
151 mcspi2_pins: pinmux_mcspi2_pins {
152 pinctrl-single,pins = <
153 0xbc (PIN_INPUT | MUX_MODE0) /* mcspi2_clk */
154 0xbe (PIN_INPUT | MUX_MODE0) /* mcspi2_simo */
155 0xc0 (PIN_INPUT_PULLUP | MUX_MODE0) /* mcspi2_somi */
156 0xc2 (PIN_OUTPUT | MUX_MODE0) /* mcspi2_cs */
157 >;
158 };
159
160 mcspi3_pins: pinmux_mcspi3_pins {
161 pinctrl-single,pins = <
162 0x78 (PIN_INPUT | MUX_MODE1) /* mcspi2_somi */
163 0x7a (PIN_INPUT | MUX_MODE1) /* mcspi2_cs */
164 0x7c (PIN_INPUT | MUX_MODE1) /* mcspi2_simo */
165 0x7e (PIN_INPUT | MUX_MODE1) /* mcspi2_clk */
166 >;
167 };
168
169 mcspi4_pins: pinmux_mcspi4_pins {
170 pinctrl-single,pins = <
171 0x164 (PIN_INPUT | MUX_MODE1) /* mcspi2_clk */
172 0x168 (PIN_INPUT | MUX_MODE1) /* mcspi2_simo */
173 0x16a (PIN_INPUT | MUX_MODE1) /* mcspi2_somi */
174 0x16c (PIN_INPUT | MUX_MODE1) /* mcspi2_cs */
175 >;
176 };
177
178 usbhost_pins: pinmux_usbhost_pins {
179 pinctrl-single,pins = <
180 0x84 (PIN_INPUT | MUX_MODE0) /* usbb2_hsic_strobe */
181 0x86 (PIN_INPUT | MUX_MODE0) /* usbb2_hsic_data */
182
183 0x19e (PIN_INPUT | MUX_MODE0) /* usbb3_hsic_strobe */
184 0x1a0 (PIN_INPUT | MUX_MODE0) /* usbb3_hsic_data */
185
186 0x70 (PIN_OUTPUT | MUX_MODE6) /* gpio3_80 HUB_NRESET */
187 0x6e (PIN_OUTPUT | MUX_MODE6) /* gpio3_79 ETH_NRESET */
188 >;
189 };
190
191 led_gpio_pins: pinmux_led_gpio_pins {
192 pinctrl-single,pins = <
193 0x196 (PIN_OUTPUT | MUX_MODE6) /* uart3_cts_rctx.gpio5_153 */
194 >;
195 };
196
197 uart1_pins: pinmux_uart1_pins {
198 pinctrl-single,pins = <
199 0x60 (PIN_OUTPUT | MUX_MODE0) /* uart1_tx.uart1_cts */
200 0x62 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_tx.uart1_cts */
201 0x64 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart1_rx.uart1_rts */
202 0x66 (PIN_OUTPUT | MUX_MODE0) /* uart1_rx.uart1_rts */
203 >;
204 };
205
206 uart3_pins: pinmux_uart3_pins {
207 pinctrl-single,pins = <
208 0x19a (PIN_OUTPUT | MUX_MODE0) /* uart3_rts_irsd.uart3_tx_irtx */
209 0x19c (PIN_INPUT_PULLUP | MUX_MODE0) /* uart3_rx_irrx.uart3_usbb3_hsic */
210 >;
211 };
212
213 uart5_pins: pinmux_uart5_pins {
214 pinctrl-single,pins = <
215 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart5_rx.uart5_rx */
216 0x172 (PIN_OUTPUT | MUX_MODE0) /* uart5_tx.uart5_tx */
217 0x174 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart5_cts.uart5_rts */
218 0x176 (PIN_OUTPUT | MUX_MODE0) /* uart5_cts.uart5_rts */
219 >;
220 };
221
222};
223
224&omap5_pmx_wkup {
225 pinctrl-names = "default";
226 pinctrl-0 = <
227 &usbhost_wkup_pins
228 >;
229
230 usbhost_wkup_pins: pinmux_usbhost_wkup_pins {
231 pinctrl-single,pins = <
232 0x1A (PIN_OUTPUT | MUX_MODE0) /* fref_clk1_out, USB hub clk */
233 >;
234 };
235};
236
237&mmc1 {
238 vmmc-supply = <&vmmcsd_fixed>;
239 bus-width = <4>;
240};
241
242&mmc2 {
243 vmmc-supply = <&vmmcsd_fixed>;
244 bus-width = <8>;
245 ti,non-removable;
246};
247
248&mmc3 {
249 bus-width = <4>;
250 ti,non-removable;
251};
252
253&mmc4 {
254 status = "disabled";
255};
256
257&mmc5 {
258 status = "disabled";
259};
260
261&i2c1 {
262 pinctrl-names = "default";
263 pinctrl-0 = <&i2c1_pins>;
264
265 clock-frequency = <400000>;
266
267 palmas: palmas@48 {
268 compatible = "ti,palmas";
269 interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */
270 interrupt-parent = <&gic>;
271 reg = <0x48>;
272 interrupt-controller;
273 #interrupt-cells = <2>;
274
275 palmas_pmic {
276 compatible = "ti,palmas-pmic";
277 interrupt-parent = <&palmas>;
278 interrupts = <14 IRQ_TYPE_NONE>;
279 interrupt-name = "short-irq";
280
281 ti,ldo6-vibrator;
282
283 regulators {
284 smps123_reg: smps123 {
285 regulator-name = "smps123";
286 regulator-min-microvolt = < 600000>;
287 regulator-max-microvolt = <1500000>;
288 regulator-always-on;
289 regulator-boot-on;
290 };
291
292 smps45_reg: smps45 {
293 regulator-name = "smps45";
294 regulator-min-microvolt = < 600000>;
295 regulator-max-microvolt = <1310000>;
296 regulator-always-on;
297 regulator-boot-on;
298 };
299
300 smps6_reg: smps6 {
301 regulator-name = "smps6";
302 regulator-min-microvolt = <1200000>;
303 regulator-max-microvolt = <1200000>;
304 regulator-always-on;
305 regulator-boot-on;
306 };
307
308 smps7_reg: smps7 {
309 regulator-name = "smps7";
310 regulator-min-microvolt = <1800000>;
311 regulator-max-microvolt = <1800000>;
312 regulator-always-on;
313 regulator-boot-on;
314 };
315
316 smps8_reg: smps8 {
317 regulator-name = "smps8";
318 regulator-min-microvolt = < 600000>;
319 regulator-max-microvolt = <1310000>;
320 regulator-always-on;
321 regulator-boot-on;
322 };
323
324 smps9_reg: smps9 {
325 regulator-name = "smps9";
326 regulator-min-microvolt = <2100000>;
327 regulator-max-microvolt = <2100000>;
328 regulator-always-on;
329 regulator-boot-on;
330 ti,smps-range = <0x80>;
331 };
332
333 smps10_reg: smps10 {
334 regulator-name = "smps10";
335 regulator-min-microvolt = <5000000>;
336 regulator-max-microvolt = <5000000>;
337 regulator-always-on;
338 regulator-boot-on;
339 };
340
341 ldo1_reg: ldo1 {
342 regulator-name = "ldo1";
343 regulator-min-microvolt = <2800000>;
344 regulator-max-microvolt = <2800000>;
345 regulator-always-on;
346 regulator-boot-on;
347 };
348
349 ldo2_reg: ldo2 {
350 regulator-name = "ldo2";
351 regulator-min-microvolt = <2900000>;
352 regulator-max-microvolt = <2900000>;
353 regulator-always-on;
354 regulator-boot-on;
355 };
356
357 ldo3_reg: ldo3 {
358 regulator-name = "ldo3";
359 regulator-min-microvolt = <3000000>;
360 regulator-max-microvolt = <3000000>;
361 regulator-always-on;
362 regulator-boot-on;
363 };
364
365 ldo4_reg: ldo4 {
366 regulator-name = "ldo4";
367 regulator-min-microvolt = <2200000>;
368 regulator-max-microvolt = <2200000>;
369 regulator-always-on;
370 regulator-boot-on;
371 };
372
373 ldo5_reg: ldo5 {
374 regulator-name = "ldo5";
375 regulator-min-microvolt = <1800000>;
376 regulator-max-microvolt = <1800000>;
377 regulator-always-on;
378 regulator-boot-on;
379 };
380
381 ldo6_reg: ldo6 {
382 regulator-name = "ldo6";
383 regulator-min-microvolt = <1500000>;
384 regulator-max-microvolt = <1500000>;
385 regulator-always-on;
386 regulator-boot-on;
387 };
388
389 ldo7_reg: ldo7 {
390 regulator-name = "ldo7";
391 regulator-min-microvolt = <1500000>;
392 regulator-max-microvolt = <1500000>;
393 regulator-always-on;
394 regulator-boot-on;
395 };
396
397 ldo8_reg: ldo8 {
398 regulator-name = "ldo8";
399 regulator-min-microvolt = <1500000>;
400 regulator-max-microvolt = <1500000>;
401 regulator-always-on;
402 regulator-boot-on;
403 };
404
405 ldo9_reg: ldo9 {
406 regulator-name = "ldo9";
407 regulator-min-microvolt = <1800000>;
408 regulator-max-microvolt = <3300000>;
409 regulator-always-on;
410 regulator-boot-on;
411 };
412
413 ldoln_reg: ldoln {
414 regulator-name = "ldoln";
415 regulator-min-microvolt = <1800000>;
416 regulator-max-microvolt = <1800000>;
417 regulator-always-on;
418 regulator-boot-on;
419 };
420
421 ldousb_reg: ldousb {
422 regulator-name = "ldousb";
423 regulator-min-microvolt = <3250000>;
424 regulator-max-microvolt = <3250000>;
425 regulator-always-on;
426 regulator-boot-on;
427 };
428 };
429 };
430 };
431};
432
433&i2c5 {
434 pinctrl-names = "default";
435 pinctrl-0 = <&i2c5_pins>;
436
437 clock-frequency = <400000>;
438};
439
440&mcbsp3 {
441 status = "disabled";
442};
443
444&usbhshost {
445 port2-mode = "ehci-hsic";
446 port3-mode = "ehci-hsic";
447};
448
449&usbhsehci {
450 phys = <0 &hsusb2_phy &hsusb3_phy>;
451};
452
453&mcspi1 {
454
455};
456
457&mcspi2 {
458 pinctrl-names = "default";
459 pinctrl-0 = <&mcspi2_pins>;
460};
461
462&mcspi3 {
463 pinctrl-names = "default";
464 pinctrl-0 = <&mcspi3_pins>;
465};
466
467&mcspi4 {
468 pinctrl-names = "default";
469 pinctrl-0 = <&mcspi4_pins>;
470};
471
472&uart1 {
473 pinctrl-names = "default";
474 pinctrl-0 = <&uart1_pins>;
475};
476
477&uart3 {
478 pinctrl-names = "default";
479 pinctrl-0 = <&uart3_pins>;
480};
481
482&uart5 {
483 pinctrl-names = "default";
484 pinctrl-0 = <&uart5_pins>;
485};
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 3dd7ff825828..e643620417a9 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -7,15 +7,11 @@
7 * Based on "omap4.dtsi" 7 * Based on "omap4.dtsi"
8 */ 8 */
9 9
10/* 10#include <dt-bindings/gpio/gpio.h>
11 * Carveout for multimedia usecases 11#include <dt-bindings/interrupt-controller/arm-gic.h>
12 * It should be the last 48MB of the first 512MB memory part 12#include <dt-bindings/pinctrl/omap.h>
13 * In theory, it should not even exist. That zone should be reserved
14 * dynamically during the .reserve callback.
15 */
16/memreserve/ 0x9d000000 0x03000000;
17 13
18/include/ "skeleton.dtsi" 14#include "skeleton.dtsi"
19 15
20/ { 16/ {
21 #address-cells = <1>; 17 #address-cells = <1>;
@@ -34,21 +30,28 @@
34 }; 30 };
35 31
36 cpus { 32 cpus {
33 #address-cells = <1>;
34 #size-cells = <0>;
35
37 cpu@0 { 36 cpu@0 {
37 device_type = "cpu";
38 compatible = "arm,cortex-a15"; 38 compatible = "arm,cortex-a15";
39 reg = <0x0>;
39 }; 40 };
40 cpu@1 { 41 cpu@1 {
42 device_type = "cpu";
41 compatible = "arm,cortex-a15"; 43 compatible = "arm,cortex-a15";
44 reg = <0x1>;
42 }; 45 };
43 }; 46 };
44 47
45 timer { 48 timer {
46 compatible = "arm,armv7-timer"; 49 compatible = "arm,armv7-timer";
47 /* PPI secure/nonsecure IRQ, active low level-sensitive */ 50 /* PPI secure/nonsecure IRQ */
48 interrupts = <1 13 0x308>, 51 interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>,
49 <1 14 0x308>, 52 <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>,
50 <1 11 0x308>, 53 <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>,
51 <1 10 0x308>; 54 <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>;
52 clock-frequency = <6144000>; 55 clock-frequency = <6144000>;
53 }; 56 };
54 57
@@ -90,8 +93,8 @@
90 reg = <0x44000000 0x2000>, 93 reg = <0x44000000 0x2000>,
91 <0x44800000 0x3000>, 94 <0x44800000 0x3000>,
92 <0x45000000 0x4000>; 95 <0x45000000 0x4000>;
93 interrupts = <0 9 0x4>, 96 interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
94 <0 10 0x4>; 97 <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
95 98
96 counter32k: counter@4ae04000 { 99 counter32k: counter@4ae04000 {
97 compatible = "ti,omap-counter32k"; 100 compatible = "ti,omap-counter32k";
@@ -119,10 +122,10 @@
119 sdma: dma-controller@4a056000 { 122 sdma: dma-controller@4a056000 {
120 compatible = "ti,omap4430-sdma"; 123 compatible = "ti,omap4430-sdma";
121 reg = <0x4a056000 0x1000>; 124 reg = <0x4a056000 0x1000>;
122 interrupts = <0 12 0x4>, 125 interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>,
123 <0 13 0x4>, 126 <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>,
124 <0 14 0x4>, 127 <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>,
125 <0 15 0x4>; 128 <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
126 #dma-cells = <1>; 129 #dma-cells = <1>;
127 #dma-channels = <32>; 130 #dma-channels = <32>;
128 #dma-requests = <127>; 131 #dma-requests = <127>;
@@ -131,7 +134,7 @@
131 gpio1: gpio@4ae10000 { 134 gpio1: gpio@4ae10000 {
132 compatible = "ti,omap4-gpio"; 135 compatible = "ti,omap4-gpio";
133 reg = <0x4ae10000 0x200>; 136 reg = <0x4ae10000 0x200>;
134 interrupts = <0 29 0x4>; 137 interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
135 ti,hwmods = "gpio1"; 138 ti,hwmods = "gpio1";
136 ti,gpio-always-on; 139 ti,gpio-always-on;
137 gpio-controller; 140 gpio-controller;
@@ -143,7 +146,7 @@
143 gpio2: gpio@48055000 { 146 gpio2: gpio@48055000 {
144 compatible = "ti,omap4-gpio"; 147 compatible = "ti,omap4-gpio";
145 reg = <0x48055000 0x200>; 148 reg = <0x48055000 0x200>;
146 interrupts = <0 30 0x4>; 149 interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
147 ti,hwmods = "gpio2"; 150 ti,hwmods = "gpio2";
148 gpio-controller; 151 gpio-controller;
149 #gpio-cells = <2>; 152 #gpio-cells = <2>;
@@ -154,7 +157,7 @@
154 gpio3: gpio@48057000 { 157 gpio3: gpio@48057000 {
155 compatible = "ti,omap4-gpio"; 158 compatible = "ti,omap4-gpio";
156 reg = <0x48057000 0x200>; 159 reg = <0x48057000 0x200>;
157 interrupts = <0 31 0x4>; 160 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
158 ti,hwmods = "gpio3"; 161 ti,hwmods = "gpio3";
159 gpio-controller; 162 gpio-controller;
160 #gpio-cells = <2>; 163 #gpio-cells = <2>;
@@ -165,7 +168,7 @@
165 gpio4: gpio@48059000 { 168 gpio4: gpio@48059000 {
166 compatible = "ti,omap4-gpio"; 169 compatible = "ti,omap4-gpio";
167 reg = <0x48059000 0x200>; 170 reg = <0x48059000 0x200>;
168 interrupts = <0 32 0x4>; 171 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
169 ti,hwmods = "gpio4"; 172 ti,hwmods = "gpio4";
170 gpio-controller; 173 gpio-controller;
171 #gpio-cells = <2>; 174 #gpio-cells = <2>;
@@ -176,7 +179,7 @@
176 gpio5: gpio@4805b000 { 179 gpio5: gpio@4805b000 {
177 compatible = "ti,omap4-gpio"; 180 compatible = "ti,omap4-gpio";
178 reg = <0x4805b000 0x200>; 181 reg = <0x4805b000 0x200>;
179 interrupts = <0 33 0x4>; 182 interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
180 ti,hwmods = "gpio5"; 183 ti,hwmods = "gpio5";
181 gpio-controller; 184 gpio-controller;
182 #gpio-cells = <2>; 185 #gpio-cells = <2>;
@@ -187,7 +190,7 @@
187 gpio6: gpio@4805d000 { 190 gpio6: gpio@4805d000 {
188 compatible = "ti,omap4-gpio"; 191 compatible = "ti,omap4-gpio";
189 reg = <0x4805d000 0x200>; 192 reg = <0x4805d000 0x200>;
190 interrupts = <0 34 0x4>; 193 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
191 ti,hwmods = "gpio6"; 194 ti,hwmods = "gpio6";
192 gpio-controller; 195 gpio-controller;
193 #gpio-cells = <2>; 196 #gpio-cells = <2>;
@@ -198,7 +201,7 @@
198 gpio7: gpio@48051000 { 201 gpio7: gpio@48051000 {
199 compatible = "ti,omap4-gpio"; 202 compatible = "ti,omap4-gpio";
200 reg = <0x48051000 0x200>; 203 reg = <0x48051000 0x200>;
201 interrupts = <0 35 0x4>; 204 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
202 ti,hwmods = "gpio7"; 205 ti,hwmods = "gpio7";
203 gpio-controller; 206 gpio-controller;
204 #gpio-cells = <2>; 207 #gpio-cells = <2>;
@@ -209,7 +212,7 @@
209 gpio8: gpio@48053000 { 212 gpio8: gpio@48053000 {
210 compatible = "ti,omap4-gpio"; 213 compatible = "ti,omap4-gpio";
211 reg = <0x48053000 0x200>; 214 reg = <0x48053000 0x200>;
212 interrupts = <0 121 0x4>; 215 interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
213 ti,hwmods = "gpio8"; 216 ti,hwmods = "gpio8";
214 gpio-controller; 217 gpio-controller;
215 #gpio-cells = <2>; 218 #gpio-cells = <2>;
@@ -222,7 +225,7 @@
222 reg = <0x50000000 0x1000>; 225 reg = <0x50000000 0x1000>;
223 #address-cells = <2>; 226 #address-cells = <2>;
224 #size-cells = <1>; 227 #size-cells = <1>;
225 interrupts = <0 20 0x4>; 228 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
226 gpmc,num-cs = <8>; 229 gpmc,num-cs = <8>;
227 gpmc,num-waitpins = <4>; 230 gpmc,num-waitpins = <4>;
228 ti,hwmods = "gpmc"; 231 ti,hwmods = "gpmc";
@@ -231,7 +234,7 @@
231 i2c1: i2c@48070000 { 234 i2c1: i2c@48070000 {
232 compatible = "ti,omap4-i2c"; 235 compatible = "ti,omap4-i2c";
233 reg = <0x48070000 0x100>; 236 reg = <0x48070000 0x100>;
234 interrupts = <0 56 0x4>; 237 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
235 #address-cells = <1>; 238 #address-cells = <1>;
236 #size-cells = <0>; 239 #size-cells = <0>;
237 ti,hwmods = "i2c1"; 240 ti,hwmods = "i2c1";
@@ -240,7 +243,7 @@
240 i2c2: i2c@48072000 { 243 i2c2: i2c@48072000 {
241 compatible = "ti,omap4-i2c"; 244 compatible = "ti,omap4-i2c";
242 reg = <0x48072000 0x100>; 245 reg = <0x48072000 0x100>;
243 interrupts = <0 57 0x4>; 246 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
244 #address-cells = <1>; 247 #address-cells = <1>;
245 #size-cells = <0>; 248 #size-cells = <0>;
246 ti,hwmods = "i2c2"; 249 ti,hwmods = "i2c2";
@@ -249,7 +252,7 @@
249 i2c3: i2c@48060000 { 252 i2c3: i2c@48060000 {
250 compatible = "ti,omap4-i2c"; 253 compatible = "ti,omap4-i2c";
251 reg = <0x48060000 0x100>; 254 reg = <0x48060000 0x100>;
252 interrupts = <0 61 0x4>; 255 interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
253 #address-cells = <1>; 256 #address-cells = <1>;
254 #size-cells = <0>; 257 #size-cells = <0>;
255 ti,hwmods = "i2c3"; 258 ti,hwmods = "i2c3";
@@ -258,7 +261,7 @@
258 i2c4: i2c@4807a000 { 261 i2c4: i2c@4807a000 {
259 compatible = "ti,omap4-i2c"; 262 compatible = "ti,omap4-i2c";
260 reg = <0x4807a000 0x100>; 263 reg = <0x4807a000 0x100>;
261 interrupts = <0 62 0x4>; 264 interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
262 #address-cells = <1>; 265 #address-cells = <1>;
263 #size-cells = <0>; 266 #size-cells = <0>;
264 ti,hwmods = "i2c4"; 267 ti,hwmods = "i2c4";
@@ -267,7 +270,7 @@
267 i2c5: i2c@4807c000 { 270 i2c5: i2c@4807c000 {
268 compatible = "ti,omap4-i2c"; 271 compatible = "ti,omap4-i2c";
269 reg = <0x4807c000 0x100>; 272 reg = <0x4807c000 0x100>;
270 interrupts = <0 60 0x4>; 273 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
271 #address-cells = <1>; 274 #address-cells = <1>;
272 #size-cells = <0>; 275 #size-cells = <0>;
273 ti,hwmods = "i2c5"; 276 ti,hwmods = "i2c5";
@@ -276,7 +279,7 @@
276 mcspi1: spi@48098000 { 279 mcspi1: spi@48098000 {
277 compatible = "ti,omap4-mcspi"; 280 compatible = "ti,omap4-mcspi";
278 reg = <0x48098000 0x200>; 281 reg = <0x48098000 0x200>;
279 interrupts = <0 65 0x4>; 282 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
280 #address-cells = <1>; 283 #address-cells = <1>;
281 #size-cells = <0>; 284 #size-cells = <0>;
282 ti,hwmods = "mcspi1"; 285 ti,hwmods = "mcspi1";
@@ -296,7 +299,7 @@
296 mcspi2: spi@4809a000 { 299 mcspi2: spi@4809a000 {
297 compatible = "ti,omap4-mcspi"; 300 compatible = "ti,omap4-mcspi";
298 reg = <0x4809a000 0x200>; 301 reg = <0x4809a000 0x200>;
299 interrupts = <0 66 0x4>; 302 interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
300 #address-cells = <1>; 303 #address-cells = <1>;
301 #size-cells = <0>; 304 #size-cells = <0>;
302 ti,hwmods = "mcspi2"; 305 ti,hwmods = "mcspi2";
@@ -311,7 +314,7 @@
311 mcspi3: spi@480b8000 { 314 mcspi3: spi@480b8000 {
312 compatible = "ti,omap4-mcspi"; 315 compatible = "ti,omap4-mcspi";
313 reg = <0x480b8000 0x200>; 316 reg = <0x480b8000 0x200>;
314 interrupts = <0 91 0x4>; 317 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
315 #address-cells = <1>; 318 #address-cells = <1>;
316 #size-cells = <0>; 319 #size-cells = <0>;
317 ti,hwmods = "mcspi3"; 320 ti,hwmods = "mcspi3";
@@ -323,7 +326,7 @@
323 mcspi4: spi@480ba000 { 326 mcspi4: spi@480ba000 {
324 compatible = "ti,omap4-mcspi"; 327 compatible = "ti,omap4-mcspi";
325 reg = <0x480ba000 0x200>; 328 reg = <0x480ba000 0x200>;
326 interrupts = <0 48 0x4>; 329 interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
327 #address-cells = <1>; 330 #address-cells = <1>;
328 #size-cells = <0>; 331 #size-cells = <0>;
329 ti,hwmods = "mcspi4"; 332 ti,hwmods = "mcspi4";
@@ -335,7 +338,7 @@
335 uart1: serial@4806a000 { 338 uart1: serial@4806a000 {
336 compatible = "ti,omap4-uart"; 339 compatible = "ti,omap4-uart";
337 reg = <0x4806a000 0x100>; 340 reg = <0x4806a000 0x100>;
338 interrupts = <0 72 0x4>; 341 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
339 ti,hwmods = "uart1"; 342 ti,hwmods = "uart1";
340 clock-frequency = <48000000>; 343 clock-frequency = <48000000>;
341 }; 344 };
@@ -343,7 +346,7 @@
343 uart2: serial@4806c000 { 346 uart2: serial@4806c000 {
344 compatible = "ti,omap4-uart"; 347 compatible = "ti,omap4-uart";
345 reg = <0x4806c000 0x100>; 348 reg = <0x4806c000 0x100>;
346 interrupts = <0 73 0x4>; 349 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
347 ti,hwmods = "uart2"; 350 ti,hwmods = "uart2";
348 clock-frequency = <48000000>; 351 clock-frequency = <48000000>;
349 }; 352 };
@@ -351,7 +354,7 @@
351 uart3: serial@48020000 { 354 uart3: serial@48020000 {
352 compatible = "ti,omap4-uart"; 355 compatible = "ti,omap4-uart";
353 reg = <0x48020000 0x100>; 356 reg = <0x48020000 0x100>;
354 interrupts = <0 74 0x4>; 357 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
355 ti,hwmods = "uart3"; 358 ti,hwmods = "uart3";
356 clock-frequency = <48000000>; 359 clock-frequency = <48000000>;
357 }; 360 };
@@ -359,7 +362,7 @@
359 uart4: serial@4806e000 { 362 uart4: serial@4806e000 {
360 compatible = "ti,omap4-uart"; 363 compatible = "ti,omap4-uart";
361 reg = <0x4806e000 0x100>; 364 reg = <0x4806e000 0x100>;
362 interrupts = <0 70 0x4>; 365 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
363 ti,hwmods = "uart4"; 366 ti,hwmods = "uart4";
364 clock-frequency = <48000000>; 367 clock-frequency = <48000000>;
365 }; 368 };
@@ -367,7 +370,7 @@
367 uart5: serial@48066000 { 370 uart5: serial@48066000 {
368 compatible = "ti,omap4-uart"; 371 compatible = "ti,omap4-uart";
369 reg = <0x48066000 0x100>; 372 reg = <0x48066000 0x100>;
370 interrupts = <0 105 0x4>; 373 interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
371 ti,hwmods = "uart5"; 374 ti,hwmods = "uart5";
372 clock-frequency = <48000000>; 375 clock-frequency = <48000000>;
373 }; 376 };
@@ -375,7 +378,7 @@
375 uart6: serial@48068000 { 378 uart6: serial@48068000 {
376 compatible = "ti,omap4-uart"; 379 compatible = "ti,omap4-uart";
377 reg = <0x48068000 0x100>; 380 reg = <0x48068000 0x100>;
378 interrupts = <0 106 0x4>; 381 interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
379 ti,hwmods = "uart6"; 382 ti,hwmods = "uart6";
380 clock-frequency = <48000000>; 383 clock-frequency = <48000000>;
381 }; 384 };
@@ -383,7 +386,7 @@
383 mmc1: mmc@4809c000 { 386 mmc1: mmc@4809c000 {
384 compatible = "ti,omap4-hsmmc"; 387 compatible = "ti,omap4-hsmmc";
385 reg = <0x4809c000 0x400>; 388 reg = <0x4809c000 0x400>;
386 interrupts = <0 83 0x4>; 389 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
387 ti,hwmods = "mmc1"; 390 ti,hwmods = "mmc1";
388 ti,dual-volt; 391 ti,dual-volt;
389 ti,needs-special-reset; 392 ti,needs-special-reset;
@@ -394,7 +397,7 @@
394 mmc2: mmc@480b4000 { 397 mmc2: mmc@480b4000 {
395 compatible = "ti,omap4-hsmmc"; 398 compatible = "ti,omap4-hsmmc";
396 reg = <0x480b4000 0x400>; 399 reg = <0x480b4000 0x400>;
397 interrupts = <0 86 0x4>; 400 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
398 ti,hwmods = "mmc2"; 401 ti,hwmods = "mmc2";
399 ti,needs-special-reset; 402 ti,needs-special-reset;
400 dmas = <&sdma 47>, <&sdma 48>; 403 dmas = <&sdma 47>, <&sdma 48>;
@@ -404,7 +407,7 @@
404 mmc3: mmc@480ad000 { 407 mmc3: mmc@480ad000 {
405 compatible = "ti,omap4-hsmmc"; 408 compatible = "ti,omap4-hsmmc";
406 reg = <0x480ad000 0x400>; 409 reg = <0x480ad000 0x400>;
407 interrupts = <0 94 0x4>; 410 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
408 ti,hwmods = "mmc3"; 411 ti,hwmods = "mmc3";
409 ti,needs-special-reset; 412 ti,needs-special-reset;
410 dmas = <&sdma 77>, <&sdma 78>; 413 dmas = <&sdma 77>, <&sdma 78>;
@@ -414,7 +417,7 @@
414 mmc4: mmc@480d1000 { 417 mmc4: mmc@480d1000 {
415 compatible = "ti,omap4-hsmmc"; 418 compatible = "ti,omap4-hsmmc";
416 reg = <0x480d1000 0x400>; 419 reg = <0x480d1000 0x400>;
417 interrupts = <0 96 0x4>; 420 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
418 ti,hwmods = "mmc4"; 421 ti,hwmods = "mmc4";
419 ti,needs-special-reset; 422 ti,needs-special-reset;
420 dmas = <&sdma 57>, <&sdma 58>; 423 dmas = <&sdma 57>, <&sdma 58>;
@@ -424,7 +427,7 @@
424 mmc5: mmc@480d5000 { 427 mmc5: mmc@480d5000 {
425 compatible = "ti,omap4-hsmmc"; 428 compatible = "ti,omap4-hsmmc";
426 reg = <0x480d5000 0x400>; 429 reg = <0x480d5000 0x400>;
427 interrupts = <0 59 0x4>; 430 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
428 ti,hwmods = "mmc5"; 431 ti,hwmods = "mmc5";
429 ti,needs-special-reset; 432 ti,needs-special-reset;
430 dmas = <&sdma 59>, <&sdma 60>; 433 dmas = <&sdma 59>, <&sdma 60>;
@@ -442,7 +445,7 @@
442 reg = <0x40132000 0x7f>, /* MPU private access */ 445 reg = <0x40132000 0x7f>, /* MPU private access */
443 <0x49032000 0x7f>; /* L3 Interconnect */ 446 <0x49032000 0x7f>; /* L3 Interconnect */
444 reg-names = "mpu", "dma"; 447 reg-names = "mpu", "dma";
445 interrupts = <0 112 0x4>; 448 interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
446 ti,hwmods = "mcpdm"; 449 ti,hwmods = "mcpdm";
447 dmas = <&sdma 65>, 450 dmas = <&sdma 65>,
448 <&sdma 66>; 451 <&sdma 66>;
@@ -454,7 +457,7 @@
454 reg = <0x4012e000 0x7f>, /* MPU private access */ 457 reg = <0x4012e000 0x7f>, /* MPU private access */
455 <0x4902e000 0x7f>; /* L3 Interconnect */ 458 <0x4902e000 0x7f>; /* L3 Interconnect */
456 reg-names = "mpu", "dma"; 459 reg-names = "mpu", "dma";
457 interrupts = <0 114 0x4>; 460 interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>;
458 ti,hwmods = "dmic"; 461 ti,hwmods = "dmic";
459 dmas = <&sdma 67>; 462 dmas = <&sdma 67>;
460 dma-names = "up_link"; 463 dma-names = "up_link";
@@ -465,7 +468,7 @@
465 reg = <0x40122000 0xff>, /* MPU private access */ 468 reg = <0x40122000 0xff>, /* MPU private access */
466 <0x49022000 0xff>; /* L3 Interconnect */ 469 <0x49022000 0xff>; /* L3 Interconnect */
467 reg-names = "mpu", "dma"; 470 reg-names = "mpu", "dma";
468 interrupts = <0 17 0x4>; 471 interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
469 interrupt-names = "common"; 472 interrupt-names = "common";
470 ti,buffer-size = <128>; 473 ti,buffer-size = <128>;
471 ti,hwmods = "mcbsp1"; 474 ti,hwmods = "mcbsp1";
@@ -479,7 +482,7 @@
479 reg = <0x40124000 0xff>, /* MPU private access */ 482 reg = <0x40124000 0xff>, /* MPU private access */
480 <0x49024000 0xff>; /* L3 Interconnect */ 483 <0x49024000 0xff>; /* L3 Interconnect */
481 reg-names = "mpu", "dma"; 484 reg-names = "mpu", "dma";
482 interrupts = <0 22 0x4>; 485 interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
483 interrupt-names = "common"; 486 interrupt-names = "common";
484 ti,buffer-size = <128>; 487 ti,buffer-size = <128>;
485 ti,hwmods = "mcbsp2"; 488 ti,hwmods = "mcbsp2";
@@ -493,7 +496,7 @@
493 reg = <0x40126000 0xff>, /* MPU private access */ 496 reg = <0x40126000 0xff>, /* MPU private access */
494 <0x49026000 0xff>; /* L3 Interconnect */ 497 <0x49026000 0xff>; /* L3 Interconnect */
495 reg-names = "mpu", "dma"; 498 reg-names = "mpu", "dma";
496 interrupts = <0 23 0x4>; 499 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
497 interrupt-names = "common"; 500 interrupt-names = "common";
498 ti,buffer-size = <128>; 501 ti,buffer-size = <128>;
499 ti,hwmods = "mcbsp3"; 502 ti,hwmods = "mcbsp3";
@@ -505,7 +508,7 @@
505 timer1: timer@4ae18000 { 508 timer1: timer@4ae18000 {
506 compatible = "ti,omap5430-timer"; 509 compatible = "ti,omap5430-timer";
507 reg = <0x4ae18000 0x80>; 510 reg = <0x4ae18000 0x80>;
508 interrupts = <0 37 0x4>; 511 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
509 ti,hwmods = "timer1"; 512 ti,hwmods = "timer1";
510 ti,timer-alwon; 513 ti,timer-alwon;
511 }; 514 };
@@ -513,21 +516,21 @@
513 timer2: timer@48032000 { 516 timer2: timer@48032000 {
514 compatible = "ti,omap5430-timer"; 517 compatible = "ti,omap5430-timer";
515 reg = <0x48032000 0x80>; 518 reg = <0x48032000 0x80>;
516 interrupts = <0 38 0x4>; 519 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
517 ti,hwmods = "timer2"; 520 ti,hwmods = "timer2";
518 }; 521 };
519 522
520 timer3: timer@48034000 { 523 timer3: timer@48034000 {
521 compatible = "ti,omap5430-timer"; 524 compatible = "ti,omap5430-timer";
522 reg = <0x48034000 0x80>; 525 reg = <0x48034000 0x80>;
523 interrupts = <0 39 0x4>; 526 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
524 ti,hwmods = "timer3"; 527 ti,hwmods = "timer3";
525 }; 528 };
526 529
527 timer4: timer@48036000 { 530 timer4: timer@48036000 {
528 compatible = "ti,omap5430-timer"; 531 compatible = "ti,omap5430-timer";
529 reg = <0x48036000 0x80>; 532 reg = <0x48036000 0x80>;
530 interrupts = <0 40 0x4>; 533 interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>;
531 ti,hwmods = "timer4"; 534 ti,hwmods = "timer4";
532 }; 535 };
533 536
@@ -535,16 +538,17 @@
535 compatible = "ti,omap5430-timer"; 538 compatible = "ti,omap5430-timer";
536 reg = <0x40138000 0x80>, 539 reg = <0x40138000 0x80>,
537 <0x49038000 0x80>; 540 <0x49038000 0x80>;
538 interrupts = <0 41 0x4>; 541 interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
539 ti,hwmods = "timer5"; 542 ti,hwmods = "timer5";
540 ti,timer-dsp; 543 ti,timer-dsp;
544 ti,timer-pwm;
541 }; 545 };
542 546
543 timer6: timer@4013a000 { 547 timer6: timer@4013a000 {
544 compatible = "ti,omap5430-timer"; 548 compatible = "ti,omap5430-timer";
545 reg = <0x4013a000 0x80>, 549 reg = <0x4013a000 0x80>,
546 <0x4903a000 0x80>; 550 <0x4903a000 0x80>;
547 interrupts = <0 42 0x4>; 551 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
548 ti,hwmods = "timer6"; 552 ti,hwmods = "timer6";
549 ti,timer-dsp; 553 ti,timer-dsp;
550 ti,timer-pwm; 554 ti,timer-pwm;
@@ -554,7 +558,7 @@
554 compatible = "ti,omap5430-timer"; 558 compatible = "ti,omap5430-timer";
555 reg = <0x4013c000 0x80>, 559 reg = <0x4013c000 0x80>,
556 <0x4903c000 0x80>; 560 <0x4903c000 0x80>;
557 interrupts = <0 43 0x4>; 561 interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
558 ti,hwmods = "timer7"; 562 ti,hwmods = "timer7";
559 ti,timer-dsp; 563 ti,timer-dsp;
560 }; 564 };
@@ -563,7 +567,7 @@
563 compatible = "ti,omap5430-timer"; 567 compatible = "ti,omap5430-timer";
564 reg = <0x4013e000 0x80>, 568 reg = <0x4013e000 0x80>,
565 <0x4903e000 0x80>; 569 <0x4903e000 0x80>;
566 interrupts = <0 44 0x4>; 570 interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
567 ti,hwmods = "timer8"; 571 ti,hwmods = "timer8";
568 ti,timer-dsp; 572 ti,timer-dsp;
569 ti,timer-pwm; 573 ti,timer-pwm;
@@ -572,21 +576,23 @@
572 timer9: timer@4803e000 { 576 timer9: timer@4803e000 {
573 compatible = "ti,omap5430-timer"; 577 compatible = "ti,omap5430-timer";
574 reg = <0x4803e000 0x80>; 578 reg = <0x4803e000 0x80>;
575 interrupts = <0 45 0x4>; 579 interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
576 ti,hwmods = "timer9"; 580 ti,hwmods = "timer9";
581 ti,timer-pwm;
577 }; 582 };
578 583
579 timer10: timer@48086000 { 584 timer10: timer@48086000 {
580 compatible = "ti,omap5430-timer"; 585 compatible = "ti,omap5430-timer";
581 reg = <0x48086000 0x80>; 586 reg = <0x48086000 0x80>;
582 interrupts = <0 46 0x4>; 587 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
583 ti,hwmods = "timer10"; 588 ti,hwmods = "timer10";
589 ti,timer-pwm;
584 }; 590 };
585 591
586 timer11: timer@48088000 { 592 timer11: timer@48088000 {
587 compatible = "ti,omap5430-timer"; 593 compatible = "ti,omap5430-timer";
588 reg = <0x48088000 0x80>; 594 reg = <0x48088000 0x80>;
589 interrupts = <0 47 0x4>; 595 interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
590 ti,hwmods = "timer11"; 596 ti,hwmods = "timer11";
591 ti,timer-pwm; 597 ti,timer-pwm;
592 }; 598 };
@@ -594,7 +600,7 @@
594 wdt2: wdt@4ae14000 { 600 wdt2: wdt@4ae14000 {
595 compatible = "ti,omap5-wdt", "ti,omap3-wdt"; 601 compatible = "ti,omap5-wdt", "ti,omap3-wdt";
596 reg = <0x4ae14000 0x80>; 602 reg = <0x4ae14000 0x80>;
597 interrupts = <0 80 0x4>; 603 interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
598 ti,hwmods = "wd_timer2"; 604 ti,hwmods = "wd_timer2";
599 }; 605 };
600 606
@@ -603,7 +609,7 @@
603 ti,hwmods = "emif1"; 609 ti,hwmods = "emif1";
604 phy-type = <2>; /* DDR PHY type: Intelli PHY */ 610 phy-type = <2>; /* DDR PHY type: Intelli PHY */
605 reg = <0x4c000000 0x400>; 611 reg = <0x4c000000 0x400>;
606 interrupts = <0 110 0x4>; 612 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
607 hw-caps-read-idle-ctrl; 613 hw-caps-read-idle-ctrl;
608 hw-caps-ll-interface; 614 hw-caps-ll-interface;
609 hw-caps-temp-alert; 615 hw-caps-temp-alert;
@@ -614,7 +620,7 @@
614 ti,hwmods = "emif2"; 620 ti,hwmods = "emif2";
615 phy-type = <2>; /* DDR PHY type: Intelli PHY */ 621 phy-type = <2>; /* DDR PHY type: Intelli PHY */
616 reg = <0x4d000000 0x400>; 622 reg = <0x4d000000 0x400>;
617 interrupts = <0 111 0x4>; 623 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
618 hw-caps-read-idle-ctrl; 624 hw-caps-read-idle-ctrl;
619 hw-caps-ll-interface; 625 hw-caps-ll-interface;
620 hw-caps-temp-alert; 626 hw-caps-temp-alert;
@@ -632,7 +638,7 @@
632 compatible = "ti,dwc3"; 638 compatible = "ti,dwc3";
633 ti,hwmods = "usb_otg_ss"; 639 ti,hwmods = "usb_otg_ss";
634 reg = <0x4a020000 0x1000>; 640 reg = <0x4a020000 0x1000>;
635 interrupts = <0 93 4>; 641 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
636 #address-cells = <1>; 642 #address-cells = <1>;
637 #size-cells = <1>; 643 #size-cells = <1>;
638 utmi-mode = <2>; 644 utmi-mode = <2>;
@@ -640,7 +646,7 @@
640 dwc3@4a030000 { 646 dwc3@4a030000 {
641 compatible = "synopsys,dwc3"; 647 compatible = "synopsys,dwc3";
642 reg = <0x4a030000 0x1000>; 648 reg = <0x4a030000 0x1000>;
643 interrupts = <0 92 4>; 649 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
644 usb-phy = <&usb2_phy>, <&usb3_phy>; 650 usb-phy = <&usb2_phy>, <&usb3_phy>;
645 tx-fifo-resize; 651 tx-fifo-resize;
646 }; 652 };
@@ -667,5 +673,44 @@
667 ctrl-module = <&omap_control_usb>; 673 ctrl-module = <&omap_control_usb>;
668 }; 674 };
669 }; 675 };
676
677 usbhstll: usbhstll@4a062000 {
678 compatible = "ti,usbhs-tll";
679 reg = <0x4a062000 0x1000>;
680 interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
681 ti,hwmods = "usb_tll_hs";
682 };
683
684 usbhshost: usbhshost@4a064000 {
685 compatible = "ti,usbhs-host";
686 reg = <0x4a064000 0x800>;
687 ti,hwmods = "usb_host_hs";
688 #address-cells = <1>;
689 #size-cells = <1>;
690 ranges;
691
692 usbhsohci: ohci@4a064800 {
693 compatible = "ti,ohci-omap3", "usb-ohci";
694 reg = <0x4a064800 0x400>;
695 interrupt-parent = <&gic>;
696 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
697 };
698
699 usbhsehci: ehci@4a064c00 {
700 compatible = "ti,ehci-omap", "usb-ehci";
701 reg = <0x4a064c00 0x400>;
702 interrupt-parent = <&gic>;
703 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
704 };
705 };
706
707 bandgap@4a0021e0 {
708 reg = <0x4a0021e0 0xc
709 0x4a00232c 0xc
710 0x4a002380 0x2c
711 0x4a0023C0 0x3c>;
712 interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
713 compatible = "ti,omap5430-bandgap";
714 };
670 }; 715 };
671}; 716};
diff --git a/arch/arm/boot/dts/picoxcell-pc3x2.dtsi b/arch/arm/boot/dts/picoxcell-pc3x2.dtsi
index f0a8c2068ea7..533919e96eae 100644
--- a/arch/arm/boot/dts/picoxcell-pc3x2.dtsi
+++ b/arch/arm/boot/dts/picoxcell-pc3x2.dtsi
@@ -18,13 +18,13 @@
18 #size-cells = <1>; 18 #size-cells = <1>;
19 19
20 cpus { 20 cpus {
21 #address-cells = <1>; 21 #address-cells = <0>;
22 #size-cells = <0>; 22 #size-cells = <0>;
23 23
24 cpu@0 { 24 cpu {
25 compatible = "arm,1176jz-s"; 25 compatible = "arm,arm1176jz-s";
26 device_type = "cpu";
26 clock-frequency = <400000000>; 27 clock-frequency = <400000000>;
27 reg = <0>;
28 d-cache-line-size = <32>; 28 d-cache-line-size = <32>;
29 d-cache-size = <32768>; 29 d-cache-size = <32768>;
30 i-cache-line-size = <32>; 30 i-cache-line-size = <32>;
diff --git a/arch/arm/boot/dts/picoxcell-pc3x3.dtsi b/arch/arm/boot/dts/picoxcell-pc3x3.dtsi
index daa962d191e6..ab3e80085511 100644
--- a/arch/arm/boot/dts/picoxcell-pc3x3.dtsi
+++ b/arch/arm/boot/dts/picoxcell-pc3x3.dtsi
@@ -18,13 +18,13 @@
18 #size-cells = <1>; 18 #size-cells = <1>;
19 19
20 cpus { 20 cpus {
21 #address-cells = <1>; 21 #address-cells = <0>;
22 #size-cells = <0>; 22 #size-cells = <0>;
23 23
24 cpu@0 { 24 cpu {
25 compatible = "arm,1176jz-s"; 25 compatible = "arm,arm1176jz-s";
26 device_type = "cpu";
26 cpu-clock = <&arm_clk>, "cpu"; 27 cpu-clock = <&arm_clk>, "cpu";
27 reg = <0>;
28 d-cache-line-size = <32>; 28 d-cache-line-size = <32>;
29 d-cache-size = <32768>; 29 d-cache-size = <32768>;
30 i-cache-line-size = <32>; 30 i-cache-line-size = <32>;
diff --git a/arch/arm/boot/dts/pm9g45.dts b/arch/arm/boot/dts/pm9g45.dts
index 387fedb58988..33ffabe9c4c8 100644
--- a/arch/arm/boot/dts/pm9g45.dts
+++ b/arch/arm/boot/dts/pm9g45.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g45.dtsi" 9#include "at91sam9g45.dtsi"
10 10
11/ { 11/ {
12 model = "Ronetix pm9g45"; 12 model = "Ronetix pm9g45";
@@ -42,15 +42,15 @@
42 board { 42 board {
43 pinctrl_board_nand: nand0-board { 43 pinctrl_board_nand: nand0-board {
44 atmel,pins = 44 atmel,pins =
45 <3 3 0x0 0x1 /* PD3 gpio RDY pin pull_up*/ 45 <AT91_PIOD 3 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP /* PD3 gpio RDY pin pull_up*/
46 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */ 46 AT91_PIOC 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PC14 gpio enable pin pull_up */
47 }; 47 };
48 }; 48 };
49 49
50 mmc { 50 mmc {
51 pinctrl_board_mmc: mmc0-board { 51 pinctrl_board_mmc: mmc0-board {
52 atmel,pins = 52 atmel,pins =
53 <3 6 0x0 0x5>; /* PD6 gpio CD pin pull_up and deglitch */ 53 <AT91_PIOD 6 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD6 gpio CD pin pull_up and deglitch */
54 }; 54 };
55 }; 55 };
56 }; 56 };
@@ -64,7 +64,7 @@
64 slot@0 { 64 slot@0 {
65 reg = <0>; 65 reg = <0>;
66 bus-width = <4>; 66 bus-width = <4>;
67 cd-gpios = <&pioD 6 0>; 67 cd-gpios = <&pioD 6 GPIO_ACTIVE_HIGH>;
68 }; 68 };
69 }; 69 };
70 70
@@ -81,8 +81,8 @@
81 nand-on-flash-bbt; 81 nand-on-flash-bbt;
82 pinctrl-0 = <&pinctrl_board_nand>; 82 pinctrl-0 = <&pinctrl_board_nand>;
83 83
84 gpios = <&pioD 3 0 84 gpios = <&pioD 3 GPIO_ACTIVE_HIGH
85 &pioC 14 0 85 &pioC 14 GPIO_ACTIVE_HIGH
86 0 86 0
87 >; 87 >;
88 88
@@ -134,13 +134,13 @@
134 134
135 led0 { 135 led0 {
136 label = "led0"; 136 label = "led0";
137 gpios = <&pioD 0 1>; 137 gpios = <&pioD 0 GPIO_ACTIVE_LOW>;
138 linux,default-trigger = "nand-disk"; 138 linux,default-trigger = "nand-disk";
139 }; 139 };
140 140
141 led1 { 141 led1 {
142 label = "led1"; 142 label = "led1";
143 gpios = <&pioD 31 0>; 143 gpios = <&pioD 31 GPIO_ACTIVE_HIGH>;
144 linux,default-trigger = "heartbeat"; 144 linux,default-trigger = "heartbeat";
145 }; 145 };
146 }; 146 };
@@ -152,13 +152,13 @@
152 152
153 right { 153 right {
154 label = "SW4"; 154 label = "SW4";
155 gpios = <&pioE 7 1>; 155 gpios = <&pioE 7 GPIO_ACTIVE_LOW>;
156 linux,code = <106>; 156 linux,code = <106>;
157 }; 157 };
158 158
159 up { 159 up {
160 label = "SW3"; 160 label = "SW3";
161 gpios = <&pioE 8 1>; 161 gpios = <&pioE 8 GPIO_ACTIVE_LOW>;
162 linux,code = <103>; 162 linux,code = <103>;
163 }; 163 };
164 }; 164 };
diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi
index 3329719a9412..05e9489cf95c 100644
--- a/arch/arm/boot/dts/prima2.dtsi
+++ b/arch/arm/boot/dts/prima2.dtsi
@@ -18,6 +18,8 @@
18 #size-cells = <0>; 18 #size-cells = <0>;
19 19
20 cpu@0 { 20 cpu@0 {
21 compatible = "arm,cortex-a9";
22 device_type = "cpu";
21 reg = <0x0>; 23 reg = <0x0>;
22 d-cache-line-size = <32>; 24 d-cache-line-size = <32>;
23 i-cache-line-size = <32>; 25 i-cache-line-size = <32>;
@@ -608,7 +610,7 @@
608 }; 610 };
609 611
610 rtc-iobg { 612 rtc-iobg {
611 compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus"; 613 compatible = "sirf,prima2-rtciobg", "sirf-prima2-rtciobg-bus", "simple-bus";
612 #address-cells = <1>; 614 #address-cells = <1>;
613 #size-cells = <1>; 615 #size-cells = <1>;
614 reg = <0x80030000 0x10000>; 616 reg = <0x80030000 0x10000>;
diff --git a/arch/arm/boot/dts/pxa2xx.dtsi b/arch/arm/boot/dts/pxa2xx.dtsi
index f18aad35e8b3..a5e90f078aa9 100644
--- a/arch/arm/boot/dts/pxa2xx.dtsi
+++ b/arch/arm/boot/dts/pxa2xx.dtsi
@@ -23,8 +23,11 @@
23 }; 23 };
24 24
25 cpus { 25 cpus {
26 cpu@0 { 26 #address-cells = <0>;
27 compatible = "arm,xscale"; 27 #size-cells = <0>;
28 cpu {
29 compatible = "marvell,xscale";
30 device_type = "cpu";
28 }; 31 };
29 }; 32 };
30 33
diff --git a/arch/arm/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index fde2a337d1ff..4ff2019c0e30 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -37,12 +37,6 @@
37 <0 0xf1004000 0 0x2000>, 37 <0 0xf1004000 0 0x2000>,
38 <0 0xf1006000 0 0x2000>; 38 <0 0xf1006000 0 0x2000>;
39 interrupts = <1 9 0xf04>; 39 interrupts = <1 9 0xf04>;
40
41 gic-cpuif@4 {
42 compatible = "arm,gic-cpuif";
43 cpuif-id = <4>;
44 cpu = <&cpu0>;
45 };
46 }; 40 };
47 41
48 timer { 42 timer {
diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
new file mode 100644
index 000000000000..09ea22c26359
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -0,0 +1,45 @@
1/*
2 * Reference Device Tree Source for the armadillo 800 eva board
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12/include/ "r8a7740.dtsi"
13
14/ {
15 model = "armadillo 800 eva reference";
16 compatible = "renesas,armadillo800eva-reference", "renesas,r8a7740";
17
18 chosen {
19 bootargs = "console=tty0 console=ttySC1,115200 earlyprintk=sh-sci.1,115200 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096 rw";
20 };
21
22 memory {
23 device_type = "memory";
24 reg = <0x40000000 0x20000000>;
25 };
26
27 reg_3p3v: regulator@0 {
28 compatible = "regulator-fixed";
29 regulator-name = "fixed-3.3V";
30 regulator-min-microvolt = <3300000>;
31 regulator-max-microvolt = <3300000>;
32 regulator-always-on;
33 regulator-boot-on;
34 };
35
36};
37
38&i2c0 {
39 touchscreen: st1232@55 {
40 compatible = "sitronix,st1232";
41 reg = <0x55>;
42 interrupt-parent = <&irqpin1>;
43 interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */
44 };
45};
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index 798fa35c0005..24e930643821 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -14,8 +14,129 @@
14 compatible = "renesas,r8a7740"; 14 compatible = "renesas,r8a7740";
15 15
16 cpus { 16 cpus {
17 #address-cells = <1>;
18 #size-cells = <0>;
17 cpu@0 { 19 cpu@0 {
18 compatible = "arm,cortex-a9"; 20 compatible = "arm,cortex-a9";
21 device_type = "cpu";
22 reg = <0x0>;
19 }; 23 };
20 }; 24 };
25
26 gic: interrupt-controller@c2800000 {
27 compatible = "arm,cortex-a9-gic";
28 #interrupt-cells = <3>;
29 #address-cells = <1>;
30 interrupt-controller;
31 reg = <0xc2800000 0x1000>,
32 <0xc2000000 0x1000>;
33 };
34
35 /* irqpin0: IRQ0 - IRQ7 */
36 irqpin0: irqpin@e6900000 {
37 compatible = "renesas,intc-irqpin";
38 #interrupt-cells = <2>;
39 interrupt-controller;
40 reg = <0xe6900000 4>,
41 <0xe6900010 4>,
42 <0xe6900020 1>,
43 <0xe6900040 1>,
44 <0xe6900060 1>;
45 interrupt-parent = <&gic>;
46 interrupts = <0 149 0x4
47 0 149 0x4
48 0 149 0x4
49 0 149 0x4
50 0 149 0x4
51 0 149 0x4
52 0 149 0x4
53 0 149 0x4>;
54 };
55
56 /* irqpin1: IRQ8 - IRQ15 */
57 irqpin1: irqpin@e6900004 {
58 compatible = "renesas,intc-irqpin";
59 #interrupt-cells = <2>;
60 interrupt-controller;
61 reg = <0xe6900004 4>,
62 <0xe6900014 4>,
63 <0xe6900024 1>,
64 <0xe6900044 1>,
65 <0xe6900064 1>;
66 interrupt-parent = <&gic>;
67 interrupts = <0 149 0x4
68 0 149 0x4
69 0 149 0x4
70 0 149 0x4
71 0 149 0x4
72 0 149 0x4
73 0 149 0x4
74 0 149 0x4>;
75 };
76
77 /* irqpin2: IRQ16 - IRQ23 */
78 irqpin2: irqpin@e6900008 {
79 compatible = "renesas,intc-irqpin";
80 #interrupt-cells = <2>;
81 interrupt-controller;
82 reg = <0xe6900008 4>,
83 <0xe6900018 4>,
84 <0xe6900028 1>,
85 <0xe6900048 1>,
86 <0xe6900068 1>;
87 interrupt-parent = <&gic>;
88 interrupts = <0 149 0x4
89 0 149 0x4
90 0 149 0x4
91 0 149 0x4
92 0 149 0x4
93 0 149 0x4
94 0 149 0x4
95 0 149 0x4>;
96 };
97
98 /* irqpin3: IRQ24 - IRQ31 */
99 irqpin3: irqpin@e690000c {
100 compatible = "renesas,intc-irqpin";
101 #interrupt-cells = <2>;
102 interrupt-controller;
103 reg = <0xe690000c 4>,
104 <0xe690001c 4>,
105 <0xe690002c 1>,
106 <0xe690004c 1>,
107 <0xe690006c 1>;
108 interrupt-parent = <&gic>;
109 interrupts = <0 149 0x4
110 0 149 0x4
111 0 149 0x4
112 0 149 0x4
113 0 149 0x4
114 0 149 0x4
115 0 149 0x4
116 0 149 0x4>;
117 };
118
119 i2c0: i2c@fff20000 {
120 #address-cells = <1>;
121 #size-cells = <0>;
122 compatible = "renesas,rmobile-iic";
123 reg = <0xfff20000 0x425>;
124 interrupt-parent = <&gic>;
125 interrupts = <0 201 0x4
126 0 202 0x4
127 0 203 0x4
128 0 204 0x4>;
129 };
130
131 i2c1: i2c@e6c20000 {
132 #address-cells = <1>;
133 #size-cells = <0>;
134 compatible = "renesas,rmobile-iic";
135 reg = <0xe6c20000 0x425>;
136 interrupt-parent = <&gic>;
137 interrupts = <0 70 0x4
138 0 71 0x4
139 0 72 0x4
140 0 73 0x4>;
141 };
21}; 142};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index fe5c6f213271..7f146c6bf756 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -48,6 +48,23 @@
48 <0xf0000100 0x100>; 48 <0xf0000100 0x100>;
49 }; 49 };
50 50
51 irqpin0: irqpin@fe780010 {
52 compatible = "renesas,intc-irqpin";
53 #interrupt-cells = <2>;
54 interrupt-controller;
55 reg = <0xfe78001c 4>,
56 <0xfe780010 4>,
57 <0xfe780024 4>,
58 <0xfe780044 4>,
59 <0xfe780064 4>;
60 interrupt-parent = <&gic>;
61 interrupts = <0 27 0x4
62 0 28 0x4
63 0 29 0x4
64 0 30 0x4>;
65 sense-bitfield-width = <2>;
66 };
67
51 i2c0: i2c@0xffc70000 { 68 i2c0: i2c@0xffc70000 {
52 #address-cells = <1>; 69 #address-cells = <1>;
53 #size-cells = <0>; 70 #size-cells = <0>;
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 7a1711027e41..339d9b11721c 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -36,12 +36,6 @@
36 <0 0xf1004000 0 0x2000>, 36 <0 0xf1004000 0 0x2000>,
37 <0 0xf1006000 0 0x2000>; 37 <0 0xf1006000 0 0x2000>;
38 interrupts = <1 9 0xf04>; 38 interrupts = <1 9 0xf04>;
39
40 gic-cpuif@4 {
41 compatible = "arm,gic-cpuif";
42 cpuif-id = <4>;
43 cpu = <&cpu0>;
44 };
45 }; 39 };
46 40
47 timer { 41 timer {
diff --git a/arch/arm/boot/dts/rk3066a-clocks.dtsi b/arch/arm/boot/dts/rk3066a-clocks.dtsi
new file mode 100644
index 000000000000..6e307fc4c451
--- /dev/null
+++ b/arch/arm/boot/dts/rk3066a-clocks.dtsi
@@ -0,0 +1,299 @@
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
new file mode 100644
index 000000000000..56bfac93d3f6
--- /dev/null
+++ b/arch/arm/boot/dts/rk3066a.dtsi
@@ -0,0 +1,390 @@
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#include <dt-bindings/gpio/gpio.h>
17#include <dt-bindings/interrupt-controller/irq.h>
18#include <dt-bindings/interrupt-controller/arm-gic.h>
19#include <dt-bindings/pinctrl/rockchip.h>
20#include "skeleton.dtsi"
21#include "rk3066a-clocks.dtsi"
22
23/ {
24 compatible = "rockchip,rk3066a";
25 interrupt-parent = <&gic>;
26
27 cpus {
28 #address-cells = <1>;
29 #size-cells = <0>;
30
31 cpu@0 {
32 device_type = "cpu";
33 compatible = "arm,cortex-a9";
34 next-level-cache = <&L2>;
35 reg = <0x0>;
36 };
37 cpu@1 {
38 device_type = "cpu";
39 compatible = "arm,cortex-a9";
40 next-level-cache = <&L2>;
41 reg = <0x1>;
42 };
43 };
44
45 soc {
46 #address-cells = <1>;
47 #size-cells = <1>;
48 compatible = "simple-bus";
49 ranges;
50
51 gic: interrupt-controller@1013d000 {
52 compatible = "arm,cortex-a9-gic";
53 interrupt-controller;
54 #interrupt-cells = <3>;
55 reg = <0x1013d000 0x1000>,
56 <0x1013c100 0x0100>;
57 };
58
59 L2: l2-cache-controller@10138000 {
60 compatible = "arm,pl310-cache";
61 reg = <0x10138000 0x1000>;
62 cache-unified;
63 cache-level = <2>;
64 };
65
66 local-timer@1013c600 {
67 compatible = "arm,cortex-a9-twd-timer";
68 reg = <0x1013c600 0x20>;
69 interrupts = <GIC_PPI 13 0x304>;
70 clocks = <&dummy150m>;
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 = <&clk_gates1 0>, <&clk_gates7 7>;
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 = <&clk_gates1 1>, <&clk_gates7 8>;
86 clock-names = "timer", "pclk";
87 };
88
89 timer@2000e000 {
90 compatible = "snps,dw-apb-timer-osc";
91 reg = <0x2000e000 0x100>;
92 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
93 clocks = <&clk_gates1 2>, <&clk_gates7 9>;
94 clock-names = "timer", "pclk";
95 };
96
97 pinctrl@20008000 {
98 compatible = "rockchip,rk3066a-pinctrl";
99 reg = <0x20008000 0x150>;
100 #address-cells = <1>;
101 #size-cells = <1>;
102 ranges;
103
104 gpio0: gpio0@20034000 {
105 compatible = "rockchip,gpio-bank";
106 reg = <0x20034000 0x100>;
107 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
108 clocks = <&clk_gates8 9>;
109
110 gpio-controller;
111 #gpio-cells = <2>;
112
113 interrupt-controller;
114 #interrupt-cells = <2>;
115 };
116
117 gpio1: gpio1@2003c000 {
118 compatible = "rockchip,gpio-bank";
119 reg = <0x2003c000 0x100>;
120 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
121 clocks = <&clk_gates8 10>;
122
123 gpio-controller;
124 #gpio-cells = <2>;
125
126 interrupt-controller;
127 #interrupt-cells = <2>;
128 };
129
130 gpio2: gpio2@2003e000 {
131 compatible = "rockchip,gpio-bank";
132 reg = <0x2003e000 0x100>;
133 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
134 clocks = <&clk_gates8 11>;
135
136 gpio-controller;
137 #gpio-cells = <2>;
138
139 interrupt-controller;
140 #interrupt-cells = <2>;
141 };
142
143 gpio3: gpio3@20080000 {
144 compatible = "rockchip,gpio-bank";
145 reg = <0x20080000 0x100>;
146 interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
147 clocks = <&clk_gates8 12>;
148
149 gpio-controller;
150 #gpio-cells = <2>;
151
152 interrupt-controller;
153 #interrupt-cells = <2>;
154 };
155
156 gpio4: gpio4@20084000 {
157 compatible = "rockchip,gpio-bank";
158 reg = <0x20084000 0x100>;
159 interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
160 clocks = <&clk_gates8 13>;
161
162 gpio-controller;
163 #gpio-cells = <2>;
164
165 interrupt-controller;
166 #interrupt-cells = <2>;
167 };
168
169 gpio6: gpio6@2000a000 {
170 compatible = "rockchip,gpio-bank";
171 reg = <0x2000a000 0x100>;
172 interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
173 clocks = <&clk_gates8 15>;
174
175 gpio-controller;
176 #gpio-cells = <2>;
177
178 interrupt-controller;
179 #interrupt-cells = <2>;
180 };
181
182 pcfg_pull_default: pcfg_pull_default {
183 bias-pull-pin-default;
184 };
185
186 pcfg_pull_none: pcfg_pull_none {
187 bias-disable;
188 };
189
190 uart0 {
191 uart0_xfer: uart0-xfer {
192 rockchip,pins = <RK_GPIO1 0 RK_FUNC_1 &pcfg_pull_default>,
193 <RK_GPIO1 1 RK_FUNC_1 &pcfg_pull_default>;
194 rockchip,config = <&pcfg_pull_default>;
195 };
196
197 uart0_cts: uart0-cts {
198 rockchip,pins = <RK_GPIO1 2 RK_FUNC_1 &pcfg_pull_default>;
199 rockchip,config = <&pcfg_pull_default>;
200 };
201
202 uart0_rts: uart0-rts {
203 rockchip,pins = <RK_GPIO1 3 RK_FUNC_1 &pcfg_pull_default>;
204 rockchip,config = <&pcfg_pull_default>;
205 };
206 };
207
208 uart1 {
209 uart1_xfer: uart1-xfer {
210 rockchip,pins = <RK_GPIO1 4 RK_FUNC_1 &pcfg_pull_default>,
211 <RK_GPIO1 5 RK_FUNC_1 &pcfg_pull_default>;
212 rockchip,config = <&pcfg_pull_default>;
213 };
214
215 uart1_cts: uart1-cts {
216 rockchip,pins = <RK_GPIO1 6 RK_FUNC_1 &pcfg_pull_default>;
217 rockchip,config = <&pcfg_pull_default>;
218 };
219
220 uart1_rts: uart1-rts {
221 rockchip,pins = <RK_GPIO1 7 RK_FUNC_1 &pcfg_pull_default>;
222 rockchip,config = <&pcfg_pull_default>;
223 };
224 };
225
226 uart2 {
227 uart2_xfer: uart2-xfer {
228 rockchip,pins = <RK_GPIO1 8 RK_FUNC_1 &pcfg_pull_default>,
229 <RK_GPIO1 9 RK_FUNC_1 &pcfg_pull_default>;
230 rockchip,config = <&pcfg_pull_default>;
231 };
232 /* no rts / cts for uart2 */
233 };
234
235 uart3 {
236 uart3_xfer: uart3-xfer {
237 rockchip,pins = <RK_GPIO3 27 RK_FUNC_1 &pcfg_pull_default>,
238 <RK_GPIO3 28 RK_FUNC_1 &pcfg_pull_default>;
239 rockchip,config = <&pcfg_pull_default>;
240 };
241
242 uart3_cts: uart3-cts {
243 rockchip,pins = <RK_GPIO3 29 RK_FUNC_1 &pcfg_pull_default>;
244 rockchip,config = <&pcfg_pull_default>;
245 };
246
247 uart3_rts: uart3-rts {
248 rockchip,pins = <RK_GPIO3 30 RK_FUNC_1 &pcfg_pull_default>;
249 rockchip,config = <&pcfg_pull_default>;
250 };
251 };
252
253 sd0 {
254 sd0_clk: sd0-clk {
255 rockchip,pins = <RK_GPIO3 8 RK_FUNC_1 &pcfg_pull_default>;
256 rockchip,config = <&pcfg_pull_default>;
257 };
258
259 sd0_cmd: sd0-cmd {
260 rockchip,pins = <RK_GPIO3 9 RK_FUNC_1 &pcfg_pull_default>;
261 rockchip,config = <&pcfg_pull_default>;
262 };
263
264 sd0_cd: sd0-cd {
265 rockchip,pins = <RK_GPIO3 14 RK_FUNC_1 &pcfg_pull_default>;
266 rockchip,config = <&pcfg_pull_default>;
267 };
268
269 sd0_wp: sd0-wp {
270 rockchip,pins = <RK_GPIO3 15 RK_FUNC_1 &pcfg_pull_default>;
271 rockchip,config = <&pcfg_pull_default>;
272 };
273
274 sd0_bus1: sd0-bus-width1 {
275 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>;
276 rockchip,config = <&pcfg_pull_default>;
277 };
278
279 sd0_bus4: sd0-bus-width4 {
280 rockchip,pins = <RK_GPIO3 10 RK_FUNC_1 &pcfg_pull_default>,
281 <RK_GPIO3 11 RK_FUNC_1 &pcfg_pull_default>,
282 <RK_GPIO3 12 RK_FUNC_1 &pcfg_pull_default>,
283 <RK_GPIO3 13 RK_FUNC_1 &pcfg_pull_default>;
284 rockchip,config = <&pcfg_pull_default>;
285 };
286 };
287
288 sd1 {
289 sd1_clk: sd1-clk {
290 rockchip,pins = <RK_GPIO3 21 RK_FUNC_1 &pcfg_pull_default>;
291 rockchip,config = <&pcfg_pull_default>;
292 };
293
294 sd1_cmd: sd1-cmd {
295 rockchip,pins = <RK_GPIO3 16 RK_FUNC_1 &pcfg_pull_default>;
296 rockchip,config = <&pcfg_pull_default>;
297 };
298
299 sd1_cd: sd1-cd {
300 rockchip,pins = <RK_GPIO3 22 RK_FUNC_1 &pcfg_pull_default>;
301 rockchip,config = <&pcfg_pull_default>;
302 };
303
304 sd1_wp: sd1-wp {
305 rockchip,pins = <RK_GPIO3 23 RK_FUNC_1 &pcfg_pull_default>;
306 rockchip,config = <&pcfg_pull_default>;
307 };
308
309 sd1_bus1: sd1-bus-width1 {
310 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>;
311 rockchip,config = <&pcfg_pull_default>;
312 };
313
314 sd1_bus4: sd1-bus-width4 {
315 rockchip,pins = <RK_GPIO3 17 RK_FUNC_1 &pcfg_pull_default>,
316 <RK_GPIO3 18 RK_FUNC_1 &pcfg_pull_default>,
317 <RK_GPIO3 19 RK_FUNC_1 &pcfg_pull_default>,
318 <RK_GPIO3 20 RK_FUNC_1 &pcfg_pull_default>;
319 rockchip,config = <&pcfg_pull_default>;
320 };
321 };
322 };
323
324 uart0: serial@10124000 {
325 compatible = "snps,dw-apb-uart";
326 reg = <0x10124000 0x400>;
327 interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
328 reg-shift = <2>;
329 reg-io-width = <1>;
330 clocks = <&clk_gates1 8>;
331 status = "disabled";
332 };
333
334 uart1: serial@10126000 {
335 compatible = "snps,dw-apb-uart";
336 reg = <0x10126000 0x400>;
337 interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
338 reg-shift = <2>;
339 reg-io-width = <1>;
340 clocks = <&clk_gates1 10>;
341 status = "disabled";
342 };
343
344 uart2: serial@20064000 {
345 compatible = "snps,dw-apb-uart";
346 reg = <0x20064000 0x400>;
347 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
348 reg-shift = <2>;
349 reg-io-width = <1>;
350 clocks = <&clk_gates1 12>;
351 status = "disabled";
352 };
353
354 uart3: serial@20068000 {
355 compatible = "snps,dw-apb-uart";
356 reg = <0x20068000 0x400>;
357 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
358 reg-shift = <2>;
359 reg-io-width = <1>;
360 clocks = <&clk_gates1 14>;
361 status = "disabled";
362 };
363
364 dwmmc@10214000 {
365 compatible = "rockchip,rk2928-dw-mshc";
366 reg = <0x10214000 0x1000>;
367 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
368 #address-cells = <1>;
369 #size-cells = <0>;
370
371 clocks = <&clk_gates5 10>, <&clk_gates2 11>;
372 clock-names = "biu", "ciu";
373
374 status = "disabled";
375 };
376
377 dwmmc@10218000 {
378 compatible = "rockchip,rk2928-dw-mshc";
379 reg = <0x10218000 0x1000>;
380 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
381 #address-cells = <1>;
382 #size-cells = <0>;
383
384 clocks = <&clk_gates5 11>, <&clk_gates2 13>;
385 clock-names = "biu", "ciu";
386
387 status = "disabled";
388 };
389 };
390};
diff --git a/arch/arm/boot/dts/s3c2416-pinctrl.dtsi b/arch/arm/boot/dts/s3c2416-pinctrl.dtsi
new file mode 100644
index 000000000000..527e3193817f
--- /dev/null
+++ b/arch/arm/boot/dts/s3c2416-pinctrl.dtsi
@@ -0,0 +1,173 @@
1/*
2 * Samsung S3C2416 pinctrl settings
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.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&pinctrl_0 {
12 /*
13 * Pin banks
14 */
15
16 gpa: gpa {
17 gpio-controller;
18 #gpio-cells = <2>;
19 };
20
21 gpb: gpb {
22 gpio-controller;
23 #gpio-cells = <2>;
24 };
25
26 gpc: gpc {
27 gpio-controller;
28 #gpio-cells = <2>;
29 };
30
31 gpd: gpd {
32 gpio-controller;
33 #gpio-cells = <2>;
34 };
35
36 gpe: gpe {
37 gpio-controller;
38 #gpio-cells = <2>;
39 };
40
41 gpf: gpf {
42 gpio-controller;
43 #gpio-cells = <2>;
44 interrupt-controller;
45 #interrupt-cells = <2>;
46 };
47
48 gpg: gpg {
49 gpio-controller;
50 #gpio-cells = <2>;
51 interrupt-controller;
52 #interrupt-cells = <2>;
53 };
54
55 gph: gph {
56 gpio-controller;
57 #gpio-cells = <2>;
58 };
59
60 gpj: gpj {
61 gpio-controller;
62 #gpio-cells = <2>;
63 };
64
65 gpk: gpk {
66 gpio-controller;
67 #gpio-cells = <2>;
68 };
69
70 gpl: gpl {
71 gpio-controller;
72 #gpio-cells = <2>;
73 };
74
75 gpm: gpm {
76 gpio-controller;
77 #gpio-cells = <2>;
78 };
79
80 /*
81 * Pin groups
82 */
83
84 uart0_data: uart0-data {
85 samsung,pins = "gph-0", "gph-1";
86 samsung,pin-function = <2>;
87 };
88
89 uart0_fctl: uart0-fctl {
90 samsung,pins = "gph-8", "gph-9";
91 samsung,pin-function = <2>;
92 };
93
94 uart1_data: uart1-data {
95 samsung,pins = "gph-2", "gph-3";
96 samsung,pin-function = <2>;
97 };
98
99 uart1_fctl: uart1-fctl {
100 samsung,pins = "gph-10", "gph-11";
101 samsung,pin-function = <2>;
102 };
103
104 uart2_data: uart2-data {
105 samsung,pins = "gph-4", "gph-5";
106 samsung,pin-function = <2>;
107 };
108
109 uart2_fctl: uart2-fctl {
110 samsung,pins = "gph-6", "gph-7";
111 samsung,pin-function = <2>;
112 };
113
114 uart3_data: uart3-data {
115 samsung,pins = "gph-6", "gph-7";
116 samsung,pin-function = <2>;
117 };
118
119 extuart_clk: extuart-clk {
120 samsung,pins = "gph-12";
121 samsung,pin-function = <2>;
122 };
123
124 i2c0_bus: i2c0-bus {
125 samsung,pins = "gpe-14", "gpe-15";
126 samsung,pin-function = <2>;
127 };
128
129 spi0_bus: spi0-bus {
130 samsung,pins = "gpe-11", "gpe-12", "gpe-13";
131 samsung,pin-function = <2>;
132 };
133
134 sd0_clk: sd0-clk {
135 samsung,pins = "gpe-5";
136 samsung,pin-function = <2>;
137 };
138
139 sd0_cmd: sd0-cmd {
140 samsung,pins = "gpe-6";
141 samsung,pin-function = <2>;
142 };
143
144 sd0_bus1: sd0-bus1 {
145 samsung,pins = "gpe-7";
146 samsung,pin-function = <2>;
147 };
148
149 sd0_bus4: sd0-bus4 {
150 samsung,pins = "gpe-8", "gpe-9", "gpe-10";
151 samsung,pin-function = <2>;
152 };
153
154 sd1_cmd: sd1-cmd {
155 samsung,pins = "gpl-8";
156 samsung,pin-function = <2>;
157 };
158
159 sd1_clk: sd1-clk {
160 samsung,pins = "gpl-9";
161 samsung,pin-function = <2>;
162 };
163
164 sd1_bus1: sd1-bus1 {
165 samsung,pins = "gpl-0";
166 samsung,pin-function = <2>;
167 };
168
169 sd1_bus4: sd1-bus4 {
170 samsung,pins = "gpl-1", "gpl-2", "gpl-3";
171 samsung,pin-function = <2>;
172 };
173};
diff --git a/arch/arm/boot/dts/s3c2416-smdk2416.dts b/arch/arm/boot/dts/s3c2416-smdk2416.dts
new file mode 100644
index 000000000000..59594cf15998
--- /dev/null
+++ b/arch/arm/boot/dts/s3c2416-smdk2416.dts
@@ -0,0 +1,72 @@
1/*
2 * SAMSUNG SMDK2416 board device tree source
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.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 "s3c2416.dtsi"
13
14/ {
15 model = "SMDK2416";
16 compatible = "samsung,s3c2416";
17
18 memory {
19 reg = <0x30000000 0x4000000>;
20 };
21
22 serial@50000000 {
23 status = "okay";
24 pinctrl-names = "default";
25 pinctrl-0 = <&uart0_data>, <&uart0_fctl>;
26 };
27
28 serial@50004000 {
29 status = "okay";
30 pinctrl-names = "default";
31 pinctrl-0 = <&uart1_data>, <&uart1_fctl>;
32 };
33
34 serial@50008000 {
35 status = "okay";
36 pinctrl-names = "default";
37 pinctrl-0 = <&uart2_data>;
38 };
39
40 serial@5000C000 {
41 status = "okay";
42 pinctrl-names = "default";
43 pinctrl-0 = <&uart3_data>;
44 };
45
46 watchdog@53000000 {
47 status = "okay";
48 };
49
50 rtc@57000000 {
51 status = "okay";
52 };
53
54 sdhci@4AC00000 {
55 pinctrl-names = "default";
56 pinctrl-0 = <&sd0_clk>, <&sd0_cmd>,
57 <&sd0_bus1>, <&sd0_bus4>;
58 bus-width = <4>;
59 cd-gpios = <&gpf 1 0>;
60 cd-inverted;
61 status = "okay";
62 };
63
64 sdhci@4A800000 {
65 pinctrl-names = "default";
66 pinctrl-0 = <&sd1_clk>, <&sd1_cmd>,
67 <&sd1_bus1>, <&sd1_bus4>;
68 bus-width = <4>;
69 broken-cd;
70 status = "okay";
71 };
72};
diff --git a/arch/arm/boot/dts/s3c2416.dtsi b/arch/arm/boot/dts/s3c2416.dtsi
new file mode 100644
index 000000000000..e6555bdd81b8
--- /dev/null
+++ b/arch/arm/boot/dts/s3c2416.dtsi
@@ -0,0 +1,79 @@
1/*
2 * Samsung's S3C2416 SoC device tree source
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.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#include "s3c24xx.dtsi"
12#include "s3c2416-pinctrl.dtsi"
13
14/ {
15 model = "Samsung S3C2416 SoC";
16 compatible = "samsung,s3c2416";
17
18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
21
22 cpu {
23 compatible = "arm,arm926ejs";
24 };
25 };
26
27 interrupt-controller@4a000000 {
28 compatible = "samsung,s3c2416-irq";
29 };
30
31 pinctrl@56000000 {
32 compatible = "samsung,s3c2416-pinctrl";
33 };
34
35 serial@50000000 {
36 compatible = "samsung,s3c2440-uart";
37 };
38
39 serial@50004000 {
40 compatible = "samsung,s3c2440-uart";
41 };
42
43 serial@50008000 {
44 compatible = "samsung,s3c2440-uart";
45 };
46
47 serial@5000C000 {
48 compatible = "samsung,s3c2440-uart";
49 reg = <0x5000C000 0x4000>;
50 interrupts = <1 18 24 4>, <1 18 25 4>;
51 status = "disabled";
52 };
53
54 sdhci@4AC00000 {
55 compatible = "samsung,s3c6410-sdhci";
56 reg = <0x4AC00000 0x100>;
57 interrupts = <0 0 21 3>;
58 status = "disabled";
59 };
60
61 sdhci@4A800000 {
62 compatible = "samsung,s3c6410-sdhci";
63 reg = <0x4A800000 0x100>;
64 interrupts = <0 0 20 3>;
65 status = "disabled";
66 };
67
68 watchdog@53000000 {
69 interrupts = <1 9 27 3>;
70 };
71
72 rtc@57000000 {
73 compatible = "samsung,s3c2416-rtc";
74 };
75
76 i2c@54000000 {
77 compatible = "samsung,s3c2440-i2c";
78 };
79};
diff --git a/arch/arm/boot/dts/s3c24xx.dtsi b/arch/arm/boot/dts/s3c24xx.dtsi
new file mode 100644
index 000000000000..2d1d7dc9418a
--- /dev/null
+++ b/arch/arm/boot/dts/s3c24xx.dtsi
@@ -0,0 +1,92 @@
1/*
2 * Samsung's S3C24XX family device tree source
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.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#include "skeleton.dtsi"
12
13/ {
14 compatible = "samsung,s3c24xx";
15 interrupt-parent = <&intc>;
16
17 aliases {
18 pinctrl0 = &pinctrl_0;
19 };
20
21 intc:interrupt-controller@4a000000 {
22 compatible = "samsung,s3c2410-irq";
23 reg = <0x4a000000 0x100>;
24 interrupt-controller;
25 #interrupt-cells = <4>;
26 };
27
28 pinctrl_0: pinctrl@56000000 {
29 reg = <0x56000000 0x1000>;
30
31 wakeup-interrupt-controller {
32 compatible = "samsung,s3c2410-wakeup-eint";
33 interrupts = <0 0 0 3>,
34 <0 0 1 3>,
35 <0 0 2 3>,
36 <0 0 3 3>,
37 <0 0 4 4>,
38 <0 0 5 4>;
39 };
40 };
41
42 timer@51000000 {
43 compatible = "samsung,s3c2410-pwm";
44 reg = <0x51000000 0x1000>;
45 interrupts = <0 0 10 3>, <0 0 11 3>, <0 0 12 3>, <0 0 13 3>, <0 0 14 3>;
46 #pwm-cells = <4>;
47 };
48
49 serial@50000000 {
50 compatible = "samsung,s3c2410-uart";
51 reg = <0x50000000 0x4000>;
52 interrupts = <1 28 0 4>, <1 28 1 4>;
53 status = "disabled";
54 };
55
56 serial@50004000 {
57 compatible = "samsung,s3c2410-uart";
58 reg = <0x50004000 0x4000>;
59 interrupts = <1 23 3 4>, <1 23 4 4>;
60 status = "disabled";
61 };
62
63 serial@50008000 {
64 compatible = "samsung,s3c2410-uart";
65 reg = <0x50008000 0x4000>;
66 interrupts = <1 15 6 4>, <1 15 7 4>;
67 status = "disabled";
68 };
69
70 watchdog@53000000 {
71 compatible = "samsung,s3c2410-wdt";
72 reg = <0x53000000 0x100>;
73 interrupts = <0 0 9 3>;
74 status = "disabled";
75 };
76
77 rtc@57000000 {
78 compatible = "samsung,s3c2410-rtc";
79 reg = <0x57000000 0x100>;
80 interrupts = <0 0 30 3>, <0 0 8 3>;
81 status = "disabled";
82 };
83
84 i2c@54000000 {
85 compatible = "samsung,s3c2410-i2c";
86 reg = <0x54000000 0x100>;
87 interrupts = <0 0 27 3>;
88 #address-cells = <1>;
89 #size-cells = <0>;
90 status = "disabled";
91 };
92};
diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5000e0d42849..a1d5e25a6698 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -8,7 +8,11 @@
8 * Licensed under GPLv2 or later. 8 * Licensed under GPLv2 or later.
9 */ 9 */
10 10
11/include/ "skeleton.dtsi" 11#include "skeleton.dtsi"
12#include <dt-bindings/dma/at91.h>
13#include <dt-bindings/pinctrl/at91.h>
14#include <dt-bindings/interrupt-controller/irq.h>
15#include <dt-bindings/gpio/gpio.h>
12 16
13/ { 17/ {
14 model = "Atmel SAMA5D3 family SoC"; 18 model = "Atmel SAMA5D3 family SoC";
@@ -35,8 +39,12 @@
35 ssc1 = &ssc1; 39 ssc1 = &ssc1;
36 }; 40 };
37 cpus { 41 cpus {
42 #address-cells = <1>;
43 #size-cells = <0>;
38 cpu@0 { 44 cpu@0 {
45 device_type = "cpu";
39 compatible = "arm,cortex-a5"; 46 compatible = "arm,cortex-a5";
47 reg = <0x0>;
40 }; 48 };
41 }; 49 };
42 50
@@ -59,8 +67,8 @@
59 mmc0: mmc@f0000000 { 67 mmc0: mmc@f0000000 {
60 compatible = "atmel,hsmci"; 68 compatible = "atmel,hsmci";
61 reg = <0xf0000000 0x600>; 69 reg = <0xf0000000 0x600>;
62 interrupts = <21 4 0>; 70 interrupts = <21 IRQ_TYPE_LEVEL_HIGH 0>;
63 dmas = <&dma0 2 0>; 71 dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(0)>;
64 dma-names = "rxtx"; 72 dma-names = "rxtx";
65 pinctrl-names = "default"; 73 pinctrl-names = "default";
66 pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7>; 74 pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3 &pinctrl_mmc0_dat4_7>;
@@ -72,9 +80,12 @@
72 spi0: spi@f0004000 { 80 spi0: spi@f0004000 {
73 #address-cells = <1>; 81 #address-cells = <1>;
74 #size-cells = <0>; 82 #size-cells = <0>;
75 compatible = "atmel,at91sam9x5-spi"; 83 compatible = "atmel,at91rm9200-spi";
76 reg = <0xf0004000 0x100>; 84 reg = <0xf0004000 0x100>;
77 interrupts = <24 4 3>; 85 interrupts = <24 IRQ_TYPE_LEVEL_HIGH 3>;
86 dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(1)>,
87 <&dma0 2 AT91_DMA_CFG_PER_ID(2)>;
88 dma-names = "tx", "rx";
78 pinctrl-names = "default"; 89 pinctrl-names = "default";
79 pinctrl-0 = <&pinctrl_spi0>; 90 pinctrl-0 = <&pinctrl_spi0>;
80 status = "disabled"; 91 status = "disabled";
@@ -83,7 +94,7 @@
83 ssc0: ssc@f0008000 { 94 ssc0: ssc@f0008000 {
84 compatible = "atmel,at91sam9g45-ssc"; 95 compatible = "atmel,at91sam9g45-ssc";
85 reg = <0xf0008000 0x4000>; 96 reg = <0xf0008000 0x4000>;
86 interrupts = <38 4 4>; 97 interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>;
87 pinctrl-names = "default"; 98 pinctrl-names = "default";
88 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 99 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
89 status = "disabled"; 100 status = "disabled";
@@ -92,7 +103,7 @@
92 can0: can@f000c000 { 103 can0: can@f000c000 {
93 compatible = "atmel,at91sam9x5-can"; 104 compatible = "atmel,at91sam9x5-can";
94 reg = <0xf000c000 0x300>; 105 reg = <0xf000c000 0x300>;
95 interrupts = <40 4 3>; 106 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>;
96 pinctrl-names = "default"; 107 pinctrl-names = "default";
97 pinctrl-0 = <&pinctrl_can0_rx_tx>; 108 pinctrl-0 = <&pinctrl_can0_rx_tx>;
98 status = "disabled"; 109 status = "disabled";
@@ -101,15 +112,15 @@
101 tcb0: timer@f0010000 { 112 tcb0: timer@f0010000 {
102 compatible = "atmel,at91sam9x5-tcb"; 113 compatible = "atmel,at91sam9x5-tcb";
103 reg = <0xf0010000 0x100>; 114 reg = <0xf0010000 0x100>;
104 interrupts = <26 4 0>; 115 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>;
105 }; 116 };
106 117
107 i2c0: i2c@f0014000 { 118 i2c0: i2c@f0014000 {
108 compatible = "atmel,at91sam9x5-i2c"; 119 compatible = "atmel,at91sam9x5-i2c";
109 reg = <0xf0014000 0x4000>; 120 reg = <0xf0014000 0x4000>;
110 interrupts = <18 4 6>; 121 interrupts = <18 IRQ_TYPE_LEVEL_HIGH 6>;
111 dmas = <&dma0 2 7>, 122 dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(7)>,
112 <&dma0 2 8>; 123 <&dma0 2 AT91_DMA_CFG_PER_ID(8)>;
113 dma-names = "tx", "rx"; 124 dma-names = "tx", "rx";
114 pinctrl-names = "default"; 125 pinctrl-names = "default";
115 pinctrl-0 = <&pinctrl_i2c0>; 126 pinctrl-0 = <&pinctrl_i2c0>;
@@ -121,9 +132,9 @@
121 i2c1: i2c@f0018000 { 132 i2c1: i2c@f0018000 {
122 compatible = "atmel,at91sam9x5-i2c"; 133 compatible = "atmel,at91sam9x5-i2c";
123 reg = <0xf0018000 0x4000>; 134 reg = <0xf0018000 0x4000>;
124 interrupts = <19 4 6>; 135 interrupts = <19 IRQ_TYPE_LEVEL_HIGH 6>;
125 dmas = <&dma0 2 9>, 136 dmas = <&dma0 2 AT91_DMA_CFG_PER_ID(9)>,
126 <&dma0 2 10>; 137 <&dma0 2 AT91_DMA_CFG_PER_ID(10)>;
127 dma-names = "tx", "rx"; 138 dma-names = "tx", "rx";
128 pinctrl-names = "default"; 139 pinctrl-names = "default";
129 pinctrl-0 = <&pinctrl_i2c1>; 140 pinctrl-0 = <&pinctrl_i2c1>;
@@ -135,7 +146,7 @@
135 usart0: serial@f001c000 { 146 usart0: serial@f001c000 {
136 compatible = "atmel,at91sam9260-usart"; 147 compatible = "atmel,at91sam9260-usart";
137 reg = <0xf001c000 0x100>; 148 reg = <0xf001c000 0x100>;
138 interrupts = <12 4 5>; 149 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
139 pinctrl-names = "default"; 150 pinctrl-names = "default";
140 pinctrl-0 = <&pinctrl_usart0>; 151 pinctrl-0 = <&pinctrl_usart0>;
141 status = "disabled"; 152 status = "disabled";
@@ -144,7 +155,7 @@
144 usart1: serial@f0020000 { 155 usart1: serial@f0020000 {
145 compatible = "atmel,at91sam9260-usart"; 156 compatible = "atmel,at91sam9260-usart";
146 reg = <0xf0020000 0x100>; 157 reg = <0xf0020000 0x100>;
147 interrupts = <13 4 5>; 158 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>;
148 pinctrl-names = "default"; 159 pinctrl-names = "default";
149 pinctrl-0 = <&pinctrl_usart1>; 160 pinctrl-0 = <&pinctrl_usart1>;
150 status = "disabled"; 161 status = "disabled";
@@ -153,7 +164,7 @@
153 macb0: ethernet@f0028000 { 164 macb0: ethernet@f0028000 {
154 compatible = "cdns,pc302-gem", "cdns,gem"; 165 compatible = "cdns,pc302-gem", "cdns,gem";
155 reg = <0xf0028000 0x100>; 166 reg = <0xf0028000 0x100>;
156 interrupts = <34 4 3>; 167 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>;
157 pinctrl-names = "default"; 168 pinctrl-names = "default";
158 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>; 169 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>;
159 status = "disabled"; 170 status = "disabled";
@@ -162,15 +173,15 @@
162 isi: isi@f0034000 { 173 isi: isi@f0034000 {
163 compatible = "atmel,at91sam9g45-isi"; 174 compatible = "atmel,at91sam9g45-isi";
164 reg = <0xf0034000 0x4000>; 175 reg = <0xf0034000 0x4000>;
165 interrupts = <37 4 5>; 176 interrupts = <37 IRQ_TYPE_LEVEL_HIGH 5>;
166 status = "disabled"; 177 status = "disabled";
167 }; 178 };
168 179
169 mmc1: mmc@f8000000 { 180 mmc1: mmc@f8000000 {
170 compatible = "atmel,hsmci"; 181 compatible = "atmel,hsmci";
171 reg = <0xf8000000 0x600>; 182 reg = <0xf8000000 0x600>;
172 interrupts = <22 4 0>; 183 interrupts = <22 IRQ_TYPE_LEVEL_HIGH 0>;
173 dmas = <&dma1 2 0>; 184 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(0)>;
174 dma-names = "rxtx"; 185 dma-names = "rxtx";
175 pinctrl-names = "default"; 186 pinctrl-names = "default";
176 pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>; 187 pinctrl-0 = <&pinctrl_mmc1_clk_cmd_dat0 &pinctrl_mmc1_dat1_3>;
@@ -182,8 +193,8 @@
182 mmc2: mmc@f8004000 { 193 mmc2: mmc@f8004000 {
183 compatible = "atmel,hsmci"; 194 compatible = "atmel,hsmci";
184 reg = <0xf8004000 0x600>; 195 reg = <0xf8004000 0x600>;
185 interrupts = <23 4 0>; 196 interrupts = <23 IRQ_TYPE_LEVEL_HIGH 0>;
186 dmas = <&dma1 2 1>; 197 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(1)>;
187 dma-names = "rxtx"; 198 dma-names = "rxtx";
188 pinctrl-names = "default"; 199 pinctrl-names = "default";
189 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>; 200 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>;
@@ -195,9 +206,12 @@
195 spi1: spi@f8008000 { 206 spi1: spi@f8008000 {
196 #address-cells = <1>; 207 #address-cells = <1>;
197 #size-cells = <0>; 208 #size-cells = <0>;
198 compatible = "atmel,at91sam9x5-spi"; 209 compatible = "atmel,at91rm9200-spi";
199 reg = <0xf8008000 0x100>; 210 reg = <0xf8008000 0x100>;
200 interrupts = <25 4 3>; 211 interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>;
212 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(15)>,
213 <&dma1 2 AT91_DMA_CFG_PER_ID(16)>;
214 dma-names = "tx", "rx";
201 pinctrl-names = "default"; 215 pinctrl-names = "default";
202 pinctrl-0 = <&pinctrl_spi1>; 216 pinctrl-0 = <&pinctrl_spi1>;
203 status = "disabled"; 217 status = "disabled";
@@ -206,7 +220,7 @@
206 ssc1: ssc@f800c000 { 220 ssc1: ssc@f800c000 {
207 compatible = "atmel,at91sam9g45-ssc"; 221 compatible = "atmel,at91sam9g45-ssc";
208 reg = <0xf800c000 0x4000>; 222 reg = <0xf800c000 0x4000>;
209 interrupts = <39 4 4>; 223 interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>;
210 pinctrl-names = "default"; 224 pinctrl-names = "default";
211 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 225 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
212 status = "disabled"; 226 status = "disabled";
@@ -215,7 +229,7 @@
215 can1: can@f8010000 { 229 can1: can@f8010000 {
216 compatible = "atmel,at91sam9x5-can"; 230 compatible = "atmel,at91sam9x5-can";
217 reg = <0xf8010000 0x300>; 231 reg = <0xf8010000 0x300>;
218 interrupts = <41 4 3>; 232 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>;
219 pinctrl-names = "default"; 233 pinctrl-names = "default";
220 pinctrl-0 = <&pinctrl_can1_rx_tx>; 234 pinctrl-0 = <&pinctrl_can1_rx_tx>;
221 }; 235 };
@@ -223,13 +237,13 @@
223 tcb1: timer@f8014000 { 237 tcb1: timer@f8014000 {
224 compatible = "atmel,at91sam9x5-tcb"; 238 compatible = "atmel,at91sam9x5-tcb";
225 reg = <0xf8014000 0x100>; 239 reg = <0xf8014000 0x100>;
226 interrupts = <27 4 0>; 240 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>;
227 }; 241 };
228 242
229 adc0: adc@f8018000 { 243 adc0: adc@f8018000 {
230 compatible = "atmel,at91sam9260-adc"; 244 compatible = "atmel,at91sam9260-adc";
231 reg = <0xf8018000 0x100>; 245 reg = <0xf8018000 0x100>;
232 interrupts = <29 4 5>; 246 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 5>;
233 pinctrl-names = "default"; 247 pinctrl-names = "default";
234 pinctrl-0 = < 248 pinctrl-0 = <
235 &pinctrl_adc0_adtrg 249 &pinctrl_adc0_adtrg
@@ -283,7 +297,7 @@
283 tsadcc: tsadcc@f8018000 { 297 tsadcc: tsadcc@f8018000 {
284 compatible = "atmel,at91sam9x5-tsadcc"; 298 compatible = "atmel,at91sam9x5-tsadcc";
285 reg = <0xf8018000 0x4000>; 299 reg = <0xf8018000 0x4000>;
286 interrupts = <29 4 5>; 300 interrupts = <29 IRQ_TYPE_LEVEL_HIGH 5>;
287 atmel,tsadcc_clock = <300000>; 301 atmel,tsadcc_clock = <300000>;
288 atmel,filtering_average = <0x03>; 302 atmel,filtering_average = <0x03>;
289 atmel,pendet_debounce = <0x08>; 303 atmel,pendet_debounce = <0x08>;
@@ -295,9 +309,9 @@
295 i2c2: i2c@f801c000 { 309 i2c2: i2c@f801c000 {
296 compatible = "atmel,at91sam9x5-i2c"; 310 compatible = "atmel,at91sam9x5-i2c";
297 reg = <0xf801c000 0x4000>; 311 reg = <0xf801c000 0x4000>;
298 interrupts = <20 4 6>; 312 interrupts = <20 IRQ_TYPE_LEVEL_HIGH 6>;
299 dmas = <&dma1 2 11>, 313 dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(11)>,
300 <&dma1 2 12>; 314 <&dma1 2 AT91_DMA_CFG_PER_ID(12)>;
301 dma-names = "tx", "rx"; 315 dma-names = "tx", "rx";
302 #address-cells = <1>; 316 #address-cells = <1>;
303 #size-cells = <0>; 317 #size-cells = <0>;
@@ -307,7 +321,7 @@
307 usart2: serial@f8020000 { 321 usart2: serial@f8020000 {
308 compatible = "atmel,at91sam9260-usart"; 322 compatible = "atmel,at91sam9260-usart";
309 reg = <0xf8020000 0x100>; 323 reg = <0xf8020000 0x100>;
310 interrupts = <14 4 5>; 324 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>;
311 pinctrl-names = "default"; 325 pinctrl-names = "default";
312 pinctrl-0 = <&pinctrl_usart2>; 326 pinctrl-0 = <&pinctrl_usart2>;
313 status = "disabled"; 327 status = "disabled";
@@ -316,7 +330,7 @@
316 usart3: serial@f8024000 { 330 usart3: serial@f8024000 {
317 compatible = "atmel,at91sam9260-usart"; 331 compatible = "atmel,at91sam9260-usart";
318 reg = <0xf8024000 0x100>; 332 reg = <0xf8024000 0x100>;
319 interrupts = <15 4 5>; 333 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>;
320 pinctrl-names = "default"; 334 pinctrl-names = "default";
321 pinctrl-0 = <&pinctrl_usart3>; 335 pinctrl-0 = <&pinctrl_usart3>;
322 status = "disabled"; 336 status = "disabled";
@@ -325,7 +339,7 @@
325 macb1: ethernet@f802c000 { 339 macb1: ethernet@f802c000 {
326 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 340 compatible = "cdns,at32ap7000-macb", "cdns,macb";
327 reg = <0xf802c000 0x100>; 341 reg = <0xf802c000 0x100>;
328 interrupts = <35 4 3>; 342 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>;
329 pinctrl-names = "default"; 343 pinctrl-names = "default";
330 pinctrl-0 = <&pinctrl_macb1_rmii>; 344 pinctrl-0 = <&pinctrl_macb1_rmii>;
331 status = "disabled"; 345 status = "disabled";
@@ -334,7 +348,7 @@
334 sha@f8034000 { 348 sha@f8034000 {
335 compatible = "atmel,sam9g46-sha"; 349 compatible = "atmel,sam9g46-sha";
336 reg = <0xf8034000 0x100>; 350 reg = <0xf8034000 0x100>;
337 interrupts = <42 4 0>; 351 interrupts = <42 IRQ_TYPE_LEVEL_HIGH 0>;
338 }; 352 };
339 353
340 aes@f8038000 { 354 aes@f8038000 {
@@ -346,20 +360,20 @@
346 tdes@f803c000 { 360 tdes@f803c000 {
347 compatible = "atmel,sam9g46-tdes"; 361 compatible = "atmel,sam9g46-tdes";
348 reg = <0xf803c000 0x100>; 362 reg = <0xf803c000 0x100>;
349 interrupts = <44 4 0>; 363 interrupts = <44 IRQ_TYPE_LEVEL_HIGH 0>;
350 }; 364 };
351 365
352 dma0: dma-controller@ffffe600 { 366 dma0: dma-controller@ffffe600 {
353 compatible = "atmel,at91sam9g45-dma"; 367 compatible = "atmel,at91sam9g45-dma";
354 reg = <0xffffe600 0x200>; 368 reg = <0xffffe600 0x200>;
355 interrupts = <30 4 0>; 369 interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>;
356 #dma-cells = <2>; 370 #dma-cells = <2>;
357 }; 371 };
358 372
359 dma1: dma-controller@ffffe800 { 373 dma1: dma-controller@ffffe800 {
360 compatible = "atmel,at91sam9g45-dma"; 374 compatible = "atmel,at91sam9g45-dma";
361 reg = <0xffffe800 0x200>; 375 reg = <0xffffe800 0x200>;
362 interrupts = <31 4 0>; 376 interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>;
363 #dma-cells = <2>; 377 #dma-cells = <2>;
364 }; 378 };
365 379
@@ -371,7 +385,7 @@
371 dbgu: serial@ffffee00 { 385 dbgu: serial@ffffee00 {
372 compatible = "atmel,at91sam9260-usart"; 386 compatible = "atmel,at91sam9260-usart";
373 reg = <0xffffee00 0x200>; 387 reg = <0xffffee00 0x200>;
374 interrupts = <2 4 7>; 388 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>;
375 pinctrl-names = "default"; 389 pinctrl-names = "default";
376 pinctrl-0 = <&pinctrl_dbgu>; 390 pinctrl-0 = <&pinctrl_dbgu>;
377 status = "disabled"; 391 status = "disabled";
@@ -403,202 +417,202 @@
403 adc0 { 417 adc0 {
404 pinctrl_adc0_adtrg: adc0_adtrg { 418 pinctrl_adc0_adtrg: adc0_adtrg {
405 atmel,pins = 419 atmel,pins =
406 <3 19 0x1 0x0>; /* PD19 periph A ADTRG */ 420 <AT91_PIOD 19 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD19 periph A ADTRG */
407 }; 421 };
408 pinctrl_adc0_ad0: adc0_ad0 { 422 pinctrl_adc0_ad0: adc0_ad0 {
409 atmel,pins = 423 atmel,pins =
410 <3 20 0x1 0x0>; /* PD20 periph A AD0 */ 424 <AT91_PIOD 20 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD20 periph A AD0 */
411 }; 425 };
412 pinctrl_adc0_ad1: adc0_ad1 { 426 pinctrl_adc0_ad1: adc0_ad1 {
413 atmel,pins = 427 atmel,pins =
414 <3 21 0x1 0x0>; /* PD21 periph A AD1 */ 428 <AT91_PIOD 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD21 periph A AD1 */
415 }; 429 };
416 pinctrl_adc0_ad2: adc0_ad2 { 430 pinctrl_adc0_ad2: adc0_ad2 {
417 atmel,pins = 431 atmel,pins =
418 <3 22 0x1 0x0>; /* PD22 periph A AD2 */ 432 <AT91_PIOD 22 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD22 periph A AD2 */
419 }; 433 };
420 pinctrl_adc0_ad3: adc0_ad3 { 434 pinctrl_adc0_ad3: adc0_ad3 {
421 atmel,pins = 435 atmel,pins =
422 <3 23 0x1 0x0>; /* PD23 periph A AD3 */ 436 <AT91_PIOD 23 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD23 periph A AD3 */
423 }; 437 };
424 pinctrl_adc0_ad4: adc0_ad4 { 438 pinctrl_adc0_ad4: adc0_ad4 {
425 atmel,pins = 439 atmel,pins =
426 <3 24 0x1 0x0>; /* PD24 periph A AD4 */ 440 <AT91_PIOD 24 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD24 periph A AD4 */
427 }; 441 };
428 pinctrl_adc0_ad5: adc0_ad5 { 442 pinctrl_adc0_ad5: adc0_ad5 {
429 atmel,pins = 443 atmel,pins =
430 <3 25 0x1 0x0>; /* PD25 periph A AD5 */ 444 <AT91_PIOD 25 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD25 periph A AD5 */
431 }; 445 };
432 pinctrl_adc0_ad6: adc0_ad6 { 446 pinctrl_adc0_ad6: adc0_ad6 {
433 atmel,pins = 447 atmel,pins =
434 <3 26 0x1 0x0>; /* PD26 periph A AD6 */ 448 <AT91_PIOD 26 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD26 periph A AD6 */
435 }; 449 };
436 pinctrl_adc0_ad7: adc0_ad7 { 450 pinctrl_adc0_ad7: adc0_ad7 {
437 atmel,pins = 451 atmel,pins =
438 <3 27 0x1 0x0>; /* PD27 periph A AD7 */ 452 <AT91_PIOD 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD27 periph A AD7 */
439 }; 453 };
440 pinctrl_adc0_ad8: adc0_ad8 { 454 pinctrl_adc0_ad8: adc0_ad8 {
441 atmel,pins = 455 atmel,pins =
442 <3 28 0x1 0x0>; /* PD28 periph A AD8 */ 456 <AT91_PIOD 28 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD28 periph A AD8 */
443 }; 457 };
444 pinctrl_adc0_ad9: adc0_ad9 { 458 pinctrl_adc0_ad9: adc0_ad9 {
445 atmel,pins = 459 atmel,pins =
446 <3 29 0x1 0x0>; /* PD29 periph A AD9 */ 460 <AT91_PIOD 29 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD29 periph A AD9 */
447 }; 461 };
448 pinctrl_adc0_ad10: adc0_ad10 { 462 pinctrl_adc0_ad10: adc0_ad10 {
449 atmel,pins = 463 atmel,pins =
450 <3 30 0x1 0x0>; /* PD30 periph A AD10, conflicts with PCK0 */ 464 <AT91_PIOD 30 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD30 periph A AD10, conflicts with PCK0 */
451 }; 465 };
452 pinctrl_adc0_ad11: adc0_ad11 { 466 pinctrl_adc0_ad11: adc0_ad11 {
453 atmel,pins = 467 atmel,pins =
454 <3 31 0x1 0x0>; /* PD31 periph A AD11, conflicts with PCK1 */ 468 <AT91_PIOD 31 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD31 periph A AD11, conflicts with PCK1 */
455 }; 469 };
456 }; 470 };
457 471
458 can0 { 472 can0 {
459 pinctrl_can0_rx_tx: can0_rx_tx { 473 pinctrl_can0_rx_tx: can0_rx_tx {
460 atmel,pins = 474 atmel,pins =
461 <3 14 0x3 0x0 /* PD14 periph C RX, conflicts with SCK0, SPI0_NPCS1 */ 475 <AT91_PIOD 14 AT91_PERIPH_C AT91_PINCTRL_NONE /* PD14 periph C RX, conflicts with SCK0, SPI0_NPCS1 */
462 3 15 0x3 0x0>; /* PD15 periph C TX, conflicts with CTS0, SPI0_NPCS2 */ 476 AT91_PIOD 15 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PD15 periph C TX, conflicts with CTS0, SPI0_NPCS2 */
463 }; 477 };
464 }; 478 };
465 479
466 can1 { 480 can1 {
467 pinctrl_can1_rx_tx: can1_rx_tx { 481 pinctrl_can1_rx_tx: can1_rx_tx {
468 atmel,pins = 482 atmel,pins =
469 <1 14 0x2 0x0 /* PB14 periph B RX, conflicts with GCRS */ 483 <AT91_PIOB 14 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB14 periph B RX, conflicts with GCRS */
470 1 15 0x2 0x0>; /* PB15 periph B TX, conflicts with GCOL */ 484 AT91_PIOB 15 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB15 periph B TX, conflicts with GCOL */
471 }; 485 };
472 }; 486 };
473 487
474 dbgu { 488 dbgu {
475 pinctrl_dbgu: dbgu-0 { 489 pinctrl_dbgu: dbgu-0 {
476 atmel,pins = 490 atmel,pins =
477 <1 30 0x1 0x0 /* PB30 periph A */ 491 <AT91_PIOB 30 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB30 periph A */
478 1 31 0x1 0x1>; /* PB31 periph A with pullup */ 492 AT91_PIOB 31 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PB31 periph A with pullup */
479 }; 493 };
480 }; 494 };
481 495
482 i2c0 { 496 i2c0 {
483 pinctrl_i2c0: i2c0-0 { 497 pinctrl_i2c0: i2c0-0 {
484 atmel,pins = 498 atmel,pins =
485 <0 30 0x1 0x0 /* PA30 periph A TWD0 pin, conflicts with URXD1, ISI_VSYNC */ 499 <AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA30 periph A TWD0 pin, conflicts with URXD1, ISI_VSYNC */
486 0 31 0x1 0x0>; /* PA31 periph A TWCK0 pin, conflicts with UTXD1, ISI_HSYNC */ 500 AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PA31 periph A TWCK0 pin, conflicts with UTXD1, ISI_HSYNC */
487 }; 501 };
488 }; 502 };
489 503
490 i2c1 { 504 i2c1 {
491 pinctrl_i2c1: i2c1-0 { 505 pinctrl_i2c1: i2c1-0 {
492 atmel,pins = 506 atmel,pins =
493 <2 26 0x2 0x0 /* PC26 periph B TWD1 pin, conflicts with SPI1_NPCS1, ISI_D11 */ 507 <AT91_PIOC 26 AT91_PERIPH_B AT91_PINCTRL_NONE /* PC26 periph B TWD1 pin, conflicts with SPI1_NPCS1, ISI_D11 */
494 2 27 0x2 0x0>; /* PC27 periph B TWCK1 pin, conflicts with SPI1_NPCS2, ISI_D10 */ 508 AT91_PIOC 27 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PC27 periph B TWCK1 pin, conflicts with SPI1_NPCS2, ISI_D10 */
495 }; 509 };
496 }; 510 };
497 511
498 isi { 512 isi {
499 pinctrl_isi: isi-0 { 513 pinctrl_isi: isi-0 {
500 atmel,pins = 514 atmel,pins =
501 <0 16 0x3 0x0 /* PA16 periph C ISI_D0, conflicts with LCDDAT16 */ 515 <AT91_PIOA 16 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA16 periph C ISI_D0, conflicts with LCDDAT16 */
502 0 17 0x3 0x0 /* PA17 periph C ISI_D1, conflicts with LCDDAT17 */ 516 AT91_PIOA 17 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA17 periph C ISI_D1, conflicts with LCDDAT17 */
503 0 18 0x3 0x0 /* PA18 periph C ISI_D2, conflicts with LCDDAT18, TWD2 */ 517 AT91_PIOA 18 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA18 periph C ISI_D2, conflicts with LCDDAT18, TWD2 */
504 0 19 0x3 0x0 /* PA19 periph C ISI_D3, conflicts with LCDDAT19, TWCK2 */ 518 AT91_PIOA 19 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA19 periph C ISI_D3, conflicts with LCDDAT19, TWCK2 */
505 0 20 0x3 0x0 /* PA20 periph C ISI_D4, conflicts with LCDDAT20, PWMH0 */ 519 AT91_PIOA 20 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA20 periph C ISI_D4, conflicts with LCDDAT20, PWMH0 */
506 0 21 0x3 0x0 /* PA21 periph C ISI_D5, conflicts with LCDDAT21, PWML0 */ 520 AT91_PIOA 21 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA21 periph C ISI_D5, conflicts with LCDDAT21, PWML0 */
507 0 22 0x3 0x0 /* PA22 periph C ISI_D6, conflicts with LCDDAT22, PWMH1 */ 521 AT91_PIOA 22 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA22 periph C ISI_D6, conflicts with LCDDAT22, PWMH1 */
508 0 23 0x3 0x0 /* PA23 periph C ISI_D7, conflicts with LCDDAT23, PWML1 */ 522 AT91_PIOA 23 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA23 periph C ISI_D7, conflicts with LCDDAT23, PWML1 */
509 2 30 0x3 0x0 /* PC30 periph C ISI_PCK, conflicts with UTXD0 */ 523 AT91_PIOC 30 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC30 periph C ISI_PCK, conflicts with UTXD0 */
510 0 31 0x3 0x0 /* PA31 periph C ISI_HSYNC, conflicts with TWCK0, UTXD1 */ 524 AT91_PIOA 31 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA31 periph C ISI_HSYNC, conflicts with TWCK0, UTXD1 */
511 0 30 0x3 0x0 /* PA30 periph C ISI_VSYNC, conflicts with TWD0, URXD1 */ 525 AT91_PIOA 30 AT91_PERIPH_C AT91_PINCTRL_NONE /* PA30 periph C ISI_VSYNC, conflicts with TWD0, URXD1 */
512 2 29 0x3 0x0 /* PC29 periph C ISI_PD8, conflicts with URXD0, PWMFI2 */ 526 AT91_PIOC 29 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC29 periph C ISI_PD8, conflicts with URXD0, PWMFI2 */
513 2 28 0x3 0x0>; /* PC28 periph C ISI_PD9, conflicts with SPI1_NPCS3, PWMFI0 */ 527 AT91_PIOC 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PC28 periph C ISI_PD9, conflicts with SPI1_NPCS3, PWMFI0 */
514 }; 528 };
515 pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 { 529 pinctrl_isi_pck_as_mck: isi_pck_as_mck-0 {
516 atmel,pins = 530 atmel,pins =
517 <3 31 0x2 0x0>; /* PD31 periph B ISI_MCK */ 531 <AT91_PIOD 31 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PD31 periph B ISI_MCK */
518 }; 532 };
519 }; 533 };
520 534
521 lcd { 535 lcd {
522 pinctrl_lcd: lcd-0 { 536 pinctrl_lcd: lcd-0 {
523 atmel,pins = 537 atmel,pins =
524 <0 24 0x1 0x0 /* PA24 periph A LCDPWM */ 538 <AT91_PIOA 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA24 periph A LCDPWM */
525 0 26 0x1 0x0 /* PA26 periph A LCDVSYNC */ 539 AT91_PIOA 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA26 periph A LCDVSYNC */
526 0 27 0x1 0x0 /* PA27 periph A LCDHSYNC */ 540 AT91_PIOA 27 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA27 periph A LCDHSYNC */
527 0 25 0x1 0x0 /* PA25 periph A LCDDISP */ 541 AT91_PIOA 25 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA25 periph A LCDDISP */
528 0 29 0x1 0x0 /* PA29 periph A LCDDEN */ 542 AT91_PIOA 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA29 periph A LCDDEN */
529 0 28 0x1 0x0 /* PA28 periph A LCDPCK */ 543 AT91_PIOA 28 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA28 periph A LCDPCK */
530 0 0 0x1 0x0 /* PA0 periph A LCDD0 pin */ 544 AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA0 periph A LCDD0 pin */
531 0 1 0x1 0x0 /* PA1 periph A LCDD1 pin */ 545 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA1 periph A LCDD1 pin */
532 0 2 0x1 0x0 /* PA2 periph A LCDD2 pin */ 546 AT91_PIOA 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA2 periph A LCDD2 pin */
533 0 3 0x1 0x0 /* PA3 periph A LCDD3 pin */ 547 AT91_PIOA 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA3 periph A LCDD3 pin */
534 0 4 0x1 0x0 /* PA4 periph A LCDD4 pin */ 548 AT91_PIOA 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA4 periph A LCDD4 pin */
535 0 5 0x1 0x0 /* PA5 periph A LCDD5 pin */ 549 AT91_PIOA 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA5 periph A LCDD5 pin */
536 0 6 0x1 0x0 /* PA6 periph A LCDD6 pin */ 550 AT91_PIOA 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA6 periph A LCDD6 pin */
537 0 7 0x1 0x0 /* PA7 periph A LCDD7 pin */ 551 AT91_PIOA 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA7 periph A LCDD7 pin */
538 0 8 0x1 0x0 /* PA8 periph A LCDD8 pin */ 552 AT91_PIOA 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA8 periph A LCDD8 pin */
539 0 9 0x1 0x0 /* PA9 periph A LCDD9 pin */ 553 AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA9 periph A LCDD9 pin */
540 0 10 0x1 0x0 /* PA10 periph A LCDD10 pin */ 554 AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA10 periph A LCDD10 pin */
541 0 11 0x1 0x0 /* PA11 periph A LCDD11 pin */ 555 AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA11 periph A LCDD11 pin */
542 0 12 0x1 0x0 /* PA12 periph A LCDD12 pin */ 556 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA12 periph A LCDD12 pin */
543 0 13 0x1 0x0 /* PA13 periph A LCDD13 pin */ 557 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA13 periph A LCDD13 pin */
544 0 14 0x1 0x0 /* PA14 periph A LCDD14 pin */ 558 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA14 periph A LCDD14 pin */
545 0 15 0x1 0x0 /* PA15 periph A LCDD15 pin */ 559 AT91_PIOA 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PA15 periph A LCDD15 pin */
546 2 14 0x3 0x0 /* PC14 periph C LCDD16 pin */ 560 AT91_PIOC 14 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC14 periph C LCDD16 pin */
547 2 13 0x3 0x0 /* PC13 periph C LCDD17 pin */ 561 AT91_PIOC 13 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC13 periph C LCDD17 pin */
548 2 12 0x3 0x0 /* PC12 periph C LCDD18 pin */ 562 AT91_PIOC 12 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC12 periph C LCDD18 pin */
549 2 11 0x3 0x0 /* PC11 periph C LCDD19 pin */ 563 AT91_PIOC 11 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC11 periph C LCDD19 pin */
550 2 10 0x3 0x0 /* PC10 periph C LCDD20 pin */ 564 AT91_PIOC 10 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC10 periph C LCDD20 pin */
551 2 15 0x3 0x0 /* PC15 periph C LCDD21 pin */ 565 AT91_PIOC 15 AT91_PERIPH_C AT91_PINCTRL_NONE /* PC15 periph C LCDD21 pin */
552 4 27 0x3 0x0 /* PE27 periph C LCDD22 pin */ 566 AT91_PIOE 27 AT91_PERIPH_C AT91_PINCTRL_NONE /* PE27 periph C LCDD22 pin */
553 4 28 0x3 0x0>; /* PE28 periph C LCDD23 pin */ 567 AT91_PIOE 28 AT91_PERIPH_C AT91_PINCTRL_NONE>; /* PE28 periph C LCDD23 pin */
554 }; 568 };
555 }; 569 };
556 570
557 macb0 { 571 macb0 {
558 pinctrl_macb0_data_rgmii: macb0_data_rgmii { 572 pinctrl_macb0_data_rgmii: macb0_data_rgmii {
559 atmel,pins = 573 atmel,pins =
560 <1 0 0x1 0x0 /* PB0 periph A GTX0, conflicts with PWMH0 */ 574 <AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB0 periph A GTX0, conflicts with PWMH0 */
561 1 1 0x1 0x0 /* PB1 periph A GTX1, conflicts with PWML0 */ 575 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB1 periph A GTX1, conflicts with PWML0 */
562 1 2 0x1 0x0 /* PB2 periph A GTX2, conflicts with TK1 */ 576 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB2 periph A GTX2, conflicts with TK1 */
563 1 3 0x1 0x0 /* PB3 periph A GTX3, conflicts with TF1 */ 577 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB3 periph A GTX3, conflicts with TF1 */
564 1 4 0x1 0x0 /* PB4 periph A GRX0, conflicts with PWMH1 */ 578 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB4 periph A GRX0, conflicts with PWMH1 */
565 1 5 0x1 0x0 /* PB5 periph A GRX1, conflicts with PWML1 */ 579 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB5 periph A GRX1, conflicts with PWML1 */
566 1 6 0x1 0x0 /* PB6 periph A GRX2, conflicts with TD1 */ 580 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB6 periph A GRX2, conflicts with TD1 */
567 1 7 0x1 0x0>; /* PB7 periph A GRX3, conflicts with RK1 */ 581 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB7 periph A GRX3, conflicts with RK1 */
568 }; 582 };
569 pinctrl_macb0_data_gmii: macb0_data_gmii { 583 pinctrl_macb0_data_gmii: macb0_data_gmii {
570 atmel,pins = 584 atmel,pins =
571 <1 19 0x2 0x0 /* PB19 periph B GTX4, conflicts with MCI1_CDA */ 585 <AT91_PIOB 19 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB19 periph B GTX4, conflicts with MCI1_CDA */
572 1 20 0x2 0x0 /* PB20 periph B GTX5, conflicts with MCI1_DA0 */ 586 AT91_PIOB 20 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB20 periph B GTX5, conflicts with MCI1_DA0 */
573 1 21 0x2 0x0 /* PB21 periph B GTX6, conflicts with MCI1_DA1 */ 587 AT91_PIOB 21 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB21 periph B GTX6, conflicts with MCI1_DA1 */
574 1 22 0x2 0x0 /* PB22 periph B GTX7, conflicts with MCI1_DA2 */ 588 AT91_PIOB 22 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB22 periph B GTX7, conflicts with MCI1_DA2 */
575 1 23 0x2 0x0 /* PB23 periph B GRX4, conflicts with MCI1_DA3 */ 589 AT91_PIOB 23 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB23 periph B GRX4, conflicts with MCI1_DA3 */
576 1 24 0x2 0x0 /* PB24 periph B GRX5, conflicts with MCI1_CK */ 590 AT91_PIOB 24 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB24 periph B GRX5, conflicts with MCI1_CK */
577 1 25 0x2 0x0 /* PB25 periph B GRX6, conflicts with SCK1 */ 591 AT91_PIOB 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB25 periph B GRX6, conflicts with SCK1 */
578 1 26 0x2 0x0>; /* PB26 periph B GRX7, conflicts with CTS1 */ 592 AT91_PIOB 26 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB26 periph B GRX7, conflicts with CTS1 */
579 }; 593 };
580 pinctrl_macb0_signal_rgmii: macb0_signal_rgmii { 594 pinctrl_macb0_signal_rgmii: macb0_signal_rgmii {
581 atmel,pins = 595 atmel,pins =
582 <1 8 0x1 0x0 /* PB8 periph A GTXCK, conflicts with PWMH2 */ 596 <AT91_PIOB 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB8 periph A GTXCK, conflicts with PWMH2 */
583 1 9 0x1 0x0 /* PB9 periph A GTXEN, conflicts with PWML2 */ 597 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A GTXEN, conflicts with PWML2 */
584 1 11 0x1 0x0 /* PB11 periph A GRXCK, conflicts with RD1 */ 598 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A GRXCK, conflicts with RD1 */
585 1 13 0x1 0x0 /* PB13 periph A GRXER, conflicts with PWML3 */ 599 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A GRXER, conflicts with PWML3 */
586 1 16 0x1 0x0 /* PB16 periph A GMDC */ 600 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A GMDC */
587 1 17 0x1 0x0 /* PB17 periph A GMDIO */ 601 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A GMDIO */
588 1 18 0x1 0x0>; /* PB18 periph A G125CK */ 602 AT91_PIOB 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB18 periph A G125CK */
589 }; 603 };
590 pinctrl_macb0_signal_gmii: macb0_signal_gmii { 604 pinctrl_macb0_signal_gmii: macb0_signal_gmii {
591 atmel,pins = 605 atmel,pins =
592 <1 9 0x1 0x0 /* PB9 periph A GTXEN, conflicts with PWML2 */ 606 <AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB9 periph A GTXEN, conflicts with PWML2 */
593 1 10 0x1 0x0 /* PB10 periph A GTXER, conflicts with RF1 */ 607 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB10 periph A GTXER, conflicts with RF1 */
594 1 11 0x1 0x0 /* PB11 periph A GRXCK, conflicts with RD1 */ 608 AT91_PIOB 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB11 periph A GRXCK, conflicts with RD1 */
595 1 12 0x1 0x0 /* PB12 periph A GRXDV, conflicts with PWMH3 */ 609 AT91_PIOB 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB12 periph A GRXDV, conflicts with PWMH3 */
596 1 13 0x1 0x0 /* PB13 periph A GRXER, conflicts with PWML3 */ 610 AT91_PIOB 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB13 periph A GRXER, conflicts with PWML3 */
597 1 14 0x1 0x0 /* PB14 periph A GCRS, conflicts with CANRX1 */ 611 AT91_PIOB 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB14 periph A GCRS, conflicts with CANRX1 */
598 1 15 0x1 0x0 /* PB15 periph A GCOL, conflicts with CANTX1 */ 612 AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB15 periph A GCOL, conflicts with CANTX1 */
599 1 16 0x1 0x0 /* PB16 periph A GMDC */ 613 AT91_PIOB 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB16 periph A GMDC */
600 1 17 0x1 0x0 /* PB17 periph A GMDIO */ 614 AT91_PIOB 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB17 periph A GMDIO */
601 1 27 0x2 0x0>; /* PB27 periph B G125CKO */ 615 AT91_PIOB 27 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB27 periph B G125CKO */
602 }; 616 };
603 617
604 }; 618 };
@@ -606,252 +620,251 @@
606 macb1 { 620 macb1 {
607 pinctrl_macb1_rmii: macb1_rmii-0 { 621 pinctrl_macb1_rmii: macb1_rmii-0 {
608 atmel,pins = 622 atmel,pins =
609 <2 0 0x1 0x0 /* PC0 periph A ETX0, conflicts with TIOA3 */ 623 <AT91_PIOC 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC0 periph A ETX0, conflicts with TIOA3 */
610 2 1 0x1 0x0 /* PC1 periph A ETX1, conflicts with TIOB3 */ 624 AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC1 periph A ETX1, conflicts with TIOB3 */
611 2 2 0x1 0x0 /* PC2 periph A ERX0, conflicts with TCLK3 */ 625 AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC2 periph A ERX0, conflicts with TCLK3 */
612 2 3 0x1 0x0 /* PC3 periph A ERX1, conflicts with TIOA4 */ 626 AT91_PIOC 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC3 periph A ERX1, conflicts with TIOA4 */
613 2 4 0x1 0x0 /* PC4 periph A ETXEN, conflicts with TIOB4 */ 627 AT91_PIOC 4 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC4 periph A ETXEN, conflicts with TIOB4 */
614 2 5 0x1 0x0 /* PC5 periph A ECRSDV,conflicts with TCLK4 */ 628 AT91_PIOC 5 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC5 periph A ECRSDV,conflicts with TCLK4 */
615 2 6 0x1 0x0 /* PC6 periph A ERXER, conflicts with TIOA5 */ 629 AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC6 periph A ERXER, conflicts with TIOA5 */
616 2 7 0x1 0x0 /* PC7 periph A EREFCK, conflicts with TIOB5 */ 630 AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC7 periph A EREFCK, conflicts with TIOB5 */
617 2 8 0x1 0x0 /* PC8 periph A EMDC, conflicts with TCLK5 */ 631 AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC8 periph A EMDC, conflicts with TCLK5 */
618 2 9 0x1 0x0>; /* PC9 periph A EMDIO */ 632 AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC9 periph A EMDIO */
619 }; 633 };
620 }; 634 };
621 635
622 mmc0 { 636 mmc0 {
623 pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 { 637 pinctrl_mmc0_clk_cmd_dat0: mmc0_clk_cmd_dat0 {
624 atmel,pins = 638 atmel,pins =
625 <3 9 0x1 0x0 /* PD9 periph A MCI0_CK */ 639 <AT91_PIOD 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD9 periph A MCI0_CK */
626 3 0 0x1 0x1 /* PD0 periph A MCI0_CDA with pullup */ 640 AT91_PIOD 0 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD0 periph A MCI0_CDA with pullup */
627 3 1 0x1 0x1>; /* PD1 periph A MCI0_DA0 with pullup */ 641 AT91_PIOD 1 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PD1 periph A MCI0_DA0 with pullup */
628 }; 642 };
629 pinctrl_mmc0_dat1_3: mmc0_dat1_3 { 643 pinctrl_mmc0_dat1_3: mmc0_dat1_3 {
630 atmel,pins = 644 atmel,pins =
631 <3 2 0x1 0x1 /* PD2 periph A MCI0_DA1 with pullup */ 645 <AT91_PIOD 2 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD2 periph A MCI0_DA1 with pullup */
632 3 3 0x1 0x1 /* PD3 periph A MCI0_DA2 with pullup */ 646 AT91_PIOD 3 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD3 periph A MCI0_DA2 with pullup */
633 3 4 0x1 0x1>; /* PD4 periph A MCI0_DA3 with pullup */ 647 AT91_PIOD 4 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PD4 periph A MCI0_DA3 with pullup */
634 }; 648 };
635 pinctrl_mmc0_dat4_7: mmc0_dat4_7 { 649 pinctrl_mmc0_dat4_7: mmc0_dat4_7 {
636 atmel,pins = 650 atmel,pins =
637 <3 5 0x1 0x1 /* PD5 periph A MCI0_DA4 with pullup, conflicts with TIOA0, PWMH2 */ 651 <AT91_PIOD 5 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD5 periph A MCI0_DA4 with pullup, conflicts with TIOA0, PWMH2 */
638 3 6 0x1 0x1 /* PD6 periph A MCI0_DA5 with pullup, conflicts with TIOB0, PWML2 */ 652 AT91_PIOD 6 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD6 periph A MCI0_DA5 with pullup, conflicts with TIOB0, PWML2 */
639 3 7 0x1 0x1 /* PD7 periph A MCI0_DA6 with pullup, conlicts with TCLK0, PWMH3 */ 653 AT91_PIOD 7 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PD7 periph A MCI0_DA6 with pullup, conlicts with TCLK0, PWMH3 */
640 3 8 0x1 0x1>; /* PD8 periph A MCI0_DA7 with pullup, conflicts with PWML3 */ 654 AT91_PIOD 8 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PD8 periph A MCI0_DA7 with pullup, conflicts with PWML3 */
641 }; 655 };
642 }; 656 };
643 657
644 mmc1 { 658 mmc1 {
645 pinctrl_mmc1_clk_cmd_dat0: mmc1_clk_cmd_dat0 { 659 pinctrl_mmc1_clk_cmd_dat0: mmc1_clk_cmd_dat0 {
646 atmel,pins = 660 atmel,pins =
647 <1 24 0x1 0x0 /* PB24 periph A MCI1_CK, conflicts with GRX5 */ 661 <AT91_PIOB 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB24 periph A MCI1_CK, conflicts with GRX5 */
648 1 19 0x1 0x1 /* PB19 periph A MCI1_CDA with pullup, conflicts with GTX4 */ 662 AT91_PIOB 19 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB19 periph A MCI1_CDA with pullup, conflicts with GTX4 */
649 1 20 0x1 0x1>; /* PB20 periph A MCI1_DA0 with pullup, conflicts with GTX5 */ 663 AT91_PIOB 20 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PB20 periph A MCI1_DA0 with pullup, conflicts with GTX5 */
650 }; 664 };
651 pinctrl_mmc1_dat1_3: mmc1_dat1_3 { 665 pinctrl_mmc1_dat1_3: mmc1_dat1_3 {
652 atmel,pins = 666 atmel,pins =
653 <1 21 0x1 0x1 /* PB21 periph A MCI1_DA1 with pullup, conflicts with GTX6 */ 667 <AT91_PIOB 21 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB21 periph A MCI1_DA1 with pullup, conflicts with GTX6 */
654 1 22 0x1 0x1 /* PB22 periph A MCI1_DA2 with pullup, conflicts with GTX7 */ 668 AT91_PIOB 22 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PB22 periph A MCI1_DA2 with pullup, conflicts with GTX7 */
655 1 23 0x1 0x1>; /* PB23 periph A MCI1_DA3 with pullup, conflicts with GRX4 */ 669 AT91_PIOB 23 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PB23 periph A MCI1_DA3 with pullup, conflicts with GRX4 */
656 }; 670 };
657 }; 671 };
658 672
659 mmc2 { 673 mmc2 {
660 pinctrl_mmc2_clk_cmd_dat0: mmc2_clk_cmd_dat0 { 674 pinctrl_mmc2_clk_cmd_dat0: mmc2_clk_cmd_dat0 {
661 atmel,pins = 675 atmel,pins =
662 <2 15 0x1 0x0 /* PC15 periph A MCI2_CK, conflicts with PCK2 */ 676 <AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC15 periph A MCI2_CK, conflicts with PCK2 */
663 2 10 0x1 0x1 /* PC10 periph A MCI2_CDA with pullup */ 677 AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PC10 periph A MCI2_CDA with pullup */
664 2 11 0x1 0x1>; /* PC11 periph A MCI2_DA0 with pullup */ 678 AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC11 periph A MCI2_DA0 with pullup */
665 }; 679 };
666 pinctrl_mmc2_dat1_3: mmc2_dat1_3 { 680 pinctrl_mmc2_dat1_3: mmc2_dat1_3 {
667 atmel,pins = 681 atmel,pins =
668 <2 12 0x1 0x0 /* PC12 periph A MCI2_DA1 with pullup, conflicts with TIOA1 */ 682 <AT91_PIOC 12 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC12 periph A MCI2_DA1 with pullup, conflicts with TIOA1 */
669 2 13 0x1 0x0 /* PC13 periph A MCI2_DA2 with pullup, conflicts with TIOB1 */ 683 AT91_PIOC 13 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC13 periph A MCI2_DA2 with pullup, conflicts with TIOB1 */
670 2 14 0x1 0x0>; /* PC14 periph A MCI2_DA3 with pullup, conflicts with TCLK1 */ 684 AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC14 periph A MCI2_DA3 with pullup, conflicts with TCLK1 */
671 }; 685 };
672 }; 686 };
673 687
674 nand0 { 688 nand0 {
675 pinctrl_nand0_ale_cle: nand0_ale_cle-0 { 689 pinctrl_nand0_ale_cle: nand0_ale_cle-0 {
676 atmel,pins = 690 atmel,pins =
677 <4 21 0x1 0x1 /* PE21 periph A with pullup */ 691 <AT91_PIOE 21 AT91_PERIPH_A AT91_PINCTRL_PULL_UP /* PE21 periph A with pullup */
678 4 22 0x1 0x1>; /* PE22 periph A with pullup */ 692 AT91_PIOE 22 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PE22 periph A with pullup */
679 }; 693 };
680 }; 694 };
681 695
682 pioA: gpio@fffff200 {
683 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
684 reg = <0xfffff200 0x100>;
685 interrupts = <6 4 1>;
686 #gpio-cells = <2>;
687 gpio-controller;
688 interrupt-controller;
689 #interrupt-cells = <2>;
690 };
691
692 pioB: gpio@fffff400 {
693 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
694 reg = <0xfffff400 0x100>;
695 interrupts = <7 4 1>;
696 #gpio-cells = <2>;
697 gpio-controller;
698 interrupt-controller;
699 #interrupt-cells = <2>;
700 };
701
702 pioC: gpio@fffff600 {
703 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
704 reg = <0xfffff600 0x100>;
705 interrupts = <8 4 1>;
706 #gpio-cells = <2>;
707 gpio-controller;
708 interrupt-controller;
709 #interrupt-cells = <2>;
710 };
711
712 pioD: gpio@fffff800 {
713 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
714 reg = <0xfffff800 0x100>;
715 interrupts = <9 4 1>;
716 #gpio-cells = <2>;
717 gpio-controller;
718 interrupt-controller;
719 #interrupt-cells = <2>;
720 };
721
722 pioE: gpio@fffffa00 {
723 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
724 reg = <0xfffffa00 0x100>;
725 interrupts = <10 4 1>;
726 #gpio-cells = <2>;
727 gpio-controller;
728 interrupt-controller;
729 #interrupt-cells = <2>;
730 };
731
732 spi0 { 696 spi0 {
733 pinctrl_spi0: spi0-0 { 697 pinctrl_spi0: spi0-0 {
734 atmel,pins = 698 atmel,pins =
735 <3 10 0x1 0x0 /* PD10 periph A SPI0_MISO pin */ 699 <AT91_PIOD 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD10 periph A SPI0_MISO pin */
736 3 11 0x1 0x0 /* PD11 periph A SPI0_MOSI pin */ 700 AT91_PIOD 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD11 periph A SPI0_MOSI pin */
737 3 12 0x1 0x0 /* PD12 periph A SPI0_SPCK pin */ 701 AT91_PIOD 12 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD12 periph A SPI0_SPCK pin */
738 3 13 0x0 0x0>; /* PD13 GPIO SPI0_NPCS0 pin */
739 }; 702 };
740 }; 703 };
741 704
742 spi1 { 705 spi1 {
743 pinctrl_spi1: spi1-0 { 706 pinctrl_spi1: spi1-0 {
744 atmel,pins = 707 atmel,pins =
745 <2 22 0x1 0x0 /* PC22 periph A SPI1_MISO pin */ 708 <AT91_PIOC 22 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC22 periph A SPI1_MISO pin */
746 2 23 0x1 0x0 /* PC23 periph A SPI1_MOSI pin */ 709 AT91_PIOC 23 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC23 periph A SPI1_MOSI pin */
747 2 24 0x1 0x0 /* PC24 periph A SPI1_SPCK pin */ 710 AT91_PIOC 24 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC24 periph A SPI1_SPCK pin */
748 2 25 0x0 0x0>; /* PC25 GPIO SPI1_NPCS0 pin */
749 }; 711 };
750 }; 712 };
751 713
752 ssc0 { 714 ssc0 {
753 pinctrl_ssc0_tx: ssc0_tx { 715 pinctrl_ssc0_tx: ssc0_tx {
754 atmel,pins = 716 atmel,pins =
755 <2 16 0x1 0x0 /* PC16 periph A TK0 */ 717 <AT91_PIOC 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC16 periph A TK0 */
756 2 17 0x1 0x0 /* PC17 periph A TF0 */ 718 AT91_PIOC 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC17 periph A TF0 */
757 2 18 0x1 0x0>; /* PC18 periph A TD0 */ 719 AT91_PIOC 18 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC18 periph A TD0 */
758 }; 720 };
759 721
760 pinctrl_ssc0_rx: ssc0_rx { 722 pinctrl_ssc0_rx: ssc0_rx {
761 atmel,pins = 723 atmel,pins =
762 <2 19 0x1 0x0 /* PC19 periph A RK0 */ 724 <AT91_PIOC 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC19 periph A RK0 */
763 2 20 0x1 0x0 /* PC20 periph A RF0 */ 725 AT91_PIOC 20 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC20 periph A RF0 */
764 2 21 0x1 0x0>; /* PC21 periph A RD0 */ 726 AT91_PIOC 21 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PC21 periph A RD0 */
765 }; 727 };
766 }; 728 };
767 729
768 ssc1 { 730 ssc1 {
769 pinctrl_ssc1_tx: ssc1_tx { 731 pinctrl_ssc1_tx: ssc1_tx {
770 atmel,pins = 732 atmel,pins =
771 <1 2 0x2 0x0 /* PB2 periph B TK1, conflicts with GTX2 */ 733 <AT91_PIOB 2 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB2 periph B TK1, conflicts with GTX2 */
772 1 3 0x2 0x0 /* PB3 periph B TF1, conflicts with GTX3 */ 734 AT91_PIOB 3 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB3 periph B TF1, conflicts with GTX3 */
773 1 6 0x2 0x0>; /* PB6 periph B TD1, conflicts with TD1 */ 735 AT91_PIOB 6 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB6 periph B TD1, conflicts with TD1 */
774 }; 736 };
775 737
776 pinctrl_ssc1_rx: ssc1_rx { 738 pinctrl_ssc1_rx: ssc1_rx {
777 atmel,pins = 739 atmel,pins =
778 <1 7 0x2 0x0 /* PB7 periph B RK1, conflicts with EREFCK */ 740 <AT91_PIOB 7 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB7 periph B RK1, conflicts with EREFCK */
779 1 10 0x2 0x0 /* PB10 periph B RF1, conflicts with GTXER */ 741 AT91_PIOB 10 AT91_PERIPH_B AT91_PINCTRL_NONE /* PB10 periph B RF1, conflicts with GTXER */
780 1 11 0x2 0x0>; /* PB11 periph B RD1, conflicts with GRXCK */ 742 AT91_PIOB 11 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PB11 periph B RD1, conflicts with GRXCK */
781 }; 743 };
782 }; 744 };
783 745
784 uart0 { 746 uart0 {
785 pinctrl_uart0: uart0-0 { 747 pinctrl_uart0: uart0-0 {
786 atmel,pins = 748 atmel,pins =
787 <2 29 0x1 0x0 /* PC29 periph A, conflicts with PWMFI2, ISI_D8 */ 749 <AT91_PIOC 29 AT91_PERIPH_A AT91_PINCTRL_NONE /* PC29 periph A, conflicts with PWMFI2, ISI_D8 */
788 2 30 0x1 0x1>; /* PC30 periph A with pullup, conflicts with ISI_PCK */ 750 AT91_PIOC 30 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PC30 periph A with pullup, conflicts with ISI_PCK */
789 }; 751 };
790 }; 752 };
791 753
792 uart1 { 754 uart1 {
793 pinctrl_uart1: uart1-0 { 755 pinctrl_uart1: uart1-0 {
794 atmel,pins = 756 atmel,pins =
795 <0 30 0x2 0x0 /* PA30 periph B, conflicts with TWD0, ISI_VSYNC */ 757 <AT91_PIOA 30 AT91_PERIPH_B AT91_PINCTRL_NONE /* PA30 periph B, conflicts with TWD0, ISI_VSYNC */
796 0 31 0x2 0x1>; /* PA31 periph B with pullup, conflicts with TWCK0, ISI_HSYNC */ 758 AT91_PIOA 31 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PA31 periph B with pullup, conflicts with TWCK0, ISI_HSYNC */
797 }; 759 };
798 }; 760 };
799 761
800 usart0 { 762 usart0 {
801 pinctrl_usart0: usart0-0 { 763 pinctrl_usart0: usart0-0 {
802 atmel,pins = 764 atmel,pins =
803 <3 17 0x1 0x0 /* PD17 periph A */ 765 <AT91_PIOD 17 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD17 periph A */
804 3 18 0x1 0x1>; /* PD18 periph A with pullup */ 766 AT91_PIOD 18 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PD18 periph A with pullup */
805 }; 767 };
806 768
807 pinctrl_usart0_rts_cts: usart0_rts_cts-0 { 769 pinctrl_usart0_rts_cts: usart0_rts_cts-0 {
808 atmel,pins = 770 atmel,pins =
809 <3 15 0x1 0x0 /* PD15 periph A, conflicts with SPI0_NPCS2, CANTX0 */ 771 <AT91_PIOD 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* PD15 periph A, conflicts with SPI0_NPCS2, CANTX0 */
810 3 16 0x1 0x0>; /* PD16 periph A, conflicts with SPI0_NPCS3, PWMFI3 */ 772 AT91_PIOD 16 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PD16 periph A, conflicts with SPI0_NPCS3, PWMFI3 */
811 }; 773 };
812 }; 774 };
813 775
814 usart1 { 776 usart1 {
815 pinctrl_usart1: usart1-0 { 777 pinctrl_usart1: usart1-0 {
816 atmel,pins = 778 atmel,pins =
817 <1 28 0x1 0x0 /* PB28 periph A */ 779 <AT91_PIOB 28 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB28 periph A */
818 1 29 0x1 0x1>; /* PB29 periph A with pullup */ 780 AT91_PIOB 29 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>; /* PB29 periph A with pullup */
819 }; 781 };
820 782
821 pinctrl_usart1_rts_cts: usart1_rts_cts-0 { 783 pinctrl_usart1_rts_cts: usart1_rts_cts-0 {
822 atmel,pins = 784 atmel,pins =
823 <1 26 0x1 0x0 /* PB26 periph A, conflicts with GRX7 */ 785 <AT91_PIOB 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* PB26 periph A, conflicts with GRX7 */
824 1 27 0x1 0x0>; /* PB27 periph A, conflicts with G125CKO */ 786 AT91_PIOB 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* PB27 periph A, conflicts with G125CKO */
825 }; 787 };
826 }; 788 };
827 789
828 usart2 { 790 usart2 {
829 pinctrl_usart2: usart2-0 { 791 pinctrl_usart2: usart2-0 {
830 atmel,pins = 792 atmel,pins =
831 <4 25 0x2 0x0 /* PE25 periph B, conflicts with A25 */ 793 <AT91_PIOE 25 AT91_PERIPH_B AT91_PINCTRL_NONE /* PE25 periph B, conflicts with A25 */
832 4 26 0x2 0x1>; /* PE26 periph B with pullup, conflicts NCS0 */ 794 AT91_PIOE 26 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PE26 periph B with pullup, conflicts NCS0 */
833 }; 795 };
834 796
835 pinctrl_usart2_rts_cts: usart2_rts_cts-0 { 797 pinctrl_usart2_rts_cts: usart2_rts_cts-0 {
836 atmel,pins = 798 atmel,pins =
837 <4 23 0x2 0x0 /* PE23 periph B, conflicts with A23 */ 799 <AT91_PIOE 23 AT91_PERIPH_B AT91_PINCTRL_NONE /* PE23 periph B, conflicts with A23 */
838 4 24 0x2 0x0>; /* PE24 periph B, conflicts with A24 */ 800 AT91_PIOE 24 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE24 periph B, conflicts with A24 */
839 }; 801 };
840 }; 802 };
841 803
842 usart3 { 804 usart3 {
843 pinctrl_usart3: usart3-0 { 805 pinctrl_usart3: usart3-0 {
844 atmel,pins = 806 atmel,pins =
845 <4 18 0x2 0x0 /* PE18 periph B, conflicts with A18 */ 807 <AT91_PIOE 18 AT91_PERIPH_B AT91_PINCTRL_NONE /* PE18 periph B, conflicts with A18 */
846 4 19 0x2 0x1>; /* PE19 periph B with pullup, conflicts with A19 */ 808 AT91_PIOE 19 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>; /* PE19 periph B with pullup, conflicts with A19 */
847 }; 809 };
848 810
849 pinctrl_usart3_rts_cts: usart3_rts_cts-0 { 811 pinctrl_usart3_rts_cts: usart3_rts_cts-0 {
850 atmel,pins = 812 atmel,pins =
851 <4 16 0x2 0x0 /* PE16 periph B, conflicts with A16 */ 813 <AT91_PIOE 16 AT91_PERIPH_B AT91_PINCTRL_NONE /* PE16 periph B, conflicts with A16 */
852 4 17 0x2 0x0>; /* PE17 periph B, conflicts with A17 */ 814 AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with A17 */
853 }; 815 };
854 }; 816 };
817
818
819 pioA: gpio@fffff200 {
820 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
821 reg = <0xfffff200 0x100>;
822 interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
823 #gpio-cells = <2>;
824 gpio-controller;
825 interrupt-controller;
826 #interrupt-cells = <2>;
827 };
828
829 pioB: gpio@fffff400 {
830 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
831 reg = <0xfffff400 0x100>;
832 interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
833 #gpio-cells = <2>;
834 gpio-controller;
835 interrupt-controller;
836 #interrupt-cells = <2>;
837 };
838
839 pioC: gpio@fffff600 {
840 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
841 reg = <0xfffff600 0x100>;
842 interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
843 #gpio-cells = <2>;
844 gpio-controller;
845 interrupt-controller;
846 #interrupt-cells = <2>;
847 };
848
849 pioD: gpio@fffff800 {
850 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
851 reg = <0xfffff800 0x100>;
852 interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
853 #gpio-cells = <2>;
854 gpio-controller;
855 interrupt-controller;
856 #interrupt-cells = <2>;
857 };
858
859 pioE: gpio@fffffa00 {
860 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
861 reg = <0xfffffa00 0x100>;
862 interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
863 #gpio-cells = <2>;
864 gpio-controller;
865 interrupt-controller;
866 #interrupt-cells = <2>;
867 };
855 }; 868 };
856 869
857 pmc: pmc@fffffc00 { 870 pmc: pmc@fffffc00 {
@@ -867,7 +880,7 @@
867 pit: timer@fffffe30 { 880 pit: timer@fffffe30 {
868 compatible = "atmel,at91sam9260-pit"; 881 compatible = "atmel,at91sam9260-pit";
869 reg = <0xfffffe30 0xf>; 882 reg = <0xfffffe30 0xf>;
870 interrupts = <3 4 5>; 883 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>;
871 }; 884 };
872 885
873 watchdog@fffffe40 { 886 watchdog@fffffe40 {
@@ -879,7 +892,7 @@
879 rtc@fffffeb0 { 892 rtc@fffffeb0 {
880 compatible = "atmel,at91rm9200-rtc"; 893 compatible = "atmel,at91rm9200-rtc";
881 reg = <0xfffffeb0 0x30>; 894 reg = <0xfffffeb0 0x30>;
882 interrupts = <1 4 7>; 895 interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>;
883 }; 896 };
884 }; 897 };
885 898
@@ -889,7 +902,7 @@
889 compatible = "atmel,at91sam9rl-udc"; 902 compatible = "atmel,at91sam9rl-udc";
890 reg = <0x00500000 0x100000 903 reg = <0x00500000 0x100000
891 0xf8030000 0x4000>; 904 0xf8030000 0x4000>;
892 interrupts = <33 4 2>; 905 interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>;
893 status = "disabled"; 906 status = "disabled";
894 907
895 ep0 { 908 ep0 {
@@ -1001,14 +1014,14 @@
1001 usb1: ohci@00600000 { 1014 usb1: ohci@00600000 {
1002 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 1015 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
1003 reg = <0x00600000 0x100000>; 1016 reg = <0x00600000 0x100000>;
1004 interrupts = <32 4 2>; 1017 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>;
1005 status = "disabled"; 1018 status = "disabled";
1006 }; 1019 };
1007 1020
1008 usb2: ehci@00700000 { 1021 usb2: ehci@00700000 {
1009 compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; 1022 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
1010 reg = <0x00700000 0x100000>; 1023 reg = <0x00700000 0x100000>;
1011 interrupts = <32 4 2>; 1024 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>;
1012 status = "disabled"; 1025 status = "disabled";
1013 }; 1026 };
1014 1027
@@ -1024,7 +1037,7 @@
1024 0xffffc000 0x00000070 /* NFC HSMC regs */ 1037 0xffffc000 0x00000070 /* NFC HSMC regs */
1025 0x00200000 0x00100000 /* NFC SRAM banks */ 1038 0x00200000 0x00100000 /* NFC SRAM banks */
1026 >; 1039 >;
1027 interrupts = <5 4 6>; 1040 interrupts = <5 IRQ_TYPE_LEVEL_HIGH 6>;
1028 atmel,nand-addr-offset = <21>; 1041 atmel,nand-addr-offset = <21>;
1029 atmel,nand-cmd-offset = <22>; 1042 atmel,nand-cmd-offset = <22>;
1030 pinctrl-names = "default"; 1043 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/sama5d31ek.dts b/arch/arm/boot/dts/sama5d31ek.dts
index fa5d216f1db7..027bac7510b6 100644
--- a/arch/arm/boot/dts/sama5d31ek.dts
+++ b/arch/arm/boot/dts/sama5d31ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "sama5d3xmb.dtsi" 10#include "sama5d3xmb.dtsi"
11/include/ "sama5d3xdm.dtsi" 11#include "sama5d3xdm.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel SAMA5D31-EK"; 14 model = "Atmel SAMA5D31-EK";
@@ -41,7 +41,7 @@
41 leds { 41 leds {
42 d3 { 42 d3 {
43 label = "d3"; 43 label = "d3";
44 gpios = <&pioE 24 0>; 44 gpios = <&pioE 24 GPIO_ACTIVE_HIGH>;
45 }; 45 };
46 }; 46 };
47 47
diff --git a/arch/arm/boot/dts/sama5d33ek.dts b/arch/arm/boot/dts/sama5d33ek.dts
index c38c9433d7a5..99bd0c8e0471 100644
--- a/arch/arm/boot/dts/sama5d33ek.dts
+++ b/arch/arm/boot/dts/sama5d33ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "sama5d3xmb.dtsi" 10#include "sama5d3xmb.dtsi"
11/include/ "sama5d3xdm.dtsi" 11#include "sama5d3xdm.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel SAMA5D33-EK"; 14 model = "Atmel SAMA5D33-EK";
diff --git a/arch/arm/boot/dts/sama5d34ek.dts b/arch/arm/boot/dts/sama5d34ek.dts
index 6bebfcdcb1d1..fb8ee11cf282 100644
--- a/arch/arm/boot/dts/sama5d34ek.dts
+++ b/arch/arm/boot/dts/sama5d34ek.dts
@@ -7,8 +7,8 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "sama5d3xmb.dtsi" 10#include "sama5d3xmb.dtsi"
11/include/ "sama5d3xdm.dtsi" 11#include "sama5d3xdm.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel SAMA5D34-EK"; 14 model = "Atmel SAMA5D34-EK";
@@ -51,7 +51,7 @@
51 leds { 51 leds {
52 d3 { 52 d3 {
53 label = "d3"; 53 label = "d3";
54 gpios = <&pioE 24 0>; 54 gpios = <&pioE 24 GPIO_ACTIVE_HIGH>;
55 }; 55 };
56 }; 56 };
57 57
diff --git a/arch/arm/boot/dts/sama5d35ek.dts b/arch/arm/boot/dts/sama5d35ek.dts
index a488fc4e9777..509a53d9cc7b 100644
--- a/arch/arm/boot/dts/sama5d35ek.dts
+++ b/arch/arm/boot/dts/sama5d35ek.dts
@@ -7,7 +7,7 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "sama5d3xmb.dtsi" 10#include "sama5d3xmb.dtsi"
11 11
12/ { 12/ {
13 model = "Atmel SAMA5D35-EK"; 13 model = "Atmel SAMA5D35-EK";
@@ -48,7 +48,7 @@
48 48
49 pb_user1 { 49 pb_user1 {
50 label = "pb_user1"; 50 label = "pb_user1";
51 gpios = <&pioE 27 0>; 51 gpios = <&pioE 27 GPIO_ACTIVE_HIGH>;
52 linux,code = <0x100>; 52 linux,code = <0x100>;
53 gpio-key,wakeup; 53 gpio-key,wakeup;
54 }; 54 };
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi
index b336e7787cb3..1f8050813a54 100644
--- a/arch/arm/boot/dts/sama5d3xcm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xcm.dtsi
@@ -6,7 +6,7 @@
6 * 6 *
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/include/ "sama5d3.dtsi" 9#include "sama5d3.dtsi"
10 10
11/ { 11/ {
12 compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5"; 12 compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5";
@@ -89,7 +89,7 @@
89 89
90 d2 { 90 d2 {
91 label = "d2"; 91 label = "d2";
92 gpios = <&pioE 25 1>; /* PE25, conflicts with A25, RXD2 */ 92 gpios = <&pioE 25 GPIO_ACTIVE_LOW>; /* PE25, conflicts with A25, RXD2 */
93 }; 93 };
94 }; 94 };
95}; 95};
diff --git a/arch/arm/boot/dts/sama5d3xdm.dtsi b/arch/arm/boot/dts/sama5d3xdm.dtsi
index 4b8830eb2060..1c296d6b2f2a 100644
--- a/arch/arm/boot/dts/sama5d3xdm.dtsi
+++ b/arch/arm/boot/dts/sama5d3xdm.dtsi
@@ -33,7 +33,7 @@
33 board { 33 board {
34 pinctrl_qt1070_irq: qt1070_irq { 34 pinctrl_qt1070_irq: qt1070_irq {
35 atmel,pins = 35 atmel,pins =
36 <4 31 0x0 0x5>; /* PE31 GPIO with pull up deglith */ 36 <AT91_PIOE 31 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PE31 GPIO with pull up deglith */
37 }; 37 };
38 }; 38 };
39 }; 39 };
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
index 661d7ca9c309..8a9e05d8a4b8 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -6,7 +6,7 @@
6 * 6 *
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/include/ "sama5d3xcm.dtsi" 9#include "sama5d3xcm.dtsi"
10 10
11/ { 11/ {
12 compatible = "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; 12 compatible = "atmel,sama5d3xmb", "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5";
@@ -20,7 +20,7 @@
20 slot@0 { 20 slot@0 {
21 reg = <0>; 21 reg = <0>;
22 bus-width = <4>; 22 bus-width = <4>;
23 cd-gpios = <&pioD 17 0>; 23 cd-gpios = <&pioD 17 GPIO_ACTIVE_HIGH>;
24 }; 24 };
25 }; 25 };
26 26
@@ -62,7 +62,7 @@
62 slot@0 { 62 slot@0 {
63 reg = <0>; 63 reg = <0>;
64 bus-width = <4>; 64 bus-width = <4>;
65 cd-gpios = <&pioD 18 0>; 65 cd-gpios = <&pioD 18 GPIO_ACTIVE_HIGH>;
66 }; 66 };
67 }; 67 };
68 68
@@ -87,32 +87,32 @@
87 board { 87 board {
88 pinctrl_mmc0_cd: mmc0_cd { 88 pinctrl_mmc0_cd: mmc0_cd {
89 atmel,pins = 89 atmel,pins =
90 <3 17 0x0 0x5>; /* PD17 GPIO with pullup deglitch */ 90 <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD17 GPIO with pullup deglitch */
91 }; 91 };
92 92
93 pinctrl_mmc1_cd: mmc1_cd { 93 pinctrl_mmc1_cd: mmc1_cd {
94 atmel,pins = 94 atmel,pins =
95 <3 18 0x0 0x5>; /* PD18 GPIO with pullup deglitch */ 95 <AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>; /* PD18 GPIO with pullup deglitch */
96 }; 96 };
97 97
98 pinctrl_pck0_as_audio_mck: pck0_as_audio_mck { 98 pinctrl_pck0_as_audio_mck: pck0_as_audio_mck {
99 atmel,pins = 99 atmel,pins =
100 <3 30 0x2 0x0>; /* PD30 periph B */ 100 <AT91_PIOD 30 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PD30 periph B */
101 }; 101 };
102 102
103 pinctrl_isi_reset: isi_reset-0 { 103 pinctrl_isi_reset: isi_reset-0 {
104 atmel,pins = 104 atmel,pins =
105 <4 24 0x0 0x0>; /* PE24 gpio */ 105 <AT91_PIOE 24 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; /* PE24 gpio */
106 }; 106 };
107 107
108 pinctrl_isi_power: isi_power-0 { 108 pinctrl_isi_power: isi_power-0 {
109 atmel,pins = 109 atmel,pins =
110 <4 29 0x0 0x0>; /* PE29 gpio */ 110 <AT91_PIOE 29 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>; /* PE29 gpio */
111 }; 111 };
112 112
113 pinctrl_usba_vbus: usba_vbus { 113 pinctrl_usba_vbus: usba_vbus {
114 atmel,pins = 114 atmel,pins =
115 <3 29 0x0 0x4>; /* PD29 GPIO with deglitch */ 115 <AT91_PIOD 29 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PD29 GPIO with deglitch */
116 }; 116 };
117 }; 117 };
118 }; 118 };
@@ -127,7 +127,7 @@
127 }; 127 };
128 128
129 usb0: gadget@00500000 { 129 usb0: gadget@00500000 {
130 atmel,vbus-gpio = <&pioD 29 0>; 130 atmel,vbus-gpio = <&pioD 29 GPIO_ACTIVE_HIGH>;
131 pinctrl-names = "default"; 131 pinctrl-names = "default";
132 pinctrl-0 = <&pinctrl_usba_vbus>; 132 pinctrl-0 = <&pinctrl_usba_vbus>;
133 status = "okay"; 133 status = "okay";
@@ -135,9 +135,9 @@
135 135
136 usb1: ohci@00600000 { 136 usb1: ohci@00600000 {
137 num-ports = <3>; 137 num-ports = <3>;
138 atmel,vbus-gpio = <&pioD 25 0 138 atmel,vbus-gpio = <&pioD 25 GPIO_ACTIVE_HIGH
139 &pioD 26 1 139 &pioD 26 GPIO_ACTIVE_LOW
140 &pioD 27 1 140 &pioD 27 GPIO_ACTIVE_LOW
141 >; 141 >;
142 status = "okay"; 142 status = "okay";
143 }; 143 };
diff --git a/arch/arm/boot/dts/sh7372.dtsi b/arch/arm/boot/dts/sh7372.dtsi
index 677fc603f8b3..7bf020ecadf5 100644
--- a/arch/arm/boot/dts/sh7372.dtsi
+++ b/arch/arm/boot/dts/sh7372.dtsi
@@ -14,8 +14,13 @@
14 compatible = "renesas,sh7372"; 14 compatible = "renesas,sh7372";
15 15
16 cpus { 16 cpus {
17 #address-cells = <1>;
18 #size-cells = <0>;
19
17 cpu@0 { 20 cpu@0 {
18 compatible = "arm,cortex-a8"; 21 compatible = "arm,cortex-a8";
22 device_type = "cpu";
23 reg = <0x0>;
19 }; 24 };
20 }; 25 };
21}; 26};
diff --git a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
index 5972abb55f9c..b6f759e830ed 100644
--- a/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
+++ b/arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
@@ -18,6 +18,19 @@
18 model = "KZM-A9-GT"; 18 model = "KZM-A9-GT";
19 compatible = "renesas,kzm9g-reference", "renesas,sh73a0"; 19 compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
20 20
21 cpus {
22 cpu@0 {
23 cpu0-supply = <&vdd_dvfs>;
24 operating-points = <
25 /* kHz uV */
26 1196000 1315000
27 598000 1175000
28 398667 1065000
29 >;
30 voltage-tolerance = <1>; /* 1% */
31 };
32 };
33
21 chosen { 34 chosen {
22 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200"; 35 bootargs = "console=tty0 console=ttySC4,115200 root=/dev/nfs ip=dhcp ignore_loglevel earlyprintk=sh-sci.4,115200";
23 }; 36 };
@@ -59,6 +72,79 @@
59 }; 72 };
60}; 73};
61 74
75&i2c0 {
76 as3711@40 {
77 compatible = "ams,as3711";
78 reg = <0x40>;
79
80 regulators {
81 vdd_dvfs: sd1 {
82 regulator-name = "1.315V CPU";
83 regulator-min-microvolt = <1050000>;
84 regulator-max-microvolt = <1350000>;
85 regulator-always-on;
86 regulator-boot-on;
87 };
88 sd2 {
89 regulator-name = "1.8V";
90 regulator-min-microvolt = <1800000>;
91 regulator-max-microvolt = <1800000>;
92 regulator-always-on;
93 regulator-boot-on;
94 };
95 sd4 {
96 regulator-name = "1.215V";
97 regulator-min-microvolt = <1215000>;
98 regulator-max-microvolt = <1235000>;
99 regulator-always-on;
100 regulator-boot-on;
101 };
102 ldo2 {
103 regulator-name = "2.8V CPU";
104 regulator-min-microvolt = <2800000>;
105 regulator-max-microvolt = <2800000>;
106 regulator-always-on;
107 regulator-boot-on;
108 };
109 ldo3 {
110 regulator-name = "3.0V CPU";
111 regulator-min-microvolt = <3000000>;
112 regulator-max-microvolt = <3000000>;
113 regulator-always-on;
114 regulator-boot-on;
115 };
116 ldo4 {
117 regulator-name = "2.8V";
118 regulator-min-microvolt = <2800000>;
119 regulator-max-microvolt = <2800000>;
120 regulator-always-on;
121 regulator-boot-on;
122 };
123 ldo5 {
124 regulator-name = "2.8V #2";
125 regulator-min-microvolt = <2800000>;
126 regulator-max-microvolt = <2800000>;
127 regulator-always-on;
128 regulator-boot-on;
129 };
130 ldo7 {
131 regulator-name = "1.15V CPU";
132 regulator-min-microvolt = <1150000>;
133 regulator-max-microvolt = <1150000>;
134 regulator-always-on;
135 regulator-boot-on;
136 };
137 ldo8 {
138 regulator-name = "1.15V CPU #2";
139 regulator-min-microvolt = <1150000>;
140 regulator-max-microvolt = <1150000>;
141 regulator-always-on;
142 regulator-boot-on;
143 };
144 };
145 };
146};
147
62&mmcif { 148&mmcif {
63 bus-width = <8>; 149 bus-width = <8>;
64 vmmc-supply = <&reg_1p8v>; 150 vmmc-supply = <&reg_1p8v>;
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index ec40bf78289e..b97750256003 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -119,7 +119,7 @@
119 0 32 0x4>; 119 0 32 0x4>;
120 }; 120 };
121 121
122 i2c0: i2c@0xe6820000 { 122 i2c0: i2c@e6820000 {
123 #address-cells = <1>; 123 #address-cells = <1>;
124 #size-cells = <0>; 124 #size-cells = <0>;
125 compatible = "renesas,rmobile-iic"; 125 compatible = "renesas,rmobile-iic";
@@ -131,7 +131,7 @@
131 0 170 0x4>; 131 0 170 0x4>;
132 }; 132 };
133 133
134 i2c1: i2c@0xe6822000 { 134 i2c1: i2c@e6822000 {
135 #address-cells = <1>; 135 #address-cells = <1>;
136 #size-cells = <0>; 136 #size-cells = <0>;
137 compatible = "renesas,rmobile-iic"; 137 compatible = "renesas,rmobile-iic";
@@ -143,7 +143,7 @@
143 0 54 0x4>; 143 0 54 0x4>;
144 }; 144 };
145 145
146 i2c2: i2c@0xe6824000 { 146 i2c2: i2c@e6824000 {
147 #address-cells = <1>; 147 #address-cells = <1>;
148 #size-cells = <0>; 148 #size-cells = <0>;
149 compatible = "renesas,rmobile-iic"; 149 compatible = "renesas,rmobile-iic";
@@ -155,7 +155,7 @@
155 0 174 0x4>; 155 0 174 0x4>;
156 }; 156 };
157 157
158 i2c3: i2c@0xe6826000 { 158 i2c3: i2c@e6826000 {
159 #address-cells = <1>; 159 #address-cells = <1>;
160 #size-cells = <0>; 160 #size-cells = <0>;
161 compatible = "renesas,rmobile-iic"; 161 compatible = "renesas,rmobile-iic";
@@ -167,7 +167,7 @@
167 0 186 0x4>; 167 0 186 0x4>;
168 }; 168 };
169 169
170 i2c4: i2c@0xe6828000 { 170 i2c4: i2c@e6828000 {
171 #address-cells = <1>; 171 #address-cells = <1>;
172 #size-cells = <0>; 172 #size-cells = <0>;
173 compatible = "renesas,rmobile-iic"; 173 compatible = "renesas,rmobile-iic";
@@ -179,7 +179,7 @@
179 0 190 0x4>; 179 0 190 0x4>;
180 }; 180 };
181 181
182 mmcif: mmcif@0x10010000 { 182 mmcif: mmcif@e6bd0000 {
183 compatible = "renesas,sh-mmcif"; 183 compatible = "renesas,sh-mmcif";
184 reg = <0xe6bd0000 0x100>; 184 reg = <0xe6bd0000 0x100>;
185 interrupt-parent = <&gic>; 185 interrupt-parent = <&gic>;
@@ -189,7 +189,7 @@
189 status = "disabled"; 189 status = "disabled";
190 }; 190 };
191 191
192 sdhi0: sdhi@0xee100000 { 192 sdhi0: sdhi@ee100000 {
193 compatible = "renesas,r8a7740-sdhi"; 193 compatible = "renesas,r8a7740-sdhi";
194 reg = <0xee100000 0x100>; 194 reg = <0xee100000 0x100>;
195 interrupt-parent = <&gic>; 195 interrupt-parent = <&gic>;
@@ -201,7 +201,7 @@
201 }; 201 };
202 202
203 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */ 203 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
204 sdhi1: sdhi@0xee120000 { 204 sdhi1: sdhi@ee120000 {
205 compatible = "renesas,r8a7740-sdhi"; 205 compatible = "renesas,r8a7740-sdhi";
206 reg = <0xee120000 0x100>; 206 reg = <0xee120000 0x100>;
207 interrupt-parent = <&gic>; 207 interrupt-parent = <&gic>;
@@ -212,7 +212,7 @@
212 status = "disabled"; 212 status = "disabled";
213 }; 213 };
214 214
215 sdhi2: sdhi@0xee140000 { 215 sdhi2: sdhi@ee140000 {
216 compatible = "renesas,r8a7740-sdhi"; 216 compatible = "renesas,r8a7740-sdhi";
217 reg = <0xee140000 0x100>; 217 reg = <0xee140000 0x100>;
218 interrupt-parent = <&gic>; 218 interrupt-parent = <&gic>;
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index db5db24fd544..49824be66845 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12/dts-v1/; 12/dts-v1/;
13/include/ "dbx5x0.dtsi" 13#include "dbx5x0.dtsi"
14 14
15/ { 15/ {
16 model = "Calao Systems Snowball platform with device tree"; 16 model = "Calao Systems Snowball platform with device tree";
@@ -22,12 +22,13 @@
22 22
23 en_3v3_reg: en_3v3 { 23 en_3v3_reg: en_3v3 {
24 compatible = "regulator-fixed"; 24 compatible = "regulator-fixed";
25 regulator-name = "en-3v3-fixed-supply"; 25 regulator-name = "en-3v3-fixed-supply";
26 regulator-min-microvolt = <3300000>; 26 regulator-min-microvolt = <3300000>;
27 regulator-max-microvolt = <3300000>; 27 regulator-max-microvolt = <3300000>;
28 gpios = <&gpio0 26 0x4>; // 26 28 /* AB8500 GPIOs start from 1 - offset 25 is GPIO26. */
29 startup-delay-us = <5000>; 29 gpio = <&ab8500_gpio 25 0x4>;
30 enable-active-high; 30 startup-delay-us = <5000>;
31 enable-active-high;
31 }; 32 };
32 33
33 gpio_keys { 34 gpio_keys {
@@ -82,7 +83,7 @@
82 }; 83 };
83 }; 84 };
84 85
85 soc-u9500 { 86 soc {
86 87
87 sound { 88 sound {
88 compatible = "stericsson,snd-soc-mop500"; 89 compatible = "stericsson,snd-soc-mop500";
@@ -99,40 +100,13 @@
99 status = "okay"; 100 status = "okay";
100 }; 101 };
101 102
102 prcmu@80157000 {
103 thermal@801573c0 {
104 num-trips = <4>;
105
106 trip0-temp = <70000>;
107 trip0-type = "active";
108 trip0-cdev-num = <1>;
109 trip0-cdev-name0 = "thermal-cpufreq-0";
110
111 trip1-temp = <75000>;
112 trip1-type = "active";
113 trip1-cdev-num = <1>;
114 trip1-cdev-name0 = "thermal-cpufreq-0";
115
116 trip2-temp = <80000>;
117 trip2-type = "active";
118 trip2-cdev-num = <1>;
119 trip2-cdev-name0 = "thermal-cpufreq-0";
120
121 trip3-temp = <85000>;
122 trip3-type = "critical";
123 trip3-cdev-num = <0>;
124
125 status = "okay";
126 };
127 };
128
129 external-bus@50000000 { 103 external-bus@50000000 {
130 status = "okay"; 104 status = "okay";
131 105
132 ethernet@0 { 106 ethernet@0 {
133 compatible = "smsc,lan9115"; 107 compatible = "smsc,lan9115";
134 reg = <0 0x10000>; 108 reg = <0 0x10000>;
135 interrupts = <12 0x1>; 109 interrupts = <12 IRQ_TYPE_EDGE_RISING>;
136 interrupt-parent = <&gpio4>; 110 interrupt-parent = <&gpio4>;
137 vdd33a-supply = <&en_3v3_reg>; 111 vdd33a-supply = <&en_3v3_reg>;
138 vddvario-supply = <&db8500_vape_reg>; 112 vddvario-supply = <&db8500_vape_reg>;
@@ -146,13 +120,21 @@
146 }; 120 };
147 }; 121 };
148 122
123 vmmci: regulator-gpio {
124 gpios = <&gpio6 25 0x4>;
125 enable-gpio = <&gpio7 4 0x4>;
126
127 status = "okay";
128 };
129
149 // External Micro SD slot 130 // External Micro SD slot
150 sdi0_per1@80126000 { 131 sdi0_per1@80126000 {
151 arm,primecell-periphid = <0x10480180>; 132 arm,primecell-periphid = <0x10480180>;
152 max-frequency = <50000000>; 133 max-frequency = <100000000>;
153 bus-width = <4>; 134 bus-width = <4>;
154 mmc-cap-mmc-highspeed; 135 mmc-cap-mmc-highspeed;
155 vmmc-supply = <&ab8500_ldo_aux3_reg>; 136 vmmc-supply = <&ab8500_ldo_aux3_reg>;
137 vqmmc-supply = <&vmmci>;
156 138
157 cd-gpios = <&gpio6 26 0x4>; // 218 139 cd-gpios = <&gpio6 26 0x4>; // 218
158 cd-inverted; 140 cd-inverted;
@@ -163,7 +145,7 @@
163 // On-board eMMC 145 // On-board eMMC
164 sdi4_per2@80114000 { 146 sdi4_per2@80114000 {
165 arm,primecell-periphid = <0x10480180>; 147 arm,primecell-periphid = <0x10480180>;
166 max-frequency = <50000000>; 148 max-frequency = <100000000>;
167 bus-width = <8>; 149 bus-width = <8>;
168 mmc-cap-mmc-highspeed; 150 mmc-cap-mmc-highspeed;
169 vmmc-supply = <&ab8500_ldo_aux2_reg>; 151 vmmc-supply = <&ab8500_ldo_aux2_reg>;
@@ -197,15 +179,15 @@
197 }; 179 };
198 180
199 i2c@80128000 { 181 i2c@80128000 {
200 lp5521@0x33 { 182 lp5521@33 {
201 // compatible = "lp5521"; 183 // compatible = "lp5521";
202 reg = <0x33>; 184 reg = <0x33>;
203 }; 185 };
204 lp5521@0x34 { 186 lp5521@34 {
205 // compatible = "lp5521"; 187 // compatible = "lp5521";
206 reg = <0x34>; 188 reg = <0x34>;
207 }; 189 };
208 bh1780@0x29 { 190 bh1780@29 {
209 // compatible = "rohm,bh1780gli"; 191 // compatible = "rohm,bh1780gli";
210 reg = <0x33>; 192 reg = <0x33>;
211 }; 193 };
@@ -298,6 +280,31 @@
298 }; 280 };
299 }; 281 };
300 282
283 thermal@801573c0 {
284 num-trips = <4>;
285
286 trip0-temp = <70000>;
287 trip0-type = "active";
288 trip0-cdev-num = <1>;
289 trip0-cdev-name0 = "thermal-cpufreq-0";
290
291 trip1-temp = <75000>;
292 trip1-type = "active";
293 trip1-cdev-num = <1>;
294 trip1-cdev-name0 = "thermal-cpufreq-0";
295
296 trip2-temp = <80000>;
297 trip2-type = "active";
298 trip2-cdev-num = <1>;
299 trip2-cdev-name0 = "thermal-cpufreq-0";
300
301 trip3-temp = <85000>;
302 trip3-type = "critical";
303 trip3-cdev-num = <0>;
304
305 status = "okay";
306 };
307
301 ab8500 { 308 ab8500 {
302 ab8500-gpio { 309 ab8500-gpio {
303 compatible = "stericsson,ab8500-gpio"; 310 compatible = "stericsson,ab8500-gpio";
@@ -316,7 +323,7 @@
316 regulator-name = "V-MMC-SD"; 323 regulator-name = "V-MMC-SD";
317 }; 324 };
318 325
319 ab8500_ldo_initcore_reg: ab8500_ldo_initcore { 326 ab8500_ldo_intcore_reg: ab8500_ldo_intcore {
320 regulator-name = "V-INTCORE"; 327 regulator-name = "V-INTCORE";
321 }; 328 };
322 329
@@ -336,7 +343,7 @@
336 regulator-name = "V-AMIC1"; 343 regulator-name = "V-AMIC1";
337 }; 344 };
338 345
339 ab8500_ldo_amamic2_reg: ab8500_ldo_amamic2 { 346 ab8500_ldo_anamic2_reg: ab8500_ldo_anamic2 {
340 regulator-name = "V-AMIC2"; 347 regulator-name = "V-AMIC2";
341 }; 348 };
342 349
diff --git a/arch/arm/boot/dts/socfpga.dtsi b/arch/arm/boot/dts/socfpga.dtsi
index 16a6e13e08b4..bee62a2cf6d6 100644
--- a/arch/arm/boot/dts/socfpga.dtsi
+++ b/arch/arm/boot/dts/socfpga.dtsi
@@ -23,6 +23,7 @@
23 23
24 aliases { 24 aliases {
25 ethernet0 = &gmac0; 25 ethernet0 = &gmac0;
26 ethernet1 = &gmac1;
26 serial0 = &uart0; 27 serial0 = &uart0;
27 serial1 = &uart1; 28 serial1 = &uart1;
28 timer0 = &timer0; 29 timer0 = &timer0;
@@ -94,6 +95,12 @@
94 compatible = "fixed-clock"; 95 compatible = "fixed-clock";
95 }; 96 };
96 97
98 f2s_periph_ref_clk: f2s_periph_ref_clk {
99 #clock-cells = <0>;
100 compatible = "fixed-clock";
101 clock-frequency = <10000000>;
102 };
103
97 main_pll: main_pll { 104 main_pll: main_pll {
98 #address-cells = <1>; 105 #address-cells = <1>;
99 #size-cells = <0>; 106 #size-cells = <0>;
@@ -235,16 +242,222 @@
235 reg = <0xD4>; 242 reg = <0xD4>;
236 }; 243 };
237 }; 244 };
245
246 mpu_periph_clk: mpu_periph_clk {
247 #clock-cells = <0>;
248 compatible = "altr,socfpga-gate-clk";
249 clocks = <&mpuclk>;
250 fixed-divider = <4>;
251 };
252
253 mpu_l2_ram_clk: mpu_l2_ram_clk {
254 #clock-cells = <0>;
255 compatible = "altr,socfpga-gate-clk";
256 clocks = <&mpuclk>;
257 fixed-divider = <2>;
258 };
259
260 l4_main_clk: l4_main_clk {
261 #clock-cells = <0>;
262 compatible = "altr,socfpga-gate-clk";
263 clocks = <&mainclk>;
264 clk-gate = <0x60 0>;
265 };
266
267 l3_main_clk: l3_main_clk {
268 #clock-cells = <0>;
269 compatible = "altr,socfpga-gate-clk";
270 clocks = <&mainclk>;
271 };
272
273 l3_mp_clk: l3_mp_clk {
274 #clock-cells = <0>;
275 compatible = "altr,socfpga-gate-clk";
276 clocks = <&mainclk>;
277 div-reg = <0x64 0 2>;
278 clk-gate = <0x60 1>;
279 };
280
281 l3_sp_clk: l3_sp_clk {
282 #clock-cells = <0>;
283 compatible = "altr,socfpga-gate-clk";
284 clocks = <&mainclk>;
285 div-reg = <0x64 2 2>;
286 };
287
288 l4_mp_clk: l4_mp_clk {
289 #clock-cells = <0>;
290 compatible = "altr,socfpga-gate-clk";
291 clocks = <&mainclk>, <&per_base_clk>;
292 div-reg = <0x64 4 3>;
293 clk-gate = <0x60 2>;
294 };
295
296 l4_sp_clk: l4_sp_clk {
297 #clock-cells = <0>;
298 compatible = "altr,socfpga-gate-clk";
299 clocks = <&mainclk>, <&per_base_clk>;
300 div-reg = <0x64 7 3>;
301 clk-gate = <0x60 3>;
302 };
303
304 dbg_at_clk: dbg_at_clk {
305 #clock-cells = <0>;
306 compatible = "altr,socfpga-gate-clk";
307 clocks = <&dbg_base_clk>;
308 div-reg = <0x68 0 2>;
309 clk-gate = <0x60 4>;
310 };
311
312 dbg_clk: dbg_clk {
313 #clock-cells = <0>;
314 compatible = "altr,socfpga-gate-clk";
315 clocks = <&dbg_base_clk>;
316 div-reg = <0x68 2 2>;
317 clk-gate = <0x60 5>;
318 };
319
320 dbg_trace_clk: dbg_trace_clk {
321 #clock-cells = <0>;
322 compatible = "altr,socfpga-gate-clk";
323 clocks = <&dbg_base_clk>;
324 div-reg = <0x6C 0 3>;
325 clk-gate = <0x60 6>;
326 };
327
328 dbg_timer_clk: dbg_timer_clk {
329 #clock-cells = <0>;
330 compatible = "altr,socfpga-gate-clk";
331 clocks = <&dbg_base_clk>;
332 clk-gate = <0x60 7>;
333 };
334
335 cfg_clk: cfg_clk {
336 #clock-cells = <0>;
337 compatible = "altr,socfpga-gate-clk";
338 clocks = <&cfg_s2f_usr0_clk>;
339 clk-gate = <0x60 8>;
340 };
341
342 s2f_user0_clk: s2f_user0_clk {
343 #clock-cells = <0>;
344 compatible = "altr,socfpga-gate-clk";
345 clocks = <&cfg_s2f_usr0_clk>;
346 clk-gate = <0x60 9>;
347 };
348
349 emac_0_clk: emac_0_clk {
350 #clock-cells = <0>;
351 compatible = "altr,socfpga-gate-clk";
352 clocks = <&emac0_clk>;
353 clk-gate = <0xa0 0>;
354 };
355
356 emac_1_clk: emac_1_clk {
357 #clock-cells = <0>;
358 compatible = "altr,socfpga-gate-clk";
359 clocks = <&emac1_clk>;
360 clk-gate = <0xa0 1>;
361 };
362
363 usb_mp_clk: usb_mp_clk {
364 #clock-cells = <0>;
365 compatible = "altr,socfpga-gate-clk";
366 clocks = <&per_base_clk>;
367 clk-gate = <0xa0 2>;
368 div-reg = <0xa4 0 3>;
369 };
370
371 spi_m_clk: spi_m_clk {
372 #clock-cells = <0>;
373 compatible = "altr,socfpga-gate-clk";
374 clocks = <&per_base_clk>;
375 clk-gate = <0xa0 3>;
376 div-reg = <0xa4 3 3>;
377 };
378
379 can0_clk: can0_clk {
380 #clock-cells = <0>;
381 compatible = "altr,socfpga-gate-clk";
382 clocks = <&per_base_clk>;
383 clk-gate = <0xa0 4>;
384 div-reg = <0xa4 6 3>;
385 };
386
387 can1_clk: can1_clk {
388 #clock-cells = <0>;
389 compatible = "altr,socfpga-gate-clk";
390 clocks = <&per_base_clk>;
391 clk-gate = <0xa0 5>;
392 div-reg = <0xa4 9 3>;
393 };
394
395 gpio_db_clk: gpio_db_clk {
396 #clock-cells = <0>;
397 compatible = "altr,socfpga-gate-clk";
398 clocks = <&per_base_clk>;
399 clk-gate = <0xa0 6>;
400 div-reg = <0xa8 0 24>;
401 };
402
403 s2f_user1_clk: s2f_user1_clk {
404 #clock-cells = <0>;
405 compatible = "altr,socfpga-gate-clk";
406 clocks = <&s2f_usr1_clk>;
407 clk-gate = <0xa0 7>;
408 };
409
410 sdmmc_clk: sdmmc_clk {
411 #clock-cells = <0>;
412 compatible = "altr,socfpga-gate-clk";
413 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
414 clk-gate = <0xa0 8>;
415 };
416
417 nand_x_clk: nand_x_clk {
418 #clock-cells = <0>;
419 compatible = "altr,socfpga-gate-clk";
420 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
421 clk-gate = <0xa0 9>;
422 };
423
424 nand_clk: nand_clk {
425 #clock-cells = <0>;
426 compatible = "altr,socfpga-gate-clk";
427 clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
428 clk-gate = <0xa0 10>;
429 fixed-divider = <4>;
430 };
431
432 qspi_clk: qspi_clk {
433 #clock-cells = <0>;
434 compatible = "altr,socfpga-gate-clk";
435 clocks = <&f2s_periph_ref_clk>, <&main_qspi_clk>, <&per_qspi_clk>;
436 clk-gate = <0xa0 11>;
437 };
238 }; 438 };
239 }; 439 };
240 440
241 gmac0: stmmac@ff700000 { 441 gmac0: ethernet@ff700000 {
242 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac"; 442 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
243 reg = <0xff700000 0x2000>; 443 reg = <0xff700000 0x2000>;
244 interrupts = <0 115 4>; 444 interrupts = <0 115 4>;
245 interrupt-names = "macirq"; 445 interrupt-names = "macirq";
246 mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */ 446 mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
247 phy-mode = "gmii"; 447 clocks = <&emac0_clk>;
448 clock-names = "stmmaceth";
449 status = "disabled";
450 };
451
452 gmac1: ethernet@ff702000 {
453 compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
454 reg = <0xff702000 0x2000>;
455 interrupts = <0 120 4>;
456 interrupt-names = "macirq";
457 mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
458 clocks = <&emac1_clk>;
459 clock-names = "stmmaceth";
460 status = "disabled";
248 }; 461 };
249 462
250 L2: l2-cache@fffef000 { 463 L2: l2-cache@fffef000 {
diff --git a/arch/arm/boot/dts/socfpga_cyclone5.dts b/arch/arm/boot/dts/socfpga_cyclone5.dts
index 2495958f1016..973999d2c697 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5.dts
@@ -32,6 +32,13 @@
32 reg = <0x0 0x40000000>; /* 1GB */ 32 reg = <0x0 0x40000000>; /* 1GB */
33 }; 33 };
34 34
35 aliases {
36 /* this allow the ethaddr uboot environmnet variable contents
37 * to be added to the gmac1 device tree blob.
38 */
39 ethernet0 = &gmac1;
40 };
41
35 soc { 42 soc {
36 clkmgr@ffd04000 { 43 clkmgr@ffd04000 {
37 clocks { 44 clocks {
@@ -41,6 +48,12 @@
41 }; 48 };
42 }; 49 };
43 50
51 ethernet@ff702000 {
52 phy-mode = "rgmii";
53 phy-addr = <0xffffffff>; /* probe for phy addr */
54 status = "okay";
55 };
56
44 timer0@ffc08000 { 57 timer0@ffc08000 {
45 clock-frequency = <100000000>; 58 clock-frequency = <100000000>;
46 }; 59 };
diff --git a/arch/arm/boot/dts/socfpga_vt.dts b/arch/arm/boot/dts/socfpga_vt.dts
index 0bf035d607f0..d1ec0cab2dee 100644
--- a/arch/arm/boot/dts/socfpga_vt.dts
+++ b/arch/arm/boot/dts/socfpga_vt.dts
@@ -41,6 +41,11 @@
41 }; 41 };
42 }; 42 };
43 43
44 ethernet@ff700000 {
45 phy-mode = "gmii";
46 status = "okay";
47 };
48
44 timer0@ffc08000 { 49 timer0@ffc08000 {
45 clock-frequency = <7000000>; 50 clock-frequency = <7000000>;
46 }; 51 };
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi
index 45597fd91050..4382547df58a 100644
--- a/arch/arm/boot/dts/spear13xx.dtsi
+++ b/arch/arm/boot/dts/spear13xx.dtsi
@@ -22,12 +22,14 @@
22 22
23 cpu@0 { 23 cpu@0 {
24 compatible = "arm,cortex-a9"; 24 compatible = "arm,cortex-a9";
25 device_type = "cpu";
25 reg = <0>; 26 reg = <0>;
26 next-level-cache = <&L2>; 27 next-level-cache = <&L2>;
27 }; 28 };
28 29
29 cpu@1 { 30 cpu@1 {
30 compatible = "arm,cortex-a9"; 31 compatible = "arm,cortex-a9";
32 device_type = "cpu";
31 reg = <1>; 33 reg = <1>;
32 next-level-cache = <&L2>; 34 next-level-cache = <&L2>;
33 }; 35 };
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi
index c2a852d43c48..f0e3fcf8e323 100644
--- a/arch/arm/boot/dts/spear3xx.dtsi
+++ b/arch/arm/boot/dts/spear3xx.dtsi
@@ -17,8 +17,12 @@
17 interrupt-parent = <&vic>; 17 interrupt-parent = <&vic>;
18 18
19 cpus { 19 cpus {
20 cpu@0 { 20 #address-cells = <0>;
21 compatible = "arm,arm926ejs"; 21 #size-cells = <0>;
22
23 cpu {
24 compatible = "arm,arm926ej-s";
25 device_type = "cpu";
22 }; 26 };
23 }; 27 };
24 28
diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi
index 19f99dc4115e..9f60a7b6a42b 100644
--- a/arch/arm/boot/dts/spear600.dtsi
+++ b/arch/arm/boot/dts/spear600.dtsi
@@ -15,8 +15,12 @@
15 compatible = "st,spear600"; 15 compatible = "st,spear600";
16 16
17 cpus { 17 cpus {
18 cpu@0 { 18 #address-cells = <0>;
19 compatible = "arm,arm926ejs"; 19 #size-cells = <0>;
20
21 cpu {
22 compatible = "arm,arm926ej-s";
23 device_type = "cpu";
20 }; 24 };
21 }; 25 };
22 26
diff --git a/arch/arm/boot/dts/st-pincfg.h b/arch/arm/boot/dts/st-pincfg.h
new file mode 100644
index 000000000000..8c45d85ac13e
--- /dev/null
+++ b/arch/arm/boot/dts/st-pincfg.h
@@ -0,0 +1,71 @@
1#ifndef _ST_PINCFG_H_
2#define _ST_PINCFG_H_
3
4/* Alternate functions */
5#define ALT1 1
6#define ALT2 2
7#define ALT3 3
8#define ALT4 4
9#define ALT5 5
10#define ALT6 6
11#define ALT7 7
12
13/* Output enable */
14#define OE (1 << 27)
15/* Pull Up */
16#define PU (1 << 26)
17/* Open Drain */
18#define OD (1 << 26)
19#define RT (1 << 23)
20#define INVERTCLK (1 << 22)
21#define CLKNOTDATA (1 << 21)
22#define DOUBLE_EDGE (1 << 20)
23#define CLK_A (0 << 18)
24#define CLK_B (1 << 18)
25#define CLK_C (2 << 18)
26#define CLK_D (3 << 18)
27
28/* User-frendly defines for Pin Direction */
29 /* oe = 0, pu = 0, od = 0 */
30#define IN (0)
31 /* oe = 0, pu = 1, od = 0 */
32#define IN_PU (PU)
33 /* oe = 1, pu = 0, od = 0 */
34#define OUT (OE)
35 /* oe = 1, pu = 0, od = 1 */
36#define BIDIR (OE | OD)
37 /* oe = 1, pu = 1, od = 1 */
38#define BIDIR_PU (OE | PU | OD)
39
40/* RETIME_TYPE */
41/*
42 * B Mode
43 * Bypass retime with optional delay parameter
44 */
45#define BYPASS (0)
46/*
47 * R0, R1, R0D, R1D modes
48 * single-edge data non inverted clock, retime data with clk
49 */
50#define SE_NICLK_IO (RT)
51/*
52 * RIV0, RIV1, RIV0D, RIV1D modes
53 * single-edge data inverted clock, retime data with clk
54 */
55#define SE_ICLK_IO (RT | INVERTCLK)
56/*
57 * R0E, R1E, R0ED, R1ED modes
58 * double-edge data, retime data with clk
59 */
60#define DE_IO (RT | DOUBLE_EDGE)
61/*
62 * CIV0, CIV1 modes with inverted clock
63 * Retiming the clk pins will park clock & reduce the noise within the core.
64 */
65#define ICLK (RT | CLKNOTDATA | INVERTCLK)
66/*
67 * CLK0, CLK1 modes with non-inverted clock
68 * Retiming the clk pins will park clock & reduce the noise within the core.
69 */
70#define NICLK (RT | CLKNOTDATA)
71#endif /* _ST_PINCFG_H_ */
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts
index 6f82d9368948..16c3888b7b15 100644
--- a/arch/arm/boot/dts/ste-nomadik-s8815.dts
+++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts
@@ -22,6 +22,49 @@
22 }; 22 };
23 }; 23 };
24 24
25 src@101e0000 {
26 /* These chrystal drivers are not used on this board */
27 disable-sxtalo;
28 disable-mxtalo;
29 };
30
31 pinctrl {
32 /* Hog CD pins */
33 pinctrl-names = "default";
34 pinctrl-0 = <&cd_default_mode>;
35
36 mmcsd-cd {
37 cd_default_mode: cd_default {
38 cd_default_cfg1 {
39 /* CD input GPIO */
40 ste,pins = "GPIO111_H21";
41 ste,input = <0>;
42 };
43 cd_default_cfg2 {
44 /* CD GPIO biasing */
45 ste,pins = "GPIO112_J21";
46 ste,output = <0>;
47 };
48 };
49 };
50 user-led {
51 user_led_default_mode: user_led_default {
52 user_led_default_cfg {
53 ste,pins = "GPIO2_C5";
54 ste,output = <1>;
55 };
56 };
57 };
58 user-button {
59 user_button_default_mode: user_button_default {
60 user_button_default_cfg {
61 ste,pins = "GPIO3_A4";
62 ste,input = <0>;
63 };
64 };
65 };
66 };
67
25 /* Custom board node with GPIO pins to active etc */ 68 /* Custom board node with GPIO pins to active etc */
26 usb-s8815 { 69 usb-s8815 {
27 /* The S8815 is using this very GPIO pin for the SMSC91x IRQs */ 70 /* The S8815 is using this very GPIO pin for the SMSC91x IRQs */
@@ -33,4 +76,30 @@
33 gpios = <&gpio3 16 0x1>; 76 gpios = <&gpio3 16 0x1>;
34 }; 77 };
35 }; 78 };
79
80 /* The user LED on the board is set up to be used for heartbeat */
81 leds {
82 compatible = "gpio-leds";
83 user-led {
84 label = "user_led";
85 gpios = <&gpio0 2 0x1>;
86 default-state = "off";
87 linux,default-trigger = "heartbeat";
88 pinctrl-names = "default";
89 pinctrl-0 = <&user_led_default_mode>;
90 };
91 };
92
93 /* User key mapped in as "escape" */
94 gpio-keys {
95 compatible = "gpio-keys";
96 user-button {
97 label = "user_button";
98 gpios = <&gpio0 3 0x1>;
99 linux,code = <1>; /* KEY_ESC */
100 gpio-key,wakeup;
101 pinctrl-names = "default";
102 pinctrl-0 = <&user_button_default_mode>;
103 };
104 };
36}; 105};
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
index 4a4aab395141..a3acfa7b3dc9 100644
--- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
+++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi
@@ -21,18 +21,23 @@
21 cache-level = <2>; 21 cache-level = <2>;
22 }; 22 };
23 23
24 mtu0 { 24 mtu0: mtu@101e2000 {
25 /* Nomadik system timer */ 25 /* Nomadik system timer */
26 compatible = "st,nomadik-mtu";
26 reg = <0x101e2000 0x1000>; 27 reg = <0x101e2000 0x1000>;
27 interrupt-parent = <&vica>; 28 interrupt-parent = <&vica>;
28 interrupts = <4>; 29 interrupts = <4>;
30 clocks = <&timclk>, <&pclk>;
31 clock-names = "timclk", "apb_pclk";
29 }; 32 };
30 33
31 mtu1 { 34 mtu1: mtu@101e3000 {
32 /* Secondary timer */ 35 /* Secondary timer */
33 reg = <0x101e3000 0x1000>; 36 reg = <0x101e3000 0x1000>;
34 interrupt-parent = <&vica>; 37 interrupt-parent = <&vica>;
35 interrupts = <5>; 38 interrupts = <5>;
39 clocks = <&timclk>, <&pclk>;
40 clock-names = "timclk", "apb_pclk";
36 }; 41 };
37 42
38 gpio0: gpio@101e4000 { 43 gpio0: gpio@101e4000 {
@@ -45,6 +50,7 @@
45 gpio-controller; 50 gpio-controller;
46 #gpio-cells = <2>; 51 #gpio-cells = <2>;
47 gpio-bank = <0>; 52 gpio-bank = <0>;
53 clocks = <&pclk>;
48 }; 54 };
49 55
50 gpio1: gpio@101e5000 { 56 gpio1: gpio@101e5000 {
@@ -57,6 +63,7 @@
57 gpio-controller; 63 gpio-controller;
58 #gpio-cells = <2>; 64 #gpio-cells = <2>;
59 gpio-bank = <1>; 65 gpio-bank = <1>;
66 clocks = <&pclk>;
60 }; 67 };
61 68
62 gpio2: gpio@101e6000 { 69 gpio2: gpio@101e6000 {
@@ -69,6 +76,7 @@
69 gpio-controller; 76 gpio-controller;
70 #gpio-cells = <2>; 77 #gpio-cells = <2>;
71 gpio-bank = <2>; 78 gpio-bank = <2>;
79 clocks = <&pclk>;
72 }; 80 };
73 81
74 gpio3: gpio@101e7000 { 82 gpio3: gpio@101e7000 {
@@ -81,10 +89,544 @@
81 gpio-controller; 89 gpio-controller;
82 #gpio-cells = <2>; 90 #gpio-cells = <2>;
83 gpio-bank = <3>; 91 gpio-bank = <3>;
92 clocks = <&pclk>;
84 }; 93 };
85 94
86 pinctrl { 95 pinctrl {
87 compatible = "stericsson,nmk-pinctrl-stn8815"; 96 compatible = "stericsson,stn8815-pinctrl";
97 /* Pin configurations */
98 uart0 {
99 uart0_default_mux: uart0_mux {
100 u0_default_mux {
101 ste,function = "u0";
102 ste,pins = "u0_a_1";
103 };
104 };
105 };
106 uart1 {
107 uart1_default_mux: uart1_mux {
108 u1_default_mux {
109 ste,function = "u1";
110 ste,pins = "u1_a_1";
111 };
112 };
113 };
114 mmcsd {
115 mmcsd_default_mux: mmcsd_mux {
116 mmcsd_default_mux {
117 ste,function = "mmcsd";
118 ste,pins = "mmcsd_a_1";
119 };
120 };
121 mmcsd_default_mode: mmcsd_default {
122 mmcsd_default_cfg1 {
123 /* MCCLK */
124 ste,pins = "GPIO8_B10";
125 ste,output = <0>;
126 };
127 mmcsd_default_cfg2 {
128 /* MCCMDDIR, MCDAT0DIR, MCDAT31DIR */
129 ste,pins = "GPIO10_C11", "GPIO15_A12",
130 "GPIO16_C13";
131 ste,output = <1>;
132 };
133 mmcsd_default_cfg3 {
134 /* MCCMD, MCDAT3-0, MCMSFBCLK */
135 ste,pins = "GPIO9_A10", "GPIO11_B11",
136 "GPIO12_A11", "GPIO13_C12",
137 "GPIO14_B12", "GPIO24_C15";
138 ste,input = <1>;
139 };
140 };
141 };
142 i2c0 {
143 i2c0_default_mode: i2c0_default {
144 i2c0_default_cfg {
145 ste,pins = "GPIO62_D3", "GPIO63_D2";
146 ste,input = <1>;
147 };
148 };
149 };
150 i2c1 {
151 i2c1_default_mode: i2c1_default {
152 i2c1_default_cfg {
153 ste,pins = "GPIO53_L4", "GPIO54_L3";
154 ste,input = <1>;
155 };
156 };
157 };
158 i2c2 {
159 i2c2_default_mode: i2c2_default {
160 i2c2_default_cfg {
161 ste,pins = "GPIO73_C21", "GPIO74_C20";
162 ste,input = <1>;
163 };
164 };
165 };
166 };
167
168 src: src@101e0000 {
169 compatible = "stericsson,nomadik-src";
170 reg = <0x101e0000 0x1000>;
171 disable-sxtalo;
172 disable-mxtalo;
173
174 /*
175 * MXTAL "Main Chrystal" is a chrystal oscillator @19.2 MHz
176 * that is parent of TIMCLK, PLL1 and PLL2
177 */
178 mxtal: mxtal@19.2M {
179 #clock-cells = <0>;
180 compatible = "fixed-clock";
181 clock-frequency = <19200000>;
182 };
183
184 /*
185 * The 2.4 MHz TIMCLK reference clock is active at
186 * boot time, this is actually the MXTALCLK @19.2 MHz
187 * divided by 8. This clock is used by the timers and
188 * watchdog. See page 105 ff.
189 */
190 timclk: timclk@2.4M {
191 #clock-cells = <0>;
192 compatible = "fixed-factor-clock";
193 clock-div = <8>;
194 clock-mult = <1>;
195 clocks = <&mxtal>;
196 };
197
198 /* PLL1 is locked to MXTALI and variable from 20.4 to 334 MHz */
199 pll1: pll1@0 {
200 #clock-cells = <0>;
201 compatible = "st,nomadik-pll-clock";
202 pll-id = <1>;
203 clocks = <&mxtal>;
204 };
205
206 /* HCLK divides the PLL1 with 1,2,3 or 4 */
207 hclk: hclk@0 {
208 #clock-cells = <0>;
209 compatible = "st,nomadik-hclk-clock";
210 clocks = <&pll1>;
211 };
212 /* The PCLK domain uses HCLK right off */
213 pclk: pclk@0 {
214 #clock-cells = <0>;
215 compatible = "fixed-factor-clock";
216 clock-div = <1>;
217 clock-mult = <1>;
218 clocks = <&hclk>;
219 };
220
221 /* PLL2 is usually 864 MHz and divided into a few fixed rates */
222 pll2: pll2@0 {
223 #clock-cells = <0>;
224 compatible = "st,nomadik-pll-clock";
225 pll-id = <2>;
226 clocks = <&mxtal>;
227 };
228 clk216: clk216@216M {
229 #clock-cells = <0>;
230 compatible = "fixed-factor-clock";
231 clock-div = <4>;
232 clock-mult = <1>;
233 clocks = <&pll2>;
234 };
235 clk108: clk108@108M {
236 #clock-cells = <0>;
237 compatible = "fixed-factor-clock";
238 clock-div = <2>;
239 clock-mult = <1>;
240 clocks = <&clk216>;
241 };
242 clk72: clk72@72M {
243 #clock-cells = <0>;
244 compatible = "fixed-factor-clock";
245 /* The data sheet does not say how this is derived */
246 clock-div = <12>;
247 clock-mult = <1>;
248 clocks = <&pll2>;
249 };
250 clk48: clk48@48M {
251 #clock-cells = <0>;
252 compatible = "fixed-factor-clock";
253 /* The data sheet does not say how this is derived */
254 clock-div = <18>;
255 clock-mult = <1>;
256 clocks = <&pll2>;
257 };
258 clk27: clk27@27M {
259 #clock-cells = <0>;
260 compatible = "fixed-factor-clock";
261 clock-div = <4>;
262 clock-mult = <1>;
263 clocks = <&clk108>;
264 };
265
266 /* This apparently exists as well */
267 ulpiclk: ulpiclk@60M {
268 #clock-cells = <0>;
269 compatible = "fixed-clock";
270 clock-frequency = <60000000>;
271 };
272
273 /*
274 * IP AMBA bus clocks, driving the bus side of the
275 * peripheral clocking, clock gates.
276 */
277
278 hclkdma0: hclkdma0@48M {
279 #clock-cells = <0>;
280 compatible = "st,nomadik-src-clock";
281 clock-id = <0>;
282 clocks = <&hclk>;
283 };
284 hclksmc: hclksmc@48M {
285 #clock-cells = <0>;
286 compatible = "st,nomadik-src-clock";
287 clock-id = <1>;
288 clocks = <&hclk>;
289 };
290 hclksdram: hclksdram@48M {
291 #clock-cells = <0>;
292 compatible = "st,nomadik-src-clock";
293 clock-id = <2>;
294 clocks = <&hclk>;
295 };
296 hclkdma1: hclkdma1@48M {
297 #clock-cells = <0>;
298 compatible = "st,nomadik-src-clock";
299 clock-id = <3>;
300 clocks = <&hclk>;
301 };
302 hclkclcd: hclkclcd@48M {
303 #clock-cells = <0>;
304 compatible = "st,nomadik-src-clock";
305 clock-id = <4>;
306 clocks = <&hclk>;
307 };
308 pclkirda: pclkirda@48M {
309 #clock-cells = <0>;
310 compatible = "st,nomadik-src-clock";
311 clock-id = <5>;
312 clocks = <&pclk>;
313 };
314 pclkssp: pclkssp@48M {
315 #clock-cells = <0>;
316 compatible = "st,nomadik-src-clock";
317 clock-id = <6>;
318 clocks = <&pclk>;
319 };
320 pclkuart0: pclkuart0@48M {
321 #clock-cells = <0>;
322 compatible = "st,nomadik-src-clock";
323 clock-id = <7>;
324 clocks = <&pclk>;
325 };
326 pclksdi: pclksdi@48M {
327 #clock-cells = <0>;
328 compatible = "st,nomadik-src-clock";
329 clock-id = <8>;
330 clocks = <&pclk>;
331 };
332 pclki2c0: pclki2c0@48M {
333 #clock-cells = <0>;
334 compatible = "st,nomadik-src-clock";
335 clock-id = <9>;
336 clocks = <&pclk>;
337 };
338 pclki2c1: pclki2c1@48M {
339 #clock-cells = <0>;
340 compatible = "st,nomadik-src-clock";
341 clock-id = <10>;
342 clocks = <&pclk>;
343 };
344 pclkuart1: pclkuart1@48M {
345 #clock-cells = <0>;
346 compatible = "st,nomadik-src-clock";
347 clock-id = <11>;
348 clocks = <&pclk>;
349 };
350 pclkmsp0: pclkmsp0@48M {
351 #clock-cells = <0>;
352 compatible = "st,nomadik-src-clock";
353 clock-id = <12>;
354 clocks = <&pclk>;
355 };
356 hclkusb: hclkusb@48M {
357 #clock-cells = <0>;
358 compatible = "st,nomadik-src-clock";
359 clock-id = <13>;
360 clocks = <&hclk>;
361 };
362 hclkdif: hclkdif@48M {
363 #clock-cells = <0>;
364 compatible = "st,nomadik-src-clock";
365 clock-id = <14>;
366 clocks = <&hclk>;
367 };
368 hclksaa: hclksaa@48M {
369 #clock-cells = <0>;
370 compatible = "st,nomadik-src-clock";
371 clock-id = <15>;
372 clocks = <&hclk>;
373 };
374 hclksva: hclksva@48M {
375 #clock-cells = <0>;
376 compatible = "st,nomadik-src-clock";
377 clock-id = <16>;
378 clocks = <&hclk>;
379 };
380 pclkhsi: pclkhsi@48M {
381 #clock-cells = <0>;
382 compatible = "st,nomadik-src-clock";
383 clock-id = <17>;
384 clocks = <&pclk>;
385 };
386 pclkxti: pclkxti@48M {
387 #clock-cells = <0>;
388 compatible = "st,nomadik-src-clock";
389 clock-id = <18>;
390 clocks = <&pclk>;
391 };
392 pclkuart2: pclkuart2@48M {
393 #clock-cells = <0>;
394 compatible = "st,nomadik-src-clock";
395 clock-id = <19>;
396 clocks = <&pclk>;
397 };
398 pclkmsp1: pclkmsp1@48M {
399 #clock-cells = <0>;
400 compatible = "st,nomadik-src-clock";
401 clock-id = <20>;
402 clocks = <&pclk>;
403 };
404 pclkmsp2: pclkmsp2@48M {
405 #clock-cells = <0>;
406 compatible = "st,nomadik-src-clock";
407 clock-id = <21>;
408 clocks = <&pclk>;
409 };
410 pclkowm: pclkowm@48M {
411 #clock-cells = <0>;
412 compatible = "st,nomadik-src-clock";
413 clock-id = <22>;
414 clocks = <&pclk>;
415 };
416 hclkhpi: hclkhpi@48M {
417 #clock-cells = <0>;
418 compatible = "st,nomadik-src-clock";
419 clock-id = <23>;
420 clocks = <&hclk>;
421 };
422 pclkske: pclkske@48M {
423 #clock-cells = <0>;
424 compatible = "st,nomadik-src-clock";
425 clock-id = <24>;
426 clocks = <&pclk>;
427 };
428 pclkhsem: pclkhsem@48M {
429 #clock-cells = <0>;
430 compatible = "st,nomadik-src-clock";
431 clock-id = <25>;
432 clocks = <&pclk>;
433 };
434 hclk3d: hclk3d@48M {
435 #clock-cells = <0>;
436 compatible = "st,nomadik-src-clock";
437 clock-id = <26>;
438 clocks = <&hclk>;
439 };
440 hclkhash: hclkhash@48M {
441 #clock-cells = <0>;
442 compatible = "st,nomadik-src-clock";
443 clock-id = <27>;
444 clocks = <&hclk>;
445 };
446 hclkcryp: hclkcryp@48M {
447 #clock-cells = <0>;
448 compatible = "st,nomadik-src-clock";
449 clock-id = <28>;
450 clocks = <&hclk>;
451 };
452 pclkmshc: pclkmshc@48M {
453 #clock-cells = <0>;
454 compatible = "st,nomadik-src-clock";
455 clock-id = <29>;
456 clocks = <&pclk>;
457 };
458 hclkusbm: hclkusbm@48M {
459 #clock-cells = <0>;
460 compatible = "st,nomadik-src-clock";
461 clock-id = <30>;
462 clocks = <&hclk>;
463 };
464 hclkrng: hclkrng@48M {
465 #clock-cells = <0>;
466 compatible = "st,nomadik-src-clock";
467 clock-id = <31>;
468 clocks = <&hclk>;
469 };
470
471 /* IP kernel clocks */
472 clcdclk: clcdclk@0 {
473 #clock-cells = <0>;
474 compatible = "st,nomadik-src-clock";
475 clock-id = <36>;
476 clocks = <&clk72 &clk48>;
477 };
478 irdaclk: irdaclk@48M {
479 #clock-cells = <0>;
480 compatible = "st,nomadik-src-clock";
481 clock-id = <37>;
482 clocks = <&clk48>;
483 };
484 sspiclk: sspiclk@48M {
485 #clock-cells = <0>;
486 compatible = "st,nomadik-src-clock";
487 clock-id = <38>;
488 clocks = <&clk48>;
489 };
490 uart0clk: uart0clk@48M {
491 #clock-cells = <0>;
492 compatible = "st,nomadik-src-clock";
493 clock-id = <39>;
494 clocks = <&clk48>;
495 };
496 sdiclk: sdiclk@48M {
497 /* Also called MCCLK in some documents */
498 #clock-cells = <0>;
499 compatible = "st,nomadik-src-clock";
500 clock-id = <40>;
501 clocks = <&clk48>;
502 };
503 i2c0clk: i2c0clk@48M {
504 #clock-cells = <0>;
505 compatible = "st,nomadik-src-clock";
506 clock-id = <41>;
507 clocks = <&clk48>;
508 };
509 i2c1clk: i2c1clk@48M {
510 #clock-cells = <0>;
511 compatible = "st,nomadik-src-clock";
512 clock-id = <42>;
513 clocks = <&clk48>;
514 };
515 uart1clk: uart1clk@48M {
516 #clock-cells = <0>;
517 compatible = "st,nomadik-src-clock";
518 clock-id = <43>;
519 clocks = <&clk48>;
520 };
521 mspclk0: mspclk0@48M {
522 #clock-cells = <0>;
523 compatible = "st,nomadik-src-clock";
524 clock-id = <44>;
525 clocks = <&clk48>;
526 };
527 usbclk: usbclk@48M {
528 #clock-cells = <0>;
529 compatible = "st,nomadik-src-clock";
530 clock-id = <45>;
531 clocks = <&clk48>; /* 48 MHz not ULPI */
532 };
533 difclk: difclk@72M {
534 #clock-cells = <0>;
535 compatible = "st,nomadik-src-clock";
536 clock-id = <46>;
537 clocks = <&clk72>;
538 };
539 ipi2cclk: ipi2cclk@48M {
540 #clock-cells = <0>;
541 compatible = "st,nomadik-src-clock";
542 clock-id = <47>;
543 clocks = <&clk48>; /* Guess */
544 };
545 ipbmcclk: ipbmcclk@48M {
546 #clock-cells = <0>;
547 compatible = "st,nomadik-src-clock";
548 clock-id = <48>;
549 clocks = <&clk48>; /* Guess */
550 };
551 hsiclkrx: hsiclkrx@216M {
552 #clock-cells = <0>;
553 compatible = "st,nomadik-src-clock";
554 clock-id = <49>;
555 clocks = <&clk216>;
556 };
557 hsiclktx: hsiclktx@108M {
558 #clock-cells = <0>;
559 compatible = "st,nomadik-src-clock";
560 clock-id = <50>;
561 clocks = <&clk108>;
562 };
563 uart2clk: uart2clk@48M {
564 #clock-cells = <0>;
565 compatible = "st,nomadik-src-clock";
566 clock-id = <51>;
567 clocks = <&clk48>;
568 };
569 mspclk1: mspclk1@48M {
570 #clock-cells = <0>;
571 compatible = "st,nomadik-src-clock";
572 clock-id = <52>;
573 clocks = <&clk48>;
574 };
575 mspclk2: mspclk2@48M {
576 #clock-cells = <0>;
577 compatible = "st,nomadik-src-clock";
578 clock-id = <53>;
579 clocks = <&clk48>;
580 };
581 owmclk: owmclk@48M {
582 #clock-cells = <0>;
583 compatible = "st,nomadik-src-clock";
584 clock-id = <54>;
585 clocks = <&clk48>; /* Guess */
586 };
587 skeclk: skeclk@48M {
588 #clock-cells = <0>;
589 compatible = "st,nomadik-src-clock";
590 clock-id = <56>;
591 clocks = <&clk48>; /* Guess */
592 };
593 x3dclk: x3dclk@48M {
594 #clock-cells = <0>;
595 compatible = "st,nomadik-src-clock";
596 clock-id = <58>;
597 clocks = <&clk48>; /* Guess */
598 };
599 pclkmsp3: pclkmsp3@48M {
600 #clock-cells = <0>;
601 compatible = "st,nomadik-src-clock";
602 clock-id = <59>;
603 clocks = <&pclk>;
604 };
605 mspclk3: mspclk3@48M {
606 #clock-cells = <0>;
607 compatible = "st,nomadik-src-clock";
608 clock-id = <60>;
609 clocks = <&clk48>;
610 };
611 mshcclk: mshcclk@48M {
612 #clock-cells = <0>;
613 compatible = "st,nomadik-src-clock";
614 clock-id = <61>;
615 clocks = <&clk48>; /* Guess */
616 };
617 usbmclk: usbmclk@48M {
618 #clock-cells = <0>;
619 compatible = "st,nomadik-src-clock";
620 clock-id = <62>;
621 /* Stated as "48 MHz not ULPI clock" */
622 clocks = <&clk48>;
623 };
624 rngcclk: rngcclk@48M {
625 #clock-cells = <0>;
626 compatible = "st,nomadik-src-clock";
627 clock-id = <63>;
628 clocks = <&clk48>; /* Guess */
629 };
88 }; 630 };
89 631
90 /* A NAND flash of 128 MiB */ 632 /* A NAND flash of 128 MiB */
@@ -97,6 +639,7 @@
97 <0x41000000 0x2000>, /* NAND Base ADDR */ 639 <0x41000000 0x2000>, /* NAND Base ADDR */
98 <0x40800000 0x2000>; /* NAND Base CMD */ 640 <0x40800000 0x2000>; /* NAND Base CMD */
99 reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd"; 641 reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
642 clocks = <&hclksmc>;
100 status = "okay"; 643 status = "okay";
101 644
102 partition@0 { 645 partition@0 {
@@ -144,6 +687,8 @@
144 <&gpio1 30 0>; /* scl */ 687 <&gpio1 30 0>; /* scl */
145 #address-cells = <1>; 688 #address-cells = <1>;
146 #size-cells = <0>; 689 #size-cells = <0>;
690 pinctrl-names = "default";
691 pinctrl-0 = <&i2c0_default_mode>;
147 692
148 stw4811@2d { 693 stw4811@2d {
149 compatible = "st,stw4811"; 694 compatible = "st,stw4811";
@@ -158,6 +703,8 @@
158 <&gpio1 21 0>; /* scl */ 703 <&gpio1 21 0>; /* scl */
159 #address-cells = <1>; 704 #address-cells = <1>;
160 #size-cells = <0>; 705 #size-cells = <0>;
706 pinctrl-names = "default";
707 pinctrl-0 = <&i2c1_default_mode>;
161 708
162 camera@2d { 709 camera@2d {
163 compatible = "st,camera"; 710 compatible = "st,camera";
@@ -180,6 +727,9 @@
180 <&gpio2 9 0>; /* scl */ 727 <&gpio2 9 0>; /* scl */
181 #address-cells = <1>; 728 #address-cells = <1>;
182 #size-cells = <0>; 729 #size-cells = <0>;
730 pinctrl-names = "default";
731 pinctrl-0 = <&i2c2_default_mode>;
732
183 stw4811@2d { 733 stw4811@2d {
184 compatible = "st,stw4811-usb"; 734 compatible = "st,stw4811-usb";
185 reg = <0x2d>; 735 reg = <0x2d>;
@@ -211,6 +761,10 @@
211 reg = <0x101fd000 0x1000>; 761 reg = <0x101fd000 0x1000>;
212 interrupt-parent = <&vica>; 762 interrupt-parent = <&vica>;
213 interrupts = <12>; 763 interrupts = <12>;
764 clocks = <&uart0clk>, <&pclkuart0>;
765 clock-names = "uartclk", "apb_pclk";
766 pinctrl-names = "default";
767 pinctrl-0 = <&uart0_default_mux>;
214 }; 768 };
215 769
216 uart1: uart@101fb000 { 770 uart1: uart@101fb000 {
@@ -218,6 +772,10 @@
218 reg = <0x101fb000 0x1000>; 772 reg = <0x101fb000 0x1000>;
219 interrupt-parent = <&vica>; 773 interrupt-parent = <&vica>;
220 interrupts = <17>; 774 interrupts = <17>;
775 clocks = <&uart1clk>, <&pclkuart1>;
776 clock-names = "uartclk", "apb_pclk";
777 pinctrl-names = "default";
778 pinctrl-0 = <&uart1_default_mux>;
221 }; 779 };
222 780
223 uart2: uart@101f2000 { 781 uart2: uart@101f2000 {
@@ -225,17 +783,23 @@
225 reg = <0x101f2000 0x1000>; 783 reg = <0x101f2000 0x1000>;
226 interrupt-parent = <&vica>; 784 interrupt-parent = <&vica>;
227 interrupts = <28>; 785 interrupts = <28>;
786 clocks = <&uart2clk>, <&pclkuart2>;
787 clock-names = "uartclk", "apb_pclk";
228 status = "disabled"; 788 status = "disabled";
229 }; 789 };
230 790
231 rng: rng@101b0000 { 791 rng: rng@101b0000 {
232 compatible = "arm,primecell"; 792 compatible = "arm,primecell";
233 reg = <0x101b0000 0x1000>; 793 reg = <0x101b0000 0x1000>;
794 clocks = <&rngcclk>, <&hclkrng>;
795 clock-names = "rng", "apb_pclk";
234 }; 796 };
235 797
236 rtc: rtc@101e8000 { 798 rtc: rtc@101e8000 {
237 compatible = "arm,pl031", "arm,primecell"; 799 compatible = "arm,pl031", "arm,primecell";
238 reg = <0x101e8000 0x1000>; 800 reg = <0x101e8000 0x1000>;
801 clocks = <&pclk>;
802 clock-names = "apb_pclk";
239 interrupt-parent = <&vica>; 803 interrupt-parent = <&vica>;
240 interrupts = <10>; 804 interrupts = <10>;
241 }; 805 };
@@ -243,6 +807,8 @@
243 mmcsd: sdi@101f6000 { 807 mmcsd: sdi@101f6000 {
244 compatible = "arm,pl18x", "arm,primecell"; 808 compatible = "arm,pl18x", "arm,primecell";
245 reg = <0x101f6000 0x1000>; 809 reg = <0x101f6000 0x1000>;
810 clocks = <&sdiclk>, <&pclksdi>;
811 clock-names = "mclk", "apb_pclk";
246 interrupt-parent = <&vica>; 812 interrupt-parent = <&vica>;
247 interrupts = <22>; 813 interrupts = <22>;
248 max-frequency = <48000000>; 814 max-frequency = <48000000>;
@@ -251,6 +817,8 @@
251 mmc-cap-sd-highspeed; 817 mmc-cap-sd-highspeed;
252 cd-gpios = <&gpio3 15 0x1>; 818 cd-gpios = <&gpio3 15 0x1>;
253 cd-inverted; 819 cd-inverted;
820 pinctrl-names = "default";
821 pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>;
254 }; 822 };
255 }; 823 };
256}; 824};
diff --git a/arch/arm/boot/dts/ste-u300.dts b/arch/arm/boot/dts/ste-u300.dts
new file mode 100644
index 000000000000..8a1032c1ffc9
--- /dev/null
+++ b/arch/arm/boot/dts/ste-u300.dts
@@ -0,0 +1,473 @@
1/*
2 * Device Tree for the ST-Ericsson U300 Machine and SoC
3 */
4
5/dts-v1/;
6/include/ "skeleton.dtsi"
7
8/ {
9 model = "ST-Ericsson U300";
10 compatible = "stericsson,u300";
11 #address-cells = <1>;
12 #size-cells = <1>;
13
14 chosen {
15 bootargs = "root=/dev/ram0 console=ttyAMA0,115200n8 earlyprintk";
16 };
17
18 aliases {
19 serial0 = &uart0;
20 serial1 = &uart1;
21 };
22
23 memory {
24 reg = <0x48000000 0x03c00000>;
25 };
26
27 s365 {
28 compatible = "stericsson,s365";
29 vana15-supply = <&ab3100_ldo_d_reg>;
30 syscon = <&syscon>;
31 };
32
33 syscon: syscon@c0011000 {
34 compatible = "stericsson,u300-syscon", "syscon";
35 reg = <0xc0011000 0x1000>;
36 clk32: app_32_clk@32k {
37 #clock-cells = <0>;
38 compatible = "fixed-clock";
39 clock-frequency = <32768>;
40 };
41 pll13: pll13@13M {
42 #clock-cells = <0>;
43 compatible = "fixed-clock";
44 clock-frequency = <13000000>;
45 };
46 /* Slow bridge clocks under PLL13 */
47 slow_clk: slow_clk@13M {
48 #clock-cells = <0>;
49 compatible = "stericsson,u300-syscon-clk";
50 clock-type = <0>; /* Slow */
51 clock-id = <0>;
52 clocks = <&pll13>;
53 };
54 uart0_clk: uart0_clk@13M {
55 #clock-cells = <0>;
56 compatible = "stericsson,u300-syscon-clk";
57 clock-type = <0>; /* Slow */
58 clock-id = <1>;
59 clocks = <&slow_clk>;
60 };
61 gpio_clk: gpio_clk@13M {
62 #clock-cells = <0>;
63 compatible = "stericsson,u300-syscon-clk";
64 clock-type = <0>; /* Slow */
65 clock-id = <4>;
66 clocks = <&slow_clk>;
67 };
68 rtc_clk: rtc_clk@13M {
69 #clock-cells = <0>;
70 compatible = "stericsson,u300-syscon-clk";
71 clock-type = <0>; /* Slow */
72 clock-id = <6>;
73 clocks = <&slow_clk>;
74 };
75 apptimer_clk: app_tmr_clk@13M {
76 #clock-cells = <0>;
77 compatible = "stericsson,u300-syscon-clk";
78 clock-type = <0>; /* Slow */
79 clock-id = <7>;
80 clocks = <&slow_clk>;
81 };
82 acc_tmr_clk@13M {
83 #clock-cells = <0>;
84 compatible = "stericsson,u300-syscon-clk";
85 clock-type = <0>; /* Slow */
86 clock-id = <8>;
87 clocks = <&slow_clk>;
88 };
89 pll208: pll208@208M {
90 #clock-cells = <0>;
91 compatible = "fixed-clock";
92 clock-frequency = <208000000>;
93 };
94 app208: app_208_clk@208M {
95 #clock-cells = <0>;
96 compatible = "fixed-factor-clock";
97 clock-div = <1>;
98 clock-mult = <1>;
99 clocks = <&pll208>;
100 };
101 cpu_clk@208M {
102 #clock-cells = <0>;
103 compatible = "stericsson,u300-syscon-clk";
104 clock-type = <2>; /* Rest */
105 clock-id = <3>;
106 clocks = <&app208>;
107 };
108 app104: app_104_clk@104M {
109 #clock-cells = <0>;
110 compatible = "fixed-factor-clock";
111 clock-div = <2>;
112 clock-mult = <1>;
113 clocks = <&pll208>;
114 };
115 semi_clk@104M {
116 #clock-cells = <0>;
117 compatible = "stericsson,u300-syscon-clk";
118 clock-type = <2>; /* Rest */
119 clock-id = <9>;
120 clocks = <&app104>;
121 };
122 app52: app_52_clk@52M {
123 #clock-cells = <0>;
124 compatible = "fixed-factor-clock";
125 clock-div = <4>;
126 clock-mult = <1>;
127 clocks = <&pll208>;
128 };
129 /* AHB subsystem clocks */
130 ahb_clk: ahb_subsys_clk@52M {
131 #clock-cells = <0>;
132 compatible = "stericsson,u300-syscon-clk";
133 clock-type = <2>; /* Rest */
134 clock-id = <10>;
135 clocks = <&app52>;
136 };
137 intcon_clk@52M {
138 #clock-cells = <0>;
139 compatible = "stericsson,u300-syscon-clk";
140 clock-type = <2>; /* Rest */
141 clock-id = <12>;
142 clocks = <&ahb_clk>;
143 };
144 emif_clk@52M {
145 #clock-cells = <0>;
146 compatible = "stericsson,u300-syscon-clk";
147 clock-type = <2>; /* Rest */
148 clock-id = <5>;
149 clocks = <&ahb_clk>;
150 };
151 dmac_clk: dmac_clk@52M {
152 #clock-cells = <0>;
153 compatible = "stericsson,u300-syscon-clk";
154 clock-type = <2>; /* Rest */
155 clock-id = <4>;
156 clocks = <&app52>;
157 };
158 fsmc_clk: fsmc_clk@52M {
159 #clock-cells = <0>;
160 compatible = "stericsson,u300-syscon-clk";
161 clock-type = <2>; /* Rest */
162 clock-id = <6>;
163 clocks = <&app52>;
164 };
165 xgam_clk: xgam_clk@52M {
166 #clock-cells = <0>;
167 compatible = "stericsson,u300-syscon-clk";
168 clock-type = <2>; /* Rest */
169 clock-id = <8>;
170 clocks = <&app52>;
171 };
172 app26: app_26_clk@26M {
173 #clock-cells = <0>;
174 compatible = "fixed-factor-clock";
175 clock-div = <2>;
176 clock-mult = <1>;
177 clocks = <&app52>;
178 };
179 /* Fast bridge clocks */
180 fast_clk: fast_clk@26M {
181 #clock-cells = <0>;
182 compatible = "stericsson,u300-syscon-clk";
183 clock-type = <1>; /* Fast */
184 clock-id = <0>;
185 clocks = <&app26>;
186 };
187 i2c0_clk: i2c0_clk@26M {
188 #clock-cells = <0>;
189 compatible = "stericsson,u300-syscon-clk";
190 clock-type = <1>; /* Fast */
191 clock-id = <1>;
192 clocks = <&fast_clk>;
193 };
194 i2c1_clk: i2c1_clk@26M {
195 #clock-cells = <0>;
196 compatible = "stericsson,u300-syscon-clk";
197 clock-type = <1>; /* Fast */
198 clock-id = <2>;
199 clocks = <&fast_clk>;
200 };
201 mmc_pclk: mmc_p_clk@26M {
202 #clock-cells = <0>;
203 compatible = "stericsson,u300-syscon-clk";
204 clock-type = <1>; /* Fast */
205 clock-id = <5>;
206 clocks = <&fast_clk>;
207 };
208 mmc_mclk: mmc_mclk {
209 #clock-cells = <0>;
210 compatible = "stericsson,u300-syscon-mclk";
211 clocks = <&mmc_pclk>;
212 };
213 spi_clk: spi_p_clk@26M {
214 #clock-cells = <0>;
215 compatible = "stericsson,u300-syscon-clk";
216 clock-type = <1>; /* Fast */
217 clock-id = <6>;
218 clocks = <&fast_clk>;
219 };
220 };
221
222 timer: timer@c0014000 {
223 compatible = "stericsson,u300-apptimer";
224 reg = <0xc0014000 0x1000>;
225 interrupt-parent = <&vica>;
226 interrupts = <24 25 26 27>;
227 clocks = <&apptimer_clk>;
228 };
229
230 gpio: gpio@c0016000 {
231 compatible = "stericsson,gpio-coh901";
232 reg = <0xc0016000 0x1000>;
233 interrupt-parent = <&vicb>;
234 interrupts = <0 1 2 18 21 22 23>;
235 clocks = <&gpio_clk>;
236 interrupt-names = "gpio0", "gpio1", "gpio2", "gpio3",
237 "gpio4", "gpio5", "gpio6";
238 interrupt-controller;
239 #interrupt-cells = <2>;
240 gpio-controller;
241 #gpio-cells = <2>;
242 };
243
244 pinctrl: pinctrl@c0011000 {
245 compatible = "stericsson,pinctrl-u300";
246 reg = <0xc0011000 0x1000>;
247 };
248
249 watchdog: watchdog@c0012000 {
250 compatible = "stericsson,coh901327";
251 reg = <0xc0012000 0x1000>;
252 interrupt-parent = <&vicb>;
253 interrupts = <3>;
254 clocks = <&clk32>;
255 };
256
257 rtc: rtc@c0017000 {
258 compatible = "stericsson,coh901331";
259 reg = <0xc0017000 0x1000>;
260 interrupt-parent = <&vicb>;
261 interrupts = <10>;
262 clocks = <&rtc_clk>;
263 };
264
265 dmac: dma-controller@c00020000 {
266 compatible = "stericsson,coh901318";
267 reg = <0xc0020000 0x1000>;
268 interrupt-parent = <&vica>;
269 interrupts = <2>;
270 #dma-cells = <1>;
271 dma-channels = <40>;
272 clocks = <&dmac_clk>;
273 };
274
275 /* A NAND flash of 128 MiB */
276 fsmc: flash@40000000 {
277 compatible = "stericsson,fsmc-nand";
278 #address-cells = <1>;
279 #size-cells = <1>;
280 reg = <0x9f800000 0x1000>, /* FSMC Register*/
281 <0x80000000 0x4000>, /* NAND Base DATA */
282 <0x80020000 0x4000>, /* NAND Base ADDR */
283 <0x80010000 0x4000>; /* NAND Base CMD */
284 reg-names = "fsmc_regs", "nand_data", "nand_addr", "nand_cmd";
285 nand-skip-bbtscan;
286 clocks = <&fsmc_clk>;
287
288 partition@0 {
289 label = "boot records";
290 reg = <0x0 0x20000>;
291 };
292 partition@20000 {
293 label = "free";
294 reg = <0x20000 0x7e0000>;
295 };
296 partition@800000 {
297 label = "platform";
298 reg = <0x800000 0xf800000>;
299 };
300 };
301
302 i2c0: i2c@c0004000 {
303 compatible = "st,ddci2c";
304 reg = <0xc0004000 0x1000>;
305 interrupt-parent = <&vicb>;
306 interrupts = <8>;
307 clocks = <&i2c0_clk>;
308 #address-cells = <1>;
309 #size-cells = <0>;
310 ab3100: ab3100@0x48 {
311 compatible = "stericsson,ab3100";
312 reg = <0x48>;
313 interrupt-parent = <&vica>;
314 interrupts = <0>; /* EXT0 IRQ */
315 ab3100-regulators {
316 compatible = "stericsson,ab3100-regulators";
317 ab3100_ldo_a_reg: ab3100_ldo_a {
318 regulator-compatible = "ab3100_ldo_a";
319 startup-delay-us = <200>;
320 regulator-always-on;
321 regulator-boot-on;
322 };
323 ab3100_ldo_c_reg: ab3100_ldo_c {
324 regulator-compatible = "ab3100_ldo_c";
325 startup-delay-us = <200>;
326 };
327 ab3100_ldo_d_reg: ab3100_ldo_d {
328 regulator-compatible = "ab3100_ldo_d";
329 startup-delay-us = <200>;
330 };
331 ab3100_ldo_e_reg: ab3100_ldo_e {
332 regulator-compatible = "ab3100_ldo_e";
333 regulator-min-microvolt = <1800000>;
334 regulator-max-microvolt = <1800000>;
335 startup-delay-us = <200>;
336 regulator-always-on;
337 regulator-boot-on;
338 };
339 ab3100_ldo_f_reg: ab3100_ldo_f {
340 regulator-compatible = "ab3100_ldo_f";
341 regulator-min-microvolt = <2500000>;
342 regulator-max-microvolt = <2500000>;
343 startup-delay-us = <600>;
344 regulator-always-on;
345 regulator-boot-on;
346 };
347 ab3100_ldo_g_reg: ab3100_ldo_g {
348 regulator-compatible = "ab3100_ldo_g";
349 regulator-min-microvolt = <1500000>;
350 regulator-max-microvolt = <2850000>;
351 startup-delay-us = <400>;
352 };
353 ab3100_ldo_h_reg: ab3100_ldo_h {
354 regulator-compatible = "ab3100_ldo_h";
355 regulator-min-microvolt = <1200000>;
356 regulator-max-microvolt = <2750000>;
357 startup-delay-us = <200>;
358 };
359 ab3100_ldo_k_reg: ab3100_ldo_k {
360 regulator-compatible = "ab3100_ldo_k";
361 regulator-min-microvolt = <1800000>;
362 regulator-max-microvolt = <2750000>;
363 startup-delay-us = <200>;
364 };
365 ab3100_ext_reg: ab3100_ext {
366 regulator-compatible = "ab3100_ext";
367 };
368 ab3100_buck_reg: ab3100_buck {
369 regulator-compatible = "ab3100_buck";
370 regulator-min-microvolt = <1200000>;
371 regulator-max-microvolt = <1800000>;
372 startup-delay-us = <1000>;
373 regulator-always-on;
374 regulator-boot-on;
375 };
376 };
377 };
378 };
379
380 i2c1: i2c@c0005000 {
381 compatible = "st,ddci2c";
382 reg = <0xc0005000 0x1000>;
383 interrupt-parent = <&vicb>;
384 interrupts = <9>;
385 clocks = <&i2c1_clk>;
386 #address-cells = <1>;
387 #size-cells = <0>;
388 fwcam0: fwcam@0x10 {
389 reg = <0x10>;
390 };
391 fwcam1: fwcam@0x5d {
392 reg = <0x5d>;
393 };
394 };
395
396 amba {
397 compatible = "arm,amba-bus";
398 #address-cells = <1>;
399 #size-cells = <1>;
400 ranges;
401
402 vica: interrupt-controller@a0001000 {
403 compatible = "arm,versatile-vic";
404 interrupt-controller;
405 #interrupt-cells = <1>;
406 reg = <0xa0001000 0x20>;
407 };
408
409 vicb: interrupt-controller@a0002000 {
410 compatible = "arm,versatile-vic";
411 interrupt-controller;
412 #interrupt-cells = <1>;
413 reg = <0xa0002000 0x20>;
414 };
415
416 uart0: serial@c0013000 {
417 compatible = "arm,pl011", "arm,primecell";
418 reg = <0xc0013000 0x1000>;
419 interrupt-parent = <&vica>;
420 interrupts = <22>;
421 clocks = <&uart0_clk>, <&uart0_clk>;
422 clock-names = "apb_pclk", "uart0_clk";
423 dmas = <&dmac 17 &dmac 18>;
424 dma-names = "tx", "rx";
425 };
426
427 uart1: serial@c0007000 {
428 compatible = "arm,pl011", "arm,primecell";
429 reg = <0xc0007000 0x1000>;
430 interrupt-parent = <&vicb>;
431 interrupts = <20>;
432 dmas = <&dmac 38 &dmac 39>;
433 dma-names = "tx", "rx";
434 };
435
436 mmcsd: mmcsd@c0001000 {
437 compatible = "arm,pl18x", "arm,primecell";
438 reg = <0xc0001000 0x1000>;
439 interrupt-parent = <&vicb>;
440 interrupts = <6 7>;
441 clocks = <&mmc_pclk>, <&mmc_mclk>;
442 clock-names = "apb_pclk", "mclk";
443 max-frequency = <24000000>;
444 bus-width = <4>; // SD-card slot
445 mmc-cap-mmc-highspeed;
446 mmc-cap-sd-highspeed;
447 cd-gpios = <&gpio 12 0x4>;
448 cd-inverted;
449 vmmc-supply = <&ab3100_ldo_g_reg>;
450 dmas = <&dmac 14>;
451 dma-names = "rx";
452 };
453
454 spi: ssp@c0006000 {
455 compatible = "arm,pl022", "arm,primecell";
456 reg = <0xc0006000 0x1000>;
457 interrupt-parent = <&vica>;
458 interrupts = <23>;
459 clocks = <&spi_clk>, <&spi_clk>;
460 clock-names = "apb_pclk", "spi_clk";
461 dmas = <&dmac 27 &dmac 28>;
462 dma-names = "tx", "rx";
463 num-cs = <3>;
464 #address-cells = <1>;
465 #size-cells = <0>;
466 spi-dummy@1 {
467 compatible = "arm,pl022-dummy";
468 reg = <1>;
469 spi-max-frequency = <20000000>;
470 };
471 };
472 };
473};
diff --git a/arch/arm/boot/dts/stih415-b2000.dts b/arch/arm/boot/dts/stih415-b2000.dts
new file mode 100644
index 000000000000..d4af53160435
--- /dev/null
+++ b/arch/arm/boot/dts/stih415-b2000.dts
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9/dts-v1/;
10#include "stih415.dtsi"
11#include "stih41x-b2000.dtsi"
12/ {
13 model = "STiH415 B2000 Board";
14 compatible = "st,stih415", "st,stih415-b2000";
15};
diff --git a/arch/arm/boot/dts/stih415-b2020.dts b/arch/arm/boot/dts/stih415-b2020.dts
new file mode 100644
index 000000000000..442b019e9a3a
--- /dev/null
+++ b/arch/arm/boot/dts/stih415-b2020.dts
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9/dts-v1/;
10#include "stih415.dtsi"
11#include "stih41x-b2020.dtsi"
12/ {
13 model = "STiH415 B2020 Board";
14 compatible = "st,stih415", "st,stih415-b2020";
15};
diff --git a/arch/arm/boot/dts/stih415-clock.dtsi b/arch/arm/boot/dts/stih415-clock.dtsi
new file mode 100644
index 000000000000..174c799df741
--- /dev/null
+++ b/arch/arm/boot/dts/stih415-clock.dtsi
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/ {
9 clocks {
10 /*
11 * Fixed 30MHz oscillator input to SoC
12 */
13 CLK_SYSIN: CLK_SYSIN {
14 #clock-cells = <0>;
15 compatible = "fixed-clock";
16 clock-frequency = <30000000>;
17 };
18
19 /*
20 * ARM Peripheral clock for timers
21 */
22 arm_periph_clk: arm_periph_clk {
23 #clock-cells = <0>;
24 compatible = "fixed-clock";
25 clock-frequency = <500000000>;
26 };
27
28 /*
29 * Bootloader initialized system infrastructure clock for
30 * serial devices.
31 */
32 CLKS_ICN_REG_0: CLKS_ICN_REG_0 {
33 #clock-cells = <0>;
34 compatible = "fixed-clock";
35 clock-frequency = <100000000>;
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/stih415-pinctrl.dtsi b/arch/arm/boot/dts/stih415-pinctrl.dtsi
new file mode 100644
index 000000000000..1d322b24d1e4
--- /dev/null
+++ b/arch/arm/boot/dts/stih415-pinctrl.dtsi
@@ -0,0 +1,268 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9#include "st-pincfg.h"
10/ {
11
12 aliases {
13 gpio0 = &PIO0;
14 gpio1 = &PIO1;
15 gpio2 = &PIO2;
16 gpio3 = &PIO3;
17 gpio4 = &PIO4;
18 gpio5 = &PIO5;
19 gpio6 = &PIO6;
20 gpio7 = &PIO7;
21 gpio8 = &PIO8;
22 gpio9 = &PIO9;
23 gpio10 = &PIO10;
24 gpio11 = &PIO11;
25 gpio12 = &PIO12;
26 gpio13 = &PIO13;
27 gpio14 = &PIO14;
28 gpio15 = &PIO15;
29 gpio16 = &PIO16;
30 gpio17 = &PIO17;
31 gpio18 = &PIO18;
32 gpio19 = &PIO100;
33 gpio20 = &PIO101;
34 gpio21 = &PIO102;
35 gpio22 = &PIO103;
36 gpio23 = &PIO104;
37 gpio24 = &PIO105;
38 gpio25 = &PIO106;
39 gpio26 = &PIO107;
40 };
41
42 soc {
43 pin-controller-sbc {
44 #address-cells = <1>;
45 #size-cells = <1>;
46 compatible = "st,stih415-sbc-pinctrl";
47 st,syscfg = <&syscfg_sbc>;
48 ranges = <0 0xfe610000 0x5000>;
49
50 PIO0: gpio@fe610000 {
51 gpio-controller;
52 #gpio-cells = <1>;
53 reg = <0 0x100>;
54 st,bank-name = "PIO0";
55 };
56 PIO1: gpio@fe611000 {
57 gpio-controller;
58 #gpio-cells = <1>;
59 reg = <0x1000 0x100>;
60 st,bank-name = "PIO1";
61 };
62 PIO2: gpio@fe612000 {
63 gpio-controller;
64 #gpio-cells = <1>;
65 reg = <0x2000 0x100>;
66 st,bank-name = "PIO2";
67 };
68 PIO3: gpio@fe613000 {
69 gpio-controller;
70 #gpio-cells = <1>;
71 reg = <0x3000 0x100>;
72 st,bank-name = "PIO3";
73 };
74 PIO4: gpio@fe614000 {
75 gpio-controller;
76 #gpio-cells = <1>;
77 reg = <0x4000 0x100>;
78 st,bank-name = "PIO4";
79 };
80
81 sbc_serial1 {
82 pinctrl_sbc_serial1:sbc_serial1 {
83 st,pins {
84 tx = <&PIO2 6 ALT3 OUT>;
85 rx = <&PIO2 7 ALT3 IN>;
86 };
87 };
88 };
89 };
90
91 pin-controller-front {
92 #address-cells = <1>;
93 #size-cells = <1>;
94 compatible = "st,stih415-front-pinctrl";
95 st,syscfg = <&syscfg_front>;
96 ranges = <0 0xfee00000 0x8000>;
97
98 PIO5: gpio@fee00000 {
99 gpio-controller;
100 #gpio-cells = <1>;
101 reg = <0 0x100>;
102 st,bank-name = "PIO5";
103 };
104 PIO6: gpio@fee01000 {
105 gpio-controller;
106 #gpio-cells = <1>;
107 reg = <0x1000 0x100>;
108 st,bank-name = "PIO6";
109 };
110 PIO7: gpio@fee02000 {
111 gpio-controller;
112 #gpio-cells = <1>;
113 reg = <0x2000 0x100>;
114 st,bank-name = "PIO7";
115 };
116 PIO8: gpio@fee03000 {
117 gpio-controller;
118 #gpio-cells = <1>;
119 reg = <0x3000 0x100>;
120 st,bank-name = "PIO8";
121 };
122 PIO9: gpio@fee04000 {
123 gpio-controller;
124 #gpio-cells = <1>;
125 reg = <0x4000 0x100>;
126 st,bank-name = "PIO9";
127 };
128 PIO10: gpio@fee05000 {
129 gpio-controller;
130 #gpio-cells = <1>;
131 reg = <0x5000 0x100>;
132 st,bank-name = "PIO10";
133 };
134 PIO11: gpio@fee06000 {
135 gpio-controller;
136 #gpio-cells = <1>;
137 reg = <0x6000 0x100>;
138 st,bank-name = "PIO11";
139 };
140 PIO12: gpio@fee07000 {
141 gpio-controller;
142 #gpio-cells = <1>;
143 reg = <0x7000 0x100>;
144 st,bank-name = "PIO12";
145 };
146 };
147
148 pin-controller-rear {
149 #address-cells = <1>;
150 #size-cells = <1>;
151 compatible = "st,stih415-rear-pinctrl";
152 st,syscfg = <&syscfg_rear>;
153 ranges = <0 0xfe820000 0x8000>;
154
155 PIO13: gpio@fe820000 {
156 gpio-controller;
157 #gpio-cells = <1>;
158 reg = <0 0x100>;
159 st,bank-name = "PIO13";
160 };
161 PIO14: gpio@fe821000 {
162 gpio-controller;
163 #gpio-cells = <1>;
164 reg = <0x1000 0x100>;
165 st,bank-name = "PIO14";
166 };
167 PIO15: gpio@fe822000 {
168 gpio-controller;
169 #gpio-cells = <1>;
170 reg = <0x2000 0x100>;
171 st,bank-name = "PIO15";
172 };
173 PIO16: gpio@fe823000 {
174 gpio-controller;
175 #gpio-cells = <1>;
176 reg = <0x3000 0x100>;
177 st,bank-name = "PIO16";
178 };
179 PIO17: gpio@fe824000 {
180 gpio-controller;
181 #gpio-cells = <1>;
182 reg = <0x4000 0x100>;
183 st,bank-name = "PIO17";
184 };
185 PIO18: gpio@fe825000 {
186 gpio-controller;
187 #gpio-cells = <1>;
188 reg = <0x5000 0x100>;
189 st,bank-name = "PIO18";
190 };
191
192 serial2 {
193 pinctrl_serial2: serial2-0 {
194 st,pins {
195 tx = <&PIO17 4 ALT2 OUT>;
196 rx = <&PIO17 5 ALT2 IN>;
197 };
198 };
199 };
200 };
201
202 pin-controller-left {
203 #address-cells = <1>;
204 #size-cells = <1>;
205 compatible = "st,stih415-left-pinctrl";
206 st,syscfg = <&syscfg_left>;
207 ranges = <0 0xfd6b0000 0x3000>;
208
209 PIO100: gpio@fd6b0000 {
210 gpio-controller;
211 #gpio-cells = <1>;
212 reg = <0 0x100>;
213 st,bank-name = "PIO100";
214 };
215 PIO101: gpio@fd6b1000 {
216 gpio-controller;
217 #gpio-cells = <1>;
218 reg = <0x1000 0x100>;
219 st,bank-name = "PIO101";
220 };
221 PIO102: gpio@fd6b2000 {
222 gpio-controller;
223 #gpio-cells = <1>;
224 reg = <0x2000 0x100>;
225 st,bank-name = "PIO102";
226 };
227 };
228
229 pin-controller-right {
230 #address-cells = <1>;
231 #size-cells = <1>;
232 compatible = "st,stih415-right-pinctrl";
233 st,syscfg = <&syscfg_right>;
234 ranges = <0 0xfd330000 0x5000>;
235
236 PIO103: gpio@fd330000 {
237 gpio-controller;
238 #gpio-cells = <1>;
239 reg = <0 0x100>;
240 st,bank-name = "PIO103";
241 };
242 PIO104: gpio@fd331000 {
243 gpio-controller;
244 #gpio-cells = <1>;
245 reg = <0x1000 0x100>;
246 st,bank-name = "PIO104";
247 };
248 PIO105: gpio@fd332000 {
249 gpio-controller;
250 #gpio-cells = <1>;
251 reg = <0x2000 0x100>;
252 st,bank-name = "PIO105";
253 };
254 PIO106: gpio@fd333000 {
255 gpio-controller;
256 #gpio-cells = <1>;
257 reg = <0x3000 0x100>;
258 st,bank-name = "PIO106";
259 };
260 PIO107: gpio@fd334000 {
261 gpio-controller;
262 #gpio-cells = <1>;
263 reg = <0x4000 0x100>;
264 st,bank-name = "PIO107";
265 };
266 };
267 };
268};
diff --git a/arch/arm/boot/dts/stih415.dtsi b/arch/arm/boot/dts/stih415.dtsi
new file mode 100644
index 000000000000..74ab8ded4b49
--- /dev/null
+++ b/arch/arm/boot/dts/stih415.dtsi
@@ -0,0 +1,87 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9#include "stih41x.dtsi"
10#include "stih415-clock.dtsi"
11#include "stih415-pinctrl.dtsi"
12/ {
13
14 L2: cache-controller {
15 compatible = "arm,pl310-cache";
16 reg = <0xfffe2000 0x1000>;
17 arm,data-latency = <3 2 2>;
18 arm,tag-latency = <1 1 1>;
19 cache-unified;
20 cache-level = <2>;
21 };
22
23 soc {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 interrupt-parent = <&intc>;
27 ranges;
28 compatible = "simple-bus";
29
30 syscfg_sbc: sbc-syscfg@fe600000{
31 compatible = "st,stih415-sbc-syscfg", "syscon";
32 reg = <0xfe600000 0xb4>;
33 };
34
35 syscfg_front: front-syscfg@fee10000{
36 compatible = "st,stih415-front-syscfg", "syscon";
37 reg = <0xfee10000 0x194>;
38 };
39
40 syscfg_rear: rear-syscfg@fe830000{
41 compatible = "st,stih415-rear-syscfg", "syscon";
42 reg = <0xfe830000 0x190>;
43 };
44
45 /* MPE syscfgs */
46 syscfg_left: left-syscfg@fd690000{
47 compatible = "st,stih415-left-syscfg", "syscon";
48 reg = <0xfd690000 0x78>;
49 };
50
51 syscfg_right: right-syscfg@fd320000{
52 compatible = "st,stih415-right-syscfg", "syscon";
53 reg = <0xfd320000 0x180>;
54 };
55
56 syscfg_system: system-syscfg@fdde0000 {
57 compatible = "st,stih415-system-syscfg", "syscon";
58 reg = <0xfdde0000 0x15c>;
59 };
60
61 syscfg_lpm: lpm-syscfg@fe4b5100{
62 compatible = "st,stih415-lpm-syscfg", "syscon";
63 reg = <0xfe4b5100 0x08>;
64 };
65
66 serial2: serial@fed32000 {
67 compatible = "st,asc";
68 status = "disabled";
69 reg = <0xfed32000 0x2c>;
70 interrupts = <0 197 0>;
71 pinctrl-names = "default";
72 pinctrl-0 = <&pinctrl_serial2>;
73 clocks = <&CLKS_ICN_REG_0>;
74 };
75
76 /* SBC comms block ASCs in SASG1 */
77 sbc_serial1: serial@fe531000 {
78 compatible = "st,asc";
79 status = "disabled";
80 reg = <0xfe531000 0x2c>;
81 interrupts = <0 210 0>;
82 clocks = <&CLK_SYSIN>;
83 pinctrl-names = "default";
84 pinctrl-0 = <&pinctrl_sbc_serial1>;
85 };
86 };
87};
diff --git a/arch/arm/boot/dts/stih416-b2000.dts b/arch/arm/boot/dts/stih416-b2000.dts
new file mode 100644
index 000000000000..a5eb6eee10bf
--- /dev/null
+++ b/arch/arm/boot/dts/stih416-b2000.dts
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9/dts-v1/;
10#include "stih416.dtsi"
11#include "stih41x-b2000.dtsi"
12
13/ {
14 compatible = "st,stih416", "st,stih416-b2000";
15 model = "STiH416 B2000";
16};
diff --git a/arch/arm/boot/dts/stih416-b2020.dts b/arch/arm/boot/dts/stih416-b2020.dts
new file mode 100644
index 000000000000..276f28da573a
--- /dev/null
+++ b/arch/arm/boot/dts/stih416-b2020.dts
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9/dts-v1/;
10#include "stih416.dtsi"
11#include "stih41x-b2020.dtsi"
12/ {
13 model = "STiH416 B2020";
14 compatible = "st,stih416", "st,stih416-b2020";
15
16};
diff --git a/arch/arm/boot/dts/stih416-clock.dtsi b/arch/arm/boot/dts/stih416-clock.dtsi
new file mode 100644
index 000000000000..7026bf1158d8
--- /dev/null
+++ b/arch/arm/boot/dts/stih416-clock.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics R&D Limited
3 * <stlinux-devel@stlinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9/ {
10 clocks {
11 /*
12 * Fixed 30MHz oscillator inputs to SoC
13 */
14 CLK_SYSIN: CLK_SYSIN {
15 #clock-cells = <0>;
16 compatible = "fixed-clock";
17 clock-frequency = <30000000>;
18 clock-output-names = "CLK_SYSIN";
19 };
20
21 /*
22 * ARM Peripheral clock for timers
23 */
24 arm_periph_clk: arm_periph_clk {
25 #clock-cells = <0>;
26 compatible = "fixed-clock";
27 clock-frequency = <600000000>;
28 };
29
30 /*
31 * Bootloader initialized system infrastructure clock for
32 * serial devices.
33 */
34 CLK_S_ICN_REG_0: clockgenA0@4 {
35 #clock-cells = <0>;
36 compatible = "fixed-clock";
37 clock-frequency = <100000000>;
38 clock-output-names = "CLK_S_ICN_REG_0";
39 };
40 };
41};
diff --git a/arch/arm/boot/dts/stih416-pinctrl.dtsi b/arch/arm/boot/dts/stih416-pinctrl.dtsi
new file mode 100644
index 000000000000..957b21a71b4b
--- /dev/null
+++ b/arch/arm/boot/dts/stih416-pinctrl.dtsi
@@ -0,0 +1,295 @@
1
2/*
3 * Copyright (C) 2013 STMicroelectronics Limited.
4 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.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 * publishhed by the Free Software Foundation.
9 */
10#include "st-pincfg.h"
11/ {
12
13 aliases {
14 gpio0 = &PIO0;
15 gpio1 = &PIO1;
16 gpio2 = &PIO2;
17 gpio3 = &PIO3;
18 gpio4 = &PIO4;
19 gpio5 = &PIO40;
20 gpio6 = &PIO5;
21 gpio7 = &PIO6;
22 gpio8 = &PIO7;
23 gpio9 = &PIO8;
24 gpio10 = &PIO9;
25 gpio11 = &PIO10;
26 gpio12 = &PIO11;
27 gpio13 = &PIO12;
28 gpio14 = &PIO30;
29 gpio15 = &PIO31;
30 gpio16 = &PIO13;
31 gpio17 = &PIO14;
32 gpio18 = &PIO15;
33 gpio19 = &PIO16;
34 gpio20 = &PIO17;
35 gpio21 = &PIO18;
36 gpio22 = &PIO100;
37 gpio23 = &PIO101;
38 gpio24 = &PIO102;
39 gpio25 = &PIO103;
40 gpio26 = &PIO104;
41 gpio27 = &PIO105;
42 gpio28 = &PIO106;
43 gpio29 = &PIO107;
44 };
45
46 soc {
47 pin-controller-sbc {
48 #address-cells = <1>;
49 #size-cells = <1>;
50 compatible = "st,stih416-sbc-pinctrl";
51 st,syscfg = <&syscfg_sbc>;
52 ranges = <0 0xfe610000 0x6000>;
53
54 PIO0: gpio@fe610000 {
55 gpio-controller;
56 #gpio-cells = <1>;
57 reg = <0 0x100>;
58 st,bank-name = "PIO0";
59 };
60 PIO1: gpio@fe611000 {
61 gpio-controller;
62 #gpio-cells = <1>;
63 reg = <0x1000 0x100>;
64 st,bank-name = "PIO1";
65 };
66 PIO2: gpio@fe612000 {
67 gpio-controller;
68 #gpio-cells = <1>;
69 reg = <0x2000 0x100>;
70 st,bank-name = "PIO2";
71 };
72 PIO3: gpio@fe613000 {
73 gpio-controller;
74 #gpio-cells = <1>;
75 reg = <0x3000 0x100>;
76 st,bank-name = "PIO3";
77 };
78 PIO4: gpio@fe614000 {
79 gpio-controller;
80 #gpio-cells = <1>;
81 reg = <0x4000 0x100>;
82 st,bank-name = "PIO4";
83 };
84 PIO40: gpio@fe615000 {
85 gpio-controller;
86 #gpio-cells = <1>;
87 reg = <0x5000 0x100>;
88 st,bank-name = "PIO40";
89 st,retime-pin-mask = <0x7f>;
90 };
91
92 sbc_serial1 {
93 pinctrl_sbc_serial1: sbc_serial1 {
94 st,pins {
95 tx = <&PIO2 6 ALT3 OUT>;
96 rx = <&PIO2 7 ALT3 IN>;
97 };
98 };
99 };
100 };
101
102 pin-controller-front {
103 #address-cells = <1>;
104 #size-cells = <1>;
105 compatible = "st,stih416-front-pinctrl";
106 st,syscfg = <&syscfg_front>;
107 ranges = <0 0xfee00000 0x10000>;
108
109 PIO5: gpio@fee00000 {
110 gpio-controller;
111 #gpio-cells = <1>;
112 reg = <0 0x100>;
113 st,bank-name = "PIO5";
114 };
115 PIO6: gpio@fee01000 {
116 gpio-controller;
117 #gpio-cells = <1>;
118 reg = <0x1000 0x100>;
119 st,bank-name = "PIO6";
120 };
121 PIO7: gpio@fee02000 {
122 gpio-controller;
123 #gpio-cells = <1>;
124 reg = <0x2000 0x100>;
125 st,bank-name = "PIO7";
126 };
127 PIO8: gpio@fee03000 {
128 gpio-controller;
129 #gpio-cells = <1>;
130 reg = <0x3000 0x100>;
131 st,bank-name = "PIO8";
132 };
133 PIO9: gpio@fee04000 {
134 gpio-controller;
135 #gpio-cells = <1>;
136 reg = <0x4000 0x100>;
137 st,bank-name = "PIO9";
138 };
139 PIO10: gpio@fee05000 {
140 gpio-controller;
141 #gpio-cells = <1>;
142 reg = <0x5000 0x100>;
143 st,bank-name = "PIO10";
144 };
145 PIO11: gpio@fee06000 {
146 gpio-controller;
147 #gpio-cells = <1>;
148 reg = <0x6000 0x100>;
149 st,bank-name = "PIO11";
150 };
151 PIO12: gpio@fee07000 {
152 gpio-controller;
153 #gpio-cells = <1>;
154 reg = <0x7000 0x100>;
155 st,bank-name = "PIO12";
156 };
157 PIO30: gpio@fee08000 {
158 gpio-controller;
159 #gpio-cells = <1>;
160 reg = <0x8000 0x100>;
161 st,bank-name = "PIO30";
162 };
163 PIO31: gpio@fee09000 {
164 gpio-controller;
165 #gpio-cells = <1>;
166 reg = <0x9000 0x100>;
167 st,bank-name = "PIO31";
168 };
169 };
170
171 pin-controller-rear {
172 #address-cells = <1>;
173 #size-cells = <1>;
174 compatible = "st,stih416-rear-pinctrl";
175 st,syscfg = <&syscfg_rear>;
176 ranges = <0 0xfe820000 0x6000>;
177
178 PIO13: gpio@fe820000 {
179 gpio-controller;
180 #gpio-cells = <1>;
181 reg = <0 0x100>;
182 st,bank-name = "PIO13";
183 };
184 PIO14: gpio@fe821000 {
185 gpio-controller;
186 #gpio-cells = <1>;
187 reg = <0x1000 0x100>;
188 st,bank-name = "PIO14";
189 };
190 PIO15: gpio@fe822000 {
191 gpio-controller;
192 #gpio-cells = <1>;
193 reg = <0x2000 0x100>;
194 st,bank-name = "PIO15";
195 };
196 PIO16: gpio@fe823000 {
197 gpio-controller;
198 #gpio-cells = <1>;
199 reg = <0x3000 0x100>;
200 st,bank-name = "PIO16";
201 };
202 PIO17: gpio@fe824000 {
203 gpio-controller;
204 #gpio-cells = <1>;
205 reg = <0x4000 0x100>;
206 st,bank-name = "PIO17";
207 };
208 PIO18: gpio@fe825000 {
209 gpio-controller;
210 #gpio-cells = <1>;
211 reg = <0x5000 0x100>;
212 st,bank-name = "PIO18";
213 st,retime-pin-mask = <0xf>;
214 };
215
216 serial2 {
217 pinctrl_serial2: serial2-0 {
218 st,pins {
219 tx = <&PIO17 4 ALT2 OUT>;
220 rx = <&PIO17 5 ALT2 IN>;
221 output-enable = <&PIO11 3 ALT2 OUT>;
222 };
223 };
224 };
225 };
226
227 pin-controller-fvdp-fe {
228 #address-cells = <1>;
229 #size-cells = <1>;
230 compatible = "st,stih416-fvdp-fe-pinctrl";
231 st,syscfg = <&syscfg_fvdp_fe>;
232 ranges = <0 0xfd6b0000 0x3000>;
233
234 PIO100: gpio@fd6b0000 {
235 gpio-controller;
236 #gpio-cells = <1>;
237 reg = <0 0x100>;
238 st,bank-name = "PIO100";
239 };
240 PIO101: gpio@fd6b1000 {
241 gpio-controller;
242 #gpio-cells = <1>;
243 reg = <0x1000 0x100>;
244 st,bank-name = "PIO101";
245 };
246 PIO102: gpio@fd6b2000 {
247 gpio-controller;
248 #gpio-cells = <1>;
249 reg = <0x2000 0x100>;
250 st,bank-name = "PIO102";
251 };
252 };
253
254 pin-controller-fvdp-lite {
255 #address-cells = <1>;
256 #size-cells = <1>;
257 compatible = "st,stih416-fvdp-lite-pinctrl";
258 st,syscfg = <&syscfg_fvdp_lite>;
259 ranges = <0 0xfd330000 0x5000>;
260
261 PIO103: gpio@fd330000 {
262 gpio-controller;
263 #gpio-cells = <1>;
264 reg = <0 0x100>;
265 st,bank-name = "PIO103";
266 };
267 PIO104: gpio@fd331000 {
268 gpio-controller;
269 #gpio-cells = <1>;
270 reg = <0x1000 0x100>;
271 st,bank-name = "PIO104";
272 };
273 PIO105: gpio@fd332000 {
274 gpio-controller;
275 #gpio-cells = <1>;
276 reg = <0x2000 0x100>;
277 st,bank-name = "PIO105";
278 };
279 PIO106: gpio@fd333000 {
280 gpio-controller;
281 #gpio-cells = <1>;
282 reg = <0x3000 0x100>;
283 st,bank-name = "PIO106";
284 };
285
286 PIO107: gpio@fd334000 {
287 gpio-controller;
288 #gpio-cells = <1>;
289 reg = <0x4000 0x100>;
290 st,bank-name = "PIO107";
291 st,retime-pin-mask = <0xf>;
292 };
293 };
294 };
295};
diff --git a/arch/arm/boot/dts/stih416.dtsi b/arch/arm/boot/dts/stih416.dtsi
new file mode 100644
index 000000000000..3cecd9689a49
--- /dev/null
+++ b/arch/arm/boot/dts/stih416.dtsi
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) 2012 STMicroelectronics Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9#include "stih41x.dtsi"
10#include "stih416-clock.dtsi"
11#include "stih416-pinctrl.dtsi"
12/ {
13 L2: cache-controller {
14 compatible = "arm,pl310-cache";
15 reg = <0xfffe2000 0x1000>;
16 arm,data-latency = <3 3 3>;
17 arm,tag-latency = <2 2 2>;
18 cache-unified;
19 cache-level = <2>;
20 };
21
22 soc {
23 #address-cells = <1>;
24 #size-cells = <1>;
25 interrupt-parent = <&intc>;
26 ranges;
27 compatible = "simple-bus";
28
29 syscfg_sbc:sbc-syscfg@fe600000{
30 compatible = "st,stih416-sbc-syscfg", "syscon";
31 reg = <0xfe600000 0x1000>;
32 };
33
34 syscfg_front:front-syscfg@fee10000{
35 compatible = "st,stih416-front-syscfg", "syscon";
36 reg = <0xfee10000 0x1000>;
37 };
38
39 syscfg_rear:rear-syscfg@fe830000{
40 compatible = "st,stih416-rear-syscfg", "syscon";
41 reg = <0xfe830000 0x1000>;
42 };
43
44 /* MPE */
45 syscfg_fvdp_fe:fvdp-fe-syscfg@fddf0000{
46 compatible = "st,stih416-fvdp-fe-syscfg", "syscon";
47 reg = <0xfddf0000 0x1000>;
48 };
49
50 syscfg_fvdp_lite:fvdp-lite-syscfg@fd6a0000{
51 compatible = "st,stih416-fvdp-lite-syscfg", "syscon";
52 reg = <0xfd6a0000 0x1000>;
53 };
54
55 syscfg_cpu:cpu-syscfg@fdde0000{
56 compatible = "st,stih416-cpu-syscfg", "syscon";
57 reg = <0xfdde0000 0x1000>;
58 };
59
60 syscfg_compo:compo-syscfg@fd320000{
61 compatible = "st,stih416-compo-syscfg", "syscon";
62 reg = <0xfd320000 0x1000>;
63 };
64
65 syscfg_transport:transport-syscfg@fd690000{
66 compatible = "st,stih416-transport-syscfg", "syscon";
67 reg = <0xfd690000 0x1000>;
68 };
69
70 syscfg_lpm:lpm-syscfg@fe4b5100{
71 compatible = "st,stih416-lpm-syscfg", "syscon";
72 reg = <0xfe4b5100 0x8>;
73 };
74
75 serial2: serial@fed32000{
76 compatible = "st,asc";
77 status = "disabled";
78 reg = <0xfed32000 0x2c>;
79 interrupts = <0 197 0>;
80 clocks = <&CLK_S_ICN_REG_0>;
81 pinctrl-names = "default";
82 pinctrl-0 = <&pinctrl_serial2>;
83 };
84
85 /* SBC_UART1 */
86 sbc_serial1: serial@fe531000 {
87 compatible = "st,asc";
88 status = "disabled";
89 reg = <0xfe531000 0x2c>;
90 interrupts = <0 210 0>;
91 pinctrl-names = "default";
92 pinctrl-0 = <&pinctrl_sbc_serial1>;
93 clocks = <&CLK_SYSIN>;
94 };
95 };
96};
diff --git a/arch/arm/boot/dts/stih41x-b2000.dtsi b/arch/arm/boot/dts/stih41x-b2000.dtsi
new file mode 100644
index 000000000000..8e694d2b8f5b
--- /dev/null
+++ b/arch/arm/boot/dts/stih41x-b2000.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9/ {
10
11 memory{
12 device_type = "memory";
13 reg = <0x60000000 0x40000000>;
14 };
15
16 chosen {
17 bootargs = "console=ttyAS0,115200";
18 linux,stdout-path = &serial2;
19 };
20
21 aliases {
22 ttyAS0 = &serial2;
23 };
24
25 soc {
26 serial2: serial@fed32000 {
27 status = "okay";
28 };
29
30 leds {
31 compatible = "gpio-leds";
32 fp_led {
33 #gpio-cells = <1>;
34 label = "Front Panel LED";
35 gpios = <&PIO105 7>;
36 linux,default-trigger = "heartbeat";
37 };
38 };
39
40 };
41};
diff --git a/arch/arm/boot/dts/stih41x-b2020.dtsi b/arch/arm/boot/dts/stih41x-b2020.dtsi
new file mode 100644
index 000000000000..133e18143b1b
--- /dev/null
+++ b/arch/arm/boot/dts/stih41x-b2020.dtsi
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9/ {
10 memory{
11 device_type = "memory";
12 reg = <0x40000000 0x80000000>;
13 };
14
15 chosen {
16 bootargs = "console=ttyAS0,115200";
17 linux,stdout-path = &sbc_serial1;
18 };
19
20 aliases {
21 ttyAS0 = &sbc_serial1;
22 };
23 soc {
24 sbc_serial1: serial@fe531000 {
25 status = "okay";
26 };
27
28 leds {
29 compatible = "gpio-leds";
30 red {
31 #gpio-cells = <1>;
32 label = "Front Panel LED";
33 gpios = <&PIO4 1>;
34 linux,default-trigger = "heartbeat";
35 };
36 green {
37 gpios = <&PIO4 7>;
38 default-state = "off";
39 };
40 };
41 };
42};
diff --git a/arch/arm/boot/dts/stih41x.dtsi b/arch/arm/boot/dts/stih41x.dtsi
new file mode 100644
index 000000000000..7321403cab8a
--- /dev/null
+++ b/arch/arm/boot/dts/stih41x.dtsi
@@ -0,0 +1,38 @@
1/ {
2 #address-cells = <1>;
3 #size-cells = <1>;
4
5 cpus {
6 #address-cells = <1>;
7 #size-cells = <0>;
8 cpu@0 {
9 compatible = "arm,cortex-a9";
10 reg = <0>;
11 };
12 cpu@1 {
13 compatible = "arm,cortex-a9";
14 reg = <1>;
15 };
16 };
17
18 intc: interrupt-controller@fffe1000 {
19 compatible = "arm,cortex-a9-gic";
20 #interrupt-cells = <3>;
21 interrupt-controller;
22 reg = <0xfffe1000 0x1000>,
23 <0xfffe0100 0x100>;
24 };
25
26 scu@fffe0000 {
27 compatible = "arm,cortex-a9-scu";
28 reg = <0xfffe0000 0x1000>;
29 };
30
31 timer@fffe0200 {
32 interrupt-parent = <&intc>;
33 compatible = "arm,cortex-a9-global-timer";
34 reg = <0xfffe0200 0x100>;
35 interrupts = <1 11 0x04>;
36 clocks = <&arm_periph_clk>;
37 };
38};
diff --git a/arch/arm/boot/dts/stuib.dtsi b/arch/arm/boot/dts/stuib.dtsi
index 615392a75676..524e33240ad4 100644
--- a/arch/arm/boot/dts/stuib.dtsi
+++ b/arch/arm/boot/dts/stuib.dtsi
@@ -9,13 +9,15 @@
9 * http://www.gnu.org/copyleft/gpl.html 9 * http://www.gnu.org/copyleft/gpl.html
10 */ 10 */
11 11
12#include <dt-bindings/interrupt-controller/irq.h>
13
12/ { 14/ {
13 soc-u9500 { 15 soc {
14 i2c@80004000 { 16 i2c@80004000 {
15 stmpe1601: stmpe1601@40 { 17 stmpe1601: stmpe1601@40 {
16 compatible = "st,stmpe1601"; 18 compatible = "st,stmpe1601";
17 reg = <0x40>; 19 reg = <0x40>;
18 interrupts = <26 0x2>; 20 interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
19 interrupt-parent = <&gpio6>; 21 interrupt-parent = <&gpio6>;
20 interrupt-controller; 22 interrupt-controller;
21 23
@@ -52,26 +54,26 @@
52 }; 54 };
53 55
54 i2c@80110000 { 56 i2c@80110000 {
55 bu21013_tp@0x5c { 57 bu21013_tp@5c {
56 compatible = "rhom,bu21013_tp"; 58 compatible = "rohm,bu21013_tp";
57 reg = <0x5c>; 59 reg = <0x5c>;
58 touch-gpio = <&gpio2 20 0x4>; 60 touch-gpio = <&gpio2 20 0x4>;
59 avdd-supply = <&ab8500_ldo_aux1_reg>; 61 avdd-supply = <&ab8500_ldo_aux1_reg>;
60 62
61 rhom,touch-max-x = <384>; 63 rohm,touch-max-x = <384>;
62 rhom,touch-max-y = <704>; 64 rohm,touch-max-y = <704>;
63 rhom,flip-y; 65 rohm,flip-y;
64 }; 66 };
65 67
66 bu21013_tp@0x5d { 68 bu21013_tp@5d {
67 compatible = "rhom,bu21013_tp"; 69 compatible = "rohm,bu21013_tp";
68 reg = <0x5d>; 70 reg = <0x5d>;
69 touch-gpio = <&gpio2 20 0x4>; 71 touch-gpio = <&gpio2 20 0x4>;
70 avdd-supply = <&ab8500_ldo_aux1_reg>; 72 avdd-supply = <&ab8500_ldo_aux1_reg>;
71 73
72 rhom,touch-max-x = <384>; 74 rohm,touch-max-x = <384>;
73 rhom,touch-max-y = <704>; 75 rohm,touch-max-y = <704>;
74 rhom,flip-y; 76 rohm,flip-y;
75 }; 77 };
76 }; 78 };
77 }; 79 };
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index b70fe0db6bb7..0e22a285dfe0 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -41,6 +41,18 @@
41 pinctrl-0 = <&uart0_pins_a>; 41 pinctrl-0 = <&uart0_pins_a>;
42 status = "okay"; 42 status = "okay";
43 }; 43 };
44
45 i2c0: i2c@01c2ac00 {
46 pinctrl-names = "default";
47 pinctrl-0 = <&i2c0_pins_a>;
48 status = "okay";
49 };
50
51 i2c1: i2c@01c2b000 {
52 pinctrl-names = "default";
53 pinctrl-0 = <&i2c1_pins_a>;
54 status = "okay";
55 };
44 }; 56 };
45 57
46 leds { 58 leds {
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index e7ef619a70a2..82e03d22f913 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -16,8 +16,12 @@
16 interrupt-parent = <&intc>; 16 interrupt-parent = <&intc>;
17 17
18 cpus { 18 cpus {
19 #address-cells = <1>;
20 #size-cells = <0>;
19 cpu@0 { 21 cpu@0 {
22 device_type = "cpu";
20 compatible = "arm,cortex-a8"; 23 compatible = "arm,cortex-a8";
24 reg = <0x0>;
21 }; 25 };
22 }; 26 };
23 27
@@ -173,8 +177,10 @@
173 pio: pinctrl@01c20800 { 177 pio: pinctrl@01c20800 {
174 compatible = "allwinner,sun4i-a10-pinctrl"; 178 compatible = "allwinner,sun4i-a10-pinctrl";
175 reg = <0x01c20800 0x400>; 179 reg = <0x01c20800 0x400>;
180 interrupts = <28>;
176 clocks = <&apb0_gates 5>; 181 clocks = <&apb0_gates 5>;
177 gpio-controller; 182 gpio-controller;
183 interrupt-controller;
178 #address-cells = <1>; 184 #address-cells = <1>;
179 #size-cells = <0>; 185 #size-cells = <0>;
180 #gpio-cells = <3>; 186 #gpio-cells = <3>;
@@ -199,6 +205,27 @@
199 allwinner,drive = <0>; 205 allwinner,drive = <0>;
200 allwinner,pull = <0>; 206 allwinner,pull = <0>;
201 }; 207 };
208
209 i2c0_pins_a: i2c0@0 {
210 allwinner,pins = "PB0", "PB1";
211 allwinner,function = "i2c0";
212 allwinner,drive = <0>;
213 allwinner,pull = <0>;
214 };
215
216 i2c1_pins_a: i2c1@0 {
217 allwinner,pins = "PB18", "PB19";
218 allwinner,function = "i2c1";
219 allwinner,drive = <0>;
220 allwinner,pull = <0>;
221 };
222
223 i2c2_pins_a: i2c2@0 {
224 allwinner,pins = "PB20", "PB21";
225 allwinner,function = "i2c2";
226 allwinner,drive = <0>;
227 allwinner,pull = <0>;
228 };
202 }; 229 };
203 230
204 timer@01c20c00 { 231 timer@01c20c00 {
@@ -292,5 +319,32 @@
292 clocks = <&apb1_gates 23>; 319 clocks = <&apb1_gates 23>;
293 status = "disabled"; 320 status = "disabled";
294 }; 321 };
322
323 i2c0: i2c@01c2ac00 {
324 compatible = "allwinner,sun4i-i2c";
325 reg = <0x01c2ac00 0x400>;
326 interrupts = <7>;
327 clocks = <&apb1_gates 0>;
328 clock-frequency = <100000>;
329 status = "disabled";
330 };
331
332 i2c1: i2c@01c2b000 {
333 compatible = "allwinner,sun4i-i2c";
334 reg = <0x01c2b000 0x400>;
335 interrupts = <8>;
336 clocks = <&apb1_gates 1>;
337 clock-frequency = <100000>;
338 status = "disabled";
339 };
340
341 i2c2: i2c@01c2b400 {
342 compatible = "allwinner,sun4i-i2c";
343 reg = <0x01c2b400 0x400>;
344 interrupts = <9>;
345 clocks = <&apb1_gates 2>;
346 clock-frequency = <100000>;
347 status = "disabled";
348 };
295 }; 349 };
296}; 350};
diff --git a/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
new file mode 100644
index 000000000000..64dc0c42c43a
--- /dev/null
+++ b/arch/arm/boot/dts/sun5i-a10s-olinuxino-micro.dts
@@ -0,0 +1,76 @@
1/*
2 * Copyright 2013 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/ "sun5i-a10s.dtsi"
16
17/ {
18 model = "Olimex A10s-Olinuxino Micro";
19 compatible = "olimex,a10s-olinuxino-micro", "allwinner,sun5i-a10s";
20
21 soc@01c20000 {
22 emac: ethernet@01c0b000 {
23 pinctrl-names = "default";
24 pinctrl-0 = <&emac_pins_a>;
25 phy = <&phy1>;
26 status = "okay";
27 };
28
29 mdio@01c0b080 {
30 status = "okay";
31
32 phy1: ethernet-phy@1 {
33 reg = <1>;
34 };
35 };
36
37 pinctrl@01c20800 {
38 led_pins_olinuxino: led_pins@0 {
39 allwinner,pins = "PE3";
40 allwinner,function = "gpio_out";
41 allwinner,drive = <1>;
42 allwinner,pull = <0>;
43 };
44 };
45
46 uart0: serial@01c28000 {
47 pinctrl-names = "default";
48 pinctrl-0 = <&uart0_pins_a>;
49 status = "okay";
50 };
51
52 uart2: serial@01c28800 {
53 pinctrl-names = "default";
54 pinctrl-0 = <&uart2_pins_a>;
55 status = "okay";
56 };
57
58 uart3: serial@01c28c00 {
59 pinctrl-names = "default";
60 pinctrl-0 = <&uart3_pins_a>;
61 status = "okay";
62 };
63 };
64
65 leds {
66 compatible = "gpio-leds";
67 pinctrl-names = "default";
68 pinctrl-0 = <&led_pins_olinuxino>;
69
70 green {
71 label = "a10s-olinuxino-micro:green:usr";
72 gpios = <&pio 4 3 0>;
73 default-state = "on";
74 };
75 };
76};
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
new file mode 100644
index 000000000000..2307ce827ae0
--- /dev/null
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -0,0 +1,286 @@
1/*
2 * Copyright 2013 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/include/ "skeleton.dtsi"
15
16/ {
17 interrupt-parent = <&intc>;
18
19 cpus {
20 cpu@0 {
21 compatible = "arm,cortex-a8";
22 };
23 };
24
25 memory {
26 reg = <0x40000000 0x20000000>;
27 };
28
29 clocks {
30 #address-cells = <1>;
31 #size-cells = <1>;
32 ranges;
33
34 /*
35 * This is a dummy clock, to be used as placeholder on
36 * other mux clocks when a specific parent clock is not
37 * yet implemented. It should be dropped when the driver
38 * is complete.
39 */
40 dummy: dummy {
41 #clock-cells = <0>;
42 compatible = "fixed-clock";
43 clock-frequency = <0>;
44 };
45
46 osc24M: osc24M@01c20050 {
47 #clock-cells = <0>;
48 compatible = "allwinner,sun4i-osc-clk";
49 reg = <0x01c20050 0x4>;
50 clock-frequency = <24000000>;
51 };
52
53 osc32k: osc32k {
54 #clock-cells = <0>;
55 compatible = "fixed-clock";
56 clock-frequency = <32768>;
57 };
58
59 pll1: pll1@01c20000 {
60 #clock-cells = <0>;
61 compatible = "allwinner,sun4i-pll1-clk";
62 reg = <0x01c20000 0x4>;
63 clocks = <&osc24M>;
64 };
65
66 /* dummy is 200M */
67 cpu: cpu@01c20054 {
68 #clock-cells = <0>;
69 compatible = "allwinner,sun4i-cpu-clk";
70 reg = <0x01c20054 0x4>;
71 clocks = <&osc32k>, <&osc24M>, <&pll1>, <&dummy>;
72 };
73
74 axi: axi@01c20054 {
75 #clock-cells = <0>;
76 compatible = "allwinner,sun4i-axi-clk";
77 reg = <0x01c20054 0x4>;
78 clocks = <&cpu>;
79 };
80
81 axi_gates: axi_gates@01c2005c {
82 #clock-cells = <1>;
83 compatible = "allwinner,sun4i-axi-gates-clk";
84 reg = <0x01c2005c 0x4>;
85 clocks = <&axi>;
86 clock-output-names = "axi_dram";
87 };
88
89 ahb: ahb@01c20054 {
90 #clock-cells = <0>;
91 compatible = "allwinner,sun4i-ahb-clk";
92 reg = <0x01c20054 0x4>;
93 clocks = <&axi>;
94 };
95
96 ahb_gates: ahb_gates@01c20060 {
97 #clock-cells = <1>;
98 compatible = "allwinner,sun4i-ahb-gates-clk";
99 reg = <0x01c20060 0x8>;
100 clocks = <&ahb>;
101 clock-output-names = "ahb_usb0", "ahb_ehci0",
102 "ahb_ohci0", "ahb_ehci1", "ahb_ohci1", "ahb_ss",
103 "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1",
104 "ahb_mmc2", "ahb_mmc3", "ahb_ms", "ahb_nand",
105 "ahb_sdram", "ahb_ace", "ahb_emac", "ahb_ts",
106 "ahb_spi0", "ahb_spi1", "ahb_spi2", "ahb_spi3",
107 "ahb_pata", "ahb_sata", "ahb_gps", "ahb_ve",
108 "ahb_tvd", "ahb_tve0", "ahb_tve1", "ahb_lcd0",
109 "ahb_lcd1", "ahb_csi0", "ahb_csi1", "ahb_hdmi",
110 "ahb_de_be0", "ahb_de_be1", "ahb_de_fe0",
111 "ahb_de_fe1", "ahb_mp", "ahb_mali400";
112 };
113
114 apb0: apb0@01c20054 {
115 #clock-cells = <0>;
116 compatible = "allwinner,sun4i-apb0-clk";
117 reg = <0x01c20054 0x4>;
118 clocks = <&ahb>;
119 };
120
121 apb0_gates: apb0_gates@01c20068 {
122 #clock-cells = <1>;
123 compatible = "allwinner,sun4i-apb0-gates-clk";
124 reg = <0x01c20068 0x4>;
125 clocks = <&apb0>;
126 clock-output-names = "apb0_codec", "apb0_spdif",
127 "apb0_ac97", "apb0_iis", "apb0_pio", "apb0_ir0",
128 "apb0_ir1", "apb0_keypad";
129 };
130
131 /* dummy is pll62 */
132 apb1_mux: apb1_mux@01c20058 {
133 #clock-cells = <0>;
134 compatible = "allwinner,sun4i-apb1-mux-clk";
135 reg = <0x01c20058 0x4>;
136 clocks = <&osc24M>, <&dummy>, <&osc32k>;
137 };
138
139 apb1: apb1@01c20058 {
140 #clock-cells = <0>;
141 compatible = "allwinner,sun4i-apb1-clk";
142 reg = <0x01c20058 0x4>;
143 clocks = <&apb1_mux>;
144 };
145
146 apb1_gates: apb1_gates@01c2006c {
147 #clock-cells = <1>;
148 compatible = "allwinner,sun4i-apb1-gates-clk";
149 reg = <0x01c2006c 0x4>;
150 clocks = <&apb1>;
151 clock-output-names = "apb1_i2c0", "apb1_i2c1",
152 "apb1_i2c2", "apb1_can", "apb1_scr",
153 "apb1_ps20", "apb1_ps21", "apb1_uart0",
154 "apb1_uart1", "apb1_uart2", "apb1_uart3",
155 "apb1_uart4", "apb1_uart5", "apb1_uart6",
156 "apb1_uart7";
157 };
158 };
159
160 soc@01c20000 {
161 compatible = "simple-bus";
162 #address-cells = <1>;
163 #size-cells = <1>;
164 reg = <0x01c20000 0x300000>;
165 ranges;
166
167 emac: ethernet@01c0b000 {
168 compatible = "allwinner,sun4i-emac";
169 reg = <0x01c0b000 0x1000>;
170 interrupts = <55>;
171 clocks = <&ahb_gates 17>;
172 status = "disabled";
173 };
174
175 mdio@01c0b080 {
176 compatible = "allwinner,sun4i-mdio";
177 reg = <0x01c0b080 0x14>;
178 status = "disabled";
179 #address-cells = <1>;
180 #size-cells = <0>;
181 };
182
183 intc: interrupt-controller@01c20400 {
184 compatible = "allwinner,sun4i-ic";
185 reg = <0x01c20400 0x400>;
186 interrupt-controller;
187 #interrupt-cells = <1>;
188 };
189
190 pio: pinctrl@01c20800 {
191 compatible = "allwinner,sun5i-a10s-pinctrl";
192 reg = <0x01c20800 0x400>;
193 interrupts = <28>;
194 clocks = <&apb0_gates 5>;
195 gpio-controller;
196 interrupt-controller;
197 #address-cells = <1>;
198 #size-cells = <0>;
199 #gpio-cells = <3>;
200
201 uart0_pins_a: uart0@0 {
202 allwinner,pins = "PB19", "PB20";
203 allwinner,function = "uart0";
204 allwinner,drive = <0>;
205 allwinner,pull = <0>;
206 };
207
208 uart2_pins_a: uart2@0 {
209 allwinner,pins = "PC18", "PC19";
210 allwinner,function = "uart2";
211 allwinner,drive = <0>;
212 allwinner,pull = <0>;
213 };
214
215 uart3_pins_a: uart3@0 {
216 allwinner,pins = "PG9", "PG10";
217 allwinner,function = "uart3";
218 allwinner,drive = <0>;
219 allwinner,pull = <0>;
220 };
221
222 emac_pins_a: emac0@0 {
223 allwinner,pins = "PA0", "PA1", "PA2",
224 "PA3", "PA4", "PA5", "PA6",
225 "PA7", "PA8", "PA9", "PA10",
226 "PA11", "PA12", "PA13", "PA14",
227 "PA15", "PA16";
228 allwinner,function = "emac";
229 allwinner,drive = <0>;
230 allwinner,pull = <0>;
231 };
232 };
233
234 timer@01c20c00 {
235 compatible = "allwinner,sun4i-timer";
236 reg = <0x01c20c00 0x90>;
237 interrupts = <22>;
238 clocks = <&osc24M>;
239 };
240
241 wdt: watchdog@01c20c90 {
242 compatible = "allwinner,sun4i-wdt";
243 reg = <0x01c20c90 0x10>;
244 };
245
246 uart0: serial@01c28000 {
247 compatible = "snps,dw-apb-uart";
248 reg = <0x01c28000 0x400>;
249 interrupts = <1>;
250 reg-shift = <2>;
251 reg-io-width = <4>;
252 clocks = <&apb1_gates 16>;
253 status = "disabled";
254 };
255
256 uart1: serial@01c28400 {
257 compatible = "snps,dw-apb-uart";
258 reg = <0x01c28400 0x400>;
259 interrupts = <2>;
260 reg-shift = <2>;
261 reg-io-width = <4>;
262 clocks = <&apb1_gates 17>;
263 status = "disabled";
264 };
265
266 uart2: serial@01c28800 {
267 compatible = "snps,dw-apb-uart";
268 reg = <0x01c28800 0x400>;
269 interrupts = <3>;
270 reg-shift = <2>;
271 reg-io-width = <4>;
272 clocks = <&apb1_gates 18>;
273 status = "disabled";
274 };
275
276 uart3: serial@01c28c00 {
277 compatible = "snps,dw-apb-uart";
278 reg = <0x01c28c00 0x400>;
279 interrupts = <4>;
280 reg-shift = <2>;
281 reg-io-width = <4>;
282 clocks = <&apb1_gates 19>;
283 status = "disabled";
284 };
285 };
286};
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 3ca55067f868..80497e376706 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -37,6 +37,24 @@
37 pinctrl-0 = <&uart1_pins_b>; 37 pinctrl-0 = <&uart1_pins_b>;
38 status = "okay"; 38 status = "okay";
39 }; 39 };
40
41 i2c0: i2c@01c2ac00 {
42 pinctrl-names = "default";
43 pinctrl-0 = <&i2c0_pins_a>;
44 status = "okay";
45 };
46
47 i2c1: i2c@01c2b000 {
48 pinctrl-names = "default";
49 pinctrl-0 = <&i2c1_pins_a>;
50 status = "okay";
51 };
52
53 i2c2: i2c@01c2b400 {
54 pinctrl-names = "default";
55 pinctrl-0 = <&i2c2_pins_a>;
56 status = "okay";
57 };
40 }; 58 };
41 59
42 leds { 60 leds {
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 31fa38f8cc98..7363211daf84 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -17,8 +17,12 @@
17 interrupt-parent = <&intc>; 17 interrupt-parent = <&intc>;
18 18
19 cpus { 19 cpus {
20 #address-cells = <1>;
21 #size-cells = <0>;
20 cpu@0 { 22 cpu@0 {
23 device_type = "cpu";
21 compatible = "arm,cortex-a8"; 24 compatible = "arm,cortex-a8";
25 reg = <0x0>;
22 }; 26 };
23 }; 27 };
24 28
@@ -95,20 +99,15 @@
95 99
96 ahb_gates: ahb_gates@01c20060 { 100 ahb_gates: ahb_gates@01c20060 {
97 #clock-cells = <1>; 101 #clock-cells = <1>;
98 compatible = "allwinner,sun4i-ahb-gates-clk"; 102 compatible = "allwinner,sun5i-a13-ahb-gates-clk";
99 reg = <0x01c20060 0x8>; 103 reg = <0x01c20060 0x8>;
100 clocks = <&ahb>; 104 clocks = <&ahb>;
101 clock-output-names = "ahb_usb0", "ahb_ehci0", 105 clock-output-names = "ahb_usbotg", "ahb_ehci", "ahb_ohci",
102 "ahb_ohci0", "ahb_ehci1", "ahb_ohci1", "ahb_ss", 106 "ahb_ss", "ahb_dma", "ahb_bist", "ahb_mmc0",
103 "ahb_dma", "ahb_bist", "ahb_mmc0", "ahb_mmc1", 107 "ahb_mmc1", "ahb_mmc2", "ahb_nand", "ahb_sdram",
104 "ahb_mmc2", "ahb_mmc3", "ahb_ms", "ahb_nand", 108 "ahb_spi0", "ahb_spi1", "ahb_spi2", "ahb_stimer",
105 "ahb_sdram", "ahb_ace", "ahb_emac", "ahb_ts", 109 "ahb_ve", "ahb_lcd", "ahb_csi", "ahb_de_be",
106 "ahb_spi0", "ahb_spi1", "ahb_spi2", "ahb_spi3", 110 "ahb_de_fe", "ahb_iep", "ahb_mali400";
107 "ahb_pata", "ahb_sata", "ahb_gps", "ahb_ve",
108 "ahb_tvd", "ahb_tve0", "ahb_tve1", "ahb_lcd0",
109 "ahb_lcd1", "ahb_csi0", "ahb_csi1", "ahb_hdmi",
110 "ahb_de_be0", "ahb_de_be1", "ahb_de_fe0",
111 "ahb_de_fe1", "ahb_mp", "ahb_mali400";
112 }; 111 };
113 112
114 apb0: apb0@01c20054 { 113 apb0: apb0@01c20054 {
@@ -120,15 +119,13 @@
120 119
121 apb0_gates: apb0_gates@01c20068 { 120 apb0_gates: apb0_gates@01c20068 {
122 #clock-cells = <1>; 121 #clock-cells = <1>;
123 compatible = "allwinner,sun4i-apb0-gates-clk"; 122 compatible = "allwinner,sun5i-a13-apb0-gates-clk";
124 reg = <0x01c20068 0x4>; 123 reg = <0x01c20068 0x4>;
125 clocks = <&apb0>; 124 clocks = <&apb0>;
126 clock-output-names = "apb0_codec", "apb0_spdif", 125 clock-output-names = "apb0_codec", "apb0_pio", "apb0_ir";
127 "apb0_ac97", "apb0_iis", "apb0_pio", "apb0_ir0",
128 "apb0_ir1", "apb0_keypad";
129 }; 126 };
130 127
131 /* dummy is pll62 */ 128 /* dummy is pll6 */
132 apb1_mux: apb1_mux@01c20058 { 129 apb1_mux: apb1_mux@01c20058 {
133 #clock-cells = <0>; 130 #clock-cells = <0>;
134 compatible = "allwinner,sun4i-apb1-mux-clk"; 131 compatible = "allwinner,sun4i-apb1-mux-clk";
@@ -145,15 +142,11 @@
145 142
146 apb1_gates: apb1_gates@01c2006c { 143 apb1_gates: apb1_gates@01c2006c {
147 #clock-cells = <1>; 144 #clock-cells = <1>;
148 compatible = "allwinner,sun4i-apb1-gates-clk"; 145 compatible = "allwinner,sun5i-a13-apb1-gates-clk";
149 reg = <0x01c2006c 0x4>; 146 reg = <0x01c2006c 0x4>;
150 clocks = <&apb1>; 147 clocks = <&apb1>;
151 clock-output-names = "apb1_i2c0", "apb1_i2c1", 148 clock-output-names = "apb1_i2c0", "apb1_i2c1",
152 "apb1_i2c2", "apb1_can", "apb1_scr", 149 "apb1_i2c2", "apb1_uart1", "apb1_uart3";
153 "apb1_ps20", "apb1_ps21", "apb1_uart0",
154 "apb1_uart1", "apb1_uart2", "apb1_uart3",
155 "apb1_uart4", "apb1_uart5", "apb1_uart6",
156 "apb1_uart7";
157 }; 150 };
158 }; 151 };
159 152
@@ -174,8 +167,10 @@
174 pio: pinctrl@01c20800 { 167 pio: pinctrl@01c20800 {
175 compatible = "allwinner,sun5i-a13-pinctrl"; 168 compatible = "allwinner,sun5i-a13-pinctrl";
176 reg = <0x01c20800 0x400>; 169 reg = <0x01c20800 0x400>;
170 interrupts = <28>;
177 clocks = <&apb0_gates 5>; 171 clocks = <&apb0_gates 5>;
178 gpio-controller; 172 gpio-controller;
173 interrupt-controller;
179 #address-cells = <1>; 174 #address-cells = <1>;
180 #size-cells = <0>; 175 #size-cells = <0>;
181 #gpio-cells = <3>; 176 #gpio-cells = <3>;
@@ -193,6 +188,27 @@
193 allwinner,drive = <0>; 188 allwinner,drive = <0>;
194 allwinner,pull = <0>; 189 allwinner,pull = <0>;
195 }; 190 };
191
192 i2c0_pins_a: i2c0@0 {
193 allwinner,pins = "PB0", "PB1";
194 allwinner,function = "i2c0";
195 allwinner,drive = <0>;
196 allwinner,pull = <0>;
197 };
198
199 i2c1_pins_a: i2c1@0 {
200 allwinner,pins = "PB15", "PB16";
201 allwinner,function = "i2c1";
202 allwinner,drive = <0>;
203 allwinner,pull = <0>;
204 };
205
206 i2c2_pins_a: i2c2@0 {
207 allwinner,pins = "PB17", "PB18";
208 allwinner,function = "i2c2";
209 allwinner,drive = <0>;
210 allwinner,pull = <0>;
211 };
196 }; 212 };
197 213
198 timer@01c20c00 { 214 timer@01c20c00 {
@@ -226,5 +242,32 @@
226 clocks = <&apb1_gates 19>; 242 clocks = <&apb1_gates 19>;
227 status = "disabled"; 243 status = "disabled";
228 }; 244 };
245
246 i2c0: i2c@01c2ac00 {
247 compatible = "allwinner,sun4i-i2c";
248 reg = <0x01c2ac00 0x400>;
249 interrupts = <7>;
250 clocks = <&apb1_gates 0>;
251 clock-frequency = <100000>;
252 status = "disabled";
253 };
254
255 i2c1: i2c@01c2b000 {
256 compatible = "allwinner,sun4i-i2c";
257 reg = <0x01c2b000 0x400>;
258 interrupts = <8>;
259 clocks = <&apb1_gates 1>;
260 clock-frequency = <100000>;
261 status = "disabled";
262 };
263
264 i2c2: i2c@01c2b400 {
265 compatible = "allwinner,sun4i-i2c";
266 reg = <0x01c2b400 0x400>;
267 interrupts = <9>;
268 clocks = <&apb1_gates 2>;
269 clock-frequency = <100000>;
270 status = "disabled";
271 };
229 }; 272 };
230}; 273};
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index 72c1f27af7f3..cb640eb6c932 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra114.dtsi" 3#include "tegra114.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Tegra114 Dalmore evaluation board"; 6 model = "NVIDIA Tegra114 Dalmore evaluation board";
@@ -727,6 +727,16 @@
727 battery-name = "battery"; 727 battery-name = "battery";
728 sbs,i2c-retry-count = <2>; 728 sbs,i2c-retry-count = <2>;
729 sbs,poll-retry-count = <100>; 729 sbs,poll-retry-count = <100>;
730 power-supplies = <&charger>;
731 };
732
733 rt5640: rt5640 {
734 compatible = "realtek,rt5640";
735 reg = <0x1c>;
736 interrupt-parent = <&gpio>;
737 interrupts = <TEGRA_GPIO(W, 3) GPIO_ACTIVE_HIGH>;
738 realtek,ldo1-en-gpios =
739 <&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
730 }; 740 };
731 }; 741 };
732 742
@@ -748,7 +758,7 @@
748 compatible = "ti,tps65090"; 758 compatible = "ti,tps65090";
749 reg = <0x48>; 759 reg = <0x48>;
750 interrupt-parent = <&gpio>; 760 interrupt-parent = <&gpio>;
751 interrupts = <72 0x04>; /* gpio PJ0 */ 761 interrupts = <TEGRA_GPIO(J, 0) IRQ_TYPE_LEVEL_HIGH>;
752 762
753 vsys1-supply = <&vdd_ac_bat_reg>; 763 vsys1-supply = <&vdd_ac_bat_reg>;
754 vsys2-supply = <&vdd_ac_bat_reg>; 764 vsys2-supply = <&vdd_ac_bat_reg>;
@@ -763,6 +773,11 @@
763 vsys-l1-supply = <&vdd_ac_bat_reg>; 773 vsys-l1-supply = <&vdd_ac_bat_reg>;
764 vsys-l2-supply = <&vdd_ac_bat_reg>; 774 vsys-l2-supply = <&vdd_ac_bat_reg>;
765 775
776 charger: charger {
777 compatible = "ti,tps65090-charger";
778 ti,enable-low-current-chrg;
779 };
780
766 regulators { 781 regulators {
767 tps65090_dcdc1_reg: dcdc1 { 782 tps65090_dcdc1_reg: dcdc1 {
768 regulator-name = "vdd-sys-5v0"; 783 regulator-name = "vdd-sys-5v0";
@@ -823,12 +838,28 @@
823 }; 838 };
824 }; 839 };
825 840
841 spi@7000da00 {
842 status = "okay";
843 spi-max-frequency = <25000000>;
844 spi-flash@0 {
845 compatible = "winbond,w25q32dw";
846 reg = <0>;
847 spi-max-frequency = <20000000>;
848 };
849 };
850
826 pmc { 851 pmc {
827 nvidia,invert-interrupt; 852 nvidia,invert-interrupt;
828 }; 853 };
829 854
855 ahub {
856 i2s@70080400 {
857 status = "okay";
858 };
859 };
860
830 sdhci@78000400 { 861 sdhci@78000400 {
831 cd-gpios = <&gpio 170 1>; /* gpio PV2 */ 862 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
832 bus-width = <4>; 863 bus-width = <4>;
833 status = "okay"; 864 status = "okay";
834 }; 865 };
@@ -873,7 +904,7 @@
873 regulator-min-microvolt = <1800000>; 904 regulator-min-microvolt = <1800000>;
874 regulator-max-microvolt = <1800000>; 905 regulator-max-microvolt = <1800000>;
875 enable-active-high; 906 enable-active-high;
876 gpio = <&gpio 61 0>; /* GPIO PH5 */ 907 gpio = <&gpio TEGRA_GPIO(H, 5) GPIO_ACTIVE_HIGH>;
877 }; 908 };
878 909
879 lcd_bl_en_reg: regulator@2 { 910 lcd_bl_en_reg: regulator@2 {
@@ -883,7 +914,7 @@
883 regulator-min-microvolt = <5000000>; 914 regulator-min-microvolt = <5000000>;
884 regulator-max-microvolt = <5000000>; 915 regulator-max-microvolt = <5000000>;
885 enable-active-high; 916 enable-active-high;
886 gpio = <&gpio 58 0>; /* GPIO PH2 */ 917 gpio = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>;
887 }; 918 };
888 919
889 usb1_vbus_reg: regulator@3 { 920 usb1_vbus_reg: regulator@3 {
@@ -893,7 +924,7 @@
893 regulator-min-microvolt = <5000000>; 924 regulator-min-microvolt = <5000000>;
894 regulator-max-microvolt = <5000000>; 925 regulator-max-microvolt = <5000000>;
895 enable-active-high; 926 enable-active-high;
896 gpio = <&gpio 108 0>; /* GPIO PN4 */ 927 gpio = <&gpio TEGRA_GPIO(N, 4) GPIO_ACTIVE_HIGH>;
897 gpio-open-drain; 928 gpio-open-drain;
898 vin-supply = <&tps65090_dcdc1_reg>; 929 vin-supply = <&tps65090_dcdc1_reg>;
899 }; 930 };
@@ -905,7 +936,7 @@
905 regulator-min-microvolt = <5000000>; 936 regulator-min-microvolt = <5000000>;
906 regulator-max-microvolt = <5000000>; 937 regulator-max-microvolt = <5000000>;
907 enable-active-high; 938 enable-active-high;
908 gpio = <&gpio 86 0>; /* GPIO PK6 */ 939 gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_HIGH>;
909 gpio-open-drain; 940 gpio-open-drain;
910 vin-supply = <&tps65090_dcdc1_reg>; 941 vin-supply = <&tps65090_dcdc1_reg>;
911 }; 942 };
@@ -917,8 +948,32 @@
917 regulator-min-microvolt = <5000000>; 948 regulator-min-microvolt = <5000000>;
918 regulator-max-microvolt = <5000000>; 949 regulator-max-microvolt = <5000000>;
919 enable-active-high; 950 enable-active-high;
920 gpio = <&gpio 81 0>; /* GPIO PK1 */ 951 gpio = <&gpio TEGRA_GPIO(K, 1) GPIO_ACTIVE_HIGH>;
921 vin-supply = <&tps65090_dcdc1_reg>; 952 vin-supply = <&tps65090_dcdc1_reg>;
922 }; 953 };
923 }; 954 };
955
956 sound {
957 compatible = "nvidia,tegra-audio-rt5640-dalmore",
958 "nvidia,tegra-audio-rt5640";
959 nvidia,model = "NVIDIA Tegra Dalmore";
960
961 nvidia,audio-routing =
962 "Headphones", "HPOR",
963 "Headphones", "HPOL",
964 "Speakers", "SPORP",
965 "Speakers", "SPORN",
966 "Speakers", "SPOLP",
967 "Speakers", "SPOLN";
968
969 nvidia,i2s-controller = <&tegra_i2s1>;
970 nvidia,audio-codec = <&rt5640>;
971
972 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(R, 7) GPIO_ACTIVE_HIGH>;
973
974 clocks = <&tegra_car TEGRA114_CLK_PLL_A>,
975 <&tegra_car TEGRA114_CLK_PLL_A_OUT0>,
976 <&tegra_car TEGRA114_CLK_EXTERN1>;
977 clock-names = "pll_a", "pll_a_out0", "mclk";
978 };
924}; 979};
diff --git a/arch/arm/boot/dts/tegra114-pluto.dts b/arch/arm/boot/dts/tegra114-pluto.dts
index 6bbc8efae9c0..d5f8d3e0bde2 100644
--- a/arch/arm/boot/dts/tegra114-pluto.dts
+++ b/arch/arm/boot/dts/tegra114-pluto.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra114.dtsi" 3#include "tegra114.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Tegra114 Pluto evaluation board"; 6 model = "NVIDIA Tegra114 Pluto evaluation board";
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 629415ffd8dc..abf6c40d28c6 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -1,4 +1,8 @@
1/include/ "skeleton.dtsi" 1#include <dt-bindings/clock/tegra114-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/interrupt-controller/arm-gic.h>
4
5#include "skeleton.dtsi"
2 6
3/ { 7/ {
4 compatible = "nvidia,tegra114"; 8 compatible = "nvidia,tegra114";
@@ -19,19 +23,20 @@
19 <0x50042000 0x1000>, 23 <0x50042000 0x1000>,
20 <0x50044000 0x2000>, 24 <0x50044000 0x2000>,
21 <0x50046000 0x2000>; 25 <0x50046000 0x2000>;
22 interrupts = <1 9 0xf04>; 26 interrupts = <GIC_PPI 9
27 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
23 }; 28 };
24 29
25 timer@60005000 { 30 timer@60005000 {
26 compatible = "nvidia,tegra114-timer", "nvidia,tegra20-timer"; 31 compatible = "nvidia,tegra114-timer", "nvidia,tegra20-timer";
27 reg = <0x60005000 0x400>; 32 reg = <0x60005000 0x400>;
28 interrupts = <0 0 0x04 33 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
29 0 1 0x04 34 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
30 0 41 0x04 35 <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
31 0 42 0x04 36 <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
32 0 121 0x04 37 <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
33 0 122 0x04>; 38 <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
34 clocks = <&tegra_car 5>; 39 clocks = <&tegra_car TEGRA114_CLK_TIMER>;
35 }; 40 };
36 41
37 tegra_car: clock { 42 tegra_car: clock {
@@ -43,39 +48,39 @@
43 apbdma: dma { 48 apbdma: dma {
44 compatible = "nvidia,tegra114-apbdma"; 49 compatible = "nvidia,tegra114-apbdma";
45 reg = <0x6000a000 0x1400>; 50 reg = <0x6000a000 0x1400>;
46 interrupts = <0 104 0x04 51 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
47 0 105 0x04 52 <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
48 0 106 0x04 53 <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
49 0 107 0x04 54 <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
50 0 108 0x04 55 <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
51 0 109 0x04 56 <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
52 0 110 0x04 57 <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
53 0 111 0x04 58 <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
54 0 112 0x04 59 <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
55 0 113 0x04 60 <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
56 0 114 0x04 61 <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
57 0 115 0x04 62 <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
58 0 116 0x04 63 <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
59 0 117 0x04 64 <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
60 0 118 0x04 65 <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
61 0 119 0x04 66 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
62 0 128 0x04 67 <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>,
63 0 129 0x04 68 <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>,
64 0 130 0x04 69 <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>,
65 0 131 0x04 70 <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
66 0 132 0x04 71 <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>,
67 0 133 0x04 72 <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
68 0 134 0x04 73 <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
69 0 135 0x04 74 <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
70 0 136 0x04 75 <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>,
71 0 137 0x04 76 <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
72 0 138 0x04 77 <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
73 0 139 0x04 78 <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
74 0 140 0x04 79 <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
75 0 141 0x04 80 <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
76 0 142 0x04 81 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
77 0 143 0x04>; 82 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
78 clocks = <&tegra_car 34>; 83 clocks = <&tegra_car TEGRA114_CLK_APBDMA>;
79 }; 84 };
80 85
81 ahb: ahb { 86 ahb: ahb {
@@ -86,14 +91,14 @@
86 gpio: gpio { 91 gpio: gpio {
87 compatible = "nvidia,tegra114-gpio", "nvidia,tegra30-gpio"; 92 compatible = "nvidia,tegra114-gpio", "nvidia,tegra30-gpio";
88 reg = <0x6000d000 0x1000>; 93 reg = <0x6000d000 0x1000>;
89 interrupts = <0 32 0x04 94 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
90 0 33 0x04 95 <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
91 0 34 0x04 96 <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
92 0 35 0x04 97 <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
93 0 55 0x04 98 <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
94 0 87 0x04 99 <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
95 0 89 0x04 100 <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
96 0 125 0x04>; 101 <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
97 #gpio-cells = <2>; 102 #gpio-cells = <2>;
98 gpio-controller; 103 gpio-controller;
99 #interrupt-cells = <2>; 104 #interrupt-cells = <2>;
@@ -118,57 +123,57 @@
118 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart"; 123 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart";
119 reg = <0x70006000 0x40>; 124 reg = <0x70006000 0x40>;
120 reg-shift = <2>; 125 reg-shift = <2>;
121 interrupts = <0 36 0x04>; 126 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
122 nvidia,dma-request-selector = <&apbdma 8>; 127 nvidia,dma-request-selector = <&apbdma 8>;
123 status = "disabled"; 128 status = "disabled";
124 clocks = <&tegra_car 6>; 129 clocks = <&tegra_car TEGRA114_CLK_UARTA>;
125 }; 130 };
126 131
127 uartb: serial@70006040 { 132 uartb: serial@70006040 {
128 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart"; 133 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart";
129 reg = <0x70006040 0x40>; 134 reg = <0x70006040 0x40>;
130 reg-shift = <2>; 135 reg-shift = <2>;
131 interrupts = <0 37 0x04>; 136 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
132 nvidia,dma-request-selector = <&apbdma 9>; 137 nvidia,dma-request-selector = <&apbdma 9>;
133 status = "disabled"; 138 status = "disabled";
134 clocks = <&tegra_car 192>; 139 clocks = <&tegra_car TEGRA114_CLK_UARTB>;
135 }; 140 };
136 141
137 uartc: serial@70006200 { 142 uartc: serial@70006200 {
138 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart"; 143 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart";
139 reg = <0x70006200 0x100>; 144 reg = <0x70006200 0x100>;
140 reg-shift = <2>; 145 reg-shift = <2>;
141 interrupts = <0 46 0x04>; 146 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
142 nvidia,dma-request-selector = <&apbdma 10>; 147 nvidia,dma-request-selector = <&apbdma 10>;
143 status = "disabled"; 148 status = "disabled";
144 clocks = <&tegra_car 55>; 149 clocks = <&tegra_car TEGRA114_CLK_UARTC>;
145 }; 150 };
146 151
147 uartd: serial@70006300 { 152 uartd: serial@70006300 {
148 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart"; 153 compatible = "nvidia,tegra114-uart", "nvidia,tegra20-uart";
149 reg = <0x70006300 0x100>; 154 reg = <0x70006300 0x100>;
150 reg-shift = <2>; 155 reg-shift = <2>;
151 interrupts = <0 90 0x04>; 156 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
152 nvidia,dma-request-selector = <&apbdma 19>; 157 nvidia,dma-request-selector = <&apbdma 19>;
153 status = "disabled"; 158 status = "disabled";
154 clocks = <&tegra_car 65>; 159 clocks = <&tegra_car TEGRA114_CLK_UARTD>;
155 }; 160 };
156 161
157 pwm: pwm { 162 pwm: pwm {
158 compatible = "nvidia,tegra114-pwm", "nvidia,tegra20-pwm"; 163 compatible = "nvidia,tegra114-pwm", "nvidia,tegra20-pwm";
159 reg = <0x7000a000 0x100>; 164 reg = <0x7000a000 0x100>;
160 #pwm-cells = <2>; 165 #pwm-cells = <2>;
161 clocks = <&tegra_car 17>; 166 clocks = <&tegra_car TEGRA114_CLK_PWM>;
162 status = "disabled"; 167 status = "disabled";
163 }; 168 };
164 169
165 i2c@7000c000 { 170 i2c@7000c000 {
166 compatible = "nvidia,tegra114-i2c"; 171 compatible = "nvidia,tegra114-i2c";
167 reg = <0x7000c000 0x100>; 172 reg = <0x7000c000 0x100>;
168 interrupts = <0 38 0x04>; 173 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
169 #address-cells = <1>; 174 #address-cells = <1>;
170 #size-cells = <0>; 175 #size-cells = <0>;
171 clocks = <&tegra_car 12>; 176 clocks = <&tegra_car TEGRA114_CLK_I2C1>;
172 clock-names = "div-clk"; 177 clock-names = "div-clk";
173 status = "disabled"; 178 status = "disabled";
174 }; 179 };
@@ -176,10 +181,10 @@
176 i2c@7000c400 { 181 i2c@7000c400 {
177 compatible = "nvidia,tegra114-i2c"; 182 compatible = "nvidia,tegra114-i2c";
178 reg = <0x7000c400 0x100>; 183 reg = <0x7000c400 0x100>;
179 interrupts = <0 84 0x04>; 184 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
180 #address-cells = <1>; 185 #address-cells = <1>;
181 #size-cells = <0>; 186 #size-cells = <0>;
182 clocks = <&tegra_car 54>; 187 clocks = <&tegra_car TEGRA114_CLK_I2C2>;
183 clock-names = "div-clk"; 188 clock-names = "div-clk";
184 status = "disabled"; 189 status = "disabled";
185 }; 190 };
@@ -187,10 +192,10 @@
187 i2c@7000c500 { 192 i2c@7000c500 {
188 compatible = "nvidia,tegra114-i2c"; 193 compatible = "nvidia,tegra114-i2c";
189 reg = <0x7000c500 0x100>; 194 reg = <0x7000c500 0x100>;
190 interrupts = <0 92 0x04>; 195 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
191 #address-cells = <1>; 196 #address-cells = <1>;
192 #size-cells = <0>; 197 #size-cells = <0>;
193 clocks = <&tegra_car 67>; 198 clocks = <&tegra_car TEGRA114_CLK_I2C3>;
194 clock-names = "div-clk"; 199 clock-names = "div-clk";
195 status = "disabled"; 200 status = "disabled";
196 }; 201 };
@@ -198,10 +203,10 @@
198 i2c@7000c700 { 203 i2c@7000c700 {
199 compatible = "nvidia,tegra114-i2c"; 204 compatible = "nvidia,tegra114-i2c";
200 reg = <0x7000c700 0x100>; 205 reg = <0x7000c700 0x100>;
201 interrupts = <0 120 0x04>; 206 interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
202 #address-cells = <1>; 207 #address-cells = <1>;
203 #size-cells = <0>; 208 #size-cells = <0>;
204 clocks = <&tegra_car 103>; 209 clocks = <&tegra_car TEGRA114_CLK_I2C4>;
205 clock-names = "div-clk"; 210 clock-names = "div-clk";
206 status = "disabled"; 211 status = "disabled";
207 }; 212 };
@@ -209,10 +214,10 @@
209 i2c@7000d000 { 214 i2c@7000d000 {
210 compatible = "nvidia,tegra114-i2c"; 215 compatible = "nvidia,tegra114-i2c";
211 reg = <0x7000d000 0x100>; 216 reg = <0x7000d000 0x100>;
212 interrupts = <0 53 0x04>; 217 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
213 #address-cells = <1>; 218 #address-cells = <1>;
214 #size-cells = <0>; 219 #size-cells = <0>;
215 clocks = <&tegra_car 47>; 220 clocks = <&tegra_car TEGRA114_CLK_I2C5>;
216 clock-names = "div-clk"; 221 clock-names = "div-clk";
217 status = "disabled"; 222 status = "disabled";
218 }; 223 };
@@ -220,11 +225,11 @@
220 spi@7000d400 { 225 spi@7000d400 {
221 compatible = "nvidia,tegra114-spi"; 226 compatible = "nvidia,tegra114-spi";
222 reg = <0x7000d400 0x200>; 227 reg = <0x7000d400 0x200>;
223 interrupts = <0 59 0x04>; 228 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
224 nvidia,dma-request-selector = <&apbdma 15>; 229 nvidia,dma-request-selector = <&apbdma 15>;
225 #address-cells = <1>; 230 #address-cells = <1>;
226 #size-cells = <0>; 231 #size-cells = <0>;
227 clocks = <&tegra_car 41>; 232 clocks = <&tegra_car TEGRA114_CLK_SBC1>;
228 clock-names = "spi"; 233 clock-names = "spi";
229 status = "disabled"; 234 status = "disabled";
230 }; 235 };
@@ -232,11 +237,11 @@
232 spi@7000d600 { 237 spi@7000d600 {
233 compatible = "nvidia,tegra114-spi"; 238 compatible = "nvidia,tegra114-spi";
234 reg = <0x7000d600 0x200>; 239 reg = <0x7000d600 0x200>;
235 interrupts = <0 82 0x04>; 240 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
236 nvidia,dma-request-selector = <&apbdma 16>; 241 nvidia,dma-request-selector = <&apbdma 16>;
237 #address-cells = <1>; 242 #address-cells = <1>;
238 #size-cells = <0>; 243 #size-cells = <0>;
239 clocks = <&tegra_car 44>; 244 clocks = <&tegra_car TEGRA114_CLK_SBC2>;
240 clock-names = "spi"; 245 clock-names = "spi";
241 status = "disabled"; 246 status = "disabled";
242 }; 247 };
@@ -244,11 +249,11 @@
244 spi@7000d800 { 249 spi@7000d800 {
245 compatible = "nvidia,tegra114-spi"; 250 compatible = "nvidia,tegra114-spi";
246 reg = <0x7000d800 0x200>; 251 reg = <0x7000d800 0x200>;
247 interrupts = <0 83 0x04>; 252 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
248 nvidia,dma-request-selector = <&apbdma 17>; 253 nvidia,dma-request-selector = <&apbdma 17>;
249 #address-cells = <1>; 254 #address-cells = <1>;
250 #size-cells = <0>; 255 #size-cells = <0>;
251 clocks = <&tegra_car 46>; 256 clocks = <&tegra_car TEGRA114_CLK_SBC3>;
252 clock-names = "spi"; 257 clock-names = "spi";
253 status = "disabled"; 258 status = "disabled";
254 }; 259 };
@@ -256,11 +261,11 @@
256 spi@7000da00 { 261 spi@7000da00 {
257 compatible = "nvidia,tegra114-spi"; 262 compatible = "nvidia,tegra114-spi";
258 reg = <0x7000da00 0x200>; 263 reg = <0x7000da00 0x200>;
259 interrupts = <0 93 0x04>; 264 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
260 nvidia,dma-request-selector = <&apbdma 18>; 265 nvidia,dma-request-selector = <&apbdma 18>;
261 #address-cells = <1>; 266 #address-cells = <1>;
262 #size-cells = <0>; 267 #size-cells = <0>;
263 clocks = <&tegra_car 68>; 268 clocks = <&tegra_car TEGRA114_CLK_SBC4>;
264 clock-names = "spi"; 269 clock-names = "spi";
265 status = "disabled"; 270 status = "disabled";
266 }; 271 };
@@ -268,11 +273,11 @@
268 spi@7000dc00 { 273 spi@7000dc00 {
269 compatible = "nvidia,tegra114-spi"; 274 compatible = "nvidia,tegra114-spi";
270 reg = <0x7000dc00 0x200>; 275 reg = <0x7000dc00 0x200>;
271 interrupts = <0 94 0x04>; 276 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
272 nvidia,dma-request-selector = <&apbdma 27>; 277 nvidia,dma-request-selector = <&apbdma 27>;
273 #address-cells = <1>; 278 #address-cells = <1>;
274 #size-cells = <0>; 279 #size-cells = <0>;
275 clocks = <&tegra_car 104>; 280 clocks = <&tegra_car TEGRA114_CLK_SBC5>;
276 clock-names = "spi"; 281 clock-names = "spi";
277 status = "disabled"; 282 status = "disabled";
278 }; 283 };
@@ -280,11 +285,11 @@
280 spi@7000de00 { 285 spi@7000de00 {
281 compatible = "nvidia,tegra114-spi"; 286 compatible = "nvidia,tegra114-spi";
282 reg = <0x7000de00 0x200>; 287 reg = <0x7000de00 0x200>;
283 interrupts = <0 79 0x04>; 288 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
284 nvidia,dma-request-selector = <&apbdma 28>; 289 nvidia,dma-request-selector = <&apbdma 28>;
285 #address-cells = <1>; 290 #address-cells = <1>;
286 #size-cells = <0>; 291 #size-cells = <0>;
287 clocks = <&tegra_car 105>; 292 clocks = <&tegra_car TEGRA114_CLK_SBC6>;
288 clock-names = "spi"; 293 clock-names = "spi";
289 status = "disabled"; 294 status = "disabled";
290 }; 295 };
@@ -292,22 +297,22 @@
292 rtc { 297 rtc {
293 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; 298 compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc";
294 reg = <0x7000e000 0x100>; 299 reg = <0x7000e000 0x100>;
295 interrupts = <0 2 0x04>; 300 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
296 clocks = <&tegra_car 4>; 301 clocks = <&tegra_car TEGRA114_CLK_RTC>;
297 }; 302 };
298 303
299 kbc { 304 kbc {
300 compatible = "nvidia,tegra114-kbc"; 305 compatible = "nvidia,tegra114-kbc";
301 reg = <0x7000e200 0x100>; 306 reg = <0x7000e200 0x100>;
302 interrupts = <0 85 0x04>; 307 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
303 clocks = <&tegra_car 36>; 308 clocks = <&tegra_car TEGRA114_CLK_KBC>;
304 status = "disabled"; 309 status = "disabled";
305 }; 310 };
306 311
307 pmc { 312 pmc {
308 compatible = "nvidia,tegra114-pmc"; 313 compatible = "nvidia,tegra114-pmc";
309 reg = <0x7000e400 0x400>; 314 reg = <0x7000e400 0x400>;
310 clocks = <&tegra_car 261>, <&clk32k_in>; 315 clocks = <&tegra_car TEGRA114_CLK_PCLK>, <&clk32k_in>;
311 clock-names = "pclk", "clk32k_in"; 316 clock-names = "pclk", "clk32k_in";
312 }; 317 };
313 318
@@ -322,35 +327,106 @@
322 nvidia,ahb = <&ahb>; 327 nvidia,ahb = <&ahb>;
323 }; 328 };
324 329
330 ahub {
331 compatible = "nvidia,tegra114-ahub";
332 reg = <0x70080000 0x200>,
333 <0x70080200 0x100>,
334 <0x70081000 0x200>;
335 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
336 nvidia,dma-request-selector = <&apbdma 1>, <&apbdma 2>,
337 <&apbdma 3>, <&apbdma 4>, <&apbdma 6>, <&apbdma 7>,
338 <&apbdma 12>, <&apbdma 13>, <&apbdma 14>,
339 <&apbdma 29>;
340 clocks = <&tegra_car TEGRA114_CLK_D_AUDIO>,
341 <&tegra_car TEGRA114_CLK_APBIF>,
342 <&tegra_car TEGRA114_CLK_I2S0>,
343 <&tegra_car TEGRA114_CLK_I2S1>,
344 <&tegra_car TEGRA114_CLK_I2S2>,
345 <&tegra_car TEGRA114_CLK_I2S3>,
346 <&tegra_car TEGRA114_CLK_I2S4>,
347 <&tegra_car TEGRA114_CLK_DAM0>,
348 <&tegra_car TEGRA114_CLK_DAM1>,
349 <&tegra_car TEGRA114_CLK_DAM2>,
350 <&tegra_car TEGRA114_CLK_SPDIF_IN>,
351 <&tegra_car TEGRA114_CLK_AMX>,
352 <&tegra_car TEGRA114_CLK_ADX>;
353 clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
354 "i2s3", "i2s4", "dam0", "dam1", "dam2",
355 "spdif_in", "amx", "adx";
356 ranges;
357 #address-cells = <1>;
358 #size-cells = <1>;
359
360 tegra_i2s0: i2s@70080300 {
361 compatible = "nvidia,tegra114-i2s", "nvidia,tegra30-i2s";
362 reg = <0x70080300 0x100>;
363 nvidia,ahub-cif-ids = <4 4>;
364 clocks = <&tegra_car TEGRA114_CLK_I2S0>;
365 status = "disabled";
366 };
367
368 tegra_i2s1: i2s@70080400 {
369 compatible = "nvidia,tegra114-i2s", "nvidia,tegra30-i2s";
370 reg = <0x70080400 0x100>;
371 nvidia,ahub-cif-ids = <5 5>;
372 clocks = <&tegra_car TEGRA114_CLK_I2S1>;
373 status = "disabled";
374 };
375
376 tegra_i2s2: i2s@70080500 {
377 compatible = "nvidia,tegra114-i2s", "nvidia,tegra30-i2s";
378 reg = <0x70080500 0x100>;
379 nvidia,ahub-cif-ids = <6 6>;
380 clocks = <&tegra_car TEGRA114_CLK_I2S2>;
381 status = "disabled";
382 };
383
384 tegra_i2s3: i2s@70080600 {
385 compatible = "nvidia,tegra114-i2s", "nvidia,tegra30-i2s";
386 reg = <0x70080600 0x100>;
387 nvidia,ahub-cif-ids = <7 7>;
388 clocks = <&tegra_car TEGRA114_CLK_I2S3>;
389 status = "disabled";
390 };
391
392 tegra_i2s4: i2s@70080700 {
393 compatible = "nvidia,tegra114-i2s", "nvidia,tegra30-i2s";
394 reg = <0x70080700 0x100>;
395 nvidia,ahub-cif-ids = <8 8>;
396 clocks = <&tegra_car TEGRA114_CLK_I2S4>;
397 status = "disabled";
398 };
399 };
400
325 sdhci@78000000 { 401 sdhci@78000000 {
326 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; 402 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci";
327 reg = <0x78000000 0x200>; 403 reg = <0x78000000 0x200>;
328 interrupts = <0 14 0x04>; 404 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
329 clocks = <&tegra_car 14>; 405 clocks = <&tegra_car TEGRA114_CLK_SDMMC1>;
330 status = "disable"; 406 status = "disable";
331 }; 407 };
332 408
333 sdhci@78000200 { 409 sdhci@78000200 {
334 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; 410 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci";
335 reg = <0x78000200 0x200>; 411 reg = <0x78000200 0x200>;
336 interrupts = <0 15 0x04>; 412 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
337 clocks = <&tegra_car 9>; 413 clocks = <&tegra_car TEGRA114_CLK_SDMMC2>;
338 status = "disable"; 414 status = "disable";
339 }; 415 };
340 416
341 sdhci@78000400 { 417 sdhci@78000400 {
342 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; 418 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci";
343 reg = <0x78000400 0x200>; 419 reg = <0x78000400 0x200>;
344 interrupts = <0 19 0x04>; 420 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
345 clocks = <&tegra_car 69>; 421 clocks = <&tegra_car TEGRA114_CLK_SDMMC3>;
346 status = "disable"; 422 status = "disable";
347 }; 423 };
348 424
349 sdhci@78000600 { 425 sdhci@78000600 {
350 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; 426 compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci";
351 reg = <0x78000600 0x200>; 427 reg = <0x78000600 0x200>;
352 interrupts = <0 31 0x04>; 428 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
353 clocks = <&tegra_car 15>; 429 clocks = <&tegra_car TEGRA114_CLK_SDMMC4>;
354 status = "disable"; 430 status = "disable";
355 }; 431 };
356 432
@@ -385,9 +461,14 @@
385 461
386 timer { 462 timer {
387 compatible = "arm,armv7-timer"; 463 compatible = "arm,armv7-timer";
388 interrupts = <1 13 0xf08>, 464 interrupts =
389 <1 14 0xf08>, 465 <GIC_PPI 13
390 <1 11 0xf08>, 466 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
391 <1 10 0xf08>; 467 <GIC_PPI 14
468 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
469 <GIC_PPI 11
470 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
471 <GIC_PPI 10
472 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
392 }; 473 };
393}; 474};
diff --git a/arch/arm/boot/dts/tegra20-colibri-512.dtsi b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
index a573b94b7c93..2fcb3f2ca160 100644
--- a/arch/arm/boot/dts/tegra20-colibri-512.dtsi
+++ b/arch/arm/boot/dts/tegra20-colibri-512.dtsi
@@ -1,4 +1,4 @@
1/include/ "tegra20.dtsi" 1#include "tegra20.dtsi"
2 2
3/ { 3/ {
4 model = "Toradex Colibri T20 512MB"; 4 model = "Toradex Colibri T20 512MB";
@@ -14,7 +14,8 @@
14 pll-supply = <&hdmi_pll_reg>; 14 pll-supply = <&hdmi_pll_reg>;
15 15
16 nvidia,ddc-i2c-bus = <&i2c_ddc>; 16 nvidia,ddc-i2c-bus = <&i2c_ddc>;
17 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 17 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
18 GPIO_ACTIVE_HIGH>;
18 }; 19 };
19 }; 20 };
20 21
@@ -217,7 +218,7 @@
217 pmic: tps6586x@34 { 218 pmic: tps6586x@34 {
218 compatible = "ti,tps6586x"; 219 compatible = "ti,tps6586x";
219 reg = <0x34>; 220 reg = <0x34>;
220 interrupts = <0 86 0x4>; 221 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
221 222
222 ti,system-power-controller; 223 ti,system-power-controller;
223 224
@@ -443,17 +444,25 @@
443 444
444 ac97: ac97 { 445 ac97: ac97 {
445 status = "okay"; 446 status = "okay";
446 nvidia,codec-reset-gpio = <&gpio 168 0>; /* gpio PV0 */ 447 nvidia,codec-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
447 nvidia,codec-sync-gpio = <&gpio 120 0>; /* gpio PP0 */ 448 GPIO_ACTIVE_HIGH>;
449 nvidia,codec-sync-gpio = <&gpio TEGRA_GPIO(P, 0)
450 GPIO_ACTIVE_HIGH>;
448 }; 451 };
449 452
450 usb@c5004000 { 453 usb@c5004000 {
451 status = "okay"; 454 status = "okay";
452 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 455 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
456 GPIO_ACTIVE_LOW>;
457 };
458
459 usb-phy@c5004000 {
460 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
461 GPIO_ACTIVE_LOW>;
453 }; 462 };
454 463
455 sdhci@c8000600 { 464 sdhci@c8000600 {
456 cd-gpios = <&gpio 23 1>; /* gpio PC7 */ 465 cd-gpios = <&gpio TEGRA_GPIO(C, 7) GPIO_ACTIVE_LOW>;
457 }; 466 };
458 467
459 clocks { 468 clocks {
@@ -483,7 +492,9 @@
483 492
484 nvidia,ac97-controller = <&ac97>; 493 nvidia,ac97-controller = <&ac97>;
485 494
486 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 495 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
496 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
497 <&tegra_car TEGRA20_CLK_CDEV1>;
487 clock-names = "pll_a", "pll_a_out0", "mclk"; 498 clock-names = "pll_a", "pll_a_out0", "mclk";
488 }; 499 };
489 500
@@ -510,7 +521,7 @@
510 enable-active-high; 521 enable-active-high;
511 regulator-boot-on; 522 regulator-boot-on;
512 regulator-always-on; 523 regulator-always-on;
513 gpio = <&gpio 217 0>; 524 gpio = <&gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>;
514 }; 525 };
515 }; 526 };
516}; 527};
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index e7d5de4e00b9..d9f89cd879a7 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20.dtsi" 3#include "tegra20.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Tegra20 Harmony evaluation board"; 6 model = "NVIDIA Tegra20 Harmony evaluation board";
@@ -18,7 +18,8 @@
18 pll-supply = <&hdmi_pll_reg>; 18 pll-supply = <&hdmi_pll_reg>;
19 19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 21 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
22 GPIO_ACTIVE_HIGH>;
22 }; 23 };
23 }; 24 };
24 25
@@ -262,7 +263,7 @@
262 compatible = "wlf,wm8903"; 263 compatible = "wlf,wm8903";
263 reg = <0x1a>; 264 reg = <0x1a>;
264 interrupt-parent = <&gpio>; 265 interrupt-parent = <&gpio>;
265 interrupts = <187 0x04>; 266 interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_LEVEL_HIGH>;
266 267
267 gpio-controller; 268 gpio-controller;
268 #gpio-cells = <2>; 269 #gpio-cells = <2>;
@@ -290,7 +291,7 @@
290 pmic: tps6586x@34 { 291 pmic: tps6586x@34 {
291 compatible = "ti,tps6586x"; 292 compatible = "ti,tps6586x";
292 reg = <0x34>; 293 reg = <0x34>;
293 interrupts = <0 86 0x4>; 294 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
294 295
295 ti,system-power-controller; 296 ti,system-power-controller;
296 297
@@ -428,32 +429,43 @@
428 status = "okay"; 429 status = "okay";
429 }; 430 };
430 431
432 usb-phy@c5000000 {
433 status = "okay";
434 };
435
431 usb@c5004000 { 436 usb@c5004000 {
432 status = "okay"; 437 status = "okay";
433 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 438 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
439 GPIO_ACTIVE_LOW>;
440 };
441
442 usb-phy@c5004000 {
443 status = "okay";
444 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
445 GPIO_ACTIVE_LOW>;
434 }; 446 };
435 447
436 usb@c5008000 { 448 usb@c5008000 {
437 status = "okay"; 449 status = "okay";
438 }; 450 };
439 451
440 usb-phy@c5004400 { 452 usb-phy@c5008000 {
441 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 453 status = "okay";
442 }; 454 };
443 455
444 sdhci@c8000200 { 456 sdhci@c8000200 {
445 status = "okay"; 457 status = "okay";
446 cd-gpios = <&gpio 69 1>; /* gpio PI5 */ 458 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
447 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 459 wp-gpios = <&gpio TEGRA_GPIO(H, 1) GPIO_ACTIVE_HIGH>;
448 power-gpios = <&gpio 155 0>; /* gpio PT3 */ 460 power-gpios = <&gpio TEGRA_GPIO(T, 3) GPIO_ACTIVE_HIGH>;
449 bus-width = <4>; 461 bus-width = <4>;
450 }; 462 };
451 463
452 sdhci@c8000600 { 464 sdhci@c8000600 {
453 status = "okay"; 465 status = "okay";
454 cd-gpios = <&gpio 58 1>; /* gpio PH2 */ 466 cd-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_LOW>;
455 wp-gpios = <&gpio 59 0>; /* gpio PH3 */ 467 wp-gpios = <&gpio TEGRA_GPIO(H, 3) GPIO_ACTIVE_HIGH>;
456 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 468 power-gpios = <&gpio TEGRA_GPIO(I, 6) GPIO_ACTIVE_HIGH>;
457 bus-width = <8>; 469 bus-width = <8>;
458 }; 470 };
459 471
@@ -475,7 +487,7 @@
475 487
476 power { 488 power {
477 label = "Power"; 489 label = "Power";
478 gpios = <&gpio 170 1>; /* gpio PV2, active low */ 490 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
479 linux,code = <116>; /* KEY_POWER */ 491 linux,code = <116>; /* KEY_POWER */
480 gpio-key,wakeup; 492 gpio-key,wakeup;
481 }; 493 };
@@ -618,7 +630,7 @@
618 regulator-name = "vdd_1v5"; 630 regulator-name = "vdd_1v5";
619 regulator-min-microvolt = <1500000>; 631 regulator-min-microvolt = <1500000>;
620 regulator-max-microvolt = <1500000>; 632 regulator-max-microvolt = <1500000>;
621 gpio = <&pmic 0 0>; 633 gpio = <&pmic 0 GPIO_ACTIVE_HIGH>;
622 }; 634 };
623 635
624 regulator@2 { 636 regulator@2 {
@@ -627,7 +639,7 @@
627 regulator-name = "vdd_1v2"; 639 regulator-name = "vdd_1v2";
628 regulator-min-microvolt = <1200000>; 640 regulator-min-microvolt = <1200000>;
629 regulator-max-microvolt = <1200000>; 641 regulator-max-microvolt = <1200000>;
630 gpio = <&pmic 1 0>; 642 gpio = <&pmic 1 GPIO_ACTIVE_HIGH>;
631 enable-active-high; 643 enable-active-high;
632 }; 644 };
633 645
@@ -637,7 +649,7 @@
637 regulator-name = "vdd_1v05"; 649 regulator-name = "vdd_1v05";
638 regulator-min-microvolt = <1050000>; 650 regulator-min-microvolt = <1050000>;
639 regulator-max-microvolt = <1050000>; 651 regulator-max-microvolt = <1050000>;
640 gpio = <&pmic 2 0>; 652 gpio = <&pmic 2 GPIO_ACTIVE_HIGH>;
641 enable-active-high; 653 enable-active-high;
642 /* Hack until board-harmony-pcie.c is removed */ 654 /* Hack until board-harmony-pcie.c is removed */
643 status = "disabled"; 655 status = "disabled";
@@ -649,7 +661,7 @@
649 regulator-name = "vdd_pnl"; 661 regulator-name = "vdd_pnl";
650 regulator-min-microvolt = <2800000>; 662 regulator-min-microvolt = <2800000>;
651 regulator-max-microvolt = <2800000>; 663 regulator-max-microvolt = <2800000>;
652 gpio = <&gpio 22 0>; /* gpio PC6 */ 664 gpio = <&gpio TEGRA_GPIO(C, 6) GPIO_ACTIVE_HIGH>;
653 enable-active-high; 665 enable-active-high;
654 }; 666 };
655 667
@@ -659,7 +671,7 @@
659 regulator-name = "vdd_bl"; 671 regulator-name = "vdd_bl";
660 regulator-min-microvolt = <2800000>; 672 regulator-min-microvolt = <2800000>;
661 regulator-max-microvolt = <2800000>; 673 regulator-max-microvolt = <2800000>;
662 gpio = <&gpio 176 0>; /* gpio PW0 */ 674 gpio = <&gpio TEGRA_GPIO(W, 0) GPIO_ACTIVE_HIGH>;
663 enable-active-high; 675 enable-active-high;
664 }; 676 };
665 }; 677 };
@@ -682,12 +694,17 @@
682 nvidia,i2s-controller = <&tegra_i2s1>; 694 nvidia,i2s-controller = <&tegra_i2s1>;
683 nvidia,audio-codec = <&wm8903>; 695 nvidia,audio-codec = <&wm8903>;
684 696
685 nvidia,spkr-en-gpios = <&wm8903 2 0>; 697 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
686 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 698 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2)
687 nvidia,int-mic-en-gpios = <&gpio 184 0>; /*gpio PX0 */ 699 GPIO_ACTIVE_HIGH>;
688 nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ 700 nvidia,int-mic-en-gpios = <&gpio TEGRA_GPIO(X, 0)
689 701 GPIO_ACTIVE_HIGH>;
690 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 702 nvidia,ext-mic-en-gpios = <&gpio TEGRA_GPIO(X, 1)
703 GPIO_ACTIVE_HIGH>;
704
705 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
706 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
707 <&tegra_car TEGRA20_CLK_CDEV1>;
691 clock-names = "pll_a", "pll_a_out0", "mclk"; 708 clock-names = "pll_a", "pll_a_out0", "mclk";
692 }; 709 };
693}; 710};
diff --git a/arch/arm/boot/dts/tegra20-iris-512.dts b/arch/arm/boot/dts/tegra20-iris-512.dts
index 52f1103907d7..f2222bd74eab 100644
--- a/arch/arm/boot/dts/tegra20-iris-512.dts
+++ b/arch/arm/boot/dts/tegra20-iris-512.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20-colibri-512.dtsi" 3#include "tegra20-colibri-512.dtsi"
4 4
5/ { 5/ {
6 model = "Toradex Colibri T20 512MB on Iris"; 6 model = "Toradex Colibri T20 512MB on Iris";
@@ -38,13 +38,20 @@
38 38
39 usb@c5000000 { 39 usb@c5000000 {
40 status = "okay"; 40 status = "okay";
41 dr_mode = "otg"; 41 };
42
43 usb-phy@c5000000 {
44 status = "okay";
42 }; 45 };
43 46
44 usb@c5008000 { 47 usb@c5008000 {
45 status = "okay"; 48 status = "okay";
46 }; 49 };
47 50
51 usb-phy@c5008000 {
52 status = "okay";
53 };
54
48 serial@70006000 { 55 serial@70006000 {
49 status = "okay"; 56 status = "okay";
50 }; 57 };
@@ -73,7 +80,7 @@
73 regulator-max-microvolt = <5000000>; 80 regulator-max-microvolt = <5000000>;
74 regulator-boot-on; 81 regulator-boot-on;
75 regulator-always-on; 82 regulator-always-on;
76 gpio = <&gpio 178 0>; 83 gpio = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
77 }; 84 };
78 85
79 vcc_sd_reg: regulator@1 { 86 vcc_sd_reg: regulator@1 {
diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts
index ace23437da89..7580578903cf 100644
--- a/arch/arm/boot/dts/tegra20-medcom-wide.dts
+++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20-tamonten.dtsi" 3#include "tegra20-tamonten.dtsi"
4 4
5/ { 5/ {
6 model = "Avionic Design Medcom-Wide board"; 6 model = "Avionic Design Medcom-Wide board";
@@ -15,7 +15,7 @@
15 compatible = "wlf,wm8903"; 15 compatible = "wlf,wm8903";
16 reg = <0x1a>; 16 reg = <0x1a>;
17 interrupt-parent = <&gpio>; 17 interrupt-parent = <&gpio>;
18 interrupts = <187 0x04>; 18 interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_LEVEL_HIGH>;
19 19
20 gpio-controller; 20 gpio-controller;
21 #gpio-cells = <2>; 21 #gpio-cells = <2>;
@@ -56,10 +56,12 @@
56 nvidia,i2s-controller = <&tegra_i2s1>; 56 nvidia,i2s-controller = <&tegra_i2s1>;
57 nvidia,audio-codec = <&wm8903>; 57 nvidia,audio-codec = <&wm8903>;
58 58
59 nvidia,spkr-en-gpios = <&wm8903 2 0>; 59 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
60 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 60 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
61 61
62 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 62 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
63 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
64 <&tegra_car TEGRA20_CLK_CDEV1>;
63 clock-names = "pll_a", "pll_a_out0", "mclk"; 65 clock-names = "pll_a", "pll_a_out0", "mclk";
64 }; 66 };
65}; 67};
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index e3e0c9977df4..cfd12763b1b2 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20.dtsi" 3#include "tegra20.dtsi"
4 4
5/ { 5/ {
6 model = "Toshiba AC100 / Dynabook AZ"; 6 model = "Toshiba AC100 / Dynabook AZ";
@@ -18,7 +18,8 @@
18 pll-supply = <&hdmi_pll_reg>; 18 pll-supply = <&hdmi_pll_reg>;
19 19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 21 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
22 GPIO_ACTIVE_HIGH>;
22 }; 23 };
23 }; 24 };
24 25
@@ -270,13 +271,14 @@
270 nvec { 271 nvec {
271 compatible = "nvidia,nvec"; 272 compatible = "nvidia,nvec";
272 reg = <0x7000c500 0x100>; 273 reg = <0x7000c500 0x100>;
273 interrupts = <0 92 0x04>; 274 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
274 #address-cells = <1>; 275 #address-cells = <1>;
275 #size-cells = <0>; 276 #size-cells = <0>;
276 clock-frequency = <80000>; 277 clock-frequency = <80000>;
277 request-gpios = <&gpio 170 0>; /* gpio PV2 */ 278 request-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
278 slave-addr = <138>; 279 slave-addr = <138>;
279 clocks = <&tegra_car 67>, <&tegra_car 124>; 280 clocks = <&tegra_car TEGRA20_CLK_I2C3>,
281 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
280 clock-names = "div-clk", "fast-clk"; 282 clock-names = "div-clk", "fast-clk";
281 }; 283 };
282 284
@@ -287,7 +289,7 @@
287 pmic: tps6586x@34 { 289 pmic: tps6586x@34 {
288 compatible = "ti,tps6586x"; 290 compatible = "ti,tps6586x";
289 reg = <0x34>; 291 reg = <0x34>;
290 interrupts = <0 86 0x4>; 292 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
291 293
292 #gpio-cells = <2>; 294 #gpio-cells = <2>;
293 gpio-controller; 295 gpio-controller;
@@ -427,24 +429,35 @@
427 status = "okay"; 429 status = "okay";
428 }; 430 };
429 431
432 usb-phy@c5000000 {
433 status = "okay";
434 };
435
430 usb@c5004000 { 436 usb@c5004000 {
431 status = "okay"; 437 status = "okay";
432 nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */ 438 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
439 GPIO_ACTIVE_LOW>;
440 };
441
442 usb-phy@c5004000 {
443 status = "okay";
444 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
445 GPIO_ACTIVE_LOW>;
433 }; 446 };
434 447
435 usb@c5008000 { 448 usb@c5008000 {
436 status = "okay"; 449 status = "okay";
437 }; 450 };
438 451
439 usb-phy@c5004400 { 452 usb-phy@c5008000 {
440 nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */ 453 status = "okay";
441 }; 454 };
442 455
443 sdhci@c8000000 { 456 sdhci@c8000000 {
444 status = "okay"; 457 status = "okay";
445 cd-gpios = <&gpio 173 1>; /* gpio PV5 */ 458 cd-gpios = <&gpio TEGRA_GPIO(V, 5) GPIO_ACTIVE_LOW>;
446 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 459 wp-gpios = <&gpio TEGRA_GPIO(H, 1) GPIO_ACTIVE_HIGH>;
447 power-gpios = <&gpio 169 0>; /* gpio PV1 */ 460 power-gpios = <&gpio TEGRA_GPIO(V, 1) GPIO_ACTIVE_HIGH>;
448 bus-width = <4>; 461 bus-width = <4>;
449 }; 462 };
450 463
@@ -472,7 +485,7 @@
472 485
473 power { 486 power {
474 label = "Power"; 487 label = "Power";
475 gpios = <&gpio 79 1>; /* gpio PJ7, active low */ 488 gpios = <&gpio TEGRA_GPIO(J, 7) GPIO_ACTIVE_LOW>;
476 linux,code = <116>; /* KEY_POWER */ 489 linux,code = <116>; /* KEY_POWER */
477 gpio-key,wakeup; 490 gpio-key,wakeup;
478 }; 491 };
@@ -483,7 +496,7 @@
483 496
484 wifi { 497 wifi {
485 label = "wifi-led"; 498 label = "wifi-led";
486 gpios = <&gpio 24 0>; /* gpio PD0 */ 499 gpios = <&gpio TEGRA_GPIO(D, 0) GPIO_ACTIVE_HIGH>;
487 linux,default-trigger = "rfkill0"; 500 linux,default-trigger = "rfkill0";
488 }; 501 };
489 }; 502 };
@@ -520,9 +533,12 @@
520 533
521 nvidia,audio-codec = <&alc5632>; 534 nvidia,audio-codec = <&alc5632>;
522 nvidia,i2s-controller = <&tegra_i2s1>; 535 nvidia,i2s-controller = <&tegra_i2s1>;
523 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 536 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2)
537 GPIO_ACTIVE_HIGH>;
524 538
525 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 539 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
540 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
541 <&tegra_car TEGRA20_CLK_CDEV1>;
526 clock-names = "pll_a", "pll_a_out0", "mclk"; 542 clock-names = "pll_a", "pll_a_out0", "mclk";
527 }; 543 };
528}; 544};
diff --git a/arch/arm/boot/dts/tegra20-plutux.dts b/arch/arm/boot/dts/tegra20-plutux.dts
index 1a17cc30bb9d..d7a358a6a647 100644
--- a/arch/arm/boot/dts/tegra20-plutux.dts
+++ b/arch/arm/boot/dts/tegra20-plutux.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20-tamonten.dtsi" 3#include "tegra20-tamonten.dtsi"
4 4
5/ { 5/ {
6 model = "Avionic Design Plutux board"; 6 model = "Avionic Design Plutux board";
@@ -17,7 +17,7 @@
17 compatible = "wlf,wm8903"; 17 compatible = "wlf,wm8903";
18 reg = <0x1a>; 18 reg = <0x1a>;
19 interrupt-parent = <&gpio>; 19 interrupt-parent = <&gpio>;
20 interrupts = <187 0x04>; 20 interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_LEVEL_HIGH>;
21 21
22 gpio-controller; 22 gpio-controller;
23 #gpio-cells = <2>; 23 #gpio-cells = <2>;
@@ -50,10 +50,12 @@
50 nvidia,i2s-controller = <&tegra_i2s1>; 50 nvidia,i2s-controller = <&tegra_i2s1>;
51 nvidia,audio-codec = <&wm8903>; 51 nvidia,audio-codec = <&wm8903>;
52 52
53 nvidia,spkr-en-gpios = <&wm8903 2 0>; 53 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
54 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 54 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
55 55
56 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 56 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
57 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
58 <&tegra_car TEGRA20_CLK_CDEV1>;
57 clock-names = "pll_a", "pll_a_out0", "mclk"; 59 clock-names = "pll_a", "pll_a_out0", "mclk";
58 }; 60 };
59}; 61};
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index cee4c34010fe..ab177b406b78 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20.dtsi" 3#include "tegra20.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Seaboard"; 6 model = "NVIDIA Seaboard";
@@ -18,7 +18,8 @@
18 pll-supply = <&hdmi_pll_reg>; 18 pll-supply = <&hdmi_pll_reg>;
19 19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 21 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
22 GPIO_ACTIVE_HIGH>;
22 }; 23 };
23 }; 24 };
24 25
@@ -313,7 +314,7 @@
313 compatible = "wlf,wm8903"; 314 compatible = "wlf,wm8903";
314 reg = <0x1a>; 315 reg = <0x1a>;
315 interrupt-parent = <&gpio>; 316 interrupt-parent = <&gpio>;
316 interrupts = <187 0x04>; 317 interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_LEVEL_HIGH>;
317 318
318 gpio-controller; 319 gpio-controller;
319 #gpio-cells = <2>; 320 #gpio-cells = <2>;
@@ -328,14 +329,14 @@
328 compatible = "isil,isl29018"; 329 compatible = "isil,isl29018";
329 reg = <0x44>; 330 reg = <0x44>;
330 interrupt-parent = <&gpio>; 331 interrupt-parent = <&gpio>;
331 interrupts = <202 0x04>; /* GPIO PZ2 */ 332 interrupts = <TEGRA_GPIO(Z, 2) IRQ_TYPE_LEVEL_HIGH>;
332 }; 333 };
333 334
334 gyrometer@68 { 335 gyrometer@68 {
335 compatible = "invn,mpu3050"; 336 compatible = "invn,mpu3050";
336 reg = <0x68>; 337 reg = <0x68>;
337 interrupt-parent = <&gpio>; 338 interrupt-parent = <&gpio>;
338 interrupts = <204 0x04>; /* gpio PZ4 */ 339 interrupts = <TEGRA_GPIO(Z, 4) IRQ_TYPE_LEVEL_HIGH>;
339 }; 340 };
340 }; 341 };
341 342
@@ -388,7 +389,7 @@
388 pmic: tps6586x@34 { 389 pmic: tps6586x@34 {
389 compatible = "ti,tps6586x"; 390 compatible = "ti,tps6586x";
390 reg = <0x34>; 391 reg = <0x34>;
391 interrupts = <0 86 0x4>; 392 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
392 393
393 ti,system-power-controller; 394 ti,system-power-controller;
394 395
@@ -511,7 +512,7 @@
511 compatible = "ak,ak8975"; 512 compatible = "ak,ak8975";
512 reg = <0xc>; 513 reg = <0xc>;
513 interrupt-parent = <&gpio>; 514 interrupt-parent = <&gpio>;
514 interrupts = <109 0x04>; /* gpio PN5 */ 515 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>;
515 }; 516 };
516 }; 517 };
517 518
@@ -565,35 +566,48 @@
565 566
566 usb@c5000000 { 567 usb@c5000000 {
567 status = "okay"; 568 status = "okay";
568 nvidia,vbus-gpio = <&gpio 24 0>; /* PD0 */ 569 nvidia,vbus-gpio = <&gpio TEGRA_GPIO(D, 0) GPIO_ACTIVE_HIGH>;
570 dr_mode = "otg";
571 };
572
573 usb-phy@c5000000 {
574 status = "okay";
575 vbus-supply = <&vbus_reg>;
569 dr_mode = "otg"; 576 dr_mode = "otg";
570 }; 577 };
571 578
572 usb@c5004000 { 579 usb@c5004000 {
573 status = "okay"; 580 status = "okay";
574 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 581 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
582 GPIO_ACTIVE_LOW>;
583 };
584
585 usb-phy@c5004000 {
586 status = "okay";
587 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
588 GPIO_ACTIVE_LOW>;
575 }; 589 };
576 590
577 usb@c5008000 { 591 usb@c5008000 {
578 status = "okay"; 592 status = "okay";
579 }; 593 };
580 594
581 usb-phy@c5004400 { 595 usb-phy@c5008000 {
582 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 596 status = "okay";
583 }; 597 };
584 598
585 sdhci@c8000000 { 599 sdhci@c8000000 {
586 status = "okay"; 600 status = "okay";
587 power-gpios = <&gpio 86 0>; /* gpio PK6 */ 601 power-gpios = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_HIGH>;
588 bus-width = <4>; 602 bus-width = <4>;
589 keep-power-in-suspend; 603 keep-power-in-suspend;
590 }; 604 };
591 605
592 sdhci@c8000400 { 606 sdhci@c8000400 {
593 status = "okay"; 607 status = "okay";
594 cd-gpios = <&gpio 69 1>; /* gpio PI5 */ 608 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
595 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 609 wp-gpios = <&gpio TEGRA_GPIO(H, 1) GPIO_ACTIVE_HIGH>;
596 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 610 power-gpios = <&gpio TEGRA_GPIO(I, 6) GPIO_ACTIVE_HIGH>;
597 bus-width = <4>; 611 bus-width = <4>;
598 }; 612 };
599 613
@@ -621,14 +635,14 @@
621 635
622 power { 636 power {
623 label = "Power"; 637 label = "Power";
624 gpios = <&gpio 170 1>; /* gpio PV2, active low */ 638 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
625 linux,code = <116>; /* KEY_POWER */ 639 linux,code = <116>; /* KEY_POWER */
626 gpio-key,wakeup; 640 gpio-key,wakeup;
627 }; 641 };
628 642
629 lid { 643 lid {
630 label = "Lid"; 644 label = "Lid";
631 gpios = <&gpio 23 0>; /* gpio PC7 */ 645 gpios = <&gpio TEGRA_GPIO(C, 7) GPIO_ACTIVE_HIGH>;
632 linux,input-type = <5>; /* EV_SW */ 646 linux,input-type = <5>; /* EV_SW */
633 linux,code = <0>; /* SW_LID */ 647 linux,code = <0>; /* SW_LID */
634 debounce-interval = <1>; 648 debounce-interval = <1>;
@@ -795,7 +809,7 @@
795 regulator-name = "vdd_1v5"; 809 regulator-name = "vdd_1v5";
796 regulator-min-microvolt = <1500000>; 810 regulator-min-microvolt = <1500000>;
797 regulator-max-microvolt = <1500000>; 811 regulator-max-microvolt = <1500000>;
798 gpio = <&pmic 0 0>; 812 gpio = <&pmic 0 GPIO_ACTIVE_HIGH>;
799 }; 813 };
800 814
801 regulator@2 { 815 regulator@2 {
@@ -804,9 +818,18 @@
804 regulator-name = "vdd_1v2"; 818 regulator-name = "vdd_1v2";
805 regulator-min-microvolt = <1200000>; 819 regulator-min-microvolt = <1200000>;
806 regulator-max-microvolt = <1200000>; 820 regulator-max-microvolt = <1200000>;
807 gpio = <&pmic 1 0>; 821 gpio = <&pmic 1 GPIO_ACTIVE_HIGH>;
808 enable-active-high; 822 enable-active-high;
809 }; 823 };
824
825 vbus_reg: regulator@3 {
826 compatible = "regulator-fixed";
827 reg = <3>;
828 regulator-name = "vdd_vbus_wup1";
829 regulator-min-microvolt = <5000000>;
830 regulator-max-microvolt = <5000000>;
831 gpio = <&gpio 24 0>; /* PD0 */
832 };
810 }; 833 };
811 834
812 sound { 835 sound {
@@ -827,10 +850,12 @@
827 nvidia,i2s-controller = <&tegra_i2s1>; 850 nvidia,i2s-controller = <&tegra_i2s1>;
828 nvidia,audio-codec = <&wm8903>; 851 nvidia,audio-codec = <&wm8903>;
829 852
830 nvidia,spkr-en-gpios = <&wm8903 2 0>; 853 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
831 nvidia,hp-det-gpios = <&gpio 185 0>; /* gpio PX1 */ 854 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(X, 1) GPIO_ACTIVE_HIGH>;
832 855
833 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 856 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
857 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
858 <&tegra_car TEGRA20_CLK_CDEV1>;
834 clock-names = "pll_a", "pll_a_out0", "mclk"; 859 clock-names = "pll_a", "pll_a_out0", "mclk";
835 }; 860 };
836}; 861};
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index 50b3ec16b93a..c54faae7cfb3 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -1,4 +1,4 @@
1/include/ "tegra20.dtsi" 1#include "tegra20.dtsi"
2 2
3/ { 3/ {
4 model = "Avionic Design Tamonten SOM"; 4 model = "Avionic Design Tamonten SOM";
@@ -14,7 +14,8 @@
14 pll-supply = <&hdmi_pll_reg>; 14 pll-supply = <&hdmi_pll_reg>;
15 15
16 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 16 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
17 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 17 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
18 GPIO_ACTIVE_HIGH>;
18 }; 19 };
19 }; 20 };
20 21
@@ -321,7 +322,7 @@
321 pmic: tps6586x@34 { 322 pmic: tps6586x@34 {
322 compatible = "ti,tps6586x"; 323 compatible = "ti,tps6586x";
323 reg = <0x34>; 324 reg = <0x34>;
324 interrupts = <0 86 0x4>; 325 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
325 326
326 ti,system-power-controller; 327 ti,system-power-controller;
327 328
@@ -470,9 +471,13 @@
470 status = "okay"; 471 status = "okay";
471 }; 472 };
472 473
474 usb-phy@c5008000 {
475 status = "okay";
476 };
477
473 sdhci@c8000600 { 478 sdhci@c8000600 {
474 cd-gpios = <&gpio 58 1>; /* gpio PH2 */ 479 cd-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_LOW>;
475 wp-gpios = <&gpio 59 0>; /* gpio PH3 */ 480 wp-gpios = <&gpio TEGRA_GPIO(H, 3) GPIO_ACTIVE_HIGH>;
476 bus-width = <4>; 481 bus-width = <4>;
477 status = "okay"; 482 status = "okay";
478 }; 483 };
diff --git a/arch/arm/boot/dts/tegra20-tec.dts b/arch/arm/boot/dts/tegra20-tec.dts
index 742f0b38d21d..c572c43751b1 100644
--- a/arch/arm/boot/dts/tegra20-tec.dts
+++ b/arch/arm/boot/dts/tegra20-tec.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20-tamonten.dtsi" 3#include "tegra20-tamonten.dtsi"
4 4
5/ { 5/ {
6 model = "Avionic Design Tamonten Evaluation Carrier"; 6 model = "Avionic Design Tamonten Evaluation Carrier";
@@ -17,7 +17,7 @@
17 compatible = "wlf,wm8903"; 17 compatible = "wlf,wm8903";
18 reg = <0x1a>; 18 reg = <0x1a>;
19 interrupt-parent = <&gpio>; 19 interrupt-parent = <&gpio>;
20 interrupts = <187 0x04>; 20 interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_LEVEL_HIGH>;
21 21
22 gpio-controller; 22 gpio-controller;
23 #gpio-cells = <2>; 23 #gpio-cells = <2>;
@@ -50,10 +50,13 @@
50 nvidia,i2s-controller = <&tegra_i2s1>; 50 nvidia,i2s-controller = <&tegra_i2s1>;
51 nvidia,audio-codec = <&wm8903>; 51 nvidia,audio-codec = <&wm8903>;
52 52
53 nvidia,spkr-en-gpios = <&wm8903 2 0>; 53 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
54 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 54 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2)
55 GPIO_ACTIVE_HIGH>;
55 56
56 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 57 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
58 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
59 <&tegra_car TEGRA20_CLK_CDEV1>;
57 clock-names = "pll_a", "pll_a_out0", "mclk"; 60 clock-names = "pll_a", "pll_a_out0", "mclk";
58 }; 61 };
59}; 62};
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 9cc78a15d739..170159910455 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20.dtsi" 3#include "tegra20.dtsi"
4 4
5/ { 5/ {
6 model = "Compulab TrimSlice board"; 6 model = "Compulab TrimSlice board";
@@ -18,7 +18,8 @@
18 pll-supply = <&hdmi_pll_reg>; 18 pll-supply = <&hdmi_pll_reg>;
19 19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 21 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
22 GPIO_ACTIVE_HIGH>;
22 }; 23 };
23 }; 24 };
24 25
@@ -311,20 +312,32 @@
311 312
312 usb@c5000000 { 313 usb@c5000000 {
313 status = "okay"; 314 status = "okay";
314 nvidia,vbus-gpio = <&gpio 170 0>; /* gpio PV2 */ 315 nvidia,vbus-gpio = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_HIGH>;
316 };
317
318 usb-phy@c5000000 {
319 status = "okay";
320 vbus-supply = <&vbus_reg>;
315 }; 321 };
316 322
317 usb@c5004000 { 323 usb@c5004000 {
318 status = "okay"; 324 status = "okay";
319 nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */ 325 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
326 GPIO_ACTIVE_LOW>;
327 };
328
329 usb-phy@c5004000 {
330 status = "okay";
331 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 0)
332 GPIO_ACTIVE_LOW>;
320 }; 333 };
321 334
322 usb@c5008000 { 335 usb@c5008000 {
323 status = "okay"; 336 status = "okay";
324 }; 337 };
325 338
326 usb-phy@c5004400 { 339 usb-phy@c5008000 {
327 nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */ 340 status = "okay";
328 }; 341 };
329 342
330 sdhci@c8000000 { 343 sdhci@c8000000 {
@@ -334,8 +347,8 @@
334 347
335 sdhci@c8000600 { 348 sdhci@c8000600 {
336 status = "okay"; 349 status = "okay";
337 cd-gpios = <&gpio 121 1>; /* gpio PP1 */ 350 cd-gpios = <&gpio TEGRA_GPIO(P, 1) GPIO_ACTIVE_LOW>;
338 wp-gpios = <&gpio 122 0>; /* gpio PP2 */ 351 wp-gpios = <&gpio TEGRA_GPIO(P, 2) GPIO_ACTIVE_HIGH>;
339 bus-width = <4>; 352 bus-width = <4>;
340 }; 353 };
341 354
@@ -357,7 +370,7 @@
357 370
358 power { 371 power {
359 label = "Power"; 372 label = "Power";
360 gpios = <&gpio 190 1>; /* gpio PX6, active low */ 373 gpios = <&gpio TEGRA_GPIO(X, 6) GPIO_ACTIVE_LOW>;
361 linux,code = <116>; /* KEY_POWER */ 374 linux,code = <116>; /* KEY_POWER */
362 gpio-key,wakeup; 375 gpio-key,wakeup;
363 }; 376 };
@@ -365,7 +378,7 @@
365 378
366 poweroff { 379 poweroff {
367 compatible = "gpio-poweroff"; 380 compatible = "gpio-poweroff";
368 gpios = <&gpio 191 1>; /* gpio PX7, active low */ 381 gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
369 }; 382 };
370 383
371 regulators { 384 regulators {
@@ -390,6 +403,15 @@
390 regulator-max-microvolt = <1800000>; 403 regulator-max-microvolt = <1800000>;
391 regulator-always-on; 404 regulator-always-on;
392 }; 405 };
406
407 vbus_reg: regulator@2 {
408 compatible = "regulator-fixed";
409 reg = <2>;
410 regulator-name = "usb1_vbus";
411 regulator-min-microvolt = <5000000>;
412 regulator-max-microvolt = <5000000>;
413 gpio = <&gpio 170 0>; /* PV2 */
414 };
393 }; 415 };
394 416
395 sound { 417 sound {
@@ -397,7 +419,9 @@
397 nvidia,i2s-controller = <&tegra_i2s1>; 419 nvidia,i2s-controller = <&tegra_i2s1>;
398 nvidia,audio-codec = <&codec>; 420 nvidia,audio-codec = <&codec>;
399 421
400 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 422 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
423 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
424 <&tegra_car TEGRA20_CLK_CDEV1>;
401 clock-names = "pll_a", "pll_a_out0", "mclk"; 425 clock-names = "pll_a", "pll_a_out0", "mclk";
402 }; 426 };
403}; 427};
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts
index dd38f1f03834..7f8c28d1121f 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20.dtsi" 3#include "tegra20.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Tegra20 Ventana evaluation board"; 6 model = "NVIDIA Tegra20 Ventana evaluation board";
@@ -18,7 +18,8 @@
18 pll-supply = <&hdmi_pll_reg>; 18 pll-supply = <&hdmi_pll_reg>;
19 19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 21 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
22 GPIO_ACTIVE_HIGH>;
22 }; 23 };
23 }; 24 };
24 25
@@ -310,7 +311,7 @@
310 compatible = "wlf,wm8903"; 311 compatible = "wlf,wm8903";
311 reg = <0x1a>; 312 reg = <0x1a>;
312 interrupt-parent = <&gpio>; 313 interrupt-parent = <&gpio>;
313 interrupts = <187 0x04>; 314 interrupts = <TEGRA_GPIO(X, 3) IRQ_TYPE_LEVEL_HIGH>;
314 315
315 gpio-controller; 316 gpio-controller;
316 #gpio-cells = <2>; 317 #gpio-cells = <2>;
@@ -325,7 +326,7 @@
325 compatible = "isil,isl29018"; 326 compatible = "isil,isl29018";
326 reg = <0x44>; 327 reg = <0x44>;
327 interrupt-parent = <&gpio>; 328 interrupt-parent = <&gpio>;
328 interrupts = <202 0x04>; /*gpio PZ2 */ 329 interrupts = <TEGRA_GPIO(Z, 2) IRQ_TYPE_LEVEL_HIGH>;
329 }; 330 };
330 }; 331 };
331 332
@@ -371,7 +372,7 @@
371 pmic: tps6586x@34 { 372 pmic: tps6586x@34 {
372 compatible = "ti,tps6586x"; 373 compatible = "ti,tps6586x";
373 reg = <0x34>; 374 reg = <0x34>;
374 interrupts = <0 86 0x4>; 375 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
375 376
376 ti,system-power-controller; 377 ti,system-power-controller;
377 378
@@ -505,31 +506,42 @@
505 status = "okay"; 506 status = "okay";
506 }; 507 };
507 508
509 usb-phy@c5000000 {
510 status = "okay";
511 };
512
508 usb@c5004000 { 513 usb@c5004000 {
509 status = "okay"; 514 status = "okay";
510 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 515 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
516 GPIO_ACTIVE_LOW>;
517 };
518
519 usb-phy@c5004000 {
520 status = "okay";
521 nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO(V, 1)
522 GPIO_ACTIVE_LOW>;
511 }; 523 };
512 524
513 usb@c5008000 { 525 usb@c5008000 {
514 status = "okay"; 526 status = "okay";
515 }; 527 };
516 528
517 usb-phy@c5004400 { 529 usb-phy@c5008000 {
518 nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */ 530 status = "okay";
519 }; 531 };
520 532
521 sdhci@c8000000 { 533 sdhci@c8000000 {
522 status = "okay"; 534 status = "okay";
523 power-gpios = <&gpio 86 0>; /* gpio PK6 */ 535 power-gpios = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_HIGH>;
524 bus-width = <4>; 536 bus-width = <4>;
525 keep-power-in-suspend; 537 keep-power-in-suspend;
526 }; 538 };
527 539
528 sdhci@c8000400 { 540 sdhci@c8000400 {
529 status = "okay"; 541 status = "okay";
530 cd-gpios = <&gpio 69 1>; /* gpio PI5 */ 542 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
531 wp-gpios = <&gpio 57 0>; /* gpio PH1 */ 543 wp-gpios = <&gpio TEGRA_GPIO(H, 1) GPIO_ACTIVE_HIGH>;
532 power-gpios = <&gpio 70 0>; /* gpio PI6 */ 544 power-gpios = <&gpio TEGRA_GPIO(I, 6) GPIO_ACTIVE_HIGH>;
533 bus-width = <4>; 545 bus-width = <4>;
534 }; 546 };
535 547
@@ -557,7 +569,7 @@
557 569
558 power { 570 power {
559 label = "Power"; 571 label = "Power";
560 gpios = <&gpio 170 1>; /* gpio PV2, active low */ 572 gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
561 linux,code = <116>; /* KEY_POWER */ 573 linux,code = <116>; /* KEY_POWER */
562 gpio-key,wakeup; 574 gpio-key,wakeup;
563 }; 575 };
@@ -583,7 +595,7 @@
583 regulator-name = "vdd_1v5"; 595 regulator-name = "vdd_1v5";
584 regulator-min-microvolt = <1500000>; 596 regulator-min-microvolt = <1500000>;
585 regulator-max-microvolt = <1500000>; 597 regulator-max-microvolt = <1500000>;
586 gpio = <&pmic 0 0>; 598 gpio = <&pmic 0 GPIO_ACTIVE_HIGH>;
587 }; 599 };
588 600
589 regulator@2 { 601 regulator@2 {
@@ -592,7 +604,7 @@
592 regulator-name = "vdd_1v2"; 604 regulator-name = "vdd_1v2";
593 regulator-min-microvolt = <1200000>; 605 regulator-min-microvolt = <1200000>;
594 regulator-max-microvolt = <1200000>; 606 regulator-max-microvolt = <1200000>;
595 gpio = <&pmic 1 0>; 607 gpio = <&pmic 1 GPIO_ACTIVE_HIGH>;
596 enable-active-high; 608 enable-active-high;
597 }; 609 };
598 610
@@ -602,7 +614,7 @@
602 regulator-name = "vdd_pnl"; 614 regulator-name = "vdd_pnl";
603 regulator-min-microvolt = <2800000>; 615 regulator-min-microvolt = <2800000>;
604 regulator-max-microvolt = <2800000>; 616 regulator-max-microvolt = <2800000>;
605 gpio = <&gpio 22 0>; /* gpio PC6 */ 617 gpio = <&gpio TEGRA_GPIO(C, 6) GPIO_ACTIVE_HIGH>;
606 enable-active-high; 618 enable-active-high;
607 }; 619 };
608 620
@@ -612,7 +624,7 @@
612 regulator-name = "vdd_bl"; 624 regulator-name = "vdd_bl";
613 regulator-min-microvolt = <2800000>; 625 regulator-min-microvolt = <2800000>;
614 regulator-max-microvolt = <2800000>; 626 regulator-max-microvolt = <2800000>;
615 gpio = <&gpio 176 0>; /* gpio PW0 */ 627 gpio = <&gpio TEGRA_GPIO(W, 0) GPIO_ACTIVE_HIGH>;
616 enable-active-high; 628 enable-active-high;
617 }; 629 };
618 }; 630 };
@@ -635,12 +647,16 @@
635 nvidia,i2s-controller = <&tegra_i2s1>; 647 nvidia,i2s-controller = <&tegra_i2s1>;
636 nvidia,audio-codec = <&wm8903>; 648 nvidia,audio-codec = <&wm8903>;
637 649
638 nvidia,spkr-en-gpios = <&wm8903 2 0>; 650 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
639 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 651 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
640 nvidia,int-mic-en-gpios = <&gpio 184 0>; /* gpio PX0 */ 652 nvidia,int-mic-en-gpios = <&gpio TEGRA_GPIO(X, 0)
641 nvidia,ext-mic-en-gpios = <&gpio 185 0>; /* gpio PX1 */ 653 GPIO_ACTIVE_HIGH>;
654 nvidia,ext-mic-en-gpios = <&gpio TEGRA_GPIO(X, 1)
655 GPIO_ACTIVE_HIGH>;
642 656
643 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 657 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
658 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
659 <&tegra_car TEGRA20_CLK_CDEV1>;
644 clock-names = "pll_a", "pll_a_out0", "mclk"; 660 clock-names = "pll_a", "pll_a_out0", "mclk";
645 }; 661 };
646}; 662};
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index d2567f83aaff..ea078ab8edeb 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra20.dtsi" 3#include "tegra20.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Tegra20 Whistler evaluation board"; 6 model = "NVIDIA Tegra20 Whistler evaluation board";
@@ -18,7 +18,8 @@
18 pll-supply = <&hdmi_pll_reg>; 18 pll-supply = <&hdmi_pll_reg>;
19 19
20 nvidia,ddc-i2c-bus = <&hdmi_ddc>; 20 nvidia,ddc-i2c-bus = <&hdmi_ddc>;
21 nvidia,hpd-gpio = <&gpio 111 0>; /* PN7 */ 21 nvidia,hpd-gpio = <&gpio TEGRA_GPIO(N, 7)
22 GPIO_ACTIVE_HIGH>;
22 }; 23 };
23 }; 24 };
24 25
@@ -281,7 +282,7 @@
281 max8907@3c { 282 max8907@3c {
282 compatible = "maxim,max8907"; 283 compatible = "maxim,max8907";
283 reg = <0x3c>; 284 reg = <0x3c>;
284 interrupts = <0 86 0x4>; 285 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
285 286
286 maxim,system-power-controller; 287 maxim,system-power-controller;
287 288
@@ -508,18 +509,28 @@
508 509
509 usb@c5000000 { 510 usb@c5000000 {
510 status = "okay"; 511 status = "okay";
511 nvidia,vbus-gpio = <&tca6416 0 0>; /* GPIO_PMU0 */ 512 nvidia,vbus-gpio = <&tca6416 0 GPIO_ACTIVE_HIGH>;
513 };
514
515 usb-phy@c5000000 {
516 status = "okay";
517 vbus-supply = <&vbus1_reg>;
512 }; 518 };
513 519
514 usb@c5008000 { 520 usb@c5008000 {
515 status = "okay"; 521 status = "okay";
516 nvidia,vbus-gpio = <&tca6416 1 0>; /* GPIO_PMU1 */ 522 nvidia,vbus-gpio = <&tca6416 1 GPIO_ACTIVE_HIGH>;
523 };
524
525 usb-phy@c5008000 {
526 status = "okay";
527 vbus-supply = <&vbus3_reg>;
517 }; 528 };
518 529
519 sdhci@c8000400 { 530 sdhci@c8000400 {
520 status = "okay"; 531 status = "okay";
521 cd-gpios = <&gpio 69 1>; /* gpio PI5 */ 532 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
522 wp-gpios = <&gpio 173 0>; /* gpio PV5 */ 533 wp-gpios = <&gpio TEGRA_GPIO(V, 5) GPIO_ACTIVE_HIGH>;
523 bus-width = <8>; 534 bus-width = <8>;
524 }; 535 };
525 536
@@ -568,6 +579,24 @@
568 regulator-max-microvolt = <5000000>; 579 regulator-max-microvolt = <5000000>;
569 regulator-always-on; 580 regulator-always-on;
570 }; 581 };
582
583 vbus1_reg: regulator@2 {
584 compatible = "regulator-fixed";
585 reg = <2>;
586 regulator-name = "vbus1";
587 regulator-min-microvolt = <5000000>;
588 regulator-max-microvolt = <5000000>;
589 gpio = <&tca6416 0 0>; /* GPIO_PMU0 */
590 };
591
592 vbus3_reg: regulator@3 {
593 compatible = "regulator-fixed";
594 reg = <3>;
595 regulator-name = "vbus3";
596 regulator-min-microvolt = <5000000>;
597 regulator-max-microvolt = <5000000>;
598 gpio = <&tca6416 1 0>; /* GPIO_PMU1 */
599 };
571 }; 600 };
572 601
573 sound { 602 sound {
@@ -584,7 +613,9 @@
584 nvidia,i2s-controller = <&tegra_i2s1>; 613 nvidia,i2s-controller = <&tegra_i2s1>;
585 nvidia,audio-codec = <&codec>; 614 nvidia,audio-codec = <&codec>;
586 615
587 clocks = <&tegra_car 112>, <&tegra_car 113>, <&tegra_car 94>; 616 clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
617 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
618 <&tegra_car TEGRA20_CLK_CDEV1>;
588 clock-names = "pll_a", "pll_a_out0", "mclk"; 619 clock-names = "pll_a", "pll_a_out0", "mclk";
589 }; 620 };
590}; 621};
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 56a91106041b..9653fd8288d2 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -1,4 +1,8 @@
1/include/ "skeleton.dtsi" 1#include <dt-bindings/clock/tegra20-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/interrupt-controller/arm-gic.h>
4
5#include "skeleton.dtsi"
2 6
3/ { 7/ {
4 compatible = "nvidia,tegra20"; 8 compatible = "nvidia,tegra20";
@@ -15,9 +19,9 @@
15 host1x { 19 host1x {
16 compatible = "nvidia,tegra20-host1x", "simple-bus"; 20 compatible = "nvidia,tegra20-host1x", "simple-bus";
17 reg = <0x50000000 0x00024000>; 21 reg = <0x50000000 0x00024000>;
18 interrupts = <0 65 0x04 /* mpcore syncpt */ 22 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
19 0 67 0x04>; /* mpcore general */ 23 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
20 clocks = <&tegra_car 28>; 24 clocks = <&tegra_car TEGRA20_CLK_HOST1X>;
21 25
22 #address-cells = <1>; 26 #address-cells = <1>;
23 #size-cells = <1>; 27 #size-cells = <1>;
@@ -27,49 +31,50 @@
27 mpe { 31 mpe {
28 compatible = "nvidia,tegra20-mpe"; 32 compatible = "nvidia,tegra20-mpe";
29 reg = <0x54040000 0x00040000>; 33 reg = <0x54040000 0x00040000>;
30 interrupts = <0 68 0x04>; 34 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
31 clocks = <&tegra_car 60>; 35 clocks = <&tegra_car TEGRA20_CLK_MPE>;
32 }; 36 };
33 37
34 vi { 38 vi {
35 compatible = "nvidia,tegra20-vi"; 39 compatible = "nvidia,tegra20-vi";
36 reg = <0x54080000 0x00040000>; 40 reg = <0x54080000 0x00040000>;
37 interrupts = <0 69 0x04>; 41 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
38 clocks = <&tegra_car 100>; 42 clocks = <&tegra_car TEGRA20_CLK_VI>;
39 }; 43 };
40 44
41 epp { 45 epp {
42 compatible = "nvidia,tegra20-epp"; 46 compatible = "nvidia,tegra20-epp";
43 reg = <0x540c0000 0x00040000>; 47 reg = <0x540c0000 0x00040000>;
44 interrupts = <0 70 0x04>; 48 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
45 clocks = <&tegra_car 19>; 49 clocks = <&tegra_car TEGRA20_CLK_EPP>;
46 }; 50 };
47 51
48 isp { 52 isp {
49 compatible = "nvidia,tegra20-isp"; 53 compatible = "nvidia,tegra20-isp";
50 reg = <0x54100000 0x00040000>; 54 reg = <0x54100000 0x00040000>;
51 interrupts = <0 71 0x04>; 55 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
52 clocks = <&tegra_car 23>; 56 clocks = <&tegra_car TEGRA20_CLK_ISP>;
53 }; 57 };
54 58
55 gr2d { 59 gr2d {
56 compatible = "nvidia,tegra20-gr2d"; 60 compatible = "nvidia,tegra20-gr2d";
57 reg = <0x54140000 0x00040000>; 61 reg = <0x54140000 0x00040000>;
58 interrupts = <0 72 0x04>; 62 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
59 clocks = <&tegra_car 21>; 63 clocks = <&tegra_car TEGRA20_CLK_GR2D>;
60 }; 64 };
61 65
62 gr3d { 66 gr3d {
63 compatible = "nvidia,tegra20-gr3d"; 67 compatible = "nvidia,tegra20-gr3d";
64 reg = <0x54180000 0x00040000>; 68 reg = <0x54180000 0x00040000>;
65 clocks = <&tegra_car 24>; 69 clocks = <&tegra_car TEGRA20_CLK_GR3D>;
66 }; 70 };
67 71
68 dc@54200000 { 72 dc@54200000 {
69 compatible = "nvidia,tegra20-dc"; 73 compatible = "nvidia,tegra20-dc";
70 reg = <0x54200000 0x00040000>; 74 reg = <0x54200000 0x00040000>;
71 interrupts = <0 73 0x04>; 75 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
72 clocks = <&tegra_car 27>, <&tegra_car 121>; 76 clocks = <&tegra_car TEGRA20_CLK_DISP1>,
77 <&tegra_car TEGRA20_CLK_PLL_P>;
73 clock-names = "disp1", "parent"; 78 clock-names = "disp1", "parent";
74 79
75 rgb { 80 rgb {
@@ -80,8 +85,9 @@
80 dc@54240000 { 85 dc@54240000 {
81 compatible = "nvidia,tegra20-dc"; 86 compatible = "nvidia,tegra20-dc";
82 reg = <0x54240000 0x00040000>; 87 reg = <0x54240000 0x00040000>;
83 interrupts = <0 74 0x04>; 88 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
84 clocks = <&tegra_car 26>, <&tegra_car 121>; 89 clocks = <&tegra_car TEGRA20_CLK_DISP2>,
90 <&tegra_car TEGRA20_CLK_PLL_P>;
85 clock-names = "disp2", "parent"; 91 clock-names = "disp2", "parent";
86 92
87 rgb { 93 rgb {
@@ -92,8 +98,9 @@
92 hdmi { 98 hdmi {
93 compatible = "nvidia,tegra20-hdmi"; 99 compatible = "nvidia,tegra20-hdmi";
94 reg = <0x54280000 0x00040000>; 100 reg = <0x54280000 0x00040000>;
95 interrupts = <0 75 0x04>; 101 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
96 clocks = <&tegra_car 51>, <&tegra_car 117>; 102 clocks = <&tegra_car TEGRA20_CLK_HDMI>,
103 <&tegra_car TEGRA20_CLK_PLL_D_OUT0>;
97 clock-names = "hdmi", "parent"; 104 clock-names = "hdmi", "parent";
98 status = "disabled"; 105 status = "disabled";
99 }; 106 };
@@ -101,15 +108,15 @@
101 tvo { 108 tvo {
102 compatible = "nvidia,tegra20-tvo"; 109 compatible = "nvidia,tegra20-tvo";
103 reg = <0x542c0000 0x00040000>; 110 reg = <0x542c0000 0x00040000>;
104 interrupts = <0 76 0x04>; 111 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
105 clocks = <&tegra_car 102>; 112 clocks = <&tegra_car TEGRA20_CLK_TVO>;
106 status = "disabled"; 113 status = "disabled";
107 }; 114 };
108 115
109 dsi { 116 dsi {
110 compatible = "nvidia,tegra20-dsi"; 117 compatible = "nvidia,tegra20-dsi";
111 reg = <0x54300000 0x00040000>; 118 reg = <0x54300000 0x00040000>;
112 clocks = <&tegra_car 48>; 119 clocks = <&tegra_car TEGRA20_CLK_DSI>;
113 status = "disabled"; 120 status = "disabled";
114 }; 121 };
115 }; 122 };
@@ -117,8 +124,9 @@
117 timer@50004600 { 124 timer@50004600 {
118 compatible = "arm,cortex-a9-twd-timer"; 125 compatible = "arm,cortex-a9-twd-timer";
119 reg = <0x50040600 0x20>; 126 reg = <0x50040600 0x20>;
120 interrupts = <1 13 0x304>; 127 interrupts = <GIC_PPI 13
121 clocks = <&tegra_car 132>; 128 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
129 clocks = <&tegra_car TEGRA20_CLK_TWD>;
122 }; 130 };
123 131
124 intc: interrupt-controller { 132 intc: interrupt-controller {
@@ -141,11 +149,11 @@
141 timer@60005000 { 149 timer@60005000 {
142 compatible = "nvidia,tegra20-timer"; 150 compatible = "nvidia,tegra20-timer";
143 reg = <0x60005000 0x60>; 151 reg = <0x60005000 0x60>;
144 interrupts = <0 0 0x04 152 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
145 0 1 0x04 153 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
146 0 41 0x04 154 <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
147 0 42 0x04>; 155 <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
148 clocks = <&tegra_car 5>; 156 clocks = <&tegra_car TEGRA20_CLK_TIMER>;
149 }; 157 };
150 158
151 tegra_car: clock { 159 tegra_car: clock {
@@ -157,23 +165,23 @@
157 apbdma: dma { 165 apbdma: dma {
158 compatible = "nvidia,tegra20-apbdma"; 166 compatible = "nvidia,tegra20-apbdma";
159 reg = <0x6000a000 0x1200>; 167 reg = <0x6000a000 0x1200>;
160 interrupts = <0 104 0x04 168 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
161 0 105 0x04 169 <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
162 0 106 0x04 170 <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
163 0 107 0x04 171 <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
164 0 108 0x04 172 <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
165 0 109 0x04 173 <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
166 0 110 0x04 174 <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
167 0 111 0x04 175 <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
168 0 112 0x04 176 <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
169 0 113 0x04 177 <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
170 0 114 0x04 178 <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
171 0 115 0x04 179 <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
172 0 116 0x04 180 <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
173 0 117 0x04 181 <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
174 0 118 0x04 182 <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
175 0 119 0x04>; 183 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>;
176 clocks = <&tegra_car 34>; 184 clocks = <&tegra_car TEGRA20_CLK_APBDMA>;
177 }; 185 };
178 186
179 ahb { 187 ahb {
@@ -184,13 +192,13 @@
184 gpio: gpio { 192 gpio: gpio {
185 compatible = "nvidia,tegra20-gpio"; 193 compatible = "nvidia,tegra20-gpio";
186 reg = <0x6000d000 0x1000>; 194 reg = <0x6000d000 0x1000>;
187 interrupts = <0 32 0x04 195 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
188 0 33 0x04 196 <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
189 0 34 0x04 197 <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
190 0 35 0x04 198 <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
191 0 55 0x04 199 <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
192 0 87 0x04 200 <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
193 0 89 0x04>; 201 <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
194 #gpio-cells = <2>; 202 #gpio-cells = <2>;
195 gpio-controller; 203 gpio-controller;
196 #interrupt-cells = <2>; 204 #interrupt-cells = <2>;
@@ -213,27 +221,27 @@
213 tegra_ac97: ac97 { 221 tegra_ac97: ac97 {
214 compatible = "nvidia,tegra20-ac97"; 222 compatible = "nvidia,tegra20-ac97";
215 reg = <0x70002000 0x200>; 223 reg = <0x70002000 0x200>;
216 interrupts = <0 81 0x04>; 224 interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
217 nvidia,dma-request-selector = <&apbdma 12>; 225 nvidia,dma-request-selector = <&apbdma 12>;
218 clocks = <&tegra_car 3>; 226 clocks = <&tegra_car TEGRA20_CLK_AC97>;
219 status = "disabled"; 227 status = "disabled";
220 }; 228 };
221 229
222 tegra_i2s1: i2s@70002800 { 230 tegra_i2s1: i2s@70002800 {
223 compatible = "nvidia,tegra20-i2s"; 231 compatible = "nvidia,tegra20-i2s";
224 reg = <0x70002800 0x200>; 232 reg = <0x70002800 0x200>;
225 interrupts = <0 13 0x04>; 233 interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
226 nvidia,dma-request-selector = <&apbdma 2>; 234 nvidia,dma-request-selector = <&apbdma 2>;
227 clocks = <&tegra_car 11>; 235 clocks = <&tegra_car TEGRA20_CLK_I2S1>;
228 status = "disabled"; 236 status = "disabled";
229 }; 237 };
230 238
231 tegra_i2s2: i2s@70002a00 { 239 tegra_i2s2: i2s@70002a00 {
232 compatible = "nvidia,tegra20-i2s"; 240 compatible = "nvidia,tegra20-i2s";
233 reg = <0x70002a00 0x200>; 241 reg = <0x70002a00 0x200>;
234 interrupts = <0 3 0x04>; 242 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
235 nvidia,dma-request-selector = <&apbdma 1>; 243 nvidia,dma-request-selector = <&apbdma 1>;
236 clocks = <&tegra_car 18>; 244 clocks = <&tegra_car TEGRA20_CLK_I2S2>;
237 status = "disabled"; 245 status = "disabled";
238 }; 246 };
239 247
@@ -248,9 +256,9 @@
248 compatible = "nvidia,tegra20-uart"; 256 compatible = "nvidia,tegra20-uart";
249 reg = <0x70006000 0x40>; 257 reg = <0x70006000 0x40>;
250 reg-shift = <2>; 258 reg-shift = <2>;
251 interrupts = <0 36 0x04>; 259 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
252 nvidia,dma-request-selector = <&apbdma 8>; 260 nvidia,dma-request-selector = <&apbdma 8>;
253 clocks = <&tegra_car 6>; 261 clocks = <&tegra_car TEGRA20_CLK_UARTA>;
254 status = "disabled"; 262 status = "disabled";
255 }; 263 };
256 264
@@ -258,9 +266,9 @@
258 compatible = "nvidia,tegra20-uart"; 266 compatible = "nvidia,tegra20-uart";
259 reg = <0x70006040 0x40>; 267 reg = <0x70006040 0x40>;
260 reg-shift = <2>; 268 reg-shift = <2>;
261 interrupts = <0 37 0x04>; 269 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
262 nvidia,dma-request-selector = <&apbdma 9>; 270 nvidia,dma-request-selector = <&apbdma 9>;
263 clocks = <&tegra_car 96>; 271 clocks = <&tegra_car TEGRA20_CLK_UARTB>;
264 status = "disabled"; 272 status = "disabled";
265 }; 273 };
266 274
@@ -268,9 +276,9 @@
268 compatible = "nvidia,tegra20-uart"; 276 compatible = "nvidia,tegra20-uart";
269 reg = <0x70006200 0x100>; 277 reg = <0x70006200 0x100>;
270 reg-shift = <2>; 278 reg-shift = <2>;
271 interrupts = <0 46 0x04>; 279 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
272 nvidia,dma-request-selector = <&apbdma 10>; 280 nvidia,dma-request-selector = <&apbdma 10>;
273 clocks = <&tegra_car 55>; 281 clocks = <&tegra_car TEGRA20_CLK_UARTC>;
274 status = "disabled"; 282 status = "disabled";
275 }; 283 };
276 284
@@ -278,9 +286,9 @@
278 compatible = "nvidia,tegra20-uart"; 286 compatible = "nvidia,tegra20-uart";
279 reg = <0x70006300 0x100>; 287 reg = <0x70006300 0x100>;
280 reg-shift = <2>; 288 reg-shift = <2>;
281 interrupts = <0 90 0x04>; 289 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
282 nvidia,dma-request-selector = <&apbdma 19>; 290 nvidia,dma-request-selector = <&apbdma 19>;
283 clocks = <&tegra_car 65>; 291 clocks = <&tegra_car TEGRA20_CLK_UARTD>;
284 status = "disabled"; 292 status = "disabled";
285 }; 293 };
286 294
@@ -288,9 +296,9 @@
288 compatible = "nvidia,tegra20-uart"; 296 compatible = "nvidia,tegra20-uart";
289 reg = <0x70006400 0x100>; 297 reg = <0x70006400 0x100>;
290 reg-shift = <2>; 298 reg-shift = <2>;
291 interrupts = <0 91 0x04>; 299 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
292 nvidia,dma-request-selector = <&apbdma 20>; 300 nvidia,dma-request-selector = <&apbdma 20>;
293 clocks = <&tegra_car 66>; 301 clocks = <&tegra_car TEGRA20_CLK_UARTE>;
294 status = "disabled"; 302 status = "disabled";
295 }; 303 };
296 304
@@ -298,24 +306,25 @@
298 compatible = "nvidia,tegra20-pwm"; 306 compatible = "nvidia,tegra20-pwm";
299 reg = <0x7000a000 0x100>; 307 reg = <0x7000a000 0x100>;
300 #pwm-cells = <2>; 308 #pwm-cells = <2>;
301 clocks = <&tegra_car 17>; 309 clocks = <&tegra_car TEGRA20_CLK_PWM>;
302 status = "disabled"; 310 status = "disabled";
303 }; 311 };
304 312
305 rtc { 313 rtc {
306 compatible = "nvidia,tegra20-rtc"; 314 compatible = "nvidia,tegra20-rtc";
307 reg = <0x7000e000 0x100>; 315 reg = <0x7000e000 0x100>;
308 interrupts = <0 2 0x04>; 316 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
309 clocks = <&tegra_car 4>; 317 clocks = <&tegra_car TEGRA20_CLK_RTC>;
310 }; 318 };
311 319
312 i2c@7000c000 { 320 i2c@7000c000 {
313 compatible = "nvidia,tegra20-i2c"; 321 compatible = "nvidia,tegra20-i2c";
314 reg = <0x7000c000 0x100>; 322 reg = <0x7000c000 0x100>;
315 interrupts = <0 38 0x04>; 323 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
316 #address-cells = <1>; 324 #address-cells = <1>;
317 #size-cells = <0>; 325 #size-cells = <0>;
318 clocks = <&tegra_car 12>, <&tegra_car 124>; 326 clocks = <&tegra_car TEGRA20_CLK_I2C1>,
327 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
319 clock-names = "div-clk", "fast-clk"; 328 clock-names = "div-clk", "fast-clk";
320 status = "disabled"; 329 status = "disabled";
321 }; 330 };
@@ -323,21 +332,22 @@
323 spi@7000c380 { 332 spi@7000c380 {
324 compatible = "nvidia,tegra20-sflash"; 333 compatible = "nvidia,tegra20-sflash";
325 reg = <0x7000c380 0x80>; 334 reg = <0x7000c380 0x80>;
326 interrupts = <0 39 0x04>; 335 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
327 nvidia,dma-request-selector = <&apbdma 11>; 336 nvidia,dma-request-selector = <&apbdma 11>;
328 #address-cells = <1>; 337 #address-cells = <1>;
329 #size-cells = <0>; 338 #size-cells = <0>;
330 clocks = <&tegra_car 43>; 339 clocks = <&tegra_car TEGRA20_CLK_SPI>;
331 status = "disabled"; 340 status = "disabled";
332 }; 341 };
333 342
334 i2c@7000c400 { 343 i2c@7000c400 {
335 compatible = "nvidia,tegra20-i2c"; 344 compatible = "nvidia,tegra20-i2c";
336 reg = <0x7000c400 0x100>; 345 reg = <0x7000c400 0x100>;
337 interrupts = <0 84 0x04>; 346 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
338 #address-cells = <1>; 347 #address-cells = <1>;
339 #size-cells = <0>; 348 #size-cells = <0>;
340 clocks = <&tegra_car 54>, <&tegra_car 124>; 349 clocks = <&tegra_car TEGRA20_CLK_I2C2>,
350 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
341 clock-names = "div-clk", "fast-clk"; 351 clock-names = "div-clk", "fast-clk";
342 status = "disabled"; 352 status = "disabled";
343 }; 353 };
@@ -345,10 +355,11 @@
345 i2c@7000c500 { 355 i2c@7000c500 {
346 compatible = "nvidia,tegra20-i2c"; 356 compatible = "nvidia,tegra20-i2c";
347 reg = <0x7000c500 0x100>; 357 reg = <0x7000c500 0x100>;
348 interrupts = <0 92 0x04>; 358 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
349 #address-cells = <1>; 359 #address-cells = <1>;
350 #size-cells = <0>; 360 #size-cells = <0>;
351 clocks = <&tegra_car 67>, <&tegra_car 124>; 361 clocks = <&tegra_car TEGRA20_CLK_I2C3>,
362 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
352 clock-names = "div-clk", "fast-clk"; 363 clock-names = "div-clk", "fast-clk";
353 status = "disabled"; 364 status = "disabled";
354 }; 365 };
@@ -356,10 +367,11 @@
356 i2c@7000d000 { 367 i2c@7000d000 {
357 compatible = "nvidia,tegra20-i2c-dvc"; 368 compatible = "nvidia,tegra20-i2c-dvc";
358 reg = <0x7000d000 0x200>; 369 reg = <0x7000d000 0x200>;
359 interrupts = <0 53 0x04>; 370 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
360 #address-cells = <1>; 371 #address-cells = <1>;
361 #size-cells = <0>; 372 #size-cells = <0>;
362 clocks = <&tegra_car 47>, <&tegra_car 124>; 373 clocks = <&tegra_car TEGRA20_CLK_DVC>,
374 <&tegra_car TEGRA20_CLK_PLL_P_OUT3>;
363 clock-names = "div-clk", "fast-clk"; 375 clock-names = "div-clk", "fast-clk";
364 status = "disabled"; 376 status = "disabled";
365 }; 377 };
@@ -367,59 +379,59 @@
367 spi@7000d400 { 379 spi@7000d400 {
368 compatible = "nvidia,tegra20-slink"; 380 compatible = "nvidia,tegra20-slink";
369 reg = <0x7000d400 0x200>; 381 reg = <0x7000d400 0x200>;
370 interrupts = <0 59 0x04>; 382 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
371 nvidia,dma-request-selector = <&apbdma 15>; 383 nvidia,dma-request-selector = <&apbdma 15>;
372 #address-cells = <1>; 384 #address-cells = <1>;
373 #size-cells = <0>; 385 #size-cells = <0>;
374 clocks = <&tegra_car 41>; 386 clocks = <&tegra_car TEGRA20_CLK_SBC1>;
375 status = "disabled"; 387 status = "disabled";
376 }; 388 };
377 389
378 spi@7000d600 { 390 spi@7000d600 {
379 compatible = "nvidia,tegra20-slink"; 391 compatible = "nvidia,tegra20-slink";
380 reg = <0x7000d600 0x200>; 392 reg = <0x7000d600 0x200>;
381 interrupts = <0 82 0x04>; 393 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
382 nvidia,dma-request-selector = <&apbdma 16>; 394 nvidia,dma-request-selector = <&apbdma 16>;
383 #address-cells = <1>; 395 #address-cells = <1>;
384 #size-cells = <0>; 396 #size-cells = <0>;
385 clocks = <&tegra_car 44>; 397 clocks = <&tegra_car TEGRA20_CLK_SBC2>;
386 status = "disabled"; 398 status = "disabled";
387 }; 399 };
388 400
389 spi@7000d800 { 401 spi@7000d800 {
390 compatible = "nvidia,tegra20-slink"; 402 compatible = "nvidia,tegra20-slink";
391 reg = <0x7000d800 0x200>; 403 reg = <0x7000d800 0x200>;
392 interrupts = <0 83 0x04>; 404 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
393 nvidia,dma-request-selector = <&apbdma 17>; 405 nvidia,dma-request-selector = <&apbdma 17>;
394 #address-cells = <1>; 406 #address-cells = <1>;
395 #size-cells = <0>; 407 #size-cells = <0>;
396 clocks = <&tegra_car 46>; 408 clocks = <&tegra_car TEGRA20_CLK_SBC3>;
397 status = "disabled"; 409 status = "disabled";
398 }; 410 };
399 411
400 spi@7000da00 { 412 spi@7000da00 {
401 compatible = "nvidia,tegra20-slink"; 413 compatible = "nvidia,tegra20-slink";
402 reg = <0x7000da00 0x200>; 414 reg = <0x7000da00 0x200>;
403 interrupts = <0 93 0x04>; 415 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
404 nvidia,dma-request-selector = <&apbdma 18>; 416 nvidia,dma-request-selector = <&apbdma 18>;
405 #address-cells = <1>; 417 #address-cells = <1>;
406 #size-cells = <0>; 418 #size-cells = <0>;
407 clocks = <&tegra_car 68>; 419 clocks = <&tegra_car TEGRA20_CLK_SBC4>;
408 status = "disabled"; 420 status = "disabled";
409 }; 421 };
410 422
411 kbc { 423 kbc {
412 compatible = "nvidia,tegra20-kbc"; 424 compatible = "nvidia,tegra20-kbc";
413 reg = <0x7000e200 0x100>; 425 reg = <0x7000e200 0x100>;
414 interrupts = <0 85 0x04>; 426 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
415 clocks = <&tegra_car 36>; 427 clocks = <&tegra_car TEGRA20_CLK_KBC>;
416 status = "disabled"; 428 status = "disabled";
417 }; 429 };
418 430
419 pmc { 431 pmc {
420 compatible = "nvidia,tegra20-pmc"; 432 compatible = "nvidia,tegra20-pmc";
421 reg = <0x7000e400 0x400>; 433 reg = <0x7000e400 0x400>;
422 clocks = <&tegra_car 110>, <&clk32k_in>; 434 clocks = <&tegra_car TEGRA20_CLK_PCLK>, <&clk32k_in>;
423 clock-names = "pclk", "clk32k_in"; 435 clock-names = "pclk", "clk32k_in";
424 }; 436 };
425 437
@@ -427,7 +439,7 @@
427 compatible = "nvidia,tegra20-mc"; 439 compatible = "nvidia,tegra20-mc";
428 reg = <0x7000f000 0x024 440 reg = <0x7000f000 0x024
429 0x7000f03c 0x3c4>; 441 0x7000f03c 0x3c4>;
430 interrupts = <0 77 0x04>; 442 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
431 }; 443 };
432 444
433 iommu { 445 iommu {
@@ -446,89 +458,114 @@
446 usb@c5000000 { 458 usb@c5000000 {
447 compatible = "nvidia,tegra20-ehci", "usb-ehci"; 459 compatible = "nvidia,tegra20-ehci", "usb-ehci";
448 reg = <0xc5000000 0x4000>; 460 reg = <0xc5000000 0x4000>;
449 interrupts = <0 20 0x04>; 461 interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
450 phy_type = "utmi"; 462 phy_type = "utmi";
451 nvidia,has-legacy-mode; 463 nvidia,has-legacy-mode;
452 clocks = <&tegra_car 22>; 464 clocks = <&tegra_car TEGRA20_CLK_USBD>;
453 nvidia,needs-double-reset; 465 nvidia,needs-double-reset;
454 nvidia,phy = <&phy1>; 466 nvidia,phy = <&phy1>;
455 status = "disabled"; 467 status = "disabled";
456 }; 468 };
457 469
458 phy1: usb-phy@c5000400 { 470 phy1: usb-phy@c5000000 {
459 compatible = "nvidia,tegra20-usb-phy"; 471 compatible = "nvidia,tegra20-usb-phy";
460 reg = <0xc5000400 0x3c00>; 472 reg = <0xc5000000 0x4000 0xc5000000 0x4000>;
461 phy_type = "utmi"; 473 phy_type = "utmi";
474 clocks = <&tegra_car TEGRA20_CLK_USBD>,
475 <&tegra_car TEGRA20_CLK_PLL_U>,
476 <&tegra_car TEGRA20_CLK_CLK_M>,
477 <&tegra_car TEGRA20_CLK_USBD>;
478 clock-names = "reg", "pll_u", "timer", "utmi-pads";
462 nvidia,has-legacy-mode; 479 nvidia,has-legacy-mode;
463 clocks = <&tegra_car 22>, <&tegra_car 127>; 480 hssync_start_delay = <9>;
464 clock-names = "phy", "pll_u"; 481 idle_wait_delay = <17>;
482 elastic_limit = <16>;
483 term_range_adj = <6>;
484 xcvr_setup = <9>;
485 xcvr_lsfslew = <1>;
486 xcvr_lsrslew = <1>;
487 status = "disabled";
465 }; 488 };
466 489
467 usb@c5004000 { 490 usb@c5004000 {
468 compatible = "nvidia,tegra20-ehci", "usb-ehci"; 491 compatible = "nvidia,tegra20-ehci", "usb-ehci";
469 reg = <0xc5004000 0x4000>; 492 reg = <0xc5004000 0x4000>;
470 interrupts = <0 21 0x04>; 493 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
471 phy_type = "ulpi"; 494 phy_type = "ulpi";
472 clocks = <&tegra_car 58>; 495 clocks = <&tegra_car TEGRA20_CLK_USB2>;
473 nvidia,phy = <&phy2>; 496 nvidia,phy = <&phy2>;
474 status = "disabled"; 497 status = "disabled";
475 }; 498 };
476 499
477 phy2: usb-phy@c5004400 { 500 phy2: usb-phy@c5004000 {
478 compatible = "nvidia,tegra20-usb-phy"; 501 compatible = "nvidia,tegra20-usb-phy";
479 reg = <0xc5004400 0x3c00>; 502 reg = <0xc5004000 0x4000>;
480 phy_type = "ulpi"; 503 phy_type = "ulpi";
481 clocks = <&tegra_car 93>, <&tegra_car 127>; 504 clocks = <&tegra_car TEGRA20_CLK_USB2>,
482 clock-names = "phy", "pll_u"; 505 <&tegra_car TEGRA20_CLK_PLL_U>,
506 <&tegra_car TEGRA20_CLK_CDEV2>;
507 clock-names = "reg", "pll_u", "ulpi-link";
508 status = "disabled";
483 }; 509 };
484 510
485 usb@c5008000 { 511 usb@c5008000 {
486 compatible = "nvidia,tegra20-ehci", "usb-ehci"; 512 compatible = "nvidia,tegra20-ehci", "usb-ehci";
487 reg = <0xc5008000 0x4000>; 513 reg = <0xc5008000 0x4000>;
488 interrupts = <0 97 0x04>; 514 interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
489 phy_type = "utmi"; 515 phy_type = "utmi";
490 clocks = <&tegra_car 59>; 516 clocks = <&tegra_car TEGRA20_CLK_USB3>;
491 nvidia,phy = <&phy3>; 517 nvidia,phy = <&phy3>;
492 status = "disabled"; 518 status = "disabled";
493 }; 519 };
494 520
495 phy3: usb-phy@c5008400 { 521 phy3: usb-phy@c5008000 {
496 compatible = "nvidia,tegra20-usb-phy"; 522 compatible = "nvidia,tegra20-usb-phy";
497 reg = <0xc5008400 0x3c00>; 523 reg = <0xc5008000 0x4000 0xc5000000 0x4000>;
498 phy_type = "utmi"; 524 phy_type = "utmi";
499 clocks = <&tegra_car 22>, <&tegra_car 127>; 525 clocks = <&tegra_car TEGRA20_CLK_USB3>,
500 clock-names = "phy", "pll_u"; 526 <&tegra_car TEGRA20_CLK_PLL_U>,
527 <&tegra_car TEGRA20_CLK_CLK_M>,
528 <&tegra_car TEGRA20_CLK_USBD>;
529 clock-names = "reg", "pll_u", "timer", "utmi-pads";
530 hssync_start_delay = <9>;
531 idle_wait_delay = <17>;
532 elastic_limit = <16>;
533 term_range_adj = <6>;
534 xcvr_setup = <9>;
535 xcvr_lsfslew = <2>;
536 xcvr_lsrslew = <2>;
537 status = "disabled";
501 }; 538 };
502 539
503 sdhci@c8000000 { 540 sdhci@c8000000 {
504 compatible = "nvidia,tegra20-sdhci"; 541 compatible = "nvidia,tegra20-sdhci";
505 reg = <0xc8000000 0x200>; 542 reg = <0xc8000000 0x200>;
506 interrupts = <0 14 0x04>; 543 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
507 clocks = <&tegra_car 14>; 544 clocks = <&tegra_car TEGRA20_CLK_SDMMC1>;
508 status = "disabled"; 545 status = "disabled";
509 }; 546 };
510 547
511 sdhci@c8000200 { 548 sdhci@c8000200 {
512 compatible = "nvidia,tegra20-sdhci"; 549 compatible = "nvidia,tegra20-sdhci";
513 reg = <0xc8000200 0x200>; 550 reg = <0xc8000200 0x200>;
514 interrupts = <0 15 0x04>; 551 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
515 clocks = <&tegra_car 9>; 552 clocks = <&tegra_car TEGRA20_CLK_SDMMC2>;
516 status = "disabled"; 553 status = "disabled";
517 }; 554 };
518 555
519 sdhci@c8000400 { 556 sdhci@c8000400 {
520 compatible = "nvidia,tegra20-sdhci"; 557 compatible = "nvidia,tegra20-sdhci";
521 reg = <0xc8000400 0x200>; 558 reg = <0xc8000400 0x200>;
522 interrupts = <0 19 0x04>; 559 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
523 clocks = <&tegra_car 69>; 560 clocks = <&tegra_car TEGRA20_CLK_SDMMC3>;
524 status = "disabled"; 561 status = "disabled";
525 }; 562 };
526 563
527 sdhci@c8000600 { 564 sdhci@c8000600 {
528 compatible = "nvidia,tegra20-sdhci"; 565 compatible = "nvidia,tegra20-sdhci";
529 reg = <0xc8000600 0x200>; 566 reg = <0xc8000600 0x200>;
530 interrupts = <0 31 0x04>; 567 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
531 clocks = <&tegra_car 15>; 568 clocks = <&tegra_car TEGRA20_CLK_SDMMC4>;
532 status = "disabled"; 569 status = "disabled";
533 }; 570 };
534 571
@@ -551,7 +588,7 @@
551 588
552 pmu { 589 pmu {
553 compatible = "arm,cortex-a9-pmu"; 590 compatible = "arm,cortex-a9-pmu";
554 interrupts = <0 56 0x04 591 interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>,
555 0 57 0x04>; 592 <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
556 }; 593 };
557}; 594};
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index b732f7c13a66..87c5f7b7c271 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -1,13 +1,13 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra30.dtsi" 3#include "tegra30.dtsi"
4 4
5/ { 5/ {
6 model = "NVIDIA Tegra30 Beaver evaluation board"; 6 model = "NVIDIA Tegra30 Beaver evaluation board";
7 compatible = "nvidia,beaver", "nvidia,tegra30"; 7 compatible = "nvidia,beaver", "nvidia,tegra30";
8 8
9 memory { 9 memory {
10 reg = <0x80000000 0x80000000>; 10 reg = <0x80000000 0x7ff00000>;
11 }; 11 };
12 12
13 pinmux { 13 pinmux {
@@ -116,6 +116,15 @@
116 status = "okay"; 116 status = "okay";
117 clock-frequency = <100000>; 117 clock-frequency = <100000>;
118 118
119 rt5640: rt5640 {
120 compatible = "realtek,rt5640";
121 reg = <0x1c>;
122 interrupt-parent = <&gpio>;
123 interrupts = <TEGRA_GPIO(X, 3) GPIO_ACTIVE_HIGH>;
124 realtek,ldo1-en-gpios =
125 <&gpio TEGRA_GPIO(X, 2) GPIO_ACTIVE_HIGH>;
126 };
127
119 tps62361 { 128 tps62361 {
120 compatible = "ti,tps62361"; 129 compatible = "ti,tps62361";
121 reg = <0x60>; 130 reg = <0x60>;
@@ -133,7 +142,7 @@
133 compatible = "ti,tps65911"; 142 compatible = "ti,tps65911";
134 reg = <0x2d>; 143 reg = <0x2d>;
135 144
136 interrupts = <0 86 0x4>; 145 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
137 #interrupt-cells = <2>; 146 #interrupt-cells = <2>;
138 interrupt-controller; 147 interrupt-controller;
139 148
@@ -264,9 +273,9 @@
264 273
265 sdhci@78000000 { 274 sdhci@78000000 {
266 status = "okay"; 275 status = "okay";
267 cd-gpios = <&gpio 69 1>; /* gpio PI5 */ 276 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
268 wp-gpios = <&gpio 155 0>; /* gpio PT3 */ 277 wp-gpios = <&gpio TEGRA_GPIO(T, 3) GPIO_ACTIVE_HIGH>;
269 power-gpios = <&gpio 31 0>; /* gpio PD7 */ 278 power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>;
270 bus-width = <4>; 279 bus-width = <4>;
271 }; 280 };
272 281
@@ -312,7 +321,7 @@
312 regulator-boot-on; 321 regulator-boot-on;
313 regulator-always-on; 322 regulator-always-on;
314 enable-active-high; 323 enable-active-high;
315 gpio = <&pmic 0 0>; /* PMIC TPS65911 GPIO0 */ 324 gpio = <&pmic 0 GPIO_ACTIVE_HIGH>;
316 }; 325 };
317 326
318 ddr_reg: regulator@2 { 327 ddr_reg: regulator@2 {
@@ -324,7 +333,7 @@
324 regulator-always-on; 333 regulator-always-on;
325 regulator-boot-on; 334 regulator-boot-on;
326 enable-active-high; 335 enable-active-high;
327 gpio = <&pmic 7 0>; /* PMIC TPS65911 GPIO7 */ 336 gpio = <&pmic 7 GPIO_ACTIVE_HIGH>;
328 vin-supply = <&vdd_5v_in_reg>; 337 vin-supply = <&vdd_5v_in_reg>;
329 }; 338 };
330 339
@@ -337,7 +346,7 @@
337 regulator-always-on; 346 regulator-always-on;
338 regulator-boot-on; 347 regulator-boot-on;
339 enable-active-high; 348 enable-active-high;
340 gpio = <&gpio 30 0>; /* gpio PD6 */ 349 gpio = <&gpio TEGRA_GPIO(D, 6) GPIO_ACTIVE_HIGH>;
341 vin-supply = <&vdd_5v_in_reg>; 350 vin-supply = <&vdd_5v_in_reg>;
342 }; 351 };
343 352
@@ -348,7 +357,7 @@
348 regulator-min-microvolt = <5000000>; 357 regulator-min-microvolt = <5000000>;
349 regulator-max-microvolt = <5000000>; 358 regulator-max-microvolt = <5000000>;
350 enable-active-high; 359 enable-active-high;
351 gpio = <&gpio 68 0>; /* GPIO PI4 */ 360 gpio = <&gpio TEGRA_GPIO(I, 4) GPIO_ACTIVE_HIGH>;
352 gpio-open-drain; 361 gpio-open-drain;
353 vin-supply = <&vdd_5v_in_reg>; 362 vin-supply = <&vdd_5v_in_reg>;
354 }; 363 };
@@ -360,7 +369,7 @@
360 regulator-min-microvolt = <5000000>; 369 regulator-min-microvolt = <5000000>;
361 regulator-max-microvolt = <5000000>; 370 regulator-max-microvolt = <5000000>;
362 enable-active-high; 371 enable-active-high;
363 gpio = <&gpio 63 0>; /* GPIO PH7 */ 372 gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_HIGH>;
364 gpio-open-drain; 373 gpio-open-drain;
365 vin-supply = <&vdd_5v_in_reg>; 374 vin-supply = <&vdd_5v_in_reg>;
366 }; 375 };
@@ -374,7 +383,7 @@
374 regulator-always-on; 383 regulator-always-on;
375 regulator-boot-on; 384 regulator-boot-on;
376 enable-active-high; 385 enable-active-high;
377 gpio = <&pmic 6 0>; /* PMIC TPS65911 GPIO6 */ 386 gpio = <&pmic 6 GPIO_ACTIVE_HIGH>;
378 vin-supply = <&vdd_5v_in_reg>; 387 vin-supply = <&vdd_5v_in_reg>;
379 }; 388 };
380 389
@@ -387,8 +396,41 @@
387 regulator-always-on; 396 regulator-always-on;
388 regulator-boot-on; 397 regulator-boot-on;
389 enable-active-high; 398 enable-active-high;
390 gpio = <&gpio 95 0>; /* gpio PL7 */ 399 gpio = <&gpio TEGRA_GPIO(L, 7) GPIO_ACTIVE_HIGH>;
391 vin-supply = <&sys_3v3_reg>; 400 vin-supply = <&sys_3v3_reg>;
392 }; 401 };
393 }; 402 };
403
404 gpio-leds {
405 compatible = "gpio-leds";
406
407 gpled1 {
408 label = "LED1"; /* CR5A1 (blue) */
409 gpios = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_HIGH>;
410 };
411 gpled2 {
412 label = "LED2"; /* CR4A2 (green) */
413 gpios = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_HIGH>;
414 };
415 };
416
417 sound {
418 compatible = "nvidia,tegra-audio-rt5640-beaver",
419 "nvidia,tegra-audio-rt5640";
420 nvidia,model = "NVIDIA Tegra Beaver";
421
422 nvidia,audio-routing =
423 "Headphones", "HPOR",
424 "Headphones", "HPOL";
425
426 nvidia,i2s-controller = <&tegra_i2s1>;
427 nvidia,audio-codec = <&rt5640>;
428
429 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2) GPIO_ACTIVE_HIGH>;
430
431 clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
432 <&tegra_car TEGRA30_CLK_PLL_A_OUT0>,
433 <&tegra_car TEGRA30_CLK_EXTERN1>;
434 clock-names = "pll_a", "pll_a_out0", "mclk";
435 };
394}; 436};
diff --git a/arch/arm/boot/dts/tegra30-cardhu-a02.dts b/arch/arm/boot/dts/tegra30-cardhu-a02.dts
index e392bd2dab9b..1082c5ed90d1 100644
--- a/arch/arm/boot/dts/tegra30-cardhu-a02.dts
+++ b/arch/arm/boot/dts/tegra30-cardhu-a02.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra30-cardhu.dtsi" 3#include "tegra30-cardhu.dtsi"
4 4
5/* This dts file support the cardhu A02 version of board */ 5/* This dts file support the cardhu A02 version of board */
6 6
@@ -22,7 +22,7 @@
22 regulator-always-on; 22 regulator-always-on;
23 regulator-boot-on; 23 regulator-boot-on;
24 enable-active-high; 24 enable-active-high;
25 gpio = <&pmic 6 0>; 25 gpio = <&pmic 6 GPIO_ACTIVE_HIGH>;
26 }; 26 };
27 27
28 sys_3v3_reg: regulator@101 { 28 sys_3v3_reg: regulator@101 {
@@ -34,7 +34,7 @@
34 regulator-always-on; 34 regulator-always-on;
35 regulator-boot-on; 35 regulator-boot-on;
36 enable-active-high; 36 enable-active-high;
37 gpio = <&pmic 7 0>; 37 gpio = <&pmic 7 GPIO_ACTIVE_HIGH>;
38 }; 38 };
39 39
40 usb1_vbus_reg: regulator@102 { 40 usb1_vbus_reg: regulator@102 {
@@ -44,7 +44,7 @@
44 regulator-min-microvolt = <5000000>; 44 regulator-min-microvolt = <5000000>;
45 regulator-max-microvolt = <5000000>; 45 regulator-max-microvolt = <5000000>;
46 enable-active-high; 46 enable-active-high;
47 gpio = <&gpio 68 0>; /* GPIO PI4 */ 47 gpio = <&gpio TEGRA_GPIO(I, 4) GPIO_ACTIVE_HIGH>;
48 gpio-open-drain; 48 gpio-open-drain;
49 vin-supply = <&vdd_5v0_reg>; 49 vin-supply = <&vdd_5v0_reg>;
50 }; 50 };
@@ -56,7 +56,7 @@
56 regulator-min-microvolt = <5000000>; 56 regulator-min-microvolt = <5000000>;
57 regulator-max-microvolt = <5000000>; 57 regulator-max-microvolt = <5000000>;
58 enable-active-high; 58 enable-active-high;
59 gpio = <&gpio 63 0>; /* GPIO PH7 */ 59 gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_HIGH>;
60 gpio-open-drain; 60 gpio-open-drain;
61 vin-supply = <&vdd_5v0_reg>; 61 vin-supply = <&vdd_5v0_reg>;
62 }; 62 };
@@ -68,7 +68,7 @@
68 regulator-min-microvolt = <5000000>; 68 regulator-min-microvolt = <5000000>;
69 regulator-max-microvolt = <5000000>; 69 regulator-max-microvolt = <5000000>;
70 enable-active-high; 70 enable-active-high;
71 gpio = <&pmic 2 0>; 71 gpio = <&pmic 2 GPIO_ACTIVE_HIGH>;
72 }; 72 };
73 73
74 vdd_bl_reg: regulator@105 { 74 vdd_bl_reg: regulator@105 {
@@ -80,13 +80,13 @@
80 regulator-always-on; 80 regulator-always-on;
81 regulator-boot-on; 81 regulator-boot-on;
82 enable-active-high; 82 enable-active-high;
83 gpio = <&gpio 83 0>; /* GPIO PK3 */ 83 gpio = <&gpio TEGRA_GPIO(K, 3) GPIO_ACTIVE_HIGH>;
84 }; 84 };
85 }; 85 };
86 86
87 sdhci@78000400 { 87 sdhci@78000400 {
88 status = "okay"; 88 status = "okay";
89 power-gpios = <&gpio 28 0>; /* gpio PD4 */ 89 power-gpios = <&gpio TEGRA_GPIO(D, 4) GPIO_ACTIVE_HIGH>;
90 bus-width = <4>; 90 bus-width = <4>;
91 keep-power-in-suspend; 91 keep-power-in-suspend;
92 }; 92 };
diff --git a/arch/arm/boot/dts/tegra30-cardhu-a04.dts b/arch/arm/boot/dts/tegra30-cardhu-a04.dts
index d0db6c7e774f..bf012bddaafb 100644
--- a/arch/arm/boot/dts/tegra30-cardhu-a04.dts
+++ b/arch/arm/boot/dts/tegra30-cardhu-a04.dts
@@ -1,6 +1,6 @@
1/dts-v1/; 1/dts-v1/;
2 2
3/include/ "tegra30-cardhu.dtsi" 3#include "tegra30-cardhu.dtsi"
4 4
5/* This dts file support the cardhu A04 and later versions of board */ 5/* This dts file support the cardhu A04 and later versions of board */
6 6
@@ -22,7 +22,7 @@
22 regulator-always-on; 22 regulator-always-on;
23 regulator-boot-on; 23 regulator-boot-on;
24 enable-active-high; 24 enable-active-high;
25 gpio = <&pmic 7 0>; 25 gpio = <&pmic 7 GPIO_ACTIVE_HIGH>;
26 }; 26 };
27 27
28 sys_3v3_reg: regulator@101 { 28 sys_3v3_reg: regulator@101 {
@@ -34,7 +34,7 @@
34 regulator-always-on; 34 regulator-always-on;
35 regulator-boot-on; 35 regulator-boot-on;
36 enable-active-high; 36 enable-active-high;
37 gpio = <&pmic 6 0>; 37 gpio = <&pmic 6 GPIO_ACTIVE_HIGH>;
38 }; 38 };
39 39
40 usb1_vbus_reg: regulator@102 { 40 usb1_vbus_reg: regulator@102 {
@@ -44,7 +44,7 @@
44 regulator-min-microvolt = <5000000>; 44 regulator-min-microvolt = <5000000>;
45 regulator-max-microvolt = <5000000>; 45 regulator-max-microvolt = <5000000>;
46 enable-active-high; 46 enable-active-high;
47 gpio = <&gpio 238 0>; /* GPIO PDD6 */ 47 gpio = <&gpio TEGRA_GPIO(DD, 6) GPIO_ACTIVE_HIGH>;
48 gpio-open-drain; 48 gpio-open-drain;
49 vin-supply = <&vdd_5v0_reg>; 49 vin-supply = <&vdd_5v0_reg>;
50 }; 50 };
@@ -56,7 +56,7 @@
56 regulator-min-microvolt = <5000000>; 56 regulator-min-microvolt = <5000000>;
57 regulator-max-microvolt = <5000000>; 57 regulator-max-microvolt = <5000000>;
58 enable-active-high; 58 enable-active-high;
59 gpio = <&gpio 236 0>; /* GPIO PDD4 */ 59 gpio = <&gpio TEGRA_GPIO(DD, 4) GPIO_ACTIVE_HIGH>;
60 gpio-open-drain; 60 gpio-open-drain;
61 vin-supply = <&vdd_5v0_reg>; 61 vin-supply = <&vdd_5v0_reg>;
62 }; 62 };
@@ -68,7 +68,7 @@
68 regulator-min-microvolt = <5000000>; 68 regulator-min-microvolt = <5000000>;
69 regulator-max-microvolt = <5000000>; 69 regulator-max-microvolt = <5000000>;
70 enable-active-high; 70 enable-active-high;
71 gpio = <&pmic 8 0>; 71 gpio = <&pmic 8 GPIO_ACTIVE_HIGH>;
72 }; 72 };
73 73
74 vdd_bl_reg: regulator@105 { 74 vdd_bl_reg: regulator@105 {
@@ -80,7 +80,7 @@
80 regulator-always-on; 80 regulator-always-on;
81 regulator-boot-on; 81 regulator-boot-on;
82 enable-active-high; 82 enable-active-high;
83 gpio = <&gpio 234 0>; /* GPIO PDD2 */ 83 gpio = <&gpio TEGRA_GPIO(DD, 2) GPIO_ACTIVE_HIGH>;
84 }; 84 };
85 85
86 vdd_bl2_reg: regulator@106 { 86 vdd_bl2_reg: regulator@106 {
@@ -92,13 +92,13 @@
92 regulator-always-on; 92 regulator-always-on;
93 regulator-boot-on; 93 regulator-boot-on;
94 enable-active-high; 94 enable-active-high;
95 gpio = <&gpio 232 0>; /* GPIO PDD0 */ 95 gpio = <&gpio TEGRA_GPIO(DD, 0) GPIO_ACTIVE_HIGH>;
96 }; 96 };
97 }; 97 };
98 98
99 sdhci@78000400 { 99 sdhci@78000400 {
100 status = "okay"; 100 status = "okay";
101 power-gpios = <&gpio 27 0>; /* gpio PD3 */ 101 power-gpios = <&gpio TEGRA_GPIO(D, 3) GPIO_ACTIVE_HIGH>;
102 bus-width = <4>; 102 bus-width = <4>;
103 keep-power-in-suspend; 103 keep-power-in-suspend;
104 }; 104 };
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index 01b4c26fad96..f65b53d32416 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -1,4 +1,4 @@
1/include/ "tegra30.dtsi" 1#include "tegra30.dtsi"
2 2
3/** 3/**
4 * This file contains common DT entry for all fab version of Cardhu. 4 * This file contains common DT entry for all fab version of Cardhu.
@@ -146,7 +146,7 @@
146 compatible = "isil,isl29028"; 146 compatible = "isil,isl29028";
147 reg = <0x44>; 147 reg = <0x44>;
148 interrupt-parent = <&gpio>; 148 interrupt-parent = <&gpio>;
149 interrupts = <88 0x04>; /*gpio PL0 */ 149 interrupts = <TEGRA_GPIO(L, 0) IRQ_TYPE_LEVEL_HIGH>;
150 }; 150 };
151 }; 151 };
152 152
@@ -163,7 +163,7 @@
163 compatible = "wlf,wm8903"; 163 compatible = "wlf,wm8903";
164 reg = <0x1a>; 164 reg = <0x1a>;
165 interrupt-parent = <&gpio>; 165 interrupt-parent = <&gpio>;
166 interrupts = <179 0x04>; /* gpio PW3 */ 166 interrupts = <TEGRA_GPIO(W, 3) IRQ_TYPE_LEVEL_HIGH>;
167 167
168 gpio-controller; 168 gpio-controller;
169 #gpio-cells = <2>; 169 #gpio-cells = <2>;
@@ -190,7 +190,7 @@
190 compatible = "ti,tps65911"; 190 compatible = "ti,tps65911";
191 reg = <0x2d>; 191 reg = <0x2d>;
192 192
193 interrupts = <0 86 0x4>; 193 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
194 #interrupt-cells = <2>; 194 #interrupt-cells = <2>;
195 interrupt-controller; 195 interrupt-controller;
196 196
@@ -318,9 +318,9 @@
318 318
319 sdhci@78000000 { 319 sdhci@78000000 {
320 status = "okay"; 320 status = "okay";
321 cd-gpios = <&gpio 69 1>; /* gpio PI5 */ 321 cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>;
322 wp-gpios = <&gpio 155 0>; /* gpio PT3 */ 322 wp-gpios = <&gpio TEGRA_GPIO(T, 3) GPIO_ACTIVE_HIGH>;
323 power-gpios = <&gpio 31 0>; /* gpio PD7 */ 323 power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>;
324 bus-width = <4>; 324 bus-width = <4>;
325 }; 325 };
326 326
@@ -364,7 +364,7 @@
364 regulator-min-microvolt = <1800000>; 364 regulator-min-microvolt = <1800000>;
365 regulator-max-microvolt = <1800000>; 365 regulator-max-microvolt = <1800000>;
366 enable-active-high; 366 enable-active-high;
367 gpio = <&gpio 220 0>; /* gpio PBB4 */ 367 gpio = <&gpio TEGRA_GPIO(BB, 4) GPIO_ACTIVE_HIGH>;
368 vin-supply = <&vio_reg>; 368 vin-supply = <&vio_reg>;
369 }; 369 };
370 370
@@ -377,7 +377,7 @@
377 regulator-boot-on; 377 regulator-boot-on;
378 regulator-always-on; 378 regulator-always-on;
379 enable-active-high; 379 enable-active-high;
380 gpio = <&pmic 0 0>; /* PMIC TPS65911 GPIO0 */ 380 gpio = <&pmic 0 GPIO_ACTIVE_HIGH>;
381 }; 381 };
382 382
383 emmc_3v3_reg: regulator@3 { 383 emmc_3v3_reg: regulator@3 {
@@ -389,7 +389,7 @@
389 regulator-always-on; 389 regulator-always-on;
390 regulator-boot-on; 390 regulator-boot-on;
391 enable-active-high; 391 enable-active-high;
392 gpio = <&gpio 25 0>; /* gpio PD1 */ 392 gpio = <&gpio TEGRA_GPIO(D, 1) GPIO_ACTIVE_HIGH>;
393 vin-supply = <&sys_3v3_reg>; 393 vin-supply = <&sys_3v3_reg>;
394 }; 394 };
395 395
@@ -400,7 +400,7 @@
400 regulator-min-microvolt = <3300000>; 400 regulator-min-microvolt = <3300000>;
401 regulator-max-microvolt = <3300000>; 401 regulator-max-microvolt = <3300000>;
402 enable-active-high; 402 enable-active-high;
403 gpio = <&gpio 30 0>; /* gpio PD6 */ 403 gpio = <&gpio TEGRA_GPIO(D, 6) GPIO_ACTIVE_HIGH>;
404 }; 404 };
405 405
406 pex_hvdd_3v3_reg: regulator@5 { 406 pex_hvdd_3v3_reg: regulator@5 {
@@ -410,7 +410,7 @@
410 regulator-min-microvolt = <3300000>; 410 regulator-min-microvolt = <3300000>;
411 regulator-max-microvolt = <3300000>; 411 regulator-max-microvolt = <3300000>;
412 enable-active-high; 412 enable-active-high;
413 gpio = <&gpio 95 0>; /* gpio PL7 */ 413 gpio = <&gpio TEGRA_GPIO(L, 7) GPIO_ACTIVE_HIGH>;
414 vin-supply = <&sys_3v3_reg>; 414 vin-supply = <&sys_3v3_reg>;
415 }; 415 };
416 416
@@ -421,7 +421,7 @@
421 regulator-min-microvolt = <2800000>; 421 regulator-min-microvolt = <2800000>;
422 regulator-max-microvolt = <2800000>; 422 regulator-max-microvolt = <2800000>;
423 enable-active-high; 423 enable-active-high;
424 gpio = <&gpio 142 0>; /* gpio PR6 */ 424 gpio = <&gpio TEGRA_GPIO(R, 6) GPIO_ACTIVE_HIGH>;
425 vin-supply = <&sys_3v3_reg>; 425 vin-supply = <&sys_3v3_reg>;
426 }; 426 };
427 427
@@ -432,7 +432,7 @@
432 regulator-min-microvolt = <2800000>; 432 regulator-min-microvolt = <2800000>;
433 regulator-max-microvolt = <2800000>; 433 regulator-max-microvolt = <2800000>;
434 enable-active-high; 434 enable-active-high;
435 gpio = <&gpio 143 0>; /* gpio PR7 */ 435 gpio = <&gpio TEGRA_GPIO(R, 7) GPIO_ACTIVE_HIGH>;
436 vin-supply = <&sys_3v3_reg>; 436 vin-supply = <&sys_3v3_reg>;
437 }; 437 };
438 438
@@ -443,7 +443,7 @@
443 regulator-min-microvolt = <3300000>; 443 regulator-min-microvolt = <3300000>;
444 regulator-max-microvolt = <3300000>; 444 regulator-max-microvolt = <3300000>;
445 enable-active-high; 445 enable-active-high;
446 gpio = <&gpio 144 0>; /* gpio PS0 */ 446 gpio = <&gpio TEGRA_GPIO(S, 0) GPIO_ACTIVE_HIGH>;
447 vin-supply = <&sys_3v3_reg>; 447 vin-supply = <&sys_3v3_reg>;
448 }; 448 };
449 449
@@ -456,7 +456,7 @@
456 regulator-always-on; 456 regulator-always-on;
457 regulator-boot-on; 457 regulator-boot-on;
458 enable-active-high; 458 enable-active-high;
459 gpio = <&gpio 24 0>; /* gpio PD0 */ 459 gpio = <&gpio TEGRA_GPIO(D, 0) GPIO_ACTIVE_HIGH>;
460 vin-supply = <&sys_3v3_reg>; 460 vin-supply = <&sys_3v3_reg>;
461 }; 461 };
462 462
@@ -467,7 +467,7 @@
467 regulator-min-microvolt = <3300000>; 467 regulator-min-microvolt = <3300000>;
468 regulator-max-microvolt = <3300000>; 468 regulator-max-microvolt = <3300000>;
469 enable-active-high; 469 enable-active-high;
470 gpio = <&gpio 94 0>; /* gpio PL6 */ 470 gpio = <&gpio TEGRA_GPIO(L, 6) GPIO_ACTIVE_HIGH>;
471 vin-supply = <&sys_3v3_reg>; 471 vin-supply = <&sys_3v3_reg>;
472 }; 472 };
473 473
@@ -480,7 +480,7 @@
480 regulator-always-on; 480 regulator-always-on;
481 regulator-boot-on; 481 regulator-boot-on;
482 enable-active-high; 482 enable-active-high;
483 gpio = <&gpio 92 0>; /* gpio PL4 */ 483 gpio = <&gpio TEGRA_GPIO(L, 4) GPIO_ACTIVE_HIGH>;
484 vin-supply = <&sys_3v3_reg>; 484 vin-supply = <&sys_3v3_reg>;
485 }; 485 };
486 486
@@ -491,7 +491,7 @@
491 regulator-min-microvolt = <5000000>; 491 regulator-min-microvolt = <5000000>;
492 regulator-max-microvolt = <5000000>; 492 regulator-max-microvolt = <5000000>;
493 enable-active-high; 493 enable-active-high;
494 gpio = <&gpio 152 0>; /* GPIO PT0 */ 494 gpio = <&gpio TEGRA_GPIO(T, 0) GPIO_ACTIVE_HIGH>;
495 gpio-open-drain; 495 gpio-open-drain;
496 vin-supply = <&vdd_5v0_reg>; 496 vin-supply = <&vdd_5v0_reg>;
497 }; 497 };
@@ -515,10 +515,13 @@
515 nvidia,i2s-controller = <&tegra_i2s1>; 515 nvidia,i2s-controller = <&tegra_i2s1>;
516 nvidia,audio-codec = <&wm8903>; 516 nvidia,audio-codec = <&wm8903>;
517 517
518 nvidia,spkr-en-gpios = <&wm8903 2 0>; 518 nvidia,spkr-en-gpios = <&wm8903 2 GPIO_ACTIVE_HIGH>;
519 nvidia,hp-det-gpios = <&gpio 178 0>; /* gpio PW2 */ 519 nvidia,hp-det-gpios = <&gpio TEGRA_GPIO(W, 2)
520 GPIO_ACTIVE_HIGH>;
520 521
521 clocks = <&tegra_car 184>, <&tegra_car 185>, <&tegra_car 120>; 522 clocks = <&tegra_car TEGRA30_CLK_PLL_A>,
523 <&tegra_car TEGRA30_CLK_PLL_A_OUT0>,
524 <&tegra_car TEGRA30_CLK_EXTERN1>;
522 clock-names = "pll_a", "pll_a_out0", "mclk"; 525 clock-names = "pll_a", "pll_a_out0", "mclk";
523 }; 526 };
524}; 527};
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index 15ded605142a..d8783f0fae63 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -1,4 +1,8 @@
1/include/ "skeleton.dtsi" 1#include <dt-bindings/clock/tegra30-car.h>
2#include <dt-bindings/gpio/tegra-gpio.h>
3#include <dt-bindings/interrupt-controller/arm-gic.h>
4
5#include "skeleton.dtsi"
2 6
3/ { 7/ {
4 compatible = "nvidia,tegra30"; 8 compatible = "nvidia,tegra30";
@@ -15,9 +19,9 @@
15 host1x { 19 host1x {
16 compatible = "nvidia,tegra30-host1x", "simple-bus"; 20 compatible = "nvidia,tegra30-host1x", "simple-bus";
17 reg = <0x50000000 0x00024000>; 21 reg = <0x50000000 0x00024000>;
18 interrupts = <0 65 0x04 /* mpcore syncpt */ 22 interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>, /* syncpt */
19 0 67 0x04>; /* mpcore general */ 23 <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>; /* general */
20 clocks = <&tegra_car 28>; 24 clocks = <&tegra_car TEGRA30_CLK_HOST1X>;
21 25
22 #address-cells = <1>; 26 #address-cells = <1>;
23 #size-cells = <1>; 27 #size-cells = <1>;
@@ -27,36 +31,36 @@
27 mpe { 31 mpe {
28 compatible = "nvidia,tegra30-mpe"; 32 compatible = "nvidia,tegra30-mpe";
29 reg = <0x54040000 0x00040000>; 33 reg = <0x54040000 0x00040000>;
30 interrupts = <0 68 0x04>; 34 interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
31 clocks = <&tegra_car 60>; 35 clocks = <&tegra_car TEGRA30_CLK_MPE>;
32 }; 36 };
33 37
34 vi { 38 vi {
35 compatible = "nvidia,tegra30-vi"; 39 compatible = "nvidia,tegra30-vi";
36 reg = <0x54080000 0x00040000>; 40 reg = <0x54080000 0x00040000>;
37 interrupts = <0 69 0x04>; 41 interrupts = <GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
38 clocks = <&tegra_car 164>; 42 clocks = <&tegra_car TEGRA30_CLK_VI>;
39 }; 43 };
40 44
41 epp { 45 epp {
42 compatible = "nvidia,tegra30-epp"; 46 compatible = "nvidia,tegra30-epp";
43 reg = <0x540c0000 0x00040000>; 47 reg = <0x540c0000 0x00040000>;
44 interrupts = <0 70 0x04>; 48 interrupts = <GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>;
45 clocks = <&tegra_car 19>; 49 clocks = <&tegra_car TEGRA30_CLK_EPP>;
46 }; 50 };
47 51
48 isp { 52 isp {
49 compatible = "nvidia,tegra30-isp"; 53 compatible = "nvidia,tegra30-isp";
50 reg = <0x54100000 0x00040000>; 54 reg = <0x54100000 0x00040000>;
51 interrupts = <0 71 0x04>; 55 interrupts = <GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>;
52 clocks = <&tegra_car 23>; 56 clocks = <&tegra_car TEGRA30_CLK_ISP>;
53 }; 57 };
54 58
55 gr2d { 59 gr2d {
56 compatible = "nvidia,tegra30-gr2d"; 60 compatible = "nvidia,tegra30-gr2d";
57 reg = <0x54140000 0x00040000>; 61 reg = <0x54140000 0x00040000>;
58 interrupts = <0 72 0x04>; 62 interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
59 clocks = <&tegra_car 21>; 63 clocks = <&tegra_car TEGRA30_CLK_GR2D>;
60 }; 64 };
61 65
62 gr3d { 66 gr3d {
@@ -69,8 +73,9 @@
69 dc@54200000 { 73 dc@54200000 {
70 compatible = "nvidia,tegra30-dc"; 74 compatible = "nvidia,tegra30-dc";
71 reg = <0x54200000 0x00040000>; 75 reg = <0x54200000 0x00040000>;
72 interrupts = <0 73 0x04>; 76 interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
73 clocks = <&tegra_car 27>, <&tegra_car 179>; 77 clocks = <&tegra_car TEGRA30_CLK_DISP1>,
78 <&tegra_car TEGRA30_CLK_PLL_P>;
74 clock-names = "disp1", "parent"; 79 clock-names = "disp1", "parent";
75 80
76 rgb { 81 rgb {
@@ -81,8 +86,9 @@
81 dc@54240000 { 86 dc@54240000 {
82 compatible = "nvidia,tegra30-dc"; 87 compatible = "nvidia,tegra30-dc";
83 reg = <0x54240000 0x00040000>; 88 reg = <0x54240000 0x00040000>;
84 interrupts = <0 74 0x04>; 89 interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
85 clocks = <&tegra_car 26>, <&tegra_car 179>; 90 clocks = <&tegra_car TEGRA30_CLK_DISP2>,
91 <&tegra_car TEGRA30_CLK_PLL_P>;
86 clock-names = "disp2", "parent"; 92 clock-names = "disp2", "parent";
87 93
88 rgb { 94 rgb {
@@ -93,8 +99,9 @@
93 hdmi { 99 hdmi {
94 compatible = "nvidia,tegra30-hdmi"; 100 compatible = "nvidia,tegra30-hdmi";
95 reg = <0x54280000 0x00040000>; 101 reg = <0x54280000 0x00040000>;
96 interrupts = <0 75 0x04>; 102 interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
97 clocks = <&tegra_car 51>, <&tegra_car 189>; 103 clocks = <&tegra_car TEGRA30_CLK_HDMI>,
104 <&tegra_car TEGRA30_CLK_PLL_D2_OUT0>;
98 clock-names = "hdmi", "parent"; 105 clock-names = "hdmi", "parent";
99 status = "disabled"; 106 status = "disabled";
100 }; 107 };
@@ -102,15 +109,15 @@
102 tvo { 109 tvo {
103 compatible = "nvidia,tegra30-tvo"; 110 compatible = "nvidia,tegra30-tvo";
104 reg = <0x542c0000 0x00040000>; 111 reg = <0x542c0000 0x00040000>;
105 interrupts = <0 76 0x04>; 112 interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
106 clocks = <&tegra_car 169>; 113 clocks = <&tegra_car TEGRA30_CLK_TVO>;
107 status = "disabled"; 114 status = "disabled";
108 }; 115 };
109 116
110 dsi { 117 dsi {
111 compatible = "nvidia,tegra30-dsi"; 118 compatible = "nvidia,tegra30-dsi";
112 reg = <0x54300000 0x00040000>; 119 reg = <0x54300000 0x00040000>;
113 clocks = <&tegra_car 48>; 120 clocks = <&tegra_car TEGRA30_CLK_DSIA>;
114 status = "disabled"; 121 status = "disabled";
115 }; 122 };
116 }; 123 };
@@ -118,8 +125,9 @@
118 timer@50004600 { 125 timer@50004600 {
119 compatible = "arm,cortex-a9-twd-timer"; 126 compatible = "arm,cortex-a9-twd-timer";
120 reg = <0x50040600 0x20>; 127 reg = <0x50040600 0x20>;
121 interrupts = <1 13 0xf04>; 128 interrupts = <GIC_PPI 13
122 clocks = <&tegra_car 214>; 129 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
130 clocks = <&tegra_car TEGRA30_CLK_TWD>;
123 }; 131 };
124 132
125 intc: interrupt-controller { 133 intc: interrupt-controller {
@@ -142,13 +150,13 @@
142 timer@60005000 { 150 timer@60005000 {
143 compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer"; 151 compatible = "nvidia,tegra30-timer", "nvidia,tegra20-timer";
144 reg = <0x60005000 0x400>; 152 reg = <0x60005000 0x400>;
145 interrupts = <0 0 0x04 153 interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
146 0 1 0x04 154 <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
147 0 41 0x04 155 <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
148 0 42 0x04 156 <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
149 0 121 0x04 157 <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
150 0 122 0x04>; 158 <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
151 clocks = <&tegra_car 5>; 159 clocks = <&tegra_car TEGRA30_CLK_TIMER>;
152 }; 160 };
153 161
154 tegra_car: clock { 162 tegra_car: clock {
@@ -160,39 +168,39 @@
160 apbdma: dma { 168 apbdma: dma {
161 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma"; 169 compatible = "nvidia,tegra30-apbdma", "nvidia,tegra20-apbdma";
162 reg = <0x6000a000 0x1400>; 170 reg = <0x6000a000 0x1400>;
163 interrupts = <0 104 0x04 171 interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>,
164 0 105 0x04 172 <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
165 0 106 0x04 173 <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
166 0 107 0x04 174 <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>,
167 0 108 0x04 175 <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
168 0 109 0x04 176 <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
169 0 110 0x04 177 <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>,
170 0 111 0x04 178 <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
171 0 112 0x04 179 <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
172 0 113 0x04 180 <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>,
173 0 114 0x04 181 <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>,
174 0 115 0x04 182 <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>,
175 0 116 0x04 183 <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>,
176 0 117 0x04 184 <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>,
177 0 118 0x04 185 <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
178 0 119 0x04 186 <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
179 0 128 0x04 187 <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>,
180 0 129 0x04 188 <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>,
181 0 130 0x04 189 <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>,
182 0 131 0x04 190 <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
183 0 132 0x04 191 <GIC_SPI 132 IRQ_TYPE_LEVEL_HIGH>,
184 0 133 0x04 192 <GIC_SPI 133 IRQ_TYPE_LEVEL_HIGH>,
185 0 134 0x04 193 <GIC_SPI 134 IRQ_TYPE_LEVEL_HIGH>,
186 0 135 0x04 194 <GIC_SPI 135 IRQ_TYPE_LEVEL_HIGH>,
187 0 136 0x04 195 <GIC_SPI 136 IRQ_TYPE_LEVEL_HIGH>,
188 0 137 0x04 196 <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>,
189 0 138 0x04 197 <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>,
190 0 139 0x04 198 <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>,
191 0 140 0x04 199 <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
192 0 141 0x04 200 <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>,
193 0 142 0x04 201 <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
194 0 143 0x04>; 202 <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
195 clocks = <&tegra_car 34>; 203 clocks = <&tegra_car TEGRA30_CLK_APBDMA>;
196 }; 204 };
197 205
198 ahb: ahb { 206 ahb: ahb {
@@ -203,14 +211,14 @@
203 gpio: gpio { 211 gpio: gpio {
204 compatible = "nvidia,tegra30-gpio"; 212 compatible = "nvidia,tegra30-gpio";
205 reg = <0x6000d000 0x1000>; 213 reg = <0x6000d000 0x1000>;
206 interrupts = <0 32 0x04 214 interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
207 0 33 0x04 215 <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
208 0 34 0x04 216 <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
209 0 35 0x04 217 <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
210 0 55 0x04 218 <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
211 0 87 0x04 219 <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
212 0 89 0x04 220 <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
213 0 125 0x04>; 221 <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
214 #gpio-cells = <2>; 222 #gpio-cells = <2>;
215 gpio-controller; 223 gpio-controller;
216 #interrupt-cells = <2>; 224 #interrupt-cells = <2>;
@@ -235,9 +243,9 @@
235 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart"; 243 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
236 reg = <0x70006000 0x40>; 244 reg = <0x70006000 0x40>;
237 reg-shift = <2>; 245 reg-shift = <2>;
238 interrupts = <0 36 0x04>; 246 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
239 nvidia,dma-request-selector = <&apbdma 8>; 247 nvidia,dma-request-selector = <&apbdma 8>;
240 clocks = <&tegra_car 6>; 248 clocks = <&tegra_car TEGRA30_CLK_UARTA>;
241 status = "disabled"; 249 status = "disabled";
242 }; 250 };
243 251
@@ -245,9 +253,9 @@
245 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart"; 253 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
246 reg = <0x70006040 0x40>; 254 reg = <0x70006040 0x40>;
247 reg-shift = <2>; 255 reg-shift = <2>;
248 interrupts = <0 37 0x04>; 256 interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
249 nvidia,dma-request-selector = <&apbdma 9>; 257 nvidia,dma-request-selector = <&apbdma 9>;
250 clocks = <&tegra_car 160>; 258 clocks = <&tegra_car TEGRA30_CLK_UARTB>;
251 status = "disabled"; 259 status = "disabled";
252 }; 260 };
253 261
@@ -255,9 +263,9 @@
255 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart"; 263 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
256 reg = <0x70006200 0x100>; 264 reg = <0x70006200 0x100>;
257 reg-shift = <2>; 265 reg-shift = <2>;
258 interrupts = <0 46 0x04>; 266 interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
259 nvidia,dma-request-selector = <&apbdma 10>; 267 nvidia,dma-request-selector = <&apbdma 10>;
260 clocks = <&tegra_car 55>; 268 clocks = <&tegra_car TEGRA30_CLK_UARTC>;
261 status = "disabled"; 269 status = "disabled";
262 }; 270 };
263 271
@@ -265,9 +273,9 @@
265 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart"; 273 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
266 reg = <0x70006300 0x100>; 274 reg = <0x70006300 0x100>;
267 reg-shift = <2>; 275 reg-shift = <2>;
268 interrupts = <0 90 0x04>; 276 interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>;
269 nvidia,dma-request-selector = <&apbdma 19>; 277 nvidia,dma-request-selector = <&apbdma 19>;
270 clocks = <&tegra_car 65>; 278 clocks = <&tegra_car TEGRA30_CLK_UARTD>;
271 status = "disabled"; 279 status = "disabled";
272 }; 280 };
273 281
@@ -275,9 +283,9 @@
275 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart"; 283 compatible = "nvidia,tegra30-uart", "nvidia,tegra20-uart";
276 reg = <0x70006400 0x100>; 284 reg = <0x70006400 0x100>;
277 reg-shift = <2>; 285 reg-shift = <2>;
278 interrupts = <0 91 0x04>; 286 interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
279 nvidia,dma-request-selector = <&apbdma 20>; 287 nvidia,dma-request-selector = <&apbdma 20>;
280 clocks = <&tegra_car 66>; 288 clocks = <&tegra_car TEGRA30_CLK_UARTE>;
281 status = "disabled"; 289 status = "disabled";
282 }; 290 };
283 291
@@ -285,24 +293,25 @@
285 compatible = "nvidia,tegra30-pwm", "nvidia,tegra20-pwm"; 293 compatible = "nvidia,tegra30-pwm", "nvidia,tegra20-pwm";
286 reg = <0x7000a000 0x100>; 294 reg = <0x7000a000 0x100>;
287 #pwm-cells = <2>; 295 #pwm-cells = <2>;
288 clocks = <&tegra_car 17>; 296 clocks = <&tegra_car TEGRA30_CLK_PWM>;
289 status = "disabled"; 297 status = "disabled";
290 }; 298 };
291 299
292 rtc { 300 rtc {
293 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc"; 301 compatible = "nvidia,tegra30-rtc", "nvidia,tegra20-rtc";
294 reg = <0x7000e000 0x100>; 302 reg = <0x7000e000 0x100>;
295 interrupts = <0 2 0x04>; 303 interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
296 clocks = <&tegra_car 4>; 304 clocks = <&tegra_car TEGRA30_CLK_RTC>;
297 }; 305 };
298 306
299 i2c@7000c000 { 307 i2c@7000c000 {
300 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c"; 308 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
301 reg = <0x7000c000 0x100>; 309 reg = <0x7000c000 0x100>;
302 interrupts = <0 38 0x04>; 310 interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
303 #address-cells = <1>; 311 #address-cells = <1>;
304 #size-cells = <0>; 312 #size-cells = <0>;
305 clocks = <&tegra_car 12>, <&tegra_car 182>; 313 clocks = <&tegra_car TEGRA30_CLK_I2C1>,
314 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
306 clock-names = "div-clk", "fast-clk"; 315 clock-names = "div-clk", "fast-clk";
307 status = "disabled"; 316 status = "disabled";
308 }; 317 };
@@ -310,10 +319,11 @@
310 i2c@7000c400 { 319 i2c@7000c400 {
311 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c"; 320 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
312 reg = <0x7000c400 0x100>; 321 reg = <0x7000c400 0x100>;
313 interrupts = <0 84 0x04>; 322 interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
314 #address-cells = <1>; 323 #address-cells = <1>;
315 #size-cells = <0>; 324 #size-cells = <0>;
316 clocks = <&tegra_car 54>, <&tegra_car 182>; 325 clocks = <&tegra_car TEGRA30_CLK_I2C2>,
326 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
317 clock-names = "div-clk", "fast-clk"; 327 clock-names = "div-clk", "fast-clk";
318 status = "disabled"; 328 status = "disabled";
319 }; 329 };
@@ -321,10 +331,11 @@
321 i2c@7000c500 { 331 i2c@7000c500 {
322 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c"; 332 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
323 reg = <0x7000c500 0x100>; 333 reg = <0x7000c500 0x100>;
324 interrupts = <0 92 0x04>; 334 interrupts = <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
325 #address-cells = <1>; 335 #address-cells = <1>;
326 #size-cells = <0>; 336 #size-cells = <0>;
327 clocks = <&tegra_car 67>, <&tegra_car 182>; 337 clocks = <&tegra_car TEGRA30_CLK_I2C3>,
338 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
328 clock-names = "div-clk", "fast-clk"; 339 clock-names = "div-clk", "fast-clk";
329 status = "disabled"; 340 status = "disabled";
330 }; 341 };
@@ -332,10 +343,11 @@
332 i2c@7000c700 { 343 i2c@7000c700 {
333 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c"; 344 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
334 reg = <0x7000c700 0x100>; 345 reg = <0x7000c700 0x100>;
335 interrupts = <0 120 0x04>; 346 interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
336 #address-cells = <1>; 347 #address-cells = <1>;
337 #size-cells = <0>; 348 #size-cells = <0>;
338 clocks = <&tegra_car 103>, <&tegra_car 182>; 349 clocks = <&tegra_car TEGRA30_CLK_I2C4>,
350 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
339 clock-names = "div-clk", "fast-clk"; 351 clock-names = "div-clk", "fast-clk";
340 status = "disabled"; 352 status = "disabled";
341 }; 353 };
@@ -343,10 +355,11 @@
343 i2c@7000d000 { 355 i2c@7000d000 {
344 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c"; 356 compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
345 reg = <0x7000d000 0x100>; 357 reg = <0x7000d000 0x100>;
346 interrupts = <0 53 0x04>; 358 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
347 #address-cells = <1>; 359 #address-cells = <1>;
348 #size-cells = <0>; 360 #size-cells = <0>;
349 clocks = <&tegra_car 47>, <&tegra_car 182>; 361 clocks = <&tegra_car TEGRA30_CLK_I2C5>,
362 <&tegra_car TEGRA30_CLK_PLL_P_OUT3>;
350 clock-names = "div-clk", "fast-clk"; 363 clock-names = "div-clk", "fast-clk";
351 status = "disabled"; 364 status = "disabled";
352 }; 365 };
@@ -354,81 +367,81 @@
354 spi@7000d400 { 367 spi@7000d400 {
355 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 368 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
356 reg = <0x7000d400 0x200>; 369 reg = <0x7000d400 0x200>;
357 interrupts = <0 59 0x04>; 370 interrupts = <GIC_SPI 59 IRQ_TYPE_LEVEL_HIGH>;
358 nvidia,dma-request-selector = <&apbdma 15>; 371 nvidia,dma-request-selector = <&apbdma 15>;
359 #address-cells = <1>; 372 #address-cells = <1>;
360 #size-cells = <0>; 373 #size-cells = <0>;
361 clocks = <&tegra_car 41>; 374 clocks = <&tegra_car TEGRA30_CLK_SBC1>;
362 status = "disabled"; 375 status = "disabled";
363 }; 376 };
364 377
365 spi@7000d600 { 378 spi@7000d600 {
366 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 379 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
367 reg = <0x7000d600 0x200>; 380 reg = <0x7000d600 0x200>;
368 interrupts = <0 82 0x04>; 381 interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
369 nvidia,dma-request-selector = <&apbdma 16>; 382 nvidia,dma-request-selector = <&apbdma 16>;
370 #address-cells = <1>; 383 #address-cells = <1>;
371 #size-cells = <0>; 384 #size-cells = <0>;
372 clocks = <&tegra_car 44>; 385 clocks = <&tegra_car TEGRA30_CLK_SBC2>;
373 status = "disabled"; 386 status = "disabled";
374 }; 387 };
375 388
376 spi@7000d800 { 389 spi@7000d800 {
377 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 390 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
378 reg = <0x7000d800 0x200>; 391 reg = <0x7000d800 0x200>;
379 interrupts = <0 83 0x04>; 392 interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
380 nvidia,dma-request-selector = <&apbdma 17>; 393 nvidia,dma-request-selector = <&apbdma 17>;
381 #address-cells = <1>; 394 #address-cells = <1>;
382 #size-cells = <0>; 395 #size-cells = <0>;
383 clocks = <&tegra_car 46>; 396 clocks = <&tegra_car TEGRA30_CLK_SBC3>;
384 status = "disabled"; 397 status = "disabled";
385 }; 398 };
386 399
387 spi@7000da00 { 400 spi@7000da00 {
388 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 401 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
389 reg = <0x7000da00 0x200>; 402 reg = <0x7000da00 0x200>;
390 interrupts = <0 93 0x04>; 403 interrupts = <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>;
391 nvidia,dma-request-selector = <&apbdma 18>; 404 nvidia,dma-request-selector = <&apbdma 18>;
392 #address-cells = <1>; 405 #address-cells = <1>;
393 #size-cells = <0>; 406 #size-cells = <0>;
394 clocks = <&tegra_car 68>; 407 clocks = <&tegra_car TEGRA30_CLK_SBC4>;
395 status = "disabled"; 408 status = "disabled";
396 }; 409 };
397 410
398 spi@7000dc00 { 411 spi@7000dc00 {
399 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 412 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
400 reg = <0x7000dc00 0x200>; 413 reg = <0x7000dc00 0x200>;
401 interrupts = <0 94 0x04>; 414 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
402 nvidia,dma-request-selector = <&apbdma 27>; 415 nvidia,dma-request-selector = <&apbdma 27>;
403 #address-cells = <1>; 416 #address-cells = <1>;
404 #size-cells = <0>; 417 #size-cells = <0>;
405 clocks = <&tegra_car 104>; 418 clocks = <&tegra_car TEGRA30_CLK_SBC5>;
406 status = "disabled"; 419 status = "disabled";
407 }; 420 };
408 421
409 spi@7000de00 { 422 spi@7000de00 {
410 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink"; 423 compatible = "nvidia,tegra30-slink", "nvidia,tegra20-slink";
411 reg = <0x7000de00 0x200>; 424 reg = <0x7000de00 0x200>;
412 interrupts = <0 79 0x04>; 425 interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
413 nvidia,dma-request-selector = <&apbdma 28>; 426 nvidia,dma-request-selector = <&apbdma 28>;
414 #address-cells = <1>; 427 #address-cells = <1>;
415 #size-cells = <0>; 428 #size-cells = <0>;
416 clocks = <&tegra_car 105>; 429 clocks = <&tegra_car TEGRA30_CLK_SBC6>;
417 status = "disabled"; 430 status = "disabled";
418 }; 431 };
419 432
420 kbc { 433 kbc {
421 compatible = "nvidia,tegra30-kbc", "nvidia,tegra20-kbc"; 434 compatible = "nvidia,tegra30-kbc", "nvidia,tegra20-kbc";
422 reg = <0x7000e200 0x100>; 435 reg = <0x7000e200 0x100>;
423 interrupts = <0 85 0x04>; 436 interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
424 clocks = <&tegra_car 36>; 437 clocks = <&tegra_car TEGRA30_CLK_KBC>;
425 status = "disabled"; 438 status = "disabled";
426 }; 439 };
427 440
428 pmc { 441 pmc {
429 compatible = "nvidia,tegra30-pmc"; 442 compatible = "nvidia,tegra30-pmc";
430 reg = <0x7000e400 0x400>; 443 reg = <0x7000e400 0x400>;
431 clocks = <&tegra_car 218>, <&clk32k_in>; 444 clocks = <&tegra_car TEGRA30_CLK_PCLK>, <&clk32k_in>;
432 clock-names = "pclk", "clk32k_in"; 445 clock-names = "pclk", "clk32k_in";
433 }; 446 };
434 447
@@ -438,7 +451,7 @@
438 0x7000f03c 0x1b4 451 0x7000f03c 0x1b4
439 0x7000f200 0x028 452 0x7000f200 0x028
440 0x7000f284 0x17c>; 453 0x7000f284 0x17c>;
441 interrupts = <0 77 0x04>; 454 interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
442 }; 455 };
443 456
444 iommu { 457 iommu {
@@ -455,12 +468,19 @@
455 compatible = "nvidia,tegra30-ahub"; 468 compatible = "nvidia,tegra30-ahub";
456 reg = <0x70080000 0x200 469 reg = <0x70080000 0x200
457 0x70080200 0x100>; 470 0x70080200 0x100>;
458 interrupts = <0 103 0x04>; 471 interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
459 nvidia,dma-request-selector = <&apbdma 1>; 472 nvidia,dma-request-selector = <&apbdma 1>;
460 clocks = <&tegra_car 106>, <&tegra_car 107>, <&tegra_car 30>, 473 clocks = <&tegra_car TEGRA30_CLK_D_AUDIO>,
461 <&tegra_car 11>, <&tegra_car 18>, <&tegra_car 101>, 474 <&tegra_car TEGRA30_CLK_APBIF>,
462 <&tegra_car 102>, <&tegra_car 108>, <&tegra_car 109>, 475 <&tegra_car TEGRA30_CLK_I2S0>,
463 <&tegra_car 110>, <&tegra_car 162>; 476 <&tegra_car TEGRA30_CLK_I2S1>,
477 <&tegra_car TEGRA30_CLK_I2S2>,
478 <&tegra_car TEGRA30_CLK_I2S3>,
479 <&tegra_car TEGRA30_CLK_I2S4>,
480 <&tegra_car TEGRA30_CLK_DAM0>,
481 <&tegra_car TEGRA30_CLK_DAM1>,
482 <&tegra_car TEGRA30_CLK_DAM2>,
483 <&tegra_car TEGRA30_CLK_SPDIF_IN>;
464 clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2", 484 clock-names = "d_audio", "apbif", "i2s0", "i2s1", "i2s2",
465 "i2s3", "i2s4", "dam0", "dam1", "dam2", 485 "i2s3", "i2s4", "dam0", "dam1", "dam2",
466 "spdif_in"; 486 "spdif_in";
@@ -472,7 +492,7 @@
472 compatible = "nvidia,tegra30-i2s"; 492 compatible = "nvidia,tegra30-i2s";
473 reg = <0x70080300 0x100>; 493 reg = <0x70080300 0x100>;
474 nvidia,ahub-cif-ids = <4 4>; 494 nvidia,ahub-cif-ids = <4 4>;
475 clocks = <&tegra_car 30>; 495 clocks = <&tegra_car TEGRA30_CLK_I2S0>;
476 status = "disabled"; 496 status = "disabled";
477 }; 497 };
478 498
@@ -480,7 +500,7 @@
480 compatible = "nvidia,tegra30-i2s"; 500 compatible = "nvidia,tegra30-i2s";
481 reg = <0x70080400 0x100>; 501 reg = <0x70080400 0x100>;
482 nvidia,ahub-cif-ids = <5 5>; 502 nvidia,ahub-cif-ids = <5 5>;
483 clocks = <&tegra_car 11>; 503 clocks = <&tegra_car TEGRA30_CLK_I2S1>;
484 status = "disabled"; 504 status = "disabled";
485 }; 505 };
486 506
@@ -488,7 +508,7 @@
488 compatible = "nvidia,tegra30-i2s"; 508 compatible = "nvidia,tegra30-i2s";
489 reg = <0x70080500 0x100>; 509 reg = <0x70080500 0x100>;
490 nvidia,ahub-cif-ids = <6 6>; 510 nvidia,ahub-cif-ids = <6 6>;
491 clocks = <&tegra_car 18>; 511 clocks = <&tegra_car TEGRA30_CLK_I2S2>;
492 status = "disabled"; 512 status = "disabled";
493 }; 513 };
494 514
@@ -496,7 +516,7 @@
496 compatible = "nvidia,tegra30-i2s"; 516 compatible = "nvidia,tegra30-i2s";
497 reg = <0x70080600 0x100>; 517 reg = <0x70080600 0x100>;
498 nvidia,ahub-cif-ids = <7 7>; 518 nvidia,ahub-cif-ids = <7 7>;
499 clocks = <&tegra_car 101>; 519 clocks = <&tegra_car TEGRA30_CLK_I2S3>;
500 status = "disabled"; 520 status = "disabled";
501 }; 521 };
502 522
@@ -504,7 +524,7 @@
504 compatible = "nvidia,tegra30-i2s"; 524 compatible = "nvidia,tegra30-i2s";
505 reg = <0x70080700 0x100>; 525 reg = <0x70080700 0x100>;
506 nvidia,ahub-cif-ids = <8 8>; 526 nvidia,ahub-cif-ids = <8 8>;
507 clocks = <&tegra_car 102>; 527 clocks = <&tegra_car TEGRA30_CLK_I2S4>;
508 status = "disabled"; 528 status = "disabled";
509 }; 529 };
510 }; 530 };
@@ -512,32 +532,32 @@
512 sdhci@78000000 { 532 sdhci@78000000 {
513 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci"; 533 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci";
514 reg = <0x78000000 0x200>; 534 reg = <0x78000000 0x200>;
515 interrupts = <0 14 0x04>; 535 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
516 clocks = <&tegra_car 14>; 536 clocks = <&tegra_car TEGRA30_CLK_SDMMC1>;
517 status = "disabled"; 537 status = "disabled";
518 }; 538 };
519 539
520 sdhci@78000200 { 540 sdhci@78000200 {
521 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci"; 541 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci";
522 reg = <0x78000200 0x200>; 542 reg = <0x78000200 0x200>;
523 interrupts = <0 15 0x04>; 543 interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
524 clocks = <&tegra_car 9>; 544 clocks = <&tegra_car TEGRA30_CLK_SDMMC2>;
525 status = "disabled"; 545 status = "disabled";
526 }; 546 };
527 547
528 sdhci@78000400 { 548 sdhci@78000400 {
529 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci"; 549 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci";
530 reg = <0x78000400 0x200>; 550 reg = <0x78000400 0x200>;
531 interrupts = <0 19 0x04>; 551 interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
532 clocks = <&tegra_car 69>; 552 clocks = <&tegra_car TEGRA30_CLK_SDMMC3>;
533 status = "disabled"; 553 status = "disabled";
534 }; 554 };
535 555
536 sdhci@78000600 { 556 sdhci@78000600 {
537 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci"; 557 compatible = "nvidia,tegra30-sdhci", "nvidia,tegra20-sdhci";
538 reg = <0x78000600 0x200>; 558 reg = <0x78000600 0x200>;
539 interrupts = <0 31 0x04>; 559 interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
540 clocks = <&tegra_car 15>; 560 clocks = <&tegra_car TEGRA30_CLK_SDMMC4>;
541 status = "disabled"; 561 status = "disabled";
542 }; 562 };
543 563
@@ -572,9 +592,9 @@
572 592
573 pmu { 593 pmu {
574 compatible = "arm,cortex-a9-pmu"; 594 compatible = "arm,cortex-a9-pmu";
575 interrupts = <0 144 0x04 595 interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>,
576 0 145 0x04 596 <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
577 0 146 0x04 597 <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>,
578 0 147 0x04>; 598 <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>;
579 }; 599 };
580}; 600};
diff --git a/arch/arm/boot/dts/tny_a9260.dts b/arch/arm/boot/dts/tny_a9260.dts
index 367a16dcd5ef..dabe232216b4 100644
--- a/arch/arm/boot/dts/tny_a9260.dts
+++ b/arch/arm/boot/dts/tny_a9260.dts
@@ -6,8 +6,8 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9260.dtsi" 9#include "at91sam9260.dtsi"
10/include/ "tny_a9260_common.dtsi" 10#include "tny_a9260_common.dtsi"
11 11
12/ { 12/ {
13 model = "Calao TNY A9260"; 13 model = "Calao TNY A9260";
diff --git a/arch/arm/boot/dts/tny_a9263.dts b/arch/arm/boot/dts/tny_a9263.dts
index dee9c571306b..0751a6a979a8 100644
--- a/arch/arm/boot/dts/tny_a9263.dts
+++ b/arch/arm/boot/dts/tny_a9263.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2 only 6 * Licensed under GPLv2 only
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9263.dtsi" 9#include "at91sam9263.dtsi"
10 10
11/ { 11/ {
12 model = "Calao TNY A9263"; 12 model = "Calao TNY A9263";
@@ -38,7 +38,7 @@
38 }; 38 };
39 39
40 usb1: gadget@fff78000 { 40 usb1: gadget@fff78000 {
41 atmel,vbus-gpio = <&pioB 11 0>; 41 atmel,vbus-gpio = <&pioB 11 GPIO_ACTIVE_HIGH>;
42 status = "okay"; 42 status = "okay";
43 }; 43 };
44 }; 44 };
diff --git a/arch/arm/boot/dts/tny_a9g20.dts b/arch/arm/boot/dts/tny_a9g20.dts
index e1ab64c72dba..8456d70bb42b 100644
--- a/arch/arm/boot/dts/tny_a9g20.dts
+++ b/arch/arm/boot/dts/tny_a9g20.dts
@@ -6,8 +6,8 @@
6 * Licensed under GPLv2. 6 * Licensed under GPLv2.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g20.dtsi" 9#include "at91sam9g20.dtsi"
10/include/ "tny_a9260_common.dtsi" 10#include "tny_a9260_common.dtsi"
11 11
12/ { 12/ {
13 model = "Calao TNY A9G20"; 13 model = "Calao TNY A9G20";
diff --git a/arch/arm/boot/dts/twl4030_omap3.dtsi b/arch/arm/boot/dts/twl4030_omap3.dtsi
new file mode 100644
index 000000000000..c353ef0a6ac7
--- /dev/null
+++ b/arch/arm/boot/dts/twl4030_omap3.dtsi
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2013 Linaro, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9&twl {
10 pinctrl-names = "default";
11 pinctrl-0 = <&twl4030_pins>;
12};
13
14&omap3_pmx_core {
15 /*
16 * On most OMAP3 platforms, the twl4030 IRQ line is connected
17 * to the SYS_NIRQ line on OMAP. Therefore, configure the
18 * defaults for the SYS_NIRQ pin here.
19 */
20 twl4030_pins: pinmux_twl4030_pins {
21 pinctrl-single,pins = <
22 0x1b0 (PIN_INPUT_PULLUP | PIN_OFF_WAKEUPENABLE | MUX_MODE0) /* sys_nirq.sys_nirq */
23 >;
24 };
25};
diff --git a/arch/arm/boot/dts/usb_a9260.dts b/arch/arm/boot/dts/usb_a9260.dts
index 296216058c11..de0c24f5210a 100644
--- a/arch/arm/boot/dts/usb_a9260.dts
+++ b/arch/arm/boot/dts/usb_a9260.dts
@@ -6,8 +6,8 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9260.dtsi" 9#include "at91sam9260.dtsi"
10/include/ "usb_a9260_common.dtsi" 10#include "usb_a9260_common.dtsi"
11 11
12/ { 12/ {
13 model = "Calao USB A9260"; 13 model = "Calao USB A9260";
@@ -20,4 +20,13 @@
20 memory { 20 memory {
21 reg = <0x20000000 0x4000000>; 21 reg = <0x20000000 0x4000000>;
22 }; 22 };
23
24 ahb {
25 apb {
26 shdwc@fffffd10 {
27 atmel,wakeup-counter = <10>;
28 atmel,wakeup-rtt-timer;
29 };
30 };
31 };
23}; 32};
diff --git a/arch/arm/boot/dts/usb_a9260_common.dtsi b/arch/arm/boot/dts/usb_a9260_common.dtsi
index e70d229baef5..285977682cf3 100644
--- a/arch/arm/boot/dts/usb_a9260_common.dtsi
+++ b/arch/arm/boot/dts/usb_a9260_common.dtsi
@@ -30,7 +30,7 @@
30 }; 30 };
31 31
32 usb1: gadget@fffa4000 { 32 usb1: gadget@fffa4000 {
33 atmel,vbus-gpio = <&pioC 5 0>; 33 atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
34 status = "okay"; 34 status = "okay";
35 }; 35 };
36 }; 36 };
@@ -93,7 +93,7 @@
93 93
94 user_led { 94 user_led {
95 label = "user_led"; 95 label = "user_led";
96 gpios = <&pioB 21 1>; 96 gpios = <&pioB 21 GPIO_ACTIVE_LOW>;
97 linux,default-trigger = "heartbeat"; 97 linux,default-trigger = "heartbeat";
98 }; 98 };
99 }; 99 };
@@ -105,7 +105,7 @@
105 105
106 user_pb { 106 user_pb {
107 label = "user_pb"; 107 label = "user_pb";
108 gpios = <&pioB 10 1>; 108 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
109 linux,code = <28>; 109 linux,code = <28>;
110 gpio-key,wakeup; 110 gpio-key,wakeup;
111 }; 111 };
diff --git a/arch/arm/boot/dts/usb_a9263.dts b/arch/arm/boot/dts/usb_a9263.dts
index 6fe05ccb6203..290e60383baf 100644
--- a/arch/arm/boot/dts/usb_a9263.dts
+++ b/arch/arm/boot/dts/usb_a9263.dts
@@ -6,7 +6,7 @@
6 * Licensed under GPLv2 only 6 * Licensed under GPLv2 only
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9263.dtsi" 9#include "at91sam9263.dtsi"
10 10
11/ { 11/ {
12 model = "Calao USB A9263"; 12 model = "Calao USB A9263";
@@ -43,10 +43,24 @@
43 }; 43 };
44 44
45 usb1: gadget@fff78000 { 45 usb1: gadget@fff78000 {
46 atmel,vbus-gpio = <&pioB 11 0>; 46 atmel,vbus-gpio = <&pioB 11 GPIO_ACTIVE_HIGH>;
47 status = "okay"; 47 status = "okay";
48 }; 48 };
49 49
50 spi0: spi@fffa4000 {
51 cs-gpios = <&pioB 15 GPIO_ACTIVE_HIGH>;
52 status = "okay";
53 mtd_dataflash@0 {
54 compatible = "atmel,at45", "atmel,dataflash";
55 reg = <0>;
56 spi-max-frequency = <15000000>;
57 };
58 };
59
60 shdwc@fffffd10 {
61 atmel,wakeup-counter = <10>;
62 atmel,wakeup-rtt-timer;
63 };
50 }; 64 };
51 65
52 nand0: nand@40000000 { 66 nand0: nand@40000000 {
@@ -107,7 +121,7 @@
107 121
108 user_led { 122 user_led {
109 label = "user_led"; 123 label = "user_led";
110 gpios = <&pioB 21 0>; 124 gpios = <&pioB 21 GPIO_ACTIVE_HIGH>;
111 linux,default-trigger = "heartbeat"; 125 linux,default-trigger = "heartbeat";
112 }; 126 };
113 }; 127 };
@@ -119,7 +133,7 @@
119 133
120 user_pb { 134 user_pb {
121 label = "user_pb"; 135 label = "user_pb";
122 gpios = <&pioB 10 1>; 136 gpios = <&pioB 10 GPIO_ACTIVE_LOW>;
123 linux,code = <28>; 137 linux,code = <28>;
124 gpio-key,wakeup; 138 gpio-key,wakeup;
125 }; 139 };
diff --git a/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi b/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi
index ad3eca17c436..5b0ffc1a0b24 100644
--- a/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi
+++ b/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi
@@ -28,39 +28,39 @@
28 28
29 user_led1 { 29 user_led1 {
30 label = "user_led1"; 30 label = "user_led1";
31 gpios = <&pioB 20 1>; 31 gpios = <&pioB 20 GPIO_ACTIVE_LOW>;
32 }; 32 };
33 33
34/* 34/*
35* led already used by mother board but active as high 35* led already used by mother board but active as high
36* user_led2 { 36* user_led2 {
37* label = "user_led2"; 37* label = "user_led2";
38* gpios = <&pioB 21 1>; 38* gpios = <&pioB 21 GPIO_ACTIVE_LOW>;
39* }; 39* };
40*/ 40*/
41 user_led3 { 41 user_led3 {
42 label = "user_led3"; 42 label = "user_led3";
43 gpios = <&pioB 22 1>; 43 gpios = <&pioB 22 GPIO_ACTIVE_LOW>;
44 }; 44 };
45 45
46 user_led4 { 46 user_led4 {
47 label = "user_led4"; 47 label = "user_led4";
48 gpios = <&pioB 23 1>; 48 gpios = <&pioB 23 GPIO_ACTIVE_LOW>;
49 }; 49 };
50 50
51 red { 51 red {
52 label = "red"; 52 label = "red";
53 gpios = <&pioB 24 1>; 53 gpios = <&pioB 24 GPIO_ACTIVE_LOW>;
54 }; 54 };
55 55
56 orange { 56 orange {
57 label = "orange"; 57 label = "orange";
58 gpios = <&pioB 30 1>; 58 gpios = <&pioB 30 GPIO_ACTIVE_LOW>;
59 }; 59 };
60 60
61 green { 61 green {
62 label = "green"; 62 label = "green";
63 gpios = <&pioB 31 1>; 63 gpios = <&pioB 31 GPIO_ACTIVE_LOW>;
64 }; 64 };
65 }; 65 };
66 66
@@ -71,25 +71,25 @@
71 71
72 user_pb1 { 72 user_pb1 {
73 label = "user_pb1"; 73 label = "user_pb1";
74 gpios = <&pioB 25 1>; 74 gpios = <&pioB 25 GPIO_ACTIVE_LOW>;
75 linux,code = <0x100>; 75 linux,code = <0x100>;
76 }; 76 };
77 77
78 user_pb2 { 78 user_pb2 {
79 label = "user_pb2"; 79 label = "user_pb2";
80 gpios = <&pioB 13 1>; 80 gpios = <&pioB 13 GPIO_ACTIVE_LOW>;
81 linux,code = <0x101>; 81 linux,code = <0x101>;
82 }; 82 };
83 83
84 user_pb3 { 84 user_pb3 {
85 label = "user_pb3"; 85 label = "user_pb3";
86 gpios = <&pioA 26 1>; 86 gpios = <&pioA 26 GPIO_ACTIVE_LOW>;
87 linux,code = <0x102>; 87 linux,code = <0x102>;
88 }; 88 };
89 89
90 user_pb4 { 90 user_pb4 {
91 label = "user_pb4"; 91 label = "user_pb4";
92 gpios = <&pioC 9 1>; 92 gpios = <&pioC 9 GPIO_ACTIVE_LOW>;
93 linux,code = <0x103>; 93 linux,code = <0x103>;
94 }; 94 };
95 }; 95 };
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts
index 2dacb16ce4ae..ec77cf8f9695 100644
--- a/arch/arm/boot/dts/usb_a9g20.dts
+++ b/arch/arm/boot/dts/usb_a9g20.dts
@@ -6,25 +6,9 @@
6 * Licensed under GPLv2 or later. 6 * Licensed under GPLv2 or later.
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9/include/ "at91sam9g20.dtsi" 9#include "usb_a9g20_common.dtsi"
10/include/ "usb_a9260_common.dtsi"
11 10
12/ { 11/ {
13 model = "Calao USB A9G20"; 12 model = "Calao USB A9G20";
14 compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; 13 compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9";
15
16 chosen {
17 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
18 };
19
20 memory {
21 reg = <0x20000000 0x4000000>;
22 };
23
24 i2c@0 {
25 rv3029c2@56 {
26 compatible = "rv3029c2";
27 reg = <0x56>;
28 };
29 };
30}; 14};
diff --git a/arch/arm/boot/dts/usb_a9g20_common.dtsi b/arch/arm/boot/dts/usb_a9g20_common.dtsi
new file mode 100644
index 000000000000..0b3b36182fe5
--- /dev/null
+++ b/arch/arm/boot/dts/usb_a9g20_common.dtsi
@@ -0,0 +1,27 @@
1/*
2 * usb_a9g20.dts - Device Tree file for Caloa USB A9G20 board
3 *
4 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include "at91sam9g20.dtsi"
10#include "usb_a9260_common.dtsi"
11
12/ {
13 chosen {
14 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
15 };
16
17 memory {
18 reg = <0x20000000 0x4000000>;
19 };
20
21 i2c@0 {
22 rv3029c2@56 {
23 compatible = "rv3029c2";
24 reg = <0x56>;
25 };
26 };
27};
diff --git a/arch/arm/boot/dts/usb_a9g20_lpw.dts b/arch/arm/boot/dts/usb_a9g20_lpw.dts
new file mode 100644
index 000000000000..f8cb1b9a01c5
--- /dev/null
+++ b/arch/arm/boot/dts/usb_a9g20_lpw.dts
@@ -0,0 +1,31 @@
1/*
2 * usb_a9g20_lpw.dts - Device Tree file for Caloa USB A9G20 Low Power board
3 *
4 * Copyright (C) 2013 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 or later.
7 */
8/dts-v1/;
9#include "usb_a9g20_common.dtsi"
10
11/ {
12 model = "Calao USB A9G20 Low Power";
13 compatible = "calao,usb-a9g20-lpw", "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9";
14
15 ahb {
16 apb {
17 spi1: spi@fffcc000 {
18 cs-gpios = <&pioB 3 GPIO_ACTIVE_HIGH>;
19 status = "okay";
20 mmc-slot@0 {
21 compatible = "mmc-spi-slot";
22 reg = <0>;
23 voltage-ranges = <3200 3400>;
24 spi-max-frequency = <25000000>;
25 interrupt-parent = <&pioC>;
26 interrupts = <4 IRQ_TYPE_EDGE_BOTH>;
27 };
28 };
29 };
30 };
31};
diff --git a/arch/arm/boot/dts/vf610-pinfunc.h b/arch/arm/boot/dts/vf610-pinfunc.h
new file mode 100644
index 000000000000..1ee681f7ce2f
--- /dev/null
+++ b/arch/arm/boot/dts/vf610-pinfunc.h
@@ -0,0 +1,810 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef __DTS_VF610_PINFUNC_H
11#define __DTS_VF610_PINFUNC_H
12
13/*
14 * The pin function ID for VF610 is a tuple of:
15 * <mux_reg input_reg mux_mode input_val>
16 */
17
18#define ALT0 0x0
19#define ALT1 0x1
20#define ALT2 0x2
21#define ALT3 0x3
22#define ALT4 0x4
23#define ALT5 0x5
24#define ALT6 0x6
25#define ALT7 0x7
26
27
28#define VF610_PAD_PTA6__GPIO_0 0x000 0x000 ALT0 0x0
29#define VF610_PAD_PTA6__RMII_CLKOUT 0x000 0x000 ALT1 0x0
30#define VF610_PAD_PTA6__RMII_CLKIN 0x000 0x2F0 ALT2 0x0
31#define VF610_PAD_PTA6__DCU1_TCON11 0x000 0x000 ALT4 0x0
32#define VF610_PAD_PTA6__DCU1_R2 0x000 0x000 ALT7 0x0
33#define VF610_PAD_PTA8__GPIO_1 0x004 0x000 ALT0 0x0
34#define VF610_PAD_PTA8__TCLK 0x004 0x000 ALT1 0x0
35#define VF610_PAD_PTA8__DCU0_R0 0x004 0x000 ALT4 0x0
36#define VF610_PAD_PTA8__MLB_CLK 0x004 0x354 ALT7 0x0
37#define VF610_PAD_PTA9__GPIO_2 0x008 0x000 ALT0 0x0
38#define VF610_PAD_PTA9__TDI 0x008 0x000 ALT1 0x0
39#define VF610_PAD_PTA9__RMII_CLKOUT 0x008 0x000 ALT2 0x0
40#define VF610_PAD_PTA9__RMII_CLKIN 0x008 0x2F0 ALT3 0x1
41#define VF610_PAD_PTA9__DCU0_R1 0x008 0x000 ALT4 0x0
42#define VF610_PAD_PTA9__WDOG_B 0x008 0x000 ALT6 0x0
43#define VF610_PAD_PTA10__GPIO_3 0x00C 0x000 ALT0 0x0
44#define VF610_PAD_PTA10__TDO 0x00C 0x000 ALT1 0x0
45#define VF610_PAD_PTA10__EXT_AUDIO_MCLK 0x00C 0x2EC ALT2 0x0
46#define VF610_PAD_PTA10__DCU0_G0 0x00C 0x000 ALT4 0x0
47#define VF610_PAD_PTA10__ENET_TS_CLKIN 0x00C 0x2F4 ALT6 0x0
48#define VF610_PAD_PTA10__MLB_SIGNAL 0x00C 0x35C ALT7 0x0
49#define VF610_PAD_PTA11__GPIO_4 0x010 0x000 ALT0 0x0
50#define VF610_PAD_PTA11__TMS 0x010 0x000 ALT1 0x0
51#define VF610_PAD_PTA11__DCU0_G1 0x010 0x000 ALT4 0x0
52#define VF610_PAD_PTA11__MLB_DATA 0x010 0x358 ALT7 0x0
53#define VF610_PAD_PTA12__GPIO_5 0x014 0x000 ALT0 0x0
54#define VF610_PAD_PTA12__TRACECK 0x014 0x000 ALT1 0x0
55#define VF610_PAD_PTA12__EXT_AUDIO_MCLK 0x014 0x2EC ALT2 0x1
56#define VF610_PAD_PTA12__VIU_DATA13 0x014 0x000 ALT6 0x0
57#define VF610_PAD_PTA12__I2C0_SCL 0x014 0x33C ALT7 0x0
58#define VF610_PAD_PTA16__GPIO_6 0x018 0x000 ALT0 0x0
59#define VF610_PAD_PTA16__TRACED0 0x018 0x000 ALT1 0x0
60#define VF610_PAD_PTA16__USB0_VBUS_EN 0x018 0x000 ALT2 0x0
61#define VF610_PAD_PTA16__ADC1_SE0 0x018 0x000 ALT3 0x0
62#define VF610_PAD_PTA16__LCD29 0x018 0x000 ALT4 0x0
63#define VF610_PAD_PTA16__SAI2_TX_BCLK 0x018 0x370 ALT5 0x0
64#define VF610_PAD_PTA16__VIU_DATA14 0x018 0x000 ALT6 0x0
65#define VF610_PAD_PTA16__I2C0_SDA 0x018 0x340 ALT7 0x0
66#define VF610_PAD_PTA17__GPIO_7 0x01C 0x000 ALT0 0x0
67#define VF610_PAD_PTA17__TRACED1 0x01C 0x000 ALT1 0x0
68#define VF610_PAD_PTA17__USB0_VBUS_OC 0x01C 0x000 ALT2 0x0
69#define VF610_PAD_PTA17__ADC1_SE1 0x01C 0x000 ALT3 0x0
70#define VF610_PAD_PTA17__LCD30 0x01C 0x000 ALT4 0x0
71#define VF610_PAD_PTA17__USB0_SOF_PULSE 0x01C 0x000 ALT5 0x0
72#define VF610_PAD_PTA17__VIU_DATA15 0x01C 0x000 ALT6 0x0
73#define VF610_PAD_PTA17__I2C1_SCL 0x01C 0x344 ALT7 0x0
74#define VF610_PAD_PTA18__GPIO_8 0x020 0x000 ALT0 0x0
75#define VF610_PAD_PTA18__TRACED2 0x020 0x000 ALT1 0x0
76#define VF610_PAD_PTA18__ADC0_SE0 0x020 0x000 ALT2 0x0
77#define VF610_PAD_PTA18__FTM1_QD_PHA 0x020 0x334 ALT3 0x0
78#define VF610_PAD_PTA18__LCD31 0x020 0x000 ALT4 0x0
79#define VF610_PAD_PTA18__SAI2_TX_DATA 0x020 0x000 ALT5 0x0
80#define VF610_PAD_PTA18__VIU_DATA16 0x020 0x000 ALT6 0x0
81#define VF610_PAD_PTA18__I2C1_SDA 0x020 0x348 ALT7 0x0
82#define VF610_PAD_PTA19__GPIO_9 0x024 0x000 ALT0 0x0
83#define VF610_PAD_PTA19__TRACED3 0x024 0x000 ALT1 0x0
84#define VF610_PAD_PTA19__ADC0_SE1 0x024 0x000 ALT2 0x0
85#define VF610_PAD_PTA19__FTM1_QD_PHB 0x024 0x338 ALT3 0x0
86#define VF610_PAD_PTA19__LCD32 0x024 0x000 ALT4 0x0
87#define VF610_PAD_PTA19__SAI2_TX_SYNC 0x024 0x000 ALT5 0x0
88#define VF610_PAD_PTA19__VIU_DATA17 0x024 0x000 ALT6 0x0
89#define VF610_PAD_PTA19__QSPI1_A_QSCK 0x024 0x374 ALT7 0x0
90#define VF610_PAD_PTA20__GPIO_10 0x028 0x000 ALT0 0x0
91#define VF610_PAD_PTA20__TRACED4 0x028 0x000 ALT1 0x0
92#define VF610_PAD_PTA20__LCD33 0x028 0x000 ALT4 0x0
93#define VF610_PAD_PTA20__UART3_TX 0x028 0x394 ALT6 0x0
94#define VF610_PAD_PTA20__DCU1_HSYNC 0x028 0x000 ALT7 0x0
95#define VF610_PAD_PTA21__GPIO_11 0x02C 0x000 ALT0 0x0
96#define VF610_PAD_PTA21__TRACED5 0x02C 0x000 ALT1 0x0
97#define VF610_PAD_PTA21__SAI2_RX_BCLK 0x02C 0x364 ALT5 0x0
98#define VF610_PAD_PTA21__UART3_RX 0x02C 0x390 ALT6 0x0
99#define VF610_PAD_PTA21__DCU1_VSYNC 0x02C 0x000 ALT7 0x0
100#define VF610_PAD_PTA22__GPIO_12 0x030 0x000 ALT0 0x0
101#define VF610_PAD_PTA22__TRACED6 0x030 0x000 ALT1 0x0
102#define VF610_PAD_PTA22__SAI2_RX_DATA 0x030 0x368 ALT5 0x0
103#define VF610_PAD_PTA22__I2C2_SCL 0x030 0x34C ALT6 0x0
104#define VF610_PAD_PTA22__DCU1_TAG 0x030 0x000 ALT7 0x0
105#define VF610_PAD_PTA23__GPIO_13 0x034 0x000 ALT0 0x0
106#define VF610_PAD_PTA23__TRACED7 0x034 0x000 ALT1 0x0
107#define VF610_PAD_PTA23__SAI2_RX_SYNC 0x034 0x36C ALT5 0x0
108#define VF610_PAD_PTA23__I2C2_SDA 0x034 0x350 ALT6 0x0
109#define VF610_PAD_PTA23__DCU1_DE 0x034 0x000 ALT7 0x0
110#define VF610_PAD_PTA24__GPIO_14 0x038 0x000 ALT0 0x0
111#define VF610_PAD_PTA24__TRACED8 0x038 0x000 ALT1 0x0
112#define VF610_PAD_PTA24__USB1_VBUS_EN 0x038 0x000 ALT2 0x0
113#define VF610_PAD_PTA24__ESDHC1_CLK 0x038 0x000 ALT5 0x0
114#define VF610_PAD_PTA24__DCU1_TCON4 0x038 0x000 ALT6 0x0
115#define VF610_PAD_PTA24__DDR_TEST_PAD_CTRL 0x038 0x000 ALT7 0x0
116#define VF610_PAD_PTA25__GPIO_15 0x03C 0x000 ALT0 0x0
117#define VF610_PAD_PTA25__TRACED9 0x03C 0x000 ALT1 0x0
118#define VF610_PAD_PTA25__USB1_VBUS_OC 0x03C 0x000 ALT2 0x0
119#define VF610_PAD_PTA25__ESDHC1_CMD 0x03C 0x000 ALT5 0x0
120#define VF610_PAD_PTA25__DCU1_TCON5 0x03C 0x000 ALT6 0x0
121#define VF610_PAD_PTA26__GPIO_16 0x040 0x000 ALT0 0x0
122#define VF610_PAD_PTA26__TRACED10 0x040 0x000 ALT1 0x0
123#define VF610_PAD_PTA26__SAI3_TX_BCLK 0x040 0x000 ALT2 0x0
124#define VF610_PAD_PTA26__ESDHC1_DAT0 0x040 0x000 ALT5 0x0
125#define VF610_PAD_PTA26__DCU1_TCON6 0x040 0x000 ALT6 0x0
126#define VF610_PAD_PTA27__GPIO_17 0x044 0x000 ALT0 0x0
127#define VF610_PAD_PTA27__TRACED11 0x044 0x000 ALT1 0x0
128#define VF610_PAD_PTA27__SAI3_RX_BCLK 0x044 0x000 ALT2 0x0
129#define VF610_PAD_PTA27__ESDHC1_DAT1 0x044 0x000 ALT5 0x0
130#define VF610_PAD_PTA27__DCU1_TCON7 0x044 0x000 ALT6 0x0
131#define VF610_PAD_PTA28__GPIO_18 0x048 0x000 ALT0 0x0
132#define VF610_PAD_PTA28__TRACED12 0x048 0x000 ALT1 0x0
133#define VF610_PAD_PTA28__SAI3_RX_DATA 0x048 0x000 ALT2 0x0
134#define VF610_PAD_PTA28__ENET1_1588_TMR0 0x048 0x000 ALT3 0x0
135#define VF610_PAD_PTA28__UART4_TX 0x048 0x000 ALT4 0x0
136#define VF610_PAD_PTA28__ESDHC1_DATA2 0x048 0x000 ALT5 0x0
137#define VF610_PAD_PTA28__DCU1_TCON8 0x048 0x000 ALT6 0x0
138#define VF610_PAD_PTA29__GPIO_19 0x04C 0x000 ALT0 0x0
139#define VF610_PAD_PTA29__TRACED13 0x04C 0x000 ALT1 0x0
140#define VF610_PAD_PTA29__SAI3_TX_DATA 0x04C 0x000 ALT2 0x0
141#define VF610_PAD_PTA29__ENET1_1588_TMR1 0x04C 0x000 ALT3 0x0
142#define VF610_PAD_PTA29__UART4_RX 0x04C 0x000 ALT4 0x0
143#define VF610_PAD_PTA29__ESDHC1_DAT3 0x04C 0x000 ALT5 0x0
144#define VF610_PAD_PTA29__DCU1_TCON9 0x04C 0x000 ALT6 0x0
145#define VF610_PAD_PTA30__GPIO_20 0x050 0x000 ALT0 0x0
146#define VF610_PAD_PTA30__TRACED14 0x050 0x000 ALT1 0x0
147#define VF610_PAD_PTA30__SAI3_RX_SYNC 0x050 0x000 ALT2 0x0
148#define VF610_PAD_PTA30__ENET1_1588_TMR2 0x050 0x000 ALT3 0x0
149#define VF610_PAD_PTA30__UART4_RTS 0x050 0x000 ALT4 0x0
150#define VF610_PAD_PTA30__I2C3_SCL 0x050 0x000 ALT5 0x0
151#define VF610_PAD_PTA30__UART3_TX 0x050 0x394 ALT7 0x1
152#define VF610_PAD_PTA31__GPIO_21 0x054 0x000 ALT0 0x0
153#define VF610_PAD_PTA31__TRACED15 0x054 0x000 ALT1 0x0
154#define VF610_PAD_PTA31__SAI3_TX_SYNC 0x054 0x000 ALT2 0x0
155#define VF610_PAD_PTA31__ENET1_1588_TMR3 0x054 0x000 ALT3 0x0
156#define VF610_PAD_PTA31__UART4_CTS 0x054 0x000 ALT4 0x0
157#define VF610_PAD_PTA31__I2C3_SDA 0x054 0x000 ALT5 0x0
158#define VF610_PAD_PTA31__UART3_RX 0x054 0x390 ALT7 0x1
159#define VF610_PAD_PTB0__GPIO_22 0x058 0x000 ALT0 0x0
160#define VF610_PAD_PTB0__FTM0_CH0 0x058 0x000 ALT1 0x0
161#define VF610_PAD_PTB0__ADC0_SE2 0x058 0x000 ALT2 0x0
162#define VF610_PAD_PTB0__TRACE_CTL 0x058 0x000 ALT3 0x0
163#define VF610_PAD_PTB0__LCD34 0x058 0x000 ALT4 0x0
164#define VF610_PAD_PTB0__SAI2_RX_BCLK 0x058 0x364 ALT5 0x1
165#define VF610_PAD_PTB0__VIU_DATA18 0x058 0x000 ALT6 0x0
166#define VF610_PAD_PTB0__QSPI1_A_QPCS0 0x058 0x000 ALT7 0x0
167#define VF610_PAD_PTB1__GPIO_23 0x05C 0x000 ALT0 0x0
168#define VF610_PAD_PTB1__FTM0_CH1 0x05C 0x000 ALT1 0x0
169#define VF610_PAD_PTB1__ADC0_SE3 0x05C 0x000 ALT2 0x0
170#define VF610_PAD_PTB1__SRC_RCON30 0x05C 0x000 ALT3 0x0
171#define VF610_PAD_PTB1__LCD35 0x05C 0x000 ALT4 0x0
172#define VF610_PAD_PTB1__SAI2_RX_DATA 0x05C 0x368 ALT5 0x1
173#define VF610_PAD_PTB1__VIU_DATA19 0x05C 0x000 ALT6 0x0
174#define VF610_PAD_PTB1__QSPI1_A_DATA3 0x05C 0x000 ALT7 0x0
175#define VF610_PAD_PTB2__GPIO_24 0x060 0x000 ALT0 0x0
176#define VF610_PAD_PTB2__FTM0_CH2 0x060 0x000 ALT1 0x0
177#define VF610_PAD_PTB2__ADC1_SE2 0x060 0x000 ALT2 0x0
178#define VF610_PAD_PTB2__SRC_RCON31 0x060 0x000 ALT3 0x0
179#define VF610_PAD_PTB2__LCD36 0x060 0x000 ALT4 0x0
180#define VF610_PAD_PTB2__SAI2_RX_SYNC 0x060 0x36C ALT5 0x1
181#define VF610_PAD_PTB2__VIDEO_IN0_DATA20 0x060 0x000 ALT6 0x0
182#define VF610_PAD_PTB2__QSPI1_A_DATA2 0x060 0x000 ALT7 0x0
183#define VF610_PAD_PTB3__GPIO_25 0x064 0x000 ALT0 0x0
184#define VF610_PAD_PTB3__FTM0_CH3 0x064 0x000 ALT1 0x0
185#define VF610_PAD_PTB3__ADC1_SE3 0x064 0x000 ALT2 0x0
186#define VF610_PAD_PTB3__PDB_EXTRIG 0x064 0x000 ALT3 0x0
187#define VF610_PAD_PTB3__LCD37 0x064 0x000 ALT4 0x0
188#define VF610_PAD_PTB3__VIU_DATA21 0x064 0x000 ALT6 0x0
189#define VF610_PAD_PTB3__QSPI1_A_DATA1 0x064 0x000 ALT7 0x0
190#define VF610_PAD_PTB4__GPIO_26 0x068 0x000 ALT0 0x0
191#define VF610_PAD_PTB4__FTM0_CH4 0x068 0x000 ALT1 0x0
192#define VF610_PAD_PTB4__UART1_TX 0x068 0x380 ALT2 0x0
193#define VF610_PAD_PTB4__ADC0_SE4 0x068 0x000 ALT3 0x0
194#define VF610_PAD_PTB4__LCD38 0x068 0x000 ALT4 0x0
195#define VF610_PAD_PTB4__VIU_FID 0x068 0x3A8 ALT5 0x0
196#define VF610_PAD_PTB4__VIU_DATA22 0x068 0x000 ALT6 0x0
197#define VF610_PAD_PTB4__QSPI1_A_DATA0 0x068 0x000 ALT7 0x0
198#define VF610_PAD_PTB5__GPIO_27 0x06C 0x000 ALT0 0x0
199#define VF610_PAD_PTB5__FTM0_CH5 0x06C 0x000 ALT1 0x0
200#define VF610_PAD_PTB5__UART1_RX 0x06C 0x37C ALT2 0x0
201#define VF610_PAD_PTB5__ADC1_SE4 0x06C 0x000 ALT3 0x0
202#define VF610_PAD_PTB5__LCD39 0x06C 0x000 ALT4 0x0
203#define VF610_PAD_PTB5__VIU_DE 0x06C 0x3A4 ALT5 0x0
204#define VF610_PAD_PTB5__QSPI1_A_DQS 0x06C 0x000 ALT7 0x0
205#define VF610_PAD_PTB6__GPIO_28 0x070 0x000 ALT0 0x0
206#define VF610_PAD_PTB6__FTM0_CH6 0x070 0x000 ALT1 0x0
207#define VF610_PAD_PTB6__UART1_RTS 0x070 0x000 ALT2 0x0
208#define VF610_PAD_PTB6__QSPI0_QPCS1_A 0x070 0x000 ALT3 0x0
209#define VF610_PAD_PTB6__LCD_LCD40 0x070 0x000 ALT4 0x0
210#define VF610_PAD_PTB6__FB_CLKOUT 0x070 0x000 ALT5 0x0
211#define VF610_PAD_PTB6__VIU_HSYNC 0x070 0x000 ALT6 0x0
212#define VF610_PAD_PTB6__UART2_TX 0x070 0x38C ALT7 0x0
213#define VF610_PAD_PTB7__GPIO_29 0x074 0x000 ALT0 0x0
214#define VF610_PAD_PTB7__FTM0_CH7 0x074 0x000 ALT1 0x0
215#define VF610_PAD_PTB7__UART1_CTS 0x074 0x378 ALT2 0x0
216#define VF610_PAD_PTB7__QSPI0_B_QPCS1 0x074 0x000 ALT3 0x0
217#define VF610_PAD_PTB7__LCD41 0x074 0x000 ALT4 0x0
218#define VF610_PAD_PTB7__VIU_VSYNC 0x074 0x000 ALT6 0x0
219#define VF610_PAD_PTB7__UART2_RX 0x074 0x388 ALT7 0x0
220#define VF610_PAD_PTB8__GPIO_30 0x078 0x000 ALT0 0x0
221#define VF610_PAD_PTB8__FTM1_CH0 0x078 0x32C ALT1 0x0
222#define VF610_PAD_PTB8__FTM1_QD_PHA 0x078 0x334 ALT3 0x1
223#define VF610_PAD_PTB8__VIU_DE 0x078 0x3A4 ALT5 0x1
224#define VF610_PAD_PTB8__DCU1_R6 0x078 0x000 ALT7 0x0
225#define VF610_PAD_PTB9__GPIO_31 0x07C 0x000 ALT0 0x0
226#define VF610_PAD_PTB9__FTM1_CH1 0x07C 0x330 ALT1 0x0
227#define VF610_PAD_PTB9__FTM1_QD_PHB 0x07C 0x338 ALT3 0x1
228#define VF610_PAD_PTB9__DCU1_R7 0x07C 0x000 ALT7 0x0
229#define VF610_PAD_PTB10__GPIO_32 0x080 0x000 ALT0 0x0
230#define VF610_PAD_PTB10__UART0_TX 0x080 0x000 ALT1 0x0
231#define VF610_PAD_PTB10__DCU0_TCON4 0x080 0x000 ALT4 0x0
232#define VF610_PAD_PTB10__VIU_DE 0x080 0x3A4 ALT5 0x2
233#define VF610_PAD_PTB10__CKO1 0x080 0x000 ALT6 0x0
234#define VF610_PAD_PTB10__ENET_TS_CLKIN 0x080 0x2F4 ALT7 0x1
235#define VF610_PAD_PTB11__GPIO_33 0x084 0x000 ALT0 0x0
236#define VF610_PAD_PTB11__UART0_RX 0x084 0x000 ALT1 0x0
237#define VF610_PAD_PTB11__DCU0_TCON5 0x084 0x000 ALT4 0x0
238#define VF610_PAD_PTB11__SNVS_ALARM_OUT_B 0x084 0x000 ALT5 0x0
239#define VF610_PAD_PTB11__CKO2 0x084 0x000 ALT6 0x0
240#define VF610_PAD_PTB11_ENET0_1588_TMR0 0x084 0x304 ALT7 0x0
241#define VF610_PAD_PTB12__GPIO_34 0x088 0x000 ALT0 0x0
242#define VF610_PAD_PTB12__UART0_RTS 0x088 0x000 ALT1 0x0
243#define VF610_PAD_PTB12__DSPI0_CS5 0x088 0x000 ALT3 0x0
244#define VF610_PAD_PTB12__DCU0_TCON6 0x088 0x000 ALT4 0x0
245#define VF610_PAD_PTB12__FB_AD1 0x088 0x000 ALT5 0x0
246#define VF610_PAD_PTB12__NMI 0x088 0x000 ALT6 0x0
247#define VF610_PAD_PTB12__ENET0_1588_TMR1 0x088 0x308 ALT7 0x0
248#define VF610_PAD_PTB13__GPIO_35 0x08C 0x000 ALT0 0x0
249#define VF610_PAD_PTB13__UART0_CTS 0x08C 0x000 ALT1 0x0
250#define VF610_PAD_PTB13__DSPI0_CS4 0x08C 0x000 ALT3 0x0
251#define VF610_PAD_PTB13__DCU0_TCON7 0x08C 0x000 ALT4 0x0
252#define VF610_PAD_PTB13__FB_AD0 0x08C 0x000 ALT5 0x0
253#define VF610_PAD_PTB13__TRACE_CTL 0x08C 0x000 ALT6 0x0
254#define VF610_PAD_PTB14__GPIO_36 0x090 0x000 ALT0 0x0
255#define VF610_PAD_PTB14__CAN0_RX 0x090 0x000 ALT1 0x0
256#define VF610_PAD_PTB14__I2C0_SCL 0x090 0x33C ALT2 0x1
257#define VF610_PAD_PTB14__DCU0_TCON8 0x090 0x000 ALT4 0x0
258#define VF610_PAD_PTB14__DCU1_PCLK 0x090 0x000 ALT7 0x0
259#define VF610_PAD_PTB15__GPIO_37 0x094 0x000 ALT0 0x0
260#define VF610_PAD_PTB15__CAN0_TX 0x094 0x000 ALT1 0x0
261#define VF610_PAD_PTB15__I2C0_SDA 0x094 0x340 ALT2 0x1
262#define VF610_PAD_PTB15__DCU0_TCON9 0x094 0x000 ALT4 0x0
263#define VF610_PAD_PTB15__VIU_PIX_CLK 0x094 0x3AC ALT7 0x0
264#define VF610_PAD_PTB16__GPIO_38 0x098 0x000 ALT0 0x0
265#define VF610_PAD_PTB16__CAN1_RX 0x098 0x000 ALT1 0x0
266#define VF610_PAD_PTB16__I2C1_SCL 0x098 0x344 ALT2 0x1
267#define VF610_PAD_PTB16__DCU0_TCON10 0x098 0x000 ALT4 0x0
268#define VF610_PAD_PTB17__GPIO_39 0x09C 0x000 ALT0 0x0
269#define VF610_PAD_PTB17__CAN1_TX 0x09C 0x000 ALT1 0x0
270#define VF610_PAD_PTB17__I2C1_SDA 0x09C 0x348 ALT2 0x1
271#define VF610_PAD_PTB17__DCU0_TCON11 0x09C 0x000 ALT4 0x0
272#define VF610_PAD_PTB18__GPIO_40 0x0A0 0x000 ALT0 0x0
273#define VF610_PAD_PTB18__DSPI0_CS1 0x0A0 0x000 ALT1 0x0
274#define VF610_PAD_PTB18__EXT_AUDIO_MCLK 0x0A0 0x2EC ALT2 0x2
275#define VF610_PAD_PTB18__VIU_DATA9 0x0A0 0x000 ALT6 0x0
276#define VF610_PAD_PTB19__GPIO_41 0x0A4 0x000 ALT0 0x0
277#define VF610_PAD_PTB19__DSPI0_CS0 0x0A4 0x000 ALT1 0x0
278#define VF610_PAD_PTB19__VIU_DATA10 0x0A4 0x000 ALT6 0x0
279#define VF610_PAD_PTB20__GPIO_42 0x0A8 0x000 ALT0 0x0
280#define VF610_PAD_PTB20__DSPI0_SIN 0x0A8 0x000 ALT1 0x0
281#define VF610_PAD_PTB20__LCD42 0x0A8 0x000 ALT4 0x0
282#define VF610_PAD_PTB20__VIU_DATA11 0x0A8 0x000 ALT6 0x0
283#define VF610_PAD_PTB21__GPIO_43 0x0AC 0x000 ALT0 0x0
284#define VF610_PAD_PTB21__DSPI0_SOUT 0x0AC 0x000 ALT1 0x0
285#define VF610_PAD_PTB21__LCD43 0x0AC 0x000 ALT4 0x0
286#define VF610_PAD_PTB21__VIU_DATA12 0x0AC 0x000 ALT6 0x0
287#define VF610_PAD_PTB21__DCU1_PCLK 0x0AC 0x000 ALT7 0x0
288#define VF610_PAD_PTB22__GPIO_44 0x0B0 0x000 ALT0 0x0
289#define VF610_PAD_PTB22__DSPI0_SCK 0x0B0 0x000 ALT1 0x0
290#define VF610_PAD_PTB22__VLCD 0x0B0 0x000 ALT4 0x0
291#define VF610_PAD_PTB22__VIU_FID 0x0B0 0x3A8 ALT5 0x1
292#define VF610_PAD_PTC0__GPIO_45 0x0B4 0x000 ALT0 0x0
293#define VF610_PAD_PTC0__ENET_RMII0_MDC 0x0B4 0x000 ALT1 0x0
294#define VF610_PAD_PTC0__FTM1_CH0 0x0B4 0x32C ALT2 0x1
295#define VF610_PAD_PTC0__DSPI0_CS3 0x0B4 0x000 ALT3 0x0
296#define VF610_PAD_PTC0__ESAI_SCKT 0x0B4 0x310 ALT4 0x0
297#define VF610_PAD_PTC0__ESDHC0_CLK 0x0B4 0x000 ALT5 0x0
298#define VF610_PAD_PTC0__VIU_DATA0 0x0B4 0x000 ALT6 0x0
299#define VF610_PAD_PTC0__SRC_RCON18 0x0B4 0x398 ALT7 0x0
300#define VF610_PAD_PTC1__GPIO_46 0x0B8 0x000 ALT0 0x0
301#define VF610_PAD_PTC1__ENET_RMII0_MDIO 0x0B8 0x000 ALT1 0x0
302#define VF610_PAD_PTC1__FTM1_CH1 0x0B8 0x330 ALT2 0x1
303#define VF610_PAD_PTC1__DSPI0_CS2 0x0B8 0x000 ALT3 0x0
304#define VF610_PAD_PTC1__ESAI_FST 0x0B8 0x30C ALT4 0x0
305#define VF610_PAD_PTC1__ESDHC0_CMD 0x0B8 0x000 ALT5 0x0
306#define VF610_PAD_PTC1__VIU_DATA1 0x0B8 0x000 ALT6 0x0
307#define VF610_PAD_PTC1__SRC_RCON19 0x0B8 0x39C ALT7 0x0
308#define VF610_PAD_PTC2__GPIO_47 0x0BC 0x000 ALT0 0x0
309#define VF610_PAD_PTC2__ENET_RMII0_CRS 0x0BC 0x000 ALT1 0x0
310#define VF610_PAD_PTC2__UART1_TX 0x0BC 0x380 ALT2 0x1
311#define VF610_PAD_PTC2__ESAI_SDO0 0x0BC 0x314 ALT4 0x0
312#define VF610_PAD_PTC2__ESDHC0_DAT0 0x0BC 0x000 ALT5 0x0
313#define VF610_PAD_PTC2__VIU_DATA2 0x0BC 0x000 ALT6 0x0
314#define VF610_PAD_PTC2__SRC_RCON20 0x0BC 0x3A0 ALT7 0x0
315#define VF610_PAD_PTC3__GPIO_48 0x0C0 0x000 ALT0 0x0
316#define VF610_PAD_PTC3__ENET_RMII0_RXD1 0x0C0 0x000 ALT1 0x0
317#define VF610_PAD_PTC3__UART1_RX 0x0C0 0x37C ALT2 0x1
318#define VF610_PAD_PTC3__ESAI_SDO1 0x0C0 0x318 ALT4 0x0
319#define VF610_PAD_PTC3__ESDHC0_DAT1 0x0C0 0x000 ALT5 0x0
320#define VF610_PAD_PTC3__VIU_DATA3 0x0C0 0x000 ALT6 0x0
321#define VF610_PAD_PTC3__DCU0_R0 0x0C0 0x000 ALT7 0x0
322#define VF610_PAD_PTC4__GPIO_49 0x0C4 0x000 ALT0 0x0
323#define VF610_PAD_PTC4__ENET_RMII0_RXD0 0x0C4 0x000 ALT1 0x0
324#define VF610_PAD_PTC4__UART1_RTS 0x0C4 0x000 ALT2 0x0
325#define VF610_PAD_PTC4__DSPI1_CS1 0x0C4 0x000 ALT3 0x0
326#define VF610_PAD_PTC4__ESAI_SDO2 0x0C4 0x31C ALT4 0x0
327#define VF610_PAD_PTC4__ESDHC0_DAT2 0x0C4 0x000 ALT5 0x0
328#define VF610_PAD_PTC4__VIU_DATA4 0x0C4 0x000 ALT6 0x0
329#define VF610_PAD_PTC4__DCU0_R1 0x0C4 0x000 ALT7 0x0
330#define VF610_PAD_PTC5__GPIO_50 0x0C8 0x000 ALT0 0x0
331#define VF610_PAD_PTC5__ENET_RMII0_RXER 0x0C8 0x000 ALT1 0x0
332#define VF610_PAD_PTC5__UART1_CTS 0x0C8 0x378 ALT2 0x1
333#define VF610_PAD_PTC5__DSPI1_CS0 0x0C8 0x300 ALT3 0x0
334#define VF610_PAD_PTC5__ESAI_SDO3 0x0C8 0x320 ALT4 0x0
335#define VF610_PAD_PTC5__ESDHC0_DAT3 0x0C8 0x000 ALT5 0x0
336#define VF610_PAD_PTC5__VIU_DATA5 0x0C8 0x000 ALT6 0x0
337#define VF610_PAD_PTC5__DCU0_G0 0x0C8 0x000 ALT7 0x0
338#define VF610_PAD_PTC6__GPIO_51 0x0CC 0x000 ALT0 0x0
339#define VF610_PAD_PTC6__ENET_RMII0_TXD1 0x0CC 0x000 ALT1 0x0
340#define VF610_PAD_PTC6__DSPI1_SIN 0x0CC 0x2FC ALT3 0x0
341#define VF610_PAD_PTC6__ESAI_SDI0 0x0CC 0x328 ALT4 0x0
342#define VF610_PAD_PTC6__ESDHC0_WP 0x0CC 0x000 ALT5 0x0
343#define VF610_PAD_PTC6__VIU_DATA6 0x0CC 0x000 ALT6 0x0
344#define VF610_PAD_PTC6__DCU0_G1 0x0CC 0x000 ALT7 0x0
345#define VF610_PAD_PTC7__GPIO_52 0x0D0 0x000 ALT0 0x0
346#define VF610_PAD_PTC7__ENET_RMII0_TXD0 0x0D0 0x000 ALT1 0x0
347#define VF610_PAD_PTC7__DSPI1_SOUT 0x0D0 0x000 ALT3 0x0
348#define VF610_PAD_PTC7__ESAI_SDI1 0x0D0 0x324 ALT4 0x0
349#define VF610_PAD_PTC7__VIU_DATA7 0x0D0 0x000 ALT6 0x0
350#define VF610_PAD_PTC7__DCU0_B0 0x0D0 0x000 ALT7 0x0
351#define VF610_PAD_PTC8__GPIO_53 0x0D4 0x000 ALT0 0x0
352#define VF610_PAD_PTC8__ENET_RMII0_TXEN 0x0D4 0x000 ALT1 0x0
353#define VF610_PAD_PTC8__DSPI1_SCK 0x0D4 0x2F8 ALT3 0x0
354#define VF610_PAD_PTC8__VIU_DATA8 0x0D4 0x000 ALT6 0x0
355#define VF610_PAD_PTC8__DCU0_B1 0x0D4 0x000 ALT7 0x0
356#define VF610_PAD_PTC9__GPIO_54 0x0D8 0x000 ALT0 0x0
357#define VF610_PAD_PTC9__ENET_RMII1_MDC 0x0D8 0x000 ALT1 0x0
358#define VF610_PAD_PTC9__ESAI_SCKT 0x0D8 0x310 ALT3 0x1
359#define VF610_PAD_PTC9__MLB_CLK 0x0D8 0x354 ALT6 0x1
360#define VF610_PAD_PTC9__DEBUG_OUT0 0x0D8 0x000 ALT7 0x0
361#define VF610_PAD_PTC10__GPIO_55 0x0DC 0x000 ALT0 0x0
362#define VF610_PAD_PTC10__ENET_RMII1_MDIO 0x0DC 0x000 ALT1 0x0
363#define VF610_PAD_PTC10__ESAI_FST 0x0DC 0x30C ALT3 0x1
364#define VF610_PAD_PTC10__MLB_SIGNAL 0x0DC 0x35C ALT6 0x1
365#define VF610_PAD_PTC10__DEBUG_OUT1 0x0DC 0x000 ALT7 0x0
366#define VF610_PAD_PTC11__GPIO_56 0x0E0 0x000 ALT0 0x0
367#define VF610_PAD_PTC11__ENET_RMII1_CRS 0x0E0 0x000 ALT1 0x0
368#define VF610_PAD_PTC11__ESAI_SDO0 0x0E0 0x314 ALT3 0x1
369#define VF610_PAD_PTC11__MLB_DATA 0x0E0 0x358 ALT6 0x1
370#define VF610_PAD_PTC11__DEBUG_OUT 0x0E0 0x000 ALT7 0x0
371#define VF610_PAD_PTC12__GPIO_57 0x0E4 0x000 ALT0 0x0
372#define VF610_PAD_PTC12__ENET_RMII_RXD1 0x0E4 0x000 ALT1 0x0
373#define VF610_PAD_PTC12__ESAI_SDO1 0x0E4 0x318 ALT3 0x1
374#define VF610_PAD_PTC12__SAI2_TX_BCLK 0x0E4 0x370 ALT5 0x1
375#define VF610_PAD_PTC12__DEBUG_OUT3 0x0E4 0x000 ALT7 0x0
376#define VF610_PAD_PTC13__GPIO_58 0x0E8 0x000 ALT0 0x0
377#define VF610_PAD_PTC13__ENET_RMII1_RXD0 0x0E8 0x000 ALT1 0x0
378#define VF610_PAD_PTC13__ESAI_SDO2 0x0E8 0x31C ALT3 0x1
379#define VF610_PAD_PTC13__SAI2_RX_BCLK 0x0E8 0x364 ALT5 0x2
380#define VF610_PAD_PTC13__DEBUG_OUT4 0x0E8 0x000 ALT7 0x0
381#define VF610_PAD_PTC14__GPIO_59 0x0EC 0x000 ALT0 0x0
382#define VF610_PAD_PTC14__ENET_RMII1_RXER 0x0EC 0x000 ALT1 0x0
383#define VF610_PAD_PTC14__ESAI_SDO3 0x0EC 0x320 ALT3 0x1
384#define VF610_PAD_PTC14__UART5_TX 0x0EC 0x000 ALT4 0x0
385#define VF610_PAD_PTC14__SAI2_RX_DATA 0x0EC 0x368 ALT5 0x2
386#define VF610_PAD_PTC14__ADC0_SE6 0x0EC 0x000 ALT6 0x0
387#define VF610_PAD_PTC14__DEBUG_OUT5 0x0EC 0x000 ALT7 0x0
388#define VF610_PAD_PTC15__GPIO_60 0x0F0 0x000 ALT0 0x0
389#define VF610_PAD_PTC15__ENET_RMII1_TXD1 0x0F0 0x000 ALT1 0x0
390#define VF610_PAD_PTC15__ESAI_SDI0 0x0F0 0x328 ALT3 0x1
391#define VF610_PAD_PTC15__UART5_RX 0x0F0 0x000 ALT4 0x0
392#define VF610_PAD_PTC15__SAI2_TX_DATA 0x0F0 0x000 ALT5 0x0
393#define VF610_PAD_PTC15__ADC0_SE7 0x0F0 0x000 ALT6 0x0
394#define VF610_PAD_PTC15__DEBUG_OUT6 0x0F0 0x000 ALT7 0x0
395#define VF610_PAD_PTC16__GPIO_61 0x0F4 0x000 ALT0 0x0
396#define VF610_PAD_PTC16__ENET_RMII1_TXD0 0x0F4 0x000 ALT1 0x0
397#define VF610_PAD_PTC16__ESAI_SDI1 0x0F4 0x324 ALT3 0x1
398#define VF610_PAD_PTC16__UART5_RTS 0x0F4 0x000 ALT4 0x0
399#define VF610_PAD_PTC16__SAI2_RX_SYNC 0x0F4 0x36C ALT5 0x2
400#define VF610_PAD_PTC16__ADC1_SE6 0x0F4 0x000 ALT6 0x0
401#define VF610_PAD_PTC16__DEBUG_OUT7 0x0F4 0x000 ALT7 0x0
402#define VF610_PAD_PTC17__GPIO_62 0x0F8 0x000 ALT0 0x0
403#define VF610_PAD_PTC17__ENET_RMII1_TXEN 0x0F8 0x000 ALT1 0x0
404#define VF610_PAD_PTC17__ADC1_SE7 0x0F8 0x000 ALT3 0x0
405#define VF610_PAD_PTC17__UART5_CTS 0x0F8 0x000 ALT4 0x0
406#define VF610_PAD_PTC17__SAI2_TX_SYNC 0x0F8 0x374 ALT5 0x1
407#define VF610_PAD_PTC17__USB1_SOF_PULSE 0x0F8 0x000 ALT6 0x0
408#define VF610_PAD_PTC17__DEBUG_OUT8 0x0F8 0x000 ALT7 0x0
409#define VF610_PAD_PTD31__GPIO_63 0x0FC 0x000 ALT0 0x0
410#define VF610_PAD_PTD31__FB_AD31 0x0FC 0x000 ALT1 0x0
411#define VF610_PAD_PTD31__NF_IO15 0x0FC 0x000 ALT2 0x0
412#define VF610_PAD_PTD31__FTM3_CH0 0x0FC 0x000 ALT4 0x0
413#define VF610_PAD_PTD31__DSPI2_CS1 0x0FC 0x000 ALT5 0x0
414#define VF610_PAD_PTD31__DEBUG_OUT9 0x0FC 0x000 ALT7 0x0
415#define VF610_PAD_PTD30__GPIO_64 0x100 0x000 ALT0 0x0
416#define VF610_PAD_PTD30__FB_AD30 0x100 0x000 ALT1 0x0
417#define VF610_PAD_PTD30__NF_IO14 0x100 0x000 ALT2 0x0
418#define VF610_PAD_PTD30__FTM3_CH1 0x100 0x000 ALT4 0x0
419#define VF610_PAD_PTD30__DSPI2_CS0 0x100 0x000 ALT5 0x0
420#define VF610_PAD_PTD30__DEBUG_OUT10 0x100 0x000 ALT7 0x0
421#define VF610_PAD_PTD29__GPIO_65 0x104 0x000 ALT0 0x0
422#define VF610_PAD_PTD29__FB_AD29 0x104 0x000 ALT1 0x0
423#define VF610_PAD_PTD29__NF_IO13 0x104 0x000 ALT2 0x0
424#define VF610_PAD_PTD29__FTM3_CH2 0x104 0x000 ALT4 0x0
425#define VF610_PAD_PTD29__DSPI2_SIN 0x104 0x000 ALT5 0x0
426#define VF610_PAD_PTD29__DEBUG_OUT11 0x104 0x000 ALT7 0x0
427#define VF610_PAD_PTD28__GPIO_66 0x108 0x000 ALT0 0x0
428#define VF610_PAD_PTD28__FB_AD28 0x108 0x000 ALT1 0x0
429#define VF610_PAD_PTD28__NF_IO12 0x108 0x000 ALT2 0x0
430#define VF610_PAD_PTD28__I2C2_SCL 0x108 0x34C ALT3 0x1
431#define VF610_PAD_PTD28__FTM3_CH3 0x108 0x000 ALT4 0x0
432#define VF610_PAD_PTD28__DSPI2_SOUT 0x108 0x000 ALT5 0x0
433#define VF610_PAD_PTD28__DEBUG_OUT12 0x108 0x000 ALT7 0x0
434#define VF610_PAD_PTD27__GPIO_67 0x10C 0x000 ALT0 0x0
435#define VF610_PAD_PTD27__FB_AD27 0x10C 0x000 ALT1 0x0
436#define VF610_PAD_PTD27__NF_IO11 0x10C 0x000 ALT2 0x0
437#define VF610_PAD_PTD27__I2C2_SDA 0x10C 0x350 ALT3 0x1
438#define VF610_PAD_PTD27__FTM3_CH4 0x10C 0x000 ALT4 0x0
439#define VF610_PAD_PTD27__DSPI2_SCK 0x10C 0x000 ALT5 0x0
440#define VF610_PAD_PTD27__DEBUG_OUT13 0x10C 0x000 ALT7 0x0
441#define VF610_PAD_PTD26__GPIO_68 0x110 0x000 ALT0 0x0
442#define VF610_PAD_PTD26__FB_AD26 0x110 0x000 ALT1 0x0
443#define VF610_PAD_PTD26__NF_IO10 0x110 0x000 ALT2 0x0
444#define VF610_PAD_PTD26__FTM3_CH5 0x110 0x000 ALT4 0x0
445#define VF610_PAD_PTD26__ESDHC1_WP 0x110 0x000 ALT5 0x0
446#define VF610_PAD_PTD26__DEBUG_OUT14 0x110 0x000 ALT7 0x0
447#define VF610_PAD_PTD25__GPIO_69 0x114 0x000 ALT0 0x0
448#define VF610_PAD_PTD25__FB_AD25 0x114 0x000 ALT1 0x0
449#define VF610_PAD_PTD25__NF_IO9 0x114 0x000 ALT2 0x0
450#define VF610_PAD_PTD25__FTM3_CH6 0x114 0x000 ALT4 0x0
451#define VF610_PAD_PTD25__DEBUG_OUT15 0x114 0x000 ALT7 0x0
452#define VF610_PAD_PTD24__GPIO_70 0x118 0x000 ALT0 0x0
453#define VF610_PAD_PTD24__FB_AD24 0x118 0x000 ALT1 0x0
454#define VF610_PAD_PTD24__NF_IO8 0x118 0x000 ALT2 0x0
455#define VF610_PAD_PTD24__FTM3_CH7 0x118 0x000 ALT4 0x0
456#define VF610_PAD_PTD24__DEBUG_OUT16 0x118 0x000 ALT7 0x0
457#define VF610_PAD_PTD23__GPIO_71 0x11C 0x000 ALT0 0x0
458#define VF610_PAD_PTD23__FB_AD23 0x11C 0x000 ALT1 0x0
459#define VF610_PAD_PTD23__NF_IO7 0x11C 0x000 ALT2 0x0
460#define VF610_PAD_PTD23__FTM2_CH0 0x11C 0x000 ALT3 0x0
461#define VF610_PAD_PTD23__ENET0_1588_TMR0 0x11C 0x304 ALT4 0x1
462#define VF610_PAD_PTD23__ESDHC0_DAT4 0x11C 0x000 ALT5 0x0
463#define VF610_PAD_PTD23__UART2_TX 0x11C 0x38C ALT6 0x1
464#define VF610_PAD_PTD23__DCU1_R3 0x11C 0x000 ALT7 0x0
465#define VF610_PAD_PTD22__GPIO_72 0x120 0x000 ALT0 0x0
466#define VF610_PAD_PTD22__FB_AD22 0x120 0x000 ALT1 0x0
467#define VF610_PAD_PTD22__NF_IO6 0x120 0x000 ALT2 0x0
468#define VF610_PAD_PTD22__FTM2_CH1 0x120 0x000 ALT3 0x0
469#define VF610_PAD_PTD22__ENET0_1588_TMR1 0x120 0x308 ALT4 0x1
470#define VF610_PAD_PTD22__ESDHC0_DAT5 0x120 0x000 ALT5 0x0
471#define VF610_PAD_PTD22__UART2_RX 0x120 0x388 ALT6 0x1
472#define VF610_PAD_PTD22__DCU1_R4 0x120 0x000 ALT7 0x0
473#define VF610_PAD_PTD21__GPIO_73 0x124 0x000 ALT0 0x0
474#define VF610_PAD_PTD21__FB_AD21 0x124 0x000 ALT1 0x0
475#define VF610_PAD_PTD21__NF_IO5 0x124 0x000 ALT2 0x0
476#define VF610_PAD_PTD21__ENET0_1588_TMR2 0x124 0x000 ALT4 0x0
477#define VF610_PAD_PTD21__ESDHC0_DAT6 0x124 0x000 ALT5 0x0
478#define VF610_PAD_PTD21__UART2_RTS 0x124 0x000 ALT6 0x0
479#define VF610_PAD_PTD21__DCU1_R5 0x124 0x000 ALT7 0x0
480#define VF610_PAD_PTD20__GPIO_74 0x128 0x000 ALT0 0x0
481#define VF610_PAD_PTD20__FB_AD20 0x128 0x000 ALT1 0x0
482#define VF610_PAD_PTD20__NF_IO4 0x128 0x000 ALT2 0x0
483#define VF610_PAD_PTD20__ENET0_1588_TMR3 0x128 0x000 ALT4 0x0
484#define VF610_PAD_PTD20__ESDHC0_DAT7 0x128 0x000 ALT5 0x0
485#define VF610_PAD_PTD20__UART2_CTS 0x128 0x384 ALT6 0x0
486#define VF610_PAD_PTD20__DCU1_R0 0x128 0x000 ALT7 0x0
487#define VF610_PAD_PTD19__GPIO_75 0x12C 0x000 ALT0 0x0
488#define VF610_PAD_PTD19__FB_AD19 0x12C 0x000 ALT1 0x0
489#define VF610_PAD_PTD19__NF_IO3 0x12C 0x000 ALT2 0x0
490#define VF610_PAD_PTD19__ESAI_SCKR 0x12C 0x000 ALT3 0x0
491#define VF610_PAD_PTD19__I2C0_SCL 0x12C 0x33C ALT4 0x2
492#define VF610_PAD_PTD19__FTM2_QD_PHA 0x12C 0x000 ALT5 0x0
493#define VF610_PAD_PTD19__DCU1_R1 0x12C 0x000 ALT7 0x0
494#define VF610_PAD_PTD18__GPIO_76 0x130 0x000 ALT0 0x0
495#define VF610_PAD_PTD18__FB_AD18 0x130 0x000 ALT1 0x0
496#define VF610_PAD_PTD18__NF_IO2 0x130 0x000 ALT2 0x0
497#define VF610_PAD_PTD18__ESAI_FSR 0x130 0x000 ALT3 0x0
498#define VF610_PAD_PTD18__I2C0_SDA 0x130 0x340 ALT4 0x2
499#define VF610_PAD_PTD18__FTM2_QD_PHB 0x130 0x000 ALT5 0x0
500#define VF610_PAD_PTD18__DCU1_G0 0x130 0x000 ALT7 0x0
501#define VF610_PAD_PTD17__GPIO_77 0x134 0x000 ALT0 0x0
502#define VF610_PAD_PTD17__FB_AD17 0x134 0x000 ALT1 0x0
503#define VF610_PAD_PTD17__NF_IO1 0x134 0x000 ALT2 0x0
504#define VF610_PAD_PTD17__ESAI_HCKR 0x134 0x000 ALT3 0x0
505#define VF610_PAD_PTD17__I2C1_SCL 0x134 0x344 ALT4 0x2
506#define VF610_PAD_PTD17__DCU1_G1 0x134 0x000 ALT7 0x0
507#define VF610_PAD_PTD16__GPIO_78 0x138 0x000 ALT0 0x0
508#define VF610_PAD_PTD16__FB_AD16 0x138 0x000 ALT1 0x0
509#define VF610_PAD_PTD16__NF_IO0 0x138 0x000 ALT2 0x0
510#define VF610_PAD_PTD16__ESAI_HCKT 0x138 0x000 ALT3 0x0
511#define VF610_PAD_PTD16__I2C1_SDA 0x138 0x348 ALT4 0x2
512#define VF610_PAD_PTD16__DCU1_G2 0x138 0x000 ALT7 0x0
513#define VF610_PAD_PTD0__GPIO_79 0x13C 0x000 ALT0 0x0
514#define VF610_PAD_PTD0__QSPI0_A_QSCK 0x13C 0x000 ALT1 0x0
515#define VF610_PAD_PTD0__UART2_TX 0x13C 0x38C ALT2 0x2
516#define VF610_PAD_PTD0__FB_AD15 0x13C 0x000 ALT4 0x0
517#define VF610_PAD_PTD0__SPDIF_EXTCLK 0x13C 0x000 ALT5 0x0
518#define VF610_PAD_PTD0__DEBUG_OUT17 0x13C 0x000 ALT7 0x0
519#define VF610_PAD_PTD1__GPIO_80 0x140 0x000 ALT0 0x0
520#define VF610_PAD_PTD1__QSPI0_A_CS0 0x140 0x000 ALT1 0x0
521#define VF610_PAD_PTD1__UART2_RX 0x140 0x388 ALT2 0x2
522#define VF610_PAD_PTD1__FB_AD14 0x140 0x000 ALT4 0x0
523#define VF610_PAD_PTD1__SPDIF_IN1 0x140 0x000 ALT5 0x0
524#define VF610_PAD_PTD1__DEBUG_OUT18 0x140 0x000 ALT7 0x0
525#define VF610_PAD_PTD2__GPIO_81 0x144 0x000 ALT0 0x0
526#define VF610_PAD_PTD2__QSPI0_A_DATA3 0x144 0x000 ALT1 0x0
527#define VF610_PAD_PTD2__UART2_RTS 0x144 0x000 ALT2 0x0
528#define VF610_PAD_PTD2__DSPI1_CS3 0x144 0x000 ALT3 0x0
529#define VF610_PAD_PTD2__FB_AD13 0x144 0x000 ALT4 0x0
530#define VF610_PAD_PTD2__SPDIF_OUT1 0x144 0x000 ALT5 0x0
531#define VF610_PAD_PTD2__DEBUG_OUT19 0x144 0x000 ALT7 0x0
532#define VF610_PAD_PTD3__GPIO_82 0x148 0x000 ALT0 0x0
533#define VF610_PAD_PTD3__QSPI0_A_DATA2 0x148 0x000 ALT1 0x0
534#define VF610_PAD_PTD3__UART2_CTS 0x148 0x384 ALT2 0x1
535#define VF610_PAD_PTD3__DSPI1_CS2 0x148 0x000 ALT3 0x0
536#define VF610_PAD_PTD3__FB_AD12 0x148 0x000 ALT4 0x0
537#define VF610_PAD_PTD3__SPDIF_PLOCK 0x148 0x000 ALT5 0x0
538#define VF610_PAD_PTD3__DEBUG_OUT20 0x148 0x000 ALT7 0x0
539#define VF610_PAD_PTD4__GPIO_83 0x14C 0x000 ALT0 0x0
540#define VF610_PAD_PTD4__QSPI0_A_DATA1 0x14C 0x000 ALT1 0x0
541#define VF610_PAD_PTD4__DSPI1_CS1 0x14C 0x000 ALT3 0x0
542#define VF610_PAD_PTD4__FB_AD11 0x14C 0x000 ALT4 0x0
543#define VF610_PAD_PTD4__SPDIF_SRCLK 0x14C 0x000 ALT5 0x0
544#define VF610_PAD_PTD4__DEBUG_OUT21 0x14C 0x000 ALT7 0x0
545#define VF610_PAD_PTD5__GPIO_84 0x150 0x000 ALT0 0x0
546#define VF610_PAD_PTD5__QSPI0_A_DATA0 0x150 0x000 ALT1 0x0
547#define VF610_PAD_PTD5__DSPI1_CS0 0x150 0x300 ALT3 0x1
548#define VF610_PAD_PTD5__FB_AD10 0x150 0x000 ALT4 0x0
549#define VF610_PAD_PTD5__DEBUG_OUT22 0x150 0x000 ALT7 0x0
550#define VF610_PAD_PTD6__GPIO_85 0x154 0x000 ALT0 0x0
551#define VF610_PAD_PTD6__QSPI1_A_DQS 0x154 0x000 ALT1 0x0
552#define VF610_PAD_PTD6__DSPI1_SIN 0x154 0x2FC ALT3 0x1
553#define VF610_PAD_PTD6__FB_AD9 0x154 0x000 ALT4 0x0
554#define VF610_PAD_PTD6__DEBUG_OUT23 0x154 0x000 ALT7 0x0
555#define VF610_PAD_PTD7__GPIO_86 0x158 0x000 ALT0 0x0
556#define VF610_PAD_PTD7__QSPI0_B_QSCK 0x158 0x000 ALT1 0x0
557#define VF610_PAD_PTD7__DSPI1_SOUT 0x158 0x000 ALT3 0x0
558#define VF610_PAD_PTD7__FB_AD8 0x158 0x000 ALT4 0x0
559#define VF610_PAD_PTD7__DEBUG_OUT24 0x158 0x000 ALT7 0x0
560#define VF610_PAD_PTD8__GPIO_87 0x15C 0x000 ALT0 0x0
561#define VF610_PAD_PTD8__QSPI0_B_CS0 0x15C 0x000 ALT1 0x0
562#define VF610_PAD_PTD8__FB_CLKOUT 0x15C 0x000 ALT2 0x0
563#define VF610_PAD_PTD8__DSPI1_SCK 0x15C 0x2F8 ALT3 0x1
564#define VF610_PAD_PTD8__FB_AD7 0x15C 0x000 ALT4 0x0
565#define VF610_PAD_PTD8__DEBUG_OUT25 0x15C 0x000 ALT7 0x0
566#define VF610_PAD_PTD9__GPIO_88 0x160 0x000 ALT0 0x0
567#define VF610_PAD_PTD9__QSPI0_B_DATA3 0x160 0x000 ALT1 0x0
568#define VF610_PAD_PTD9__DSPI3_CS1 0x160 0x000 ALT2 0x0
569#define VF610_PAD_PTD9__FB_AD6 0x160 0x000 ALT4 0x0
570#define VF610_PAD_PTD9__SAI1_TX_SYNC 0x160 0x360 ALT6 0x0
571#define VF610_PAD_PTD9__DCU1_B0 0x160 0x000 ALT7 0x0
572#define VF610_PAD_PTD10__GPIO_89 0x164 0x000 ALT0 0x0
573#define VF610_PAD_PTD10__QSPI0_B_DATA2 0x164 0x000 ALT1 0x0
574#define VF610_PAD_PTD10__DSPI3_CS0 0x164 0x000 ALT2 0x0
575#define VF610_PAD_PTD10__FB_AD5 0x164 0x000 ALT4 0x0
576#define VF610_PAD_PTD10__DCU1_B1 0x164 0x000 ALT7 0x0
577#define VF610_PAD_PTD11__GPIO_90 0x168 0x000 ALT0 0x0
578#define VF610_PAD_PTD11__QSPI0_B_DATA1 0x168 0x000 ALT1 0x0
579#define VF610_PAD_PTD11__DSPI3_SIN 0x168 0x000 ALT2 0x0
580#define VF610_PAD_PTD11__FB_AD4 0x168 0x000 ALT4 0x0
581#define VF610_PAD_PTD11__DEBUG_OUT26 0x168 0x000 ALT7 0x0
582#define VF610_PAD_PTD12__GPIO_91 0x16C 0x000 ALT0 0x0
583#define VF610_PAD_PTD12__QSPI0_B_DATA0 0x16C 0x000 ALT1 0x0
584#define VF610_PAD_PTD12__DSPI3_SOUT 0x16C 0x000 ALT2 0x0
585#define VF610_PAD_PTD12__FB_AD3 0x16C 0x000 ALT4 0x0
586#define VF610_PAD_PTD12__DEBUG_OUT27 0x16C 0x000 ALT7 0x0
587#define VF610_PAD_PTD13__GPIO_92 0x170 0x000 ALT0 0x0
588#define VF610_PAD_PTD13__QSPI0_B_DQS 0x170 0x000 ALT1 0x0
589#define VF610_PAD_PTD13__DSPI3_SCK 0x170 0x000 ALT2 0x0
590#define VF610_PAD_PTD13__FB_AD2 0x170 0x000 ALT4 0x0
591#define VF610_PAD_PTD13__DEBUG_OUT28 0x170 0x000 ALT7 0x0
592#define VF610_PAD_PTB23__GPIO_93 0x174 0x000 ALT0 0x0
593#define VF610_PAD_PTB23__SAI0_TX_BCLK 0x174 0x000 ALT1 0x0
594#define VF610_PAD_PTB23__UART1_TX 0x174 0x380 ALT2 0x2
595#define VF610_PAD_PTB23__SRC_RCON18 0x174 0x398 ALT3 0x1
596#define VF610_PAD_PTB23__FB_MUXED_ALE 0x174 0x000 ALT4 0x0
597#define VF610_PAD_PTB23__FB_TS_B 0x174 0x000 ALT5 0x0
598#define VF610_PAD_PTB23__UART3_RTS 0x174 0x000 ALT6 0x0
599#define VF610_PAD_PTB23__DCU1_G3 0x174 0x000 ALT7 0x0
600#define VF610_PAD_PTB24__GPIO_94 0x178 0x000 ALT0 0x0
601#define VF610_PAD_PTB24__SAI0_RX_BCLK 0x178 0x000 ALT1 0x0
602#define VF610_PAD_PTB24__UART1_RX 0x178 0x37C ALT2 0x2
603#define VF610_PAD_PTB24__SRC_RCON19 0x178 0x39C ALT3 0x1
604#define VF610_PAD_PTB24__FB_MUXED_TSIZ0 0x178 0x000 ALT4 0x0
605#define VF610_PAD_PTB24__NF_WE_B 0x178 0x000 ALT5 0x0
606#define VF610_PAD_PTB24__UART3_CTS 0x178 0x000 ALT6 0x0
607#define VF610_PAD_PTB24__DCU1_G4 0x178 0x000 ALT7 0x0
608#define VF610_PAD_PTB25__GPIO_95 0x17C 0x000 ALT0 0x0
609#define VF610_PAD_PTB25__SAI0_RX_DATA 0x17C 0x000 ALT1 0x0
610#define VF610_PAD_PTB25__UART1_RTS 0x17C 0x000 ALT2 0x0
611#define VF610_PAD_PTB25__SRC_RCON20 0x17C 0x3A0 ALT3 0x1
612#define VF610_PAD_PTB25__FB_CS1_B 0x17C 0x000 ALT4 0x0
613#define VF610_PAD_PTB25__NF_CE0_B 0x17C 0x000 ALT5 0x0
614#define VF610_PAD_PTB25__DCU1_G5 0x17C 0x000 ALT7 0x0
615#define VF610_PAD_PTB26__GPIO_96 0x180 0x000 ALT0 0x0
616#define VF610_PAD_PTB26__SAI0_TX_DATA 0x180 0x000 ALT1 0x0
617#define VF610_PAD_PTB26__UART1_CTS 0x180 0x378 ALT2 0x2
618#define VF610_PAD_PTB26__SRC_RCON21 0x180 0x000 ALT3 0x0
619#define VF610_PAD_PTB26__FB_CS0_B 0x180 0x000 ALT4 0x0
620#define VF610_PAD_PTB26__NF_CE1_B 0x180 0x000 ALT5 0x0
621#define VF610_PAD_PTB26__DCU1_G6 0x180 0x000 ALT7 0x0
622#define VF610_PAD_PTB27__GPIO_97 0x184 0x000 ALT0 0x0
623#define VF610_PAD_PTB27__SAI0_RX_SYNC 0x184 0x000 ALT1 0x0
624#define VF610_PAD_PTB27__SRC_RCON22 0x184 0x000 ALT3 0x0
625#define VF610_PAD_PTB27__FB_OE_B 0x184 0x000 ALT4 0x0
626#define VF610_PAD_PTB27__FB_MUXED_TBST_B 0x184 0x000 ALT5 0x0
627#define VF610_PAD_PTB27__NF_RE_B 0x184 0x000 ALT6 0x0
628#define VF610_PAD_PTB27__DCU1_G7 0x184 0x000 ALT7 0x0
629#define VF610_PAD_PTB28__GPIO_98 0x188 0x000 ALT0 0x0
630#define VF610_PAD_PTB28__SAI0_TX_SYNC 0x188 0x000 ALT1 0x0
631#define VF610_PAD_PTB28__SRC_RCON23 0x188 0x000 ALT3 0x0
632#define VF610_PAD_PTB28__FB_RW_B 0x188 0x000 ALT4 0x0
633#define VF610_PAD_PTB28__DCU1_B6 0x188 0x000 ALT7 0x0
634#define VF610_PAD_PTC26__GPIO_99 0x18C 0x000 ALT0 0x0
635#define VF610_PAD_PTC26__SAI1_TX_BCLK 0x18C 0x000 ALT1 0x0
636#define VF610_PAD_PTC26__DSPI0_CS5 0x18C 0x000 ALT2 0x0
637#define VF610_PAD_PTC26__SRC_RCON24 0x18C 0x000 ALT3 0x0
638#define VF610_PAD_PTC26__FB_TA_B 0x18C 0x000 ALT4 0x0
639#define VF610_PAD_PTC26__NF_RB_B 0x18C 0x000 ALT5 0x0
640#define VF610_PAD_PTC26__DCU1_B7 0x18C 0x000 ALT7 0x0
641#define VF610_PAD_PTC27__GPIO_100 0x190 0x000 ALT0 0x0
642#define VF610_PAD_PTC27__SAI1_RX_BCLK 0x190 0x000 ALT1 0x0
643#define VF610_PAD_PTC27__DSPI0_CS4 0x190 0x000 ALT2 0x0
644#define VF610_PAD_PTC27__SRC_RCON25 0x190 0x000 ALT3 0x0
645#define VF610_PAD_PTC27__FB_BE3_B 0x190 0x000 ALT4 0x0
646#define VF610_PAD_PTC27__FB_CS3_B 0x190 0x000 ALT5 0x0
647#define VF610_PAD_PTC27__NF_ALE 0x190 0x000 ALT6 0x0
648#define VF610_PAD_PTC27__DCU1_B2 0x190 0x000 ALT7 0x0
649#define VF610_PAD_PTC28__GPIO_101 0x194 0x000 ALT0 0x0
650#define VF610_PAD_PTC28__SAI1_RX_DATA 0x194 0x000 ALT1 0x0
651#define VF610_PAD_PTC28__DSPI0_CS3 0x194 0x000 ALT2 0x0
652#define VF610_PAD_PTC28__SRC_RCON26 0x194 0x000 ALT3 0x0
653#define VF610_PAD_PTC28__FB_BE2_B 0x194 0x000 ALT4 0x0
654#define VF610_PAD_PTC28__FB_CS2_B 0x194 0x000 ALT5 0x0
655#define VF610_PAD_PTC28__NF_CLE 0x194 0x000 ALT6 0x0
656#define VF610_PAD_PTC28__DCU1_B3 0x194 0x000 ALT7 0x0
657#define VF610_PAD_PTC29__GPIO_102 0x198 0x000 ALT0 0x0
658#define VF610_PAD_PTC29__SAI1_TX_DATA 0x198 0x000 ALT1 0x0
659#define VF610_PAD_PTC29__DSPI0_CS2 0x198 0x000 ALT2 0x0
660#define VF610_PAD_PTC29__SRC_RCON27 0x198 0x000 ALT3 0x0
661#define VF610_PAD_PTC29__FB_BE1_B 0x198 0x000 ALT4 0x0
662#define VF610_PAD_PTC29__FB_MUXED_TSIZE1 0x198 0x000 ALT5 0x0
663#define VF610_PAD_PTC29__DCU1_B4 0x198 0x000 ALT7 0x0
664#define VF610_PAD_PTC30__GPIO_103 0x19C 0x000 ALT0 0x0
665#define VF610_PAD_PTC30__SAI1_RX_SYNC 0x19C 0x000 ALT1 0x0
666#define VF610_PAD_PTC30__DSPI1_CS2 0x19C 0x000 ALT2 0x0
667#define VF610_PAD_PTC30__SRC_RCON28 0x19C 0x000 ALT3 0x0
668#define VF610_PAD_PTC30__FB_MUXED_BE0_B 0x19C 0x000 ALT4 0x0
669#define VF610_PAD_PTC30__FB_TSIZ0 0x19C 0x000 ALT5 0x0
670#define VF610_PAD_PTC30__ADC0_SE5 0x19C 0x000 ALT6 0x0
671#define VF610_PAD_PTC30__DCU1_B5 0x19C 0x000 ALT7 0x0
672#define VF610_PAD_PTC31__GPIO_104 0x1A0 0x000 ALT0 0x0
673#define VF610_PAD_PTC31__SAI1_TX_SYNC 0x1A0 0x360 ALT1 0x1
674#define VF610_PAD_PTC31__SRC_RCON29 0x1A0 0x000 ALT3 0x0
675#define VF610_PAD_PTC31__ADC1_SE5 0x1A0 0x000 ALT6 0x0
676#define VF610_PAD_PTC31__DCU1_B6 0x1A0 0x000 ALT7 0x0
677#define VF610_PAD_PTE0__GPIO_105 0x1A4 0x000 ALT0 0x0
678#define VF610_PAD_PTE0__DCU0_HSYNC 0x1A4 0x000 ALT1 0x0
679#define VF610_PAD_PTE0__SRC_BMODE1 0x1A4 0x000 ALT2 0x0
680#define VF610_PAD_PTE0__LCD0 0x1A4 0x000 ALT4 0x0
681#define VF610_PAD_PTE0__DEBUG_OUT29 0x1A4 0x000 ALT7 0x0
682#define VF610_PAD_PTE1__GPIO_106 0x1A8 0x000 ALT0 0x0
683#define VF610_PAD_PTE1__DCU0_VSYNC 0x1A8 0x000 ALT1 0x0
684#define VF610_PAD_PTE1__SRC_BMODE0 0x1A8 0x000 ALT2 0x0
685#define VF610_PAD_PTE1__LCD1 0x1A8 0x000 ALT4 0x0
686#define VF610_PAD_PTE1__DEBUG_OUT30 0x1A8 0x000 ALT7 0x0
687#define VF610_PAD_PTE2__GPIO_107 0x1AC 0x000 ALT0 0x0
688#define VF610_PAD_PTE2__DCU0_PCLK 0x1AC 0x000 ALT1 0x0
689#define VF610_PAD_PTE2__LCD2 0x1AC 0x000 ALT4 0x0
690#define VF610_PAD_PTE2__DEBUG_OUT31 0x1AC 0x000 ALT7 0x0
691#define VF610_PAD_PTE3__GPIO_108 0x1B0 0x000 ALT0 0x0
692#define VF610_PAD_PTE3__DCU0_TAG 0x1B0 0x000 ALT1 0x0
693#define VF610_PAD_PTE3__LCD3 0x1B0 0x000 ALT4 0x0
694#define VF610_PAD_PTE3__DEBUG_OUT32 0x1B0 0x000 ALT7 0x0
695#define VF610_PAD_PTE4__GPIO_109 0x1B4 0x000 ALT0 0x0
696#define VF610_PAD_PTE4__DCU0_DE 0x1B4 0x000 ALT1 0x0
697#define VF610_PAD_PTE4__LCD4 0x1B4 0x000 ALT4 0x0
698#define VF610_PAD_PTE4__DEBUG_OUT33 0x1B4 0x000 ALT7 0x0
699#define VF610_PAD_PTE5__GPIO_110 0x1B8 0x000 ALT0 0x0
700#define VF610_PAD_PTE5__DCU0_R0 0x1B8 0x000 ALT1 0x0
701#define VF610_PAD_PTE5__LCD5 0x1B8 0x000 ALT4 0x0
702#define VF610_PAD_PTE5__DEBUG_OUT34 0x1B8 0x000 ALT7 0x0
703#define VF610_PAD_PTE6__GPIO_111 0x1BC 0x000 ALT0 0x0
704#define VF610_PAD_PTE6__DCU0_R1 0x1BC 0x000 ALT1 0x0
705#define VF610_PAD_PTE6__LCD6 0x1BC 0x000 ALT4 0x0
706#define VF610_PAD_PTE6__DEBUG_OUT35 0x1BC 0x000 ALT7 0x0
707#define VF610_PAD_PTE7__GPIO_112 0x1C0 0x000 ALT0 0x0
708#define VF610_PAD_PTE7__DCU0_R2 0x1C0 0x000 ALT1 0x0
709#define VF610_PAD_PTE7__SRC_RCON0 0x1C0 0x000 ALT3 0x0
710#define VF610_PAD_PTE7__LCD7 0x1C0 0x000 ALT4 0x0
711#define VF610_PAD_PTE7__DEBUG_OUT36 0x1C0 0x000 ALT7 0x0
712#define VF610_PAD_PTE8__GPIO_113 0x1C4 0x000 ALT0 0x0
713#define VF610_PAD_PTE8__DCU0_R3 0x1C4 0x000 ALT1 0x0
714#define VF610_PAD_PTE8__SRC_RCON1 0x1C4 0x000 ALT3 0x0
715#define VF610_PAD_PTE8__LCD8 0x1C4 0x000 ALT4 0x0
716#define VF610_PAD_PTE8__DEBUG_OUT37 0x1C4 0x000 ALT7 0x0
717#define VF610_PAD_PTE9__GPIO_114 0x1C8 0x000 ALT0 0x0
718#define VF610_PAD_PTE9__DCU0_R4 0x1C8 0x000 ALT1 0x0
719#define VF610_PAD_PTE9__SRC_RCON2 0x1C8 0x000 ALT3 0x0
720#define VF610_PAD_PTE9__LCD9 0x1C8 0x000 ALT4 0x0
721#define VF610_PAD_PTE9__DEBUG_OUT38 0x1C8 0x000 ALT7 0x0
722#define VF610_PAD_PTE10__GPIO_115 0x1CC 0x000 ALT0 0x0
723#define VF610_PAD_PTE10__DCU0_R5 0x1CC 0x000 ALT1 0x0
724#define VF610_PAD_PTE10__SRC_RCON3 0x1CC 0x000 ALT3 0x0
725#define VF610_PAD_PTE10__LCD10 0x1CC 0x000 ALT4 0x0
726#define VF610_PAD_PTE10__DEBUG_OUT39 0x1CC 0x000 ALT7 0x0
727#define VF610_PAD_PTE11__GPIO_116 0x1D0 0x000 ALT0 0x0
728#define VF610_PAD_PTE11__DCU0_R6 0x1D0 0x000 ALT1 0x0
729#define VF610_PAD_PTE11__SRC_RCON4 0x1D0 0x000 ALT3 0x0
730#define VF610_PAD_PTE11__LCD11 0x1D0 0x000 ALT4 0x0
731#define VF610_PAD_PTE11__DEBUG_OUT40 0x1D0 0x000 ALT7 0x0
732#define VF610_PAD_PTE12__GPIO_117 0x1D4 0x000 ALT0 0x0
733#define VF610_PAD_PTE12__DCU0_R7 0x1D4 0x000 ALT1 0x0
734#define VF610_PAD_PTE12__DSPI1_CS3 0x1D4 0x000 ALT2 0x0
735#define VF610_PAD_PTE12__SRC_RCON5 0x1D4 0x000 ALT3 0x0
736#define VF610_PAD_PTE12__LCD12 0x1D4 0x000 ALT4 0x0
737#define VF610_PAD_PTE12__LPT_ALT0 0x1D4 0x000 ALT7 0x0
738#define VF610_PAD_PTE13__GPIO_118 0x1D8 0x000 ALT0 0x0
739#define VF610_PAD_PTE13__DCU0_G0 0x1D8 0x000 ALT1 0x0
740#define VF610_PAD_PTE13__LCD13 0x1D8 0x000 ALT4 0x0
741#define VF610_PAD_PTE13__DEBUG_OUT41 0x1D8 0x000 ALT7 0x0
742#define VF610_PAD_PTE14__GPIO_119 0x1DC 0x000 ALT0 0x0
743#define VF610_PAD_PTE14__DCU0_G1 0x1DC 0x000 ALT1 0x0
744#define VF610_PAD_PTE14__LCD14 0x1DC 0x000 ALT4 0x0
745#define VF610_PAD_PTE14__DEBUG_OUT42 0x1DC 0x000 ALT7 0x0
746#define VF610_PAD_PTE15__GPIO_120 0x1E0 0x000 ALT0 0x0
747#define VF610_PAD_PTE15__DCU0_G2 0x1E0 0x000 ALT1 0x0
748#define VF610_PAD_PTE15__SRC_RCON6 0x1E0 0x000 ALT3 0x0
749#define VF610_PAD_PTE15__LCD15 0x1E0 0x000 ALT4 0x0
750#define VF610_PAD_PTE15__DEBUG_OUT43 0x1E0 0x000 ALT7 0x0
751#define VF610_PAD_PTE16__GPIO_121 0x1E4 0x000 ALT0 0x0
752#define VF610_PAD_PTE16__DCU0_G3 0x1E4 0x000 ALT1 0x0
753#define VF610_PAD_PTE16__SRC_RCON7 0x1E4 0x000 ALT3 0x0
754#define VF610_PAD_PTE16__LCD16 0x1E4 0x000 ALT4 0x0
755#define VF610_PAD_PTE17__GPIO_122 0x1E8 0x000 ALT0 0x0
756#define VF610_PAD_PTE17__DCU0_G4 0x1E8 0x000 ALT1 0x0
757#define VF610_PAD_PTE17__SRC_RCON8 0x1E8 0x000 ALT3 0x0
758#define VF610_PAD_PTE17__LCD17 0x1E8 0x000 ALT4 0x0
759#define VF610_PAD_PTE18__GPIO_123 0x1EC 0x000 ALT0 0x0
760#define VF610_PAD_PTE18__DCU0_G5 0x1EC 0x000 ALT1 0x0
761#define VF610_PAD_PTE18__SRC_RCON9 0x1EC 0x000 ALT3 0x0
762#define VF610_PAD_PTE18__LCD18 0x1EC 0x000 ALT4 0x0
763#define VF610_PAD_PTE19__GPIO_124 0x1F0 0x000 ALT0 0x0
764#define VF610_PAD_PTE19__DCU0_G6 0x1F0 0x000 ALT1 0x0
765#define VF610_PAD_PTE19__SRC_RCON10 0x1F0 0x000 ALT3 0x0
766#define VF610_PAD_PTE19__LCD19 0x1F0 0x000 ALT4 0x0
767#define VF610_PAD_PTE19__I2C0_SCL 0x1F0 0x33C ALT5 0x3
768#define VF610_PAD_PTE20__GPIO_125 0x1F4 0x000 ALT0 0x0
769#define VF610_PAD_PTE20__DCU0_G7 0x1F4 0x000 ALT1 0x0
770#define VF610_PAD_PTE20__SRC_RCON11 0x1F4 0x000 ALT3 0x0
771#define VF610_PAD_PTE20__LCD20 0x1F4 0x000 ALT4 0x0
772#define VF610_PAD_PTE20__I2C0_SDA 0x1F4 0x340 ALT5 0x3
773#define VF610_PAD_PTE20__EWM_IN 0x1F4 0x000 ALT7 0x0
774#define VF610_PAD_PTE21__GPIO_126 0x1F8 0x000 ALT0 0x0
775#define VF610_PAD_PTE21__DCU0_B0 0x1F8 0x000 ALT1 0x0
776#define VF610_PAD_PTE21__LCD21 0x1F8 0x000 ALT4 0x0
777#define VF610_PAD_PTE22__GPIO_127 0x1FC 0x000 ALT0 0x0
778#define VF610_PAD_PTE22__DCU0_B1 0x1FC 0x000 ALT1 0x0
779#define VF610_PAD_PTE22__LCD22 0x1FC 0x000 ALT4 0x0
780#define VF610_PAD_PTE23__GPIO_128 0x200 0x000 ALT0 0x0
781#define VF610_PAD_PTE23__DCU0_B2 0x200 0x000 ALT1 0x0
782#define VF610_PAD_PTE23__SRC_RCON12 0x200 0x000 ALT3 0x0
783#define VF610_PAD_PTE23__LCD23 0x200 0x000 ALT4 0x0
784#define VF610_PAD_PTE24__GPIO_129 0x204 0x000 ALT0 0x0
785#define VF610_PAD_PTE24__DCU0_B3 0x204 0x000 ALT1 0x0
786#define VF610_PAD_PTE24__SRC_RCON13 0x204 0x000 ALT3 0x0
787#define VF610_PAD_PTE24__LCD24 0x204 0x000 ALT4 0x0
788#define VF610_PAD_PTE25__GPIO_130 0x208 0x000 ALT0 0x0
789#define VF610_PAD_PTE25__DCU0_B4 0x208 0x000 ALT1 0x0
790#define VF610_PAD_PTE25__SRC_RCON14 0x208 0x000 ALT3 0x0
791#define VF610_PAD_PTE25__LCD25 0x208 0x000 ALT4 0x0
792#define VF610_PAD_PTE26__GPIO_131 0x20C 0x000 ALT0 0x0
793#define VF610_PAD_PTE26__DCU0_B5 0x20C 0x000 ALT1 0x0
794#define VF610_PAD_PTE26__SRC_RCON15 0x20C 0x000 ALT3 0x0
795#define VF610_PAD_PTE26__LCD26 0x20C 0x000 ALT4 0x0
796#define VF610_PAD_PTE27__GPIO_132 0x210 0x000 ALT0 0x0
797#define VF610_PAD_PTE27__DCU0_B6 0x210 0x000 ALT1 0x0
798#define VF610_PAD_PTE27__SRC_RCON16 0x210 0x000 ALT3 0x0
799#define VF610_PAD_PTE27__LCD27 0x210 0x000 ALT4 0x0
800#define VF610_PAD_PTE27__I2C1_SCL 0x210 0x344 ALT5 0x3
801#define VF610_PAD_PTE28__GPIO_133 0x214 0x000 ALT0 0x0
802#define VF610_PAD_PTE28__DCU0_B7 0x214 0x000 ALT1 0x0
803#define VF610_PAD_PTE28__SRC_RCON17 0x214 0x000 ALT3 0x0
804#define VF610_PAD_PTE28__LCD28 0x214 0x000 ALT4 0x0
805#define VF610_PAD_PTE28__I2C1_SDA 0x214 0x348 ALT5 0x3
806#define VF610_PAD_PTE28__EWM_OUT 0x214 0x000 ALT7 0x0
807#define VF610_PAD_PTA7__GPIO_134 0x218 0x000 ALT0 0x0
808#define VF610_PAD_PTA7__VIU_PIX_CLK 0x218 0x3AC ALT1 0x1
809
810#endif
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
new file mode 100644
index 000000000000..b3905f5bcaf9
--- /dev/null
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -0,0 +1,57 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10/dts-v1/;
11#include "vf610.dtsi"
12
13/ {
14 model = "VF610 Tower Board";
15 compatible = "fsl,vf610-twr", "fsl,vf610";
16
17 chosen {
18 bootargs = "console=ttyLP1,115200";
19 };
20
21 memory {
22 reg = <0x80000000 0x8000000>;
23 };
24
25 clocks {
26 audio_ext {
27 compatible = "fixed-clock";
28 clock-frequency = <24576000>;
29 };
30
31 enet_ext {
32 compatible = "fixed-clock";
33 clock-frequency = <50000000>;
34 };
35 };
36
37};
38
39&fec0 {
40 phy-mode = "rmii";
41 pinctrl-names = "default";
42 pinctrl-0 = <&pinctrl_fec0_1>;
43 status = "okay";
44};
45
46&fec1 {
47 phy-mode = "rmii";
48 pinctrl-names = "default";
49 pinctrl-0 = <&pinctrl_fec1_1>;
50 status = "okay";
51};
52
53&uart1 {
54 pinctrl-names = "default";
55 pinctrl-0 = <&pinctrl_uart1_1>;
56 status = "okay";
57};
diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi
new file mode 100644
index 000000000000..e1eb7dadda80
--- /dev/null
+++ b/arch/arm/boot/dts/vf610.dtsi
@@ -0,0 +1,464 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#include "skeleton.dtsi"
11#include "vf610-pinfunc.h"
12#include <dt-bindings/clock/vf610-clock.h>
13
14/ {
15 aliases {
16 serial0 = &uart0;
17 serial1 = &uart1;
18 serial2 = &uart2;
19 serial3 = &uart3;
20 serial4 = &uart4;
21 serial5 = &uart5;
22 gpio0 = &gpio1;
23 gpio1 = &gpio2;
24 gpio2 = &gpio3;
25 gpio3 = &gpio4;
26 gpio4 = &gpio5;
27 };
28
29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
32
33 cpu@0 {
34 compatible = "arm,cortex-a5";
35 device_type = "cpu";
36 reg = <0x0>;
37 next-level-cache = <&L2>;
38 };
39 };
40
41 clocks {
42 #address-cells = <1>;
43 #size-cells = <0>;
44
45 sxosc {
46 compatible = "fixed-clock";
47 clock-frequency = <32768>;
48 };
49
50 fxosc {
51 compatible = "fixed-clock";
52 clock-frequency = <24000000>;
53 };
54 };
55
56 soc {
57 #address-cells = <1>;
58 #size-cells = <1>;
59 compatible = "simple-bus";
60 interrupt-parent = <&intc>;
61 ranges;
62
63 aips0: aips-bus@40000000 {
64 compatible = "fsl,aips-bus", "simple-bus";
65 #address-cells = <1>;
66 #size-cells = <1>;
67 interrupt-parent = <&intc>;
68 reg = <0x40000000 0x70000>;
69 ranges;
70
71 intc: interrupt-controller@40002000 {
72 compatible = "arm,cortex-a9-gic";
73 #interrupt-cells = <3>;
74 #address-cells = <1>;
75 #size-cells = <1>;
76 interrupt-controller;
77 reg = <0x40003000 0x1000>,
78 <0x40002100 0x100>;
79 };
80
81 L2: l2-cache@40006000 {
82 compatible = "arm,pl310-cache";
83 reg = <0x40006000 0x1000>;
84 cache-unified;
85 cache-level = <2>;
86 arm,data-latency = <1 1 1>;
87 arm,tag-latency = <2 2 2>;
88 };
89
90 uart0: serial@40027000 {
91 compatible = "fsl,vf610-lpuart";
92 reg = <0x40027000 0x1000>;
93 interrupts = <0 61 0x00>;
94 clocks = <&clks VF610_CLK_UART0>;
95 clock-names = "ipg";
96 status = "disabled";
97 };
98
99 uart1: serial@40028000 {
100 compatible = "fsl,vf610-lpuart";
101 reg = <0x40028000 0x1000>;
102 interrupts = <0 62 0x04>;
103 clocks = <&clks VF610_CLK_UART1>;
104 clock-names = "ipg";
105 status = "disabled";
106 };
107
108 uart2: serial@40029000 {
109 compatible = "fsl,vf610-lpuart";
110 reg = <0x40029000 0x1000>;
111 interrupts = <0 63 0x04>;
112 clocks = <&clks VF610_CLK_UART2>;
113 clock-names = "ipg";
114 status = "disabled";
115 };
116
117 uart3: serial@4002a000 {
118 compatible = "fsl,vf610-lpuart";
119 reg = <0x4002a000 0x1000>;
120 interrupts = <0 64 0x04>;
121 clocks = <&clks VF610_CLK_UART3>;
122 clock-names = "ipg";
123 status = "disabled";
124 };
125
126 sai2: sai@40031000 {
127 compatible = "fsl,vf610-sai";
128 reg = <0x40031000 0x1000>;
129 interrupts = <0 86 0x04>;
130 clocks = <&clks VF610_CLK_SAI2>;
131 clock-names = "sai";
132 status = "disabled";
133 };
134
135 pit: pit@40037000 {
136 compatible = "fsl,vf610-pit";
137 reg = <0x40037000 0x1000>;
138 interrupts = <0 39 0x04>;
139 clocks = <&clks VF610_CLK_PIT>;
140 clock-names = "pit";
141 };
142
143 wdog@4003e000 {
144 compatible = "fsl,vf610-wdt", "fsl,imx21-wdt";
145 reg = <0x4003e000 0x1000>;
146 clocks = <&clks VF610_CLK_WDT>;
147 clock-names = "wdog";
148 };
149
150 qspi0: quadspi@40044000 {
151 #address-cells = <1>;
152 #size-cells = <0>;
153 compatible = "fsl,vf610-qspi";
154 reg = <0x40044000 0x1000>;
155 interrupts = <0 24 0x04>;
156 clocks = <&clks VF610_CLK_QSPI0_EN>,
157 <&clks VF610_CLK_QSPI0>;
158 clock-names = "qspi_en", "qspi";
159 status = "disabled";
160 };
161
162 iomuxc: iomuxc@40048000 {
163 compatible = "fsl,vf610-iomuxc";
164 reg = <0x40048000 0x1000>;
165 #gpio-range-cells = <3>;
166
167 /* functions and groups pins */
168
169 dcu0 {
170 pinctrl_dcu0_1: dcu0grp_1 {
171 fsl,pins = <
172 VF610_PAD_PTB8__GPIO_30 0x42
173 VF610_PAD_PTE0__DCU0_HSYNC 0x42
174 VF610_PAD_PTE1__DCU0_VSYNC 0x42
175 VF610_PAD_PTE2__DCU0_PCLK 0x42
176 VF610_PAD_PTE4__DCU0_DE 0x42
177 VF610_PAD_PTE5__DCU0_R0 0x42
178 VF610_PAD_PTE6__DCU0_R1 0x42
179 VF610_PAD_PTE7__DCU0_R2 0x42
180 VF610_PAD_PTE8__DCU0_R3 0x42
181 VF610_PAD_PTE9__DCU0_R4 0x42
182 VF610_PAD_PTE10__DCU0_R5 0x42
183 VF610_PAD_PTE11__DCU0_R6 0x42
184 VF610_PAD_PTE12__DCU0_R7 0x42
185 VF610_PAD_PTE13__DCU0_G0 0x42
186 VF610_PAD_PTE14__DCU0_G1 0x42
187 VF610_PAD_PTE15__DCU0_G2 0x42
188 VF610_PAD_PTE16__DCU0_G3 0x42
189 VF610_PAD_PTE17__DCU0_G4 0x42
190 VF610_PAD_PTE18__DCU0_G5 0x42
191 VF610_PAD_PTE19__DCU0_G6 0x42
192 VF610_PAD_PTE20__DCU0_G7 0x42
193 VF610_PAD_PTE21__DCU0_B0 0x42
194 VF610_PAD_PTE22__DCU0_B1 0x42
195 VF610_PAD_PTE23__DCU0_B2 0x42
196 VF610_PAD_PTE24__DCU0_B3 0x42
197 VF610_PAD_PTE25__DCU0_B4 0x42
198 VF610_PAD_PTE26__DCU0_B5 0x42
199 VF610_PAD_PTE27__DCU0_B6 0x42
200 VF610_PAD_PTE28__DCU0_B7 0x42
201 >;
202 };
203 };
204
205 dspi0 {
206 pinctrl_dspi0_1: dspi0grp_1 {
207 fsl,pins = <
208 VF610_PAD_PTB19__DSPI0_CS0 0x1182
209 VF610_PAD_PTB20__DSPI0_SIN 0x1181
210 VF610_PAD_PTB21__DSPI0_SOUT 0x1182
211 VF610_PAD_PTB22__DSPI0_SCK 0x1182
212 >;
213 };
214 };
215
216 esdhc1 {
217 pinctrl_esdhc1_1: esdhc1grp_1 {
218 fsl,pins = <
219 VF610_PAD_PTA24__ESDHC1_CLK 0x31ef
220 VF610_PAD_PTA25__ESDHC1_CMD 0x31ef
221 VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef
222 VF610_PAD_PTA27__ESDHC1_DAT1 0x31ef
223 VF610_PAD_PTA28__ESDHC1_DATA2 0x31ef
224 VF610_PAD_PTA29__ESDHC1_DAT3 0x31ef
225 VF610_PAD_PTA7__GPIO_134 0x219d
226 >;
227 };
228 };
229
230 fec0 {
231 pinctrl_fec0_1: fec0grp_1 {
232 fsl,pins = <
233 VF610_PAD_PTA6__RMII_CLKIN 0x30d1
234 VF610_PAD_PTC0__ENET_RMII0_MDC 0x30d3
235 VF610_PAD_PTC1__ENET_RMII0_MDIO 0x30d1
236 VF610_PAD_PTC2__ENET_RMII0_CRS 0x30d1
237 VF610_PAD_PTC3__ENET_RMII0_RXD1 0x30d1
238 VF610_PAD_PTC4__ENET_RMII0_RXD0 0x30d1
239 VF610_PAD_PTC5__ENET_RMII0_RXER 0x30d1
240 VF610_PAD_PTC6__ENET_RMII0_TXD1 0x30d2
241 VF610_PAD_PTC7__ENET_RMII0_TXD0 0x30d2
242 VF610_PAD_PTC8__ENET_RMII0_TXEN 0x30d2
243 >;
244 };
245 };
246
247 fec1 {
248 pinctrl_fec1_1: fec1grp_1 {
249 fsl,pins = <
250 VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2
251 VF610_PAD_PTC10__ENET_RMII1_MDIO 0x30d3
252 VF610_PAD_PTC11__ENET_RMII1_CRS 0x30d1
253 VF610_PAD_PTC12__ENET_RMII_RXD1 0x30d1
254 VF610_PAD_PTC13__ENET_RMII1_RXD0 0x30d1
255 VF610_PAD_PTC14__ENET_RMII1_RXER 0x30d1
256 VF610_PAD_PTC15__ENET_RMII1_TXD1 0x30d2
257 VF610_PAD_PTC16__ENET_RMII1_TXD0 0x30d2
258 VF610_PAD_PTC17__ENET_RMII1_TXEN 0x30d2
259 >;
260 };
261 };
262
263 i2c0 {
264 pinctrl_i2c0_1: i2c0grp_1 {
265 fsl,pins = <
266 VF610_PAD_PTB14__I2C0_SCL 0x30d3
267 VF610_PAD_PTB15__I2C0_SDA 0x30d3
268 >;
269 };
270 };
271
272 pwm0 {
273 pinctrl_pwm0_1: pwm0grp_1 {
274 fsl,pins = <
275 VF610_PAD_PTB0__FTM0_CH0 0x1582
276 VF610_PAD_PTB1__FTM0_CH1 0x1582
277 VF610_PAD_PTB2__FTM0_CH2 0x1582
278 VF610_PAD_PTB3__FTM0_CH3 0x1582
279 VF610_PAD_PTB6__FTM0_CH6 0x1582
280 VF610_PAD_PTB7__FTM0_CH7 0x1582
281 >;
282 };
283 };
284
285 qspi0 {
286 pinctrl_qspi0_1: qspi0grp_1 {
287 fsl,pins = <
288 VF610_PAD_PTD0__QSPI0_A_QSCK 0x307b
289 VF610_PAD_PTD1__QSPI0_A_CS0 0x307f
290 VF610_PAD_PTD2__QSPI0_A_DATA3 0x3073
291 VF610_PAD_PTD3__QSPI0_A_DATA2 0x3073
292 VF610_PAD_PTD4__QSPI0_A_DATA1 0x3073
293 VF610_PAD_PTD5__QSPI0_A_DATA0 0x307b
294 VF610_PAD_PTD7__QSPI0_B_QSCK 0x307b
295 VF610_PAD_PTD8__QSPI0_B_CS0 0x307f
296 VF610_PAD_PTD9__QSPI0_B_DATA3 0x3073
297 VF610_PAD_PTD10__QSPI0_B_DATA2 0x3073
298 VF610_PAD_PTD11__QSPI0_B_DATA1 0x3073
299 VF610_PAD_PTD12__QSPI0_B_DATA0 0x307b
300 >;
301 };
302 };
303
304 sai2 {
305 pinctrl_sai2_1: sai2grp_1 {
306 fsl,pins = <
307 VF610_PAD_PTA16__SAI2_TX_BCLK 0x02ed
308 VF610_PAD_PTA18__SAI2_TX_DATA 0x02ee
309 VF610_PAD_PTA19__SAI2_TX_SYNC 0x02ed
310 VF610_PAD_PTA21__SAI2_RX_BCLK 0x02ed
311 VF610_PAD_PTA22__SAI2_RX_DATA 0x02ed
312 VF610_PAD_PTA23__SAI2_RX_SYNC 0x02ed
313 VF610_PAD_PTB18__EXT_AUDIO_MCLK 0x02ed
314 >;
315 };
316 };
317
318 uart1 {
319 pinctrl_uart1_1: uart1grp_1 {
320 fsl,pins = <
321 VF610_PAD_PTB4__UART1_TX 0x21a2
322 VF610_PAD_PTB5__UART1_RX 0x21a1
323 >;
324 };
325 };
326
327 usbvbus {
328 pinctrl_usbvbus_1: usbvbusgrp_1 {
329 fsl,pins = <
330 VF610_PAD_PTA24__USB1_VBUS_EN 0x219c
331 VF610_PAD_PTA16__USB0_VBUS_EN 0x219c
332 >;
333 };
334 };
335
336 };
337
338 gpio1: gpio@40049000 {
339 compatible = "fsl,vf610-gpio";
340 reg = <0x40049000 0x1000 0x400ff000 0x40>;
341 interrupts = <0 107 0x04>;
342 gpio-controller;
343 #gpio-cells = <2>;
344 interrupt-controller;
345 #interrupt-cells = <2>;
346 gpio-ranges = <&iomuxc 0 0 32>;
347 };
348
349 gpio2: gpio@4004a000 {
350 compatible = "fsl,vf610-gpio";
351 reg = <0x4004a000 0x1000 0x400ff040 0x40>;
352 interrupts = <0 108 0x04>;
353 gpio-controller;
354 #gpio-cells = <2>;
355 interrupt-controller;
356 #interrupt-cells = <2>;
357 gpio-ranges = <&iomuxc 0 32 32>;
358 };
359
360 gpio3: gpio@4004b000 {
361 compatible = "fsl,vf610-gpio";
362 reg = <0x4004b000 0x1000 0x400ff080 0x40>;
363 interrupts = <0 109 0x04>;
364 gpio-controller;
365 #gpio-cells = <2>;
366 interrupt-controller;
367 #interrupt-cells = <2>;
368 gpio-ranges = <&iomuxc 0 64 32>;
369 };
370
371 gpio4: gpio@4004c000 {
372 compatible = "fsl,vf610-gpio";
373 reg = <0x4004c000 0x1000 0x400ff0c0 0x40>;
374 interrupts = <0 110 0x04>;
375 gpio-controller;
376 #gpio-cells = <2>;
377 interrupt-controller;
378 #interrupt-cells = <2>;
379 gpio-ranges = <&iomuxc 0 96 32>;
380 };
381
382 gpio5: gpio@4004d000 {
383 compatible = "fsl,vf610-gpio";
384 reg = <0x4004d000 0x1000 0x400ff100 0x40>;
385 interrupts = <0 111 0x04>;
386 gpio-controller;
387 #gpio-cells = <2>;
388 interrupt-controller;
389 #interrupt-cells = <2>;
390 gpio-ranges = <&iomuxc 0 128 7>;
391 };
392
393 anatop@40050000 {
394 compatible = "fsl,vf610-anatop";
395 reg = <0x40050000 0x1000>;
396 };
397
398 i2c0: i2c@40066000 {
399 #address-cells = <1>;
400 #size-cells = <0>;
401 compatible = "fsl,vf610-i2c";
402 reg = <0x40066000 0x1000>;
403 interrupts =<0 71 0x04>;
404 clocks = <&clks VF610_CLK_I2C0>;
405 clock-names = "ipg";
406 status = "disabled";
407 };
408
409 clks: ccm@4006b000 {
410 compatible = "fsl,vf610-ccm";
411 reg = <0x4006b000 0x1000>;
412 #clock-cells = <1>;
413 };
414 };
415
416 aips1: aips-bus@40080000 {
417 compatible = "fsl,aips-bus", "simple-bus";
418 #address-cells = <1>;
419 #size-cells = <1>;
420 reg = <0x40080000 0x80000>;
421 ranges;
422
423 uart4: serial@400a9000 {
424 compatible = "fsl,vf610-lpuart";
425 reg = <0x400a9000 0x1000>;
426 interrupts = <0 65 0x04>;
427 clocks = <&clks VF610_CLK_UART4>;
428 clock-names = "ipg";
429 status = "disabled";
430 };
431
432 uart5: serial@400aa000 {
433 compatible = "fsl,vf610-lpuart";
434 reg = <0x400aa000 0x1000>;
435 interrupts = <0 66 0x04>;
436 clocks = <&clks VF610_CLK_UART5>;
437 clock-names = "ipg";
438 status = "disabled";
439 };
440
441 fec0: ethernet@400d0000 {
442 compatible = "fsl,mvf600-fec";
443 reg = <0x400d0000 0x1000>;
444 interrupts = <0 78 0x04>;
445 clocks = <&clks VF610_CLK_ENET>,
446 <&clks VF610_CLK_ENET>,
447 <&clks VF610_CLK_ENET>;
448 clock-names = "ipg", "ahb", "ptp";
449 status = "disabled";
450 };
451
452 fec1: ethernet@400d1000 {
453 compatible = "fsl,mvf600-fec";
454 reg = <0x400d1000 0x1000>;
455 interrupts = <0 79 0x04>;
456 clocks = <&clks VF610_CLK_ENET>,
457 <&clks VF610_CLK_ENET>,
458 <&clks VF610_CLK_ENET>;
459 clock-names = "ipg", "ahb", "ptp";
460 status = "disabled";
461 };
462 };
463 };
464};
diff --git a/arch/arm/boot/dts/vt8500-bv07.dts b/arch/arm/boot/dts/vt8500-bv07.dts
index 877b33afa7ed..87f33310e2bc 100644
--- a/arch/arm/boot/dts/vt8500-bv07.dts
+++ b/arch/arm/boot/dts/vt8500-bv07.dts
@@ -30,3 +30,7 @@
30 }; 30 };
31 }; 31 };
32}; 32};
33
34&uart0 {
35 status = "okay";
36};
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi
index 4a4b96f6827e..51d0e912c8f5 100644
--- a/arch/arm/boot/dts/vt8500.dtsi
+++ b/arch/arm/boot/dts/vt8500.dtsi
@@ -11,6 +11,23 @@
11/ { 11/ {
12 compatible = "via,vt8500"; 12 compatible = "via,vt8500";
13 13
14 cpus {
15 #address-cells = <0>;
16 #size-cells = <0>;
17
18 cpu {
19 device_type = "cpu";
20 compatible = "arm,arm926ej-s";
21 };
22 };
23
24 aliases {
25 serial0 = &uart0;
26 serial1 = &uart1;
27 serial2 = &uart2;
28 serial3 = &uart3;
29 };
30
14 soc { 31 soc {
15 #address-cells = <1>; 32 #address-cells = <1>;
16 #size-cells = <1>; 33 #size-cells = <1>;
@@ -111,32 +128,36 @@
111 reg = <0xd8050400 0x100>; 128 reg = <0xd8050400 0x100>;
112 }; 129 };
113 130
114 uart@d8200000 { 131 uart0: serial@d8200000 {
115 compatible = "via,vt8500-uart"; 132 compatible = "via,vt8500-uart";
116 reg = <0xd8200000 0x1040>; 133 reg = <0xd8200000 0x1040>;
117 interrupts = <32>; 134 interrupts = <32>;
118 clocks = <&clkuart0>; 135 clocks = <&clkuart0>;
136 status = "disabled";
119 }; 137 };
120 138
121 uart@d82b0000 { 139 uart1: serial@d82b0000 {
122 compatible = "via,vt8500-uart"; 140 compatible = "via,vt8500-uart";
123 reg = <0xd82b0000 0x1040>; 141 reg = <0xd82b0000 0x1040>;
124 interrupts = <33>; 142 interrupts = <33>;
125 clocks = <&clkuart1>; 143 clocks = <&clkuart1>;
144 status = "disabled";
126 }; 145 };
127 146
128 uart@d8210000 { 147 uart2: serial@d8210000 {
129 compatible = "via,vt8500-uart"; 148 compatible = "via,vt8500-uart";
130 reg = <0xd8210000 0x1040>; 149 reg = <0xd8210000 0x1040>;
131 interrupts = <47>; 150 interrupts = <47>;
132 clocks = <&clkuart2>; 151 clocks = <&clkuart2>;
152 status = "disabled";
133 }; 153 };
134 154
135 uart@d82c0000 { 155 uart3: serial@d82c0000 {
136 compatible = "via,vt8500-uart"; 156 compatible = "via,vt8500-uart";
137 reg = <0xd82c0000 0x1040>; 157 reg = <0xd82c0000 0x1040>;
138 interrupts = <50>; 158 interrupts = <50>;
139 clocks = <&clkuart3>; 159 clocks = <&clkuart3>;
160 status = "disabled";
140 }; 161 };
141 162
142 rtc@d8100000 { 163 rtc@d8100000 {
diff --git a/arch/arm/boot/dts/wm8505-ref.dts b/arch/arm/boot/dts/wm8505-ref.dts
index edd2cec3d37f..e3e6b9eb09d0 100644
--- a/arch/arm/boot/dts/wm8505-ref.dts
+++ b/arch/arm/boot/dts/wm8505-ref.dts
@@ -30,3 +30,7 @@
30 }; 30 };
31 }; 31 };
32}; 32};
33
34&uart0 {
35 status = "okay";
36};
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index b2bf359e852f..a1a854b8a454 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -12,11 +12,24 @@
12 compatible = "wm,wm8505"; 12 compatible = "wm,wm8505";
13 13
14 cpus { 14 cpus {
15 cpu@0 { 15 #address-cells = <0>;
16 compatible = "arm,arm926ejs"; 16 #size-cells = <0>;
17
18 cpu {
19 device_type = "cpu";
20 compatible = "arm,arm926ej-s";
17 }; 21 };
18 }; 22 };
19 23
24 aliases {
25 serial0 = &uart0;
26 serial1 = &uart1;
27 serial2 = &uart2;
28 serial3 = &uart3;
29 serial4 = &uart4;
30 serial5 = &uart5;
31 };
32
20 soc { 33 soc {
21 #address-cells = <1>; 34 #address-cells = <1>;
22 #size-cells = <1>; 35 #size-cells = <1>;
@@ -68,6 +81,13 @@
68 clock-frequency = <25000000>; 81 clock-frequency = <25000000>;
69 }; 82 };
70 83
84 plla: plla {
85 #clock-cells = <0>;
86 compatible = "via,vt8500-pll-clock";
87 clocks = <&ref25>;
88 reg = <0x200>;
89 };
90
71 pllb: pllb { 91 pllb: pllb {
72 #clock-cells = <0>; 92 #clock-cells = <0>;
73 compatible = "via,vt8500-pll-clock"; 93 compatible = "via,vt8500-pll-clock";
@@ -75,6 +95,48 @@
75 reg = <0x204>; 95 reg = <0x204>;
76 }; 96 };
77 97
98 pllc: pllc {
99 #clock-cells = <0>;
100 compatible = "via,vt8500-pll-clock";
101 clocks = <&ref25>;
102 reg = <0x208>;
103 };
104
105 plld: plld {
106 #clock-cells = <0>;
107 compatible = "via,vt8500-pll-clock";
108 clocks = <&ref25>;
109 reg = <0x20c>;
110 };
111
112 clkarm: arm {
113 #clock-cells = <0>;
114 compatible = "via,vt8500-device-clock";
115 clocks = <&plla>;
116 divisor-reg = <0x300>;
117 };
118
119 clkahb: ahb {
120 #clock-cells = <0>;
121 compatible = "via,vt8500-device-clock";
122 clocks = <&pllb>;
123 divisor-reg = <0x304>;
124 };
125
126 clkapb: apb {
127 #clock-cells = <0>;
128 compatible = "via,vt8500-device-clock";
129 clocks = <&pllb>;
130 divisor-reg = <0x350>;
131 };
132
133 clkddr: ddr {
134 #clock-cells = <0>;
135 compatible = "via,vt8500-device-clock";
136 clocks = <&plld>;
137 divisor-reg = <0x310>;
138 };
139
78 clkuart0: uart0 { 140 clkuart0: uart0 {
79 #clock-cells = <0>; 141 #clock-cells = <0>;
80 compatible = "via,vt8500-device-clock"; 142 compatible = "via,vt8500-device-clock";
@@ -163,46 +225,52 @@
163 reg = <0xd8050400 0x100>; 225 reg = <0xd8050400 0x100>;
164 }; 226 };
165 227
166 uart@d8200000 { 228 uart0: serial@d8200000 {
167 compatible = "via,vt8500-uart"; 229 compatible = "via,vt8500-uart";
168 reg = <0xd8200000 0x1040>; 230 reg = <0xd8200000 0x1040>;
169 interrupts = <32>; 231 interrupts = <32>;
170 clocks = <&clkuart0>; 232 clocks = <&clkuart0>;
233 status = "disabled";
171 }; 234 };
172 235
173 uart@d82b0000 { 236 uart1: serial@d82b0000 {
174 compatible = "via,vt8500-uart"; 237 compatible = "via,vt8500-uart";
175 reg = <0xd82b0000 0x1040>; 238 reg = <0xd82b0000 0x1040>;
176 interrupts = <33>; 239 interrupts = <33>;
177 clocks = <&clkuart1>; 240 clocks = <&clkuart1>;
241 status = "disabled";
178 }; 242 };
179 243
180 uart@d8210000 { 244 uart2: serial@d8210000 {
181 compatible = "via,vt8500-uart"; 245 compatible = "via,vt8500-uart";
182 reg = <0xd8210000 0x1040>; 246 reg = <0xd8210000 0x1040>;
183 interrupts = <47>; 247 interrupts = <47>;
184 clocks = <&clkuart2>; 248 clocks = <&clkuart2>;
249 status = "disabled";
185 }; 250 };
186 251
187 uart@d82c0000 { 252 uart3: serial@d82c0000 {
188 compatible = "via,vt8500-uart"; 253 compatible = "via,vt8500-uart";
189 reg = <0xd82c0000 0x1040>; 254 reg = <0xd82c0000 0x1040>;
190 interrupts = <50>; 255 interrupts = <50>;
191 clocks = <&clkuart3>; 256 clocks = <&clkuart3>;
257 status = "disabled";
192 }; 258 };
193 259
194 uart@d8370000 { 260 uart4: serial@d8370000 {
195 compatible = "via,vt8500-uart"; 261 compatible = "via,vt8500-uart";
196 reg = <0xd8370000 0x1040>; 262 reg = <0xd8370000 0x1040>;
197 interrupts = <31>; 263 interrupts = <31>;
198 clocks = <&clkuart4>; 264 clocks = <&clkuart4>;
265 status = "disabled";
199 }; 266 };
200 267
201 uart@d8380000 { 268 uart5: serial@d8380000 {
202 compatible = "via,vt8500-uart"; 269 compatible = "via,vt8500-uart";
203 reg = <0xd8380000 0x1040>; 270 reg = <0xd8380000 0x1040>;
204 interrupts = <30>; 271 interrupts = <30>;
205 clocks = <&clkuart5>; 272 clocks = <&clkuart5>;
273 status = "disabled";
206 }; 274 };
207 275
208 rtc@d8100000 { 276 rtc@d8100000 {
diff --git a/arch/arm/boot/dts/wm8650-mid.dts b/arch/arm/boot/dts/wm8650-mid.dts
index 61671a0d9ede..dd0d1b602388 100644
--- a/arch/arm/boot/dts/wm8650-mid.dts
+++ b/arch/arm/boot/dts/wm8650-mid.dts
@@ -32,3 +32,6 @@
32 }; 32 };
33}; 33};
34 34
35&uart0 {
36 status = "okay";
37};
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index dd8464eeb40d..7525982262ac 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -11,6 +11,21 @@
11/ { 11/ {
12 compatible = "wm,wm8650"; 12 compatible = "wm,wm8650";
13 13
14 cpus {
15 #address-cells = <0>;
16 #size-cells = <0>;
17
18 cpu {
19 device_type = "cpu";
20 compatible = "arm,arm926ej-s";
21 };
22 };
23
24 aliases {
25 serial0 = &uart0;
26 serial1 = &uart1;
27 };
28
14 soc { 29 soc {
15 #address-cells = <1>; 30 #address-cells = <1>;
16 #size-cells = <1>; 31 #size-cells = <1>;
@@ -77,6 +92,55 @@
77 reg = <0x204>; 92 reg = <0x204>;
78 }; 93 };
79 94
95 pllc: pllc {
96 #clock-cells = <0>;
97 compatible = "wm,wm8650-pll-clock";
98 clocks = <&ref25>;
99 reg = <0x208>;
100 };
101
102 plld: plld {
103 #clock-cells = <0>;
104 compatible = "wm,wm8650-pll-clock";
105 clocks = <&ref25>;
106 reg = <0x20c>;
107 };
108
109 plle: plle {
110 #clock-cells = <0>;
111 compatible = "wm,wm8650-pll-clock";
112 clocks = <&ref25>;
113 reg = <0x210>;
114 };
115
116 clkarm: arm {
117 #clock-cells = <0>;
118 compatible = "via,vt8500-device-clock";
119 clocks = <&plla>;
120 divisor-reg = <0x300>;
121 };
122
123 clkahb: ahb {
124 #clock-cells = <0>;
125 compatible = "via,vt8500-device-clock";
126 clocks = <&pllb>;
127 divisor-reg = <0x304>;
128 };
129
130 clkapb: apb {
131 #clock-cells = <0>;
132 compatible = "via,vt8500-device-clock";
133 clocks = <&pllb>;
134 divisor-reg = <0x320>;
135 };
136
137 clkddr: ddr {
138 #clock-cells = <0>;
139 compatible = "via,vt8500-device-clock";
140 clocks = <&plld>;
141 divisor-reg = <0x310>;
142 };
143
80 clkuart0: uart0 { 144 clkuart0: uart0 {
81 #clock-cells = <0>; 145 #clock-cells = <0>;
82 compatible = "via,vt8500-device-clock"; 146 compatible = "via,vt8500-device-clock";
@@ -93,14 +157,7 @@
93 enable-bit = <2>; 157 enable-bit = <2>;
94 }; 158 };
95 159
96 arm: arm { 160 clksdhc: sdhc {
97 #clock-cells = <0>;
98 compatible = "via,vt8500-device-clock";
99 clocks = <&plla>;
100 divisor-reg = <0x300>;
101 };
102
103 sdhc: sdhc {
104 #clock-cells = <0>; 161 #clock-cells = <0>;
105 compatible = "via,vt8500-device-clock"; 162 compatible = "via,vt8500-device-clock";
106 clocks = <&pllb>; 163 clocks = <&pllb>;
@@ -140,18 +197,20 @@
140 reg = <0xd8050400 0x100>; 197 reg = <0xd8050400 0x100>;
141 }; 198 };
142 199
143 uart@d8200000 { 200 uart0: serial@d8200000 {
144 compatible = "via,vt8500-uart"; 201 compatible = "via,vt8500-uart";
145 reg = <0xd8200000 0x1040>; 202 reg = <0xd8200000 0x1040>;
146 interrupts = <32>; 203 interrupts = <32>;
147 clocks = <&clkuart0>; 204 clocks = <&clkuart0>;
205 status = "disabled";
148 }; 206 };
149 207
150 uart@d82b0000 { 208 uart1: serial@d82b0000 {
151 compatible = "via,vt8500-uart"; 209 compatible = "via,vt8500-uart";
152 reg = <0xd82b0000 0x1040>; 210 reg = <0xd82b0000 0x1040>;
153 interrupts = <33>; 211 interrupts = <33>;
154 clocks = <&clkuart1>; 212 clocks = <&clkuart1>;
213 status = "disabled";
155 }; 214 };
156 215
157 rtc@d8100000 { 216 rtc@d8100000 {
diff --git a/arch/arm/boot/dts/wm8750-apc8750.dts b/arch/arm/boot/dts/wm8750-apc8750.dts
new file mode 100644
index 000000000000..37e4a408bf39
--- /dev/null
+++ b/arch/arm/boot/dts/wm8750-apc8750.dts
@@ -0,0 +1,30 @@
1/*
2 * wm8750-apc8750.dts
3 * - Device tree file for VIA APC8750
4 *
5 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
6 *
7 * Licensed under GPLv2 or later
8 */
9
10/dts-v1/;
11/include/ "wm8750.dtsi"
12
13/ {
14 model = "VIA APC8750";
15};
16
17&pinctrl {
18 pinctrl-names = "default";
19 pinctrl-0 = <&i2c>;
20
21 i2c: i2c {
22 wm,pins = <168 169 170 171>;
23 wm,function = <2>; /* alt */
24 wm,pull = <2>; /* pull-up */
25 };
26};
27
28&uart0 {
29 status = "okay";
30};
diff --git a/arch/arm/boot/dts/wm8750.dtsi b/arch/arm/boot/dts/wm8750.dtsi
new file mode 100644
index 000000000000..557a9c2ace49
--- /dev/null
+++ b/arch/arm/boot/dts/wm8750.dtsi
@@ -0,0 +1,347 @@
1/*
2 * wm8750.dtsi - Device tree file for Wondermedia WM8750 SoC
3 *
4 * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
5 *
6 * Licensed under GPLv2 or later
7 */
8
9/include/ "skeleton.dtsi"
10
11/ {
12 compatible = "wm,wm8750";
13
14 cpus {
15 #address-cells = <0>;
16 #size-cells = <0>;
17
18 cpu {
19 device_type = "cpu";
20 compatible = "arm,arm1176ej-s";
21 };
22 };
23
24 aliases {
25 serial0 = &uart0;
26 serial1 = &uart1;
27 serial2 = &uart2;
28 serial3 = &uart3;
29 serial4 = &uart4;
30 serial5 = &uart5;
31 i2c0 = &i2c_0;
32 i2c1 = &i2c_1;
33 };
34
35 soc {
36 #address-cells = <1>;
37 #size-cells = <1>;
38 compatible = "simple-bus";
39 ranges;
40 interrupt-parent = <&intc0>;
41
42 intc0: interrupt-controller@d8140000 {
43 compatible = "via,vt8500-intc";
44 interrupt-controller;
45 reg = <0xd8140000 0x10000>;
46 #interrupt-cells = <1>;
47 };
48
49 /* Secondary IC cascaded to intc0 */
50 intc1: interrupt-controller@d8150000 {
51 compatible = "via,vt8500-intc";
52 interrupt-controller;
53 #interrupt-cells = <1>;
54 reg = <0xD8150000 0x10000>;
55 interrupts = <56 57 58 59 60 61 62 63>;
56 };
57
58 pinctrl: pinctrl@d8110000 {
59 compatible = "wm,wm8750-pinctrl";
60 reg = <0xd8110000 0x10000>;
61 interrupt-controller;
62 #interrupt-cells = <2>;
63 gpio-controller;
64 #gpio-cells = <2>;
65 };
66
67 pmc@d8130000 {
68 compatible = "via,vt8500-pmc";
69 reg = <0xd8130000 0x1000>;
70
71 clocks {
72 #address-cells = <1>;
73 #size-cells = <0>;
74
75 ref24: ref24M {
76 #clock-cells = <0>;
77 compatible = "fixed-clock";
78 clock-frequency = <24000000>;
79 };
80
81 ref25: ref25M {
82 #clock-cells = <0>;
83 compatible = "fixed-clock";
84 clock-frequency = <25000000>;
85 };
86
87 plla: plla {
88 #clock-cells = <0>;
89 compatible = "wm,wm8750-pll-clock";
90 clocks = <&ref25>;
91 reg = <0x200>;
92 };
93
94 pllb: pllb {
95 #clock-cells = <0>;
96 compatible = "wm,wm8750-pll-clock";
97 clocks = <&ref25>;
98 reg = <0x204>;
99 };
100
101 pllc: pllc {
102 #clock-cells = <0>;
103 compatible = "wm,wm8750-pll-clock";
104 clocks = <&ref25>;
105 reg = <0x208>;
106 };
107
108 plld: plld {
109 #clock-cells = <0>;
110 compatible = "wm,wm8750-pll-clock";
111 clocks = <&ref25>;
112 reg = <0x20C>;
113 };
114
115 plle: plle {
116 #clock-cells = <0>;
117 compatible = "wm,wm8750-pll-clock";
118 clocks = <&ref25>;
119 reg = <0x210>;
120 };
121
122 clkarm: arm {
123 #clock-cells = <0>;
124 compatible = "via,vt8500-device-clock";
125 clocks = <&plla>;
126 divisor-reg = <0x300>;
127 };
128
129 clkahb: ahb {
130 #clock-cells = <0>;
131 compatible = "via,vt8500-device-clock";
132 clocks = <&pllb>;
133 divisor-reg = <0x304>;
134 };
135
136 clkapb: apb {
137 #clock-cells = <0>;
138 compatible = "via,vt8500-device-clock";
139 clocks = <&pllb>;
140 divisor-reg = <0x320>;
141 };
142
143 clkddr: ddr {
144 #clock-cells = <0>;
145 compatible = "via,vt8500-device-clock";
146 clocks = <&plld>;
147 divisor-reg = <0x310>;
148 };
149
150 clkuart0: uart0 {
151 #clock-cells = <0>;
152 compatible = "via,vt8500-device-clock";
153 clocks = <&ref24>;
154 enable-reg = <0x254>;
155 enable-bit = <24>;
156 };
157
158 clkuart1: uart1 {
159 #clock-cells = <0>;
160 compatible = "via,vt8500-device-clock";
161 clocks = <&ref24>;
162 enable-reg = <0x254>;
163 enable-bit = <25>;
164 };
165
166 clkuart2: uart2 {
167 #clock-cells = <0>;
168 compatible = "via,vt8500-device-clock";
169 clocks = <&ref24>;
170 enable-reg = <0x254>;
171 enable-bit = <26>;
172 };
173
174 clkuart3: uart3 {
175 #clock-cells = <0>;
176 compatible = "via,vt8500-device-clock";
177 clocks = <&ref24>;
178 enable-reg = <0x254>;
179 enable-bit = <27>;
180 };
181
182 clkuart4: uart4 {
183 #clock-cells = <0>;
184 compatible = "via,vt8500-device-clock";
185 clocks = <&ref24>;
186 enable-reg = <0x254>;
187 enable-bit = <28>;
188 };
189
190 clkuart5: uart5 {
191 #clock-cells = <0>;
192 compatible = "via,vt8500-device-clock";
193 clocks = <&ref24>;
194 enable-reg = <0x254>;
195 enable-bit = <29>;
196 };
197
198 clkpwm: pwm {
199 #clock-cells = <0>;
200 compatible = "via,vt8500-device-clock";
201 clocks = <&pllb>;
202 divisor-reg = <0x350>;
203 enable-reg = <0x250>;
204 enable-bit = <17>;
205 };
206
207 clksdhc: sdhc {
208 #clock-cells = <0>;
209 compatible = "via,vt8500-device-clock";
210 clocks = <&pllb>;
211 divisor-reg = <0x330>;
212 divisor-mask = <0x3f>;
213 enable-reg = <0x250>;
214 enable-bit = <0>;
215 };
216
217 clki2c0: i2c0clk {
218 #clock-cells = <0>;
219 compatible = "via,vt8500-device-clock";
220 clocks = <&pllb>;
221 divisor-reg = <0x3A0>;
222 enable-reg = <0x250>;
223 enable-bit = <8>;
224 };
225
226 clki2c1: i2c1clk {
227 #clock-cells = <0>;
228 compatible = "via,vt8500-device-clock";
229 clocks = <&pllb>;
230 divisor-reg = <0x3A4>;
231 enable-reg = <0x250>;
232 enable-bit = <9>;
233 };
234 };
235 };
236
237 pwm: pwm@d8220000 {
238 #pwm-cells = <3>;
239 compatible = "via,vt8500-pwm";
240 reg = <0xd8220000 0x100>;
241 clocks = <&clkpwm>;
242 };
243
244 timer@d8130100 {
245 compatible = "via,vt8500-timer";
246 reg = <0xd8130100 0x28>;
247 interrupts = <36>;
248 };
249
250 ehci@d8007900 {
251 compatible = "via,vt8500-ehci";
252 reg = <0xd8007900 0x200>;
253 interrupts = <26>;
254 };
255
256 uhci@d8007b00 {
257 compatible = "platform-uhci";
258 reg = <0xd8007b00 0x200>;
259 interrupts = <26>;
260 };
261
262 uhci@d8008d00 {
263 compatible = "platform-uhci";
264 reg = <0xd8008d00 0x200>;
265 interrupts = <26>;
266 };
267
268 uart0: serial@d8200000 {
269 compatible = "via,vt8500-uart";
270 reg = <0xd8200000 0x1040>;
271 interrupts = <32>;
272 clocks = <&clkuart0>;
273 status = "disabled";
274 };
275
276 uart1: serial@d82b0000 {
277 compatible = "via,vt8500-uart";
278 reg = <0xd82b0000 0x1040>;
279 interrupts = <33>;
280 clocks = <&clkuart1>;
281 status = "disabled";
282 };
283
284 uart2: serial@d8210000 {
285 compatible = "via,vt8500-uart";
286 reg = <0xd8210000 0x1040>;
287 interrupts = <47>;
288 clocks = <&clkuart2>;
289 status = "disabled";
290 };
291
292 uart3: serial@d82c0000 {
293 compatible = "via,vt8500-uart";
294 reg = <0xd82c0000 0x1040>;
295 interrupts = <50>;
296 clocks = <&clkuart3>;
297 status = "disabled";
298 };
299
300 uart4: serial@d8370000 {
301 compatible = "via,vt8500-uart";
302 reg = <0xd8370000 0x1040>;
303 interrupts = <30>;
304 clocks = <&clkuart4>;
305 status = "disabled";
306 };
307
308 uart5: serial@d8380000 {
309 compatible = "via,vt8500-uart";
310 reg = <0xd8380000 0x1040>;
311 interrupts = <43>;
312 clocks = <&clkuart5>;
313 status = "disabled";
314 };
315
316 rtc@d8100000 {
317 compatible = "via,vt8500-rtc";
318 reg = <0xd8100000 0x10000>;
319 interrupts = <48>;
320 };
321
322 sdhc@d800a000 {
323 compatible = "wm,wm8505-sdhc";
324 reg = <0xd800a000 0x1000>;
325 interrupts = <20 21>;
326 clocks = <&clksdhc>;
327 bus-width = <4>;
328 sdon-inverted;
329 };
330
331 i2c_0: i2c@d8280000 {
332 compatible = "wm,wm8505-i2c";
333 reg = <0xd8280000 0x1000>;
334 interrupts = <19>;
335 clocks = <&clki2c0>;
336 clock-frequency = <400000>;
337 };
338
339 i2c_1: i2c@d8320000 {
340 compatible = "wm,wm8505-i2c";
341 reg = <0xd8320000 0x1000>;
342 interrupts = <18>;
343 clocks = <&clki2c1>;
344 clock-frequency = <400000>;
345 };
346 };
347};
diff --git a/arch/arm/boot/dts/wm8850-w70v2.dts b/arch/arm/boot/dts/wm8850-w70v2.dts
index 32d22532cd6c..90e913fb64be 100644
--- a/arch/arm/boot/dts/wm8850-w70v2.dts
+++ b/arch/arm/boot/dts/wm8850-w70v2.dts
@@ -41,3 +41,7 @@
41 }; 41 };
42 }; 42 };
43}; 43};
44
45&uart0 {
46 status = "okay";
47};
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi
index fc790d0aee66..d98386dd2882 100644
--- a/arch/arm/boot/dts/wm8850.dtsi
+++ b/arch/arm/boot/dts/wm8850.dtsi
@@ -11,6 +11,17 @@
11/ { 11/ {
12 compatible = "wm,wm8850"; 12 compatible = "wm,wm8850";
13 13
14 cpus {
15 #address-cells = <1>;
16 #size-cells = <0>;
17
18 cpu@0 {
19 device_type = "cpu";
20 compatible = "arm,cortex-a9";
21 reg = <0x0>;
22 };
23 };
24
14 aliases { 25 aliases {
15 serial0 = &uart0; 26 serial0 = &uart0;
16 serial1 = &uart1; 27 serial1 = &uart1;
@@ -72,18 +83,81 @@
72 83
73 plla: plla { 84 plla: plla {
74 #clock-cells = <0>; 85 #clock-cells = <0>;
75 compatible = "wm,wm8750-pll-clock"; 86 compatible = "wm,wm8850-pll-clock";
76 clocks = <&ref25>; 87 clocks = <&ref24>;
77 reg = <0x200>; 88 reg = <0x200>;
78 }; 89 };
79 90
80 pllb: pllb { 91 pllb: pllb {
81 #clock-cells = <0>; 92 #clock-cells = <0>;
82 compatible = "wm,wm8750-pll-clock"; 93 compatible = "wm,wm8850-pll-clock";
83 clocks = <&ref25>; 94 clocks = <&ref24>;
84 reg = <0x204>; 95 reg = <0x204>;
85 }; 96 };
86 97
98 pllc: pllc {
99 #clock-cells = <0>;
100 compatible = "wm,wm8850-pll-clock";
101 clocks = <&ref24>;
102 reg = <0x208>;
103 };
104
105 plld: plld {
106 #clock-cells = <0>;
107 compatible = "wm,wm8850-pll-clock";
108 clocks = <&ref24>;
109 reg = <0x20c>;
110 };
111
112 plle: plle {
113 #clock-cells = <0>;
114 compatible = "wm,wm8850-pll-clock";
115 clocks = <&ref24>;
116 reg = <0x210>;
117 };
118
119 pllf: pllf {
120 #clock-cells = <0>;
121 compatible = "wm,wm8850-pll-clock";
122 clocks = <&ref24>;
123 reg = <0x214>;
124 };
125
126 pllg: pllg {
127 #clock-cells = <0>;
128 compatible = "wm,wm8850-pll-clock";
129 clocks = <&ref24>;
130 reg = <0x218>;
131 };
132
133 clkarm: arm {
134 #clock-cells = <0>;
135 compatible = "via,vt8500-device-clock";
136 clocks = <&plla>;
137 divisor-reg = <0x300>;
138 };
139
140 clkahb: ahb {
141 #clock-cells = <0>;
142 compatible = "via,vt8500-device-clock";
143 clocks = <&pllb>;
144 divisor-reg = <0x304>;
145 };
146
147 clkapb: apb {
148 #clock-cells = <0>;
149 compatible = "via,vt8500-device-clock";
150 clocks = <&pllb>;
151 divisor-reg = <0x320>;
152 };
153
154 clkddr: ddr {
155 #clock-cells = <0>;
156 compatible = "via,vt8500-device-clock";
157 clocks = <&plld>;
158 divisor-reg = <0x310>;
159 };
160
87 clkuart0: uart0 { 161 clkuart0: uart0 {
88 #clock-cells = <0>; 162 #clock-cells = <0>;
89 compatible = "via,vt8500-device-clock"; 163 compatible = "via,vt8500-device-clock";
@@ -178,32 +252,36 @@
178 interrupts = <26>; 252 interrupts = <26>;
179 }; 253 };
180 254
181 uart0: uart@d8200000 { 255 uart0: serial@d8200000 {
182 compatible = "via,vt8500-uart"; 256 compatible = "via,vt8500-uart";
183 reg = <0xd8200000 0x1040>; 257 reg = <0xd8200000 0x1040>;
184 interrupts = <32>; 258 interrupts = <32>;
185 clocks = <&clkuart0>; 259 clocks = <&clkuart0>;
260 status = "disabled";
186 }; 261 };
187 262
188 uart1: uart@d82b0000 { 263 uart1: serial@d82b0000 {
189 compatible = "via,vt8500-uart"; 264 compatible = "via,vt8500-uart";
190 reg = <0xd82b0000 0x1040>; 265 reg = <0xd82b0000 0x1040>;
191 interrupts = <33>; 266 interrupts = <33>;
192 clocks = <&clkuart1>; 267 clocks = <&clkuart1>;
268 status = "disabled";
193 }; 269 };
194 270
195 uart2: uart@d8210000 { 271 uart2: serial@d8210000 {
196 compatible = "via,vt8500-uart"; 272 compatible = "via,vt8500-uart";
197 reg = <0xd8210000 0x1040>; 273 reg = <0xd8210000 0x1040>;
198 interrupts = <47>; 274 interrupts = <47>;
199 clocks = <&clkuart2>; 275 clocks = <&clkuart2>;
276 status = "disabled";
200 }; 277 };
201 278
202 uart3: uart@d82c0000 { 279 uart3: serial@d82c0000 {
203 compatible = "via,vt8500-uart"; 280 compatible = "via,vt8500-uart";
204 reg = <0xd82c0000 0x1040>; 281 reg = <0xd82c0000 0x1040>;
205 interrupts = <50>; 282 interrupts = <50>;
206 clocks = <&clkuart3>; 283 clocks = <&clkuart3>;
284 status = "disabled";
207 }; 285 };
208 286
209 rtc@d8100000 { 287 rtc@d8100000 {
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 14fb2e609bab..6f54a64850eb 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -49,16 +49,20 @@
49 49
50 uart0: uart@e0000000 { 50 uart0: uart@e0000000 {
51 compatible = "xlnx,xuartps"; 51 compatible = "xlnx,xuartps";
52 status = "disabled";
53 clocks = <&clkc 23>, <&clkc 40>;
54 clock-names = "ref_clk", "aper_clk";
52 reg = <0xE0000000 0x1000>; 55 reg = <0xE0000000 0x1000>;
53 interrupts = <0 27 4>; 56 interrupts = <0 27 4>;
54 clocks = <&uart_clk 0>;
55 }; 57 };
56 58
57 uart1: uart@e0001000 { 59 uart1: uart@e0001000 {
58 compatible = "xlnx,xuartps"; 60 compatible = "xlnx,xuartps";
61 status = "disabled";
62 clocks = <&clkc 24>, <&clkc 41>;
63 clock-names = "ref_clk", "aper_clk";
59 reg = <0xE0001000 0x1000>; 64 reg = <0xE0001000 0x1000>;
60 interrupts = <0 50 4>; 65 interrupts = <0 50 4>;
61 clocks = <&uart_clk 1>;
62 }; 66 };
63 67
64 slcr: slcr@f8000000 { 68 slcr: slcr@f8000000 {
@@ -69,50 +73,21 @@
69 #address-cells = <1>; 73 #address-cells = <1>;
70 #size-cells = <0>; 74 #size-cells = <0>;
71 75
72 ps_clk: ps_clk { 76 clkc: clkc {
73 #clock-cells = <0>;
74 compatible = "fixed-clock";
75 /* clock-frequency set in board-specific file */
76 clock-output-names = "ps_clk";
77 };
78 armpll: armpll {
79 #clock-cells = <0>;
80 compatible = "xlnx,zynq-pll";
81 clocks = <&ps_clk>;
82 reg = <0x100 0x110>;
83 clock-output-names = "armpll";
84 };
85 ddrpll: ddrpll {
86 #clock-cells = <0>;
87 compatible = "xlnx,zynq-pll";
88 clocks = <&ps_clk>;
89 reg = <0x104 0x114>;
90 clock-output-names = "ddrpll";
91 };
92 iopll: iopll {
93 #clock-cells = <0>;
94 compatible = "xlnx,zynq-pll";
95 clocks = <&ps_clk>;
96 reg = <0x108 0x118>;
97 clock-output-names = "iopll";
98 };
99 uart_clk: uart_clk {
100 #clock-cells = <1>;
101 compatible = "xlnx,zynq-periph-clock";
102 clocks = <&iopll &armpll &ddrpll>;
103 reg = <0x154>;
104 clock-output-names = "uart0_ref_clk",
105 "uart1_ref_clk";
106 };
107 cpu_clk: cpu_clk {
108 #clock-cells = <1>; 77 #clock-cells = <1>;
109 compatible = "xlnx,zynq-cpu-clock"; 78 compatible = "xlnx,ps7-clkc";
110 clocks = <&iopll &armpll &ddrpll>; 79 ps-clk-frequency = <33333333>;
111 reg = <0x120 0x1C4>; 80 clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x",
112 clock-output-names = "cpu_6x4x", 81 "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x",
113 "cpu_3x2x", 82 "dci", "lqspi", "smc", "pcap", "gem0", "gem1",
114 "cpu_2x", 83 "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1",
115 "cpu_1x"; 84 "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1",
85 "dma", "usb0_aper", "usb1_aper", "gem0_aper",
86 "gem1_aper", "sdio0_aper", "sdio1_aper",
87 "spi0_aper", "spi1_aper", "can0_aper", "can1_aper",
88 "i2c0_aper", "i2c1_aper", "uart0_aper", "uart1_aper",
89 "gpio_aper", "lqspi_aper", "smc_aper", "swdt",
90 "dbg_trc", "dbg_apb";
116 }; 91 };
117 }; 92 };
118 }; 93 };
@@ -121,9 +96,8 @@
121 interrupt-parent = <&intc>; 96 interrupt-parent = <&intc>;
122 interrupts = < 0 10 4 0 11 4 0 12 4 >; 97 interrupts = < 0 10 4 0 11 4 0 12 4 >;
123 compatible = "cdns,ttc"; 98 compatible = "cdns,ttc";
99 clocks = <&clkc 6>;
124 reg = <0xF8001000 0x1000>; 100 reg = <0xF8001000 0x1000>;
125 clocks = <&cpu_clk 3>;
126 clock-names = "cpu_1x";
127 clock-ranges; 101 clock-ranges;
128 }; 102 };
129 103
@@ -131,9 +105,8 @@
131 interrupt-parent = <&intc>; 105 interrupt-parent = <&intc>;
132 interrupts = < 0 37 4 0 38 4 0 39 4 >; 106 interrupts = < 0 37 4 0 38 4 0 39 4 >;
133 compatible = "cdns,ttc"; 107 compatible = "cdns,ttc";
108 clocks = <&clkc 6>;
134 reg = <0xF8002000 0x1000>; 109 reg = <0xF8002000 0x1000>;
135 clocks = <&cpu_clk 3>;
136 clock-names = "cpu_1x";
137 clock-ranges; 110 clock-ranges;
138 }; 111 };
139 scutimer: scutimer@f8f00600 { 112 scutimer: scutimer@f8f00600 {
@@ -141,7 +114,7 @@
141 interrupts = < 1 13 0x301 >; 114 interrupts = < 1 13 0x301 >;
142 compatible = "arm,cortex-a9-twd-timer"; 115 compatible = "arm,cortex-a9-twd-timer";
143 reg = < 0xf8f00600 0x20 >; 116 reg = < 0xf8f00600 0x20 >;
144 clocks = <&cpu_clk 1>; 117 clocks = <&clkc 4>;
145 } ; 118 } ;
146 }; 119 };
147}; 120};
diff --git a/arch/arm/boot/dts/zynq-zc702.dts b/arch/arm/boot/dts/zynq-zc702.dts
index 86f44d5b0265..21aea99a067b 100644
--- a/arch/arm/boot/dts/zynq-zc702.dts
+++ b/arch/arm/boot/dts/zynq-zc702.dts
@@ -24,11 +24,11 @@
24 }; 24 };
25 25
26 chosen { 26 chosen {
27 bootargs = "console=ttyPS1,115200 earlyprintk"; 27 bootargs = "console=ttyPS0,115200 earlyprintk";
28 }; 28 };
29 29
30}; 30};
31 31
32&ps_clk { 32&uart1 {
33 clock-frequency = <33333330>; 33 status = "okay";
34}; 34};
diff --git a/arch/arm/boot/dts/zynq-zc706.dts b/arch/arm/boot/dts/zynq-zc706.dts
new file mode 100644
index 000000000000..79009e0b74b9
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-zc706.dts
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2011 Xilinx
3 * Copyright (C) 2012 National Instruments Corp.
4 * Copyright (C) 2013 Xilinx
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15/dts-v1/;
16/include/ "zynq-7000.dtsi"
17
18/ {
19 model = "Zynq ZC706 Development Board";
20 compatible = "xlnx,zynq-zc706", "xlnx,zynq-7000";
21
22 memory {
23 device_type = "memory";
24 reg = <0 0x40000000>;
25 };
26
27 chosen {
28 bootargs = "console=ttyPS0,115200 earlyprintk";
29 };
30
31};
32
33&uart1 {
34 status = "okay";
35};
diff --git a/arch/arm/boot/dts/zynq-zed.dts b/arch/arm/boot/dts/zynq-zed.dts
new file mode 100644
index 000000000000..d6acf2b1cdf4
--- /dev/null
+++ b/arch/arm/boot/dts/zynq-zed.dts
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2011 Xilinx
3 * Copyright (C) 2012 National Instruments Corp.
4 * Copyright (C) 2013 Xilinx
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15/dts-v1/;
16/include/ "zynq-7000.dtsi"
17
18/ {
19 model = "Zynq Zed Development Board";
20 compatible = "xlnx,zynq-7000";
21
22 memory {
23 device_type = "memory";
24 reg = <0 0x20000000>;
25 };
26
27 chosen {
28 bootargs = "console=ttyPS0,115200 earlyprintk";
29 };
30
31};
32
33&uart1 {
34 status = "okay";
35};
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 9353184d730d..c3a4e9ceba34 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -17,3 +17,6 @@ config SHARP_PARAM
17 17
18config SHARP_SCOOP 18config SHARP_SCOOP
19 bool 19 bool
20
21config TI_PRIV_EDMA
22 bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 48434cbe3e89..8c60f473e976 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
16obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o 16obj-$(CONFIG_MCPM) += mcpm_head.o mcpm_entry.o mcpm_platsmp.o vlock.o
17AFLAGS_mcpm_head.o := -march=armv7-a 17AFLAGS_mcpm_head.o := -march=armv7-a
18AFLAGS_vlock.o := -march=armv7-a 18AFLAGS_vlock.o := -march=armv7-a
19obj-$(CONFIG_TI_PRIV_EDMA) += edma.o
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/common/edma.c
index 45b7c71d9cc1..a432e6c1dac1 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/common/edma.c
@@ -17,6 +17,7 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 19 */
20#include <linux/err.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/module.h> 23#include <linux/module.h>
@@ -24,8 +25,15 @@
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/io.h> 26#include <linux/io.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/edma.h>
29#include <linux/err.h>
30#include <linux/of_address.h>
31#include <linux/of_device.h>
32#include <linux/of_dma.h>
33#include <linux/of_irq.h>
34#include <linux/pm_runtime.h>
27 35
28#include <mach/edma.h> 36#include <linux/platform_data/edma.h>
29 37
30/* Offsets matching "struct edmacc_param" */ 38/* Offsets matching "struct edmacc_param" */
31#define PARM_OPT 0x00 39#define PARM_OPT 0x00
@@ -494,26 +502,6 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data)
494 return IRQ_HANDLED; 502 return IRQ_HANDLED;
495} 503}
496 504
497/******************************************************************************
498 *
499 * Transfer controller error interrupt handlers
500 *
501 *****************************************************************************/
502
503#define tc_errs_handled false /* disabled as long as they're NOPs */
504
505static irqreturn_t dma_tc0err_handler(int irq, void *data)
506{
507 dev_dbg(data, "dma_tc0err_handler\n");
508 return IRQ_HANDLED;
509}
510
511static irqreturn_t dma_tc1err_handler(int irq, void *data)
512{
513 dev_dbg(data, "dma_tc1err_handler\n");
514 return IRQ_HANDLED;
515}
516
517static int reserve_contiguous_slots(int ctlr, unsigned int id, 505static int reserve_contiguous_slots(int ctlr, unsigned int id,
518 unsigned int num_slots, 506 unsigned int num_slots,
519 unsigned int start_slot) 507 unsigned int start_slot)
@@ -1388,32 +1376,236 @@ void edma_clear_event(unsigned channel)
1388} 1376}
1389EXPORT_SYMBOL(edma_clear_event); 1377EXPORT_SYMBOL(edma_clear_event);
1390 1378
1391/*-----------------------------------------------------------------------*/ 1379#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DMADEVICES)
1380
1381static int edma_of_read_u32_to_s16_array(const struct device_node *np,
1382 const char *propname, s16 *out_values,
1383 size_t sz)
1384{
1385 int ret;
1386
1387 ret = of_property_read_u16_array(np, propname, out_values, sz);
1388 if (ret)
1389 return ret;
1390
1391 /* Terminate it */
1392 *out_values++ = -1;
1393 *out_values++ = -1;
1394
1395 return 0;
1396}
1397
1398static int edma_xbar_event_map(struct device *dev,
1399 struct device_node *node,
1400 struct edma_soc_info *pdata, int len)
1401{
1402 int ret, i;
1403 struct resource res;
1404 void __iomem *xbar;
1405 const s16 (*xbar_chans)[2];
1406 u32 shift, offset, mux;
1407
1408 xbar_chans = devm_kzalloc(dev,
1409 len/sizeof(s16) + 2*sizeof(s16),
1410 GFP_KERNEL);
1411 if (!xbar_chans)
1412 return -ENOMEM;
1413
1414 ret = of_address_to_resource(node, 1, &res);
1415 if (ret)
1416 return -EIO;
1417
1418 xbar = devm_ioremap(dev, res.start, resource_size(&res));
1419 if (!xbar)
1420 return -ENOMEM;
1421
1422 ret = edma_of_read_u32_to_s16_array(node,
1423 "ti,edma-xbar-event-map",
1424 (s16 *)xbar_chans,
1425 len/sizeof(u32));
1426 if (ret)
1427 return -EIO;
1428
1429 for (i = 0; xbar_chans[i][0] != -1; i++) {
1430 shift = (xbar_chans[i][1] & 0x03) << 3;
1431 offset = xbar_chans[i][1] & 0xfffffffc;
1432 mux = readl(xbar + offset);
1433 mux &= ~(0xff << shift);
1434 mux |= xbar_chans[i][0] << shift;
1435 writel(mux, (xbar + offset));
1436 }
1437
1438 pdata->xbar_chans = xbar_chans;
1439
1440 return 0;
1441}
1442
1443static int edma_of_parse_dt(struct device *dev,
1444 struct device_node *node,
1445 struct edma_soc_info *pdata)
1446{
1447 int ret = 0, i;
1448 u32 value;
1449 struct property *prop;
1450 size_t sz;
1451 struct edma_rsv_info *rsv_info;
1452 s8 (*queue_tc_map)[2], (*queue_priority_map)[2];
1453
1454 memset(pdata, 0, sizeof(struct edma_soc_info));
1455
1456 ret = of_property_read_u32(node, "dma-channels", &value);
1457 if (ret < 0)
1458 return ret;
1459 pdata->n_channel = value;
1460
1461 ret = of_property_read_u32(node, "ti,edma-regions", &value);
1462 if (ret < 0)
1463 return ret;
1464 pdata->n_region = value;
1465
1466 ret = of_property_read_u32(node, "ti,edma-slots", &value);
1467 if (ret < 0)
1468 return ret;
1469 pdata->n_slot = value;
1470
1471 pdata->n_cc = 1;
1472
1473 rsv_info = devm_kzalloc(dev, sizeof(struct edma_rsv_info), GFP_KERNEL);
1474 if (!rsv_info)
1475 return -ENOMEM;
1476 pdata->rsv = rsv_info;
1477
1478 queue_tc_map = devm_kzalloc(dev, 8*sizeof(s8), GFP_KERNEL);
1479 if (!queue_tc_map)
1480 return -ENOMEM;
1481
1482 for (i = 0; i < 3; i++) {
1483 queue_tc_map[i][0] = i;
1484 queue_tc_map[i][1] = i;
1485 }
1486 queue_tc_map[i][0] = -1;
1487 queue_tc_map[i][1] = -1;
1488
1489 pdata->queue_tc_mapping = queue_tc_map;
1490
1491 queue_priority_map = devm_kzalloc(dev, 8*sizeof(s8), GFP_KERNEL);
1492 if (!queue_priority_map)
1493 return -ENOMEM;
1494
1495 for (i = 0; i < 3; i++) {
1496 queue_priority_map[i][0] = i;
1497 queue_priority_map[i][1] = i;
1498 }
1499 queue_priority_map[i][0] = -1;
1500 queue_priority_map[i][1] = -1;
1501
1502 pdata->queue_priority_mapping = queue_priority_map;
1503
1504 pdata->default_queue = 0;
1505
1506 prop = of_find_property(node, "ti,edma-xbar-event-map", &sz);
1507 if (prop)
1508 ret = edma_xbar_event_map(dev, node, pdata, sz);
1509
1510 return ret;
1511}
1512
1513static struct of_dma_filter_info edma_filter_info = {
1514 .filter_fn = edma_filter_fn,
1515};
1516
1517static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev,
1518 struct device_node *node)
1519{
1520 struct edma_soc_info *info;
1521 int ret;
1522
1523 info = devm_kzalloc(dev, sizeof(struct edma_soc_info), GFP_KERNEL);
1524 if (!info)
1525 return ERR_PTR(-ENOMEM);
1392 1526
1393static int __init edma_probe(struct platform_device *pdev) 1527 ret = edma_of_parse_dt(dev, node, info);
1528 if (ret)
1529 return ERR_PTR(ret);
1530
1531 dma_cap_set(DMA_SLAVE, edma_filter_info.dma_cap);
1532 of_dma_controller_register(dev->of_node, of_dma_simple_xlate,
1533 &edma_filter_info);
1534
1535 return info;
1536}
1537#else
1538static struct edma_soc_info *edma_setup_info_from_dt(struct device *dev,
1539 struct device_node *node)
1540{
1541 return ERR_PTR(-ENOSYS);
1542}
1543#endif
1544
1545static int edma_probe(struct platform_device *pdev)
1394{ 1546{
1395 struct edma_soc_info **info = pdev->dev.platform_data; 1547 struct edma_soc_info **info = pdev->dev.platform_data;
1396 const s8 (*queue_priority_mapping)[2]; 1548 struct edma_soc_info *ninfo[EDMA_MAX_CC] = {NULL};
1397 const s8 (*queue_tc_mapping)[2]; 1549 s8 (*queue_priority_mapping)[2];
1550 s8 (*queue_tc_mapping)[2];
1398 int i, j, off, ln, found = 0; 1551 int i, j, off, ln, found = 0;
1399 int status = -1; 1552 int status = -1;
1400 const s16 (*rsv_chans)[2]; 1553 const s16 (*rsv_chans)[2];
1401 const s16 (*rsv_slots)[2]; 1554 const s16 (*rsv_slots)[2];
1555 const s16 (*xbar_chans)[2];
1402 int irq[EDMA_MAX_CC] = {0, 0}; 1556 int irq[EDMA_MAX_CC] = {0, 0};
1403 int err_irq[EDMA_MAX_CC] = {0, 0}; 1557 int err_irq[EDMA_MAX_CC] = {0, 0};
1404 struct resource *r[EDMA_MAX_CC] = {NULL}; 1558 struct resource *r[EDMA_MAX_CC] = {NULL};
1405 resource_size_t len[EDMA_MAX_CC]; 1559 struct resource res[EDMA_MAX_CC];
1406 char res_name[10]; 1560 char res_name[10];
1407 char irq_name[10]; 1561 char irq_name[10];
1562 struct device_node *node = pdev->dev.of_node;
1563 struct device *dev = &pdev->dev;
1564 int ret;
1565
1566 if (node) {
1567 /* Check if this is a second instance registered */
1568 if (arch_num_cc) {
1569 dev_err(dev, "only one EDMA instance is supported via DT\n");
1570 return -ENODEV;
1571 }
1572
1573 ninfo[0] = edma_setup_info_from_dt(dev, node);
1574 if (IS_ERR(ninfo[0])) {
1575 dev_err(dev, "failed to get DT data\n");
1576 return PTR_ERR(ninfo[0]);
1577 }
1578
1579 info = ninfo;
1580 }
1408 1581
1409 if (!info) 1582 if (!info)
1410 return -ENODEV; 1583 return -ENODEV;
1411 1584
1585 pm_runtime_enable(dev);
1586 ret = pm_runtime_get_sync(dev);
1587 if (ret < 0) {
1588 dev_err(dev, "pm_runtime_get_sync() failed\n");
1589 return ret;
1590 }
1591
1412 for (j = 0; j < EDMA_MAX_CC; j++) { 1592 for (j = 0; j < EDMA_MAX_CC; j++) {
1413 sprintf(res_name, "edma_cc%d", j); 1593 if (!info[j]) {
1414 r[j] = platform_get_resource_byname(pdev, IORESOURCE_MEM, 1594 if (!found)
1595 return -ENODEV;
1596 break;
1597 }
1598 if (node) {
1599 ret = of_address_to_resource(node, j, &res[j]);
1600 if (!ret)
1601 r[j] = &res[j];
1602 } else {
1603 sprintf(res_name, "edma_cc%d", j);
1604 r[j] = platform_get_resource_byname(pdev,
1605 IORESOURCE_MEM,
1415 res_name); 1606 res_name);
1416 if (!r[j] || !info[j]) { 1607 }
1608 if (!r[j]) {
1417 if (found) 1609 if (found)
1418 break; 1610 break;
1419 else 1611 else
@@ -1422,26 +1614,14 @@ static int __init edma_probe(struct platform_device *pdev)
1422 found = 1; 1614 found = 1;
1423 } 1615 }
1424 1616
1425 len[j] = resource_size(r[j]); 1617 edmacc_regs_base[j] = devm_ioremap_resource(&pdev->dev, r[j]);
1426 1618 if (IS_ERR(edmacc_regs_base[j]))
1427 r[j] = request_mem_region(r[j]->start, len[j], 1619 return PTR_ERR(edmacc_regs_base[j]);
1428 dev_name(&pdev->dev));
1429 if (!r[j]) {
1430 status = -EBUSY;
1431 goto fail1;
1432 }
1433
1434 edmacc_regs_base[j] = ioremap(r[j]->start, len[j]);
1435 if (!edmacc_regs_base[j]) {
1436 status = -EBUSY;
1437 goto fail1;
1438 }
1439 1620
1440 edma_cc[j] = kzalloc(sizeof(struct edma), GFP_KERNEL); 1621 edma_cc[j] = devm_kzalloc(&pdev->dev, sizeof(struct edma),
1441 if (!edma_cc[j]) { 1622 GFP_KERNEL);
1442 status = -ENOMEM; 1623 if (!edma_cc[j])
1443 goto fail1; 1624 return -ENOMEM;
1444 }
1445 1625
1446 edma_cc[j]->num_channels = min_t(unsigned, info[j]->n_channel, 1626 edma_cc[j]->num_channels = min_t(unsigned, info[j]->n_channel,
1447 EDMA_MAX_DMACH); 1627 EDMA_MAX_DMACH);
@@ -1472,7 +1652,7 @@ static int __init edma_probe(struct platform_device *pdev)
1472 off = rsv_chans[i][0]; 1652 off = rsv_chans[i][0];
1473 ln = rsv_chans[i][1]; 1653 ln = rsv_chans[i][1];
1474 clear_bits(off, ln, 1654 clear_bits(off, ln,
1475 edma_cc[j]->edma_unused); 1655 edma_cc[j]->edma_unused);
1476 } 1656 }
1477 } 1657 }
1478 1658
@@ -1488,26 +1668,48 @@ static int __init edma_probe(struct platform_device *pdev)
1488 } 1668 }
1489 } 1669 }
1490 1670
1491 sprintf(irq_name, "edma%d", j); 1671 /* Clear the xbar mapped channels in unused list */
1492 irq[j] = platform_get_irq_byname(pdev, irq_name); 1672 xbar_chans = info[j]->xbar_chans;
1673 if (xbar_chans) {
1674 for (i = 0; xbar_chans[i][1] != -1; i++) {
1675 off = xbar_chans[i][1];
1676 clear_bits(off, 1,
1677 edma_cc[j]->edma_unused);
1678 }
1679 }
1680
1681 if (node) {
1682 irq[j] = irq_of_parse_and_map(node, 0);
1683 } else {
1684 sprintf(irq_name, "edma%d", j);
1685 irq[j] = platform_get_irq_byname(pdev, irq_name);
1686 }
1493 edma_cc[j]->irq_res_start = irq[j]; 1687 edma_cc[j]->irq_res_start = irq[j];
1494 status = request_irq(irq[j], dma_irq_handler, 0, "edma", 1688 status = devm_request_irq(&pdev->dev, irq[j],
1495 &pdev->dev); 1689 dma_irq_handler, 0, "edma",
1690 &pdev->dev);
1496 if (status < 0) { 1691 if (status < 0) {
1497 dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", 1692 dev_dbg(&pdev->dev,
1693 "devm_request_irq %d failed --> %d\n",
1498 irq[j], status); 1694 irq[j], status);
1499 goto fail; 1695 return status;
1500 } 1696 }
1501 1697
1502 sprintf(irq_name, "edma%d_err", j); 1698 if (node) {
1503 err_irq[j] = platform_get_irq_byname(pdev, irq_name); 1699 err_irq[j] = irq_of_parse_and_map(node, 2);
1700 } else {
1701 sprintf(irq_name, "edma%d_err", j);
1702 err_irq[j] = platform_get_irq_byname(pdev, irq_name);
1703 }
1504 edma_cc[j]->irq_res_end = err_irq[j]; 1704 edma_cc[j]->irq_res_end = err_irq[j];
1505 status = request_irq(err_irq[j], dma_ccerr_handler, 0, 1705 status = devm_request_irq(&pdev->dev, err_irq[j],
1506 "edma_error", &pdev->dev); 1706 dma_ccerr_handler, 0,
1707 "edma_error", &pdev->dev);
1507 if (status < 0) { 1708 if (status < 0) {
1508 dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n", 1709 dev_dbg(&pdev->dev,
1710 "devm_request_irq %d failed --> %d\n",
1509 err_irq[j], status); 1711 err_irq[j], status);
1510 goto fail; 1712 return status;
1511 } 1713 }
1512 1714
1513 for (i = 0; i < edma_cc[j]->num_channels; i++) 1715 for (i = 0; i < edma_cc[j]->num_channels; i++)
@@ -1541,46 +1743,20 @@ static int __init edma_probe(struct platform_device *pdev)
1541 arch_num_cc++; 1743 arch_num_cc++;
1542 } 1744 }
1543 1745
1544 if (tc_errs_handled) {
1545 status = request_irq(IRQ_TCERRINT0, dma_tc0err_handler, 0,
1546 "edma_tc0", &pdev->dev);
1547 if (status < 0) {
1548 dev_dbg(&pdev->dev, "request_irq %d failed --> %d\n",
1549 IRQ_TCERRINT0, status);
1550 return status;
1551 }
1552 status = request_irq(IRQ_TCERRINT, dma_tc1err_handler, 0,
1553 "edma_tc1", &pdev->dev);
1554 if (status < 0) {
1555 dev_dbg(&pdev->dev, "request_irq %d --> %d\n",
1556 IRQ_TCERRINT, status);
1557 return status;
1558 }
1559 }
1560
1561 return 0; 1746 return 0;
1562
1563fail:
1564 for (i = 0; i < EDMA_MAX_CC; i++) {
1565 if (err_irq[i])
1566 free_irq(err_irq[i], &pdev->dev);
1567 if (irq[i])
1568 free_irq(irq[i], &pdev->dev);
1569 }
1570fail1:
1571 for (i = 0; i < EDMA_MAX_CC; i++) {
1572 if (r[i])
1573 release_mem_region(r[i]->start, len[i]);
1574 if (edmacc_regs_base[i])
1575 iounmap(edmacc_regs_base[i]);
1576 kfree(edma_cc[i]);
1577 }
1578 return status;
1579} 1747}
1580 1748
1749static const struct of_device_id edma_of_ids[] = {
1750 { .compatible = "ti,edma3", },
1751 {}
1752};
1581 1753
1582static struct platform_driver edma_driver = { 1754static struct platform_driver edma_driver = {
1583 .driver.name = "edma", 1755 .driver = {
1756 .name = "edma",
1757 .of_match_table = edma_of_ids,
1758 },
1759 .probe = edma_probe,
1584}; 1760};
1585 1761
1586static int __init edma_init(void) 1762static int __init edma_init(void)
diff --git a/arch/arm/common/mcpm_head.S b/arch/arm/common/mcpm_head.S
index 8178705c4b24..80f033614a1f 100644
--- a/arch/arm/common/mcpm_head.S
+++ b/arch/arm/common/mcpm_head.S
@@ -32,11 +32,11 @@
321901: adr r0, 1902b 321901: adr r0, 1902b
33 bl printascii 33 bl printascii
34 mov r0, r9 34 mov r0, r9
35 bl printhex8 35 bl printhex2
36 adr r0, 1903b 36 adr r0, 1903b
37 bl printascii 37 bl printascii
38 mov r0, r10 38 mov r0, r10
39 bl printhex8 39 bl printhex2
40 adr r0, 1904b 40 adr r0, 1904b
41 bl printascii 41 bl printascii
42#endif 42#endif
diff --git a/arch/arm/common/mcpm_platsmp.c b/arch/arm/common/mcpm_platsmp.c
index 3caed0db6986..510e5b13aa2e 100644
--- a/arch/arm/common/mcpm_platsmp.c
+++ b/arch/arm/common/mcpm_platsmp.c
@@ -19,10 +19,6 @@
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21 21
22static void __init simple_smp_init_cpus(void)
23{
24}
25
26static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle) 22static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle)
27{ 23{
28 unsigned int mpidr, pcpu, pcluster, ret; 24 unsigned int mpidr, pcpu, pcluster, ret;
@@ -74,7 +70,6 @@ static void mcpm_cpu_die(unsigned int cpu)
74#endif 70#endif
75 71
76static struct smp_operations __initdata mcpm_smp_ops = { 72static struct smp_operations __initdata mcpm_smp_ops = {
77 .smp_init_cpus = simple_smp_init_cpus,
78 .smp_boot_secondary = mcpm_boot_secondary, 73 .smp_boot_secondary = mcpm_boot_secondary,
79 .smp_secondary_init = mcpm_secondary_init, 74 .smp_secondary_init = mcpm_secondary_init,
80#ifdef CONFIG_HOTPLUG_CPU 75#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/arm/configs/ap4evb_defconfig b/arch/arm/configs/ap4evb_defconfig
deleted file mode 100644
index 66894f736d04..000000000000
--- a/arch/arm/configs/ap4evb_defconfig
+++ /dev/null
@@ -1,56 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y
8# CONFIG_BLK_DEV_BSG is not set
9# CONFIG_IOSCHED_DEADLINE is not set
10# CONFIG_IOSCHED_CFQ is not set
11CONFIG_ARCH_SHMOBILE=y
12CONFIG_ARCH_SH7372=y
13CONFIG_MACH_AP4EVB=y
14CONFIG_AEABI=y
15# CONFIG_OABI_COMPAT is not set
16CONFIG_ZBOOT_ROM_TEXT=0x0
17CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=sh-sci.0,115200"
19CONFIG_KEXEC=y
20CONFIG_PM=y
21# CONFIG_SUSPEND is not set
22CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
23# CONFIG_FIRMWARE_IN_KERNEL is not set
24CONFIG_MTD=y
25CONFIG_MTD_CONCAT=y
26CONFIG_MTD_PARTITIONS=y
27CONFIG_MTD_CHAR=y
28CONFIG_MTD_BLOCK=y
29CONFIG_MTD_CFI=y
30CONFIG_MTD_CFI_INTELEXT=y
31CONFIG_MTD_PHYSMAP=y
32CONFIG_MTD_NAND=y
33# CONFIG_BLK_DEV is not set
34# CONFIG_MISC_DEVICES is not set
35# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
36# CONFIG_INPUT_KEYBOARD is not set
37# CONFIG_INPUT_MOUSE is not set
38# CONFIG_SERIO is not set
39CONFIG_SERIAL_SH_SCI=y
40CONFIG_SERIAL_SH_SCI_NR_UARTS=8
41CONFIG_SERIAL_SH_SCI_CONSOLE=y
42# CONFIG_LEGACY_PTYS is not set
43# CONFIG_HW_RANDOM is not set
44# CONFIG_HWMON is not set
45# CONFIG_VGA_CONSOLE is not set
46# CONFIG_HID_SUPPORT is not set
47# CONFIG_USB_SUPPORT is not set
48# CONFIG_DNOTIFY is not set
49CONFIG_TMPFS=y
50# CONFIG_MISC_FILESYSTEMS is not set
51CONFIG_MAGIC_SYSRQ=y
52CONFIG_DEBUG_KERNEL=y
53# CONFIG_DETECT_SOFTLOCKUP is not set
54# CONFIG_RCU_CPU_STALL_DETECTOR is not set
55# CONFIG_FTRACE is not set
56# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/armadillo800eva_defconfig b/arch/arm/configs/armadillo800eva_defconfig
index 0f2d80da7378..fae939d3d7f0 100644
--- a/arch/arm/configs/armadillo800eva_defconfig
+++ b/arch/arm/configs/armadillo800eva_defconfig
@@ -86,7 +86,7 @@ CONFIG_TOUCHSCREEN_ST1232=y
86# CONFIG_SERIO is not set 86# CONFIG_SERIO is not set
87# CONFIG_LEGACY_PTYS is not set 87# CONFIG_LEGACY_PTYS is not set
88CONFIG_SERIAL_SH_SCI=y 88CONFIG_SERIAL_SH_SCI=y
89CONFIG_SERIAL_SH_SCI_NR_UARTS=8 89CONFIG_SERIAL_SH_SCI_NR_UARTS=9
90CONFIG_SERIAL_SH_SCI_CONSOLE=y 90CONFIG_SERIAL_SH_SCI_CONSOLE=y
91# CONFIG_HW_RANDOM is not set 91# CONFIG_HW_RANDOM is not set
92CONFIG_I2C=y 92CONFIG_I2C=y
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 047f2a415309..75fd842d4071 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
@@ -25,8 +24,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
25CONFIG_AT91_TIMER_HZ=128 24CONFIG_AT91_TIMER_HZ=128
26CONFIG_AEABI=y 25CONFIG_AEABI=y
27# CONFIG_OABI_COMPAT is not set 26# CONFIG_OABI_COMPAT is not set
28CONFIG_LEDS=y
29CONFIG_LEDS_CPU=y
30CONFIG_UACCESS_WITH_MEMCPY=y 27CONFIG_UACCESS_WITH_MEMCPY=y
31CONFIG_ZBOOT_ROM_TEXT=0x0 28CONFIG_ZBOOT_ROM_TEXT=0x0
32CONFIG_ZBOOT_ROM_BSS=0x0 29CONFIG_ZBOOT_ROM_BSS=0x0
@@ -42,6 +39,9 @@ CONFIG_UNIX=y
42CONFIG_INET=y 39CONFIG_INET=y
43CONFIG_IP_MULTICAST=y 40CONFIG_IP_MULTICAST=y
44CONFIG_IP_PNP=y 41CONFIG_IP_PNP=y
42CONFIG_IP_PNP_DHCP=y
43CONFIG_IP_PNP_BOOTP=y
44CONFIG_IP_PNP_RARP=y
45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
46# CONFIG_INET_XFRM_MODE_TUNNEL is not set 46# CONFIG_INET_XFRM_MODE_TUNNEL is not set
47# CONFIG_INET_XFRM_MODE_BEET is not set 47# CONFIG_INET_XFRM_MODE_BEET is not set
@@ -51,7 +51,8 @@ CONFIG_IPV6=y
51# CONFIG_INET6_XFRM_MODE_TUNNEL is not set 51# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
52# CONFIG_INET6_XFRM_MODE_BEET is not set 52# CONFIG_INET6_XFRM_MODE_BEET is not set
53CONFIG_IPV6_SIT_6RD=y 53CONFIG_IPV6_SIT_6RD=y
54# CONFIG_WIRELESS is not set 54CONFIG_CFG80211=y
55CONFIG_MAC80211=y
55CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 56CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
56CONFIG_DEVTMPFS=y 57CONFIG_DEVTMPFS=y
57CONFIG_DEVTMPFS_MOUNT=y 58CONFIG_DEVTMPFS_MOUNT=y
@@ -72,7 +73,6 @@ CONFIG_BLK_DEV_RAM_COUNT=4
72CONFIG_BLK_DEV_RAM_SIZE=8192 73CONFIG_BLK_DEV_RAM_SIZE=8192
73CONFIG_ATMEL_PWM=y 74CONFIG_ATMEL_PWM=y
74CONFIG_ATMEL_TCLIB=y 75CONFIG_ATMEL_TCLIB=y
75CONFIG_EEPROM_93CX6=m
76CONFIG_SCSI=y 76CONFIG_SCSI=y
77CONFIG_BLK_DEV_SD=y 77CONFIG_BLK_DEV_SD=y
78CONFIG_SCSI_MULTI_LUN=y 78CONFIG_SCSI_MULTI_LUN=y
@@ -81,7 +81,6 @@ CONFIG_NETDEVICES=y
81CONFIG_MII=y 81CONFIG_MII=y
82CONFIG_MACB=y 82CONFIG_MACB=y
83# CONFIG_NET_VENDOR_BROADCOM is not set 83# CONFIG_NET_VENDOR_BROADCOM is not set
84# CONFIG_NET_VENDOR_CHELSIO is not set
85# CONFIG_NET_VENDOR_FARADAY is not set 84# CONFIG_NET_VENDOR_FARADAY is not set
86# CONFIG_NET_VENDOR_INTEL is not set 85# CONFIG_NET_VENDOR_INTEL is not set
87# CONFIG_NET_VENDOR_MARVELL is not set 86# CONFIG_NET_VENDOR_MARVELL is not set
@@ -92,7 +91,23 @@ CONFIG_MACB=y
92# CONFIG_NET_VENDOR_STMICRO is not set 91# CONFIG_NET_VENDOR_STMICRO is not set
93CONFIG_DAVICOM_PHY=y 92CONFIG_DAVICOM_PHY=y
94CONFIG_MICREL_PHY=y 93CONFIG_MICREL_PHY=y
95# CONFIG_WLAN is not set 94CONFIG_RTL8187=m
95CONFIG_LIBERTAS=m
96CONFIG_LIBERTAS_SDIO=m
97CONFIG_LIBERTAS_SPI=m
98CONFIG_RT2X00=m
99CONFIG_RT2500USB=m
100CONFIG_RT73USB=m
101CONFIG_RT2800USB=m
102CONFIG_RT2800USB_RT53XX=y
103CONFIG_RT2800USB_RT55XX=y
104CONFIG_RT2800USB_UNKNOWN=y
105CONFIG_RTLWIFI=m
106# CONFIG_RTLWIFI_DEBUG is not set
107CONFIG_RTL8192CU=m
108CONFIG_MWIFIEX=m
109CONFIG_MWIFIEX_SDIO=m
110CONFIG_MWIFIEX_USB=m
96CONFIG_INPUT_POLLDEV=y 111CONFIG_INPUT_POLLDEV=y
97# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 112# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
98CONFIG_INPUT_MOUSEDEV_SCREEN_X=480 113CONFIG_INPUT_MOUSEDEV_SCREEN_X=480
@@ -112,13 +127,11 @@ CONFIG_I2C=y
112CONFIG_I2C_GPIO=y 127CONFIG_I2C_GPIO=y
113CONFIG_SPI=y 128CONFIG_SPI=y
114CONFIG_SPI_ATMEL=y 129CONFIG_SPI_ATMEL=y
115CONFIG_PINCTRL_AT91=y
116# CONFIG_HWMON is not set 130# CONFIG_HWMON is not set
117CONFIG_WATCHDOG=y 131CONFIG_WATCHDOG=y
118CONFIG_AT91SAM9X_WATCHDOG=y 132CONFIG_AT91SAM9X_WATCHDOG=y
119CONFIG_SSB=m 133CONFIG_SSB=m
120CONFIG_FB=y 134CONFIG_FB=y
121CONFIG_FB_MODE_HELPERS=y
122CONFIG_FB_ATMEL=y 135CONFIG_FB_ATMEL=y
123CONFIG_BACKLIGHT_LCD_SUPPORT=y 136CONFIG_BACKLIGHT_LCD_SUPPORT=y
124# CONFIG_LCD_CLASS_DEVICE is not set 137# CONFIG_LCD_CLASS_DEVICE is not set
@@ -132,11 +145,8 @@ CONFIG_FONT_8x8=y
132CONFIG_FONT_ACORN_8x8=y 145CONFIG_FONT_ACORN_8x8=y
133CONFIG_FONT_MINI_4x6=y 146CONFIG_FONT_MINI_4x6=y
134CONFIG_LOGO=y 147CONFIG_LOGO=y
135# CONFIG_HID_SUPPORT is not set
136CONFIG_USB=y 148CONFIG_USB=y
137CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 149CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
138CONFIG_USB_DEVICEFS=y
139# CONFIG_USB_DEVICE_CLASS is not set
140CONFIG_USB_EHCI_HCD=y 150CONFIG_USB_EHCI_HCD=y
141CONFIG_USB_OHCI_HCD=y 151CONFIG_USB_OHCI_HCD=y
142CONFIG_USB_ACM=y 152CONFIG_USB_ACM=y
@@ -146,16 +156,12 @@ CONFIG_USB_SERIAL_GENERIC=y
146CONFIG_USB_SERIAL_FTDI_SIO=y 156CONFIG_USB_SERIAL_FTDI_SIO=y
147CONFIG_USB_SERIAL_PL2303=y 157CONFIG_USB_SERIAL_PL2303=y
148CONFIG_USB_GADGET=y 158CONFIG_USB_GADGET=y
149CONFIG_USB_AT91=m 159CONFIG_USB_AT91=y
150CONFIG_USB_ATMEL_USBA=m 160CONFIG_USB_ATMEL_USBA=y
151CONFIG_USB_ETH=m 161CONFIG_USB_G_SERIAL=y
152CONFIG_USB_GADGETFS=m
153CONFIG_USB_CDC_COMPOSITE=m
154CONFIG_USB_G_ACM_MS=m
155CONFIG_USB_G_MULTI=m
156CONFIG_USB_G_MULTI_CDC=y
157CONFIG_MMC=y 162CONFIG_MMC=y
158CONFIG_MMC_ATMELMCI=y 163CONFIG_MMC_ATMELMCI=y
164CONFIG_MMC_SPI=y
159CONFIG_NEW_LEDS=y 165CONFIG_NEW_LEDS=y
160CONFIG_LEDS_CLASS=y 166CONFIG_LEDS_CLASS=y
161CONFIG_LEDS_GPIO=y 167CONFIG_LEDS_GPIO=y
@@ -164,20 +170,23 @@ CONFIG_LEDS_TRIGGER_TIMER=y
164CONFIG_LEDS_TRIGGER_HEARTBEAT=y 170CONFIG_LEDS_TRIGGER_HEARTBEAT=y
165CONFIG_LEDS_TRIGGER_GPIO=y 171CONFIG_LEDS_TRIGGER_GPIO=y
166CONFIG_RTC_CLASS=y 172CONFIG_RTC_CLASS=y
173CONFIG_RTC_DRV_RV3029C2=y
167CONFIG_RTC_DRV_AT91RM9200=y 174CONFIG_RTC_DRV_AT91RM9200=y
168CONFIG_RTC_DRV_AT91SAM9=y 175CONFIG_RTC_DRV_AT91SAM9=y
169CONFIG_DMADEVICES=y 176CONFIG_DMADEVICES=y
170# CONFIG_IOMMU_SUPPORT is not set 177# CONFIG_IOMMU_SUPPORT is not set
171CONFIG_EXT2_FS=y 178CONFIG_EXT4_FS=y
172CONFIG_FANOTIFY=y 179CONFIG_FANOTIFY=y
173CONFIG_VFAT_FS=y 180CONFIG_VFAT_FS=y
174CONFIG_TMPFS=y 181CONFIG_TMPFS=y
182CONFIG_UBIFS_FS=y
183CONFIG_UBIFS_FS_ADVANCED_COMPR=y
175CONFIG_NFS_FS=y 184CONFIG_NFS_FS=y
176CONFIG_NFS_V3=y
177CONFIG_ROOT_NFS=y 185CONFIG_ROOT_NFS=y
178CONFIG_NLS_CODEPAGE_437=y 186CONFIG_NLS_CODEPAGE_437=y
179CONFIG_NLS_CODEPAGE_850=y 187CONFIG_NLS_CODEPAGE_850=y
180CONFIG_NLS_ISO8859_1=y 188CONFIG_NLS_ISO8859_1=y
189CONFIG_NLS_UTF8=y
181CONFIG_STRIP_ASM_SYMS=y 190CONFIG_STRIP_ASM_SYMS=y
182CONFIG_DEBUG_FS=y 191CONFIG_DEBUG_FS=y
183# CONFIG_SCHED_DEBUG is not set 192# CONFIG_SCHED_DEBUG is not set
@@ -192,7 +201,7 @@ CONFIG_CRYPTO_ARC4=y
192CONFIG_CRYPTO_USER_API_HASH=m 201CONFIG_CRYPTO_USER_API_HASH=m
193CONFIG_CRYPTO_USER_API_SKCIPHER=m 202CONFIG_CRYPTO_USER_API_SKCIPHER=m
194# CONFIG_CRYPTO_HW is not set 203# CONFIG_CRYPTO_HW is not set
195CONFIG_CRC_CCITT=m 204CONFIG_CRC_CCITT=y
196CONFIG_CRC_ITU_T=m 205CONFIG_CRC_ITU_T=y
197CONFIG_CRC7=m 206CONFIG_CRC7=m
198CONFIG_AVERAGE=y 207CONFIG_AVERAGE=y
diff --git a/arch/arm/configs/at91rm9200_defconfig b/arch/arm/configs/at91rm9200_defconfig
index 4ae57a34a582..75502c4d222c 100644
--- a/arch/arm/configs/at91rm9200_defconfig
+++ b/arch/arm/configs/at91rm9200_defconfig
@@ -1,10 +1,12 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y
5CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=14 8CONFIG_LOG_BUF_SHIFT=14
9CONFIG_USER_NS=y
8CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
9CONFIG_MODULES=y 11CONFIG_MODULES=y
10CONFIG_MODULE_FORCE_LOAD=y 12CONFIG_MODULE_FORCE_LOAD=y
@@ -16,7 +18,6 @@ CONFIG_MODULE_SRCVERSION_ALL=y
16CONFIG_ARCH_AT91=y 18CONFIG_ARCH_AT91=y
17CONFIG_ARCH_AT91RM9200=y 19CONFIG_ARCH_AT91RM9200=y
18CONFIG_MACH_ONEARM=y 20CONFIG_MACH_ONEARM=y
19CONFIG_ARCH_AT91RM9200DK=y
20CONFIG_MACH_AT91RM9200EK=y 21CONFIG_MACH_AT91RM9200EK=y
21CONFIG_MACH_CSB337=y 22CONFIG_MACH_CSB337=y
22CONFIG_MACH_CSB637=y 23CONFIG_MACH_CSB637=y
@@ -35,49 +36,37 @@ CONFIG_AT91_TIMER_HZ=100
35# CONFIG_ARM_THUMB is not set 36# CONFIG_ARM_THUMB is not set
36CONFIG_PCCARD=y 37CONFIG_PCCARD=y
37CONFIG_AT91_CF=y 38CONFIG_AT91_CF=y
38CONFIG_NO_HZ=y
39CONFIG_HIGH_RES_TIMERS=y
40CONFIG_PREEMPT=y
41CONFIG_AEABI=y 39CONFIG_AEABI=y
42CONFIG_LEDS=y 40# CONFIG_COMPACTION is not set
43CONFIG_LEDS_CPU=y
44CONFIG_ZBOOT_ROM_TEXT=0x10000000 41CONFIG_ZBOOT_ROM_TEXT=0x10000000
45CONFIG_ZBOOT_ROM_BSS=0x20040000 42CONFIG_ZBOOT_ROM_BSS=0x20040000
46CONFIG_KEXEC=y 43CONFIG_KEXEC=y
44CONFIG_AUTO_ZRELADDR=y
47CONFIG_FPE_NWFPE=y 45CONFIG_FPE_NWFPE=y
48CONFIG_BINFMT_MISC=y 46CONFIG_BINFMT_MISC=y
49CONFIG_NET=y 47CONFIG_NET=y
50CONFIG_PACKET=y 48CONFIG_PACKET=y
51CONFIG_UNIX=y 49CONFIG_UNIX=y
52CONFIG_XFRM_USER=m
53CONFIG_INET=y 50CONFIG_INET=y
54CONFIG_IP_MULTICAST=y 51CONFIG_IP_MULTICAST=y
55CONFIG_IP_PNP=y 52CONFIG_IP_PNP=y
56CONFIG_IP_PNP_DHCP=y 53CONFIG_IP_PNP_DHCP=y
57CONFIG_IP_PNP_BOOTP=y 54CONFIG_IP_PNP_BOOTP=y
58CONFIG_NET_IPIP=m 55# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
59CONFIG_INET_AH=m 56# CONFIG_INET_XFRM_MODE_TUNNEL is not set
60CONFIG_INET_ESP=m 57# CONFIG_INET_XFRM_MODE_BEET is not set
61CONFIG_INET_IPCOMP=m 58# CONFIG_INET_DIAG is not set
62CONFIG_INET_XFRM_MODE_TRANSPORT=m 59CONFIG_IPV6=y
63CONFIG_INET_XFRM_MODE_TUNNEL=m
64CONFIG_INET_XFRM_MODE_BEET=m
65CONFIG_IPV6_PRIVACY=y 60CONFIG_IPV6_PRIVACY=y
66CONFIG_IPV6_ROUTER_PREF=y 61CONFIG_IPV6_ROUTER_PREF=y
67CONFIG_IPV6_ROUTE_INFO=y 62CONFIG_IPV6_ROUTE_INFO=y
68CONFIG_INET6_AH=m
69CONFIG_INET6_ESP=m
70CONFIG_INET6_IPCOMP=m
71CONFIG_IPV6_MIP6=m
72CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
73CONFIG_IPV6_TUNNEL=m
74CONFIG_BRIDGE=m
75CONFIG_VLAN_8021Q=m
76CONFIG_BT=m
77CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 63CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
64CONFIG_DEVTMPFS=y
65CONFIG_DEVTMPFS_MOUNT=y
66# CONFIG_STANDALONE is not set
67# CONFIG_PREVENT_FIRMWARE_BUILD is not set
78CONFIG_MTD=y 68CONFIG_MTD=y
79CONFIG_MTD_CMDLINE_PARTS=y 69CONFIG_MTD_CMDLINE_PARTS=y
80CONFIG_MTD_AFS_PARTS=y
81CONFIG_MTD_CHAR=y 70CONFIG_MTD_CHAR=y
82CONFIG_MTD_BLOCK=y 71CONFIG_MTD_BLOCK=y
83CONFIG_MTD_CFI=y 72CONFIG_MTD_CFI=y
@@ -94,55 +83,21 @@ CONFIG_MTD_NAND_PLATFORM=y
94CONFIG_MTD_UBI=y 83CONFIG_MTD_UBI=y
95CONFIG_MTD_UBI_GLUEBI=y 84CONFIG_MTD_UBI_GLUEBI=y
96CONFIG_BLK_DEV_LOOP=y 85CONFIG_BLK_DEV_LOOP=y
97CONFIG_BLK_DEV_NBD=y
98CONFIG_BLK_DEV_RAM=y 86CONFIG_BLK_DEV_RAM=y
99CONFIG_BLK_DEV_RAM_SIZE=8192 87CONFIG_BLK_DEV_RAM_SIZE=8192
100CONFIG_SCSI=y
101CONFIG_BLK_DEV_SD=y
102CONFIG_BLK_DEV_SR=m
103CONFIG_BLK_DEV_SR_VENDOR=y
104CONFIG_CHR_DEV_SG=m
105CONFIG_SCSI_MULTI_LUN=y
106# CONFIG_SCSI_LOWLEVEL is not set
107CONFIG_NETDEVICES=y 88CONFIG_NETDEVICES=y
108CONFIG_TUN=m 89CONFIG_MII=y
109CONFIG_ARM_AT91_ETHER=y 90CONFIG_ARM_AT91_ETHER=y
110CONFIG_PHYLIB=y
111CONFIG_DAVICOM_PHY=y 91CONFIG_DAVICOM_PHY=y
112CONFIG_SMSC_PHY=y 92CONFIG_SMSC_PHY=y
113CONFIG_MICREL_PHY=y 93CONFIG_MICREL_PHY=y
114CONFIG_PPP=y 94# CONFIG_WLAN is not set
115CONFIG_PPP_BSDCOMP=y 95# CONFIG_INPUT_MOUSEDEV is not set
116CONFIG_PPP_DEFLATE=y
117CONFIG_PPP_FILTER=y
118CONFIG_PPP_MPPE=m
119CONFIG_PPP_MULTILINK=y
120CONFIG_PPPOE=m
121CONFIG_PPP_ASYNC=y
122CONFIG_SLIP=m
123CONFIG_SLIP_COMPRESSED=y
124CONFIG_SLIP_SMART=y
125CONFIG_SLIP_MODE_SLIP6=y
126CONFIG_USB_CATC=m
127CONFIG_USB_KAWETH=m
128CONFIG_USB_PEGASUS=m
129CONFIG_USB_RTL8150=m
130CONFIG_USB_USBNET=m
131CONFIG_USB_NET_DM9601=m
132CONFIG_USB_NET_GL620A=m
133CONFIG_USB_NET_PLUSB=m
134CONFIG_USB_NET_RNDIS_HOST=m
135CONFIG_USB_ALI_M5632=y
136CONFIG_USB_AN2720=y
137CONFIG_USB_EPSON2888=y
138# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
139CONFIG_INPUT_MOUSEDEV_SCREEN_X=640
140CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480
141CONFIG_INPUT_EVDEV=y 96CONFIG_INPUT_EVDEV=y
142CONFIG_KEYBOARD_GPIO=y 97CONFIG_KEYBOARD_GPIO=y
143# CONFIG_INPUT_MOUSE is not set 98# CONFIG_INPUT_MOUSE is not set
144CONFIG_INPUT_TOUCHSCREEN=y 99CONFIG_INPUT_TOUCHSCREEN=y
145CONFIG_LEGACY_PTY_COUNT=32 100# CONFIG_LEGACY_PTYS is not set
146CONFIG_SERIAL_ATMEL=y 101CONFIG_SERIAL_ATMEL=y
147CONFIG_SERIAL_ATMEL_CONSOLE=y 102CONFIG_SERIAL_ATMEL_CONSOLE=y
148CONFIG_HW_RANDOM=y 103CONFIG_HW_RANDOM=y
@@ -151,38 +106,8 @@ CONFIG_I2C_CHARDEV=y
151CONFIG_I2C_GPIO=y 106CONFIG_I2C_GPIO=y
152CONFIG_SPI=y 107CONFIG_SPI=y
153CONFIG_SPI_ATMEL=y 108CONFIG_SPI_ATMEL=y
154CONFIG_SPI_BITBANG=y
155CONFIG_GPIO_SYSFS=y 109CONFIG_GPIO_SYSFS=y
156CONFIG_HWMON=m 110# CONFIG_HWMON is not set
157CONFIG_SENSORS_ADM1021=m
158CONFIG_SENSORS_ADM1025=m
159CONFIG_SENSORS_ADM1026=m
160CONFIG_SENSORS_ADM1029=m
161CONFIG_SENSORS_ADM1031=m
162CONFIG_SENSORS_ADM9240=m
163CONFIG_SENSORS_DS1621=m
164CONFIG_SENSORS_GL518SM=m
165CONFIG_SENSORS_GL520SM=m
166CONFIG_SENSORS_IT87=m
167CONFIG_SENSORS_LM63=m
168CONFIG_SENSORS_LM73=m
169CONFIG_SENSORS_LM75=m
170CONFIG_SENSORS_LM77=m
171CONFIG_SENSORS_LM78=m
172CONFIG_SENSORS_LM80=m
173CONFIG_SENSORS_LM83=m
174CONFIG_SENSORS_LM85=m
175CONFIG_SENSORS_LM87=m
176CONFIG_SENSORS_LM90=m
177CONFIG_SENSORS_LM92=m
178CONFIG_SENSORS_MAX1619=m
179CONFIG_SENSORS_PCF8591=m
180CONFIG_SENSORS_SMSC47B397=m
181CONFIG_SENSORS_W83781D=m
182CONFIG_SENSORS_W83791D=m
183CONFIG_SENSORS_W83792D=m
184CONFIG_SENSORS_W83793=m
185CONFIG_SENSORS_W83L785TS=m
186CONFIG_WATCHDOG=y 111CONFIG_WATCHDOG=y
187CONFIG_WATCHDOG_NOWAYOUT=y 112CONFIG_WATCHDOG_NOWAYOUT=y
188CONFIG_AT91RM9200_WATCHDOG=y 113CONFIG_AT91RM9200_WATCHDOG=y
@@ -194,43 +119,14 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
194CONFIG_LCD_CLASS_DEVICE=y 119CONFIG_LCD_CLASS_DEVICE=y
195CONFIG_BACKLIGHT_CLASS_DEVICE=y 120CONFIG_BACKLIGHT_CLASS_DEVICE=y
196# CONFIG_BACKLIGHT_GENERIC is not set 121# CONFIG_BACKLIGHT_GENERIC is not set
197CONFIG_DISPLAY_SUPPORT=y
198CONFIG_FRAMEBUFFER_CONSOLE=y 122CONFIG_FRAMEBUFFER_CONSOLE=y
199CONFIG_FONTS=y 123CONFIG_FONTS=y
200CONFIG_FONT_MINI_4x6=y
201CONFIG_LOGO=y 124CONFIG_LOGO=y
202# CONFIG_LOGO_LINUX_MONO is not set
203# CONFIG_LOGO_LINUX_VGA16 is not set
204CONFIG_USB=y 125CONFIG_USB=y
205CONFIG_USB_DEVICEFS=y
206# CONFIG_USB_DEVICE_CLASS is not set
207CONFIG_USB_MON=y
208CONFIG_USB_OHCI_HCD=y 126CONFIG_USB_OHCI_HCD=y
209CONFIG_USB_ACM=m
210CONFIG_USB_PRINTER=m
211CONFIG_USB_STORAGE=y
212CONFIG_USB_SERIAL=y
213CONFIG_USB_SERIAL_CONSOLE=y
214CONFIG_USB_SERIAL_GENERIC=y
215CONFIG_USB_SERIAL_FTDI_SIO=y
216CONFIG_USB_SERIAL_KEYSPAN=y
217CONFIG_USB_SERIAL_KEYSPAN_MPR=y
218CONFIG_USB_SERIAL_KEYSPAN_USA28=y
219CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
220CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
221CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
222CONFIG_USB_SERIAL_KEYSPAN_USA19=y
223CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
224CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
225CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
226CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
227CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
228CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
229CONFIG_USB_SERIAL_MCT_U232=y
230CONFIG_USB_SERIAL_PL2303=y
231CONFIG_USB_GADGET=y 127CONFIG_USB_GADGET=y
232CONFIG_USB_ETH=m 128CONFIG_USB_AT91=y
233CONFIG_USB_MASS_STORAGE=m 129CONFIG_USB_G_SERIAL=y
234CONFIG_MMC=y 130CONFIG_MMC=y
235CONFIG_MMC_ATMELMCI=y 131CONFIG_MMC_ATMELMCI=y
236CONFIG_NEW_LEDS=y 132CONFIG_NEW_LEDS=y
@@ -240,84 +136,27 @@ CONFIG_LEDS_TRIGGERS=y
240CONFIG_LEDS_TRIGGER_TIMER=y 136CONFIG_LEDS_TRIGGER_TIMER=y
241CONFIG_LEDS_TRIGGER_HEARTBEAT=y 137CONFIG_LEDS_TRIGGER_HEARTBEAT=y
242CONFIG_LEDS_TRIGGER_GPIO=y 138CONFIG_LEDS_TRIGGER_GPIO=y
243CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
244CONFIG_RTC_CLASS=y 139CONFIG_RTC_CLASS=y
245# CONFIG_RTC_HCTOSYS is not set
246CONFIG_RTC_DRV_DS1307=y
247CONFIG_RTC_DRV_PCF8563=y
248CONFIG_RTC_DRV_AT91RM9200=y 140CONFIG_RTC_DRV_AT91RM9200=y
249CONFIG_EXT2_FS=y 141CONFIG_EXT4_FS=y
250CONFIG_EXT2_FS_XATTR=y
251CONFIG_EXT3_FS=y
252# CONFIG_EXT3_FS_XATTR is not set
253CONFIG_REISERFS_FS=y
254CONFIG_AUTOFS4_FS=y 142CONFIG_AUTOFS4_FS=y
255CONFIG_ISO9660_FS=y
256CONFIG_JOLIET=y
257CONFIG_ZISOFS=y
258CONFIG_UDF_FS=y
259CONFIG_MSDOS_FS=y
260CONFIG_VFAT_FS=y 143CONFIG_VFAT_FS=y
261CONFIG_NTFS_FS=m
262CONFIG_TMPFS=y 144CONFIG_TMPFS=y
263CONFIG_CONFIGFS_FS=y 145CONFIG_UBIFS_FS=y
264CONFIG_JFFS2_FS=y 146CONFIG_UBIFS_FS_ADVANCED_COMPR=y
265CONFIG_JFFS2_SUMMARY=y
266CONFIG_JFFS2_COMPRESSION_OPTIONS=y
267CONFIG_JFFS2_LZO=y
268CONFIG_JFFS2_RUBIN=y
269CONFIG_CRAMFS=y
270CONFIG_MINIX_FS=y
271CONFIG_NFS_FS=y 147CONFIG_NFS_FS=y
272CONFIG_NFS_V3=y
273CONFIG_NFS_V3_ACL=y
274CONFIG_NFS_V4=y
275CONFIG_ROOT_NFS=y 148CONFIG_ROOT_NFS=y
276CONFIG_NFSD=y
277CONFIG_CIFS=m
278CONFIG_PARTITION_ADVANCED=y
279CONFIG_MAC_PARTITION=y
280CONFIG_NLS_CODEPAGE_437=y 149CONFIG_NLS_CODEPAGE_437=y
281CONFIG_NLS_CODEPAGE_737=m 150CONFIG_NLS_CODEPAGE_850=y
282CONFIG_NLS_CODEPAGE_775=m
283CONFIG_NLS_CODEPAGE_850=m
284CONFIG_NLS_CODEPAGE_852=m
285CONFIG_NLS_CODEPAGE_855=m
286CONFIG_NLS_CODEPAGE_857=m
287CONFIG_NLS_CODEPAGE_860=m
288CONFIG_NLS_CODEPAGE_861=m
289CONFIG_NLS_CODEPAGE_862=m
290CONFIG_NLS_CODEPAGE_863=m
291CONFIG_NLS_CODEPAGE_864=m
292CONFIG_NLS_CODEPAGE_865=m
293CONFIG_NLS_CODEPAGE_866=m
294CONFIG_NLS_CODEPAGE_869=m
295CONFIG_NLS_CODEPAGE_936=m
296CONFIG_NLS_CODEPAGE_950=m
297CONFIG_NLS_CODEPAGE_932=m
298CONFIG_NLS_CODEPAGE_949=m
299CONFIG_NLS_CODEPAGE_874=m
300CONFIG_NLS_ISO8859_8=m
301CONFIG_NLS_CODEPAGE_1250=m
302CONFIG_NLS_CODEPAGE_1251=m
303CONFIG_NLS_ASCII=m
304CONFIG_NLS_ISO8859_1=y 151CONFIG_NLS_ISO8859_1=y
305CONFIG_NLS_ISO8859_2=m
306CONFIG_NLS_ISO8859_3=m
307CONFIG_NLS_ISO8859_4=m
308CONFIG_NLS_ISO8859_5=m
309CONFIG_NLS_ISO8859_6=m
310CONFIG_NLS_ISO8859_7=m
311CONFIG_NLS_ISO8859_9=m
312CONFIG_NLS_ISO8859_13=m
313CONFIG_NLS_ISO8859_14=m
314CONFIG_NLS_ISO8859_15=m
315CONFIG_NLS_KOI8_R=m
316CONFIG_NLS_KOI8_U=m
317CONFIG_NLS_UTF8=y 152CONFIG_NLS_UTF8=y
318CONFIG_MAGIC_SYSRQ=y 153CONFIG_MAGIC_SYSRQ=y
319CONFIG_DEBUG_FS=y 154CONFIG_DEBUG_FS=y
320CONFIG_DEBUG_KERNEL=y 155CONFIG_DEBUG_KERNEL=y
321# CONFIG_FTRACE is not set 156# CONFIG_FTRACE is not set
157CONFIG_DEBUG_USER=y
158CONFIG_DEBUG_LL=y
159CONFIG_EARLY_PRINTK=y
322CONFIG_CRYPTO_PCBC=y 160CONFIG_CRYPTO_PCBC=y
323CONFIG_CRYPTO_SHA1=y 161CONFIG_CRYPTO_SHA1=y
162CONFIG_XZ_DEC_ARMTHUMB=y
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9260_9g20_defconfig
index 892e8287ed73..69b6928d3d9d 100644
--- a/arch/arm/configs/at91sam9g20_defconfig
+++ b/arch/arm/configs/at91sam9260_9g20_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
@@ -11,7 +10,14 @@ CONFIG_MODULE_UNLOAD=y
11# CONFIG_IOSCHED_DEADLINE is not set 10# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set 11# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y 12CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9G20=y 13CONFIG_ARCH_AT91SAM9260=y
14CONFIG_MACH_AT91SAM9260EK=y
15CONFIG_MACH_CAM60=y
16CONFIG_MACH_SAM9_L9260=y
17CONFIG_MACH_AFEB9260=y
18CONFIG_MACH_QIL_A9260=y
19CONFIG_MACH_CPU9260=y
20CONFIG_MACH_FLEXIBITY=y
15CONFIG_MACH_AT91SAM9G20EK=y 21CONFIG_MACH_AT91SAM9G20EK=y
16CONFIG_MACH_AT91SAM9G20EK_2MMC=y 22CONFIG_MACH_AT91SAM9G20EK_2MMC=y
17CONFIG_MACH_CPU9G20=y 23CONFIG_MACH_CPU9G20=y
@@ -20,10 +26,10 @@ CONFIG_MACH_PORTUXG20=y
20CONFIG_MACH_STAMP9G20=y 26CONFIG_MACH_STAMP9G20=y
21CONFIG_MACH_PCONTROL_G20=y 27CONFIG_MACH_PCONTROL_G20=y
22CONFIG_MACH_GSIA18S=y 28CONFIG_MACH_GSIA18S=y
23CONFIG_MACH_USB_A9G20=y
24CONFIG_MACH_SNAPPER_9260=y 29CONFIG_MACH_SNAPPER_9260=y
25CONFIG_MACH_AT91SAM9_DT=y 30CONFIG_MACH_AT91SAM9_DT=y
26CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 31CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
32CONFIG_AT91_SLOW_CLOCK=y
27# CONFIG_ARM_THUMB is not set 33# CONFIG_ARM_THUMB is not set
28CONFIG_AEABI=y 34CONFIG_AEABI=y
29CONFIG_LEDS=y 35CONFIG_LEDS=y
@@ -33,12 +39,14 @@ CONFIG_ZBOOT_ROM_BSS=0x0
33CONFIG_ARM_APPENDED_DTB=y 39CONFIG_ARM_APPENDED_DTB=y
34CONFIG_ARM_ATAG_DTB_COMPAT=y 40CONFIG_ARM_ATAG_DTB_COMPAT=y
35CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw" 41CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
42CONFIG_AUTO_ZRELADDR=y
36CONFIG_FPE_NWFPE=y 43CONFIG_FPE_NWFPE=y
37CONFIG_NET=y 44CONFIG_NET=y
38CONFIG_PACKET=y 45CONFIG_PACKET=y
39CONFIG_UNIX=y 46CONFIG_UNIX=y
40CONFIG_INET=y 47CONFIG_INET=y
41CONFIG_IP_PNP=y 48CONFIG_IP_PNP=y
49CONFIG_IP_PNP_DHCP=y
42CONFIG_IP_PNP_BOOTP=y 50CONFIG_IP_PNP_BOOTP=y
43# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 51# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
44# CONFIG_INET_XFRM_MODE_TUNNEL is not set 52# CONFIG_INET_XFRM_MODE_TUNNEL is not set
@@ -46,8 +54,11 @@ CONFIG_IP_PNP_BOOTP=y
46# CONFIG_INET_LRO is not set 54# CONFIG_INET_LRO is not set
47# CONFIG_IPV6 is not set 55# CONFIG_IPV6 is not set
48CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 56CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
57CONFIG_DEVTMPFS=y
58CONFIG_DEVTMPFS_MOUNT=y
49CONFIG_MTD=y 59CONFIG_MTD=y
50CONFIG_MTD_CMDLINE_PARTS=y 60CONFIG_MTD_CMDLINE_PARTS=y
61CONFIG_MTD_OF_PARTS=y
51CONFIG_MTD_CHAR=y 62CONFIG_MTD_CHAR=y
52CONFIG_MTD_BLOCK=y 63CONFIG_MTD_BLOCK=y
53CONFIG_MTD_DATAFLASH=y 64CONFIG_MTD_DATAFLASH=y
@@ -56,6 +67,8 @@ CONFIG_MTD_NAND_ATMEL=y
56CONFIG_BLK_DEV_LOOP=y 67CONFIG_BLK_DEV_LOOP=y
57CONFIG_BLK_DEV_RAM=y 68CONFIG_BLK_DEV_RAM=y
58CONFIG_BLK_DEV_RAM_SIZE=8192 69CONFIG_BLK_DEV_RAM_SIZE=8192
70CONFIG_MISC_DEVICES=y
71CONFIG_EEPROM_AT25=y
59CONFIG_SCSI=y 72CONFIG_SCSI=y
60CONFIG_BLK_DEV_SD=y 73CONFIG_BLK_DEV_SD=y
61CONFIG_SCSI_MULTI_LUN=y 74CONFIG_SCSI_MULTI_LUN=y
@@ -63,23 +76,36 @@ CONFIG_SCSI_MULTI_LUN=y
63CONFIG_NETDEVICES=y 76CONFIG_NETDEVICES=y
64CONFIG_MII=y 77CONFIG_MII=y
65CONFIG_MACB=y 78CONFIG_MACB=y
79# CONFIG_NET_VENDOR_BROADCOM is not set
80# CONFIG_NET_VENDOR_CHELSIO is not set
81# CONFIG_NET_VENDOR_FARADAY is not set
82# CONFIG_NET_VENDOR_INTEL is not set
83# CONFIG_NET_VENDOR_MARVELL is not set
84# CONFIG_NET_VENDOR_MICREL is not set
85# CONFIG_NET_VENDOR_MICROCHIP is not set
86# CONFIG_NET_VENDOR_NATSEMI is not set
87# CONFIG_NET_VENDOR_SEEQ is not set
88# CONFIG_NET_VENDOR_SMSC is not set
89# CONFIG_NET_VENDOR_STMICRO is not set
90CONFIG_SMSC_PHY=y
66# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 91# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
67CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
68CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
69CONFIG_INPUT_EVDEV=y
70# CONFIG_KEYBOARD_ATKBD is not set
71CONFIG_KEYBOARD_GPIO=y 92CONFIG_KEYBOARD_GPIO=y
72# CONFIG_INPUT_MOUSE is not set 93# CONFIG_INPUT_MOUSE is not set
73CONFIG_LEGACY_PTY_COUNT=16 94# CONFIG_SERIO is not set
74CONFIG_SERIAL_ATMEL=y 95CONFIG_SERIAL_ATMEL=y
75CONFIG_SERIAL_ATMEL_CONSOLE=y 96CONFIG_SERIAL_ATMEL_CONSOLE=y
76CONFIG_HW_RANDOM=y 97CONFIG_HW_RANDOM=y
77CONFIG_I2C=y 98CONFIG_I2C=y
99CONFIG_I2C_CHARDEV=y
78CONFIG_I2C_GPIO=y 100CONFIG_I2C_GPIO=y
79CONFIG_SPI=y 101CONFIG_SPI=y
80CONFIG_SPI_ATMEL=y 102CONFIG_SPI_ATMEL=y
81CONFIG_SPI_SPIDEV=y 103CONFIG_SPI_SPIDEV=y
104CONFIG_GPIO_SYSFS=y
82# CONFIG_HWMON is not set 105# CONFIG_HWMON is not set
106CONFIG_WATCHDOG=y
107CONFIG_WATCHDOG_NOWAYOUT=y
108CONFIG_AT91SAM9X_WATCHDOG=y
83CONFIG_SOUND=y 109CONFIG_SOUND=y
84CONFIG_SND=y 110CONFIG_SND=y
85CONFIG_SND_SEQUENCER=y 111CONFIG_SND_SEQUENCER=y
@@ -94,12 +120,11 @@ CONFIG_USB_MON=y
94CONFIG_USB_OHCI_HCD=y 120CONFIG_USB_OHCI_HCD=y
95CONFIG_USB_STORAGE=y 121CONFIG_USB_STORAGE=y
96CONFIG_USB_GADGET=y 122CONFIG_USB_GADGET=y
97CONFIG_USB_ZERO=m 123CONFIG_USB_AT91=y
98CONFIG_USB_GADGETFS=m 124CONFIG_USB_G_SERIAL=y
99CONFIG_USB_MASS_STORAGE=m
100CONFIG_USB_G_SERIAL=m
101CONFIG_MMC=y 125CONFIG_MMC=y
102CONFIG_MMC_ATMELMCI=m 126CONFIG_MMC_ATMELMCI=y
127CONFIG_MMC_SPI=y
103CONFIG_NEW_LEDS=y 128CONFIG_NEW_LEDS=y
104CONFIG_LEDS_CLASS=y 129CONFIG_LEDS_CLASS=y
105CONFIG_LEDS_GPIO=y 130CONFIG_LEDS_GPIO=y
@@ -109,15 +134,12 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
109CONFIG_RTC_CLASS=y 134CONFIG_RTC_CLASS=y
110CONFIG_RTC_DRV_RV3029C2=y 135CONFIG_RTC_DRV_RV3029C2=y
111CONFIG_RTC_DRV_AT91SAM9=y 136CONFIG_RTC_DRV_AT91SAM9=y
112CONFIG_EXT2_FS=y 137CONFIG_EXT4_FS=y
113CONFIG_MSDOS_FS=y
114CONFIG_VFAT_FS=y 138CONFIG_VFAT_FS=y
115CONFIG_TMPFS=y 139CONFIG_TMPFS=y
116CONFIG_JFFS2_FS=y 140CONFIG_UBIFS_FS=y
117CONFIG_JFFS2_SUMMARY=y 141CONFIG_UBIFS_FS_ADVANCED_COMPR=y
118CONFIG_CRAMFS=y
119CONFIG_NFS_FS=y 142CONFIG_NFS_FS=y
120CONFIG_NFS_V3=y
121CONFIG_ROOT_NFS=y 143CONFIG_ROOT_NFS=y
122CONFIG_NLS_CODEPAGE_437=y 144CONFIG_NLS_CODEPAGE_437=y
123CONFIG_NLS_CODEPAGE_850=y 145CONFIG_NLS_CODEPAGE_850=y
@@ -125,3 +147,9 @@ CONFIG_NLS_ISO8859_1=y
125CONFIG_NLS_ISO8859_15=y 147CONFIG_NLS_ISO8859_15=y
126CONFIG_NLS_UTF8=y 148CONFIG_NLS_UTF8=y
127# CONFIG_ENABLE_WARN_DEPRECATED is not set 149# CONFIG_ENABLE_WARN_DEPRECATED is not set
150CONFIG_DEBUG_KERNEL=y
151CONFIG_DEBUG_INFO=y
152# CONFIG_FTRACE is not set
153CONFIG_DEBUG_LL=y
154CONFIG_AT91_DEBUG_LL_DBGU0=y
155CONFIG_EARLY_PRINTK=y
diff --git a/arch/arm/configs/at91sam9260_defconfig b/arch/arm/configs/at91sam9260_defconfig
deleted file mode 100644
index 05618eb694f8..000000000000
--- a/arch/arm/configs/at91sam9260_defconfig
+++ /dev/null
@@ -1,91 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y
5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11# CONFIG_IOSCHED_DEADLINE is not set
12# CONFIG_IOSCHED_CFQ is not set
13CONFIG_ARCH_AT91=y
14CONFIG_ARCH_AT91SAM9260=y
15CONFIG_ARCH_AT91SAM9260_SAM9XE=y
16CONFIG_MACH_AT91SAM9260EK=y
17CONFIG_MACH_CAM60=y
18CONFIG_MACH_SAM9_L9260=y
19CONFIG_MACH_AFEB9260=y
20CONFIG_MACH_USB_A9260=y
21CONFIG_MACH_QIL_A9260=y
22CONFIG_MACH_CPU9260=y
23CONFIG_MACH_FLEXIBITY=y
24CONFIG_MACH_SNAPPER_9260=y
25CONFIG_MACH_AT91SAM9_DT=y
26CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
27# CONFIG_ARM_THUMB is not set
28CONFIG_ZBOOT_ROM_TEXT=0x0
29CONFIG_ZBOOT_ROM_BSS=0x0
30CONFIG_ARM_APPENDED_DTB=y
31CONFIG_ARM_ATAG_DTB_COMPAT=y
32CONFIG_CMDLINE="mem=64M console=ttyS0,115200 initrd=0x21100000,3145728 root=/dev/ram0 rw"
33CONFIG_FPE_NWFPE=y
34CONFIG_NET=y
35CONFIG_PACKET=y
36CONFIG_UNIX=y
37CONFIG_INET=y
38CONFIG_IP_PNP=y
39CONFIG_IP_PNP_BOOTP=y
40# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
41# CONFIG_INET_XFRM_MODE_TUNNEL is not set
42# CONFIG_INET_XFRM_MODE_BEET is not set
43# CONFIG_INET_LRO is not set
44# CONFIG_IPV6 is not set
45CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
46CONFIG_BLK_DEV_RAM=y
47CONFIG_BLK_DEV_RAM_SIZE=8192
48CONFIG_SCSI=y
49CONFIG_BLK_DEV_SD=y
50CONFIG_SCSI_MULTI_LUN=y
51CONFIG_NETDEVICES=y
52CONFIG_MII=y
53CONFIG_MACB=y
54# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
55# CONFIG_INPUT_KEYBOARD is not set
56# CONFIG_INPUT_MOUSE is not set
57# CONFIG_SERIO is not set
58CONFIG_SERIAL_ATMEL=y
59CONFIG_SERIAL_ATMEL_CONSOLE=y
60# CONFIG_HW_RANDOM is not set
61CONFIG_I2C=y
62CONFIG_I2C_CHARDEV=y
63CONFIG_I2C_GPIO=y
64# CONFIG_HWMON is not set
65CONFIG_WATCHDOG=y
66CONFIG_WATCHDOG_NOWAYOUT=y
67CONFIG_AT91SAM9X_WATCHDOG=y
68# CONFIG_USB_HID is not set
69CONFIG_USB=y
70CONFIG_USB_DEVICEFS=y
71CONFIG_USB_MON=y
72CONFIG_USB_OHCI_HCD=y
73CONFIG_USB_STORAGE=y
74CONFIG_USB_STORAGE_DEBUG=y
75CONFIG_USB_GADGET=y
76CONFIG_USB_ZERO=m
77CONFIG_USB_GADGETFS=m
78CONFIG_USB_MASS_STORAGE=m
79CONFIG_USB_G_SERIAL=m
80CONFIG_RTC_CLASS=y
81CONFIG_RTC_DRV_AT91SAM9=y
82CONFIG_EXT2_FS=y
83CONFIG_VFAT_FS=y
84CONFIG_TMPFS=y
85CONFIG_CRAMFS=y
86CONFIG_NLS_CODEPAGE_437=y
87CONFIG_NLS_CODEPAGE_850=y
88CONFIG_NLS_ISO8859_1=y
89CONFIG_DEBUG_KERNEL=y
90CONFIG_DEBUG_USER=y
91CONFIG_DEBUG_LL=y
diff --git a/arch/arm/configs/at91sam9261_defconfig b/arch/arm/configs/at91sam9261_9g10_defconfig
index c87beb973b37..9d35cd81c611 100644
--- a/arch/arm/configs/at91sam9261_defconfig
+++ b/arch/arm/configs/at91sam9261_9g10_defconfig
@@ -17,6 +17,7 @@ CONFIG_MODULE_UNLOAD=y
17CONFIG_ARCH_AT91=y 17CONFIG_ARCH_AT91=y
18CONFIG_ARCH_AT91SAM9261=y 18CONFIG_ARCH_AT91SAM9261=y
19CONFIG_MACH_AT91SAM9261EK=y 19CONFIG_MACH_AT91SAM9261EK=y
20CONFIG_MACH_AT91SAM9G10EK=y
20CONFIG_AT91_PROGRAMMABLE_CLOCKS=y 21CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
21# CONFIG_ARM_THUMB is not set 22# CONFIG_ARM_THUMB is not set
22CONFIG_AEABI=y 23CONFIG_AEABI=y
@@ -38,11 +39,11 @@ CONFIG_IP_PNP_BOOTP=y
38# CONFIG_INET_LRO is not set 39# CONFIG_INET_LRO is not set
39# CONFIG_IPV6 is not set 40# CONFIG_IPV6 is not set
40CONFIG_CFG80211=y 41CONFIG_CFG80211=y
41CONFIG_LIB80211=y
42CONFIG_MAC80211=y 42CONFIG_MAC80211=y
43CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 43CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
44CONFIG_DEVTMPFS=y
45CONFIG_DEVTMPFS_MOUNT=y
44CONFIG_MTD=y 46CONFIG_MTD=y
45CONFIG_MTD_PARTITIONS=y
46CONFIG_MTD_CMDLINE_PARTS=y 47CONFIG_MTD_CMDLINE_PARTS=y
47CONFIG_MTD_BLOCK=y 48CONFIG_MTD_BLOCK=y
48CONFIG_MTD_NAND=y 49CONFIG_MTD_NAND=y
@@ -51,17 +52,13 @@ CONFIG_MTD_UBI=y
51CONFIG_MTD_UBI_GLUEBI=y 52CONFIG_MTD_UBI_GLUEBI=y
52CONFIG_BLK_DEV_RAM=y 53CONFIG_BLK_DEV_RAM=y
53CONFIG_BLK_DEV_RAM_SIZE=8192 54CONFIG_BLK_DEV_RAM_SIZE=8192
54CONFIG_MISC_DEVICES=y
55CONFIG_ATMEL_TCLIB=y 55CONFIG_ATMEL_TCLIB=y
56CONFIG_ATMEL_SSC=y 56CONFIG_ATMEL_SSC=y
57CONFIG_SCSI=y 57CONFIG_SCSI=y
58CONFIG_BLK_DEV_SD=y 58CONFIG_BLK_DEV_SD=y
59CONFIG_SCSI_MULTI_LUN=y 59CONFIG_SCSI_MULTI_LUN=y
60CONFIG_NETDEVICES=y 60CONFIG_NETDEVICES=y
61CONFIG_NET_ETHERNET=y
62CONFIG_DM9000=y 61CONFIG_DM9000=y
63# CONFIG_NETDEV_1000 is not set
64# CONFIG_NETDEV_10000 is not set
65CONFIG_USB_ZD1201=m 62CONFIG_USB_ZD1201=m
66CONFIG_RTL8187=m 63CONFIG_RTL8187=m
67CONFIG_LIBERTAS=m 64CONFIG_LIBERTAS=m
@@ -118,15 +115,11 @@ CONFIG_SND_AT73C213=y
118CONFIG_SND_USB_AUDIO=m 115CONFIG_SND_USB_AUDIO=m
119# CONFIG_USB_HID is not set 116# CONFIG_USB_HID is not set
120CONFIG_USB=y 117CONFIG_USB=y
121CONFIG_USB_DEVICEFS=y
122CONFIG_USB_OHCI_HCD=y 118CONFIG_USB_OHCI_HCD=y
123CONFIG_USB_STORAGE=y 119CONFIG_USB_STORAGE=y
124CONFIG_USB_GADGET=y 120CONFIG_USB_GADGET=y
125CONFIG_USB_ZERO=m 121CONFIG_USB_AT91=y
126CONFIG_USB_ETH=m 122CONFIG_USB_G_SERIAL=y
127CONFIG_USB_GADGETFS=m
128CONFIG_USB_MASS_STORAGE=m
129CONFIG_USB_G_SERIAL=m
130CONFIG_MMC=y 123CONFIG_MMC=y
131CONFIG_MMC_ATMELMCI=m 124CONFIG_MMC_ATMELMCI=m
132CONFIG_NEW_LEDS=y 125CONFIG_NEW_LEDS=y
@@ -147,12 +140,10 @@ CONFIG_SQUASHFS=y
147CONFIG_SQUASHFS_LZO=y 140CONFIG_SQUASHFS_LZO=y
148CONFIG_SQUASHFS_XZ=y 141CONFIG_SQUASHFS_XZ=y
149CONFIG_NFS_FS=y 142CONFIG_NFS_FS=y
150CONFIG_NFS_V3=y
151CONFIG_ROOT_NFS=y 143CONFIG_ROOT_NFS=y
152CONFIG_NLS_CODEPAGE_437=y 144CONFIG_NLS_CODEPAGE_437=y
153CONFIG_NLS_CODEPAGE_850=y 145CONFIG_NLS_CODEPAGE_850=y
154CONFIG_NLS_ISO8859_1=y 146CONFIG_NLS_ISO8859_1=y
155CONFIG_NLS_ISO8859_15=y 147CONFIG_NLS_ISO8859_15=y
156CONFIG_NLS_UTF8=y 148CONFIG_NLS_UTF8=y
157CONFIG_FTRACE=y
158CONFIG_CRC_CCITT=m 149CONFIG_CRC_CCITT=m
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig
index 36fed66bd4b5..e40026364e57 100644
--- a/arch/arm/configs/at91sam9263_defconfig
+++ b/arch/arm/configs/at91sam9263_defconfig
@@ -1,6 +1,4 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_KERNEL_LZMA=y
4# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
5CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
6CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
@@ -17,7 +15,6 @@ CONFIG_MODULE_UNLOAD=y
17CONFIG_ARCH_AT91=y 15CONFIG_ARCH_AT91=y
18CONFIG_ARCH_AT91SAM9263=y 16CONFIG_ARCH_AT91SAM9263=y
19CONFIG_MACH_AT91SAM9263EK=y 17CONFIG_MACH_AT91SAM9263EK=y
20CONFIG_MACH_USB_A9263=y
21CONFIG_MTD_AT91_DATAFLASH_CARD=y 18CONFIG_MTD_AT91_DATAFLASH_CARD=y
22# CONFIG_ARM_THUMB is not set 19# CONFIG_ARM_THUMB is not set
23CONFIG_AEABI=y 20CONFIG_AEABI=y
@@ -48,9 +45,11 @@ CONFIG_IP_PIMSM_V2=y
48# CONFIG_INET_LRO is not set 45# CONFIG_INET_LRO is not set
49# CONFIG_INET_DIAG is not set 46# CONFIG_INET_DIAG is not set
50CONFIG_IPV6=y 47CONFIG_IPV6=y
48# CONFIG_WIRELESS is not set
51CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 49CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
50CONFIG_DEVTMPFS=y
51CONFIG_DEVTMPFS_MOUNT=y
52CONFIG_MTD=y 52CONFIG_MTD=y
53CONFIG_MTD_PARTITIONS=y
54CONFIG_MTD_CMDLINE_PARTS=y 53CONFIG_MTD_CMDLINE_PARTS=y
55CONFIG_MTD_CHAR=y 54CONFIG_MTD_CHAR=y
56CONFIG_MTD_BLOCK=y 55CONFIG_MTD_BLOCK=y
@@ -65,7 +64,6 @@ CONFIG_MTD_UBI_GLUEBI=y
65CONFIG_BLK_DEV_LOOP=y 64CONFIG_BLK_DEV_LOOP=y
66CONFIG_BLK_DEV_RAM=y 65CONFIG_BLK_DEV_RAM=y
67CONFIG_BLK_DEV_RAM_SIZE=8192 66CONFIG_BLK_DEV_RAM_SIZE=8192
68CONFIG_MISC_DEVICES=y
69CONFIG_ATMEL_PWM=y 67CONFIG_ATMEL_PWM=y
70CONFIG_ATMEL_TCLIB=y 68CONFIG_ATMEL_TCLIB=y
71CONFIG_SCSI=y 69CONFIG_SCSI=y
@@ -73,23 +71,18 @@ CONFIG_BLK_DEV_SD=y
73CONFIG_SCSI_MULTI_LUN=y 71CONFIG_SCSI_MULTI_LUN=y
74CONFIG_NETDEVICES=y 72CONFIG_NETDEVICES=y
75CONFIG_MII=y 73CONFIG_MII=y
76CONFIG_SMSC_PHY=y
77CONFIG_NET_ETHERNET=y
78CONFIG_MACB=y 74CONFIG_MACB=y
79# CONFIG_NETDEV_1000 is not set 75CONFIG_SMSC_PHY=y
80# CONFIG_NETDEV_10000 is not set 76# CONFIG_WLAN is not set
81CONFIG_USB_ZD1201=m
82CONFIG_INPUT_POLLDEV=m 77CONFIG_INPUT_POLLDEV=m
83# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 78# CONFIG_INPUT_MOUSEDEV is not set
84CONFIG_INPUT_MOUSEDEV_SCREEN_X=240
85CONFIG_INPUT_MOUSEDEV_SCREEN_Y=320
86CONFIG_INPUT_EVDEV=y 79CONFIG_INPUT_EVDEV=y
87# CONFIG_KEYBOARD_ATKBD is not set 80# CONFIG_KEYBOARD_ATKBD is not set
88CONFIG_KEYBOARD_GPIO=y 81CONFIG_KEYBOARD_GPIO=y
89# CONFIG_INPUT_MOUSE is not set 82# CONFIG_INPUT_MOUSE is not set
90CONFIG_INPUT_TOUCHSCREEN=y 83CONFIG_INPUT_TOUCHSCREEN=y
91CONFIG_TOUCHSCREEN_ADS7846=y 84CONFIG_TOUCHSCREEN_ADS7846=y
92CONFIG_LEGACY_PTY_COUNT=4 85# CONFIG_LEGACY_PTYS is not set
93CONFIG_SERIAL_ATMEL=y 86CONFIG_SERIAL_ATMEL=y
94CONFIG_SERIAL_ATMEL_CONSOLE=y 87CONFIG_SERIAL_ATMEL_CONSOLE=y
95CONFIG_HW_RANDOM=y 88CONFIG_HW_RANDOM=y
@@ -98,6 +91,7 @@ CONFIG_I2C_CHARDEV=y
98CONFIG_I2C_GPIO=y 91CONFIG_I2C_GPIO=y
99CONFIG_SPI=y 92CONFIG_SPI=y
100CONFIG_SPI_ATMEL=y 93CONFIG_SPI_ATMEL=y
94CONFIG_GPIO_SYSFS=y
101# CONFIG_HWMON is not set 95# CONFIG_HWMON is not set
102CONFIG_WATCHDOG=y 96CONFIG_WATCHDOG=y
103CONFIG_WATCHDOG_NOWAYOUT=y 97CONFIG_WATCHDOG_NOWAYOUT=y
@@ -107,9 +101,9 @@ CONFIG_FB_ATMEL=y
107CONFIG_BACKLIGHT_LCD_SUPPORT=y 101CONFIG_BACKLIGHT_LCD_SUPPORT=y
108CONFIG_LCD_CLASS_DEVICE=y 102CONFIG_LCD_CLASS_DEVICE=y
109CONFIG_BACKLIGHT_CLASS_DEVICE=y 103CONFIG_BACKLIGHT_CLASS_DEVICE=y
110CONFIG_BACKLIGHT_ATMEL_LCDC=y
111CONFIG_FRAMEBUFFER_CONSOLE=y 104CONFIG_FRAMEBUFFER_CONSOLE=y
112CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 105CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
106CONFIG_FONTS=y
113CONFIG_LOGO=y 107CONFIG_LOGO=y
114CONFIG_SOUND=y 108CONFIG_SOUND=y
115CONFIG_SND=y 109CONFIG_SND=y
@@ -124,16 +118,12 @@ CONFIG_SND_ATMEL_AC97C=y
124# CONFIG_SND_SPI is not set 118# CONFIG_SND_SPI is not set
125CONFIG_SND_USB_AUDIO=m 119CONFIG_SND_USB_AUDIO=m
126CONFIG_USB=y 120CONFIG_USB=y
127CONFIG_USB_DEVICEFS=y
128CONFIG_USB_MON=y 121CONFIG_USB_MON=y
129CONFIG_USB_OHCI_HCD=y 122CONFIG_USB_OHCI_HCD=y
130CONFIG_USB_STORAGE=y 123CONFIG_USB_STORAGE=y
131CONFIG_USB_GADGET=y 124CONFIG_USB_GADGET=y
132CONFIG_USB_ZERO=m 125CONFIG_USB_ATMEL_USBA=y
133CONFIG_USB_ETH=m 126CONFIG_USB_G_SERIAL=y
134CONFIG_USB_GADGETFS=m
135CONFIG_USB_MASS_STORAGE=m
136CONFIG_USB_G_SERIAL=m
137CONFIG_MMC=y 127CONFIG_MMC=y
138CONFIG_SDIO_UART=m 128CONFIG_SDIO_UART=m
139CONFIG_MMC_ATMELMCI=m 129CONFIG_MMC_ATMELMCI=m
@@ -145,22 +135,18 @@ CONFIG_LEDS_TRIGGERS=y
145CONFIG_LEDS_TRIGGER_HEARTBEAT=y 135CONFIG_LEDS_TRIGGER_HEARTBEAT=y
146CONFIG_RTC_CLASS=y 136CONFIG_RTC_CLASS=y
147CONFIG_RTC_DRV_AT91SAM9=y 137CONFIG_RTC_DRV_AT91SAM9=y
148CONFIG_EXT2_FS=y 138CONFIG_EXT4_FS=y
149CONFIG_FUSE_FS=m
150CONFIG_VFAT_FS=y 139CONFIG_VFAT_FS=y
151CONFIG_TMPFS=y 140CONFIG_TMPFS=y
152CONFIG_JFFS2_FS=y
153CONFIG_UBIFS_FS=y 141CONFIG_UBIFS_FS=y
154CONFIG_UBIFS_FS_ADVANCED_COMPR=y 142CONFIG_UBIFS_FS_ADVANCED_COMPR=y
155CONFIG_CRAMFS=y
156CONFIG_NFS_FS=y 143CONFIG_NFS_FS=y
157CONFIG_NFS_V3=y
158CONFIG_NFS_V3_ACL=y 144CONFIG_NFS_V3_ACL=y
159CONFIG_NFS_V4=y 145CONFIG_NFS_V4=y
160CONFIG_ROOT_NFS=y 146CONFIG_ROOT_NFS=y
161CONFIG_NLS_CODEPAGE_437=y 147CONFIG_NLS_CODEPAGE_437=y
162CONFIG_NLS_CODEPAGE_850=y 148CONFIG_NLS_CODEPAGE_850=y
163CONFIG_NLS_ISO8859_1=y 149CONFIG_NLS_ISO8859_1=y
164CONFIG_FTRACE=y 150CONFIG_NLS_UTF8=y
165CONFIG_DEBUG_USER=y 151CONFIG_DEBUG_USER=y
166CONFIG_XZ_DEC=y 152CONFIG_XZ_DEC=y
diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
index 18964cdacd68..08166cd4e7d6 100644
--- a/arch/arm/configs/at91sam9g45_defconfig
+++ b/arch/arm/configs/at91sam9g45_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
@@ -23,8 +22,6 @@ CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
23CONFIG_AT91_SLOW_CLOCK=y 22CONFIG_AT91_SLOW_CLOCK=y
24CONFIG_AEABI=y 23CONFIG_AEABI=y
25# CONFIG_OABI_COMPAT is not set 24# CONFIG_OABI_COMPAT is not set
26CONFIG_LEDS=y
27CONFIG_LEDS_CPU=y
28CONFIG_UACCESS_WITH_MEMCPY=y 25CONFIG_UACCESS_WITH_MEMCPY=y
29CONFIG_ZBOOT_ROM_TEXT=0x0 26CONFIG_ZBOOT_ROM_TEXT=0x0
30CONFIG_ZBOOT_ROM_BSS=0x0 27CONFIG_ZBOOT_ROM_BSS=0x0
@@ -36,6 +33,9 @@ CONFIG_PACKET=y
36CONFIG_UNIX=y 33CONFIG_UNIX=y
37CONFIG_INET=y 34CONFIG_INET=y
38CONFIG_IP_MULTICAST=y 35CONFIG_IP_MULTICAST=y
36CONFIG_IP_PNP=y
37CONFIG_IP_PNP_DHCP=y
38CONFIG_IP_PNP_BOOTP=y
39# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 39# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
40# CONFIG_INET_XFRM_MODE_TUNNEL is not set 40# CONFIG_INET_XFRM_MODE_TUNNEL is not set
41# CONFIG_INET_XFRM_MODE_BEET is not set 41# CONFIG_INET_XFRM_MODE_BEET is not set
@@ -45,9 +45,6 @@ CONFIG_IPV6=y
45# CONFIG_INET6_XFRM_MODE_TUNNEL is not set 45# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
46# CONFIG_INET6_XFRM_MODE_BEET is not set 46# CONFIG_INET6_XFRM_MODE_BEET is not set
47CONFIG_IPV6_SIT_6RD=y 47CONFIG_IPV6_SIT_6RD=y
48CONFIG_CFG80211=y
49CONFIG_LIB80211=y
50CONFIG_MAC80211=y
51CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 48CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
52CONFIG_DEVTMPFS=y 49CONFIG_DEVTMPFS=y
53CONFIG_DEVTMPFS_MOUNT=y 50CONFIG_DEVTMPFS_MOUNT=y
@@ -61,13 +58,14 @@ CONFIG_MTD_DATAFLASH=y
61CONFIG_MTD_NAND=y 58CONFIG_MTD_NAND=y
62CONFIG_MTD_NAND_ATMEL=y 59CONFIG_MTD_NAND_ATMEL=y
63CONFIG_MTD_UBI=y 60CONFIG_MTD_UBI=y
61CONFIG_MTD_UBI_GLUEBI=y
64CONFIG_BLK_DEV_LOOP=y 62CONFIG_BLK_DEV_LOOP=y
65CONFIG_BLK_DEV_RAM=y 63CONFIG_BLK_DEV_RAM=y
66CONFIG_BLK_DEV_RAM_COUNT=4 64CONFIG_BLK_DEV_RAM_COUNT=4
67CONFIG_BLK_DEV_RAM_SIZE=8192 65CONFIG_BLK_DEV_RAM_SIZE=8192
68CONFIG_MISC_DEVICES=y
69CONFIG_ATMEL_PWM=y 66CONFIG_ATMEL_PWM=y
70CONFIG_ATMEL_TCLIB=y 67CONFIG_ATMEL_TCLIB=y
68CONFIG_ATMEL_SSC=y
71CONFIG_SCSI=y 69CONFIG_SCSI=y
72CONFIG_BLK_DEV_SD=y 70CONFIG_BLK_DEV_SD=y
73CONFIG_SCSI_MULTI_LUN=y 71CONFIG_SCSI_MULTI_LUN=y
@@ -76,67 +74,40 @@ CONFIG_NETDEVICES=y
76CONFIG_MII=y 74CONFIG_MII=y
77CONFIG_MACB=y 75CONFIG_MACB=y
78CONFIG_DAVICOM_PHY=y 76CONFIG_DAVICOM_PHY=y
79CONFIG_LIBERTAS_THINFIRM=m 77# CONFIG_INPUT_MOUSEDEV is not set
80CONFIG_LIBERTAS_THINFIRM_USB=m
81CONFIG_AT76C50X_USB=m
82CONFIG_USB_ZD1201=m
83CONFIG_RTL8187=m
84CONFIG_ATH_COMMON=m
85CONFIG_ATH9K=m
86CONFIG_CARL9170=m
87CONFIG_B43=m
88CONFIG_B43_PHY_N=y
89CONFIG_LIBERTAS=m
90CONFIG_LIBERTAS_USB=m
91CONFIG_LIBERTAS_SDIO=m
92CONFIG_LIBERTAS_SPI=m
93CONFIG_RT2X00=m
94CONFIG_RT2500USB=m
95CONFIG_RT73USB=m
96CONFIG_RT2800USB=m
97CONFIG_RT2800USB_RT53XX=y
98CONFIG_RT2800USB_UNKNOWN=y
99CONFIG_RTL8192CU=m
100CONFIG_WL1251=m
101CONFIG_WL1251_SDIO=m
102CONFIG_WL12XX_MENU=m
103CONFIG_WL12XX=m
104CONFIG_WL12XX_SDIO=m
105CONFIG_ZD1211RW=m
106CONFIG_MWIFIEX=m
107CONFIG_MWIFIEX_SDIO=m
108CONFIG_INPUT_POLLDEV=m
109# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
110CONFIG_INPUT_MOUSEDEV_SCREEN_X=480
111CONFIG_INPUT_MOUSEDEV_SCREEN_Y=272
112CONFIG_INPUT_JOYDEV=y 78CONFIG_INPUT_JOYDEV=y
113CONFIG_INPUT_EVDEV=y 79CONFIG_INPUT_EVDEV=y
114# CONFIG_KEYBOARD_ATKBD is not set 80# CONFIG_KEYBOARD_ATKBD is not set
115CONFIG_KEYBOARD_QT1070=m 81CONFIG_KEYBOARD_QT1070=y
116CONFIG_KEYBOARD_QT2160=m 82CONFIG_KEYBOARD_QT2160=y
117CONFIG_KEYBOARD_GPIO=y 83CONFIG_KEYBOARD_GPIO=y
118# CONFIG_INPUT_MOUSE is not set 84# CONFIG_INPUT_MOUSE is not set
119CONFIG_INPUT_TOUCHSCREEN=y 85CONFIG_INPUT_TOUCHSCREEN=y
120CONFIG_TOUCHSCREEN_ATMEL_MXT=m 86CONFIG_TOUCHSCREEN_ATMEL_MXT=m
121CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y 87CONFIG_TOUCHSCREEN_ATMEL_TSADCC=y
122# CONFIG_SERIO is not set 88# CONFIG_SERIO is not set
123CONFIG_LEGACY_PTY_COUNT=4 89# CONFIG_LEGACY_PTYS is not set
124CONFIG_SERIAL_ATMEL=y 90CONFIG_SERIAL_ATMEL=y
125CONFIG_SERIAL_ATMEL_CONSOLE=y 91CONFIG_SERIAL_ATMEL_CONSOLE=y
126CONFIG_HW_RANDOM=y 92CONFIG_HW_RANDOM=y
127CONFIG_I2C=y 93CONFIG_I2C=y
94CONFIG_I2C_CHARDEV=y
128CONFIG_I2C_GPIO=y 95CONFIG_I2C_GPIO=y
129CONFIG_SPI=y 96CONFIG_SPI=y
130CONFIG_SPI_ATMEL=y 97CONFIG_SPI_ATMEL=y
131# CONFIG_HWMON is not set 98# CONFIG_HWMON is not set
132CONFIG_FB=y 99CONFIG_FB=y
133CONFIG_FB_ATMEL=y 100CONFIG_FB_ATMEL=y
134CONFIG_FB_UDL=m
135CONFIG_BACKLIGHT_LCD_SUPPORT=y 101CONFIG_BACKLIGHT_LCD_SUPPORT=y
136# CONFIG_LCD_CLASS_DEVICE is not set 102CONFIG_LCD_CLASS_DEVICE=y
137CONFIG_BACKLIGHT_CLASS_DEVICE=y 103CONFIG_BACKLIGHT_CLASS_DEVICE=y
138CONFIG_BACKLIGHT_ATMEL_LCDC=y 104CONFIG_BACKLIGHT_ATMEL_LCDC=y
105CONFIG_BACKLIGHT_ATMEL_PWM=y
139# CONFIG_BACKLIGHT_GENERIC is not set 106# CONFIG_BACKLIGHT_GENERIC is not set
107CONFIG_FRAMEBUFFER_CONSOLE=y
108CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
109CONFIG_FONTS=y
110CONFIG_LOGO=y
140CONFIG_SOUND=y 111CONFIG_SOUND=y
141CONFIG_SND=y 112CONFIG_SND=y
142CONFIG_SND_SEQUENCER=y 113CONFIG_SND_SEQUENCER=y
@@ -148,33 +119,25 @@ CONFIG_SND_PCM_OSS=y
148# CONFIG_SND_ARM is not set 119# CONFIG_SND_ARM is not set
149CONFIG_SND_ATMEL_AC97C=y 120CONFIG_SND_ATMEL_AC97C=y
150# CONFIG_SND_SPI is not set 121# CONFIG_SND_SPI is not set
151CONFIG_SND_USB_AUDIO=m 122# CONFIG_SND_USB is not set
152# CONFIG_USB_HID is not set 123# CONFIG_USB_HID is not set
153CONFIG_USB=y 124CONFIG_USB=y
154CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 125CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
155CONFIG_USB_DEVICEFS=y
156# CONFIG_USB_DEVICE_CLASS is not set
157CONFIG_USB_EHCI_HCD=y 126CONFIG_USB_EHCI_HCD=y
158CONFIG_USB_OHCI_HCD=y 127CONFIG_USB_OHCI_HCD=y
159CONFIG_USB_ACM=y 128CONFIG_USB_ACM=y
160CONFIG_USB_STORAGE=y 129CONFIG_USB_STORAGE=y
161CONFIG_USB_GADGET=y 130CONFIG_USB_GADGET=y
162CONFIG_USB_ATMEL_USBA=m 131CONFIG_USB_ATMEL_USBA=y
163CONFIG_USB_ZERO=m 132CONFIG_USB_G_MULTI=y
164CONFIG_USB_AUDIO=m
165CONFIG_USB_ETH=m
166CONFIG_USB_ETH_EEM=y
167CONFIG_USB_MASS_STORAGE=m
168CONFIG_USB_G_SERIAL=m
169CONFIG_USB_CDC_COMPOSITE=m
170CONFIG_USB_G_MULTI=m
171CONFIG_USB_G_MULTI_CDC=y 133CONFIG_USB_G_MULTI_CDC=y
172CONFIG_MMC=y 134CONFIG_MMC=y
173# CONFIG_MMC_BLOCK_BOUNCE is not set 135# CONFIG_MMC_BLOCK_BOUNCE is not set
174CONFIG_SDIO_UART=m
175CONFIG_MMC_ATMELMCI=y 136CONFIG_MMC_ATMELMCI=y
176CONFIG_LEDS_ATMEL_PWM=y 137CONFIG_NEW_LEDS=y
138CONFIG_LEDS_CLASS=y
177CONFIG_LEDS_GPIO=y 139CONFIG_LEDS_GPIO=y
140CONFIG_LEDS_TRIGGERS=y
178CONFIG_LEDS_TRIGGER_TIMER=y 141CONFIG_LEDS_TRIGGER_TIMER=y
179CONFIG_LEDS_TRIGGER_HEARTBEAT=y 142CONFIG_LEDS_TRIGGER_HEARTBEAT=y
180CONFIG_LEDS_TRIGGER_GPIO=y 143CONFIG_LEDS_TRIGGER_GPIO=y
@@ -184,17 +147,14 @@ CONFIG_DMADEVICES=y
184CONFIG_AT_HDMAC=y 147CONFIG_AT_HDMAC=y
185CONFIG_DMATEST=m 148CONFIG_DMATEST=m
186# CONFIG_IOMMU_SUPPORT is not set 149# CONFIG_IOMMU_SUPPORT is not set
187CONFIG_EXT2_FS=y 150CONFIG_EXT4_FS=y
188CONFIG_FANOTIFY=y 151CONFIG_FANOTIFY=y
189CONFIG_VFAT_FS=y 152CONFIG_VFAT_FS=y
190CONFIG_TMPFS=y 153CONFIG_TMPFS=y
191CONFIG_JFFS2_FS=y 154CONFIG_UBIFS_FS=y
192CONFIG_JFFS2_SUMMARY=y 155CONFIG_UBIFS_FS_ADVANCED_COMPR=y
193CONFIG_CRAMFS=m
194CONFIG_SQUASHFS=m
195CONFIG_SQUASHFS_EMBEDDED=y
196CONFIG_NFS_FS=y 156CONFIG_NFS_FS=y
197CONFIG_NFS_V3=y 157CONFIG_ROOT_NFS=y
198CONFIG_NLS_CODEPAGE_437=y 158CONFIG_NLS_CODEPAGE_437=y
199CONFIG_NLS_CODEPAGE_850=y 159CONFIG_NLS_CODEPAGE_850=y
200CONFIG_NLS_ISO8859_1=y 160CONFIG_NLS_ISO8859_1=y
@@ -203,6 +163,8 @@ CONFIG_STRIP_ASM_SYMS=y
203CONFIG_DEBUG_MEMORY_INIT=y 163CONFIG_DEBUG_MEMORY_INIT=y
204# CONFIG_FTRACE is not set 164# CONFIG_FTRACE is not set
205CONFIG_DEBUG_USER=y 165CONFIG_DEBUG_USER=y
166CONFIG_DEBUG_LL=y
167CONFIG_EARLY_PRINTK=y
206CONFIG_CRYPTO_ECB=y 168CONFIG_CRYPTO_ECB=y
207# CONFIG_CRYPTO_ANSI_CPRNG is not set 169# CONFIG_CRYPTO_ANSI_CPRNG is not set
208CONFIG_CRYPTO_USER_API_HASH=m 170CONFIG_CRYPTO_USER_API_HASH=m
diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig
index ce987211a609..34e9780e63ba 100644
--- a/arch/arm/configs/bcm2835_defconfig
+++ b/arch/arm/configs/bcm2835_defconfig
@@ -55,14 +55,11 @@ CONFIG_DEVTMPFS_MOUNT=y
55# CONFIG_INPUT_KEYBOARD is not set 55# CONFIG_INPUT_KEYBOARD is not set
56# CONFIG_INPUT_MOUSE is not set 56# CONFIG_INPUT_MOUSE is not set
57# CONFIG_SERIO is not set 57# CONFIG_SERIO is not set
58# CONFIG_VT is not set
59# CONFIG_LEGACY_PTYS is not set 58# CONFIG_LEGACY_PTYS is not set
60# CONFIG_DEVKMEM is not set 59# CONFIG_DEVKMEM is not set
61CONFIG_SERIAL_AMBA_PL011=y 60CONFIG_SERIAL_AMBA_PL011=y
62CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 61CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
63CONFIG_TTY_PRINTK=y 62CONFIG_TTY_PRINTK=y
64CONFIG_HW_RANDOM=y
65CONFIG_HW_RANDOM_BCM2835=y
66CONFIG_I2C=y 63CONFIG_I2C=y
67CONFIG_I2C_CHARDEV=y 64CONFIG_I2C_CHARDEV=y
68CONFIG_I2C_BCM2835=y 65CONFIG_I2C_BCM2835=y
@@ -70,11 +67,27 @@ CONFIG_SPI=y
70CONFIG_SPI_BCM2835=y 67CONFIG_SPI_BCM2835=y
71CONFIG_GPIO_SYSFS=y 68CONFIG_GPIO_SYSFS=y
72# CONFIG_HWMON is not set 69# CONFIG_HWMON is not set
70CONFIG_FB=y
71CONFIG_FB_SIMPLE=y
72CONFIG_FRAMEBUFFER_CONSOLE=y
73CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
73# CONFIG_USB_SUPPORT is not set 74# CONFIG_USB_SUPPORT is not set
74CONFIG_MMC=y 75CONFIG_MMC=y
75CONFIG_MMC_SDHCI=y 76CONFIG_MMC_SDHCI=y
76CONFIG_MMC_SDHCI_PLTFM=y 77CONFIG_MMC_SDHCI_PLTFM=y
77CONFIG_MMC_SDHCI_BCM2835=y 78CONFIG_MMC_SDHCI_BCM2835=y
79CONFIG_NEW_LEDS=y
80CONFIG_LEDS_CLASS=y
81CONFIG_LEDS_GPIO=y
82CONFIG_LEDS_TRIGGERS=y
83CONFIG_LEDS_TRIGGER_TIMER=y
84CONFIG_LEDS_TRIGGER_ONESHOT=y
85CONFIG_LEDS_TRIGGER_HEARTBEAT=y
86CONFIG_LEDS_TRIGGER_CPU=y
87CONFIG_LEDS_TRIGGER_GPIO=y
88CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
89CONFIG_LEDS_TRIGGER_TRANSIENT=y
90CONFIG_LEDS_TRIGGER_CAMERA=y
78# CONFIG_IOMMU_SUPPORT is not set 91# CONFIG_IOMMU_SUPPORT is not set
79CONFIG_EXT2_FS=y 92CONFIG_EXT2_FS=y
80CONFIG_EXT2_FS_XATTR=y 93CONFIG_EXT2_FS_XATTR=y
diff --git a/arch/arm/configs/bockw_defconfig b/arch/arm/configs/bockw_defconfig
index 6524cdf3b08d..845f5cdf62b5 100644
--- a/arch/arm/configs/bockw_defconfig
+++ b/arch/arm/configs/bockw_defconfig
@@ -31,6 +31,7 @@ CONFIG_CMDLINE="console=ttySC0,115200 ignore_loglevel root=/dev/nfs ip=dhcp"
31CONFIG_CMDLINE_FORCE=y 31CONFIG_CMDLINE_FORCE=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33# CONFIG_SUSPEND is not set 33# CONFIG_SUSPEND is not set
34CONFIG_PM_RUNTIME=y
34CONFIG_NET=y 35CONFIG_NET=y
35CONFIG_UNIX=y 36CONFIG_UNIX=y
36CONFIG_INET=y 37CONFIG_INET=y
@@ -48,6 +49,14 @@ CONFIG_DEVTMPFS_MOUNT=y
48# CONFIG_STANDALONE is not set 49# CONFIG_STANDALONE is not set
49# CONFIG_PREVENT_FIRMWARE_BUILD is not set 50# CONFIG_PREVENT_FIRMWARE_BUILD is not set
50# CONFIG_FW_LOADER is not set 51# CONFIG_FW_LOADER is not set
52CONFIG_MTD=y
53CONFIG_MTD_CHAR=y
54CONFIG_MTD_BLOCK=y
55CONFIG_MTD_CFI=y
56CONFIG_MTD_CFI_AMDSTD=y
57CONFIG_MTD_M25P80=y
58CONFIG_SCSI=y
59CONFIG_BLK_DEV_SD=y
51CONFIG_NETDEVICES=y 60CONFIG_NETDEVICES=y
52# CONFIG_NET_CADENCE is not set 61# CONFIG_NET_CADENCE is not set
53# CONFIG_NET_VENDOR_BROADCOM is not set 62# CONFIG_NET_VENDOR_BROADCOM is not set
@@ -71,7 +80,23 @@ CONFIG_SERIAL_SH_SCI_NR_UARTS=6
71CONFIG_SERIAL_SH_SCI_CONSOLE=y 80CONFIG_SERIAL_SH_SCI_CONSOLE=y
72# CONFIG_HW_RANDOM is not set 81# CONFIG_HW_RANDOM is not set
73# CONFIG_HWMON is not set 82# CONFIG_HWMON is not set
74# CONFIG_USB_SUPPORT is not set 83CONFIG_I2C=y
84CONFIG_I2C_RCAR=y
85CONFIG_SPI=y
86CONFIG_SPI_SH_HSPI=y
87CONFIG_USB=y
88CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
89CONFIG_USB_EHCI_HCD=y
90CONFIG_USB_OHCI_HCD=y
91CONFIG_USB_OHCI_HCD_PLATFORM=y
92CONFIG_USB_EHCI_HCD_PLATFORM=y
93CONFIG_USB_STORAGE=y
94CONFIG_USB_RCAR_PHY=y
95CONFIG_MMC=y
96CONFIG_MMC_SDHI=y
97CONFIG_MMC_SH_MMCIF=y
98CONFIG_RTC_CLASS=y
99CONFIG_RTC_DRV_RX8581=y
75CONFIG_UIO=y 100CONFIG_UIO=y
76CONFIG_UIO_PDRV_GENIRQ=y 101CONFIG_UIO_PDRV_GENIRQ=y
77# CONFIG_IOMMU_SUPPORT is not set 102# CONFIG_IOMMU_SUPPORT is not set
diff --git a/arch/arm/configs/bonito_defconfig b/arch/arm/configs/bonito_defconfig
deleted file mode 100644
index 54571082d920..000000000000
--- a/arch/arm/configs/bonito_defconfig
+++ /dev/null
@@ -1,72 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16
6# CONFIG_UTS_NS is not set
7# CONFIG_IPC_NS is not set
8# CONFIG_USER_NS is not set
9# CONFIG_PID_NS is not set
10CONFIG_BLK_DEV_INITRD=y
11CONFIG_INITRAMFS_SOURCE=""
12CONFIG_CC_OPTIMIZE_FOR_SIZE=y
13CONFIG_SLAB=y
14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y
16CONFIG_MODULE_FORCE_UNLOAD=y
17# CONFIG_BLK_DEV_BSG is not set
18# CONFIG_IOSCHED_DEADLINE is not set
19# CONFIG_IOSCHED_CFQ is not set
20CONFIG_ARCH_SHMOBILE=y
21CONFIG_ARCH_R8A7740=y
22CONFIG_MACH_BONITO=y
23# CONFIG_SH_TIMER_TMU is not set
24CONFIG_AEABI=y
25# CONFIG_OABI_COMPAT is not set
26CONFIG_FORCE_MAX_ZONEORDER=12
27CONFIG_ZBOOT_ROM_TEXT=0x0
28CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_CMDLINE="console=ttySC5,115200 earlyprintk=sh-sci.5,115200 ignore_loglevel"
30CONFIG_KEXEC=y
31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
32# CONFIG_SUSPEND is not set
33CONFIG_PM_RUNTIME=y
34CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
35# CONFIG_FIRMWARE_IN_KERNEL is not set
36CONFIG_MTD=y
37CONFIG_MTD_CHAR=y
38CONFIG_MTD_BLOCK=y
39CONFIG_MTD_CFI=y
40CONFIG_MTD_CFI_ADV_OPTIONS=y
41CONFIG_MTD_CFI_INTELEXT=y
42CONFIG_MTD_PHYSMAP=y
43CONFIG_MTD_ARM_INTEGRATOR=y
44CONFIG_MTD_BLOCK2MTD=y
45CONFIG_SCSI=y
46CONFIG_BLK_DEV_SD=y
47# CONFIG_SCSI_LOWLEVEL is not set
48# CONFIG_INPUT_KEYBOARD is not set
49# CONFIG_INPUT_MOUSE is not set
50# CONFIG_LEGACY_PTYS is not set
51CONFIG_SERIAL_SH_SCI=y
52CONFIG_SERIAL_SH_SCI_NR_UARTS=9
53CONFIG_SERIAL_SH_SCI_CONSOLE=y
54# CONFIG_HW_RANDOM is not set
55CONFIG_I2C=y
56CONFIG_I2C_CHARDEV=y
57CONFIG_I2C_SH_MOBILE=y
58CONFIG_GPIO_SYSFS=y
59# CONFIG_HWMON is not set
60# CONFIG_MFD_SUPPORT is not set
61# CONFIG_HID_SUPPORT is not set
62# CONFIG_USB_SUPPORT is not set
63CONFIG_UIO=y
64CONFIG_UIO_PDRV=y
65CONFIG_UIO_PDRV_GENIRQ=y
66# CONFIG_DNOTIFY is not set
67# CONFIG_INOTIFY_USER is not set
68CONFIG_TMPFS=y
69# CONFIG_MISC_FILESYSTEMS is not set
70# CONFIG_ENABLE_WARN_DEPRECATED is not set
71# CONFIG_ENABLE_MUST_CHECK is not set
72# CONFIG_ARM_UNWIND is not set
diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig
index 1cd94c36321f..9e8c8316d6b0 100644
--- a/arch/arm/configs/clps711x_defconfig
+++ b/arch/arm/configs/clps711x_defconfig
@@ -31,21 +31,18 @@ CONFIG_EP7211_DONGLE=y
31# CONFIG_WIRELESS is not set 31# CONFIG_WIRELESS is not set
32CONFIG_MTD=y 32CONFIG_MTD=y
33CONFIG_MTD_CMDLINE_PARTS=y 33CONFIG_MTD_CMDLINE_PARTS=y
34CONFIG_MTD_CHAR=y
35CONFIG_MTD_BLOCK=y 34CONFIG_MTD_BLOCK=y
36CONFIG_MTD_CFI=y 35CONFIG_MTD_CFI=y
37CONFIG_MTD_JEDECPROBE=y 36CONFIG_MTD_JEDECPROBE=y
38CONFIG_MTD_CFI_INTELEXT=y 37CONFIG_MTD_CFI_INTELEXT=y
39CONFIG_MTD_CFI_AMDSTD=y 38CONFIG_MTD_CFI_AMDSTD=y
40CONFIG_MTD_CFI_STAA=y 39CONFIG_MTD_CFI_STAA=y
41CONFIG_MTD_AUTCPU12=y
42CONFIG_MTD_PLATRAM=y 40CONFIG_MTD_PLATRAM=y
43CONFIG_MTD_NAND=y 41CONFIG_MTD_NAND=y
44CONFIG_MTD_NAND_GPIO=y 42CONFIG_MTD_NAND_GPIO=y
45CONFIG_NETDEVICES=y 43CONFIG_NETDEVICES=y
46# CONFIG_NET_CADENCE is not set 44# CONFIG_NET_CADENCE is not set
47# CONFIG_NET_VENDOR_BROADCOM is not set 45# CONFIG_NET_VENDOR_BROADCOM is not set
48# CONFIG_NET_VENDOR_CHELSIO is not set
49CONFIG_CS89x0=y 46CONFIG_CS89x0=y
50CONFIG_CS89x0_PLATFORM=y 47CONFIG_CS89x0_PLATFORM=y
51# CONFIG_NET_VENDOR_FARADAY is not set 48# CONFIG_NET_VENDOR_FARADAY is not set
@@ -63,7 +60,11 @@ CONFIG_CS89x0_PLATFORM=y
63# CONFIG_VT is not set 60# CONFIG_VT is not set
64CONFIG_SERIAL_CLPS711X_CONSOLE=y 61CONFIG_SERIAL_CLPS711X_CONSOLE=y
65# CONFIG_HW_RANDOM is not set 62# CONFIG_HW_RANDOM is not set
63CONFIG_I2C=y
64CONFIG_I2C_GPIO=y
66CONFIG_SPI=y 65CONFIG_SPI=y
66CONFIG_SPI_CLPS711X=y
67CONFIG_GPIO_CLPS711X=y
67CONFIG_GPIO_GENERIC_PLATFORM=y 68CONFIG_GPIO_GENERIC_PLATFORM=y
68# CONFIG_HWMON is not set 69# CONFIG_HWMON is not set
69CONFIG_FB=y 70CONFIG_FB=y
@@ -87,4 +88,3 @@ CONFIG_DEBUG_LL=y
87CONFIG_EARLY_PRINTK=y 88CONFIG_EARLY_PRINTK=y
88# CONFIG_CRYPTO_ANSI_CPRNG is not set 89# CONFIG_CRYPTO_ANSI_CPRNG is not set
89# CONFIG_CRYPTO_HW is not set 90# CONFIG_CRYPTO_HW is not set
90# CONFIG_CRC32 is not set
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index 227abf9cc601..ad7dfbbafa45 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -50,6 +50,7 @@ CONFIG_USB_USBNET=y
50CONFIG_USB_NET_SMSC75XX=y 50CONFIG_USB_NET_SMSC75XX=y
51CONFIG_USB_NET_SMSC95XX=y 51CONFIG_USB_NET_SMSC95XX=y
52CONFIG_INPUT_EVDEV=y 52CONFIG_INPUT_EVDEV=y
53CONFIG_KEYBOARD_GPIO=y
53CONFIG_KEYBOARD_CROS_EC=y 54CONFIG_KEYBOARD_CROS_EC=y
54# CONFIG_MOUSE_PS2 is not set 55# CONFIG_MOUSE_PS2 is not set
55CONFIG_MOUSE_CYAPA=y 56CONFIG_MOUSE_CYAPA=y
@@ -104,6 +105,8 @@ CONFIG_MMC_SDHCI_S3C=y
104CONFIG_MMC_DW=y 105CONFIG_MMC_DW=y
105CONFIG_MMC_DW_IDMAC=y 106CONFIG_MMC_DW_IDMAC=y
106CONFIG_MMC_DW_EXYNOS=y 107CONFIG_MMC_DW_EXYNOS=y
108CONFIG_RTC_CLASS=y
109CONFIG_RTC_DRV_S3C=y
107CONFIG_COMMON_CLK_MAX77686=y 110CONFIG_COMMON_CLK_MAX77686=y
108CONFIG_EXT2_FS=y 111CONFIG_EXT2_FS=y
109CONFIG_EXT3_FS=y 112CONFIG_EXT3_FS=y
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index 6ec010f248b5..06686e7303a9 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -37,6 +37,8 @@ CONFIG_MACH_IMX51_DT=y
37CONFIG_MACH_EUKREA_CPUIMX51SD=y 37CONFIG_MACH_EUKREA_CPUIMX51SD=y
38CONFIG_SOC_IMX53=y 38CONFIG_SOC_IMX53=y
39CONFIG_SOC_IMX6Q=y 39CONFIG_SOC_IMX6Q=y
40CONFIG_SOC_IMX6SL=y
41CONFIG_SOC_VF610=y
40CONFIG_MXC_PWM=y 42CONFIG_MXC_PWM=y
41CONFIG_SMP=y 43CONFIG_SMP=y
42CONFIG_VMSPLIT_2G=y 44CONFIG_VMSPLIT_2G=y
@@ -47,6 +49,7 @@ CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
47CONFIG_VFP=y 49CONFIG_VFP=y
48CONFIG_NEON=y 50CONFIG_NEON=y
49CONFIG_BINFMT_MISC=m 51CONFIG_BINFMT_MISC=m
52CONFIG_PM_RUNTIME=y
50CONFIG_PM_DEBUG=y 53CONFIG_PM_DEBUG=y
51CONFIG_PM_TEST_SUSPEND=y 54CONFIG_PM_TEST_SUSPEND=y
52CONFIG_NET=y 55CONFIG_NET=y
@@ -170,6 +173,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
170CONFIG_LCD_CLASS_DEVICE=y 173CONFIG_LCD_CLASS_DEVICE=y
171CONFIG_LCD_L4F00242T03=y 174CONFIG_LCD_L4F00242T03=y
172CONFIG_BACKLIGHT_CLASS_DEVICE=y 175CONFIG_BACKLIGHT_CLASS_DEVICE=y
176CONFIG_BACKLIGHT_PWM=y
173CONFIG_FRAMEBUFFER_CONSOLE=y 177CONFIG_FRAMEBUFFER_CONSOLE=y
174CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 178CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
175CONFIG_FONTS=y 179CONFIG_FONTS=y
@@ -182,6 +186,7 @@ CONFIG_SND_SOC=y
182CONFIG_SND_IMX_SOC=y 186CONFIG_SND_IMX_SOC=y
183CONFIG_SND_SOC_PHYCORE_AC97=y 187CONFIG_SND_SOC_PHYCORE_AC97=y
184CONFIG_SND_SOC_EUKREA_TLV320=y 188CONFIG_SND_SOC_EUKREA_TLV320=y
189CONFIG_SND_SOC_IMX_WM8962=y
185CONFIG_SND_SOC_IMX_SGTL5000=y 190CONFIG_SND_SOC_IMX_SGTL5000=y
186CONFIG_SND_SOC_IMX_MC13783=y 191CONFIG_SND_SOC_IMX_MC13783=y
187CONFIG_USB=y 192CONFIG_USB=y
@@ -208,10 +213,15 @@ CONFIG_IMX_SDMA=y
208CONFIG_MXS_DMA=y 213CONFIG_MXS_DMA=y
209CONFIG_STAGING=y 214CONFIG_STAGING=y
210CONFIG_DRM_IMX=y 215CONFIG_DRM_IMX=y
216CONFIG_DRM_IMX_TVE=y
217CONFIG_DRM_IMX_FB_HELPER=y
218CONFIG_DRM_IMX_PARALLEL_DISPLAY=y
211CONFIG_DRM_IMX_IPUV3_CORE=y 219CONFIG_DRM_IMX_IPUV3_CORE=y
212CONFIG_DRM_IMX_IPUV3=y 220CONFIG_DRM_IMX_IPUV3=y
213CONFIG_COMMON_CLK_DEBUG=y 221CONFIG_COMMON_CLK_DEBUG=y
214# CONFIG_IOMMU_SUPPORT is not set 222# CONFIG_IOMMU_SUPPORT is not set
223CONFIG_PWM=y
224CONFIG_PWM_IMX=y
215CONFIG_EXT2_FS=y 225CONFIG_EXT2_FS=y
216CONFIG_EXT2_FS_XATTR=y 226CONFIG_EXT2_FS_XATTR=y
217CONFIG_EXT2_FS_POSIX_ACL=y 227CONFIG_EXT2_FS_POSIX_ACL=y
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig
new file mode 100644
index 000000000000..62e968cac9dc
--- /dev/null
+++ b/arch/arm/configs/keystone_defconfig
@@ -0,0 +1,157 @@
1# CONFIG_SWAP is not set
2CONFIG_POSIX_MQUEUE=y
3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=14
7CONFIG_BLK_DEV_INITRD=y
8CONFIG_SYSCTL_SYSCALL=y
9CONFIG_KALLSYMS_ALL=y
10# CONFIG_ELF_CORE is not set
11# CONFIG_BASE_FULL is not set
12CONFIG_EMBEDDED=y
13CONFIG_PROFILING=y
14CONFIG_OPROFILE=y
15CONFIG_KPROBES=y
16CONFIG_MODULES=y
17CONFIG_MODULE_FORCE_LOAD=y
18CONFIG_MODULE_UNLOAD=y
19CONFIG_MODULE_FORCE_UNLOAD=y
20CONFIG_MODVERSIONS=y
21CONFIG_ARCH_KEYSTONE=y
22CONFIG_ARM_LPAE=y
23CONFIG_SMP=y
24CONFIG_PREEMPT=y
25CONFIG_AEABI=y
26CONFIG_HIGHMEM=y
27CONFIG_VFP=y
28CONFIG_NEON=y
29# CONFIG_SUSPEND is not set
30CONFIG_PM_RUNTIME=y
31CONFIG_NET=y
32CONFIG_PACKET=y
33CONFIG_UNIX=y
34CONFIG_UNIX_DIAG=y
35CONFIG_XFRM_USER=y
36CONFIG_XFRM_SUB_POLICY=y
37CONFIG_XFRM_STATISTICS=y
38CONFIG_NET_KEY=y
39CONFIG_NET_KEY_MIGRATE=y
40CONFIG_INET=y
41CONFIG_IP_MULTICAST=y
42CONFIG_IP_ADVANCED_ROUTER=y
43CONFIG_IP_MULTIPLE_TABLES=y
44CONFIG_IP_ROUTE_MULTIPATH=y
45CONFIG_IP_ROUTE_VERBOSE=y
46CONFIG_IP_PNP=y
47CONFIG_IP_PNP_DHCP=y
48CONFIG_IP_PNP_BOOTP=y
49CONFIG_NET_IPIP=y
50CONFIG_NET_IPGRE_DEMUX=y
51CONFIG_NET_IPGRE=y
52CONFIG_IP_MROUTE=y
53CONFIG_IP_MROUTE_MULTIPLE_TABLES=y
54CONFIG_IP_PIMSM_V2=y
55CONFIG_INET_AH=y
56CONFIG_INET_IPCOMP=y
57CONFIG_IPV6=y
58CONFIG_INET6_XFRM_MODE_TRANSPORT=m
59CONFIG_INET6_XFRM_MODE_TUNNEL=m
60CONFIG_INET6_XFRM_MODE_BEET=m
61CONFIG_IPV6_SIT=m
62CONFIG_IPV6_MULTIPLE_TABLES=y
63CONFIG_IPV6_SUBTREES=y
64CONFIG_IPV6_MROUTE=y
65CONFIG_IPV6_PIMSM_V2=y
66CONFIG_NETFILTER=y
67CONFIG_NF_CONNTRACK=y
68CONFIG_NF_CT_NETLINK=y
69CONFIG_NETFILTER_XT_TARGET_CLASSIFY=y
70CONFIG_NETFILTER_XT_TARGET_CONNMARK=y
71CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y
72CONFIG_NETFILTER_XT_TARGET_MARK=y
73CONFIG_NETFILTER_XT_MATCH_COMMENT=y
74CONFIG_NETFILTER_XT_MATCH_CONNBYTES=y
75CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=y
76CONFIG_NETFILTER_XT_MATCH_CONNMARK=y
77CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
78CONFIG_NETFILTER_XT_MATCH_CPU=y
79CONFIG_NETFILTER_XT_MATCH_IPRANGE=y
80CONFIG_NETFILTER_XT_MATCH_LENGTH=y
81CONFIG_NETFILTER_XT_MATCH_MAC=y
82CONFIG_NETFILTER_XT_MATCH_MARK=y
83CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
84CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y
85CONFIG_NETFILTER_XT_MATCH_STATE=y
86CONFIG_NF_CONNTRACK_IPV4=y
87CONFIG_IP_NF_IPTABLES=y
88CONFIG_IP_NF_MATCH_AH=y
89CONFIG_IP_NF_MATCH_ECN=y
90CONFIG_IP_NF_MATCH_TTL=y
91CONFIG_IP_NF_FILTER=y
92CONFIG_IP_NF_TARGET_REJECT=y
93CONFIG_IP_NF_TARGET_ULOG=y
94CONFIG_IP_NF_MANGLE=y
95CONFIG_IP_NF_TARGET_CLUSTERIP=y
96CONFIG_IP_NF_TARGET_ECN=y
97CONFIG_IP_NF_TARGET_TTL=y
98CONFIG_IP_NF_RAW=y
99CONFIG_IP_NF_ARPTABLES=y
100CONFIG_IP_NF_ARPFILTER=y
101CONFIG_IP_NF_ARP_MANGLE=y
102CONFIG_IP6_NF_IPTABLES=m
103CONFIG_IP_SCTP=y
104CONFIG_VLAN_8021Q=y
105CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
106CONFIG_CMA=y
107CONFIG_MTD=y
108CONFIG_MTD_CMDLINE_PARTS=y
109CONFIG_MTD_BLOCK=y
110CONFIG_MTD_PLATRAM=y
111CONFIG_MTD_M25P80=y
112CONFIG_MTD_NAND=y
113CONFIG_MTD_UBI=y
114CONFIG_PROC_DEVICETREE=y
115CONFIG_BLK_DEV_LOOP=y
116CONFIG_EEPROM_AT24=y
117CONFIG_NETDEVICES=y
118CONFIG_SERIAL_8250=y
119CONFIG_SERIAL_8250_CONSOLE=y
120CONFIG_SERIAL_OF_PLATFORM=y
121# CONFIG_HW_RANDOM is not set
122CONFIG_I2C=y
123# CONFIG_I2C_COMPAT is not set
124CONFIG_I2C_CHARDEV=y
125CONFIG_SPI=y
126CONFIG_SPI_SPIDEV=y
127# CONFIG_HWMON is not set
128CONFIG_WATCHDOG=y
129# CONFIG_USB_SUPPORT is not set
130CONFIG_DMADEVICES=y
131CONFIG_COMMON_CLK_DEBUG=y
132CONFIG_MEMORY=y
133CONFIG_TMPFS=y
134CONFIG_JFFS2_FS=y
135CONFIG_JFFS2_FS_WBUF_VERIFY=y
136CONFIG_UBIFS_FS=y
137CONFIG_CRAMFS=y
138CONFIG_NFS_FS=y
139CONFIG_NFS_V3_ACL=y
140CONFIG_ROOT_NFS=y
141CONFIG_NFSD=y
142CONFIG_NFSD_V3=y
143CONFIG_NFSD_V3_ACL=y
144CONFIG_PRINTK_TIME=y
145CONFIG_DEBUG_SHIRQ=y
146CONFIG_DEBUG_INFO=y
147CONFIG_DEBUG_USER=y
148CONFIG_CRYPTO_USER=y
149CONFIG_CRYPTO_NULL=y
150CONFIG_CRYPTO_AUTHENC=y
151CONFIG_CRYPTO_CBC=y
152CONFIG_CRYPTO_CTR=y
153CONFIG_CRYPTO_XCBC=y
154CONFIG_CRYPTO_DES=y
155CONFIG_CRYPTO_ANSI_CPRNG=y
156CONFIG_CRYPTO_USER_API_HASH=y
157CONFIG_CRYPTO_USER_API_SKCIPHER=y
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index a1d8252e9ec7..0f2aa61911a3 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_NO_HZ=y 2CONFIG_NO_HZ=y
4CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
@@ -31,6 +30,7 @@ CONFIG_MACH_T5325=y
31CONFIG_MACH_TS219=y 30CONFIG_MACH_TS219=y
32CONFIG_MACH_TS41X=y 31CONFIG_MACH_TS41X=y
33CONFIG_MACH_CLOUDBOX_DT=y 32CONFIG_MACH_CLOUDBOX_DT=y
33CONFIG_MACH_DB88F628X_BP_DT=y
34CONFIG_MACH_DLINK_KIRKWOOD_DT=y 34CONFIG_MACH_DLINK_KIRKWOOD_DT=y
35CONFIG_MACH_DOCKSTAR_DT=y 35CONFIG_MACH_DOCKSTAR_DT=y
36CONFIG_MACH_DREAMPLUG_DT=y 36CONFIG_MACH_DREAMPLUG_DT=y
@@ -50,14 +50,19 @@ CONFIG_MACH_NETSPACE_V2_DT=y
50CONFIG_MACH_NSA310_DT=y 50CONFIG_MACH_NSA310_DT=y
51CONFIG_MACH_OPENBLOCKS_A6_DT=y 51CONFIG_MACH_OPENBLOCKS_A6_DT=y
52CONFIG_MACH_READYNAS_DT=y 52CONFIG_MACH_READYNAS_DT=y
53CONFIG_MACH_SHEEVAPLUG_DT=y
53CONFIG_MACH_TOPKICK_DT=y 54CONFIG_MACH_TOPKICK_DT=y
54CONFIG_MACH_TS219_DT=y 55CONFIG_MACH_TS219_DT=y
55# CONFIG_CPU_FEROCEON_OLD_ID is not set 56# CONFIG_CPU_FEROCEON_OLD_ID is not set
57CONFIG_PCI_MVEBU=y
56CONFIG_PREEMPT=y 58CONFIG_PREEMPT=y
57CONFIG_AEABI=y 59CONFIG_AEABI=y
58# CONFIG_OABI_COMPAT is not set 60# CONFIG_OABI_COMPAT is not set
59CONFIG_ZBOOT_ROM_TEXT=0x0 61CONFIG_ZBOOT_ROM_TEXT=0x0
60CONFIG_ZBOOT_ROM_BSS=0x0 62CONFIG_ZBOOT_ROM_BSS=0x0
63CONFIG_CPU_FREQ=y
64CONFIG_CPU_FREQ_STAT_DETAILS=y
65CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
61CONFIG_CPU_IDLE=y 66CONFIG_CPU_IDLE=y
62CONFIG_NET=y 67CONFIG_NET=y
63CONFIG_PACKET=y 68CONFIG_PACKET=y
@@ -68,14 +73,12 @@ CONFIG_IP_PNP=y
68CONFIG_IP_PNP_DHCP=y 73CONFIG_IP_PNP_DHCP=y
69CONFIG_IP_PNP_BOOTP=y 74CONFIG_IP_PNP_BOOTP=y
70# CONFIG_IPV6 is not set 75# CONFIG_IPV6 is not set
71CONFIG_NET_DSA=y
72CONFIG_NET_PKTGEN=m 76CONFIG_NET_PKTGEN=m
73CONFIG_CFG80211=y 77CONFIG_CFG80211=y
74CONFIG_MAC80211=y 78CONFIG_MAC80211=y
75CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 79CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
76CONFIG_MTD=y 80CONFIG_MTD=y
77CONFIG_MTD_CMDLINE_PARTS=y 81CONFIG_MTD_CMDLINE_PARTS=y
78CONFIG_MTD_CHAR=y
79CONFIG_MTD_BLOCK=y 82CONFIG_MTD_BLOCK=y
80CONFIG_MTD_CFI=y 83CONFIG_MTD_CFI=y
81CONFIG_MTD_JEDECPROBE=y 84CONFIG_MTD_JEDECPROBE=y
@@ -140,6 +143,7 @@ CONFIG_HID_TOPSEED=y
140CONFIG_HID_THRUSTMASTER=y 143CONFIG_HID_THRUSTMASTER=y
141CONFIG_HID_ZEROPLUS=y 144CONFIG_HID_ZEROPLUS=y
142CONFIG_USB=y 145CONFIG_USB=y
146CONFIG_USB_XHCI_HCD=y
143CONFIG_USB_EHCI_HCD=y 147CONFIG_USB_EHCI_HCD=y
144CONFIG_USB_EHCI_ROOT_HUB_TT=y 148CONFIG_USB_EHCI_ROOT_HUB_TT=y
145CONFIG_USB_PRINTER=m 149CONFIG_USB_PRINTER=m
diff --git a/arch/arm/configs/kzm9g_defconfig b/arch/arm/configs/kzm9g_defconfig
index f6e585b353a4..1ad028023a64 100644
--- a/arch/arm/configs/kzm9g_defconfig
+++ b/arch/arm/configs/kzm9g_defconfig
@@ -84,9 +84,12 @@ CONFIG_I2C_CHARDEV=y
84CONFIG_I2C_SH_MOBILE=y 84CONFIG_I2C_SH_MOBILE=y
85CONFIG_GPIO_PCF857X=y 85CONFIG_GPIO_PCF857X=y
86# CONFIG_HWMON is not set 86# CONFIG_HWMON is not set
87CONFIG_MFD_AS3711=y
87CONFIG_REGULATOR=y 88CONFIG_REGULATOR=y
89CONFIG_REGULATOR_AS3711=y
88CONFIG_FB=y 90CONFIG_FB=y
89CONFIG_FB_SH_MOBILE_LCDC=y 91CONFIG_FB_SH_MOBILE_LCDC=y
92CONFIG_BACKLIGHT_AS3711=y
90CONFIG_FRAMEBUFFER_CONSOLE=y 93CONFIG_FRAMEBUFFER_CONSOLE=y
91CONFIG_LOGO=y 94CONFIG_LOGO=y
92CONFIG_FB_SH_MOBILE_MERAM=y 95CONFIG_FB_SH_MOBILE_MERAM=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 2e67a272df70..340d550c12b0 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -1,6 +1,7 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_NO_HZ=y 2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y
4CONFIG_ARCH_MVEBU=y 5CONFIG_ARCH_MVEBU=y
5CONFIG_MACH_ARMADA_370=y 6CONFIG_MACH_ARMADA_370=y
6CONFIG_ARCH_SIRF=y 7CONFIG_ARCH_SIRF=y
@@ -31,10 +32,12 @@ CONFIG_SATA_HIGHBANK=y
31CONFIG_SATA_MV=y 32CONFIG_SATA_MV=y
32CONFIG_SATA_AHCI_PLATFORM=y 33CONFIG_SATA_AHCI_PLATFORM=y
33CONFIG_NETDEVICES=y 34CONFIG_NETDEVICES=y
35CONFIG_SUN4I_EMAC=y
34CONFIG_NET_CALXEDA_XGMAC=y 36CONFIG_NET_CALXEDA_XGMAC=y
35CONFIG_SMSC911X=y 37CONFIG_SMSC911X=y
36CONFIG_STMMAC_ETH=y 38CONFIG_STMMAC_ETH=y
37CONFIG_SERIO_AMBAKMI=y 39CONFIG_SERIO_AMBAKMI=y
40CONFIG_MDIO_SUN4I=y
38CONFIG_SERIAL_8250=y 41CONFIG_SERIAL_8250=y
39CONFIG_SERIAL_8250_CONSOLE=y 42CONFIG_SERIAL_8250_CONSOLE=y
40CONFIG_SERIAL_8250_DW=y 43CONFIG_SERIAL_8250_DW=y
@@ -46,6 +49,8 @@ CONFIG_SERIAL_SIRFSOC=y
46CONFIG_SERIAL_SIRFSOC_CONSOLE=y 49CONFIG_SERIAL_SIRFSOC_CONSOLE=y
47CONFIG_SERIAL_VT8500=y 50CONFIG_SERIAL_VT8500=y
48CONFIG_SERIAL_VT8500_CONSOLE=y 51CONFIG_SERIAL_VT8500_CONSOLE=y
52CONFIG_SERIAL_XILINX_PS_UART=y
53CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
49CONFIG_IPMI_HANDLER=y 54CONFIG_IPMI_HANDLER=y
50CONFIG_IPMI_SI=y 55CONFIG_IPMI_SI=y
51CONFIG_I2C=y 56CONFIG_I2C=y
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig
index f3e8ae001ff1..731814e2c189 100644
--- a/arch/arm/configs/mvebu_defconfig
+++ b/arch/arm/configs/mvebu_defconfig
@@ -13,6 +13,8 @@ CONFIG_MACH_ARMADA_370=y
13CONFIG_MACH_ARMADA_XP=y 13CONFIG_MACH_ARMADA_XP=y
14# CONFIG_CACHE_L2X0 is not set 14# CONFIG_CACHE_L2X0 is not set
15# CONFIG_SWP_EMULATE is not set 15# CONFIG_SWP_EMULATE is not set
16CONFIG_PCI=y
17CONFIG_PCI_MVEBU=y
16CONFIG_SMP=y 18CONFIG_SMP=y
17CONFIG_AEABI=y 19CONFIG_AEABI=y
18CONFIG_HIGHMEM=y 20CONFIG_HIGHMEM=y
@@ -60,6 +62,8 @@ CONFIG_USB_SUPPORT=y
60CONFIG_USB=y 62CONFIG_USB=y
61CONFIG_USB_EHCI_HCD=y 63CONFIG_USB_EHCI_HCD=y
62CONFIG_USB_EHCI_ROOT_HUB_TT=y 64CONFIG_USB_EHCI_ROOT_HUB_TT=y
65CONFIG_USB_STORAGE=y
66CONFIG_USB_XHCI_HCD=y
63CONFIG_MMC=y 67CONFIG_MMC=y
64CONFIG_MMC_MVSDIO=y 68CONFIG_MMC_MVSDIO=y
65CONFIG_NEW_LEDS=y 69CONFIG_NEW_LEDS=y
@@ -96,5 +100,3 @@ CONFIG_TIMER_STATS=y
96# CONFIG_DEBUG_BUGVERBOSE is not set 100# CONFIG_DEBUG_BUGVERBOSE is not set
97CONFIG_DEBUG_INFO=y 101CONFIG_DEBUG_INFO=y
98CONFIG_DEBUG_USER=y 102CONFIG_DEBUG_USER=y
99CONFIG_DEBUG_LL=y
100CONFIG_EARLY_PRINTK=y
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index b01e7632ed2e..35f8cf299fa2 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -81,6 +81,7 @@ CONFIG_PPP_SYNC_TTY=m
81# CONFIG_INPUT_MOUSEDEV is not set 81# CONFIG_INPUT_MOUSEDEV is not set
82CONFIG_INPUT_EVDEV=y 82CONFIG_INPUT_EVDEV=y
83# CONFIG_KEYBOARD_ATKBD is not set 83# CONFIG_KEYBOARD_ATKBD is not set
84CONFIG_KEYBOARD_GPIO=y
84# CONFIG_MOUSE_PS2 is not set 85# CONFIG_MOUSE_PS2 is not set
85# CONFIG_SERIO is not set 86# CONFIG_SERIO is not set
86# CONFIG_LEGACY_PTYS is not set 87# CONFIG_LEGACY_PTYS is not set
@@ -96,6 +97,11 @@ CONFIG_DEBUG_GPIO=y
96CONFIG_MMC=y 97CONFIG_MMC=y
97CONFIG_MMC_CLKGATE=y 98CONFIG_MMC_CLKGATE=y
98CONFIG_MMC_ARMMMCI=y 99CONFIG_MMC_ARMMMCI=y
100CONFIG_NEW_LEDS=y
101CONFIG_LEDS_CLASS=y
102CONFIG_LEDS_GPIO=y
103CONFIG_LEDS_TRIGGERS=y
104CONFIG_LEDS_TRIGGER_HEARTBEAT=y
99CONFIG_RTC_CLASS=y 105CONFIG_RTC_CLASS=y
100CONFIG_RTC_DRV_PL031=y 106CONFIG_RTC_DRV_PL031=y
101CONFIG_DMADEVICES=y 107CONFIG_DMADEVICES=y
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index 9940f7b4e438..d74edbad18fc 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -26,7 +26,8 @@ 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_OMAP_MBOX_FWK=y 29CONFIG_MAILBOX=y
30CONFIG_OMAP1_MBOX=y
30CONFIG_OMAP_32K_TIMER=y 31CONFIG_OMAP_32K_TIMER=y
31CONFIG_OMAP_DM_TIMER=y 32CONFIG_OMAP_DM_TIMER=y
32CONFIG_ARCH_OMAP730=y 33CONFIG_ARCH_OMAP730=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index abbe31937c65..2ac0ffb12f03 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -210,6 +210,8 @@ CONFIG_USB_WDM=y
210CONFIG_USB_STORAGE=y 210CONFIG_USB_STORAGE=y
211CONFIG_USB_LIBUSUAL=y 211CONFIG_USB_LIBUSUAL=y
212CONFIG_USB_TEST=y 212CONFIG_USB_TEST=y
213CONFIG_USB_PHY=y
214CONFIG_NOP_USB_XCEIV=y
213CONFIG_USB_GADGET=y 215CONFIG_USB_GADGET=y
214CONFIG_USB_GADGET_DEBUG=y 216CONFIG_USB_GADGET_DEBUG=y
215CONFIG_USB_GADGET_DEBUG_FILES=y 217CONFIG_USB_GADGET_DEBUG_FILES=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 4d0dc3c16063..f6e78f83c3c3 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -26,7 +26,9 @@ CONFIG_AEABI=y
26CONFIG_UACCESS_WITH_MEMCPY=y 26CONFIG_UACCESS_WITH_MEMCPY=y
27CONFIG_ZBOOT_ROM_TEXT=0x0 27CONFIG_ZBOOT_ROM_TEXT=0x0
28CONFIG_ZBOOT_ROM_BSS=0x0 28CONFIG_ZBOOT_ROM_BSS=0x0
29CONFIG_ARM_APPENDED_DTB=y
29CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw" 30CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x21100000,25165824 root=/dev/ram0 rw"
31CONFIG_KEXEC=y
30CONFIG_AUTO_ZRELADDR=y 32CONFIG_AUTO_ZRELADDR=y
31CONFIG_VFP=y 33CONFIG_VFP=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 34# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -39,6 +41,9 @@ CONFIG_UNIX=y
39CONFIG_INET=y 41CONFIG_INET=y
40CONFIG_IP_MULTICAST=y 42CONFIG_IP_MULTICAST=y
41CONFIG_IP_PNP=y 43CONFIG_IP_PNP=y
44CONFIG_IP_PNP_DHCP=y
45CONFIG_IP_PNP_BOOTP=y
46CONFIG_IP_PNP_RARP=y
42# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 47# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
43# CONFIG_INET_XFRM_MODE_TUNNEL is not set 48# CONFIG_INET_XFRM_MODE_TUNNEL is not set
44# CONFIG_INET_XFRM_MODE_BEET is not set 49# CONFIG_INET_XFRM_MODE_BEET is not set
@@ -68,6 +73,8 @@ CONFIG_MTD_M25P80=y
68CONFIG_MTD_NAND=y 73CONFIG_MTD_NAND=y
69CONFIG_MTD_NAND_ATMEL=y 74CONFIG_MTD_NAND_ATMEL=y
70CONFIG_MTD_UBI=y 75CONFIG_MTD_UBI=y
76CONFIG_MTD_UBI_GLUEBI=y
77CONFIG_PROC_DEVICETREE=y
71CONFIG_BLK_DEV_LOOP=y 78CONFIG_BLK_DEV_LOOP=y
72CONFIG_BLK_DEV_RAM=y 79CONFIG_BLK_DEV_RAM=y
73CONFIG_BLK_DEV_RAM_COUNT=4 80CONFIG_BLK_DEV_RAM_COUNT=4
@@ -95,7 +102,19 @@ CONFIG_MACB=y
95# CONFIG_NET_VENDOR_STMICRO is not set 102# CONFIG_NET_VENDOR_STMICRO is not set
96# CONFIG_NET_VENDOR_WIZNET is not set 103# CONFIG_NET_VENDOR_WIZNET is not set
97CONFIG_MICREL_PHY=y 104CONFIG_MICREL_PHY=y
98# CONFIG_WLAN is not set 105CONFIG_LIBERTAS_THINFIRM=m
106CONFIG_LIBERTAS_THINFIRM_USB=m
107CONFIG_RTL8187=m
108CONFIG_RT2X00=m
109CONFIG_RT2500USB=m
110CONFIG_RT73USB=m
111CONFIG_RT2800USB=m
112CONFIG_RT2800USB_RT53XX=y
113CONFIG_RT2800USB_RT55XX=y
114CONFIG_RT2800USB_UNKNOWN=y
115CONFIG_MWIFIEX=m
116CONFIG_MWIFIEX_SDIO=m
117CONFIG_MWIFIEX_USB=m
99# CONFIG_INPUT_MOUSEDEV is not set 118# CONFIG_INPUT_MOUSEDEV is not set
100CONFIG_INPUT_EVDEV=y 119CONFIG_INPUT_EVDEV=y
101# CONFIG_KEYBOARD_ATKBD is not set 120# CONFIG_KEYBOARD_ATKBD is not set
@@ -133,9 +152,13 @@ CONFIG_USB_EHCI_HCD=y
133CONFIG_USB_OHCI_HCD=y 152CONFIG_USB_OHCI_HCD=y
134CONFIG_USB_ACM=y 153CONFIG_USB_ACM=y
135CONFIG_USB_STORAGE=y 154CONFIG_USB_STORAGE=y
155CONFIG_USB_SERIAL=y
156CONFIG_USB_SERIAL_GENERIC=y
157CONFIG_USB_SERIAL_FTDI_SIO=y
158CONFIG_USB_SERIAL_PL2303=y
136CONFIG_USB_GADGET=y 159CONFIG_USB_GADGET=y
137CONFIG_USB_AT91=y 160CONFIG_USB_ATMEL_USBA=y
138CONFIG_USB_MASS_STORAGE=m 161CONFIG_USB_G_SERIAL=y
139CONFIG_MMC=y 162CONFIG_MMC=y
140# CONFIG_MMC_BLOCK_BOUNCE is not set 163# CONFIG_MMC_BLOCK_BOUNCE is not set
141CONFIG_MMC_ATMELMCI=y 164CONFIG_MMC_ATMELMCI=y
@@ -151,18 +174,18 @@ CONFIG_DMADEVICES=y
151# CONFIG_IOMMU_SUPPORT is not set 174# CONFIG_IOMMU_SUPPORT is not set
152CONFIG_IIO=y 175CONFIG_IIO=y
153CONFIG_AT91_ADC=y 176CONFIG_AT91_ADC=y
154CONFIG_EXT2_FS=y 177CONFIG_EXT4_FS=y
155CONFIG_FANOTIFY=y 178CONFIG_FANOTIFY=y
156CONFIG_VFAT_FS=y 179CONFIG_VFAT_FS=y
157CONFIG_TMPFS=y 180CONFIG_TMPFS=y
158CONFIG_JFFS2_FS=y
159CONFIG_JFFS2_SUMMARY=y
160CONFIG_UBIFS_FS=y 181CONFIG_UBIFS_FS=y
182CONFIG_UBIFS_FS_ADVANCED_COMPR=y
161CONFIG_NFS_FS=y 183CONFIG_NFS_FS=y
162CONFIG_ROOT_NFS=y 184CONFIG_ROOT_NFS=y
163CONFIG_NLS_CODEPAGE_437=y 185CONFIG_NLS_CODEPAGE_437=y
164CONFIG_NLS_CODEPAGE_850=y 186CONFIG_NLS_CODEPAGE_850=y
165CONFIG_NLS_ISO8859_1=y 187CONFIG_NLS_ISO8859_1=y
188CONFIG_NLS_UTF8=y
166CONFIG_STRIP_ASM_SYMS=y 189CONFIG_STRIP_ASM_SYMS=y
167CONFIG_DEBUG_FS=y 190CONFIG_DEBUG_FS=y
168# CONFIG_SCHED_DEBUG is not set 191# CONFIG_SCHED_DEBUG is not set
diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index f7ba316164d4..1effb43dab80 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -21,8 +21,8 @@ CONFIG_MODULE_FORCE_UNLOAD=y
21CONFIG_PARTITION_ADVANCED=y 21CONFIG_PARTITION_ADVANCED=y
22# CONFIG_IOSCHED_DEADLINE is not set 22# CONFIG_IOSCHED_DEADLINE is not set
23# CONFIG_IOSCHED_CFQ is not set 23# CONFIG_IOSCHED_CFQ is not set
24CONFIG_ARCH_TEGRA=y
25CONFIG_GPIO_PCA953X=y 24CONFIG_GPIO_PCA953X=y
25CONFIG_ARCH_TEGRA=y
26CONFIG_ARCH_TEGRA_2x_SOC=y 26CONFIG_ARCH_TEGRA_2x_SOC=y
27CONFIG_ARCH_TEGRA_3x_SOC=y 27CONFIG_ARCH_TEGRA_3x_SOC=y
28CONFIG_ARCH_TEGRA_114_SOC=y 28CONFIG_ARCH_TEGRA_114_SOC=y
@@ -36,7 +36,6 @@ CONFIG_HIGHMEM=y
36CONFIG_ZBOOT_ROM_TEXT=0x0 36CONFIG_ZBOOT_ROM_TEXT=0x0
37CONFIG_ZBOOT_ROM_BSS=0x0 37CONFIG_ZBOOT_ROM_BSS=0x0
38CONFIG_KEXEC=y 38CONFIG_KEXEC=y
39CONFIG_AUTO_ZRELADDR=y
40CONFIG_CPU_FREQ=y 39CONFIG_CPU_FREQ=y
41CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 40CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
42CONFIG_CPU_IDLE=y 41CONFIG_CPU_IDLE=y
@@ -81,7 +80,6 @@ CONFIG_DEVTMPFS_MOUNT=y
81# CONFIG_FIRMWARE_IN_KERNEL is not set 80# CONFIG_FIRMWARE_IN_KERNEL is not set
82CONFIG_CMA=y 81CONFIG_CMA=y
83CONFIG_MTD=y 82CONFIG_MTD=y
84CONFIG_MTD_CHAR=y
85CONFIG_MTD_M25P80=y 83CONFIG_MTD_M25P80=y
86CONFIG_PROC_DEVICETREE=y 84CONFIG_PROC_DEVICETREE=y
87CONFIG_BLK_DEV_LOOP=y 85CONFIG_BLK_DEV_LOOP=y
@@ -105,8 +103,8 @@ CONFIG_BRCMFMAC=m
105CONFIG_RT2X00=y 103CONFIG_RT2X00=y
106CONFIG_RT2800USB=m 104CONFIG_RT2800USB=m
107CONFIG_INPUT_EVDEV=y 105CONFIG_INPUT_EVDEV=y
108CONFIG_KEYBOARD_TEGRA=y
109CONFIG_KEYBOARD_GPIO=y 106CONFIG_KEYBOARD_GPIO=y
107CONFIG_KEYBOARD_TEGRA=y
110CONFIG_INPUT_MISC=y 108CONFIG_INPUT_MISC=y
111CONFIG_INPUT_MPU3050=y 109CONFIG_INPUT_MPU3050=y
112# CONFIG_LEGACY_PTYS is not set 110# CONFIG_LEGACY_PTYS is not set
@@ -121,6 +119,7 @@ CONFIG_I2C_MUX=y
121CONFIG_I2C_MUX_PINCTRL=y 119CONFIG_I2C_MUX_PINCTRL=y
122CONFIG_I2C_TEGRA=y 120CONFIG_I2C_TEGRA=y
123CONFIG_SPI=y 121CONFIG_SPI=y
122CONFIG_SPI_TEGRA114=y
124CONFIG_SPI_TEGRA20_SFLASH=y 123CONFIG_SPI_TEGRA20_SFLASH=y
125CONFIG_SPI_TEGRA20_SLINK=y 124CONFIG_SPI_TEGRA20_SLINK=y
126CONFIG_GPIO_PCA953X_IRQ=y 125CONFIG_GPIO_PCA953X_IRQ=y
@@ -129,14 +128,15 @@ CONFIG_GPIO_TPS6586X=y
129CONFIG_GPIO_TPS65910=y 128CONFIG_GPIO_TPS65910=y
130CONFIG_POWER_SUPPLY=y 129CONFIG_POWER_SUPPLY=y
131CONFIG_BATTERY_SBS=y 130CONFIG_BATTERY_SBS=y
131CONFIG_CHARGER_TPS65090=y
132CONFIG_POWER_RESET=y 132CONFIG_POWER_RESET=y
133CONFIG_POWER_RESET_GPIO=y 133CONFIG_POWER_RESET_GPIO=y
134CONFIG_SENSORS_LM90=y 134CONFIG_SENSORS_LM90=y
135CONFIG_MFD_TPS6586X=y
136CONFIG_MFD_TPS65910=y
137CONFIG_MFD_MAX8907=y 135CONFIG_MFD_MAX8907=y
138CONFIG_MFD_TPS65090=y
139CONFIG_MFD_PALMAS=y 136CONFIG_MFD_PALMAS=y
137CONFIG_MFD_TPS65090=y
138CONFIG_MFD_TPS6586X=y
139CONFIG_MFD_TPS65910=y
140CONFIG_REGULATOR=y 140CONFIG_REGULATOR=y
141CONFIG_REGULATOR_FIXED_VOLTAGE=y 141CONFIG_REGULATOR_FIXED_VOLTAGE=y
142CONFIG_REGULATOR_VIRTUAL_CONSUMER=y 142CONFIG_REGULATOR_VIRTUAL_CONSUMER=y
@@ -171,6 +171,7 @@ CONFIG_SND=y
171# CONFIG_SND_USB is not set 171# CONFIG_SND_USB is not set
172CONFIG_SND_SOC=y 172CONFIG_SND_SOC=y
173CONFIG_SND_SOC_TEGRA=y 173CONFIG_SND_SOC_TEGRA=y
174CONFIG_SND_SOC_TEGRA_RT5640=y
174CONFIG_SND_SOC_TEGRA_WM8753=y 175CONFIG_SND_SOC_TEGRA_WM8753=y
175CONFIG_SND_SOC_TEGRA_WM8903=y 176CONFIG_SND_SOC_TEGRA_WM8903=y
176CONFIG_SND_SOC_TEGRA_TRIMSLICE=y 177CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
@@ -190,7 +191,13 @@ CONFIG_NEW_LEDS=y
190CONFIG_LEDS_CLASS=y 191CONFIG_LEDS_CLASS=y
191CONFIG_LEDS_GPIO=y 192CONFIG_LEDS_GPIO=y
192CONFIG_LEDS_TRIGGERS=y 193CONFIG_LEDS_TRIGGERS=y
194CONFIG_LEDS_TRIGGER_TIMER=y
195CONFIG_LEDS_TRIGGER_ONESHOT=y
196CONFIG_LEDS_TRIGGER_HEARTBEAT=y
193CONFIG_LEDS_TRIGGER_GPIO=y 197CONFIG_LEDS_TRIGGER_GPIO=y
198CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
199CONFIG_LEDS_TRIGGER_TRANSIENT=y
200CONFIG_LEDS_TRIGGER_CAMERA=y
194CONFIG_RTC_CLASS=y 201CONFIG_RTC_CLASS=y
195CONFIG_RTC_DRV_MAX8907=y 202CONFIG_RTC_DRV_MAX8907=y
196CONFIG_RTC_DRV_PALMAS=y 203CONFIG_RTC_DRV_PALMAS=y
@@ -203,7 +210,6 @@ CONFIG_TEGRA20_APB_DMA=y
203CONFIG_STAGING=y 210CONFIG_STAGING=y
204CONFIG_SENSORS_ISL29018=y 211CONFIG_SENSORS_ISL29018=y
205CONFIG_SENSORS_ISL29028=y 212CONFIG_SENSORS_ISL29028=y
206CONFIG_AK8975=y
207CONFIG_MFD_NVEC=y 213CONFIG_MFD_NVEC=y
208CONFIG_KEYBOARD_NVEC=y 214CONFIG_KEYBOARD_NVEC=y
209CONFIG_SERIO_NVEC_PS2=y 215CONFIG_SERIO_NVEC_PS2=y
@@ -213,6 +219,7 @@ CONFIG_TEGRA_IOMMU_GART=y
213CONFIG_TEGRA_IOMMU_SMMU=y 219CONFIG_TEGRA_IOMMU_SMMU=y
214CONFIG_MEMORY=y 220CONFIG_MEMORY=y
215CONFIG_IIO=y 221CONFIG_IIO=y
222CONFIG_AK8975=y
216CONFIG_PWM=y 223CONFIG_PWM=y
217CONFIG_PWM_TEGRA=y 224CONFIG_PWM_TEGRA=y
218CONFIG_EXT2_FS=y 225CONFIG_EXT2_FS=y
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig
index 374000ec4e4e..fd81a1b99cce 100644
--- a/arch/arm/configs/u300_defconfig
+++ b/arch/arm/configs/u300_defconfig
@@ -1,7 +1,8 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y
5CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
6CONFIG_EXPERT=y 7CONFIG_EXPERT=y
7# CONFIG_AIO is not set 8# CONFIG_AIO is not set
@@ -11,12 +12,9 @@ CONFIG_MODULE_UNLOAD=y
11# CONFIG_LBDAF is not set 12# CONFIG_LBDAF is not set
12# CONFIG_BLK_DEV_BSG is not set 13# CONFIG_BLK_DEV_BSG is not set
13# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_ARCH_MULTI_V7 is not set
14CONFIG_ARCH_U300=y 16CONFIG_ARCH_U300=y
15CONFIG_MACH_U300=y
16CONFIG_MACH_U300_BS335=y
17CONFIG_MACH_U300_SPIDUMMY=y 17CONFIG_MACH_U300_SPIDUMMY=y
18CONFIG_NO_HZ=y
19CONFIG_HIGH_RES_TIMERS=y
20CONFIG_PREEMPT=y 18CONFIG_PREEMPT=y
21CONFIG_AEABI=y 19CONFIG_AEABI=y
22CONFIG_ZBOOT_ROM_TEXT=0x0 20CONFIG_ZBOOT_ROM_TEXT=0x0
@@ -44,14 +42,15 @@ CONFIG_I2C=y
44# CONFIG_HWMON is not set 42# CONFIG_HWMON is not set
45CONFIG_WATCHDOG=y 43CONFIG_WATCHDOG=y
46CONFIG_REGULATOR=y 44CONFIG_REGULATOR=y
45CONFIG_REGULATOR_FIXED_VOLTAGE=y
47CONFIG_FB=y 46CONFIG_FB=y
48CONFIG_BACKLIGHT_LCD_SUPPORT=y 47CONFIG_BACKLIGHT_LCD_SUPPORT=y
49# CONFIG_LCD_CLASS_DEVICE is not set 48# CONFIG_LCD_CLASS_DEVICE is not set
50CONFIG_BACKLIGHT_CLASS_DEVICE=y 49CONFIG_BACKLIGHT_CLASS_DEVICE=y
51# CONFIG_HID_SUPPORT is not set
52# CONFIG_USB_SUPPORT is not set 50# CONFIG_USB_SUPPORT is not set
53CONFIG_MMC=y 51CONFIG_MMC=y
54CONFIG_MMC_CLKGATE=y 52CONFIG_MMC_UNSAFE_RESUME=y
53# CONFIG_MMC_BLOCK_BOUNCE is not set
55CONFIG_MMC_ARMMMCI=y 54CONFIG_MMC_ARMMMCI=y
56CONFIG_RTC_CLASS=y 55CONFIG_RTC_CLASS=y
57# CONFIG_RTC_HCTOSYS is not set 56# CONFIG_RTC_HCTOSYS is not set
@@ -70,4 +69,3 @@ CONFIG_DEBUG_FS=y
70CONFIG_TIMER_STATS=y 69CONFIG_TIMER_STATS=y
71# CONFIG_DEBUG_PREEMPT is not set 70# CONFIG_DEBUG_PREEMPT is not set
72CONFIG_DEBUG_INFO=y 71CONFIG_DEBUG_INFO=y
73# CONFIG_CRC32 is not set
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 7c1bfc0aea0c..accefe099182 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -80,15 +80,6 @@ static inline u32 arch_timer_get_cntfrq(void)
80 return val; 80 return val;
81} 81}
82 82
83static inline u64 arch_counter_get_cntpct(void)
84{
85 u64 cval;
86
87 isb();
88 asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
89 return cval;
90}
91
92static inline u64 arch_counter_get_cntvct(void) 83static inline u64 arch_counter_get_cntvct(void)
93{ 84{
94 u64 cval; 85 u64 cval;
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 05ee9eebad6b..a5fef710af32 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -136,7 +136,11 @@
136 * assumes FIQs are enabled, and that the processor is in SVC mode. 136 * assumes FIQs are enabled, and that the processor is in SVC mode.
137 */ 137 */
138 .macro save_and_disable_irqs, oldcpsr 138 .macro save_and_disable_irqs, oldcpsr
139#ifdef CONFIG_CPU_V7M
140 mrs \oldcpsr, primask
141#else
139 mrs \oldcpsr, cpsr 142 mrs \oldcpsr, cpsr
143#endif
140 disable_irq 144 disable_irq
141 .endm 145 .endm
142 146
@@ -150,7 +154,11 @@
150 * guarantee that this will preserve the flags. 154 * guarantee that this will preserve the flags.
151 */ 155 */
152 .macro restore_irqs_notrace, oldcpsr 156 .macro restore_irqs_notrace, oldcpsr
157#ifdef CONFIG_CPU_V7M
158 msr primask, \oldcpsr
159#else
153 msr cpsr_c, \oldcpsr 160 msr cpsr_c, \oldcpsr
161#endif
154 .endm 162 .endm
155 163
156 .macro restore_irqs, oldcpsr 164 .macro restore_irqs, oldcpsr
@@ -229,7 +237,14 @@
229#endif 237#endif
230 .endm 238 .endm
231 239
232#ifdef CONFIG_THUMB2_KERNEL 240#if defined(CONFIG_CPU_V7M)
241 /*
242 * setmode is used to assert to be in svc mode during boot. For v7-M
243 * this is done in __v7m_setup, so setmode can be empty here.
244 */
245 .macro setmode, mode, reg
246 .endm
247#elif defined(CONFIG_THUMB2_KERNEL)
233 .macro setmode, mode, reg 248 .macro setmode, mode, reg
234 mov \reg, #\mode 249 mov \reg, #\mode
235 msr cpsr_c, \reg 250 msr cpsr_c, \reg
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index bff71388e72a..17d0ae8672fa 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -320,9 +320,7 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
320} 320}
321 321
322#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE 322#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
323static inline void flush_kernel_dcache_page(struct page *page) 323extern void flush_kernel_dcache_page(struct page *);
324{
325}
326 324
327#define flush_dcache_mmap_lock(mapping) \ 325#define flush_dcache_mmap_lock(mapping) \
328 spin_lock_irq(&(mapping)->tree_lock) 326 spin_lock_irq(&(mapping)->tree_lock)
diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h
index 1f3262e99d81..6493802f880a 100644
--- a/arch/arm/include/asm/cp15.h
+++ b/arch/arm/include/asm/cp15.h
@@ -23,6 +23,11 @@
23#define CR_RR (1 << 14) /* Round Robin cache replacement */ 23#define CR_RR (1 << 14) /* Round Robin cache replacement */
24#define CR_L4 (1 << 15) /* LDR pc can set T bit */ 24#define CR_L4 (1 << 15) /* LDR pc can set T bit */
25#define CR_DT (1 << 16) 25#define CR_DT (1 << 16)
26#ifdef CONFIG_MMU
27#define CR_HA (1 << 17) /* Hardware management of Access Flag */
28#else
29#define CR_BR (1 << 17) /* MPU Background region enable (PMSA) */
30#endif
26#define CR_IT (1 << 18) 31#define CR_IT (1 << 18)
27#define CR_ST (1 << 19) 32#define CR_ST (1 << 19)
28#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */ 33#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
@@ -61,6 +66,20 @@ static inline void set_cr(unsigned int val)
61 isb(); 66 isb();
62} 67}
63 68
69static inline unsigned int get_auxcr(void)
70{
71 unsigned int val;
72 asm("mrc p15, 0, %0, c1, c0, 1 @ get AUXCR" : "=r" (val));
73 return val;
74}
75
76static inline void set_auxcr(unsigned int val)
77{
78 asm volatile("mcr p15, 0, %0, c1, c0, 1 @ set AUXCR"
79 : : "r" (val));
80 isb();
81}
82
64#ifndef CONFIG_SMP 83#ifndef CONFIG_SMP
65extern void adjust_cr(unsigned long mask, unsigned long set); 84extern void adjust_cr(unsigned long mask, unsigned long set);
66#endif 85#endif
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 7652712d1d14..8c25dc4e9851 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -8,8 +8,25 @@
8#define CPUID_CACHETYPE 1 8#define CPUID_CACHETYPE 1
9#define CPUID_TCM 2 9#define CPUID_TCM 2
10#define CPUID_TLBTYPE 3 10#define CPUID_TLBTYPE 3
11#define CPUID_MPUIR 4
11#define CPUID_MPIDR 5 12#define CPUID_MPIDR 5
12 13
14#ifdef CONFIG_CPU_V7M
15#define CPUID_EXT_PFR0 0x40
16#define CPUID_EXT_PFR1 0x44
17#define CPUID_EXT_DFR0 0x48
18#define CPUID_EXT_AFR0 0x4c
19#define CPUID_EXT_MMFR0 0x50
20#define CPUID_EXT_MMFR1 0x54
21#define CPUID_EXT_MMFR2 0x58
22#define CPUID_EXT_MMFR3 0x5c
23#define CPUID_EXT_ISAR0 0x60
24#define CPUID_EXT_ISAR1 0x64
25#define CPUID_EXT_ISAR2 0x68
26#define CPUID_EXT_ISAR3 0x6c
27#define CPUID_EXT_ISAR4 0x70
28#define CPUID_EXT_ISAR5 0x74
29#else
13#define CPUID_EXT_PFR0 "c1, 0" 30#define CPUID_EXT_PFR0 "c1, 0"
14#define CPUID_EXT_PFR1 "c1, 1" 31#define CPUID_EXT_PFR1 "c1, 1"
15#define CPUID_EXT_DFR0 "c1, 2" 32#define CPUID_EXT_DFR0 "c1, 2"
@@ -24,6 +41,7 @@
24#define CPUID_EXT_ISAR3 "c2, 3" 41#define CPUID_EXT_ISAR3 "c2, 3"
25#define CPUID_EXT_ISAR4 "c2, 4" 42#define CPUID_EXT_ISAR4 "c2, 4"
26#define CPUID_EXT_ISAR5 "c2, 5" 43#define CPUID_EXT_ISAR5 "c2, 5"
44#endif
27 45
28#define MPIDR_SMP_BITMASK (0x3 << 30) 46#define MPIDR_SMP_BITMASK (0x3 << 30)
29#define MPIDR_SMP_VALUE (0x2 << 30) 47#define MPIDR_SMP_VALUE (0x2 << 30)
@@ -32,6 +50,8 @@
32 50
33#define MPIDR_HWID_BITMASK 0xFFFFFF 51#define MPIDR_HWID_BITMASK 0xFFFFFF
34 52
53#define MPIDR_INVALID (~MPIDR_HWID_BITMASK)
54
35#define MPIDR_LEVEL_BITS 8 55#define MPIDR_LEVEL_BITS 8
36#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1) 56#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1)
37 57
@@ -79,7 +99,23 @@ extern unsigned int processor_id;
79 __val; \ 99 __val; \
80 }) 100 })
81 101
82#else /* ifdef CONFIG_CPU_CP15 */ 102#elif defined(CONFIG_CPU_V7M)
103
104#include <asm/io.h>
105#include <asm/v7m.h>
106
107#define read_cpuid(reg) \
108 ({ \
109 WARN_ON_ONCE(1); \
110 0; \
111 })
112
113static inline unsigned int __attribute_const__ read_cpuid_ext(unsigned offset)
114{
115 return readl(BASEADDR_V7M_SCB + offset);
116}
117
118#else /* ifdef CONFIG_CPU_CP15 / elif defined (CONFIG_CPU_V7M) */
83 119
84/* 120/*
85 * read_cpuid and read_cpuid_ext should only ever be called on machines that 121 * read_cpuid and read_cpuid_ext should only ever be called on machines that
@@ -106,7 +142,14 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)
106 return read_cpuid(CPUID_ID); 142 return read_cpuid(CPUID_ID);
107} 143}
108 144
109#else /* ifdef CONFIG_CPU_CP15 */ 145#elif defined(CONFIG_CPU_V7M)
146
147static inline unsigned int __attribute_const__ read_cpuid_id(void)
148{
149 return readl(BASEADDR_V7M_SCB + V7M_SCB_CPUID);
150}
151
152#else /* ifdef CONFIG_CPU_CP15 / elif defined(CONFIG_CPU_V7M) */
110 153
111static inline unsigned int __attribute_const__ read_cpuid_id(void) 154static inline unsigned int __attribute_const__ read_cpuid_id(void)
112{ 155{
diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
index fe92ccf1d0b0..191ada6e4d2d 100644
--- a/arch/arm/include/asm/div64.h
+++ b/arch/arm/include/asm/div64.h
@@ -46,7 +46,7 @@
46 __rem; \ 46 __rem; \
47}) 47})
48 48
49#if __GNUC__ < 4 49#if __GNUC__ < 4 || !defined(CONFIG_AEABI)
50 50
51/* 51/*
52 * gcc versions earlier than 4.0 are simply too problematic for the 52 * gcc versions earlier than 4.0 are simply too problematic for the
diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h
index ea289e1435e7..c81adc08b3fb 100644
--- a/arch/arm/include/asm/glue-cache.h
+++ b/arch/arm/include/asm/glue-cache.h
@@ -117,10 +117,37 @@
117# endif 117# endif
118#endif 118#endif
119 119
120#if defined(CONFIG_CPU_V7M)
121# ifdef _CACHE
122# define MULTI_CACHE 1
123# else
124# define _CACHE nop
125# endif
126#endif
127
120#if !defined(_CACHE) && !defined(MULTI_CACHE) 128#if !defined(_CACHE) && !defined(MULTI_CACHE)
121#error Unknown cache maintenance model 129#error Unknown cache maintenance model
122#endif 130#endif
123 131
132#ifndef __ASSEMBLER__
133extern inline void nop_flush_icache_all(void) { }
134extern inline void nop_flush_kern_cache_all(void) { }
135extern inline void nop_flush_kern_cache_louis(void) { }
136extern inline void nop_flush_user_cache_all(void) { }
137extern inline void nop_flush_user_cache_range(unsigned long a,
138 unsigned long b, unsigned int c) { }
139
140extern inline void nop_coherent_kern_range(unsigned long a, unsigned long b) { }
141extern inline int nop_coherent_user_range(unsigned long a,
142 unsigned long b) { return 0; }
143extern inline void nop_flush_kern_dcache_area(void *a, size_t s) { }
144
145extern inline void nop_dma_flush_range(const void *a, const void *b) { }
146
147extern inline void nop_dma_map_area(const void *s, size_t l, int f) { }
148extern inline void nop_dma_unmap_area(const void *s, size_t l, int f) { }
149#endif
150
124#ifndef MULTI_CACHE 151#ifndef MULTI_CACHE
125#define __cpuc_flush_icache_all __glue(_CACHE,_flush_icache_all) 152#define __cpuc_flush_icache_all __glue(_CACHE,_flush_icache_all)
126#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all) 153#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
diff --git a/arch/arm/include/asm/glue-df.h b/arch/arm/include/asm/glue-df.h
index b6e9f2c108b5..6b70f1b46a6e 100644
--- a/arch/arm/include/asm/glue-df.h
+++ b/arch/arm/include/asm/glue-df.h
@@ -95,6 +95,14 @@
95# endif 95# endif
96#endif 96#endif
97 97
98#ifdef CONFIG_CPU_ABRT_NOMMU
99# ifdef CPU_DABORT_HANDLER
100# define MULTI_DABORT 1
101# else
102# define CPU_DABORT_HANDLER nommu_early_abort
103# endif
104#endif
105
98#ifndef CPU_DABORT_HANDLER 106#ifndef CPU_DABORT_HANDLER
99#error Unknown data abort handler type 107#error Unknown data abort handler type
100#endif 108#endif
diff --git a/arch/arm/include/asm/glue-proc.h b/arch/arm/include/asm/glue-proc.h
index ac1dd54724b6..74a8b84f3cb1 100644
--- a/arch/arm/include/asm/glue-proc.h
+++ b/arch/arm/include/asm/glue-proc.h
@@ -230,6 +230,24 @@
230# endif 230# endif
231#endif 231#endif
232 232
233#ifdef CONFIG_CPU_V7M
234# ifdef CPU_NAME
235# undef MULTI_CPU
236# define MULTI_CPU
237# else
238# define CPU_NAME cpu_v7m
239# endif
240#endif
241
242#ifdef CONFIG_CPU_PJ4B
243# ifdef CPU_NAME
244# undef MULTI_CPU
245# define MULTI_CPU
246# else
247# define CPU_NAME cpu_pj4b
248# endif
249#endif
250
233#ifndef MULTI_CPU 251#ifndef MULTI_CPU
234#define cpu_proc_init __glue(CPU_NAME,_proc_init) 252#define cpu_proc_init __glue(CPU_NAME,_proc_init)
235#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/hardware/pci_v3.h b/arch/arm/include/asm/hardware/pci_v3.h
deleted file mode 100644
index 2811c7e2cfdf..000000000000
--- a/arch/arm/include/asm/hardware/pci_v3.h
+++ /dev/null
@@ -1,186 +0,0 @@
1/*
2 * arch/arm/include/asm/hardware/pci_v3.h
3 *
4 * Internal header file PCI V3 chip
5 *
6 * Copyright (C) ARM Limited
7 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23#ifndef ASM_ARM_HARDWARE_PCI_V3_H
24#define ASM_ARM_HARDWARE_PCI_V3_H
25
26/* -------------------------------------------------------------------------------
27 * V3 Local Bus to PCI Bridge definitions
28 * -------------------------------------------------------------------------------
29 * Registers (these are taken from page 129 of the EPC User's Manual Rev 1.04
30 * All V3 register names are prefaced by V3_ to avoid clashing with any other
31 * PCI definitions. Their names match the user's manual.
32 *
33 * I'm assuming that I20 is disabled.
34 *
35 */
36#define V3_PCI_VENDOR 0x00000000
37#define V3_PCI_DEVICE 0x00000002
38#define V3_PCI_CMD 0x00000004
39#define V3_PCI_STAT 0x00000006
40#define V3_PCI_CC_REV 0x00000008
41#define V3_PCI_HDR_CFG 0x0000000C
42#define V3_PCI_IO_BASE 0x00000010
43#define V3_PCI_BASE0 0x00000014
44#define V3_PCI_BASE1 0x00000018
45#define V3_PCI_SUB_VENDOR 0x0000002C
46#define V3_PCI_SUB_ID 0x0000002E
47#define V3_PCI_ROM 0x00000030
48#define V3_PCI_BPARAM 0x0000003C
49#define V3_PCI_MAP0 0x00000040
50#define V3_PCI_MAP1 0x00000044
51#define V3_PCI_INT_STAT 0x00000048
52#define V3_PCI_INT_CFG 0x0000004C
53#define V3_LB_BASE0 0x00000054
54#define V3_LB_BASE1 0x00000058
55#define V3_LB_MAP0 0x0000005E
56#define V3_LB_MAP1 0x00000062
57#define V3_LB_BASE2 0x00000064
58#define V3_LB_MAP2 0x00000066
59#define V3_LB_SIZE 0x00000068
60#define V3_LB_IO_BASE 0x0000006E
61#define V3_FIFO_CFG 0x00000070
62#define V3_FIFO_PRIORITY 0x00000072
63#define V3_FIFO_STAT 0x00000074
64#define V3_LB_ISTAT 0x00000076
65#define V3_LB_IMASK 0x00000077
66#define V3_SYSTEM 0x00000078
67#define V3_LB_CFG 0x0000007A
68#define V3_PCI_CFG 0x0000007C
69#define V3_DMA_PCI_ADR0 0x00000080
70#define V3_DMA_PCI_ADR1 0x00000090
71#define V3_DMA_LOCAL_ADR0 0x00000084
72#define V3_DMA_LOCAL_ADR1 0x00000094
73#define V3_DMA_LENGTH0 0x00000088
74#define V3_DMA_LENGTH1 0x00000098
75#define V3_DMA_CSR0 0x0000008B
76#define V3_DMA_CSR1 0x0000009B
77#define V3_DMA_CTLB_ADR0 0x0000008C
78#define V3_DMA_CTLB_ADR1 0x0000009C
79#define V3_DMA_DELAY 0x000000E0
80#define V3_MAIL_DATA 0x000000C0
81#define V3_PCI_MAIL_IEWR 0x000000D0
82#define V3_PCI_MAIL_IERD 0x000000D2
83#define V3_LB_MAIL_IEWR 0x000000D4
84#define V3_LB_MAIL_IERD 0x000000D6
85#define V3_MAIL_WR_STAT 0x000000D8
86#define V3_MAIL_RD_STAT 0x000000DA
87#define V3_QBA_MAP 0x000000DC
88
89/* PCI COMMAND REGISTER bits
90 */
91#define V3_COMMAND_M_FBB_EN (1 << 9)
92#define V3_COMMAND_M_SERR_EN (1 << 8)
93#define V3_COMMAND_M_PAR_EN (1 << 6)
94#define V3_COMMAND_M_MASTER_EN (1 << 2)
95#define V3_COMMAND_M_MEM_EN (1 << 1)
96#define V3_COMMAND_M_IO_EN (1 << 0)
97
98/* SYSTEM REGISTER bits
99 */
100#define V3_SYSTEM_M_RST_OUT (1 << 15)
101#define V3_SYSTEM_M_LOCK (1 << 14)
102
103/* PCI_CFG bits
104 */
105#define V3_PCI_CFG_M_I2O_EN (1 << 15)
106#define V3_PCI_CFG_M_IO_REG_DIS (1 << 14)
107#define V3_PCI_CFG_M_IO_DIS (1 << 13)
108#define V3_PCI_CFG_M_EN3V (1 << 12)
109#define V3_PCI_CFG_M_RETRY_EN (1 << 10)
110#define V3_PCI_CFG_M_AD_LOW1 (1 << 9)
111#define V3_PCI_CFG_M_AD_LOW0 (1 << 8)
112
113/* PCI_BASE register bits (PCI -> Local Bus)
114 */
115#define V3_PCI_BASE_M_ADR_BASE 0xFFF00000
116#define V3_PCI_BASE_M_ADR_BASEL 0x000FFF00
117#define V3_PCI_BASE_M_PREFETCH (1 << 3)
118#define V3_PCI_BASE_M_TYPE (3 << 1)
119#define V3_PCI_BASE_M_IO (1 << 0)
120
121/* PCI MAP register bits (PCI -> Local bus)
122 */
123#define V3_PCI_MAP_M_MAP_ADR 0xFFF00000
124#define V3_PCI_MAP_M_RD_POST_INH (1 << 15)
125#define V3_PCI_MAP_M_ROM_SIZE (3 << 10)
126#define V3_PCI_MAP_M_SWAP (3 << 8)
127#define V3_PCI_MAP_M_ADR_SIZE 0x000000F0
128#define V3_PCI_MAP_M_REG_EN (1 << 1)
129#define V3_PCI_MAP_M_ENABLE (1 << 0)
130
131/*
132 * LB_BASE0,1 register bits (Local bus -> PCI)
133 */
134#define V3_LB_BASE_ADR_BASE 0xfff00000
135#define V3_LB_BASE_SWAP (3 << 8)
136#define V3_LB_BASE_ADR_SIZE (15 << 4)
137#define V3_LB_BASE_PREFETCH (1 << 3)
138#define V3_LB_BASE_ENABLE (1 << 0)
139
140#define V3_LB_BASE_ADR_SIZE_1MB (0 << 4)
141#define V3_LB_BASE_ADR_SIZE_2MB (1 << 4)
142#define V3_LB_BASE_ADR_SIZE_4MB (2 << 4)
143#define V3_LB_BASE_ADR_SIZE_8MB (3 << 4)
144#define V3_LB_BASE_ADR_SIZE_16MB (4 << 4)
145#define V3_LB_BASE_ADR_SIZE_32MB (5 << 4)
146#define V3_LB_BASE_ADR_SIZE_64MB (6 << 4)
147#define V3_LB_BASE_ADR_SIZE_128MB (7 << 4)
148#define V3_LB_BASE_ADR_SIZE_256MB (8 << 4)
149#define V3_LB_BASE_ADR_SIZE_512MB (9 << 4)
150#define V3_LB_BASE_ADR_SIZE_1GB (10 << 4)
151#define V3_LB_BASE_ADR_SIZE_2GB (11 << 4)
152
153#define v3_addr_to_lb_base(a) ((a) & V3_LB_BASE_ADR_BASE)
154
155/*
156 * LB_MAP0,1 register bits (Local bus -> PCI)
157 */
158#define V3_LB_MAP_MAP_ADR 0xfff0
159#define V3_LB_MAP_TYPE (7 << 1)
160#define V3_LB_MAP_AD_LOW_EN (1 << 0)
161
162#define V3_LB_MAP_TYPE_IACK (0 << 1)
163#define V3_LB_MAP_TYPE_IO (1 << 1)
164#define V3_LB_MAP_TYPE_MEM (3 << 1)
165#define V3_LB_MAP_TYPE_CONFIG (5 << 1)
166#define V3_LB_MAP_TYPE_MEM_MULTIPLE (6 << 1)
167
168#define v3_addr_to_lb_map(a) (((a) >> 16) & V3_LB_MAP_MAP_ADR)
169
170/*
171 * LB_BASE2 register bits (Local bus -> PCI IO)
172 */
173#define V3_LB_BASE2_ADR_BASE 0xff00
174#define V3_LB_BASE2_SWAP (3 << 6)
175#define V3_LB_BASE2_ENABLE (1 << 0)
176
177#define v3_addr_to_lb_base2(a) (((a) >> 16) & V3_LB_BASE2_ADR_BASE)
178
179/*
180 * LB_MAP2 register bits (Local bus -> PCI IO)
181 */
182#define V3_LB_MAP2_MAP_ADR 0xff00
183
184#define v3_addr_to_lb_map2(a) (((a) >> 16) & V3_LB_MAP2_MAP_ADR)
185
186#endif
diff --git a/arch/arm/include/asm/hugetlb-3level.h b/arch/arm/include/asm/hugetlb-3level.h
new file mode 100644
index 000000000000..d4014fbe5ea3
--- /dev/null
+++ b/arch/arm/include/asm/hugetlb-3level.h
@@ -0,0 +1,71 @@
1/*
2 * arch/arm/include/asm/hugetlb-3level.h
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 *
6 * Based on arch/x86/include/asm/hugetlb.h.
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _ASM_ARM_HUGETLB_3LEVEL_H
23#define _ASM_ARM_HUGETLB_3LEVEL_H
24
25
26/*
27 * If our huge pte is non-zero then mark the valid bit.
28 * This allows pte_present(huge_ptep_get(ptep)) to return true for non-zero
29 * ptes.
30 * (The valid bit is automatically cleared by set_pte_at for PROT_NONE ptes).
31 */
32static inline pte_t huge_ptep_get(pte_t *ptep)
33{
34 pte_t retval = *ptep;
35 if (pte_val(retval))
36 pte_val(retval) |= L_PTE_VALID;
37 return retval;
38}
39
40static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
41 pte_t *ptep, pte_t pte)
42{
43 set_pte_at(mm, addr, ptep, pte);
44}
45
46static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
47 unsigned long addr, pte_t *ptep)
48{
49 ptep_clear_flush(vma, addr, ptep);
50}
51
52static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
53 unsigned long addr, pte_t *ptep)
54{
55 ptep_set_wrprotect(mm, addr, ptep);
56}
57
58static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
59 unsigned long addr, pte_t *ptep)
60{
61 return ptep_get_and_clear(mm, addr, ptep);
62}
63
64static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
65 unsigned long addr, pte_t *ptep,
66 pte_t pte, int dirty)
67{
68 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
69}
70
71#endif /* _ASM_ARM_HUGETLB_3LEVEL_H */
diff --git a/arch/arm/include/asm/hugetlb.h b/arch/arm/include/asm/hugetlb.h
new file mode 100644
index 000000000000..1f1b1cd112f3
--- /dev/null
+++ b/arch/arm/include/asm/hugetlb.h
@@ -0,0 +1,84 @@
1/*
2 * arch/arm/include/asm/hugetlb.h
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 *
6 * Based on arch/x86/include/asm/hugetlb.h
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _ASM_ARM_HUGETLB_H
23#define _ASM_ARM_HUGETLB_H
24
25#include <asm/page.h>
26#include <asm-generic/hugetlb.h>
27
28#include <asm/hugetlb-3level.h>
29
30static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
31 unsigned long addr, unsigned long end,
32 unsigned long floor,
33 unsigned long ceiling)
34{
35 free_pgd_range(tlb, addr, end, floor, ceiling);
36}
37
38
39static inline int is_hugepage_only_range(struct mm_struct *mm,
40 unsigned long addr, unsigned long len)
41{
42 return 0;
43}
44
45static inline int prepare_hugepage_range(struct file *file,
46 unsigned long addr, unsigned long len)
47{
48 struct hstate *h = hstate_file(file);
49 if (len & ~huge_page_mask(h))
50 return -EINVAL;
51 if (addr & ~huge_page_mask(h))
52 return -EINVAL;
53 return 0;
54}
55
56static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
57{
58}
59
60static inline int huge_pte_none(pte_t pte)
61{
62 return pte_none(pte);
63}
64
65static inline pte_t huge_pte_wrprotect(pte_t pte)
66{
67 return pte_wrprotect(pte);
68}
69
70static inline int arch_prepare_hugepage(struct page *page)
71{
72 return 0;
73}
74
75static inline void arch_release_hugepage(struct page *page)
76{
77}
78
79static inline void arch_clear_hugepage_flags(struct page *page)
80{
81 clear_bit(PG_dcache_clean, &page->flags);
82}
83
84#endif /* _ASM_ARM_HUGETLB_H */
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 652b56086de7..d070741b2b37 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -130,16 +130,16 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
130 */ 130 */
131extern void __iomem *__arm_ioremap_pfn_caller(unsigned long, unsigned long, 131extern void __iomem *__arm_ioremap_pfn_caller(unsigned long, unsigned long,
132 size_t, unsigned int, void *); 132 size_t, unsigned int, void *);
133extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int, 133extern void __iomem *__arm_ioremap_caller(phys_addr_t, size_t, unsigned int,
134 void *); 134 void *);
135 135
136extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int); 136extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
137extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); 137extern void __iomem *__arm_ioremap(phys_addr_t, size_t, unsigned int);
138extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached); 138extern void __iomem *__arm_ioremap_exec(phys_addr_t, size_t, bool cached);
139extern void __iounmap(volatile void __iomem *addr); 139extern void __iounmap(volatile void __iomem *addr);
140extern void __arm_iounmap(volatile void __iomem *addr); 140extern void __arm_iounmap(volatile void __iomem *addr);
141 141
142extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, 142extern void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
143 unsigned int, void *); 143 unsigned int, void *);
144extern void (*arch_iounmap)(volatile void __iomem *); 144extern void (*arch_iounmap)(volatile void __iomem *);
145 145
diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h
index 1e6cca55c750..3b763d6652a0 100644
--- a/arch/arm/include/asm/irqflags.h
+++ b/arch/arm/include/asm/irqflags.h
@@ -8,6 +8,16 @@
8/* 8/*
9 * CPU interrupt mask handling. 9 * CPU interrupt mask handling.
10 */ 10 */
11#ifdef CONFIG_CPU_V7M
12#define IRQMASK_REG_NAME_R "primask"
13#define IRQMASK_REG_NAME_W "primask"
14#define IRQMASK_I_BIT 1
15#else
16#define IRQMASK_REG_NAME_R "cpsr"
17#define IRQMASK_REG_NAME_W "cpsr_c"
18#define IRQMASK_I_BIT PSR_I_BIT
19#endif
20
11#if __LINUX_ARM_ARCH__ >= 6 21#if __LINUX_ARM_ARCH__ >= 6
12 22
13static inline unsigned long arch_local_irq_save(void) 23static inline unsigned long arch_local_irq_save(void)
@@ -15,7 +25,7 @@ static inline unsigned long arch_local_irq_save(void)
15 unsigned long flags; 25 unsigned long flags;
16 26
17 asm volatile( 27 asm volatile(
18 " mrs %0, cpsr @ arch_local_irq_save\n" 28 " mrs %0, " IRQMASK_REG_NAME_R " @ arch_local_irq_save\n"
19 " cpsid i" 29 " cpsid i"
20 : "=r" (flags) : : "memory", "cc"); 30 : "=r" (flags) : : "memory", "cc");
21 return flags; 31 return flags;
@@ -129,7 +139,7 @@ static inline unsigned long arch_local_save_flags(void)
129{ 139{
130 unsigned long flags; 140 unsigned long flags;
131 asm volatile( 141 asm volatile(
132 " mrs %0, cpsr @ local_save_flags" 142 " mrs %0, " IRQMASK_REG_NAME_R " @ local_save_flags"
133 : "=r" (flags) : : "memory", "cc"); 143 : "=r" (flags) : : "memory", "cc");
134 return flags; 144 return flags;
135} 145}
@@ -140,7 +150,7 @@ static inline unsigned long arch_local_save_flags(void)
140static inline void arch_local_irq_restore(unsigned long flags) 150static inline void arch_local_irq_restore(unsigned long flags)
141{ 151{
142 asm volatile( 152 asm volatile(
143 " msr cpsr_c, %0 @ local_irq_restore" 153 " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore"
144 : 154 :
145 : "r" (flags) 155 : "r" (flags)
146 : "memory", "cc"); 156 : "memory", "cc");
@@ -148,8 +158,8 @@ static inline void arch_local_irq_restore(unsigned long flags)
148 158
149static inline int arch_irqs_disabled_flags(unsigned long flags) 159static inline int arch_irqs_disabled_flags(unsigned long flags)
150{ 160{
151 return flags & PSR_I_BIT; 161 return flags & IRQMASK_I_BIT;
152} 162}
153 163
154#endif 164#endif /* ifdef __KERNEL__ */
155#endif 165#endif /* ifndef __ASM_ARM_IRQFLAGS_H */
diff --git a/arch/arm/include/asm/kvm_arch_timer.h b/arch/arm/include/asm/kvm_arch_timer.h
deleted file mode 100644
index 68cb9e1dfb81..000000000000
--- a/arch/arm/include/asm/kvm_arch_timer.h
+++ /dev/null
@@ -1,85 +0,0 @@
1/*
2 * Copyright (C) 2012 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, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARM_KVM_ARCH_TIMER_H
20#define __ASM_ARM_KVM_ARCH_TIMER_H
21
22#include <linux/clocksource.h>
23#include <linux/hrtimer.h>
24#include <linux/workqueue.h>
25
26struct arch_timer_kvm {
27#ifdef CONFIG_KVM_ARM_TIMER
28 /* Is the timer enabled */
29 bool enabled;
30
31 /* Virtual offset */
32 cycle_t cntvoff;
33#endif
34};
35
36struct arch_timer_cpu {
37#ifdef CONFIG_KVM_ARM_TIMER
38 /* Registers: control register, timer value */
39 u32 cntv_ctl; /* Saved/restored */
40 cycle_t cntv_cval; /* Saved/restored */
41
42 /*
43 * Anything that is not used directly from assembly code goes
44 * here.
45 */
46
47 /* Background timer used when the guest is not running */
48 struct hrtimer timer;
49
50 /* Work queued with the above timer expires */
51 struct work_struct expired;
52
53 /* Background timer active */
54 bool armed;
55
56 /* Timer IRQ */
57 const struct kvm_irq_level *irq;
58#endif
59};
60
61#ifdef CONFIG_KVM_ARM_TIMER
62int kvm_timer_hyp_init(void);
63int kvm_timer_init(struct kvm *kvm);
64void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
65void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu);
66void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu);
67void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
68#else
69static inline int kvm_timer_hyp_init(void)
70{
71 return 0;
72};
73
74static inline int kvm_timer_init(struct kvm *kvm)
75{
76 return 0;
77}
78
79static inline void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) {}
80static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {}
81static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {}
82static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {}
83#endif
84
85#endif
diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h
index 124623e5ef14..64e96960de29 100644
--- a/arch/arm/include/asm/kvm_arm.h
+++ b/arch/arm/include/asm/kvm_arm.h
@@ -135,7 +135,6 @@
135#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1ULL) 135#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1ULL)
136#define PTRS_PER_S2_PGD (1ULL << (KVM_PHYS_SHIFT - 30)) 136#define PTRS_PER_S2_PGD (1ULL << (KVM_PHYS_SHIFT - 30))
137#define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t)) 137#define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t))
138#define S2_PGD_SIZE (1 << S2_PGD_ORDER)
139 138
140/* Virtualization Translation Control Register (VTCR) bits */ 139/* Virtualization Translation Control Register (VTCR) bits */
141#define VTCR_SH0 (3 << 12) 140#define VTCR_SH0 (3 << 12)
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
index 18d50322a9e2..a2f43ddcc300 100644
--- a/arch/arm/include/asm/kvm_asm.h
+++ b/arch/arm/include/asm/kvm_asm.h
@@ -37,16 +37,18 @@
37#define c5_AIFSR 15 /* Auxilary Instrunction Fault Status R */ 37#define c5_AIFSR 15 /* Auxilary Instrunction Fault Status R */
38#define c6_DFAR 16 /* Data Fault Address Register */ 38#define c6_DFAR 16 /* Data Fault Address Register */
39#define c6_IFAR 17 /* Instruction Fault Address Register */ 39#define c6_IFAR 17 /* Instruction Fault Address Register */
40#define c9_L2CTLR 18 /* Cortex A15 L2 Control Register */ 40#define c7_PAR 18 /* Physical Address Register */
41#define c10_PRRR 19 /* Primary Region Remap Register */ 41#define c7_PAR_high 19 /* PAR top 32 bits */
42#define c10_NMRR 20 /* Normal Memory Remap Register */ 42#define c9_L2CTLR 20 /* Cortex A15 L2 Control Register */
43#define c12_VBAR 21 /* Vector Base Address Register */ 43#define c10_PRRR 21 /* Primary Region Remap Register */
44#define c13_CID 22 /* Context ID Register */ 44#define c10_NMRR 22 /* Normal Memory Remap Register */
45#define c13_TID_URW 23 /* Thread ID, User R/W */ 45#define c12_VBAR 23 /* Vector Base Address Register */
46#define c13_TID_URO 24 /* Thread ID, User R/O */ 46#define c13_CID 24 /* Context ID Register */
47#define c13_TID_PRIV 25 /* Thread ID, Privileged */ 47#define c13_TID_URW 25 /* Thread ID, User R/W */
48#define c14_CNTKCTL 26 /* Timer Control Register (PL1) */ 48#define c13_TID_URO 26 /* Thread ID, User R/O */
49#define NR_CP15_REGS 27 /* Number of regs (incl. invalid) */ 49#define c13_TID_PRIV 27 /* Thread ID, Privileged */
50#define c14_CNTKCTL 28 /* Timer Control Register (PL1) */
51#define NR_CP15_REGS 29 /* Number of regs (incl. invalid) */
50 52
51#define ARM_EXCEPTION_RESET 0 53#define ARM_EXCEPTION_RESET 0
52#define ARM_EXCEPTION_UNDEFINED 1 54#define ARM_EXCEPTION_UNDEFINED 1
@@ -72,8 +74,6 @@ extern char __kvm_hyp_vector[];
72extern char __kvm_hyp_code_start[]; 74extern char __kvm_hyp_code_start[];
73extern char __kvm_hyp_code_end[]; 75extern char __kvm_hyp_code_end[];
74 76
75extern void __kvm_tlb_flush_vmid(struct kvm *kvm);
76
77extern void __kvm_flush_vm_context(void); 77extern void __kvm_flush_vm_context(void);
78extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); 78extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
79 79
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index 82b4babead2c..a464e8d7b6c5 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -65,11 +65,6 @@ static inline bool vcpu_mode_priv(struct kvm_vcpu *vcpu)
65 return cpsr_mode > USR_MODE;; 65 return cpsr_mode > USR_MODE;;
66} 66}
67 67
68static inline bool kvm_vcpu_reg_is_pc(struct kvm_vcpu *vcpu, int reg)
69{
70 return reg == 15;
71}
72
73static inline u32 kvm_vcpu_get_hsr(struct kvm_vcpu *vcpu) 68static inline u32 kvm_vcpu_get_hsr(struct kvm_vcpu *vcpu)
74{ 69{
75 return vcpu->arch.fault.hsr; 70 return vcpu->arch.fault.hsr;
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 57cb786a6203..7d22517d8071 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -23,9 +23,14 @@
23#include <asm/kvm_asm.h> 23#include <asm/kvm_asm.h>
24#include <asm/kvm_mmio.h> 24#include <asm/kvm_mmio.h>
25#include <asm/fpstate.h> 25#include <asm/fpstate.h>
26#include <asm/kvm_arch_timer.h> 26#include <kvm/arm_arch_timer.h>
27 27
28#if defined(CONFIG_KVM_ARM_MAX_VCPUS)
28#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS 29#define KVM_MAX_VCPUS CONFIG_KVM_ARM_MAX_VCPUS
30#else
31#define KVM_MAX_VCPUS 0
32#endif
33
29#define KVM_USER_MEM_SLOTS 32 34#define KVM_USER_MEM_SLOTS 32
30#define KVM_PRIVATE_MEM_SLOTS 4 35#define KVM_PRIVATE_MEM_SLOTS 4
31#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 36#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
@@ -38,7 +43,7 @@
38#define KVM_NR_PAGE_SIZES 1 43#define KVM_NR_PAGE_SIZES 1
39#define KVM_PAGES_PER_HPAGE(x) (1UL<<31) 44#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
40 45
41#include <asm/kvm_vgic.h> 46#include <kvm/arm_vgic.h>
42 47
43struct kvm_vcpu; 48struct kvm_vcpu;
44u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode); 49u32 *kvm_vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num, u32 mode);
@@ -190,8 +195,8 @@ int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
190int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, 195int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
191 int exception_index); 196 int exception_index);
192 197
193static inline void __cpu_init_hyp_mode(unsigned long long boot_pgd_ptr, 198static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
194 unsigned long long pgd_ptr, 199 phys_addr_t pgd_ptr,
195 unsigned long hyp_stack_ptr, 200 unsigned long hyp_stack_ptr,
196 unsigned long vector_ptr) 201 unsigned long vector_ptr)
197{ 202{
diff --git a/arch/arm/include/asm/kvm_vgic.h b/arch/arm/include/asm/kvm_vgic.h
deleted file mode 100644
index 343744e4809c..000000000000
--- a/arch/arm/include/asm/kvm_vgic.h
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * Copyright (C) 2012 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, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __ASM_ARM_KVM_VGIC_H
20#define __ASM_ARM_KVM_VGIC_H
21
22#include <linux/kernel.h>
23#include <linux/kvm.h>
24#include <linux/irqreturn.h>
25#include <linux/spinlock.h>
26#include <linux/types.h>
27#include <linux/irqchip/arm-gic.h>
28
29#define VGIC_NR_IRQS 128
30#define VGIC_NR_SGIS 16
31#define VGIC_NR_PPIS 16
32#define VGIC_NR_PRIVATE_IRQS (VGIC_NR_SGIS + VGIC_NR_PPIS)
33#define VGIC_NR_SHARED_IRQS (VGIC_NR_IRQS - VGIC_NR_PRIVATE_IRQS)
34#define VGIC_MAX_CPUS KVM_MAX_VCPUS
35#define VGIC_MAX_LRS (1 << 6)
36
37/* Sanity checks... */
38#if (VGIC_MAX_CPUS > 8)
39#error Invalid number of CPU interfaces
40#endif
41
42#if (VGIC_NR_IRQS & 31)
43#error "VGIC_NR_IRQS must be a multiple of 32"
44#endif
45
46#if (VGIC_NR_IRQS > 1024)
47#error "VGIC_NR_IRQS must be <= 1024"
48#endif
49
50/*
51 * The GIC distributor registers describing interrupts have two parts:
52 * - 32 per-CPU interrupts (SGI + PPI)
53 * - a bunch of shared interrupts (SPI)
54 */
55struct vgic_bitmap {
56 union {
57 u32 reg[VGIC_NR_PRIVATE_IRQS / 32];
58 DECLARE_BITMAP(reg_ul, VGIC_NR_PRIVATE_IRQS);
59 } percpu[VGIC_MAX_CPUS];
60 union {
61 u32 reg[VGIC_NR_SHARED_IRQS / 32];
62 DECLARE_BITMAP(reg_ul, VGIC_NR_SHARED_IRQS);
63 } shared;
64};
65
66struct vgic_bytemap {
67 u32 percpu[VGIC_MAX_CPUS][VGIC_NR_PRIVATE_IRQS / 4];
68 u32 shared[VGIC_NR_SHARED_IRQS / 4];
69};
70
71struct vgic_dist {
72#ifdef CONFIG_KVM_ARM_VGIC
73 spinlock_t lock;
74 bool ready;
75
76 /* Virtual control interface mapping */
77 void __iomem *vctrl_base;
78
79 /* Distributor and vcpu interface mapping in the guest */
80 phys_addr_t vgic_dist_base;
81 phys_addr_t vgic_cpu_base;
82
83 /* Distributor enabled */
84 u32 enabled;
85
86 /* Interrupt enabled (one bit per IRQ) */
87 struct vgic_bitmap irq_enabled;
88
89 /* Interrupt 'pin' level */
90 struct vgic_bitmap irq_state;
91
92 /* Level-triggered interrupt in progress */
93 struct vgic_bitmap irq_active;
94
95 /* Interrupt priority. Not used yet. */
96 struct vgic_bytemap irq_priority;
97
98 /* Level/edge triggered */
99 struct vgic_bitmap irq_cfg;
100
101 /* Source CPU per SGI and target CPU */
102 u8 irq_sgi_sources[VGIC_MAX_CPUS][VGIC_NR_SGIS];
103
104 /* Target CPU for each IRQ */
105 u8 irq_spi_cpu[VGIC_NR_SHARED_IRQS];
106 struct vgic_bitmap irq_spi_target[VGIC_MAX_CPUS];
107
108 /* Bitmap indicating which CPU has something pending */
109 unsigned long irq_pending_on_cpu;
110#endif
111};
112
113struct vgic_cpu {
114#ifdef CONFIG_KVM_ARM_VGIC
115 /* per IRQ to LR mapping */
116 u8 vgic_irq_lr_map[VGIC_NR_IRQS];
117
118 /* Pending interrupts on this VCPU */
119 DECLARE_BITMAP( pending_percpu, VGIC_NR_PRIVATE_IRQS);
120 DECLARE_BITMAP( pending_shared, VGIC_NR_SHARED_IRQS);
121
122 /* Bitmap of used/free list registers */
123 DECLARE_BITMAP( lr_used, VGIC_MAX_LRS);
124
125 /* Number of list registers on this CPU */
126 int nr_lr;
127
128 /* CPU vif control registers for world switch */
129 u32 vgic_hcr;
130 u32 vgic_vmcr;
131 u32 vgic_misr; /* Saved only */
132 u32 vgic_eisr[2]; /* Saved only */
133 u32 vgic_elrsr[2]; /* Saved only */
134 u32 vgic_apr;
135 u32 vgic_lr[VGIC_MAX_LRS];
136#endif
137};
138
139#define LR_EMPTY 0xff
140
141struct kvm;
142struct kvm_vcpu;
143struct kvm_run;
144struct kvm_exit_mmio;
145
146#ifdef CONFIG_KVM_ARM_VGIC
147int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr);
148int kvm_vgic_hyp_init(void);
149int kvm_vgic_init(struct kvm *kvm);
150int kvm_vgic_create(struct kvm *kvm);
151int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu);
152void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu);
153void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu);
154int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
155 bool level);
156int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
157bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
158 struct kvm_exit_mmio *mmio);
159
160#define irqchip_in_kernel(k) (!!((k)->arch.vgic.vctrl_base))
161#define vgic_initialized(k) ((k)->arch.vgic.ready)
162
163#else
164static inline int kvm_vgic_hyp_init(void)
165{
166 return 0;
167}
168
169static inline int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr)
170{
171 return 0;
172}
173
174static inline int kvm_vgic_init(struct kvm *kvm)
175{
176 return 0;
177}
178
179static inline int kvm_vgic_create(struct kvm *kvm)
180{
181 return 0;
182}
183
184static inline int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
185{
186 return 0;
187}
188
189static inline void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) {}
190static inline void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) {}
191
192static inline int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid,
193 unsigned int irq_num, bool level)
194{
195 return 0;
196}
197
198static inline int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
199{
200 return 0;
201}
202
203static inline bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
204 struct kvm_exit_mmio *mmio)
205{
206 return false;
207}
208
209static inline int irqchip_in_kernel(struct kvm *kvm)
210{
211 return 0;
212}
213
214static inline bool vgic_initialized(struct kvm *kvm)
215{
216 return true;
217}
218#endif
219
220#endif
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 308ad7d6f98b..75bf07910b81 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -8,6 +8,8 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/types.h>
12
11#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
12 14
13struct tag; 15struct tag;
@@ -16,8 +18,10 @@ struct pt_regs;
16struct smp_operations; 18struct smp_operations;
17#ifdef CONFIG_SMP 19#ifdef CONFIG_SMP
18#define smp_ops(ops) (&(ops)) 20#define smp_ops(ops) (&(ops))
21#define smp_init_ops(ops) (&(ops))
19#else 22#else
20#define smp_ops(ops) (struct smp_operations *)NULL 23#define smp_ops(ops) (struct smp_operations *)NULL
24#define smp_init_ops(ops) (bool (*)(void))NULL
21#endif 25#endif
22 26
23struct machine_desc { 27struct machine_desc {
@@ -41,6 +45,7 @@ struct machine_desc {
41 unsigned char reserve_lp2 :1; /* never has lp2 */ 45 unsigned char reserve_lp2 :1; /* never has lp2 */
42 char restart_mode; /* default restart mode */ 46 char restart_mode; /* default restart mode */
43 struct smp_operations *smp; /* SMP operations */ 47 struct smp_operations *smp; /* SMP operations */
48 bool (*smp_init)(void);
44 void (*fixup)(struct tag *, char **, 49 void (*fixup)(struct tag *, char **,
45 struct meminfo *); 50 struct meminfo *);
46 void (*reserve)(void);/* reserve mem blocks */ 51 void (*reserve)(void);/* reserve mem blocks */
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 7d2c3c843801..a1c90d7feb0e 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -16,6 +16,7 @@
16struct pci_sys_data; 16struct pci_sys_data;
17struct pci_ops; 17struct pci_ops;
18struct pci_bus; 18struct pci_bus;
19struct device;
19 20
20struct hw_pci { 21struct hw_pci {
21#ifdef CONFIG_PCI_DOMAINS 22#ifdef CONFIG_PCI_DOMAINS
@@ -68,7 +69,16 @@ struct pci_sys_data {
68/* 69/*
69 * Call this with your hw_pci struct to initialise the PCI system. 70 * Call this with your hw_pci struct to initialise the PCI system.
70 */ 71 */
71void pci_common_init(struct hw_pci *); 72void pci_common_init_dev(struct device *, struct hw_pci *);
73
74/*
75 * Compatibility wrapper for older platforms that do not care about
76 * passing the parent device.
77 */
78static inline void pci_common_init(struct hw_pci *hw)
79{
80 pci_common_init_dev(NULL, hw);
81}
72 82
73/* 83/*
74 * Setup early fixed I/O mapping. 84 * Setup early fixed I/O mapping.
@@ -96,9 +106,4 @@ extern struct pci_ops via82c505_ops;
96extern int via82c505_setup(int nr, struct pci_sys_data *); 106extern int via82c505_setup(int nr, struct pci_sys_data *);
97extern void via82c505_init(void *sysdata); 107extern void via82c505_init(void *sysdata);
98 108
99extern struct pci_ops pci_v3_ops;
100extern int pci_v3_setup(int nr, struct pci_sys_data *);
101extern void pci_v3_preinit(void);
102extern void pci_v3_postinit(void);
103
104#endif /* __ASM_MACH_PCI_H */ 109#endif /* __ASM_MACH_PCI_H */
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 57870ab313c5..e750a938fd3c 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -18,6 +18,8 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/sizes.h> 19#include <linux/sizes.h>
20 20
21#include <asm/cache.h>
22
21#ifdef CONFIG_NEED_MACH_MEMORY_H 23#ifdef CONFIG_NEED_MACH_MEMORY_H
22#include <mach/memory.h> 24#include <mach/memory.h>
23#endif 25#endif
@@ -141,6 +143,20 @@
141#define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page))) 143#define page_to_phys(page) (__pfn_to_phys(page_to_pfn(page)))
142#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys))) 144#define phys_to_page(phys) (pfn_to_page(__phys_to_pfn(phys)))
143 145
146/*
147 * Minimum guaranted alignment in pgd_alloc(). The page table pointers passed
148 * around in head.S and proc-*.S are shifted by this amount, in order to
149 * leave spare high bits for systems with physical address extension. This
150 * does not fully accomodate the 40-bit addressing capability of ARM LPAE, but
151 * gives us about 38-bits or so.
152 */
153#ifdef CONFIG_ARM_LPAE
154#define ARCH_PGD_SHIFT L1_CACHE_SHIFT
155#else
156#define ARCH_PGD_SHIFT 0
157#endif
158#define ARCH_PGD_MASK ((1 << ARCH_PGD_SHIFT) - 1)
159
144#ifndef __ASSEMBLY__ 160#ifndef __ASSEMBLY__
145 161
146/* 162/*
@@ -207,7 +223,7 @@ static inline unsigned long __phys_to_virt(unsigned long x)
207 * direct-mapped view. We assume this is the first page 223 * direct-mapped view. We assume this is the first page
208 * of RAM in the mem_map as well. 224 * of RAM in the mem_map as well.
209 */ 225 */
210#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT) 226#define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT))
211 227
212/* 228/*
213 * These are *only* valid on the kernel direct mapped RAM memory. 229 * These are *only* valid on the kernel direct mapped RAM memory.
@@ -260,12 +276,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
260/* 276/*
261 * Conversion between a struct page and a physical address. 277 * Conversion between a struct page and a physical address.
262 * 278 *
263 * Note: when converting an unknown physical address to a
264 * struct page, the resulting pointer must be validated
265 * using VALID_PAGE(). It must return an invalid struct page
266 * for any physical address not corresponding to a system
267 * RAM address.
268 *
269 * page_to_pfn(page) convert a struct page * to a PFN number 279 * page_to_pfn(page) convert a struct page * to a PFN number
270 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * 280 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
271 * 281 *
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index a7b85e0d0cc1..b5792b7fd8d3 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -18,6 +18,7 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cachetype.h> 19#include <asm/cachetype.h>
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm/smp_plat.h>
21#include <asm-generic/mm_hooks.h> 22#include <asm-generic/mm_hooks.h>
22 23
23void __check_vmalloc_seq(struct mm_struct *mm); 24void __check_vmalloc_seq(struct mm_struct *mm);
@@ -27,7 +28,15 @@ void __check_vmalloc_seq(struct mm_struct *mm);
27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); 28void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
28#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) 29#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
29 30
30DECLARE_PER_CPU(atomic64_t, active_asids); 31#ifdef CONFIG_ARM_ERRATA_798181
32void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
33 cpumask_t *mask);
34#else /* !CONFIG_ARM_ERRATA_798181 */
35static inline void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
36 cpumask_t *mask)
37{
38}
39#endif /* CONFIG_ARM_ERRATA_798181 */
31 40
32#else /* !CONFIG_CPU_HAS_ASID */ 41#else /* !CONFIG_CPU_HAS_ASID */
33 42
@@ -98,12 +107,16 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
98#ifdef CONFIG_MMU 107#ifdef CONFIG_MMU
99 unsigned int cpu = smp_processor_id(); 108 unsigned int cpu = smp_processor_id();
100 109
101#ifdef CONFIG_SMP 110 /*
102 /* check for possible thread migration */ 111 * __sync_icache_dcache doesn't broadcast the I-cache invalidation,
103 if (!cpumask_empty(mm_cpumask(next)) && 112 * so check for possible thread migration and invalidate the I-cache
113 * if we're new to this CPU.
114 */
115 if (cache_ops_need_broadcast() &&
116 !cpumask_empty(mm_cpumask(next)) &&
104 !cpumask_test_cpu(cpu, mm_cpumask(next))) 117 !cpumask_test_cpu(cpu, mm_cpumask(next)))
105 __flush_icache_all(); 118 __flush_icache_all();
106#endif 119
107 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) { 120 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) {
108 check_and_switch_context(next, tsk); 121 check_and_switch_context(next, tsk);
109 if (cache_is_vivt()) 122 if (cache_is_vivt())
diff --git a/arch/arm/include/asm/mpu.h b/arch/arm/include/asm/mpu.h
new file mode 100644
index 000000000000..c3247cc2fe08
--- /dev/null
+++ b/arch/arm/include/asm/mpu.h
@@ -0,0 +1,76 @@
1#ifndef __ARM_MPU_H
2#define __ARM_MPU_H
3
4#ifdef CONFIG_ARM_MPU
5
6/* MPUIR layout */
7#define MPUIR_nU 1
8#define MPUIR_DREGION 8
9#define MPUIR_IREGION 16
10#define MPUIR_DREGION_SZMASK (0xFF << MPUIR_DREGION)
11#define MPUIR_IREGION_SZMASK (0xFF << MPUIR_IREGION)
12
13/* ID_MMFR0 data relevant to MPU */
14#define MMFR0_PMSA (0xF << 4)
15#define MMFR0_PMSAv7 (3 << 4)
16
17/* MPU D/I Size Register fields */
18#define MPU_RSR_SZ 1
19#define MPU_RSR_EN 0
20
21/* The D/I RSR value for an enabled region spanning the whole of memory */
22#define MPU_RSR_ALL_MEM 63
23
24/* Individual bits in the DR/IR ACR */
25#define MPU_ACR_XN (1 << 12)
26#define MPU_ACR_SHARED (1 << 2)
27
28/* C, B and TEX[2:0] bits only have semantic meanings when grouped */
29#define MPU_RGN_CACHEABLE 0xB
30#define MPU_RGN_SHARED_CACHEABLE (MPU_RGN_CACHEABLE | MPU_ACR_SHARED)
31#define MPU_RGN_STRONGLY_ORDERED 0
32
33/* Main region should only be shared for SMP */
34#ifdef CONFIG_SMP
35#define MPU_RGN_NORMAL (MPU_RGN_CACHEABLE | MPU_ACR_SHARED)
36#else
37#define MPU_RGN_NORMAL MPU_RGN_CACHEABLE
38#endif
39
40/* Access permission bits of ACR (only define those that we use)*/
41#define MPU_AP_PL1RW_PL0RW (0x3 << 8)
42#define MPU_AP_PL1RW_PL0R0 (0x2 << 8)
43#define MPU_AP_PL1RW_PL0NA (0x1 << 8)
44
45/* For minimal static MPU region configurations */
46#define MPU_PROBE_REGION 0
47#define MPU_BG_REGION 1
48#define MPU_RAM_REGION 2
49#define MPU_VECTORS_REGION 3
50
51/* Maximum number of regions Linux is interested in */
52#define MPU_MAX_REGIONS 16
53
54#define MPU_DATA_SIDE 0
55#define MPU_INSTR_SIDE 1
56
57#ifndef __ASSEMBLY__
58
59struct mpu_rgn {
60 /* Assume same attributes for d/i-side */
61 u32 drbar;
62 u32 drsr;
63 u32 dracr;
64};
65
66struct mpu_rgn_info {
67 u32 mpuir;
68 struct mpu_rgn rgns[MPU_MAX_REGIONS];
69};
70extern struct mpu_rgn_info mpu_rgn_info;
71
72#endif /* __ASSEMBLY__ */
73
74#endif /* CONFIG_ARM_MPU */
75
76#endif
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index 812a4944e783..6363f3d1d505 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -13,7 +13,7 @@
13/* PAGE_SHIFT determines the page size */ 13/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12 14#define PAGE_SHIFT 12
15#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 15#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1)) 16#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
17 17
18#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
19 19
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h
index 968c0a14e0a3..209e6504922e 100644
--- a/arch/arm/include/asm/percpu.h
+++ b/arch/arm/include/asm/percpu.h
@@ -30,8 +30,15 @@ static inline void set_my_cpu_offset(unsigned long off)
30static inline unsigned long __my_cpu_offset(void) 30static inline unsigned long __my_cpu_offset(void)
31{ 31{
32 unsigned long off; 32 unsigned long off;
33 /* Read TPIDRPRW */ 33 register unsigned long *sp asm ("sp");
34 asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : : "memory"); 34
35 /*
36 * Read TPIDRPRW.
37 * We want to allow caching the value, so avoid using volatile and
38 * instead use a fake stack read to hazard against barrier().
39 */
40 asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : "Q" (*sp));
41
35 return off; 42 return off;
36} 43}
37#define __my_cpu_offset __my_cpu_offset() 44#define __my_cpu_offset __my_cpu_offset()
diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h
index 18f5cef82ad5..626989fec4d3 100644
--- a/arch/arm/include/asm/pgtable-3level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-3level-hwdef.h
@@ -30,6 +30,7 @@
30#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0) 30#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0)
31#define PMD_TYPE_TABLE (_AT(pmdval_t, 3) << 0) 31#define PMD_TYPE_TABLE (_AT(pmdval_t, 3) << 0)
32#define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0) 32#define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0)
33#define PMD_TABLE_BIT (_AT(pmdval_t, 1) << 1)
33#define PMD_BIT4 (_AT(pmdval_t, 0)) 34#define PMD_BIT4 (_AT(pmdval_t, 0))
34#define PMD_DOMAIN(x) (_AT(pmdval_t, 0)) 35#define PMD_DOMAIN(x) (_AT(pmdval_t, 0))
35#define PMD_APTABLE_SHIFT (61) 36#define PMD_APTABLE_SHIFT (61)
@@ -41,6 +42,8 @@
41 */ 42 */
42#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2) 43#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
43#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] */
46#define PMD_SECT_RDONLY (_AT(pmdval_t, 1) << 7) /* AP[2] */
44#define PMD_SECT_S (_AT(pmdval_t, 3) << 8) 47#define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
45#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10) 48#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
46#define PMD_SECT_nG (_AT(pmdval_t, 1) << 11) 49#define PMD_SECT_nG (_AT(pmdval_t, 1) << 11)
@@ -66,6 +69,7 @@
66#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0) 69#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
67#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0) 70#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0)
68#define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0) 71#define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0)
72#define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1)
69#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */ 73#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2) /* AttrIndx[0] */
70#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3) /* AttrIndx[1] */ 74#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3) /* AttrIndx[1] */
71#define PTE_EXT_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 75#define PTE_EXT_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
@@ -79,4 +83,24 @@
79#define PHYS_MASK_SHIFT (40) 83#define PHYS_MASK_SHIFT (40)
80#define PHYS_MASK ((1ULL << PHYS_MASK_SHIFT) - 1) 84#define PHYS_MASK ((1ULL << PHYS_MASK_SHIFT) - 1)
81 85
86/*
87 * TTBR0/TTBR1 split (PAGE_OFFSET):
88 * 0x40000000: T0SZ = 2, T1SZ = 0 (not used)
89 * 0x80000000: T0SZ = 0, T1SZ = 1
90 * 0xc0000000: T0SZ = 0, T1SZ = 2
91 *
92 * Only use this feature if PHYS_OFFSET <= PAGE_OFFSET, otherwise
93 * booting secondary CPUs would end up using TTBR1 for the identity
94 * mapping set up in TTBR0.
95 */
96#if defined CONFIG_VMSPLIT_2G
97#define TTBR1_OFFSET 16 /* skip two L1 entries */
98#elif defined CONFIG_VMSPLIT_3G
99#define TTBR1_OFFSET (4096 * (1 + 3)) /* only L2, skip pgd + 3*pmd */
100#else
101#define TTBR1_OFFSET 0
102#endif
103
104#define TTBR1_SIZE (((PAGE_OFFSET >> 30) - 1) << 16)
105
82#endif 106#endif
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 86b8fe398b95..5689c18c85f5 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -33,7 +33,7 @@
33#define PTRS_PER_PMD 512 33#define PTRS_PER_PMD 512
34#define PTRS_PER_PGD 4 34#define PTRS_PER_PGD 4
35 35
36#define PTE_HWTABLE_PTRS (PTRS_PER_PTE) 36#define PTE_HWTABLE_PTRS (0)
37#define PTE_HWTABLE_OFF (0) 37#define PTE_HWTABLE_OFF (0)
38#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u64)) 38#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u64))
39 39
@@ -48,20 +48,28 @@
48#define PMD_SHIFT 21 48#define PMD_SHIFT 21
49 49
50#define PMD_SIZE (1UL << PMD_SHIFT) 50#define PMD_SIZE (1UL << PMD_SHIFT)
51#define PMD_MASK (~(PMD_SIZE-1)) 51#define PMD_MASK (~((1 << PMD_SHIFT) - 1))
52#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 52#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
53#define PGDIR_MASK (~(PGDIR_SIZE-1)) 53#define PGDIR_MASK (~((1 << PGDIR_SHIFT) - 1))
54 54
55/* 55/*
56 * section address mask and size definitions. 56 * section address mask and size definitions.
57 */ 57 */
58#define SECTION_SHIFT 21 58#define SECTION_SHIFT 21
59#define SECTION_SIZE (1UL << SECTION_SHIFT) 59#define SECTION_SIZE (1UL << SECTION_SHIFT)
60#define SECTION_MASK (~(SECTION_SIZE-1)) 60#define SECTION_MASK (~((1 << SECTION_SHIFT) - 1))
61 61
62#define USER_PTRS_PER_PGD (PAGE_OFFSET / PGDIR_SIZE) 62#define USER_PTRS_PER_PGD (PAGE_OFFSET / PGDIR_SIZE)
63 63
64/* 64/*
65 * Hugetlb definitions.
66 */
67#define HPAGE_SHIFT PMD_SHIFT
68#define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT)
69#define HPAGE_MASK (~(HPAGE_SIZE - 1))
70#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
71
72/*
65 * "Linux" PTE definitions for LPAE. 73 * "Linux" PTE definitions for LPAE.
66 * 74 *
67 * These bits overlap with the hardware bits but the naming is preserved for 75 * These bits overlap with the hardware bits but the naming is preserved for
@@ -79,6 +87,11 @@
79#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */ 87#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */
80#define L_PTE_NONE (_AT(pteval_t, 1) << 57) /* PROT_NONE */ 88#define L_PTE_NONE (_AT(pteval_t, 1) << 57) /* PROT_NONE */
81 89
90#define PMD_SECT_VALID (_AT(pmdval_t, 1) << 0)
91#define PMD_SECT_DIRTY (_AT(pmdval_t, 1) << 55)
92#define PMD_SECT_SPLITTING (_AT(pmdval_t, 1) << 56)
93#define PMD_SECT_NONE (_AT(pmdval_t, 1) << 57)
94
82/* 95/*
83 * To be used in assembly code with the upper page attributes. 96 * To be used in assembly code with the upper page attributes.
84 */ 97 */
@@ -166,8 +179,83 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
166 clean_pmd_entry(pmdp); \ 179 clean_pmd_entry(pmdp); \
167 } while (0) 180 } while (0)
168 181
182/*
183 * For 3 levels of paging the PTE_EXT_NG bit will be set for user address ptes
184 * that are written to a page table but not for ptes created with mk_pte.
185 *
186 * In hugetlb_no_page, a new huge pte (new_pte) is generated and passed to
187 * hugetlb_cow, where it is compared with an entry in a page table.
188 * This comparison test fails erroneously leading ultimately to a memory leak.
189 *
190 * To correct this behaviour, we mask off PTE_EXT_NG for any pte that is
191 * present before running the comparison.
192 */
193#define __HAVE_ARCH_PTE_SAME
194#define pte_same(pte_a,pte_b) ((pte_present(pte_a) ? pte_val(pte_a) & ~PTE_EXT_NG \
195 : pte_val(pte_a)) \
196 == (pte_present(pte_b) ? pte_val(pte_b) & ~PTE_EXT_NG \
197 : pte_val(pte_b)))
198
169#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,__pte(pte_val(pte)|(ext))) 199#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,__pte(pte_val(pte)|(ext)))
170 200
201#define pte_huge(pte) (pte_val(pte) && !(pte_val(pte) & PTE_TABLE_BIT))
202#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT))
203
204#define pmd_young(pmd) (pmd_val(pmd) & PMD_SECT_AF)
205
206#define __HAVE_ARCH_PMD_WRITE
207#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY))
208
209#ifdef CONFIG_TRANSPARENT_HUGEPAGE
210#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
211#define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING)
212#endif
213
214#define PMD_BIT_FUNC(fn,op) \
215static inline pmd_t pmd_##fn(pmd_t pmd) { pmd_val(pmd) op; return pmd; }
216
217PMD_BIT_FUNC(wrprotect, |= PMD_SECT_RDONLY);
218PMD_BIT_FUNC(mkold, &= ~PMD_SECT_AF);
219PMD_BIT_FUNC(mksplitting, |= PMD_SECT_SPLITTING);
220PMD_BIT_FUNC(mkwrite, &= ~PMD_SECT_RDONLY);
221PMD_BIT_FUNC(mkdirty, |= PMD_SECT_DIRTY);
222PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
223
224#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))
225
226#define pmd_pfn(pmd) (((pmd_val(pmd) & PMD_MASK) & PHYS_MASK) >> PAGE_SHIFT)
227#define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
228#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
229
230/* represent a notpresent pmd by zero, this is used by pmdp_invalidate */
231#define pmd_mknotpresent(pmd) (__pmd(0))
232
233static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
234{
235 const pmdval_t mask = PMD_SECT_USER | PMD_SECT_XN | PMD_SECT_RDONLY |
236 PMD_SECT_VALID | PMD_SECT_NONE;
237 pmd_val(pmd) = (pmd_val(pmd) & ~mask) | (pgprot_val(newprot) & mask);
238 return pmd;
239}
240
241static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
242 pmd_t *pmdp, pmd_t pmd)
243{
244 BUG_ON(addr >= TASK_SIZE);
245
246 /* create a faulting entry if PROT_NONE protected */
247 if (pmd_val(pmd) & PMD_SECT_NONE)
248 pmd_val(pmd) &= ~PMD_SECT_VALID;
249
250 *pmdp = __pmd(pmd_val(pmd) | PMD_SECT_nG);
251 flush_pmd_entry(pmdp);
252}
253
254static inline int has_transparent_hugepage(void)
255{
256 return 1;
257}
258
171#endif /* __ASSEMBLY__ */ 259#endif /* __ASSEMBLY__ */
172 260
173#endif /* _ASM_PGTABLE_3LEVEL_H */ 261#endif /* _ASM_PGTABLE_3LEVEL_H */
diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h
index 7ec60d6075bf..0642228ff785 100644
--- a/arch/arm/include/asm/pgtable-nommu.h
+++ b/arch/arm/include/asm/pgtable-nommu.h
@@ -79,8 +79,6 @@ extern unsigned int kobjsize(const void *objp);
79 * No page table caches to initialise. 79 * No page table caches to initialise.
80 */ 80 */
81#define pgtable_cache_init() do { } while (0) 81#define pgtable_cache_init() do { } while (0)
82#define io_remap_pfn_range remap_pfn_range
83
84 82
85/* 83/*
86 * All 32bit addresses are effectively valid for vmalloc... 84 * All 32bit addresses are effectively valid for vmalloc...
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 9bcd262a9008..04aeb02d2e11 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -24,6 +24,9 @@
24#include <asm/memory.h> 24#include <asm/memory.h>
25#include <asm/pgtable-hwdef.h> 25#include <asm/pgtable-hwdef.h>
26 26
27
28#include <asm/tlbflush.h>
29
27#ifdef CONFIG_ARM_LPAE 30#ifdef CONFIG_ARM_LPAE
28#include <asm/pgtable-3level.h> 31#include <asm/pgtable-3level.h>
29#else 32#else
@@ -318,13 +321,6 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
318#define HAVE_ARCH_UNMAPPED_AREA 321#define HAVE_ARCH_UNMAPPED_AREA
319#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN 322#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
320 323
321/*
322 * remap a physical page `pfn' of size `size' with page protection `prot'
323 * into virtual address `from'
324 */
325#define io_remap_pfn_range(vma,from,pfn,size,prot) \
326 remap_pfn_range(vma, from, pfn, size, prot)
327
328#define pgtable_cache_init() do { } while (0) 324#define pgtable_cache_init() do { } while (0)
329 325
330#endif /* !__ASSEMBLY__ */ 326#endif /* !__ASSEMBLY__ */
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
index f3628fb3d2b3..5324c1112f3a 100644
--- a/arch/arm/include/asm/proc-fns.h
+++ b/arch/arm/include/asm/proc-fns.h
@@ -60,7 +60,7 @@ extern struct processor {
60 /* 60 /*
61 * Set the page table 61 * Set the page table
62 */ 62 */
63 void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm); 63 void (*switch_mm)(phys_addr_t pgd_phys, struct mm_struct *mm);
64 /* 64 /*
65 * Set a possibly extended PTE. Non-extended PTEs should 65 * Set a possibly extended PTE. Non-extended PTEs should
66 * ignore 'ext'. 66 * ignore 'ext'.
@@ -82,7 +82,7 @@ extern void cpu_proc_init(void);
82extern void cpu_proc_fin(void); 82extern void cpu_proc_fin(void);
83extern int cpu_do_idle(void); 83extern int cpu_do_idle(void);
84extern void cpu_dcache_clean_area(void *, int); 84extern void cpu_dcache_clean_area(void *, int);
85extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm); 85extern void cpu_do_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm);
86#ifdef CONFIG_ARM_LPAE 86#ifdef CONFIG_ARM_LPAE
87extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte); 87extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte);
88#else 88#else
@@ -116,13 +116,25 @@ extern void cpu_resume(void);
116#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm) 116#define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
117 117
118#ifdef CONFIG_ARM_LPAE 118#ifdef CONFIG_ARM_LPAE
119
120#define cpu_get_ttbr(nr) \
121 ({ \
122 u64 ttbr; \
123 __asm__("mrrc p15, " #nr ", %Q0, %R0, c2" \
124 : "=r" (ttbr)); \
125 ttbr; \
126 })
127
128#define cpu_set_ttbr(nr, val) \
129 do { \
130 u64 ttbr = val; \
131 __asm__("mcrr p15, " #nr ", %Q0, %R0, c2" \
132 : : "r" (ttbr)); \
133 } while (0)
134
119#define cpu_get_pgd() \ 135#define cpu_get_pgd() \
120 ({ \ 136 ({ \
121 unsigned long pg, pg2; \ 137 u64 pg = cpu_get_ttbr(0); \
122 __asm__("mrrc p15, 0, %0, %1, c2" \
123 : "=r" (pg), "=r" (pg2) \
124 : \
125 : "cc"); \
126 pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \ 138 pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \
127 (pgd_t *)phys_to_virt(pg); \ 139 (pgd_t *)phys_to_virt(pg); \
128 }) 140 })
@@ -137,6 +149,10 @@ extern void cpu_resume(void);
137 }) 149 })
138#endif 150#endif
139 151
152#else /*!CONFIG_MMU */
153
154#define cpu_switch_mm(pgd,mm) { }
155
140#endif 156#endif
141 157
142#endif /* __ASSEMBLY__ */ 158#endif /* __ASSEMBLY__ */
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index ce0dbe7c1625..c4ae171850f8 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -32,5 +32,14 @@ struct psci_operations {
32}; 32};
33 33
34extern struct psci_operations psci_ops; 34extern struct psci_operations psci_ops;
35extern struct smp_operations psci_smp_ops;
36
37#ifdef CONFIG_ARM_PSCI
38void psci_init(void);
39bool psci_smp_available(void);
40#else
41static inline void psci_init(void) { }
42static inline bool psci_smp_available(void) { return false; }
43#endif
35 44
36#endif /* __ASM_ARM_PSCI_H */ 45#endif /* __ASM_ARM_PSCI_H */
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 3d52ee1bfb31..04c99f36ff7f 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -45,6 +45,7 @@ struct pt_regs {
45 */ 45 */
46static inline int valid_user_regs(struct pt_regs *regs) 46static inline int valid_user_regs(struct pt_regs *regs)
47{ 47{
48#ifndef CONFIG_CPU_V7M
48 unsigned long mode = regs->ARM_cpsr & MODE_MASK; 49 unsigned long mode = regs->ARM_cpsr & MODE_MASK;
49 50
50 /* 51 /*
@@ -67,6 +68,9 @@ static inline int valid_user_regs(struct pt_regs *regs)
67 regs->ARM_cpsr |= USR_MODE; 68 regs->ARM_cpsr |= USR_MODE;
68 69
69 return 0; 70 return 0;
71#else /* ifndef CONFIG_CPU_V7M */
72 return 1;
73#endif
70} 74}
71 75
72static inline long regs_return_value(struct pt_regs *regs) 76static inline long regs_return_value(struct pt_regs *regs)
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index d3a22bebe6ce..a8cae71caceb 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -65,7 +65,10 @@ asmlinkage void secondary_start_kernel(void);
65 * Initial data for bringing up a secondary CPU. 65 * Initial data for bringing up a secondary CPU.
66 */ 66 */
67struct secondary_data { 67struct secondary_data {
68 unsigned long pgdir; 68 union {
69 unsigned long mpu_rgn_szr;
70 unsigned long pgdir;
71 };
69 unsigned long swapper_pg_dir; 72 unsigned long swapper_pg_dir;
70 void *stack; 73 void *stack;
71}; 74};
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index aaa61b6f50ff..6462a721ebd4 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -26,6 +26,9 @@ static inline bool is_smp(void)
26} 26}
27 27
28/* all SMP configurations have the extended CPUID registers */ 28/* all SMP configurations have the extended CPUID registers */
29#ifndef CONFIG_MMU
30#define tlb_ops_need_broadcast() 0
31#else
29static inline int tlb_ops_need_broadcast(void) 32static inline int tlb_ops_need_broadcast(void)
30{ 33{
31 if (!is_smp()) 34 if (!is_smp())
@@ -33,6 +36,7 @@ static inline int tlb_ops_need_broadcast(void)
33 36
34 return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2; 37 return ((read_cpuid_ext(CPUID_EXT_MMFR3) >> 12) & 0xf) < 2;
35} 38}
39#endif
36 40
37#if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7 41#if !defined(CONFIG_SMP) || __LINUX_ARM_ARCH__ >= 7
38#define cache_ops_need_broadcast() 0 42#define cache_ops_need_broadcast() 0
@@ -49,7 +53,7 @@ static inline int cache_ops_need_broadcast(void)
49/* 53/*
50 * Logical CPU mapping. 54 * Logical CPU mapping.
51 */ 55 */
52extern int __cpu_logical_map[]; 56extern u32 __cpu_logical_map[];
53#define cpu_logical_map(cpu) __cpu_logical_map[cpu] 57#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
54/* 58/*
55 * Retrieve logical cpu index corresponding to a given MPIDR[23:0] 59 * Retrieve logical cpu index corresponding to a given MPIDR[23:0]
@@ -66,4 +70,22 @@ static inline int get_logical_index(u32 mpidr)
66 return -EINVAL; 70 return -EINVAL;
67} 71}
68 72
73/*
74 * NOTE ! Assembly code relies on the following
75 * structure memory layout in order to carry out load
76 * multiple from its base address. For more
77 * information check arch/arm/kernel/sleep.S
78 */
79struct mpidr_hash {
80 u32 mask; /* used by sleep.S */
81 u32 shift_aff[3]; /* used by sleep.S */
82 u32 bits;
83};
84
85extern struct mpidr_hash mpidr_hash;
86
87static inline u32 mpidr_hash_size(void)
88{
89 return 1 << mpidr_hash.bits;
90}
69#endif 91#endif
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 6220e9fdf4c7..f8b8965666e9 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -97,19 +97,22 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
97 97
98static inline int arch_spin_trylock(arch_spinlock_t *lock) 98static inline int arch_spin_trylock(arch_spinlock_t *lock)
99{ 99{
100 unsigned long tmp; 100 unsigned long contended, res;
101 u32 slock; 101 u32 slock;
102 102
103 __asm__ __volatile__( 103 do {
104" ldrex %0, [%2]\n" 104 __asm__ __volatile__(
105" subs %1, %0, %0, ror #16\n" 105 " ldrex %0, [%3]\n"
106" addeq %0, %0, %3\n" 106 " mov %2, #0\n"
107" strexeq %1, %0, [%2]" 107 " subs %1, %0, %0, ror #16\n"
108 : "=&r" (slock), "=&r" (tmp) 108 " addeq %0, %0, %4\n"
109 : "r" (&lock->slock), "I" (1 << TICKET_SHIFT) 109 " strexeq %2, %0, [%3]"
110 : "cc"); 110 : "=&r" (slock), "=&r" (contended), "=r" (res)
111 111 : "r" (&lock->slock), "I" (1 << TICKET_SHIFT)
112 if (tmp == 0) { 112 : "cc");
113 } while (res);
114
115 if (!contended) {
113 smp_mb(); 116 smp_mb();
114 return 1; 117 return 1;
115 } else { 118 } else {
diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h
index 1c0a551ae375..cd20029bcd94 100644
--- a/arch/arm/include/asm/suspend.h
+++ b/arch/arm/include/asm/suspend.h
@@ -1,6 +1,11 @@
1#ifndef __ASM_ARM_SUSPEND_H 1#ifndef __ASM_ARM_SUSPEND_H
2#define __ASM_ARM_SUSPEND_H 2#define __ASM_ARM_SUSPEND_H
3 3
4struct sleep_save_sp {
5 u32 *save_ptr_stash;
6 u32 save_ptr_stash_phys;
7};
8
4extern void cpu_resume(void); 9extern void cpu_resume(void);
5extern int cpu_suspend(unsigned long, int (*)(unsigned long)); 10extern int cpu_suspend(unsigned long, int (*)(unsigned long));
6 11
diff --git a/arch/arm/include/asm/system_info.h b/arch/arm/include/asm/system_info.h
index dfd386d0c022..720ea0320a6d 100644
--- a/arch/arm/include/asm/system_info.h
+++ b/arch/arm/include/asm/system_info.h
@@ -11,6 +11,7 @@
11#define CPU_ARCH_ARMv5TEJ 7 11#define CPU_ARCH_ARMv5TEJ 7
12#define CPU_ARCH_ARMv6 8 12#define CPU_ARCH_ARMv6 8
13#define CPU_ARCH_ARMv7 9 13#define CPU_ARCH_ARMv7 9
14#define CPU_ARCH_ARMv7M 10
14 15
15#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
16 17
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 1995d1a84060..214d4158089a 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -58,7 +58,7 @@ struct thread_info {
58 struct cpu_context_save cpu_context; /* cpu context */ 58 struct cpu_context_save cpu_context; /* cpu context */
59 __u32 syscall; /* syscall number */ 59 __u32 syscall; /* syscall number */
60 __u8 used_cp[16]; /* thread used copro */ 60 __u8 used_cp[16]; /* thread used copro */
61 unsigned long tp_value; 61 unsigned long tp_value[2]; /* TLS registers */
62#ifdef CONFIG_CRUNCH 62#ifdef CONFIG_CRUNCH
63 struct crunch_state crunchstate; 63 struct crunch_state crunchstate;
64#endif 64#endif
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index bdf2b8458ec1..46e7cfb3e721 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -204,6 +204,12 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
204#endif 204#endif
205} 205}
206 206
207static inline void
208tlb_remove_pmd_tlb_entry(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
209{
210 tlb_add_flush(tlb, addr);
211}
212
207#define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr) 213#define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr)
208#define pmd_free_tlb(tlb, pmdp, addr) __pmd_free_tlb(tlb, pmdp, addr) 214#define pmd_free_tlb(tlb, pmdp, addr) __pmd_free_tlb(tlb, pmdp, addr)
209#define pud_free_tlb(tlb, pudp, addr) pud_free((tlb)->mm, pudp) 215#define pud_free_tlb(tlb, pudp, addr) pud_free((tlb)->mm, pudp)
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index a3625d141c1d..fdbb9e369745 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -535,8 +535,33 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
535} 535}
536#endif 536#endif
537 537
538#define update_mmu_cache_pmd(vma, address, pmd) do { } while (0)
539
538#endif 540#endif
539 541
540#endif /* CONFIG_MMU */ 542#elif defined(CONFIG_SMP) /* !CONFIG_MMU */
543
544#ifndef __ASSEMBLY__
545
546#include <linux/mm_types.h>
547
548static inline void local_flush_tlb_all(void) { }
549static inline void local_flush_tlb_mm(struct mm_struct *mm) { }
550static inline void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) { }
551static inline void local_flush_tlb_kernel_page(unsigned long kaddr) { }
552static inline void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end) { }
553static inline void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) { }
554static inline void local_flush_bp_all(void) { }
555
556extern void flush_tlb_all(void);
557extern void flush_tlb_mm(struct mm_struct *mm);
558extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr);
559extern void flush_tlb_kernel_page(unsigned long kaddr);
560extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
561extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
562extern void flush_bp_all(void);
563#endif /* __ASSEMBLY__ */
564
565#endif
541 566
542#endif 567#endif
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
index 73409e6c0251..83259b873333 100644
--- a/arch/arm/include/asm/tls.h
+++ b/arch/arm/include/asm/tls.h
@@ -2,27 +2,30 @@
2#define __ASMARM_TLS_H 2#define __ASMARM_TLS_H
3 3
4#ifdef __ASSEMBLY__ 4#ifdef __ASSEMBLY__
5 .macro set_tls_none, tp, tmp1, tmp2 5#include <asm/asm-offsets.h>
6 .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2
6 .endm 7 .endm
7 8
8 .macro set_tls_v6k, tp, tmp1, tmp2 9 .macro switch_tls_v6k, base, tp, tpuser, tmp1, tmp2
10 mrc p15, 0, \tmp2, c13, c0, 2 @ get the user r/w register
9 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register 11 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
10 mov \tmp1, #0 12 mcr p15, 0, \tpuser, c13, c0, 2 @ and the user r/w register
11 mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register 13 str \tmp2, [\base, #TI_TP_VALUE + 4] @ save it
12 .endm 14 .endm
13 15
14 .macro set_tls_v6, tp, tmp1, tmp2 16 .macro switch_tls_v6, base, tp, tpuser, tmp1, tmp2
15 ldr \tmp1, =elf_hwcap 17 ldr \tmp1, =elf_hwcap
16 ldr \tmp1, [\tmp1, #0] 18 ldr \tmp1, [\tmp1, #0]
17 mov \tmp2, #0xffff0fff 19 mov \tmp2, #0xffff0fff
18 tst \tmp1, #HWCAP_TLS @ hardware TLS available? 20 tst \tmp1, #HWCAP_TLS @ hardware TLS available?
19 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
20 movne \tmp1, #0
21 mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
22 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0 21 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
22 mrcne p15, 0, \tmp2, c13, c0, 2 @ get the user r/w register
23 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
24 mcrne p15, 0, \tpuser, c13, c0, 2 @ set user r/w register
25 strne \tmp2, [\base, #TI_TP_VALUE + 4] @ save it
23 .endm 26 .endm
24 27
25 .macro set_tls_software, tp, tmp1, tmp2 28 .macro switch_tls_software, base, tp, tpuser, tmp1, tmp2
26 mov \tmp1, #0xffff0fff 29 mov \tmp1, #0xffff0fff
27 str \tp, [\tmp1, #-15] @ set TLS value at 0xffff0ff0 30 str \tp, [\tmp1, #-15] @ set TLS value at 0xffff0ff0
28 .endm 31 .endm
@@ -31,19 +34,30 @@
31#ifdef CONFIG_TLS_REG_EMUL 34#ifdef CONFIG_TLS_REG_EMUL
32#define tls_emu 1 35#define tls_emu 1
33#define has_tls_reg 1 36#define has_tls_reg 1
34#define set_tls set_tls_none 37#define switch_tls switch_tls_none
35#elif defined(CONFIG_CPU_V6) 38#elif defined(CONFIG_CPU_V6)
36#define tls_emu 0 39#define tls_emu 0
37#define has_tls_reg (elf_hwcap & HWCAP_TLS) 40#define has_tls_reg (elf_hwcap & HWCAP_TLS)
38#define set_tls set_tls_v6 41#define switch_tls switch_tls_v6
39#elif defined(CONFIG_CPU_32v6K) 42#elif defined(CONFIG_CPU_32v6K)
40#define tls_emu 0 43#define tls_emu 0
41#define has_tls_reg 1 44#define has_tls_reg 1
42#define set_tls set_tls_v6k 45#define switch_tls switch_tls_v6k
43#else 46#else
44#define tls_emu 0 47#define tls_emu 0
45#define has_tls_reg 0 48#define has_tls_reg 0
46#define set_tls set_tls_software 49#define switch_tls switch_tls_software
47#endif 50#endif
48 51
52#ifndef __ASSEMBLY__
53static inline unsigned long get_tpuser(void)
54{
55 unsigned long reg = 0;
56
57 if (has_tls_reg && !tls_emu)
58 __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (reg));
59
60 return reg;
61}
62#endif
49#endif /* __ASMARM_TLS_H */ 63#endif /* __ASMARM_TLS_H */
diff --git a/arch/arm/include/asm/v7m.h b/arch/arm/include/asm/v7m.h
new file mode 100644
index 000000000000..fa88d09fa3d9
--- /dev/null
+++ b/arch/arm/include/asm/v7m.h
@@ -0,0 +1,44 @@
1/*
2 * Common defines for v7m cpus
3 */
4#define V7M_SCS_ICTR IOMEM(0xe000e004)
5#define V7M_SCS_ICTR_INTLINESNUM_MASK 0x0000000f
6
7#define BASEADDR_V7M_SCB IOMEM(0xe000ed00)
8
9#define V7M_SCB_CPUID 0x00
10
11#define V7M_SCB_ICSR 0x04
12#define V7M_SCB_ICSR_PENDSVSET (1 << 28)
13#define V7M_SCB_ICSR_PENDSVCLR (1 << 27)
14#define V7M_SCB_ICSR_RETTOBASE (1 << 11)
15
16#define V7M_SCB_VTOR 0x08
17
18#define V7M_SCB_SCR 0x10
19#define V7M_SCB_SCR_SLEEPDEEP (1 << 2)
20
21#define V7M_SCB_CCR 0x14
22#define V7M_SCB_CCR_STKALIGN (1 << 9)
23
24#define V7M_SCB_SHPR2 0x1c
25#define V7M_SCB_SHPR3 0x20
26
27#define V7M_SCB_SHCSR 0x24
28#define V7M_SCB_SHCSR_USGFAULTENA (1 << 18)
29#define V7M_SCB_SHCSR_BUSFAULTENA (1 << 17)
30#define V7M_SCB_SHCSR_MEMFAULTENA (1 << 16)
31
32#define V7M_xPSR_FRAMEPTRALIGN 0x00000200
33#define V7M_xPSR_EXCEPTIONNO 0x000001ff
34
35/*
36 * When branching to an address that has bits [31:28] == 0xf an exception return
37 * occurs. Bits [27:5] are reserved (SBOP). If the processor implements the FP
38 * extension Bit [4] defines if the exception frame has space allocated for FP
39 * state information, SBOP otherwise. Bit [3] defines the mode that is returned
40 * to (0 -> handler mode; 1 -> thread mode). Bit [2] defines which sp is used
41 * (0 -> msp; 1 -> psp). Bits [1:0] are fixed to 0b01.
42 */
43#define EXC_RET_STACK_MASK 0x00000004
44#define EXC_RET_THREADMODE_PROCESSSTACK 0xfffffffd
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 30cdacb675af..359a7b50b158 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_ARM_XEN_PAGE_H 1#ifndef _ASM_ARM_XEN_PAGE_H
2#define _ASM_ARM_XEN_PAGE_H 2#define _ASM_ARM_XEN_PAGE_H
3 3
4#include <asm/mach/map.h>
5#include <asm/page.h> 4#include <asm/page.h>
6#include <asm/pgtable.h> 5#include <asm/pgtable.h>
7 6
@@ -88,6 +87,6 @@ static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
88 return __set_phys_to_machine(pfn, mfn); 87 return __set_phys_to_machine(pfn, mfn);
89} 88}
90 89
91#define xen_remap(cookie, size) __arm_ioremap((cookie), (size), MT_MEMORY); 90#define xen_remap(cookie, size) ioremap_cached((cookie), (size));
92 91
93#endif /* _ASM_ARM_XEN_PAGE_H */ 92#endif /* _ASM_ARM_XEN_PAGE_H */
diff --git a/arch/arm/include/debug/imx-uart.h b/arch/arm/include/debug/imx-uart.h
index 91d38e38a0b4..29da84e183f4 100644
--- a/arch/arm/include/debug/imx-uart.h
+++ b/arch/arm/include/debug/imx-uart.h
@@ -65,6 +65,14 @@
65#define IMX6Q_UART_BASE_ADDR(n) IMX6Q_UART##n##_BASE_ADDR 65#define IMX6Q_UART_BASE_ADDR(n) IMX6Q_UART##n##_BASE_ADDR
66#define IMX6Q_UART_BASE(n) IMX6Q_UART_BASE_ADDR(n) 66#define IMX6Q_UART_BASE(n) IMX6Q_UART_BASE_ADDR(n)
67 67
68#define IMX6SL_UART1_BASE_ADDR 0x02020000
69#define IMX6SL_UART2_BASE_ADDR 0x02024000
70#define IMX6SL_UART3_BASE_ADDR 0x02034000
71#define IMX6SL_UART4_BASE_ADDR 0x02038000
72#define IMX6SL_UART5_BASE_ADDR 0x02018000
73#define IMX6SL_UART_BASE_ADDR(n) IMX6SL_UART##n##_BASE_ADDR
74#define IMX6SL_UART_BASE(n) IMX6SL_UART_BASE_ADDR(n)
75
68#define IMX_DEBUG_UART_BASE(soc) soc##_UART_BASE(CONFIG_DEBUG_IMX_UART_PORT) 76#define IMX_DEBUG_UART_BASE(soc) soc##_UART_BASE(CONFIG_DEBUG_IMX_UART_PORT)
69 77
70#ifdef CONFIG_DEBUG_IMX1_UART 78#ifdef CONFIG_DEBUG_IMX1_UART
@@ -83,6 +91,8 @@
83#define UART_PADDR IMX_DEBUG_UART_BASE(IMX53) 91#define UART_PADDR IMX_DEBUG_UART_BASE(IMX53)
84#elif defined(CONFIG_DEBUG_IMX6Q_UART) 92#elif defined(CONFIG_DEBUG_IMX6Q_UART)
85#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6Q) 93#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6Q)
94#elif defined(CONFIG_DEBUG_IMX6SL_UART)
95#define UART_PADDR IMX_DEBUG_UART_BASE(IMX6SL)
86#endif 96#endif
87 97
88#endif /* __DEBUG_IMX_UART_H */ 98#endif /* __DEBUG_IMX_UART_H */
diff --git a/arch/arm/include/debug/keystone.S b/arch/arm/include/debug/keystone.S
new file mode 100644
index 000000000000..9aef9ba3f4f0
--- /dev/null
+++ b/arch/arm/include/debug/keystone.S
@@ -0,0 +1,43 @@
1/*
2 * Early serial debug output macro for Keystone SOCs
3 *
4 * Copyright 2013 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 *
7 * Based on RMKs low level debug code.
8 * Copyright (C) 1994-1999 Russell King
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_reg.h>
16
17#define UART_SHIFT 2
18#if defined(CONFIG_DEBUG_KEYSTONE_UART0)
19#define UART_PHYS 0x02530c00
20#define UART_VIRT 0xfeb30c00
21#elif defined(CONFIG_DEBUG_KEYSTONE_UART1)
22#define UART_PHYS 0x02531000
23#define UART_VIRT 0xfeb31000
24#endif
25
26 .macro addruart, rp, rv, tmp
27 ldr \rv, =UART_VIRT @ physical base address
28 ldr \rp, =UART_PHYS @ virtual base address
29 .endm
30
31 .macro senduart,rd,rx
32 str \rd, [\rx, #UART_TX << UART_SHIFT]
33 .endm
34
35 .macro busyuart,rd,rx
361002: ldr \rd, [\rx, #UART_LSR << UART_SHIFT]
37 and \rd, \rd, #UART_LSR_TEMT | UART_LSR_THRE
38 teq \rd, #UART_LSR_TEMT | UART_LSR_THRE
39 bne 1002b
40 .endm
41
42 .macro waituart,rd,rx
43 .endm
diff --git a/arch/arm/include/debug/mvebu.S b/arch/arm/include/debug/mvebu.S
index df191afa3be1..6517311a1c91 100644
--- a/arch/arm/include/debug/mvebu.S
+++ b/arch/arm/include/debug/mvebu.S
@@ -11,7 +11,12 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14#ifdef CONFIG_DEBUG_MVEBU_UART_ALTERNATE
15#define ARMADA_370_XP_REGS_PHYS_BASE 0xf1000000
16#else
14#define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 17#define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000
18#endif
19
15#define ARMADA_370_XP_REGS_VIRT_BASE 0xfec00000 20#define ARMADA_370_XP_REGS_VIRT_BASE 0xfec00000
16 21
17 .macro addruart, rp, rv, tmp 22 .macro addruart, rp, rv, tmp
diff --git a/arch/arm/include/debug/nspire.S b/arch/arm/include/debug/nspire.S
new file mode 100644
index 000000000000..886fd276fcbc
--- /dev/null
+++ b/arch/arm/include/debug/nspire.S
@@ -0,0 +1,28 @@
1/*
2 * linux/arch/arm/include/debug/nspire.S
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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#define NSPIRE_EARLY_UART_PHYS_BASE 0x90020000
13#define NSPIRE_EARLY_UART_VIRT_BASE 0xfee20000
14
15.macro addruart, rp, rv, tmp
16 ldr \rp, =(NSPIRE_EARLY_UART_PHYS_BASE) @ physical base address
17 ldr \rv, =(NSPIRE_EARLY_UART_VIRT_BASE) @ virtual base address
18.endm
19
20
21#ifdef CONFIG_DEBUG_NSPIRE_CX_UART
22#include <asm/hardware/debug-pl01x.S>
23#endif
24
25#ifdef CONFIG_DEBUG_NSPIRE_CLASSIC_UART
26#define UART_SHIFT 2
27#include <asm/hardware/debug-8250.S>
28#endif
diff --git a/arch/arm/include/debug/rockchip.S b/arch/arm/include/debug/rockchip.S
new file mode 100644
index 000000000000..cfd883e69588
--- /dev/null
+++ b/arch/arm/include/debug/rockchip.S
@@ -0,0 +1,42 @@
1/*
2 * Early serial output macro for Rockchip SoCs
3 *
4 * Copyright (C) 2012 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.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#if defined(CONFIG_DEBUG_RK29_UART0)
14#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x20060000
15#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfed60000
16#elif defined(CONFIG_DEBUG_RK29_UART1)
17#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x20064000
18#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfed64000
19#elif defined(CONFIG_DEBUG_RK29_UART2)
20#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x20068000
21#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfed68000
22#elif defined(CONFIG_DEBUG_RK3X_UART0)
23#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x10124000
24#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfeb24000
25#elif defined(CONFIG_DEBUG_RK3X_UART1)
26#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x10126000
27#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfeb26000
28#elif defined(CONFIG_DEBUG_RK3X_UART2)
29#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x20064000
30#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfed64000
31#elif defined(CONFIG_DEBUG_RK3X_UART3)
32#define ROCKCHIP_UART_DEBUG_PHYS_BASE 0x20068000
33#define ROCKCHIP_UART_DEBUG_VIRT_BASE 0xfed68000
34#endif
35
36 .macro addruart, rp, rv, tmp
37 ldr \rp, =ROCKCHIP_UART_DEBUG_PHYS_BASE
38 ldr \rv, =ROCKCHIP_UART_DEBUG_VIRT_BASE
39 .endm
40
41#define UART_SHIFT 2
42#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/include/debug/sti.S b/arch/arm/include/debug/sti.S
new file mode 100644
index 000000000000..e3aa58ff1776
--- /dev/null
+++ b/arch/arm/include/debug/sti.S
@@ -0,0 +1,61 @@
1/*
2 * arch/arm/include/debug/sti.S
3 *
4 * Debugging macro include header
5 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#define STIH41X_COMMS_BASE 0xfed00000
13#define STIH41X_ASC2_BASE (STIH41X_COMMS_BASE+0x32000)
14
15#define STIH41X_SBC_LPM_BASE 0xfe400000
16#define STIH41X_SBC_COMMS_BASE (STIH41X_SBC_LPM_BASE + 0x100000)
17#define STIH41X_SBC_ASC1_BASE (STIH41X_SBC_COMMS_BASE + 0x31000)
18
19
20#define VIRT_ADDRESS(x) (x - 0x1000000)
21
22#if IS_ENABLED(CONFIG_STIH41X_DEBUG_ASC2)
23#define DEBUG_LL_UART_BASE STIH41X_ASC2_BASE
24#endif
25
26#if IS_ENABLED(CONFIG_STIH41X_DEBUG_SBC_ASC1)
27#define DEBUG_LL_UART_BASE STIH41X_SBC_ASC1_BASE
28#endif
29
30#ifndef DEBUG_LL_UART_BASE
31#error "DEBUG UART is not Configured"
32#endif
33
34#define ASC_TX_BUF_OFF 0x04
35#define ASC_CTRL_OFF 0x0c
36#define ASC_STA_OFF 0x14
37
38#define ASC_STA_TX_FULL (1<<9)
39#define ASC_STA_TX_EMPTY (1<<1)
40
41
42 .macro addruart, rp, rv, tmp
43 ldr \rp, =DEBUG_LL_UART_BASE @ physical base
44 ldr \rv, =VIRT_ADDRESS(DEBUG_LL_UART_BASE) @ virt base
45 .endm
46
47 .macro senduart,rd,rx
48 strb \rd, [\rx, #ASC_TX_BUF_OFF]
49 .endm
50
51 .macro waituart,rd,rx
521001: ldr \rd, [\rx, #ASC_STA_OFF]
53 tst \rd, #ASC_STA_TX_FULL
54 bne 1001b
55 .endm
56
57 .macro busyuart,rd,rx
581001: ldr \rd, [\rx, #ASC_STA_OFF]
59 tst \rd, #ASC_STA_TX_EMPTY
60 beq 1001b
61 .endm
diff --git a/arch/arm/mach-u300/include/mach/debug-macro.S b/arch/arm/include/debug/u300.S
index 8ae8e4ab34b0..6f04f08a203c 100644
--- a/arch/arm/mach-u300/include/mach/debug-macro.S
+++ b/arch/arm/include/debug/u300.S
@@ -1,14 +1,11 @@
1/* 1/*
2 * 2 * Copyright (C) 2006-2013 ST-Ericsson AB
3 * arch-arm/mach-u300/include/mach/debug-macro.S
4 *
5 *
6 * Copyright (C) 2006-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
8 * Debugging macro include header. 4 * Debugging macro include header.
9 * Author: Linus Walleij <linus.walleij@stericsson.com> 5 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */ 6 */
11#include <mach/hardware.h> 7#define U300_SLOW_PER_PHYS_BASE 0xc0010000
8#define U300_SLOW_PER_VIRT_BASE 0xff000000
12 9
13 .macro addruart, rp, rv, tmp 10 .macro addruart, rp, rv, tmp
14 /* If we move the address using MMU, use this. */ 11 /* If we move the address using MMU, use this. */
diff --git a/arch/arm/include/debug/vexpress.S b/arch/arm/include/debug/vexpress.S
index dc8e882a6257..acafb229e2b6 100644
--- a/arch/arm/include/debug/vexpress.S
+++ b/arch/arm/include/debug/vexpress.S
@@ -16,6 +16,8 @@
16#define DEBUG_LL_PHYS_BASE_RS1 0x1c000000 16#define DEBUG_LL_PHYS_BASE_RS1 0x1c000000
17#define DEBUG_LL_UART_OFFSET_RS1 0x00090000 17#define DEBUG_LL_UART_OFFSET_RS1 0x00090000
18 18
19#define DEBUG_LL_UART_PHYS_CRX 0xb0090000
20
19#define DEBUG_LL_VIRT_BASE 0xf8000000 21#define DEBUG_LL_VIRT_BASE 0xf8000000
20 22
21#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT) 23#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT)
@@ -67,6 +69,14 @@
67 69
68#include <asm/hardware/debug-pl01x.S> 70#include <asm/hardware/debug-pl01x.S>
69 71
72#elif defined(CONFIG_DEBUG_VEXPRESS_UART0_CRX)
73
74 .macro addruart,rp,tmp,tmp2
75 ldr \rp, =DEBUG_LL_UART_PHYS_CRX
76 .endm
77
78#include <asm/hardware/debug-pl01x.S>
79
70#else /* CONFIG_DEBUG_LL_UART_NONE */ 80#else /* CONFIG_DEBUG_LL_UART_NONE */
71 81
72 .macro addruart, rp, rv, tmp 82 .macro addruart, rp, rv, tmp
diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h
index 3688fd15a32d..6d34d080372a 100644
--- a/arch/arm/include/uapi/asm/hwcap.h
+++ b/arch/arm/include/uapi/asm/hwcap.h
@@ -25,6 +25,6 @@
25#define HWCAP_IDIVT (1 << 18) 25#define HWCAP_IDIVT (1 << 18)
26#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */ 26#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */
27#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) 27#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
28 28#define HWCAP_LPAE (1 << 20)
29 29
30#endif /* _UAPI__ASMARM_HWCAP_H */ 30#endif /* _UAPI__ASMARM_HWCAP_H */
diff --git a/arch/arm/include/uapi/asm/ptrace.h b/arch/arm/include/uapi/asm/ptrace.h
index 96ee0929790f..5af0ed1b825a 100644
--- a/arch/arm/include/uapi/asm/ptrace.h
+++ b/arch/arm/include/uapi/asm/ptrace.h
@@ -34,28 +34,47 @@
34 34
35/* 35/*
36 * PSR bits 36 * PSR bits
37 * Note on V7M there is no mode contained in the PSR
37 */ 38 */
38#define USR26_MODE 0x00000000 39#define USR26_MODE 0x00000000
39#define FIQ26_MODE 0x00000001 40#define FIQ26_MODE 0x00000001
40#define IRQ26_MODE 0x00000002 41#define IRQ26_MODE 0x00000002
41#define SVC26_MODE 0x00000003 42#define SVC26_MODE 0x00000003
43#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M)
44/*
45 * Use 0 here to get code right that creates a userspace
46 * or kernel space thread.
47 */
48#define USR_MODE 0x00000000
49#define SVC_MODE 0x00000000
50#else
42#define USR_MODE 0x00000010 51#define USR_MODE 0x00000010
52#define SVC_MODE 0x00000013
53#endif
43#define FIQ_MODE 0x00000011 54#define FIQ_MODE 0x00000011
44#define IRQ_MODE 0x00000012 55#define IRQ_MODE 0x00000012
45#define SVC_MODE 0x00000013
46#define ABT_MODE 0x00000017 56#define ABT_MODE 0x00000017
47#define HYP_MODE 0x0000001a 57#define HYP_MODE 0x0000001a
48#define UND_MODE 0x0000001b 58#define UND_MODE 0x0000001b
49#define SYSTEM_MODE 0x0000001f 59#define SYSTEM_MODE 0x0000001f
50#define MODE32_BIT 0x00000010 60#define MODE32_BIT 0x00000010
51#define MODE_MASK 0x0000001f 61#define MODE_MASK 0x0000001f
52#define PSR_T_BIT 0x00000020 62
53#define PSR_F_BIT 0x00000040 63#define V4_PSR_T_BIT 0x00000020 /* >= V4T, but not V7M */
54#define PSR_I_BIT 0x00000080 64#define V7M_PSR_T_BIT 0x01000000
55#define PSR_A_BIT 0x00000100 65#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M)
56#define PSR_E_BIT 0x00000200 66#define PSR_T_BIT V7M_PSR_T_BIT
57#define PSR_J_BIT 0x01000000 67#else
58#define PSR_Q_BIT 0x08000000 68/* for compatibility */
69#define PSR_T_BIT V4_PSR_T_BIT
70#endif
71
72#define PSR_F_BIT 0x00000040 /* >= V4, but not V7M */
73#define PSR_I_BIT 0x00000080 /* >= V4, but not V7M */
74#define PSR_A_BIT 0x00000100 /* >= V6, but not V7M */
75#define PSR_E_BIT 0x00000200 /* >= V6, but not V7M */
76#define PSR_J_BIT 0x01000000 /* >= V5J, but not V7M */
77#define PSR_Q_BIT 0x08000000 /* >= V5E, including V7M */
59#define PSR_V_BIT 0x10000000 78#define PSR_V_BIT 0x10000000
60#define PSR_C_BIT 0x20000000 79#define PSR_C_BIT 0x20000000
61#define PSR_Z_BIT 0x40000000 80#define PSR_Z_BIT 0x40000000
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 5f3338eacad2..fccfbdb03df1 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -15,7 +15,7 @@ CFLAGS_REMOVE_return_address.o = -pg
15 15
16# Object file lists. 16# Object file lists.
17 17
18obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ 18obj-y := elf.o entry-common.o irq.o opcodes.o \
19 process.o ptrace.o return_address.o sched_clock.o \ 19 process.o ptrace.o return_address.o sched_clock.o \
20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o 20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
21 21
@@ -23,6 +23,12 @@ obj-$(CONFIG_ATAGS) += atags_parse.o
23obj-$(CONFIG_ATAGS_PROC) += atags_proc.o 23obj-$(CONFIG_ATAGS_PROC) += atags_proc.o
24obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o 24obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o
25 25
26ifeq ($(CONFIG_CPU_V7M),y)
27obj-y += entry-v7m.o
28else
29obj-y += entry-armv.o
30endif
31
26obj-$(CONFIG_OC_ETM) += etm.o 32obj-$(CONFIG_OC_ETM) += etm.o
27obj-$(CONFIG_CPU_IDLE) += cpuidle.o 33obj-$(CONFIG_CPU_IDLE) += cpuidle.o
28obj-$(CONFIG_ISA_DMA_API) += dma.o 34obj-$(CONFIG_ISA_DMA_API) += dma.o
@@ -32,7 +38,10 @@ obj-$(CONFIG_ARTHUR) += arthur.o
32obj-$(CONFIG_ISA_DMA) += dma-isa.o 38obj-$(CONFIG_ISA_DMA) += dma-isa.o
33obj-$(CONFIG_PCI) += bios32.o isa.o 39obj-$(CONFIG_PCI) += bios32.o isa.o
34obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o 40obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
35obj-$(CONFIG_SMP) += smp.o smp_tlb.o 41obj-$(CONFIG_SMP) += smp.o
42ifdef CONFIG_MMU
43obj-$(CONFIG_SMP) += smp_tlb.o
44endif
36obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 45obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
37obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o 46obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
38obj-$(CONFIG_ARM_ARCH_TIMER) += arch_timer.o 47obj-$(CONFIG_ARM_ARCH_TIMER) += arch_timer.o
@@ -82,6 +91,9 @@ obj-$(CONFIG_DEBUG_LL) += debug.o
82obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 91obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
83 92
84obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o 93obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o
85obj-$(CONFIG_ARM_PSCI) += psci.o 94ifeq ($(CONFIG_ARM_PSCI),y)
95obj-y += psci.o
96obj-$(CONFIG_SMP) += psci_smp.o
97endif
86 98
87extra-y := $(head-y) vmlinux.lds 99extra-y := $(head-y) vmlinux.lds
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index ee68cce6b48e..ded041711beb 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -23,6 +23,7 @@
23#include <asm/thread_info.h> 23#include <asm/thread_info.h>
24#include <asm/memory.h> 24#include <asm/memory.h>
25#include <asm/procinfo.h> 25#include <asm/procinfo.h>
26#include <asm/suspend.h>
26#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
27#include <linux/kbuild.h> 28#include <linux/kbuild.h>
28 29
@@ -145,6 +146,11 @@ int main(void)
145#ifdef MULTI_CACHE 146#ifdef MULTI_CACHE
146 DEFINE(CACHE_FLUSH_KERN_ALL, offsetof(struct cpu_cache_fns, flush_kern_all)); 147 DEFINE(CACHE_FLUSH_KERN_ALL, offsetof(struct cpu_cache_fns, flush_kern_all));
147#endif 148#endif
149#ifdef CONFIG_ARM_CPU_SUSPEND
150 DEFINE(SLEEP_SAVE_SP_SZ, sizeof(struct sleep_save_sp));
151 DEFINE(SLEEP_SAVE_SP_PHYS, offsetof(struct sleep_save_sp, save_ptr_stash_phys));
152 DEFINE(SLEEP_SAVE_SP_VIRT, offsetof(struct sleep_save_sp, save_ptr_stash));
153#endif
148 BLANK(); 154 BLANK();
149 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); 155 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
150 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); 156 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE);
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index b2ed73c45489..261fcc826169 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -445,7 +445,8 @@ static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
445 return 0; 445 return 0;
446} 446}
447 447
448static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head) 448static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
449 struct list_head *head)
449{ 450{
450 struct pci_sys_data *sys = NULL; 451 struct pci_sys_data *sys = NULL;
451 int ret; 452 int ret;
@@ -480,7 +481,7 @@ static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
480 if (hw->scan) 481 if (hw->scan)
481 sys->bus = hw->scan(nr, sys); 482 sys->bus = hw->scan(nr, sys);
482 else 483 else
483 sys->bus = pci_scan_root_bus(NULL, sys->busnr, 484 sys->bus = pci_scan_root_bus(parent, sys->busnr,
484 hw->ops, sys, &sys->resources); 485 hw->ops, sys, &sys->resources);
485 486
486 if (!sys->bus) 487 if (!sys->bus)
@@ -497,7 +498,7 @@ static void pcibios_init_hw(struct hw_pci *hw, struct list_head *head)
497 } 498 }
498} 499}
499 500
500void pci_common_init(struct hw_pci *hw) 501void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
501{ 502{
502 struct pci_sys_data *sys; 503 struct pci_sys_data *sys;
503 LIST_HEAD(head); 504 LIST_HEAD(head);
@@ -505,7 +506,7 @@ void pci_common_init(struct hw_pci *hw)
505 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 506 pci_add_flags(PCI_REASSIGN_ALL_RSRC);
506 if (hw->preinit) 507 if (hw->preinit)
507 hw->preinit(); 508 hw->preinit();
508 pcibios_init_hw(hw, &head); 509 pcibios_init_hw(parent, hw, &head);
509 if (hw->postinit) 510 if (hw->postinit)
510 hw->postinit(); 511 hw->postinit();
511 512
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 5af04f6daa33..5859c8bc727c 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -82,7 +82,7 @@ void __init arm_dt_init_cpu_maps(void)
82 u32 i, j, cpuidx = 1; 82 u32 i, j, cpuidx = 1;
83 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0; 83 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
84 84
85 u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = UINT_MAX }; 85 u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
86 bool bootcpu_valid = false; 86 bool bootcpu_valid = false;
87 cpus = of_find_node_by_path("/cpus"); 87 cpus = of_find_node_by_path("/cpus");
88 88
@@ -92,6 +92,9 @@ void __init arm_dt_init_cpu_maps(void)
92 for_each_child_of_node(cpus, cpu) { 92 for_each_child_of_node(cpus, cpu) {
93 u32 hwid; 93 u32 hwid;
94 94
95 if (of_node_cmp(cpu->type, "cpu"))
96 continue;
97
95 pr_debug(" * %s...\n", cpu->full_name); 98 pr_debug(" * %s...\n", cpu->full_name);
96 /* 99 /*
97 * A device tree containing CPU nodes with missing "reg" 100 * A device tree containing CPU nodes with missing "reg"
@@ -149,9 +152,10 @@ void __init arm_dt_init_cpu_maps(void)
149 tmp_map[i] = hwid; 152 tmp_map[i] = hwid;
150 } 153 }
151 154
152 if (WARN(!bootcpu_valid, "DT missing boot CPU MPIDR[23:0], " 155 if (!bootcpu_valid) {
153 "fall back to default cpu_logical_map\n")) 156 pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n");
154 return; 157 return;
158 }
155 159
156 /* 160 /*
157 * Since the boot CPU node contains proper data, and all nodes have 161 * Since the boot CPU node contains proper data, and all nodes have
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 582b405befc5..a39cfc2a1f90 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -685,15 +685,16 @@ ENTRY(__switch_to)
685 UNWIND(.fnstart ) 685 UNWIND(.fnstart )
686 UNWIND(.cantunwind ) 686 UNWIND(.cantunwind )
687 add ip, r1, #TI_CPU_SAVE 687 add ip, r1, #TI_CPU_SAVE
688 ldr r3, [r2, #TI_TP_VALUE]
689 ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack 688 ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack
690 THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack 689 THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
691 THUMB( str sp, [ip], #4 ) 690 THUMB( str sp, [ip], #4 )
692 THUMB( str lr, [ip], #4 ) 691 THUMB( str lr, [ip], #4 )
692 ldr r4, [r2, #TI_TP_VALUE]
693 ldr r5, [r2, #TI_TP_VALUE + 4]
693#ifdef CONFIG_CPU_USE_DOMAINS 694#ifdef CONFIG_CPU_USE_DOMAINS
694 ldr r6, [r2, #TI_CPU_DOMAIN] 695 ldr r6, [r2, #TI_CPU_DOMAIN]
695#endif 696#endif
696 set_tls r3, r4, r5 697 switch_tls r1, r4, r5, r3, r7
697#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP) 698#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
698 ldr r7, [r2, #TI_TASK] 699 ldr r7, [r2, #TI_TASK]
699 ldr r8, =__stack_chk_guard 700 ldr r8, =__stack_chk_guard
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index bc5bc0a97131..94104bf69719 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -350,6 +350,9 @@ ENDPROC(ftrace_stub)
350 350
351 .align 5 351 .align 5
352ENTRY(vector_swi) 352ENTRY(vector_swi)
353#ifdef CONFIG_CPU_V7M
354 v7m_exception_entry
355#else
353 sub sp, sp, #S_FRAME_SIZE 356 sub sp, sp, #S_FRAME_SIZE
354 stmia sp, {r0 - r12} @ Calling r0 - r12 357 stmia sp, {r0 - r12} @ Calling r0 - r12
355 ARM( add r8, sp, #S_PC ) 358 ARM( add r8, sp, #S_PC )
@@ -360,8 +363,19 @@ ENTRY(vector_swi)
360 str lr, [sp, #S_PC] @ Save calling PC 363 str lr, [sp, #S_PC] @ Save calling PC
361 str r8, [sp, #S_PSR] @ Save CPSR 364 str r8, [sp, #S_PSR] @ Save CPSR
362 str r0, [sp, #S_OLD_R0] @ Save OLD_R0 365 str r0, [sp, #S_OLD_R0] @ Save OLD_R0
366#endif
363 zero_fp 367 zero_fp
364 368
369#ifdef CONFIG_ALIGNMENT_TRAP
370 ldr ip, __cr_alignment
371 ldr ip, [ip]
372 mcr p15, 0, ip, c1, c0 @ update control register
373#endif
374
375 enable_irq
376 ct_user_exit
377 get_thread_info tsk
378
365 /* 379 /*
366 * Get the system call number. 380 * Get the system call number.
367 */ 381 */
@@ -375,9 +389,9 @@ ENTRY(vector_swi)
375#ifdef CONFIG_ARM_THUMB 389#ifdef CONFIG_ARM_THUMB
376 tst r8, #PSR_T_BIT 390 tst r8, #PSR_T_BIT
377 movne r10, #0 @ no thumb OABI emulation 391 movne r10, #0 @ no thumb OABI emulation
378 ldreq r10, [lr, #-4] @ get SWI instruction 392 USER( ldreq r10, [lr, #-4] ) @ get SWI instruction
379#else 393#else
380 ldr r10, [lr, #-4] @ get SWI instruction 394 USER( ldr r10, [lr, #-4] ) @ get SWI instruction
381#endif 395#endif
382#ifdef CONFIG_CPU_ENDIAN_BE8 396#ifdef CONFIG_CPU_ENDIAN_BE8
383 rev r10, r10 @ little endian instruction 397 rev r10, r10 @ little endian instruction
@@ -392,22 +406,13 @@ ENTRY(vector_swi)
392 /* Legacy ABI only, possibly thumb mode. */ 406 /* Legacy ABI only, possibly thumb mode. */
393 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs 407 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
394 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in 408 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
395 ldreq scno, [lr, #-4] 409 USER( ldreq scno, [lr, #-4] )
396 410
397#else 411#else
398 /* Legacy ABI only. */ 412 /* Legacy ABI only. */
399 ldr scno, [lr, #-4] @ get SWI instruction 413 USER( ldr scno, [lr, #-4] ) @ get SWI instruction
400#endif 414#endif
401 415
402#ifdef CONFIG_ALIGNMENT_TRAP
403 ldr ip, __cr_alignment
404 ldr ip, [ip]
405 mcr p15, 0, ip, c1, c0 @ update control register
406#endif
407 enable_irq
408 ct_user_exit
409
410 get_thread_info tsk
411 adr tbl, sys_call_table @ load syscall table pointer 416 adr tbl, sys_call_table @ load syscall table pointer
412 417
413#if defined(CONFIG_OABI_COMPAT) 418#if defined(CONFIG_OABI_COMPAT)
@@ -442,6 +447,21 @@ local_restart:
442 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back 447 eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
443 bcs arm_syscall 448 bcs arm_syscall
444 b sys_ni_syscall @ not private func 449 b sys_ni_syscall @ not private func
450
451#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
452 /*
453 * We failed to handle a fault trying to access the page
454 * containing the swi instruction, but we're not really in a
455 * position to return -EFAULT. Instead, return back to the
456 * instruction and re-enter the user fault handling path trying
457 * to page it in. This will likely result in sending SEGV to the
458 * current task.
459 */
4609001:
461 sub lr, lr, #4
462 str lr, [sp, #S_PC]
463 b ret_fast_syscall
464#endif
445ENDPROC(vector_swi) 465ENDPROC(vector_swi)
446 466
447 /* 467 /*
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 160f3376ba6d..de23a9beed13 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -5,6 +5,7 @@
5#include <asm/asm-offsets.h> 5#include <asm/asm-offsets.h>
6#include <asm/errno.h> 6#include <asm/errno.h>
7#include <asm/thread_info.h> 7#include <asm/thread_info.h>
8#include <asm/v7m.h>
8 9
9@ Bad Abort numbers 10@ Bad Abort numbers
10@ ----------------- 11@ -----------------
@@ -44,6 +45,116 @@
44#endif 45#endif
45 .endm 46 .endm
46 47
48#ifdef CONFIG_CPU_V7M
49/*
50 * ARMv7-M exception entry/exit macros.
51 *
52 * xPSR, ReturnAddress(), LR (R14), R12, R3, R2, R1, and R0 are
53 * automatically saved on the current stack (32 words) before
54 * switching to the exception stack (SP_main).
55 *
56 * If exception is taken while in user mode, SP_main is
57 * empty. Otherwise, SP_main is aligned to 64 bit automatically
58 * (CCR.STKALIGN set).
59 *
60 * Linux assumes that the interrupts are disabled when entering an
61 * exception handler and it may BUG if this is not the case. Interrupts
62 * are disabled during entry and reenabled in the exit macro.
63 *
64 * v7m_exception_slow_exit is used when returning from SVC or PendSV.
65 * When returning to kernel mode, we don't return from exception.
66 */
67 .macro v7m_exception_entry
68 @ determine the location of the registers saved by the core during
69 @ exception entry. Depending on the mode the cpu was in when the
70 @ exception happend that is either on the main or the process stack.
71 @ Bit 2 of EXC_RETURN stored in the lr register specifies which stack
72 @ was used.
73 tst lr, #EXC_RET_STACK_MASK
74 mrsne r12, psp
75 moveq r12, sp
76
77 @ we cannot rely on r0-r3 and r12 matching the value saved in the
78 @ exception frame because of tail-chaining. So these have to be
79 @ reloaded.
80 ldmia r12!, {r0-r3}
81
82 @ Linux expects to have irqs off. Do it here before taking stack space
83 cpsid i
84
85 sub sp, #S_FRAME_SIZE-S_IP
86 stmdb sp!, {r0-r11}
87
88 @ load saved r12, lr, return address and xPSR.
89 @ r0-r7 are used for signals and never touched from now on. Clobbering
90 @ r8-r12 is OK.
91 mov r9, r12
92 ldmia r9!, {r8, r10-r12}
93
94 @ calculate the original stack pointer value.
95 @ r9 currently points to the memory location just above the auto saved
96 @ xPSR.
97 @ The cpu might automatically 8-byte align the stack. Bit 9
98 @ of the saved xPSR specifies if stack aligning took place. In this case
99 @ another 32-bit value is included in the stack.
100
101 tst r12, V7M_xPSR_FRAMEPTRALIGN
102 addne r9, r9, #4
103
104 @ store saved r12 using str to have a register to hold the base for stm
105 str r8, [sp, #S_IP]
106 add r8, sp, #S_SP
107 @ store r13-r15, xPSR
108 stmia r8!, {r9-r12}
109 @ store old_r0
110 str r0, [r8]
111 .endm
112
113 /*
114 * PENDSV and SVCALL are configured to have the same exception
115 * priorities. As a kernel thread runs at SVCALL execution priority it
116 * can never be preempted and so we will never have to return to a
117 * kernel thread here.
118 */
119 .macro v7m_exception_slow_exit ret_r0
120 cpsid i
121 ldr lr, =EXC_RET_THREADMODE_PROCESSSTACK
122
123 @ read original r12, sp, lr, pc and xPSR
124 add r12, sp, #S_IP
125 ldmia r12, {r1-r5}
126
127 @ an exception frame is always 8-byte aligned. To tell the hardware if
128 @ the sp to be restored is aligned or not set bit 9 of the saved xPSR
129 @ accordingly.
130 tst r2, #4
131 subne r2, r2, #4
132 orrne r5, V7M_xPSR_FRAMEPTRALIGN
133 biceq r5, V7M_xPSR_FRAMEPTRALIGN
134
135 @ write basic exception frame
136 stmdb r2!, {r1, r3-r5}
137 ldmia sp, {r1, r3-r5}
138 .if \ret_r0
139 stmdb r2!, {r0, r3-r5}
140 .else
141 stmdb r2!, {r1, r3-r5}
142 .endif
143
144 @ restore process sp
145 msr psp, r2
146
147 @ restore original r4-r11
148 ldmia sp!, {r0-r11}
149
150 @ restore main sp
151 add sp, sp, #S_FRAME_SIZE-S_IP
152
153 cpsie i
154 bx lr
155 .endm
156#endif /* CONFIG_CPU_V7M */
157
47 @ 158 @
48 @ Store/load the USER SP and LR registers by switching to the SYS 159 @ Store/load the USER SP and LR registers by switching to the SYS
49 @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not 160 @ mode. Useful in Thumb-2 mode where "stm/ldm rd, {sp, lr}^" is not
@@ -165,6 +276,18 @@
165 rfeia sp! 276 rfeia sp!
166 .endm 277 .endm
167 278
279#ifdef CONFIG_CPU_V7M
280 /*
281 * Note we don't need to do clrex here as clearing the local monitor is
282 * part of each exception entry and exit sequence.
283 */
284 .macro restore_user_regs, fast = 0, offset = 0
285 .if \offset
286 add sp, #\offset
287 .endif
288 v7m_exception_slow_exit ret_r0 = \fast
289 .endm
290#else /* ifdef CONFIG_CPU_V7M */
168 .macro restore_user_regs, fast = 0, offset = 0 291 .macro restore_user_regs, fast = 0, offset = 0
169 clrex @ clear the exclusive monitor 292 clrex @ clear the exclusive monitor
170 mov r2, sp 293 mov r2, sp
@@ -181,6 +304,7 @@
181 add sp, sp, #S_FRAME_SIZE - S_SP 304 add sp, sp, #S_FRAME_SIZE - S_SP
182 movs pc, lr @ return & move spsr_svc into cpsr 305 movs pc, lr @ return & move spsr_svc into cpsr
183 .endm 306 .endm
307#endif /* ifdef CONFIG_CPU_V7M / else */
184 308
185 .macro get_thread_info, rd 309 .macro get_thread_info, rd
186 mov \rd, sp 310 mov \rd, sp
diff --git a/arch/arm/kernel/entry-v7m.S b/arch/arm/kernel/entry-v7m.S
new file mode 100644
index 000000000000..e00621f1403f
--- /dev/null
+++ b/arch/arm/kernel/entry-v7m.S
@@ -0,0 +1,143 @@
1/*
2 * linux/arch/arm/kernel/entry-v7m.S
3 *
4 * Copyright (C) 2008 ARM Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Low-level vector interface routines for the ARMv7-M architecture
11 */
12#include <asm/memory.h>
13#include <asm/glue.h>
14#include <asm/thread_notify.h>
15#include <asm/v7m.h>
16
17#include <mach/entry-macro.S>
18
19#include "entry-header.S"
20
21#ifdef CONFIG_TRACE_IRQFLAGS
22#error "CONFIG_TRACE_IRQFLAGS not supported on the current ARMv7M implementation"
23#endif
24
25__invalid_entry:
26 v7m_exception_entry
27 adr r0, strerr
28 mrs r1, ipsr
29 mov r2, lr
30 bl printk
31 mov r0, sp
32 bl show_regs
331: b 1b
34ENDPROC(__invalid_entry)
35
36strerr: .asciz "\nUnhandled exception: IPSR = %08lx LR = %08lx\n"
37
38 .align 2
39__irq_entry:
40 v7m_exception_entry
41
42 @
43 @ Invoke the IRQ handler
44 @
45 mrs r0, ipsr
46 ldr r1, =V7M_xPSR_EXCEPTIONNO
47 and r0, r1
48 sub r0, #16
49 mov r1, sp
50 stmdb sp!, {lr}
51 @ routine called with r0 = irq number, r1 = struct pt_regs *
52 bl nvic_do_IRQ
53
54 pop {lr}
55 @
56 @ Check for any pending work if returning to user
57 @
58 ldr r1, =BASEADDR_V7M_SCB
59 ldr r0, [r1, V7M_SCB_ICSR]
60 tst r0, V7M_SCB_ICSR_RETTOBASE
61 beq 2f
62
63 get_thread_info tsk
64 ldr r2, [tsk, #TI_FLAGS]
65 tst r2, #_TIF_WORK_MASK
66 beq 2f @ no work pending
67 mov r0, #V7M_SCB_ICSR_PENDSVSET
68 str r0, [r1, V7M_SCB_ICSR] @ raise PendSV
69
702:
71 @ registers r0-r3 and r12 are automatically restored on exception
72 @ return. r4-r7 were not clobbered in v7m_exception_entry so for
73 @ correctness they don't need to be restored. So only r8-r11 must be
74 @ restored here. The easiest way to do so is to restore r0-r7, too.
75 ldmia sp!, {r0-r11}
76 add sp, #S_FRAME_SIZE-S_IP
77 cpsie i
78 bx lr
79ENDPROC(__irq_entry)
80
81__pendsv_entry:
82 v7m_exception_entry
83
84 ldr r1, =BASEADDR_V7M_SCB
85 mov r0, #V7M_SCB_ICSR_PENDSVCLR
86 str r0, [r1, V7M_SCB_ICSR] @ clear PendSV
87
88 @ execute the pending work, including reschedule
89 get_thread_info tsk
90 mov why, #0
91 b ret_to_user
92ENDPROC(__pendsv_entry)
93
94/*
95 * Register switch for ARMv7-M processors.
96 * r0 = previous task_struct, r1 = previous thread_info, r2 = next thread_info
97 * previous and next are guaranteed not to be the same.
98 */
99ENTRY(__switch_to)
100 .fnstart
101 .cantunwind
102 add ip, r1, #TI_CPU_SAVE
103 stmia ip!, {r4 - r11} @ Store most regs on stack
104 str sp, [ip], #4
105 str lr, [ip], #4
106 mov r5, r0
107 add r4, r2, #TI_CPU_SAVE
108 ldr r0, =thread_notify_head
109 mov r1, #THREAD_NOTIFY_SWITCH
110 bl atomic_notifier_call_chain
111 mov ip, r4
112 mov r0, r5
113 ldmia ip!, {r4 - r11} @ Load all regs saved previously
114 ldr sp, [ip]
115 ldr pc, [ip, #4]!
116 .fnend
117ENDPROC(__switch_to)
118
119 .data
120 .align 8
121/*
122 * Vector table (64 words => 256 bytes natural alignment)
123 */
124ENTRY(vector_table)
125 .long 0 @ 0 - Reset stack pointer
126 .long __invalid_entry @ 1 - Reset
127 .long __invalid_entry @ 2 - NMI
128 .long __invalid_entry @ 3 - HardFault
129 .long __invalid_entry @ 4 - MemManage
130 .long __invalid_entry @ 5 - BusFault
131 .long __invalid_entry @ 6 - UsageFault
132 .long __invalid_entry @ 7 - Reserved
133 .long __invalid_entry @ 8 - Reserved
134 .long __invalid_entry @ 9 - Reserved
135 .long __invalid_entry @ 10 - Reserved
136 .long vector_swi @ 11 - SVCall
137 .long __invalid_entry @ 12 - Debug Monitor
138 .long __invalid_entry @ 13 - Reserved
139 .long __pendsv_entry @ 14 - PendSV
140 .long __invalid_entry @ 15 - SysTick
141 .rept 64 - 16
142 .long __irq_entry @ 16..64 - External Interrupts
143 .endr
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 6a2e09c952c7..75f14cc3e073 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -17,8 +17,12 @@
17#include <asm/assembler.h> 17#include <asm/assembler.h>
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/memory.h>
20#include <asm/cp15.h> 21#include <asm/cp15.h>
21#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/v7m.h>
24#include <asm/mpu.h>
25#include <asm/page.h>
22 26
23/* 27/*
24 * Kernel startup entry point. 28 * Kernel startup entry point.
@@ -50,21 +54,86 @@ ENTRY(stext)
50 54
51 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode 55 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
52 @ and irqs disabled 56 @ and irqs disabled
53#ifndef CONFIG_CPU_CP15 57#if defined(CONFIG_CPU_CP15)
54 ldr r9, =CONFIG_PROCESSOR_ID
55#else
56 mrc p15, 0, r9, c0, c0 @ get processor id 58 mrc p15, 0, r9, c0, c0 @ get processor id
59#elif defined(CONFIG_CPU_V7M)
60 ldr r9, =BASEADDR_V7M_SCB
61 ldr r9, [r9, V7M_SCB_CPUID]
62#else
63 ldr r9, =CONFIG_PROCESSOR_ID
57#endif 64#endif
58 bl __lookup_processor_type @ r5=procinfo r9=cpuid 65 bl __lookup_processor_type @ r5=procinfo r9=cpuid
59 movs r10, r5 @ invalid processor (r5=0)? 66 movs r10, r5 @ invalid processor (r5=0)?
60 beq __error_p @ yes, error 'p' 67 beq __error_p @ yes, error 'p'
61 68
62 adr lr, BSYM(__after_proc_init) @ return (PIC) address 69#ifdef CONFIG_ARM_MPU
70 /* Calculate the size of a region covering just the kernel */
71 ldr r5, =PHYS_OFFSET @ Region start: PHYS_OFFSET
72 ldr r6, =(_end) @ Cover whole kernel
73 sub r6, r6, r5 @ Minimum size of region to map
74 clz r6, r6 @ Region size must be 2^N...
75 rsb r6, r6, #31 @ ...so round up region size
76 lsl r6, r6, #MPU_RSR_SZ @ Put size in right field
77 orr r6, r6, #(1 << MPU_RSR_EN) @ Set region enabled bit
78 bl __setup_mpu
79#endif
80 ldr r13, =__mmap_switched @ address to jump to after
81 @ initialising sctlr
82 adr lr, BSYM(1f) @ return (PIC) address
63 ARM( add pc, r10, #PROCINFO_INITFUNC ) 83 ARM( add pc, r10, #PROCINFO_INITFUNC )
64 THUMB( add r12, r10, #PROCINFO_INITFUNC ) 84 THUMB( add r12, r10, #PROCINFO_INITFUNC )
65 THUMB( mov pc, r12 ) 85 THUMB( mov pc, r12 )
86 1: b __after_proc_init
66ENDPROC(stext) 87ENDPROC(stext)
67 88
89#ifdef CONFIG_SMP
90 __CPUINIT
91ENTRY(secondary_startup)
92 /*
93 * Common entry point for secondary CPUs.
94 *
95 * Ensure that we're in SVC mode, and IRQs are disabled. Lookup
96 * the processor type - there is no need to check the machine type
97 * as it has already been validated by the primary processor.
98 */
99 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9
100#ifndef CONFIG_CPU_CP15
101 ldr r9, =CONFIG_PROCESSOR_ID
102#else
103 mrc p15, 0, r9, c0, c0 @ get processor id
104#endif
105 bl __lookup_processor_type @ r5=procinfo r9=cpuid
106 movs r10, r5 @ invalid processor?
107 beq __error_p @ yes, error 'p'
108
109 adr r4, __secondary_data
110 ldmia r4, {r7, r12}
111
112#ifdef CONFIG_ARM_MPU
113 /* Use MPU region info supplied by __cpu_up */
114 ldr r6, [r7] @ get secondary_data.mpu_szr
115 bl __setup_mpu @ Initialize the MPU
116#endif
117
118 adr lr, BSYM(__after_proc_init) @ return address
119 mov r13, r12 @ __secondary_switched address
120 ARM( add pc, r10, #PROCINFO_INITFUNC )
121 THUMB( add r12, r10, #PROCINFO_INITFUNC )
122 THUMB( mov pc, r12 )
123ENDPROC(secondary_startup)
124
125ENTRY(__secondary_switched)
126 ldr sp, [r7, #8] @ set up the stack pointer
127 mov fp, #0
128 b secondary_start_kernel
129ENDPROC(__secondary_switched)
130
131 .type __secondary_data, %object
132__secondary_data:
133 .long secondary_data
134 .long __secondary_switched
135#endif /* CONFIG_SMP */
136
68/* 137/*
69 * Set the Control Register and Read the process ID. 138 * Set the Control Register and Read the process ID.
70 */ 139 */
@@ -95,10 +164,97 @@ __after_proc_init:
95#endif 164#endif
96 mcr p15, 0, r0, c1, c0, 0 @ write control reg 165 mcr p15, 0, r0, c1, c0, 0 @ write control reg
97#endif /* CONFIG_CPU_CP15 */ 166#endif /* CONFIG_CPU_CP15 */
98 167 mov pc, r13
99 b __mmap_switched @ clear the BSS and jump
100 @ to start_kernel
101ENDPROC(__after_proc_init) 168ENDPROC(__after_proc_init)
102 .ltorg 169 .ltorg
103 170
171#ifdef CONFIG_ARM_MPU
172
173
174/* Set which MPU region should be programmed */
175.macro set_region_nr tmp, rgnr
176 mov \tmp, \rgnr @ Use static region numbers
177 mcr p15, 0, \tmp, c6, c2, 0 @ Write RGNR
178.endm
179
180/* Setup a single MPU region, either D or I side (D-side for unified) */
181.macro setup_region bar, acr, sr, side = MPU_DATA_SIDE
182 mcr p15, 0, \bar, c6, c1, (0 + \side) @ I/DRBAR
183 mcr p15, 0, \acr, c6, c1, (4 + \side) @ I/DRACR
184 mcr p15, 0, \sr, c6, c1, (2 + \side) @ I/DRSR
185.endm
186
187/*
188 * Setup the MPU and initial MPU Regions. We create the following regions:
189 * Region 0: Use this for probing the MPU details, so leave disabled.
190 * Region 1: Background region - covers the whole of RAM as strongly ordered
191 * Region 2: Normal, Shared, cacheable for RAM. From PHYS_OFFSET, size from r6
192 * Region 3: Normal, shared, inaccessible from PL0 to protect the vectors page
193 *
194 * r6: Value to be written to DRSR (and IRSR if required) for MPU_RAM_REGION
195*/
196
197ENTRY(__setup_mpu)
198
199 /* Probe for v7 PMSA compliance */
200 mrc p15, 0, r0, c0, c1, 4 @ Read ID_MMFR0
201 and r0, r0, #(MMFR0_PMSA) @ PMSA field
202 teq r0, #(MMFR0_PMSAv7) @ PMSA v7
203 bne __error_p @ Fail: ARM_MPU on NOT v7 PMSA
204
205 /* Determine whether the D/I-side memory map is unified. We set the
206 * flags here and continue to use them for the rest of this function */
207 mrc p15, 0, r0, c0, c0, 4 @ MPUIR
208 ands r5, r0, #MPUIR_DREGION_SZMASK @ 0 size d region => No MPU
209 beq __error_p @ Fail: ARM_MPU and no MPU
210 tst r0, #MPUIR_nU @ MPUIR_nU = 0 for unified
211
212 /* Setup second region first to free up r6 */
213 set_region_nr r0, #MPU_RAM_REGION
214 isb
215 /* Full access from PL0, PL1, shared for CONFIG_SMP, cacheable */
216 ldr r0, =PHYS_OFFSET @ RAM starts at PHYS_OFFSET
217 ldr r5,=(MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL)
218
219 setup_region r0, r5, r6, MPU_DATA_SIDE @ PHYS_OFFSET, shared, enabled
220 beq 1f @ Memory-map not unified
221 setup_region r0, r5, r6, MPU_INSTR_SIDE @ PHYS_OFFSET, shared, enabled
2221: isb
223
224 /* First/background region */
225 set_region_nr r0, #MPU_BG_REGION
226 isb
227 /* Execute Never, strongly ordered, inaccessible to PL0, rw PL1 */
228 mov r0, #0 @ BG region starts at 0x0
229 ldr r5,=(MPU_ACR_XN | MPU_RGN_STRONGLY_ORDERED | MPU_AP_PL1RW_PL0NA)
230 mov r6, #MPU_RSR_ALL_MEM @ 4GB region, enabled
231
232 setup_region r0, r5, r6, MPU_DATA_SIDE @ 0x0, BG region, enabled
233 beq 2f @ Memory-map not unified
234 setup_region r0, r5, r6, MPU_INSTR_SIDE @ 0x0, BG region, enabled
2352: isb
236
237 /* Vectors region */
238 set_region_nr r0, #MPU_VECTORS_REGION
239 isb
240 /* Shared, inaccessible to PL0, rw PL1 */
241 mov r0, #CONFIG_VECTORS_BASE @ Cover from VECTORS_BASE
242 ldr r5,=(MPU_AP_PL1RW_PL0NA | MPU_RGN_NORMAL)
243 /* Writing N to bits 5:1 (RSR_SZ) --> region size 2^N+1 */
244 mov r6, #(((PAGE_SHIFT - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN)
245
246 setup_region r0, r5, r6, MPU_DATA_SIDE @ VECTORS_BASE, PL0 NA, enabled
247 beq 3f @ Memory-map not unified
248 setup_region r0, r5, r6, MPU_INSTR_SIDE @ VECTORS_BASE, PL0 NA, enabled
2493: isb
250
251 /* Enable the MPU */
252 mrc p15, 0, r0, c1, c0, 0 @ Read SCTLR
253 bic r0, r0, #CR_BR @ Disable the 'default mem-map'
254 orr r0, r0, #CR_M @ Set SCTRL.M (MPU on)
255 mcr p15, 0, r0, c1, c0, 0 @ Enable MPU
256 isb
257 mov pc,lr
258ENDPROC(__setup_mpu)
259#endif
104#include "head-common.S" 260#include "head-common.S"
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 8bac553fe213..45e8935cae4e 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -156,7 +156,7 @@ ENDPROC(stext)
156 * 156 *
157 * Returns: 157 * Returns:
158 * r0, r3, r5-r7 corrupted 158 * r0, r3, r5-r7 corrupted
159 * r4 = physical page table address 159 * r4 = page table (see ARCH_PGD_SHIFT in asm/memory.h)
160 */ 160 */
161__create_page_tables: 161__create_page_tables:
162 pgtbl r4, r8 @ page table address 162 pgtbl r4, r8 @ page table address
@@ -331,6 +331,7 @@ __create_page_tables:
331#endif 331#endif
332#ifdef CONFIG_ARM_LPAE 332#ifdef CONFIG_ARM_LPAE
333 sub r4, r4, #0x1000 @ point to the PGD table 333 sub r4, r4, #0x1000 @ point to the PGD table
334 mov r4, r4, lsr #ARCH_PGD_SHIFT
334#endif 335#endif
335 mov pc, lr 336 mov pc, lr
336ENDPROC(__create_page_tables) 337ENDPROC(__create_page_tables)
@@ -408,7 +409,7 @@ __secondary_data:
408 * r0 = cp#15 control register 409 * r0 = cp#15 control register
409 * r1 = machine ID 410 * r1 = machine ID
410 * r2 = atags or dtb pointer 411 * r2 = atags or dtb pointer
411 * r4 = page table pointer 412 * r4 = page table (see ARCH_PGD_SHIFT in asm/memory.h)
412 * r9 = processor ID 413 * r9 = processor ID
413 * r13 = *virtual* address to jump to upon completion 414 * r13 = *virtual* address to jump to upon completion
414 */ 415 */
@@ -427,10 +428,7 @@ __enable_mmu:
427#ifdef CONFIG_CPU_ICACHE_DISABLE 428#ifdef CONFIG_CPU_ICACHE_DISABLE
428 bic r0, r0, #CR_I 429 bic r0, r0, #CR_I
429#endif 430#endif
430#ifdef CONFIG_ARM_LPAE 431#ifndef CONFIG_ARM_LPAE
431 mov r5, #0
432 mcrr p15, 0, r4, r5, c2 @ load TTBR0
433#else
434 mov r5, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ 432 mov r5, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \
435 domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ 433 domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
436 domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \ 434 domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \
diff --git a/arch/arm/kernel/hyp-stub.S b/arch/arm/kernel/hyp-stub.S
index 1315c4ccfa56..4910232c4833 100644
--- a/arch/arm/kernel/hyp-stub.S
+++ b/arch/arm/kernel/hyp-stub.S
@@ -153,6 +153,13 @@ THUMB( orr r7, #(1 << 30) ) @ HSCTLR.TE
153 mrc p15, 4, r7, c14, c1, 0 @ CNTHCTL 153 mrc p15, 4, r7, c14, c1, 0 @ CNTHCTL
154 orr r7, r7, #3 @ PL1PCEN | PL1PCTEN 154 orr r7, r7, #3 @ PL1PCEN | PL1PCTEN
155 mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL 155 mcr p15, 4, r7, c14, c1, 0 @ CNTHCTL
156 mov r7, #0
157 mcrr p15, 4, r7, r7, c14 @ CNTVOFF
158
159 @ Disable virtual timer in case it was counting
160 mrc p15, 0, r7, c14, c3, 1 @ CNTV_CTL
161 bic r7, #1 @ Clear ENABLE
162 mcr p15, 0, r7, c14, c3, 1 @ CNTV_CTL
1561: 1631:
157#endif 164#endif
158 165
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 8ef8c9337809..4fb074c446bf 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -134,6 +134,10 @@ void machine_kexec(struct kimage *image)
134 unsigned long reboot_code_buffer_phys; 134 unsigned long reboot_code_buffer_phys;
135 void *reboot_code_buffer; 135 void *reboot_code_buffer;
136 136
137 if (num_online_cpus() > 1) {
138 pr_err("kexec: error: multiple CPUs still online\n");
139 return;
140 }
137 141
138 page_list = image->head & PAGE_MASK; 142 page_list = image->head & PAGE_MASK;
139 143
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 1e9be5d25e56..85c3fb6c93c2 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -288,24 +288,16 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
288 288
289 if (strcmp(".ARM.exidx.init.text", secname) == 0) 289 if (strcmp(".ARM.exidx.init.text", secname) == 0)
290 maps[ARM_SEC_INIT].unw_sec = s; 290 maps[ARM_SEC_INIT].unw_sec = s;
291 else if (strcmp(".ARM.exidx.devinit.text", secname) == 0)
292 maps[ARM_SEC_DEVINIT].unw_sec = s;
293 else if (strcmp(".ARM.exidx", secname) == 0) 291 else if (strcmp(".ARM.exidx", secname) == 0)
294 maps[ARM_SEC_CORE].unw_sec = s; 292 maps[ARM_SEC_CORE].unw_sec = s;
295 else if (strcmp(".ARM.exidx.exit.text", secname) == 0) 293 else if (strcmp(".ARM.exidx.exit.text", secname) == 0)
296 maps[ARM_SEC_EXIT].unw_sec = s; 294 maps[ARM_SEC_EXIT].unw_sec = s;
297 else if (strcmp(".ARM.exidx.devexit.text", secname) == 0)
298 maps[ARM_SEC_DEVEXIT].unw_sec = s;
299 else if (strcmp(".init.text", secname) == 0) 295 else if (strcmp(".init.text", secname) == 0)
300 maps[ARM_SEC_INIT].txt_sec = s; 296 maps[ARM_SEC_INIT].txt_sec = s;
301 else if (strcmp(".devinit.text", secname) == 0)
302 maps[ARM_SEC_DEVINIT].txt_sec = s;
303 else if (strcmp(".text", secname) == 0) 297 else if (strcmp(".text", secname) == 0)
304 maps[ARM_SEC_CORE].txt_sec = s; 298 maps[ARM_SEC_CORE].txt_sec = s;
305 else if (strcmp(".exit.text", secname) == 0) 299 else if (strcmp(".exit.text", secname) == 0)
306 maps[ARM_SEC_EXIT].txt_sec = s; 300 maps[ARM_SEC_EXIT].txt_sec = s;
307 else if (strcmp(".devexit.text", secname) == 0)
308 maps[ARM_SEC_DEVEXIT].txt_sec = s;
309 } 301 }
310 302
311 for (i = 0; i < ARM_SEC_MAX; i++) 303 for (i = 0; i < ARM_SEC_MAX; i++)
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 8c3094d0f7b7..d9f5cd4e533f 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -569,6 +569,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
569 return; 569 return;
570 } 570 }
571 571
572 perf_callchain_store(entry, regs->ARM_pc);
572 tail = (struct frame_tail __user *)regs->ARM_fp - 1; 573 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
573 574
574 while ((entry->nr < PERF_MAX_STACK_DEPTH) && 575 while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 282de4826abb..7f1efcd4a6e9 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -39,6 +39,7 @@
39#include <asm/thread_notify.h> 39#include <asm/thread_notify.h>
40#include <asm/stacktrace.h> 40#include <asm/stacktrace.h>
41#include <asm/mach/time.h> 41#include <asm/mach/time.h>
42#include <asm/tls.h>
42 43
43#ifdef CONFIG_CC_STACKPROTECTOR 44#ifdef CONFIG_CC_STACKPROTECTOR
44#include <linux/stackprotector.h> 45#include <linux/stackprotector.h>
@@ -184,30 +185,61 @@ int __init reboot_setup(char *str)
184 185
185__setup("reboot=", reboot_setup); 186__setup("reboot=", reboot_setup);
186 187
188/*
189 * Called by kexec, immediately prior to machine_kexec().
190 *
191 * This must completely disable all secondary CPUs; simply causing those CPUs
192 * to execute e.g. a RAM-based pin loop is not sufficient. This allows the
193 * kexec'd kernel to use any and all RAM as it sees fit, without having to
194 * avoid any code or data used by any SW CPU pin loop. The CPU hotplug
195 * functionality embodied in disable_nonboot_cpus() to achieve this.
196 */
187void machine_shutdown(void) 197void machine_shutdown(void)
188{ 198{
189#ifdef CONFIG_SMP 199 disable_nonboot_cpus();
190 smp_send_stop();
191#endif
192} 200}
193 201
202/*
203 * Halting simply requires that the secondary CPUs stop performing any
204 * activity (executing tasks, handling interrupts). smp_send_stop()
205 * achieves this.
206 */
194void machine_halt(void) 207void machine_halt(void)
195{ 208{
196 machine_shutdown(); 209 smp_send_stop();
210
197 local_irq_disable(); 211 local_irq_disable();
198 while (1); 212 while (1);
199} 213}
200 214
215/*
216 * Power-off simply requires that the secondary CPUs stop performing any
217 * activity (executing tasks, handling interrupts). smp_send_stop()
218 * achieves this. When the system power is turned off, it will take all CPUs
219 * with it.
220 */
201void machine_power_off(void) 221void machine_power_off(void)
202{ 222{
203 machine_shutdown(); 223 smp_send_stop();
224
204 if (pm_power_off) 225 if (pm_power_off)
205 pm_power_off(); 226 pm_power_off();
206} 227}
207 228
229/*
230 * Restart requires that the secondary CPUs stop performing any activity
231 * while the primary CPU resets the system. Systems with a single CPU can
232 * use soft_restart() as their machine descriptor's .restart hook, since that
233 * will cause the only available CPU to reset. Systems with multiple CPUs must
234 * provide a HW restart implementation, to ensure that all CPUs reset at once.
235 * This is required so that any code running after reset on the primary CPU
236 * doesn't have to co-ordinate with other CPUs to ensure they aren't still
237 * executing pre-reset code, and using RAM that the primary CPU's code wishes
238 * to use. Implementing such co-ordination would be essentially impossible.
239 */
208void machine_restart(char *cmd) 240void machine_restart(char *cmd)
209{ 241{
210 machine_shutdown(); 242 smp_send_stop();
211 243
212 arm_pm_restart(reboot_mode, cmd); 244 arm_pm_restart(reboot_mode, cmd);
213 245
@@ -343,7 +375,8 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
343 clear_ptrace_hw_breakpoint(p); 375 clear_ptrace_hw_breakpoint(p);
344 376
345 if (clone_flags & CLONE_SETTLS) 377 if (clone_flags & CLONE_SETTLS)
346 thread->tp_value = childregs->ARM_r3; 378 thread->tp_value[0] = childregs->ARM_r3;
379 thread->tp_value[1] = get_tpuser();
347 380
348 thread_notify(THREAD_NOTIFY_COPY, thread); 381 thread_notify(THREAD_NOTIFY_COPY, thread);
349 382
diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
index 36531643cc2c..46931880093d 100644
--- a/arch/arm/kernel/psci.c
+++ b/arch/arm/kernel/psci.c
@@ -158,7 +158,7 @@ static const struct of_device_id psci_of_match[] __initconst = {
158 {}, 158 {},
159}; 159};
160 160
161static int __init psci_init(void) 161void __init psci_init(void)
162{ 162{
163 struct device_node *np; 163 struct device_node *np;
164 const char *method; 164 const char *method;
@@ -166,7 +166,7 @@ static int __init psci_init(void)
166 166
167 np = of_find_matching_node(NULL, psci_of_match); 167 np = of_find_matching_node(NULL, psci_of_match);
168 if (!np) 168 if (!np)
169 return 0; 169 return;
170 170
171 pr_info("probing function IDs from device-tree\n"); 171 pr_info("probing function IDs from device-tree\n");
172 172
@@ -206,6 +206,5 @@ static int __init psci_init(void)
206 206
207out_put_node: 207out_put_node:
208 of_node_put(np); 208 of_node_put(np);
209 return 0; 209 return;
210} 210}
211early_initcall(psci_init);
diff --git a/arch/arm/kernel/psci_smp.c b/arch/arm/kernel/psci_smp.c
new file mode 100644
index 000000000000..219f1d73572a
--- /dev/null
+++ b/arch/arm/kernel/psci_smp.c
@@ -0,0 +1,84 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2012 ARM Limited
12 *
13 * Author: Will Deacon <will.deacon@arm.com>
14 */
15
16#include <linux/init.h>
17#include <linux/irqchip/arm-gic.h>
18#include <linux/smp.h>
19#include <linux/of.h>
20
21#include <asm/psci.h>
22#include <asm/smp_plat.h>
23
24/*
25 * psci_smp assumes that the following is true about PSCI:
26 *
27 * cpu_suspend Suspend the execution on a CPU
28 * @state we don't currently describe affinity levels, so just pass 0.
29 * @entry_point the first instruction to be executed on return
30 * returns 0 success, < 0 on failure
31 *
32 * cpu_off Power down a CPU
33 * @state we don't currently describe affinity levels, so just pass 0.
34 * no return on successful call
35 *
36 * cpu_on Power up a CPU
37 * @cpuid cpuid of target CPU, as from MPIDR
38 * @entry_point the first instruction to be executed on return
39 * returns 0 success, < 0 on failure
40 *
41 * migrate Migrate the context to a different CPU
42 * @cpuid cpuid of target CPU, as from MPIDR
43 * returns 0 success, < 0 on failure
44 *
45 */
46
47extern void secondary_startup(void);
48
49static int __cpuinit psci_boot_secondary(unsigned int cpu,
50 struct task_struct *idle)
51{
52 if (psci_ops.cpu_on)
53 return psci_ops.cpu_on(cpu_logical_map(cpu),
54 __pa(secondary_startup));
55 return -ENODEV;
56}
57
58#ifdef CONFIG_HOTPLUG_CPU
59void __ref psci_cpu_die(unsigned int cpu)
60{
61 const struct psci_power_state ps = {
62 .type = PSCI_POWER_STATE_TYPE_POWER_DOWN,
63 };
64
65 if (psci_ops.cpu_off)
66 psci_ops.cpu_off(ps);
67
68 /* We should never return */
69 panic("psci: cpu %d failed to shutdown\n", cpu);
70}
71#endif
72
73bool __init psci_smp_available(void)
74{
75 /* is cpu_on available at least? */
76 return (psci_ops.cpu_on != NULL);
77}
78
79struct smp_operations __initdata psci_smp_ops = {
80 .smp_boot_secondary = psci_boot_secondary,
81#ifdef CONFIG_HOTPLUG_CPU
82 .cpu_die = psci_cpu_die,
83#endif
84};
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 03deeffd9f6d..2bc1514d6dbe 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -849,7 +849,7 @@ long arch_ptrace(struct task_struct *child, long request,
849#endif 849#endif
850 850
851 case PTRACE_GET_THREAD_AREA: 851 case PTRACE_GET_THREAD_AREA:
852 ret = put_user(task_thread_info(child)->tp_value, 852 ret = put_user(task_thread_info(child)->tp_value[0],
853 datap); 853 datap);
854 break; 854 break;
855 855
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1522c7ae31b0..9b653278c9e8 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -37,6 +37,7 @@
37#include <asm/cputype.h> 37#include <asm/cputype.h>
38#include <asm/elf.h> 38#include <asm/elf.h>
39#include <asm/procinfo.h> 39#include <asm/procinfo.h>
40#include <asm/psci.h>
40#include <asm/sections.h> 41#include <asm/sections.h>
41#include <asm/setup.h> 42#include <asm/setup.h>
42#include <asm/smp_plat.h> 43#include <asm/smp_plat.h>
@@ -128,7 +129,9 @@ struct stack {
128 u32 und[3]; 129 u32 und[3];
129} ____cacheline_aligned; 130} ____cacheline_aligned;
130 131
132#ifndef CONFIG_CPU_V7M
131static struct stack stacks[NR_CPUS]; 133static struct stack stacks[NR_CPUS];
134#endif
132 135
133char elf_platform[ELF_PLATFORM_SIZE]; 136char elf_platform[ELF_PLATFORM_SIZE];
134EXPORT_SYMBOL(elf_platform); 137EXPORT_SYMBOL(elf_platform);
@@ -207,7 +210,7 @@ static const char *proc_arch[] = {
207 "5TEJ", 210 "5TEJ",
208 "6TEJ", 211 "6TEJ",
209 "7", 212 "7",
210 "?(11)", 213 "7M",
211 "?(12)", 214 "?(12)",
212 "?(13)", 215 "?(13)",
213 "?(14)", 216 "?(14)",
@@ -216,6 +219,12 @@ static const char *proc_arch[] = {
216 "?(17)", 219 "?(17)",
217}; 220};
218 221
222#ifdef CONFIG_CPU_V7M
223static int __get_cpu_architecture(void)
224{
225 return CPU_ARCH_ARMv7M;
226}
227#else
219static int __get_cpu_architecture(void) 228static int __get_cpu_architecture(void)
220{ 229{
221 int cpu_arch; 230 int cpu_arch;
@@ -248,6 +257,7 @@ static int __get_cpu_architecture(void)
248 257
249 return cpu_arch; 258 return cpu_arch;
250} 259}
260#endif
251 261
252int __pure cpu_architecture(void) 262int __pure cpu_architecture(void)
253{ 263{
@@ -293,7 +303,9 @@ static void __init cacheid_init(void)
293{ 303{
294 unsigned int arch = cpu_architecture(); 304 unsigned int arch = cpu_architecture();
295 305
296 if (arch >= CPU_ARCH_ARMv6) { 306 if (arch == CPU_ARCH_ARMv7M) {
307 cacheid = 0;
308 } else if (arch >= CPU_ARCH_ARMv6) {
297 unsigned int cachetype = read_cpuid_cachetype(); 309 unsigned int cachetype = read_cpuid_cachetype();
298 if ((cachetype & (7 << 29)) == 4 << 29) { 310 if ((cachetype & (7 << 29)) == 4 << 29) {
299 /* ARMv7 register format */ 311 /* ARMv7 register format */
@@ -355,7 +367,7 @@ void __init early_print(const char *str, ...)
355 367
356static void __init cpuid_init_hwcaps(void) 368static void __init cpuid_init_hwcaps(void)
357{ 369{
358 unsigned int divide_instrs; 370 unsigned int divide_instrs, vmsa;
359 371
360 if (cpu_architecture() < CPU_ARCH_ARMv7) 372 if (cpu_architecture() < CPU_ARCH_ARMv7)
361 return; 373 return;
@@ -368,6 +380,11 @@ static void __init cpuid_init_hwcaps(void)
368 case 1: 380 case 1:
369 elf_hwcap |= HWCAP_IDIVT; 381 elf_hwcap |= HWCAP_IDIVT;
370 } 382 }
383
384 /* LPAE implies atomic ldrd/strd instructions */
385 vmsa = (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xf) >> 0;
386 if (vmsa >= 5)
387 elf_hwcap |= HWCAP_LPAE;
371} 388}
372 389
373static void __init feat_v6_fixup(void) 390static void __init feat_v6_fixup(void)
@@ -392,6 +409,7 @@ static void __init feat_v6_fixup(void)
392 */ 409 */
393void notrace cpu_init(void) 410void notrace cpu_init(void)
394{ 411{
412#ifndef CONFIG_CPU_V7M
395 unsigned int cpu = smp_processor_id(); 413 unsigned int cpu = smp_processor_id();
396 struct stack *stk = &stacks[cpu]; 414 struct stack *stk = &stacks[cpu];
397 415
@@ -442,9 +460,10 @@ void notrace cpu_init(void)
442 "I" (offsetof(struct stack, und[0])), 460 "I" (offsetof(struct stack, und[0])),
443 PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) 461 PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
444 : "r14"); 462 : "r14");
463#endif
445} 464}
446 465
447int __cpu_logical_map[NR_CPUS]; 466u32 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
448 467
449void __init smp_setup_processor_id(void) 468void __init smp_setup_processor_id(void)
450{ 469{
@@ -456,9 +475,82 @@ void __init smp_setup_processor_id(void)
456 for (i = 1; i < nr_cpu_ids; ++i) 475 for (i = 1; i < nr_cpu_ids; ++i)
457 cpu_logical_map(i) = i == cpu ? 0 : i; 476 cpu_logical_map(i) = i == cpu ? 0 : i;
458 477
478 /*
479 * clear __my_cpu_offset on boot CPU to avoid hang caused by
480 * using percpu variable early, for example, lockdep will
481 * access percpu variable inside lock_release
482 */
483 set_my_cpu_offset(0);
484
459 printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr); 485 printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr);
460} 486}
461 487
488struct mpidr_hash mpidr_hash;
489#ifdef CONFIG_SMP
490/**
491 * smp_build_mpidr_hash - Pre-compute shifts required at each affinity
492 * level in order to build a linear index from an
493 * MPIDR value. Resulting algorithm is a collision
494 * free hash carried out through shifting and ORing
495 */
496static void __init smp_build_mpidr_hash(void)
497{
498 u32 i, affinity;
499 u32 fs[3], bits[3], ls, mask = 0;
500 /*
501 * Pre-scan the list of MPIDRS and filter out bits that do
502 * not contribute to affinity levels, ie they never toggle.
503 */
504 for_each_possible_cpu(i)
505 mask |= (cpu_logical_map(i) ^ cpu_logical_map(0));
506 pr_debug("mask of set bits 0x%x\n", mask);
507 /*
508 * Find and stash the last and first bit set at all affinity levels to
509 * check how many bits are required to represent them.
510 */
511 for (i = 0; i < 3; i++) {
512 affinity = MPIDR_AFFINITY_LEVEL(mask, i);
513 /*
514 * Find the MSB bit and LSB bits position
515 * to determine how many bits are required
516 * to express the affinity level.
517 */
518 ls = fls(affinity);
519 fs[i] = affinity ? ffs(affinity) - 1 : 0;
520 bits[i] = ls - fs[i];
521 }
522 /*
523 * An index can be created from the MPIDR by isolating the
524 * significant bits at each affinity level and by shifting
525 * them in order to compress the 24 bits values space to a
526 * compressed set of values. This is equivalent to hashing
527 * the MPIDR through shifting and ORing. It is a collision free
528 * hash though not minimal since some levels might contain a number
529 * of CPUs that is not an exact power of 2 and their bit
530 * representation might contain holes, eg MPIDR[7:0] = {0x2, 0x80}.
531 */
532 mpidr_hash.shift_aff[0] = fs[0];
533 mpidr_hash.shift_aff[1] = MPIDR_LEVEL_BITS + fs[1] - bits[0];
534 mpidr_hash.shift_aff[2] = 2*MPIDR_LEVEL_BITS + fs[2] -
535 (bits[1] + bits[0]);
536 mpidr_hash.mask = mask;
537 mpidr_hash.bits = bits[2] + bits[1] + bits[0];
538 pr_debug("MPIDR hash: aff0[%u] aff1[%u] aff2[%u] mask[0x%x] bits[%u]\n",
539 mpidr_hash.shift_aff[0],
540 mpidr_hash.shift_aff[1],
541 mpidr_hash.shift_aff[2],
542 mpidr_hash.mask,
543 mpidr_hash.bits);
544 /*
545 * 4x is an arbitrary value used to warn on a hash table much bigger
546 * than expected on most systems.
547 */
548 if (mpidr_hash_size() > 4 * num_possible_cpus())
549 pr_warn("Large number of MPIDR hash buckets detected\n");
550 sync_cache_w(&mpidr_hash);
551}
552#endif
553
462static void __init setup_processor(void) 554static void __init setup_processor(void)
463{ 555{
464 struct proc_info_list *list; 556 struct proc_info_list *list;
@@ -796,10 +888,17 @@ void __init setup_arch(char **cmdline_p)
796 unflatten_device_tree(); 888 unflatten_device_tree();
797 889
798 arm_dt_init_cpu_maps(); 890 arm_dt_init_cpu_maps();
891 psci_init();
799#ifdef CONFIG_SMP 892#ifdef CONFIG_SMP
800 if (is_smp()) { 893 if (is_smp()) {
801 smp_set_ops(mdesc->smp); 894 if (!mdesc->smp_init || !mdesc->smp_init()) {
895 if (psci_smp_available())
896 smp_set_ops(&psci_smp_ops);
897 else if (mdesc->smp)
898 smp_set_ops(mdesc->smp);
899 }
802 smp_init_cpus(); 900 smp_init_cpus();
901 smp_build_mpidr_hash();
803 } 902 }
804#endif 903#endif
805 904
@@ -872,6 +971,7 @@ static const char *hwcap_str[] = {
872 "vfpv4", 971 "vfpv4",
873 "idiva", 972 "idiva",
874 "idivt", 973 "idivt",
974 "lpae",
875 NULL 975 NULL
876}; 976};
877 977
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 296786bdbb73..1c16c35c271a 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -392,14 +392,19 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig,
392 if (ksig->ka.sa.sa_flags & SA_SIGINFO) 392 if (ksig->ka.sa.sa_flags & SA_SIGINFO)
393 idx += 3; 393 idx += 3;
394 394
395 /*
396 * Put the sigreturn code on the stack no matter which return
397 * mechanism we use in order to remain ABI compliant
398 */
395 if (__put_user(sigreturn_codes[idx], rc) || 399 if (__put_user(sigreturn_codes[idx], rc) ||
396 __put_user(sigreturn_codes[idx+1], rc+1)) 400 __put_user(sigreturn_codes[idx+1], rc+1))
397 return 1; 401 return 1;
398 402
399 if (cpsr & MODE32_BIT) { 403 if ((cpsr & MODE32_BIT) && !IS_ENABLED(CONFIG_ARM_MPU)) {
400 /* 404 /*
401 * 32-bit code can use the new high-page 405 * 32-bit code can use the new high-page
402 * signal return code support. 406 * signal return code support except when the MPU has
407 * protected the vectors page from PL0
403 */ 408 */
404 retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb; 409 retcode = KERN_SIGRETURN_CODE + (idx << 2) + thumb;
405 } else { 410 } else {
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
index 987dcf33415c..db1536b8b30b 100644
--- a/arch/arm/kernel/sleep.S
+++ b/arch/arm/kernel/sleep.S
@@ -7,6 +7,49 @@
7 .text 7 .text
8 8
9/* 9/*
10 * Implementation of MPIDR hash algorithm through shifting
11 * and OR'ing.
12 *
13 * @dst: register containing hash result
14 * @rs0: register containing affinity level 0 bit shift
15 * @rs1: register containing affinity level 1 bit shift
16 * @rs2: register containing affinity level 2 bit shift
17 * @mpidr: register containing MPIDR value
18 * @mask: register containing MPIDR mask
19 *
20 * Pseudo C-code:
21 *
22 *u32 dst;
23 *
24 *compute_mpidr_hash(u32 rs0, u32 rs1, u32 rs2, u32 mpidr, u32 mask) {
25 * u32 aff0, aff1, aff2;
26 * u32 mpidr_masked = mpidr & mask;
27 * aff0 = mpidr_masked & 0xff;
28 * aff1 = mpidr_masked & 0xff00;
29 * aff2 = mpidr_masked & 0xff0000;
30 * dst = (aff0 >> rs0 | aff1 >> rs1 | aff2 >> rs2);
31 *}
32 * Input registers: rs0, rs1, rs2, mpidr, mask
33 * Output register: dst
34 * Note: input and output registers must be disjoint register sets
35 (eg: a macro instance with mpidr = r1 and dst = r1 is invalid)
36 */
37 .macro compute_mpidr_hash dst, rs0, rs1, rs2, mpidr, mask
38 and \mpidr, \mpidr, \mask @ mask out MPIDR bits
39 and \dst, \mpidr, #0xff @ mask=aff0
40 ARM( mov \dst, \dst, lsr \rs0 ) @ dst=aff0>>rs0
41 THUMB( lsr \dst, \dst, \rs0 )
42 and \mask, \mpidr, #0xff00 @ mask = aff1
43 ARM( orr \dst, \dst, \mask, lsr \rs1 ) @ dst|=(aff1>>rs1)
44 THUMB( lsr \mask, \mask, \rs1 )
45 THUMB( orr \dst, \dst, \mask )
46 and \mask, \mpidr, #0xff0000 @ mask = aff2
47 ARM( orr \dst, \dst, \mask, lsr \rs2 ) @ dst|=(aff2>>rs2)
48 THUMB( lsr \mask, \mask, \rs2 )
49 THUMB( orr \dst, \dst, \mask )
50 .endm
51
52/*
10 * Save CPU state for a suspend. This saves the CPU general purpose 53 * Save CPU state for a suspend. This saves the CPU general purpose
11 * registers, and allocates space on the kernel stack to save the CPU 54 * registers, and allocates space on the kernel stack to save the CPU
12 * specific registers and some other data for resume. 55 * specific registers and some other data for resume.
@@ -29,12 +72,18 @@ ENTRY(__cpu_suspend)
29 mov r1, r4 @ size of save block 72 mov r1, r4 @ size of save block
30 mov r2, r5 @ virtual SP 73 mov r2, r5 @ virtual SP
31 ldr r3, =sleep_save_sp 74 ldr r3, =sleep_save_sp
32#ifdef CONFIG_SMP 75 ldr r3, [r3, #SLEEP_SAVE_SP_VIRT]
33 ALT_SMP(mrc p15, 0, lr, c0, c0, 5) 76 ALT_SMP(mrc p15, 0, r9, c0, c0, 5)
34 ALT_UP(mov lr, #0) 77 ALT_UP_B(1f)
35 and lr, lr, #15 78 ldr r8, =mpidr_hash
79 /*
80 * This ldmia relies on the memory layout of the mpidr_hash
81 * struct mpidr_hash.
82 */
83 ldmia r8, {r4-r7} @ r4 = mpidr mask (r5,r6,r7) = l[0,1,2] shifts
84 compute_mpidr_hash lr, r5, r6, r7, r9, r4
36 add r3, r3, lr, lsl #2 85 add r3, r3, lr, lsl #2
37#endif 861:
38 bl __cpu_suspend_save 87 bl __cpu_suspend_save
39 adr lr, BSYM(cpu_suspend_abort) 88 adr lr, BSYM(cpu_suspend_abort)
40 ldmfd sp!, {r0, pc} @ call suspend fn 89 ldmfd sp!, {r0, pc} @ call suspend fn
@@ -81,15 +130,23 @@ ENDPROC(cpu_resume_after_mmu)
81 .data 130 .data
82 .align 131 .align
83ENTRY(cpu_resume) 132ENTRY(cpu_resume)
84#ifdef CONFIG_SMP 133 mov r1, #0
85 adr r0, sleep_save_sp 134 ALT_SMP(mrc p15, 0, r0, c0, c0, 5)
86 ALT_SMP(mrc p15, 0, r1, c0, c0, 5) 135 ALT_UP_B(1f)
87 ALT_UP(mov r1, #0) 136 adr r2, mpidr_hash_ptr
88 and r1, r1, #15 137 ldr r3, [r2]
89 ldr r0, [r0, r1, lsl #2] @ stack phys addr 138 add r2, r2, r3 @ r2 = struct mpidr_hash phys address
90#else 139 /*
91 ldr r0, sleep_save_sp @ stack phys addr 140 * This ldmia relies on the memory layout of the mpidr_hash
92#endif 141 * struct mpidr_hash.
142 */
143 ldmia r2, { r3-r6 } @ r3 = mpidr mask (r4,r5,r6) = l[0,1,2] shifts
144 compute_mpidr_hash r1, r4, r5, r6, r0, r3
1451:
146 adr r0, _sleep_save_sp
147 ldr r0, [r0, #SLEEP_SAVE_SP_PHYS]
148 ldr r0, [r0, r1, lsl #2]
149
93 setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1 @ set SVC, irqs off 150 setmode PSR_I_BIT | PSR_F_BIT | SVC_MODE, r1 @ set SVC, irqs off
94 @ load phys pgd, stack, resume fn 151 @ load phys pgd, stack, resume fn
95 ARM( ldmia r0!, {r1, sp, pc} ) 152 ARM( ldmia r0!, {r1, sp, pc} )
@@ -98,7 +155,11 @@ THUMB( mov sp, r2 )
98THUMB( bx r3 ) 155THUMB( bx r3 )
99ENDPROC(cpu_resume) 156ENDPROC(cpu_resume)
100 157
101sleep_save_sp: 158 .align 2
102 .rept CONFIG_NR_CPUS 159mpidr_hash_ptr:
103 .long 0 @ preserve stack phys ptr here 160 .long mpidr_hash - . @ mpidr_hash struct offset
104 .endr 161
162 .type sleep_save_sp, #object
163ENTRY(sleep_save_sp)
164_sleep_save_sp:
165 .space SLEEP_SAVE_SP_SZ @ struct sleep_save_sp
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 550d63cef68e..c5fb5469054b 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -45,6 +45,7 @@
45#include <asm/smp_plat.h> 45#include <asm/smp_plat.h>
46#include <asm/virt.h> 46#include <asm/virt.h>
47#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
48#include <asm/mpu.h>
48 49
49/* 50/*
50 * as from 2.5, kernels no longer have an init_tasks structure 51 * as from 2.5, kernels no longer have an init_tasks structure
@@ -78,6 +79,13 @@ void __init smp_set_ops(struct smp_operations *ops)
78 smp_ops = *ops; 79 smp_ops = *ops;
79}; 80};
80 81
82static unsigned long get_arch_pgd(pgd_t *pgd)
83{
84 phys_addr_t pgdir = virt_to_phys(pgd);
85 BUG_ON(pgdir & ARCH_PGD_MASK);
86 return pgdir >> ARCH_PGD_SHIFT;
87}
88
81int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 89int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
82{ 90{
83 int ret; 91 int ret;
@@ -87,8 +95,14 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
87 * its stack and the page tables. 95 * its stack and the page tables.
88 */ 96 */
89 secondary_data.stack = task_stack_page(idle) + THREAD_START_SP; 97 secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
90 secondary_data.pgdir = virt_to_phys(idmap_pgd); 98#ifdef CONFIG_ARM_MPU
91 secondary_data.swapper_pg_dir = virt_to_phys(swapper_pg_dir); 99 secondary_data.mpu_rgn_szr = mpu_rgn_info.rgns[MPU_RAM_REGION].drsr;
100#endif
101
102#ifdef CONFIG_MMU
103 secondary_data.pgdir = get_arch_pgd(idmap_pgd);
104 secondary_data.swapper_pg_dir = get_arch_pgd(swapper_pg_dir);
105#endif
92 __cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data)); 106 __cpuc_flush_dcache_area(&secondary_data, sizeof(secondary_data));
93 outer_clean_range(__pa(&secondary_data), __pa(&secondary_data + 1)); 107 outer_clean_range(__pa(&secondary_data), __pa(&secondary_data + 1));
94 108
@@ -112,9 +126,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
112 pr_err("CPU%u: failed to boot: %d\n", cpu, ret); 126 pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
113 } 127 }
114 128
115 secondary_data.stack = NULL;
116 secondary_data.pgdir = 0;
117 129
130 memset(&secondary_data, 0, sizeof(secondary_data));
118 return ret; 131 return ret;
119} 132}
120 133
@@ -651,17 +664,6 @@ void smp_send_reschedule(int cpu)
651 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); 664 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE);
652} 665}
653 666
654#ifdef CONFIG_HOTPLUG_CPU
655static void smp_kill_cpus(cpumask_t *mask)
656{
657 unsigned int cpu;
658 for_each_cpu(cpu, mask)
659 platform_cpu_kill(cpu);
660}
661#else
662static void smp_kill_cpus(cpumask_t *mask) { }
663#endif
664
665void smp_send_stop(void) 667void smp_send_stop(void)
666{ 668{
667 unsigned long timeout; 669 unsigned long timeout;
@@ -679,8 +681,6 @@ void smp_send_stop(void)
679 681
680 if (num_online_cpus() > 1) 682 if (num_online_cpus() > 1)
681 pr_warning("SMP: failed to stop secondary CPUs\n"); 683 pr_warning("SMP: failed to stop secondary CPUs\n");
682
683 smp_kill_cpus(&mask);
684} 684}
685 685
686/* 686/*
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index 9a52a07aa40e..a98b62dca2fa 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -103,7 +103,7 @@ static void broadcast_tlb_a15_erratum(void)
103 103
104static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm) 104static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
105{ 105{
106 int cpu, this_cpu; 106 int this_cpu;
107 cpumask_t mask = { CPU_BITS_NONE }; 107 cpumask_t mask = { CPU_BITS_NONE };
108 108
109 if (!erratum_a15_798181()) 109 if (!erratum_a15_798181())
@@ -111,21 +111,7 @@ static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
111 111
112 dummy_flush_tlb_a15_erratum(); 112 dummy_flush_tlb_a15_erratum();
113 this_cpu = get_cpu(); 113 this_cpu = get_cpu();
114 for_each_online_cpu(cpu) { 114 a15_erratum_get_cpumask(this_cpu, mm, &mask);
115 if (cpu == this_cpu)
116 continue;
117 /*
118 * We only need to send an IPI if the other CPUs are running
119 * the same ASID as the one being invalidated. There is no
120 * need for locking around the active_asids check since the
121 * switch_mm() function has at least one dmb() (as required by
122 * this workaround) in case a context switch happens on
123 * another CPU after the condition below.
124 */
125 if (atomic64_read(&mm->context.id) ==
126 atomic64_read(&per_cpu(active_asids, cpu)))
127 cpumask_set_cpu(cpu, &mask);
128 }
129 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1); 115 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
130 put_cpu(); 116 put_cpu();
131} 117}
diff --git a/arch/arm/kernel/suspend.c b/arch/arm/kernel/suspend.c
index c59c97ea8268..41cf3cbf756d 100644
--- a/arch/arm/kernel/suspend.c
+++ b/arch/arm/kernel/suspend.c
@@ -1,15 +1,54 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/slab.h>
2 3
4#include <asm/cacheflush.h>
3#include <asm/idmap.h> 5#include <asm/idmap.h>
4#include <asm/pgalloc.h> 6#include <asm/pgalloc.h>
5#include <asm/pgtable.h> 7#include <asm/pgtable.h>
6#include <asm/memory.h> 8#include <asm/memory.h>
9#include <asm/smp_plat.h>
7#include <asm/suspend.h> 10#include <asm/suspend.h>
8#include <asm/tlbflush.h> 11#include <asm/tlbflush.h>
9 12
10extern int __cpu_suspend(unsigned long, int (*)(unsigned long)); 13extern int __cpu_suspend(unsigned long, int (*)(unsigned long));
11extern void cpu_resume_mmu(void); 14extern void cpu_resume_mmu(void);
12 15
16#ifdef CONFIG_MMU
17/*
18 * Hide the first two arguments to __cpu_suspend - these are an implementation
19 * detail which platform code shouldn't have to know about.
20 */
21int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
22{
23 struct mm_struct *mm = current->active_mm;
24 int ret;
25
26 if (!idmap_pgd)
27 return -EINVAL;
28
29 /*
30 * Provide a temporary page table with an identity mapping for
31 * the MMU-enable code, required for resuming. On successful
32 * resume (indicated by a zero return code), we need to switch
33 * back to the correct page tables.
34 */
35 ret = __cpu_suspend(arg, fn);
36 if (ret == 0) {
37 cpu_switch_mm(mm->pgd, mm);
38 local_flush_bp_all();
39 local_flush_tlb_all();
40 }
41
42 return ret;
43}
44#else
45int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
46{
47 return __cpu_suspend(arg, fn);
48}
49#define idmap_pgd NULL
50#endif
51
13/* 52/*
14 * This is called by __cpu_suspend() to save the state, and do whatever 53 * This is called by __cpu_suspend() to save the state, and do whatever
15 * flushing is required to ensure that when the CPU goes to sleep we have 54 * flushing is required to ensure that when the CPU goes to sleep we have
@@ -47,30 +86,19 @@ void __cpu_suspend_save(u32 *ptr, u32 ptrsz, u32 sp, u32 *save_ptr)
47 virt_to_phys(save_ptr) + sizeof(*save_ptr)); 86 virt_to_phys(save_ptr) + sizeof(*save_ptr));
48} 87}
49 88
50/* 89extern struct sleep_save_sp sleep_save_sp;
51 * Hide the first two arguments to __cpu_suspend - these are an implementation
52 * detail which platform code shouldn't have to know about.
53 */
54int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))
55{
56 struct mm_struct *mm = current->active_mm;
57 int ret;
58
59 if (!idmap_pgd)
60 return -EINVAL;
61 90
62 /* 91static int cpu_suspend_alloc_sp(void)
63 * Provide a temporary page table with an identity mapping for 92{
64 * the MMU-enable code, required for resuming. On successful 93 void *ctx_ptr;
65 * resume (indicated by a zero return code), we need to switch 94 /* ctx_ptr is an array of physical addresses */
66 * back to the correct page tables. 95 ctx_ptr = kcalloc(mpidr_hash_size(), sizeof(u32), GFP_KERNEL);
67 */
68 ret = __cpu_suspend(arg, fn);
69 if (ret == 0) {
70 cpu_switch_mm(mm->pgd, mm);
71 local_flush_bp_all();
72 local_flush_tlb_all();
73 }
74 96
75 return ret; 97 if (WARN_ON(!ctx_ptr))
98 return -ENOMEM;
99 sleep_save_sp.save_ptr_stash = ctx_ptr;
100 sleep_save_sp.save_ptr_stash_phys = virt_to_phys(ctx_ptr);
101 sync_cache_w(&sleep_save_sp);
102 return 0;
76} 103}
104early_initcall(cpu_suspend_alloc_sp);
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index f10316b4ecdc..c5a59546a256 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/cpu.h> 14#include <linux/cpu.h>
15#include <linux/cpumask.h> 15#include <linux/cpumask.h>
16#include <linux/export.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/percpu.h> 18#include <linux/percpu.h>
18#include <linux/node.h> 19#include <linux/node.h>
@@ -200,6 +201,7 @@ static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {}
200 * cpu topology table 201 * cpu topology table
201 */ 202 */
202struct cputopo_arm cpu_topology[NR_CPUS]; 203struct cputopo_arm cpu_topology[NR_CPUS];
204EXPORT_SYMBOL_GPL(cpu_topology);
203 205
204const struct cpumask *cpu_coregroup_mask(int cpu) 206const struct cpumask *cpu_coregroup_mask(int cpu)
205{ 207{
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 18b32e8e4497..cab094c234ee 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -581,7 +581,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
581 return regs->ARM_r0; 581 return regs->ARM_r0;
582 582
583 case NR(set_tls): 583 case NR(set_tls):
584 thread->tp_value = regs->ARM_r0; 584 thread->tp_value[0] = regs->ARM_r0;
585 if (tls_emu) 585 if (tls_emu)
586 return 0; 586 return 0;
587 if (has_tls_reg) { 587 if (has_tls_reg) {
@@ -699,7 +699,7 @@ static int get_tp_trap(struct pt_regs *regs, unsigned int instr)
699 int reg = (instr >> 12) & 15; 699 int reg = (instr >> 12) & 15;
700 if (reg == 15) 700 if (reg == 15)
701 return 1; 701 return 1;
702 regs->uregs[reg] = current_thread_info()->tp_value; 702 regs->uregs[reg] = current_thread_info()->tp_value[0];
703 regs->ARM_pc += 4; 703 regs->ARM_pc += 4;
704 return 0; 704 return 0;
705} 705}
@@ -812,6 +812,7 @@ static void __init kuser_get_tls_init(unsigned long vectors)
812 812
813void __init early_trap_init(void *vectors_base) 813void __init early_trap_init(void *vectors_base)
814{ 814{
815#ifndef CONFIG_CPU_V7M
815 unsigned long vectors = (unsigned long)vectors_base; 816 unsigned long vectors = (unsigned long)vectors_base;
816 extern char __stubs_start[], __stubs_end[]; 817 extern char __stubs_start[], __stubs_end[];
817 extern char __vectors_start[], __vectors_end[]; 818 extern char __vectors_start[], __vectors_end[];
@@ -843,4 +844,11 @@ void __init early_trap_init(void *vectors_base)
843 844
844 flush_icache_range(vectors, vectors + PAGE_SIZE); 845 flush_icache_range(vectors, vectors + PAGE_SIZE);
845 modify_domain(DOMAIN_USER, DOMAIN_CLIENT); 846 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
847#else /* ifndef CONFIG_CPU_V7M */
848 /*
849 * on V7-M there is no need to copy the vector table to a dedicated
850 * memory area. The address is configurable and so a table in the kernel
851 * image can be used.
852 */
853#endif
846} 854}
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index a871b8e00fca..fa25e4e425f6 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -70,10 +70,6 @@ SECTIONS
70 ARM_EXIT_DISCARD(EXIT_TEXT) 70 ARM_EXIT_DISCARD(EXIT_TEXT)
71 ARM_EXIT_DISCARD(EXIT_DATA) 71 ARM_EXIT_DISCARD(EXIT_DATA)
72 EXIT_CALL 72 EXIT_CALL
73#ifndef CONFIG_HOTPLUG
74 *(.ARM.exidx.devexit.text)
75 *(.ARM.extab.devexit.text)
76#endif
77#ifndef CONFIG_MMU 73#ifndef CONFIG_MMU
78 *(.fixup) 74 *(.fixup)
79 *(__ex_table) 75 *(__ex_table)
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index 370e1a8af6ac..ebf5015508b5 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -41,9 +41,9 @@ config KVM_ARM_HOST
41 Provides host support for ARM processors. 41 Provides host support for ARM processors.
42 42
43config KVM_ARM_MAX_VCPUS 43config KVM_ARM_MAX_VCPUS
44 int "Number maximum supported virtual CPUs per VM" if KVM_ARM_HOST 44 int "Number maximum supported virtual CPUs per VM"
45 default 4 if KVM_ARM_HOST 45 depends on KVM_ARM_HOST
46 default 0 46 default 4
47 help 47 help
48 Static number of max supported virtual CPUs per VM. 48 Static number of max supported virtual CPUs per VM.
49 49
@@ -67,6 +67,4 @@ config KVM_ARM_TIMER
67 ---help--- 67 ---help---
68 Adds support for the Architected Timers in virtual machines 68 Adds support for the Architected Timers in virtual machines
69 69
70source drivers/virtio/Kconfig
71
72endif # VIRTUALIZATION 70endif # VIRTUALIZATION
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 53c5ed83d16f..d99bee4950e5 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -14,10 +14,11 @@ CFLAGS_mmu.o := -I.
14AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt) 14AFLAGS_init.o := -Wa,-march=armv7-a$(plus_virt)
15AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt) 15AFLAGS_interrupts.o := -Wa,-march=armv7-a$(plus_virt)
16 16
17kvm-arm-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o) 17KVM := ../../../virt/kvm
18kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o
18 19
19obj-y += kvm-arm.o init.o interrupts.o 20obj-y += kvm-arm.o init.o interrupts.o
20obj-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
21obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o 22obj-y += coproc.o coproc_a15.o mmio.o psci.o perf.o
22obj-$(CONFIG_KVM_ARM_VGIC) += vgic.o 23obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
23obj-$(CONFIG_KVM_ARM_TIMER) += arch_timer.o 24obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o
diff --git a/arch/arm/kvm/arch_timer.c b/arch/arm/kvm/arch_timer.c
deleted file mode 100644
index c55b6089e923..000000000000
--- a/arch/arm/kvm/arch_timer.c
+++ /dev/null
@@ -1,272 +0,0 @@
1/*
2 * Copyright (C) 2012 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, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/cpu.h>
20#include <linux/of_irq.h>
21#include <linux/kvm.h>
22#include <linux/kvm_host.h>
23#include <linux/interrupt.h>
24
25#include <clocksource/arm_arch_timer.h>
26#include <asm/arch_timer.h>
27
28#include <asm/kvm_vgic.h>
29#include <asm/kvm_arch_timer.h>
30
31static struct timecounter *timecounter;
32static struct workqueue_struct *wqueue;
33static struct kvm_irq_level timer_irq = {
34 .level = 1,
35};
36
37static cycle_t kvm_phys_timer_read(void)
38{
39 return timecounter->cc->read(timecounter->cc);
40}
41
42static bool timer_is_armed(struct arch_timer_cpu *timer)
43{
44 return timer->armed;
45}
46
47/* timer_arm: as in "arm the timer", not as in ARM the company */
48static void timer_arm(struct arch_timer_cpu *timer, u64 ns)
49{
50 timer->armed = true;
51 hrtimer_start(&timer->timer, ktime_add_ns(ktime_get(), ns),
52 HRTIMER_MODE_ABS);
53}
54
55static void timer_disarm(struct arch_timer_cpu *timer)
56{
57 if (timer_is_armed(timer)) {
58 hrtimer_cancel(&timer->timer);
59 cancel_work_sync(&timer->expired);
60 timer->armed = false;
61 }
62}
63
64static void kvm_timer_inject_irq(struct kvm_vcpu *vcpu)
65{
66 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
67
68 timer->cntv_ctl |= ARCH_TIMER_CTRL_IT_MASK;
69 kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id,
70 vcpu->arch.timer_cpu.irq->irq,
71 vcpu->arch.timer_cpu.irq->level);
72}
73
74static irqreturn_t kvm_arch_timer_handler(int irq, void *dev_id)
75{
76 struct kvm_vcpu *vcpu = *(struct kvm_vcpu **)dev_id;
77
78 /*
79 * We disable the timer in the world switch and let it be
80 * handled by kvm_timer_sync_hwstate(). Getting a timer
81 * interrupt at this point is a sure sign of some major
82 * breakage.
83 */
84 pr_warn("Unexpected interrupt %d on vcpu %p\n", irq, vcpu);
85 return IRQ_HANDLED;
86}
87
88static void kvm_timer_inject_irq_work(struct work_struct *work)
89{
90 struct kvm_vcpu *vcpu;
91
92 vcpu = container_of(work, struct kvm_vcpu, arch.timer_cpu.expired);
93 vcpu->arch.timer_cpu.armed = false;
94 kvm_timer_inject_irq(vcpu);
95}
96
97static enum hrtimer_restart kvm_timer_expire(struct hrtimer *hrt)
98{
99 struct arch_timer_cpu *timer;
100 timer = container_of(hrt, struct arch_timer_cpu, timer);
101 queue_work(wqueue, &timer->expired);
102 return HRTIMER_NORESTART;
103}
104
105/**
106 * kvm_timer_flush_hwstate - prepare to move the virt timer to the cpu
107 * @vcpu: The vcpu pointer
108 *
109 * Disarm any pending soft timers, since the world-switch code will write the
110 * virtual timer state back to the physical CPU.
111 */
112void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu)
113{
114 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
115
116 /*
117 * We're about to run this vcpu again, so there is no need to
118 * keep the background timer running, as we're about to
119 * populate the CPU timer again.
120 */
121 timer_disarm(timer);
122}
123
124/**
125 * kvm_timer_sync_hwstate - sync timer state from cpu
126 * @vcpu: The vcpu pointer
127 *
128 * Check if the virtual timer was armed and either schedule a corresponding
129 * soft timer or inject directly if already expired.
130 */
131void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu)
132{
133 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
134 cycle_t cval, now;
135 u64 ns;
136
137 if ((timer->cntv_ctl & ARCH_TIMER_CTRL_IT_MASK) ||
138 !(timer->cntv_ctl & ARCH_TIMER_CTRL_ENABLE))
139 return;
140
141 cval = timer->cntv_cval;
142 now = kvm_phys_timer_read() - vcpu->kvm->arch.timer.cntvoff;
143
144 BUG_ON(timer_is_armed(timer));
145
146 if (cval <= now) {
147 /*
148 * Timer has already expired while we were not
149 * looking. Inject the interrupt and carry on.
150 */
151 kvm_timer_inject_irq(vcpu);
152 return;
153 }
154
155 ns = cyclecounter_cyc2ns(timecounter->cc, cval - now);
156 timer_arm(timer, ns);
157}
158
159void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
160{
161 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
162
163 INIT_WORK(&timer->expired, kvm_timer_inject_irq_work);
164 hrtimer_init(&timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
165 timer->timer.function = kvm_timer_expire;
166 timer->irq = &timer_irq;
167}
168
169static void kvm_timer_init_interrupt(void *info)
170{
171 enable_percpu_irq(timer_irq.irq, 0);
172}
173
174
175static int kvm_timer_cpu_notify(struct notifier_block *self,
176 unsigned long action, void *cpu)
177{
178 switch (action) {
179 case CPU_STARTING:
180 case CPU_STARTING_FROZEN:
181 kvm_timer_init_interrupt(NULL);
182 break;
183 case CPU_DYING:
184 case CPU_DYING_FROZEN:
185 disable_percpu_irq(timer_irq.irq);
186 break;
187 }
188
189 return NOTIFY_OK;
190}
191
192static struct notifier_block kvm_timer_cpu_nb = {
193 .notifier_call = kvm_timer_cpu_notify,
194};
195
196static const struct of_device_id arch_timer_of_match[] = {
197 { .compatible = "arm,armv7-timer", },
198 {},
199};
200
201int kvm_timer_hyp_init(void)
202{
203 struct device_node *np;
204 unsigned int ppi;
205 int err;
206
207 timecounter = arch_timer_get_timecounter();
208 if (!timecounter)
209 return -ENODEV;
210
211 np = of_find_matching_node(NULL, arch_timer_of_match);
212 if (!np) {
213 kvm_err("kvm_arch_timer: can't find DT node\n");
214 return -ENODEV;
215 }
216
217 ppi = irq_of_parse_and_map(np, 2);
218 if (!ppi) {
219 kvm_err("kvm_arch_timer: no virtual timer interrupt\n");
220 err = -EINVAL;
221 goto out;
222 }
223
224 err = request_percpu_irq(ppi, kvm_arch_timer_handler,
225 "kvm guest timer", kvm_get_running_vcpus());
226 if (err) {
227 kvm_err("kvm_arch_timer: can't request interrupt %d (%d)\n",
228 ppi, err);
229 goto out;
230 }
231
232 timer_irq.irq = ppi;
233
234 err = register_cpu_notifier(&kvm_timer_cpu_nb);
235 if (err) {
236 kvm_err("Cannot register timer CPU notifier\n");
237 goto out_free;
238 }
239
240 wqueue = create_singlethread_workqueue("kvm_arch_timer");
241 if (!wqueue) {
242 err = -ENOMEM;
243 goto out_free;
244 }
245
246 kvm_info("%s IRQ%d\n", np->name, ppi);
247 on_each_cpu(kvm_timer_init_interrupt, NULL, 1);
248
249 goto out;
250out_free:
251 free_percpu_irq(ppi, kvm_get_running_vcpus());
252out:
253 of_node_put(np);
254 return err;
255}
256
257void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu)
258{
259 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;
260
261 timer_disarm(timer);
262}
263
264int kvm_timer_init(struct kvm *kvm)
265{
266 if (timecounter && wqueue) {
267 kvm->arch.timer.cntvoff = kvm_phys_timer_read();
268 kvm->arch.timer.enabled = 1;
269 }
270
271 return 0;
272}
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index ef1703b9587b..741f66a2edbd 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -800,8 +800,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
800 800
801static void cpu_init_hyp_mode(void *dummy) 801static void cpu_init_hyp_mode(void *dummy)
802{ 802{
803 unsigned long long boot_pgd_ptr; 803 phys_addr_t boot_pgd_ptr;
804 unsigned long long pgd_ptr; 804 phys_addr_t pgd_ptr;
805 unsigned long hyp_stack_ptr; 805 unsigned long hyp_stack_ptr;
806 unsigned long stack_page; 806 unsigned long stack_page;
807 unsigned long vector_ptr; 807 unsigned long vector_ptr;
@@ -809,8 +809,8 @@ static void cpu_init_hyp_mode(void *dummy)
809 /* Switch from the HYP stub to our own HYP init vector */ 809 /* Switch from the HYP stub to our own HYP init vector */
810 __hyp_set_vectors(kvm_get_idmap_vector()); 810 __hyp_set_vectors(kvm_get_idmap_vector());
811 811
812 boot_pgd_ptr = (unsigned long long)kvm_mmu_get_boot_httbr(); 812 boot_pgd_ptr = kvm_mmu_get_boot_httbr();
813 pgd_ptr = (unsigned long long)kvm_mmu_get_httbr(); 813 pgd_ptr = kvm_mmu_get_httbr();
814 stack_page = __get_cpu_var(kvm_arm_hyp_stack_page); 814 stack_page = __get_cpu_var(kvm_arm_hyp_stack_page);
815 hyp_stack_ptr = stack_page + PAGE_SIZE; 815 hyp_stack_ptr = stack_page + PAGE_SIZE;
816 vector_ptr = (unsigned long)__kvm_hyp_vector; 816 vector_ptr = (unsigned long)__kvm_hyp_vector;
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c
index 8eea97be1ed5..4a5199070430 100644
--- a/arch/arm/kvm/coproc.c
+++ b/arch/arm/kvm/coproc.c
@@ -180,6 +180,10 @@ static const struct coproc_reg cp15_regs[] = {
180 NULL, reset_unknown, c6_DFAR }, 180 NULL, reset_unknown, c6_DFAR },
181 { CRn( 6), CRm( 0), Op1( 0), Op2( 2), is32, 181 { CRn( 6), CRm( 0), Op1( 0), Op2( 2), is32,
182 NULL, reset_unknown, c6_IFAR }, 182 NULL, reset_unknown, c6_IFAR },
183
184 /* PAR swapped by interrupt.S */
185 { CRn( 7), Op1( 0), is64, NULL, reset_unknown64, c7_PAR },
186
183 /* 187 /*
184 * DC{C,I,CI}SW operations: 188 * DC{C,I,CI}SW operations:
185 */ 189 */
diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c
index 3d74a0be47db..df4c82d47ad7 100644
--- a/arch/arm/kvm/handle_exit.c
+++ b/arch/arm/kvm/handle_exit.c
@@ -52,9 +52,6 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
52 52
53static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run) 53static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
54{ 54{
55 if (kvm_psci_call(vcpu))
56 return 1;
57
58 kvm_inject_undefined(vcpu); 55 kvm_inject_undefined(vcpu);
59 return 1; 56 return 1;
60} 57}
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S
index f7793df62f58..16cd4ba5d7fd 100644
--- a/arch/arm/kvm/interrupts.S
+++ b/arch/arm/kvm/interrupts.S
@@ -49,6 +49,7 @@ __kvm_hyp_code_start:
49ENTRY(__kvm_tlb_flush_vmid_ipa) 49ENTRY(__kvm_tlb_flush_vmid_ipa)
50 push {r2, r3} 50 push {r2, r3}
51 51
52 dsb ishst
52 add r0, r0, #KVM_VTTBR 53 add r0, r0, #KVM_VTTBR
53 ldrd r2, r3, [r0] 54 ldrd r2, r3, [r0]
54 mcrr p15, 6, r2, r3, c2 @ Write VTTBR 55 mcrr p15, 6, r2, r3, c2 @ Write VTTBR
@@ -291,6 +292,7 @@ THUMB( orr r2, r2, #PSR_T_BIT )
291 ldr r2, =BSYM(panic) 292 ldr r2, =BSYM(panic)
292 msr ELR_hyp, r2 293 msr ELR_hyp, r2
293 ldr r0, =\panic_str 294 ldr r0, =\panic_str
295 clrex @ Clear exclusive monitor
294 eret 296 eret
295.endm 297.endm
296 298
@@ -414,6 +416,10 @@ guest_trap:
414 mrcne p15, 4, r2, c6, c0, 4 @ HPFAR 416 mrcne p15, 4, r2, c6, c0, 4 @ HPFAR
415 bne 3f 417 bne 3f
416 418
419 /* Preserve PAR */
420 mrrc p15, 0, r0, r1, c7 @ PAR
421 push {r0, r1}
422
417 /* Resolve IPA using the xFAR */ 423 /* Resolve IPA using the xFAR */
418 mcr p15, 0, r2, c7, c8, 0 @ ATS1CPR 424 mcr p15, 0, r2, c7, c8, 0 @ ATS1CPR
419 isb 425 isb
@@ -424,13 +430,20 @@ guest_trap:
424 lsl r2, r2, #4 430 lsl r2, r2, #4
425 orr r2, r2, r1, lsl #24 431 orr r2, r2, r1, lsl #24
426 432
433 /* Restore PAR */
434 pop {r0, r1}
435 mcrr p15, 0, r0, r1, c7 @ PAR
436
4273: load_vcpu @ Load VCPU pointer to r0 4373: load_vcpu @ Load VCPU pointer to r0
428 str r2, [r0, #VCPU_HPFAR] 438 str r2, [r0, #VCPU_HPFAR]
429 439
4301: mov r1, #ARM_EXCEPTION_HVC 4401: mov r1, #ARM_EXCEPTION_HVC
431 b __kvm_vcpu_return 441 b __kvm_vcpu_return
432 442
4334: pop {r0, r1, r2} @ Failed translation, return to guest 4434: pop {r0, r1} @ Failed translation, return to guest
444 mcrr p15, 0, r0, r1, c7 @ PAR
445 clrex
446 pop {r0, r1, r2}
434 eret 447 eret
435 448
436/* 449/*
@@ -456,6 +469,7 @@ switch_to_guest_vfp:
456 469
457 pop {r3-r7} 470 pop {r3-r7}
458 pop {r0-r2} 471 pop {r0-r2}
472 clrex
459 eret 473 eret
460#endif 474#endif
461 475
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index 3c8f2f0b4c5e..6f18695a09cb 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -302,11 +302,14 @@ vcpu .req r0 @ vcpu pointer always in r0
302 .endif 302 .endif
303 303
304 mrc p15, 0, r2, c14, c1, 0 @ CNTKCTL 304 mrc p15, 0, r2, c14, c1, 0 @ CNTKCTL
305 mrrc p15, 0, r4, r5, c7 @ PAR
305 306
306 .if \store_to_vcpu == 0 307 .if \store_to_vcpu == 0
307 push {r2} 308 push {r2,r4-r5}
308 .else 309 .else
309 str r2, [vcpu, #CP15_OFFSET(c14_CNTKCTL)] 310 str r2, [vcpu, #CP15_OFFSET(c14_CNTKCTL)]
311 add r12, vcpu, #CP15_OFFSET(c7_PAR)
312 strd r4, r5, [r12]
310 .endif 313 .endif
311.endm 314.endm
312 315
@@ -319,12 +322,15 @@ vcpu .req r0 @ vcpu pointer always in r0
319 */ 322 */
320.macro write_cp15_state read_from_vcpu 323.macro write_cp15_state read_from_vcpu
321 .if \read_from_vcpu == 0 324 .if \read_from_vcpu == 0
322 pop {r2} 325 pop {r2,r4-r5}
323 .else 326 .else
324 ldr r2, [vcpu, #CP15_OFFSET(c14_CNTKCTL)] 327 ldr r2, [vcpu, #CP15_OFFSET(c14_CNTKCTL)]
328 add r12, vcpu, #CP15_OFFSET(c7_PAR)
329 ldrd r4, r5, [r12]
325 .endif 330 .endif
326 331
327 mcr p15, 0, r2, c14, c1, 0 @ CNTKCTL 332 mcr p15, 0, r2, c14, c1, 0 @ CNTKCTL
333 mcrr p15, 0, r4, r5, c7 @ PAR
328 334
329 .if \read_from_vcpu == 0 335 .if \read_from_vcpu == 0
330 pop {r2-r12} 336 pop {r2-r12}
@@ -497,6 +503,10 @@ vcpu .req r0 @ vcpu pointer always in r0
497 add r5, vcpu, r4 503 add r5, vcpu, r4
498 strd r2, r3, [r5] 504 strd r2, r3, [r5]
499 505
506 @ Ensure host CNTVCT == CNTPCT
507 mov r2, #0
508 mcrr p15, 4, r2, r2, c14 @ CNTVOFF
509
5001: 5101:
501#endif 511#endif
502 @ Allow physical timer/counter access for the host 512 @ Allow physical timer/counter access for the host
diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
index 72a12f2171b2..b8e06b7a2833 100644
--- a/arch/arm/kvm/mmio.c
+++ b/arch/arm/kvm/mmio.c
@@ -86,12 +86,6 @@ static int decode_hsr(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
86 sign_extend = kvm_vcpu_dabt_issext(vcpu); 86 sign_extend = kvm_vcpu_dabt_issext(vcpu);
87 rt = kvm_vcpu_dabt_get_rd(vcpu); 87 rt = kvm_vcpu_dabt_get_rd(vcpu);
88 88
89 if (kvm_vcpu_reg_is_pc(vcpu, rt)) {
90 /* IO memory trying to read/write pc */
91 kvm_inject_pabt(vcpu, kvm_vcpu_get_hfar(vcpu));
92 return 1;
93 }
94
95 mmio->is_write = is_write; 89 mmio->is_write = is_write;
96 mmio->phys_addr = fault_ipa; 90 mmio->phys_addr = fault_ipa;
97 mmio->len = len; 91 mmio->len = len;
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 84ba67b982c0..ca6bea4859b4 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -382,9 +382,6 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm)
382 if (!pgd) 382 if (!pgd)
383 return -ENOMEM; 383 return -ENOMEM;
384 384
385 /* stage-2 pgd must be aligned to its size */
386 VM_BUG_ON((unsigned long)pgd & (S2_PGD_SIZE - 1));
387
388 memset(pgd, 0, PTRS_PER_S2_PGD * sizeof(pgd_t)); 385 memset(pgd, 0, PTRS_PER_S2_PGD * sizeof(pgd_t));
389 kvm_clean_pgd(pgd); 386 kvm_clean_pgd(pgd);
390 kvm->arch.pgd = pgd; 387 kvm->arch.pgd = pgd;
diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c
index 7ee5bb7a3667..86a693a02ba3 100644
--- a/arch/arm/kvm/psci.c
+++ b/arch/arm/kvm/psci.c
@@ -75,7 +75,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
75 * kvm_psci_call - handle PSCI call if r0 value is in range 75 * kvm_psci_call - handle PSCI call if r0 value is in range
76 * @vcpu: Pointer to the VCPU struct 76 * @vcpu: Pointer to the VCPU struct
77 * 77 *
78 * Handle PSCI calls from guests through traps from HVC or SMC instructions. 78 * Handle PSCI calls from guests through traps from HVC instructions.
79 * The calling convention is similar to SMC calls to the secure world where 79 * The calling convention is similar to SMC calls to the secure world where
80 * the function number is placed in r0 and this function returns true if the 80 * the function number is placed in r0 and this function returns true if the
81 * function number specified in r0 is withing the PSCI range, and false 81 * function number specified in r0 is withing the PSCI range, and false
diff --git a/arch/arm/kvm/reset.c b/arch/arm/kvm/reset.c
index b80256b554cd..b7840e7aa452 100644
--- a/arch/arm/kvm/reset.c
+++ b/arch/arm/kvm/reset.c
@@ -27,6 +27,8 @@
27#include <asm/kvm_arm.h> 27#include <asm/kvm_arm.h>
28#include <asm/kvm_coproc.h> 28#include <asm/kvm_coproc.h>
29 29
30#include <kvm/arm_arch_timer.h>
31
30/****************************************************************************** 32/******************************************************************************
31 * Cortex-A15 Reset Values 33 * Cortex-A15 Reset Values
32 */ 34 */
@@ -37,6 +39,11 @@ static struct kvm_regs a15_regs_reset = {
37 .usr_regs.ARM_cpsr = SVC_MODE | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT, 39 .usr_regs.ARM_cpsr = SVC_MODE | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT,
38}; 40};
39 41
42static const struct kvm_irq_level a15_vtimer_irq = {
43 .irq = 27,
44 .level = 1,
45};
46
40 47
41/******************************************************************************* 48/*******************************************************************************
42 * Exported reset function 49 * Exported reset function
@@ -52,6 +59,7 @@ static struct kvm_regs a15_regs_reset = {
52int kvm_reset_vcpu(struct kvm_vcpu *vcpu) 59int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
53{ 60{
54 struct kvm_regs *cpu_reset; 61 struct kvm_regs *cpu_reset;
62 const struct kvm_irq_level *cpu_vtimer_irq;
55 63
56 switch (vcpu->arch.target) { 64 switch (vcpu->arch.target) {
57 case KVM_ARM_TARGET_CORTEX_A15: 65 case KVM_ARM_TARGET_CORTEX_A15:
@@ -59,6 +67,7 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
59 return -EINVAL; 67 return -EINVAL;
60 cpu_reset = &a15_regs_reset; 68 cpu_reset = &a15_regs_reset;
61 vcpu->arch.midr = read_cpuid_id(); 69 vcpu->arch.midr = read_cpuid_id();
70 cpu_vtimer_irq = &a15_vtimer_irq;
62 break; 71 break;
63 default: 72 default:
64 return -ENODEV; 73 return -ENODEV;
@@ -70,5 +79,8 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
70 /* Reset CP15 registers */ 79 /* Reset CP15 registers */
71 kvm_reset_coprocs(vcpu); 80 kvm_reset_coprocs(vcpu);
72 81
82 /* Reset arch_timer context */
83 kvm_timer_vcpu_reset(vcpu, cpu_vtimer_irq);
84
73 return 0; 85 return 0;
74} 86}
diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
deleted file mode 100644
index 17c5ac7d10ed..000000000000
--- a/arch/arm/kvm/vgic.c
+++ /dev/null
@@ -1,1499 +0,0 @@
1/*
2 * Copyright (C) 2012 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, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/cpu.h>
20#include <linux/kvm.h>
21#include <linux/kvm_host.h>
22#include <linux/interrupt.h>
23#include <linux/io.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
26#include <linux/of_irq.h>
27
28#include <linux/irqchip/arm-gic.h>
29
30#include <asm/kvm_emulate.h>
31#include <asm/kvm_arm.h>
32#include <asm/kvm_mmu.h>
33
34/*
35 * How the whole thing works (courtesy of Christoffer Dall):
36 *
37 * - At any time, the dist->irq_pending_on_cpu is the oracle that knows if
38 * something is pending
39 * - VGIC pending interrupts are stored on the vgic.irq_state vgic
40 * bitmap (this bitmap is updated by both user land ioctls and guest
41 * mmio ops, and other in-kernel peripherals such as the
42 * arch. timers) and indicate the 'wire' state.
43 * - Every time the bitmap changes, the irq_pending_on_cpu oracle is
44 * recalculated
45 * - To calculate the oracle, we need info for each cpu from
46 * compute_pending_for_cpu, which considers:
47 * - PPI: dist->irq_state & dist->irq_enable
48 * - SPI: dist->irq_state & dist->irq_enable & dist->irq_spi_target
49 * - irq_spi_target is a 'formatted' version of the GICD_ICFGR
50 * registers, stored on each vcpu. We only keep one bit of
51 * information per interrupt, making sure that only one vcpu can
52 * accept the interrupt.
53 * - The same is true when injecting an interrupt, except that we only
54 * consider a single interrupt at a time. The irq_spi_cpu array
55 * contains the target CPU for each SPI.
56 *
57 * The handling of level interrupts adds some extra complexity. We
58 * need to track when the interrupt has been EOIed, so we can sample
59 * the 'line' again. This is achieved as such:
60 *
61 * - When a level interrupt is moved onto a vcpu, the corresponding
62 * bit in irq_active is set. As long as this bit is set, the line
63 * will be ignored for further interrupts. The interrupt is injected
64 * into the vcpu with the GICH_LR_EOI bit set (generate a
65 * maintenance interrupt on EOI).
66 * - When the interrupt is EOIed, the maintenance interrupt fires,
67 * and clears the corresponding bit in irq_active. This allow the
68 * interrupt line to be sampled again.
69 */
70
71#define VGIC_ADDR_UNDEF (-1)
72#define IS_VGIC_ADDR_UNDEF(_x) ((_x) == VGIC_ADDR_UNDEF)
73
74/* Physical address of vgic virtual cpu interface */
75static phys_addr_t vgic_vcpu_base;
76
77/* Virtual control interface base address */
78static void __iomem *vgic_vctrl_base;
79
80static struct device_node *vgic_node;
81
82#define ACCESS_READ_VALUE (1 << 0)
83#define ACCESS_READ_RAZ (0 << 0)
84#define ACCESS_READ_MASK(x) ((x) & (1 << 0))
85#define ACCESS_WRITE_IGNORED (0 << 1)
86#define ACCESS_WRITE_SETBIT (1 << 1)
87#define ACCESS_WRITE_CLEARBIT (2 << 1)
88#define ACCESS_WRITE_VALUE (3 << 1)
89#define ACCESS_WRITE_MASK(x) ((x) & (3 << 1))
90
91static void vgic_retire_disabled_irqs(struct kvm_vcpu *vcpu);
92static void vgic_update_state(struct kvm *kvm);
93static void vgic_kick_vcpus(struct kvm *kvm);
94static void vgic_dispatch_sgi(struct kvm_vcpu *vcpu, u32 reg);
95static u32 vgic_nr_lr;
96
97static unsigned int vgic_maint_irq;
98
99static u32 *vgic_bitmap_get_reg(struct vgic_bitmap *x,
100 int cpuid, u32 offset)
101{
102 offset >>= 2;
103 if (!offset)
104 return x->percpu[cpuid].reg;
105 else
106 return x->shared.reg + offset - 1;
107}
108
109static int vgic_bitmap_get_irq_val(struct vgic_bitmap *x,
110 int cpuid, int irq)
111{
112 if (irq < VGIC_NR_PRIVATE_IRQS)
113 return test_bit(irq, x->percpu[cpuid].reg_ul);
114
115 return test_bit(irq - VGIC_NR_PRIVATE_IRQS, x->shared.reg_ul);
116}
117
118static void vgic_bitmap_set_irq_val(struct vgic_bitmap *x, int cpuid,
119 int irq, int val)
120{
121 unsigned long *reg;
122
123 if (irq < VGIC_NR_PRIVATE_IRQS) {
124 reg = x->percpu[cpuid].reg_ul;
125 } else {
126 reg = x->shared.reg_ul;
127 irq -= VGIC_NR_PRIVATE_IRQS;
128 }
129
130 if (val)
131 set_bit(irq, reg);
132 else
133 clear_bit(irq, reg);
134}
135
136static unsigned long *vgic_bitmap_get_cpu_map(struct vgic_bitmap *x, int cpuid)
137{
138 if (unlikely(cpuid >= VGIC_MAX_CPUS))
139 return NULL;
140 return x->percpu[cpuid].reg_ul;
141}
142
143static unsigned long *vgic_bitmap_get_shared_map(struct vgic_bitmap *x)
144{
145 return x->shared.reg_ul;
146}
147
148static u32 *vgic_bytemap_get_reg(struct vgic_bytemap *x, int cpuid, u32 offset)
149{
150 offset >>= 2;
151 BUG_ON(offset > (VGIC_NR_IRQS / 4));
152 if (offset < 4)
153 return x->percpu[cpuid] + offset;
154 else
155 return x->shared + offset - 8;
156}
157
158#define VGIC_CFG_LEVEL 0
159#define VGIC_CFG_EDGE 1
160
161static bool vgic_irq_is_edge(struct kvm_vcpu *vcpu, int irq)
162{
163 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
164 int irq_val;
165
166 irq_val = vgic_bitmap_get_irq_val(&dist->irq_cfg, vcpu->vcpu_id, irq);
167 return irq_val == VGIC_CFG_EDGE;
168}
169
170static int vgic_irq_is_enabled(struct kvm_vcpu *vcpu, int irq)
171{
172 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
173
174 return vgic_bitmap_get_irq_val(&dist->irq_enabled, vcpu->vcpu_id, irq);
175}
176
177static int vgic_irq_is_active(struct kvm_vcpu *vcpu, int irq)
178{
179 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
180
181 return vgic_bitmap_get_irq_val(&dist->irq_active, vcpu->vcpu_id, irq);
182}
183
184static void vgic_irq_set_active(struct kvm_vcpu *vcpu, int irq)
185{
186 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
187
188 vgic_bitmap_set_irq_val(&dist->irq_active, vcpu->vcpu_id, irq, 1);
189}
190
191static void vgic_irq_clear_active(struct kvm_vcpu *vcpu, int irq)
192{
193 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
194
195 vgic_bitmap_set_irq_val(&dist->irq_active, vcpu->vcpu_id, irq, 0);
196}
197
198static int vgic_dist_irq_is_pending(struct kvm_vcpu *vcpu, int irq)
199{
200 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
201
202 return vgic_bitmap_get_irq_val(&dist->irq_state, vcpu->vcpu_id, irq);
203}
204
205static void vgic_dist_irq_set(struct kvm_vcpu *vcpu, int irq)
206{
207 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
208
209 vgic_bitmap_set_irq_val(&dist->irq_state, vcpu->vcpu_id, irq, 1);
210}
211
212static void vgic_dist_irq_clear(struct kvm_vcpu *vcpu, int irq)
213{
214 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
215
216 vgic_bitmap_set_irq_val(&dist->irq_state, vcpu->vcpu_id, irq, 0);
217}
218
219static void vgic_cpu_irq_set(struct kvm_vcpu *vcpu, int irq)
220{
221 if (irq < VGIC_NR_PRIVATE_IRQS)
222 set_bit(irq, vcpu->arch.vgic_cpu.pending_percpu);
223 else
224 set_bit(irq - VGIC_NR_PRIVATE_IRQS,
225 vcpu->arch.vgic_cpu.pending_shared);
226}
227
228static void vgic_cpu_irq_clear(struct kvm_vcpu *vcpu, int irq)
229{
230 if (irq < VGIC_NR_PRIVATE_IRQS)
231 clear_bit(irq, vcpu->arch.vgic_cpu.pending_percpu);
232 else
233 clear_bit(irq - VGIC_NR_PRIVATE_IRQS,
234 vcpu->arch.vgic_cpu.pending_shared);
235}
236
237static u32 mmio_data_read(struct kvm_exit_mmio *mmio, u32 mask)
238{
239 return *((u32 *)mmio->data) & mask;
240}
241
242static void mmio_data_write(struct kvm_exit_mmio *mmio, u32 mask, u32 value)
243{
244 *((u32 *)mmio->data) = value & mask;
245}
246
247/**
248 * vgic_reg_access - access vgic register
249 * @mmio: pointer to the data describing the mmio access
250 * @reg: pointer to the virtual backing of vgic distributor data
251 * @offset: least significant 2 bits used for word offset
252 * @mode: ACCESS_ mode (see defines above)
253 *
254 * Helper to make vgic register access easier using one of the access
255 * modes defined for vgic register access
256 * (read,raz,write-ignored,setbit,clearbit,write)
257 */
258static void vgic_reg_access(struct kvm_exit_mmio *mmio, u32 *reg,
259 phys_addr_t offset, int mode)
260{
261 int word_offset = (offset & 3) * 8;
262 u32 mask = (1UL << (mmio->len * 8)) - 1;
263 u32 regval;
264
265 /*
266 * Any alignment fault should have been delivered to the guest
267 * directly (ARM ARM B3.12.7 "Prioritization of aborts").
268 */
269
270 if (reg) {
271 regval = *reg;
272 } else {
273 BUG_ON(mode != (ACCESS_READ_RAZ | ACCESS_WRITE_IGNORED));
274 regval = 0;
275 }
276
277 if (mmio->is_write) {
278 u32 data = mmio_data_read(mmio, mask) << word_offset;
279 switch (ACCESS_WRITE_MASK(mode)) {
280 case ACCESS_WRITE_IGNORED:
281 return;
282
283 case ACCESS_WRITE_SETBIT:
284 regval |= data;
285 break;
286
287 case ACCESS_WRITE_CLEARBIT:
288 regval &= ~data;
289 break;
290
291 case ACCESS_WRITE_VALUE:
292 regval = (regval & ~(mask << word_offset)) | data;
293 break;
294 }
295 *reg = regval;
296 } else {
297 switch (ACCESS_READ_MASK(mode)) {
298 case ACCESS_READ_RAZ:
299 regval = 0;
300 /* fall through */
301
302 case ACCESS_READ_VALUE:
303 mmio_data_write(mmio, mask, regval >> word_offset);
304 }
305 }
306}
307
308static bool handle_mmio_misc(struct kvm_vcpu *vcpu,
309 struct kvm_exit_mmio *mmio, phys_addr_t offset)
310{
311 u32 reg;
312 u32 word_offset = offset & 3;
313
314 switch (offset & ~3) {
315 case 0: /* CTLR */
316 reg = vcpu->kvm->arch.vgic.enabled;
317 vgic_reg_access(mmio, &reg, word_offset,
318 ACCESS_READ_VALUE | ACCESS_WRITE_VALUE);
319 if (mmio->is_write) {
320 vcpu->kvm->arch.vgic.enabled = reg & 1;
321 vgic_update_state(vcpu->kvm);
322 return true;
323 }
324 break;
325
326 case 4: /* TYPER */
327 reg = (atomic_read(&vcpu->kvm->online_vcpus) - 1) << 5;
328 reg |= (VGIC_NR_IRQS >> 5) - 1;
329 vgic_reg_access(mmio, &reg, word_offset,
330 ACCESS_READ_VALUE | ACCESS_WRITE_IGNORED);
331 break;
332
333 case 8: /* IIDR */
334 reg = 0x4B00043B;
335 vgic_reg_access(mmio, &reg, word_offset,
336 ACCESS_READ_VALUE | ACCESS_WRITE_IGNORED);
337 break;
338 }
339
340 return false;
341}
342
343static bool handle_mmio_raz_wi(struct kvm_vcpu *vcpu,
344 struct kvm_exit_mmio *mmio, phys_addr_t offset)
345{
346 vgic_reg_access(mmio, NULL, offset,
347 ACCESS_READ_RAZ | ACCESS_WRITE_IGNORED);
348 return false;
349}
350
351static bool handle_mmio_set_enable_reg(struct kvm_vcpu *vcpu,
352 struct kvm_exit_mmio *mmio,
353 phys_addr_t offset)
354{
355 u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_enabled,
356 vcpu->vcpu_id, offset);
357 vgic_reg_access(mmio, reg, offset,
358 ACCESS_READ_VALUE | ACCESS_WRITE_SETBIT);
359 if (mmio->is_write) {
360 vgic_update_state(vcpu->kvm);
361 return true;
362 }
363
364 return false;
365}
366
367static bool handle_mmio_clear_enable_reg(struct kvm_vcpu *vcpu,
368 struct kvm_exit_mmio *mmio,
369 phys_addr_t offset)
370{
371 u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_enabled,
372 vcpu->vcpu_id, offset);
373 vgic_reg_access(mmio, reg, offset,
374 ACCESS_READ_VALUE | ACCESS_WRITE_CLEARBIT);
375 if (mmio->is_write) {
376 if (offset < 4) /* Force SGI enabled */
377 *reg |= 0xffff;
378 vgic_retire_disabled_irqs(vcpu);
379 vgic_update_state(vcpu->kvm);
380 return true;
381 }
382
383 return false;
384}
385
386static bool handle_mmio_set_pending_reg(struct kvm_vcpu *vcpu,
387 struct kvm_exit_mmio *mmio,
388 phys_addr_t offset)
389{
390 u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_state,
391 vcpu->vcpu_id, offset);
392 vgic_reg_access(mmio, reg, offset,
393 ACCESS_READ_VALUE | ACCESS_WRITE_SETBIT);
394 if (mmio->is_write) {
395 vgic_update_state(vcpu->kvm);
396 return true;
397 }
398
399 return false;
400}
401
402static bool handle_mmio_clear_pending_reg(struct kvm_vcpu *vcpu,
403 struct kvm_exit_mmio *mmio,
404 phys_addr_t offset)
405{
406 u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_state,
407 vcpu->vcpu_id, offset);
408 vgic_reg_access(mmio, reg, offset,
409 ACCESS_READ_VALUE | ACCESS_WRITE_CLEARBIT);
410 if (mmio->is_write) {
411 vgic_update_state(vcpu->kvm);
412 return true;
413 }
414
415 return false;
416}
417
418static bool handle_mmio_priority_reg(struct kvm_vcpu *vcpu,
419 struct kvm_exit_mmio *mmio,
420 phys_addr_t offset)
421{
422 u32 *reg = vgic_bytemap_get_reg(&vcpu->kvm->arch.vgic.irq_priority,
423 vcpu->vcpu_id, offset);
424 vgic_reg_access(mmio, reg, offset,
425 ACCESS_READ_VALUE | ACCESS_WRITE_VALUE);
426 return false;
427}
428
429#define GICD_ITARGETSR_SIZE 32
430#define GICD_CPUTARGETS_BITS 8
431#define GICD_IRQS_PER_ITARGETSR (GICD_ITARGETSR_SIZE / GICD_CPUTARGETS_BITS)
432static u32 vgic_get_target_reg(struct kvm *kvm, int irq)
433{
434 struct vgic_dist *dist = &kvm->arch.vgic;
435 struct kvm_vcpu *vcpu;
436 int i, c;
437 unsigned long *bmap;
438 u32 val = 0;
439
440 irq -= VGIC_NR_PRIVATE_IRQS;
441
442 kvm_for_each_vcpu(c, vcpu, kvm) {
443 bmap = vgic_bitmap_get_shared_map(&dist->irq_spi_target[c]);
444 for (i = 0; i < GICD_IRQS_PER_ITARGETSR; i++)
445 if (test_bit(irq + i, bmap))
446 val |= 1 << (c + i * 8);
447 }
448
449 return val;
450}
451
452static void vgic_set_target_reg(struct kvm *kvm, u32 val, int irq)
453{
454 struct vgic_dist *dist = &kvm->arch.vgic;
455 struct kvm_vcpu *vcpu;
456 int i, c;
457 unsigned long *bmap;
458 u32 target;
459
460 irq -= VGIC_NR_PRIVATE_IRQS;
461
462 /*
463 * Pick the LSB in each byte. This ensures we target exactly
464 * one vcpu per IRQ. If the byte is null, assume we target
465 * CPU0.
466 */
467 for (i = 0; i < GICD_IRQS_PER_ITARGETSR; i++) {
468 int shift = i * GICD_CPUTARGETS_BITS;
469 target = ffs((val >> shift) & 0xffU);
470 target = target ? (target - 1) : 0;
471 dist->irq_spi_cpu[irq + i] = target;
472 kvm_for_each_vcpu(c, vcpu, kvm) {
473 bmap = vgic_bitmap_get_shared_map(&dist->irq_spi_target[c]);
474 if (c == target)
475 set_bit(irq + i, bmap);
476 else
477 clear_bit(irq + i, bmap);
478 }
479 }
480}
481
482static bool handle_mmio_target_reg(struct kvm_vcpu *vcpu,
483 struct kvm_exit_mmio *mmio,
484 phys_addr_t offset)
485{
486 u32 reg;
487
488 /* We treat the banked interrupts targets as read-only */
489 if (offset < 32) {
490 u32 roreg = 1 << vcpu->vcpu_id;
491 roreg |= roreg << 8;
492 roreg |= roreg << 16;
493
494 vgic_reg_access(mmio, &roreg, offset,
495 ACCESS_READ_VALUE | ACCESS_WRITE_IGNORED);
496 return false;
497 }
498
499 reg = vgic_get_target_reg(vcpu->kvm, offset & ~3U);
500 vgic_reg_access(mmio, &reg, offset,
501 ACCESS_READ_VALUE | ACCESS_WRITE_VALUE);
502 if (mmio->is_write) {
503 vgic_set_target_reg(vcpu->kvm, reg, offset & ~3U);
504 vgic_update_state(vcpu->kvm);
505 return true;
506 }
507
508 return false;
509}
510
511static u32 vgic_cfg_expand(u16 val)
512{
513 u32 res = 0;
514 int i;
515
516 /*
517 * Turn a 16bit value like abcd...mnop into a 32bit word
518 * a0b0c0d0...m0n0o0p0, which is what the HW cfg register is.
519 */
520 for (i = 0; i < 16; i++)
521 res |= ((val >> i) & VGIC_CFG_EDGE) << (2 * i + 1);
522
523 return res;
524}
525
526static u16 vgic_cfg_compress(u32 val)
527{
528 u16 res = 0;
529 int i;
530
531 /*
532 * Turn a 32bit word a0b0c0d0...m0n0o0p0 into 16bit value like
533 * abcd...mnop which is what we really care about.
534 */
535 for (i = 0; i < 16; i++)
536 res |= ((val >> (i * 2 + 1)) & VGIC_CFG_EDGE) << i;
537
538 return res;
539}
540
541/*
542 * The distributor uses 2 bits per IRQ for the CFG register, but the
543 * LSB is always 0. As such, we only keep the upper bit, and use the
544 * two above functions to compress/expand the bits
545 */
546static bool handle_mmio_cfg_reg(struct kvm_vcpu *vcpu,
547 struct kvm_exit_mmio *mmio, phys_addr_t offset)
548{
549 u32 val;
550 u32 *reg = vgic_bitmap_get_reg(&vcpu->kvm->arch.vgic.irq_cfg,
551 vcpu->vcpu_id, offset >> 1);
552 if (offset & 2)
553 val = *reg >> 16;
554 else
555 val = *reg & 0xffff;
556
557 val = vgic_cfg_expand(val);
558 vgic_reg_access(mmio, &val, offset,
559 ACCESS_READ_VALUE | ACCESS_WRITE_VALUE);
560 if (mmio->is_write) {
561 if (offset < 4) {
562 *reg = ~0U; /* Force PPIs/SGIs to 1 */
563 return false;
564 }
565
566 val = vgic_cfg_compress(val);
567 if (offset & 2) {
568 *reg &= 0xffff;
569 *reg |= val << 16;
570 } else {
571 *reg &= 0xffff << 16;
572 *reg |= val;
573 }
574 }
575
576 return false;
577}
578
579static bool handle_mmio_sgi_reg(struct kvm_vcpu *vcpu,
580 struct kvm_exit_mmio *mmio, phys_addr_t offset)
581{
582 u32 reg;
583 vgic_reg_access(mmio, &reg, offset,
584 ACCESS_READ_RAZ | ACCESS_WRITE_VALUE);
585 if (mmio->is_write) {
586 vgic_dispatch_sgi(vcpu, reg);
587 vgic_update_state(vcpu->kvm);
588 return true;
589 }
590
591 return false;
592}
593
594/*
595 * I would have liked to use the kvm_bus_io_*() API instead, but it
596 * cannot cope with banked registers (only the VM pointer is passed
597 * around, and we need the vcpu). One of these days, someone please
598 * fix it!
599 */
600struct mmio_range {
601 phys_addr_t base;
602 unsigned long len;
603 bool (*handle_mmio)(struct kvm_vcpu *vcpu, struct kvm_exit_mmio *mmio,
604 phys_addr_t offset);
605};
606
607static const struct mmio_range vgic_ranges[] = {
608 {
609 .base = GIC_DIST_CTRL,
610 .len = 12,
611 .handle_mmio = handle_mmio_misc,
612 },
613 {
614 .base = GIC_DIST_IGROUP,
615 .len = VGIC_NR_IRQS / 8,
616 .handle_mmio = handle_mmio_raz_wi,
617 },
618 {
619 .base = GIC_DIST_ENABLE_SET,
620 .len = VGIC_NR_IRQS / 8,
621 .handle_mmio = handle_mmio_set_enable_reg,
622 },
623 {
624 .base = GIC_DIST_ENABLE_CLEAR,
625 .len = VGIC_NR_IRQS / 8,
626 .handle_mmio = handle_mmio_clear_enable_reg,
627 },
628 {
629 .base = GIC_DIST_PENDING_SET,
630 .len = VGIC_NR_IRQS / 8,
631 .handle_mmio = handle_mmio_set_pending_reg,
632 },
633 {
634 .base = GIC_DIST_PENDING_CLEAR,
635 .len = VGIC_NR_IRQS / 8,
636 .handle_mmio = handle_mmio_clear_pending_reg,
637 },
638 {
639 .base = GIC_DIST_ACTIVE_SET,
640 .len = VGIC_NR_IRQS / 8,
641 .handle_mmio = handle_mmio_raz_wi,
642 },
643 {
644 .base = GIC_DIST_ACTIVE_CLEAR,
645 .len = VGIC_NR_IRQS / 8,
646 .handle_mmio = handle_mmio_raz_wi,
647 },
648 {
649 .base = GIC_DIST_PRI,
650 .len = VGIC_NR_IRQS,
651 .handle_mmio = handle_mmio_priority_reg,
652 },
653 {
654 .base = GIC_DIST_TARGET,
655 .len = VGIC_NR_IRQS,
656 .handle_mmio = handle_mmio_target_reg,
657 },
658 {
659 .base = GIC_DIST_CONFIG,
660 .len = VGIC_NR_IRQS / 4,
661 .handle_mmio = handle_mmio_cfg_reg,
662 },
663 {
664 .base = GIC_DIST_SOFTINT,
665 .len = 4,
666 .handle_mmio = handle_mmio_sgi_reg,
667 },
668 {}
669};
670
671static const
672struct mmio_range *find_matching_range(const struct mmio_range *ranges,
673 struct kvm_exit_mmio *mmio,
674 phys_addr_t base)
675{
676 const struct mmio_range *r = ranges;
677 phys_addr_t addr = mmio->phys_addr - base;
678
679 while (r->len) {
680 if (addr >= r->base &&
681 (addr + mmio->len) <= (r->base + r->len))
682 return r;
683 r++;
684 }
685
686 return NULL;
687}
688
689/**
690 * vgic_handle_mmio - handle an in-kernel MMIO access
691 * @vcpu: pointer to the vcpu performing the access
692 * @run: pointer to the kvm_run structure
693 * @mmio: pointer to the data describing the access
694 *
695 * returns true if the MMIO access has been performed in kernel space,
696 * and false if it needs to be emulated in user space.
697 */
698bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
699 struct kvm_exit_mmio *mmio)
700{
701 const struct mmio_range *range;
702 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
703 unsigned long base = dist->vgic_dist_base;
704 bool updated_state;
705 unsigned long offset;
706
707 if (!irqchip_in_kernel(vcpu->kvm) ||
708 mmio->phys_addr < base ||
709 (mmio->phys_addr + mmio->len) > (base + KVM_VGIC_V2_DIST_SIZE))
710 return false;
711
712 /* We don't support ldrd / strd or ldm / stm to the emulated vgic */
713 if (mmio->len > 4) {
714 kvm_inject_dabt(vcpu, mmio->phys_addr);
715 return true;
716 }
717
718 range = find_matching_range(vgic_ranges, mmio, base);
719 if (unlikely(!range || !range->handle_mmio)) {
720 pr_warn("Unhandled access %d %08llx %d\n",
721 mmio->is_write, mmio->phys_addr, mmio->len);
722 return false;
723 }
724
725 spin_lock(&vcpu->kvm->arch.vgic.lock);
726 offset = mmio->phys_addr - range->base - base;
727 updated_state = range->handle_mmio(vcpu, mmio, offset);
728 spin_unlock(&vcpu->kvm->arch.vgic.lock);
729 kvm_prepare_mmio(run, mmio);
730 kvm_handle_mmio_return(vcpu, run);
731
732 if (updated_state)
733 vgic_kick_vcpus(vcpu->kvm);
734
735 return true;
736}
737
738static void vgic_dispatch_sgi(struct kvm_vcpu *vcpu, u32 reg)
739{
740 struct kvm *kvm = vcpu->kvm;
741 struct vgic_dist *dist = &kvm->arch.vgic;
742 int nrcpus = atomic_read(&kvm->online_vcpus);
743 u8 target_cpus;
744 int sgi, mode, c, vcpu_id;
745
746 vcpu_id = vcpu->vcpu_id;
747
748 sgi = reg & 0xf;
749 target_cpus = (reg >> 16) & 0xff;
750 mode = (reg >> 24) & 3;
751
752 switch (mode) {
753 case 0:
754 if (!target_cpus)
755 return;
756
757 case 1:
758 target_cpus = ((1 << nrcpus) - 1) & ~(1 << vcpu_id) & 0xff;
759 break;
760
761 case 2:
762 target_cpus = 1 << vcpu_id;
763 break;
764 }
765
766 kvm_for_each_vcpu(c, vcpu, kvm) {
767 if (target_cpus & 1) {
768 /* Flag the SGI as pending */
769 vgic_dist_irq_set(vcpu, sgi);
770 dist->irq_sgi_sources[c][sgi] |= 1 << vcpu_id;
771 kvm_debug("SGI%d from CPU%d to CPU%d\n", sgi, vcpu_id, c);
772 }
773
774 target_cpus >>= 1;
775 }
776}
777
778static int compute_pending_for_cpu(struct kvm_vcpu *vcpu)
779{
780 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
781 unsigned long *pending, *enabled, *pend_percpu, *pend_shared;
782 unsigned long pending_private, pending_shared;
783 int vcpu_id;
784
785 vcpu_id = vcpu->vcpu_id;
786 pend_percpu = vcpu->arch.vgic_cpu.pending_percpu;
787 pend_shared = vcpu->arch.vgic_cpu.pending_shared;
788
789 pending = vgic_bitmap_get_cpu_map(&dist->irq_state, vcpu_id);
790 enabled = vgic_bitmap_get_cpu_map(&dist->irq_enabled, vcpu_id);
791 bitmap_and(pend_percpu, pending, enabled, VGIC_NR_PRIVATE_IRQS);
792
793 pending = vgic_bitmap_get_shared_map(&dist->irq_state);
794 enabled = vgic_bitmap_get_shared_map(&dist->irq_enabled);
795 bitmap_and(pend_shared, pending, enabled, VGIC_NR_SHARED_IRQS);
796 bitmap_and(pend_shared, pend_shared,
797 vgic_bitmap_get_shared_map(&dist->irq_spi_target[vcpu_id]),
798 VGIC_NR_SHARED_IRQS);
799
800 pending_private = find_first_bit(pend_percpu, VGIC_NR_PRIVATE_IRQS);
801 pending_shared = find_first_bit(pend_shared, VGIC_NR_SHARED_IRQS);
802 return (pending_private < VGIC_NR_PRIVATE_IRQS ||
803 pending_shared < VGIC_NR_SHARED_IRQS);
804}
805
806/*
807 * Update the interrupt state and determine which CPUs have pending
808 * interrupts. Must be called with distributor lock held.
809 */
810static void vgic_update_state(struct kvm *kvm)
811{
812 struct vgic_dist *dist = &kvm->arch.vgic;
813 struct kvm_vcpu *vcpu;
814 int c;
815
816 if (!dist->enabled) {
817 set_bit(0, &dist->irq_pending_on_cpu);
818 return;
819 }
820
821 kvm_for_each_vcpu(c, vcpu, kvm) {
822 if (compute_pending_for_cpu(vcpu)) {
823 pr_debug("CPU%d has pending interrupts\n", c);
824 set_bit(c, &dist->irq_pending_on_cpu);
825 }
826 }
827}
828
829#define LR_CPUID(lr) \
830 (((lr) & GICH_LR_PHYSID_CPUID) >> GICH_LR_PHYSID_CPUID_SHIFT)
831#define MK_LR_PEND(src, irq) \
832 (GICH_LR_PENDING_BIT | ((src) << GICH_LR_PHYSID_CPUID_SHIFT) | (irq))
833
834/*
835 * An interrupt may have been disabled after being made pending on the
836 * CPU interface (the classic case is a timer running while we're
837 * rebooting the guest - the interrupt would kick as soon as the CPU
838 * interface gets enabled, with deadly consequences).
839 *
840 * The solution is to examine already active LRs, and check the
841 * interrupt is still enabled. If not, just retire it.
842 */
843static void vgic_retire_disabled_irqs(struct kvm_vcpu *vcpu)
844{
845 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
846 int lr;
847
848 for_each_set_bit(lr, vgic_cpu->lr_used, vgic_cpu->nr_lr) {
849 int irq = vgic_cpu->vgic_lr[lr] & GICH_LR_VIRTUALID;
850
851 if (!vgic_irq_is_enabled(vcpu, irq)) {
852 vgic_cpu->vgic_irq_lr_map[irq] = LR_EMPTY;
853 clear_bit(lr, vgic_cpu->lr_used);
854 vgic_cpu->vgic_lr[lr] &= ~GICH_LR_STATE;
855 if (vgic_irq_is_active(vcpu, irq))
856 vgic_irq_clear_active(vcpu, irq);
857 }
858 }
859}
860
861/*
862 * Queue an interrupt to a CPU virtual interface. Return true on success,
863 * or false if it wasn't possible to queue it.
864 */
865static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
866{
867 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
868 int lr;
869
870 /* Sanitize the input... */
871 BUG_ON(sgi_source_id & ~7);
872 BUG_ON(sgi_source_id && irq >= VGIC_NR_SGIS);
873 BUG_ON(irq >= VGIC_NR_IRQS);
874
875 kvm_debug("Queue IRQ%d\n", irq);
876
877 lr = vgic_cpu->vgic_irq_lr_map[irq];
878
879 /* Do we have an active interrupt for the same CPUID? */
880 if (lr != LR_EMPTY &&
881 (LR_CPUID(vgic_cpu->vgic_lr[lr]) == sgi_source_id)) {
882 kvm_debug("LR%d piggyback for IRQ%d %x\n",
883 lr, irq, vgic_cpu->vgic_lr[lr]);
884 BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
885 vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT;
886 return true;
887 }
888
889 /* Try to use another LR for this interrupt */
890 lr = find_first_zero_bit((unsigned long *)vgic_cpu->lr_used,
891 vgic_cpu->nr_lr);
892 if (lr >= vgic_cpu->nr_lr)
893 return false;
894
895 kvm_debug("LR%d allocated for IRQ%d %x\n", lr, irq, sgi_source_id);
896 vgic_cpu->vgic_lr[lr] = MK_LR_PEND(sgi_source_id, irq);
897 vgic_cpu->vgic_irq_lr_map[irq] = lr;
898 set_bit(lr, vgic_cpu->lr_used);
899
900 if (!vgic_irq_is_edge(vcpu, irq))
901 vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI;
902
903 return true;
904}
905
906static bool vgic_queue_sgi(struct kvm_vcpu *vcpu, int irq)
907{
908 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
909 unsigned long sources;
910 int vcpu_id = vcpu->vcpu_id;
911 int c;
912
913 sources = dist->irq_sgi_sources[vcpu_id][irq];
914
915 for_each_set_bit(c, &sources, VGIC_MAX_CPUS) {
916 if (vgic_queue_irq(vcpu, c, irq))
917 clear_bit(c, &sources);
918 }
919
920 dist->irq_sgi_sources[vcpu_id][irq] = sources;
921
922 /*
923 * If the sources bitmap has been cleared it means that we
924 * could queue all the SGIs onto link registers (see the
925 * clear_bit above), and therefore we are done with them in
926 * our emulated gic and can get rid of them.
927 */
928 if (!sources) {
929 vgic_dist_irq_clear(vcpu, irq);
930 vgic_cpu_irq_clear(vcpu, irq);
931 return true;
932 }
933
934 return false;
935}
936
937static bool vgic_queue_hwirq(struct kvm_vcpu *vcpu, int irq)
938{
939 if (vgic_irq_is_active(vcpu, irq))
940 return true; /* level interrupt, already queued */
941
942 if (vgic_queue_irq(vcpu, 0, irq)) {
943 if (vgic_irq_is_edge(vcpu, irq)) {
944 vgic_dist_irq_clear(vcpu, irq);
945 vgic_cpu_irq_clear(vcpu, irq);
946 } else {
947 vgic_irq_set_active(vcpu, irq);
948 }
949
950 return true;
951 }
952
953 return false;
954}
955
956/*
957 * Fill the list registers with pending interrupts before running the
958 * guest.
959 */
960static void __kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
961{
962 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
963 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
964 int i, vcpu_id;
965 int overflow = 0;
966
967 vcpu_id = vcpu->vcpu_id;
968
969 /*
970 * We may not have any pending interrupt, or the interrupts
971 * may have been serviced from another vcpu. In all cases,
972 * move along.
973 */
974 if (!kvm_vgic_vcpu_pending_irq(vcpu)) {
975 pr_debug("CPU%d has no pending interrupt\n", vcpu_id);
976 goto epilog;
977 }
978
979 /* SGIs */
980 for_each_set_bit(i, vgic_cpu->pending_percpu, VGIC_NR_SGIS) {
981 if (!vgic_queue_sgi(vcpu, i))
982 overflow = 1;
983 }
984
985 /* PPIs */
986 for_each_set_bit_from(i, vgic_cpu->pending_percpu, VGIC_NR_PRIVATE_IRQS) {
987 if (!vgic_queue_hwirq(vcpu, i))
988 overflow = 1;
989 }
990
991 /* SPIs */
992 for_each_set_bit(i, vgic_cpu->pending_shared, VGIC_NR_SHARED_IRQS) {
993 if (!vgic_queue_hwirq(vcpu, i + VGIC_NR_PRIVATE_IRQS))
994 overflow = 1;
995 }
996
997epilog:
998 if (overflow) {
999 vgic_cpu->vgic_hcr |= GICH_HCR_UIE;
1000 } else {
1001 vgic_cpu->vgic_hcr &= ~GICH_HCR_UIE;
1002 /*
1003 * We're about to run this VCPU, and we've consumed
1004 * everything the distributor had in store for
1005 * us. Claim we don't have anything pending. We'll
1006 * adjust that if needed while exiting.
1007 */
1008 clear_bit(vcpu_id, &dist->irq_pending_on_cpu);
1009 }
1010}
1011
1012static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1013{
1014 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
1015 bool level_pending = false;
1016
1017 kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr);
1018
1019 if (vgic_cpu->vgic_misr & GICH_MISR_EOI) {
1020 /*
1021 * Some level interrupts have been EOIed. Clear their
1022 * active bit.
1023 */
1024 int lr, irq;
1025
1026 for_each_set_bit(lr, (unsigned long *)vgic_cpu->vgic_eisr,
1027 vgic_cpu->nr_lr) {
1028 irq = vgic_cpu->vgic_lr[lr] & GICH_LR_VIRTUALID;
1029
1030 vgic_irq_clear_active(vcpu, irq);
1031 vgic_cpu->vgic_lr[lr] &= ~GICH_LR_EOI;
1032
1033 /* Any additional pending interrupt? */
1034 if (vgic_dist_irq_is_pending(vcpu, irq)) {
1035 vgic_cpu_irq_set(vcpu, irq);
1036 level_pending = true;
1037 } else {
1038 vgic_cpu_irq_clear(vcpu, irq);
1039 }
1040
1041 /*
1042 * Despite being EOIed, the LR may not have
1043 * been marked as empty.
1044 */
1045 set_bit(lr, (unsigned long *)vgic_cpu->vgic_elrsr);
1046 vgic_cpu->vgic_lr[lr] &= ~GICH_LR_ACTIVE_BIT;
1047 }
1048 }
1049
1050 if (vgic_cpu->vgic_misr & GICH_MISR_U)
1051 vgic_cpu->vgic_hcr &= ~GICH_HCR_UIE;
1052
1053 return level_pending;
1054}
1055
1056/*
1057 * Sync back the VGIC state after a guest run. The distributor lock is
1058 * needed so we don't get preempted in the middle of the state processing.
1059 */
1060static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
1061{
1062 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
1063 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1064 int lr, pending;
1065 bool level_pending;
1066
1067 level_pending = vgic_process_maintenance(vcpu);
1068
1069 /* Clear mappings for empty LRs */
1070 for_each_set_bit(lr, (unsigned long *)vgic_cpu->vgic_elrsr,
1071 vgic_cpu->nr_lr) {
1072 int irq;
1073
1074 if (!test_and_clear_bit(lr, vgic_cpu->lr_used))
1075 continue;
1076
1077 irq = vgic_cpu->vgic_lr[lr] & GICH_LR_VIRTUALID;
1078
1079 BUG_ON(irq >= VGIC_NR_IRQS);
1080 vgic_cpu->vgic_irq_lr_map[irq] = LR_EMPTY;
1081 }
1082
1083 /* Check if we still have something up our sleeve... */
1084 pending = find_first_zero_bit((unsigned long *)vgic_cpu->vgic_elrsr,
1085 vgic_cpu->nr_lr);
1086 if (level_pending || pending < vgic_cpu->nr_lr)
1087 set_bit(vcpu->vcpu_id, &dist->irq_pending_on_cpu);
1088}
1089
1090void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
1091{
1092 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1093
1094 if (!irqchip_in_kernel(vcpu->kvm))
1095 return;
1096
1097 spin_lock(&dist->lock);
1098 __kvm_vgic_flush_hwstate(vcpu);
1099 spin_unlock(&dist->lock);
1100}
1101
1102void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
1103{
1104 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1105
1106 if (!irqchip_in_kernel(vcpu->kvm))
1107 return;
1108
1109 spin_lock(&dist->lock);
1110 __kvm_vgic_sync_hwstate(vcpu);
1111 spin_unlock(&dist->lock);
1112}
1113
1114int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
1115{
1116 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1117
1118 if (!irqchip_in_kernel(vcpu->kvm))
1119 return 0;
1120
1121 return test_bit(vcpu->vcpu_id, &dist->irq_pending_on_cpu);
1122}
1123
1124static void vgic_kick_vcpus(struct kvm *kvm)
1125{
1126 struct kvm_vcpu *vcpu;
1127 int c;
1128
1129 /*
1130 * We've injected an interrupt, time to find out who deserves
1131 * a good kick...
1132 */
1133 kvm_for_each_vcpu(c, vcpu, kvm) {
1134 if (kvm_vgic_vcpu_pending_irq(vcpu))
1135 kvm_vcpu_kick(vcpu);
1136 }
1137}
1138
1139static int vgic_validate_injection(struct kvm_vcpu *vcpu, int irq, int level)
1140{
1141 int is_edge = vgic_irq_is_edge(vcpu, irq);
1142 int state = vgic_dist_irq_is_pending(vcpu, irq);
1143
1144 /*
1145 * Only inject an interrupt if:
1146 * - edge triggered and we have a rising edge
1147 * - level triggered and we change level
1148 */
1149 if (is_edge)
1150 return level > state;
1151 else
1152 return level != state;
1153}
1154
1155static bool vgic_update_irq_state(struct kvm *kvm, int cpuid,
1156 unsigned int irq_num, bool level)
1157{
1158 struct vgic_dist *dist = &kvm->arch.vgic;
1159 struct kvm_vcpu *vcpu;
1160 int is_edge, is_level;
1161 int enabled;
1162 bool ret = true;
1163
1164 spin_lock(&dist->lock);
1165
1166 vcpu = kvm_get_vcpu(kvm, cpuid);
1167 is_edge = vgic_irq_is_edge(vcpu, irq_num);
1168 is_level = !is_edge;
1169
1170 if (!vgic_validate_injection(vcpu, irq_num, level)) {
1171 ret = false;
1172 goto out;
1173 }
1174
1175 if (irq_num >= VGIC_NR_PRIVATE_IRQS) {
1176 cpuid = dist->irq_spi_cpu[irq_num - VGIC_NR_PRIVATE_IRQS];
1177 vcpu = kvm_get_vcpu(kvm, cpuid);
1178 }
1179
1180 kvm_debug("Inject IRQ%d level %d CPU%d\n", irq_num, level, cpuid);
1181
1182 if (level)
1183 vgic_dist_irq_set(vcpu, irq_num);
1184 else
1185 vgic_dist_irq_clear(vcpu, irq_num);
1186
1187 enabled = vgic_irq_is_enabled(vcpu, irq_num);
1188
1189 if (!enabled) {
1190 ret = false;
1191 goto out;
1192 }
1193
1194 if (is_level && vgic_irq_is_active(vcpu, irq_num)) {
1195 /*
1196 * Level interrupt in progress, will be picked up
1197 * when EOId.
1198 */
1199 ret = false;
1200 goto out;
1201 }
1202
1203 if (level) {
1204 vgic_cpu_irq_set(vcpu, irq_num);
1205 set_bit(cpuid, &dist->irq_pending_on_cpu);
1206 }
1207
1208out:
1209 spin_unlock(&dist->lock);
1210
1211 return ret;
1212}
1213
1214/**
1215 * kvm_vgic_inject_irq - Inject an IRQ from a device to the vgic
1216 * @kvm: The VM structure pointer
1217 * @cpuid: The CPU for PPIs
1218 * @irq_num: The IRQ number that is assigned to the device
1219 * @level: Edge-triggered: true: to trigger the interrupt
1220 * false: to ignore the call
1221 * Level-sensitive true: activates an interrupt
1222 * false: deactivates an interrupt
1223 *
1224 * The GIC is not concerned with devices being active-LOW or active-HIGH for
1225 * level-sensitive interrupts. You can think of the level parameter as 1
1226 * being HIGH and 0 being LOW and all devices being active-HIGH.
1227 */
1228int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int irq_num,
1229 bool level)
1230{
1231 if (vgic_update_irq_state(kvm, cpuid, irq_num, level))
1232 vgic_kick_vcpus(kvm);
1233
1234 return 0;
1235}
1236
1237static irqreturn_t vgic_maintenance_handler(int irq, void *data)
1238{
1239 /*
1240 * We cannot rely on the vgic maintenance interrupt to be
1241 * delivered synchronously. This means we can only use it to
1242 * exit the VM, and we perform the handling of EOIed
1243 * interrupts on the exit path (see vgic_process_maintenance).
1244 */
1245 return IRQ_HANDLED;
1246}
1247
1248int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
1249{
1250 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
1251 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1252 int i;
1253
1254 if (!irqchip_in_kernel(vcpu->kvm))
1255 return 0;
1256
1257 if (vcpu->vcpu_id >= VGIC_MAX_CPUS)
1258 return -EBUSY;
1259
1260 for (i = 0; i < VGIC_NR_IRQS; i++) {
1261 if (i < VGIC_NR_PPIS)
1262 vgic_bitmap_set_irq_val(&dist->irq_enabled,
1263 vcpu->vcpu_id, i, 1);
1264 if (i < VGIC_NR_PRIVATE_IRQS)
1265 vgic_bitmap_set_irq_val(&dist->irq_cfg,
1266 vcpu->vcpu_id, i, VGIC_CFG_EDGE);
1267
1268 vgic_cpu->vgic_irq_lr_map[i] = LR_EMPTY;
1269 }
1270
1271 /*
1272 * By forcing VMCR to zero, the GIC will restore the binary
1273 * points to their reset values. Anything else resets to zero
1274 * anyway.
1275 */
1276 vgic_cpu->vgic_vmcr = 0;
1277
1278 vgic_cpu->nr_lr = vgic_nr_lr;
1279 vgic_cpu->vgic_hcr = GICH_HCR_EN; /* Get the show on the road... */
1280
1281 return 0;
1282}
1283
1284static void vgic_init_maintenance_interrupt(void *info)
1285{
1286 enable_percpu_irq(vgic_maint_irq, 0);
1287}
1288
1289static int vgic_cpu_notify(struct notifier_block *self,
1290 unsigned long action, void *cpu)
1291{
1292 switch (action) {
1293 case CPU_STARTING:
1294 case CPU_STARTING_FROZEN:
1295 vgic_init_maintenance_interrupt(NULL);
1296 break;
1297 case CPU_DYING:
1298 case CPU_DYING_FROZEN:
1299 disable_percpu_irq(vgic_maint_irq);
1300 break;
1301 }
1302
1303 return NOTIFY_OK;
1304}
1305
1306static struct notifier_block vgic_cpu_nb = {
1307 .notifier_call = vgic_cpu_notify,
1308};
1309
1310int kvm_vgic_hyp_init(void)
1311{
1312 int ret;
1313 struct resource vctrl_res;
1314 struct resource vcpu_res;
1315
1316 vgic_node = of_find_compatible_node(NULL, NULL, "arm,cortex-a15-gic");
1317 if (!vgic_node) {
1318 kvm_err("error: no compatible vgic node in DT\n");
1319 return -ENODEV;
1320 }
1321
1322 vgic_maint_irq = irq_of_parse_and_map(vgic_node, 0);
1323 if (!vgic_maint_irq) {
1324 kvm_err("error getting vgic maintenance irq from DT\n");
1325 ret = -ENXIO;
1326 goto out;
1327 }
1328
1329 ret = request_percpu_irq(vgic_maint_irq, vgic_maintenance_handler,
1330 "vgic", kvm_get_running_vcpus());
1331 if (ret) {
1332 kvm_err("Cannot register interrupt %d\n", vgic_maint_irq);
1333 goto out;
1334 }
1335
1336 ret = register_cpu_notifier(&vgic_cpu_nb);
1337 if (ret) {
1338 kvm_err("Cannot register vgic CPU notifier\n");
1339 goto out_free_irq;
1340 }
1341
1342 ret = of_address_to_resource(vgic_node, 2, &vctrl_res);
1343 if (ret) {
1344 kvm_err("Cannot obtain VCTRL resource\n");
1345 goto out_free_irq;
1346 }
1347
1348 vgic_vctrl_base = of_iomap(vgic_node, 2);
1349 if (!vgic_vctrl_base) {
1350 kvm_err("Cannot ioremap VCTRL\n");
1351 ret = -ENOMEM;
1352 goto out_free_irq;
1353 }
1354
1355 vgic_nr_lr = readl_relaxed(vgic_vctrl_base + GICH_VTR);
1356 vgic_nr_lr = (vgic_nr_lr & 0x3f) + 1;
1357
1358 ret = create_hyp_io_mappings(vgic_vctrl_base,
1359 vgic_vctrl_base + resource_size(&vctrl_res),
1360 vctrl_res.start);
1361 if (ret) {
1362 kvm_err("Cannot map VCTRL into hyp\n");
1363 goto out_unmap;
1364 }
1365
1366 kvm_info("%s@%llx IRQ%d\n", vgic_node->name,
1367 vctrl_res.start, vgic_maint_irq);
1368 on_each_cpu(vgic_init_maintenance_interrupt, NULL, 1);
1369
1370 if (of_address_to_resource(vgic_node, 3, &vcpu_res)) {
1371 kvm_err("Cannot obtain VCPU resource\n");
1372 ret = -ENXIO;
1373 goto out_unmap;
1374 }
1375 vgic_vcpu_base = vcpu_res.start;
1376
1377 goto out;
1378
1379out_unmap:
1380 iounmap(vgic_vctrl_base);
1381out_free_irq:
1382 free_percpu_irq(vgic_maint_irq, kvm_get_running_vcpus());
1383out:
1384 of_node_put(vgic_node);
1385 return ret;
1386}
1387
1388int kvm_vgic_init(struct kvm *kvm)
1389{
1390 int ret = 0, i;
1391
1392 mutex_lock(&kvm->lock);
1393
1394 if (vgic_initialized(kvm))
1395 goto out;
1396
1397 if (IS_VGIC_ADDR_UNDEF(kvm->arch.vgic.vgic_dist_base) ||
1398 IS_VGIC_ADDR_UNDEF(kvm->arch.vgic.vgic_cpu_base)) {
1399 kvm_err("Need to set vgic cpu and dist addresses first\n");
1400 ret = -ENXIO;
1401 goto out;
1402 }
1403
1404 ret = kvm_phys_addr_ioremap(kvm, kvm->arch.vgic.vgic_cpu_base,
1405 vgic_vcpu_base, KVM_VGIC_V2_CPU_SIZE);
1406 if (ret) {
1407 kvm_err("Unable to remap VGIC CPU to VCPU\n");
1408 goto out;
1409 }
1410
1411 for (i = VGIC_NR_PRIVATE_IRQS; i < VGIC_NR_IRQS; i += 4)
1412 vgic_set_target_reg(kvm, 0, i);
1413
1414 kvm_timer_init(kvm);
1415 kvm->arch.vgic.ready = true;
1416out:
1417 mutex_unlock(&kvm->lock);
1418 return ret;
1419}
1420
1421int kvm_vgic_create(struct kvm *kvm)
1422{
1423 int ret = 0;
1424
1425 mutex_lock(&kvm->lock);
1426
1427 if (atomic_read(&kvm->online_vcpus) || kvm->arch.vgic.vctrl_base) {
1428 ret = -EEXIST;
1429 goto out;
1430 }
1431
1432 spin_lock_init(&kvm->arch.vgic.lock);
1433 kvm->arch.vgic.vctrl_base = vgic_vctrl_base;
1434 kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF;
1435 kvm->arch.vgic.vgic_cpu_base = VGIC_ADDR_UNDEF;
1436
1437out:
1438 mutex_unlock(&kvm->lock);
1439 return ret;
1440}
1441
1442static bool vgic_ioaddr_overlap(struct kvm *kvm)
1443{
1444 phys_addr_t dist = kvm->arch.vgic.vgic_dist_base;
1445 phys_addr_t cpu = kvm->arch.vgic.vgic_cpu_base;
1446
1447 if (IS_VGIC_ADDR_UNDEF(dist) || IS_VGIC_ADDR_UNDEF(cpu))
1448 return 0;
1449 if ((dist <= cpu && dist + KVM_VGIC_V2_DIST_SIZE > cpu) ||
1450 (cpu <= dist && cpu + KVM_VGIC_V2_CPU_SIZE > dist))
1451 return -EBUSY;
1452 return 0;
1453}
1454
1455static int vgic_ioaddr_assign(struct kvm *kvm, phys_addr_t *ioaddr,
1456 phys_addr_t addr, phys_addr_t size)
1457{
1458 int ret;
1459
1460 if (!IS_VGIC_ADDR_UNDEF(*ioaddr))
1461 return -EEXIST;
1462 if (addr + size < addr)
1463 return -EINVAL;
1464
1465 ret = vgic_ioaddr_overlap(kvm);
1466 if (ret)
1467 return ret;
1468 *ioaddr = addr;
1469 return ret;
1470}
1471
1472int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr)
1473{
1474 int r = 0;
1475 struct vgic_dist *vgic = &kvm->arch.vgic;
1476
1477 if (addr & ~KVM_PHYS_MASK)
1478 return -E2BIG;
1479
1480 if (addr & (SZ_4K - 1))
1481 return -EINVAL;
1482
1483 mutex_lock(&kvm->lock);
1484 switch (type) {
1485 case KVM_VGIC_V2_ADDR_TYPE_DIST:
1486 r = vgic_ioaddr_assign(kvm, &vgic->vgic_dist_base,
1487 addr, KVM_VGIC_V2_DIST_SIZE);
1488 break;
1489 case KVM_VGIC_V2_ADDR_TYPE_CPU:
1490 r = vgic_ioaddr_assign(kvm, &vgic->vgic_cpu_base,
1491 addr, KVM_VGIC_V2_CPU_SIZE);
1492 break;
1493 default:
1494 r = -ENODEV;
1495 }
1496
1497 mutex_unlock(&kvm->lock);
1498 return r;
1499}
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 02802386b894..699b71e7f7ec 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -163,6 +163,7 @@ config MACH_SAMA5_DT
163 bool "Atmel SAMA5 Evaluation Kits with device-tree support" 163 bool "Atmel SAMA5 Evaluation Kits with device-tree support"
164 depends on SOC_SAMA5 164 depends on SOC_SAMA5
165 select USE_OF 165 select USE_OF
166 select PHYLIB if NETDEVICES
166 help 167 help
167 Select this if you want to experiment device-tree with 168 Select this if you want to experiment device-tree with
168 an Atmel Evaluation Kit. 169 an Atmel Evaluation Kit.
diff --git a/arch/arm/mach-at91/Kconfig.non_dt b/arch/arm/mach-at91/Kconfig.non_dt
index 6c24985515a2..ca900be144ce 100644
--- a/arch/arm/mach-at91/Kconfig.non_dt
+++ b/arch/arm/mach-at91/Kconfig.non_dt
@@ -14,15 +14,11 @@ config ARCH_AT91RM9200
14 select SOC_AT91RM9200 14 select SOC_AT91RM9200
15 15
16config ARCH_AT91SAM9260 16config ARCH_AT91SAM9260
17 bool "AT91SAM9260 or AT91SAM9XE" 17 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20"
18 select SOC_AT91SAM9260 18 select SOC_AT91SAM9260
19 19
20config ARCH_AT91SAM9261 20config ARCH_AT91SAM9261
21 bool "AT91SAM9261" 21 bool "AT91SAM9261 or AT91SAM9G10"
22 select SOC_AT91SAM9261
23
24config ARCH_AT91SAM9G10
25 bool "AT91SAM9G10"
26 select SOC_AT91SAM9261 22 select SOC_AT91SAM9261
27 23
28config ARCH_AT91SAM9263 24config ARCH_AT91SAM9263
@@ -33,10 +29,6 @@ config ARCH_AT91SAM9RL
33 bool "AT91SAM9RL" 29 bool "AT91SAM9RL"
34 select SOC_AT91SAM9RL 30 select SOC_AT91SAM9RL
35 31
36config ARCH_AT91SAM9G20
37 bool "AT91SAM9G20"
38 select SOC_AT91SAM9260
39
40config ARCH_AT91SAM9G45 32config ARCH_AT91SAM9G45
41 bool "AT91SAM9G45" 33 bool "AT91SAM9G45"
42 select SOC_AT91SAM9G45 34 select SOC_AT91SAM9G45
@@ -50,6 +42,14 @@ config ARCH_AT91X40
50 42
51endchoice 43endchoice
52 44
45config ARCH_AT91SAM9G20
46 bool
47 select ARCH_AT91SAM9260
48
49config ARCH_AT91SAM9G10
50 bool
51 select ARCH_AT91SAM9261
52
53# ---------------------------------------------------------- 53# ----------------------------------------------------------
54 54
55if ARCH_AT91RM9200 55if ARCH_AT91RM9200
@@ -62,13 +62,6 @@ config MACH_ONEARM
62 Select this if you are using Ajeco's 1ARM Single Board Computer. 62 Select this if you are using Ajeco's 1ARM Single Board Computer.
63 <http://www.ajeco.fi/> 63 <http://www.ajeco.fi/>
64 64
65config ARCH_AT91RM9200DK
66 bool "Atmel AT91RM9200-DK Development board"
67 select HAVE_AT91_DATAFLASH_CARD
68 help
69 Select this if you are using Atmel's AT91RM9200-DK Development board.
70 (Discontinued)
71
72config MACH_AT91RM9200EK 65config MACH_AT91RM9200EK
73 bool "Atmel AT91RM9200-EK Evaluation Kit" 66 bool "Atmel AT91RM9200-EK Evaluation Kit"
74 select HAVE_AT91_DATAFLASH_CARD 67 select HAVE_AT91_DATAFLASH_CARD
@@ -183,12 +176,6 @@ config MACH_AFEB9260
183 <svn://194.85.238.22/home/users/george/svn/arm9eb> 176 <svn://194.85.238.22/home/users/george/svn/arm9eb>
184 <http://groups.google.com/group/arm9fpga-evolution-board> 177 <http://groups.google.com/group/arm9fpga-evolution-board>
185 178
186config MACH_USB_A9260
187 bool "CALAO USB-A9260"
188 help
189 Select this if you are using a Calao Systems USB-A9260.
190 <http://www.calao-systems.com>
191
192config MACH_QIL_A9260 179config MACH_QIL_A9260
193 bool "CALAO QIL-A9260 board" 180 bool "CALAO QIL-A9260 board"
194 help 181 help
@@ -207,76 +194,6 @@ config MACH_FLEXIBITY
207 Select this if you are using Flexibity Connect board 194 Select this if you are using Flexibity Connect board
208 <http://www.flexibity.com> 195 <http://www.flexibity.com>
209 196
210endif
211
212# ----------------------------------------------------------
213
214if ARCH_AT91SAM9261
215
216comment "AT91SAM9261 Board Type"
217
218config MACH_AT91SAM9261EK
219 bool "Atmel AT91SAM9261-EK Evaluation Kit"
220 select HAVE_AT91_DATAFLASH_CARD
221 help
222 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
223 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
224
225endif
226
227# ----------------------------------------------------------
228
229if ARCH_AT91SAM9G10
230
231comment "AT91SAM9G10 Board Type"
232
233config MACH_AT91SAM9G10EK
234 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
235 select HAVE_AT91_DATAFLASH_CARD
236 help
237 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
238 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
239
240endif
241
242# ----------------------------------------------------------
243
244if ARCH_AT91SAM9263
245
246comment "AT91SAM9263 Board Type"
247
248config MACH_AT91SAM9263EK
249 bool "Atmel AT91SAM9263-EK Evaluation Kit"
250 select HAVE_AT91_DATAFLASH_CARD
251 help
252 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
253 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
254
255config MACH_USB_A9263
256 bool "CALAO USB-A9263"
257 help
258 Select this if you are using a Calao Systems USB-A9263.
259 <http://www.calao-systems.com>
260
261endif
262
263# ----------------------------------------------------------
264
265if ARCH_AT91SAM9RL
266
267comment "AT91SAM9RL Board Type"
268
269config MACH_AT91SAM9RLEK
270 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
271 help
272 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
273
274endif
275
276# ----------------------------------------------------------
277
278if ARCH_AT91SAM9G20
279
280comment "AT91SAM9G20 Board Type" 197comment "AT91SAM9G20 Board Type"
281 198
282config MACH_AT91SAM9G20EK 199config MACH_AT91SAM9G20EK
@@ -334,24 +251,64 @@ config MACH_GSIA18S
334 produced by GeoSIG Ltd company. This is an internet accelerograph. 251 produced by GeoSIG Ltd company. This is an internet accelerograph.
335 <http://www.geosig.com> 252 <http://www.geosig.com>
336 253
337config MACH_USB_A9G20 254config MACH_SNAPPER_9260
338 bool "CALAO USB-A9G20" 255 bool "Bluewater Systems Snapper 9260/9G20 module"
339 depends on ARCH_AT91SAM9G20 256 help
257 Select this if you are using the Bluewater Systems Snapper 9260 or
258 Snapper 9G20 modules.
259 <http://www.bluewatersys.com/>
260endif
261
262# ----------------------------------------------------------
263
264if ARCH_AT91SAM9261
265
266comment "AT91SAM9261 Board Type"
267
268config MACH_AT91SAM9261EK
269 bool "Atmel AT91SAM9261-EK Evaluation Kit"
270 select HAVE_AT91_DATAFLASH_CARD
340 help 271 help
341 Select this if you are using a Calao Systems USB-A9G20. 272 Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
342 <http://www.calao-systems.com> 273 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
274
275comment "AT91SAM9G10 Board Type"
276
277config MACH_AT91SAM9G10EK
278 bool "Atmel AT91SAM9G10-EK Evaluation Kit"
279 select HAVE_AT91_DATAFLASH_CARD
280 help
281 Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
282 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
343 283
344endif 284endif
345 285
346if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20) 286# ----------------------------------------------------------
347comment "AT91SAM9260/AT91SAM9G20 boards" 287
288if ARCH_AT91SAM9263
289
290comment "AT91SAM9263 Board Type"
291
292config MACH_AT91SAM9263EK
293 bool "Atmel AT91SAM9263-EK Evaluation Kit"
294 select HAVE_AT91_DATAFLASH_CARD
295 help
296 Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
297 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
298
299endif
300
301# ----------------------------------------------------------
302
303if ARCH_AT91SAM9RL
304
305comment "AT91SAM9RL Board Type"
306
307config MACH_AT91SAM9RLEK
308 bool "Atmel AT91SAM9RL-EK Evaluation Kit"
309 help
310 Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
348 311
349config MACH_SNAPPER_9260
350 bool "Bluewater Systems Snapper 9260/9G20 module"
351 help
352 Select this if you are using the Bluewater Systems Snapper 9260 or
353 Snapper 9G20 modules.
354 <http://www.bluewatersys.com/>
355endif 312endif
356 313
357# ---------------------------------------------------------- 314# ----------------------------------------------------------
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 788562dccb43..3b0a9538093c 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -27,16 +27,13 @@ obj-$(CONFIG_SOC_SAMA5D3) += sama5d3.o
27obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o 27obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200_devices.o
28obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o 28obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260_devices.o
29obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261_devices.o 29obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261_devices.o
30obj-$(CONFIG_ARCH_AT91SAM9G10) += at91sam9261_devices.o
31obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263_devices.o 30obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263_devices.o
32obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl_devices.o 31obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl_devices.o
33obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260_devices.o
34obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45_devices.o 32obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45_devices.o
35obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 33obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
36 34
37# AT91RM9200 board-specific support 35# AT91RM9200 board-specific support
38obj-$(CONFIG_MACH_ONEARM) += board-1arm.o 36obj-$(CONFIG_MACH_ONEARM) += board-1arm.o
39obj-$(CONFIG_ARCH_AT91RM9200DK) += board-rm9200dk.o
40obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o 37obj-$(CONFIG_MACH_AT91RM9200EK) += board-rm9200ek.o
41obj-$(CONFIG_MACH_CSB337) += board-csb337.o 38obj-$(CONFIG_MACH_CSB337) += board-csb337.o
42obj-$(CONFIG_MACH_CSB637) += board-csb637.o 39obj-$(CONFIG_MACH_CSB637) += board-csb637.o
@@ -55,7 +52,6 @@ obj-$(CONFIG_MACH_RSI_EWS) += board-rsi-ews.o
55obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 52obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
56obj-$(CONFIG_MACH_CAM60) += board-cam60.o 53obj-$(CONFIG_MACH_CAM60) += board-cam60.o
57obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o 54obj-$(CONFIG_MACH_SAM9_L9260) += board-sam9-l9260.o
58obj-$(CONFIG_MACH_USB_A9260) += board-usb-a926x.o
59obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o 55obj-$(CONFIG_MACH_QIL_A9260) += board-qil-a9260.o
60obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o 56obj-$(CONFIG_MACH_AFEB9260) += board-afeb-9260v1.o
61obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o 57obj-$(CONFIG_MACH_CPU9260) += board-cpu9krea.o
@@ -67,7 +63,6 @@ obj-$(CONFIG_MACH_AT91SAM9G10EK) += board-sam9261ek.o
67 63
68# AT91SAM9263 board-specific support 64# AT91SAM9263 board-specific support
69obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o 65obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
70obj-$(CONFIG_MACH_USB_A9263) += board-usb-a926x.o
71 66
72# AT91SAM9RL board-specific support 67# AT91SAM9RL board-specific support
73obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o 68obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
@@ -80,7 +75,6 @@ obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
80obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 75obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
81obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o 76obj-$(CONFIG_MACH_PCONTROL_G20) += board-pcontrol-g20.o board-stamp9g20.o
82obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o 77obj-$(CONFIG_MACH_GSIA18S) += board-gsia18s.o board-stamp9g20.o
83obj-$(CONFIG_MACH_USB_A9G20) += board-usb-a926x.o
84 78
85# AT91SAM9260/AT91SAM9G20 board-specific support 79# AT91SAM9260/AT91SAM9G20 board-specific support
86obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o 80obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index d193a409bc45..9eb574397ee1 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -332,10 +332,6 @@ static void __init at91rm9200_initialize(void)
332{ 332{
333 arm_pm_idle = at91rm9200_idle; 333 arm_pm_idle = at91rm9200_idle;
334 arm_pm_restart = at91rm9200_restart; 334 arm_pm_restart = at91rm9200_restart;
335 at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
336 | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
337 | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
338 | (1 << AT91RM9200_ID_IRQ6);
339 335
340 /* Initialize GPIO subsystem */ 336 /* Initialize GPIO subsystem */
341 at91_gpio_init(at91rm9200_gpio, 337 at91_gpio_init(at91rm9200_gpio,
@@ -388,6 +384,10 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
388AT91_SOC_START(at91rm9200) 384AT91_SOC_START(at91rm9200)
389 .map_io = at91rm9200_map_io, 385 .map_io = at91rm9200_map_io,
390 .default_irq_priority = at91rm9200_default_irq_priority, 386 .default_irq_priority = at91rm9200_default_irq_priority,
387 .extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
388 | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
389 | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
390 | (1 << AT91RM9200_ID_IRQ6),
391 .ioremap_registers = at91rm9200_ioremap_registers, 391 .ioremap_registers = at91rm9200_ioremap_registers,
392 .register_clocks = at91rm9200_register_clocks, 392 .register_clocks = at91rm9200_register_clocks,
393 .init = at91rm9200_initialize, 393 .init = at91rm9200_initialize,
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index a8ce24538da6..5de6074b4f4f 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -348,8 +348,6 @@ static void __init at91sam9260_initialize(void)
348{ 348{
349 arm_pm_idle = at91sam9_idle; 349 arm_pm_idle = at91sam9_idle;
350 arm_pm_restart = at91sam9_alt_restart; 350 arm_pm_restart = at91sam9_alt_restart;
351 at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
352 | (1 << AT91SAM9260_ID_IRQ2);
353 351
354 /* Register GPIO subsystem */ 352 /* Register GPIO subsystem */
355 at91_gpio_init(at91sam9260_gpio, 3); 353 at91_gpio_init(at91sam9260_gpio, 3);
@@ -400,6 +398,8 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
400AT91_SOC_START(at91sam9260) 398AT91_SOC_START(at91sam9260)
401 .map_io = at91sam9260_map_io, 399 .map_io = at91sam9260_map_io,
402 .default_irq_priority = at91sam9260_default_irq_priority, 400 .default_irq_priority = at91sam9260_default_irq_priority,
401 .extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
402 | (1 << AT91SAM9260_ID_IRQ2),
403 .ioremap_registers = at91sam9260_ioremap_registers, 403 .ioremap_registers = at91sam9260_ioremap_registers,
404 .register_clocks = at91sam9260_register_clocks, 404 .register_clocks = at91sam9260_register_clocks,
405 .init = at91sam9260_initialize, 405 .init = at91sam9260_initialize,
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 25efb5ac30f1..0e0793241ab7 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -290,8 +290,6 @@ static void __init at91sam9261_initialize(void)
290{ 290{
291 arm_pm_idle = at91sam9_idle; 291 arm_pm_idle = at91sam9_idle;
292 arm_pm_restart = at91sam9_alt_restart; 292 arm_pm_restart = at91sam9_alt_restart;
293 at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
294 | (1 << AT91SAM9261_ID_IRQ2);
295 293
296 /* Register GPIO subsystem */ 294 /* Register GPIO subsystem */
297 at91_gpio_init(at91sam9261_gpio, 3); 295 at91_gpio_init(at91sam9261_gpio, 3);
@@ -342,6 +340,8 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
342AT91_SOC_START(at91sam9261) 340AT91_SOC_START(at91sam9261)
343 .map_io = at91sam9261_map_io, 341 .map_io = at91sam9261_map_io,
344 .default_irq_priority = at91sam9261_default_irq_priority, 342 .default_irq_priority = at91sam9261_default_irq_priority,
343 .extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
344 | (1 << AT91SAM9261_ID_IRQ2),
345 .ioremap_registers = at91sam9261_ioremap_registers, 345 .ioremap_registers = at91sam9261_ioremap_registers,
346 .register_clocks = at91sam9261_register_clocks, 346 .register_clocks = at91sam9261_register_clocks,
347 .init = at91sam9261_initialize, 347 .init = at91sam9261_initialize,
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index f44ffd2105a7..6ce7d1850893 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -327,7 +327,6 @@ static void __init at91sam9263_initialize(void)
327{ 327{
328 arm_pm_idle = at91sam9_idle; 328 arm_pm_idle = at91sam9_idle;
329 arm_pm_restart = at91sam9_alt_restart; 329 arm_pm_restart = at91sam9_alt_restart;
330 at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
331 330
332 /* Register GPIO subsystem */ 331 /* Register GPIO subsystem */
333 at91_gpio_init(at91sam9263_gpio, 5); 332 at91_gpio_init(at91sam9263_gpio, 5);
@@ -378,6 +377,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
378AT91_SOC_START(at91sam9263) 377AT91_SOC_START(at91sam9263)
379 .map_io = at91sam9263_map_io, 378 .map_io = at91sam9263_map_io,
380 .default_irq_priority = at91sam9263_default_irq_priority, 379 .default_irq_priority = at91sam9263_default_irq_priority,
380 .extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1),
381 .ioremap_registers = at91sam9263_ioremap_registers, 381 .ioremap_registers = at91sam9263_ioremap_registers,
382 .register_clocks = at91sam9263_register_clocks, 382 .register_clocks = at91sam9263_register_clocks,
383 .init = at91sam9263_initialize, 383 .init = at91sam9263_initialize,
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 8b7fce067652..474ee04d24b9 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -266,6 +266,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
266 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk), 266 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
267 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk), 267 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
268 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk), 268 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
269 CLKDEV_CON_DEV_ID("hclk", "600000.gadget", &utmi_clk),
270 CLKDEV_CON_DEV_ID("pclk", "600000.gadget", &udphs_clk),
269 /* fake hclk clock */ 271 /* fake hclk clock */
270 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), 272 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
271 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk), 273 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
@@ -374,7 +376,6 @@ static void __init at91sam9g45_initialize(void)
374{ 376{
375 arm_pm_idle = at91sam9_idle; 377 arm_pm_idle = at91sam9_idle;
376 arm_pm_restart = at91sam9g45_restart; 378 arm_pm_restart = at91sam9g45_restart;
377 at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
378 379
379 /* Register GPIO subsystem */ 380 /* Register GPIO subsystem */
380 at91_gpio_init(at91sam9g45_gpio, 5); 381 at91_gpio_init(at91sam9g45_gpio, 5);
@@ -425,6 +426,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
425AT91_SOC_START(at91sam9g45) 426AT91_SOC_START(at91sam9g45)
426 .map_io = at91sam9g45_map_io, 427 .map_io = at91sam9g45_map_io,
427 .default_irq_priority = at91sam9g45_default_irq_priority, 428 .default_irq_priority = at91sam9g45_default_irq_priority,
429 .extern_irq = (1 << AT91SAM9G45_ID_IRQ0),
428 .ioremap_registers = at91sam9g45_ioremap_registers, 430 .ioremap_registers = at91sam9g45_ioremap_registers,
429 .register_clocks = at91sam9g45_register_clocks, 431 .register_clocks = at91sam9g45_register_clocks,
430 .init = at91sam9g45_initialize, 432 .init = at91sam9g45_initialize,
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index f77fae5591bc..d4ec0d9a9872 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -293,7 +293,6 @@ static void __init at91sam9rl_initialize(void)
293{ 293{
294 arm_pm_idle = at91sam9_idle; 294 arm_pm_idle = at91sam9_idle;
295 arm_pm_restart = at91sam9_alt_restart; 295 arm_pm_restart = at91sam9_alt_restart;
296 at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
297 296
298 /* Register GPIO subsystem */ 297 /* Register GPIO subsystem */
299 at91_gpio_init(at91sam9rl_gpio, 4); 298 at91_gpio_init(at91sam9rl_gpio, 4);
@@ -344,6 +343,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
344AT91_SOC_START(at91sam9rl) 343AT91_SOC_START(at91sam9rl)
345 .map_io = at91sam9rl_map_io, 344 .map_io = at91sam9rl_map_io,
346 .default_irq_priority = at91sam9rl_default_irq_priority, 345 .default_irq_priority = at91sam9rl_default_irq_priority,
346 .extern_irq = (1 << AT91SAM9RL_ID_IRQ0),
347 .ioremap_registers = at91sam9rl_ioremap_registers, 347 .ioremap_registers = at91sam9rl_ioremap_registers,
348 .register_clocks = at91sam9rl_register_clocks, 348 .register_clocks = at91sam9rl_register_clocks,
349 .init = at91sam9rl_initialize, 349 .init = at91sam9rl_initialize,
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index e631fec040ce..2abee6626aac 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -249,6 +249,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
249 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk), 249 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
250 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk), 250 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
251 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk), 251 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
252 CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk),
253 CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk),
252}; 254};
253 255
254/* 256/*
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index 19ca79396905..bad94b84a46f 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -55,8 +55,6 @@ static void at91x40_idle(void)
55void __init at91x40_initialize(unsigned long main_clock) 55void __init at91x40_initialize(unsigned long main_clock)
56{ 56{
57 arm_pm_idle = at91x40_idle; 57 arm_pm_idle = at91x40_idle;
58 at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
59 | (1 << AT91X40_ID_IRQ2);
60} 58}
61 59
62/* 60/*
@@ -86,9 +84,10 @@ static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = {
86 84
87void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS]) 85void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS])
88{ 86{
87 u32 extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
88 | (1 << AT91X40_ID_IRQ2);
89 if (!priority) 89 if (!priority)
90 priority = at91x40_default_irq_priority; 90 priority = at91x40_default_irq_priority;
91 91
92 at91_aic_init(priority, at91_extern_irq); 92 at91_aic_init(priority, extern_irq);
93} 93}
94
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index 705305e62bbc..ad95f6a23a28 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -62,7 +62,8 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
62 62
63static void __init sama5_dt_device_init(void) 63static void __init sama5_dt_device_init(void)
64{ 64{
65 if (of_machine_is_compatible("atmel,sama5d3xcm")) 65 if (of_machine_is_compatible("atmel,sama5d3xcm") &&
66 IS_ENABLED(CONFIG_PHYLIB))
66 phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, 67 phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
67 ksz9021rn_phy_fixup); 68 ksz9021rn_phy_fixup);
68 69
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
deleted file mode 100644
index 690541b18cbc..000000000000
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ /dev/null
@@ -1,228 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-rm9200dk.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * Epson S1D framebuffer glue code is:
7 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/gpio.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30#include <linux/spi/spi.h>
31#include <linux/mtd/physmap.h>
32
33#include <asm/setup.h>
34#include <asm/mach-types.h>
35#include <asm/irq.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40
41#include <mach/hardware.h>
42#include <mach/at91rm9200_mc.h>
43#include <mach/at91_ramc.h>
44
45#include "at91_aic.h"
46#include "board.h"
47#include "generic.h"
48
49
50static void __init dk_init_early(void)
51{
52 /* Initialize processor: 18.432 MHz crystal */
53 at91_initialize(18432000);
54}
55
56static struct macb_platform_data __initdata dk_eth_data = {
57 .phy_irq_pin = AT91_PIN_PC4,
58 .is_rmii = 1,
59};
60
61static struct at91_usbh_data __initdata dk_usbh_data = {
62 .ports = 2,
63 .vbus_pin = {-EINVAL, -EINVAL},
64 .overcurrent_pin= {-EINVAL, -EINVAL},
65};
66
67static struct at91_udc_data __initdata dk_udc_data = {
68 .vbus_pin = AT91_PIN_PD4,
69 .pullup_pin = AT91_PIN_PD5,
70};
71
72static struct at91_cf_data __initdata dk_cf_data = {
73 .irq_pin = -EINVAL,
74 .det_pin = AT91_PIN_PB0,
75 .vcc_pin = -EINVAL,
76 .rst_pin = AT91_PIN_PC5,
77};
78
79#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD
80static struct mci_platform_data __initdata dk_mci0_data = {
81 .slot[0] = {
82 .bus_width = 4,
83 .detect_pin = -EINVAL,
84 .wp_pin = -EINVAL,
85 },
86};
87#endif
88
89static struct spi_board_info dk_spi_devices[] = {
90 { /* DataFlash chip */
91 .modalias = "mtd_dataflash",
92 .chip_select = 0,
93 .max_speed_hz = 15 * 1000 * 1000,
94 },
95 { /* UR6HCPS2-SP40 PS2-to-SPI adapter */
96 .modalias = "ur6hcps2",
97 .chip_select = 1,
98 .max_speed_hz = 250 * 1000,
99 },
100 { /* TLV1504 ADC, 4 channels, 10 bits; one is a temp sensor */
101 .modalias = "tlv1504",
102 .chip_select = 2,
103 .max_speed_hz = 20 * 1000 * 1000,
104 },
105#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
106 { /* DataFlash card */
107 .modalias = "mtd_dataflash",
108 .chip_select = 3,
109 .max_speed_hz = 15 * 1000 * 1000,
110 }
111#endif
112};
113
114static struct i2c_board_info __initdata dk_i2c_devices[] = {
115 {
116 I2C_BOARD_INFO("ics1523", 0x26),
117 },
118 {
119 I2C_BOARD_INFO("x9429", 0x28),
120 },
121 {
122 I2C_BOARD_INFO("24c1024", 0x50),
123 }
124};
125
126static struct mtd_partition __initdata dk_nand_partition[] = {
127 {
128 .name = "NAND Partition 1",
129 .offset = 0,
130 .size = MTDPART_SIZ_FULL,
131 },
132};
133
134static struct atmel_nand_data __initdata dk_nand_data = {
135 .ale = 22,
136 .cle = 21,
137 .det_pin = AT91_PIN_PB1,
138 .rdy_pin = AT91_PIN_PC2,
139 .enable_pin = -EINVAL,
140 .ecc_mode = NAND_ECC_SOFT,
141 .on_flash_bbt = 1,
142 .parts = dk_nand_partition,
143 .num_parts = ARRAY_SIZE(dk_nand_partition),
144};
145
146#define DK_FLASH_BASE AT91_CHIPSELECT_0
147#define DK_FLASH_SIZE SZ_2M
148
149static struct physmap_flash_data dk_flash_data = {
150 .width = 2,
151};
152
153static struct resource dk_flash_resource = {
154 .start = DK_FLASH_BASE,
155 .end = DK_FLASH_BASE + DK_FLASH_SIZE - 1,
156 .flags = IORESOURCE_MEM,
157};
158
159static struct platform_device dk_flash = {
160 .name = "physmap-flash",
161 .id = 0,
162 .dev = {
163 .platform_data = &dk_flash_data,
164 },
165 .resource = &dk_flash_resource,
166 .num_resources = 1,
167};
168
169static struct gpio_led dk_leds[] = {
170 {
171 .name = "led0",
172 .gpio = AT91_PIN_PB2,
173 .active_low = 1,
174 .default_trigger = "heartbeat",
175 }
176};
177
178static void __init dk_board_init(void)
179{
180 /* Serial */
181 /* DBGU on ttyS0. (Rx & Tx only) */
182 at91_register_uart(0, 0, 0);
183
184 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
185 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
186 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
187 | ATMEL_UART_RI);
188 at91_add_device_serial();
189 /* Ethernet */
190 at91_add_device_eth(&dk_eth_data);
191 /* USB Host */
192 at91_add_device_usbh(&dk_usbh_data);
193 /* USB Device */
194 at91_add_device_udc(&dk_udc_data);
195 at91_set_multi_drive(dk_udc_data.pullup_pin, 1); /* pullup_pin is connected to reset */
196 /* Compact Flash */
197 at91_add_device_cf(&dk_cf_data);
198 /* I2C */
199 at91_add_device_i2c(dk_i2c_devices, ARRAY_SIZE(dk_i2c_devices));
200 /* SPI */
201 at91_add_device_spi(dk_spi_devices, ARRAY_SIZE(dk_spi_devices));
202#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
203 /* DataFlash card */
204 at91_set_gpio_output(AT91_PIN_PB7, 0);
205#else
206 /* MMC */
207 at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
208 at91_add_device_mci(0, &dk_mci0_data);
209#endif
210 /* NAND */
211 at91_add_device_nand(&dk_nand_data);
212 /* NOR Flash */
213 platform_device_register(&dk_flash);
214 /* LEDs */
215 at91_gpio_leds(dk_leds, ARRAY_SIZE(dk_leds));
216 /* VGA */
217// dk_add_device_video();
218}
219
220MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
221 /* Maintainer: SAN People/Atmel */
222 .init_time = at91rm9200_timer_init,
223 .map_io = at91_map_io,
224 .handle_irq = at91_aic_handle_irq,
225 .init_early = dk_init_early,
226 .init_irq = at91_init_irq_default,
227 .init_machine = dk_board_init,
228MACHINE_END
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index b446645c7727..d3437624ca4e 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -264,11 +264,7 @@ static void __init ek_add_device_ts(void) {}
264 */ 264 */
265static struct at73c213_board_info at73c213_data = { 265static struct at73c213_board_info at73c213_data = {
266 .ssc_id = 1, 266 .ssc_id = 1,
267#if defined(CONFIG_MACH_AT91SAM9261EK) 267 .shortname = "AT91SAM9261/9G10-EK external DAC",
268 .shortname = "AT91SAM9261-EK external DAC",
269#else
270 .shortname = "AT91SAM9G10-EK external DAC",
271#endif
272}; 268};
273 269
274#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE) 270#if defined(CONFIG_SND_AT73C213) || defined(CONFIG_SND_AT73C213_MODULE)
@@ -412,9 +408,6 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
412 .default_monspecs = &at91fb_default_stn_monspecs, 408 .default_monspecs = &at91fb_default_stn_monspecs,
413 .atmel_lcdfb_power_control = at91_lcdc_stn_power_control, 409 .atmel_lcdfb_power_control = at91_lcdc_stn_power_control,
414 .guard_time = 1, 410 .guard_time = 1,
415#if defined(CONFIG_MACH_AT91SAM9G10EK)
416 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
417#endif
418}; 411};
419 412
420#else 413#else
@@ -468,9 +461,6 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
468 .default_monspecs = &at91fb_default_tft_monspecs, 461 .default_monspecs = &at91fb_default_tft_monspecs,
469 .atmel_lcdfb_power_control = at91_lcdc_tft_power_control, 462 .atmel_lcdfb_power_control = at91_lcdc_tft_power_control,
470 .guard_time = 1, 463 .guard_time = 1,
471#if defined(CONFIG_MACH_AT91SAM9G10EK)
472 .lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB,
473#endif
474}; 464};
475#endif 465#endif
476 466
@@ -574,6 +564,10 @@ static void __init ek_board_init(void)
574 /* DBGU on ttyS0. (Rx & Tx only) */ 564 /* DBGU on ttyS0. (Rx & Tx only) */
575 at91_register_uart(0, 0, 0); 565 at91_register_uart(0, 0, 0);
576 at91_add_device_serial(); 566 at91_add_device_serial();
567
568 if (cpu_is_at91sam9g10())
569 ek_lcdc_data.lcd_wiring_mode = ATMEL_LCDC_WIRING_RGB;
570
577 /* USB Host */ 571 /* USB Host */
578 at91_add_device_usbh(&ek_usbh_data); 572 at91_add_device_usbh(&ek_usbh_data);
579 /* USB Device */ 573 /* USB Device */
@@ -606,11 +600,17 @@ static void __init ek_board_init(void)
606 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); 600 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
607} 601}
608 602
609#if defined(CONFIG_MACH_AT91SAM9261EK)
610MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK") 603MACHINE_START(AT91SAM9261EK, "Atmel AT91SAM9261-EK")
611#else 604 /* Maintainer: Atmel */
605 .init_time = at91sam926x_pit_init,
606 .map_io = at91_map_io,
607 .handle_irq = at91_aic_handle_irq,
608 .init_early = ek_init_early,
609 .init_irq = at91_init_irq_default,
610 .init_machine = ek_board_init,
611MACHINE_END
612
612MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK") 613MACHINE_START(AT91SAM9G10EK, "Atmel AT91SAM9G10-EK")
613#endif
614 /* Maintainer: Atmel */ 614 /* Maintainer: Atmel */
615 .init_time = at91sam926x_pit_init, 615 .init_time = at91sam926x_pit_init,
616 .map_io = at91_map_io, 616 .map_io = at91_map_io,
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
deleted file mode 100644
index 2487d944a1bc..000000000000
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ /dev/null
@@ -1,384 +0,0 @@
1/*
2 * linux/arch/arm/mach-at91/board-usb-a926x.c
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2007 Atmel Corporation.
6 * Copyright (C) 2007 Calao-systems
7 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30#include <linux/gpio_keys.h>
31#include <linux/gpio.h>
32#include <linux/input.h>
33#include <linux/spi/mmc_spi.h>
34
35#include <asm/setup.h>
36#include <asm/mach-types.h>
37#include <asm/irq.h>
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42
43#include <mach/hardware.h>
44#include <mach/at91sam9_smc.h>
45
46#include "at91_aic.h"
47#include "at91_shdwc.h"
48#include "board.h"
49#include "sam9_smc.h"
50#include "generic.h"
51
52
53static void __init ek_init_early(void)
54{
55 /* Initialize processor: 12.00 MHz crystal */
56 at91_initialize(12000000);
57}
58
59/*
60 * USB Host port
61 */
62static struct at91_usbh_data __initdata ek_usbh_data = {
63 .ports = 2,
64 .vbus_pin = {-EINVAL, -EINVAL},
65 .overcurrent_pin= {-EINVAL, -EINVAL},
66};
67
68/*
69 * USB Device port
70 */
71static struct at91_udc_data __initdata ek_udc_data = {
72 .vbus_pin = AT91_PIN_PB11,
73 .pullup_pin = -EINVAL, /* pull-up driven by UDC */
74};
75
76static void __init ek_add_device_udc(void)
77{
78 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
79 ek_udc_data.vbus_pin = AT91_PIN_PC5;
80
81 at91_add_device_udc(&ek_udc_data);
82}
83
84#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
85#define MMC_SPI_CARD_DETECT_INT AT91_PIN_PC4
86static int at91_mmc_spi_init(struct device *dev,
87 irqreturn_t (*detect_int)(int, void *), void *data)
88{
89 /* Configure Interrupt pin as input, no pull-up */
90 at91_set_gpio_input(MMC_SPI_CARD_DETECT_INT, 0);
91 return request_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), detect_int,
92 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
93 "mmc-spi-detect", data);
94}
95
96static void at91_mmc_spi_exit(struct device *dev, void *data)
97{
98 free_irq(gpio_to_irq(MMC_SPI_CARD_DETECT_INT), data);
99}
100
101static struct mmc_spi_platform_data at91_mmc_spi_pdata = {
102 .init = at91_mmc_spi_init,
103 .exit = at91_mmc_spi_exit,
104 .detect_delay = 100, /* msecs */
105};
106#endif
107
108/*
109 * SPI devices.
110 */
111static struct spi_board_info usb_a9263_spi_devices[] = {
112 { /* DataFlash chip */
113 .modalias = "mtd_dataflash",
114 .chip_select = 0,
115 .max_speed_hz = 15 * 1000 * 1000,
116 .bus_num = 0,
117 }
118};
119
120static struct spi_board_info usb_a9g20_spi_devices[] = {
121#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
122 {
123 .modalias = "mmc_spi",
124 .max_speed_hz = 20000000, /* max spi clock (SCK) speed in HZ */
125 .bus_num = 1,
126 .chip_select = 0,
127 .platform_data = &at91_mmc_spi_pdata,
128 .mode = SPI_MODE_3,
129 },
130#endif
131};
132
133static void __init ek_add_device_spi(void)
134{
135 if (machine_is_usb_a9263())
136 at91_add_device_spi(usb_a9263_spi_devices, ARRAY_SIZE(usb_a9263_spi_devices));
137 else if (machine_is_usb_a9g20())
138 at91_add_device_spi(usb_a9g20_spi_devices, ARRAY_SIZE(usb_a9g20_spi_devices));
139}
140
141/*
142 * MACB Ethernet device
143 */
144static struct macb_platform_data __initdata ek_macb_data = {
145 .phy_irq_pin = AT91_PIN_PE31,
146 .is_rmii = 1,
147};
148
149static void __init ek_add_device_eth(void)
150{
151 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
152 ek_macb_data.phy_irq_pin = AT91_PIN_PA31;
153
154 at91_add_device_eth(&ek_macb_data);
155}
156
157/*
158 * NAND flash
159 */
160static struct mtd_partition __initdata ek_nand_partition[] = {
161 {
162 .name = "barebox",
163 .offset = 0,
164 .size = 3 * SZ_128K,
165 }, {
166 .name = "bareboxenv",
167 .offset = MTDPART_OFS_NXTBLK,
168 .size = SZ_128K,
169 }, {
170 .name = "bareboxenv2",
171 .offset = MTDPART_OFS_NXTBLK,
172 .size = SZ_128K,
173 }, {
174 .name = "oftree",
175 .offset = MTDPART_OFS_NXTBLK,
176 .size = SZ_128K,
177 }, {
178 .name = "kernel",
179 .offset = MTDPART_OFS_NXTBLK,
180 .size = 4 * SZ_1M,
181 }, {
182 .name = "rootfs",
183 .offset = MTDPART_OFS_NXTBLK,
184 .size = 120 * SZ_1M,
185 }, {
186 .name = "data",
187 .offset = MTDPART_OFS_NXTBLK,
188 .size = MTDPART_SIZ_FULL,
189 }
190};
191
192static struct atmel_nand_data __initdata ek_nand_data = {
193 .ale = 21,
194 .cle = 22,
195 .det_pin = -EINVAL,
196 .rdy_pin = AT91_PIN_PA22,
197 .enable_pin = AT91_PIN_PD15,
198 .ecc_mode = NAND_ECC_SOFT,
199 .on_flash_bbt = 1,
200 .parts = ek_nand_partition,
201 .num_parts = ARRAY_SIZE(ek_nand_partition),
202};
203
204static struct sam9_smc_config __initdata usb_a9260_nand_smc_config = {
205 .ncs_read_setup = 0,
206 .nrd_setup = 1,
207 .ncs_write_setup = 0,
208 .nwe_setup = 1,
209
210 .ncs_read_pulse = 3,
211 .nrd_pulse = 3,
212 .ncs_write_pulse = 3,
213 .nwe_pulse = 3,
214
215 .read_cycle = 5,
216 .write_cycle = 5,
217
218 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
219 .tdf_cycles = 2,
220};
221
222static struct sam9_smc_config __initdata usb_a9g20_nand_smc_config = {
223 .ncs_read_setup = 0,
224 .nrd_setup = 2,
225 .ncs_write_setup = 0,
226 .nwe_setup = 2,
227
228 .ncs_read_pulse = 4,
229 .nrd_pulse = 4,
230 .ncs_write_pulse = 4,
231 .nwe_pulse = 4,
232
233 .read_cycle = 7,
234 .write_cycle = 7,
235
236 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8,
237 .tdf_cycles = 3,
238};
239
240static void __init ek_add_device_nand(void)
241{
242 if (machine_is_usb_a9260() || machine_is_usb_a9g20()) {
243 ek_nand_data.rdy_pin = AT91_PIN_PC13;
244 ek_nand_data.enable_pin = AT91_PIN_PC14;
245 }
246
247 /* configure chip-select 3 (NAND) */
248 if (machine_is_usb_a9g20())
249 sam9_smc_configure(0, 3, &usb_a9g20_nand_smc_config);
250 else
251 sam9_smc_configure(0, 3, &usb_a9260_nand_smc_config);
252
253 at91_add_device_nand(&ek_nand_data);
254}
255
256
257/*
258 * GPIO Buttons
259 */
260#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
261static struct gpio_keys_button ek_buttons[] = {
262 { /* USER PUSH BUTTON */
263 .code = KEY_ENTER,
264 .gpio = AT91_PIN_PB10,
265 .active_low = 1,
266 .desc = "user_pb",
267 .wakeup = 1,
268 }
269};
270
271static struct gpio_keys_platform_data ek_button_data = {
272 .buttons = ek_buttons,
273 .nbuttons = ARRAY_SIZE(ek_buttons),
274};
275
276static struct platform_device ek_button_device = {
277 .name = "gpio-keys",
278 .id = -1,
279 .num_resources = 0,
280 .dev = {
281 .platform_data = &ek_button_data,
282 }
283};
284
285static void __init ek_add_device_buttons(void)
286{
287 at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */
288 at91_set_deglitch(AT91_PIN_PB10, 1);
289
290 platform_device_register(&ek_button_device);
291}
292#else
293static void __init ek_add_device_buttons(void) {}
294#endif
295
296/*
297 * LEDs
298 */
299static struct gpio_led ek_leds[] = {
300 { /* user_led (green) */
301 .name = "user_led",
302 .gpio = AT91_PIN_PB21,
303 .active_low = 1,
304 .default_trigger = "heartbeat",
305 }
306};
307
308static struct i2c_board_info __initdata ek_i2c_devices[] = {
309 {
310 I2C_BOARD_INFO("rv3029c2", 0x56),
311 },
312};
313
314static void __init ek_add_device_leds(void)
315{
316 if (machine_is_usb_a9260() || machine_is_usb_a9g20())
317 ek_leds[0].active_low = 0;
318
319 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
320}
321
322static void __init ek_board_init(void)
323{
324 /* Serial */
325 /* DBGU on ttyS0. (Rx & Tx only) */
326 at91_register_uart(0, 0, 0);
327 at91_add_device_serial();
328 /* USB Host */
329 at91_add_device_usbh(&ek_usbh_data);
330 /* USB Device */
331 ek_add_device_udc();
332 /* SPI */
333 ek_add_device_spi();
334 /* Ethernet */
335 ek_add_device_eth();
336 /* NAND */
337 ek_add_device_nand();
338 /* Push Buttons */
339 ek_add_device_buttons();
340 /* LEDs */
341 ek_add_device_leds();
342
343 if (machine_is_usb_a9g20()) {
344 /* I2C */
345 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
346 } else {
347 /* I2C */
348 at91_add_device_i2c(NULL, 0);
349 /* shutdown controller, wakeup button (5 msec low) */
350 at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10)
351 | AT91_SHDW_WKMODE0_LOW
352 | AT91_SHDW_RTTWKEN);
353 }
354}
355
356MACHINE_START(USB_A9263, "CALAO USB_A9263")
357 /* Maintainer: calao-systems */
358 .init_time = at91sam926x_pit_init,
359 .map_io = at91_map_io,
360 .handle_irq = at91_aic_handle_irq,
361 .init_early = ek_init_early,
362 .init_irq = at91_init_irq_default,
363 .init_machine = ek_board_init,
364MACHINE_END
365
366MACHINE_START(USB_A9260, "CALAO USB_A9260")
367 /* Maintainer: calao-systems */
368 .init_time = at91sam926x_pit_init,
369 .map_io = at91_map_io,
370 .handle_irq = at91_aic_handle_irq,
371 .init_early = ek_init_early,
372 .init_irq = at91_init_irq_default,
373 .init_machine = ek_board_init,
374MACHINE_END
375
376MACHINE_START(USB_A9G20, "CALAO USB_A92G0")
377 /* Maintainer: Jean-Christophe PLAGNIOL-VILLARD */
378 .init_time = at91sam926x_pit_init,
379 .map_io = at91_map_io,
380 .handle_irq = at91_aic_handle_irq,
381 .init_early = ek_init_early,
382 .init_irq = at91_init_irq_default,
383 .init_machine = ek_board_init,
384MACHINE_END
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index da841885d01c..6b2630a92f71 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -75,7 +75,7 @@ EXPORT_SYMBOL_GPL(at91_pmc_base);
75#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \ 75#define cpu_has_pllb() (!(cpu_is_at91sam9rl() \
76 || cpu_is_at91sam9g45() \ 76 || cpu_is_at91sam9g45() \
77 || cpu_is_at91sam9x5() \ 77 || cpu_is_at91sam9x5() \
78 || cpu_is_at91sam9n12())) 78 || cpu_is_sama5d3()))
79 79
80#define cpu_has_upll() (cpu_is_at91sam9g45() \ 80#define cpu_has_upll() (cpu_is_at91sam9g45() \
81 || cpu_is_at91sam9x5() \ 81 || cpu_is_at91sam9x5() \
@@ -489,7 +489,7 @@ static int at91_clk_show(struct seq_file *s, void *unused)
489 seq_printf(s, "UCKR = %8x\n", uckr); 489 seq_printf(s, "UCKR = %8x\n", uckr);
490 } 490 }
491 seq_printf(s, "MCKR = %8x\n", at91_pmc_read(AT91_PMC_MCKR)); 491 seq_printf(s, "MCKR = %8x\n", at91_pmc_read(AT91_PMC_MCKR));
492 if (cpu_has_upll()) 492 if (cpu_has_upll() || cpu_is_at91sam9n12())
493 seq_printf(s, "USB = %8x\n", at91_pmc_read(AT91_PMC_USB)); 493 seq_printf(s, "USB = %8x\n", at91_pmc_read(AT91_PMC_USB));
494 seq_printf(s, "SR = %8x\n", sr); 494 seq_printf(s, "SR = %8x\n", sr);
495 495
@@ -614,6 +614,8 @@ static u32 __init at91_usb_rate(struct clk *pll, u32 freq, u32 reg)
614{ 614{
615 if (pll == &pllb && (reg & AT91_PMC_USB96M)) 615 if (pll == &pllb && (reg & AT91_PMC_USB96M))
616 return freq / 2; 616 return freq / 2;
617 else if (pll == &utmi_clk || cpu_is_at91sam9n12())
618 return freq / (1 + ((reg & AT91_PMC_OHCIUSBDIV) >> 8));
617 else 619 else
618 return freq; 620 return freq;
619} 621}
@@ -683,6 +685,8 @@ static struct clk *const standard_pmc_clocks[] __initconst = {
683/* PLLB generated USB full speed clock init */ 685/* PLLB generated USB full speed clock init */
684static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock) 686static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock)
685{ 687{
688 unsigned int reg;
689
686 /* 690 /*
687 * USB clock init: choose 48 MHz PLLB value, 691 * USB clock init: choose 48 MHz PLLB value,
688 * disable 48MHz clock during usb peripheral suspend. 692 * disable 48MHz clock during usb peripheral suspend.
@@ -691,22 +695,35 @@ static void __init at91_pllb_usbfs_clock_init(unsigned long main_clock)
691 */ 695 */
692 uhpck.parent = &pllb; 696 uhpck.parent = &pllb;
693 697
694 at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) | AT91_PMC_USB96M; 698 reg = at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2);
695 pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init); 699 pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init);
696 if (cpu_is_at91rm9200()) { 700 if (cpu_is_at91rm9200()) {
701 reg = at91_pllb_usb_init |= AT91_PMC_USB96M;
697 uhpck.pmc_mask = AT91RM9200_PMC_UHP; 702 uhpck.pmc_mask = AT91RM9200_PMC_UHP;
698 udpck.pmc_mask = AT91RM9200_PMC_UDP; 703 udpck.pmc_mask = AT91RM9200_PMC_UDP;
699 at91_pmc_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP); 704 at91_pmc_write(AT91_PMC_SCER, AT91RM9200_PMC_MCKUDP);
700 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || 705 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() ||
701 cpu_is_at91sam9263() || cpu_is_at91sam9g20() || 706 cpu_is_at91sam9263() || cpu_is_at91sam9g20() ||
702 cpu_is_at91sam9g10()) { 707 cpu_is_at91sam9g10()) {
708 reg = at91_pllb_usb_init |= AT91_PMC_USB96M;
709 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
710 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
711 } else if (cpu_is_at91sam9n12()) {
712 /* Divider for USB clock is in USB clock register for 9n12 */
713 reg = AT91_PMC_USBS_PLLB;
714
715 /* For PLLB output 96M, set usb divider 2 (USBDIV + 1) */
716 reg |= AT91_PMC_OHCIUSBDIV_2;
717 at91_pmc_write(AT91_PMC_USB, reg);
718
719 /* Still setup masks */
703 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 720 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
704 udpck.pmc_mask = AT91SAM926x_PMC_UDP; 721 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
705 } 722 }
706 at91_pmc_write(AT91_CKGR_PLLBR, 0); 723 at91_pmc_write(AT91_CKGR_PLLBR, 0);
707 724
708 udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); 725 udpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, reg);
709 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, at91_pllb_usb_init); 726 uhpck.rate_hz = at91_usb_rate(&pllb, pllb.rate_hz, reg);
710} 727}
711 728
712/* UPLL generated USB full speed clock init */ 729/* UPLL generated USB full speed clock init */
@@ -725,8 +742,7 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock)
725 /* Now set uhpck values */ 742 /* Now set uhpck values */
726 uhpck.parent = &utmi_clk; 743 uhpck.parent = &utmi_clk;
727 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 744 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
728 uhpck.rate_hz = utmi_clk.rate_hz; 745 uhpck.rate_hz = at91_usb_rate(&utmi_clk, utmi_clk.rate_hz, usbr);
729 uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8);
730} 746}
731 747
732static int __init at91_pmc_init(unsigned long main_clock) 748static int __init at91_pmc_init(unsigned long main_clock)
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index 69f9e3bbf4e5..4ec6a6d9b9be 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -51,7 +51,7 @@ static struct cpuidle_driver at91_idle_driver = {
51 .states[1] = { 51 .states[1] = {
52 .enter = at91_enter_idle, 52 .enter = at91_enter_idle,
53 .exit_latency = 10, 53 .exit_latency = 10,
54 .target_residency = 100000, 54 .target_residency = 10000,
55 .flags = CPUIDLE_FLAG_TIME_VALID, 55 .flags = CPUIDLE_FLAG_TIME_VALID,
56 .name = "RAM_SR", 56 .name = "RAM_SR",
57 .desc = "WFI and DDR Self Refresh", 57 .desc = "WFI and DDR Self Refresh",
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 78ab06548658..f6de36aefe85 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -85,4 +85,4 @@ extern void __init at91_gpio_irq_setup(void);
85extern int __init at91_gpio_of_irq_setup(struct device_node *node, 85extern int __init at91_gpio_of_irq_setup(struct device_node *node,
86 struct device_node *parent); 86 struct device_node *parent);
87 87
88extern int at91_extern_irq; 88extern u32 at91_get_extern_irq(void);
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 2bd7f51b0b82..c604cc69acb5 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -130,7 +130,10 @@ extern void __iomem *at91_pmc_base;
130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */ 130#define AT91_PMC_USBS (0x1 << 0) /* USB OHCI Input clock selection */
131#define AT91_PMC_USBS_PLLA (0 << 0) 131#define AT91_PMC_USBS_PLLA (0 << 0)
132#define AT91_PMC_USBS_UPLL (1 << 0) 132#define AT91_PMC_USBS_UPLL (1 << 0)
133#define AT91_PMC_USBS_PLLB (1 << 0) /* [AT91SAMN12 only] */
133#define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */ 134#define AT91_PMC_OHCIUSBDIV (0xF << 8) /* Divider for USB OHCI Clock */
135#define AT91_PMC_OHCIUSBDIV_1 (0x0 << 8)
136#define AT91_PMC_OHCIUSBDIV_2 (0x1 << 8)
134 137
135#define AT91_PMC_SMD 0x3c /* Soft Modem Clock Register [some SAM9 only] */ 138#define AT91_PMC_SMD 0x3c /* Soft Modem Clock Register [some SAM9 only] */
136#define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */ 139#define AT91_PMC_SMDS (0x1 << 0) /* SMD input clock selection */
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
index e0ca59171022..3d192c5aee66 100644
--- a/arch/arm/mach-at91/irq.c
+++ b/arch/arm/mach-at91/irq.c
@@ -232,7 +232,14 @@ static void __maybe_unused at91_aic5_eoi(struct irq_data *d)
232 at91_aic_write(AT91_AIC5_EOICR, 0); 232 at91_aic_write(AT91_AIC5_EOICR, 0);
233} 233}
234 234
235unsigned long *at91_extern_irq; 235static unsigned long *at91_extern_irq;
236
237u32 at91_get_extern_irq(void)
238{
239 if (!at91_extern_irq)
240 return 0;
241 return *at91_extern_irq;
242}
236 243
237#define is_extern_irq(hwirq) test_bit(hwirq, at91_extern_irq) 244#define is_extern_irq(hwirq) test_bit(hwirq, at91_extern_irq)
238 245
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 530db304ec5e..15afb5d9271f 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -212,7 +212,7 @@ static int at91_pm_enter(suspend_state_t state)
212 (at91_pmc_read(AT91_PMC_PCSR) 212 (at91_pmc_read(AT91_PMC_PCSR)
213 | (1 << AT91_ID_FIQ) 213 | (1 << AT91_ID_FIQ)
214 | (1 << AT91_ID_SYS) 214 | (1 << AT91_ID_SYS)
215 | (at91_extern_irq)) 215 | (at91_get_extern_irq()))
216 & at91_aic_read(AT91_AIC_IMR), 216 & at91_aic_read(AT91_AIC_IMR),
217 state); 217 state);
218 218
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index e2f4bdd146d6..b17fbcf4d9e8 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -48,7 +48,7 @@ void __init at91_init_irq_default(void)
48void __init at91_init_interrupts(unsigned int *priority) 48void __init at91_init_interrupts(unsigned int *priority)
49{ 49{
50 /* Initialize the AIC interrupt controller */ 50 /* Initialize the AIC interrupt controller */
51 at91_aic_init(priority, at91_extern_irq); 51 at91_aic_init(priority, at91_boot_soc.extern_irq);
52 52
53 /* Enable GPIO interrupts */ 53 /* Enable GPIO interrupts */
54 at91_gpio_irq_setup(); 54 at91_gpio_irq_setup();
@@ -80,7 +80,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
80 80
81 desc->pfn = __phys_to_pfn(base); 81 desc->pfn = __phys_to_pfn(base);
82 desc->length = length; 82 desc->length = length;
83 desc->type = MT_DEVICE; 83 desc->type = MT_MEMORY_NONCACHED;
84 84
85 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n", 85 pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n",
86 base, length, desc->virtual); 86 base, length, desc->virtual);
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index 43a225f9e713..a1e1482c6da8 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -6,6 +6,7 @@
6 6
7struct at91_init_soc { 7struct at91_init_soc {
8 int builtin; 8 int builtin;
9 u32 extern_irq;
9 unsigned int *default_irq_priority; 10 unsigned int *default_irq_priority;
10 void (*map_io)(void); 11 void (*map_io)(void);
11 void (*ioremap_registers)(void); 12 void (*ioremap_registers)(void);
diff --git a/arch/arm/mach-bcm/board_bcm.c b/arch/arm/mach-bcm/board_bcm.c
index 22e8421b1df3..28599326d4ad 100644
--- a/arch/arm/mach-bcm/board_bcm.c
+++ b/arch/arm/mach-bcm/board_bcm.c
@@ -15,7 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/irqchip.h>
19#include <linux/clocksource.h> 18#include <linux/clocksource.h>
20 19
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -54,7 +53,6 @@ static void __init board_init(void)
54static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, }; 53static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, };
55 54
56DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor") 55DT_MACHINE_START(BCM11351_DT, "Broadcom Application Processor")
57 .init_irq = irqchip_init,
58 .init_time = clocksource_of_init, 56 .init_time = clocksource_of_init,
59 .init_machine = board_init, 57 .init_machine = board_init,
60 .dt_compat = bcm11351_dt_compat, 58 .dt_compat = bcm11351_dt_compat,
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index 2d00165e85ec..01ad4d41e728 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -22,8 +22,7 @@ config ARCH_CLEP7312
22 22
23config ARCH_EDB7211 23config ARCH_EDB7211
24 bool "EDB7211" 24 bool "EDB7211"
25 select ARCH_SELECT_MEMORY_MODEL 25 select ARCH_HAS_HOLES_MEMORYMODEL
26 select ARCH_SPARSEMEM_ENABLE
27 help 26 help
28 Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211 27 Say Y here if you intend to run this kernel on a Cirrus Logic EDB-7211
29 evaluation board. 28 evaluation board.
diff --git a/arch/arm/mach-clps711x/Makefile b/arch/arm/mach-clps711x/Makefile
index 992995af666a..f30ed2b496fb 100644
--- a/arch/arm/mach-clps711x/Makefile
+++ b/arch/arm/mach-clps711x/Makefile
@@ -4,10 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := common.o 7obj-y := common.o devices.o
8obj-m :=
9obj-n :=
10obj- :=
11 8
12obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o 9obj-$(CONFIG_ARCH_AUTCPU12) += board-autcpu12.o
13obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o 10obj-$(CONFIG_ARCH_CDB89712) += board-cdb89712.o
diff --git a/arch/arm/mach-clps711x/board-autcpu12.c b/arch/arm/mach-clps711x/board-autcpu12.c
index f38584709df7..5867aebd8d0c 100644
--- a/arch/arm/mach-clps711x/board-autcpu12.c
+++ b/arch/arm/mach-clps711x/board-autcpu12.c
@@ -26,6 +26,8 @@
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/ioport.h> 27#include <linux/ioport.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/mtd/physmap.h>
30#include <linux/mtd/plat-ram.h>
29#include <linux/mtd/partitions.h> 31#include <linux/mtd/partitions.h>
30#include <linux/mtd/nand-gpio.h> 32#include <linux/mtd/nand-gpio.h>
31#include <linux/platform_device.h> 33#include <linux/platform_device.h>
@@ -40,38 +42,49 @@
40#include <asm/page.h> 42#include <asm/page.h>
41 43
42#include <asm/mach/map.h> 44#include <asm/mach/map.h>
43#include <mach/autcpu12.h>
44 45
45#include "common.h" 46#include "common.h"
47#include "devices.h"
46 48
47#define AUTCPU12_CS8900_BASE (CS2_PHYS_BASE + 0x300) 49/* NOR flash */
48#define AUTCPU12_CS8900_IRQ (IRQ_EINT3) 50#define AUTCPU12_FLASH_BASE (CS0_PHYS_BASE)
51
52/* Board specific hardware definitions */
53#define AUTCPU12_CHAR_LCD_BASE (CS1_PHYS_BASE + 0x00000000)
54#define AUTCPU12_CSAUX1_BASE (CS1_PHYS_BASE + 0x04000000)
55#define AUTCPU12_CAN_BASE (CS1_PHYS_BASE + 0x08000000)
56#define AUTCPU12_TOUCH_BASE (CS1_PHYS_BASE + 0x0a000000)
57#define AUTCPU12_IO_BASE (CS1_PHYS_BASE + 0x0c000000)
58#define AUTCPU12_LPT_BASE (CS1_PHYS_BASE + 0x0e000000)
59
60/* NVRAM */
61#define AUTCPU12_NVRAM_BASE (CS1_PHYS_BASE + 0x02000000)
49 62
63/* SmartMedia flash */
50#define AUTCPU12_SMC_BASE (CS1_PHYS_BASE + 0x06000000) 64#define AUTCPU12_SMC_BASE (CS1_PHYS_BASE + 0x06000000)
51#define AUTCPU12_SMC_SEL_BASE (AUTCPU12_SMC_BASE + 0x10) 65#define AUTCPU12_SMC_SEL_BASE (AUTCPU12_SMC_BASE + 0x10)
52 66
67/* Ethernet */
68#define AUTCPU12_CS8900_BASE (CS2_PHYS_BASE + 0x300)
69#define AUTCPU12_CS8900_IRQ (IRQ_EINT3)
70
71/* NAND flash */
53#define AUTCPU12_MMGPIO_BASE (CLPS711X_NR_GPIO) 72#define AUTCPU12_MMGPIO_BASE (CLPS711X_NR_GPIO)
54#define AUTCPU12_SMC_NCE (AUTCPU12_MMGPIO_BASE + 0) /* Bit 0 */ 73#define AUTCPU12_SMC_NCE (AUTCPU12_MMGPIO_BASE + 0) /* Bit 0 */
55#define AUTCPU12_SMC_RDY CLPS711X_GPIO(1, 2) 74#define AUTCPU12_SMC_RDY CLPS711X_GPIO(1, 2)
56#define AUTCPU12_SMC_ALE CLPS711X_GPIO(1, 3) 75#define AUTCPU12_SMC_ALE CLPS711X_GPIO(1, 3)
57#define AUTCPU12_SMC_CLE CLPS711X_GPIO(1, 3) 76#define AUTCPU12_SMC_CLE CLPS711X_GPIO(1, 3)
58 77
78/* LCD contrast digital potentiometer */
79#define AUTCPU12_DPOT_CS CLPS711X_GPIO(4, 0)
80#define AUTCPU12_DPOT_CLK CLPS711X_GPIO(4, 1)
81#define AUTCPU12_DPOT_UD CLPS711X_GPIO(4, 2)
82
59static struct resource autcpu12_cs8900_resource[] __initdata = { 83static struct resource autcpu12_cs8900_resource[] __initdata = {
60 DEFINE_RES_MEM(AUTCPU12_CS8900_BASE, SZ_1K), 84 DEFINE_RES_MEM(AUTCPU12_CS8900_BASE, SZ_1K),
61 DEFINE_RES_IRQ(AUTCPU12_CS8900_IRQ), 85 DEFINE_RES_IRQ(AUTCPU12_CS8900_IRQ),
62}; 86};
63 87
64static struct resource autcpu12_nvram_resource[] __initdata = {
65 DEFINE_RES_MEM_NAMED(AUTCPU12_PHYS_NVRAM, SZ_128K, "SRAM"),
66};
67
68static struct platform_device autcpu12_nvram_pdev __initdata = {
69 .name = "autcpu12_nvram",
70 .id = -1,
71 .resource = autcpu12_nvram_resource,
72 .num_resources = ARRAY_SIZE(autcpu12_nvram_resource),
73};
74
75static struct resource autcpu12_nand_resource[] __initdata = { 88static struct resource autcpu12_nand_resource[] __initdata = {
76 DEFINE_RES_MEM(AUTCPU12_SMC_BASE, SZ_16), 89 DEFINE_RES_MEM(AUTCPU12_SMC_BASE, SZ_16),
77}; 90};
@@ -147,17 +160,106 @@ static struct platform_device autcpu12_mmgpio_pdev __initdata = {
147 }, 160 },
148}; 161};
149 162
163static const struct gpio autcpu12_gpios[] __initconst = {
164 { AUTCPU12_DPOT_CS, GPIOF_OUT_INIT_HIGH, "DPOT CS" },
165 { AUTCPU12_DPOT_CLK, GPIOF_OUT_INIT_LOW, "DPOT CLK" },
166 { AUTCPU12_DPOT_UD, GPIOF_OUT_INIT_LOW, "DPOT UD" },
167};
168
169static struct mtd_partition autcpu12_flash_partitions[] = {
170 {
171 .name = "NOR.0",
172 .offset = 0,
173 .size = MTDPART_SIZ_FULL,
174 },
175};
176
177static struct physmap_flash_data autcpu12_flash_pdata = {
178 .width = 4,
179 .parts = autcpu12_flash_partitions,
180 .nr_parts = ARRAY_SIZE(autcpu12_flash_partitions),
181};
182
183static struct resource autcpu12_flash_resources[] __initdata = {
184 DEFINE_RES_MEM(AUTCPU12_FLASH_BASE, SZ_8M),
185};
186
187static struct platform_device autcpu12_flash_pdev __initdata = {
188 .name = "physmap-flash",
189 .id = 0,
190 .resource = autcpu12_flash_resources,
191 .num_resources = ARRAY_SIZE(autcpu12_flash_resources),
192 .dev = {
193 .platform_data = &autcpu12_flash_pdata,
194 },
195};
196
197static struct resource autcpu12_nvram_resource[] __initdata = {
198 DEFINE_RES_MEM(AUTCPU12_NVRAM_BASE, 0),
199};
200
201static struct platdata_mtd_ram autcpu12_nvram_pdata = {
202 .bankwidth = 4,
203};
204
205static struct platform_device autcpu12_nvram_pdev __initdata = {
206 .name = "mtd-ram",
207 .id = 0,
208 .resource = autcpu12_nvram_resource,
209 .num_resources = ARRAY_SIZE(autcpu12_nvram_resource),
210 .dev = {
211 .platform_data = &autcpu12_nvram_pdata,
212 },
213};
214
215static void __init autcpu12_nvram_init(void)
216{
217 void __iomem *nvram;
218 unsigned int save[2];
219 resource_size_t nvram_size = SZ_128K;
220
221 /*
222 * Check for 32K/128K
223 * Read ofs 0K
224 * Read ofs 64K
225 * Write complement to ofs 64K
226 * Read and check result on ofs 0K
227 * Restore contents
228 */
229 nvram = ioremap(autcpu12_nvram_resource[0].start, SZ_128K);
230 if (nvram) {
231 save[0] = readl(nvram + 0);
232 save[1] = readl(nvram + SZ_64K);
233 writel(~save[0], nvram + SZ_64K);
234 if (readl(nvram + 0) != save[0]) {
235 writel(save[0], nvram + 0);
236 nvram_size = SZ_32K;
237 } else
238 writel(save[1], nvram + SZ_64K);
239 iounmap(nvram);
240
241 autcpu12_nvram_resource[0].end =
242 autcpu12_nvram_resource[0].start + nvram_size - 1;
243 platform_device_register(&autcpu12_nvram_pdev);
244 } else
245 pr_err("Failed to remap NVRAM resource\n");
246}
247
150static void __init autcpu12_init(void) 248static void __init autcpu12_init(void)
151{ 249{
250 clps711x_devices_init();
251 platform_device_register(&autcpu12_flash_pdev);
152 platform_device_register_simple("video-clps711x", 0, NULL, 0); 252 platform_device_register_simple("video-clps711x", 0, NULL, 0);
153 platform_device_register_simple("cs89x0", 0, autcpu12_cs8900_resource, 253 platform_device_register_simple("cs89x0", 0, autcpu12_cs8900_resource,
154 ARRAY_SIZE(autcpu12_cs8900_resource)); 254 ARRAY_SIZE(autcpu12_cs8900_resource));
155 platform_device_register(&autcpu12_mmgpio_pdev); 255 platform_device_register(&autcpu12_mmgpio_pdev);
156 platform_device_register(&autcpu12_nvram_pdev); 256 autcpu12_nvram_init();
157} 257}
158 258
159static void __init autcpu12_init_late(void) 259static void __init autcpu12_init_late(void)
160{ 260{
261 gpio_request_array(autcpu12_gpios, ARRAY_SIZE(autcpu12_gpios));
262
161 if (IS_ENABLED(MTD_NAND_GPIO) && IS_ENABLED(GPIO_GENERIC_PLATFORM)) { 263 if (IS_ENABLED(MTD_NAND_GPIO) && IS_ENABLED(GPIO_GENERIC_PLATFORM)) {
162 /* We are need both drivers to handle NAND */ 264 /* We are need both drivers to handle NAND */
163 platform_device_register(&autcpu12_nand_pdev); 265 platform_device_register(&autcpu12_nand_pdev);
@@ -169,6 +271,7 @@ MACHINE_START(AUTCPU12, "autronix autcpu12")
169 .atag_offset = 0x20000, 271 .atag_offset = 0x20000,
170 .nr_irqs = CLPS711X_NR_IRQS, 272 .nr_irqs = CLPS711X_NR_IRQS,
171 .map_io = clps711x_map_io, 273 .map_io = clps711x_map_io,
274 .init_early = clps711x_init_early,
172 .init_irq = clps711x_init_irq, 275 .init_irq = clps711x_init_irq,
173 .init_time = clps711x_timer_init, 276 .init_time = clps711x_timer_init,
174 .init_machine = autcpu12_init, 277 .init_machine = autcpu12_init,
diff --git a/arch/arm/mach-clps711x/board-cdb89712.c b/arch/arm/mach-clps711x/board-cdb89712.c
index baab7da33c9b..a9e38c6bcfb4 100644
--- a/arch/arm/mach-clps711x/board-cdb89712.c
+++ b/arch/arm/mach-clps711x/board-cdb89712.c
@@ -39,6 +39,7 @@
39#include <asm/mach/map.h> 39#include <asm/mach/map.h>
40 40
41#include "common.h" 41#include "common.h"
42#include "devices.h"
42 43
43#define CDB89712_CS8900_BASE (CS2_PHYS_BASE + 0x300) 44#define CDB89712_CS8900_BASE (CS2_PHYS_BASE + 0x300)
44#define CDB89712_CS8900_IRQ (IRQ_EINT3) 45#define CDB89712_CS8900_IRQ (IRQ_EINT3)
@@ -127,6 +128,7 @@ static struct platform_device cdb89712_sram_pdev __initdata = {
127 128
128static void __init cdb89712_init(void) 129static void __init cdb89712_init(void)
129{ 130{
131 clps711x_devices_init();
130 platform_device_register(&cdb89712_flash_pdev); 132 platform_device_register(&cdb89712_flash_pdev);
131 platform_device_register(&cdb89712_bootrom_pdev); 133 platform_device_register(&cdb89712_bootrom_pdev);
132 platform_device_register(&cdb89712_sram_pdev); 134 platform_device_register(&cdb89712_sram_pdev);
@@ -139,6 +141,7 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712")
139 .atag_offset = 0x100, 141 .atag_offset = 0x100,
140 .nr_irqs = CLPS711X_NR_IRQS, 142 .nr_irqs = CLPS711X_NR_IRQS,
141 .map_io = clps711x_map_io, 143 .map_io = clps711x_map_io,
144 .init_early = clps711x_init_early,
142 .init_irq = clps711x_init_irq, 145 .init_irq = clps711x_init_irq,
143 .init_time = clps711x_timer_init, 146 .init_time = clps711x_timer_init,
144 .init_machine = cdb89712_init, 147 .init_machine = cdb89712_init,
diff --git a/arch/arm/mach-clps711x/board-clep7312.c b/arch/arm/mach-clps711x/board-clep7312.c
index 014aa3c19a03..b4764246d0f8 100644
--- a/arch/arm/mach-clps711x/board-clep7312.c
+++ b/arch/arm/mach-clps711x/board-clep7312.c
@@ -39,6 +39,7 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
39 .nr_irqs = CLPS711X_NR_IRQS, 39 .nr_irqs = CLPS711X_NR_IRQS,
40 .fixup = fixup_clep7312, 40 .fixup = fixup_clep7312,
41 .map_io = clps711x_map_io, 41 .map_io = clps711x_map_io,
42 .init_early = clps711x_init_early,
42 .init_irq = clps711x_init_irq, 43 .init_irq = clps711x_init_irq,
43 .init_time = clps711x_timer_init, 44 .init_time = clps711x_timer_init,
44 .handle_irq = clps711x_handle_irq, 45 .handle_irq = clps711x_handle_irq,
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index 5f928e9ed2ef..9dfb990f0801 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -12,6 +12,7 @@
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/memblock.h> 13#include <linux/memblock.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/i2c-gpio.h>
15#include <linux/interrupt.h> 16#include <linux/interrupt.h>
16#include <linux/backlight.h> 17#include <linux/backlight.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -29,6 +30,7 @@
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30 31
31#include "common.h" 32#include "common.h"
33#include "devices.h"
32 34
33#define VIDEORAM_SIZE SZ_128K 35#define VIDEORAM_SIZE SZ_128K
34 36
@@ -36,11 +38,24 @@
36#define EDB7211_LCDEN CLPS711X_GPIO(3, 2) 38#define EDB7211_LCDEN CLPS711X_GPIO(3, 2)
37#define EDB7211_LCDBL CLPS711X_GPIO(3, 3) 39#define EDB7211_LCDBL CLPS711X_GPIO(3, 3)
38 40
41#define EDB7211_I2C_SDA CLPS711X_GPIO(3, 4)
42#define EDB7211_I2C_SCL CLPS711X_GPIO(3, 5)
43
39#define EDB7211_FLASH0_BASE (CS0_PHYS_BASE) 44#define EDB7211_FLASH0_BASE (CS0_PHYS_BASE)
40#define EDB7211_FLASH1_BASE (CS1_PHYS_BASE) 45#define EDB7211_FLASH1_BASE (CS1_PHYS_BASE)
46
41#define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) 47#define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300)
42#define EDB7211_CS8900_IRQ (IRQ_EINT3) 48#define EDB7211_CS8900_IRQ (IRQ_EINT3)
43 49
50/* The extra 8 lines of the keyboard matrix */
51#define EDB7211_EXTKBD_BASE (CS3_PHYS_BASE)
52
53static struct i2c_gpio_platform_data edb7211_i2c_pdata __initdata = {
54 .sda_pin = EDB7211_I2C_SDA,
55 .scl_pin = EDB7211_I2C_SCL,
56 .scl_is_output_only = 1,
57};
58
44static struct resource edb7211_cs8900_resource[] __initdata = { 59static struct resource edb7211_cs8900_resource[] __initdata = {
45 DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K), 60 DEFINE_RES_MEM(EDB7211_CS8900_BASE, SZ_1K),
46 DEFINE_RES_IRQ(EDB7211_CS8900_IRQ), 61 DEFINE_RES_IRQ(EDB7211_CS8900_IRQ),
@@ -94,13 +109,14 @@ static struct plat_lcd_data edb7211_lcd_power_pdata = {
94 109
95static void edb7211_lcd_backlight_set_intensity(int intensity) 110static void edb7211_lcd_backlight_set_intensity(int intensity)
96{ 111{
97 gpio_set_value(EDB7211_LCDBL, intensity); 112 gpio_set_value(EDB7211_LCDBL, !!intensity);
113 clps_writel((clps_readl(PMPCON) & 0xf0ff) | (intensity << 8), PMPCON);
98} 114}
99 115
100static struct generic_bl_info edb7211_lcd_backlight_pdata = { 116static struct generic_bl_info edb7211_lcd_backlight_pdata = {
101 .name = "lcd-backlight.0", 117 .name = "lcd-backlight.0",
102 .default_intensity = 0x01, 118 .default_intensity = 0x01,
103 .max_intensity = 0x01, 119 .max_intensity = 0x0f,
104 .set_bl_intensity = edb7211_lcd_backlight_set_intensity, 120 .set_bl_intensity = edb7211_lcd_backlight_set_intensity,
105}; 121};
106 122
@@ -112,8 +128,8 @@ static struct gpio edb7211_gpios[] __initconst = {
112 128
113static struct map_desc edb7211_io_desc[] __initdata = { 129static struct map_desc edb7211_io_desc[] __initdata = {
114 { /* Memory-mapped extra keyboard row */ 130 { /* Memory-mapped extra keyboard row */
115 .virtual = IO_ADDRESS(EP7211_PHYS_EXTKBD), 131 .virtual = IO_ADDRESS(EDB7211_EXTKBD_BASE),
116 .pfn = __phys_to_pfn(EP7211_PHYS_EXTKBD), 132 .pfn = __phys_to_pfn(EDB7211_EXTKBD_BASE),
117 .length = SZ_1M, 133 .length = SZ_1M,
118 .type = MT_DEVICE, 134 .type = MT_DEVICE,
119 }, 135 },
@@ -151,6 +167,11 @@ fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
151 167
152static void __init edb7211_init(void) 168static void __init edb7211_init(void)
153{ 169{
170 clps711x_devices_init();
171}
172
173static void __init edb7211_init_late(void)
174{
154 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios)); 175 gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
155 176
156 platform_device_register(&edb7211_flash_pdev); 177 platform_device_register(&edb7211_flash_pdev);
@@ -163,6 +184,9 @@ static void __init edb7211_init(void)
163 platform_device_register_simple("video-clps711x", 0, NULL, 0); 184 platform_device_register_simple("video-clps711x", 0, NULL, 0);
164 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, 185 platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
165 ARRAY_SIZE(edb7211_cs8900_resource)); 186 ARRAY_SIZE(edb7211_cs8900_resource));
187 platform_device_register_data(&platform_bus, "i2c-gpio", 0,
188 &edb7211_i2c_pdata,
189 sizeof(edb7211_i2c_pdata));
166} 190}
167 191
168MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") 192MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
@@ -172,9 +196,11 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
172 .fixup = fixup_edb7211, 196 .fixup = fixup_edb7211,
173 .reserve = edb7211_reserve, 197 .reserve = edb7211_reserve,
174 .map_io = edb7211_map_io, 198 .map_io = edb7211_map_io,
199 .init_early = clps711x_init_early,
175 .init_irq = clps711x_init_irq, 200 .init_irq = clps711x_init_irq,
176 .init_time = clps711x_timer_init, 201 .init_time = clps711x_timer_init,
177 .init_machine = edb7211_init, 202 .init_machine = edb7211_init,
203 .init_late = edb7211_init_late,
178 .handle_irq = clps711x_handle_irq, 204 .handle_irq = clps711x_handle_irq,
179 .restart = clps711x_restart, 205 .restart = clps711x_restart,
180MACHINE_END 206MACHINE_END
diff --git a/arch/arm/mach-clps711x/board-fortunet.c b/arch/arm/mach-clps711x/board-fortunet.c
index c5675efc8c6a..b1561e3d7c5c 100644
--- a/arch/arm/mach-clps711x/board-fortunet.c
+++ b/arch/arm/mach-clps711x/board-fortunet.c
@@ -77,6 +77,7 @@ MACHINE_START(FORTUNET, "ARM-FortuNet")
77 .nr_irqs = CLPS711X_NR_IRQS, 77 .nr_irqs = CLPS711X_NR_IRQS,
78 .fixup = fortunet_fixup, 78 .fixup = fortunet_fixup,
79 .map_io = clps711x_map_io, 79 .map_io = clps711x_map_io,
80 .init_early = clps711x_init_early,
80 .init_irq = clps711x_init_irq, 81 .init_irq = clps711x_init_irq,
81 .init_time = clps711x_timer_init, 82 .init_time = clps711x_timer_init,
82 .handle_irq = clps711x_handle_irq, 83 .handle_irq = clps711x_handle_irq,
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
index 8d3ee6771135..dd81b06f68fe 100644
--- a/arch/arm/mach-clps711x/board-p720t.c
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -23,10 +23,12 @@
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/gpio.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <linux/leds.h> 28#include <linux/leds.h>
28#include <linux/sizes.h> 29#include <linux/sizes.h>
29#include <linux/backlight.h> 30#include <linux/backlight.h>
31#include <linux/basic_mmio_gpio.h>
30#include <linux/platform_device.h> 32#include <linux/platform_device.h>
31#include <linux/mtd/partitions.h> 33#include <linux/mtd/partitions.h>
32#include <linux/mtd/nand-gpio.h> 34#include <linux/mtd/nand-gpio.h>
@@ -38,11 +40,11 @@
38#include <asm/mach-types.h> 40#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
40#include <asm/mach/map.h> 42#include <asm/mach/map.h>
41#include <mach/syspld.h>
42 43
43#include <video/platform_lcd.h> 44#include <video/platform_lcd.h>
44 45
45#include "common.h" 46#include "common.h"
47#include "devices.h"
46 48
47#define P720T_USERLED CLPS711X_GPIO(3, 0) 49#define P720T_USERLED CLPS711X_GPIO(3, 0)
48#define P720T_NAND_CLE CLPS711X_GPIO(4, 0) 50#define P720T_NAND_CLE CLPS711X_GPIO(4, 0)
@@ -51,6 +53,178 @@
51 53
52#define P720T_NAND_BASE (CLPS711X_SDRAM1_BASE) 54#define P720T_NAND_BASE (CLPS711X_SDRAM1_BASE)
53 55
56#define P720T_MMGPIO_BASE (CLPS711X_NR_GPIO)
57
58#define SYSPLD_PHYS_BASE IOMEM(CS1_PHYS_BASE)
59
60#define PLD_INT (SYSPLD_PHYS_BASE + 0x000000)
61#define PLD_INT_MMGPIO_BASE (P720T_MMGPIO_BASE + 0)
62#define PLD_INT_PENIRQ (PLD_INT_MMGPIO_BASE + 5)
63#define PLD_INT_UCB_IRQ (PLD_INT_MMGPIO_BASE + 1)
64#define PLD_INT_KBD_ATN (PLD_INT_MMGPIO_BASE + 0) /* EINT1 */
65
66#define PLD_PWR (SYSPLD_PHYS_BASE + 0x000004)
67#define PLD_PWR_MMGPIO_BASE (P720T_MMGPIO_BASE + 8)
68#define PLD_PWR_EXT (PLD_PWR_MMGPIO_BASE + 5)
69#define PLD_PWR_MODE (PLD_PWR_MMGPIO_BASE + 4) /* 1 = PWM, 0 = PFM */
70#define PLD_S4_ON (PLD_PWR_MMGPIO_BASE + 3) /* LCD bias voltage enable */
71#define PLD_S3_ON (PLD_PWR_MMGPIO_BASE + 2) /* LCD backlight enable */
72#define PLD_S2_ON (PLD_PWR_MMGPIO_BASE + 1) /* LCD 3V3 supply enable */
73#define PLD_S1_ON (PLD_PWR_MMGPIO_BASE + 0) /* LCD 3V supply enable */
74
75#define PLD_KBD (SYSPLD_PHYS_BASE + 0x000008)
76#define PLD_KBD_MMGPIO_BASE (P720T_MMGPIO_BASE + 16)
77#define PLD_KBD_WAKE (PLD_KBD_MMGPIO_BASE + 1)
78#define PLD_KBD_EN (PLD_KBD_MMGPIO_BASE + 0)
79
80#define PLD_SPI (SYSPLD_PHYS_BASE + 0x00000c)
81#define PLD_SPI_MMGPIO_BASE (P720T_MMGPIO_BASE + 24)
82#define PLD_SPI_EN (PLD_SPI_MMGPIO_BASE + 0)
83
84#define PLD_IO (SYSPLD_PHYS_BASE + 0x000010)
85#define PLD_IO_MMGPIO_BASE (P720T_MMGPIO_BASE + 32)
86#define PLD_IO_BOOTSEL (PLD_IO_MMGPIO_BASE + 6) /* Boot sel switch */
87#define PLD_IO_USER (PLD_IO_MMGPIO_BASE + 5) /* User defined switch */
88#define PLD_IO_LED3 (PLD_IO_MMGPIO_BASE + 4)
89#define PLD_IO_LED2 (PLD_IO_MMGPIO_BASE + 3)
90#define PLD_IO_LED1 (PLD_IO_MMGPIO_BASE + 2)
91#define PLD_IO_LED0 (PLD_IO_MMGPIO_BASE + 1)
92#define PLD_IO_LEDEN (PLD_IO_MMGPIO_BASE + 0)
93
94#define PLD_IRDA (SYSPLD_PHYS_BASE + 0x000014)
95#define PLD_IRDA_MMGPIO_BASE (P720T_MMGPIO_BASE + 40)
96#define PLD_IRDA_EN (PLD_IRDA_MMGPIO_BASE + 0)
97
98#define PLD_COM2 (SYSPLD_PHYS_BASE + 0x000018)
99#define PLD_COM2_MMGPIO_BASE (P720T_MMGPIO_BASE + 48)
100#define PLD_COM2_EN (PLD_COM2_MMGPIO_BASE + 0)
101
102#define PLD_COM1 (SYSPLD_PHYS_BASE + 0x00001c)
103#define PLD_COM1_MMGPIO_BASE (P720T_MMGPIO_BASE + 56)
104#define PLD_COM1_EN (PLD_COM1_MMGPIO_BASE + 0)
105
106#define PLD_AUD (SYSPLD_PHYS_BASE + 0x000020)
107#define PLD_AUD_MMGPIO_BASE (P720T_MMGPIO_BASE + 64)
108#define PLD_AUD_DIV1 (PLD_AUD_MMGPIO_BASE + 6)
109#define PLD_AUD_DIV0 (PLD_AUD_MMGPIO_BASE + 5)
110#define PLD_AUD_CLK_SEL1 (PLD_AUD_MMGPIO_BASE + 4)
111#define PLD_AUD_CLK_SEL0 (PLD_AUD_MMGPIO_BASE + 3)
112#define PLD_AUD_MIC_PWR (PLD_AUD_MMGPIO_BASE + 2)
113#define PLD_AUD_MIC_GAIN (PLD_AUD_MMGPIO_BASE + 1)
114#define PLD_AUD_CODEC_EN (PLD_AUD_MMGPIO_BASE + 0)
115
116#define PLD_CF (SYSPLD_PHYS_BASE + 0x000024)
117#define PLD_CF_MMGPIO_BASE (P720T_MMGPIO_BASE + 72)
118#define PLD_CF2_SLEEP (PLD_CF_MMGPIO_BASE + 5)
119#define PLD_CF1_SLEEP (PLD_CF_MMGPIO_BASE + 4)
120#define PLD_CF2_nPDREQ (PLD_CF_MMGPIO_BASE + 3)
121#define PLD_CF1_nPDREQ (PLD_CF_MMGPIO_BASE + 2)
122#define PLD_CF2_nIRQ (PLD_CF_MMGPIO_BASE + 1)
123#define PLD_CF1_nIRQ (PLD_CF_MMGPIO_BASE + 0)
124
125#define PLD_SDC (SYSPLD_PHYS_BASE + 0x000028)
126#define PLD_SDC_MMGPIO_BASE (P720T_MMGPIO_BASE + 80)
127#define PLD_SDC_INT_EN (PLD_SDC_MMGPIO_BASE + 2)
128#define PLD_SDC_WP (PLD_SDC_MMGPIO_BASE + 1)
129#define PLD_SDC_CD (PLD_SDC_MMGPIO_BASE + 0)
130
131#define PLD_CODEC (SYSPLD_PHYS_BASE + 0x400000)
132#define PLD_CODEC_MMGPIO_BASE (P720T_MMGPIO_BASE + 88)
133#define PLD_CODEC_IRQ3 (PLD_CODEC_MMGPIO_BASE + 4)
134#define PLD_CODEC_IRQ2 (PLD_CODEC_MMGPIO_BASE + 3)
135#define PLD_CODEC_IRQ1 (PLD_CODEC_MMGPIO_BASE + 2)
136#define PLD_CODEC_EN (PLD_CODEC_MMGPIO_BASE + 0)
137
138#define PLD_BRITE (SYSPLD_PHYS_BASE + 0x400004)
139#define PLD_BRITE_MMGPIO_BASE (P720T_MMGPIO_BASE + 96)
140#define PLD_BRITE_UP (PLD_BRITE_MMGPIO_BASE + 1)
141#define PLD_BRITE_DN (PLD_BRITE_MMGPIO_BASE + 0)
142
143#define PLD_LCDEN (SYSPLD_PHYS_BASE + 0x400008)
144#define PLD_LCDEN_MMGPIO_BASE (P720T_MMGPIO_BASE + 104)
145#define PLD_LCDEN_EN (PLD_LCDEN_MMGPIO_BASE + 0)
146
147#define PLD_TCH (SYSPLD_PHYS_BASE + 0x400010)
148#define PLD_TCH_MMGPIO_BASE (P720T_MMGPIO_BASE + 112)
149#define PLD_TCH_PENIRQ (PLD_TCH_MMGPIO_BASE + 1)
150#define PLD_TCH_EN (PLD_TCH_MMGPIO_BASE + 0)
151
152#define PLD_GPIO (SYSPLD_PHYS_BASE + 0x400014)
153#define PLD_GPIO_MMGPIO_BASE (P720T_MMGPIO_BASE + 120)
154#define PLD_GPIO2 (PLD_GPIO_MMGPIO_BASE + 2)
155#define PLD_GPIO1 (PLD_GPIO_MMGPIO_BASE + 1)
156#define PLD_GPIO0 (PLD_GPIO_MMGPIO_BASE + 0)
157
158static struct gpio p720t_gpios[] __initconst = {
159 { PLD_S1_ON, GPIOF_OUT_INIT_LOW, "PLD_S1_ON" },
160 { PLD_S2_ON, GPIOF_OUT_INIT_LOW, "PLD_S2_ON" },
161 { PLD_S3_ON, GPIOF_OUT_INIT_LOW, "PLD_S3_ON" },
162 { PLD_S4_ON, GPIOF_OUT_INIT_LOW, "PLD_S4_ON" },
163 { PLD_KBD_EN, GPIOF_OUT_INIT_LOW, "PLD_KBD_EN" },
164 { PLD_SPI_EN, GPIOF_OUT_INIT_LOW, "PLD_SPI_EN" },
165 { PLD_IO_USER, GPIOF_OUT_INIT_LOW, "PLD_IO_USER" },
166 { PLD_IO_LED0, GPIOF_OUT_INIT_LOW, "PLD_IO_LED0" },
167 { PLD_IO_LED1, GPIOF_OUT_INIT_LOW, "PLD_IO_LED1" },
168 { PLD_IO_LED2, GPIOF_OUT_INIT_LOW, "PLD_IO_LED2" },
169 { PLD_IO_LED3, GPIOF_OUT_INIT_LOW, "PLD_IO_LED3" },
170 { PLD_IO_LEDEN, GPIOF_OUT_INIT_LOW, "PLD_IO_LEDEN" },
171 { PLD_IRDA_EN, GPIOF_OUT_INIT_LOW, "PLD_IRDA_EN" },
172 { PLD_COM1_EN, GPIOF_OUT_INIT_HIGH, "PLD_COM1_EN" },
173 { PLD_COM2_EN, GPIOF_OUT_INIT_HIGH, "PLD_COM2_EN" },
174 { PLD_CODEC_EN, GPIOF_OUT_INIT_LOW, "PLD_CODEC_EN" },
175 { PLD_LCDEN_EN, GPIOF_OUT_INIT_LOW, "PLD_LCDEN_EN" },
176 { PLD_TCH_EN, GPIOF_OUT_INIT_LOW, "PLD_TCH_EN" },
177 { P720T_USERLED,GPIOF_OUT_INIT_LOW, "USER_LED" },
178};
179
180static struct resource p720t_mmgpio_resource[] __initdata = {
181 DEFINE_RES_MEM_NAMED(0, 4, "dat"),
182};
183
184static struct bgpio_pdata p720t_mmgpio_pdata = {
185 .ngpio = 8,
186};
187
188static struct platform_device p720t_mmgpio __initdata = {
189 .name = "basic-mmio-gpio",
190 .id = -1,
191 .resource = p720t_mmgpio_resource,
192 .num_resources = ARRAY_SIZE(p720t_mmgpio_resource),
193 .dev = {
194 .platform_data = &p720t_mmgpio_pdata,
195 },
196};
197
198static void __init p720t_mmgpio_init(void __iomem *addrbase, int gpiobase)
199{
200 p720t_mmgpio_resource[0].start = (unsigned long)addrbase;
201 p720t_mmgpio_pdata.base = gpiobase;
202
203 platform_device_register(&p720t_mmgpio);
204}
205
206static struct {
207 void __iomem *addrbase;
208 int gpiobase;
209} mmgpios[] __initconst = {
210 { PLD_INT, PLD_INT_MMGPIO_BASE },
211 { PLD_PWR, PLD_PWR_MMGPIO_BASE },
212 { PLD_KBD, PLD_KBD_MMGPIO_BASE },
213 { PLD_SPI, PLD_SPI_MMGPIO_BASE },
214 { PLD_IO, PLD_IO_MMGPIO_BASE },
215 { PLD_IRDA, PLD_IRDA_MMGPIO_BASE },
216 { PLD_COM2, PLD_COM2_MMGPIO_BASE },
217 { PLD_COM1, PLD_COM1_MMGPIO_BASE },
218 { PLD_AUD, PLD_AUD_MMGPIO_BASE },
219 { PLD_CF, PLD_CF_MMGPIO_BASE },
220 { PLD_SDC, PLD_SDC_MMGPIO_BASE },
221 { PLD_CODEC, PLD_CODEC_MMGPIO_BASE },
222 { PLD_BRITE, PLD_BRITE_MMGPIO_BASE },
223 { PLD_LCDEN, PLD_LCDEN_MMGPIO_BASE },
224 { PLD_TCH, PLD_TCH_MMGPIO_BASE },
225 { PLD_GPIO, PLD_GPIO_MMGPIO_BASE },
226};
227
54static struct resource p720t_nand_resource[] __initdata = { 228static struct resource p720t_nand_resource[] __initdata = {
55 DEFINE_RES_MEM(P720T_NAND_BASE, SZ_4), 229 DEFINE_RES_MEM(P720T_NAND_BASE, SZ_4),
56}; 230};
@@ -92,11 +266,15 @@ static struct platform_device p720t_nand_pdev __initdata = {
92static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) 266static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
93{ 267{
94 if (power) { 268 if (power) {
95 PLD_LCDEN = PLD_LCDEN_EN; 269 gpio_set_value(PLD_LCDEN_EN, 1);
96 PLD_PWR |= PLD_S4_ON | PLD_S2_ON | PLD_S1_ON; 270 gpio_set_value(PLD_S1_ON, 1);
271 gpio_set_value(PLD_S2_ON, 1);
272 gpio_set_value(PLD_S4_ON, 1);
97 } else { 273 } else {
98 PLD_PWR &= ~(PLD_S4_ON | PLD_S2_ON | PLD_S1_ON); 274 gpio_set_value(PLD_S1_ON, 0);
99 PLD_LCDEN = 0; 275 gpio_set_value(PLD_S2_ON, 0);
276 gpio_set_value(PLD_S4_ON, 0);
277 gpio_set_value(PLD_LCDEN_EN, 0);
100 } 278 }
101} 279}
102 280
@@ -106,10 +284,7 @@ static struct plat_lcd_data p720t_lcd_power_pdata = {
106 284
107static void p720t_lcd_backlight_set_intensity(int intensity) 285static void p720t_lcd_backlight_set_intensity(int intensity)
108{ 286{
109 if (intensity) 287 gpio_set_value(PLD_S3_ON, intensity);
110 PLD_PWR |= PLD_S3_ON;
111 else
112 PLD_PWR = 0;
113} 288}
114 289
115static struct generic_bl_info p720t_lcd_backlight_pdata = { 290static struct generic_bl_info p720t_lcd_backlight_pdata = {
@@ -119,19 +294,6 @@ static struct generic_bl_info p720t_lcd_backlight_pdata = {
119 .set_bl_intensity = p720t_lcd_backlight_set_intensity, 294 .set_bl_intensity = p720t_lcd_backlight_set_intensity,
120}; 295};
121 296
122/*
123 * Map the P720T system PLD. It occupies two address spaces:
124 * 0x10000000 and 0x10400000. We map both regions as one.
125 */
126static struct map_desc p720t_io_desc[] __initdata = {
127 {
128 .virtual = SYSPLD_VIRT_BASE,
129 .pfn = __phys_to_pfn(SYSPLD_PHYS_BASE),
130 .length = SZ_8M,
131 .type = MT_DEVICE,
132 },
133};
134
135static void __init 297static void __init
136fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi) 298fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
137{ 299{
@@ -157,33 +319,6 @@ fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
157 } 319 }
158} 320}
159 321
160static void __init p720t_map_io(void)
161{
162 clps711x_map_io();
163 iotable_init(p720t_io_desc, ARRAY_SIZE(p720t_io_desc));
164}
165
166static void __init p720t_init_early(void)
167{
168 /*
169 * Power down as much as possible in case we don't
170 * have the drivers loaded.
171 */
172 PLD_LCDEN = 0;
173 PLD_PWR &= ~(PLD_S4_ON|PLD_S3_ON|PLD_S2_ON|PLD_S1_ON);
174
175 PLD_KBD = 0;
176 PLD_IO = 0;
177 PLD_IRDA = 0;
178 PLD_CODEC = 0;
179 PLD_TCH = 0;
180 PLD_SPI = 0;
181 if (!IS_ENABLED(CONFIG_DEBUG_LL)) {
182 PLD_COM2 = 0;
183 PLD_COM1 = 0;
184 }
185}
186
187static struct gpio_led p720t_gpio_leds[] = { 322static struct gpio_led p720t_gpio_leds[] = {
188 { 323 {
189 .name = "User LED", 324 .name = "User LED",
@@ -199,7 +334,20 @@ static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = {
199 334
200static void __init p720t_init(void) 335static void __init p720t_init(void)
201{ 336{
337 int i;
338
339 clps711x_devices_init();
340
341 for (i = 0; i < ARRAY_SIZE(mmgpios); i++)
342 p720t_mmgpio_init(mmgpios[i].addrbase, mmgpios[i].gpiobase);
343
202 platform_device_register(&p720t_nand_pdev); 344 platform_device_register(&p720t_nand_pdev);
345}
346
347static void __init p720t_init_late(void)
348{
349 WARN_ON(gpio_request_array(p720t_gpios, ARRAY_SIZE(p720t_gpios)));
350
203 platform_device_register_data(&platform_bus, "platform-lcd", 0, 351 platform_device_register_data(&platform_bus, "platform-lcd", 0,
204 &p720t_lcd_power_pdata, 352 &p720t_lcd_power_pdata,
205 sizeof(p720t_lcd_power_pdata)); 353 sizeof(p720t_lcd_power_pdata));
@@ -207,10 +355,6 @@ static void __init p720t_init(void)
207 &p720t_lcd_backlight_pdata, 355 &p720t_lcd_backlight_pdata,
208 sizeof(p720t_lcd_backlight_pdata)); 356 sizeof(p720t_lcd_backlight_pdata));
209 platform_device_register_simple("video-clps711x", 0, NULL, 0); 357 platform_device_register_simple("video-clps711x", 0, NULL, 0);
210}
211
212static void __init p720t_init_late(void)
213{
214 platform_device_register_data(&platform_bus, "leds-gpio", 0, 358 platform_device_register_data(&platform_bus, "leds-gpio", 0,
215 &p720t_gpio_led_pdata, 359 &p720t_gpio_led_pdata,
216 sizeof(p720t_gpio_led_pdata)); 360 sizeof(p720t_gpio_led_pdata));
@@ -221,8 +365,8 @@ MACHINE_START(P720T, "ARM-Prospector720T")
221 .atag_offset = 0x100, 365 .atag_offset = 0x100,
222 .nr_irqs = CLPS711X_NR_IRQS, 366 .nr_irqs = CLPS711X_NR_IRQS,
223 .fixup = fixup_p720t, 367 .fixup = fixup_p720t,
224 .map_io = p720t_map_io, 368 .map_io = clps711x_map_io,
225 .init_early = p720t_init_early, 369 .init_early = clps711x_init_early,
226 .init_irq = clps711x_init_irq, 370 .init_irq = clps711x_init_irq,
227 .init_time = clps711x_timer_init, 371 .init_time = clps711x_timer_init,
228 .init_machine = p720t_init, 372 .init_machine = p720t_init,
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 20ff50f3ccf0..f6d1746366d4 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -27,12 +27,14 @@
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/clkdev.h> 28#include <linux/clkdev.h>
29#include <linux/clockchips.h> 29#include <linux/clockchips.h>
30#include <linux/clocksource.h>
30#include <linux/clk-provider.h> 31#include <linux/clk-provider.h>
31 32
32#include <asm/exception.h> 33#include <asm/exception.h>
33#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
34#include <asm/mach/map.h> 35#include <asm/mach/map.h>
35#include <asm/mach/time.h> 36#include <asm/mach/time.h>
37#include <asm/sched_clock.h>
36#include <asm/system_misc.h> 38#include <asm/system_misc.h>
37 39
38#include <mach/hardware.h> 40#include <mach/hardware.h>
@@ -213,7 +215,7 @@ void __init clps711x_init_irq(void)
213 } 215 }
214} 216}
215 217
216inline u32 fls16(u32 x) 218static inline u32 fls16(u32 x)
217{ 219{
218 u32 r = 15; 220 u32 r = 15;
219 221
@@ -237,27 +239,52 @@ inline u32 fls16(u32 x)
237 239
238asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs) 240asmlinkage void __exception_irq_entry clps711x_handle_irq(struct pt_regs *regs)
239{ 241{
240 u32 irqstat; 242 do {
241 void __iomem *base = CLPS711X_VIRT_BASE; 243 u32 irqstat;
242 244 void __iomem *base = CLPS711X_VIRT_BASE;
243 irqstat = readl_relaxed(base + INTSR1) & readl_relaxed(base + INTMR1); 245
244 if (irqstat) { 246 irqstat = readw_relaxed(base + INTSR1) &
245 handle_IRQ(fls16(irqstat), regs); 247 readw_relaxed(base + INTMR1);
246 return; 248 if (irqstat)
247 } 249 handle_IRQ(fls16(irqstat), regs);
250
251 irqstat = readw_relaxed(base + INTSR2) &
252 readw_relaxed(base + INTMR2);
253 if (irqstat) {
254 handle_IRQ(fls16(irqstat) + 16, regs);
255 continue;
256 }
257
258 break;
259 } while (1);
260}
248 261
249 irqstat = readl_relaxed(base + INTSR2) & readl_relaxed(base + INTMR2); 262static u32 notrace clps711x_sched_clock_read(void)
250 if (likely(irqstat)) 263{
251 handle_IRQ(fls16(irqstat) + 16, regs); 264 return ~readw_relaxed(CLPS711X_VIRT_BASE + TC1D);
252} 265}
253 266
254static void clps711x_clockevent_set_mode(enum clock_event_mode mode, 267static void clps711x_clockevent_set_mode(enum clock_event_mode mode,
255 struct clock_event_device *evt) 268 struct clock_event_device *evt)
256{ 269{
270 disable_irq(IRQ_TC2OI);
271
272 switch (mode) {
273 case CLOCK_EVT_MODE_PERIODIC:
274 enable_irq(IRQ_TC2OI);
275 break;
276 case CLOCK_EVT_MODE_ONESHOT:
277 /* Not supported */
278 case CLOCK_EVT_MODE_SHUTDOWN:
279 case CLOCK_EVT_MODE_UNUSED:
280 case CLOCK_EVT_MODE_RESUME:
281 /* Left event sources disabled, no more interrupts appear */
282 break;
283 }
257} 284}
258 285
259static struct clock_event_device clockevent_clps711x = { 286static struct clock_event_device clockevent_clps711x = {
260 .name = "CLPS711x Clockevents", 287 .name = "clps711x-clockevent",
261 .rating = 300, 288 .rating = 300,
262 .features = CLOCK_EVT_FEAT_PERIODIC, 289 .features = CLOCK_EVT_FEAT_PERIODIC,
263 .set_mode = clps711x_clockevent_set_mode, 290 .set_mode = clps711x_clockevent_set_mode,
@@ -271,8 +298,8 @@ static irqreturn_t clps711x_timer_interrupt(int irq, void *dev_id)
271} 298}
272 299
273static struct irqaction clps711x_timer_irq = { 300static struct irqaction clps711x_timer_irq = {
274 .name = "CLPS711x Timer Tick", 301 .name = "clps711x-timer",
275 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 302 .flags = IRQF_TIMER | IRQF_IRQPOLL,
276 .handler = clps711x_timer_interrupt, 303 .handler = clps711x_timer_interrupt,
277}; 304};
278 305
@@ -301,6 +328,7 @@ void __init clps711x_timer_init(void)
301 cpu = ext; 328 cpu = ext;
302 bus = cpu; 329 bus = cpu;
303 spi = 135400; 330 spi = 135400;
331 pll = 0;
304 } else { 332 } else {
305 cpu = pll; 333 cpu = pll;
306 if (cpu >= 36864000) 334 if (cpu >= 36864000)
@@ -319,9 +347,9 @@ void __init clps711x_timer_init(void)
319 else 347 else
320 timh = 541440; 348 timh = 541440;
321 } else 349 } else
322 timh = cpu / 144; 350 timh = DIV_ROUND_CLOSEST(cpu, 144);
323 351
324 timl = timh / 256; 352 timl = DIV_ROUND_CLOSEST(timh, 256);
325 353
326 /* All clocks are fixed */ 354 /* All clocks are fixed */
327 add_fixed_clk(clk_pll, "pll", pll); 355 add_fixed_clk(clk_pll, "pll", pll);
@@ -334,13 +362,24 @@ void __init clps711x_timer_init(void)
334 362
335 pr_info("CPU frequency set at %i Hz.\n", cpu); 363 pr_info("CPU frequency set at %i Hz.\n", cpu);
336 364
365 /* Start Timer1 in free running mode (Low frequency) */
366 tmp = clps_readl(SYSCON1) & ~(SYSCON1_TC1S | SYSCON1_TC1M);
367 clps_writel(tmp, SYSCON1);
368
369 setup_sched_clock(clps711x_sched_clock_read, 16, timl);
370
371 clocksource_mmio_init(CLPS711X_VIRT_BASE + TC1D,
372 "clps711x_clocksource", timl, 300, 16,
373 clocksource_mmio_readw_down);
374
375 /* Set Timer2 prescaler */
337 clps_writew(DIV_ROUND_CLOSEST(timh, HZ), TC2D); 376 clps_writew(DIV_ROUND_CLOSEST(timh, HZ), TC2D);
338 377
339 tmp = clps_readl(SYSCON1); 378 /* Start Timer2 in prescale mode (High frequency)*/
340 tmp |= SYSCON1_TC2S | SYSCON1_TC2M; 379 tmp = clps_readl(SYSCON1) | SYSCON1_TC2M | SYSCON1_TC2S;
341 clps_writel(tmp, SYSCON1); 380 clps_writel(tmp, SYSCON1);
342 381
343 clockevents_config_and_register(&clockevent_clps711x, timh, 1, 0xffff); 382 clockevents_config_and_register(&clockevent_clps711x, timh, 0, 0);
344 383
345 setup_irq(IRQ_TC2OI, &clps711x_timer_irq); 384 setup_irq(IRQ_TC2OI, &clps711x_timer_irq);
346} 385}
@@ -353,15 +392,11 @@ void clps711x_restart(char mode, const char *cmd)
353static void clps711x_idle(void) 392static void clps711x_idle(void)
354{ 393{
355 clps_writel(1, HALT); 394 clps_writel(1, HALT);
356 __asm__ __volatile__( 395 asm("mov r0, r0");
357 "mov r0, r0\n\ 396 asm("mov r0, r0");
358 mov r0, r0");
359} 397}
360 398
361static int __init clps711x_idle_init(void) 399void __init clps711x_init_early(void)
362{ 400{
363 arm_pm_idle = clps711x_idle; 401 arm_pm_idle = clps711x_idle;
364 return 0;
365} 402}
366
367arch_initcall(clps711x_idle_init);
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index f84a7292c70e..2a22f4c6cc75 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -13,3 +13,4 @@ extern void clps711x_init_irq(void);
13extern void clps711x_timer_init(void); 13extern void clps711x_timer_init(void);
14extern void clps711x_handle_irq(struct pt_regs *regs); 14extern void clps711x_handle_irq(struct pt_regs *regs);
15extern void clps711x_restart(char mode, const char *cmd); 15extern void clps711x_restart(char mode, const char *cmd);
16extern void clps711x_init_early(void);
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c
new file mode 100644
index 000000000000..856b81cf2f8a
--- /dev/null
+++ b/arch/arm/mach-clps711x/devices.c
@@ -0,0 +1,68 @@
1/*
2 * CLPS711X common devices definitions
3 *
4 * Author: Alexander Shiyan <shc_work@mail.ru>, 2013
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/platform_device.h>
13#include <linux/sizes.h>
14
15#include <mach/hardware.h>
16
17static const phys_addr_t clps711x_gpios[][2] __initconst = {
18 { PADR, PADDR },
19 { PBDR, PBDDR },
20 { PCDR, PCDDR },
21 { PDDR, PDDDR },
22 { PEDR, PEDDR },
23};
24
25static void __init clps711x_add_gpio(void)
26{
27 unsigned i;
28 struct resource gpio_res[2];
29
30 memset(gpio_res, 0, sizeof(gpio_res));
31
32 gpio_res[0].flags = IORESOURCE_MEM;
33 gpio_res[1].flags = IORESOURCE_MEM;
34
35 for (i = 0; i < ARRAY_SIZE(clps711x_gpios); i++) {
36 gpio_res[0].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][0];
37 gpio_res[0].end = gpio_res[0].start;
38 gpio_res[1].start = CLPS711X_PHYS_BASE + clps711x_gpios[i][1];
39 gpio_res[1].end = gpio_res[1].start;
40
41 platform_device_register_simple("clps711x-gpio", i,
42 gpio_res, ARRAY_SIZE(gpio_res));
43 }
44}
45
46const struct resource clps711x_syscon_res[] __initconst = {
47 /* SYSCON1, SYSFLG1 */
48 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON1, SZ_128),
49 /* SYSCON2, SYSFLG2 */
50 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON2, SZ_128),
51 /* SYSCON3 */
52 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + SYSCON3, SZ_64),
53};
54
55static void __init clps711x_add_syscon(void)
56{
57 unsigned i;
58
59 for (i = 0; i < ARRAY_SIZE(clps711x_syscon_res); i++)
60 platform_device_register_simple("clps711x-syscon", i + 1,
61 &clps711x_syscon_res[i], 1);
62}
63
64void __init clps711x_devices_init(void)
65{
66 clps711x_add_gpio();
67 clps711x_add_syscon();
68}
diff --git a/arch/arm/mach-clps711x/devices.h b/arch/arm/mach-clps711x/devices.h
new file mode 100644
index 000000000000..a5efc1744b84
--- /dev/null
+++ b/arch/arm/mach-clps711x/devices.h
@@ -0,0 +1,12 @@
1/*
2 * CLPS711X common devices definitions
3 *
4 * Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
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
12void clps711x_devices_init(void);
diff --git a/arch/arm/mach-clps711x/include/mach/autcpu12.h b/arch/arm/mach-clps711x/include/mach/autcpu12.h
deleted file mode 100644
index 0452f5f3f034..000000000000
--- a/arch/arm/mach-clps711x/include/mach/autcpu12.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * AUTCPU12 specific defines
3 *
4 * (c) 2001 Thomas Gleixner, autronix automation <gleixner@autronix.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 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_AUTCPU12_H
21#define __ASM_ARCH_AUTCPU12_H
22
23/*
24 * The flash bank is wired to chip select 0
25 */
26#define AUTCPU12_PHYS_FLASH CS0_PHYS_BASE /* physical */
27
28/* offset for device specific information structure */
29#define AUTCPU12_LCDINFO_OFFS (0x00010000)
30
31/* Videomemory in the internal SRAM (CS 6) */
32#define AUTCPU12_PHYS_VIDEO CS6_PHYS_BASE
33
34/*
35* All special IO's are tied to CS1
36*/
37#define AUTCPU12_PHYS_CHAR_LCD CS1_PHYS_BASE +0x00000000 /* physical */
38
39#define AUTCPU12_PHYS_NVRAM CS1_PHYS_BASE +0x02000000 /* physical */
40
41#define AUTCPU12_PHYS_CSAUX1 CS1_PHYS_BASE +0x04000000 /* physical */
42
43#define AUTCPU12_PHYS_CAN CS1_PHYS_BASE +0x08000000 /* physical */
44
45#define AUTCPU12_PHYS_TOUCH CS1_PHYS_BASE +0x0A000000 /* physical */
46
47#define AUTCPU12_PHYS_IO CS1_PHYS_BASE +0x0C000000 /* physical */
48
49#define AUTCPU12_PHYS_LPT CS1_PHYS_BASE +0x0E000000 /* physical */
50
51/*
52* defines for lcd contrast
53*/
54#define AUTCPU12_DPOT_PORT_OFFSET PEDR
55#define AUTCPU12_DPOT_CS (1<<0)
56#define AUTCPU12_DPOT_CLK (1<<1)
57#define AUTCPU12_DPOT_UD (1<<2)
58
59#endif
diff --git a/arch/arm/mach-clps711x/include/mach/clps711x.h b/arch/arm/mach-clps711x/include/mach/clps711x.h
index 01d1b9559710..0286f4bf9945 100644
--- a/arch/arm/mach-clps711x/include/mach/clps711x.h
+++ b/arch/arm/mach-clps711x/include/mach/clps711x.h
@@ -21,6 +21,8 @@
21#ifndef __MACH_CLPS711X_H 21#ifndef __MACH_CLPS711X_H
22#define __MACH_CLPS711X_H 22#define __MACH_CLPS711X_H
23 23
24#include <linux/mfd/syscon/clps711x.h>
25
24#define CLPS711X_PHYS_BASE (0x80000000) 26#define CLPS711X_PHYS_BASE (0x80000000)
25 27
26#define PADR (0x0000) 28#define PADR (0x0000)
@@ -96,83 +98,9 @@
96#define RANDID2 (0x2708) 98#define RANDID2 (0x2708)
97#define RANDID3 (0x270c) 99#define RANDID3 (0x270c)
98 100
99/* common bits: SYSCON1 / SYSCON2 */
100#define SYSCON_UARTEN (1 << 8)
101
102#define SYSCON1_KBDSCAN(x) ((x) & 15)
103#define SYSCON1_KBDSCANMASK (15)
104#define SYSCON1_TC1M (1 << 4)
105#define SYSCON1_TC1S (1 << 5)
106#define SYSCON1_TC2M (1 << 6)
107#define SYSCON1_TC2S (1 << 7)
108#define SYSCON1_UART1EN SYSCON_UARTEN
109#define SYSCON1_BZTOG (1 << 9)
110#define SYSCON1_BZMOD (1 << 10)
111#define SYSCON1_DBGEN (1 << 11)
112#define SYSCON1_LCDEN (1 << 12)
113#define SYSCON1_CDENTX (1 << 13)
114#define SYSCON1_CDENRX (1 << 14)
115#define SYSCON1_SIREN (1 << 15)
116#define SYSCON1_ADCKSEL(x) (((x) & 3) << 16)
117#define SYSCON1_ADCKSEL_MASK (3 << 16)
118#define SYSCON1_EXCKEN (1 << 18)
119#define SYSCON1_WAKEDIS (1 << 19)
120#define SYSCON1_IRTXM (1 << 20)
121
122/* common bits: SYSFLG1 / SYSFLG2 */
123#define SYSFLG_UBUSY (1 << 11)
124#define SYSFLG_URXFE (1 << 22)
125#define SYSFLG_UTXFF (1 << 23)
126
127#define SYSFLG1_MCDR (1 << 0)
128#define SYSFLG1_DCDET (1 << 1)
129#define SYSFLG1_WUDR (1 << 2)
130#define SYSFLG1_WUON (1 << 3)
131#define SYSFLG1_CTS (1 << 8)
132#define SYSFLG1_DSR (1 << 9)
133#define SYSFLG1_DCD (1 << 10)
134#define SYSFLG1_UBUSY SYSFLG_UBUSY
135#define SYSFLG1_NBFLG (1 << 12)
136#define SYSFLG1_RSTFLG (1 << 13)
137#define SYSFLG1_PFFLG (1 << 14)
138#define SYSFLG1_CLDFLG (1 << 15)
139#define SYSFLG1_URXFE SYSFLG_URXFE
140#define SYSFLG1_UTXFF SYSFLG_UTXFF
141#define SYSFLG1_CRXFE (1 << 24)
142#define SYSFLG1_CTXFF (1 << 25)
143#define SYSFLG1_SSIBUSY (1 << 26)
144#define SYSFLG1_ID (1 << 29)
145#define SYSFLG1_VERID(x) (((x) >> 30) & 3)
146#define SYSFLG1_VERID_MASK (3 << 30)
147
148#define SYSFLG2_SSRXOF (1 << 0)
149#define SYSFLG2_RESVAL (1 << 1)
150#define SYSFLG2_RESFRM (1 << 2)
151#define SYSFLG2_SS2RXFE (1 << 3)
152#define SYSFLG2_SS2TXFF (1 << 4)
153#define SYSFLG2_SS2TXUF (1 << 5)
154#define SYSFLG2_CKMODE (1 << 6)
155#define SYSFLG2_UBUSY SYSFLG_UBUSY
156#define SYSFLG2_URXFE SYSFLG_URXFE
157#define SYSFLG2_UTXFF SYSFLG_UTXFF
158
159#define LCDCON_GSEN (1 << 30) 101#define LCDCON_GSEN (1 << 30)
160#define LCDCON_GSMD (1 << 31) 102#define LCDCON_GSMD (1 << 31)
161 103
162#define SYSCON2_SERSEL (1 << 0)
163#define SYSCON2_KBD6 (1 << 1)
164#define SYSCON2_DRAMZ (1 << 2)
165#define SYSCON2_KBWEN (1 << 3)
166#define SYSCON2_SS2TXEN (1 << 4)
167#define SYSCON2_PCCARD1 (1 << 5)
168#define SYSCON2_PCCARD2 (1 << 6)
169#define SYSCON2_SS2RXEN (1 << 7)
170#define SYSCON2_UART2EN SYSCON_UARTEN
171#define SYSCON2_SS2MAEN (1 << 9)
172#define SYSCON2_OSTB (1 << 12)
173#define SYSCON2_CLKENSL (1 << 13)
174#define SYSCON2_BUZFREQ (1 << 14)
175
176/* common bits: UARTDR1 / UARTDR2 */ 104/* common bits: UARTDR1 / UARTDR2 */
177#define UARTDR_FRMERR (1 << 8) 105#define UARTDR_FRMERR (1 << 8)
178#define UARTDR_PARERR (1 << 9) 106#define UARTDR_PARERR (1 << 9)
@@ -228,18 +156,6 @@
228#define DAI64FS_MCLK256EN (1 << 3) 156#define DAI64FS_MCLK256EN (1 << 3)
229#define DAI64FS_LOOPBACK (1 << 5) 157#define DAI64FS_LOOPBACK (1 << 5)
230 158
231#define SYSCON3_ADCCON (1 << 0)
232#define SYSCON3_CLKCTL0 (1 << 1)
233#define SYSCON3_CLKCTL1 (1 << 2)
234#define SYSCON3_DAISEL (1 << 3)
235#define SYSCON3_ADCCKNSEN (1 << 4)
236#define SYSCON3_VERSN(x) (((x) >> 5) & 7)
237#define SYSCON3_VERSN_MASK (7 << 5)
238#define SYSCON3_FASTWAKE (1 << 8)
239#define SYSCON3_DAIEN (1 << 9)
240#define SYSCON3_128FS SYSCON3_DAIEN
241#define SYSCON3_ENPD67 (1 << 10)
242
243#define SDCONF_ACTIVE (1 << 10) 159#define SDCONF_ACTIVE (1 << 10)
244#define SDCONF_CLKCTL (1 << 9) 160#define SDCONF_CLKCTL (1 << 9)
245#define SDCONF_WIDTH_4 (0 << 7) 161#define SDCONF_WIDTH_4 (0 << 7)
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h
index 2f23dd5d73e4..c5a8ea6839ef 100644
--- a/arch/arm/mach-clps711x/include/mach/hardware.h
+++ b/arch/arm/mach-clps711x/include/mach/hardware.h
@@ -70,11 +70,4 @@
70#define CLPS711X_SDRAM0_BASE (0xc0000000) 70#define CLPS711X_SDRAM0_BASE (0xc0000000)
71#define CLPS711X_SDRAM1_BASE (0xd0000000) 71#define CLPS711X_SDRAM1_BASE (0xd0000000)
72 72
73#if defined (CONFIG_ARCH_EDB7211)
74
75/* The extra 8 lines of the keyboard matrix are wired to chip select 3 */
76#define EP7211_PHYS_EXTKBD CS3_PHYS_BASE
77
78#endif /* CONFIG_ARCH_EDB7211 */
79
80#endif 73#endif
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
deleted file mode 100644
index fc0e028d9405..000000000000
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/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(0xc0000000)
27
28/*
29 * The PS7211 allows up to 256MB max per DRAM bank, but the EDB7211
30 * uses only one of the two banks (bank #1). However, even within
31 * bank #1, memory is discontiguous.
32 *
33 * The EDB7211 has two 8MB DRAM areas with 8MB of empty space between
34 * them, so we use 24 for the node max shift to get 16MB node sizes.
35 */
36
37#define SECTION_SIZE_BITS 24
38#define MAX_PHYSMEM_BITS 32
39
40#endif
41
diff --git a/arch/arm/mach-clps711x/include/mach/syspld.h b/arch/arm/mach-clps711x/include/mach/syspld.h
deleted file mode 100644
index 9a433155bf58..000000000000
--- a/arch/arm/mach-clps711x/include/mach/syspld.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/syspld.h
3 *
4 * System Control PLD register definitions.
5 *
6 * Copyright (C) 2000 Deep Blue Solutions Ltd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __ASM_ARCH_SYSPLD_H
23#define __ASM_ARCH_SYSPLD_H
24
25#define SYSPLD_PHYS_BASE (0x10000000)
26#define SYSPLD_VIRT_BASE IO_ADDRESS(SYSPLD_PHYS_BASE)
27
28#define SYSPLD_REG(type, off) (*(volatile type *)(SYSPLD_VIRT_BASE + (off)))
29
30#define PLD_INT SYSPLD_REG(u32, 0x000000)
31#define PLD_INT_PENIRQ (1 << 5)
32#define PLD_INT_UCB_IRQ (1 << 1)
33#define PLD_INT_KBD_ATN (1 << 0) /* EINT1 */
34
35#define PLD_PWR SYSPLD_REG(u32, 0x000004)
36#define PLD_PWR_EXT (1 << 5)
37#define PLD_PWR_MODE (1 << 4) /* 1 = PWM, 0 = PFM */
38#define PLD_S4_ON (1 << 3) /* LCD bias voltage enable */
39#define PLD_S3_ON (1 << 2) /* LCD backlight enable */
40#define PLD_S2_ON (1 << 1) /* LCD 3V3 supply enable */
41#define PLD_S1_ON (1 << 0) /* LCD 3V supply enable */
42
43#define PLD_KBD SYSPLD_REG(u32, 0x000008)
44#define PLD_KBD_WAKE (1 << 1)
45#define PLD_KBD_EN (1 << 0)
46
47#define PLD_SPI SYSPLD_REG(u32, 0x00000c)
48#define PLD_SPI_EN (1 << 0)
49
50#define PLD_IO SYSPLD_REG(u32, 0x000010)
51#define PLD_IO_BOOTSEL (1 << 6) /* boot sel switch */
52#define PLD_IO_USER (1 << 5) /* user defined switch */
53#define PLD_IO_LED3 (1 << 4)
54#define PLD_IO_LED2 (1 << 3)
55#define PLD_IO_LED1 (1 << 2)
56#define PLD_IO_LED0 (1 << 1)
57#define PLD_IO_LEDEN (1 << 0)
58
59#define PLD_IRDA SYSPLD_REG(u32, 0x000014)
60#define PLD_IRDA_EN (1 << 0)
61
62#define PLD_COM2 SYSPLD_REG(u32, 0x000018)
63#define PLD_COM2_EN (1 << 0)
64
65#define PLD_COM1 SYSPLD_REG(u32, 0x00001c)
66#define PLD_COM1_EN (1 << 0)
67
68#define PLD_AUD SYSPLD_REG(u32, 0x000020)
69#define PLD_AUD_DIV1 (1 << 6)
70#define PLD_AUD_DIV0 (1 << 5)
71#define PLD_AUD_CLK_SEL1 (1 << 4)
72#define PLD_AUD_CLK_SEL0 (1 << 3)
73#define PLD_AUD_MIC_PWR (1 << 2)
74#define PLD_AUD_MIC_GAIN (1 << 1)
75#define PLD_AUD_CODEC_EN (1 << 0)
76
77#define PLD_CF SYSPLD_REG(u32, 0x000024)
78#define PLD_CF2_SLEEP (1 << 5)
79#define PLD_CF1_SLEEP (1 << 4)
80#define PLD_CF2_nPDREQ (1 << 3)
81#define PLD_CF1_nPDREQ (1 << 2)
82#define PLD_CF2_nIRQ (1 << 1)
83#define PLD_CF1_nIRQ (1 << 0)
84
85#define PLD_SDC SYSPLD_REG(u32, 0x000028)
86#define PLD_SDC_INT_EN (1 << 2)
87#define PLD_SDC_WP (1 << 1)
88#define PLD_SDC_CD (1 << 0)
89
90#define PLD_FPGA SYSPLD_REG(u32, 0x00002c)
91
92#define PLD_CODEC SYSPLD_REG(u32, 0x400000)
93#define PLD_CODEC_IRQ3 (1 << 4)
94#define PLD_CODEC_IRQ2 (1 << 3)
95#define PLD_CODEC_IRQ1 (1 << 2)
96#define PLD_CODEC_EN (1 << 0)
97
98#define PLD_BRITE SYSPLD_REG(u32, 0x400004)
99#define PLD_BRITE_UP (1 << 1)
100#define PLD_BRITE_DN (1 << 0)
101
102#define PLD_LCDEN SYSPLD_REG(u32, 0x400008)
103#define PLD_LCDEN_EN (1 << 0)
104
105#define PLD_ID SYSPLD_REG(u32, 0x40000c)
106
107#define PLD_TCH SYSPLD_REG(u32, 0x400010)
108#define PLD_TCH_PENIRQ (1 << 1)
109#define PLD_TCH_EN (1 << 0)
110
111#define PLD_GPIO SYSPLD_REG(u32, 0x400014)
112#define PLD_GPIO2 (1 << 2)
113#define PLD_GPIO1 (1 << 1)
114#define PLD_GPIO0 (1 << 0)
115
116#endif
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index a075b3e0c5c7..e026b19b23ea 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -40,6 +40,7 @@ config ARCH_DAVINCI_DA850
40 bool "DA850/OMAP-L138/AM18x based system" 40 bool "DA850/OMAP-L138/AM18x based system"
41 select ARCH_DAVINCI_DA8XX 41 select ARCH_DAVINCI_DA8XX
42 select ARCH_HAS_CPUFREQ 42 select ARCH_HAS_CPUFREQ
43 select CPU_FREQ_TABLE
43 select CP_INTC 44 select CP_INTC
44 45
45config ARCH_DAVINCI_DA8XX 46config ARCH_DAVINCI_DA8XX
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index dd1ffccc75e9..63997a1128e6 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -5,7 +5,7 @@
5 5
6# Common objects 6# Common objects
7obj-y := time.o clock.o serial.o psc.o \ 7obj-y := time.o clock.o serial.o psc.o \
8 dma.o usb.o common.o sram.o aemif.o 8 usb.o common.o sram.o aemif.o
9 9
10obj-$(CONFIG_DAVINCI_MUX) += mux.o 10obj-$(CONFIG_DAVINCI_MUX) += mux.o
11 11
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 8a24b6c6339f..bea6793a7ede 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -985,7 +985,6 @@ static struct regulator_init_data tps65070_regulator_data[] = {
985static struct touchscreen_init_data tps6507x_touchscreen_data = { 985static struct touchscreen_init_data tps6507x_touchscreen_data = {
986 .poll_period = 30, /* ms between touch samples */ 986 .poll_period = 30, /* ms between touch samples */
987 .min_pressure = 0x30, /* minimum pressure to trigger touch */ 987 .min_pressure = 0x30, /* minimum pressure to trigger touch */
988 .vref = 0, /* turn off vref when not using A/D */
989 .vendor = 0, /* /sys/class/input/input?/id/vendor */ 988 .vendor = 0, /* /sys/class/input/input?/id/vendor */
990 .product = 65070, /* /sys/class/input/input?/id/product */ 989 .product = 65070, /* /sys/class/input/input?/id/product */
991 .version = 0x100, /* /sys/class/input/input?/id/version */ 990 .version = 0x100, /* /sys/class/input/input?/id/version */
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index 739be7e738fe..513eee14f77d 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -151,7 +151,6 @@ static __init void davinci_sffsdr_init(void)
151} 151}
152 152
153MACHINE_START(SFFSDR, "Lyrtech SFFSDR") 153MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
154 /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */
155 .atag_offset = 0x100, 154 .atag_offset = 0x100,
156 .map_io = davinci_sffsdr_map_io, 155 .map_io = davinci_sffsdr_map_io,
157 .init_irq = davinci_irq_init, 156 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index ba798370fc96..78ea395d2aca 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -26,12 +26,12 @@
26#include <linux/input.h> 26#include <linux/input.h>
27#include <linux/input/matrix_keypad.h> 27#include <linux/input/matrix_keypad.h>
28#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
29#include <linux/platform_data/edma.h>
29 30
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
32 33
33#include <mach/irqs.h> 34#include <mach/irqs.h>
34#include <mach/edma.h>
35#include <mach/mux.h> 35#include <mach/mux.h>
36#include <mach/cp_intc.h> 36#include <mach/cp_intc.h>
37#include <mach/tnetv107x.h> 37#include <mach/tnetv107x.h>
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 4d6933848abf..a0d4f6038b60 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1004,7 +1004,7 @@ static const struct da850_opp da850_opp_96 = {
1004 1004
1005#define OPP(freq) \ 1005#define OPP(freq) \
1006 { \ 1006 { \
1007 .index = (unsigned int) &da850_opp_##freq, \ 1007 .driver_data = (unsigned int) &da850_opp_##freq, \
1008 .frequency = freq * 1000, \ 1008 .frequency = freq * 1000, \
1009 } 1009 }
1010 1010
@@ -1016,7 +1016,7 @@ static struct cpufreq_frequency_table da850_freq_table[] = {
1016 OPP(200), 1016 OPP(200),
1017 OPP(96), 1017 OPP(96),
1018 { 1018 {
1019 .index = 0, 1019 .driver_data = 0,
1020 .frequency = CPUFREQ_TABLE_END, 1020 .frequency = CPUFREQ_TABLE_END,
1021 }, 1021 },
1022}; 1022};
@@ -1044,7 +1044,7 @@ static int da850_set_voltage(unsigned int index)
1044 if (!cvdd) 1044 if (!cvdd)
1045 return -ENODEV; 1045 return -ENODEV;
1046 1046
1047 opp = (struct da850_opp *) cpufreq_info.freq_table[index].index; 1047 opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data;
1048 1048
1049 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max); 1049 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
1050} 1050}
@@ -1125,7 +1125,7 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long index)
1125 struct pll_data *pll = clk->pll_data; 1125 struct pll_data *pll = clk->pll_data;
1126 int ret; 1126 int ret;
1127 1127
1128 opp = (struct da850_opp *) cpufreq_info.freq_table[index].index; 1128 opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data;
1129 prediv = opp->prediv; 1129 prediv = opp->prediv;
1130 mult = opp->mult; 1130 mult = opp->mult;
1131 postdiv = opp->postdiv; 1131 postdiv = opp->postdiv;
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 1ab3df423dac..a883043d0820 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -23,9 +23,9 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/platform_data/davinci_asp.h> 25#include <linux/platform_data/davinci_asp.h>
26#include <linux/platform_data/edma.h>
26#include <linux/platform_data/keyscan-davinci.h> 27#include <linux/platform_data/keyscan-davinci.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <mach/edma.h>
29 29
30#include <media/davinci/vpfe_capture.h> 30#include <media/davinci/vpfe_capture.h>
31#include <media/davinci/vpif_types.h> 31#include <media/davinci/vpif_types.h>
@@ -77,32 +77,32 @@ void davinci_map_sysmod(void);
77#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000 77#define DM646X_ASYNC_EMIF_CS2_SPACE_BASE 0x42000000
78 78
79/* DM355 function declarations */ 79/* DM355 function declarations */
80void __init dm355_init(void); 80void dm355_init(void);
81void dm355_init_spi0(unsigned chipselect_mask, 81void dm355_init_spi0(unsigned chipselect_mask,
82 const struct spi_board_info *info, unsigned len); 82 const struct spi_board_info *info, unsigned len);
83void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata); 83void dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata);
84int dm355_init_video(struct vpfe_config *, struct vpbe_config *); 84int dm355_init_video(struct vpfe_config *, struct vpbe_config *);
85 85
86/* DM365 function declarations */ 86/* DM365 function declarations */
87void __init dm365_init(void); 87void dm365_init(void);
88void __init dm365_init_asp(struct snd_platform_data *pdata); 88void dm365_init_asp(struct snd_platform_data *pdata);
89void __init dm365_init_vc(struct snd_platform_data *pdata); 89void dm365_init_vc(struct snd_platform_data *pdata);
90void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); 90void dm365_init_ks(struct davinci_ks_platform_data *pdata);
91void __init dm365_init_rtc(void); 91void dm365_init_rtc(void);
92void dm365_init_spi0(unsigned chipselect_mask, 92void dm365_init_spi0(unsigned chipselect_mask,
93 const struct spi_board_info *info, unsigned len); 93 const struct spi_board_info *info, unsigned len);
94int dm365_init_video(struct vpfe_config *, struct vpbe_config *); 94int dm365_init_video(struct vpfe_config *, struct vpbe_config *);
95 95
96/* DM644x function declarations */ 96/* DM644x function declarations */
97void __init dm644x_init(void); 97void dm644x_init(void);
98void __init dm644x_init_asp(struct snd_platform_data *pdata); 98void dm644x_init_asp(struct snd_platform_data *pdata);
99int __init dm644x_init_video(struct vpfe_config *, struct vpbe_config *); 99int dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
100 100
101/* DM646x function declarations */ 101/* DM646x function declarations */
102void __init dm646x_init(void); 102void dm646x_init(void);
103void __init dm646x_init_mcasp0(struct snd_platform_data *pdata); 103void dm646x_init_mcasp0(struct snd_platform_data *pdata);
104void __init dm646x_init_mcasp1(struct snd_platform_data *pdata); 104void dm646x_init_mcasp1(struct snd_platform_data *pdata);
105int __init dm646x_init_edma(struct edma_rsv_info *rsv); 105int dm646x_init_edma(struct edma_rsv_info *rsv);
106void dm646x_video_init(void); 106void dm646x_video_init(void);
107void dm646x_setup_vpif(struct vpif_display_config *, 107void dm646x_setup_vpif(struct vpif_display_config *,
108 struct vpif_capture_config *); 108 struct vpif_capture_config *);
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index bf572525175d..eb254fe861ac 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -105,27 +105,27 @@ struct platform_device da8xx_serial_device = {
105 }, 105 },
106}; 106};
107 107
108static const s8 da8xx_queue_tc_mapping[][2] = { 108static s8 da8xx_queue_tc_mapping[][2] = {
109 /* {event queue no, TC no} */ 109 /* {event queue no, TC no} */
110 {0, 0}, 110 {0, 0},
111 {1, 1}, 111 {1, 1},
112 {-1, -1} 112 {-1, -1}
113}; 113};
114 114
115static const s8 da8xx_queue_priority_mapping[][2] = { 115static s8 da8xx_queue_priority_mapping[][2] = {
116 /* {event queue no, Priority} */ 116 /* {event queue no, Priority} */
117 {0, 3}, 117 {0, 3},
118 {1, 7}, 118 {1, 7},
119 {-1, -1} 119 {-1, -1}
120}; 120};
121 121
122static const s8 da850_queue_tc_mapping[][2] = { 122static s8 da850_queue_tc_mapping[][2] = {
123 /* {event queue no, TC no} */ 123 /* {event queue no, TC no} */
124 {0, 0}, 124 {0, 0},
125 {-1, -1} 125 {-1, -1}
126}; 126};
127 127
128static const s8 da850_queue_priority_mapping[][2] = { 128static s8 da850_queue_priority_mapping[][2] = {
129 /* {event queue no, Priority} */ 129 /* {event queue no, Priority} */
130 {0, 3}, 130 {0, 3},
131 {-1, -1} 131 {-1, -1}
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index cfb194df18ed..128cb9ae80f4 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -18,10 +18,10 @@
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/platform_data/edma.h>
21 22
22#include <mach/common.h> 23#include <mach/common.h>
23#include <mach/irqs.h> 24#include <mach/irqs.h>
24#include <mach/edma.h>
25#include <mach/tnetv107x.h> 25#include <mach/tnetv107x.h>
26 26
27#include "clock.h" 27#include "clock.h"
@@ -58,14 +58,14 @@
58#define TNETV107X_DMACH_SDIO1_RX 28 58#define TNETV107X_DMACH_SDIO1_RX 28
59#define TNETV107X_DMACH_SDIO1_TX 29 59#define TNETV107X_DMACH_SDIO1_TX 29
60 60
61static const s8 edma_tc_mapping[][2] = { 61static s8 edma_tc_mapping[][2] = {
62 /* event queue no TC no */ 62 /* event queue no TC no */
63 { 0, 0 }, 63 { 0, 0 },
64 { 1, 1 }, 64 { 1, 1 },
65 { -1, -1 } 65 { -1, -1 }
66}; 66};
67 67
68static const s8 edma_priority_mapping[][2] = { 68static s8 edma_priority_mapping[][2] = {
69 /* event queue no Prio */ 69 /* event queue no Prio */
70 { 0, 3 }, 70 { 0, 3 },
71 { 1, 7 }, 71 { 1, 7 },
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index a7068a3aa9d3..90b83d00fe2b 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -19,9 +19,10 @@
19#include <mach/irqs.h> 19#include <mach/irqs.h>
20#include <mach/cputype.h> 20#include <mach/cputype.h>
21#include <mach/mux.h> 21#include <mach/mux.h>
22#include <mach/edma.h>
23#include <linux/platform_data/mmc-davinci.h> 22#include <linux/platform_data/mmc-davinci.h>
24#include <mach/time.h> 23#include <mach/time.h>
24#include <linux/platform_data/edma.h>
25
25 26
26#include "davinci.h" 27#include "davinci.h"
27#include "clock.h" 28#include "clock.h"
@@ -34,6 +35,9 @@
34#define DM365_MMCSD0_BASE 0x01D11000 35#define DM365_MMCSD0_BASE 0x01D11000
35#define DM365_MMCSD1_BASE 0x01D00000 36#define DM365_MMCSD1_BASE 0x01D00000
36 37
38#define DAVINCI_DMA_MMCRXEVT 26
39#define DAVINCI_DMA_MMCTXEVT 27
40
37void __iomem *davinci_sysmod_base; 41void __iomem *davinci_sysmod_base;
38 42
39void davinci_map_sysmod(void) 43void davinci_map_sysmod(void)
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a11034a358f1..42ef53f62c6c 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -19,7 +19,6 @@
19#include <asm/mach/map.h> 19#include <asm/mach/map.h>
20 20
21#include <mach/cputype.h> 21#include <mach/cputype.h>
22#include <mach/edma.h>
23#include <mach/psc.h> 22#include <mach/psc.h>
24#include <mach/mux.h> 23#include <mach/mux.h>
25#include <mach/irqs.h> 24#include <mach/irqs.h>
@@ -28,6 +27,7 @@
28#include <mach/common.h> 27#include <mach/common.h>
29#include <linux/platform_data/spi-davinci.h> 28#include <linux/platform_data/spi-davinci.h>
30#include <mach/gpio-davinci.h> 29#include <mach/gpio-davinci.h>
30#include <linux/platform_data/edma.h>
31 31
32#include "davinci.h" 32#include "davinci.h"
33#include "clock.h" 33#include "clock.h"
@@ -569,7 +569,7 @@ static u8 dm355_default_priorities[DAVINCI_N_AINTC_IRQ] = {
569 569
570/*----------------------------------------------------------------------*/ 570/*----------------------------------------------------------------------*/
571 571
572static const s8 572static s8
573queue_tc_mapping[][2] = { 573queue_tc_mapping[][2] = {
574 /* {event queue no, TC no} */ 574 /* {event queue no, TC no} */
575 {0, 0}, 575 {0, 0},
@@ -577,7 +577,7 @@ queue_tc_mapping[][2] = {
577 {-1, -1}, 577 {-1, -1},
578}; 578};
579 579
580static const s8 580static s8
581queue_priority_mapping[][2] = { 581queue_priority_mapping[][2] = {
582 /* {event queue no, Priority} */ 582 /* {event queue no, Priority} */
583 {0, 3}, 583 {0, 3},
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 40fa4fee9331..fa7af5eda52d 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -18,11 +18,11 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/platform_data/edma.h>
21 22
22#include <asm/mach/map.h> 23#include <asm/mach/map.h>
23 24
24#include <mach/cputype.h> 25#include <mach/cputype.h>
25#include <mach/edma.h>
26#include <mach/psc.h> 26#include <mach/psc.h>
27#include <mach/mux.h> 27#include <mach/mux.h>
28#include <mach/irqs.h> 28#include <mach/irqs.h>
@@ -826,7 +826,7 @@ static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = {
826}; 826};
827 827
828/* Four Transfer Controllers on DM365 */ 828/* Four Transfer Controllers on DM365 */
829static const s8 829static s8
830dm365_queue_tc_mapping[][2] = { 830dm365_queue_tc_mapping[][2] = {
831 /* {event queue no, TC no} */ 831 /* {event queue no, TC no} */
832 {0, 0}, 832 {0, 0},
@@ -836,7 +836,7 @@ dm365_queue_tc_mapping[][2] = {
836 {-1, -1}, 836 {-1, -1},
837}; 837};
838 838
839static const s8 839static s8
840dm365_queue_priority_mapping[][2] = { 840dm365_queue_priority_mapping[][2] = {
841 /* {event queue no, Priority} */ 841 /* {event queue no, Priority} */
842 {0, 7}, 842 {0, 7},
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 4d37d3e2a193..a49d18246fe9 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -12,11 +12,11 @@
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/platform_data/edma.h>
15 16
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
17 18
18#include <mach/cputype.h> 19#include <mach/cputype.h>
19#include <mach/edma.h>
20#include <mach/irqs.h> 20#include <mach/irqs.h>
21#include <mach/psc.h> 21#include <mach/psc.h>
22#include <mach/mux.h> 22#include <mach/mux.h>
@@ -497,7 +497,7 @@ static u8 dm644x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
497 497
498/*----------------------------------------------------------------------*/ 498/*----------------------------------------------------------------------*/
499 499
500static const s8 500static s8
501queue_tc_mapping[][2] = { 501queue_tc_mapping[][2] = {
502 /* {event queue no, TC no} */ 502 /* {event queue no, TC no} */
503 {0, 0}, 503 {0, 0},
@@ -505,7 +505,7 @@ queue_tc_mapping[][2] = {
505 {-1, -1}, 505 {-1, -1},
506}; 506};
507 507
508static const s8 508static s8
509queue_priority_mapping[][2] = { 509queue_priority_mapping[][2] = {
510 /* {event queue no, Priority} */ 510 /* {event queue no, Priority} */
511 {0, 3}, 511 {0, 3},
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index ac7b431c4c8e..d1259e80141b 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -13,11 +13,11 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/platform_data/edma.h>
16 17
17#include <asm/mach/map.h> 18#include <asm/mach/map.h>
18 19
19#include <mach/cputype.h> 20#include <mach/cputype.h>
20#include <mach/edma.h>
21#include <mach/irqs.h> 21#include <mach/irqs.h>
22#include <mach/psc.h> 22#include <mach/psc.h>
23#include <mach/mux.h> 23#include <mach/mux.h>
@@ -531,7 +531,7 @@ static u8 dm646x_default_priorities[DAVINCI_N_AINTC_IRQ] = {
531/*----------------------------------------------------------------------*/ 531/*----------------------------------------------------------------------*/
532 532
533/* Four Transfer Controllers on DM646x */ 533/* Four Transfer Controllers on DM646x */
534static const s8 534static s8
535dm646x_queue_tc_mapping[][2] = { 535dm646x_queue_tc_mapping[][2] = {
536 /* {event queue no, TC no} */ 536 /* {event queue no, TC no} */
537 {0, 0}, 537 {0, 0},
@@ -541,7 +541,7 @@ dm646x_queue_tc_mapping[][2] = {
541 {-1, -1}, 541 {-1, -1},
542}; 542};
543 543
544static const s8 544static s8
545dm646x_queue_priority_mapping[][2] = { 545dm646x_queue_priority_mapping[][2] = {
546 /* {event queue no, Priority} */ 546 /* {event queue no, Priority} */
547 {0, 4}, 547 {0, 4},
diff --git a/arch/arm/mach-davinci/include/mach/cp_intc.h b/arch/arm/mach-davinci/include/mach/cp_intc.h
index d13d8dfa2b0d..827bbe9baed4 100644
--- a/arch/arm/mach-davinci/include/mach/cp_intc.h
+++ b/arch/arm/mach-davinci/include/mach/cp_intc.h
@@ -51,7 +51,7 @@
51#define CP_INTC_HOST_PRIO_VECTOR(n) (0x1600 + (n << 2)) 51#define CP_INTC_HOST_PRIO_VECTOR(n) (0x1600 + (n << 2))
52#define CP_INTC_VECTOR_ADDR(n) (0x2000 + (n << 2)) 52#define CP_INTC_VECTOR_ADDR(n) (0x2000 + (n << 2))
53 53
54void __init cp_intc_init(void); 54void cp_intc_init(void);
55int __init cp_intc_of_init(struct device_node *, struct device_node *); 55int cp_intc_of_init(struct device_node *, struct device_node *);
56 56
57#endif /* __ASM_HARDWARE_CP_INTC_H */ 57#endif /* __ASM_HARDWARE_CP_INTC_H */
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 2e1c9eae0a58..3c797e2272f8 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -20,8 +20,8 @@
20#include <linux/videodev2.h> 20#include <linux/videodev2.h>
21 21
22#include <mach/serial.h> 22#include <mach/serial.h>
23#include <mach/edma.h>
24#include <mach/pm.h> 23#include <mach/pm.h>
24#include <linux/platform_data/edma.h>
25#include <linux/platform_data/i2c-davinci.h> 25#include <linux/platform_data/i2c-davinci.h>
26#include <linux/platform_data/mmc-davinci.h> 26#include <linux/platform_data/mmc-davinci.h>
27#include <linux/platform_data/usb-davinci.h> 27#include <linux/platform_data/usb-davinci.h>
@@ -79,8 +79,8 @@ extern unsigned int da850_max_speed;
79#define DA8XX_SHARED_RAM_BASE 0x80000000 79#define DA8XX_SHARED_RAM_BASE 0x80000000
80#define DA8XX_ARM_RAM_BASE 0xffff0000 80#define DA8XX_ARM_RAM_BASE 0xffff0000
81 81
82void __init da830_init(void); 82void da830_init(void);
83void __init da850_init(void); 83void da850_init(void);
84 84
85int da830_register_edma(struct edma_rsv_info *rsv); 85int da830_register_edma(struct edma_rsv_info *rsv);
86int da850_register_edma(struct edma_rsv_info *rsv[2]); 86int da850_register_edma(struct edma_rsv_info *rsv[2]);
@@ -94,17 +94,17 @@ int da8xx_register_uio_pruss(void);
94int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); 94int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
95int da8xx_register_mmcsd0(struct davinci_mmc_config *config); 95int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
96int da850_register_mmcsd1(struct davinci_mmc_config *config); 96int da850_register_mmcsd1(struct davinci_mmc_config *config);
97void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata); 97void da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
98int da8xx_register_rtc(void); 98int da8xx_register_rtc(void);
99int da850_register_cpufreq(char *async_clk); 99int da850_register_cpufreq(char *async_clk);
100int da8xx_register_cpuidle(void); 100int da8xx_register_cpuidle(void);
101void __iomem * __init da8xx_get_mem_ctlr(void); 101void __iomem *da8xx_get_mem_ctlr(void);
102int da850_register_pm(struct platform_device *pdev); 102int da850_register_pm(struct platform_device *pdev);
103int __init da850_register_sata(unsigned long refclkpn); 103int da850_register_sata(unsigned long refclkpn);
104int __init da850_register_vpif(void); 104int da850_register_vpif(void);
105int __init da850_register_vpif_display 105int da850_register_vpif_display
106 (struct vpif_display_config *display_config); 106 (struct vpif_display_config *display_config);
107int __init da850_register_vpif_capture 107int da850_register_vpif_capture
108 (struct vpif_capture_config *capture_config); 108 (struct vpif_capture_config *capture_config);
109void da8xx_restart(char mode, const char *cmd); 109void da8xx_restart(char mode, const char *cmd);
110void da8xx_rproc_reserve_cma(void); 110void da8xx_rproc_reserve_cma(void);
diff --git a/arch/arm/mach-davinci/include/mach/edma.h b/arch/arm/mach-davinci/include/mach/edma.h
deleted file mode 100644
index 7e84c906ceff..000000000000
--- a/arch/arm/mach-davinci/include/mach/edma.h
+++ /dev/null
@@ -1,267 +0,0 @@
1/*
2 * TI DAVINCI dma definitions
3 *
4 * Copyright (C) 2006-2009 Texas Instruments.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27
28/*
29 * This EDMA3 programming framework exposes two basic kinds of resource:
30 *
31 * Channel Triggers transfers, usually from a hardware event but
32 * also manually or by "chaining" from DMA completions.
33 * Each channel is coupled to a Parameter RAM (PaRAM) slot.
34 *
35 * Slot Each PaRAM slot holds a DMA transfer descriptor (PaRAM
36 * "set"), source and destination addresses, a link to a
37 * next PaRAM slot (if any), options for the transfer, and
38 * instructions for updating those addresses. There are
39 * more than twice as many slots as event channels.
40 *
41 * Each PaRAM set describes a sequence of transfers, either for one large
42 * buffer or for several discontiguous smaller buffers. An EDMA transfer
43 * is driven only from a channel, which performs the transfers specified
44 * in its PaRAM slot until there are no more transfers. When that last
45 * transfer completes, the "link" field may be used to reload the channel's
46 * PaRAM slot with a new transfer descriptor.
47 *
48 * The EDMA Channel Controller (CC) maps requests from channels into physical
49 * Transfer Controller (TC) requests when the channel triggers (by hardware
50 * or software events, or by chaining). The two physical DMA channels provided
51 * by the TCs are thus shared by many logical channels.
52 *
53 * DaVinci hardware also has a "QDMA" mechanism which is not currently
54 * supported through this interface. (DSP firmware uses it though.)
55 */
56
57#ifndef EDMA_H_
58#define EDMA_H_
59
60/* PaRAM slots are laid out like this */
61struct edmacc_param {
62 unsigned int opt;
63 unsigned int src;
64 unsigned int a_b_cnt;
65 unsigned int dst;
66 unsigned int src_dst_bidx;
67 unsigned int link_bcntrld;
68 unsigned int src_dst_cidx;
69 unsigned int ccnt;
70};
71
72#define CCINT0_INTERRUPT 16
73#define CCERRINT_INTERRUPT 17
74#define TCERRINT0_INTERRUPT 18
75#define TCERRINT1_INTERRUPT 19
76
77/* fields in edmacc_param.opt */
78#define SAM BIT(0)
79#define DAM BIT(1)
80#define SYNCDIM BIT(2)
81#define STATIC BIT(3)
82#define EDMA_FWID (0x07 << 8)
83#define TCCMODE BIT(11)
84#define EDMA_TCC(t) ((t) << 12)
85#define TCINTEN BIT(20)
86#define ITCINTEN BIT(21)
87#define TCCHEN BIT(22)
88#define ITCCHEN BIT(23)
89
90#define TRWORD (0x7<<2)
91#define PAENTRY (0x1ff<<5)
92
93/* Drivers should avoid using these symbolic names for dm644x
94 * channels, and use platform_device IORESOURCE_DMA resources
95 * instead. (Other DaVinci chips have different peripherals
96 * and thus have different DMA channel mappings.)
97 */
98#define DAVINCI_DMA_MCBSP_TX 2
99#define DAVINCI_DMA_MCBSP_RX 3
100#define DAVINCI_DMA_VPSS_HIST 4
101#define DAVINCI_DMA_VPSS_H3A 5
102#define DAVINCI_DMA_VPSS_PRVU 6
103#define DAVINCI_DMA_VPSS_RSZ 7
104#define DAVINCI_DMA_IMCOP_IMXINT 8
105#define DAVINCI_DMA_IMCOP_VLCDINT 9
106#define DAVINCI_DMA_IMCO_PASQINT 10
107#define DAVINCI_DMA_IMCOP_DSQINT 11
108#define DAVINCI_DMA_SPI_SPIX 16
109#define DAVINCI_DMA_SPI_SPIR 17
110#define DAVINCI_DMA_UART0_URXEVT0 18
111#define DAVINCI_DMA_UART0_UTXEVT0 19
112#define DAVINCI_DMA_UART1_URXEVT1 20
113#define DAVINCI_DMA_UART1_UTXEVT1 21
114#define DAVINCI_DMA_UART2_URXEVT2 22
115#define DAVINCI_DMA_UART2_UTXEVT2 23
116#define DAVINCI_DMA_MEMSTK_MSEVT 24
117#define DAVINCI_DMA_MMCRXEVT 26
118#define DAVINCI_DMA_MMCTXEVT 27
119#define DAVINCI_DMA_I2C_ICREVT 28
120#define DAVINCI_DMA_I2C_ICXEVT 29
121#define DAVINCI_DMA_GPIO_GPINT0 32
122#define DAVINCI_DMA_GPIO_GPINT1 33
123#define DAVINCI_DMA_GPIO_GPINT2 34
124#define DAVINCI_DMA_GPIO_GPINT3 35
125#define DAVINCI_DMA_GPIO_GPINT4 36
126#define DAVINCI_DMA_GPIO_GPINT5 37
127#define DAVINCI_DMA_GPIO_GPINT6 38
128#define DAVINCI_DMA_GPIO_GPINT7 39
129#define DAVINCI_DMA_GPIO_GPBNKINT0 40
130#define DAVINCI_DMA_GPIO_GPBNKINT1 41
131#define DAVINCI_DMA_GPIO_GPBNKINT2 42
132#define DAVINCI_DMA_GPIO_GPBNKINT3 43
133#define DAVINCI_DMA_GPIO_GPBNKINT4 44
134#define DAVINCI_DMA_TIMER0_TINT0 48
135#define DAVINCI_DMA_TIMER1_TINT1 49
136#define DAVINCI_DMA_TIMER2_TINT2 50
137#define DAVINCI_DMA_TIMER3_TINT3 51
138#define DAVINCI_DMA_PWM0 52
139#define DAVINCI_DMA_PWM1 53
140#define DAVINCI_DMA_PWM2 54
141
142/* DA830 specific EDMA3 information */
143#define EDMA_DA830_NUM_DMACH 32
144#define EDMA_DA830_NUM_TCC 32
145#define EDMA_DA830_NUM_PARAMENTRY 128
146#define EDMA_DA830_NUM_EVQUE 2
147#define EDMA_DA830_NUM_TC 2
148#define EDMA_DA830_CHMAP_EXIST 0
149#define EDMA_DA830_NUM_REGIONS 4
150#define DA830_DMACH2EVENT_MAP0 0x000FC03Fu
151#define DA830_DMACH2EVENT_MAP1 0x00000000u
152#define DA830_EDMA_ARM_OWN 0x30FFCCFFu
153
154/*ch_status paramater of callback function possible values*/
155#define DMA_COMPLETE 1
156#define DMA_CC_ERROR 2
157#define DMA_TC1_ERROR 3
158#define DMA_TC2_ERROR 4
159
160enum address_mode {
161 INCR = 0,
162 FIFO = 1
163};
164
165enum fifo_width {
166 W8BIT = 0,
167 W16BIT = 1,
168 W32BIT = 2,
169 W64BIT = 3,
170 W128BIT = 4,
171 W256BIT = 5
172};
173
174enum dma_event_q {
175 EVENTQ_0 = 0,
176 EVENTQ_1 = 1,
177 EVENTQ_2 = 2,
178 EVENTQ_3 = 3,
179 EVENTQ_DEFAULT = -1
180};
181
182enum sync_dimension {
183 ASYNC = 0,
184 ABSYNC = 1
185};
186
187#define EDMA_CTLR_CHAN(ctlr, chan) (((ctlr) << 16) | (chan))
188#define EDMA_CTLR(i) ((i) >> 16)
189#define EDMA_CHAN_SLOT(i) ((i) & 0xffff)
190
191#define EDMA_CHANNEL_ANY -1 /* for edma_alloc_channel() */
192#define EDMA_SLOT_ANY -1 /* for edma_alloc_slot() */
193#define EDMA_CONT_PARAMS_ANY 1001
194#define EDMA_CONT_PARAMS_FIXED_EXACT 1002
195#define EDMA_CONT_PARAMS_FIXED_NOT_EXACT 1003
196
197#define EDMA_MAX_CC 2
198
199/* alloc/free DMA channels and their dedicated parameter RAM slots */
200int edma_alloc_channel(int channel,
201 void (*callback)(unsigned channel, u16 ch_status, void *data),
202 void *data, enum dma_event_q);
203void edma_free_channel(unsigned channel);
204
205/* alloc/free parameter RAM slots */
206int edma_alloc_slot(unsigned ctlr, int slot);
207void edma_free_slot(unsigned slot);
208
209/* alloc/free a set of contiguous parameter RAM slots */
210int edma_alloc_cont_slots(unsigned ctlr, unsigned int id, int slot, int count);
211int edma_free_cont_slots(unsigned slot, int count);
212
213/* calls that operate on part of a parameter RAM slot */
214void edma_set_src(unsigned slot, dma_addr_t src_port,
215 enum address_mode mode, enum fifo_width);
216void edma_set_dest(unsigned slot, dma_addr_t dest_port,
217 enum address_mode mode, enum fifo_width);
218void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst);
219void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
220void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
221void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
222 u16 bcnt_rld, enum sync_dimension sync_mode);
223void edma_link(unsigned from, unsigned to);
224void edma_unlink(unsigned from);
225
226/* calls that operate on an entire parameter RAM slot */
227void edma_write_slot(unsigned slot, const struct edmacc_param *params);
228void edma_read_slot(unsigned slot, struct edmacc_param *params);
229
230/* channel control operations */
231int edma_start(unsigned channel);
232void edma_stop(unsigned channel);
233void edma_clean_channel(unsigned channel);
234void edma_clear_event(unsigned channel);
235void edma_pause(unsigned channel);
236void edma_resume(unsigned channel);
237
238struct edma_rsv_info {
239
240 const s16 (*rsv_chans)[2];
241 const s16 (*rsv_slots)[2];
242};
243
244/* platform_data for EDMA driver */
245struct edma_soc_info {
246
247 /* how many dma resources of each type */
248 unsigned n_channel;
249 unsigned n_region;
250 unsigned n_slot;
251 unsigned n_tc;
252 unsigned n_cc;
253 /*
254 * Default queue is expected to be a low-priority queue.
255 * This way, long transfers on the default queue started
256 * by the codec engine will not cause audio defects.
257 */
258 enum dma_event_q default_queue;
259
260 /* Resource reservation for other cores */
261 struct edma_rsv_info *rsv;
262
263 const s8 (*queue_tc_mapping)[2];
264 const s8 (*queue_priority_mapping)[2];
265};
266
267#endif
diff --git a/arch/arm/mach-davinci/include/mach/tnetv107x.h b/arch/arm/mach-davinci/include/mach/tnetv107x.h
index 1656a02e3eda..366e975effa8 100644
--- a/arch/arm/mach-davinci/include/mach/tnetv107x.h
+++ b/arch/arm/mach-davinci/include/mach/tnetv107x.h
@@ -51,9 +51,9 @@ struct tnetv107x_device_info {
51extern struct platform_device tnetv107x_wdt_device; 51extern struct platform_device tnetv107x_wdt_device;
52extern struct platform_device tnetv107x_serial_device; 52extern struct platform_device tnetv107x_serial_device;
53 53
54extern void __init tnetv107x_init(void); 54extern void tnetv107x_init(void);
55extern void __init tnetv107x_devices_init(struct tnetv107x_device_info *); 55extern void tnetv107x_devices_init(struct tnetv107x_device_info *);
56extern void __init tnetv107x_irq_init(void); 56extern void tnetv107x_irq_init(void);
57void tnetv107x_restart(char mode, const char *cmd); 57void tnetv107x_restart(char mode, const char *cmd);
58 58
59#endif 59#endif
diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index 36469d813951..dff7b2fd4e20 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -22,8 +22,7 @@ config MACH_CM_A510
22 22
23config MACH_DOVE_DT 23config MACH_DOVE_DT
24 bool "Marvell Dove Flattened Device Tree" 24 bool "Marvell Dove Flattened Device Tree"
25 select MVEBU_CLK_CORE 25 select DOVE_CLK
26 select MVEBU_CLK_GATING
27 select REGULATOR 26 select REGULATOR
28 select REGULATOR_FIXED_VOLTAGE 27 select REGULATOR_FIXED_VOLTAGE
29 select USE_OF 28 select USE_OF
diff --git a/arch/arm/mach-dove/board-dt.c b/arch/arm/mach-dove/board-dt.c
index 0b142803b2e1..f3755ac81148 100644
--- a/arch/arm/mach-dove/board-dt.c
+++ b/arch/arm/mach-dove/board-dt.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/clk-provider.h> 12#include <linux/clk-provider.h>
13#include <linux/clk/mvebu.h>
14#include <linux/of.h> 13#include <linux/of.h>
15#include <linux/of_platform.h> 14#include <linux/of_platform.h>
16#include <linux/platform_data/usb-ehci-orion.h> 15#include <linux/platform_data/usb-ehci-orion.h>
@@ -49,7 +48,7 @@ static void __init dove_legacy_clk_init(void)
49 48
50static void __init dove_of_clk_init(void) 49static void __init dove_of_clk_init(void)
51{ 50{
52 mvebu_clocks_init(); 51 of_clk_init(NULL);
53 dove_legacy_clk_init(); 52 dove_legacy_clk_init();
54} 53}
55 54
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index e2b5da031f96..2a9443d04d92 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -9,7 +9,6 @@
9 */ 9 */
10 10
11#include <linux/clk-provider.h> 11#include <linux/clk-provider.h>
12#include <linux/clk/mvebu.h>
13#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
14#include <linux/init.h> 13#include <linux/init.h>
15#include <linux/of.h> 14#include <linux/of.h>
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index b13cc74114db..8a53f346cdb3 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -116,7 +116,7 @@ static void __init ebsa110_map_io(void)
116 iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc)); 116 iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc));
117} 117}
118 118
119static void __iomem *ebsa110_ioremap_caller(unsigned long cookie, size_t size, 119static void __iomem *ebsa110_ioremap_caller(phys_addr_t cookie, size_t size,
120 unsigned int flags, void *caller) 120 unsigned int flags, void *caller)
121{ 121{
122 return (void __iomem *)cookie; 122 return (void __iomem *)cookie;
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index ff18fc2ea46f..f5f65b58181e 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -14,9 +14,11 @@ menu "SAMSUNG EXYNOS SoCs Support"
14config ARCH_EXYNOS4 14config ARCH_EXYNOS4
15 bool "SAMSUNG EXYNOS4" 15 bool "SAMSUNG EXYNOS4"
16 default y 16 default y
17 select GIC_NON_BANKED
17 select HAVE_ARM_SCU if SMP 18 select HAVE_ARM_SCU if SMP
18 select HAVE_SMP 19 select HAVE_SMP
19 select MIGHT_HAVE_CACHE_L2X0 20 select MIGHT_HAVE_CACHE_L2X0
21 select PINCTRL
20 help 22 help
21 Samsung EXYNOS4 SoCs based systems 23 Samsung EXYNOS4 SoCs based systems
22 24
@@ -24,6 +26,7 @@ config ARCH_EXYNOS5
24 bool "SAMSUNG EXYNOS5" 26 bool "SAMSUNG EXYNOS5"
25 select HAVE_ARM_SCU if SMP 27 select HAVE_ARM_SCU if SMP
26 select HAVE_SMP 28 select HAVE_SMP
29 select PINCTRL
27 help 30 help
28 Samsung EXYNOS5 (Cortex-A15) SoC based systems 31 Samsung EXYNOS5 (Cortex-A15) SoC based systems
29 32
@@ -34,6 +37,7 @@ config CPU_EXYNOS4210
34 default y 37 default y
35 depends on ARCH_EXYNOS4 38 depends on ARCH_EXYNOS4
36 select ARM_CPU_SUSPEND if PM 39 select ARM_CPU_SUSPEND if PM
40 select PINCTRL_EXYNOS
37 select PM_GENERIC_DOMAINS 41 select PM_GENERIC_DOMAINS
38 select S5P_PM if PM 42 select S5P_PM if PM
39 select S5P_SLEEP if PM 43 select S5P_SLEEP if PM
@@ -45,6 +49,7 @@ config SOC_EXYNOS4212
45 bool "SAMSUNG EXYNOS4212" 49 bool "SAMSUNG EXYNOS4212"
46 default y 50 default y
47 depends on ARCH_EXYNOS4 51 depends on ARCH_EXYNOS4
52 select PINCTRL_EXYNOS
48 select S5P_PM if PM 53 select S5P_PM if PM
49 select S5P_SLEEP if PM 54 select S5P_SLEEP if PM
50 select SAMSUNG_DMADEV 55 select SAMSUNG_DMADEV
@@ -55,6 +60,7 @@ config SOC_EXYNOS4412
55 bool "SAMSUNG EXYNOS4412" 60 bool "SAMSUNG EXYNOS4412"
56 default y 61 default y
57 depends on ARCH_EXYNOS4 62 depends on ARCH_EXYNOS4
63 select PINCTRL_EXYNOS
58 select SAMSUNG_DMADEV 64 select SAMSUNG_DMADEV
59 help 65 help
60 Enable EXYNOS4412 SoC support 66 Enable EXYNOS4412 SoC support
@@ -63,6 +69,7 @@ config SOC_EXYNOS5250
63 bool "SAMSUNG EXYNOS5250" 69 bool "SAMSUNG EXYNOS5250"
64 default y 70 default y
65 depends on ARCH_EXYNOS5 71 depends on ARCH_EXYNOS5
72 select PINCTRL_EXYNOS
66 select PM_GENERIC_DOMAINS if PM 73 select PM_GENERIC_DOMAINS if PM
67 select S5P_PM if PM 74 select S5P_PM if PM
68 select S5P_SLEEP if PM 75 select S5P_SLEEP if PM
@@ -71,352 +78,42 @@ config SOC_EXYNOS5250
71 help 78 help
72 Enable EXYNOS5250 SoC support 79 Enable EXYNOS5250 SoC support
73 80
81config SOC_EXYNOS5420
82 bool "SAMSUNG EXYNOS5420"
83 default y
84 depends on ARCH_EXYNOS5
85 select PM_GENERIC_DOMAINS if PM
86 select S5P_PM if PM
87 select S5P_SLEEP if PM
88 help
89 Enable EXYNOS5420 SoC support
90
74config SOC_EXYNOS5440 91config SOC_EXYNOS5440
75 bool "SAMSUNG EXYNOS5440" 92 bool "SAMSUNG EXYNOS5440"
76 default y 93 default y
77 depends on ARCH_EXYNOS5 94 depends on ARCH_EXYNOS5
78 select ARCH_HAS_OPP 95 select ARCH_HAS_OPP
79 select ARM_ARCH_TIMER 96 select HAVE_ARM_ARCH_TIMER
80 select AUTO_ZRELADDR 97 select AUTO_ZRELADDR
81 select PINCTRL 98 select MIGHT_HAVE_PCI
99 select PCI_DOMAINS if PCI
82 select PINCTRL_EXYNOS5440 100 select PINCTRL_EXYNOS5440
83 select PM_OPP 101 select PM_OPP
84 help 102 help
85 Enable EXYNOS5440 SoC support 103 Enable EXYNOS5440 SoC support
86 104
87config EXYNOS_ATAGS
88 bool "ATAGS based boot for EXYNOS (deprecated)"
89 depends on !ARCH_MULTIPLATFORM
90 depends on ATAGS
91 default y
92 help
93 The EXYNOS platform is moving towards being completely probed
94 through device tree. This enables support for board files using
95 the traditional ATAGS boot format.
96 Note that this option is not available for multiplatform builds.
97
98if EXYNOS_ATAGS
99
100config EXYNOS_DEV_DMA
101 bool
102 help
103 Compile in amba device definitions for DMA controller
104
105config EXYNOS4_DEV_AHCI
106 bool
107 help
108 Compile in platform device definitions for AHCI
109
110config EXYNOS4_SETUP_FIMD0
111 bool
112 help
113 Common setup code for FIMD0.
114
115config EXYNOS4_DEV_USB_OHCI
116 bool
117 help
118 Compile in platform device definition for USB OHCI
119
120config EXYNOS4_SETUP_I2C1
121 bool
122 help
123 Common setup code for i2c bus 1.
124
125config EXYNOS4_SETUP_I2C2
126 bool
127 help
128 Common setup code for i2c bus 2.
129
130config EXYNOS4_SETUP_I2C3
131 bool
132 help
133 Common setup code for i2c bus 3.
134
135config EXYNOS4_SETUP_I2C4
136 bool
137 help
138 Common setup code for i2c bus 4.
139
140config EXYNOS4_SETUP_I2C5
141 bool
142 help
143 Common setup code for i2c bus 5.
144
145config EXYNOS4_SETUP_I2C6
146 bool
147 help
148 Common setup code for i2c bus 6.
149
150config EXYNOS4_SETUP_I2C7
151 bool
152 help
153 Common setup code for i2c bus 7.
154
155config EXYNOS4_SETUP_KEYPAD
156 bool
157 help
158 Common setup code for keypad.
159
160config EXYNOS4_SETUP_SDHCI
161 bool
162 select EXYNOS4_SETUP_SDHCI_GPIO
163 help
164 Internal helper functions for EXYNOS4 based SDHCI systems.
165
166config EXYNOS4_SETUP_SDHCI_GPIO
167 bool
168 help
169 Common setup code for SDHCI gpio.
170
171config EXYNOS4_SETUP_FIMC
172 bool
173 help
174 Common setup code for the camera interfaces.
175
176config EXYNOS4_SETUP_USB_PHY
177 bool
178 help
179 Common setup code for USB PHY controller
180
181config EXYNOS_SETUP_SPI
182 bool
183 help
184 Common setup code for SPI GPIO configurations.
185
186# machine support
187
188if ARCH_EXYNOS4
189
190comment "EXYNOS4210 Boards"
191
192config MACH_SMDKC210
193 bool "SMDKC210"
194 select MACH_SMDKV310
195 help
196 Machine support for Samsung SMDKC210
197
198config MACH_SMDKV310
199 bool "SMDKV310"
200 select CPU_EXYNOS4210
201 select EXYNOS4_DEV_AHCI
202 select EXYNOS4_DEV_USB_OHCI
203 select EXYNOS4_SETUP_FIMD0
204 select EXYNOS4_SETUP_I2C1
205 select EXYNOS4_SETUP_KEYPAD
206 select EXYNOS4_SETUP_SDHCI
207 select EXYNOS4_SETUP_USB_PHY
208 select EXYNOS_DEV_DMA
209 select EXYNOS_DEV_SYSMMU
210 select S3C24XX_PWM
211 select S3C_DEV_HSMMC
212 select S3C_DEV_HSMMC1
213 select S3C_DEV_HSMMC2
214 select S3C_DEV_HSMMC3
215 select S3C_DEV_I2C1
216 select S3C_DEV_RTC
217 select S3C_DEV_USB_HSOTG
218 select S3C_DEV_WDT
219 select S5P_DEV_FIMC0
220 select S5P_DEV_FIMC1
221 select S5P_DEV_FIMC2
222 select S5P_DEV_FIMC3
223 select S5P_DEV_FIMD0
224 select S5P_DEV_G2D
225 select S5P_DEV_I2C_HDMIPHY
226 select S5P_DEV_JPEG
227 select S5P_DEV_MFC
228 select S5P_DEV_TV
229 select S5P_DEV_USB_EHCI
230 select SAMSUNG_DEV_BACKLIGHT
231 select SAMSUNG_DEV_KEYPAD
232 select SAMSUNG_DEV_PWM
233 help
234 Machine support for Samsung SMDKV310
235
236config MACH_ARMLEX4210
237 bool "ARMLEX4210"
238 select CPU_EXYNOS4210
239 select EXYNOS4_DEV_AHCI
240 select EXYNOS4_SETUP_SDHCI
241 select EXYNOS_DEV_DMA
242 select S3C_DEV_HSMMC
243 select S3C_DEV_HSMMC2
244 select S3C_DEV_HSMMC3
245 select S3C_DEV_RTC
246 select S3C_DEV_WDT
247 help
248 Machine support for Samsung ARMLEX4210 based on EXYNOS4210
249
250config MACH_UNIVERSAL_C210
251 bool "Mobile UNIVERSAL_C210 Board"
252 select CLKSRC_MMIO
253 select CLKSRC_SAMSUNG_PWM
254 select CPU_EXYNOS4210
255 select EXYNOS4_SETUP_FIMC
256 select EXYNOS4_SETUP_FIMD0
257 select EXYNOS4_SETUP_I2C1
258 select EXYNOS4_SETUP_I2C3
259 select EXYNOS4_SETUP_I2C5
260 select EXYNOS4_SETUP_SDHCI
261 select EXYNOS4_SETUP_USB_PHY
262 select EXYNOS_DEV_DMA
263 select EXYNOS_DEV_SYSMMU
264 select S3C_DEV_HSMMC
265 select S3C_DEV_HSMMC2
266 select S3C_DEV_HSMMC3
267 select S3C_DEV_I2C1
268 select S3C_DEV_I2C3
269 select S3C_DEV_I2C5
270 select S3C_DEV_USB_HSOTG
271 select S5P_DEV_CSIS0
272 select S5P_DEV_FIMC0
273 select S5P_DEV_FIMC1
274 select S5P_DEV_FIMC2
275 select S5P_DEV_FIMC3
276 select S5P_DEV_FIMD0
277 select S5P_DEV_G2D
278 select S5P_DEV_I2C_HDMIPHY
279 select S5P_DEV_JPEG
280 select S5P_DEV_MFC
281 select S5P_DEV_ONENAND
282 select S5P_DEV_TV
283 select S5P_GPIO_INT
284 select S5P_SETUP_MIPIPHY
285 help
286 Machine support for Samsung Mobile Universal S5PC210 Reference
287 Board.
288
289config MACH_NURI
290 bool "Mobile NURI Board"
291 select CPU_EXYNOS4210
292 select EXYNOS4_SETUP_FIMC
293 select EXYNOS4_SETUP_FIMD0
294 select EXYNOS4_SETUP_I2C1
295 select EXYNOS4_SETUP_I2C3
296 select EXYNOS4_SETUP_I2C5
297 select EXYNOS4_SETUP_I2C6
298 select EXYNOS4_SETUP_SDHCI
299 select EXYNOS4_SETUP_USB_PHY
300 select EXYNOS_DEV_DMA
301 select S3C_DEV_HSMMC
302 select S3C_DEV_HSMMC2
303 select S3C_DEV_HSMMC3
304 select S3C_DEV_I2C1
305 select S3C_DEV_I2C3
306 select S3C_DEV_I2C5
307 select S3C_DEV_I2C6
308 select S3C_DEV_RTC
309 select S3C_DEV_USB_HSOTG
310 select S3C_DEV_WDT
311 select S5P_DEV_CSIS0
312 select S5P_DEV_FIMC0
313 select S5P_DEV_FIMC1
314 select S5P_DEV_FIMC2
315 select S5P_DEV_FIMC3
316 select S5P_DEV_FIMD0
317 select S5P_DEV_G2D
318 select S5P_DEV_JPEG
319 select S5P_DEV_MFC
320 select S5P_DEV_USB_EHCI
321 select S5P_GPIO_INT
322 select S5P_SETUP_MIPIPHY
323 select SAMSUNG_DEV_ADC
324 select SAMSUNG_DEV_PWM
325 help
326 Machine support for Samsung Mobile NURI Board.
327
328config MACH_ORIGEN
329 bool "ORIGEN"
330 select CPU_EXYNOS4210
331 select EXYNOS4_DEV_USB_OHCI
332 select EXYNOS4_SETUP_FIMD0
333 select EXYNOS4_SETUP_SDHCI
334 select EXYNOS4_SETUP_USB_PHY
335 select EXYNOS_DEV_DMA
336 select EXYNOS_DEV_SYSMMU
337 select S3C24XX_PWM
338 select S3C_DEV_HSMMC
339 select S3C_DEV_HSMMC2
340 select S3C_DEV_RTC
341 select S3C_DEV_USB_HSOTG
342 select S3C_DEV_WDT
343 select S5P_DEV_FIMC0
344 select S5P_DEV_FIMC1
345 select S5P_DEV_FIMC2
346 select S5P_DEV_FIMC3
347 select S5P_DEV_FIMD0
348 select S5P_DEV_G2D
349 select S5P_DEV_I2C_HDMIPHY
350 select S5P_DEV_JPEG
351 select S5P_DEV_MFC
352 select S5P_DEV_TV
353 select S5P_DEV_USB_EHCI
354 select SAMSUNG_DEV_BACKLIGHT
355 select SAMSUNG_DEV_PWM
356 help
357 Machine support for ORIGEN based on Samsung EXYNOS4210
358
359comment "EXYNOS4212 Boards"
360
361config MACH_SMDK4212
362 bool "SMDK4212"
363 select EXYNOS4_SETUP_FIMD0
364 select EXYNOS4_SETUP_I2C1
365 select EXYNOS4_SETUP_I2C3
366 select EXYNOS4_SETUP_I2C7
367 select EXYNOS4_SETUP_KEYPAD
368 select EXYNOS4_SETUP_SDHCI
369 select EXYNOS4_SETUP_USB_PHY
370 select EXYNOS_DEV_DMA
371 select EXYNOS_DEV_SYSMMU
372 select S3C24XX_PWM
373 select S3C_DEV_HSMMC2
374 select S3C_DEV_HSMMC3
375 select S3C_DEV_I2C1
376 select S3C_DEV_I2C3
377 select S3C_DEV_I2C7
378 select S3C_DEV_RTC
379 select S3C_DEV_USB_HSOTG
380 select S3C_DEV_WDT
381 select S5P_DEV_FIMC0
382 select S5P_DEV_FIMC1
383 select S5P_DEV_FIMC2
384 select S5P_DEV_FIMC3
385 select S5P_DEV_FIMD0
386 select S5P_DEV_MFC
387 select SAMSUNG_DEV_BACKLIGHT
388 select SAMSUNG_DEV_KEYPAD
389 select SAMSUNG_DEV_PWM
390 select SOC_EXYNOS4212
391 help
392 Machine support for Samsung SMDK4212
393
394comment "EXYNOS4412 Boards"
395
396config MACH_SMDK4412
397 bool "SMDK4412"
398 select MACH_SMDK4212
399 select SOC_EXYNOS4412
400 help
401 Machine support for Samsung SMDK4412
402endif
403
404endif
405
406comment "Flattened Device Tree based board for EXYNOS SoCs" 105comment "Flattened Device Tree based board for EXYNOS SoCs"
407 106
408config MACH_EXYNOS4_DT 107config MACH_EXYNOS4_DT
409 bool "Samsung Exynos4 Machine using device tree" 108 bool "Samsung Exynos4 Machine using device tree"
109 default y
410 depends on ARCH_EXYNOS4 110 depends on ARCH_EXYNOS4
411 select ARM_AMBA 111 select ARM_AMBA
412 select CLKSRC_OF 112 select CLKSRC_OF
413 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210 113 select CLKSRC_SAMSUNG_PWM if CPU_EXYNOS4210
414 select CPU_EXYNOS4210 114 select CPU_EXYNOS4210
415 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD 115 select KEYBOARD_SAMSUNG if INPUT_KEYBOARD
416 select PINCTRL
417 select PINCTRL_EXYNOS
418 select S5P_DEV_MFC 116 select S5P_DEV_MFC
419 select USE_OF
420 help 117 help
421 Machine support for Samsung Exynos4 machine with device tree enabled. 118 Machine support for Samsung Exynos4 machine with device tree enabled.
422 Select this if a fdt blob is available for the Exynos4 SoC based board. 119 Select this if a fdt blob is available for the Exynos4 SoC based board.
@@ -429,28 +126,11 @@ config MACH_EXYNOS5_DT
429 depends on ARCH_EXYNOS5 126 depends on ARCH_EXYNOS5
430 select ARM_AMBA 127 select ARM_AMBA
431 select CLKSRC_OF 128 select CLKSRC_OF
432 select USE_OF 129 select USB_ARCH_HAS_XHCI
433 help 130 help
434 Machine support for Samsung EXYNOS5 machine with device tree enabled. 131 Machine support for Samsung EXYNOS5 machine with device tree enabled.
435 Select this if a fdt blob is available for the EXYNOS5 SoC based board. 132 Select this if a fdt blob is available for the EXYNOS5 SoC based board.
436 133
437if ARCH_EXYNOS4
438
439comment "Configuration for HSMMC 8-bit bus width"
440
441config EXYNOS4_SDHCI_CH0_8BIT
442 bool "Channel 0 with 8-bit bus"
443 help
444 Support HSMMC Channel 0 8-bit bus.
445 If selected, Channel 1 is disabled.
446
447config EXYNOS4_SDHCI_CH2_8BIT
448 bool "Channel 2 with 8-bit bus"
449 help
450 Support HSMMC Channel 2 8-bit bus.
451 If selected, Channel 3 is disabled.
452endif
453
454endmenu 134endmenu
455 135
456endif 136endif
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index b09b027178f3..e970a7a4e278 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -32,38 +32,5 @@ AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec)
32 32
33# machine support 33# machine support
34 34
35obj-$(CONFIG_MACH_SMDKC210) += mach-smdkv310.o
36obj-$(CONFIG_MACH_SMDKV310) += mach-smdkv310.o
37obj-$(CONFIG_MACH_ARMLEX4210) += mach-armlex4210.o
38obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o
39obj-$(CONFIG_MACH_NURI) += mach-nuri.o
40obj-$(CONFIG_MACH_ORIGEN) += mach-origen.o
41
42obj-$(CONFIG_MACH_SMDK4212) += mach-smdk4x12.o
43obj-$(CONFIG_MACH_SMDK4412) += mach-smdk4x12.o
44
45obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o 35obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o
46obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o 36obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o
47
48# device support
49
50obj-y += dev-uart.o
51obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o
52obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o
53obj-$(CONFIG_EXYNOS_DEV_DMA) += dma.o
54obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
55
56obj-$(CONFIG_ARCH_EXYNOS) += setup-i2c0.o
57obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o
58obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o
59obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o
60obj-$(CONFIG_EXYNOS4_SETUP_I2C2) += setup-i2c2.o
61obj-$(CONFIG_EXYNOS4_SETUP_I2C3) += setup-i2c3.o
62obj-$(CONFIG_EXYNOS4_SETUP_I2C4) += setup-i2c4.o
63obj-$(CONFIG_EXYNOS4_SETUP_I2C5) += setup-i2c5.o
64obj-$(CONFIG_EXYNOS4_SETUP_I2C6) += setup-i2c6.o
65obj-$(CONFIG_EXYNOS4_SETUP_I2C7) += setup-i2c7.o
66obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD) += setup-keypad.o
67obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
68obj-$(CONFIG_EXYNOS4_SETUP_USB_PHY) += setup-usb-phy.o
69obj-$(CONFIG_EXYNOS_SETUP_SPI) += setup-spi.o
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index f7e504b7874d..2c655db4b78e 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -40,20 +40,9 @@
40 40
41#include <mach/regs-irq.h> 41#include <mach/regs-irq.h>
42#include <mach/regs-pmu.h> 42#include <mach/regs-pmu.h>
43#include <mach/regs-gpio.h>
44#include <mach/irqs.h>
45 43
46#include <plat/cpu.h> 44#include <plat/cpu.h>
47#include <plat/devs.h>
48#include <plat/pm.h> 45#include <plat/pm.h>
49#include <plat/sdhci.h>
50#include <plat/gpio-cfg.h>
51#include <plat/adc-core.h>
52#include <plat/fb-core.h>
53#include <plat/fimc-core.h>
54#include <plat/iic-core.h>
55#include <plat/tv-core.h>
56#include <plat/spi-core.h>
57#include <plat/regs-serial.h> 46#include <plat/regs-serial.h>
58 47
59#include "common.h" 48#include "common.h"
@@ -64,36 +53,31 @@ static const char name_exynos4210[] = "EXYNOS4210";
64static const char name_exynos4212[] = "EXYNOS4212"; 53static const char name_exynos4212[] = "EXYNOS4212";
65static const char name_exynos4412[] = "EXYNOS4412"; 54static const char name_exynos4412[] = "EXYNOS4412";
66static const char name_exynos5250[] = "EXYNOS5250"; 55static const char name_exynos5250[] = "EXYNOS5250";
56static const char name_exynos5420[] = "EXYNOS5420";
67static const char name_exynos5440[] = "EXYNOS5440"; 57static const char name_exynos5440[] = "EXYNOS5440";
68 58
69static void exynos4_map_io(void); 59static void exynos4_map_io(void);
70static void exynos5_map_io(void); 60static void exynos5_map_io(void);
71static void exynos5440_map_io(void); 61static void exynos5440_map_io(void);
72static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no);
73static int exynos_init(void); 62static int exynos_init(void);
74 63
75unsigned long xxti_f = 0, xusbxti_f = 0;
76
77static struct cpu_table cpu_ids[] __initdata = { 64static struct cpu_table cpu_ids[] __initdata = {
78 { 65 {
79 .idcode = EXYNOS4210_CPU_ID, 66 .idcode = EXYNOS4210_CPU_ID,
80 .idmask = EXYNOS4_CPU_MASK, 67 .idmask = EXYNOS4_CPU_MASK,
81 .map_io = exynos4_map_io, 68 .map_io = exynos4_map_io,
82 .init_uarts = exynos4_init_uarts,
83 .init = exynos_init, 69 .init = exynos_init,
84 .name = name_exynos4210, 70 .name = name_exynos4210,
85 }, { 71 }, {
86 .idcode = EXYNOS4212_CPU_ID, 72 .idcode = EXYNOS4212_CPU_ID,
87 .idmask = EXYNOS4_CPU_MASK, 73 .idmask = EXYNOS4_CPU_MASK,
88 .map_io = exynos4_map_io, 74 .map_io = exynos4_map_io,
89 .init_uarts = exynos4_init_uarts,
90 .init = exynos_init, 75 .init = exynos_init,
91 .name = name_exynos4212, 76 .name = name_exynos4212,
92 }, { 77 }, {
93 .idcode = EXYNOS4412_CPU_ID, 78 .idcode = EXYNOS4412_CPU_ID,
94 .idmask = EXYNOS4_CPU_MASK, 79 .idmask = EXYNOS4_CPU_MASK,
95 .map_io = exynos4_map_io, 80 .map_io = exynos4_map_io,
96 .init_uarts = exynos4_init_uarts,
97 .init = exynos_init, 81 .init = exynos_init,
98 .name = name_exynos4412, 82 .name = name_exynos4412,
99 }, { 83 }, {
@@ -103,6 +87,12 @@ static struct cpu_table cpu_ids[] __initdata = {
103 .init = exynos_init, 87 .init = exynos_init,
104 .name = name_exynos5250, 88 .name = name_exynos5250,
105 }, { 89 }, {
90 .idcode = EXYNOS5420_SOC_ID,
91 .idmask = EXYNOS5_SOC_MASK,
92 .map_io = exynos5_map_io,
93 .init = exynos_init,
94 .name = name_exynos5420,
95 }, {
106 .idcode = EXYNOS5440_SOC_ID, 96 .idcode = EXYNOS5440_SOC_ID,
107 .idmask = EXYNOS5_SOC_MASK, 97 .idmask = EXYNOS5_SOC_MASK,
108 .map_io = exynos5440_map_io, 98 .map_io = exynos5440_map_io,
@@ -113,15 +103,6 @@ static struct cpu_table cpu_ids[] __initdata = {
113 103
114/* Initial IO mappings */ 104/* Initial IO mappings */
115 105
116static struct map_desc exynos_iodesc[] __initdata = {
117 {
118 .virtual = (unsigned long)S5P_VA_CHIPID,
119 .pfn = __phys_to_pfn(EXYNOS_PA_CHIPID),
120 .length = SZ_4K,
121 .type = MT_DEVICE,
122 },
123};
124
125static struct map_desc exynos4_iodesc[] __initdata = { 106static struct map_desc exynos4_iodesc[] __initdata = {
126 { 107 {
127 .virtual = (unsigned long)S3C_VA_SYS, 108 .virtual = (unsigned long)S3C_VA_SYS,
@@ -304,13 +285,6 @@ static struct map_desc exynos5440_iodesc0[] __initdata = {
304 }, 285 },
305}; 286};
306 287
307static struct samsung_pwm_variant exynos4_pwm_variant = {
308 .bits = 32,
309 .div_base = 0,
310 .has_tint_cstat = true,
311 .tclk_mask = 0,
312};
313
314void exynos4_restart(char mode, const char *cmd) 288void exynos4_restart(char mode, const char *cmd)
315{ 289{
316 __raw_writel(0x1, S5P_SWRESET); 290 __raw_writel(0x1, S5P_SWRESET);
@@ -322,10 +296,10 @@ void exynos5_restart(char mode, const char *cmd)
322 u32 val; 296 u32 val;
323 void __iomem *addr; 297 void __iomem *addr;
324 298
325 if (of_machine_is_compatible("samsung,exynos5250")) { 299 val = 0x1;
326 val = 0x1; 300 addr = EXYNOS_SWRESET;
327 addr = EXYNOS_SWRESET; 301
328 } else if (of_machine_is_compatible("samsung,exynos5440")) { 302 if (of_machine_is_compatible("samsung,exynos5440")) {
329 u32 status; 303 u32 status;
330 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock"); 304 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock");
331 305
@@ -336,9 +310,6 @@ void exynos5_restart(char mode, const char *cmd)
336 val = __raw_readl(addr); 310 val = __raw_readl(addr);
337 311
338 val = (val & 0xffff0000) | (status & 0xffff); 312 val = (val & 0xffff0000) | (status & 0xffff);
339 } else {
340 pr_err("%s: cannot support non-DT\n", __func__);
341 return;
342 } 313 }
343 314
344 __raw_writel(val, addr); 315 __raw_writel(val, addr);
@@ -353,8 +324,7 @@ void __init exynos_init_late(void)
353 exynos_pm_late_initcall(); 324 exynos_pm_late_initcall();
354} 325}
355 326
356#ifdef CONFIG_OF 327static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
357int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
358 int depth, void *data) 328 int depth, void *data)
359{ 329{
360 struct map_desc iodesc; 330 struct map_desc iodesc;
@@ -376,7 +346,6 @@ int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
376 iotable_init(&iodesc, 1); 346 iotable_init(&iodesc, 1);
377 return 1; 347 return 1;
378} 348}
379#endif
380 349
381/* 350/*
382 * exynos_map_io 351 * exynos_map_io
@@ -384,19 +353,11 @@ int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
384 * register the standard cpu IO areas 353 * register the standard cpu IO areas
385 */ 354 */
386 355
387void __init exynos_init_io(struct map_desc *mach_desc, int size) 356void __init exynos_init_io(void)
388{ 357{
389 debug_ll_io_init(); 358 debug_ll_io_init();
390 359
391#ifdef CONFIG_OF 360 of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
392 if (initial_boot_params)
393 of_scan_flat_dt(exynos_fdt_map_chipid, NULL);
394 else
395#endif
396 iotable_init(exynos_iodesc, ARRAY_SIZE(exynos_iodesc));
397
398 if (mach_desc)
399 iotable_init(mach_desc, size);
400 361
401 /* detect cpu id and rev. */ 362 /* detect cpu id and rev. */
402 s5p_init_cpu(S5P_VA_CHIPID); 363 s5p_init_cpu(S5P_VA_CHIPID);
@@ -417,34 +378,6 @@ static void __init exynos4_map_io(void)
417 iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc)); 378 iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc));
418 if (soc_is_exynos4212() || soc_is_exynos4412()) 379 if (soc_is_exynos4212() || soc_is_exynos4412())
419 iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc)); 380 iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc));
420
421 /* initialize device information early */
422 exynos4_default_sdhci0();
423 exynos4_default_sdhci1();
424 exynos4_default_sdhci2();
425 exynos4_default_sdhci3();
426
427 s3c_adc_setname("samsung-adc-v3");
428
429 s3c_fimc_setname(0, "exynos4-fimc");
430 s3c_fimc_setname(1, "exynos4-fimc");
431 s3c_fimc_setname(2, "exynos4-fimc");
432 s3c_fimc_setname(3, "exynos4-fimc");
433
434 s3c_sdhci_setname(0, "exynos4-sdhci");
435 s3c_sdhci_setname(1, "exynos4-sdhci");
436 s3c_sdhci_setname(2, "exynos4-sdhci");
437 s3c_sdhci_setname(3, "exynos4-sdhci");
438
439 /* The I2C bus controllers are directly compatible with s3c2440 */
440 s3c_i2c0_setname("s3c2440-i2c");
441 s3c_i2c1_setname("s3c2440-i2c");
442 s3c_i2c2_setname("s3c2440-i2c");
443
444 s5p_fb_setname(0, "exynos4-fb");
445 s5p_hdmi_setname("exynos4-hdmi");
446
447 s3c64xx_spi_setname("exynos4210-spi");
448} 381}
449 382
450static void __init exynos5_map_io(void) 383static void __init exynos5_map_io(void)
@@ -460,81 +393,10 @@ static void __init exynos5440_map_io(void)
460 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0)); 393 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0));
461} 394}
462 395
463void __init exynos_set_timer_source(u8 channels)
464{
465 exynos4_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
466 exynos4_pwm_variant.output_mask &= ~channels;
467}
468
469void __init exynos_init_time(void) 396void __init exynos_init_time(void)
470{ 397{
471 unsigned int timer_irqs[SAMSUNG_PWM_NUM] = { 398 of_clk_init(NULL);
472 EXYNOS4_IRQ_TIMER0_VIC, EXYNOS4_IRQ_TIMER1_VIC, 399 clocksource_of_init();
473 EXYNOS4_IRQ_TIMER2_VIC, EXYNOS4_IRQ_TIMER3_VIC,
474 EXYNOS4_IRQ_TIMER4_VIC,
475 };
476
477 if (of_have_populated_dt()) {
478#ifdef CONFIG_OF
479 of_clk_init(NULL);
480 clocksource_of_init();
481#endif
482 } else {
483 /* todo: remove after migrating legacy E4 platforms to dt */
484#ifdef CONFIG_ARCH_EXYNOS4
485 exynos4_clk_init(NULL, !soc_is_exynos4210(), S5P_VA_CMU, readl(S5P_VA_CHIPID + 8) & 1);
486 exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f);
487#endif
488#ifdef CONFIG_CLKSRC_SAMSUNG_PWM
489 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0)
490 samsung_pwm_clocksource_init(S3C_VA_TIMER,
491 timer_irqs, &exynos4_pwm_variant);
492 else
493#endif
494 mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0,
495 EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1);
496 }
497}
498
499static unsigned int max_combiner_nr(void)
500{
501 if (soc_is_exynos5250())
502 return EXYNOS5_MAX_COMBINER_NR;
503 else if (soc_is_exynos4412())
504 return EXYNOS4412_MAX_COMBINER_NR;
505 else if (soc_is_exynos4212())
506 return EXYNOS4212_MAX_COMBINER_NR;
507 else
508 return EXYNOS4210_MAX_COMBINER_NR;
509}
510
511
512void __init exynos4_init_irq(void)
513{
514 unsigned int gic_bank_offset;
515
516 gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000;
517
518 if (!of_have_populated_dt())
519 gic_init_bases(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU, gic_bank_offset, NULL);
520#ifdef CONFIG_OF
521 else
522 irqchip_init();
523#endif
524
525 if (!of_have_populated_dt())
526 combiner_init(S5P_VA_COMBINER_BASE, NULL,
527 max_combiner_nr(), COMBINER_IRQ(0, 0));
528
529 gic_arch_extn.irq_set_wake = s3c_irq_wake;
530}
531
532void __init exynos5_init_irq(void)
533{
534#ifdef CONFIG_OF
535 irqchip_init();
536#endif
537 gic_arch_extn.irq_set_wake = s3c_irq_wake;
538} 400}
539 401
540struct bus_type exynos_subsys = { 402struct bus_type exynos_subsys = {
@@ -552,59 +414,19 @@ static int __init exynos_core_init(void)
552} 414}
553core_initcall(exynos_core_init); 415core_initcall(exynos_core_init);
554 416
555#ifdef CONFIG_CACHE_L2X0
556static int __init exynos4_l2x0_cache_init(void) 417static int __init exynos4_l2x0_cache_init(void)
557{ 418{
558 int ret; 419 int ret;
559 420
560 if (soc_is_exynos5250() || soc_is_exynos5440())
561 return 0;
562
563 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); 421 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
564 if (!ret) { 422 if (ret)
565 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs); 423 return ret;
566 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
567 return 0;
568 }
569 424
570 if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) { 425 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
571 l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC; 426 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
572 /* TAG, Data Latency Control: 2 cycles */
573 l2x0_saved_regs.tag_latency = 0x110;
574
575 if (soc_is_exynos4212() || soc_is_exynos4412())
576 l2x0_saved_regs.data_latency = 0x120;
577 else
578 l2x0_saved_regs.data_latency = 0x110;
579
580 l2x0_saved_regs.prefetch_ctrl = 0x30000007;
581 l2x0_saved_regs.pwr_ctrl =
582 (L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
583
584 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
585
586 __raw_writel(l2x0_saved_regs.tag_latency,
587 S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
588 __raw_writel(l2x0_saved_regs.data_latency,
589 S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
590
591 /* L2X0 Prefetch Control */
592 __raw_writel(l2x0_saved_regs.prefetch_ctrl,
593 S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
594
595 /* L2X0 Power Control */
596 __raw_writel(l2x0_saved_regs.pwr_ctrl,
597 S5P_VA_L2CC + L2X0_POWER_CTRL);
598
599 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
600 clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
601 }
602
603 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
604 return 0; 427 return 0;
605} 428}
606early_initcall(exynos4_l2x0_cache_init); 429early_initcall(exynos4_l2x0_cache_init);
607#endif
608 430
609static int __init exynos_init(void) 431static int __init exynos_init(void)
610{ 432{
@@ -612,350 +434,3 @@ static int __init exynos_init(void)
612 434
613 return device_register(&exynos4_dev); 435 return device_register(&exynos4_dev);
614} 436}
615
616/* uart registration process */
617
618static void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
619{
620 struct s3c2410_uartcfg *tcfg = cfg;
621 u32 ucnt;
622
623 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
624 tcfg->has_fracval = 1;
625
626 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
627}
628
629static void __iomem *exynos_eint_base;
630
631static DEFINE_SPINLOCK(eint_lock);
632
633static unsigned int eint0_15_data[16];
634
635static inline int exynos4_irq_to_gpio(unsigned int irq)
636{
637 if (irq < IRQ_EINT(0))
638 return -EINVAL;
639
640 irq -= IRQ_EINT(0);
641 if (irq < 8)
642 return EXYNOS4_GPX0(irq);
643
644 irq -= 8;
645 if (irq < 8)
646 return EXYNOS4_GPX1(irq);
647
648 irq -= 8;
649 if (irq < 8)
650 return EXYNOS4_GPX2(irq);
651
652 irq -= 8;
653 if (irq < 8)
654 return EXYNOS4_GPX3(irq);
655
656 return -EINVAL;
657}
658
659static inline int exynos5_irq_to_gpio(unsigned int irq)
660{
661 if (irq < IRQ_EINT(0))
662 return -EINVAL;
663
664 irq -= IRQ_EINT(0);
665 if (irq < 8)
666 return EXYNOS5_GPX0(irq);
667
668 irq -= 8;
669 if (irq < 8)
670 return EXYNOS5_GPX1(irq);
671
672 irq -= 8;
673 if (irq < 8)
674 return EXYNOS5_GPX2(irq);
675
676 irq -= 8;
677 if (irq < 8)
678 return EXYNOS5_GPX3(irq);
679
680 return -EINVAL;
681}
682
683static unsigned int exynos4_eint0_15_src_int[16] = {
684 EXYNOS4_IRQ_EINT0,
685 EXYNOS4_IRQ_EINT1,
686 EXYNOS4_IRQ_EINT2,
687 EXYNOS4_IRQ_EINT3,
688 EXYNOS4_IRQ_EINT4,
689 EXYNOS4_IRQ_EINT5,
690 EXYNOS4_IRQ_EINT6,
691 EXYNOS4_IRQ_EINT7,
692 EXYNOS4_IRQ_EINT8,
693 EXYNOS4_IRQ_EINT9,
694 EXYNOS4_IRQ_EINT10,
695 EXYNOS4_IRQ_EINT11,
696 EXYNOS4_IRQ_EINT12,
697 EXYNOS4_IRQ_EINT13,
698 EXYNOS4_IRQ_EINT14,
699 EXYNOS4_IRQ_EINT15,
700};
701
702static unsigned int exynos5_eint0_15_src_int[16] = {
703 EXYNOS5_IRQ_EINT0,
704 EXYNOS5_IRQ_EINT1,
705 EXYNOS5_IRQ_EINT2,
706 EXYNOS5_IRQ_EINT3,
707 EXYNOS5_IRQ_EINT4,
708 EXYNOS5_IRQ_EINT5,
709 EXYNOS5_IRQ_EINT6,
710 EXYNOS5_IRQ_EINT7,
711 EXYNOS5_IRQ_EINT8,
712 EXYNOS5_IRQ_EINT9,
713 EXYNOS5_IRQ_EINT10,
714 EXYNOS5_IRQ_EINT11,
715 EXYNOS5_IRQ_EINT12,
716 EXYNOS5_IRQ_EINT13,
717 EXYNOS5_IRQ_EINT14,
718 EXYNOS5_IRQ_EINT15,
719};
720static inline void exynos_irq_eint_mask(struct irq_data *data)
721{
722 u32 mask;
723
724 spin_lock(&eint_lock);
725 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
726 mask |= EINT_OFFSET_BIT(data->irq);
727 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
728 spin_unlock(&eint_lock);
729}
730
731static void exynos_irq_eint_unmask(struct irq_data *data)
732{
733 u32 mask;
734
735 spin_lock(&eint_lock);
736 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
737 mask &= ~(EINT_OFFSET_BIT(data->irq));
738 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
739 spin_unlock(&eint_lock);
740}
741
742static inline void exynos_irq_eint_ack(struct irq_data *data)
743{
744 __raw_writel(EINT_OFFSET_BIT(data->irq),
745 EINT_PEND(exynos_eint_base, data->irq));
746}
747
748static void exynos_irq_eint_maskack(struct irq_data *data)
749{
750 exynos_irq_eint_mask(data);
751 exynos_irq_eint_ack(data);
752}
753
754static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
755{
756 int offs = EINT_OFFSET(data->irq);
757 int shift;
758 u32 ctrl, mask;
759 u32 newvalue = 0;
760
761 switch (type) {
762 case IRQ_TYPE_EDGE_RISING:
763 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
764 break;
765
766 case IRQ_TYPE_EDGE_FALLING:
767 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
768 break;
769
770 case IRQ_TYPE_EDGE_BOTH:
771 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
772 break;
773
774 case IRQ_TYPE_LEVEL_LOW:
775 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
776 break;
777
778 case IRQ_TYPE_LEVEL_HIGH:
779 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
780 break;
781
782 default:
783 printk(KERN_ERR "No such irq type %d", type);
784 return -EINVAL;
785 }
786
787 shift = (offs & 0x7) * 4;
788 mask = 0x7 << shift;
789
790 spin_lock(&eint_lock);
791 ctrl = __raw_readl(EINT_CON(exynos_eint_base, data->irq));
792 ctrl &= ~mask;
793 ctrl |= newvalue << shift;
794 __raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
795 spin_unlock(&eint_lock);
796
797 if (soc_is_exynos5250())
798 s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
799 else
800 s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
801
802 return 0;
803}
804
805static struct irq_chip exynos_irq_eint = {
806 .name = "exynos-eint",
807 .irq_mask = exynos_irq_eint_mask,
808 .irq_unmask = exynos_irq_eint_unmask,
809 .irq_mask_ack = exynos_irq_eint_maskack,
810 .irq_ack = exynos_irq_eint_ack,
811 .irq_set_type = exynos_irq_eint_set_type,
812#ifdef CONFIG_PM
813 .irq_set_wake = s3c_irqext_wake,
814#endif
815};
816
817/*
818 * exynos4_irq_demux_eint
819 *
820 * This function demuxes the IRQ from from EINTs 16 to 31.
821 * It is designed to be inlined into the specific handler
822 * s5p_irq_demux_eintX_Y.
823 *
824 * Each EINT pend/mask registers handle eight of them.
825 */
826static inline void exynos_irq_demux_eint(unsigned int start)
827{
828 unsigned int irq;
829
830 u32 status = __raw_readl(EINT_PEND(exynos_eint_base, start));
831 u32 mask = __raw_readl(EINT_MASK(exynos_eint_base, start));
832
833 status &= ~mask;
834 status &= 0xff;
835
836 while (status) {
837 irq = fls(status) - 1;
838 generic_handle_irq(irq + start);
839 status &= ~(1 << irq);
840 }
841}
842
843static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
844{
845 struct irq_chip *chip = irq_get_chip(irq);
846 chained_irq_enter(chip, desc);
847 exynos_irq_demux_eint(IRQ_EINT(16));
848 exynos_irq_demux_eint(IRQ_EINT(24));
849 chained_irq_exit(chip, desc);
850}
851
852static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
853{
854 u32 *irq_data = irq_get_handler_data(irq);
855 struct irq_chip *chip = irq_get_chip(irq);
856
857 chained_irq_enter(chip, desc);
858 generic_handle_irq(*irq_data);
859 chained_irq_exit(chip, desc);
860}
861
862static int __init exynos_init_irq_eint(void)
863{
864 int irq;
865
866#ifdef CONFIG_PINCTRL_SAMSUNG
867 /*
868 * The Samsung pinctrl driver provides an integrated gpio/pinmux/pinconf
869 * functionality along with support for external gpio and wakeup
870 * interrupts. If the samsung pinctrl driver is enabled and includes
871 * the wakeup interrupt support, then the setting up external wakeup
872 * interrupts here can be skipped. This check here is temporary to
873 * allow exynos4 platforms that do not use Samsung pinctrl driver to
874 * co-exist with platforms that do. When all of the Samsung Exynos4
875 * platforms switch over to using the pinctrl driver, the wakeup
876 * interrupt support code here can be completely removed.
877 */
878 static const struct of_device_id exynos_pinctrl_ids[] = {
879 { .compatible = "samsung,exynos4210-pinctrl", },
880 { .compatible = "samsung,exynos4x12-pinctrl", },
881 { .compatible = "samsung,exynos5250-pinctrl", },
882 };
883 struct device_node *pctrl_np, *wkup_np;
884 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
885
886 for_each_matching_node(pctrl_np, exynos_pinctrl_ids) {
887 if (of_device_is_available(pctrl_np)) {
888 wkup_np = of_find_compatible_node(pctrl_np, NULL,
889 wkup_compat);
890 if (wkup_np)
891 return -ENODEV;
892 }
893 }
894#endif
895 if (soc_is_exynos5440())
896 return 0;
897
898 if (soc_is_exynos5250())
899 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
900 else
901 exynos_eint_base = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
902
903 if (exynos_eint_base == NULL) {
904 pr_err("unable to ioremap for EINT base address\n");
905 return -ENOMEM;
906 }
907
908 for (irq = 0 ; irq <= 31 ; irq++) {
909 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos_irq_eint,
910 handle_level_irq);
911 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
912 }
913
914 irq_set_chained_handler(EXYNOS_IRQ_EINT16_31, exynos_irq_demux_eint16_31);
915
916 for (irq = 0 ; irq <= 15 ; irq++) {
917 eint0_15_data[irq] = IRQ_EINT(irq);
918
919 if (soc_is_exynos5250()) {
920 irq_set_handler_data(exynos5_eint0_15_src_int[irq],
921 &eint0_15_data[irq]);
922 irq_set_chained_handler(exynos5_eint0_15_src_int[irq],
923 exynos_irq_eint0_15);
924 } else {
925 irq_set_handler_data(exynos4_eint0_15_src_int[irq],
926 &eint0_15_data[irq]);
927 irq_set_chained_handler(exynos4_eint0_15_src_int[irq],
928 exynos_irq_eint0_15);
929 }
930 }
931
932 return 0;
933}
934arch_initcall(exynos_init_irq_eint);
935
936static struct resource exynos4_pmu_resource[] = {
937 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU),
938 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1),
939#if defined(CONFIG_SOC_EXYNOS4412)
940 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2),
941 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3),
942#endif
943};
944
945static struct platform_device exynos4_device_pmu = {
946 .name = "arm-pmu",
947 .num_resources = ARRAY_SIZE(exynos4_pmu_resource),
948 .resource = exynos4_pmu_resource,
949};
950
951static int __init exynos_armpmu_init(void)
952{
953 if (!of_have_populated_dt()) {
954 if (soc_is_exynos4210() || soc_is_exynos4212())
955 exynos4_device_pmu.num_resources = 2;
956 platform_device_register(&exynos4_device_pmu);
957 }
958
959 return 0;
960}
961arch_initcall(exynos_armpmu_init);
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 11fc1e29819b..38d45fd23be4 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -19,9 +19,7 @@ void exynos_init_time(void);
19extern unsigned long xxti_f, xusbxti_f; 19extern unsigned long xxti_f, xusbxti_f;
20 20
21struct map_desc; 21struct map_desc;
22void exynos_init_io(struct map_desc *mach_desc, int size); 22void exynos_init_io(void);
23void exynos4_init_irq(void);
24void exynos5_init_irq(void);
25void exynos4_restart(char mode, const char *cmd); 23void exynos4_restart(char mode, const char *cmd);
26void exynos5_restart(char mode, const char *cmd); 24void exynos5_restart(char mode, const char *cmd);
27void exynos_init_late(void); 25void exynos_init_late(void);
diff --git a/arch/arm/mach-exynos/dev-ahci.c b/arch/arm/mach-exynos/dev-ahci.c
deleted file mode 100644
index ce1aad3eeeb9..000000000000
--- a/arch/arm/mach-exynos/dev-ahci.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/* linux/arch/arm/mach-exynos4/dev-ahci.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - AHCI 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/clk.h>
14#include <linux/delay.h>
15#include <linux/dma-mapping.h>
16#include <linux/platform_device.h>
17#include <linux/ahci_platform.h>
18
19#include <plat/cpu.h>
20
21#include <mach/irqs.h>
22#include <mach/map.h>
23#include <mach/regs-pmu.h>
24
25/* PHY Control Register */
26#define SATA_CTRL0 0x0
27/* PHY Link Control Register */
28#define SATA_CTRL1 0x4
29/* PHY Status Register */
30#define SATA_PHY_STATUS 0x8
31
32#define SATA_CTRL0_RX_DATA_VALID(x) (x << 27)
33#define SATA_CTRL0_SPEED_MODE (1 << 26)
34#define SATA_CTRL0_M_PHY_CAL (1 << 19)
35#define SATA_CTRL0_PHY_CMU_RST_N (1 << 10)
36#define SATA_CTRL0_M_PHY_LN_RST_N (1 << 9)
37#define SATA_CTRL0_PHY_POR_N (1 << 8)
38
39#define SATA_CTRL1_RST_PMALIVE_N (1 << 8)
40#define SATA_CTRL1_RST_RXOOB_N (1 << 7)
41#define SATA_CTRL1_RST_RX_N (1 << 6)
42#define SATA_CTRL1_RST_TX_N (1 << 5)
43
44#define SATA_PHY_STATUS_CMU_OK (1 << 18)
45#define SATA_PHY_STATUS_LANE_OK (1 << 16)
46
47#define LANE0 0x200
48#define COM_LANE 0xA00
49
50#define HOST_PORTS_IMPL 0xC
51#define SCLK_SATA_FREQ (67 * MHZ)
52
53static void __iomem *phy_base, *phy_ctrl;
54
55struct phy_reg {
56 u8 reg;
57 u8 val;
58};
59
60/* SATA PHY setup */
61static const struct phy_reg exynos4_sataphy_cmu[] = {
62 { 0x00, 0x06 }, { 0x02, 0x80 }, { 0x22, 0xa0 }, { 0x23, 0x42 },
63 { 0x2e, 0x04 }, { 0x2f, 0x50 }, { 0x30, 0x70 }, { 0x31, 0x02 },
64 { 0x32, 0x25 }, { 0x33, 0x40 }, { 0x34, 0x01 }, { 0x35, 0x40 },
65 { 0x61, 0x2e }, { 0x63, 0x5e }, { 0x65, 0x42 }, { 0x66, 0xd1 },
66 { 0x67, 0x20 }, { 0x68, 0x28 }, { 0x69, 0x78 }, { 0x6a, 0x04 },
67 { 0x6b, 0xc8 }, { 0x6c, 0x06 },
68};
69
70static const struct phy_reg exynos4_sataphy_lane[] = {
71 { 0x00, 0x02 }, { 0x05, 0x10 }, { 0x06, 0x84 }, { 0x07, 0x04 },
72 { 0x08, 0xe0 }, { 0x10, 0x23 }, { 0x13, 0x05 }, { 0x14, 0x30 },
73 { 0x15, 0x00 }, { 0x17, 0x70 }, { 0x18, 0xf2 }, { 0x19, 0x1e },
74 { 0x1a, 0x18 }, { 0x1b, 0x0d }, { 0x1c, 0x08 }, { 0x50, 0x60 },
75 { 0x51, 0x0f },
76};
77
78static const struct phy_reg exynos4_sataphy_comlane[] = {
79 { 0x01, 0x20 }, { 0x03, 0x40 }, { 0x04, 0x3c }, { 0x05, 0x7d },
80 { 0x06, 0x1d }, { 0x07, 0xcf }, { 0x08, 0x05 }, { 0x09, 0x63 },
81 { 0x0a, 0x29 }, { 0x0b, 0xc4 }, { 0x0c, 0x01 }, { 0x0d, 0x03 },
82 { 0x0e, 0x28 }, { 0x0f, 0x98 }, { 0x10, 0x19 }, { 0x13, 0x80 },
83 { 0x14, 0xf0 }, { 0x15, 0xd0 }, { 0x39, 0xa0 }, { 0x3a, 0xa0 },
84 { 0x3b, 0xa0 }, { 0x3c, 0xa0 }, { 0x3d, 0xa0 }, { 0x3e, 0xa0 },
85 { 0x3f, 0xa0 }, { 0x40, 0x42 }, { 0x42, 0x80 }, { 0x43, 0x58 },
86 { 0x45, 0x44 }, { 0x46, 0x5c }, { 0x47, 0x86 }, { 0x48, 0x8d },
87 { 0x49, 0xd0 }, { 0x4a, 0x09 }, { 0x4b, 0x90 }, { 0x4c, 0x07 },
88 { 0x4d, 0x40 }, { 0x51, 0x20 }, { 0x52, 0x32 }, { 0x7f, 0xd8 },
89 { 0x80, 0x1a }, { 0x81, 0xff }, { 0x82, 0x11 }, { 0x83, 0x00 },
90 { 0x87, 0xf0 }, { 0x87, 0xff }, { 0x87, 0xff }, { 0x87, 0xff },
91 { 0x87, 0xff }, { 0x8c, 0x1c }, { 0x8d, 0xc2 }, { 0x8e, 0xc3 },
92 { 0x8f, 0x3f }, { 0x90, 0x0a }, { 0x96, 0xf8 },
93};
94
95static int wait_for_phy_ready(void __iomem *reg, unsigned long bit)
96{
97 unsigned long timeout;
98
99 /* wait for maximum of 3 sec */
100 timeout = jiffies + msecs_to_jiffies(3000);
101 while (!(__raw_readl(reg) & bit)) {
102 if (time_after(jiffies, timeout))
103 return -1;
104 cpu_relax();
105 }
106 return 0;
107}
108
109static int ahci_phy_init(void __iomem *mmio)
110{
111 int i, ctrl0;
112
113 for (i = 0; i < ARRAY_SIZE(exynos4_sataphy_cmu); i++)
114 __raw_writeb(exynos4_sataphy_cmu[i].val,
115 phy_base + (exynos4_sataphy_cmu[i].reg * 4));
116
117 for (i = 0; i < ARRAY_SIZE(exynos4_sataphy_lane); i++)
118 __raw_writeb(exynos4_sataphy_lane[i].val,
119 phy_base + (LANE0 + exynos4_sataphy_lane[i].reg) * 4);
120
121 for (i = 0; i < ARRAY_SIZE(exynos4_sataphy_comlane); i++)
122 __raw_writeb(exynos4_sataphy_comlane[i].val,
123 phy_base + (COM_LANE + exynos4_sataphy_comlane[i].reg) * 4);
124
125 __raw_writeb(0x07, phy_base);
126
127 ctrl0 = __raw_readl(phy_ctrl + SATA_CTRL0);
128 ctrl0 |= SATA_CTRL0_PHY_CMU_RST_N;
129 __raw_writel(ctrl0, phy_ctrl + SATA_CTRL0);
130
131 if (wait_for_phy_ready(phy_ctrl + SATA_PHY_STATUS,
132 SATA_PHY_STATUS_CMU_OK) < 0) {
133 printk(KERN_ERR "PHY CMU not ready\n");
134 return -EBUSY;
135 }
136
137 __raw_writeb(0x03, phy_base + (COM_LANE * 4));
138
139 ctrl0 = __raw_readl(phy_ctrl + SATA_CTRL0);
140 ctrl0 |= SATA_CTRL0_M_PHY_LN_RST_N;
141 __raw_writel(ctrl0, phy_ctrl + SATA_CTRL0);
142
143 if (wait_for_phy_ready(phy_ctrl + SATA_PHY_STATUS,
144 SATA_PHY_STATUS_LANE_OK) < 0) {
145 printk(KERN_ERR "PHY LANE not ready\n");
146 return -EBUSY;
147 }
148
149 ctrl0 = __raw_readl(phy_ctrl + SATA_CTRL0);
150 ctrl0 |= SATA_CTRL0_M_PHY_CAL;
151 __raw_writel(ctrl0, phy_ctrl + SATA_CTRL0);
152
153 return 0;
154}
155
156static int exynos4_ahci_init(struct device *dev, void __iomem *mmio)
157{
158 struct clk *clk_sata, *clk_sataphy, *clk_sclk_sata;
159 int val, ret;
160
161 phy_base = ioremap(EXYNOS4_PA_SATAPHY, SZ_64K);
162 if (!phy_base) {
163 dev_err(dev, "failed to allocate memory for SATA PHY\n");
164 return -ENOMEM;
165 }
166
167 phy_ctrl = ioremap(EXYNOS4_PA_SATAPHY_CTRL, SZ_16);
168 if (!phy_ctrl) {
169 dev_err(dev, "failed to allocate memory for SATA PHY CTRL\n");
170 ret = -ENOMEM;
171 goto err1;
172 }
173
174 clk_sata = clk_get(dev, "sata");
175 if (IS_ERR(clk_sata)) {
176 dev_err(dev, "failed to get sata clock\n");
177 ret = PTR_ERR(clk_sata);
178 clk_sata = NULL;
179 goto err2;
180
181 }
182 clk_enable(clk_sata);
183
184 clk_sataphy = clk_get(dev, "sataphy");
185 if (IS_ERR(clk_sataphy)) {
186 dev_err(dev, "failed to get sataphy clock\n");
187 ret = PTR_ERR(clk_sataphy);
188 clk_sataphy = NULL;
189 goto err3;
190 }
191 clk_enable(clk_sataphy);
192
193 clk_sclk_sata = clk_get(dev, "sclk_sata");
194 if (IS_ERR(clk_sclk_sata)) {
195 dev_err(dev, "failed to get sclk_sata\n");
196 ret = PTR_ERR(clk_sclk_sata);
197 clk_sclk_sata = NULL;
198 goto err4;
199 }
200 clk_enable(clk_sclk_sata);
201 clk_set_rate(clk_sclk_sata, SCLK_SATA_FREQ);
202
203 __raw_writel(S5P_PMU_SATA_PHY_CONTROL_EN, S5P_PMU_SATA_PHY_CONTROL);
204
205 /* Enable PHY link control */
206 val = SATA_CTRL1_RST_PMALIVE_N | SATA_CTRL1_RST_RXOOB_N |
207 SATA_CTRL1_RST_RX_N | SATA_CTRL1_RST_TX_N;
208 __raw_writel(val, phy_ctrl + SATA_CTRL1);
209
210 /* Set communication speed as 3Gbps and enable PHY power */
211 val = SATA_CTRL0_RX_DATA_VALID(3) | SATA_CTRL0_SPEED_MODE |
212 SATA_CTRL0_PHY_POR_N;
213 __raw_writel(val, phy_ctrl + SATA_CTRL0);
214
215 /* Port0 is available */
216 __raw_writel(0x1, mmio + HOST_PORTS_IMPL);
217
218 return ahci_phy_init(mmio);
219
220err4:
221 clk_disable(clk_sataphy);
222 clk_put(clk_sataphy);
223err3:
224 clk_disable(clk_sata);
225 clk_put(clk_sata);
226err2:
227 iounmap(phy_ctrl);
228err1:
229 iounmap(phy_base);
230
231 return ret;
232}
233
234static struct ahci_platform_data exynos4_ahci_pdata = {
235 .init = exynos4_ahci_init,
236};
237
238static struct resource exynos4_ahci_resource[] = {
239 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SATA, SZ_64K),
240 [1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_SATA),
241};
242
243static u64 exynos4_ahci_dmamask = DMA_BIT_MASK(32);
244
245struct platform_device exynos4_device_ahci = {
246 .name = "ahci",
247 .id = -1,
248 .resource = exynos4_ahci_resource,
249 .num_resources = ARRAY_SIZE(exynos4_ahci_resource),
250 .dev = {
251 .platform_data = &exynos4_ahci_pdata,
252 .dma_mask = &exynos4_ahci_dmamask,
253 .coherent_dma_mask = DMA_BIT_MASK(32),
254 },
255};
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c
deleted file mode 100644
index c662c89794b2..000000000000
--- a/arch/arm/mach-exynos/dev-audio.c
+++ /dev/null
@@ -1,254 +0,0 @@
1/* linux/arch/arm/mach-exynos4/dev-audio.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 version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17#include <linux/platform_data/asoc-s3c.h>
18
19#include <plat/gpio-cfg.h>
20
21#include <mach/map.h>
22#include <mach/dma.h>
23#include <mach/irqs.h>
24
25#define EXYNOS4_AUDSS_INT_MEM (0x03000000)
26
27static int exynos4_cfg_i2s(struct platform_device *pdev)
28{
29 /* configure GPIO for i2s port */
30 switch (pdev->id) {
31 case 0:
32 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 7, S3C_GPIO_SFN(2));
33 break;
34 case 1:
35 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(2));
36 break;
37 case 2:
38 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(4));
39 break;
40 default:
41 printk(KERN_ERR "Invalid Device %d\n", pdev->id);
42 return -EINVAL;
43 }
44
45 return 0;
46}
47
48static struct s3c_audio_pdata i2sv5_pdata = {
49 .cfg_gpio = exynos4_cfg_i2s,
50 .type = {
51 .i2s = {
52 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI
53 | QUIRK_NEED_RSTCLR,
54 .idma_addr = EXYNOS4_AUDSS_INT_MEM,
55 },
56 },
57};
58
59static struct resource exynos4_i2s0_resource[] = {
60 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S0, SZ_256),
61 [1] = DEFINE_RES_DMA(DMACH_I2S0_TX),
62 [2] = DEFINE_RES_DMA(DMACH_I2S0_RX),
63 [3] = DEFINE_RES_DMA(DMACH_I2S0S_TX),
64};
65
66struct platform_device exynos4_device_i2s0 = {
67 .name = "samsung-i2s",
68 .id = 0,
69 .num_resources = ARRAY_SIZE(exynos4_i2s0_resource),
70 .resource = exynos4_i2s0_resource,
71 .dev = {
72 .platform_data = &i2sv5_pdata,
73 },
74};
75
76static struct s3c_audio_pdata i2sv3_pdata = {
77 .cfg_gpio = exynos4_cfg_i2s,
78 .type = {
79 .i2s = {
80 .quirks = QUIRK_NO_MUXPSR,
81 },
82 },
83};
84
85static struct resource exynos4_i2s1_resource[] = {
86 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S1, SZ_256),
87 [1] = DEFINE_RES_DMA(DMACH_I2S1_TX),
88 [2] = DEFINE_RES_DMA(DMACH_I2S1_RX),
89};
90
91struct platform_device exynos4_device_i2s1 = {
92 .name = "samsung-i2s",
93 .id = 1,
94 .num_resources = ARRAY_SIZE(exynos4_i2s1_resource),
95 .resource = exynos4_i2s1_resource,
96 .dev = {
97 .platform_data = &i2sv3_pdata,
98 },
99};
100
101static struct resource exynos4_i2s2_resource[] = {
102 [0] = DEFINE_RES_MEM(EXYNOS4_PA_I2S2, SZ_256),
103 [1] = DEFINE_RES_DMA(DMACH_I2S2_TX),
104 [2] = DEFINE_RES_DMA(DMACH_I2S2_RX),
105};
106
107struct platform_device exynos4_device_i2s2 = {
108 .name = "samsung-i2s",
109 .id = 2,
110 .num_resources = ARRAY_SIZE(exynos4_i2s2_resource),
111 .resource = exynos4_i2s2_resource,
112 .dev = {
113 .platform_data = &i2sv3_pdata,
114 },
115};
116
117/* PCM Controller platform_devices */
118
119static int exynos4_pcm_cfg_gpio(struct platform_device *pdev)
120{
121 switch (pdev->id) {
122 case 0:
123 s3c_gpio_cfgpin_range(EXYNOS4_GPZ(0), 5, S3C_GPIO_SFN(3));
124 break;
125 case 1:
126 s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(3));
127 break;
128 case 2:
129 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 5, S3C_GPIO_SFN(3));
130 break;
131 default:
132 printk(KERN_DEBUG "Invalid PCM Controller number!");
133 return -EINVAL;
134 }
135
136 return 0;
137}
138
139static struct s3c_audio_pdata s3c_pcm_pdata = {
140 .cfg_gpio = exynos4_pcm_cfg_gpio,
141};
142
143static struct resource exynos4_pcm0_resource[] = {
144 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM0, SZ_256),
145 [1] = DEFINE_RES_DMA(DMACH_PCM0_TX),
146 [2] = DEFINE_RES_DMA(DMACH_PCM0_RX),
147};
148
149struct platform_device exynos4_device_pcm0 = {
150 .name = "samsung-pcm",
151 .id = 0,
152 .num_resources = ARRAY_SIZE(exynos4_pcm0_resource),
153 .resource = exynos4_pcm0_resource,
154 .dev = {
155 .platform_data = &s3c_pcm_pdata,
156 },
157};
158
159static struct resource exynos4_pcm1_resource[] = {
160 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM1, SZ_256),
161 [1] = DEFINE_RES_DMA(DMACH_PCM1_TX),
162 [2] = DEFINE_RES_DMA(DMACH_PCM1_RX),
163};
164
165struct platform_device exynos4_device_pcm1 = {
166 .name = "samsung-pcm",
167 .id = 1,
168 .num_resources = ARRAY_SIZE(exynos4_pcm1_resource),
169 .resource = exynos4_pcm1_resource,
170 .dev = {
171 .platform_data = &s3c_pcm_pdata,
172 },
173};
174
175static struct resource exynos4_pcm2_resource[] = {
176 [0] = DEFINE_RES_MEM(EXYNOS4_PA_PCM2, SZ_256),
177 [1] = DEFINE_RES_DMA(DMACH_PCM2_TX),
178 [2] = DEFINE_RES_DMA(DMACH_PCM2_RX),
179};
180
181struct platform_device exynos4_device_pcm2 = {
182 .name = "samsung-pcm",
183 .id = 2,
184 .num_resources = ARRAY_SIZE(exynos4_pcm2_resource),
185 .resource = exynos4_pcm2_resource,
186 .dev = {
187 .platform_data = &s3c_pcm_pdata,
188 },
189};
190
191/* AC97 Controller platform devices */
192
193static int exynos4_ac97_cfg_gpio(struct platform_device *pdev)
194{
195 return s3c_gpio_cfgpin_range(EXYNOS4_GPC0(0), 5, S3C_GPIO_SFN(4));
196}
197
198static struct resource exynos4_ac97_resource[] = {
199 [0] = DEFINE_RES_MEM(EXYNOS4_PA_AC97, SZ_256),
200 [1] = DEFINE_RES_DMA(DMACH_AC97_PCMOUT),
201 [2] = DEFINE_RES_DMA(DMACH_AC97_PCMIN),
202 [3] = DEFINE_RES_DMA(DMACH_AC97_MICIN),
203 [4] = DEFINE_RES_IRQ(EXYNOS4_IRQ_AC97),
204};
205
206static struct s3c_audio_pdata s3c_ac97_pdata = {
207 .cfg_gpio = exynos4_ac97_cfg_gpio,
208};
209
210static u64 exynos4_ac97_dmamask = DMA_BIT_MASK(32);
211
212struct platform_device exynos4_device_ac97 = {
213 .name = "samsung-ac97",
214 .id = -1,
215 .num_resources = ARRAY_SIZE(exynos4_ac97_resource),
216 .resource = exynos4_ac97_resource,
217 .dev = {
218 .platform_data = &s3c_ac97_pdata,
219 .dma_mask = &exynos4_ac97_dmamask,
220 .coherent_dma_mask = DMA_BIT_MASK(32),
221 },
222};
223
224/* S/PDIF Controller platform_device */
225
226static int exynos4_spdif_cfg_gpio(struct platform_device *pdev)
227{
228 s3c_gpio_cfgpin_range(EXYNOS4_GPC1(0), 2, S3C_GPIO_SFN(4));
229
230 return 0;
231}
232
233static struct resource exynos4_spdif_resource[] = {
234 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SPDIF, SZ_256),
235 [1] = DEFINE_RES_DMA(DMACH_SPDIF),
236};
237
238static struct s3c_audio_pdata samsung_spdif_pdata = {
239 .cfg_gpio = exynos4_spdif_cfg_gpio,
240};
241
242static u64 exynos4_spdif_dmamask = DMA_BIT_MASK(32);
243
244struct platform_device exynos4_device_spdif = {
245 .name = "samsung-spdif",
246 .id = -1,
247 .num_resources = ARRAY_SIZE(exynos4_spdif_resource),
248 .resource = exynos4_spdif_resource,
249 .dev = {
250 .platform_data = &samsung_spdif_pdata,
251 .dma_mask = &exynos4_spdif_dmamask,
252 .coherent_dma_mask = DMA_BIT_MASK(32),
253 },
254};
diff --git a/arch/arm/mach-exynos/dev-ohci.c b/arch/arm/mach-exynos/dev-ohci.c
deleted file mode 100644
index d5bc129e6bb7..000000000000
--- a/arch/arm/mach-exynos/dev-ohci.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/* linux/arch/arm/mach-exynos/dev-ohci.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS - OHCI 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/dma-mapping.h>
14#include <linux/platform_device.h>
15#include <linux/platform_data/usb-ohci-exynos.h>
16
17#include <mach/irqs.h>
18#include <mach/map.h>
19
20#include <plat/devs.h>
21#include <plat/usb-phy.h>
22
23static struct resource exynos4_ohci_resource[] = {
24 [0] = DEFINE_RES_MEM(EXYNOS4_PA_OHCI, SZ_256),
25 [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
26};
27
28static u64 exynos4_ohci_dma_mask = DMA_BIT_MASK(32);
29
30struct platform_device exynos4_device_ohci = {
31 .name = "exynos-ohci",
32 .id = -1,
33 .num_resources = ARRAY_SIZE(exynos4_ohci_resource),
34 .resource = exynos4_ohci_resource,
35 .dev = {
36 .dma_mask = &exynos4_ohci_dma_mask,
37 .coherent_dma_mask = DMA_BIT_MASK(32),
38 }
39};
40
41void __init exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd)
42{
43 struct exynos4_ohci_platdata *npd;
44
45 npd = s3c_set_platdata(pd, sizeof(struct exynos4_ohci_platdata),
46 &exynos4_device_ohci);
47
48 if (!npd->phy_init)
49 npd->phy_init = s5p_usb_phy_init;
50 if (!npd->phy_exit)
51 npd->phy_exit = s5p_usb_phy_exit;
52}
diff --git a/arch/arm/mach-exynos/dev-uart.c b/arch/arm/mach-exynos/dev-uart.c
deleted file mode 100644
index c48aff02c786..000000000000
--- a/arch/arm/mach-exynos/dev-uart.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Base EXYNOS 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/hardware.h>
22#include <mach/map.h>
23#include <mach/irqs.h>
24
25#include <plat/devs.h>
26
27#define EXYNOS_UART_RESOURCE(_series, _nr) \
28static struct resource exynos##_series##_uart##_nr##_resource[] = { \
29 [0] = DEFINE_RES_MEM(EXYNOS##_series##_PA_UART##_nr, EXYNOS##_series##_SZ_UART), \
30 [1] = DEFINE_RES_IRQ(EXYNOS##_series##_IRQ_UART##_nr), \
31};
32
33EXYNOS_UART_RESOURCE(4, 0)
34EXYNOS_UART_RESOURCE(4, 1)
35EXYNOS_UART_RESOURCE(4, 2)
36EXYNOS_UART_RESOURCE(4, 3)
37
38struct s3c24xx_uart_resources exynos4_uart_resources[] __initdata = {
39 [0] = {
40 .resources = exynos4_uart0_resource,
41 .nr_resources = ARRAY_SIZE(exynos4_uart0_resource),
42 },
43 [1] = {
44 .resources = exynos4_uart1_resource,
45 .nr_resources = ARRAY_SIZE(exynos4_uart1_resource),
46 },
47 [2] = {
48 .resources = exynos4_uart2_resource,
49 .nr_resources = ARRAY_SIZE(exynos4_uart2_resource),
50 },
51 [3] = {
52 .resources = exynos4_uart3_resource,
53 .nr_resources = ARRAY_SIZE(exynos4_uart3_resource),
54 },
55};
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c
deleted file mode 100644
index 87e07d6fc615..000000000000
--- a/arch/arm/mach-exynos/dma.c
+++ /dev/null
@@ -1,322 +0,0 @@
1/* linux/arch/arm/mach-exynos4/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#include <linux/of.h>
28
29#include <asm/irq.h>
30#include <plat/devs.h>
31#include <plat/irqs.h>
32#include <plat/cpu.h>
33
34#include <mach/map.h>
35#include <mach/irqs.h>
36#include <mach/dma.h>
37
38static u8 exynos4210_pdma0_peri[] = {
39 DMACH_PCM0_RX,
40 DMACH_PCM0_TX,
41 DMACH_PCM2_RX,
42 DMACH_PCM2_TX,
43 DMACH_MSM_REQ0,
44 DMACH_MSM_REQ2,
45 DMACH_SPI0_RX,
46 DMACH_SPI0_TX,
47 DMACH_SPI2_RX,
48 DMACH_SPI2_TX,
49 DMACH_I2S0S_TX,
50 DMACH_I2S0_RX,
51 DMACH_I2S0_TX,
52 DMACH_I2S2_RX,
53 DMACH_I2S2_TX,
54 DMACH_UART0_RX,
55 DMACH_UART0_TX,
56 DMACH_UART2_RX,
57 DMACH_UART2_TX,
58 DMACH_UART4_RX,
59 DMACH_UART4_TX,
60 DMACH_SLIMBUS0_RX,
61 DMACH_SLIMBUS0_TX,
62 DMACH_SLIMBUS2_RX,
63 DMACH_SLIMBUS2_TX,
64 DMACH_SLIMBUS4_RX,
65 DMACH_SLIMBUS4_TX,
66 DMACH_AC97_MICIN,
67 DMACH_AC97_PCMIN,
68 DMACH_AC97_PCMOUT,
69};
70
71static u8 exynos4212_pdma0_peri[] = {
72 DMACH_PCM0_RX,
73 DMACH_PCM0_TX,
74 DMACH_PCM2_RX,
75 DMACH_PCM2_TX,
76 DMACH_MIPI_HSI0,
77 DMACH_MIPI_HSI1,
78 DMACH_SPI0_RX,
79 DMACH_SPI0_TX,
80 DMACH_SPI2_RX,
81 DMACH_SPI2_TX,
82 DMACH_I2S0S_TX,
83 DMACH_I2S0_RX,
84 DMACH_I2S0_TX,
85 DMACH_I2S2_RX,
86 DMACH_I2S2_TX,
87 DMACH_UART0_RX,
88 DMACH_UART0_TX,
89 DMACH_UART2_RX,
90 DMACH_UART2_TX,
91 DMACH_UART4_RX,
92 DMACH_UART4_TX,
93 DMACH_SLIMBUS0_RX,
94 DMACH_SLIMBUS0_TX,
95 DMACH_SLIMBUS2_RX,
96 DMACH_SLIMBUS2_TX,
97 DMACH_SLIMBUS4_RX,
98 DMACH_SLIMBUS4_TX,
99 DMACH_AC97_MICIN,
100 DMACH_AC97_PCMIN,
101 DMACH_AC97_PCMOUT,
102 DMACH_MIPI_HSI4,
103 DMACH_MIPI_HSI5,
104};
105
106static u8 exynos5250_pdma0_peri[] = {
107 DMACH_PCM0_RX,
108 DMACH_PCM0_TX,
109 DMACH_PCM2_RX,
110 DMACH_PCM2_TX,
111 DMACH_SPI0_RX,
112 DMACH_SPI0_TX,
113 DMACH_SPI2_RX,
114 DMACH_SPI2_TX,
115 DMACH_I2S0S_TX,
116 DMACH_I2S0_RX,
117 DMACH_I2S0_TX,
118 DMACH_I2S2_RX,
119 DMACH_I2S2_TX,
120 DMACH_UART0_RX,
121 DMACH_UART0_TX,
122 DMACH_UART2_RX,
123 DMACH_UART2_TX,
124 DMACH_UART4_RX,
125 DMACH_UART4_TX,
126 DMACH_SLIMBUS0_RX,
127 DMACH_SLIMBUS0_TX,
128 DMACH_SLIMBUS2_RX,
129 DMACH_SLIMBUS2_TX,
130 DMACH_SLIMBUS4_RX,
131 DMACH_SLIMBUS4_TX,
132 DMACH_AC97_MICIN,
133 DMACH_AC97_PCMIN,
134 DMACH_AC97_PCMOUT,
135 DMACH_MIPI_HSI0,
136 DMACH_MIPI_HSI2,
137 DMACH_MIPI_HSI4,
138 DMACH_MIPI_HSI6,
139};
140
141static struct dma_pl330_platdata exynos_pdma0_pdata;
142
143static AMBA_AHB_DEVICE(exynos_pdma0, "dma-pl330.0", 0x00041330,
144 EXYNOS4_PA_PDMA0, {EXYNOS4_IRQ_PDMA0}, &exynos_pdma0_pdata);
145
146static u8 exynos4210_pdma1_peri[] = {
147 DMACH_PCM0_RX,
148 DMACH_PCM0_TX,
149 DMACH_PCM1_RX,
150 DMACH_PCM1_TX,
151 DMACH_MSM_REQ1,
152 DMACH_MSM_REQ3,
153 DMACH_SPI1_RX,
154 DMACH_SPI1_TX,
155 DMACH_I2S0S_TX,
156 DMACH_I2S0_RX,
157 DMACH_I2S0_TX,
158 DMACH_I2S1_RX,
159 DMACH_I2S1_TX,
160 DMACH_UART0_RX,
161 DMACH_UART0_TX,
162 DMACH_UART1_RX,
163 DMACH_UART1_TX,
164 DMACH_UART3_RX,
165 DMACH_UART3_TX,
166 DMACH_SLIMBUS1_RX,
167 DMACH_SLIMBUS1_TX,
168 DMACH_SLIMBUS3_RX,
169 DMACH_SLIMBUS3_TX,
170 DMACH_SLIMBUS5_RX,
171 DMACH_SLIMBUS5_TX,
172};
173
174static u8 exynos4212_pdma1_peri[] = {
175 DMACH_PCM0_RX,
176 DMACH_PCM0_TX,
177 DMACH_PCM1_RX,
178 DMACH_PCM1_TX,
179 DMACH_MIPI_HSI2,
180 DMACH_MIPI_HSI3,
181 DMACH_SPI1_RX,
182 DMACH_SPI1_TX,
183 DMACH_I2S0S_TX,
184 DMACH_I2S0_RX,
185 DMACH_I2S0_TX,
186 DMACH_I2S1_RX,
187 DMACH_I2S1_TX,
188 DMACH_UART0_RX,
189 DMACH_UART0_TX,
190 DMACH_UART1_RX,
191 DMACH_UART1_TX,
192 DMACH_UART3_RX,
193 DMACH_UART3_TX,
194 DMACH_SLIMBUS1_RX,
195 DMACH_SLIMBUS1_TX,
196 DMACH_SLIMBUS3_RX,
197 DMACH_SLIMBUS3_TX,
198 DMACH_SLIMBUS5_RX,
199 DMACH_SLIMBUS5_TX,
200 DMACH_SLIMBUS0AUX_RX,
201 DMACH_SLIMBUS0AUX_TX,
202 DMACH_SPDIF,
203 DMACH_MIPI_HSI6,
204 DMACH_MIPI_HSI7,
205};
206
207static u8 exynos5250_pdma1_peri[] = {
208 DMACH_PCM0_RX,
209 DMACH_PCM0_TX,
210 DMACH_PCM1_RX,
211 DMACH_PCM1_TX,
212 DMACH_SPI1_RX,
213 DMACH_SPI1_TX,
214 DMACH_PWM,
215 DMACH_SPDIF,
216 DMACH_I2S0S_TX,
217 DMACH_I2S0_RX,
218 DMACH_I2S0_TX,
219 DMACH_I2S1_RX,
220 DMACH_I2S1_TX,
221 DMACH_UART0_RX,
222 DMACH_UART0_TX,
223 DMACH_UART1_RX,
224 DMACH_UART1_TX,
225 DMACH_UART3_RX,
226 DMACH_UART3_TX,
227 DMACH_SLIMBUS1_RX,
228 DMACH_SLIMBUS1_TX,
229 DMACH_SLIMBUS3_RX,
230 DMACH_SLIMBUS3_TX,
231 DMACH_SLIMBUS5_RX,
232 DMACH_SLIMBUS5_TX,
233 DMACH_SLIMBUS0AUX_RX,
234 DMACH_SLIMBUS0AUX_TX,
235 DMACH_DISP1,
236 DMACH_MIPI_HSI1,
237 DMACH_MIPI_HSI3,
238 DMACH_MIPI_HSI5,
239 DMACH_MIPI_HSI7,
240};
241
242static struct dma_pl330_platdata exynos_pdma1_pdata;
243
244static AMBA_AHB_DEVICE(exynos_pdma1, "dma-pl330.1", 0x00041330,
245 EXYNOS4_PA_PDMA1, {EXYNOS4_IRQ_PDMA1}, &exynos_pdma1_pdata);
246
247static u8 mdma_peri[] = {
248 DMACH_MTOM_0,
249 DMACH_MTOM_1,
250 DMACH_MTOM_2,
251 DMACH_MTOM_3,
252 DMACH_MTOM_4,
253 DMACH_MTOM_5,
254 DMACH_MTOM_6,
255 DMACH_MTOM_7,
256};
257
258static struct dma_pl330_platdata exynos_mdma1_pdata = {
259 .nr_valid_peri = ARRAY_SIZE(mdma_peri),
260 .peri_id = mdma_peri,
261};
262
263static AMBA_AHB_DEVICE(exynos_mdma1, "dma-pl330.2", 0x00041330,
264 EXYNOS4_PA_MDMA1, {EXYNOS4_IRQ_MDMA1}, &exynos_mdma1_pdata);
265
266static int __init exynos_dma_init(void)
267{
268 if (of_have_populated_dt())
269 return 0;
270
271 if (soc_is_exynos4210()) {
272 exynos_pdma0_pdata.nr_valid_peri =
273 ARRAY_SIZE(exynos4210_pdma0_peri);
274 exynos_pdma0_pdata.peri_id = exynos4210_pdma0_peri;
275 exynos_pdma1_pdata.nr_valid_peri =
276 ARRAY_SIZE(exynos4210_pdma1_peri);
277 exynos_pdma1_pdata.peri_id = exynos4210_pdma1_peri;
278
279 if (samsung_rev() == EXYNOS4210_REV_0)
280 exynos_mdma1_device.res.start = EXYNOS4_PA_S_MDMA1;
281 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
282 exynos_pdma0_pdata.nr_valid_peri =
283 ARRAY_SIZE(exynos4212_pdma0_peri);
284 exynos_pdma0_pdata.peri_id = exynos4212_pdma0_peri;
285 exynos_pdma1_pdata.nr_valid_peri =
286 ARRAY_SIZE(exynos4212_pdma1_peri);
287 exynos_pdma1_pdata.peri_id = exynos4212_pdma1_peri;
288 } else if (soc_is_exynos5250()) {
289 exynos_pdma0_pdata.nr_valid_peri =
290 ARRAY_SIZE(exynos5250_pdma0_peri);
291 exynos_pdma0_pdata.peri_id = exynos5250_pdma0_peri;
292 exynos_pdma1_pdata.nr_valid_peri =
293 ARRAY_SIZE(exynos5250_pdma1_peri);
294 exynos_pdma1_pdata.peri_id = exynos5250_pdma1_peri;
295
296 exynos_pdma0_device.res.start = EXYNOS5_PA_PDMA0;
297 exynos_pdma0_device.res.end = EXYNOS5_PA_PDMA0 + SZ_4K;
298 exynos_pdma0_device.irq[0] = EXYNOS5_IRQ_PDMA0;
299 exynos_pdma1_device.res.start = EXYNOS5_PA_PDMA1;
300 exynos_pdma1_device.res.end = EXYNOS5_PA_PDMA1 + SZ_4K;
301 exynos_pdma0_device.irq[0] = EXYNOS5_IRQ_PDMA1;
302 exynos_mdma1_device.res.start = EXYNOS5_PA_MDMA1;
303 exynos_mdma1_device.res.end = EXYNOS5_PA_MDMA1 + SZ_4K;
304 exynos_pdma0_device.irq[0] = EXYNOS5_IRQ_MDMA1;
305 }
306
307 dma_cap_set(DMA_SLAVE, exynos_pdma0_pdata.cap_mask);
308 dma_cap_set(DMA_CYCLIC, exynos_pdma0_pdata.cap_mask);
309 dma_cap_set(DMA_PRIVATE, exynos_pdma0_pdata.cap_mask);
310 amba_device_register(&exynos_pdma0_device, &iomem_resource);
311
312 dma_cap_set(DMA_SLAVE, exynos_pdma1_pdata.cap_mask);
313 dma_cap_set(DMA_CYCLIC, exynos_pdma1_pdata.cap_mask);
314 dma_cap_set(DMA_PRIVATE, exynos_pdma1_pdata.cap_mask);
315 amba_device_register(&exynos_pdma1_device, &iomem_resource);
316
317 dma_cap_set(DMA_MEMCPY, exynos_mdma1_pdata.cap_mask);
318 amba_device_register(&exynos_mdma1_device, &iomem_resource);
319
320 return 0;
321}
322arch_initcall(exynos_dma_init);
diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
index ed11f100d479..932129ef26c6 100644
--- a/arch/arm/mach-exynos/firmware.c
+++ b/arch/arm/mach-exynos/firmware.c
@@ -48,20 +48,18 @@ static const struct firmware_ops exynos_firmware_ops = {
48 48
49void __init exynos_firmware_init(void) 49void __init exynos_firmware_init(void)
50{ 50{
51 if (of_have_populated_dt()) { 51 struct device_node *nd;
52 struct device_node *nd; 52 const __be32 *addr;
53 const __be32 *addr;
54 53
55 nd = of_find_compatible_node(NULL, NULL, 54 nd = of_find_compatible_node(NULL, NULL,
56 "samsung,secure-firmware"); 55 "samsung,secure-firmware");
57 if (!nd) 56 if (!nd)
58 return; 57 return;
59 58
60 addr = of_get_address(nd, 0, NULL, NULL); 59 addr = of_get_address(nd, 0, NULL, NULL);
61 if (!addr) { 60 if (!addr) {
62 pr_err("%s: No address specified.\n", __func__); 61 pr_err("%s: No address specified.\n", __func__);
63 return; 62 return;
64 }
65 } 63 }
66 64
67 pr_info("Running under secure firmware.\n"); 65 pr_info("Running under secure firmware.\n");
diff --git a/arch/arm/mach-exynos/include/mach/gpio.h b/arch/arm/mach-exynos/include/mach/gpio.h
deleted file mode 100644
index eb24f1eb8e3b..000000000000
--- a/arch/arm/mach-exynos/include/mach/gpio.h
+++ /dev/null
@@ -1,289 +0,0 @@
1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS - GPIO lib support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_GPIO_H
13#define __ASM_ARCH_GPIO_H __FILE__
14
15/* Macro for EXYNOS GPIO numbering */
16
17#define EXYNOS_GPIO_NEXT(__gpio) \
18 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
19
20/* EXYNOS4 GPIO bank sizes */
21
22#define EXYNOS4_GPIO_A0_NR (8)
23#define EXYNOS4_GPIO_A1_NR (6)
24#define EXYNOS4_GPIO_B_NR (8)
25#define EXYNOS4_GPIO_C0_NR (5)
26#define EXYNOS4_GPIO_C1_NR (5)
27#define EXYNOS4_GPIO_D0_NR (4)
28#define EXYNOS4_GPIO_D1_NR (4)
29#define EXYNOS4_GPIO_E0_NR (5)
30#define EXYNOS4_GPIO_E1_NR (8)
31#define EXYNOS4_GPIO_E2_NR (6)
32#define EXYNOS4_GPIO_E3_NR (8)
33#define EXYNOS4_GPIO_E4_NR (8)
34#define EXYNOS4_GPIO_F0_NR (8)
35#define EXYNOS4_GPIO_F1_NR (8)
36#define EXYNOS4_GPIO_F2_NR (8)
37#define EXYNOS4_GPIO_F3_NR (6)
38#define EXYNOS4_GPIO_J0_NR (8)
39#define EXYNOS4_GPIO_J1_NR (5)
40#define EXYNOS4_GPIO_K0_NR (7)
41#define EXYNOS4_GPIO_K1_NR (7)
42#define EXYNOS4_GPIO_K2_NR (7)
43#define EXYNOS4_GPIO_K3_NR (7)
44#define EXYNOS4_GPIO_L0_NR (8)
45#define EXYNOS4_GPIO_L1_NR (3)
46#define EXYNOS4_GPIO_L2_NR (8)
47#define EXYNOS4_GPIO_X0_NR (8)
48#define EXYNOS4_GPIO_X1_NR (8)
49#define EXYNOS4_GPIO_X2_NR (8)
50#define EXYNOS4_GPIO_X3_NR (8)
51#define EXYNOS4_GPIO_Y0_NR (6)
52#define EXYNOS4_GPIO_Y1_NR (4)
53#define EXYNOS4_GPIO_Y2_NR (6)
54#define EXYNOS4_GPIO_Y3_NR (8)
55#define EXYNOS4_GPIO_Y4_NR (8)
56#define EXYNOS4_GPIO_Y5_NR (8)
57#define EXYNOS4_GPIO_Y6_NR (8)
58#define EXYNOS4_GPIO_Z_NR (7)
59
60/* EXYNOS4 GPIO bank numbers */
61
62enum exynos4_gpio_number {
63 EXYNOS4_GPIO_A0_START = 0,
64 EXYNOS4_GPIO_A1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_A0),
65 EXYNOS4_GPIO_B_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_A1),
66 EXYNOS4_GPIO_C0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_B),
67 EXYNOS4_GPIO_C1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_C0),
68 EXYNOS4_GPIO_D0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_C1),
69 EXYNOS4_GPIO_D1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_D0),
70 EXYNOS4_GPIO_E0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_D1),
71 EXYNOS4_GPIO_E1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E0),
72 EXYNOS4_GPIO_E2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E1),
73 EXYNOS4_GPIO_E3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E2),
74 EXYNOS4_GPIO_E4_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E3),
75 EXYNOS4_GPIO_F0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E4),
76 EXYNOS4_GPIO_F1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F0),
77 EXYNOS4_GPIO_F2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F1),
78 EXYNOS4_GPIO_F3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F2),
79 EXYNOS4_GPIO_J0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F3),
80 EXYNOS4_GPIO_J1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_J0),
81 EXYNOS4_GPIO_K0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_J1),
82 EXYNOS4_GPIO_K1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K0),
83 EXYNOS4_GPIO_K2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K1),
84 EXYNOS4_GPIO_K3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K2),
85 EXYNOS4_GPIO_L0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K3),
86 EXYNOS4_GPIO_L1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_L0),
87 EXYNOS4_GPIO_L2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_L1),
88 EXYNOS4_GPIO_X0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_L2),
89 EXYNOS4_GPIO_X1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X0),
90 EXYNOS4_GPIO_X2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X1),
91 EXYNOS4_GPIO_X3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X2),
92 EXYNOS4_GPIO_Y0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X3),
93 EXYNOS4_GPIO_Y1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y0),
94 EXYNOS4_GPIO_Y2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y1),
95 EXYNOS4_GPIO_Y3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y2),
96 EXYNOS4_GPIO_Y4_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y3),
97 EXYNOS4_GPIO_Y5_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y4),
98 EXYNOS4_GPIO_Y6_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y5),
99 EXYNOS4_GPIO_Z_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y6),
100};
101
102/* EXYNOS4 GPIO number definitions */
103
104#define EXYNOS4_GPA0(_nr) (EXYNOS4_GPIO_A0_START + (_nr))
105#define EXYNOS4_GPA1(_nr) (EXYNOS4_GPIO_A1_START + (_nr))
106#define EXYNOS4_GPB(_nr) (EXYNOS4_GPIO_B_START + (_nr))
107#define EXYNOS4_GPC0(_nr) (EXYNOS4_GPIO_C0_START + (_nr))
108#define EXYNOS4_GPC1(_nr) (EXYNOS4_GPIO_C1_START + (_nr))
109#define EXYNOS4_GPD0(_nr) (EXYNOS4_GPIO_D0_START + (_nr))
110#define EXYNOS4_GPD1(_nr) (EXYNOS4_GPIO_D1_START + (_nr))
111#define EXYNOS4_GPE0(_nr) (EXYNOS4_GPIO_E0_START + (_nr))
112#define EXYNOS4_GPE1(_nr) (EXYNOS4_GPIO_E1_START + (_nr))
113#define EXYNOS4_GPE2(_nr) (EXYNOS4_GPIO_E2_START + (_nr))
114#define EXYNOS4_GPE3(_nr) (EXYNOS4_GPIO_E3_START + (_nr))
115#define EXYNOS4_GPE4(_nr) (EXYNOS4_GPIO_E4_START + (_nr))
116#define EXYNOS4_GPF0(_nr) (EXYNOS4_GPIO_F0_START + (_nr))
117#define EXYNOS4_GPF1(_nr) (EXYNOS4_GPIO_F1_START + (_nr))
118#define EXYNOS4_GPF2(_nr) (EXYNOS4_GPIO_F2_START + (_nr))
119#define EXYNOS4_GPF3(_nr) (EXYNOS4_GPIO_F3_START + (_nr))
120#define EXYNOS4_GPJ0(_nr) (EXYNOS4_GPIO_J0_START + (_nr))
121#define EXYNOS4_GPJ1(_nr) (EXYNOS4_GPIO_J1_START + (_nr))
122#define EXYNOS4_GPK0(_nr) (EXYNOS4_GPIO_K0_START + (_nr))
123#define EXYNOS4_GPK1(_nr) (EXYNOS4_GPIO_K1_START + (_nr))
124#define EXYNOS4_GPK2(_nr) (EXYNOS4_GPIO_K2_START + (_nr))
125#define EXYNOS4_GPK3(_nr) (EXYNOS4_GPIO_K3_START + (_nr))
126#define EXYNOS4_GPL0(_nr) (EXYNOS4_GPIO_L0_START + (_nr))
127#define EXYNOS4_GPL1(_nr) (EXYNOS4_GPIO_L1_START + (_nr))
128#define EXYNOS4_GPL2(_nr) (EXYNOS4_GPIO_L2_START + (_nr))
129#define EXYNOS4_GPX0(_nr) (EXYNOS4_GPIO_X0_START + (_nr))
130#define EXYNOS4_GPX1(_nr) (EXYNOS4_GPIO_X1_START + (_nr))
131#define EXYNOS4_GPX2(_nr) (EXYNOS4_GPIO_X2_START + (_nr))
132#define EXYNOS4_GPX3(_nr) (EXYNOS4_GPIO_X3_START + (_nr))
133#define EXYNOS4_GPY0(_nr) (EXYNOS4_GPIO_Y0_START + (_nr))
134#define EXYNOS4_GPY1(_nr) (EXYNOS4_GPIO_Y1_START + (_nr))
135#define EXYNOS4_GPY2(_nr) (EXYNOS4_GPIO_Y2_START + (_nr))
136#define EXYNOS4_GPY3(_nr) (EXYNOS4_GPIO_Y3_START + (_nr))
137#define EXYNOS4_GPY4(_nr) (EXYNOS4_GPIO_Y4_START + (_nr))
138#define EXYNOS4_GPY5(_nr) (EXYNOS4_GPIO_Y5_START + (_nr))
139#define EXYNOS4_GPY6(_nr) (EXYNOS4_GPIO_Y6_START + (_nr))
140#define EXYNOS4_GPZ(_nr) (EXYNOS4_GPIO_Z_START + (_nr))
141
142/* the end of the EXYNOS4 specific gpios */
143
144#define EXYNOS4_GPIO_END (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + 1)
145
146/* EXYNOS5 GPIO bank sizes */
147
148#define EXYNOS5_GPIO_A0_NR (8)
149#define EXYNOS5_GPIO_A1_NR (6)
150#define EXYNOS5_GPIO_A2_NR (8)
151#define EXYNOS5_GPIO_B0_NR (5)
152#define EXYNOS5_GPIO_B1_NR (5)
153#define EXYNOS5_GPIO_B2_NR (4)
154#define EXYNOS5_GPIO_B3_NR (4)
155#define EXYNOS5_GPIO_C0_NR (7)
156#define EXYNOS5_GPIO_C1_NR (4)
157#define EXYNOS5_GPIO_C2_NR (7)
158#define EXYNOS5_GPIO_C3_NR (7)
159#define EXYNOS5_GPIO_C4_NR (7)
160#define EXYNOS5_GPIO_D0_NR (4)
161#define EXYNOS5_GPIO_D1_NR (8)
162#define EXYNOS5_GPIO_Y0_NR (6)
163#define EXYNOS5_GPIO_Y1_NR (4)
164#define EXYNOS5_GPIO_Y2_NR (6)
165#define EXYNOS5_GPIO_Y3_NR (8)
166#define EXYNOS5_GPIO_Y4_NR (8)
167#define EXYNOS5_GPIO_Y5_NR (8)
168#define EXYNOS5_GPIO_Y6_NR (8)
169#define EXYNOS5_GPIO_X0_NR (8)
170#define EXYNOS5_GPIO_X1_NR (8)
171#define EXYNOS5_GPIO_X2_NR (8)
172#define EXYNOS5_GPIO_X3_NR (8)
173#define EXYNOS5_GPIO_E0_NR (8)
174#define EXYNOS5_GPIO_E1_NR (2)
175#define EXYNOS5_GPIO_F0_NR (4)
176#define EXYNOS5_GPIO_F1_NR (4)
177#define EXYNOS5_GPIO_G0_NR (8)
178#define EXYNOS5_GPIO_G1_NR (8)
179#define EXYNOS5_GPIO_G2_NR (2)
180#define EXYNOS5_GPIO_H0_NR (4)
181#define EXYNOS5_GPIO_H1_NR (8)
182#define EXYNOS5_GPIO_V0_NR (8)
183#define EXYNOS5_GPIO_V1_NR (8)
184#define EXYNOS5_GPIO_V2_NR (8)
185#define EXYNOS5_GPIO_V3_NR (8)
186#define EXYNOS5_GPIO_V4_NR (2)
187#define EXYNOS5_GPIO_Z_NR (7)
188
189/* EXYNOS5 GPIO bank numbers */
190
191enum exynos5_gpio_number {
192 EXYNOS5_GPIO_A0_START = 0,
193 EXYNOS5_GPIO_A1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_A0),
194 EXYNOS5_GPIO_A2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_A1),
195 EXYNOS5_GPIO_B0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_A2),
196 EXYNOS5_GPIO_B1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B0),
197 EXYNOS5_GPIO_B2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B1),
198 EXYNOS5_GPIO_B3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B2),
199 EXYNOS5_GPIO_C0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B3),
200 EXYNOS5_GPIO_C1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C0),
201 EXYNOS5_GPIO_C2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C1),
202 EXYNOS5_GPIO_C3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C2),
203 EXYNOS5_GPIO_C4_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C3),
204 EXYNOS5_GPIO_D0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C4),
205 EXYNOS5_GPIO_D1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_D0),
206 EXYNOS5_GPIO_Y0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_D1),
207 EXYNOS5_GPIO_Y1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y0),
208 EXYNOS5_GPIO_Y2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y1),
209 EXYNOS5_GPIO_Y3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y2),
210 EXYNOS5_GPIO_Y4_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y3),
211 EXYNOS5_GPIO_Y5_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y4),
212 EXYNOS5_GPIO_Y6_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y5),
213 EXYNOS5_GPIO_X0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y6),
214 EXYNOS5_GPIO_X1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X0),
215 EXYNOS5_GPIO_X2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X1),
216 EXYNOS5_GPIO_X3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X2),
217 EXYNOS5_GPIO_E0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X3),
218 EXYNOS5_GPIO_E1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_E0),
219 EXYNOS5_GPIO_F0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_E1),
220 EXYNOS5_GPIO_F1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_F0),
221 EXYNOS5_GPIO_G0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_F1),
222 EXYNOS5_GPIO_G1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_G0),
223 EXYNOS5_GPIO_G2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_G1),
224 EXYNOS5_GPIO_H0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_G2),
225 EXYNOS5_GPIO_H1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_H0),
226 EXYNOS5_GPIO_V0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_H1),
227 EXYNOS5_GPIO_V1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V0),
228 EXYNOS5_GPIO_V2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V1),
229 EXYNOS5_GPIO_V3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V2),
230 EXYNOS5_GPIO_V4_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V3),
231 EXYNOS5_GPIO_Z_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V4),
232};
233
234/* EXYNOS5 GPIO number definitions */
235
236#define EXYNOS5_GPA0(_nr) (EXYNOS5_GPIO_A0_START + (_nr))
237#define EXYNOS5_GPA1(_nr) (EXYNOS5_GPIO_A1_START + (_nr))
238#define EXYNOS5_GPA2(_nr) (EXYNOS5_GPIO_A2_START + (_nr))
239#define EXYNOS5_GPB0(_nr) (EXYNOS5_GPIO_B0_START + (_nr))
240#define EXYNOS5_GPB1(_nr) (EXYNOS5_GPIO_B1_START + (_nr))
241#define EXYNOS5_GPB2(_nr) (EXYNOS5_GPIO_B2_START + (_nr))
242#define EXYNOS5_GPB3(_nr) (EXYNOS5_GPIO_B3_START + (_nr))
243#define EXYNOS5_GPC0(_nr) (EXYNOS5_GPIO_C0_START + (_nr))
244#define EXYNOS5_GPC1(_nr) (EXYNOS5_GPIO_C1_START + (_nr))
245#define EXYNOS5_GPC2(_nr) (EXYNOS5_GPIO_C2_START + (_nr))
246#define EXYNOS5_GPC3(_nr) (EXYNOS5_GPIO_C3_START + (_nr))
247#define EXYNOS5_GPC4(_nr) (EXYNOS5_GPIO_C4_START + (_nr))
248#define EXYNOS5_GPD0(_nr) (EXYNOS5_GPIO_D0_START + (_nr))
249#define EXYNOS5_GPD1(_nr) (EXYNOS5_GPIO_D1_START + (_nr))
250#define EXYNOS5_GPY0(_nr) (EXYNOS5_GPIO_Y0_START + (_nr))
251#define EXYNOS5_GPY1(_nr) (EXYNOS5_GPIO_Y1_START + (_nr))
252#define EXYNOS5_GPY2(_nr) (EXYNOS5_GPIO_Y2_START + (_nr))
253#define EXYNOS5_GPY3(_nr) (EXYNOS5_GPIO_Y3_START + (_nr))
254#define EXYNOS5_GPY4(_nr) (EXYNOS5_GPIO_Y4_START + (_nr))
255#define EXYNOS5_GPY5(_nr) (EXYNOS5_GPIO_Y5_START + (_nr))
256#define EXYNOS5_GPY6(_nr) (EXYNOS5_GPIO_Y6_START + (_nr))
257#define EXYNOS5_GPX0(_nr) (EXYNOS5_GPIO_X0_START + (_nr))
258#define EXYNOS5_GPX1(_nr) (EXYNOS5_GPIO_X1_START + (_nr))
259#define EXYNOS5_GPX2(_nr) (EXYNOS5_GPIO_X2_START + (_nr))
260#define EXYNOS5_GPX3(_nr) (EXYNOS5_GPIO_X3_START + (_nr))
261#define EXYNOS5_GPE0(_nr) (EXYNOS5_GPIO_E0_START + (_nr))
262#define EXYNOS5_GPE1(_nr) (EXYNOS5_GPIO_E1_START + (_nr))
263#define EXYNOS5_GPF0(_nr) (EXYNOS5_GPIO_F0_START + (_nr))
264#define EXYNOS5_GPF1(_nr) (EXYNOS5_GPIO_F1_START + (_nr))
265#define EXYNOS5_GPG0(_nr) (EXYNOS5_GPIO_G0_START + (_nr))
266#define EXYNOS5_GPG1(_nr) (EXYNOS5_GPIO_G1_START + (_nr))
267#define EXYNOS5_GPG2(_nr) (EXYNOS5_GPIO_G2_START + (_nr))
268#define EXYNOS5_GPH0(_nr) (EXYNOS5_GPIO_H0_START + (_nr))
269#define EXYNOS5_GPH1(_nr) (EXYNOS5_GPIO_H1_START + (_nr))
270#define EXYNOS5_GPV0(_nr) (EXYNOS5_GPIO_V0_START + (_nr))
271#define EXYNOS5_GPV1(_nr) (EXYNOS5_GPIO_V1_START + (_nr))
272#define EXYNOS5_GPV2(_nr) (EXYNOS5_GPIO_V2_START + (_nr))
273#define EXYNOS5_GPV3(_nr) (EXYNOS5_GPIO_V3_START + (_nr))
274#define EXYNOS5_GPV4(_nr) (EXYNOS5_GPIO_V4_START + (_nr))
275#define EXYNOS5_GPZ(_nr) (EXYNOS5_GPIO_Z_START + (_nr))
276
277/* the end of the EXYNOS5 specific gpios */
278
279#define EXYNOS5_GPIO_END (EXYNOS5_GPZ(EXYNOS5_GPIO_Z_NR) + 1)
280
281/* actually, EXYNOS5_GPIO_END is bigger than EXYNOS4 */
282
283#define S3C_GPIO_END (EXYNOS5_GPIO_END)
284
285/* define the number of gpios */
286
287#define ARCH_NR_GPIOS (CONFIG_SAMSUNG_GPIO_EXTRA + S3C_GPIO_END)
288
289#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
deleted file mode 100644
index c72f59d91fce..000000000000
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ /dev/null
@@ -1,476 +0,0 @@
1/*
2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * EXYNOS - IRQ definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#ifndef __ASM_ARCH_IRQS_H
13#define __ASM_ARCH_IRQS_H __FILE__
14
15#include <plat/irqs.h>
16
17/* PPI: Private Peripheral Interrupt */
18
19#define IRQ_PPI(x) (x + 16)
20
21/* SPI: Shared Peripheral Interrupt */
22
23#define IRQ_SPI(x) (x + 32)
24
25/* COMBINER */
26
27#define MAX_IRQ_IN_COMBINER 8
28#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128))
29#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y)
30
31/* For EXYNOS4 and EXYNOS5 */
32
33#define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32)
34
35/* For EXYNOS4 SoCs */
36
37#define EXYNOS4_IRQ_EINT0 IRQ_SPI(16)
38#define EXYNOS4_IRQ_EINT1 IRQ_SPI(17)
39#define EXYNOS4_IRQ_EINT2 IRQ_SPI(18)
40#define EXYNOS4_IRQ_EINT3 IRQ_SPI(19)
41#define EXYNOS4_IRQ_EINT4 IRQ_SPI(20)
42#define EXYNOS4_IRQ_EINT5 IRQ_SPI(21)
43#define EXYNOS4_IRQ_EINT6 IRQ_SPI(22)
44#define EXYNOS4_IRQ_EINT7 IRQ_SPI(23)
45#define EXYNOS4_IRQ_EINT8 IRQ_SPI(24)
46#define EXYNOS4_IRQ_EINT9 IRQ_SPI(25)
47#define EXYNOS4_IRQ_EINT10 IRQ_SPI(26)
48#define EXYNOS4_IRQ_EINT11 IRQ_SPI(27)
49#define EXYNOS4_IRQ_EINT12 IRQ_SPI(28)
50#define EXYNOS4_IRQ_EINT13 IRQ_SPI(29)
51#define EXYNOS4_IRQ_EINT14 IRQ_SPI(30)
52#define EXYNOS4_IRQ_EINT15 IRQ_SPI(31)
53
54#define EXYNOS4_IRQ_MDMA0 IRQ_SPI(33)
55#define EXYNOS4_IRQ_MDMA1 IRQ_SPI(34)
56#define EXYNOS4_IRQ_PDMA0 IRQ_SPI(35)
57#define EXYNOS4_IRQ_PDMA1 IRQ_SPI(36)
58#define EXYNOS4_IRQ_TIMER0_VIC IRQ_SPI(37)
59#define EXYNOS4_IRQ_TIMER1_VIC IRQ_SPI(38)
60#define EXYNOS4_IRQ_TIMER2_VIC IRQ_SPI(39)
61#define EXYNOS4_IRQ_TIMER3_VIC IRQ_SPI(40)
62#define EXYNOS4_IRQ_TIMER4_VIC IRQ_SPI(41)
63#define EXYNOS4_IRQ_MCT_L0 IRQ_SPI(42)
64#define EXYNOS4_IRQ_WDT IRQ_SPI(43)
65#define EXYNOS4_IRQ_RTC_ALARM IRQ_SPI(44)
66#define EXYNOS4_IRQ_RTC_TIC IRQ_SPI(45)
67#define EXYNOS4_IRQ_GPIO_XB IRQ_SPI(46)
68#define EXYNOS4_IRQ_GPIO_XA IRQ_SPI(47)
69#define EXYNOS4_IRQ_MCT_L1 IRQ_SPI(48)
70
71#define EXYNOS4_IRQ_UART0 IRQ_SPI(52)
72#define EXYNOS4_IRQ_UART1 IRQ_SPI(53)
73#define EXYNOS4_IRQ_UART2 IRQ_SPI(54)
74#define EXYNOS4_IRQ_UART3 IRQ_SPI(55)
75#define EXYNOS4_IRQ_UART4 IRQ_SPI(56)
76#define EXYNOS4_IRQ_MCT_G0 IRQ_SPI(57)
77#define EXYNOS4_IRQ_IIC IRQ_SPI(58)
78#define EXYNOS4_IRQ_IIC1 IRQ_SPI(59)
79#define EXYNOS4_IRQ_IIC2 IRQ_SPI(60)
80#define EXYNOS4_IRQ_IIC3 IRQ_SPI(61)
81#define EXYNOS4_IRQ_IIC4 IRQ_SPI(62)
82#define EXYNOS4_IRQ_IIC5 IRQ_SPI(63)
83#define EXYNOS4_IRQ_IIC6 IRQ_SPI(64)
84#define EXYNOS4_IRQ_IIC7 IRQ_SPI(65)
85#define EXYNOS4_IRQ_SPI0 IRQ_SPI(66)
86#define EXYNOS4_IRQ_SPI1 IRQ_SPI(67)
87#define EXYNOS4_IRQ_SPI2 IRQ_SPI(68)
88
89#define EXYNOS4_IRQ_USB_HOST IRQ_SPI(70)
90#define EXYNOS4_IRQ_USB_HSOTG IRQ_SPI(71)
91#define EXYNOS4_IRQ_MODEM_IF IRQ_SPI(72)
92#define EXYNOS4_IRQ_HSMMC0 IRQ_SPI(73)
93#define EXYNOS4_IRQ_HSMMC1 IRQ_SPI(74)
94#define EXYNOS4_IRQ_HSMMC2 IRQ_SPI(75)
95#define EXYNOS4_IRQ_HSMMC3 IRQ_SPI(76)
96#define EXYNOS4_IRQ_DWMCI IRQ_SPI(77)
97
98#define EXYNOS4_IRQ_MIPI_CSIS0 IRQ_SPI(78)
99#define EXYNOS4_IRQ_MIPI_CSIS1 IRQ_SPI(80)
100
101#define EXYNOS4_IRQ_ONENAND_AUDI IRQ_SPI(82)
102#define EXYNOS4_IRQ_ROTATOR IRQ_SPI(83)
103#define EXYNOS4_IRQ_FIMC0 IRQ_SPI(84)
104#define EXYNOS4_IRQ_FIMC1 IRQ_SPI(85)
105#define EXYNOS4_IRQ_FIMC2 IRQ_SPI(86)
106#define EXYNOS4_IRQ_FIMC3 IRQ_SPI(87)
107#define EXYNOS4_IRQ_JPEG IRQ_SPI(88)
108#define EXYNOS4_IRQ_2D IRQ_SPI(89)
109#define EXYNOS4_IRQ_PCIE IRQ_SPI(90)
110
111#define EXYNOS4_IRQ_MIXER IRQ_SPI(91)
112#define EXYNOS4_IRQ_HDMI IRQ_SPI(92)
113#define EXYNOS4_IRQ_IIC_HDMIPHY IRQ_SPI(93)
114#define EXYNOS4_IRQ_MFC IRQ_SPI(94)
115#define EXYNOS4_IRQ_SDO IRQ_SPI(95)
116
117#define EXYNOS4_IRQ_AUDIO_SS IRQ_SPI(96)
118#define EXYNOS4_IRQ_I2S0 IRQ_SPI(97)
119#define EXYNOS4_IRQ_I2S1 IRQ_SPI(98)
120#define EXYNOS4_IRQ_I2S2 IRQ_SPI(99)
121#define EXYNOS4_IRQ_AC97 IRQ_SPI(100)
122
123#define EXYNOS4_IRQ_SPDIF IRQ_SPI(104)
124#define EXYNOS4_IRQ_ADC0 IRQ_SPI(105)
125#define EXYNOS4_IRQ_PEN0 IRQ_SPI(106)
126#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)
127#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)
128#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109)
129#define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110)
130#define EXYNOS4_IRQ_GPS IRQ_SPI(111)
131#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
132#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)
133
134#define EXYNOS4_IRQ_TSI IRQ_SPI(115)
135#define EXYNOS4_IRQ_SATA IRQ_SPI(116)
136
137#define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2)
138#define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2)
139#define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2)
140#define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2)
141
142#define EXYNOS4_IRQ_TMU_TRIG0 COMBINER_IRQ(2, 4)
143#define EXYNOS4_IRQ_TMU_TRIG1 COMBINER_IRQ(3, 4)
144
145#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)
146#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)
147#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)
148#define EXYNOS4_IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3)
149#define EXYNOS4_IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4)
150#define EXYNOS4_IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5)
151#define EXYNOS4_IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6)
152#define EXYNOS4_IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7)
153
154#define EXYNOS4_IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0)
155#define EXYNOS4_IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1)
156#define EXYNOS4_IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2)
157#define EXYNOS4_IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3)
158#define EXYNOS4_IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4)
159#define EXYNOS4_IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5)
160#define EXYNOS4_IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6)
161#define EXYNOS4_IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7)
162
163#define EXYNOS4_IRQ_SYSMMU_FIMC_LITE0_0 COMBINER_IRQ(16, 0)
164#define EXYNOS4_IRQ_SYSMMU_FIMC_LITE1_0 COMBINER_IRQ(16, 1)
165#define EXYNOS4_IRQ_SYSMMU_FIMC_ISP_0 COMBINER_IRQ(16, 2)
166#define EXYNOS4_IRQ_SYSMMU_FIMC_DRC_0 COMBINER_IRQ(16, 3)
167#define EXYNOS4_IRQ_SYSMMU_FIMC_FD_0 COMBINER_IRQ(16, 4)
168#define EXYNOS4_IRQ_SYSMMU_FIMC_CX_0 COMBINER_IRQ(16, 5)
169
170#define EXYNOS4_IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0)
171#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)
172#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2)
173
174#define EXYNOS4210_MAX_COMBINER_NR 16
175#define EXYNOS4212_MAX_COMBINER_NR 18
176#define EXYNOS4412_MAX_COMBINER_NR 20
177#define EXYNOS4_MAX_COMBINER_NR EXYNOS4412_MAX_COMBINER_NR
178
179#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16
180#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9
181
182/*
183 * For Compatibility:
184 * the default is for EXYNOS4, and
185 * for exynos5, should be re-mapped at function
186 */
187
188#define IRQ_TIMER0_VIC EXYNOS4_IRQ_TIMER0_VIC
189#define IRQ_TIMER1_VIC EXYNOS4_IRQ_TIMER1_VIC
190#define IRQ_TIMER2_VIC EXYNOS4_IRQ_TIMER2_VIC
191#define IRQ_TIMER3_VIC EXYNOS4_IRQ_TIMER3_VIC
192#define IRQ_TIMER4_VIC EXYNOS4_IRQ_TIMER4_VIC
193
194#define IRQ_WDT EXYNOS4_IRQ_WDT
195#define IRQ_RTC_ALARM EXYNOS4_IRQ_RTC_ALARM
196#define IRQ_RTC_TIC EXYNOS4_IRQ_RTC_TIC
197#define IRQ_GPIO_XB EXYNOS4_IRQ_GPIO_XB
198#define IRQ_GPIO_XA EXYNOS4_IRQ_GPIO_XA
199
200#define IRQ_IIC EXYNOS4_IRQ_IIC
201#define IRQ_IIC1 EXYNOS4_IRQ_IIC1
202#define IRQ_IIC3 EXYNOS4_IRQ_IIC3
203#define IRQ_IIC5 EXYNOS4_IRQ_IIC5
204#define IRQ_IIC6 EXYNOS4_IRQ_IIC6
205#define IRQ_IIC7 EXYNOS4_IRQ_IIC7
206
207#define IRQ_SPI0 EXYNOS4_IRQ_SPI0
208#define IRQ_SPI1 EXYNOS4_IRQ_SPI1
209#define IRQ_SPI2 EXYNOS4_IRQ_SPI2
210
211#define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST
212#define IRQ_OTG EXYNOS4_IRQ_USB_HSOTG
213
214#define IRQ_HSMMC0 EXYNOS4_IRQ_HSMMC0
215#define IRQ_HSMMC1 EXYNOS4_IRQ_HSMMC1
216#define IRQ_HSMMC2 EXYNOS4_IRQ_HSMMC2
217#define IRQ_HSMMC3 EXYNOS4_IRQ_HSMMC3
218
219#define IRQ_MIPI_CSIS0 EXYNOS4_IRQ_MIPI_CSIS0
220
221#define IRQ_ONENAND_AUDI EXYNOS4_IRQ_ONENAND_AUDI
222
223#define IRQ_FIMC0 EXYNOS4_IRQ_FIMC0
224#define IRQ_FIMC1 EXYNOS4_IRQ_FIMC1
225#define IRQ_FIMC2 EXYNOS4_IRQ_FIMC2
226#define IRQ_FIMC3 EXYNOS4_IRQ_FIMC3
227#define IRQ_JPEG EXYNOS4_IRQ_JPEG
228#define IRQ_2D EXYNOS4_IRQ_2D
229
230#define IRQ_MIXER EXYNOS4_IRQ_MIXER
231#define IRQ_HDMI EXYNOS4_IRQ_HDMI
232#define IRQ_IIC_HDMIPHY EXYNOS4_IRQ_IIC_HDMIPHY
233#define IRQ_MFC EXYNOS4_IRQ_MFC
234#define IRQ_SDO EXYNOS4_IRQ_SDO
235
236#define IRQ_I2S0 EXYNOS4_IRQ_I2S0
237
238#define IRQ_ADC EXYNOS4_IRQ_ADC0
239#define IRQ_TC EXYNOS4_IRQ_PEN0
240
241#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD
242
243#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO
244#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC
245#define IRQ_FIMD0_SYSTEM EXYNOS4_IRQ_FIMD0_SYSTEM
246
247#define IRQ_GPIO1_NR_GROUPS EXYNOS4_IRQ_GPIO1_NR_GROUPS
248#define IRQ_GPIO2_NR_GROUPS EXYNOS4_IRQ_GPIO2_NR_GROUPS
249
250/* For EXYNOS5 SoCs */
251
252#define EXYNOS5_IRQ_MDMA0 IRQ_SPI(33)
253#define EXYNOS5_IRQ_PDMA0 IRQ_SPI(34)
254#define EXYNOS5_IRQ_PDMA1 IRQ_SPI(35)
255#define EXYNOS5_IRQ_TIMER0_VIC IRQ_SPI(36)
256#define EXYNOS5_IRQ_TIMER1_VIC IRQ_SPI(37)
257#define EXYNOS5_IRQ_TIMER2_VIC IRQ_SPI(38)
258#define EXYNOS5_IRQ_TIMER3_VIC IRQ_SPI(39)
259#define EXYNOS5_IRQ_TIMER4_VIC IRQ_SPI(40)
260#define EXYNOS5_IRQ_RTIC IRQ_SPI(41)
261#define EXYNOS5_IRQ_WDT IRQ_SPI(42)
262#define EXYNOS5_IRQ_RTC_ALARM IRQ_SPI(43)
263#define EXYNOS5_IRQ_RTC_TIC IRQ_SPI(44)
264#define EXYNOS5_IRQ_GPIO_XB IRQ_SPI(45)
265#define EXYNOS5_IRQ_GPIO_XA IRQ_SPI(46)
266#define EXYNOS5_IRQ_GPIO IRQ_SPI(47)
267#define EXYNOS5_IRQ_IEM_IEC IRQ_SPI(48)
268#define EXYNOS5_IRQ_IEM_APC IRQ_SPI(49)
269#define EXYNOS5_IRQ_GPIO_C2C IRQ_SPI(50)
270#define EXYNOS5_IRQ_IIC IRQ_SPI(56)
271#define EXYNOS5_IRQ_IIC1 IRQ_SPI(57)
272#define EXYNOS5_IRQ_IIC2 IRQ_SPI(58)
273#define EXYNOS5_IRQ_IIC3 IRQ_SPI(59)
274#define EXYNOS5_IRQ_IIC4 IRQ_SPI(60)
275#define EXYNOS5_IRQ_IIC5 IRQ_SPI(61)
276#define EXYNOS5_IRQ_IIC6 IRQ_SPI(62)
277#define EXYNOS5_IRQ_IIC7 IRQ_SPI(63)
278#define EXYNOS5_IRQ_IIC_HDMIPHY IRQ_SPI(64)
279#define EXYNOS5_IRQ_TMU IRQ_SPI(65)
280#define EXYNOS5_IRQ_FIQ_0 IRQ_SPI(66)
281#define EXYNOS5_IRQ_FIQ_1 IRQ_SPI(67)
282#define EXYNOS5_IRQ_SPI0 IRQ_SPI(68)
283#define EXYNOS5_IRQ_SPI1 IRQ_SPI(69)
284#define EXYNOS5_IRQ_SPI2 IRQ_SPI(70)
285#define EXYNOS5_IRQ_USB_HOST IRQ_SPI(71)
286#define EXYNOS5_IRQ_USB3_DRD IRQ_SPI(72)
287#define EXYNOS5_IRQ_MIPI_HSI IRQ_SPI(73)
288#define EXYNOS5_IRQ_USB_HSOTG IRQ_SPI(74)
289#define EXYNOS5_IRQ_HSMMC0 IRQ_SPI(75)
290#define EXYNOS5_IRQ_HSMMC1 IRQ_SPI(76)
291#define EXYNOS5_IRQ_HSMMC2 IRQ_SPI(77)
292#define EXYNOS5_IRQ_HSMMC3 IRQ_SPI(78)
293#define EXYNOS5_IRQ_MIPICSI0 IRQ_SPI(79)
294#define EXYNOS5_IRQ_MIPICSI1 IRQ_SPI(80)
295#define EXYNOS5_IRQ_EFNFCON_DMA_ABORT IRQ_SPI(81)
296#define EXYNOS5_IRQ_MIPIDSI0 IRQ_SPI(82)
297#define EXYNOS5_IRQ_WDT_IOP IRQ_SPI(83)
298#define EXYNOS5_IRQ_ROTATOR IRQ_SPI(84)
299#define EXYNOS5_IRQ_GSC0 IRQ_SPI(85)
300#define EXYNOS5_IRQ_GSC1 IRQ_SPI(86)
301#define EXYNOS5_IRQ_GSC2 IRQ_SPI(87)
302#define EXYNOS5_IRQ_GSC3 IRQ_SPI(88)
303#define EXYNOS5_IRQ_JPEG IRQ_SPI(89)
304#define EXYNOS5_IRQ_EFNFCON_DMA IRQ_SPI(90)
305#define EXYNOS5_IRQ_2D IRQ_SPI(91)
306#define EXYNOS5_IRQ_EFNFCON_0 IRQ_SPI(92)
307#define EXYNOS5_IRQ_EFNFCON_1 IRQ_SPI(93)
308#define EXYNOS5_IRQ_MIXER IRQ_SPI(94)
309#define EXYNOS5_IRQ_HDMI IRQ_SPI(95)
310#define EXYNOS5_IRQ_MFC IRQ_SPI(96)
311#define EXYNOS5_IRQ_AUDIO_SS IRQ_SPI(97)
312#define EXYNOS5_IRQ_I2S0 IRQ_SPI(98)
313#define EXYNOS5_IRQ_I2S1 IRQ_SPI(99)
314#define EXYNOS5_IRQ_I2S2 IRQ_SPI(100)
315#define EXYNOS5_IRQ_AC97 IRQ_SPI(101)
316#define EXYNOS5_IRQ_PCM0 IRQ_SPI(102)
317#define EXYNOS5_IRQ_PCM1 IRQ_SPI(103)
318#define EXYNOS5_IRQ_PCM2 IRQ_SPI(104)
319#define EXYNOS5_IRQ_SPDIF IRQ_SPI(105)
320#define EXYNOS5_IRQ_ADC0 IRQ_SPI(106)
321#define EXYNOS5_IRQ_ADC1 IRQ_SPI(107)
322#define EXYNOS5_IRQ_SATA_PHY IRQ_SPI(108)
323#define EXYNOS5_IRQ_SATA_PMEMREQ IRQ_SPI(109)
324#define EXYNOS5_IRQ_CAM_C IRQ_SPI(110)
325#define EXYNOS5_IRQ_EAGLE_PMU IRQ_SPI(111)
326#define EXYNOS5_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
327#define EXYNOS5_IRQ_DP1_INTP1 IRQ_SPI(113)
328#define EXYNOS5_IRQ_CEC IRQ_SPI(114)
329#define EXYNOS5_IRQ_SATA IRQ_SPI(115)
330
331#define EXYNOS5_IRQ_MMC44 IRQ_SPI(123)
332#define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124)
333#define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125)
334#define EXYNOS5_IRQ_FIMC_LITE1 IRQ_SPI(126)
335#define EXYNOS5_IRQ_RP_TIMER IRQ_SPI(127)
336
337/* EXYNOS5440 */
338
339#define EXYNOS5440_IRQ_UART0 IRQ_SPI(2)
340#define EXYNOS5440_IRQ_UART1 IRQ_SPI(3)
341
342#define EXYNOS5_IRQ_PMU COMBINER_IRQ(1, 2)
343
344#define EXYNOS5_IRQ_SYSMMU_GSC0_0 COMBINER_IRQ(2, 0)
345#define EXYNOS5_IRQ_SYSMMU_GSC0_1 COMBINER_IRQ(2, 1)
346#define EXYNOS5_IRQ_SYSMMU_GSC1_0 COMBINER_IRQ(2, 2)
347#define EXYNOS5_IRQ_SYSMMU_GSC1_1 COMBINER_IRQ(2, 3)
348#define EXYNOS5_IRQ_SYSMMU_GSC2_0 COMBINER_IRQ(2, 4)
349#define EXYNOS5_IRQ_SYSMMU_GSC2_1 COMBINER_IRQ(2, 5)
350#define EXYNOS5_IRQ_SYSMMU_GSC3_0 COMBINER_IRQ(2, 6)
351#define EXYNOS5_IRQ_SYSMMU_GSC3_1 COMBINER_IRQ(2, 7)
352
353#define EXYNOS5_IRQ_SYSMMU_LITE2_0 COMBINER_IRQ(3, 0)
354#define EXYNOS5_IRQ_SYSMMU_LITE2_1 COMBINER_IRQ(3, 1)
355#define EXYNOS5_IRQ_SYSMMU_FIMD1_0 COMBINER_IRQ(3, 2)
356#define EXYNOS5_IRQ_SYSMMU_FIMD1_1 COMBINER_IRQ(3, 3)
357#define EXYNOS5_IRQ_SYSMMU_LITE0_0 COMBINER_IRQ(3, 4)
358#define EXYNOS5_IRQ_SYSMMU_LITE0_1 COMBINER_IRQ(3, 5)
359#define EXYNOS5_IRQ_SYSMMU_SCALERPISP_0 COMBINER_IRQ(3, 6)
360#define EXYNOS5_IRQ_SYSMMU_SCALERPISP_1 COMBINER_IRQ(3, 7)
361
362#define EXYNOS5_IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(4, 0)
363#define EXYNOS5_IRQ_SYSMMU_ROTATOR_1 COMBINER_IRQ(4, 1)
364#define EXYNOS5_IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 2)
365#define EXYNOS5_IRQ_SYSMMU_JPEG_1 COMBINER_IRQ(4, 3)
366
367#define EXYNOS5_IRQ_SYSMMU_FD_0 COMBINER_IRQ(5, 0)
368#define EXYNOS5_IRQ_SYSMMU_FD_1 COMBINER_IRQ(5, 1)
369#define EXYNOS5_IRQ_SYSMMU_SCALERCISP_0 COMBINER_IRQ(5, 2)
370#define EXYNOS5_IRQ_SYSMMU_SCALERCISP_1 COMBINER_IRQ(5, 3)
371#define EXYNOS5_IRQ_SYSMMU_MCUISP_0 COMBINER_IRQ(5, 4)
372#define EXYNOS5_IRQ_SYSMMU_MCUISP_1 COMBINER_IRQ(5, 5)
373#define EXYNOS5_IRQ_SYSMMU_3DNR_0 COMBINER_IRQ(5, 6)
374#define EXYNOS5_IRQ_SYSMMU_3DNR_1 COMBINER_IRQ(5, 7)
375
376#define EXYNOS5_IRQ_SYSMMU_ARM_0 COMBINER_IRQ(6, 0)
377#define EXYNOS5_IRQ_SYSMMU_ARM_1 COMBINER_IRQ(6, 1)
378#define EXYNOS5_IRQ_SYSMMU_MFC_R_0 COMBINER_IRQ(6, 2)
379#define EXYNOS5_IRQ_SYSMMU_MFC_R_1 COMBINER_IRQ(6, 3)
380#define EXYNOS5_IRQ_SYSMMU_RTIC_0 COMBINER_IRQ(6, 4)
381#define EXYNOS5_IRQ_SYSMMU_RTIC_1 COMBINER_IRQ(6, 5)
382#define EXYNOS5_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(6, 6)
383#define EXYNOS5_IRQ_SYSMMU_SSS_1 COMBINER_IRQ(6, 7)
384
385#define EXYNOS5_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(7, 0)
386#define EXYNOS5_IRQ_SYSMMU_MDMA0_1 COMBINER_IRQ(7, 1)
387#define EXYNOS5_IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(7, 2)
388#define EXYNOS5_IRQ_SYSMMU_MDMA1_1 COMBINER_IRQ(7, 3)
389#define EXYNOS5_IRQ_SYSMMU_TV_0 COMBINER_IRQ(7, 4)
390#define EXYNOS5_IRQ_SYSMMU_TV_1 COMBINER_IRQ(7, 5)
391
392#define EXYNOS5_IRQ_SYSMMU_MFC_L_0 COMBINER_IRQ(8, 5)
393#define EXYNOS5_IRQ_SYSMMU_MFC_L_1 COMBINER_IRQ(8, 6)
394
395#define EXYNOS5_IRQ_SYSMMU_DIS1_0 COMBINER_IRQ(9, 4)
396#define EXYNOS5_IRQ_SYSMMU_DIS1_1 COMBINER_IRQ(9, 5)
397
398#define EXYNOS5_IRQ_DP COMBINER_IRQ(10, 3)
399#define EXYNOS5_IRQ_SYSMMU_DIS0_0 COMBINER_IRQ(10, 4)
400#define EXYNOS5_IRQ_SYSMMU_DIS0_1 COMBINER_IRQ(10, 5)
401#define EXYNOS5_IRQ_SYSMMU_ISP_0 COMBINER_IRQ(10, 6)
402#define EXYNOS5_IRQ_SYSMMU_ISP_1 COMBINER_IRQ(10, 7)
403
404#define EXYNOS5_IRQ_SYSMMU_ODC_0 COMBINER_IRQ(11, 0)
405#define EXYNOS5_IRQ_SYSMMU_ODC_1 COMBINER_IRQ(11, 1)
406#define EXYNOS5_IRQ_SYSMMU_DRC_0 COMBINER_IRQ(11, 6)
407#define EXYNOS5_IRQ_SYSMMU_DRC_1 COMBINER_IRQ(11, 7)
408
409#define EXYNOS5_IRQ_MDMA1_ABORT COMBINER_IRQ(13, 1)
410
411#define EXYNOS5_IRQ_MDMA0_ABORT COMBINER_IRQ(15, 3)
412
413#define EXYNOS5_IRQ_FIMD1_FIFO COMBINER_IRQ(18, 4)
414#define EXYNOS5_IRQ_FIMD1_VSYNC COMBINER_IRQ(18, 5)
415#define EXYNOS5_IRQ_FIMD1_SYSTEM COMBINER_IRQ(18, 6)
416
417#define EXYNOS5_IRQ_ARMIOP_GIC COMBINER_IRQ(19, 0)
418#define EXYNOS5_IRQ_ARMISP_GIC COMBINER_IRQ(19, 1)
419#define EXYNOS5_IRQ_IOP_GIC COMBINER_IRQ(19, 3)
420#define EXYNOS5_IRQ_ISP_GIC COMBINER_IRQ(19, 4)
421
422#define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(22, 4)
423
424#define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0)
425
426#define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0)
427#define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1)
428#define EXYNOS5_IRQ_SYSMMU_LITE1_1 COMBINER_IRQ(24, 2)
429#define EXYNOS5_IRQ_SYSMMU_2D_0 COMBINER_IRQ(24, 5)
430#define EXYNOS5_IRQ_SYSMMU_2D_1 COMBINER_IRQ(24, 6)
431
432#define EXYNOS5_IRQ_EINT2 COMBINER_IRQ(25, 0)
433#define EXYNOS5_IRQ_EINT3 COMBINER_IRQ(25, 1)
434
435#define EXYNOS5_IRQ_EINT4 COMBINER_IRQ(26, 0)
436#define EXYNOS5_IRQ_EINT5 COMBINER_IRQ(26, 1)
437
438#define EXYNOS5_IRQ_EINT6 COMBINER_IRQ(27, 0)
439#define EXYNOS5_IRQ_EINT7 COMBINER_IRQ(27, 1)
440
441#define EXYNOS5_IRQ_EINT8 COMBINER_IRQ(28, 0)
442#define EXYNOS5_IRQ_EINT9 COMBINER_IRQ(28, 1)
443
444#define EXYNOS5_IRQ_EINT10 COMBINER_IRQ(29, 0)
445#define EXYNOS5_IRQ_EINT11 COMBINER_IRQ(29, 1)
446
447#define EXYNOS5_IRQ_EINT12 COMBINER_IRQ(30, 0)
448#define EXYNOS5_IRQ_EINT13 COMBINER_IRQ(30, 1)
449
450#define EXYNOS5_IRQ_EINT14 COMBINER_IRQ(31, 0)
451#define EXYNOS5_IRQ_EINT15 COMBINER_IRQ(31, 1)
452
453#define EXYNOS5_MAX_COMBINER_NR 32
454
455#define EXYNOS5_IRQ_GPIO1_NR_GROUPS 14
456#define EXYNOS5_IRQ_GPIO2_NR_GROUPS 9
457#define EXYNOS5_IRQ_GPIO3_NR_GROUPS 5
458#define EXYNOS5_IRQ_GPIO4_NR_GROUPS 1
459
460#define MAX_COMBINER_NR (EXYNOS4_MAX_COMBINER_NR > EXYNOS5_MAX_COMBINER_NR ? \
461 EXYNOS4_MAX_COMBINER_NR : EXYNOS5_MAX_COMBINER_NR)
462
463#define S5P_EINT_BASE1 COMBINER_IRQ(MAX_COMBINER_NR, 0)
464#define S5P_EINT_BASE2 (S5P_EINT_BASE1 + 16)
465#define S5P_GPIOINT_BASE (S5P_EINT_BASE1 + 32)
466#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT)
467#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64)
468
469/* Set the default NR_IRQS */
470#define EXYNOS_NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
471
472#ifndef CONFIG_SPARSE_IRQ
473#define NR_IRQS EXYNOS_NR_IRQS
474#endif
475
476#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 92b29bb583cb..7b046b59d9ec 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -30,31 +30,6 @@
30#define EXYNOS4x12_PA_SYSRAM_NS 0x0204F000 30#define EXYNOS4x12_PA_SYSRAM_NS 0x0204F000
31#define EXYNOS5250_PA_SYSRAM_NS 0x0204F000 31#define EXYNOS5250_PA_SYSRAM_NS 0x0204F000
32 32
33#define EXYNOS4_PA_FIMC0 0x11800000
34#define EXYNOS4_PA_FIMC1 0x11810000
35#define EXYNOS4_PA_FIMC2 0x11820000
36#define EXYNOS4_PA_FIMC3 0x11830000
37
38#define EXYNOS4_PA_JPEG 0x11840000
39
40/* x = 0...1 */
41#define EXYNOS4_PA_FIMC_LITE(x) (0x12390000 + ((x) * 0x10000))
42
43#define EXYNOS4_PA_G2D 0x12800000
44
45#define EXYNOS4_PA_I2S0 0x03830000
46#define EXYNOS4_PA_I2S1 0xE3100000
47#define EXYNOS4_PA_I2S2 0xE2A00000
48
49#define EXYNOS4_PA_PCM0 0x03840000
50#define EXYNOS4_PA_PCM1 0x13980000
51#define EXYNOS4_PA_PCM2 0x13990000
52
53#define EXYNOS4_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000))
54
55#define EXYNOS4_PA_ONENAND 0x0C000000
56#define EXYNOS4_PA_ONENAND_DMA 0x0C600000
57
58#define EXYNOS_PA_CHIPID 0x10000000 33#define EXYNOS_PA_CHIPID 0x10000000
59 34
60#define EXYNOS4_PA_SYSCON 0x10010000 35#define EXYNOS4_PA_SYSCON 0x10010000
@@ -71,10 +46,6 @@
71#define EXYNOS4_PA_WATCHDOG 0x10060000 46#define EXYNOS4_PA_WATCHDOG 0x10060000
72#define EXYNOS5_PA_WATCHDOG 0x101D0000 47#define EXYNOS5_PA_WATCHDOG 0x101D0000
73 48
74#define EXYNOS4_PA_RTC 0x10070000
75
76#define EXYNOS4_PA_KEYPAD 0x100A0000
77
78#define EXYNOS4_PA_DMC0 0x10400000 49#define EXYNOS4_PA_DMC0 0x10400000
79#define EXYNOS4_PA_DMC1 0x10410000 50#define EXYNOS4_PA_DMC1 0x10410000
80 51
@@ -87,207 +58,22 @@
87#define EXYNOS5_PA_GIC_DIST 0x10481000 58#define EXYNOS5_PA_GIC_DIST 0x10481000
88 59
89#define EXYNOS4_PA_COREPERI 0x10500000 60#define EXYNOS4_PA_COREPERI 0x10500000
90#define EXYNOS4_PA_TWD 0x10500600
91#define EXYNOS4_PA_L2CC 0x10502000 61#define EXYNOS4_PA_L2CC 0x10502000
92 62
93#define EXYNOS4_PA_TMU 0x100C0000
94
95#define EXYNOS4_PA_MDMA0 0x10810000
96#define EXYNOS4_PA_MDMA1 0x12850000
97#define EXYNOS4_PA_S_MDMA1 0x12840000
98#define EXYNOS4_PA_PDMA0 0x12680000
99#define EXYNOS4_PA_PDMA1 0x12690000
100#define EXYNOS5_PA_MDMA0 0x10800000
101#define EXYNOS5_PA_MDMA1 0x11C10000
102#define EXYNOS5_PA_PDMA0 0x121A0000
103#define EXYNOS5_PA_PDMA1 0x121B0000
104
105#define EXYNOS4_PA_SYSMMU_MDMA 0x10A40000
106#define EXYNOS4_PA_SYSMMU_2D_ACP 0x10A40000
107#define EXYNOS4_PA_SYSMMU_SSS 0x10A50000
108#define EXYNOS4_PA_SYSMMU_FIMC0 0x11A20000
109#define EXYNOS4_PA_SYSMMU_FIMC1 0x11A30000
110#define EXYNOS4_PA_SYSMMU_FIMC2 0x11A40000
111#define EXYNOS4_PA_SYSMMU_FIMC3 0x11A50000
112#define EXYNOS4_PA_SYSMMU_JPEG 0x11A60000
113#define EXYNOS4_PA_SYSMMU_FIMD0 0x11E20000
114#define EXYNOS4_PA_SYSMMU_FIMD1 0x12220000
115#define EXYNOS4_PA_SYSMMU_FIMC_ISP 0x12260000
116#define EXYNOS4_PA_SYSMMU_FIMC_DRC 0x12270000
117#define EXYNOS4_PA_SYSMMU_FIMC_FD 0x122A0000
118#define EXYNOS4_PA_SYSMMU_ISPCPU 0x122B0000
119#define EXYNOS4_PA_SYSMMU_FIMC_LITE0 0x123B0000
120#define EXYNOS4_PA_SYSMMU_FIMC_LITE1 0x123C0000
121#define EXYNOS4_PA_SYSMMU_PCIe 0x12620000
122#define EXYNOS4_PA_SYSMMU_G2D 0x12A20000
123#define EXYNOS4_PA_SYSMMU_ROTATOR 0x12A30000
124#define EXYNOS4_PA_SYSMMU_MDMA2 0x12A40000
125#define EXYNOS4_PA_SYSMMU_TV 0x12E20000
126#define EXYNOS4_PA_SYSMMU_MFC_L 0x13620000
127#define EXYNOS4_PA_SYSMMU_MFC_R 0x13630000
128
129#define EXYNOS5_PA_GSC0 0x13E00000
130#define EXYNOS5_PA_GSC1 0x13E10000
131#define EXYNOS5_PA_GSC2 0x13E20000
132#define EXYNOS5_PA_GSC3 0x13E30000
133
134#define EXYNOS5_PA_SYSMMU_MDMA1 0x10A40000
135#define EXYNOS5_PA_SYSMMU_SSS 0x10A50000
136#define EXYNOS5_PA_SYSMMU_2D 0x10A60000
137#define EXYNOS5_PA_SYSMMU_MFC_L 0x11200000
138#define EXYNOS5_PA_SYSMMU_MFC_R 0x11210000
139#define EXYNOS5_PA_SYSMMU_ROTATOR 0x11D40000
140#define EXYNOS5_PA_SYSMMU_MDMA2 0x11D50000
141#define EXYNOS5_PA_SYSMMU_JPEG 0x11F20000
142#define EXYNOS5_PA_SYSMMU_IOP 0x12360000
143#define EXYNOS5_PA_SYSMMU_RTIC 0x12370000
144#define EXYNOS5_PA_SYSMMU_ISP 0x13260000
145#define EXYNOS5_PA_SYSMMU_DRC 0x12370000
146#define EXYNOS5_PA_SYSMMU_SCALERC 0x13280000
147#define EXYNOS5_PA_SYSMMU_SCALERP 0x13290000
148#define EXYNOS5_PA_SYSMMU_FD 0x132A0000
149#define EXYNOS5_PA_SYSMMU_ISPCPU 0x132B0000
150#define EXYNOS5_PA_SYSMMU_ODC 0x132C0000
151#define EXYNOS5_PA_SYSMMU_DIS0 0x132D0000
152#define EXYNOS5_PA_SYSMMU_DIS1 0x132E0000
153#define EXYNOS5_PA_SYSMMU_3DNR 0x132F0000
154#define EXYNOS5_PA_SYSMMU_LITE0 0x13C40000
155#define EXYNOS5_PA_SYSMMU_LITE1 0x13C50000
156#define EXYNOS5_PA_SYSMMU_GSC0 0x13E80000
157#define EXYNOS5_PA_SYSMMU_GSC1 0x13E90000
158#define EXYNOS5_PA_SYSMMU_GSC2 0x13EA0000
159#define EXYNOS5_PA_SYSMMU_GSC3 0x13EB0000
160#define EXYNOS5_PA_SYSMMU_FIMD1 0x14640000
161#define EXYNOS5_PA_SYSMMU_TV 0x14650000
162
163#define EXYNOS4_PA_SPI0 0x13920000
164#define EXYNOS4_PA_SPI1 0x13930000
165#define EXYNOS4_PA_SPI2 0x13940000
166#define EXYNOS5_PA_SPI0 0x12D20000
167#define EXYNOS5_PA_SPI1 0x12D30000
168#define EXYNOS5_PA_SPI2 0x12D40000
169
170#define EXYNOS4_PA_GPIO1 0x11400000
171#define EXYNOS4_PA_GPIO2 0x11000000
172#define EXYNOS4_PA_GPIO3 0x03860000
173#define EXYNOS5_PA_GPIO1 0x11400000
174#define EXYNOS5_PA_GPIO2 0x13400000
175#define EXYNOS5_PA_GPIO3 0x10D10000
176#define EXYNOS5_PA_GPIO4 0x03860000
177
178#define EXYNOS4_PA_MIPI_CSIS0 0x11880000
179#define EXYNOS4_PA_MIPI_CSIS1 0x11890000
180
181#define EXYNOS4_PA_FIMD0 0x11C00000
182
183#define EXYNOS4_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
184#define EXYNOS4_PA_DWMCI 0x12550000
185#define EXYNOS5_PA_DWMCI0 0x12200000
186#define EXYNOS5_PA_DWMCI1 0x12210000
187#define EXYNOS5_PA_DWMCI2 0x12220000
188#define EXYNOS5_PA_DWMCI3 0x12230000
189
190#define EXYNOS4_PA_HSOTG 0x12480000
191#define EXYNOS4_PA_USB_HSPHY 0x125B0000
192
193#define EXYNOS4_PA_SATA 0x12560000
194#define EXYNOS4_PA_SATAPHY 0x125D0000
195#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000
196
197#define EXYNOS4_PA_SROMC 0x12570000 63#define EXYNOS4_PA_SROMC 0x12570000
198#define EXYNOS5_PA_SROMC 0x12250000 64#define EXYNOS5_PA_SROMC 0x12250000
199 65
200#define EXYNOS4_PA_EHCI 0x12580000
201#define EXYNOS4_PA_OHCI 0x12590000
202#define EXYNOS4_PA_HSPHY 0x125B0000 66#define EXYNOS4_PA_HSPHY 0x125B0000
203#define EXYNOS4_PA_MFC 0x13400000
204 67
205#define EXYNOS4_PA_UART 0x13800000 68#define EXYNOS4_PA_UART 0x13800000
206#define EXYNOS5_PA_UART 0x12C00000 69#define EXYNOS5_PA_UART 0x12C00000
207 70
208#define EXYNOS4_PA_VP 0x12C00000
209#define EXYNOS4_PA_MIXER 0x12C10000
210#define EXYNOS4_PA_SDO 0x12C20000
211#define EXYNOS4_PA_HDMI 0x12D00000
212#define EXYNOS4_PA_IIC_HDMIPHY 0x138E0000
213
214#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
215#define EXYNOS5_PA_IIC(x) (0x12C60000 + ((x) * 0x10000))
216
217#define EXYNOS4_PA_ADC 0x13910000
218#define EXYNOS4_PA_ADC1 0x13911000
219
220#define EXYNOS4_PA_AC97 0x139A0000
221
222#define EXYNOS4_PA_SPDIF 0x139B0000
223
224#define EXYNOS4_PA_TIMER 0x139D0000 71#define EXYNOS4_PA_TIMER 0x139D0000
225#define EXYNOS5_PA_TIMER 0x12DD0000 72#define EXYNOS5_PA_TIMER 0x12DD0000
226 73
227#define EXYNOS4_PA_SDRAM 0x40000000
228#define EXYNOS5_PA_SDRAM 0x40000000
229
230/* Compatibiltiy Defines */
231
232#define S3C_PA_HSMMC0 EXYNOS4_PA_HSMMC(0)
233#define S3C_PA_HSMMC1 EXYNOS4_PA_HSMMC(1)
234#define S3C_PA_HSMMC2 EXYNOS4_PA_HSMMC(2)
235#define S3C_PA_HSMMC3 EXYNOS4_PA_HSMMC(3)
236#define S3C_PA_IIC EXYNOS4_PA_IIC(0)
237#define S3C_PA_IIC1 EXYNOS4_PA_IIC(1)
238#define S3C_PA_IIC2 EXYNOS4_PA_IIC(2)
239#define S3C_PA_IIC3 EXYNOS4_PA_IIC(3)
240#define S3C_PA_IIC4 EXYNOS4_PA_IIC(4)
241#define S3C_PA_IIC5 EXYNOS4_PA_IIC(5)
242#define S3C_PA_IIC6 EXYNOS4_PA_IIC(6)
243#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7)
244#define S3C_PA_RTC EXYNOS4_PA_RTC
245#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG
246#define S3C_PA_SPI0 EXYNOS4_PA_SPI0
247#define S3C_PA_SPI1 EXYNOS4_PA_SPI1
248#define S3C_PA_SPI2 EXYNOS4_PA_SPI2
249#define S3C_PA_USB_HSOTG EXYNOS4_PA_HSOTG
250
251#define S5P_PA_EHCI EXYNOS4_PA_EHCI
252#define S5P_PA_FIMC0 EXYNOS4_PA_FIMC0
253#define S5P_PA_FIMC1 EXYNOS4_PA_FIMC1
254#define S5P_PA_FIMC2 EXYNOS4_PA_FIMC2
255#define S5P_PA_FIMC3 EXYNOS4_PA_FIMC3
256#define S5P_PA_JPEG EXYNOS4_PA_JPEG
257#define S5P_PA_G2D EXYNOS4_PA_G2D
258#define S5P_PA_FIMD0 EXYNOS4_PA_FIMD0
259#define S5P_PA_HDMI EXYNOS4_PA_HDMI
260#define S5P_PA_IIC_HDMIPHY EXYNOS4_PA_IIC_HDMIPHY
261#define S5P_PA_MFC EXYNOS4_PA_MFC
262#define S5P_PA_MIPI_CSIS0 EXYNOS4_PA_MIPI_CSIS0
263#define S5P_PA_MIPI_CSIS1 EXYNOS4_PA_MIPI_CSIS1
264#define S5P_PA_MIXER EXYNOS4_PA_MIXER
265#define S5P_PA_ONENAND EXYNOS4_PA_ONENAND
266#define S5P_PA_ONENAND_DMA EXYNOS4_PA_ONENAND_DMA
267#define S5P_PA_SDO EXYNOS4_PA_SDO
268#define S5P_PA_SDRAM EXYNOS4_PA_SDRAM
269#define S5P_PA_VP EXYNOS4_PA_VP
270
271#define SAMSUNG_PA_ADC EXYNOS4_PA_ADC
272#define SAMSUNG_PA_ADC1 EXYNOS4_PA_ADC1
273#define SAMSUNG_PA_KEYPAD EXYNOS4_PA_KEYPAD
274
275/* Compatibility UART */ 74/* Compatibility UART */
276 75
277#define EXYNOS4_PA_UART0 0x13800000
278#define EXYNOS4_PA_UART1 0x13810000
279#define EXYNOS4_PA_UART2 0x13820000
280#define EXYNOS4_PA_UART3 0x13830000
281#define EXYNOS4_SZ_UART SZ_256
282
283#define EXYNOS5_PA_UART0 0x12C00000
284#define EXYNOS5_PA_UART1 0x12C10000
285#define EXYNOS5_PA_UART2 0x12C20000
286#define EXYNOS5_PA_UART3 0x12C30000
287
288#define EXYNOS5440_PA_UART0 0x000B0000 76#define EXYNOS5440_PA_UART0 0x000B0000
289#define EXYNOS5440_PA_UART1 0x000C0000
290#define EXYNOS5440_SZ_UART SZ_256
291 77
292#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 78#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
293 79
diff --git a/arch/arm/mach-exynos/include/mach/pm-core.h b/arch/arm/mach-exynos/include/mach/pm-core.h
index 296090e7f423..2b00833b6641 100644
--- a/arch/arm/mach-exynos/include/mach/pm-core.h
+++ b/arch/arm/mach-exynos/include/mach/pm-core.h
@@ -34,12 +34,7 @@ static inline void s3c_pm_debug_init_uart(void)
34 34
35static inline void s3c_pm_arch_prepare_irqs(void) 35static inline void s3c_pm_arch_prepare_irqs(void)
36{ 36{
37 u32 eintmask = s3c_irqwake_eintmask; 37 __raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
38
39 if (of_have_populated_dt())
40 eintmask = exynos_get_eint_wake_mask();
41
42 __raw_writel(eintmask, S5P_EINT_WAKEUP_MASK);
43 __raw_writel(s3c_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK); 38 __raw_writel(s3c_irqwake_intmask & ~(1 << 31), S5P_WAKEUP_MASK);
44} 39}
45 40
@@ -69,4 +64,9 @@ static inline void samsung_pm_saved_gpios(void)
69 /* nothing here yet */ 64 /* nothing here yet */
70} 65}
71 66
67/* Compatibility definitions to make plat-samsung/pm.c compile */
68#define IRQ_EINT_BIT(x) 1
69#define s3c_irqwake_intallow 0
70#define s3c_irqwake_eintallow 0
71
72#endif /* __ASM_ARCH_PM_CORE_H */ 72#endif /* __ASM_ARCH_PM_CORE_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-gpio.h b/arch/arm/mach-exynos/include/mach/regs-gpio.h
deleted file mode 100644
index e4b5b60dcb85..000000000000
--- a/arch/arm/mach-exynos/include/mach/regs-gpio.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/regs-gpio.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - 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#include <mach/irqs.h>
18
19#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
20#define EINT_CON(b, x) (b + 0xE00 + (EINT_REG_NR(x) * 4))
21#define EINT_FLTCON(b, x) (b + 0xE80 + (EINT_REG_NR(x) * 4))
22#define EINT_MASK(b, x) (b + 0xF00 + (EINT_REG_NR(x) * 4))
23#define EINT_PEND(b, x) (b + 0xF40 + (EINT_REG_NR(x) * 4))
24
25#define EINT_OFFSET_BIT(x) (1 << (EINT_OFFSET(x) & 0x7))
26
27/* compatibility for plat-s5p/irq-pm.c */
28#define EXYNOS4_EINT40CON (S5P_VA_GPIO2 + 0xE00)
29#define S5P_EINT_CON(x) (EXYNOS4_EINT40CON + ((x) * 0x4))
30
31#define EXYNOS4_EINT40FLTCON0 (S5P_VA_GPIO2 + 0xE80)
32#define S5P_EINT_FLTCON(x) (EXYNOS4_EINT40FLTCON0 + ((x) * 0x4))
33
34#define EXYNOS4_EINT40MASK (S5P_VA_GPIO2 + 0xF00)
35#define S5P_EINT_MASK(x) (EXYNOS4_EINT40MASK + ((x) * 0x4))
36
37#define EXYNOS4_EINT40PEND (S5P_VA_GPIO2 + 0xF40)
38#define S5P_EINT_PEND(x) (EXYNOS4_EINT40PEND + ((x) * 0x4))
39
40#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-usb-phy.h b/arch/arm/mach-exynos/include/mach/regs-usb-phy.h
deleted file mode 100644
index 07277735252e..000000000000
--- a/arch/arm/mach-exynos/include/mach/regs-usb-phy.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * Copyright (C) 2011 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 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 __PLAT_S5P_REGS_USB_PHY_H
12#define __PLAT_S5P_REGS_USB_PHY_H
13
14#define EXYNOS4_HSOTG_PHYREG(x) ((x) + S3C_VA_USB_HSPHY)
15
16#define EXYNOS4_PHYPWR EXYNOS4_HSOTG_PHYREG(0x00)
17#define PHY1_HSIC_NORMAL_MASK (0xf << 9)
18#define PHY1_HSIC1_SLEEP (1 << 12)
19#define PHY1_HSIC1_FORCE_SUSPEND (1 << 11)
20#define PHY1_HSIC0_SLEEP (1 << 10)
21#define PHY1_HSIC0_FORCE_SUSPEND (1 << 9)
22
23#define PHY1_STD_NORMAL_MASK (0x7 << 6)
24#define PHY1_STD_SLEEP (1 << 8)
25#define PHY1_STD_ANALOG_POWERDOWN (1 << 7)
26#define PHY1_STD_FORCE_SUSPEND (1 << 6)
27
28#define PHY0_NORMAL_MASK (0x39 << 0)
29#define PHY0_SLEEP (1 << 5)
30#define PHY0_OTG_DISABLE (1 << 4)
31#define PHY0_ANALOG_POWERDOWN (1 << 3)
32#define PHY0_FORCE_SUSPEND (1 << 0)
33
34#define EXYNOS4_PHYCLK EXYNOS4_HSOTG_PHYREG(0x04)
35#define PHY1_COMMON_ON_N (1 << 7)
36#define PHY0_COMMON_ON_N (1 << 4)
37#define PHY0_ID_PULLUP (1 << 2)
38
39#define EXYNOS4_CLKSEL_SHIFT (0)
40
41#define EXYNOS4210_CLKSEL_MASK (0x3 << 0)
42#define EXYNOS4210_CLKSEL_48M (0x0 << 0)
43#define EXYNOS4210_CLKSEL_12M (0x2 << 0)
44#define EXYNOS4210_CLKSEL_24M (0x3 << 0)
45
46#define EXYNOS4X12_CLKSEL_MASK (0x7 << 0)
47#define EXYNOS4X12_CLKSEL_9600K (0x0 << 0)
48#define EXYNOS4X12_CLKSEL_10M (0x1 << 0)
49#define EXYNOS4X12_CLKSEL_12M (0x2 << 0)
50#define EXYNOS4X12_CLKSEL_19200K (0x3 << 0)
51#define EXYNOS4X12_CLKSEL_20M (0x4 << 0)
52#define EXYNOS4X12_CLKSEL_24M (0x5 << 0)
53
54#define EXYNOS4_RSTCON EXYNOS4_HSOTG_PHYREG(0x08)
55#define HOST_LINK_PORT_SWRST_MASK (0xf << 6)
56#define HOST_LINK_PORT2_SWRST (1 << 9)
57#define HOST_LINK_PORT1_SWRST (1 << 8)
58#define HOST_LINK_PORT0_SWRST (1 << 7)
59#define HOST_LINK_ALL_SWRST (1 << 6)
60
61#define PHY1_SWRST_MASK (0x7 << 3)
62#define PHY1_HSIC_SWRST (1 << 5)
63#define PHY1_STD_SWRST (1 << 4)
64#define PHY1_ALL_SWRST (1 << 3)
65
66#define PHY0_SWRST_MASK (0x7 << 0)
67#define PHY0_PHYLINK_SWRST (1 << 2)
68#define PHY0_HLINK_SWRST (1 << 1)
69#define PHY0_SWRST (1 << 0)
70
71#define EXYNOS4_PHY1CON EXYNOS4_HSOTG_PHYREG(0x34)
72#define FPENABLEN (1 << 0)
73
74#endif /* __PLAT_S5P_REGS_USB_PHY_H */
diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h
index 2979995d5a6a..5d7ce36be46f 100644
--- a/arch/arm/mach-exynos/include/mach/uncompress.h
+++ b/arch/arm/mach-exynos/include/mach/uncompress.h
@@ -15,9 +15,6 @@
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16 16
17#include <mach/map.h> 17#include <mach/map.h>
18
19volatile u8 *uart_base;
20
21#include <plat/uncompress.h> 18#include <plat/uncompress.h>
22 19
23static unsigned int __raw_readl(unsigned int ptr) 20static unsigned int __raw_readl(unsigned int ptr)
@@ -31,13 +28,12 @@ static void arch_detect_cpu(void)
31 28
32 /* 29 /*
33 * product_id is bits 31:12 30 * product_id is bits 31:12
34 * bits 23:20 describe the exynosX family 31 * bits 23:20 describe the exynosX family
35 * 32 * bits 27:24 describe the exynosX family in exynos5420
36 */ 33 */
37 chip_id >>= 20; 34 chip_id >>= 20;
38 chip_id &= 0xf;
39 35
40 if (chip_id == 0x5) 36 if ((chip_id & 0x0f) == 0x5 || (chip_id & 0xf0) == 0x50)
41 uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); 37 uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
42 else 38 else
43 uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT); 39 uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
diff --git a/arch/arm/mach-exynos/mach-armlex4210.c b/arch/arm/mach-exynos/mach-armlex4210.c
deleted file mode 100644
index 5f0f55701374..000000000000
--- a/arch/arm/mach-exynos/mach-armlex4210.c
+++ /dev/null
@@ -1,207 +0,0 @@
1/* linux/arch/arm/mach-exynos4/mach-armlex4210.c
2 *
3 * Copyright (c) 2011 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/gpio.h>
12#include <linux/io.h>
13#include <linux/mmc/host.h>
14#include <linux/platform_device.h>
15#include <linux/serial_core.h>
16#include <linux/smsc911x.h>
17
18#include <asm/mach/arch.h>
19#include <asm/mach-types.h>
20
21#include <plat/cpu.h>
22#include <plat/devs.h>
23#include <plat/gpio-cfg.h>
24#include <plat/regs-serial.h>
25#include <plat/regs-srom.h>
26#include <plat/sdhci.h>
27
28#include <mach/irqs.h>
29#include <mach/map.h>
30
31#include "common.h"
32
33/* Following are default values for UCON, ULCON and UFCON UART registers */
34#define ARMLEX4210_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 ARMLEX4210_ULCON_DEFAULT S3C2410_LCON_CS8
42
43#define ARMLEX4210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
44 S5PV210_UFCON_TXTRIG4 | \
45 S5PV210_UFCON_RXTRIG4)
46
47static struct s3c2410_uartcfg armlex4210_uartcfgs[] __initdata = {
48 [0] = {
49 .hwport = 0,
50 .flags = 0,
51 .ucon = ARMLEX4210_UCON_DEFAULT,
52 .ulcon = ARMLEX4210_ULCON_DEFAULT,
53 .ufcon = ARMLEX4210_UFCON_DEFAULT,
54 },
55 [1] = {
56 .hwport = 1,
57 .flags = 0,
58 .ucon = ARMLEX4210_UCON_DEFAULT,
59 .ulcon = ARMLEX4210_ULCON_DEFAULT,
60 .ufcon = ARMLEX4210_UFCON_DEFAULT,
61 },
62 [2] = {
63 .hwport = 2,
64 .flags = 0,
65 .ucon = ARMLEX4210_UCON_DEFAULT,
66 .ulcon = ARMLEX4210_ULCON_DEFAULT,
67 .ufcon = ARMLEX4210_UFCON_DEFAULT,
68 },
69 [3] = {
70 .hwport = 3,
71 .flags = 0,
72 .ucon = ARMLEX4210_UCON_DEFAULT,
73 .ulcon = ARMLEX4210_ULCON_DEFAULT,
74 .ufcon = ARMLEX4210_UFCON_DEFAULT,
75 },
76};
77
78static struct s3c_sdhci_platdata armlex4210_hsmmc0_pdata __initdata = {
79 .cd_type = S3C_SDHCI_CD_PERMANENT,
80#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
81 .max_width = 8,
82 .host_caps = MMC_CAP_8_BIT_DATA,
83#endif
84};
85
86static struct s3c_sdhci_platdata armlex4210_hsmmc2_pdata __initdata = {
87 .cd_type = S3C_SDHCI_CD_GPIO,
88 .ext_cd_gpio = EXYNOS4_GPX2(5),
89 .ext_cd_gpio_invert = 1,
90 .max_width = 4,
91};
92
93static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = {
94 .cd_type = S3C_SDHCI_CD_PERMANENT,
95 .max_width = 4,
96};
97
98static void __init armlex4210_sdhci_init(void)
99{
100 s3c_sdhci0_set_platdata(&armlex4210_hsmmc0_pdata);
101 s3c_sdhci2_set_platdata(&armlex4210_hsmmc2_pdata);
102 s3c_sdhci3_set_platdata(&armlex4210_hsmmc3_pdata);
103}
104
105static void __init armlex4210_wlan_init(void)
106{
107 /* enable */
108 s3c_gpio_cfgpin(EXYNOS4_GPX2(0), S3C_GPIO_SFN(0xf));
109 s3c_gpio_setpull(EXYNOS4_GPX2(0), S3C_GPIO_PULL_UP);
110
111 /* reset */
112 s3c_gpio_cfgpin(EXYNOS4_GPX1(6), S3C_GPIO_SFN(0xf));
113 s3c_gpio_setpull(EXYNOS4_GPX1(6), S3C_GPIO_PULL_UP);
114
115 /* wakeup */
116 s3c_gpio_cfgpin(EXYNOS4_GPX1(5), S3C_GPIO_SFN(0xf));
117 s3c_gpio_setpull(EXYNOS4_GPX1(5), S3C_GPIO_PULL_UP);
118}
119
120static struct resource armlex4210_smsc911x_resources[] = {
121 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(3), SZ_64K),
122 [1] = DEFINE_RES_NAMED(IRQ_EINT(27), 1, NULL, IORESOURCE_IRQ \
123 | IRQF_TRIGGER_HIGH),
124};
125
126static struct smsc911x_platform_config smsc9215_config = {
127 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
128 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
129 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
130 .phy_interface = PHY_INTERFACE_MODE_MII,
131 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
132};
133
134static struct platform_device armlex4210_smsc911x = {
135 .name = "smsc911x",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(armlex4210_smsc911x_resources),
138 .resource = armlex4210_smsc911x_resources,
139 .dev = {
140 .platform_data = &smsc9215_config,
141 },
142};
143
144static struct platform_device *armlex4210_devices[] __initdata = {
145 &s3c_device_hsmmc0,
146 &s3c_device_hsmmc2,
147 &s3c_device_hsmmc3,
148 &s3c_device_rtc,
149 &s3c_device_wdt,
150 &armlex4210_smsc911x,
151 &exynos4_device_ahci,
152};
153
154static void __init armlex4210_smsc911x_init(void)
155{
156 u32 cs1;
157
158 /* configure nCS1 width to 16 bits */
159 cs1 = __raw_readl(S5P_SROM_BW) &
160 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
161 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
162 (0 << S5P_SROM_BW__WAITENABLE__SHIFT) |
163 (1 << S5P_SROM_BW__ADDRMODE__SHIFT) |
164 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
165 S5P_SROM_BW__NCS1__SHIFT;
166 __raw_writel(cs1, S5P_SROM_BW);
167
168 /* set timing for nCS1 suitable for ethernet chip */
169 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
170 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
171 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
172 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
173 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
174 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
175 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
176}
177
178static void __init armlex4210_map_io(void)
179{
180 exynos_init_io(NULL, 0);
181 s3c24xx_init_uarts(armlex4210_uartcfgs,
182 ARRAY_SIZE(armlex4210_uartcfgs));
183}
184
185static void __init armlex4210_machine_init(void)
186{
187 armlex4210_smsc911x_init();
188
189 armlex4210_sdhci_init();
190
191 armlex4210_wlan_init();
192
193 platform_add_devices(armlex4210_devices,
194 ARRAY_SIZE(armlex4210_devices));
195}
196
197MACHINE_START(ARMLEX4210, "ARMLEX4210")
198 /* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */
199 .atag_offset = 0x100,
200 .smp = smp_ops(exynos_smp_ops),
201 .init_irq = exynos4_init_irq,
202 .map_io = armlex4210_map_io,
203 .init_machine = armlex4210_machine_init,
204 .init_late = exynos_init_late,
205 .init_time = exynos_init_time,
206 .restart = exynos4_restart,
207MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index b9ed834a7eee..0099c6c13bba 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -23,11 +23,6 @@
23 23
24#include "common.h" 24#include "common.h"
25 25
26static void __init exynos4_dt_map_io(void)
27{
28 exynos_init_io(NULL, 0);
29}
30
31static void __init exynos4_dt_machine_init(void) 26static void __init exynos4_dt_machine_init(void)
32{ 27{
33 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -55,8 +50,7 @@ static void __init exynos4_reserve(void)
55DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") 50DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)")
56 /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ 51 /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */
57 .smp = smp_ops(exynos_smp_ops), 52 .smp = smp_ops(exynos_smp_ops),
58 .init_irq = exynos4_init_irq, 53 .map_io = exynos_init_io,
59 .map_io = exynos4_dt_map_io,
60 .init_early = exynos_firmware_init, 54 .init_early = exynos_firmware_init,
61 .init_machine = exynos4_dt_machine_init, 55 .init_machine = exynos4_dt_machine_init,
62 .init_late = exynos_init_late, 56 .init_late = exynos_init_late,
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
index 753b94f3fca7..f874b773ca13 100644
--- a/arch/arm/mach-exynos/mach-exynos5-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -23,11 +23,6 @@
23 23
24#include "common.h" 24#include "common.h"
25 25
26static void __init exynos5_dt_map_io(void)
27{
28 exynos_init_io(NULL, 0);
29}
30
31static void __init exynos5_dt_machine_init(void) 26static void __init exynos5_dt_machine_init(void)
32{ 27{
33 struct device_node *i2c_np; 28 struct device_node *i2c_np;
@@ -57,6 +52,7 @@ static void __init exynos5_dt_machine_init(void)
57 52
58static char const *exynos5_dt_compat[] __initdata = { 53static char const *exynos5_dt_compat[] __initdata = {
59 "samsung,exynos5250", 54 "samsung,exynos5250",
55 "samsung,exynos5420",
60 "samsung,exynos5440", 56 "samsung,exynos5440",
61 NULL 57 NULL
62}; 58};
@@ -76,9 +72,8 @@ static void __init exynos5_reserve(void)
76 72
77DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") 73DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
78 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ 74 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
79 .init_irq = exynos5_init_irq,
80 .smp = smp_ops(exynos_smp_ops), 75 .smp = smp_ops(exynos_smp_ops),
81 .map_io = exynos5_dt_map_io, 76 .map_io = exynos_init_io,
82 .init_machine = exynos5_dt_machine_init, 77 .init_machine = exynos5_dt_machine_init,
83 .init_late = exynos_init_late, 78 .init_late = exynos_init_late,
84 .init_time = exynos_init_time, 79 .init_time = exynos_init_time,
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
deleted file mode 100644
index 5c8b2878dbbd..000000000000
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ /dev/null
@@ -1,1388 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/mach-nuri.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/platform_device.h>
12#include <linux/serial_core.h>
13#include <linux/input.h>
14#include <linux/i2c.h>
15#include <linux/i2c/atmel_mxt_ts.h>
16#include <linux/i2c-gpio.h>
17#include <linux/gpio_keys.h>
18#include <linux/gpio.h>
19#include <linux/power/max8903_charger.h>
20#include <linux/power/max17042_battery.h>
21#include <linux/regulator/machine.h>
22#include <linux/regulator/fixed.h>
23#include <linux/mfd/max8997.h>
24#include <linux/mfd/max8997-private.h>
25#include <linux/mmc/host.h>
26#include <linux/fb.h>
27#include <linux/pwm_backlight.h>
28#include <linux/platform_data/i2c-s3c2410.h>
29#include <linux/platform_data/mipi-csis.h>
30#include <linux/platform_data/s3c-hsotg.h>
31#include <linux/platform_data/usb-ehci-s5p.h>
32#include <drm/exynos_drm.h>
33
34#include <video/platform_lcd.h>
35#include <video/samsung_fimd.h>
36#include <media/m5mols.h>
37#include <media/s5k6aa.h>
38#include <media/s5p_fimc.h>
39#include <media/v4l2-mediabus.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach-types.h>
43
44#include <plat/adc.h>
45#include <plat/regs-serial.h>
46#include <plat/cpu.h>
47#include <plat/devs.h>
48#include <plat/fb.h>
49#include <plat/sdhci.h>
50#include <plat/clock.h>
51#include <plat/gpio-cfg.h>
52#include <plat/mfc.h>
53#include <plat/fimc-core.h>
54#include <plat/camport.h>
55
56#include <mach/irqs.h>
57#include <mach/map.h>
58
59#include "common.h"
60
61/* Following are default values for UCON, ULCON and UFCON UART registers */
62#define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
63 S3C2410_UCON_RXILEVEL | \
64 S3C2410_UCON_TXIRQMODE | \
65 S3C2410_UCON_RXIRQMODE | \
66 S3C2410_UCON_RXFIFO_TOI | \
67 S3C2443_UCON_RXERR_IRQEN)
68
69#define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
70
71#define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
72 S5PV210_UFCON_TXTRIG256 | \
73 S5PV210_UFCON_RXTRIG256)
74
75enum fixed_regulator_id {
76 FIXED_REG_ID_MMC = 0,
77 FIXED_REG_ID_MAX8903,
78 FIXED_REG_ID_CAM_A28V,
79 FIXED_REG_ID_CAM_12V,
80 FIXED_REG_ID_CAM_VT_15V,
81};
82
83static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
84 {
85 .hwport = 0,
86 .ucon = NURI_UCON_DEFAULT,
87 .ulcon = NURI_ULCON_DEFAULT,
88 .ufcon = NURI_UFCON_DEFAULT,
89 },
90 {
91 .hwport = 1,
92 .ucon = NURI_UCON_DEFAULT,
93 .ulcon = NURI_ULCON_DEFAULT,
94 .ufcon = NURI_UFCON_DEFAULT,
95 },
96 {
97 .hwport = 2,
98 .ucon = NURI_UCON_DEFAULT,
99 .ulcon = NURI_ULCON_DEFAULT,
100 .ufcon = NURI_UFCON_DEFAULT,
101 },
102 {
103 .hwport = 3,
104 .ucon = NURI_UCON_DEFAULT,
105 .ulcon = NURI_ULCON_DEFAULT,
106 .ufcon = NURI_UFCON_DEFAULT,
107 },
108};
109
110/* eMMC */
111static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
112 .max_width = 8,
113 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
114 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
115 MMC_CAP_ERASE),
116 .cd_type = S3C_SDHCI_CD_PERMANENT,
117};
118
119static struct regulator_consumer_supply emmc_supplies[] = {
120 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
121 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
122};
123
124static struct regulator_init_data emmc_fixed_voltage_init_data = {
125 .constraints = {
126 .name = "VMEM_VDD_2.8V",
127 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
128 },
129 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
130 .consumer_supplies = emmc_supplies,
131};
132
133static struct fixed_voltage_config emmc_fixed_voltage_config = {
134 .supply_name = "MASSMEMORY_EN (inverted)",
135 .microvolts = 2800000,
136 .gpio = EXYNOS4_GPL1(1),
137 .enable_high = false,
138 .init_data = &emmc_fixed_voltage_init_data,
139};
140
141static struct platform_device emmc_fixed_voltage = {
142 .name = "reg-fixed-voltage",
143 .id = FIXED_REG_ID_MMC,
144 .dev = {
145 .platform_data = &emmc_fixed_voltage_config,
146 },
147};
148
149/* SD */
150static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
151 .max_width = 4,
152 .host_caps = MMC_CAP_4_BIT_DATA |
153 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
154 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
155 .ext_cd_gpio_invert = 1,
156 .cd_type = S3C_SDHCI_CD_GPIO,
157};
158
159/* WLAN */
160static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
161 .max_width = 4,
162 .host_caps = MMC_CAP_4_BIT_DATA |
163 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
164 .cd_type = S3C_SDHCI_CD_EXTERNAL,
165};
166
167static void __init nuri_sdhci_init(void)
168{
169 s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
170 s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
171 s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
172}
173
174/* GPIO KEYS */
175static struct gpio_keys_button nuri_gpio_keys_tables[] = {
176 {
177 .code = KEY_VOLUMEUP,
178 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
179 .desc = "gpio-keys: KEY_VOLUMEUP",
180 .type = EV_KEY,
181 .active_low = 1,
182 .debounce_interval = 1,
183 }, {
184 .code = KEY_VOLUMEDOWN,
185 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
186 .desc = "gpio-keys: KEY_VOLUMEDOWN",
187 .type = EV_KEY,
188 .active_low = 1,
189 .debounce_interval = 1,
190 }, {
191 .code = KEY_POWER,
192 .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
193 .desc = "gpio-keys: KEY_POWER",
194 .type = EV_KEY,
195 .active_low = 1,
196 .wakeup = 1,
197 .debounce_interval = 1,
198 },
199};
200
201static struct gpio_keys_platform_data nuri_gpio_keys_data = {
202 .buttons = nuri_gpio_keys_tables,
203 .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
204};
205
206static struct platform_device nuri_gpio_keys = {
207 .name = "gpio-keys",
208 .dev = {
209 .platform_data = &nuri_gpio_keys_data,
210 },
211};
212
213#ifdef CONFIG_DRM_EXYNOS
214static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
215 .panel = {
216 .timing = {
217 .xres = 1024,
218 .yres = 600,
219 .hsync_len = 40,
220 .left_margin = 79,
221 .right_margin = 200,
222 .vsync_len = 10,
223 .upper_margin = 10,
224 .lower_margin = 11,
225 .refresh = 60,
226 },
227 },
228 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
229 VIDCON0_CLKSEL_LCD,
230 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
231 .default_win = 3,
232 .bpp = 32,
233};
234
235#else
236/* Frame Buffer */
237static struct s3c_fb_pd_win nuri_fb_win0 = {
238 .max_bpp = 24,
239 .default_bpp = 16,
240 .xres = 1024,
241 .yres = 600,
242 .virtual_x = 1024,
243 .virtual_y = 2 * 600,
244};
245
246static struct fb_videomode nuri_lcd_timing = {
247 .left_margin = 64,
248 .right_margin = 16,
249 .upper_margin = 64,
250 .lower_margin = 1,
251 .hsync_len = 48,
252 .vsync_len = 3,
253 .xres = 1024,
254 .yres = 600,
255 .refresh = 60,
256};
257
258static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
259 .win[0] = &nuri_fb_win0,
260 .vtiming = &nuri_lcd_timing,
261 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
262 VIDCON0_CLKSEL_LCD,
263 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
264 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
265};
266#endif
267
268static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
269{
270 int gpio = EXYNOS4_GPE1(5);
271
272 gpio_request(gpio, "LVDS_nSHDN");
273 gpio_direction_output(gpio, power);
274 gpio_free(gpio);
275}
276
277static int nuri_bl_init(struct device *dev)
278{
279 return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
280 "LCD_LD0_EN");
281}
282
283static int nuri_bl_notify(struct device *dev, int brightness)
284{
285 if (brightness < 1)
286 brightness = 0;
287
288 gpio_set_value(EXYNOS4_GPE2(3), 1);
289
290 return brightness;
291}
292
293static void nuri_bl_exit(struct device *dev)
294{
295 gpio_free(EXYNOS4_GPE2(3));
296}
297
298/* nuri pwm backlight */
299static struct platform_pwm_backlight_data nuri_backlight_data = {
300 .pwm_id = 0,
301 .pwm_period_ns = 30000,
302 .max_brightness = 100,
303 .dft_brightness = 50,
304 .init = nuri_bl_init,
305 .notify = nuri_bl_notify,
306 .exit = nuri_bl_exit,
307};
308
309static struct platform_device nuri_backlight_device = {
310 .name = "pwm-backlight",
311 .id = -1,
312 .dev = {
313 .parent = &s3c_device_timer[0].dev,
314 .platform_data = &nuri_backlight_data,
315 },
316};
317
318static struct plat_lcd_data nuri_lcd_platform_data = {
319 .set_power = nuri_lcd_power_on,
320};
321
322static struct platform_device nuri_lcd_device = {
323 .name = "platform-lcd",
324 .id = -1,
325 .dev = {
326 .platform_data = &nuri_lcd_platform_data,
327 },
328};
329
330/* I2C1 */
331static struct i2c_board_info i2c1_devs[] __initdata = {
332 /* Gyro, To be updated */
333};
334
335/* TSP */
336static struct mxt_platform_data mxt_platform_data = {
337 .x_line = 18,
338 .y_line = 11,
339 .x_size = 1024,
340 .y_size = 600,
341 .blen = 0x1,
342 .threshold = 0x28,
343 .voltage = 2800000, /* 2.8V */
344 .orient = MXT_DIAGONAL_COUNTER,
345 .irqflags = IRQF_TRIGGER_FALLING,
346};
347
348static struct s3c2410_platform_i2c i2c3_data __initdata = {
349 .flags = 0,
350 .bus_num = 3,
351 .slave_addr = 0x10,
352 .frequency = 400 * 1000,
353 .sda_delay = 100,
354};
355
356static struct i2c_board_info i2c3_devs[] __initdata = {
357 {
358 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
359 .platform_data = &mxt_platform_data,
360 .irq = IRQ_EINT(4),
361 },
362};
363
364static void __init nuri_tsp_init(void)
365{
366 int gpio;
367
368 /* TOUCH_INT: XEINT_4 */
369 gpio = EXYNOS4_GPX0(4);
370 gpio_request(gpio, "TOUCH_INT");
371 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
372 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
373}
374
375static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
376 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
377};
378static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
379 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
380 REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"), /* MIPI */
381};
382static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
383 REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"), /* MIPI */
384};
385static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
386 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
387};
388static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
389 REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
390};
391static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
392 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
393};
394static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
395 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
396 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
397};
398static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
399 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
400};
401static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
402 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
403};
404static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
405 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
406};
407static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
408 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
409};
410static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
411 REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
412};
413static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
414 REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
415};
416static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
417 REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
418};
419static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
420 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
421};
422static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
423 REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
424};
425static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
426 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
427};
428static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
429 REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
430};
431static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
432 REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
433};
434static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
435 REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
436};
437static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
438 REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
439};
440
441static struct regulator_consumer_supply __initdata max8997_charger_[] = {
442 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
443};
444static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
445 REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
446};
447
448static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
449 REGULATOR_SUPPLY("gps_clk", "bcm4751"),
450 REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
451 REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
452};
453
454static struct regulator_init_data __initdata max8997_ldo1_data = {
455 .constraints = {
456 .name = "VADC_3.3V_C210",
457 .min_uV = 3300000,
458 .max_uV = 3300000,
459 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
460 .apply_uV = 1,
461 .state_mem = {
462 .disabled = 1,
463 },
464 },
465 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
466 .consumer_supplies = max8997_ldo1_,
467};
468
469static struct regulator_init_data __initdata max8997_ldo2_data = {
470 .constraints = {
471 .name = "VALIVE_1.1V_C210",
472 .min_uV = 1100000,
473 .max_uV = 1100000,
474 .apply_uV = 1,
475 .always_on = 1,
476 .state_mem = {
477 .enabled = 1,
478 },
479 },
480};
481
482static struct regulator_init_data __initdata max8997_ldo3_data = {
483 .constraints = {
484 .name = "VUSB_1.1V_C210",
485 .min_uV = 1100000,
486 .max_uV = 1100000,
487 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
488 .apply_uV = 1,
489 .state_mem = {
490 .disabled = 1,
491 },
492 },
493 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
494 .consumer_supplies = max8997_ldo3_,
495};
496
497static struct regulator_init_data __initdata max8997_ldo4_data = {
498 .constraints = {
499 .name = "VMIPI_1.8V",
500 .min_uV = 1800000,
501 .max_uV = 1800000,
502 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
503 .apply_uV = 1,
504 .state_mem = {
505 .disabled = 1,
506 },
507 },
508 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
509 .consumer_supplies = max8997_ldo4_,
510};
511
512static struct regulator_init_data __initdata max8997_ldo5_data = {
513 .constraints = {
514 .name = "VHSIC_1.2V_C210",
515 .min_uV = 1200000,
516 .max_uV = 1200000,
517 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
518 .apply_uV = 1,
519 .state_mem = {
520 .disabled = 1,
521 },
522 },
523 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
524 .consumer_supplies = max8997_ldo5_,
525};
526
527static struct regulator_init_data __initdata max8997_ldo6_data = {
528 .constraints = {
529 .name = "VCC_1.8V_PDA",
530 .min_uV = 1800000,
531 .max_uV = 1800000,
532 .apply_uV = 1,
533 .always_on = 1,
534 .state_mem = {
535 .enabled = 1,
536 },
537 },
538 .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
539 .consumer_supplies = nuri_max8997_ldo6_consumer,
540};
541
542static struct regulator_init_data __initdata max8997_ldo7_data = {
543 .constraints = {
544 .name = "CAM_ISP_1.8V",
545 .min_uV = 1800000,
546 .max_uV = 1800000,
547 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
548 .apply_uV = 1,
549 .state_mem = {
550 .disabled = 1,
551 },
552 },
553 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
554 .consumer_supplies = max8997_ldo7_,
555};
556
557static struct regulator_init_data __initdata max8997_ldo8_data = {
558 .constraints = {
559 .name = "VUSB+VDAC_3.3V_C210",
560 .min_uV = 3300000,
561 .max_uV = 3300000,
562 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
563 .apply_uV = 1,
564 .state_mem = {
565 .disabled = 1,
566 },
567 },
568 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
569 .consumer_supplies = max8997_ldo8_,
570};
571
572static struct regulator_init_data __initdata max8997_ldo9_data = {
573 .constraints = {
574 .name = "VCC_2.8V_PDA",
575 .min_uV = 2800000,
576 .max_uV = 2800000,
577 .apply_uV = 1,
578 .always_on = 1,
579 .state_mem = {
580 .enabled = 1,
581 },
582 },
583};
584
585static struct regulator_init_data __initdata max8997_ldo10_data = {
586 .constraints = {
587 .name = "VPLL_1.1V_C210",
588 .min_uV = 1100000,
589 .max_uV = 1100000,
590 .apply_uV = 1,
591 .always_on = 1,
592 .state_mem = {
593 .disabled = 1,
594 },
595 },
596};
597
598static struct regulator_init_data __initdata max8997_ldo11_data = {
599 .constraints = {
600 .name = "LVDS_VDD3.3V",
601 .min_uV = 3300000,
602 .max_uV = 3300000,
603 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
604 .apply_uV = 1,
605 .boot_on = 1,
606 .state_mem = {
607 .disabled = 1,
608 },
609 },
610 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
611 .consumer_supplies = max8997_ldo11_,
612};
613
614static struct regulator_init_data __initdata max8997_ldo12_data = {
615 .constraints = {
616 .name = "VT_CAM_1.8V",
617 .min_uV = 1800000,
618 .max_uV = 1800000,
619 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
620 .apply_uV = 1,
621 .state_mem = {
622 .disabled = 1,
623 },
624 },
625 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
626 .consumer_supplies = max8997_ldo12_,
627};
628
629static struct regulator_init_data __initdata max8997_ldo13_data = {
630 .constraints = {
631 .name = "VTF_2.8V",
632 .min_uV = 2800000,
633 .max_uV = 2800000,
634 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
635 .apply_uV = 1,
636 .state_mem = {
637 .disabled = 1,
638 },
639 },
640 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
641 .consumer_supplies = max8997_ldo13_,
642};
643
644static struct regulator_init_data __initdata max8997_ldo14_data = {
645 .constraints = {
646 .name = "VCC_3.0V_MOTOR",
647 .min_uV = 3000000,
648 .max_uV = 3000000,
649 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
650 .apply_uV = 1,
651 .state_mem = {
652 .disabled = 1,
653 },
654 },
655 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
656 .consumer_supplies = max8997_ldo14_,
657};
658
659static struct regulator_init_data __initdata max8997_ldo15_data = {
660 .constraints = {
661 .name = "VTOUCH_ADVV2.8V",
662 .min_uV = 2800000,
663 .max_uV = 2800000,
664 .apply_uV = 1,
665 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
666 .state_mem = {
667 .disabled = 1,
668 },
669 },
670 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
671 .consumer_supplies = max8997_ldo15_,
672};
673
674static struct regulator_init_data __initdata max8997_ldo16_data = {
675 .constraints = {
676 .name = "CAM_SENSOR_IO_1.8V",
677 .min_uV = 1800000,
678 .max_uV = 1800000,
679 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
680 .apply_uV = 1,
681 .state_mem = {
682 .disabled = 1,
683 },
684 },
685 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
686 .consumer_supplies = max8997_ldo16_,
687};
688
689static struct regulator_init_data __initdata max8997_ldo18_data = {
690 .constraints = {
691 .name = "VTOUCH_VDD2.8V",
692 .min_uV = 2800000,
693 .max_uV = 2800000,
694 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
695 .apply_uV = 1,
696 .state_mem = {
697 .disabled = 1,
698 },
699 },
700 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
701 .consumer_supplies = max8997_ldo18_,
702};
703
704static struct regulator_init_data __initdata max8997_ldo21_data = {
705 .constraints = {
706 .name = "VDDQ_M1M2_1.2V",
707 .min_uV = 1200000,
708 .max_uV = 1200000,
709 .apply_uV = 1,
710 .always_on = 1,
711 .state_mem = {
712 .disabled = 1,
713 },
714 },
715};
716
717static struct regulator_init_data __initdata max8997_buck1_data = {
718 .constraints = {
719 .name = "VARM_1.2V_C210",
720 .min_uV = 900000,
721 .max_uV = 1350000,
722 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
723 .always_on = 1,
724 .state_mem = {
725 .disabled = 1,
726 },
727 },
728 .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
729 .consumer_supplies = max8997_buck1_,
730};
731
732static struct regulator_init_data __initdata max8997_buck2_data = {
733 .constraints = {
734 .name = "VINT_1.1V_C210",
735 .min_uV = 900000,
736 .max_uV = 1200000,
737 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
738 .always_on = 1,
739 .state_mem = {
740 .disabled = 1,
741 },
742 },
743 .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
744 .consumer_supplies = max8997_buck2_,
745};
746
747static struct regulator_init_data __initdata max8997_buck3_data = {
748 .constraints = {
749 .name = "VG3D_1.1V_C210",
750 .min_uV = 900000,
751 .max_uV = 1100000,
752 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
753 REGULATOR_CHANGE_STATUS,
754 .state_mem = {
755 .disabled = 1,
756 },
757 },
758 .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
759 .consumer_supplies = max8997_buck3_,
760};
761
762static struct regulator_init_data __initdata max8997_buck4_data = {
763 .constraints = {
764 .name = "CAM_ISP_CORE_1.2V",
765 .min_uV = 1200000,
766 .max_uV = 1200000,
767 .apply_uV = 1,
768 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
769 .state_mem = {
770 .disabled = 1,
771 },
772 },
773 .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
774 .consumer_supplies = max8997_buck4_,
775};
776
777static struct regulator_init_data __initdata max8997_buck5_data = {
778 .constraints = {
779 .name = "VMEM_1.2V_C210",
780 .min_uV = 1200000,
781 .max_uV = 1200000,
782 .apply_uV = 1,
783 .always_on = 1,
784 .state_mem = {
785 .enabled = 1,
786 },
787 },
788};
789
790static struct regulator_init_data __initdata max8997_buck6_data = {
791 .constraints = {
792 .name = "CAM_AF_2.8V",
793 .min_uV = 2800000,
794 .max_uV = 2800000,
795 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
796 .state_mem = {
797 .disabled = 1,
798 },
799 },
800 .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
801 .consumer_supplies = max8997_buck6_,
802};
803
804static struct regulator_init_data __initdata max8997_buck7_data = {
805 .constraints = {
806 .name = "VCC_SUB_2.0V",
807 .min_uV = 2000000,
808 .max_uV = 2000000,
809 .apply_uV = 1,
810 .always_on = 1,
811 .state_mem = {
812 .enabled = 1,
813 },
814 },
815};
816
817static struct regulator_init_data __initdata max8997_32khz_ap_data = {
818 .constraints = {
819 .name = "32KHz AP",
820 .always_on = 1,
821 .state_mem = {
822 .enabled = 1,
823 },
824 },
825 .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
826 .consumer_supplies = max8997_32khz_ap_,
827};
828
829static struct regulator_init_data __initdata max8997_32khz_cp_data = {
830 .constraints = {
831 .name = "32KHz CP",
832 .state_mem = {
833 .disabled = 1,
834 },
835 },
836};
837
838static struct regulator_init_data __initdata max8997_vichg_data = {
839 .constraints = {
840 .name = "VICHG",
841 .state_mem = {
842 .disabled = 1,
843 },
844 },
845};
846
847static struct regulator_init_data __initdata max8997_esafeout1_data = {
848 .constraints = {
849 .name = "SAFEOUT1",
850 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
851 .always_on = 1,
852 .state_mem = {
853 .disabled = 1,
854 },
855 },
856 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
857 .consumer_supplies = max8997_esafeout1_,
858};
859
860static struct regulator_init_data __initdata max8997_esafeout2_data = {
861 .constraints = {
862 .name = "SAFEOUT2",
863 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
864 .state_mem = {
865 .disabled = 1,
866 },
867 },
868 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
869 .consumer_supplies = max8997_esafeout2_,
870};
871
872static struct regulator_init_data __initdata max8997_charger_cv_data = {
873 .constraints = {
874 .name = "CHARGER_CV",
875 .min_uV = 4200000,
876 .max_uV = 4200000,
877 .apply_uV = 1,
878 },
879};
880
881static struct regulator_init_data __initdata max8997_charger_data = {
882 .constraints = {
883 .name = "CHARGER",
884 .min_uA = 200000,
885 .max_uA = 950000,
886 .boot_on = 1,
887 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
888 REGULATOR_CHANGE_CURRENT,
889 },
890 .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
891 .consumer_supplies = max8997_charger_,
892};
893
894static struct regulator_init_data __initdata max8997_charger_topoff_data = {
895 .constraints = {
896 .name = "CHARGER TOPOFF",
897 .min_uA = 50000,
898 .max_uA = 200000,
899 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
900 },
901 .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
902 .consumer_supplies = max8997_chg_toff_,
903};
904
905static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
906 { MAX8997_LDO1, &max8997_ldo1_data },
907 { MAX8997_LDO2, &max8997_ldo2_data },
908 { MAX8997_LDO3, &max8997_ldo3_data },
909 { MAX8997_LDO4, &max8997_ldo4_data },
910 { MAX8997_LDO5, &max8997_ldo5_data },
911 { MAX8997_LDO6, &max8997_ldo6_data },
912 { MAX8997_LDO7, &max8997_ldo7_data },
913 { MAX8997_LDO8, &max8997_ldo8_data },
914 { MAX8997_LDO9, &max8997_ldo9_data },
915 { MAX8997_LDO10, &max8997_ldo10_data },
916 { MAX8997_LDO11, &max8997_ldo11_data },
917 { MAX8997_LDO12, &max8997_ldo12_data },
918 { MAX8997_LDO13, &max8997_ldo13_data },
919 { MAX8997_LDO14, &max8997_ldo14_data },
920 { MAX8997_LDO15, &max8997_ldo15_data },
921 { MAX8997_LDO16, &max8997_ldo16_data },
922
923 { MAX8997_LDO18, &max8997_ldo18_data },
924 { MAX8997_LDO21, &max8997_ldo21_data },
925
926 { MAX8997_BUCK1, &max8997_buck1_data },
927 { MAX8997_BUCK2, &max8997_buck2_data },
928 { MAX8997_BUCK3, &max8997_buck3_data },
929 { MAX8997_BUCK4, &max8997_buck4_data },
930 { MAX8997_BUCK5, &max8997_buck5_data },
931 { MAX8997_BUCK6, &max8997_buck6_data },
932 { MAX8997_BUCK7, &max8997_buck7_data },
933
934 { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
935 { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
936
937 { MAX8997_ENVICHG, &max8997_vichg_data },
938 { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
939 { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
940 { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
941 { MAX8997_CHARGER, &max8997_charger_data },
942 { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
943};
944
945static struct max8997_platform_data __initdata nuri_max8997_pdata = {
946 .wakeup = 1,
947
948 .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
949 .regulators = nuri_max8997_regulators,
950
951 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
952
953 .buck1_voltage[0] = 1350000, /* 1.35V */
954 .buck1_voltage[1] = 1300000, /* 1.3V */
955 .buck1_voltage[2] = 1250000, /* 1.25V */
956 .buck1_voltage[3] = 1200000, /* 1.2V */
957 .buck1_voltage[4] = 1150000, /* 1.15V */
958 .buck1_voltage[5] = 1100000, /* 1.1V */
959 .buck1_voltage[6] = 1000000, /* 1.0V */
960 .buck1_voltage[7] = 950000, /* 0.95V */
961
962 .buck2_voltage[0] = 1100000, /* 1.1V */
963 .buck2_voltage[1] = 1000000, /* 1.0V */
964 .buck2_voltage[2] = 950000, /* 0.95V */
965 .buck2_voltage[3] = 900000, /* 0.9V */
966 .buck2_voltage[4] = 1100000, /* 1.1V */
967 .buck2_voltage[5] = 1000000, /* 1.0V */
968 .buck2_voltage[6] = 950000, /* 0.95V */
969 .buck2_voltage[7] = 900000, /* 0.9V */
970
971 .buck5_voltage[0] = 1200000, /* 1.2V */
972 .buck5_voltage[1] = 1200000, /* 1.2V */
973 .buck5_voltage[2] = 1200000, /* 1.2V */
974 .buck5_voltage[3] = 1200000, /* 1.2V */
975 .buck5_voltage[4] = 1200000, /* 1.2V */
976 .buck5_voltage[5] = 1200000, /* 1.2V */
977 .buck5_voltage[6] = 1200000, /* 1.2V */
978 .buck5_voltage[7] = 1200000, /* 1.2V */
979};
980
981/* GPIO I2C 5 (PMIC) */
982enum { I2C5_MAX8997 };
983static struct i2c_board_info i2c5_devs[] __initdata = {
984 [I2C5_MAX8997] = {
985 I2C_BOARD_INFO("max8997", 0xCC >> 1),
986 .platform_data = &nuri_max8997_pdata,
987 },
988};
989
990static struct max17042_platform_data nuri_battery_platform_data = {
991};
992
993/* GPIO I2C 9 (Fuel Gauge) */
994static struct i2c_gpio_platform_data i2c9_gpio_data = {
995 .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
996 .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
997};
998static struct platform_device i2c9_gpio = {
999 .name = "i2c-gpio",
1000 .id = 9,
1001 .dev = {
1002 .platform_data = &i2c9_gpio_data,
1003 },
1004};
1005enum { I2C9_MAX17042};
1006static struct i2c_board_info i2c9_devs[] __initdata = {
1007 [I2C9_MAX17042] = {
1008 I2C_BOARD_INFO("max17042", 0x36),
1009 .platform_data = &nuri_battery_platform_data,
1010 },
1011};
1012
1013/* MAX8903 Secondary Charger */
1014static struct regulator_consumer_supply supplies_max8903[] = {
1015 REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
1016};
1017
1018static struct regulator_init_data max8903_charger_en_data = {
1019 .constraints = {
1020 .name = "VOUT_CHARGER",
1021 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1022 .boot_on = 1,
1023 },
1024 .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
1025 .consumer_supplies = supplies_max8903,
1026};
1027
1028static struct fixed_voltage_config max8903_charger_en = {
1029 .supply_name = "VOUT_CHARGER",
1030 .microvolts = 5000000, /* Assume 5VDC */
1031 .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
1032 .enable_high = 0, /* Enable = Low */
1033 .enabled_at_boot = 1,
1034 .init_data = &max8903_charger_en_data,
1035};
1036
1037static struct platform_device max8903_fixed_reg_dev = {
1038 .name = "reg-fixed-voltage",
1039 .id = FIXED_REG_ID_MAX8903,
1040 .dev = { .platform_data = &max8903_charger_en },
1041};
1042
1043static struct max8903_pdata nuri_max8903 = {
1044 /*
1045 * cen: don't control with the driver, let it be
1046 * controlled by regulator above
1047 */
1048 .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
1049 /* uok, usus: not connected */
1050 .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
1051 /* flt: vcc_1.8V_pda */
1052 .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
1053
1054 .dc_valid = true,
1055 .usb_valid = false, /* USB is not wired to MAX8903 */
1056};
1057
1058static struct platform_device nuri_max8903_device = {
1059 .name = "max8903-charger",
1060 .dev = {
1061 .platform_data = &nuri_max8903,
1062 },
1063};
1064
1065static void __init nuri_power_init(void)
1066{
1067 int gpio;
1068 int ta_en = 0;
1069
1070 gpio = EXYNOS4_GPX0(7);
1071 gpio_request(gpio, "AP_PMIC_IRQ");
1072 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1073 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1074
1075 gpio = EXYNOS4_GPX2(3);
1076 gpio_request(gpio, "FUEL_ALERT");
1077 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1078 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1079
1080 gpio = nuri_max8903.dok;
1081 gpio_request(gpio, "TA_nCONNECTED");
1082 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1083 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1084 ta_en = gpio_get_value(gpio) ? 0 : 1;
1085
1086 gpio = nuri_max8903.chg;
1087 gpio_request(gpio, "TA_nCHG");
1088 gpio_direction_input(gpio);
1089
1090 gpio = nuri_max8903.dcm;
1091 gpio_request(gpio, "CURR_ADJ");
1092 gpio_direction_output(gpio, ta_en);
1093}
1094
1095/* USB EHCI */
1096static struct s5p_ehci_platdata nuri_ehci_pdata;
1097
1098static void __init nuri_ehci_init(void)
1099{
1100 struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
1101
1102 s5p_ehci_set_platdata(pdata);
1103}
1104
1105/* USB OTG */
1106static struct s3c_hsotg_plat nuri_hsotg_pdata;
1107
1108/* CAMERA */
1109static struct regulator_consumer_supply cam_vt_cam15_supply =
1110 REGULATOR_SUPPLY("vdd_core", "6-003c");
1111
1112static struct regulator_init_data cam_vt_cam15_reg_init_data = {
1113 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1114 .num_consumer_supplies = 1,
1115 .consumer_supplies = &cam_vt_cam15_supply,
1116};
1117
1118static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
1119 .supply_name = "VT_CAM_1.5V",
1120 .microvolts = 1500000,
1121 .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
1122 .enable_high = 1,
1123 .init_data = &cam_vt_cam15_reg_init_data,
1124};
1125
1126static struct platform_device cam_vt_cam15_fixed_rdev = {
1127 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
1128 .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
1129};
1130
1131static struct regulator_consumer_supply cam_vdda_supply[] = {
1132 REGULATOR_SUPPLY("vdda", "6-003c"),
1133 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1134};
1135
1136static struct regulator_init_data cam_vdda_reg_init_data = {
1137 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1138 .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
1139 .consumer_supplies = cam_vdda_supply,
1140};
1141
1142static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
1143 .supply_name = "CAM_IO_EN",
1144 .microvolts = 2800000,
1145 .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
1146 .enable_high = 1,
1147 .init_data = &cam_vdda_reg_init_data,
1148};
1149
1150static struct platform_device cam_vdda_fixed_rdev = {
1151 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
1152 .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
1153};
1154
1155static struct regulator_consumer_supply camera_8m_12v_supply =
1156 REGULATOR_SUPPLY("dig_12", "0-001f");
1157
1158static struct regulator_init_data cam_8m_12v_reg_init_data = {
1159 .num_consumer_supplies = 1,
1160 .consumer_supplies = &camera_8m_12v_supply,
1161 .constraints = {
1162 .valid_ops_mask = REGULATOR_CHANGE_STATUS
1163 },
1164};
1165
1166static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
1167 .supply_name = "8M_1.2V",
1168 .microvolts = 1200000,
1169 .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
1170 .enable_high = 1,
1171 .init_data = &cam_8m_12v_reg_init_data,
1172};
1173
1174static struct platform_device cam_8m_12v_fixed_rdev = {
1175 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
1176 .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
1177};
1178
1179static struct s5p_platform_mipi_csis mipi_csis_platdata = {
1180 .clk_rate = 166000000UL,
1181 .lanes = 2,
1182 .hs_settle = 12,
1183};
1184
1185#define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
1186#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
1187#define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
1188#define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
1189
1190static struct s5k6aa_platform_data s5k6aa_pldata = {
1191 .mclk_frequency = 24000000UL,
1192 .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
1193 .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
1194 .bus_type = V4L2_MBUS_PARALLEL,
1195 .horiz_flip = 1,
1196};
1197
1198static struct i2c_board_info s5k6aa_board_info = {
1199 I2C_BOARD_INFO("S5K6AA", 0x3c),
1200 .platform_data = &s5k6aa_pldata,
1201};
1202
1203static struct m5mols_platform_data m5mols_platdata = {
1204 .gpio_reset = GPIO_CAM_MEGA_RST,
1205};
1206
1207static struct i2c_board_info m5mols_board_info = {
1208 I2C_BOARD_INFO("M5MOLS", 0x1F),
1209 .platform_data = &m5mols_platdata,
1210};
1211
1212static struct fimc_source_info nuri_camera_sensors[] = {
1213 {
1214 .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
1215 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1216 .fimc_bus_type = FIMC_BUS_TYPE_ITU_601,
1217 .board_info = &s5k6aa_board_info,
1218 .clk_frequency = 24000000UL,
1219 .i2c_bus_num = 6,
1220 }, {
1221 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1222 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1223 .fimc_bus_type = FIMC_BUS_TYPE_MIPI_CSI2,
1224 .board_info = &m5mols_board_info,
1225 .clk_frequency = 24000000UL,
1226 },
1227};
1228
1229static struct s5p_platform_fimc fimc_md_platdata = {
1230 .source_info = nuri_camera_sensors,
1231 .num_clients = ARRAY_SIZE(nuri_camera_sensors),
1232};
1233
1234static struct gpio nuri_camera_gpios[] = {
1235 { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
1236 { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
1237 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
1238 { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1239};
1240
1241static void __init nuri_camera_init(void)
1242{
1243 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1244 &s5p_device_mipi_csis0);
1245 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
1246 &s5p_device_fimc_md);
1247
1248 if (gpio_request_array(nuri_camera_gpios,
1249 ARRAY_SIZE(nuri_camera_gpios))) {
1250 pr_err("%s: GPIO request failed\n", __func__);
1251 return;
1252 }
1253
1254 m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
1255 if (m5mols_board_info.irq >= 0)
1256 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
1257 else
1258 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
1259
1260 /* Free GPIOs controlled directly by the sensor drivers. */
1261 gpio_free(GPIO_CAM_VT_NRST);
1262 gpio_free(GPIO_CAM_VT_NSTBY);
1263 gpio_free(GPIO_CAM_MEGA_RST);
1264
1265 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
1266 pr_err("%s: Camera port A setup failed\n", __func__);
1267 return;
1268 }
1269 /* Increase drive strength of the sensor clock output */
1270 s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
1271}
1272
1273static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
1274 .frequency = 400000U,
1275 .sda_delay = 200,
1276 .bus_num = 6,
1277};
1278
1279static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
1280 .frequency = 400000U,
1281 .sda_delay = 200,
1282};
1283
1284/* DEVFREQ controlling memory/bus */
1285static struct platform_device exynos4_bus_devfreq = {
1286 .name = "exynos4210-busfreq",
1287};
1288
1289static struct platform_device *nuri_devices[] __initdata = {
1290 /* Samsung Platform Devices */
1291 &s3c_device_i2c5, /* PMIC should initialize first */
1292 &s3c_device_i2c0,
1293 &s3c_device_i2c6,
1294 &emmc_fixed_voltage,
1295 &s5p_device_mipi_csis0,
1296 &s5p_device_fimc0,
1297 &s5p_device_fimc1,
1298 &s5p_device_fimc2,
1299 &s5p_device_fimc3,
1300 &s5p_device_fimd0,
1301 &s3c_device_hsmmc0,
1302 &s3c_device_hsmmc2,
1303 &s3c_device_hsmmc3,
1304 &s3c_device_wdt,
1305 &s3c_device_timer[0],
1306 &s5p_device_ehci,
1307 &s3c_device_i2c3,
1308 &i2c9_gpio,
1309 &s3c_device_adc,
1310 &s5p_device_g2d,
1311 &s5p_device_jpeg,
1312 &s3c_device_rtc,
1313 &s5p_device_mfc,
1314 &s5p_device_mfc_l,
1315 &s5p_device_mfc_r,
1316 &s5p_device_fimc_md,
1317 &s3c_device_usb_hsotg,
1318
1319 /* NURI Devices */
1320 &nuri_gpio_keys,
1321 &nuri_lcd_device,
1322 &nuri_backlight_device,
1323 &max8903_fixed_reg_dev,
1324 &nuri_max8903_device,
1325 &cam_vt_cam15_fixed_rdev,
1326 &cam_vdda_fixed_rdev,
1327 &cam_8m_12v_fixed_rdev,
1328 &exynos4_bus_devfreq,
1329};
1330
1331static void __init nuri_map_io(void)
1332{
1333 exynos_init_io(NULL, 0);
1334 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1335 xxti_f = 0;
1336 xusbxti_f = 24000000;
1337}
1338
1339static void __init nuri_reserve(void)
1340{
1341 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1342}
1343
1344static void __init nuri_machine_init(void)
1345{
1346 nuri_sdhci_init();
1347 nuri_tsp_init();
1348 nuri_power_init();
1349
1350 s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
1351 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
1352 s3c_i2c3_set_platdata(&i2c3_data);
1353 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
1354 s3c_i2c5_set_platdata(NULL);
1355 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
1356 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1357 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1358 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
1359 s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
1360
1361#ifdef CONFIG_DRM_EXYNOS
1362 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
1363 exynos4_fimd0_gpio_setup_24bpp();
1364#else
1365 s5p_fimd0_set_platdata(&nuri_fb_pdata);
1366#endif
1367
1368 nuri_camera_init();
1369
1370 nuri_ehci_init();
1371 s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
1372
1373 /* Last */
1374 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1375}
1376
1377MACHINE_START(NURI, "NURI")
1378 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1379 .atag_offset = 0x100,
1380 .smp = smp_ops(exynos_smp_ops),
1381 .init_irq = exynos4_init_irq,
1382 .map_io = nuri_map_io,
1383 .init_machine = nuri_machine_init,
1384 .init_late = exynos_init_late,
1385 .init_time = exynos_init_time,
1386 .reserve = &nuri_reserve,
1387 .restart = exynos4_restart,
1388MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-origen.c b/arch/arm/mach-exynos/mach-origen.c
deleted file mode 100644
index 27f03ed5d067..000000000000
--- a/arch/arm/mach-exynos/mach-origen.c
+++ /dev/null
@@ -1,823 +0,0 @@
1/* linux/arch/arm/mach-exynos4/mach-origen.c
2 *
3 * Copyright (c) 2011 Insignal Co., Ltd.
4 * http://www.insignal.co.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/serial_core.h>
12#include <linux/leds.h>
13#include <linux/gpio.h>
14#include <linux/mmc/host.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/input.h>
18#include <linux/pwm.h>
19#include <linux/pwm_backlight.h>
20#include <linux/gpio_keys.h>
21#include <linux/i2c.h>
22#include <linux/regulator/machine.h>
23#include <linux/mfd/max8997.h>
24#include <linux/lcd.h>
25#include <linux/rfkill-gpio.h>
26#include <linux/platform_data/i2c-s3c2410.h>
27#include <linux/platform_data/s3c-hsotg.h>
28#include <linux/platform_data/usb-ehci-s5p.h>
29#include <linux/platform_data/usb-ohci-exynos.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach-types.h>
33
34#include <video/platform_lcd.h>
35#include <video/samsung_fimd.h>
36
37#include <plat/regs-serial.h>
38#include <plat/cpu.h>
39#include <plat/devs.h>
40#include <plat/sdhci.h>
41#include <plat/clock.h>
42#include <plat/gpio-cfg.h>
43#include <plat/backlight.h>
44#include <plat/fb.h>
45#include <plat/mfc.h>
46#include <plat/hdmi.h>
47
48#include <mach/map.h>
49#include <mach/irqs.h>
50
51#include <drm/exynos_drm.h>
52#include "common.h"
53
54/* Following are default values for UCON, ULCON and UFCON UART registers */
55#define ORIGEN_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 ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8
63
64#define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
65 S5PV210_UFCON_TXTRIG4 | \
66 S5PV210_UFCON_RXTRIG4)
67
68static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = {
69 [0] = {
70 .hwport = 0,
71 .flags = 0,
72 .ucon = ORIGEN_UCON_DEFAULT,
73 .ulcon = ORIGEN_ULCON_DEFAULT,
74 .ufcon = ORIGEN_UFCON_DEFAULT,
75 },
76 [1] = {
77 .hwport = 1,
78 .flags = 0,
79 .ucon = ORIGEN_UCON_DEFAULT,
80 .ulcon = ORIGEN_ULCON_DEFAULT,
81 .ufcon = ORIGEN_UFCON_DEFAULT,
82 },
83 [2] = {
84 .hwport = 2,
85 .flags = 0,
86 .ucon = ORIGEN_UCON_DEFAULT,
87 .ulcon = ORIGEN_ULCON_DEFAULT,
88 .ufcon = ORIGEN_UFCON_DEFAULT,
89 },
90 [3] = {
91 .hwport = 3,
92 .flags = 0,
93 .ucon = ORIGEN_UCON_DEFAULT,
94 .ulcon = ORIGEN_ULCON_DEFAULT,
95 .ufcon = ORIGEN_UFCON_DEFAULT,
96 },
97};
98
99static struct regulator_consumer_supply __initdata ldo3_consumer[] = {
100 REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"), /* MIPI */
101 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */
102 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */
103 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* OTG */
104};
105static struct regulator_consumer_supply __initdata ldo6_consumer[] = {
106 REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"), /* MIPI */
107};
108static struct regulator_consumer_supply __initdata ldo7_consumer[] = {
109 REGULATOR_SUPPLY("avdd", "alc5625"), /* Realtek ALC5625 */
110};
111static struct regulator_consumer_supply __initdata ldo8_consumer[] = {
112 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
113 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */
114 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* OTG */
115};
116static struct regulator_consumer_supply __initdata ldo9_consumer[] = {
117 REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
118};
119static struct regulator_consumer_supply __initdata ldo11_consumer[] = {
120 REGULATOR_SUPPLY("dvdd", "alc5625"), /* Realtek ALC5625 */
121};
122static struct regulator_consumer_supply __initdata ldo14_consumer[] = {
123 REGULATOR_SUPPLY("avdd18", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
124};
125static struct regulator_consumer_supply __initdata ldo17_consumer[] = {
126 REGULATOR_SUPPLY("vdd33", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
127};
128static struct regulator_consumer_supply __initdata buck1_consumer[] = {
129 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
130};
131static struct regulator_consumer_supply __initdata buck2_consumer[] = {
132 REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
133};
134static struct regulator_consumer_supply __initdata buck3_consumer[] = {
135 REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */
136};
137static struct regulator_consumer_supply __initdata buck7_consumer[] = {
138 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* LCD */
139};
140
141static struct regulator_init_data __initdata max8997_ldo1_data = {
142 .constraints = {
143 .name = "VDD_ABB_3.3V",
144 .min_uV = 3300000,
145 .max_uV = 3300000,
146 .apply_uV = 1,
147 .state_mem = {
148 .disabled = 1,
149 },
150 },
151};
152
153static struct regulator_init_data __initdata max8997_ldo2_data = {
154 .constraints = {
155 .name = "VDD_ALIVE_1.1V",
156 .min_uV = 1100000,
157 .max_uV = 1100000,
158 .apply_uV = 1,
159 .always_on = 1,
160 .state_mem = {
161 .enabled = 1,
162 },
163 },
164};
165
166static struct regulator_init_data __initdata max8997_ldo3_data = {
167 .constraints = {
168 .name = "VMIPI_1.1V",
169 .min_uV = 1100000,
170 .max_uV = 1100000,
171 .apply_uV = 1,
172 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
173 .state_mem = {
174 .disabled = 1,
175 },
176 },
177 .num_consumer_supplies = ARRAY_SIZE(ldo3_consumer),
178 .consumer_supplies = ldo3_consumer,
179};
180
181static struct regulator_init_data __initdata max8997_ldo4_data = {
182 .constraints = {
183 .name = "VDD_RTC_1.8V",
184 .min_uV = 1800000,
185 .max_uV = 1800000,
186 .apply_uV = 1,
187 .always_on = 1,
188 .state_mem = {
189 .disabled = 1,
190 },
191 },
192};
193
194static struct regulator_init_data __initdata max8997_ldo6_data = {
195 .constraints = {
196 .name = "VMIPI_1.8V",
197 .min_uV = 1800000,
198 .max_uV = 1800000,
199 .apply_uV = 1,
200 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
201 .state_mem = {
202 .disabled = 1,
203 },
204 },
205 .num_consumer_supplies = ARRAY_SIZE(ldo6_consumer),
206 .consumer_supplies = ldo6_consumer,
207};
208
209static struct regulator_init_data __initdata max8997_ldo7_data = {
210 .constraints = {
211 .name = "VDD_AUD_1.8V",
212 .min_uV = 1800000,
213 .max_uV = 1800000,
214 .apply_uV = 1,
215 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
216 .state_mem = {
217 .disabled = 1,
218 },
219 },
220 .num_consumer_supplies = ARRAY_SIZE(ldo7_consumer),
221 .consumer_supplies = ldo7_consumer,
222};
223
224static struct regulator_init_data __initdata max8997_ldo8_data = {
225 .constraints = {
226 .name = "VADC_3.3V",
227 .min_uV = 3300000,
228 .max_uV = 3300000,
229 .apply_uV = 1,
230 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
231 .state_mem = {
232 .disabled = 1,
233 },
234 },
235 .num_consumer_supplies = ARRAY_SIZE(ldo8_consumer),
236 .consumer_supplies = ldo8_consumer,
237};
238
239static struct regulator_init_data __initdata max8997_ldo9_data = {
240 .constraints = {
241 .name = "DVDD_SWB_2.8V",
242 .min_uV = 2800000,
243 .max_uV = 2800000,
244 .apply_uV = 1,
245 .always_on = 1,
246 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
247 .state_mem = {
248 .disabled = 1,
249 },
250 },
251 .num_consumer_supplies = ARRAY_SIZE(ldo9_consumer),
252 .consumer_supplies = ldo9_consumer,
253};
254
255static struct regulator_init_data __initdata max8997_ldo10_data = {
256 .constraints = {
257 .name = "VDD_PLL_1.1V",
258 .min_uV = 1100000,
259 .max_uV = 1100000,
260 .apply_uV = 1,
261 .always_on = 1,
262 .state_mem = {
263 .disabled = 1,
264 },
265 },
266};
267
268static struct regulator_init_data __initdata max8997_ldo11_data = {
269 .constraints = {
270 .name = "VDD_AUD_3V",
271 .min_uV = 3000000,
272 .max_uV = 3000000,
273 .apply_uV = 1,
274 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
275 .state_mem = {
276 .disabled = 1,
277 },
278 },
279 .num_consumer_supplies = ARRAY_SIZE(ldo11_consumer),
280 .consumer_supplies = ldo11_consumer,
281};
282
283static struct regulator_init_data __initdata max8997_ldo14_data = {
284 .constraints = {
285 .name = "AVDD18_SWB_1.8V",
286 .min_uV = 1800000,
287 .max_uV = 1800000,
288 .apply_uV = 1,
289 .always_on = 1,
290 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
291 .state_mem = {
292 .disabled = 1,
293 },
294 },
295 .num_consumer_supplies = ARRAY_SIZE(ldo14_consumer),
296 .consumer_supplies = ldo14_consumer,
297};
298
299static struct regulator_init_data __initdata max8997_ldo17_data = {
300 .constraints = {
301 .name = "VDD_SWB_3.3V",
302 .min_uV = 3300000,
303 .max_uV = 3300000,
304 .apply_uV = 1,
305 .always_on = 1,
306 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
307 .state_mem = {
308 .disabled = 1,
309 },
310 },
311 .num_consumer_supplies = ARRAY_SIZE(ldo17_consumer),
312 .consumer_supplies = ldo17_consumer,
313};
314
315static struct regulator_init_data __initdata max8997_ldo21_data = {
316 .constraints = {
317 .name = "VDD_MIF_1.2V",
318 .min_uV = 1200000,
319 .max_uV = 1200000,
320 .apply_uV = 1,
321 .always_on = 1,
322 .state_mem = {
323 .disabled = 1,
324 },
325 },
326};
327
328static struct regulator_init_data __initdata max8997_buck1_data = {
329 .constraints = {
330 .name = "VDD_ARM_1.2V",
331 .min_uV = 950000,
332 .max_uV = 1350000,
333 .always_on = 1,
334 .boot_on = 1,
335 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
336 .state_mem = {
337 .disabled = 1,
338 },
339 },
340 .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
341 .consumer_supplies = buck1_consumer,
342};
343
344static struct regulator_init_data __initdata max8997_buck2_data = {
345 .constraints = {
346 .name = "VDD_INT_1.1V",
347 .min_uV = 900000,
348 .max_uV = 1100000,
349 .always_on = 1,
350 .boot_on = 1,
351 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
352 .state_mem = {
353 .disabled = 1,
354 },
355 },
356 .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
357 .consumer_supplies = buck2_consumer,
358};
359
360static struct regulator_init_data __initdata max8997_buck3_data = {
361 .constraints = {
362 .name = "VDD_G3D_1.1V",
363 .min_uV = 900000,
364 .max_uV = 1100000,
365 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
366 REGULATOR_CHANGE_STATUS,
367 .state_mem = {
368 .disabled = 1,
369 },
370 },
371 .num_consumer_supplies = ARRAY_SIZE(buck3_consumer),
372 .consumer_supplies = buck3_consumer,
373};
374
375static struct regulator_init_data __initdata max8997_buck5_data = {
376 .constraints = {
377 .name = "VDDQ_M1M2_1.2V",
378 .min_uV = 1200000,
379 .max_uV = 1200000,
380 .apply_uV = 1,
381 .always_on = 1,
382 .state_mem = {
383 .disabled = 1,
384 },
385 },
386};
387
388static struct regulator_init_data __initdata max8997_buck7_data = {
389 .constraints = {
390 .name = "VDD_LCD_3.3V",
391 .min_uV = 3300000,
392 .max_uV = 3300000,
393 .boot_on = 1,
394 .apply_uV = 1,
395 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
396 .state_mem = {
397 .disabled = 1
398 },
399 },
400 .num_consumer_supplies = ARRAY_SIZE(buck7_consumer),
401 .consumer_supplies = buck7_consumer,
402};
403
404static struct max8997_regulator_data __initdata origen_max8997_regulators[] = {
405 { MAX8997_LDO1, &max8997_ldo1_data },
406 { MAX8997_LDO2, &max8997_ldo2_data },
407 { MAX8997_LDO3, &max8997_ldo3_data },
408 { MAX8997_LDO4, &max8997_ldo4_data },
409 { MAX8997_LDO6, &max8997_ldo6_data },
410 { MAX8997_LDO7, &max8997_ldo7_data },
411 { MAX8997_LDO8, &max8997_ldo8_data },
412 { MAX8997_LDO9, &max8997_ldo9_data },
413 { MAX8997_LDO10, &max8997_ldo10_data },
414 { MAX8997_LDO11, &max8997_ldo11_data },
415 { MAX8997_LDO14, &max8997_ldo14_data },
416 { MAX8997_LDO17, &max8997_ldo17_data },
417 { MAX8997_LDO21, &max8997_ldo21_data },
418 { MAX8997_BUCK1, &max8997_buck1_data },
419 { MAX8997_BUCK2, &max8997_buck2_data },
420 { MAX8997_BUCK3, &max8997_buck3_data },
421 { MAX8997_BUCK5, &max8997_buck5_data },
422 { MAX8997_BUCK7, &max8997_buck7_data },
423};
424
425static struct max8997_platform_data __initdata origen_max8997_pdata = {
426 .num_regulators = ARRAY_SIZE(origen_max8997_regulators),
427 .regulators = origen_max8997_regulators,
428
429 .wakeup = true,
430 .buck1_gpiodvs = false,
431 .buck2_gpiodvs = false,
432 .buck5_gpiodvs = false,
433
434 .ignore_gpiodvs_side_effect = true,
435 .buck125_default_idx = 0x0,
436
437 .buck125_gpios[0] = EXYNOS4_GPX0(0),
438 .buck125_gpios[1] = EXYNOS4_GPX0(1),
439 .buck125_gpios[2] = EXYNOS4_GPX0(2),
440
441 .buck1_voltage[0] = 1350000,
442 .buck1_voltage[1] = 1300000,
443 .buck1_voltage[2] = 1250000,
444 .buck1_voltage[3] = 1200000,
445 .buck1_voltage[4] = 1150000,
446 .buck1_voltage[5] = 1100000,
447 .buck1_voltage[6] = 1000000,
448 .buck1_voltage[7] = 950000,
449
450 .buck2_voltage[0] = 1100000,
451 .buck2_voltage[1] = 1100000,
452 .buck2_voltage[2] = 1100000,
453 .buck2_voltage[3] = 1100000,
454 .buck2_voltage[4] = 1000000,
455 .buck2_voltage[5] = 1000000,
456 .buck2_voltage[6] = 1000000,
457 .buck2_voltage[7] = 1000000,
458
459 .buck5_voltage[0] = 1200000,
460 .buck5_voltage[1] = 1200000,
461 .buck5_voltage[2] = 1200000,
462 .buck5_voltage[3] = 1200000,
463 .buck5_voltage[4] = 1200000,
464 .buck5_voltage[5] = 1200000,
465 .buck5_voltage[6] = 1200000,
466 .buck5_voltage[7] = 1200000,
467};
468
469/* I2C0 */
470static struct i2c_board_info i2c0_devs[] __initdata = {
471 {
472 I2C_BOARD_INFO("max8997", (0xCC >> 1)),
473 .platform_data = &origen_max8997_pdata,
474 .irq = IRQ_EINT(4),
475 },
476};
477
478static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
479 .cd_type = S3C_SDHCI_CD_INTERNAL,
480};
481
482static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
483 .cd_type = S3C_SDHCI_CD_INTERNAL,
484};
485
486/* USB EHCI */
487static struct s5p_ehci_platdata origen_ehci_pdata;
488
489static void __init origen_ehci_init(void)
490{
491 struct s5p_ehci_platdata *pdata = &origen_ehci_pdata;
492
493 s5p_ehci_set_platdata(pdata);
494}
495
496/* USB OHCI */
497static struct exynos4_ohci_platdata origen_ohci_pdata;
498
499static void __init origen_ohci_init(void)
500{
501 struct exynos4_ohci_platdata *pdata = &origen_ohci_pdata;
502
503 exynos4_ohci_set_platdata(pdata);
504}
505
506/* USB OTG */
507static struct s3c_hsotg_plat origen_hsotg_pdata;
508
509static struct gpio_led origen_gpio_leds[] = {
510 {
511 .name = "origen::status1",
512 .default_trigger = "heartbeat",
513 .gpio = EXYNOS4_GPX1(3),
514 .active_low = 1,
515 },
516 {
517 .name = "origen::status2",
518 .default_trigger = "mmc0",
519 .gpio = EXYNOS4_GPX1(4),
520 .active_low = 1,
521 },
522};
523
524static struct gpio_led_platform_data origen_gpio_led_info = {
525 .leds = origen_gpio_leds,
526 .num_leds = ARRAY_SIZE(origen_gpio_leds),
527};
528
529static struct platform_device origen_leds_gpio = {
530 .name = "leds-gpio",
531 .id = -1,
532 .dev = {
533 .platform_data = &origen_gpio_led_info,
534 },
535};
536
537static struct gpio_keys_button origen_gpio_keys_table[] = {
538 {
539 .code = KEY_MENU,
540 .gpio = EXYNOS4_GPX1(5),
541 .desc = "gpio-keys: KEY_MENU",
542 .type = EV_KEY,
543 .active_low = 1,
544 .wakeup = 1,
545 .debounce_interval = 1,
546 }, {
547 .code = KEY_HOME,
548 .gpio = EXYNOS4_GPX1(6),
549 .desc = "gpio-keys: KEY_HOME",
550 .type = EV_KEY,
551 .active_low = 1,
552 .wakeup = 1,
553 .debounce_interval = 1,
554 }, {
555 .code = KEY_BACK,
556 .gpio = EXYNOS4_GPX1(7),
557 .desc = "gpio-keys: KEY_BACK",
558 .type = EV_KEY,
559 .active_low = 1,
560 .wakeup = 1,
561 .debounce_interval = 1,
562 }, {
563 .code = KEY_UP,
564 .gpio = EXYNOS4_GPX2(0),
565 .desc = "gpio-keys: KEY_UP",
566 .type = EV_KEY,
567 .active_low = 1,
568 .wakeup = 1,
569 .debounce_interval = 1,
570 }, {
571 .code = KEY_DOWN,
572 .gpio = EXYNOS4_GPX2(1),
573 .desc = "gpio-keys: KEY_DOWN",
574 .type = EV_KEY,
575 .active_low = 1,
576 .wakeup = 1,
577 .debounce_interval = 1,
578 },
579};
580
581static struct gpio_keys_platform_data origen_gpio_keys_data = {
582 .buttons = origen_gpio_keys_table,
583 .nbuttons = ARRAY_SIZE(origen_gpio_keys_table),
584};
585
586static struct platform_device origen_device_gpiokeys = {
587 .name = "gpio-keys",
588 .dev = {
589 .platform_data = &origen_gpio_keys_data,
590 },
591};
592
593static void lcd_hv070wsa_set_power(struct plat_lcd_data *pd, unsigned int power)
594{
595 int ret;
596
597 if (power)
598 ret = gpio_request_one(EXYNOS4_GPE3(4),
599 GPIOF_OUT_INIT_HIGH, "GPE3_4");
600 else
601 ret = gpio_request_one(EXYNOS4_GPE3(4),
602 GPIOF_OUT_INIT_LOW, "GPE3_4");
603
604 gpio_free(EXYNOS4_GPE3(4));
605
606 if (ret)
607 pr_err("failed to request gpio for LCD power: %d\n", ret);
608}
609
610static struct plat_lcd_data origen_lcd_hv070wsa_data = {
611 .set_power = lcd_hv070wsa_set_power,
612};
613
614static struct platform_device origen_lcd_hv070wsa = {
615 .name = "platform-lcd",
616 .dev.parent = &s5p_device_fimd0.dev,
617 .dev.platform_data = &origen_lcd_hv070wsa_data,
618};
619
620static struct pwm_lookup origen_pwm_lookup[] = {
621 PWM_LOOKUP("s3c24xx-pwm.0", 0, "pwm-backlight.0", NULL),
622};
623
624#ifdef CONFIG_DRM_EXYNOS_FIMD
625static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
626 .panel = {
627 .timing = {
628 .left_margin = 64,
629 .right_margin = 16,
630 .upper_margin = 64,
631 .lower_margin = 16,
632 .hsync_len = 48,
633 .vsync_len = 3,
634 .xres = 1024,
635 .yres = 600,
636 },
637 },
638 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
639 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
640 VIDCON1_INV_VCLK,
641 .default_win = 0,
642 .bpp = 32,
643};
644#else
645static struct s3c_fb_pd_win origen_fb_win0 = {
646 .xres = 1024,
647 .yres = 600,
648 .max_bpp = 32,
649 .default_bpp = 24,
650 .virtual_x = 1024,
651 .virtual_y = 2 * 600,
652};
653
654static struct fb_videomode origen_lcd_timing = {
655 .left_margin = 64,
656 .right_margin = 16,
657 .upper_margin = 64,
658 .lower_margin = 16,
659 .hsync_len = 48,
660 .vsync_len = 3,
661 .xres = 1024,
662 .yres = 600,
663};
664
665static struct s3c_fb_platdata origen_lcd_pdata __initdata = {
666 .win[0] = &origen_fb_win0,
667 .vtiming = &origen_lcd_timing,
668 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
669 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
670 VIDCON1_INV_VCLK,
671 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
672};
673#endif
674
675/* Bluetooth rfkill gpio platform data */
676static struct rfkill_gpio_platform_data origen_bt_pdata = {
677 .reset_gpio = EXYNOS4_GPX2(2),
678 .shutdown_gpio = -1,
679 .type = RFKILL_TYPE_BLUETOOTH,
680 .name = "origen-bt",
681};
682
683/* Bluetooth Platform device */
684static struct platform_device origen_device_bluetooth = {
685 .name = "rfkill_gpio",
686 .id = -1,
687 .dev = {
688 .platform_data = &origen_bt_pdata,
689 },
690};
691
692static struct platform_device *origen_devices[] __initdata = {
693 &s3c_device_hsmmc2,
694 &s3c_device_hsmmc0,
695 &s3c_device_i2c0,
696 &s3c_device_rtc,
697 &s3c_device_usb_hsotg,
698 &s3c_device_wdt,
699 &s5p_device_ehci,
700 &s5p_device_fimc0,
701 &s5p_device_fimc1,
702 &s5p_device_fimc2,
703 &s5p_device_fimc3,
704 &s5p_device_fimc_md,
705 &s5p_device_fimd0,
706 &s5p_device_g2d,
707 &s5p_device_hdmi,
708 &s5p_device_i2c_hdmiphy,
709 &s5p_device_jpeg,
710 &s5p_device_mfc,
711 &s5p_device_mfc_l,
712 &s5p_device_mfc_r,
713 &s5p_device_mixer,
714 &exynos4_device_ohci,
715 &origen_device_gpiokeys,
716 &origen_lcd_hv070wsa,
717 &origen_leds_gpio,
718 &origen_device_bluetooth,
719};
720
721/* LCD Backlight data */
722static struct samsung_bl_gpio_info origen_bl_gpio_info = {
723 .no = EXYNOS4_GPD0(0),
724 .func = S3C_GPIO_SFN(2),
725};
726
727static struct platform_pwm_backlight_data origen_bl_data = {
728 .pwm_id = 0,
729 .pwm_period_ns = 1000,
730};
731
732static void __init origen_bt_setup(void)
733{
734 gpio_request(EXYNOS4_GPA0(0), "GPIO BT_UART");
735 /* 4 UART Pins configuration */
736 s3c_gpio_cfgrange_nopull(EXYNOS4_GPA0(0), 4, S3C_GPIO_SFN(2));
737 /* Setup BT Reset, this gpio will be requesed by rfkill-gpio */
738 s3c_gpio_cfgpin(EXYNOS4_GPX2(2), S3C_GPIO_OUTPUT);
739 s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE);
740}
741
742/* I2C module and id for HDMIPHY */
743static struct i2c_board_info hdmiphy_info = {
744 I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38),
745};
746
747static void s5p_tv_setup(void)
748{
749 /* Direct HPD to HDMI chip */
750 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
751 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
752 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
753}
754
755static void __init origen_map_io(void)
756{
757 exynos_init_io(NULL, 0);
758 s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs));
759 xxti_f = 0;
760 xusbxti_f = 24000000;
761}
762
763static void __init origen_power_init(void)
764{
765 gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ");
766 s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf));
767 s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE);
768}
769
770static void __init origen_reserve(void)
771{
772 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
773}
774
775static void __init origen_machine_init(void)
776{
777 origen_power_init();
778
779 s3c_i2c0_set_platdata(NULL);
780 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
781
782 /*
783 * Since sdhci instance 2 can contain a bootable media,
784 * sdhci instance 0 is registered after instance 2.
785 */
786 s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata);
787 s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
788
789 origen_ehci_init();
790 origen_ohci_init();
791 s3c_hsotg_set_platdata(&origen_hsotg_pdata);
792
793 s5p_tv_setup();
794 s5p_i2c_hdmiphy_set_platdata(NULL);
795 s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);
796
797#ifdef CONFIG_DRM_EXYNOS_FIMD
798 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
799 exynos4_fimd0_gpio_setup_24bpp();
800#else
801 s5p_fimd0_set_platdata(&origen_lcd_pdata);
802#endif
803
804 platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
805
806 pwm_add_table(origen_pwm_lookup, ARRAY_SIZE(origen_pwm_lookup));
807 samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
808
809 origen_bt_setup();
810}
811
812MACHINE_START(ORIGEN, "ORIGEN")
813 /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
814 .atag_offset = 0x100,
815 .smp = smp_ops(exynos_smp_ops),
816 .init_irq = exynos4_init_irq,
817 .map_io = origen_map_io,
818 .init_machine = origen_machine_init,
819 .init_late = exynos_init_late,
820 .init_time = exynos_init_time,
821 .reserve = &origen_reserve,
822 .restart = exynos4_restart,
823MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c b/arch/arm/mach-exynos/mach-smdk4x12.c
deleted file mode 100644
index 2c8af9617920..000000000000
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/mach-smdk4x12.c
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/gpio.h>
13#include <linux/i2c.h>
14#include <linux/input.h>
15#include <linux/io.h>
16#include <linux/lcd.h>
17#include <linux/mfd/max8997.h>
18#include <linux/mmc/host.h>
19#include <linux/platform_device.h>
20#include <linux/pwm.h>
21#include <linux/pwm_backlight.h>
22#include <linux/regulator/machine.h>
23#include <linux/serial_core.h>
24#include <linux/platform_data/i2c-s3c2410.h>
25#include <linux/platform_data/s3c-hsotg.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach-types.h>
29
30#include <video/samsung_fimd.h>
31#include <plat/backlight.h>
32#include <plat/clock.h>
33#include <plat/cpu.h>
34#include <plat/devs.h>
35#include <plat/fb.h>
36#include <plat/gpio-cfg.h>
37#include <plat/keypad.h>
38#include <plat/mfc.h>
39#include <plat/regs-serial.h>
40#include <plat/sdhci.h>
41
42#include <mach/irqs.h>
43#include <mach/map.h>
44
45#include <drm/exynos_drm.h>
46#include "common.h"
47
48/* Following are default values for UCON, ULCON and UFCON UART registers */
49#define SMDK4X12_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
50 S3C2410_UCON_RXILEVEL | \
51 S3C2410_UCON_TXIRQMODE | \
52 S3C2410_UCON_RXIRQMODE | \
53 S3C2410_UCON_RXFIFO_TOI | \
54 S3C2443_UCON_RXERR_IRQEN)
55
56#define SMDK4X12_ULCON_DEFAULT S3C2410_LCON_CS8
57
58#define SMDK4X12_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
59 S5PV210_UFCON_TXTRIG4 | \
60 S5PV210_UFCON_RXTRIG4)
61
62static struct s3c2410_uartcfg smdk4x12_uartcfgs[] __initdata = {
63 [0] = {
64 .hwport = 0,
65 .flags = 0,
66 .ucon = SMDK4X12_UCON_DEFAULT,
67 .ulcon = SMDK4X12_ULCON_DEFAULT,
68 .ufcon = SMDK4X12_UFCON_DEFAULT,
69 },
70 [1] = {
71 .hwport = 1,
72 .flags = 0,
73 .ucon = SMDK4X12_UCON_DEFAULT,
74 .ulcon = SMDK4X12_ULCON_DEFAULT,
75 .ufcon = SMDK4X12_UFCON_DEFAULT,
76 },
77 [2] = {
78 .hwport = 2,
79 .flags = 0,
80 .ucon = SMDK4X12_UCON_DEFAULT,
81 .ulcon = SMDK4X12_ULCON_DEFAULT,
82 .ufcon = SMDK4X12_UFCON_DEFAULT,
83 },
84 [3] = {
85 .hwport = 3,
86 .flags = 0,
87 .ucon = SMDK4X12_UCON_DEFAULT,
88 .ulcon = SMDK4X12_ULCON_DEFAULT,
89 .ufcon = SMDK4X12_UFCON_DEFAULT,
90 },
91};
92
93static struct s3c_sdhci_platdata smdk4x12_hsmmc2_pdata __initdata = {
94 .cd_type = S3C_SDHCI_CD_INTERNAL,
95#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
96 .max_width = 8,
97 .host_caps = MMC_CAP_8_BIT_DATA,
98#endif
99};
100
101static struct s3c_sdhci_platdata smdk4x12_hsmmc3_pdata __initdata = {
102 .cd_type = S3C_SDHCI_CD_INTERNAL,
103};
104
105static struct regulator_consumer_supply max8997_buck1 =
106 REGULATOR_SUPPLY("vdd_arm", NULL);
107
108static struct regulator_consumer_supply max8997_buck2 =
109 REGULATOR_SUPPLY("vdd_int", NULL);
110
111static struct regulator_consumer_supply max8997_buck3 =
112 REGULATOR_SUPPLY("vdd_g3d", NULL);
113
114static struct regulator_init_data max8997_buck1_data = {
115 .constraints = {
116 .name = "VDD_ARM_SMDK4X12",
117 .min_uV = 925000,
118 .max_uV = 1350000,
119 .always_on = 1,
120 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
121 .state_mem = {
122 .disabled = 1,
123 },
124 },
125 .num_consumer_supplies = 1,
126 .consumer_supplies = &max8997_buck1,
127};
128
129static struct regulator_init_data max8997_buck2_data = {
130 .constraints = {
131 .name = "VDD_INT_SMDK4X12",
132 .min_uV = 950000,
133 .max_uV = 1150000,
134 .always_on = 1,
135 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
136 .state_mem = {
137 .disabled = 1,
138 },
139 },
140 .num_consumer_supplies = 1,
141 .consumer_supplies = &max8997_buck2,
142};
143
144static struct regulator_init_data max8997_buck3_data = {
145 .constraints = {
146 .name = "VDD_G3D_SMDK4X12",
147 .min_uV = 950000,
148 .max_uV = 1150000,
149 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
150 REGULATOR_CHANGE_STATUS,
151 .state_mem = {
152 .disabled = 1,
153 },
154 },
155 .num_consumer_supplies = 1,
156 .consumer_supplies = &max8997_buck3,
157};
158
159static struct max8997_regulator_data smdk4x12_max8997_regulators[] = {
160 { MAX8997_BUCK1, &max8997_buck1_data },
161 { MAX8997_BUCK2, &max8997_buck2_data },
162 { MAX8997_BUCK3, &max8997_buck3_data },
163};
164
165static struct max8997_platform_data smdk4x12_max8997_pdata = {
166 .num_regulators = ARRAY_SIZE(smdk4x12_max8997_regulators),
167 .regulators = smdk4x12_max8997_regulators,
168
169 .buck1_voltage[0] = 1100000, /* 1.1V */
170 .buck1_voltage[1] = 1100000, /* 1.1V */
171 .buck1_voltage[2] = 1100000, /* 1.1V */
172 .buck1_voltage[3] = 1100000, /* 1.1V */
173 .buck1_voltage[4] = 1100000, /* 1.1V */
174 .buck1_voltage[5] = 1100000, /* 1.1V */
175 .buck1_voltage[6] = 1000000, /* 1.0V */
176 .buck1_voltage[7] = 950000, /* 0.95V */
177
178 .buck2_voltage[0] = 1100000, /* 1.1V */
179 .buck2_voltage[1] = 1000000, /* 1.0V */
180 .buck2_voltage[2] = 950000, /* 0.95V */
181 .buck2_voltage[3] = 900000, /* 0.9V */
182 .buck2_voltage[4] = 1100000, /* 1.1V */
183 .buck2_voltage[5] = 1000000, /* 1.0V */
184 .buck2_voltage[6] = 950000, /* 0.95V */
185 .buck2_voltage[7] = 900000, /* 0.9V */
186
187 .buck5_voltage[0] = 1100000, /* 1.1V */
188 .buck5_voltage[1] = 1100000, /* 1.1V */
189 .buck5_voltage[2] = 1100000, /* 1.1V */
190 .buck5_voltage[3] = 1100000, /* 1.1V */
191 .buck5_voltage[4] = 1100000, /* 1.1V */
192 .buck5_voltage[5] = 1100000, /* 1.1V */
193 .buck5_voltage[6] = 1100000, /* 1.1V */
194 .buck5_voltage[7] = 1100000, /* 1.1V */
195};
196
197static struct i2c_board_info smdk4x12_i2c_devs0[] __initdata = {
198 {
199 I2C_BOARD_INFO("max8997", 0x66),
200 .platform_data = &smdk4x12_max8997_pdata,
201 }
202};
203
204static struct i2c_board_info smdk4x12_i2c_devs1[] __initdata = {
205 { I2C_BOARD_INFO("wm8994", 0x1a), }
206};
207
208static struct i2c_board_info smdk4x12_i2c_devs3[] __initdata = {
209 /* nothing here yet */
210};
211
212static struct i2c_board_info smdk4x12_i2c_devs7[] __initdata = {
213 /* nothing here yet */
214};
215
216static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = {
217 .no = EXYNOS4_GPD0(1),
218 .func = S3C_GPIO_SFN(2),
219};
220
221static struct platform_pwm_backlight_data smdk4x12_bl_data = {
222 .pwm_id = 1,
223 .pwm_period_ns = 1000,
224};
225
226static struct pwm_lookup smdk4x12_pwm_lookup[] = {
227 PWM_LOOKUP("s3c24xx-pwm.1", 0, "pwm-backlight.0", NULL),
228};
229
230static uint32_t smdk4x12_keymap[] __initdata = {
231 /* KEY(row, col, keycode) */
232 KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3),
233 KEY(1, 6, KEY_4), KEY(1, 7, KEY_5),
234 KEY(2, 5, KEY_D), KEY(2, 6, KEY_A), KEY(2, 7, KEY_B),
235 KEY(0, 7, KEY_E), KEY(0, 5, KEY_C)
236};
237
238static struct matrix_keymap_data smdk4x12_keymap_data __initdata = {
239 .keymap = smdk4x12_keymap,
240 .keymap_size = ARRAY_SIZE(smdk4x12_keymap),
241};
242
243static struct samsung_keypad_platdata smdk4x12_keypad_data __initdata = {
244 .keymap_data = &smdk4x12_keymap_data,
245 .rows = 3,
246 .cols = 8,
247};
248
249#ifdef CONFIG_DRM_EXYNOS_FIMD
250static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
251 .panel = {
252 .timing = {
253 .left_margin = 8,
254 .right_margin = 8,
255 .upper_margin = 6,
256 .lower_margin = 6,
257 .hsync_len = 6,
258 .vsync_len = 4,
259 .xres = 480,
260 .yres = 800,
261 },
262 },
263 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
264 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
265 .default_win = 0,
266 .bpp = 32,
267};
268#else
269static struct s3c_fb_pd_win smdk4x12_fb_win0 = {
270 .xres = 480,
271 .yres = 800,
272 .virtual_x = 480,
273 .virtual_y = 800 * 2,
274 .max_bpp = 32,
275 .default_bpp = 24,
276};
277
278static struct fb_videomode smdk4x12_lcd_timing = {
279 .left_margin = 8,
280 .right_margin = 8,
281 .upper_margin = 6,
282 .lower_margin = 6,
283 .hsync_len = 6,
284 .vsync_len = 4,
285 .xres = 480,
286 .yres = 800,
287};
288
289static struct s3c_fb_platdata smdk4x12_lcd_pdata __initdata = {
290 .win[0] = &smdk4x12_fb_win0,
291 .vtiming = &smdk4x12_lcd_timing,
292 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
293 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
294 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
295};
296#endif
297
298/* USB OTG */
299static struct s3c_hsotg_plat smdk4x12_hsotg_pdata;
300
301static struct platform_device *smdk4x12_devices[] __initdata = {
302 &s3c_device_hsmmc2,
303 &s3c_device_hsmmc3,
304 &s3c_device_i2c0,
305 &s3c_device_i2c1,
306 &s3c_device_i2c3,
307 &s3c_device_i2c7,
308 &s3c_device_rtc,
309 &s3c_device_usb_hsotg,
310 &s3c_device_wdt,
311 &s5p_device_fimc0,
312 &s5p_device_fimc1,
313 &s5p_device_fimc2,
314 &s5p_device_fimc3,
315 &s5p_device_fimc_md,
316 &s5p_device_fimd0,
317 &s5p_device_mfc,
318 &s5p_device_mfc_l,
319 &s5p_device_mfc_r,
320 &samsung_device_keypad,
321};
322
323static void __init smdk4x12_map_io(void)
324{
325 exynos_init_io(NULL, 0);
326 s3c24xx_init_uarts(smdk4x12_uartcfgs, ARRAY_SIZE(smdk4x12_uartcfgs));
327}
328
329static void __init smdk4x12_reserve(void)
330{
331 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
332}
333
334static void __init smdk4x12_machine_init(void)
335{
336 s3c_i2c0_set_platdata(NULL);
337 i2c_register_board_info(0, smdk4x12_i2c_devs0,
338 ARRAY_SIZE(smdk4x12_i2c_devs0));
339
340 s3c_i2c1_set_platdata(NULL);
341 i2c_register_board_info(1, smdk4x12_i2c_devs1,
342 ARRAY_SIZE(smdk4x12_i2c_devs1));
343
344 s3c_i2c3_set_platdata(NULL);
345 i2c_register_board_info(3, smdk4x12_i2c_devs3,
346 ARRAY_SIZE(smdk4x12_i2c_devs3));
347
348 s3c_i2c7_set_platdata(NULL);
349 i2c_register_board_info(7, smdk4x12_i2c_devs7,
350 ARRAY_SIZE(smdk4x12_i2c_devs7));
351
352 samsung_bl_set(&smdk4x12_bl_gpio_info, &smdk4x12_bl_data);
353 pwm_add_table(smdk4x12_pwm_lookup, ARRAY_SIZE(smdk4x12_pwm_lookup));
354
355 samsung_keypad_set_platdata(&smdk4x12_keypad_data);
356
357 s3c_sdhci2_set_platdata(&smdk4x12_hsmmc2_pdata);
358 s3c_sdhci3_set_platdata(&smdk4x12_hsmmc3_pdata);
359
360 s3c_hsotg_set_platdata(&smdk4x12_hsotg_pdata);
361
362#ifdef CONFIG_DRM_EXYNOS_FIMD
363 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
364 exynos4_fimd0_gpio_setup_24bpp();
365#else
366 s5p_fimd0_set_platdata(&smdk4x12_lcd_pdata);
367#endif
368
369 platform_add_devices(smdk4x12_devices, ARRAY_SIZE(smdk4x12_devices));
370}
371
372MACHINE_START(SMDK4212, "SMDK4212")
373 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
374 .atag_offset = 0x100,
375 .smp = smp_ops(exynos_smp_ops),
376 .init_irq = exynos4_init_irq,
377 .map_io = smdk4x12_map_io,
378 .init_machine = smdk4x12_machine_init,
379 .init_time = exynos_init_time,
380 .restart = exynos4_restart,
381 .reserve = &smdk4x12_reserve,
382MACHINE_END
383
384MACHINE_START(SMDK4412, "SMDK4412")
385 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
386 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
387 .atag_offset = 0x100,
388 .smp = smp_ops(exynos_smp_ops),
389 .init_irq = exynos4_init_irq,
390 .map_io = smdk4x12_map_io,
391 .init_machine = smdk4x12_machine_init,
392 .init_late = exynos_init_late,
393 .init_time = exynos_init_time,
394 .restart = exynos4_restart,
395 .reserve = &smdk4x12_reserve,
396MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
deleted file mode 100644
index d95b8cf85253..000000000000
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ /dev/null
@@ -1,444 +0,0 @@
1/* linux/arch/arm/mach-exynos4/mach-smdkv310.c
2 *
3 * Copyright (c) 2010-2011 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/serial_core.h>
12#include <linux/delay.h>
13#include <linux/gpio.h>
14#include <linux/lcd.h>
15#include <linux/mmc/host.h>
16#include <linux/platform_device.h>
17#include <linux/smsc911x.h>
18#include <linux/io.h>
19#include <linux/i2c.h>
20#include <linux/input.h>
21#include <linux/pwm.h>
22#include <linux/pwm_backlight.h>
23#include <linux/platform_data/i2c-s3c2410.h>
24#include <linux/platform_data/s3c-hsotg.h>
25#include <linux/platform_data/usb-ehci-s5p.h>
26#include <linux/platform_data/usb-ohci-exynos.h>
27
28#include <asm/mach/arch.h>
29#include <asm/mach-types.h>
30
31#include <video/platform_lcd.h>
32#include <video/samsung_fimd.h>
33#include <plat/regs-serial.h>
34#include <plat/regs-srom.h>
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/fb.h>
38#include <plat/keypad.h>
39#include <plat/sdhci.h>
40#include <plat/gpio-cfg.h>
41#include <plat/backlight.h>
42#include <plat/mfc.h>
43#include <plat/clock.h>
44#include <plat/hdmi.h>
45
46#include <mach/irqs.h>
47#include <mach/map.h>
48
49#include <drm/exynos_drm.h>
50#include "common.h"
51
52/* Following are default values for UCON, ULCON and UFCON UART registers */
53#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
54 S3C2410_UCON_RXILEVEL | \
55 S3C2410_UCON_TXIRQMODE | \
56 S3C2410_UCON_RXIRQMODE | \
57 S3C2410_UCON_RXFIFO_TOI | \
58 S3C2443_UCON_RXERR_IRQEN)
59
60#define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
61
62#define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
63 S5PV210_UFCON_TXTRIG4 | \
64 S5PV210_UFCON_RXTRIG4)
65
66static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
67 [0] = {
68 .hwport = 0,
69 .flags = 0,
70 .ucon = SMDKV310_UCON_DEFAULT,
71 .ulcon = SMDKV310_ULCON_DEFAULT,
72 .ufcon = SMDKV310_UFCON_DEFAULT,
73 },
74 [1] = {
75 .hwport = 1,
76 .flags = 0,
77 .ucon = SMDKV310_UCON_DEFAULT,
78 .ulcon = SMDKV310_ULCON_DEFAULT,
79 .ufcon = SMDKV310_UFCON_DEFAULT,
80 },
81 [2] = {
82 .hwport = 2,
83 .flags = 0,
84 .ucon = SMDKV310_UCON_DEFAULT,
85 .ulcon = SMDKV310_ULCON_DEFAULT,
86 .ufcon = SMDKV310_UFCON_DEFAULT,
87 },
88 [3] = {
89 .hwport = 3,
90 .flags = 0,
91 .ucon = SMDKV310_UCON_DEFAULT,
92 .ulcon = SMDKV310_ULCON_DEFAULT,
93 .ufcon = SMDKV310_UFCON_DEFAULT,
94 },
95};
96
97static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
98 .cd_type = S3C_SDHCI_CD_INTERNAL,
99#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
100 .max_width = 8,
101 .host_caps = MMC_CAP_8_BIT_DATA,
102#endif
103};
104
105static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
106 .cd_type = S3C_SDHCI_CD_GPIO,
107 .ext_cd_gpio = EXYNOS4_GPK0(2),
108 .ext_cd_gpio_invert = 1,
109};
110
111static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
112 .cd_type = S3C_SDHCI_CD_INTERNAL,
113#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
114 .max_width = 8,
115 .host_caps = MMC_CAP_8_BIT_DATA,
116#endif
117};
118
119static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
120 .cd_type = S3C_SDHCI_CD_GPIO,
121 .ext_cd_gpio = EXYNOS4_GPK2(2),
122 .ext_cd_gpio_invert = 1,
123};
124
125static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
126 unsigned int power)
127{
128 if (power) {
129#if !defined(CONFIG_BACKLIGHT_PWM)
130 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_HIGH, "GPD0");
131 gpio_free(EXYNOS4_GPD0(1));
132#endif
133 /* fire nRESET on power up */
134 gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
135 mdelay(100);
136
137 gpio_set_value(EXYNOS4_GPX0(6), 0);
138 mdelay(10);
139
140 gpio_set_value(EXYNOS4_GPX0(6), 1);
141 mdelay(10);
142
143 gpio_free(EXYNOS4_GPX0(6));
144 } else {
145#if !defined(CONFIG_BACKLIGHT_PWM)
146 gpio_request_one(EXYNOS4_GPD0(1), GPIOF_OUT_INIT_LOW, "GPD0");
147 gpio_free(EXYNOS4_GPD0(1));
148#endif
149 }
150}
151
152static struct plat_lcd_data smdkv310_lcd_lte480wv_data = {
153 .set_power = lcd_lte480wv_set_power,
154};
155
156static struct platform_device smdkv310_lcd_lte480wv = {
157 .name = "platform-lcd",
158 .dev.parent = &s5p_device_fimd0.dev,
159 .dev.platform_data = &smdkv310_lcd_lte480wv_data,
160};
161
162#ifdef CONFIG_DRM_EXYNOS_FIMD
163static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
164 .panel = {
165 .timing = {
166 .left_margin = 13,
167 .right_margin = 8,
168 .upper_margin = 7,
169 .lower_margin = 5,
170 .hsync_len = 3,
171 .vsync_len = 1,
172 .xres = 800,
173 .yres = 480,
174 },
175 },
176 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
177 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
178 .default_win = 0,
179 .bpp = 32,
180};
181#else
182static struct s3c_fb_pd_win smdkv310_fb_win0 = {
183 .max_bpp = 32,
184 .default_bpp = 24,
185 .xres = 800,
186 .yres = 480,
187};
188
189static struct fb_videomode smdkv310_lcd_timing = {
190 .left_margin = 13,
191 .right_margin = 8,
192 .upper_margin = 7,
193 .lower_margin = 5,
194 .hsync_len = 3,
195 .vsync_len = 1,
196 .xres = 800,
197 .yres = 480,
198};
199
200static struct s3c_fb_platdata smdkv310_lcd0_pdata __initdata = {
201 .win[0] = &smdkv310_fb_win0,
202 .vtiming = &smdkv310_lcd_timing,
203 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
204 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
205 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
206};
207#endif
208
209static struct resource smdkv310_smsc911x_resources[] = {
210 [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(1), SZ_64K),
211 [1] = DEFINE_RES_NAMED(IRQ_EINT(5), 1, NULL, IORESOURCE_IRQ \
212 | IRQF_TRIGGER_LOW),
213};
214
215static struct smsc911x_platform_config smsc9215_config = {
216 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
217 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
218 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
219 .phy_interface = PHY_INTERFACE_MODE_MII,
220 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
221};
222
223static struct platform_device smdkv310_smsc911x = {
224 .name = "smsc911x",
225 .id = -1,
226 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
227 .resource = smdkv310_smsc911x_resources,
228 .dev = {
229 .platform_data = &smsc9215_config,
230 },
231};
232
233static uint32_t smdkv310_keymap[] __initdata = {
234 /* KEY(row, col, keycode) */
235 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
236 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
237 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
238 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
239};
240
241static struct matrix_keymap_data smdkv310_keymap_data __initdata = {
242 .keymap = smdkv310_keymap,
243 .keymap_size = ARRAY_SIZE(smdkv310_keymap),
244};
245
246static struct samsung_keypad_platdata smdkv310_keypad_data __initdata = {
247 .keymap_data = &smdkv310_keymap_data,
248 .rows = 2,
249 .cols = 8,
250};
251
252static struct i2c_board_info i2c_devs1[] __initdata = {
253 {I2C_BOARD_INFO("wm8994", 0x1a),},
254};
255
256/* USB EHCI */
257static struct s5p_ehci_platdata smdkv310_ehci_pdata;
258
259static void __init smdkv310_ehci_init(void)
260{
261 struct s5p_ehci_platdata *pdata = &smdkv310_ehci_pdata;
262
263 s5p_ehci_set_platdata(pdata);
264}
265
266/* USB OHCI */
267static struct exynos4_ohci_platdata smdkv310_ohci_pdata;
268
269static void __init smdkv310_ohci_init(void)
270{
271 struct exynos4_ohci_platdata *pdata = &smdkv310_ohci_pdata;
272
273 exynos4_ohci_set_platdata(pdata);
274}
275
276/* USB OTG */
277static struct s3c_hsotg_plat smdkv310_hsotg_pdata;
278
279/* Audio device */
280static struct platform_device smdkv310_device_audio = {
281 .name = "smdk-audio",
282 .id = -1,
283};
284
285static struct platform_device *smdkv310_devices[] __initdata = {
286 &s3c_device_hsmmc0,
287 &s3c_device_hsmmc1,
288 &s3c_device_hsmmc2,
289 &s3c_device_hsmmc3,
290 &s3c_device_i2c1,
291 &s5p_device_i2c_hdmiphy,
292 &s3c_device_rtc,
293 &s3c_device_usb_hsotg,
294 &s3c_device_wdt,
295 &s5p_device_ehci,
296 &s5p_device_fimc0,
297 &s5p_device_fimc1,
298 &s5p_device_fimc2,
299 &s5p_device_fimc3,
300 &s5p_device_fimc_md,
301 &s5p_device_g2d,
302 &s5p_device_jpeg,
303 &exynos4_device_ac97,
304 &exynos4_device_i2s0,
305 &exynos4_device_ohci,
306 &samsung_device_keypad,
307 &s5p_device_mfc,
308 &s5p_device_mfc_l,
309 &s5p_device_mfc_r,
310 &exynos4_device_spdif,
311 &samsung_asoc_idma,
312 &s5p_device_fimd0,
313 &smdkv310_device_audio,
314 &smdkv310_lcd_lte480wv,
315 &smdkv310_smsc911x,
316 &exynos4_device_ahci,
317 &s5p_device_hdmi,
318 &s5p_device_mixer,
319};
320
321static void __init smdkv310_smsc911x_init(void)
322{
323 u32 cs1;
324
325 /* configure nCS1 width to 16 bits */
326 cs1 = __raw_readl(S5P_SROM_BW) &
327 ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
328 cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
329 (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
330 (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
331 S5P_SROM_BW__NCS1__SHIFT;
332 __raw_writel(cs1, S5P_SROM_BW);
333
334 /* set timing for nCS1 suitable for ethernet chip */
335 __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
336 (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
337 (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
338 (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
339 (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
340 (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
341 (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
342}
343
344/* LCD Backlight data */
345static struct samsung_bl_gpio_info smdkv310_bl_gpio_info = {
346 .no = EXYNOS4_GPD0(1),
347 .func = S3C_GPIO_SFN(2),
348};
349
350static struct platform_pwm_backlight_data smdkv310_bl_data = {
351 .pwm_id = 1,
352 .pwm_period_ns = 1000,
353};
354
355/* I2C module and id for HDMIPHY */
356static struct i2c_board_info hdmiphy_info = {
357 I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38),
358};
359
360static struct pwm_lookup smdkv310_pwm_lookup[] = {
361 PWM_LOOKUP("s3c24xx-pwm.1", 0, "pwm-backlight.0", NULL),
362};
363
364static void s5p_tv_setup(void)
365{
366 /* direct HPD to HDMI chip */
367 WARN_ON(gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug"));
368 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
369 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
370}
371
372static void __init smdkv310_map_io(void)
373{
374 exynos_init_io(NULL, 0);
375 s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
376 xxti_f = 12000000;
377 xusbxti_f = 24000000;
378}
379
380static void __init smdkv310_reserve(void)
381{
382 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
383}
384
385static void __init smdkv310_machine_init(void)
386{
387 s3c_i2c1_set_platdata(NULL);
388 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
389
390 smdkv310_smsc911x_init();
391
392 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
393 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
394 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
395 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
396
397 s5p_tv_setup();
398 s5p_i2c_hdmiphy_set_platdata(NULL);
399 s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);
400
401 samsung_keypad_set_platdata(&smdkv310_keypad_data);
402
403 samsung_bl_set(&smdkv310_bl_gpio_info, &smdkv310_bl_data);
404 pwm_add_table(smdkv310_pwm_lookup, ARRAY_SIZE(smdkv310_pwm_lookup));
405
406#ifdef CONFIG_DRM_EXYNOS_FIMD
407 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
408 exynos4_fimd0_gpio_setup_24bpp();
409#else
410 s5p_fimd0_set_platdata(&smdkv310_lcd0_pdata);
411#endif
412
413 smdkv310_ehci_init();
414 smdkv310_ohci_init();
415 s3c_hsotg_set_platdata(&smdkv310_hsotg_pdata);
416
417 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
418}
419
420MACHINE_START(SMDKV310, "SMDKV310")
421 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
422 /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
423 .atag_offset = 0x100,
424 .smp = smp_ops(exynos_smp_ops),
425 .init_irq = exynos4_init_irq,
426 .map_io = smdkv310_map_io,
427 .init_machine = smdkv310_machine_init,
428 .init_time = exynos_init_time,
429 .reserve = &smdkv310_reserve,
430 .restart = exynos4_restart,
431MACHINE_END
432
433MACHINE_START(SMDKC210, "SMDKC210")
434 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
435 .atag_offset = 0x100,
436 .smp = smp_ops(exynos_smp_ops),
437 .init_irq = exynos4_init_irq,
438 .map_io = smdkv310_map_io,
439 .init_machine = smdkv310_machine_init,
440 .init_late = exynos_init_late,
441 .init_time = exynos_init_time,
442 .reserve = &smdkv310_reserve,
443 .restart = exynos4_restart,
444MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
deleted file mode 100644
index 74ddb2b55614..000000000000
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ /dev/null
@@ -1,1159 +0,0 @@
1/* linux/arch/arm/mach-exynos4/mach-universal_c210.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., 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
10#include <linux/platform_device.h>
11#include <linux/serial_core.h>
12#include <linux/input.h>
13#include <linux/i2c.h>
14#include <linux/gpio_keys.h>
15#include <linux/gpio.h>
16#include <linux/interrupt.h>
17#include <linux/fb.h>
18#include <linux/mfd/max8998.h>
19#include <linux/regulator/machine.h>
20#include <linux/regulator/fixed.h>
21#include <linux/regulator/max8952.h>
22#include <linux/mmc/host.h>
23#include <linux/i2c-gpio.h>
24#include <linux/i2c/mcs.h>
25#include <linux/i2c/atmel_mxt_ts.h>
26#include <linux/platform_data/i2c-s3c2410.h>
27#include <linux/platform_data/mipi-csis.h>
28#include <linux/platform_data/s3c-hsotg.h>
29#include <drm/exynos_drm.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach-types.h>
33
34#include <video/samsung_fimd.h>
35#include <plat/regs-serial.h>
36#include <plat/clock.h>
37#include <plat/cpu.h>
38#include <plat/devs.h>
39#include <plat/gpio-cfg.h>
40#include <plat/fb.h>
41#include <plat/mfc.h>
42#include <plat/sdhci.h>
43#include <plat/fimc-core.h>
44#include <plat/camport.h>
45
46#include <mach/map.h>
47
48#include <media/v4l2-mediabus.h>
49#include <media/s5p_fimc.h>
50#include <media/m5mols.h>
51#include <media/s5k6aa.h>
52
53#include "common.h"
54
55/* Following are default values for UCON, ULCON and UFCON UART registers */
56#define UNIVERSAL_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 UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
64
65#define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
66 S5PV210_UFCON_TXTRIG256 | \
67 S5PV210_UFCON_RXTRIG256)
68
69static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
70 [0] = {
71 .hwport = 0,
72 .ucon = UNIVERSAL_UCON_DEFAULT,
73 .ulcon = UNIVERSAL_ULCON_DEFAULT,
74 .ufcon = UNIVERSAL_UFCON_DEFAULT,
75 },
76 [1] = {
77 .hwport = 1,
78 .ucon = UNIVERSAL_UCON_DEFAULT,
79 .ulcon = UNIVERSAL_ULCON_DEFAULT,
80 .ufcon = UNIVERSAL_UFCON_DEFAULT,
81 },
82 [2] = {
83 .hwport = 2,
84 .ucon = UNIVERSAL_UCON_DEFAULT,
85 .ulcon = UNIVERSAL_ULCON_DEFAULT,
86 .ufcon = UNIVERSAL_UFCON_DEFAULT,
87 },
88 [3] = {
89 .hwport = 3,
90 .ucon = UNIVERSAL_UCON_DEFAULT,
91 .ulcon = UNIVERSAL_ULCON_DEFAULT,
92 .ufcon = UNIVERSAL_UFCON_DEFAULT,
93 },
94};
95
96static struct regulator_consumer_supply max8952_consumer =
97 REGULATOR_SUPPLY("vdd_arm", NULL);
98
99static struct regulator_init_data universal_max8952_reg_data = {
100 .constraints = {
101 .name = "VARM_1.2V",
102 .min_uV = 770000,
103 .max_uV = 1400000,
104 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
105 .always_on = 1,
106 .boot_on = 1,
107 },
108 .num_consumer_supplies = 1,
109 .consumer_supplies = &max8952_consumer,
110};
111
112static struct max8952_platform_data universal_max8952_pdata __initdata = {
113 .gpio_vid0 = EXYNOS4_GPX0(3),
114 .gpio_vid1 = EXYNOS4_GPX0(4),
115 .gpio_en = -1, /* Not controllable, set "Always High" */
116 .default_mode = 0, /* vid0 = 0, vid1 = 0 */
117 .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
118 .sync_freq = 0, /* default: fastest */
119 .ramp_speed = 0, /* default: fastest */
120 .reg_data = &universal_max8952_reg_data,
121};
122
123static struct regulator_consumer_supply lp3974_buck1_consumer =
124 REGULATOR_SUPPLY("vdd_int", NULL);
125
126static struct regulator_consumer_supply lp3974_buck2_consumer =
127 REGULATOR_SUPPLY("vddg3d", NULL);
128
129static struct regulator_consumer_supply lp3974_buck3_consumer[] = {
130 REGULATOR_SUPPLY("vdet", "s5p-sdo"),
131 REGULATOR_SUPPLY("vdd_reg", "0-003c"),
132};
133
134static struct regulator_init_data lp3974_buck1_data = {
135 .constraints = {
136 .name = "VINT_1.1V",
137 .min_uV = 750000,
138 .max_uV = 1500000,
139 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
140 REGULATOR_CHANGE_STATUS,
141 .boot_on = 1,
142 .state_mem = {
143 .disabled = 1,
144 },
145 },
146 .num_consumer_supplies = 1,
147 .consumer_supplies = &lp3974_buck1_consumer,
148};
149
150static struct regulator_init_data lp3974_buck2_data = {
151 .constraints = {
152 .name = "VG3D_1.1V",
153 .min_uV = 750000,
154 .max_uV = 1500000,
155 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
156 REGULATOR_CHANGE_STATUS,
157 .boot_on = 1,
158 .state_mem = {
159 .disabled = 1,
160 },
161 },
162 .num_consumer_supplies = 1,
163 .consumer_supplies = &lp3974_buck2_consumer,
164};
165
166static struct regulator_init_data lp3974_buck3_data = {
167 .constraints = {
168 .name = "VCC_1.8V",
169 .min_uV = 1800000,
170 .max_uV = 1800000,
171 .apply_uV = 1,
172 .always_on = 1,
173 .state_mem = {
174 .enabled = 1,
175 },
176 },
177 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck3_consumer),
178 .consumer_supplies = lp3974_buck3_consumer,
179};
180
181static struct regulator_init_data lp3974_buck4_data = {
182 .constraints = {
183 .name = "VMEM_1.2V",
184 .min_uV = 1200000,
185 .max_uV = 1200000,
186 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
187 .apply_uV = 1,
188 .state_mem = {
189 .disabled = 1,
190 },
191 },
192};
193
194static struct regulator_init_data lp3974_ldo2_data = {
195 .constraints = {
196 .name = "VALIVE_1.2V",
197 .min_uV = 1200000,
198 .max_uV = 1200000,
199 .apply_uV = 1,
200 .always_on = 1,
201 .state_mem = {
202 .enabled = 1,
203 },
204 },
205};
206
207static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
208 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"),
209 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
210 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
211 REGULATOR_SUPPLY("vddcore", "s5p-mipi-csis.0"),
212};
213
214static struct regulator_init_data lp3974_ldo3_data = {
215 .constraints = {
216 .name = "VUSB+MIPI_1.1V",
217 .min_uV = 1100000,
218 .max_uV = 1100000,
219 .apply_uV = 1,
220 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
221 .state_mem = {
222 .disabled = 1,
223 },
224 },
225 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
226 .consumer_supplies = lp3974_ldo3_consumer,
227};
228
229static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
230 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"),
231};
232
233static struct regulator_init_data lp3974_ldo4_data = {
234 .constraints = {
235 .name = "VADC_3.3V",
236 .min_uV = 3300000,
237 .max_uV = 3300000,
238 .apply_uV = 1,
239 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
240 .state_mem = {
241 .disabled = 1,
242 },
243 },
244 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
245 .consumer_supplies = lp3974_ldo4_consumer,
246};
247
248static struct regulator_init_data lp3974_ldo5_data = {
249 .constraints = {
250 .name = "VTF_2.8V",
251 .min_uV = 2800000,
252 .max_uV = 2800000,
253 .apply_uV = 1,
254 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
255 .state_mem = {
256 .disabled = 1,
257 },
258 },
259};
260
261static struct regulator_init_data lp3974_ldo6_data = {
262 .constraints = {
263 .name = "LDO6",
264 .min_uV = 2000000,
265 .max_uV = 2000000,
266 .apply_uV = 1,
267 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
268 .state_mem = {
269 .disabled = 1,
270 },
271 },
272};
273
274static struct regulator_consumer_supply lp3974_ldo7_consumer[] = {
275 REGULATOR_SUPPLY("vddio", "s5p-mipi-csis.0"),
276};
277
278static struct regulator_init_data lp3974_ldo7_data = {
279 .constraints = {
280 .name = "VLCD+VMIPI_1.8V",
281 .min_uV = 1800000,
282 .max_uV = 1800000,
283 .apply_uV = 1,
284 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
285 .state_mem = {
286 .disabled = 1,
287 },
288 },
289 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer),
290 .consumer_supplies = lp3974_ldo7_consumer,
291};
292
293static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
294 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"),
295 REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
296};
297
298static struct regulator_init_data lp3974_ldo8_data = {
299 .constraints = {
300 .name = "VUSB+VDAC_3.3V",
301 .min_uV = 3300000,
302 .max_uV = 3300000,
303 .apply_uV = 1,
304 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
305 .state_mem = {
306 .disabled = 1,
307 },
308 },
309 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
310 .consumer_supplies = lp3974_ldo8_consumer,
311};
312
313static struct regulator_consumer_supply lp3974_ldo9_consumer =
314 REGULATOR_SUPPLY("vddio", "0-003c");
315
316static struct regulator_init_data lp3974_ldo9_data = {
317 .constraints = {
318 .name = "VCC_2.8V",
319 .min_uV = 2800000,
320 .max_uV = 2800000,
321 .apply_uV = 1,
322 .always_on = 1,
323 .state_mem = {
324 .enabled = 1,
325 },
326 },
327 .num_consumer_supplies = 1,
328 .consumer_supplies = &lp3974_ldo9_consumer,
329};
330
331static struct regulator_init_data lp3974_ldo10_data = {
332 .constraints = {
333 .name = "VPLL_1.1V",
334 .min_uV = 1100000,
335 .max_uV = 1100000,
336 .boot_on = 1,
337 .apply_uV = 1,
338 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
339 .state_mem = {
340 .disabled = 1,
341 },
342 },
343};
344
345static struct regulator_consumer_supply lp3974_ldo11_consumer =
346 REGULATOR_SUPPLY("dig_28", "0-001f");
347
348static struct regulator_init_data lp3974_ldo11_data = {
349 .constraints = {
350 .name = "CAM_AF_3.3V",
351 .min_uV = 3300000,
352 .max_uV = 3300000,
353 .apply_uV = 1,
354 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
355 .state_mem = {
356 .disabled = 1,
357 },
358 },
359 .num_consumer_supplies = 1,
360 .consumer_supplies = &lp3974_ldo11_consumer,
361};
362
363static struct regulator_init_data lp3974_ldo12_data = {
364 .constraints = {
365 .name = "PS_2.8V",
366 .min_uV = 2800000,
367 .max_uV = 2800000,
368 .apply_uV = 1,
369 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
370 .state_mem = {
371 .disabled = 1,
372 },
373 },
374};
375
376static struct regulator_init_data lp3974_ldo13_data = {
377 .constraints = {
378 .name = "VHIC_1.2V",
379 .min_uV = 1200000,
380 .max_uV = 1200000,
381 .apply_uV = 1,
382 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
383 .state_mem = {
384 .disabled = 1,
385 },
386 },
387};
388
389static struct regulator_consumer_supply lp3974_ldo14_consumer =
390 REGULATOR_SUPPLY("dig_18", "0-001f");
391
392static struct regulator_init_data lp3974_ldo14_data = {
393 .constraints = {
394 .name = "CAM_I_HOST_1.8V",
395 .min_uV = 1800000,
396 .max_uV = 1800000,
397 .apply_uV = 1,
398 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
399 .state_mem = {
400 .disabled = 1,
401 },
402 },
403 .num_consumer_supplies = 1,
404 .consumer_supplies = &lp3974_ldo14_consumer,
405};
406
407
408static struct regulator_consumer_supply lp3974_ldo15_consumer =
409 REGULATOR_SUPPLY("dig_12", "0-001f");
410
411static struct regulator_init_data lp3974_ldo15_data = {
412 .constraints = {
413 .name = "CAM_S_DIG+FM33_CORE_1.2V",
414 .min_uV = 1200000,
415 .max_uV = 1200000,
416 .apply_uV = 1,
417 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
418 .state_mem = {
419 .disabled = 1,
420 },
421 },
422 .num_consumer_supplies = 1,
423 .consumer_supplies = &lp3974_ldo15_consumer,
424};
425
426static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
427 REGULATOR_SUPPLY("vdda", "0-003c"),
428 REGULATOR_SUPPLY("a_sensor", "0-001f"),
429};
430
431static struct regulator_init_data lp3974_ldo16_data = {
432 .constraints = {
433 .name = "CAM_S_ANA_2.8V",
434 .min_uV = 2800000,
435 .max_uV = 2800000,
436 .apply_uV = 1,
437 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
438 .state_mem = {
439 .disabled = 1,
440 },
441 },
442 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer),
443 .consumer_supplies = lp3974_ldo16_consumer,
444};
445
446static struct regulator_init_data lp3974_ldo17_data = {
447 .constraints = {
448 .name = "VCC_3.0V_LCD",
449 .min_uV = 3000000,
450 .max_uV = 3000000,
451 .apply_uV = 1,
452 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
453 .boot_on = 1,
454 .state_mem = {
455 .disabled = 1,
456 },
457 },
458};
459
460static struct regulator_init_data lp3974_32khz_ap_data = {
461 .constraints = {
462 .name = "32KHz AP",
463 .always_on = 1,
464 .state_mem = {
465 .enabled = 1,
466 },
467 },
468};
469
470static struct regulator_init_data lp3974_32khz_cp_data = {
471 .constraints = {
472 .name = "32KHz CP",
473 .state_mem = {
474 .disabled = 1,
475 },
476 },
477};
478
479static struct regulator_init_data lp3974_vichg_data = {
480 .constraints = {
481 .name = "VICHG",
482 .state_mem = {
483 .disabled = 1,
484 },
485 },
486};
487
488static struct regulator_init_data lp3974_esafeout1_data = {
489 .constraints = {
490 .name = "SAFEOUT1",
491 .min_uV = 4800000,
492 .max_uV = 4800000,
493 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
494 .always_on = 1,
495 .state_mem = {
496 .enabled = 1,
497 },
498 },
499};
500
501static struct regulator_init_data lp3974_esafeout2_data = {
502 .constraints = {
503 .name = "SAFEOUT2",
504 .boot_on = 1,
505 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
506 .state_mem = {
507 .enabled = 1,
508 },
509 },
510};
511
512static struct max8998_regulator_data lp3974_regulators[] = {
513 { MAX8998_LDO2, &lp3974_ldo2_data },
514 { MAX8998_LDO3, &lp3974_ldo3_data },
515 { MAX8998_LDO4, &lp3974_ldo4_data },
516 { MAX8998_LDO5, &lp3974_ldo5_data },
517 { MAX8998_LDO6, &lp3974_ldo6_data },
518 { MAX8998_LDO7, &lp3974_ldo7_data },
519 { MAX8998_LDO8, &lp3974_ldo8_data },
520 { MAX8998_LDO9, &lp3974_ldo9_data },
521 { MAX8998_LDO10, &lp3974_ldo10_data },
522 { MAX8998_LDO11, &lp3974_ldo11_data },
523 { MAX8998_LDO12, &lp3974_ldo12_data },
524 { MAX8998_LDO13, &lp3974_ldo13_data },
525 { MAX8998_LDO14, &lp3974_ldo14_data },
526 { MAX8998_LDO15, &lp3974_ldo15_data },
527 { MAX8998_LDO16, &lp3974_ldo16_data },
528 { MAX8998_LDO17, &lp3974_ldo17_data },
529 { MAX8998_BUCK1, &lp3974_buck1_data },
530 { MAX8998_BUCK2, &lp3974_buck2_data },
531 { MAX8998_BUCK3, &lp3974_buck3_data },
532 { MAX8998_BUCK4, &lp3974_buck4_data },
533 { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data },
534 { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data },
535 { MAX8998_ENVICHG, &lp3974_vichg_data },
536 { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data },
537 { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data },
538};
539
540static struct max8998_platform_data universal_lp3974_pdata = {
541 .num_regulators = ARRAY_SIZE(lp3974_regulators),
542 .regulators = lp3974_regulators,
543 .buck1_voltage1 = 1100000, /* INT */
544 .buck1_voltage2 = 1000000,
545 .buck1_voltage3 = 1100000,
546 .buck1_voltage4 = 1000000,
547 .buck1_set1 = EXYNOS4_GPX0(5),
548 .buck1_set2 = EXYNOS4_GPX0(6),
549 .buck2_voltage1 = 1200000, /* G3D */
550 .buck2_voltage2 = 1100000,
551 .buck1_default_idx = 0,
552 .buck2_set3 = EXYNOS4_GPE2(0),
553 .buck2_default_idx = 0,
554 .wakeup = true,
555};
556
557
558enum fixed_regulator_id {
559 FIXED_REG_ID_MMC0,
560 FIXED_REG_ID_HDMI_5V,
561 FIXED_REG_ID_CAM_S_IF,
562 FIXED_REG_ID_CAM_I_CORE,
563 FIXED_REG_ID_CAM_VT_DIO,
564};
565
566static struct regulator_consumer_supply hdmi_fixed_consumer =
567 REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi");
568
569static struct regulator_init_data hdmi_fixed_voltage_init_data = {
570 .constraints = {
571 .name = "HDMI_5V",
572 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
573 },
574 .num_consumer_supplies = 1,
575 .consumer_supplies = &hdmi_fixed_consumer,
576};
577
578static struct fixed_voltage_config hdmi_fixed_voltage_config = {
579 .supply_name = "HDMI_EN1",
580 .microvolts = 5000000,
581 .gpio = EXYNOS4_GPE0(1),
582 .enable_high = true,
583 .init_data = &hdmi_fixed_voltage_init_data,
584};
585
586static struct platform_device hdmi_fixed_voltage = {
587 .name = "reg-fixed-voltage",
588 .id = FIXED_REG_ID_HDMI_5V,
589 .dev = {
590 .platform_data = &hdmi_fixed_voltage_config,
591 },
592};
593
594/* GPIO I2C 5 (PMIC) */
595static struct i2c_board_info i2c5_devs[] __initdata = {
596 {
597 I2C_BOARD_INFO("max8952", 0xC0 >> 1),
598 .platform_data = &universal_max8952_pdata,
599 }, {
600 I2C_BOARD_INFO("lp3974", 0xCC >> 1),
601 .platform_data = &universal_lp3974_pdata,
602 },
603};
604
605/* I2C3 (TSP) */
606static struct mxt_platform_data qt602240_platform_data = {
607 .x_line = 19,
608 .y_line = 11,
609 .x_size = 800,
610 .y_size = 480,
611 .blen = 0x11,
612 .threshold = 0x28,
613 .voltage = 2800000, /* 2.8V */
614 .orient = MXT_DIAGONAL,
615 .irqflags = IRQF_TRIGGER_FALLING,
616};
617
618static struct i2c_board_info i2c3_devs[] __initdata = {
619 {
620 I2C_BOARD_INFO("qt602240_ts", 0x4a),
621 .platform_data = &qt602240_platform_data,
622 },
623};
624
625static void __init universal_tsp_init(void)
626{
627 int gpio;
628
629 /* TSP_LDO_ON: XMDMADDR_11 */
630 gpio = EXYNOS4_GPE2(3);
631 gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
632 gpio_export(gpio, 0);
633
634 /* TSP_INT: XMDMADDR_7 */
635 gpio = EXYNOS4_GPE1(7);
636 gpio_request(gpio, "TSP_INT");
637
638 s5p_register_gpio_interrupt(gpio);
639 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
640 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
641 i2c3_devs[0].irq = gpio_to_irq(gpio);
642}
643
644
645/* GPIO I2C 12 (3 Touchkey) */
646static uint32_t touchkey_keymap[] = {
647 /* MCS_KEY_MAP(value, keycode) */
648 MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */
649 MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */
650};
651
652static struct mcs_platform_data touchkey_data = {
653 .keymap = touchkey_keymap,
654 .keymap_size = ARRAY_SIZE(touchkey_keymap),
655 .key_maxval = 2,
656};
657
658/* GPIO I2C 3_TOUCH 2.8V */
659#define I2C_GPIO_BUS_12 12
660static struct i2c_gpio_platform_data i2c_gpio12_data = {
661 .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */
662 .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */
663};
664
665static struct platform_device i2c_gpio12 = {
666 .name = "i2c-gpio",
667 .id = I2C_GPIO_BUS_12,
668 .dev = {
669 .platform_data = &i2c_gpio12_data,
670 },
671};
672
673static struct i2c_board_info i2c_gpio12_devs[] __initdata = {
674 {
675 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
676 .platform_data = &touchkey_data,
677 },
678};
679
680static void __init universal_touchkey_init(void)
681{
682 int gpio;
683
684 gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */
685 gpio_request(gpio, "3_TOUCH_INT");
686 s5p_register_gpio_interrupt(gpio);
687 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
688 i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
689
690 gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */
691 gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
692}
693
694static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
695 .frequency = 300 * 1000,
696 .sda_delay = 200,
697};
698
699/* GPIO KEYS */
700static struct gpio_keys_button universal_gpio_keys_tables[] = {
701 {
702 .code = KEY_VOLUMEUP,
703 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
704 .desc = "gpio-keys: KEY_VOLUMEUP",
705 .type = EV_KEY,
706 .active_low = 1,
707 .debounce_interval = 1,
708 }, {
709 .code = KEY_VOLUMEDOWN,
710 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
711 .desc = "gpio-keys: KEY_VOLUMEDOWN",
712 .type = EV_KEY,
713 .active_low = 1,
714 .debounce_interval = 1,
715 }, {
716 .code = KEY_CONFIG,
717 .gpio = EXYNOS4_GPX2(2), /* XEINT18 */
718 .desc = "gpio-keys: KEY_CONFIG",
719 .type = EV_KEY,
720 .active_low = 1,
721 .debounce_interval = 1,
722 }, {
723 .code = KEY_CAMERA,
724 .gpio = EXYNOS4_GPX2(3), /* XEINT19 */
725 .desc = "gpio-keys: KEY_CAMERA",
726 .type = EV_KEY,
727 .active_low = 1,
728 .debounce_interval = 1,
729 }, {
730 .code = KEY_OK,
731 .gpio = EXYNOS4_GPX3(5), /* XEINT29 */
732 .desc = "gpio-keys: KEY_OK",
733 .type = EV_KEY,
734 .active_low = 1,
735 .debounce_interval = 1,
736 },
737};
738
739static struct gpio_keys_platform_data universal_gpio_keys_data = {
740 .buttons = universal_gpio_keys_tables,
741 .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
742};
743
744static struct platform_device universal_gpio_keys = {
745 .name = "gpio-keys",
746 .dev = {
747 .platform_data = &universal_gpio_keys_data,
748 },
749};
750
751/* eMMC */
752static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
753 .max_width = 8,
754 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
755 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
756 .cd_type = S3C_SDHCI_CD_PERMANENT,
757};
758
759static struct regulator_consumer_supply mmc0_supplies[] = {
760 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
761};
762
763static struct regulator_init_data mmc0_fixed_voltage_init_data = {
764 .constraints = {
765 .name = "VMEM_VDD_2.8V",
766 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
767 },
768 .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
769 .consumer_supplies = mmc0_supplies,
770};
771
772static struct fixed_voltage_config mmc0_fixed_voltage_config = {
773 .supply_name = "MASSMEMORY_EN",
774 .microvolts = 2800000,
775 .gpio = EXYNOS4_GPE1(3),
776 .enable_high = true,
777 .init_data = &mmc0_fixed_voltage_init_data,
778};
779
780static struct platform_device mmc0_fixed_voltage = {
781 .name = "reg-fixed-voltage",
782 .id = FIXED_REG_ID_MMC0,
783 .dev = {
784 .platform_data = &mmc0_fixed_voltage_config,
785 },
786};
787
788/* SD */
789static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
790 .max_width = 4,
791 .host_caps = MMC_CAP_4_BIT_DATA |
792 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
793 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
794 .ext_cd_gpio_invert = 1,
795 .cd_type = S3C_SDHCI_CD_GPIO,
796};
797
798/* WiFi */
799static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
800 .max_width = 4,
801 .host_caps = MMC_CAP_4_BIT_DATA |
802 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
803 .cd_type = S3C_SDHCI_CD_EXTERNAL,
804};
805
806static void __init universal_sdhci_init(void)
807{
808 s3c_sdhci0_set_platdata(&universal_hsmmc0_data);
809 s3c_sdhci2_set_platdata(&universal_hsmmc2_data);
810 s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
811}
812
813/* I2C1 */
814static struct i2c_board_info i2c1_devs[] __initdata = {
815 /* Gyro, To be updated */
816};
817
818#ifdef CONFIG_DRM_EXYNOS
819static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
820 .panel = {
821 .timing = {
822 .left_margin = 16,
823 .right_margin = 16,
824 .upper_margin = 2,
825 .lower_margin = 28,
826 .hsync_len = 2,
827 .vsync_len = 1,
828 .xres = 480,
829 .yres = 800,
830 .refresh = 55,
831 },
832 },
833 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
834 VIDCON0_CLKSEL_LCD,
835 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
836 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
837 .default_win = 3,
838 .bpp = 32,
839};
840#else
841/* Frame Buffer */
842static struct s3c_fb_pd_win universal_fb_win0 = {
843 .max_bpp = 32,
844 .default_bpp = 16,
845 .xres = 480,
846 .yres = 800,
847 .virtual_x = 480,
848 .virtual_y = 2 * 800,
849};
850
851static struct fb_videomode universal_lcd_timing = {
852 .left_margin = 16,
853 .right_margin = 16,
854 .upper_margin = 2,
855 .lower_margin = 28,
856 .hsync_len = 2,
857 .vsync_len = 1,
858 .xres = 480,
859 .yres = 800,
860 .refresh = 55,
861};
862
863static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
864 .win[0] = &universal_fb_win0,
865 .vtiming = &universal_lcd_timing,
866 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
867 VIDCON0_CLKSEL_LCD,
868 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
869 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
870 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
871};
872#endif
873
874static struct regulator_consumer_supply cam_vt_dio_supply =
875 REGULATOR_SUPPLY("vdd_core", "0-003c");
876
877static struct regulator_init_data cam_vt_dio_reg_init_data = {
878 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
879 .num_consumer_supplies = 1,
880 .consumer_supplies = &cam_vt_dio_supply,
881};
882
883static struct fixed_voltage_config cam_vt_dio_fixed_voltage_cfg = {
884 .supply_name = "CAM_VT_D_IO",
885 .microvolts = 2800000,
886 .gpio = EXYNOS4_GPE2(1), /* CAM_PWR_EN2 */
887 .enable_high = 1,
888 .init_data = &cam_vt_dio_reg_init_data,
889};
890
891static struct platform_device cam_vt_dio_fixed_reg_dev = {
892 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_DIO,
893 .dev = { .platform_data = &cam_vt_dio_fixed_voltage_cfg },
894};
895
896static struct regulator_consumer_supply cam_i_core_supply =
897 REGULATOR_SUPPLY("core", "0-001f");
898
899static struct regulator_init_data cam_i_core_reg_init_data = {
900 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
901 .num_consumer_supplies = 1,
902 .consumer_supplies = &cam_i_core_supply,
903};
904
905static struct fixed_voltage_config cam_i_core_fixed_voltage_cfg = {
906 .supply_name = "CAM_I_CORE_1.2V",
907 .microvolts = 1200000,
908 .gpio = EXYNOS4_GPE2(2), /* CAM_8M_CORE_EN */
909 .enable_high = 1,
910 .init_data = &cam_i_core_reg_init_data,
911};
912
913static struct platform_device cam_i_core_fixed_reg_dev = {
914 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_I_CORE,
915 .dev = { .platform_data = &cam_i_core_fixed_voltage_cfg },
916};
917
918static struct regulator_consumer_supply cam_s_if_supply =
919 REGULATOR_SUPPLY("d_sensor", "0-001f");
920
921static struct regulator_init_data cam_s_if_reg_init_data = {
922 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
923 .num_consumer_supplies = 1,
924 .consumer_supplies = &cam_s_if_supply,
925};
926
927static struct fixed_voltage_config cam_s_if_fixed_voltage_cfg = {
928 .supply_name = "CAM_S_IF_1.8V",
929 .microvolts = 1800000,
930 .gpio = EXYNOS4_GPE3(0), /* CAM_PWR_EN1 */
931 .enable_high = 1,
932 .init_data = &cam_s_if_reg_init_data,
933};
934
935static struct platform_device cam_s_if_fixed_reg_dev = {
936 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_S_IF,
937 .dev = { .platform_data = &cam_s_if_fixed_voltage_cfg },
938};
939
940static struct s5p_platform_mipi_csis mipi_csis_platdata = {
941 .clk_rate = 166000000UL,
942 .lanes = 2,
943 .hs_settle = 12,
944};
945
946#define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3)
947#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */
948#define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5)
949#define GPIO_CAM_VGA_NRST EXYNOS4_GPE4(7)
950#define GPIO_CAM_VGA_NSTBY EXYNOS4_GPE4(6)
951
952static int s5k6aa_set_power(int on)
953{
954 gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
955 return 0;
956}
957
958static struct s5k6aa_platform_data s5k6aa_platdata = {
959 .mclk_frequency = 21600000UL,
960 .gpio_reset = { GPIO_CAM_VGA_NRST, 0 },
961 .gpio_stby = { GPIO_CAM_VGA_NSTBY, 0 },
962 .bus_type = V4L2_MBUS_PARALLEL,
963 .horiz_flip = 1,
964 .set_power = s5k6aa_set_power,
965};
966
967static struct i2c_board_info s5k6aa_board_info = {
968 I2C_BOARD_INFO("S5K6AA", 0x3C),
969 .platform_data = &s5k6aa_platdata,
970};
971
972static int m5mols_set_power(struct device *dev, int on)
973{
974 gpio_set_value(GPIO_CAM_LEVEL_EN(1), !on);
975 gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
976 return 0;
977}
978
979static struct m5mols_platform_data m5mols_platdata = {
980 .gpio_reset = GPIO_CAM_MEGA_nRST,
981 .reset_polarity = 0,
982 .set_power = m5mols_set_power,
983};
984
985static struct i2c_board_info m5mols_board_info = {
986 I2C_BOARD_INFO("M5MOLS", 0x1F),
987 .platform_data = &m5mols_platdata,
988};
989
990static struct fimc_source_info universal_camera_sensors[] = {
991 {
992 .mux_id = 0,
993 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
994 V4L2_MBUS_VSYNC_ACTIVE_LOW,
995 .fimc_bus_type = FIMC_BUS_TYPE_ITU_601,
996 .board_info = &s5k6aa_board_info,
997 .i2c_bus_num = 0,
998 .clk_frequency = 24000000UL,
999 }, {
1000 .mux_id = 0,
1001 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1002 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1003 .fimc_bus_type = FIMC_BUS_TYPE_MIPI_CSI2,
1004 .board_info = &m5mols_board_info,
1005 .i2c_bus_num = 0,
1006 .clk_frequency = 24000000UL,
1007 },
1008};
1009
1010static struct s5p_platform_fimc fimc_md_platdata = {
1011 .source_info = universal_camera_sensors,
1012 .num_clients = ARRAY_SIZE(universal_camera_sensors),
1013};
1014
1015static struct gpio universal_camera_gpios[] = {
1016 { GPIO_CAM_LEVEL_EN(1), GPIOF_OUT_INIT_HIGH, "CAM_LVL_EN1" },
1017 { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" },
1018 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
1019 { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1020 { GPIO_CAM_VGA_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
1021 { GPIO_CAM_VGA_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
1022};
1023
1024/* USB OTG */
1025static struct s3c_hsotg_plat universal_hsotg_pdata;
1026
1027static void __init universal_camera_init(void)
1028{
1029 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1030 &s5p_device_mipi_csis0);
1031 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
1032 &s5p_device_fimc_md);
1033
1034 if (gpio_request_array(universal_camera_gpios,
1035 ARRAY_SIZE(universal_camera_gpios))) {
1036 pr_err("%s: GPIO request failed\n", __func__);
1037 return;
1038 }
1039
1040 if (!s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xf)))
1041 m5mols_board_info.irq = gpio_to_irq(GPIO_CAM_8M_ISP_INT);
1042 else
1043 pr_err("Failed to configure 8M_ISP_INT GPIO\n");
1044
1045 /* Free GPIOs controlled directly by the sensor drivers. */
1046 gpio_free(GPIO_CAM_MEGA_nRST);
1047 gpio_free(GPIO_CAM_8M_ISP_INT);
1048 gpio_free(GPIO_CAM_VGA_NRST);
1049 gpio_free(GPIO_CAM_VGA_NSTBY);
1050
1051 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A))
1052 pr_err("Camera port A setup failed\n");
1053}
1054
1055static struct platform_device *universal_devices[] __initdata = {
1056 /* Samsung Platform Devices */
1057 &s5p_device_mipi_csis0,
1058 &s5p_device_fimc0,
1059 &s5p_device_fimc1,
1060 &s5p_device_fimc2,
1061 &s5p_device_fimc3,
1062 &s5p_device_g2d,
1063 &mmc0_fixed_voltage,
1064 &s3c_device_hsmmc0,
1065 &s3c_device_hsmmc2,
1066 &s3c_device_hsmmc3,
1067 &s3c_device_i2c0,
1068 &s3c_device_i2c3,
1069 &s3c_device_i2c5,
1070 &s5p_device_i2c_hdmiphy,
1071 &hdmi_fixed_voltage,
1072 &s5p_device_hdmi,
1073 &s5p_device_sdo,
1074 &s5p_device_mixer,
1075
1076 /* Universal Devices */
1077 &i2c_gpio12,
1078 &universal_gpio_keys,
1079 &s5p_device_onenand,
1080 &s5p_device_fimd0,
1081 &s5p_device_jpeg,
1082 &s3c_device_usb_hsotg,
1083 &s5p_device_mfc,
1084 &s5p_device_mfc_l,
1085 &s5p_device_mfc_r,
1086 &cam_vt_dio_fixed_reg_dev,
1087 &cam_i_core_fixed_reg_dev,
1088 &cam_s_if_fixed_reg_dev,
1089 &s5p_device_fimc_md,
1090};
1091
1092static void __init universal_map_io(void)
1093{
1094 exynos_init_io(NULL, 0);
1095 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
1096 exynos_set_timer_source(BIT(2) | BIT(4));
1097 xxti_f = 0;
1098 xusbxti_f = 24000000;
1099}
1100
1101static void s5p_tv_setup(void)
1102{
1103 /* direct HPD to HDMI chip */
1104 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
1105 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
1106 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
1107}
1108
1109static void __init universal_reserve(void)
1110{
1111 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1112}
1113
1114static void __init universal_machine_init(void)
1115{
1116 universal_sdhci_init();
1117 s5p_tv_setup();
1118
1119 s3c_i2c0_set_platdata(&universal_i2c0_platdata);
1120 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
1121
1122 universal_tsp_init();
1123 s3c_i2c3_set_platdata(NULL);
1124 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
1125
1126 s3c_i2c5_set_platdata(NULL);
1127 s5p_i2c_hdmiphy_set_platdata(NULL);
1128 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1129
1130#ifdef CONFIG_DRM_EXYNOS
1131 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
1132 exynos4_fimd0_gpio_setup_24bpp();
1133#else
1134 s5p_fimd0_set_platdata(&universal_lcd_pdata);
1135#endif
1136
1137 universal_touchkey_init();
1138 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
1139 ARRAY_SIZE(i2c_gpio12_devs));
1140
1141 s3c_hsotg_set_platdata(&universal_hsotg_pdata);
1142 universal_camera_init();
1143
1144 /* Last */
1145 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
1146}
1147
1148MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
1149 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1150 .atag_offset = 0x100,
1151 .smp = smp_ops(exynos_smp_ops),
1152 .init_irq = exynos4_init_irq,
1153 .map_io = universal_map_io,
1154 .init_machine = universal_machine_init,
1155 .init_late = exynos_init_late,
1156 .init_time = exynos_init_time,
1157 .reserve = &universal_reserve,
1158 .restart = exynos4_restart,
1159MACHINE_END
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index a0e8ff7758a4..deba1308ff16 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -50,6 +50,8 @@ static inline void __iomem *cpu_boot_reg(int cpu)
50 boot_reg = cpu_boot_reg_base(); 50 boot_reg = cpu_boot_reg_base();
51 if (soc_is_exynos4412()) 51 if (soc_is_exynos4412())
52 boot_reg += 4*cpu; 52 boot_reg += 4*cpu;
53 else if (soc_is_exynos5420())
54 boot_reg += 4;
53 return boot_reg; 55 return boot_reg;
54} 56}
55 57
@@ -180,10 +182,14 @@ static void __init exynos_smp_init_cpus(void)
180 void __iomem *scu_base = scu_base_addr(); 182 void __iomem *scu_base = scu_base_addr();
181 unsigned int i, ncores; 183 unsigned int i, ncores;
182 184
183 if (soc_is_exynos5250()) 185 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
184 ncores = 2;
185 else
186 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 186 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
187 else
188 /*
189 * CPU Nodes are passed thru DT and set_cpu_possible
190 * is set by "arm_dt_init_cpu_maps".
191 */
192 return;
187 193
188 /* sanity check */ 194 /* sanity check */
189 if (ncores > nr_cpu_ids) { 195 if (ncores > nr_cpu_ids) {
@@ -200,7 +206,7 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
200{ 206{
201 int i; 207 int i;
202 208
203 if (!(soc_is_exynos5250() || soc_is_exynos5440())) 209 if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9)
204 scu_enable(scu_base_addr()); 210 scu_enable(scu_base_addr());
205 211
206 /* 212 /*
diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index e3faaa812016..41c20692a13f 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -30,7 +30,6 @@
30#include <plat/regs-srom.h> 30#include <plat/regs-srom.h>
31 31
32#include <mach/regs-irq.h> 32#include <mach/regs-irq.h>
33#include <mach/regs-gpio.h>
34#include <mach/regs-clock.h> 33#include <mach/regs-clock.h>
35#include <mach/regs-pmu.h> 34#include <mach/regs-pmu.h>
36#include <mach/pm-core.h> 35#include <mach/pm-core.h>
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 9f1351de52f7..1703593e366c 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -74,17 +74,6 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain)
74 return exynos_pd_power(domain, false); 74 return exynos_pd_power(domain, false);
75} 75}
76 76
77#define EXYNOS_GPD(PD, BASE, NAME) \
78static struct exynos_pm_domain PD = { \
79 .base = (void __iomem *)BASE, \
80 .name = NAME, \
81 .pd = { \
82 .power_off = exynos_pd_power_off, \
83 .power_on = exynos_pd_power_on, \
84 }, \
85}
86
87#ifdef CONFIG_OF
88static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, 77static void exynos_add_device_to_domain(struct exynos_pm_domain *pd,
89 struct device *dev) 78 struct device *dev)
90{ 79{
@@ -157,7 +146,7 @@ static struct notifier_block platform_nb = {
157 .notifier_call = exynos_pm_notifier_call, 146 .notifier_call = exynos_pm_notifier_call,
158}; 147};
159 148
160static __init int exynos_pm_dt_parse_domains(void) 149static __init int exynos4_pm_init_power_domain(void)
161{ 150{
162 struct platform_device *pdev; 151 struct platform_device *pdev;
163 struct device_node *np; 152 struct device_node *np;
@@ -193,94 +182,6 @@ static __init int exynos_pm_dt_parse_domains(void)
193 182
194 return 0; 183 return 0;
195} 184}
196#else
197static __init int exynos_pm_dt_parse_domains(void)
198{
199 return 0;
200}
201#endif /* CONFIG_OF */
202
203static __init __maybe_unused void exynos_pm_add_dev_to_genpd(struct platform_device *pdev,
204 struct exynos_pm_domain *pd)
205{
206 if (pdev->dev.bus) {
207 if (!pm_genpd_add_device(&pd->pd, &pdev->dev))
208 pm_genpd_dev_need_restore(&pdev->dev, true);
209 else
210 pr_info("%s: error in adding %s device to %s power"
211 "domain\n", __func__, dev_name(&pdev->dev),
212 pd->name);
213 }
214}
215
216EXYNOS_GPD(exynos4_pd_mfc, S5P_PMU_MFC_CONF, "pd-mfc");
217EXYNOS_GPD(exynos4_pd_g3d, S5P_PMU_G3D_CONF, "pd-g3d");
218EXYNOS_GPD(exynos4_pd_lcd0, S5P_PMU_LCD0_CONF, "pd-lcd0");
219EXYNOS_GPD(exynos4_pd_lcd1, S5P_PMU_LCD1_CONF, "pd-lcd1");
220EXYNOS_GPD(exynos4_pd_tv, S5P_PMU_TV_CONF, "pd-tv");
221EXYNOS_GPD(exynos4_pd_cam, S5P_PMU_CAM_CONF, "pd-cam");
222EXYNOS_GPD(exynos4_pd_gps, S5P_PMU_GPS_CONF, "pd-gps");
223
224static struct exynos_pm_domain *exynos4_pm_domains[] = {
225 &exynos4_pd_mfc,
226 &exynos4_pd_g3d,
227 &exynos4_pd_lcd0,
228 &exynos4_pd_lcd1,
229 &exynos4_pd_tv,
230 &exynos4_pd_cam,
231 &exynos4_pd_gps,
232};
233
234static __init int exynos4_pm_init_power_domain(void)
235{
236 int idx;
237
238 if (of_have_populated_dt())
239 return exynos_pm_dt_parse_domains();
240
241 for (idx = 0; idx < ARRAY_SIZE(exynos4_pm_domains); idx++) {
242 struct exynos_pm_domain *pd = exynos4_pm_domains[idx];
243 int on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN;
244
245 pm_genpd_init(&pd->pd, NULL, !on);
246 }
247
248#ifdef CONFIG_S5P_DEV_FIMD0
249 exynos_pm_add_dev_to_genpd(&s5p_device_fimd0, &exynos4_pd_lcd0);
250#endif
251#ifdef CONFIG_S5P_DEV_TV
252 exynos_pm_add_dev_to_genpd(&s5p_device_hdmi, &exynos4_pd_tv);
253 exynos_pm_add_dev_to_genpd(&s5p_device_mixer, &exynos4_pd_tv);
254#endif
255#ifdef CONFIG_S5P_DEV_MFC
256 exynos_pm_add_dev_to_genpd(&s5p_device_mfc, &exynos4_pd_mfc);
257#endif
258#ifdef CONFIG_S5P_DEV_FIMC0
259 exynos_pm_add_dev_to_genpd(&s5p_device_fimc0, &exynos4_pd_cam);
260#endif
261#ifdef CONFIG_S5P_DEV_FIMC1
262 exynos_pm_add_dev_to_genpd(&s5p_device_fimc1, &exynos4_pd_cam);
263#endif
264#ifdef CONFIG_S5P_DEV_FIMC2
265 exynos_pm_add_dev_to_genpd(&s5p_device_fimc2, &exynos4_pd_cam);
266#endif
267#ifdef CONFIG_S5P_DEV_FIMC3
268 exynos_pm_add_dev_to_genpd(&s5p_device_fimc3, &exynos4_pd_cam);
269#endif
270#ifdef CONFIG_S5P_DEV_CSIS0
271 exynos_pm_add_dev_to_genpd(&s5p_device_mipi_csis0, &exynos4_pd_cam);
272#endif
273#ifdef CONFIG_S5P_DEV_CSIS1
274 exynos_pm_add_dev_to_genpd(&s5p_device_mipi_csis1, &exynos4_pd_cam);
275#endif
276#ifdef CONFIG_S5P_DEV_G2D
277 exynos_pm_add_dev_to_genpd(&s5p_device_g2d, &exynos4_pd_lcd0);
278#endif
279#ifdef CONFIG_S5P_DEV_JPEG
280 exynos_pm_add_dev_to_genpd(&s5p_device_jpeg, &exynos4_pd_cam);
281#endif
282 return 0;
283}
284arch_initcall(exynos4_pm_init_power_domain); 185arch_initcall(exynos4_pm_init_power_domain);
285 186
286int __init exynos_pm_late_initcall(void) 187int __init exynos_pm_late_initcall(void)
diff --git a/arch/arm/mach-exynos/setup-fimc.c b/arch/arm/mach-exynos/setup-fimc.c
deleted file mode 100644
index 6a45078d9d12..000000000000
--- a/arch/arm/mach-exynos/setup-fimc.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 *
4 * Exynos4 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 exynos4_fimc_setup_gpio(enum s5p_camport_id id)
16{
17 u32 gpio8, gpio5;
18 u32 sfn;
19 int ret;
20
21 switch (id) {
22 case S5P_CAMPORT_A:
23 gpio8 = EXYNOS4_GPJ0(0); /* PCLK, VSYNC, HREF, DATA[0:4] */
24 gpio5 = EXYNOS4_GPJ1(0); /* DATA[5:7], CLKOUT, FIELD */
25 sfn = S3C_GPIO_SFN(2);
26 break;
27
28 case S5P_CAMPORT_B:
29 gpio8 = EXYNOS4_GPE0(0); /* DATA[0:7] */
30 gpio5 = EXYNOS4_GPE1(0); /* PCLK, VSYNC, HREF, CLKOUT, FIELD */
31 sfn = S3C_GPIO_SFN(3);
32 break;
33
34 default:
35 WARN(1, "Wrong camport id: %d\n", id);
36 return -EINVAL;
37 }
38
39 ret = s3c_gpio_cfgall_range(gpio8, 8, sfn, S3C_GPIO_PULL_UP);
40 if (ret)
41 return ret;
42
43 return s3c_gpio_cfgall_range(gpio5, 5, sfn, S3C_GPIO_PULL_UP);
44}
diff --git a/arch/arm/mach-exynos/setup-fimd0.c b/arch/arm/mach-exynos/setup-fimd0.c
deleted file mode 100644
index 5665bb4e980b..000000000000
--- a/arch/arm/mach-exynos/setup-fimd0.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/* linux/arch/arm/mach-exynos4/setup-fimd0.c
2 *
3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Base Exynos4 FIMD 0 configuration
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 <video/samsung_fimd.h>
17#include <plat/gpio-cfg.h>
18
19#include <mach/map.h>
20
21void exynos4_fimd0_gpio_setup_24bpp(void)
22{
23 unsigned int reg;
24
25 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF0(0), 8, S3C_GPIO_SFN(2));
26 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF1(0), 8, S3C_GPIO_SFN(2));
27 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF2(0), 8, S3C_GPIO_SFN(2));
28 s3c_gpio_cfgrange_nopull(EXYNOS4_GPF3(0), 4, S3C_GPIO_SFN(2));
29
30 /*
31 * Set DISPLAY_CONTROL register for Display path selection.
32 *
33 * DISPLAY_CONTROL[1:0]
34 * ---------------------
35 * 00 | MIE
36 * 01 | MDINE
37 * 10 | FIMD : selected
38 * 11 | FIMD
39 */
40 reg = __raw_readl(S3C_VA_SYS + 0x0210);
41 reg |= (1 << 1);
42 __raw_writel(reg, S3C_VA_SYS + 0x0210);
43}
diff --git a/arch/arm/mach-exynos/setup-i2c0.c b/arch/arm/mach-exynos/setup-i2c0.c
deleted file mode 100644
index e2d9dfbf102c..000000000000
--- a/arch/arm/mach-exynos/setup-i2c0.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (c) 2009-2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com/
4 *
5 * I2C0 GPIO configuration.
6 *
7 * Based on plat-s3c64xx/setup-i2c0.c
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14struct platform_device; /* don't need the contents */
15
16#include <linux/gpio.h>
17#include <linux/platform_data/i2c-s3c2410.h>
18#include <plat/gpio-cfg.h>
19#include <plat/cpu.h>
20
21void s3c_i2c0_cfg_gpio(struct platform_device *dev)
22{
23 if (soc_is_exynos5250() || soc_is_exynos5440())
24 /* will be implemented with gpio function */
25 return;
26
27 s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2,
28 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
29}
diff --git a/arch/arm/mach-exynos/setup-i2c1.c b/arch/arm/mach-exynos/setup-i2c1.c
deleted file mode 100644
index 8d2279cc85dc..000000000000
--- a/arch/arm/mach-exynos/setup-i2c1.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c1.c
3 *
4 * Copyright (C) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C1 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c1_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPD1(2), 2,
22 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-i2c2.c b/arch/arm/mach-exynos/setup-i2c2.c
deleted file mode 100644
index 0ed62fc42a77..000000000000
--- a/arch/arm/mach-exynos/setup-i2c2.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c2.c
3 *
4 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C2 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c2_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPA0(6), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-i2c3.c b/arch/arm/mach-exynos/setup-i2c3.c
deleted file mode 100644
index 7787fd26076b..000000000000
--- a/arch/arm/mach-exynos/setup-i2c3.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c3.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C3 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c3_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPA1(2), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-i2c4.c b/arch/arm/mach-exynos/setup-i2c4.c
deleted file mode 100644
index edc847f89826..000000000000
--- a/arch/arm/mach-exynos/setup-i2c4.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c4.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C4 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c4_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPB(2), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-i2c5.c b/arch/arm/mach-exynos/setup-i2c5.c
deleted file mode 100644
index d88af7f75954..000000000000
--- a/arch/arm/mach-exynos/setup-i2c5.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c5.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C5 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c5_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPB(6), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-i2c6.c b/arch/arm/mach-exynos/setup-i2c6.c
deleted file mode 100644
index c590286c9d3a..000000000000
--- a/arch/arm/mach-exynos/setup-i2c6.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c6.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C6 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c6_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPC1(3), 2,
22 S3C_GPIO_SFN(4), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-i2c7.c b/arch/arm/mach-exynos/setup-i2c7.c
deleted file mode 100644
index 1bba75568a5f..000000000000
--- a/arch/arm/mach-exynos/setup-i2c7.c
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c7.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C7 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <linux/platform_data/i2c-s3c2410.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c7_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(EXYNOS4_GPD0(2), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-exynos/setup-keypad.c b/arch/arm/mach-exynos/setup-keypad.c
deleted file mode 100644
index 7862bfb5933d..000000000000
--- a/arch/arm/mach-exynos/setup-keypad.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/* linux/arch/arm/mach-exynos4/setup-keypad.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * GPIO configuration for Exynos4 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 /* Keypads can be of various combinations, Just making sure */
19
20 if (rows > 8) {
21 /* Set all the necessary GPX2 pins: KP_ROW[0~7] */
22 s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3),
23 S3C_GPIO_PULL_UP);
24
25 /* Set all the necessary GPX3 pins: KP_ROW[8~] */
26 s3c_gpio_cfgall_range(EXYNOS4_GPX3(0), (rows - 8),
27 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
28 } else {
29 /* Set all the necessary GPX2 pins: KP_ROW[x] */
30 s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), rows, S3C_GPIO_SFN(3),
31 S3C_GPIO_PULL_UP);
32 }
33
34 /* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */
35 s3c_gpio_cfgrange_nopull(EXYNOS4_GPX1(0), cols, S3C_GPIO_SFN(3));
36}
diff --git a/arch/arm/mach-exynos/setup-sdhci-gpio.c b/arch/arm/mach-exynos/setup-sdhci-gpio.c
deleted file mode 100644
index d5b98c866738..000000000000
--- a/arch/arm/mach-exynos/setup-sdhci-gpio.c
+++ /dev/null
@@ -1,152 +0,0 @@
1/* linux/arch/arm/mach-exynos4/setup-sdhci-gpio.c
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * EXYNOS4 - 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 <mach/gpio.h>
23#include <plat/gpio-cfg.h>
24#include <plat/sdhci.h>
25
26void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
27{
28 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
29 unsigned int gpio;
30
31 /* Set all the necessary GPK0[0:1] pins to special-function 2 */
32 for (gpio = EXYNOS4_GPK0(0); gpio < EXYNOS4_GPK0(2); gpio++) {
33 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
34 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
35 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
36 }
37
38 switch (width) {
39 case 8:
40 for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
41 /* Data pin GPK1[3:6] to special-function 3 */
42 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
43 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
44 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
45 }
46 case 4:
47 for (gpio = EXYNOS4_GPK0(3); gpio <= EXYNOS4_GPK0(6); gpio++) {
48 /* Data pin GPK0[3:6] to special-function 2 */
49 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
50 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
51 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
52 }
53 default:
54 break;
55 }
56
57 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
58 s3c_gpio_cfgpin(EXYNOS4_GPK0(2), S3C_GPIO_SFN(2));
59 s3c_gpio_setpull(EXYNOS4_GPK0(2), S3C_GPIO_PULL_UP);
60 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
61 }
62}
63
64void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
65{
66 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
67 unsigned int gpio;
68
69 /* Set all the necessary GPK1[0:1] pins to special-function 2 */
70 for (gpio = EXYNOS4_GPK1(0); gpio < EXYNOS4_GPK1(2); gpio++) {
71 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
72 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
73 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
74 }
75
76 for (gpio = EXYNOS4_GPK1(3); gpio <= EXYNOS4_GPK1(6); gpio++) {
77 /* Data pin GPK1[3:6] to special-function 2 */
78 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
79 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
80 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
81 }
82
83 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
84 s3c_gpio_cfgpin(EXYNOS4_GPK1(2), S3C_GPIO_SFN(2));
85 s3c_gpio_setpull(EXYNOS4_GPK1(2), S3C_GPIO_PULL_UP);
86 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
87 }
88}
89
90void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
91{
92 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
93 unsigned int gpio;
94
95 /* Set all the necessary GPK2[0:1] pins to special-function 2 */
96 for (gpio = EXYNOS4_GPK2(0); gpio < EXYNOS4_GPK2(2); gpio++) {
97 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
98 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
99 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
100 }
101
102 switch (width) {
103 case 8:
104 for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) {
105 /* Data pin GPK3[3:6] to special-function 3 */
106 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
107 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
108 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
109 }
110 case 4:
111 for (gpio = EXYNOS4_GPK2(3); gpio <= EXYNOS4_GPK2(6); gpio++) {
112 /* Data pin GPK2[3:6] to special-function 2 */
113 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
114 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
115 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
116 }
117 default:
118 break;
119 }
120
121 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
122 s3c_gpio_cfgpin(EXYNOS4_GPK2(2), S3C_GPIO_SFN(2));
123 s3c_gpio_setpull(EXYNOS4_GPK2(2), S3C_GPIO_PULL_UP);
124 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
125 }
126}
127
128void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
129{
130 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
131 unsigned int gpio;
132
133 /* Set all the necessary GPK3[0:1] pins to special-function 2 */
134 for (gpio = EXYNOS4_GPK3(0); gpio < EXYNOS4_GPK3(2); gpio++) {
135 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
136 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
137 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
138 }
139
140 for (gpio = EXYNOS4_GPK3(3); gpio <= EXYNOS4_GPK3(6); gpio++) {
141 /* Data pin GPK3[3:6] to special-function 2 */
142 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
143 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
144 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
145 }
146
147 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
148 s3c_gpio_cfgpin(EXYNOS4_GPK3(2), S3C_GPIO_SFN(2));
149 s3c_gpio_setpull(EXYNOS4_GPK3(2), S3C_GPIO_PULL_UP);
150 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
151 }
152}
diff --git a/arch/arm/mach-exynos/setup-spi.c b/arch/arm/mach-exynos/setup-spi.c
deleted file mode 100644
index 4999829d1c6e..000000000000
--- a/arch/arm/mach-exynos/setup-spi.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/* linux/arch/arm/mach-exynos4/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(EXYNOS4_GPB(0), S3C_GPIO_SFN(2));
18 s3c_gpio_setpull(EXYNOS4_GPB(0), S3C_GPIO_PULL_UP);
19 s3c_gpio_cfgall_range(EXYNOS4_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(EXYNOS4_GPB(4), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(EXYNOS4_GPB(4), S3C_GPIO_PULL_UP);
30 s3c_gpio_cfgall_range(EXYNOS4_GPB(6), 2,
31 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
32 return 0;
33}
34#endif
35
36#ifdef CONFIG_S3C64XX_DEV_SPI2
37int s3c64xx_spi2_cfg_gpio(void)
38{
39 s3c_gpio_cfgpin(EXYNOS4_GPC1(1), S3C_GPIO_SFN(5));
40 s3c_gpio_setpull(EXYNOS4_GPC1(1), S3C_GPIO_PULL_UP);
41 s3c_gpio_cfgall_range(EXYNOS4_GPC1(3), 2,
42 S3C_GPIO_SFN(5), S3C_GPIO_PULL_UP);
43 return 0;
44}
45#endif
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
deleted file mode 100644
index 6af40662a449..000000000000
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ /dev/null
@@ -1,223 +0,0 @@
1/*
2 * Copyright (C) 2011 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 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
12#include <linux/clk.h>
13#include <linux/delay.h>
14#include <linux/err.h>
15#include <linux/io.h>
16#include <linux/platform_device.h>
17#include <mach/regs-pmu.h>
18#include <mach/regs-usb-phy.h>
19#include <plat/cpu.h>
20#include <plat/usb-phy.h>
21
22static atomic_t host_usage;
23
24static int exynos4_usb_host_phy_is_on(void)
25{
26 return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
27}
28
29static void exynos4210_usb_phy_clkset(struct platform_device *pdev)
30{
31 struct clk *xusbxti_clk;
32 u32 phyclk;
33
34 xusbxti_clk = clk_get(&pdev->dev, "xusbxti");
35 if (xusbxti_clk && !IS_ERR(xusbxti_clk)) {
36 if (soc_is_exynos4210()) {
37 /* set clock frequency for PLL */
38 phyclk = readl(EXYNOS4_PHYCLK) & ~EXYNOS4210_CLKSEL_MASK;
39
40 switch (clk_get_rate(xusbxti_clk)) {
41 case 12 * MHZ:
42 phyclk |= EXYNOS4210_CLKSEL_12M;
43 break;
44 case 48 * MHZ:
45 phyclk |= EXYNOS4210_CLKSEL_48M;
46 break;
47 default:
48 case 24 * MHZ:
49 phyclk |= EXYNOS4210_CLKSEL_24M;
50 break;
51 }
52 writel(phyclk, EXYNOS4_PHYCLK);
53 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
54 /* set clock frequency for PLL */
55 phyclk = readl(EXYNOS4_PHYCLK) & ~EXYNOS4X12_CLKSEL_MASK;
56
57 switch (clk_get_rate(xusbxti_clk)) {
58 case 9600 * KHZ:
59 phyclk |= EXYNOS4X12_CLKSEL_9600K;
60 break;
61 case 10 * MHZ:
62 phyclk |= EXYNOS4X12_CLKSEL_10M;
63 break;
64 case 12 * MHZ:
65 phyclk |= EXYNOS4X12_CLKSEL_12M;
66 break;
67 case 19200 * KHZ:
68 phyclk |= EXYNOS4X12_CLKSEL_19200K;
69 break;
70 case 20 * MHZ:
71 phyclk |= EXYNOS4X12_CLKSEL_20M;
72 break;
73 default:
74 case 24 * MHZ:
75 /* default reference clock */
76 phyclk |= EXYNOS4X12_CLKSEL_24M;
77 break;
78 }
79 writel(phyclk, EXYNOS4_PHYCLK);
80 }
81 clk_put(xusbxti_clk);
82 }
83}
84
85static int exynos4210_usb_phy0_init(struct platform_device *pdev)
86{
87 u32 rstcon;
88
89 writel(readl(S5P_USBDEVICE_PHY_CONTROL) | S5P_USBDEVICE_PHY_ENABLE,
90 S5P_USBDEVICE_PHY_CONTROL);
91
92 exynos4210_usb_phy_clkset(pdev);
93
94 /* set to normal PHY0 */
95 writel((readl(EXYNOS4_PHYPWR) & ~PHY0_NORMAL_MASK), EXYNOS4_PHYPWR);
96
97 /* reset PHY0 and Link */
98 rstcon = readl(EXYNOS4_RSTCON) | PHY0_SWRST_MASK;
99 writel(rstcon, EXYNOS4_RSTCON);
100 udelay(10);
101
102 rstcon &= ~PHY0_SWRST_MASK;
103 writel(rstcon, EXYNOS4_RSTCON);
104
105 return 0;
106}
107
108static int exynos4210_usb_phy0_exit(struct platform_device *pdev)
109{
110 writel((readl(EXYNOS4_PHYPWR) | PHY0_ANALOG_POWERDOWN |
111 PHY0_OTG_DISABLE), EXYNOS4_PHYPWR);
112
113 writel(readl(S5P_USBDEVICE_PHY_CONTROL) & ~S5P_USBDEVICE_PHY_ENABLE,
114 S5P_USBDEVICE_PHY_CONTROL);
115
116 return 0;
117}
118
119static int exynos4210_usb_phy1_init(struct platform_device *pdev)
120{
121 struct clk *otg_clk;
122 u32 rstcon;
123 int err;
124
125 atomic_inc(&host_usage);
126
127 otg_clk = clk_get(&pdev->dev, "otg");
128 if (IS_ERR(otg_clk)) {
129 dev_err(&pdev->dev, "Failed to get otg clock\n");
130 return PTR_ERR(otg_clk);
131 }
132
133 err = clk_enable(otg_clk);
134 if (err) {
135 clk_put(otg_clk);
136 return err;
137 }
138
139 if (exynos4_usb_host_phy_is_on())
140 return 0;
141
142 writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
143 S5P_USBHOST_PHY_CONTROL);
144
145 exynos4210_usb_phy_clkset(pdev);
146
147 /* floating prevention logic: disable */
148 writel((readl(EXYNOS4_PHY1CON) | FPENABLEN), EXYNOS4_PHY1CON);
149
150 /* set to normal HSIC 0 and 1 of PHY1 */
151 writel((readl(EXYNOS4_PHYPWR) & ~PHY1_HSIC_NORMAL_MASK),
152 EXYNOS4_PHYPWR);
153
154 /* set to normal standard USB of PHY1 */
155 writel((readl(EXYNOS4_PHYPWR) & ~PHY1_STD_NORMAL_MASK), EXYNOS4_PHYPWR);
156
157 /* reset all ports of both PHY and Link */
158 rstcon = readl(EXYNOS4_RSTCON) | HOST_LINK_PORT_SWRST_MASK |
159 PHY1_SWRST_MASK;
160 writel(rstcon, EXYNOS4_RSTCON);
161 udelay(10);
162
163 rstcon &= ~(HOST_LINK_PORT_SWRST_MASK | PHY1_SWRST_MASK);
164 writel(rstcon, EXYNOS4_RSTCON);
165 udelay(80);
166
167 clk_disable(otg_clk);
168 clk_put(otg_clk);
169
170 return 0;
171}
172
173static int exynos4210_usb_phy1_exit(struct platform_device *pdev)
174{
175 struct clk *otg_clk;
176 int err;
177
178 if (atomic_dec_return(&host_usage) > 0)
179 return 0;
180
181 otg_clk = clk_get(&pdev->dev, "otg");
182 if (IS_ERR(otg_clk)) {
183 dev_err(&pdev->dev, "Failed to get otg clock\n");
184 return PTR_ERR(otg_clk);
185 }
186
187 err = clk_enable(otg_clk);
188 if (err) {
189 clk_put(otg_clk);
190 return err;
191 }
192
193 writel((readl(EXYNOS4_PHYPWR) | PHY1_STD_ANALOG_POWERDOWN),
194 EXYNOS4_PHYPWR);
195
196 writel(readl(S5P_USBHOST_PHY_CONTROL) & ~S5P_USBHOST_PHY_ENABLE,
197 S5P_USBHOST_PHY_CONTROL);
198
199 clk_disable(otg_clk);
200 clk_put(otg_clk);
201
202 return 0;
203}
204
205int s5p_usb_phy_init(struct platform_device *pdev, int type)
206{
207 if (type == USB_PHY_TYPE_DEVICE)
208 return exynos4210_usb_phy0_init(pdev);
209 else if (type == USB_PHY_TYPE_HOST)
210 return exynos4210_usb_phy1_init(pdev);
211
212 return -EINVAL;
213}
214
215int s5p_usb_phy_exit(struct platform_device *pdev, int type)
216{
217 if (type == USB_PHY_TYPE_DEVICE)
218 return exynos4210_usb_phy0_exit(pdev);
219 else if (type == USB_PHY_TYPE_HOST)
220 return exynos4210_usb_phy1_exit(pdev);
221
222 return -EINVAL;
223}
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index e7df2dd43a40..dc5d6becd8c7 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -176,7 +176,6 @@ static const char *highbank_match[] __initconst = {
176 176
177DT_MACHINE_START(HIGHBANK, "Highbank") 177DT_MACHINE_START(HIGHBANK, "Highbank")
178 .smp = smp_ops(highbank_smp_ops), 178 .smp = smp_ops(highbank_smp_ops),
179 .map_io = debug_ll_io_init,
180 .init_irq = highbank_init_irq, 179 .init_irq = highbank_init_irq,
181 .init_time = highbank_timer_init, 180 .init_time = highbank_timer_init,
182 .init_machine = highbank_init, 181 .init_machine = highbank_init,
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ba44328464f3..60661a4b0e24 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -56,9 +56,6 @@ config MXC_USE_EPIT
56 uses the same clocks as the GPT. Anyway, on some systems the GPT 56 uses the same clocks as the GPT. Anyway, on some systems the GPT
57 may be in use for other purposes. 57 may be in use for other purposes.
58 58
59config MXC_ULPI
60 bool
61
62config ARCH_HAS_RNGA 59config ARCH_HAS_RNGA
63 bool 60 bool
64 61
@@ -176,6 +173,7 @@ config ARCH_MX1ADS
176config MACH_SCB9328 173config MACH_SCB9328
177 bool "Synertronixx scb9328" 174 bool "Synertronixx scb9328"
178 select IMX_HAVE_PLATFORM_IMX_UART 175 select IMX_HAVE_PLATFORM_IMX_UART
176 select SOC_IMX1
179 help 177 help
180 Say Y here if you are using a Synertronixx scb9328 board 178 Say Y here if you are using a Synertronixx scb9328 board
181 179
@@ -233,7 +231,7 @@ config MACH_EUKREA_CPUIMX25SD
233 select IMX_HAVE_PLATFORM_MXC_EHCI 231 select IMX_HAVE_PLATFORM_MXC_EHCI
234 select IMX_HAVE_PLATFORM_MXC_NAND 232 select IMX_HAVE_PLATFORM_MXC_NAND
235 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 233 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
236 select MXC_ULPI if USB_ULPI 234 select USB_ULPI_VIEWPORT if USB_ULPI
237 select SOC_IMX25 235 select SOC_IMX25
238 236
239choice 237choice
@@ -284,7 +282,7 @@ config MACH_PCM038
284 select IMX_HAVE_PLATFORM_MXC_NAND 282 select IMX_HAVE_PLATFORM_MXC_NAND
285 select IMX_HAVE_PLATFORM_MXC_W1 283 select IMX_HAVE_PLATFORM_MXC_W1
286 select IMX_HAVE_PLATFORM_SPI_IMX 284 select IMX_HAVE_PLATFORM_SPI_IMX
287 select MXC_ULPI if USB_ULPI 285 select USB_ULPI_VIEWPORT if USB_ULPI
288 select SOC_IMX27 286 select SOC_IMX27
289 help 287 help
290 Include support for phyCORE-i.MX27 (aka pcm038) platform. This 288 Include support for phyCORE-i.MX27 (aka pcm038) platform. This
@@ -314,7 +312,7 @@ config MACH_CPUIMX27
314 select IMX_HAVE_PLATFORM_MXC_EHCI 312 select IMX_HAVE_PLATFORM_MXC_EHCI
315 select IMX_HAVE_PLATFORM_MXC_NAND 313 select IMX_HAVE_PLATFORM_MXC_NAND
316 select IMX_HAVE_PLATFORM_MXC_W1 314 select IMX_HAVE_PLATFORM_MXC_W1
317 select MXC_ULPI if USB_ULPI 315 select USB_ULPI_VIEWPORT if USB_ULPI
318 select SOC_IMX27 316 select SOC_IMX27
319 help 317 help
320 Include support for Eukrea CPUIMX27 platform. This includes 318 Include support for Eukrea CPUIMX27 platform. This includes
@@ -369,7 +367,7 @@ config MACH_MX27_3DS
369 select IMX_HAVE_PLATFORM_MXC_MMC 367 select IMX_HAVE_PLATFORM_MXC_MMC
370 select IMX_HAVE_PLATFORM_SPI_IMX 368 select IMX_HAVE_PLATFORM_SPI_IMX
371 select MXC_DEBUG_BOARD 369 select MXC_DEBUG_BOARD
372 select MXC_ULPI if USB_ULPI 370 select USB_ULPI_VIEWPORT if USB_ULPI
373 select SOC_IMX27 371 select SOC_IMX27
374 help 372 help
375 Include support for MX27PDK platform. This includes specific 373 Include support for MX27PDK platform. This includes specific
@@ -414,7 +412,7 @@ config MACH_PCA100
414 select IMX_HAVE_PLATFORM_MXC_NAND 412 select IMX_HAVE_PLATFORM_MXC_NAND
415 select IMX_HAVE_PLATFORM_MXC_W1 413 select IMX_HAVE_PLATFORM_MXC_W1
416 select IMX_HAVE_PLATFORM_SPI_IMX 414 select IMX_HAVE_PLATFORM_SPI_IMX
417 select MXC_ULPI if USB_ULPI 415 select USB_ULPI_VIEWPORT if USB_ULPI
418 select SOC_IMX27 416 select SOC_IMX27
419 help 417 help
420 Include support for phyCARD-s (aka pca100) platform. This 418 Include support for phyCARD-s (aka pca100) platform. This
@@ -481,7 +479,7 @@ config MACH_MX31LILLY
481 select IMX_HAVE_PLATFORM_MXC_EHCI 479 select IMX_HAVE_PLATFORM_MXC_EHCI
482 select IMX_HAVE_PLATFORM_MXC_MMC 480 select IMX_HAVE_PLATFORM_MXC_MMC
483 select IMX_HAVE_PLATFORM_SPI_IMX 481 select IMX_HAVE_PLATFORM_SPI_IMX
484 select MXC_ULPI if USB_ULPI 482 select USB_ULPI_VIEWPORT if USB_ULPI
485 select SOC_IMX31 483 select SOC_IMX31
486 help 484 help
487 Include support for mx31 based LILLY1131 modules. This includes 485 Include support for mx31 based LILLY1131 modules. This includes
@@ -497,7 +495,7 @@ config MACH_MX31LITE
497 select IMX_HAVE_PLATFORM_MXC_RTC 495 select IMX_HAVE_PLATFORM_MXC_RTC
498 select IMX_HAVE_PLATFORM_SPI_IMX 496 select IMX_HAVE_PLATFORM_SPI_IMX
499 select LEDS_GPIO_REGISTER 497 select LEDS_GPIO_REGISTER
500 select MXC_ULPI if USB_ULPI 498 select USB_ULPI_VIEWPORT if USB_ULPI
501 select SOC_IMX31 499 select SOC_IMX31
502 help 500 help
503 Include support for MX31 LITEKIT platform. This includes specific 501 Include support for MX31 LITEKIT platform. This includes specific
@@ -514,7 +512,7 @@ config MACH_PCM037
514 select IMX_HAVE_PLATFORM_MXC_MMC 512 select IMX_HAVE_PLATFORM_MXC_MMC
515 select IMX_HAVE_PLATFORM_MXC_NAND 513 select IMX_HAVE_PLATFORM_MXC_NAND
516 select IMX_HAVE_PLATFORM_MXC_W1 514 select IMX_HAVE_PLATFORM_MXC_W1
517 select MXC_ULPI if USB_ULPI 515 select USB_ULPI_VIEWPORT if USB_ULPI
518 select SOC_IMX31 516 select SOC_IMX31
519 help 517 help
520 Include support for Phytec pcm037 platform. This includes 518 Include support for Phytec pcm037 platform. This includes
@@ -544,7 +542,7 @@ config MACH_MX31_3DS
544 select IMX_HAVE_PLATFORM_MXC_NAND 542 select IMX_HAVE_PLATFORM_MXC_NAND
545 select IMX_HAVE_PLATFORM_SPI_IMX 543 select IMX_HAVE_PLATFORM_SPI_IMX
546 select MXC_DEBUG_BOARD 544 select MXC_DEBUG_BOARD
547 select MXC_ULPI if USB_ULPI 545 select USB_ULPI_VIEWPORT if USB_ULPI
548 select SOC_IMX31 546 select SOC_IMX31
549 help 547 help
550 Include support for MX31PDK (3DS) platform. This includes specific 548 Include support for MX31PDK (3DS) platform. This includes specific
@@ -571,7 +569,7 @@ config MACH_MX31MOBOARD
571 select IMX_HAVE_PLATFORM_MXC_MMC 569 select IMX_HAVE_PLATFORM_MXC_MMC
572 select IMX_HAVE_PLATFORM_SPI_IMX 570 select IMX_HAVE_PLATFORM_SPI_IMX
573 select LEDS_GPIO_REGISTER 571 select LEDS_GPIO_REGISTER
574 select MXC_ULPI if USB_ULPI 572 select USB_ULPI_VIEWPORT if USB_ULPI
575 select SOC_IMX31 573 select SOC_IMX31
576 help 574 help
577 Include support for mx31moboard platform. This includes specific 575 Include support for mx31moboard platform. This includes specific
@@ -595,7 +593,7 @@ config MACH_ARMADILLO5X0
595 select IMX_HAVE_PLATFORM_MXC_EHCI 593 select IMX_HAVE_PLATFORM_MXC_EHCI
596 select IMX_HAVE_PLATFORM_MXC_MMC 594 select IMX_HAVE_PLATFORM_MXC_MMC
597 select IMX_HAVE_PLATFORM_MXC_NAND 595 select IMX_HAVE_PLATFORM_MXC_NAND
598 select MXC_ULPI if USB_ULPI 596 select USB_ULPI_VIEWPORT if USB_ULPI
599 select SOC_IMX31 597 select SOC_IMX31
600 help 598 help
601 Include support for Atmark Armadillo-500 platform. This includes 599 Include support for Atmark Armadillo-500 platform. This includes
@@ -639,7 +637,7 @@ config MACH_PCM043
639 select IMX_HAVE_PLATFORM_MXC_EHCI 637 select IMX_HAVE_PLATFORM_MXC_EHCI
640 select IMX_HAVE_PLATFORM_MXC_NAND 638 select IMX_HAVE_PLATFORM_MXC_NAND
641 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 639 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
642 select MXC_ULPI if USB_ULPI 640 select USB_ULPI_VIEWPORT if USB_ULPI
643 select SOC_IMX35 641 select SOC_IMX35
644 help 642 help
645 Include support for Phytec pcm043 platform. This includes 643 Include support for Phytec pcm043 platform. This includes
@@ -673,7 +671,7 @@ config MACH_EUKREA_CPUIMX35SD
673 select IMX_HAVE_PLATFORM_MXC_EHCI 671 select IMX_HAVE_PLATFORM_MXC_EHCI
674 select IMX_HAVE_PLATFORM_MXC_NAND 672 select IMX_HAVE_PLATFORM_MXC_NAND
675 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 673 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
676 select MXC_ULPI if USB_ULPI 674 select USB_ULPI_VIEWPORT if USB_ULPI
677 select SOC_IMX35 675 select SOC_IMX35
678 help 676 help
679 Include support for Eukrea CPUIMX35 platform. This includes 677 Include support for Eukrea CPUIMX35 platform. This includes
@@ -816,6 +814,41 @@ config SOC_IMX6Q
816 help 814 help
817 This enables support for Freescale i.MX6 Quad processor. 815 This enables support for Freescale i.MX6 Quad processor.
818 816
817config SOC_IMX6SL
818 bool "i.MX6 SoloLite support"
819 select ARM_ERRATA_754322
820 select ARM_ERRATA_775420
821 select ARM_GIC
822 select CPU_V7
823 select HAVE_IMX_ANATOP
824 select HAVE_IMX_GPC
825 select HAVE_IMX_MMDC
826 select HAVE_IMX_SRC
827 select MFD_SYSCON
828 select PINCTRL
829 select PINCTRL_IMX6SL
830 select PL310_ERRATA_588369 if CACHE_PL310
831 select PL310_ERRATA_727915 if CACHE_PL310
832 select PL310_ERRATA_769419 if CACHE_PL310
833
834 help
835 This enables support for Freescale i.MX6 SoloLite processor.
836
837config SOC_VF610
838 bool "Vybrid Family VF610 support"
839 select CPU_V7
840 select ARM_GIC
841 select CLKSRC_OF
842 select PINCTRL
843 select PINCTRL_VF610
844 select VF_PIT_TIMER
845 select PL310_ERRATA_588369 if CACHE_PL310
846 select PL310_ERRATA_727915 if CACHE_PL310
847 select PL310_ERRATA_769419 if CACHE_PL310
848
849 help
850 This enable support for Freescale Vybrid VF610 processor.
851
819endif 852endif
820 853
821source "arch/arm/mach-imx/devices/Kconfig" 854source "arch/arm/mach-imx/devices/Kconfig"
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 70ae7c490ac0..e20f22d58fd8 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
23obj-$(CONFIG_MXC_TZIC) += tzic.o 23obj-$(CONFIG_MXC_TZIC) += tzic.o
24obj-$(CONFIG_MXC_AVIC) += avic.o 24obj-$(CONFIG_MXC_AVIC) += avic.o
25 25
26obj-$(CONFIG_MXC_ULPI) += ulpi.o
27obj-$(CONFIG_MXC_USE_EPIT) += epit.o 26obj-$(CONFIG_MXC_USE_EPIT) += epit.o
28obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 27obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
29 28
@@ -98,6 +97,7 @@ AFLAGS_headsmp.o :=-Wa,-march=armv7-a
98obj-$(CONFIG_SMP) += headsmp.o platsmp.o 97obj-$(CONFIG_SMP) += headsmp.o platsmp.o
99obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 98obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
100obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o 99obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o mach-imx6q.o
100obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o
101 101
102ifeq ($(CONFIG_PM),y) 102ifeq ($(CONFIG_PM),y)
103obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o 103obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o
@@ -111,4 +111,6 @@ obj-$(CONFIG_MACH_EUKREA_MBIMXSD51_BASEBOARD) += eukrea_mbimxsd51-baseboard.o
111obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o 111obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
112obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 112obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
113 113
114obj-$(CONFIG_SOC_VF610) += clk-vf610.o mach-vf610.o
115
114obj-y += devices/ 116obj-y += devices/
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 6fc486b6a3c6..9afac26fa1cc 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -73,6 +73,12 @@ static const char *mx53_cko2_sel[] = {
73 "tve_sel", "lp_apm", 73 "tve_sel", "lp_apm",
74 "uart_root", "dummy"/* spdif0_clk_root */, 74 "uart_root", "dummy"/* spdif0_clk_root */,
75 "dummy", "dummy", }; 75 "dummy", "dummy", };
76static const char *mx51_spdif_xtal_sel[] = { "osc", "ckih", "ckih2", };
77static const char *mx53_spdif_xtal_sel[] = { "osc", "ckih", "ckih2", "pll4_sw", };
78static const char *spdif_sel[] = { "pll1_sw", "pll2_sw", "pll3_sw", "spdif_xtal_sel", };
79static const char *spdif0_com_sel[] = { "spdif0_podf", "ssi1_root_gate", };
80static const char *mx51_spdif1_com_sel[] = { "spdif1_podf", "ssi2_root_gate", };
81
76 82
77enum imx5_clks { 83enum imx5_clks {
78 dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred, 84 dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred,
@@ -110,7 +116,9 @@ enum imx5_clks {
110 owire_gate, gpu3d_s, gpu2d_s, gpu3d_gate, gpu2d_gate, garb_gate, 116 owire_gate, gpu3d_s, gpu2d_s, gpu3d_gate, gpu2d_gate, garb_gate,
111 cko1_sel, cko1_podf, cko1, 117 cko1_sel, cko1_podf, cko1,
112 cko2_sel, cko2_podf, cko2, 118 cko2_sel, cko2_podf, cko2,
113 srtc_gate, pata_gate, 119 srtc_gate, pata_gate, sata_gate, spdif_xtal_sel, spdif0_sel,
120 spdif1_sel, spdif0_pred, spdif0_podf, spdif1_pred, spdif1_podf,
121 spdif0_com_s, spdif1_com_sel, spdif0_gate, spdif1_gate, spdif_ipg_gate,
114 clk_max 122 clk_max
115}; 123};
116 124
@@ -123,11 +131,13 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
123{ 131{
124 int i; 132 int i;
125 133
134 of_clk_init(NULL);
135
126 clk[dummy] = imx_clk_fixed("dummy", 0); 136 clk[dummy] = imx_clk_fixed("dummy", 0);
127 clk[ckil] = imx_clk_fixed("ckil", rate_ckil); 137 clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil);
128 clk[osc] = imx_clk_fixed("osc", rate_osc); 138 clk[osc] = imx_obtain_fixed_clock("osc", rate_osc);
129 clk[ckih1] = imx_clk_fixed("ckih1", rate_ckih1); 139 clk[ckih1] = imx_obtain_fixed_clock("ckih1", rate_ckih1);
130 clk[ckih2] = imx_clk_fixed("ckih2", rate_ckih2); 140 clk[ckih2] = imx_obtain_fixed_clock("ckih2", rate_ckih2);
131 141
132 clk[lp_apm] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1, 142 clk[lp_apm] = imx_clk_mux("lp_apm", MXC_CCM_CCSR, 9, 1,
133 lp_apm_sel, ARRAY_SIZE(lp_apm_sel)); 143 lp_apm_sel, ARRAY_SIZE(lp_apm_sel));
@@ -267,6 +277,13 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
267 clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22); 277 clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22);
268 clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28); 278 clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28);
269 clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0); 279 clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0);
280 clk[spdif0_sel] = imx_clk_mux("spdif0_sel", MXC_CCM_CSCMR2, 0, 2, spdif_sel, ARRAY_SIZE(spdif_sel));
281 clk[spdif0_pred] = imx_clk_divider("spdif0_pred", "spdif0_sel", MXC_CCM_CDCDR, 25, 3);
282 clk[spdif0_podf] = imx_clk_divider("spdif0_podf", "spdif0_pred", MXC_CCM_CDCDR, 19, 6);
283 clk[spdif0_com_s] = imx_clk_mux_flags("spdif0_com_sel", MXC_CCM_CSCMR2, 4, 1,
284 spdif0_com_sel, ARRAY_SIZE(spdif0_com_sel), CLK_SET_RATE_PARENT);
285 clk[spdif0_gate] = imx_clk_gate2("spdif0_gate", "spdif0_com_sel", MXC_CCM_CCGR5, 26);
286 clk[spdif_ipg_gate] = imx_clk_gate2("spdif_ipg_gate", "ipg", MXC_CCM_CCGR5, 30);
270 287
271 for (i = 0; i < ARRAY_SIZE(clk); i++) 288 for (i = 0; i < ARRAY_SIZE(clk); i++)
272 if (IS_ERR(clk[i])) 289 if (IS_ERR(clk[i]))
@@ -310,8 +327,6 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
310 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0"); 327 clk_register_clkdev(clk[ssi1_ipg_gate], NULL, "imx-ssi.0");
311 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1"); 328 clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
312 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2"); 329 clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2");
313 clk_register_clkdev(clk[ssi_ext1_gate], "ssi_ext1", NULL);
314 clk_register_clkdev(clk[ssi_ext2_gate], "ssi_ext2", NULL);
315 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma"); 330 clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
316 clk_register_clkdev(clk[cpu_podf], NULL, "cpufreq-cpu0.0"); 331 clk_register_clkdev(clk[cpu_podf], NULL, "cpufreq-cpu0.0");
317 clk_register_clkdev(clk[iim_gate], "iim", NULL); 332 clk_register_clkdev(clk[iim_gate], "iim", NULL);
@@ -378,6 +393,15 @@ int __init mx51_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
378 clk[mipi_hsc2_gate] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8); 393 clk[mipi_hsc2_gate] = imx_clk_gate2("mipi_hsc2_gate", "ipg", MXC_CCM_CCGR4, 8);
379 clk[mipi_esc_gate] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10); 394 clk[mipi_esc_gate] = imx_clk_gate2("mipi_esc_gate", "ipg", MXC_CCM_CCGR4, 10);
380 clk[mipi_hsp_gate] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12); 395 clk[mipi_hsp_gate] = imx_clk_gate2("mipi_hsp_gate", "ipg", MXC_CCM_CCGR4, 12);
396 clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
397 mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel));
398 clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2,
399 spdif_sel, ARRAY_SIZE(spdif_sel));
400 clk[spdif1_pred] = imx_clk_divider("spdif1_podf", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
401 clk[spdif1_podf] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6);
402 clk[spdif1_com_sel] = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1,
403 mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
404 clk[spdif1_gate] = imx_clk_gate2("spdif1_gate", "spdif1_com_sel", MXC_CCM_CCGR5, 28);
381 405
382 for (i = 0; i < ARRAY_SIZE(clk); i++) 406 for (i = 0; i < ARRAY_SIZE(clk); i++)
383 if (IS_ERR(clk[i])) 407 if (IS_ERR(clk[i]))
@@ -485,6 +509,7 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
485 clk[can2_serial_gate] = imx_clk_gate2("can2_serial_gate", "can_sel", MXC_CCM_CCGR4, 8); 509 clk[can2_serial_gate] = imx_clk_gate2("can2_serial_gate", "can_sel", MXC_CCM_CCGR4, 8);
486 clk[can2_ipg_gate] = imx_clk_gate2("can2_ipg_gate", "ipg", MXC_CCM_CCGR4, 6); 510 clk[can2_ipg_gate] = imx_clk_gate2("can2_ipg_gate", "ipg", MXC_CCM_CCGR4, 6);
487 clk[i2c3_gate] = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22); 511 clk[i2c3_gate] = imx_clk_gate2("i2c3_gate", "per_root", MXC_CCM_CCGR1, 22);
512 clk[sata_gate] = imx_clk_gate2("sata_gate", "ipg", MXC_CCM_CCGR4, 2);
488 513
489 clk[cko1_sel] = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4, 514 clk[cko1_sel] = imx_clk_mux("cko1_sel", MXC_CCM_CCOSR, 0, 4,
490 mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel)); 515 mx53_cko1_sel, ARRAY_SIZE(mx53_cko1_sel));
@@ -495,6 +520,8 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
495 mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel)); 520 mx53_cko2_sel, ARRAY_SIZE(mx53_cko2_sel));
496 clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3); 521 clk[cko2_podf] = imx_clk_divider("cko2_podf", "cko2_sel", MXC_CCM_CCOSR, 21, 3);
497 clk[cko2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24); 522 clk[cko2] = imx_clk_gate2("cko2", "cko2_podf", MXC_CCM_CCOSR, 24);
523 clk[spdif_xtal_sel] = imx_clk_mux("spdif_xtal_sel", MXC_CCM_CSCMR1, 2, 2,
524 mx53_spdif_xtal_sel, ARRAY_SIZE(mx53_spdif_xtal_sel));
498 525
499 for (i = 0; i < ARRAY_SIZE(clk); i++) 526 for (i = 0; i < ARRAY_SIZE(clk); i++)
500 if (IS_ERR(clk[i])) 527 if (IS_ERR(clk[i]))
@@ -542,42 +569,12 @@ int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
542 return 0; 569 return 0;
543} 570}
544 571
545#ifdef CONFIG_OF
546static void __init clk_get_freq_dt(unsigned long *ckil, unsigned long *osc,
547 unsigned long *ckih1, unsigned long *ckih2)
548{
549 struct device_node *np;
550
551 /* retrieve the freqency of fixed clocks from device tree */
552 for_each_compatible_node(np, NULL, "fixed-clock") {
553 u32 rate;
554 if (of_property_read_u32(np, "clock-frequency", &rate))
555 continue;
556
557 if (of_device_is_compatible(np, "fsl,imx-ckil"))
558 *ckil = rate;
559 else if (of_device_is_compatible(np, "fsl,imx-osc"))
560 *osc = rate;
561 else if (of_device_is_compatible(np, "fsl,imx-ckih1"))
562 *ckih1 = rate;
563 else if (of_device_is_compatible(np, "fsl,imx-ckih2"))
564 *ckih2 = rate;
565 }
566}
567
568int __init mx51_clocks_init_dt(void) 572int __init mx51_clocks_init_dt(void)
569{ 573{
570 unsigned long ckil, osc, ckih1, ckih2; 574 return mx51_clocks_init(0, 0, 0, 0);
571
572 clk_get_freq_dt(&ckil, &osc, &ckih1, &ckih2);
573 return mx51_clocks_init(ckil, osc, ckih1, ckih2);
574} 575}
575 576
576int __init mx53_clocks_init_dt(void) 577int __init mx53_clocks_init_dt(void)
577{ 578{
578 unsigned long ckil, osc, ckih1, ckih2; 579 return mx53_clocks_init(0, 0, 0, 0);
579
580 clk_get_freq_dt(&ckil, &osc, &ckih1, &ckih2);
581 return mx53_clocks_init(ckil, osc, ckih1, ckih2);
582} 580}
583#endif
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 4e3148ce852d..4282e99f5ca1 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -238,7 +238,7 @@ enum mx6q_clks {
238 pll4_audio, pll5_video, pll8_mlb, pll7_usb_host, pll6_enet, ssi1_ipg, 238 pll4_audio, pll5_video, pll8_mlb, pll7_usb_host, pll6_enet, ssi1_ipg,
239 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5, 239 ssi2_ipg, ssi3_ipg, rom, usbphy1, usbphy2, ldb_di0_div_3_5, ldb_di1_div_3_5,
240 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate, 240 sata_ref, sata_ref_100m, pcie_ref, pcie_ref_125m, enet_ref, usbphy1_gate,
241 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, clk_max 241 usbphy2_gate, pll4_post_div, pll5_post_div, pll5_video_div, eim_slow, clk_max
242}; 242};
243 243
244static struct clk *clk[clk_max]; 244static struct clk *clk[clk_max];
@@ -270,27 +270,16 @@ static struct clk_div_table video_div_table[] = {
270 { } 270 { }
271}; 271};
272 272
273int __init mx6q_clocks_init(void) 273static void __init imx6q_clocks_init(struct device_node *ccm_node)
274{ 274{
275 struct device_node *np; 275 struct device_node *np;
276 void __iomem *base; 276 void __iomem *base;
277 int i, irq; 277 int i, irq;
278 278
279 clk[dummy] = imx_clk_fixed("dummy", 0); 279 clk[dummy] = imx_clk_fixed("dummy", 0);
280 280 clk[ckil] = imx_obtain_fixed_clock("ckil", 0);
281 /* retrieve the freqency of fixed clocks from device tree */ 281 clk[ckih] = imx_obtain_fixed_clock("ckih1", 0);
282 for_each_compatible_node(np, NULL, "fixed-clock") { 282 clk[osc] = imx_obtain_fixed_clock("osc", 0);
283 u32 rate;
284 if (of_property_read_u32(np, "clock-frequency", &rate))
285 continue;
286
287 if (of_device_is_compatible(np, "fsl,imx-ckil"))
288 clk[ckil] = imx_clk_fixed("ckil", rate);
289 else if (of_device_is_compatible(np, "fsl,imx-ckih1"))
290 clk[ckih] = imx_clk_fixed("ckih", rate);
291 else if (of_device_is_compatible(np, "fsl,imx-osc"))
292 clk[osc] = imx_clk_fixed("osc", rate);
293 }
294 283
295 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop"); 284 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
296 base = of_iomap(np, 0); 285 base = of_iomap(np, 0);
@@ -312,7 +301,6 @@ int __init mx6q_clocks_init(void)
312 clk[pll5_video] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f); 301 clk[pll5_video] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f);
313 clk[pll6_enet] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3); 302 clk[pll6_enet] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3);
314 clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x3); 303 clk[pll7_usb_host] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host","osc", base + 0x20, 0x3);
315 clk[pll8_mlb] = imx_clk_pllv3(IMX_PLLV3_MLB, "pll8_mlb", "osc", base + 0xd0, 0x0);
316 304
317 /* 305 /*
318 * Bit 20 is the reserved and read-only bit, we do this only for: 306 * Bit 20 is the reserved and read-only bit, we do this only for:
@@ -360,7 +348,7 @@ int __init mx6q_clocks_init(void)
360 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); 348 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);
361 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); 349 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);
362 350
363 np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-ccm"); 351 np = ccm_node;
364 base = of_iomap(np, 0); 352 base = of_iomap(np, 0);
365 WARN_ON(!base); 353 WARN_ON(!base);
366 ccm_base = base; 354 ccm_base = base;
@@ -481,7 +469,14 @@ int __init mx6q_clocks_init(void)
481 clk[esai] = imx_clk_gate2("esai", "esai_podf", base + 0x6c, 16); 469 clk[esai] = imx_clk_gate2("esai", "esai_podf", base + 0x6c, 16);
482 clk[gpt_ipg] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20); 470 clk[gpt_ipg] = imx_clk_gate2("gpt_ipg", "ipg", base + 0x6c, 20);
483 clk[gpt_ipg_per] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22); 471 clk[gpt_ipg_per] = imx_clk_gate2("gpt_ipg_per", "ipg_per", base + 0x6c, 22);
484 clk[gpu2d_core] = imx_clk_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24); 472 if (cpu_is_imx6dl())
473 /*
474 * The multiplexer and divider of imx6q clock gpu3d_shader get
475 * redefined/reused as gpu2d_core_sel and gpu2d_core_podf on imx6dl.
476 */
477 clk[gpu2d_core] = imx_clk_gate2("gpu2d_core", "gpu3d_shader", base + 0x6c, 24);
478 else
479 clk[gpu2d_core] = imx_clk_gate2("gpu2d_core", "gpu2d_core_podf", base + 0x6c, 24);
485 clk[gpu3d_core] = imx_clk_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26); 480 clk[gpu3d_core] = imx_clk_gate2("gpu3d_core", "gpu3d_core_podf", base + 0x6c, 26);
486 clk[hdmi_iahb] = imx_clk_gate2("hdmi_iahb", "ahb", base + 0x70, 0); 481 clk[hdmi_iahb] = imx_clk_gate2("hdmi_iahb", "ahb", base + 0x70, 0);
487 clk[hdmi_isfr] = imx_clk_gate2("hdmi_isfr", "pll3_pfd1_540m", base + 0x70, 4); 482 clk[hdmi_isfr] = imx_clk_gate2("hdmi_isfr", "pll3_pfd1_540m", base + 0x70, 4);
@@ -499,7 +494,14 @@ int __init mx6q_clocks_init(void)
499 clk[ldb_di1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14); 494 clk[ldb_di1] = imx_clk_gate2("ldb_di1", "ldb_di1_podf", base + 0x74, 14);
500 clk[ipu2_di1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10); 495 clk[ipu2_di1] = imx_clk_gate2("ipu2_di1", "ipu2_di1_sel", base + 0x74, 10);
501 clk[hsi_tx] = imx_clk_gate2("hsi_tx", "hsi_tx_podf", base + 0x74, 16); 496 clk[hsi_tx] = imx_clk_gate2("hsi_tx", "hsi_tx_podf", base + 0x74, 16);
502 clk[mlb] = imx_clk_gate2("mlb", "axi", base + 0x74, 18); 497 if (cpu_is_imx6dl())
498 /*
499 * The multiplexer and divider of the imx6q clock gpu2d get
500 * redefined/reused as mlb_sys_sel and mlb_sys_clk_podf on imx6dl.
501 */
502 clk[mlb] = imx_clk_gate2("mlb", "gpu2d_core_podf", base + 0x74, 18);
503 else
504 clk[mlb] = imx_clk_gate2("mlb", "axi", base + 0x74, 18);
503 clk[mmdc_ch0_axi] = imx_clk_gate2("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20); 505 clk[mmdc_ch0_axi] = imx_clk_gate2("mmdc_ch0_axi", "mmdc_ch0_axi_podf", base + 0x74, 20);
504 clk[mmdc_ch1_axi] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22); 506 clk[mmdc_ch1_axi] = imx_clk_gate2("mmdc_ch1_axi", "mmdc_ch1_axi_podf", base + 0x74, 22);
505 clk[ocram] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28); 507 clk[ocram] = imx_clk_gate2("ocram", "ahb", base + 0x74, 28);
@@ -528,6 +530,7 @@ int __init mx6q_clocks_init(void)
528 clk[usdhc2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4); 530 clk[usdhc2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4);
529 clk[usdhc3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6); 531 clk[usdhc3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
530 clk[usdhc4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8); 532 clk[usdhc4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
533 clk[eim_slow] = imx_clk_gate2("eim_slow", "emi_slow_podf", base + 0x80, 10);
531 clk[vdo_axi] = imx_clk_gate2("vdo_axi", "vdo_axi_sel", base + 0x80, 12); 534 clk[vdo_axi] = imx_clk_gate2("vdo_axi", "vdo_axi_sel", base + 0x80, 12);
532 clk[vpu_axi] = imx_clk_gate2("vpu_axi", "vpu_axi_podf", base + 0x80, 14); 535 clk[vpu_axi] = imx_clk_gate2("vpu_axi", "vpu_axi_podf", base + 0x80, 14);
533 clk[cko1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7); 536 clk[cko1] = imx_clk_gate("cko1", "cko1_podf", base + 0x60, 7);
@@ -547,6 +550,8 @@ int __init mx6q_clocks_init(void)
547 clk_register_clkdev(clk[ahb], "ahb", NULL); 550 clk_register_clkdev(clk[ahb], "ahb", NULL);
548 clk_register_clkdev(clk[cko1], "cko1", NULL); 551 clk_register_clkdev(clk[cko1], "cko1", NULL);
549 clk_register_clkdev(clk[arm], NULL, "cpu0"); 552 clk_register_clkdev(clk[arm], NULL, "cpu0");
553 clk_register_clkdev(clk[pll4_post_div], "pll4_post_div", NULL);
554 clk_register_clkdev(clk[pll4_audio], "pll4_audio", NULL);
550 555
551 if (imx6q_revision() != IMX_CHIP_REVISION_1_0) { 556 if (imx6q_revision() != IMX_CHIP_REVISION_1_0) {
552 clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]); 557 clk_set_parent(clk[ldb_di0_sel], clk[pll5_video_div]);
@@ -576,6 +581,5 @@ int __init mx6q_clocks_init(void)
576 WARN_ON(!base); 581 WARN_ON(!base);
577 irq = irq_of_parse_and_map(np, 0); 582 irq = irq_of_parse_and_map(np, 0);
578 mxc_timer_init(base, irq); 583 mxc_timer_init(base, irq);
579
580 return 0;
581} 584}
585CLK_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
new file mode 100644
index 000000000000..a307ac22dffe
--- /dev/null
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -0,0 +1,267 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#include <linux/clk.h>
11#include <linux/clkdev.h>
12#include <linux/err.h>
13#include <linux/of.h>
14#include <linux/of_address.h>
15#include <linux/of_irq.h>
16#include <dt-bindings/clock/imx6sl-clock.h>
17
18#include "clk.h"
19#include "common.h"
20
21static const char const *step_sels[] = { "osc", "pll2_pfd2", };
22static const char const *pll1_sw_sels[] = { "pll1_sys", "step", };
23static const char const *ocram_alt_sels[] = { "pll2_pfd2", "pll3_pfd1", };
24static const char const *ocram_sels[] = { "periph", "ocram_alt_sels", };
25static const char const *pre_periph_sels[] = { "pll2_bus", "pll2_pfd2", "pll2_pfd0", "pll2_198m", };
26static const char const *periph_clk2_sels[] = { "pll3_usb_otg", "osc", "osc", "dummy", };
27static const char const *periph2_clk2_sels[] = { "pll3_usb_otg", "pll2_bus", };
28static const char const *periph_sels[] = { "pre_periph_sel", "periph_clk2_podf", };
29static const char const *periph2_sels[] = { "pre_periph2_sel", "periph2_clk2_podf", };
30static const char const *csi_lcdif_sels[] = { "mmdc", "pll2_pfd2", "pll3_120m", "pll3_pfd1", };
31static const char const *usdhc_sels[] = { "pll2_pfd2", "pll2_pfd0", };
32static const char const *ssi_sels[] = { "pll3_pfd2", "pll3_pfd3", "pll4_post_div", "dummy", };
33static const char const *perclk_sels[] = { "ipg", "osc", };
34static const char const *epdc_pxp_sels[] = { "mmdc", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd2", "pll3_pfd1", };
35static const char const *gpu2d_ovg_sels[] = { "pll3_pfd1", "pll3_usb_otg", "pll2_bus", "pll2_pfd2", };
36static const char const *gpu2d_sels[] = { "pll2_pfd2", "pll3_usb_otg", "pll3_pfd1", "pll2_bus", };
37static const char const *lcdif_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll3_pfd0", "pll3_pfd1", };
38static const char const *epdc_pix_sels[] = { "pll2_bus", "pll3_usb_otg", "pll5_video_div", "pll2_pfd0", "pll2_pfd1", "pll3_pfd1", };
39static const char const *audio_sels[] = { "pll4_post_div", "pll3_pfd2", "pll3_pfd3", "pll3_usb_otg", };
40static const char const *ecspi_sels[] = { "pll3_60m", "osc", };
41static const char const *uart_sels[] = { "pll3_80m", "osc", };
42
43static struct clk_div_table clk_enet_ref_table[] = {
44 { .val = 0, .div = 20, },
45 { .val = 1, .div = 10, },
46 { .val = 2, .div = 5, },
47 { .val = 3, .div = 4, },
48 { }
49};
50
51static struct clk_div_table post_div_table[] = {
52 { .val = 2, .div = 1, },
53 { .val = 1, .div = 2, },
54 { .val = 0, .div = 4, },
55 { }
56};
57
58static struct clk_div_table video_div_table[] = {
59 { .val = 0, .div = 1, },
60 { .val = 1, .div = 2, },
61 { .val = 2, .div = 1, },
62 { .val = 3, .div = 4, },
63 { }
64};
65
66static struct clk *clks[IMX6SL_CLK_CLK_END];
67static struct clk_onecell_data clk_data;
68
69static void __init imx6sl_clocks_init(struct device_node *ccm_node)
70{
71 struct device_node *np;
72 void __iomem *base;
73 int irq;
74 int i;
75
76 clks[IMX6SL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
77 clks[IMX6SL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
78 clks[IMX6SL_CLK_OSC] = imx_obtain_fixed_clock("osc", 0);
79
80 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop");
81 base = of_iomap(np, 0);
82 WARN_ON(!base);
83
84 /* type name parent base div_mask */
85 clks[IMX6SL_CLK_PLL1_SYS] = imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_sys", "osc", base, 0x7f);
86 clks[IMX6SL_CLK_PLL2_BUS] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc", base + 0x30, 0x1);
87 clks[IMX6SL_CLK_PLL3_USB_OTG] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc", base + 0x10, 0x3);
88 clks[IMX6SL_CLK_PLL4_AUDIO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4_audio", "osc", base + 0x70, 0x7f);
89 clks[IMX6SL_CLK_PLL5_VIDEO] = imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "osc", base + 0xa0, 0x7f);
90 clks[IMX6SL_CLK_PLL6_ENET] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll6_enet", "osc", base + 0xe0, 0x3);
91 clks[IMX6SL_CLK_PLL7_USB_HOST] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_usb_host", "osc", base + 0x20, 0x3);
92
93 /*
94 * usbphy1 and usbphy2 are implemented as dummy gates using reserve
95 * bit 20. They are used by phy driver to keep the refcount of
96 * parent PLL correct. usbphy1_gate and usbphy2_gate only needs to be
97 * turned on during boot, and software will not need to control it
98 * anymore after that.
99 */
100 clks[IMX6SL_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll3_usb_otg", base + 0x10, 20);
101 clks[IMX6SL_CLK_USBPHY2] = imx_clk_gate("usbphy2", "pll7_usb_host", base + 0x20, 20);
102 clks[IMX6SL_CLK_USBPHY1_GATE] = imx_clk_gate("usbphy1_gate", "dummy", base + 0x10, 6);
103 clks[IMX6SL_CLK_USBPHY2_GATE] = imx_clk_gate("usbphy2_gate", "dummy", base + 0x20, 6);
104
105 /* dev name parent_name flags reg shift width div: flags, div_table lock */
106 clks[IMX6SL_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);
107 clks[IMX6SL_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);
108 clks[IMX6SL_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);
109 clks[IMX6SL_CLK_ENET_REF] = clk_register_divider_table(NULL, "enet_ref", "pll6_enet", 0, base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock);
110
111 /* name parent_name reg idx */
112 clks[IMX6SL_CLK_PLL2_PFD0] = imx_clk_pfd("pll2_pfd0", "pll2_bus", base + 0x100, 0);
113 clks[IMX6SL_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_bus", base + 0x100, 1);
114 clks[IMX6SL_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_bus", base + 0x100, 2);
115 clks[IMX6SL_CLK_PLL3_PFD0] = imx_clk_pfd("pll3_pfd0", "pll3_usb_otg", base + 0xf0, 0);
116 clks[IMX6SL_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_usb_otg", base + 0xf0, 1);
117 clks[IMX6SL_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_usb_otg", base + 0xf0, 2);
118 clks[IMX6SL_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_usb_otg", base + 0xf0, 3);
119
120 /* name parent_name mult div */
121 clks[IMX6SL_CLK_PLL2_198M] = imx_clk_fixed_factor("pll2_198m", "pll2_pfd2", 1, 2);
122 clks[IMX6SL_CLK_PLL3_120M] = imx_clk_fixed_factor("pll3_120m", "pll3_usb_otg", 1, 4);
123 clks[IMX6SL_CLK_PLL3_80M] = imx_clk_fixed_factor("pll3_80m", "pll3_usb_otg", 1, 6);
124 clks[IMX6SL_CLK_PLL3_60M] = imx_clk_fixed_factor("pll3_60m", "pll3_usb_otg", 1, 8);
125
126 np = ccm_node;
127 base = of_iomap(np, 0);
128 WARN_ON(!base);
129
130 /* name reg shift width parent_names num_parents */
131 clks[IMX6SL_CLK_STEP] = imx_clk_mux("step", base + 0xc, 8, 1, step_sels, ARRAY_SIZE(step_sels));
132 clks[IMX6SL_CLK_PLL1_SW] = imx_clk_mux("pll1_sw", base + 0xc, 2, 1, pll1_sw_sels, ARRAY_SIZE(pll1_sw_sels));
133 clks[IMX6SL_CLK_OCRAM_ALT_SEL] = imx_clk_mux("ocram_alt_sel", base + 0x14, 7, 1, ocram_alt_sels, ARRAY_SIZE(ocram_alt_sels));
134 clks[IMX6SL_CLK_OCRAM_SEL] = imx_clk_mux("ocram_sel", base + 0x14, 6, 1, ocram_sels, ARRAY_SIZE(ocram_sels));
135 clks[IMX6SL_CLK_PRE_PERIPH2_SEL] = imx_clk_mux("pre_periph2_sel", base + 0x18, 21, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels));
136 clks[IMX6SL_CLK_PRE_PERIPH_SEL] = imx_clk_mux("pre_periph_sel", base + 0x18, 18, 2, pre_periph_sels, ARRAY_SIZE(pre_periph_sels));
137 clks[IMX6SL_CLK_PERIPH2_CLK2_SEL] = imx_clk_mux("periph2_clk2_sel", base + 0x18, 20, 1, periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels));
138 clks[IMX6SL_CLK_PERIPH_CLK2_SEL] = imx_clk_mux("periph_clk2_sel", base + 0x18, 12, 2, periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels));
139 clks[IMX6SL_CLK_CSI_SEL] = imx_clk_mux("csi_sel", base + 0x3c, 9, 2, csi_lcdif_sels, ARRAY_SIZE(csi_lcdif_sels));
140 clks[IMX6SL_CLK_LCDIF_AXI_SEL] = imx_clk_mux("lcdif_axi_sel", base + 0x3c, 14, 2, csi_lcdif_sels, ARRAY_SIZE(csi_lcdif_sels));
141 clks[IMX6SL_CLK_USDHC1_SEL] = imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
142 clks[IMX6SL_CLK_USDHC2_SEL] = imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
143 clks[IMX6SL_CLK_USDHC3_SEL] = imx_clk_mux("usdhc3_sel", base + 0x1c, 18, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
144 clks[IMX6SL_CLK_USDHC4_SEL] = imx_clk_mux("usdhc4_sel", base + 0x1c, 19, 1, usdhc_sels, ARRAY_SIZE(usdhc_sels));
145 clks[IMX6SL_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels));
146 clks[IMX6SL_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels));
147 clks[IMX6SL_CLK_SSI3_SEL] = imx_clk_mux("ssi3_sel", base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels));
148 clks[IMX6SL_CLK_PERCLK_SEL] = imx_clk_mux("perclk_sel", base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels));
149 clks[IMX6SL_CLK_PXP_AXI_SEL] = imx_clk_mux("pxp_axi_sel", base + 0x34, 6, 3, epdc_pxp_sels, ARRAY_SIZE(epdc_pxp_sels));
150 clks[IMX6SL_CLK_EPDC_AXI_SEL] = imx_clk_mux("epdc_axi_sel", base + 0x34, 15, 3, epdc_pxp_sels, ARRAY_SIZE(epdc_pxp_sels));
151 clks[IMX6SL_CLK_GPU2D_OVG_SEL] = imx_clk_mux("gpu2d_ovg_sel", base + 0x18, 4, 2, gpu2d_ovg_sels, ARRAY_SIZE(gpu2d_ovg_sels));
152 clks[IMX6SL_CLK_GPU2D_SEL] = imx_clk_mux("gpu2d_sel", base + 0x18, 8, 2, gpu2d_sels, ARRAY_SIZE(gpu2d_sels));
153 clks[IMX6SL_CLK_LCDIF_PIX_SEL] = imx_clk_mux("lcdif_pix_sel", base + 0x38, 6, 3, lcdif_pix_sels, ARRAY_SIZE(lcdif_pix_sels));
154 clks[IMX6SL_CLK_EPDC_PIX_SEL] = imx_clk_mux("epdc_pix_sel", base + 0x38, 15, 3, epdc_pix_sels, ARRAY_SIZE(epdc_pix_sels));
155 clks[IMX6SL_CLK_SPDIF0_SEL] = imx_clk_mux("spdif0_sel", base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels));
156 clks[IMX6SL_CLK_SPDIF1_SEL] = imx_clk_mux("spdif1_sel", base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels));
157 clks[IMX6SL_CLK_EXTERN_AUDIO_SEL] = imx_clk_mux("extern_audio_sel", base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels));
158 clks[IMX6SL_CLK_ECSPI_SEL] = imx_clk_mux("ecspi_sel", base + 0x38, 18, 1, ecspi_sels, ARRAY_SIZE(ecspi_sels));
159 clks[IMX6SL_CLK_UART_SEL] = imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels));
160
161 /* name reg shift width busy: reg, shift parent_names num_parents */
162 clks[IMX6SL_CLK_PERIPH] = imx_clk_busy_mux("periph", base + 0x14, 25, 1, base + 0x48, 5, periph_sels, ARRAY_SIZE(periph_sels));
163 clks[IMX6SL_CLK_PERIPH2] = imx_clk_busy_mux("periph2", base + 0x14, 26, 1, base + 0x48, 3, periph2_sels, ARRAY_SIZE(periph2_sels));
164
165 /* name parent_name reg shift width */
166 clks[IMX6SL_CLK_OCRAM_PODF] = imx_clk_divider("ocram_podf", "ocram_sel", base + 0x14, 16, 3);
167 clks[IMX6SL_CLK_PERIPH_CLK2_PODF] = imx_clk_divider("periph_clk2_podf", "periph_clk2_sel", base + 0x14, 27, 3);
168 clks[IMX6SL_CLK_PERIPH2_CLK2_PODF] = imx_clk_divider("periph2_clk2_podf", "periph2_clk2_sel", base + 0x14, 0, 3);
169 clks[IMX6SL_CLK_IPG] = imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2);
170 clks[IMX6SL_CLK_CSI_PODF] = imx_clk_divider("csi_podf", "csi_sel", base + 0x3c, 11, 3);
171 clks[IMX6SL_CLK_LCDIF_AXI_PODF] = imx_clk_divider("lcdif_axi_podf", "lcdif_axi_sel", base + 0x3c, 16, 3);
172 clks[IMX6SL_CLK_USDHC1_PODF] = imx_clk_divider("usdhc1_podf", "usdhc1_sel", base + 0x24, 11, 3);
173 clks[IMX6SL_CLK_USDHC2_PODF] = imx_clk_divider("usdhc2_podf", "usdhc2_sel", base + 0x24, 16, 3);
174 clks[IMX6SL_CLK_USDHC3_PODF] = imx_clk_divider("usdhc3_podf", "usdhc3_sel", base + 0x24, 19, 3);
175 clks[IMX6SL_CLK_USDHC4_PODF] = imx_clk_divider("usdhc4_podf", "usdhc4_sel", base + 0x24, 22, 3);
176 clks[IMX6SL_CLK_SSI1_PRED] = imx_clk_divider("ssi1_pred", "ssi1_sel", base + 0x28, 6, 3);
177 clks[IMX6SL_CLK_SSI1_PODF] = imx_clk_divider("ssi1_podf", "ssi1_pred", base + 0x28, 0, 6);
178 clks[IMX6SL_CLK_SSI2_PRED] = imx_clk_divider("ssi2_pred", "ssi2_sel", base + 0x2c, 6, 3);
179 clks[IMX6SL_CLK_SSI2_PODF] = imx_clk_divider("ssi2_podf", "ssi2_pred", base + 0x2c, 0, 6);
180 clks[IMX6SL_CLK_SSI3_PRED] = imx_clk_divider("ssi3_pred", "ssi3_sel", base + 0x28, 22, 3);
181 clks[IMX6SL_CLK_SSI3_PODF] = imx_clk_divider("ssi3_podf", "ssi3_pred", base + 0x28, 16, 6);
182 clks[IMX6SL_CLK_PERCLK] = imx_clk_divider("perclk", "perclk_sel", base + 0x1c, 0, 6);
183 clks[IMX6SL_CLK_PXP_AXI_PODF] = imx_clk_divider("pxp_axi_podf", "pxp_axi_sel", base + 0x34, 3, 3);
184 clks[IMX6SL_CLK_EPDC_AXI_PODF] = imx_clk_divider("epdc_axi_podf", "epdc_axi_sel", base + 0x34, 12, 3);
185 clks[IMX6SL_CLK_GPU2D_OVG_PODF] = imx_clk_divider("gpu2d_ovg_podf", "gpu2d_ovg_sel", base + 0x18, 26, 3);
186 clks[IMX6SL_CLK_GPU2D_PODF] = imx_clk_divider("gpu2d_podf", "gpu2d_sel", base + 0x18, 29, 3);
187 clks[IMX6SL_CLK_LCDIF_PIX_PRED] = imx_clk_divider("lcdif_pix_pred", "lcdif_pix_sel", base + 0x38, 3, 3);
188 clks[IMX6SL_CLK_EPDC_PIX_PRED] = imx_clk_divider("epdc_pix_pred", "epdc_pix_sel", base + 0x38, 12, 3);
189 clks[IMX6SL_CLK_LCDIF_PIX_PODF] = imx_clk_divider("lcdif_pix_podf", "lcdif_pix_pred", base + 0x1c, 20, 3);
190 clks[IMX6SL_CLK_EPDC_PIX_PODF] = imx_clk_divider("epdc_pix_podf", "epdc_pix_pred", base + 0x18, 23, 3);
191 clks[IMX6SL_CLK_SPDIF0_PRED] = imx_clk_divider("spdif0_pred", "spdif0_sel", base + 0x30, 25, 3);
192 clks[IMX6SL_CLK_SPDIF0_PODF] = imx_clk_divider("spdif0_podf", "spdif0_pred", base + 0x30, 22, 3);
193 clks[IMX6SL_CLK_SPDIF1_PRED] = imx_clk_divider("spdif1_pred", "spdif1_sel", base + 0x30, 12, 3);
194 clks[IMX6SL_CLK_SPDIF1_PODF] = imx_clk_divider("spdif1_podf", "spdif1_pred", base + 0x30, 9, 3);
195 clks[IMX6SL_CLK_EXTERN_AUDIO_PRED] = imx_clk_divider("extern_audio_pred", "extern_audio_sel", base + 0x28, 9, 3);
196 clks[IMX6SL_CLK_EXTERN_AUDIO_PODF] = imx_clk_divider("extern_audio_podf", "extern_audio_pred", base + 0x28, 25, 3);
197 clks[IMX6SL_CLK_ECSPI_ROOT] = imx_clk_divider("ecspi_root", "ecspi_sel", base + 0x38, 19, 6);
198 clks[IMX6SL_CLK_UART_ROOT] = imx_clk_divider("uart_root", "uart_sel", base + 0x24, 0, 6);
199
200 /* name parent_name reg shift width busy: reg, shift */
201 clks[IMX6SL_CLK_AHB] = imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3, base + 0x48, 1);
202 clks[IMX6SL_CLK_MMDC_ROOT] = imx_clk_busy_divider("mmdc", "periph2", base + 0x14, 3, 3, base + 0x48, 2);
203 clks[IMX6SL_CLK_ARM] = imx_clk_busy_divider("arm", "pll1_sw", base + 0x10, 0, 3, base + 0x48, 16);
204
205 /* name parent_name reg shift */
206 clks[IMX6SL_CLK_ECSPI1] = imx_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0);
207 clks[IMX6SL_CLK_ECSPI2] = imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2);
208 clks[IMX6SL_CLK_ECSPI3] = imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4);
209 clks[IMX6SL_CLK_ECSPI4] = imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6);
210 clks[IMX6SL_CLK_EPIT1] = imx_clk_gate2("epit1", "perclk", base + 0x6c, 12);
211 clks[IMX6SL_CLK_EPIT2] = imx_clk_gate2("epit2", "perclk", base + 0x6c, 14);
212 clks[IMX6SL_CLK_EXTERN_AUDIO] = imx_clk_gate2("extern_audio", "extern_audio_podf", base + 0x6c, 16);
213 clks[IMX6SL_CLK_GPT] = imx_clk_gate2("gpt", "perclk", base + 0x6c, 20);
214 clks[IMX6SL_CLK_GPT_SERIAL] = imx_clk_gate2("gpt_serial", "perclk", base + 0x6c, 22);
215 clks[IMX6SL_CLK_GPU2D_OVG] = imx_clk_gate2("gpu2d_ovg", "gpu2d_ovg_podf", base + 0x6c, 26);
216 clks[IMX6SL_CLK_I2C1] = imx_clk_gate2("i2c1", "perclk", base + 0x70, 6);
217 clks[IMX6SL_CLK_I2C2] = imx_clk_gate2("i2c2", "perclk", base + 0x70, 8);
218 clks[IMX6SL_CLK_I2C3] = imx_clk_gate2("i2c3", "perclk", base + 0x70, 10);
219 clks[IMX6SL_CLK_OCOTP] = imx_clk_gate2("ocotp", "ipg", base + 0x70, 12);
220 clks[IMX6SL_CLK_CSI] = imx_clk_gate2("csi", "csi_podf", base + 0x74, 0);
221 clks[IMX6SL_CLK_PXP_AXI] = imx_clk_gate2("pxp_axi", "pxp_axi_podf", base + 0x74, 2);
222 clks[IMX6SL_CLK_EPDC_AXI] = imx_clk_gate2("epdc_axi", "epdc_axi_podf", base + 0x74, 4);
223 clks[IMX6SL_CLK_LCDIF_AXI] = imx_clk_gate2("lcdif_axi", "lcdif_axi_podf", base + 0x74, 6);
224 clks[IMX6SL_CLK_LCDIF_PIX] = imx_clk_gate2("lcdif_pix", "lcdif_pix_podf", base + 0x74, 8);
225 clks[IMX6SL_CLK_EPDC_PIX] = imx_clk_gate2("epdc_pix", "epdc_pix_podf", base + 0x74, 10);
226 clks[IMX6SL_CLK_OCRAM] = imx_clk_gate2("ocram", "ocram_podf", base + 0x74, 28);
227 clks[IMX6SL_CLK_PWM1] = imx_clk_gate2("pwm1", "perclk", base + 0x78, 16);
228 clks[IMX6SL_CLK_PWM2] = imx_clk_gate2("pwm2", "perclk", base + 0x78, 18);
229 clks[IMX6SL_CLK_PWM3] = imx_clk_gate2("pwm3", "perclk", base + 0x78, 20);
230 clks[IMX6SL_CLK_PWM4] = imx_clk_gate2("pwm4", "perclk", base + 0x78, 22);
231 clks[IMX6SL_CLK_SDMA] = imx_clk_gate2("sdma", "ipg", base + 0x7c, 6);
232 clks[IMX6SL_CLK_SPDIF] = imx_clk_gate2("spdif", "spdif0_podf", base + 0x7c, 14);
233 clks[IMX6SL_CLK_SSI1] = imx_clk_gate2("ssi1", "ssi1_podf", base + 0x7c, 18);
234 clks[IMX6SL_CLK_SSI2] = imx_clk_gate2("ssi2", "ssi2_podf", base + 0x7c, 20);
235 clks[IMX6SL_CLK_SSI3] = imx_clk_gate2("ssi3", "ssi3_podf", base + 0x7c, 22);
236 clks[IMX6SL_CLK_UART] = imx_clk_gate2("uart", "ipg", base + 0x7c, 24);
237 clks[IMX6SL_CLK_UART_SERIAL] = imx_clk_gate2("uart_serial", "uart_root", base + 0x7c, 26);
238 clks[IMX6SL_CLK_USBOH3] = imx_clk_gate2("usboh3", "ipg", base + 0x80, 0);
239 clks[IMX6SL_CLK_USDHC1] = imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2);
240 clks[IMX6SL_CLK_USDHC2] = imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4);
241 clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
242 clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
243
244 for (i = 0; i < ARRAY_SIZE(clks); i++)
245 if (IS_ERR(clks[i]))
246 pr_err("i.MX6SL clk %d: register failed with %ld\n",
247 i, PTR_ERR(clks[i]));
248
249 clk_data.clks = clks;
250 clk_data.clk_num = ARRAY_SIZE(clks);
251 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
252
253 clk_register_clkdev(clks[IMX6SL_CLK_GPT], "ipg", "imx-gpt.0");
254 clk_register_clkdev(clks[IMX6SL_CLK_GPT_SERIAL], "per", "imx-gpt.0");
255
256 if (IS_ENABLED(CONFIG_USB_MXS_PHY)) {
257 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY1_GATE]);
258 clk_prepare_enable(clks[IMX6SL_CLK_USBPHY2_GATE]);
259 }
260
261 np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-gpt");
262 base = of_iomap(np, 0);
263 WARN_ON(!base);
264 irq = irq_of_parse_and_map(np, 0);
265 mxc_timer_init(base, irq);
266}
267CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
diff --git a/arch/arm/mach-imx/clk-pllv3.c b/arch/arm/mach-imx/clk-pllv3.c
index d09bc3df9a7a..a9fad5f8d340 100644
--- a/arch/arm/mach-imx/clk-pllv3.c
+++ b/arch/arm/mach-imx/clk-pllv3.c
@@ -296,13 +296,6 @@ static const struct clk_ops clk_pllv3_enet_ops = {
296 .recalc_rate = clk_pllv3_enet_recalc_rate, 296 .recalc_rate = clk_pllv3_enet_recalc_rate,
297}; 297};
298 298
299static const struct clk_ops clk_pllv3_mlb_ops = {
300 .prepare = clk_pllv3_prepare,
301 .unprepare = clk_pllv3_unprepare,
302 .enable = clk_pllv3_enable,
303 .disable = clk_pllv3_disable,
304};
305
306struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, 299struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
307 const char *parent_name, void __iomem *base, 300 const char *parent_name, void __iomem *base,
308 u32 div_mask) 301 u32 div_mask)
@@ -330,9 +323,6 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
330 case IMX_PLLV3_ENET: 323 case IMX_PLLV3_ENET:
331 ops = &clk_pllv3_enet_ops; 324 ops = &clk_pllv3_enet_ops;
332 break; 325 break;
333 case IMX_PLLV3_MLB:
334 ops = &clk_pllv3_mlb_ops;
335 break;
336 default: 326 default:
337 ops = &clk_pllv3_ops; 327 ops = &clk_pllv3_ops;
338 } 328 }
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c
new file mode 100644
index 000000000000..d617c0b7c809
--- /dev/null
+++ b/arch/arm/mach-imx/clk-vf610.c
@@ -0,0 +1,319 @@
1/*
2 * Copyright 2012-2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 */
10
11#include <linux/of_address.h>
12#include <linux/clk.h>
13#include <dt-bindings/clock/vf610-clock.h>
14
15#include "clk.h"
16
17#define CCM_CCR (ccm_base + 0x00)
18#define CCM_CSR (ccm_base + 0x04)
19#define CCM_CCSR (ccm_base + 0x08)
20#define CCM_CACRR (ccm_base + 0x0c)
21#define CCM_CSCMR1 (ccm_base + 0x10)
22#define CCM_CSCDR1 (ccm_base + 0x14)
23#define CCM_CSCDR2 (ccm_base + 0x18)
24#define CCM_CSCDR3 (ccm_base + 0x1c)
25#define CCM_CSCMR2 (ccm_base + 0x20)
26#define CCM_CSCDR4 (ccm_base + 0x24)
27#define CCM_CLPCR (ccm_base + 0x2c)
28#define CCM_CISR (ccm_base + 0x30)
29#define CCM_CIMR (ccm_base + 0x34)
30#define CCM_CGPR (ccm_base + 0x3c)
31#define CCM_CCGR0 (ccm_base + 0x40)
32#define CCM_CCGR1 (ccm_base + 0x44)
33#define CCM_CCGR2 (ccm_base + 0x48)
34#define CCM_CCGR3 (ccm_base + 0x4c)
35#define CCM_CCGR4 (ccm_base + 0x50)
36#define CCM_CCGR5 (ccm_base + 0x54)
37#define CCM_CCGR6 (ccm_base + 0x58)
38#define CCM_CCGR7 (ccm_base + 0x5c)
39#define CCM_CCGR8 (ccm_base + 0x60)
40#define CCM_CCGR9 (ccm_base + 0x64)
41#define CCM_CCGR10 (ccm_base + 0x68)
42#define CCM_CCGR11 (ccm_base + 0x6c)
43#define CCM_CMEOR0 (ccm_base + 0x70)
44#define CCM_CMEOR1 (ccm_base + 0x74)
45#define CCM_CMEOR2 (ccm_base + 0x78)
46#define CCM_CMEOR3 (ccm_base + 0x7c)
47#define CCM_CMEOR4 (ccm_base + 0x80)
48#define CCM_CMEOR5 (ccm_base + 0x84)
49#define CCM_CPPDSR (ccm_base + 0x88)
50#define CCM_CCOWR (ccm_base + 0x8c)
51#define CCM_CCPGR0 (ccm_base + 0x90)
52#define CCM_CCPGR1 (ccm_base + 0x94)
53#define CCM_CCPGR2 (ccm_base + 0x98)
54#define CCM_CCPGR3 (ccm_base + 0x9c)
55
56#define CCM_CCGRx_CGn(n) ((n) * 2)
57
58#define PFD_PLL1_BASE (anatop_base + 0x2b0)
59#define PFD_PLL2_BASE (anatop_base + 0x100)
60#define PFD_PLL3_BASE (anatop_base + 0xf0)
61
62static void __iomem *anatop_base;
63static void __iomem *ccm_base;
64
65/* sources for multiplexer clocks, this is used multiple times */
66static const char const *fast_sels[] = { "firc", "fxosc", };
67static const char const *slow_sels[] = { "sirc_32k", "sxosc", };
68static const char const *pll1_sels[] = { "pll1_main", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", };
69static const char const *pll2_sels[] = { "pll2_main", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", };
70static const char const *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_main", "pll1_pfd_sel", "pll3_main", };
71static const char const *ddr_sels[] = { "pll2_pfd2", "sys_sel", };
72static const char const *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", };
73static const char const *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", };
74static const char const *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", };
75static const char const *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", };
76static const char const *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", };
77static const char const *qspi_sels[] = { "pll3_main", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", };
78static const char const *esdhc_sels[] = { "pll3_main", "pll3_pfd3", "pll1_pfd3", "platform_bus", };
79static const char const *dcu_sels[] = { "pll1_pfd2", "pll3_main", };
80static const char const *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", };
81static const char const *vadc_sels[] = { "pll6_main_div", "pll3_main_div", "pll3_main", };
82/* FTM counter clock source, not module clock */
83static const char const *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", };
84static const char const *ftm_fix_sels[] = { "sxosc", "ipg_bus", };
85
86static struct clk_div_table pll4_main_div_table[] = {
87 { .val = 0, .div = 1 },
88 { .val = 1, .div = 2 },
89 { .val = 2, .div = 6 },
90 { .val = 3, .div = 8 },
91 { .val = 4, .div = 10 },
92 { .val = 5, .div = 12 },
93 { .val = 6, .div = 14 },
94 { .val = 7, .div = 16 },
95 { }
96};
97
98static struct clk *clk[VF610_CLK_END];
99static struct clk_onecell_data clk_data;
100
101static void __init vf610_clocks_init(struct device_node *ccm_node)
102{
103 struct device_node *np;
104
105 clk[VF610_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
106 clk[VF610_CLK_SIRC_128K] = imx_clk_fixed("sirc_128k", 128000);
107 clk[VF610_CLK_SIRC_32K] = imx_clk_fixed("sirc_32k", 32000);
108 clk[VF610_CLK_FIRC] = imx_clk_fixed("firc", 24000000);
109
110 clk[VF610_CLK_SXOSC] = imx_obtain_fixed_clock("sxosc", 0);
111 clk[VF610_CLK_FXOSC] = imx_obtain_fixed_clock("fxosc", 0);
112 clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0);
113 clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0);
114
115 clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2);
116
117 np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop");
118 anatop_base = of_iomap(np, 0);
119 BUG_ON(!anatop_base);
120
121 np = ccm_node;
122 ccm_base = of_iomap(np, 0);
123 BUG_ON(!ccm_base);
124
125 clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels));
126 clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels));
127
128 clk[VF610_CLK_PLL1_MAIN] = imx_clk_fixed_factor("pll1_main", "fast_clk_sel", 22, 1);
129 clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_main", PFD_PLL1_BASE, 0);
130 clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_main", PFD_PLL1_BASE, 1);
131 clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_main", PFD_PLL1_BASE, 2);
132 clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_main", PFD_PLL1_BASE, 3);
133
134 clk[VF610_CLK_PLL2_MAIN] = imx_clk_fixed_factor("pll2_main", "fast_clk_sel", 22, 1);
135 clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_main", PFD_PLL2_BASE, 0);
136 clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_main", PFD_PLL2_BASE, 1);
137 clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_main", PFD_PLL2_BASE, 2);
138 clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_main", PFD_PLL2_BASE, 3);
139
140 clk[VF610_CLK_PLL3_MAIN] = imx_clk_fixed_factor("pll3_main", "fast_clk_sel", 20, 1);
141 clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_main", PFD_PLL3_BASE, 0);
142 clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_main", PFD_PLL3_BASE, 1);
143 clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_main", PFD_PLL3_BASE, 2);
144 clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_main", PFD_PLL3_BASE, 3);
145
146 clk[VF610_CLK_PLL4_MAIN] = imx_clk_fixed_factor("pll4_main", "fast_clk_sel", 25, 1);
147 /* Enet pll: fixed 50Mhz */
148 clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6);
149 /* pll6: default 960Mhz */
150 clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1);
151 clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5);
152 clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5);
153 clk[VF610_CLK_SYS_SEL] = imx_clk_mux("sys_sel", CCM_CCSR, 0, 3, sys_sels, ARRAY_SIZE(sys_sels));
154 clk[VF610_CLK_DDR_SEL] = imx_clk_mux("ddr_sel", CCM_CCSR, 6, 1, ddr_sels, ARRAY_SIZE(ddr_sels));
155 clk[VF610_CLK_SYS_BUS] = imx_clk_divider("sys_bus", "sys_sel", CCM_CACRR, 0, 3);
156 clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3);
157 clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2);
158
159 clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_main_div", "pll3_main", CCM_CACRR, 20, 1);
160 clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock);
161 clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1);
162
163 clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "pll3_main", CCM_CCGR1, CCM_CCGRx_CGn(4));
164 clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "pll3_main", CCM_CCGR7, CCM_CCGRx_CGn(4));
165
166 clk[VF610_CLK_QSPI0_SEL] = imx_clk_mux("qspi0_sel", CCM_CSCMR1, 22, 2, qspi_sels, 4);
167 clk[VF610_CLK_QSPI0_EN] = imx_clk_gate("qspi0_en", "qspi0_sel", CCM_CSCDR3, 4);
168 clk[VF610_CLK_QSPI0_X4_DIV] = imx_clk_divider("qspi0_x4", "qspi0_en", CCM_CSCDR3, 0, 2);
169 clk[VF610_CLK_QSPI0_X2_DIV] = imx_clk_divider("qspi0_x2", "qspi0_x4", CCM_CSCDR3, 2, 1);
170 clk[VF610_CLK_QSPI0_X1_DIV] = imx_clk_divider("qspi0_x1", "qspi0_x2", CCM_CSCDR3, 3, 1);
171 clk[VF610_CLK_QSPI0] = imx_clk_gate2("qspi0", "qspi0_x1", CCM_CCGR2, CCM_CCGRx_CGn(4));
172
173 clk[VF610_CLK_QSPI1_SEL] = imx_clk_mux("qspi1_sel", CCM_CSCMR1, 24, 2, qspi_sels, 4);
174 clk[VF610_CLK_QSPI1_EN] = imx_clk_gate("qspi1_en", "qspi1_sel", CCM_CSCDR3, 12);
175 clk[VF610_CLK_QSPI1_X4_DIV] = imx_clk_divider("qspi1_x4", "qspi1_en", CCM_CSCDR3, 8, 2);
176 clk[VF610_CLK_QSPI1_X2_DIV] = imx_clk_divider("qspi1_x2", "qspi1_x4", CCM_CSCDR3, 10, 1);
177 clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1);
178 clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4));
179
180 clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_main", 1, 10);
181 clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_main", 1, 20);
182 clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4);
183 clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7);
184 clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24);
185 clk[VF610_CLK_ENET_TS] = imx_clk_gate("enet_ts", "enet_ts_sel", CCM_CSCDR1, 23);
186
187 clk[VF610_CLK_PIT] = imx_clk_gate2("pit", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(7));
188
189 clk[VF610_CLK_UART0] = imx_clk_gate2("uart0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(7));
190 clk[VF610_CLK_UART1] = imx_clk_gate2("uart1", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(8));
191 clk[VF610_CLK_UART2] = imx_clk_gate2("uart2", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(9));
192 clk[VF610_CLK_UART3] = imx_clk_gate2("uart3", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(10));
193
194 clk[VF610_CLK_I2C0] = imx_clk_gate2("i2c0", "ipg_bus", CCM_CCGR4, CCM_CCGRx_CGn(6));
195 clk[VF610_CLK_I2C1] = imx_clk_gate2("i2c1", "ipg_bus", CCM_CCGR4, CCM_CCGRx_CGn(7));
196
197 clk[VF610_CLK_DSPI0] = imx_clk_gate2("dspi0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(12));
198 clk[VF610_CLK_DSPI1] = imx_clk_gate2("dspi1", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(13));
199 clk[VF610_CLK_DSPI2] = imx_clk_gate2("dspi2", "ipg_bus", CCM_CCGR6, CCM_CCGRx_CGn(12));
200 clk[VF610_CLK_DSPI3] = imx_clk_gate2("dspi3", "ipg_bus", CCM_CCGR6, CCM_CCGRx_CGn(13));
201
202 clk[VF610_CLK_WDT] = imx_clk_gate2("wdt", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(14));
203
204 clk[VF610_CLK_ESDHC0_SEL] = imx_clk_mux("esdhc0_sel", CCM_CSCMR1, 16, 2, esdhc_sels, 4);
205 clk[VF610_CLK_ESDHC0_EN] = imx_clk_gate("esdhc0_en", "esdhc0_sel", CCM_CSCDR2, 28);
206 clk[VF610_CLK_ESDHC0_DIV] = imx_clk_divider("esdhc0_div", "esdhc0_en", CCM_CSCDR2, 16, 4);
207 clk[VF610_CLK_ESDHC0] = imx_clk_gate2("eshc0", "esdhc0_div", CCM_CCGR7, CCM_CCGRx_CGn(1));
208
209 clk[VF610_CLK_ESDHC1_SEL] = imx_clk_mux("esdhc1_sel", CCM_CSCMR1, 18, 2, esdhc_sels, 4);
210 clk[VF610_CLK_ESDHC1_EN] = imx_clk_gate("esdhc1_en", "esdhc1_sel", CCM_CSCDR2, 29);
211 clk[VF610_CLK_ESDHC1_DIV] = imx_clk_divider("esdhc1_div", "esdhc1_en", CCM_CSCDR2, 20, 4);
212 clk[VF610_CLK_ESDHC1] = imx_clk_gate2("eshc1", "esdhc1_div", CCM_CCGR7, CCM_CCGRx_CGn(2));
213
214 /*
215 * ftm_ext_clk and ftm_fix_clk are FTM timer counter's
216 * selectable clock sources, both use a common enable bit
217 * in CCM_CSCDR1, selecting "dummy" clock as parent of
218 * "ftm0_ext_fix" make it serve only for enable/disable.
219 */
220 clk[VF610_CLK_FTM0_EXT_SEL] = imx_clk_mux("ftm0_ext_sel", CCM_CSCMR2, 6, 2, ftm_ext_sels, 4);
221 clk[VF610_CLK_FTM0_FIX_SEL] = imx_clk_mux("ftm0_fix_sel", CCM_CSCMR2, 14, 1, ftm_fix_sels, 2);
222 clk[VF610_CLK_FTM0_EXT_FIX_EN] = imx_clk_gate("ftm0_ext_fix_en", "dummy", CCM_CSCDR1, 25);
223 clk[VF610_CLK_FTM1_EXT_SEL] = imx_clk_mux("ftm1_ext_sel", CCM_CSCMR2, 8, 2, ftm_ext_sels, 4);
224 clk[VF610_CLK_FTM1_FIX_SEL] = imx_clk_mux("ftm1_fix_sel", CCM_CSCMR2, 15, 1, ftm_fix_sels, 2);
225 clk[VF610_CLK_FTM1_EXT_FIX_EN] = imx_clk_gate("ftm1_ext_fix_en", "dummy", CCM_CSCDR1, 26);
226 clk[VF610_CLK_FTM2_EXT_SEL] = imx_clk_mux("ftm2_ext_sel", CCM_CSCMR2, 10, 2, ftm_ext_sels, 4);
227 clk[VF610_CLK_FTM2_FIX_SEL] = imx_clk_mux("ftm2_fix_sel", CCM_CSCMR2, 16, 1, ftm_fix_sels, 2);
228 clk[VF610_CLK_FTM2_EXT_FIX_EN] = imx_clk_gate("ftm2_ext_fix_en", "dummy", CCM_CSCDR1, 27);
229 clk[VF610_CLK_FTM3_EXT_SEL] = imx_clk_mux("ftm3_ext_sel", CCM_CSCMR2, 12, 2, ftm_ext_sels, 4);
230 clk[VF610_CLK_FTM3_FIX_SEL] = imx_clk_mux("ftm3_fix_sel", CCM_CSCMR2, 17, 1, ftm_fix_sels, 2);
231 clk[VF610_CLK_FTM3_EXT_FIX_EN] = imx_clk_gate("ftm3_ext_fix_en", "dummy", CCM_CSCDR1, 28);
232
233 /* ftm(n)_clk are FTM module operation clock */
234 clk[VF610_CLK_FTM0] = imx_clk_gate2("ftm0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(8));
235 clk[VF610_CLK_FTM1] = imx_clk_gate2("ftm1", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(9));
236 clk[VF610_CLK_FTM2] = imx_clk_gate2("ftm2", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(8));
237 clk[VF610_CLK_FTM3] = imx_clk_gate2("ftm3", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(9));
238
239 clk[VF610_CLK_DCU0_SEL] = imx_clk_mux("dcu0_sel", CCM_CSCMR1, 28, 1, dcu_sels, 2);
240 clk[VF610_CLK_DCU0_EN] = imx_clk_gate("dcu0_en", "dcu0_sel", CCM_CSCDR3, 19);
241 clk[VF610_CLK_DCU0_DIV] = imx_clk_divider("dcu0_div", "dcu0_en", CCM_CSCDR3, 16, 3);
242 clk[VF610_CLK_DCU0] = imx_clk_gate2("dcu0", "dcu0_div", CCM_CCGR3, CCM_CCGRx_CGn(8));
243 clk[VF610_CLK_DCU1_SEL] = imx_clk_mux("dcu1_sel", CCM_CSCMR1, 29, 1, dcu_sels, 2);
244 clk[VF610_CLK_DCU1_EN] = imx_clk_gate("dcu1_en", "dcu1_sel", CCM_CSCDR3, 23);
245 clk[VF610_CLK_DCU1_DIV] = imx_clk_divider("dcu1_div", "dcu1_en", CCM_CSCDR3, 20, 3);
246 clk[VF610_CLK_DCU1] = imx_clk_gate2("dcu1", "dcu1_div", CCM_CCGR9, CCM_CCGRx_CGn(8));
247
248 clk[VF610_CLK_ESAI_SEL] = imx_clk_mux("esai_sel", CCM_CSCMR1, 20, 2, esai_sels, 4);
249 clk[VF610_CLK_ESAI_EN] = imx_clk_gate("esai_en", "esai_sel", CCM_CSCDR2, 30);
250 clk[VF610_CLK_ESAI_DIV] = imx_clk_divider("esai_div", "esai_en", CCM_CSCDR2, 24, 4);
251 clk[VF610_CLK_ESAI] = imx_clk_gate2("esai", "esai_div", CCM_CCGR4, CCM_CCGRx_CGn(2));
252
253 clk[VF610_CLK_SAI0_SEL] = imx_clk_mux("sai0_sel", CCM_CSCMR1, 0, 2, sai_sels, 4);
254 clk[VF610_CLK_SAI0_EN] = imx_clk_gate("sai0_en", "sai0_sel", CCM_CSCDR1, 16);
255 clk[VF610_CLK_SAI0_DIV] = imx_clk_divider("sai0_div", "sai0_en", CCM_CSCDR1, 0, 4);
256 clk[VF610_CLK_SAI0] = imx_clk_gate2("sai0", "sai0_div", CCM_CCGR0, CCM_CCGRx_CGn(15));
257
258 clk[VF610_CLK_SAI1_SEL] = imx_clk_mux("sai1_sel", CCM_CSCMR1, 2, 2, sai_sels, 4);
259 clk[VF610_CLK_SAI1_EN] = imx_clk_gate("sai1_en", "sai1_sel", CCM_CSCDR1, 17);
260 clk[VF610_CLK_SAI1_DIV] = imx_clk_divider("sai1_div", "sai1_en", CCM_CSCDR1, 4, 4);
261 clk[VF610_CLK_SAI1] = imx_clk_gate2("sai1", "sai1_div", CCM_CCGR1, CCM_CCGRx_CGn(0));
262
263 clk[VF610_CLK_SAI2_SEL] = imx_clk_mux("sai2_sel", CCM_CSCMR1, 4, 2, sai_sels, 4);
264 clk[VF610_CLK_SAI2_EN] = imx_clk_gate("sai2_en", "sai2_sel", CCM_CSCDR1, 18);
265 clk[VF610_CLK_SAI2_DIV] = imx_clk_divider("sai2_div", "sai2_en", CCM_CSCDR1, 8, 4);
266 clk[VF610_CLK_SAI2] = imx_clk_gate2("sai2", "sai2_div", CCM_CCGR1, CCM_CCGRx_CGn(1));
267
268 clk[VF610_CLK_SAI3_SEL] = imx_clk_mux("sai3_sel", CCM_CSCMR1, 6, 2, sai_sels, 4);
269 clk[VF610_CLK_SAI3_EN] = imx_clk_gate("sai3_en", "sai3_sel", CCM_CSCDR1, 19);
270 clk[VF610_CLK_SAI3_DIV] = imx_clk_divider("sai3_div", "sai3_en", CCM_CSCDR1, 12, 4);
271 clk[VF610_CLK_SAI3] = imx_clk_gate2("sai3", "sai3_div", CCM_CCGR1, CCM_CCGRx_CGn(2));
272
273 clk[VF610_CLK_NFC_SEL] = imx_clk_mux("nfc_sel", CCM_CSCMR1, 12, 2, nfc_sels, 4);
274 clk[VF610_CLK_NFC_EN] = imx_clk_gate("nfc_en", "nfc_sel", CCM_CSCDR2, 9);
275 clk[VF610_CLK_NFC_PRE_DIV] = imx_clk_divider("nfc_pre_div", "nfc_en", CCM_CSCDR3, 13, 3);
276 clk[VF610_CLK_NFC_FRAC_DIV] = imx_clk_divider("nfc_frac_div", "nfc_pre_div", CCM_CSCDR2, 4, 4);
277 clk[VF610_CLK_NFC] = imx_clk_gate2("nfc", "nfc_frac_div", CCM_CCGR10, CCM_CCGRx_CGn(0));
278
279 clk[VF610_CLK_GPU_SEL] = imx_clk_mux("gpu_sel", CCM_CSCMR1, 14, 1, gpu_sels, 2);
280 clk[VF610_CLK_GPU_EN] = imx_clk_gate("gpu_en", "gpu_sel", CCM_CSCDR2, 10);
281 clk[VF610_CLK_GPU2D] = imx_clk_gate2("gpu", "gpu_en", CCM_CCGR8, CCM_CCGRx_CGn(15));
282
283 clk[VF610_CLK_VADC_SEL] = imx_clk_mux("vadc_sel", CCM_CSCMR1, 8, 2, vadc_sels, 3);
284 clk[VF610_CLK_VADC_EN] = imx_clk_gate("vadc_en", "vadc_sel", CCM_CSCDR1, 22);
285 clk[VF610_CLK_VADC_DIV] = imx_clk_divider("vadc_div", "vadc_en", CCM_CSCDR1, 20, 2);
286 clk[VF610_CLK_VADC_DIV_HALF] = imx_clk_fixed_factor("vadc_div_half", "vadc_div", 1, 2);
287 clk[VF610_CLK_VADC] = imx_clk_gate2("vadc", "vadc_div", CCM_CCGR8, CCM_CCGRx_CGn(7));
288
289 clk[VF610_CLK_ADC0] = imx_clk_gate2("adc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(11));
290 clk[VF610_CLK_ADC1] = imx_clk_gate2("adc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(11));
291 clk[VF610_CLK_DAC0] = imx_clk_gate2("dac0", "ipg_bus", CCM_CCGR8, CCM_CCGRx_CGn(12));
292 clk[VF610_CLK_DAC1] = imx_clk_gate2("dac1", "ipg_bus", CCM_CCGR8, CCM_CCGRx_CGn(13));
293
294 clk[VF610_CLK_ASRC] = imx_clk_gate2("asrc", "ipg_bus", CCM_CCGR4, CCM_CCGRx_CGn(1));
295
296 clk[VF610_CLK_FLEXCAN0] = imx_clk_gate2("flexcan0", "ipg_bus", CCM_CCGR0, CCM_CCGRx_CGn(0));
297 clk[VF610_CLK_FLEXCAN1] = imx_clk_gate2("flexcan1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(4));
298
299 clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
300 clk_set_rate(clk[VF610_CLK_QSPI0_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_SEL]) / 2);
301 clk_set_rate(clk[VF610_CLK_QSPI0_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X4_DIV]) / 2);
302 clk_set_rate(clk[VF610_CLK_QSPI0_X1_DIV], clk_get_rate(clk[VF610_CLK_QSPI0_X2_DIV]) / 2);
303
304 clk_set_parent(clk[VF610_CLK_QSPI1_SEL], clk[VF610_CLK_PLL1_PFD4]);
305 clk_set_rate(clk[VF610_CLK_QSPI1_X4_DIV], clk_get_rate(clk[VF610_CLK_QSPI1_SEL]) / 2);
306 clk_set_rate(clk[VF610_CLK_QSPI1_X2_DIV], clk_get_rate(clk[VF610_CLK_QSPI1_X4_DIV]) / 2);
307 clk_set_rate(clk[VF610_CLK_QSPI1_X1_DIV], clk_get_rate(clk[VF610_CLK_QSPI1_X2_DIV]) / 2);
308
309 clk_set_parent(clk[VF610_CLK_SAI0_SEL], clk[VF610_CLK_AUDIO_EXT]);
310 clk_set_parent(clk[VF610_CLK_SAI1_SEL], clk[VF610_CLK_AUDIO_EXT]);
311 clk_set_parent(clk[VF610_CLK_SAI2_SEL], clk[VF610_CLK_AUDIO_EXT]);
312 clk_set_parent(clk[VF610_CLK_SAI3_SEL], clk[VF610_CLK_AUDIO_EXT]);
313
314 /* Add the clocks to provider list */
315 clk_data.clks = clk;
316 clk_data.clk_num = ARRAY_SIZE(clk);
317 of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
318}
319CLK_OF_DECLARE(vf610, "fsl,vf610-ccm", vf610_clocks_init);
diff --git a/arch/arm/mach-imx/clk.c b/arch/arm/mach-imx/clk.c
index 37e884ed1cd4..55bc80a00666 100644
--- a/arch/arm/mach-imx/clk.c
+++ b/arch/arm/mach-imx/clk.c
@@ -1,4 +1,39 @@
1#include <linux/clk.h>
2#include <linux/err.h>
3#include <linux/of.h>
4#include <linux/slab.h>
1#include <linux/spinlock.h> 5#include <linux/spinlock.h>
2#include "clk.h" 6#include "clk.h"
3 7
4DEFINE_SPINLOCK(imx_ccm_lock); 8DEFINE_SPINLOCK(imx_ccm_lock);
9
10static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
11{
12 struct of_phandle_args phandle;
13 struct clk *clk = ERR_PTR(-ENODEV);
14 char *path;
15
16 path = kasprintf(GFP_KERNEL, "/clocks/%s", name);
17 if (!path)
18 return ERR_PTR(-ENOMEM);
19
20 phandle.np = of_find_node_by_path(path);
21 kfree(path);
22
23 if (phandle.np) {
24 clk = of_clk_get_from_provider(&phandle);
25 of_node_put(phandle.np);
26 }
27 return clk;
28}
29
30struct clk * __init imx_obtain_fixed_clock(
31 const char *name, unsigned long rate)
32{
33 struct clk *clk;
34
35 clk = imx_obtain_fixed_clock_from_dt(name);
36 if (IS_ERR(clk))
37 clk = imx_clk_fixed(name, rate);
38 return clk;
39}
diff --git a/arch/arm/mach-imx/clk.h b/arch/arm/mach-imx/clk.h
index d9d9d9c66dff..0e4e8bb261b9 100644
--- a/arch/arm/mach-imx/clk.h
+++ b/arch/arm/mach-imx/clk.h
@@ -18,7 +18,6 @@ enum imx_pllv3_type {
18 IMX_PLLV3_USB, 18 IMX_PLLV3_USB,
19 IMX_PLLV3_AV, 19 IMX_PLLV3_AV,
20 IMX_PLLV3_ENET, 20 IMX_PLLV3_ENET,
21 IMX_PLLV3_MLB,
22}; 21};
23 22
24struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name, 23struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
@@ -29,6 +28,9 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
29 void __iomem *reg, u8 bit_idx, 28 void __iomem *reg, u8 bit_idx,
30 u8 clk_gate_flags, spinlock_t *lock); 29 u8 clk_gate_flags, spinlock_t *lock);
31 30
31struct clk * imx_obtain_fixed_clock(
32 const char *name, unsigned long rate);
33
32static inline struct clk *imx_clk_gate2(const char *name, const char *parent, 34static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
33 void __iomem *reg, u8 shift) 35 void __iomem *reg, u8 shift)
34{ 36{
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index c08ae3f99cee..ee78847abf47 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -68,12 +68,12 @@ extern int mx27_clocks_init_dt(void);
68extern int mx31_clocks_init_dt(void); 68extern int mx31_clocks_init_dt(void);
69extern int mx51_clocks_init_dt(void); 69extern int mx51_clocks_init_dt(void);
70extern int mx53_clocks_init_dt(void); 70extern int mx53_clocks_init_dt(void);
71extern int mx6q_clocks_init(void);
72extern struct platform_device *mxc_register_gpio(char *name, int id, 71extern struct platform_device *mxc_register_gpio(char *name, int id,
73 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); 72 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
74extern void mxc_set_cpu_type(unsigned int type); 73extern void mxc_set_cpu_type(unsigned int type);
75extern void mxc_restart(char, const char *); 74extern void mxc_restart(char, const char *);
76extern void mxc_arch_reset_init(void __iomem *); 75extern void mxc_arch_reset_init(void __iomem *);
76extern void mxc_arch_reset_init_dt(void);
77extern int mx53_revision(void); 77extern int mx53_revision(void);
78extern int imx6q_revision(void); 78extern int imx6q_revision(void);
79extern int mx53_display_revision(void); 79extern int mx53_display_revision(void);
diff --git a/arch/arm/mach-imx/hardware.h b/arch/arm/mach-imx/hardware.h
index 356131f7b591..a3b0b04b45c9 100644
--- a/arch/arm/mach-imx/hardware.h
+++ b/arch/arm/mach-imx/hardware.h
@@ -20,6 +20,7 @@
20#ifndef __ASM_ARCH_MXC_HARDWARE_H__ 20#ifndef __ASM_ARCH_MXC_HARDWARE_H__
21#define __ASM_ARCH_MXC_HARDWARE_H__ 21#define __ASM_ARCH_MXC_HARDWARE_H__
22 22
23#include <asm/io.h>
23#include <asm/sizes.h> 24#include <asm/sizes.h>
24 25
25#define addr_in_module(addr, mod) \ 26#define addr_in_module(addr, mod) \
diff --git a/arch/arm/mach-imx/imx25-dt.c b/arch/arm/mach-imx/imx25-dt.c
index 82348391582a..3e1ec5ffe630 100644
--- a/arch/arm/mach-imx/imx25-dt.c
+++ b/arch/arm/mach-imx/imx25-dt.c
@@ -19,6 +19,8 @@
19 19
20static void __init imx25_dt_init(void) 20static void __init imx25_dt_init(void)
21{ 21{
22 mxc_arch_reset_init_dt();
23
22 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 24 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
23} 25}
24 26
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 4aaead0a77ff..4e235ecb4021 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -22,6 +22,8 @@ static void __init imx27_dt_init(void)
22{ 22{
23 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 23 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
24 24
25 mxc_arch_reset_init_dt();
26
25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 27 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
26 28
27 platform_device_register_full(&devinfo); 29 platform_device_register_full(&devinfo);
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index 67de611e29ab..818a1cc2fe45 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -20,6 +20,8 @@
20 20
21static void __init imx31_dt_init(void) 21static void __init imx31_dt_init(void)
22{ 22{
23 mxc_arch_reset_init_dt();
24
23 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 25 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
24} 26}
25 27
diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c
index ab24cc322111..53e43e579dd7 100644
--- a/arch/arm/mach-imx/imx51-dt.c
+++ b/arch/arm/mach-imx/imx51-dt.c
@@ -23,6 +23,8 @@ static void __init imx51_dt_init(void)
23{ 23{
24 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", }; 24 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
25 25
26 mxc_arch_reset_init_dt();
27
26 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 28 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
27 platform_device_register_full(&devinfo); 29 platform_device_register_full(&devinfo);
28} 30}
diff --git a/arch/arm/mach-imx/irq-common.c b/arch/arm/mach-imx/irq-common.c
index 4b34f52dc46b..0a920d184867 100644
--- a/arch/arm/mach-imx/irq-common.c
+++ b/arch/arm/mach-imx/irq-common.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/platform_data/asoc-imx-ssi.h>
21 22
22#include "irq-common.h" 23#include "irq-common.h"
23 24
diff --git a/arch/arm/mach-imx/mach-imx53.c b/arch/arm/mach-imx/mach-imx53.c
index f579c616feed..98c58944015a 100644
--- a/arch/arm/mach-imx/mach-imx53.c
+++ b/arch/arm/mach-imx/mach-imx53.c
@@ -21,25 +21,12 @@
21#include <asm/mach/time.h> 21#include <asm/mach/time.h>
22 22
23#include "common.h" 23#include "common.h"
24#include "hardware.h"
24#include "mx53.h" 25#include "mx53.h"
25 26
26static void __init imx53_qsb_init(void)
27{
28 struct clk *clk;
29
30 clk = clk_get_sys(NULL, "ssi_ext1");
31 if (IS_ERR(clk)) {
32 pr_err("failed to get clk ssi_ext1\n");
33 return;
34 }
35
36 clk_register_clkdev(clk, NULL, "0-000a");
37}
38
39static void __init imx53_dt_init(void) 27static void __init imx53_dt_init(void)
40{ 28{
41 if (of_machine_is_compatible("fsl,imx53-qsb")) 29 mxc_arch_reset_init_dt();
42 imx53_qsb_init();
43 30
44 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 31 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
45} 32}
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 5536fd81379a..f5965220a4d8 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/clk-provider.h>
14#include <linux/clkdev.h> 15#include <linux/clkdev.h>
15#include <linux/clocksource.h> 16#include <linux/clocksource.h>
16#include <linux/cpu.h> 17#include <linux/cpu.h>
@@ -145,6 +146,45 @@ static void __init imx6q_sabrelite_init(void)
145 imx6q_sabrelite_cko1_setup(); 146 imx6q_sabrelite_cko1_setup();
146} 147}
147 148
149static void __init imx6q_sabresd_cko1_setup(void)
150{
151 struct clk *cko1_sel, *pll4, *pll4_post, *cko1;
152 unsigned long rate;
153
154 cko1_sel = clk_get_sys(NULL, "cko1_sel");
155 pll4 = clk_get_sys(NULL, "pll4_audio");
156 pll4_post = clk_get_sys(NULL, "pll4_post_div");
157 cko1 = clk_get_sys(NULL, "cko1");
158 if (IS_ERR(cko1_sel) || IS_ERR(pll4)
159 || IS_ERR(pll4_post) || IS_ERR(cko1)) {
160 pr_err("cko1 setup failed!\n");
161 goto put_clk;
162 }
163 /*
164 * Setting pll4 at 768MHz (24MHz * 32)
165 * So its child clock can get 24MHz easily
166 */
167 clk_set_rate(pll4, 768000000);
168
169 clk_set_parent(cko1_sel, pll4_post);
170 rate = clk_round_rate(cko1, 24000000);
171 clk_set_rate(cko1, rate);
172put_clk:
173 if (!IS_ERR(cko1_sel))
174 clk_put(cko1_sel);
175 if (!IS_ERR(pll4_post))
176 clk_put(pll4_post);
177 if (!IS_ERR(pll4))
178 clk_put(pll4);
179 if (!IS_ERR(cko1))
180 clk_put(cko1);
181}
182
183static void __init imx6q_sabresd_init(void)
184{
185 imx6q_sabresd_cko1_setup();
186}
187
148static void __init imx6q_1588_init(void) 188static void __init imx6q_1588_init(void)
149{ 189{
150 struct regmap *gpr; 190 struct regmap *gpr;
@@ -165,6 +205,9 @@ static void __init imx6q_init_machine(void)
165{ 205{
166 if (of_machine_is_compatible("fsl,imx6q-sabrelite")) 206 if (of_machine_is_compatible("fsl,imx6q-sabrelite"))
167 imx6q_sabrelite_init(); 207 imx6q_sabrelite_init();
208 else if (of_machine_is_compatible("fsl,imx6q-sabresd") ||
209 of_machine_is_compatible("fsl,imx6dl-sabresd"))
210 imx6q_sabresd_init();
168 211
169 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 212 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
170 213
@@ -253,10 +296,44 @@ static void __init imx6q_map_io(void)
253 imx_scu_map_io(); 296 imx_scu_map_io();
254} 297}
255 298
299#ifdef CONFIG_CACHE_L2X0
300static void __init imx6q_init_l2cache(void)
301{
302 void __iomem *l2x0_base;
303 struct device_node *np;
304 unsigned int val;
305
306 np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache");
307 if (!np)
308 goto out;
309
310 l2x0_base = of_iomap(np, 0);
311 if (!l2x0_base) {
312 of_node_put(np);
313 goto out;
314 }
315
316 /* Configure the L2 PREFETCH and POWER registers */
317 val = readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL);
318 val |= 0x70800000;
319 writel_relaxed(val, l2x0_base + L2X0_PREFETCH_CTRL);
320 val = L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN;
321 writel_relaxed(val, l2x0_base + L2X0_POWER_CTRL);
322
323 iounmap(l2x0_base);
324 of_node_put(np);
325
326out:
327 l2x0_of_init(0, ~0UL);
328}
329#else
330static inline void imx6q_init_l2cache(void) {}
331#endif
332
256static void __init imx6q_init_irq(void) 333static void __init imx6q_init_irq(void)
257{ 334{
258 imx6q_init_revision(); 335 imx6q_init_revision();
259 l2x0_of_init(0, ~0UL); 336 imx6q_init_l2cache();
260 imx_src_init(); 337 imx_src_init();
261 imx_gpc_init(); 338 imx_gpc_init();
262 irqchip_init(); 339 irqchip_init();
@@ -264,7 +341,7 @@ static void __init imx6q_init_irq(void)
264 341
265static void __init imx6q_timer_init(void) 342static void __init imx6q_timer_init(void)
266{ 343{
267 mx6q_clocks_init(); 344 of_clk_init(NULL);
268 clocksource_of_init(); 345 clocksource_of_init();
269 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q", 346 imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
270 imx6q_revision()); 347 imx6q_revision());
diff --git a/arch/arm/mach-imx/mach-imx6sl.c b/arch/arm/mach-imx/mach-imx6sl.c
new file mode 100644
index 000000000000..132db2609507
--- /dev/null
+++ b/arch/arm/mach-imx/mach-imx6sl.c
@@ -0,0 +1,52 @@
1/*
2 * Copyright 2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#include <linux/clk-provider.h>
11#include <linux/irqchip.h>
12#include <linux/of.h>
13#include <linux/of_platform.h>
14#include <asm/hardware/cache-l2x0.h>
15#include <asm/mach/arch.h>
16#include <asm/mach/map.h>
17
18#include "common.h"
19
20static void __init imx6sl_init_machine(void)
21{
22 mxc_arch_reset_init_dt();
23
24 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
25}
26
27static void __init imx6sl_init_irq(void)
28{
29 l2x0_of_init(0, ~0UL);
30 imx_src_init();
31 imx_gpc_init();
32 irqchip_init();
33}
34
35static void __init imx6sl_timer_init(void)
36{
37 of_clk_init(NULL);
38}
39
40static const char *imx6sl_dt_compat[] __initdata = {
41 "fsl,imx6sl",
42 NULL,
43};
44
45DT_MACHINE_START(IMX6SL, "Freescale i.MX6 SoloLite (Device Tree)")
46 .map_io = debug_ll_io_init,
47 .init_irq = imx6sl_init_irq,
48 .init_time = imx6sl_timer_init,
49 .init_machine = imx6sl_init_machine,
50 .dt_compat = imx6sl_dt_compat,
51 .restart = mxc_restart,
52MACHINE_END
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index dae4cd7be040..6f424eced181 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -268,10 +268,11 @@ static struct mc13xxx_led_platform_data moboard_led[] = {
268static struct mc13xxx_leds_platform_data moboard_leds = { 268static struct mc13xxx_leds_platform_data moboard_leds = {
269 .num_leds = ARRAY_SIZE(moboard_led), 269 .num_leds = ARRAY_SIZE(moboard_led),
270 .led = moboard_led, 270 .led = moboard_led,
271 .flags = MC13783_LED_SLEWLIMTC, 271 .led_control[0] = MC13783_LED_C0_ENABLE | MC13783_LED_C0_ABMODE(0),
272 .abmode = MC13783_LED_AB_DISABLED, 272 .led_control[1] = MC13783_LED_C1_SLEWLIM,
273 .tc1_period = MC13783_LED_PERIOD_10MS, 273 .led_control[2] = MC13783_LED_C2_SLEWLIM,
274 .tc2_period = MC13783_LED_PERIOD_10MS, 274 .led_control[3] = MC13783_LED_C3_PERIOD(0),
275 .led_control[4] = MC13783_LED_C3_PERIOD(0),
275}; 276};
276 277
277static struct mc13xxx_buttons_platform_data moboard_buttons = { 278static struct mc13xxx_buttons_platform_data moboard_buttons = {
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb1ffdf..19bb6441a7d4 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -398,8 +398,8 @@ static void __init pca100_init(void)
398 imx27_add_fsl_usb2_udc(&otg_device_pdata); 398 imx27_add_fsl_usb2_udc(&otg_device_pdata);
399 } 399 }
400 400
401 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 401 usbh2_pdata.otg = imx_otg_ulpi_create(
402 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 402 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
403 403
404 if (usbh2_pdata.otg) 404 if (usbh2_pdata.otg)
405 imx27_add_mxc_ehci_hs(2, &usbh2_pdata); 405 imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
diff --git a/arch/arm/mach-imx/mach-vf610.c b/arch/arm/mach-imx/mach-vf610.c
new file mode 100644
index 000000000000..816991deb9b8
--- /dev/null
+++ b/arch/arm/mach-imx/mach-vf610.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2012-2013 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#include <linux/of_platform.h>
11#include <linux/clocksource.h>
12#include <linux/irqchip.h>
13#include <linux/clk-provider.h>
14#include <asm/mach/arch.h>
15#include <asm/hardware/cache-l2x0.h>
16
17#include "common.h"
18
19static void __init vf610_init_machine(void)
20{
21 mxc_arch_reset_init_dt();
22 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
23}
24
25static void __init vf610_init_irq(void)
26{
27 l2x0_of_init(0, ~0UL);
28 irqchip_init();
29}
30
31static void __init vf610_init_time(void)
32{
33 of_clk_init(NULL);
34 clocksource_of_init();
35}
36
37static const char *vf610_dt_compat[] __initdata = {
38 "fsl,vf610",
39 NULL,
40};
41
42DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)")
43 .init_irq = vf610_init_irq,
44 .init_time = vf610_init_time,
45 .init_machine = vf610_init_machine,
46 .dt_compat = vf610_dt_compat,
47 .restart = mxc_restart,
48MACHINE_END
diff --git a/arch/arm/mach-imx/mm-imx1.c b/arch/arm/mach-imx/mm-imx1.c
index 3c609c52d3eb..e065fedb3ad4 100644
--- a/arch/arm/mach-imx/mm-imx1.c
+++ b/arch/arm/mach-imx/mm-imx1.c
@@ -39,7 +39,6 @@ void __init mx1_map_io(void)
39void __init imx1_init_early(void) 39void __init imx1_init_early(void)
40{ 40{
41 mxc_set_cpu_type(MXC_CPU_MX1); 41 mxc_set_cpu_type(MXC_CPU_MX1);
42 mxc_arch_reset_init(MX1_IO_ADDRESS(MX1_WDT_BASE_ADDR));
43 imx_iomuxv1_init(MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR), 42 imx_iomuxv1_init(MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
44 MX1_NUM_GPIO_PORT); 43 MX1_NUM_GPIO_PORT);
45} 44}
@@ -51,6 +50,7 @@ void __init mx1_init_irq(void)
51 50
52void __init imx1_soc_init(void) 51void __init imx1_soc_init(void)
53{ 52{
53 mxc_arch_reset_init(MX1_IO_ADDRESS(MX1_WDT_BASE_ADDR));
54 mxc_device_init(); 54 mxc_device_init();
55 55
56 mxc_register_gpio("imx1-gpio", 0, MX1_GPIO1_BASE_ADDR, SZ_256, 56 mxc_register_gpio("imx1-gpio", 0, MX1_GPIO1_BASE_ADDR, SZ_256,
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index d8ccd3a8ec53..2e91ab2ca378 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -66,7 +66,6 @@ void __init mx21_map_io(void)
66void __init imx21_init_early(void) 66void __init imx21_init_early(void)
67{ 67{
68 mxc_set_cpu_type(MXC_CPU_MX21); 68 mxc_set_cpu_type(MXC_CPU_MX21);
69 mxc_arch_reset_init(MX21_IO_ADDRESS(MX21_WDOG_BASE_ADDR));
70 imx_iomuxv1_init(MX21_IO_ADDRESS(MX21_GPIO_BASE_ADDR), 69 imx_iomuxv1_init(MX21_IO_ADDRESS(MX21_GPIO_BASE_ADDR),
71 MX21_NUM_GPIO_PORT); 70 MX21_NUM_GPIO_PORT);
72} 71}
@@ -82,6 +81,7 @@ static const struct resource imx21_audmux_res[] __initconst = {
82 81
83void __init imx21_soc_init(void) 82void __init imx21_soc_init(void)
84{ 83{
84 mxc_arch_reset_init(MX21_IO_ADDRESS(MX21_WDOG_BASE_ADDR));
85 mxc_device_init(); 85 mxc_device_init();
86 86
87 mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0); 87 mxc_register_gpio("imx21-gpio", 0, MX21_GPIO1_BASE_ADDR, SZ_256, MX21_INT_GPIO, 0);
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 9357707bb7af..e065c117f5a6 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -54,7 +54,6 @@ void __init imx25_init_early(void)
54{ 54{
55 mxc_set_cpu_type(MXC_CPU_MX25); 55 mxc_set_cpu_type(MXC_CPU_MX25);
56 mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR)); 56 mxc_iomux_v3_init(MX25_IO_ADDRESS(MX25_IOMUXC_BASE_ADDR));
57 mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
58} 57}
59 58
60void __init mx25_init_irq(void) 59void __init mx25_init_irq(void)
@@ -89,6 +88,7 @@ static const struct resource imx25_audmux_res[] __initconst = {
89 88
90void __init imx25_soc_init(void) 89void __init imx25_soc_init(void)
91{ 90{
91 mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
92 mxc_device_init(); 92 mxc_device_init();
93 93
94 /* i.mx25 has the i.mx35 type gpio */ 94 /* i.mx25 has the i.mx35 type gpio */
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 4f1be65a7b5f..7d82a5a5b16b 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -66,7 +66,6 @@ void __init mx27_map_io(void)
66void __init imx27_init_early(void) 66void __init imx27_init_early(void)
67{ 67{
68 mxc_set_cpu_type(MXC_CPU_MX27); 68 mxc_set_cpu_type(MXC_CPU_MX27);
69 mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR));
70 imx_iomuxv1_init(MX27_IO_ADDRESS(MX27_GPIO_BASE_ADDR), 69 imx_iomuxv1_init(MX27_IO_ADDRESS(MX27_GPIO_BASE_ADDR),
71 MX27_NUM_GPIO_PORT); 70 MX27_NUM_GPIO_PORT);
72} 71}
@@ -82,6 +81,7 @@ static const struct resource imx27_audmux_res[] __initconst = {
82 81
83void __init imx27_soc_init(void) 82void __init imx27_soc_init(void)
84{ 83{
84 mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR));
85 mxc_device_init(); 85 mxc_device_init();
86 86
87 /* i.mx27 has the i.mx21 type gpio */ 87 /* i.mx27 has the i.mx21 type gpio */
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index e0e69a682174..0884ca90d15a 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -65,7 +65,7 @@ static void imx3_idle(void)
65 : "=r" (reg)); 65 : "=r" (reg));
66} 66}
67 67
68static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size, 68static void __iomem *imx3_ioremap_caller(phys_addr_t phys_addr, size_t size,
69 unsigned int mtype, void *caller) 69 unsigned int mtype, void *caller)
70{ 70{
71 if (mtype == MT_DEVICE) { 71 if (mtype == MT_DEVICE) {
@@ -138,7 +138,6 @@ void __init mx31_map_io(void)
138void __init imx31_init_early(void) 138void __init imx31_init_early(void)
139{ 139{
140 mxc_set_cpu_type(MXC_CPU_MX31); 140 mxc_set_cpu_type(MXC_CPU_MX31);
141 mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
142 arch_ioremap_caller = imx3_ioremap_caller; 141 arch_ioremap_caller = imx3_ioremap_caller;
143 arm_pm_idle = imx3_idle; 142 arm_pm_idle = imx3_idle;
144 mx3_ccm_base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR); 143 mx3_ccm_base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
@@ -174,6 +173,7 @@ void __init imx31_soc_init(void)
174 173
175 imx3_init_l2x0(); 174 imx3_init_l2x0();
176 175
176 mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
177 mxc_device_init(); 177 mxc_device_init();
178 178
179 mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0); 179 mxc_register_gpio("imx31-gpio", 0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
@@ -216,7 +216,6 @@ void __init imx35_init_early(void)
216{ 216{
217 mxc_set_cpu_type(MXC_CPU_MX35); 217 mxc_set_cpu_type(MXC_CPU_MX35);
218 mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); 218 mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
219 mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
220 arm_pm_idle = imx3_idle; 219 arm_pm_idle = imx3_idle;
221 arch_ioremap_caller = imx3_ioremap_caller; 220 arch_ioremap_caller = imx3_ioremap_caller;
222 mx3_ccm_base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR); 221 mx3_ccm_base = MX35_IO_ADDRESS(MX35_CCM_BASE_ADDR);
@@ -272,6 +271,7 @@ void __init imx35_soc_init(void)
272 271
273 imx3_init_l2x0(); 272 imx3_init_l2x0();
274 273
274 mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
275 mxc_device_init(); 275 mxc_device_init();
276 276
277 mxc_register_gpio("imx35-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0); 277 mxc_register_gpio("imx35-gpio", 0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index b7c4e70e5081..cf193d87274a 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -83,7 +83,6 @@ void __init imx51_init_early(void)
83 imx51_ipu_mipi_setup(); 83 imx51_ipu_mipi_setup();
84 mxc_set_cpu_type(MXC_CPU_MX51); 84 mxc_set_cpu_type(MXC_CPU_MX51);
85 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); 85 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
86 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
87 imx_src_init(); 86 imx_src_init();
88} 87}
89 88
@@ -91,7 +90,6 @@ void __init imx53_init_early(void)
91{ 90{
92 mxc_set_cpu_type(MXC_CPU_MX53); 91 mxc_set_cpu_type(MXC_CPU_MX53);
93 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR)); 92 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR));
94 mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
95 imx_src_init(); 93 imx_src_init();
96} 94}
97 95
@@ -129,6 +127,7 @@ static const struct resource imx51_audmux_res[] __initconst = {
129 127
130void __init imx51_soc_init(void) 128void __init imx51_soc_init(void)
131{ 129{
130 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
132 mxc_device_init(); 131 mxc_device_init();
133 132
134 /* i.mx51 has the i.mx35 type gpio */ 133 /* i.mx51 has the i.mx35 type gpio */
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index 695e0d73bf85..7cdc79a9657c 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -21,6 +21,8 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
24 26
25#include <asm/system_misc.h> 27#include <asm/system_misc.h>
26#include <asm/proc-fns.h> 28#include <asm/proc-fns.h>
@@ -30,6 +32,7 @@
30#include "hardware.h" 32#include "hardware.h"
31 33
32static void __iomem *wdog_base; 34static void __iomem *wdog_base;
35static struct clk *wdog_clk;
33 36
34/* 37/*
35 * Reset the system. It is called by machine_restart(). 38 * Reset the system. It is called by machine_restart().
@@ -38,16 +41,13 @@ void mxc_restart(char mode, const char *cmd)
38{ 41{
39 unsigned int wcr_enable; 42 unsigned int wcr_enable;
40 43
41 if (cpu_is_mx1()) { 44 if (wdog_clk)
42 wcr_enable = (1 << 0); 45 clk_enable(wdog_clk);
43 } else {
44 struct clk *clk;
45 46
46 clk = clk_get_sys("imx2-wdt.0", NULL); 47 if (cpu_is_mx1())
47 if (!IS_ERR(clk)) 48 wcr_enable = (1 << 0);
48 clk_prepare_enable(clk); 49 else
49 wcr_enable = (1 << 2); 50 wcr_enable = (1 << 2);
50 }
51 51
52 /* Assert SRS signal */ 52 /* Assert SRS signal */
53 __raw_writew(wcr_enable, wdog_base); 53 __raw_writew(wcr_enable, wdog_base);
@@ -55,7 +55,7 @@ void mxc_restart(char mode, const char *cmd)
55 /* wait for reset to assert... */ 55 /* wait for reset to assert... */
56 mdelay(500); 56 mdelay(500);
57 57
58 printk(KERN_ERR "Watchdog reset failed to assert reset\n"); 58 pr_err("%s: Watchdog reset failed to assert reset\n", __func__);
59 59
60 /* delay to allow the serial port to show the message */ 60 /* delay to allow the serial port to show the message */
61 mdelay(50); 61 mdelay(50);
@@ -64,7 +64,34 @@ void mxc_restart(char mode, const char *cmd)
64 soft_restart(0); 64 soft_restart(0);
65} 65}
66 66
67void mxc_arch_reset_init(void __iomem *base) 67void __init mxc_arch_reset_init(void __iomem *base)
68{ 68{
69 wdog_base = base; 69 wdog_base = base;
70
71 wdog_clk = clk_get_sys("imx2-wdt.0", NULL);
72 if (IS_ERR(wdog_clk)) {
73 pr_warn("%s: failed to get wdog clock\n", __func__);
74 wdog_clk = NULL;
75 return;
76 }
77
78 clk_prepare(wdog_clk);
79}
80
81void __init mxc_arch_reset_init_dt(void)
82{
83 struct device_node *np;
84
85 np = of_find_compatible_node(NULL, NULL, "fsl,imx21-wdt");
86 wdog_base = of_iomap(np, 0);
87 WARN_ON(!wdog_base);
88
89 wdog_clk = of_clk_get(np, 0);
90 if (IS_ERR(wdog_clk)) {
91 pr_warn("%s: failed to get wdog clock\n", __func__);
92 wdog_clk = NULL;
93 return;
94 }
95
96 clk_prepare(wdog_clk);
70} 97}
diff --git a/arch/arm/mach-imx/ulpi.c b/arch/arm/mach-imx/ulpi.c
deleted file mode 100644
index 0f051957d10c..000000000000
--- a/arch/arm/mach-imx/ulpi.c
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 * Copyright 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
3 * Copyright 2009 Daniel Mack <daniel@caiaq.de>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/io.h>
23#include <linux/delay.h>
24#include <linux/usb/otg.h>
25#include <linux/usb/ulpi.h>
26
27#include "ulpi.h"
28
29/* ULPIVIEW register bits */
30#define ULPIVW_WU (1 << 31) /* Wakeup */
31#define ULPIVW_RUN (1 << 30) /* read/write run */
32#define ULPIVW_WRITE (1 << 29) /* 0 = read 1 = write */
33#define ULPIVW_SS (1 << 27) /* SyncState */
34#define ULPIVW_PORT_MASK 0x07 /* Port field */
35#define ULPIVW_PORT_SHIFT 24
36#define ULPIVW_ADDR_MASK 0xff /* data address field */
37#define ULPIVW_ADDR_SHIFT 16
38#define ULPIVW_RDATA_MASK 0xff /* read data field */
39#define ULPIVW_RDATA_SHIFT 8
40#define ULPIVW_WDATA_MASK 0xff /* write data field */
41#define ULPIVW_WDATA_SHIFT 0
42
43static int ulpi_poll(void __iomem *view, u32 bit)
44{
45 int timeout = 10000;
46
47 while (timeout--) {
48 u32 data = __raw_readl(view);
49
50 if (!(data & bit))
51 return 0;
52
53 cpu_relax();
54 };
55
56 printk(KERN_WARNING "timeout polling for ULPI device\n");
57
58 return -ETIMEDOUT;
59}
60
61static int ulpi_read(struct usb_phy *otg, u32 reg)
62{
63 int ret;
64 void __iomem *view = otg->io_priv;
65
66 /* make sure interface is running */
67 if (!(__raw_readl(view) & ULPIVW_SS)) {
68 __raw_writel(ULPIVW_WU, view);
69
70 /* wait for wakeup */
71 ret = ulpi_poll(view, ULPIVW_WU);
72 if (ret)
73 return ret;
74 }
75
76 /* read the register */
77 __raw_writel((ULPIVW_RUN | (reg << ULPIVW_ADDR_SHIFT)), view);
78
79 /* wait for completion */
80 ret = ulpi_poll(view, ULPIVW_RUN);
81 if (ret)
82 return ret;
83
84 return (__raw_readl(view) >> ULPIVW_RDATA_SHIFT) & ULPIVW_RDATA_MASK;
85}
86
87static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
88{
89 int ret;
90 void __iomem *view = otg->io_priv;
91
92 /* make sure the interface is running */
93 if (!(__raw_readl(view) & ULPIVW_SS)) {
94 __raw_writel(ULPIVW_WU, view);
95 /* wait for wakeup */
96 ret = ulpi_poll(view, ULPIVW_WU);
97 if (ret)
98 return ret;
99 }
100
101 __raw_writel((ULPIVW_RUN | ULPIVW_WRITE |
102 (reg << ULPIVW_ADDR_SHIFT) |
103 ((val & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)), view);
104
105 /* wait for completion */
106 return ulpi_poll(view, ULPIVW_RUN);
107}
108
109struct usb_phy_io_ops mxc_ulpi_access_ops = {
110 .read = ulpi_read,
111 .write = ulpi_write,
112};
113EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops);
114
115struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
116{
117 return otg_ulpi_create(&mxc_ulpi_access_ops, flags);
118}
diff --git a/arch/arm/mach-imx/ulpi.h b/arch/arm/mach-imx/ulpi.h
index 42bdaca6d7d9..23f5c0349e80 100644
--- a/arch/arm/mach-imx/ulpi.h
+++ b/arch/arm/mach-imx/ulpi.h
@@ -1,8 +1,13 @@
1#ifndef __MACH_ULPI_H 1#ifndef __MACH_ULPI_H
2#define __MACH_ULPI_H 2#define __MACH_ULPI_H
3 3
4#ifdef CONFIG_USB_ULPI 4#include <linux/usb/ulpi.h>
5struct usb_phy *imx_otg_ulpi_create(unsigned int flags); 5
6#ifdef CONFIG_USB_ULPI_VIEWPORT
7static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
8{
9 return otg_ulpi_create(&ulpi_viewport_access_ops, flags);
10}
6#else 11#else
7static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags) 12static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
8{ 13{
@@ -10,7 +15,5 @@ static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
10} 15}
11#endif 16#endif
12 17
13extern struct usb_phy_io_ops mxc_ulpi_access_ops;
14
15#endif /* __MACH_ULPI_H */ 18#endif /* __MACH_ULPI_H */
16 19
diff --git a/arch/arm/mach-integrator/Makefile b/arch/arm/mach-integrator/Makefile
index d14d6b76f4c2..ec759ded7b60 100644
--- a/arch/arm/mach-integrator/Makefile
+++ b/arch/arm/mach-integrator/Makefile
@@ -8,5 +8,5 @@ obj-y := core.o lm.o leds.o
8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o 8obj-$(CONFIG_ARCH_INTEGRATOR_AP) += integrator_ap.o
9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o 9obj-$(CONFIG_ARCH_INTEGRATOR_CP) += integrator_cp.o
10 10
11obj-$(CONFIG_PCI) += pci_v3.o pci.o 11obj-$(CONFIG_PCI) += pci_v3.o
12obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o 12obj-$(CONFIG_INTEGRATOR_IMPD1) += impd1.o
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
index be5859efe10e..306d025d9730 100644
--- a/arch/arm/mach-integrator/include/mach/platform.h
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -305,29 +305,6 @@
305/* KMI definitions are now in include/asm-arm/hardware/amba_kmi.h -- rmk */ 305/* KMI definitions are now in include/asm-arm/hardware/amba_kmi.h -- rmk */
306 306
307/* ------------------------------------------------------------------------ 307/* ------------------------------------------------------------------------
308 * Where in the memory map does PCI live?
309 * ------------------------------------------------------------------------
310 * This represents a fairly liberal usage of address space. Even though
311 * the V3 only has two windows (therefore we need to map stuff on the fly),
312 * we maintain the same addresses, even if they're not mapped.
313 *
314 */
315#define PHYS_PCI_MEM_BASE 0x40000000 /* 512M to xxx */
316/* unused 256M from A0000000-AFFFFFFF might be used for I2O ???
317 */
318#define PHYS_PCI_IO_BASE 0x60000000 /* 16M to xxx */
319/* unused (128-16)M from B1000000-B7FFFFFF
320 */
321#define PHYS_PCI_CONFIG_BASE 0x61000000 /* 16M to xxx */
322/* unused ((128-16)M - 64K) from XXX
323 */
324#define PHYS_PCI_V3_BASE 0x62000000
325
326#define PCI_MEMORY_VADDR IOMEM(0xe8000000)
327#define PCI_CONFIG_VADDR IOMEM(0xec000000)
328#define PCI_V3_VADDR IOMEM(0xed000000)
329
330/* ------------------------------------------------------------------------
331 * Integrator Interrupt Controllers 308 * Integrator Interrupt Controllers
332 * ------------------------------------------------------------------------ 309 * ------------------------------------------------------------------------
333 * 310 *
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index b23c8e4f28e8..a5b15c4e8def 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -41,7 +41,6 @@
41#include <linux/stat.h> 41#include <linux/stat.h>
42#include <linux/sys_soc.h> 42#include <linux/sys_soc.h>
43#include <linux/termios.h> 43#include <linux/termios.h>
44#include <video/vga.h>
45 44
46#include <mach/hardware.h> 45#include <mach/hardware.h>
47#include <mach/platform.h> 46#include <mach/platform.h>
@@ -57,10 +56,10 @@
57#include <asm/mach/arch.h> 56#include <asm/mach/arch.h>
58#include <asm/mach/irq.h> 57#include <asm/mach/irq.h>
59#include <asm/mach/map.h> 58#include <asm/mach/map.h>
60#include <asm/mach/pci.h>
61#include <asm/mach/time.h> 59#include <asm/mach/time.h>
62 60
63#include "common.h" 61#include "common.h"
62#include "pci_v3.h"
64 63
65/* Base address to the AP system controller */ 64/* Base address to the AP system controller */
66void __iomem *ap_syscon_base; 65void __iomem *ap_syscon_base;
@@ -78,10 +77,6 @@ void __iomem *ap_syscon_base;
78 77
79/* 78/*
80 * Logical Physical 79 * Logical Physical
81 * e8000000 40000000 PCI memory PHYS_PCI_MEM_BASE (max 512M)
82 * ec000000 61000000 PCI config space PHYS_PCI_CONFIG_BASE (max 16M)
83 * ed000000 62000000 PCI V3 regs PHYS_PCI_V3_BASE (max 64k)
84 * fee00000 60000000 PCI IO PHYS_PCI_IO_BASE (max 16M)
85 * ef000000 Cache flush 80 * ef000000 Cache flush
86 * f1000000 10000000 Core module registers 81 * f1000000 10000000 Core module registers
87 * f1100000 11000000 System controller registers 82 * f1100000 11000000 System controller registers
@@ -130,29 +125,13 @@ static struct map_desc ap_io_desc[] __initdata __maybe_unused = {
130 .pfn = __phys_to_pfn(INTEGRATOR_AP_GPIO_BASE), 125 .pfn = __phys_to_pfn(INTEGRATOR_AP_GPIO_BASE),
131 .length = SZ_4K, 126 .length = SZ_4K,
132 .type = MT_DEVICE 127 .type = MT_DEVICE
133 }, {
134 .virtual = (unsigned long)PCI_MEMORY_VADDR,
135 .pfn = __phys_to_pfn(PHYS_PCI_MEM_BASE),
136 .length = SZ_16M,
137 .type = MT_DEVICE
138 }, {
139 .virtual = (unsigned long)PCI_CONFIG_VADDR,
140 .pfn = __phys_to_pfn(PHYS_PCI_CONFIG_BASE),
141 .length = SZ_16M,
142 .type = MT_DEVICE
143 }, {
144 .virtual = (unsigned long)PCI_V3_VADDR,
145 .pfn = __phys_to_pfn(PHYS_PCI_V3_BASE),
146 .length = SZ_64K,
147 .type = MT_DEVICE
148 } 128 }
149}; 129};
150 130
151static void __init ap_map_io(void) 131static void __init ap_map_io(void)
152{ 132{
153 iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc)); 133 iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc));
154 vga_base = (unsigned long)PCI_MEMORY_VADDR; 134 pci_v3_early_init();
155 pci_map_io_early(__phys_to_pfn(PHYS_PCI_IO_BASE));
156} 135}
157 136
158#ifdef CONFIG_PM 137#ifdef CONFIG_PM
@@ -615,6 +594,11 @@ static void __init ap_map_io_atag(void)
615 * for eventual deletion. 594 * for eventual deletion.
616 */ 595 */
617 596
597static struct platform_device pci_v3_device = {
598 .name = "pci-v3",
599 .id = 0,
600};
601
618static struct resource cfi_flash_resource = { 602static struct resource cfi_flash_resource = {
619 .start = INTEGRATOR_FLASH_BASE, 603 .start = INTEGRATOR_FLASH_BASE,
620 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1, 604 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1,
@@ -672,6 +656,7 @@ static void __init ap_init(void)
672 unsigned long sc_dec; 656 unsigned long sc_dec;
673 int i; 657 int i;
674 658
659 platform_device_register(&pci_v3_device);
675 platform_device_register(&cfi_flash_device); 660 platform_device_register(&cfi_flash_device);
676 661
677 ap_syscon_base = __io_address(INTEGRATOR_SC_BASE); 662 ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c
deleted file mode 100644
index 6c1667e728f5..000000000000
--- a/arch/arm/mach-integrator/pci.c
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/pci-integrator.c
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 *
22 * PCI functions for Integrator
23 */
24#include <linux/kernel.h>
25#include <linux/pci.h>
26#include <linux/interrupt.h>
27#include <linux/init.h>
28
29#include <asm/mach/pci.h>
30#include <asm/mach-types.h>
31
32#include <mach/irqs.h>
33
34/*
35 * A small note about bridges and interrupts. The DECchip 21050 (and
36 * later) adheres to the PCI-PCI bridge specification. This says that
37 * the interrupts on the other side of a bridge are swizzled in the
38 * following manner:
39 *
40 * Dev Interrupt Interrupt
41 * Pin on Pin on
42 * Device Connector
43 *
44 * 4 A A
45 * B B
46 * C C
47 * D D
48 *
49 * 5 A B
50 * B C
51 * C D
52 * D A
53 *
54 * 6 A C
55 * B D
56 * C A
57 * D B
58 *
59 * 7 A D
60 * B A
61 * C B
62 * D C
63 *
64 * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A.
65 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4
66 */
67
68/*
69 * This routine handles multiple bridges.
70 */
71static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp)
72{
73 if (*pinp == 0)
74 *pinp = 1;
75
76 return pci_common_swizzle(dev, pinp);
77}
78
79static int irq_tab[4] __initdata = {
80 IRQ_AP_PCIINT0, IRQ_AP_PCIINT1, IRQ_AP_PCIINT2, IRQ_AP_PCIINT3
81};
82
83/*
84 * map the specified device/slot/pin to an IRQ. This works out such
85 * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1.
86 */
87static int __init integrator_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
88{
89 int intnr = ((slot - 9) + (pin - 1)) & 3;
90
91 return irq_tab[intnr];
92}
93
94extern void pci_v3_init(void *);
95
96static struct hw_pci integrator_pci __initdata = {
97 .swizzle = integrator_swizzle,
98 .map_irq = integrator_map_irq,
99 .setup = pci_v3_setup,
100 .nr_controllers = 1,
101 .ops = &pci_v3_ops,
102 .preinit = pci_v3_preinit,
103 .postinit = pci_v3_postinit,
104};
105
106static int __init integrator_pci_init(void)
107{
108 if (machine_is_integrator())
109 pci_common_init(&integrator_pci);
110 return 0;
111}
112
113subsys_initcall(integrator_pci_init);
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index e7fcea7f3300..bef100527c42 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -27,16 +27,199 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/platform_device.h>
31#include <linux/of.h>
32#include <linux/of_address.h>
33#include <linux/of_irq.h>
34#include <linux/of_pci.h>
35#include <video/vga.h>
30 36
31#include <mach/hardware.h> 37#include <mach/hardware.h>
32#include <mach/platform.h> 38#include <mach/platform.h>
33#include <mach/irqs.h> 39#include <mach/irqs.h>
34 40
41#include <asm/mach/map.h>
35#include <asm/signal.h> 42#include <asm/signal.h>
36#include <asm/mach/pci.h> 43#include <asm/mach/pci.h>
37#include <asm/irq_regs.h> 44#include <asm/irq_regs.h>
38 45
39#include <asm/hardware/pci_v3.h> 46#include "pci_v3.h"
47
48/*
49 * Where in the memory map does PCI live?
50 *
51 * This represents a fairly liberal usage of address space. Even though
52 * the V3 only has two windows (therefore we need to map stuff on the fly),
53 * we maintain the same addresses, even if they're not mapped.
54 */
55#define PHYS_PCI_MEM_BASE 0x40000000 /* 256M */
56#define PHYS_PCI_PRE_BASE 0x50000000 /* 256M */
57#define PHYS_PCI_IO_BASE 0x60000000 /* 16M */
58#define PHYS_PCI_CONFIG_BASE 0x61000000 /* 16M */
59#define PHYS_PCI_V3_BASE 0x62000000 /* 64K */
60
61#define PCI_MEMORY_VADDR IOMEM(0xe8000000)
62#define PCI_CONFIG_VADDR IOMEM(0xec000000)
63
64/*
65 * V3 Local Bus to PCI Bridge definitions
66 *
67 * Registers (these are taken from page 129 of the EPC User's Manual Rev 1.04
68 * All V3 register names are prefaced by V3_ to avoid clashing with any other
69 * PCI definitions. Their names match the user's manual.
70 *
71 * I'm assuming that I20 is disabled.
72 *
73 */
74#define V3_PCI_VENDOR 0x00000000
75#define V3_PCI_DEVICE 0x00000002
76#define V3_PCI_CMD 0x00000004
77#define V3_PCI_STAT 0x00000006
78#define V3_PCI_CC_REV 0x00000008
79#define V3_PCI_HDR_CFG 0x0000000C
80#define V3_PCI_IO_BASE 0x00000010
81#define V3_PCI_BASE0 0x00000014
82#define V3_PCI_BASE1 0x00000018
83#define V3_PCI_SUB_VENDOR 0x0000002C
84#define V3_PCI_SUB_ID 0x0000002E
85#define V3_PCI_ROM 0x00000030
86#define V3_PCI_BPARAM 0x0000003C
87#define V3_PCI_MAP0 0x00000040
88#define V3_PCI_MAP1 0x00000044
89#define V3_PCI_INT_STAT 0x00000048
90#define V3_PCI_INT_CFG 0x0000004C
91#define V3_LB_BASE0 0x00000054
92#define V3_LB_BASE1 0x00000058
93#define V3_LB_MAP0 0x0000005E
94#define V3_LB_MAP1 0x00000062
95#define V3_LB_BASE2 0x00000064
96#define V3_LB_MAP2 0x00000066
97#define V3_LB_SIZE 0x00000068
98#define V3_LB_IO_BASE 0x0000006E
99#define V3_FIFO_CFG 0x00000070
100#define V3_FIFO_PRIORITY 0x00000072
101#define V3_FIFO_STAT 0x00000074
102#define V3_LB_ISTAT 0x00000076
103#define V3_LB_IMASK 0x00000077
104#define V3_SYSTEM 0x00000078
105#define V3_LB_CFG 0x0000007A
106#define V3_PCI_CFG 0x0000007C
107#define V3_DMA_PCI_ADR0 0x00000080
108#define V3_DMA_PCI_ADR1 0x00000090
109#define V3_DMA_LOCAL_ADR0 0x00000084
110#define V3_DMA_LOCAL_ADR1 0x00000094
111#define V3_DMA_LENGTH0 0x00000088
112#define V3_DMA_LENGTH1 0x00000098
113#define V3_DMA_CSR0 0x0000008B
114#define V3_DMA_CSR1 0x0000009B
115#define V3_DMA_CTLB_ADR0 0x0000008C
116#define V3_DMA_CTLB_ADR1 0x0000009C
117#define V3_DMA_DELAY 0x000000E0
118#define V3_MAIL_DATA 0x000000C0
119#define V3_PCI_MAIL_IEWR 0x000000D0
120#define V3_PCI_MAIL_IERD 0x000000D2
121#define V3_LB_MAIL_IEWR 0x000000D4
122#define V3_LB_MAIL_IERD 0x000000D6
123#define V3_MAIL_WR_STAT 0x000000D8
124#define V3_MAIL_RD_STAT 0x000000DA
125#define V3_QBA_MAP 0x000000DC
126
127/* PCI COMMAND REGISTER bits
128 */
129#define V3_COMMAND_M_FBB_EN (1 << 9)
130#define V3_COMMAND_M_SERR_EN (1 << 8)
131#define V3_COMMAND_M_PAR_EN (1 << 6)
132#define V3_COMMAND_M_MASTER_EN (1 << 2)
133#define V3_COMMAND_M_MEM_EN (1 << 1)
134#define V3_COMMAND_M_IO_EN (1 << 0)
135
136/* SYSTEM REGISTER bits
137 */
138#define V3_SYSTEM_M_RST_OUT (1 << 15)
139#define V3_SYSTEM_M_LOCK (1 << 14)
140
141/* PCI_CFG bits
142 */
143#define V3_PCI_CFG_M_I2O_EN (1 << 15)
144#define V3_PCI_CFG_M_IO_REG_DIS (1 << 14)
145#define V3_PCI_CFG_M_IO_DIS (1 << 13)
146#define V3_PCI_CFG_M_EN3V (1 << 12)
147#define V3_PCI_CFG_M_RETRY_EN (1 << 10)
148#define V3_PCI_CFG_M_AD_LOW1 (1 << 9)
149#define V3_PCI_CFG_M_AD_LOW0 (1 << 8)
150
151/* PCI_BASE register bits (PCI -> Local Bus)
152 */
153#define V3_PCI_BASE_M_ADR_BASE 0xFFF00000
154#define V3_PCI_BASE_M_ADR_BASEL 0x000FFF00
155#define V3_PCI_BASE_M_PREFETCH (1 << 3)
156#define V3_PCI_BASE_M_TYPE (3 << 1)
157#define V3_PCI_BASE_M_IO (1 << 0)
158
159/* PCI MAP register bits (PCI -> Local bus)
160 */
161#define V3_PCI_MAP_M_MAP_ADR 0xFFF00000
162#define V3_PCI_MAP_M_RD_POST_INH (1 << 15)
163#define V3_PCI_MAP_M_ROM_SIZE (3 << 10)
164#define V3_PCI_MAP_M_SWAP (3 << 8)
165#define V3_PCI_MAP_M_ADR_SIZE 0x000000F0
166#define V3_PCI_MAP_M_REG_EN (1 << 1)
167#define V3_PCI_MAP_M_ENABLE (1 << 0)
168
169/*
170 * LB_BASE0,1 register bits (Local bus -> PCI)
171 */
172#define V3_LB_BASE_ADR_BASE 0xfff00000
173#define V3_LB_BASE_SWAP (3 << 8)
174#define V3_LB_BASE_ADR_SIZE (15 << 4)
175#define V3_LB_BASE_PREFETCH (1 << 3)
176#define V3_LB_BASE_ENABLE (1 << 0)
177
178#define V3_LB_BASE_ADR_SIZE_1MB (0 << 4)
179#define V3_LB_BASE_ADR_SIZE_2MB (1 << 4)
180#define V3_LB_BASE_ADR_SIZE_4MB (2 << 4)
181#define V3_LB_BASE_ADR_SIZE_8MB (3 << 4)
182#define V3_LB_BASE_ADR_SIZE_16MB (4 << 4)
183#define V3_LB_BASE_ADR_SIZE_32MB (5 << 4)
184#define V3_LB_BASE_ADR_SIZE_64MB (6 << 4)
185#define V3_LB_BASE_ADR_SIZE_128MB (7 << 4)
186#define V3_LB_BASE_ADR_SIZE_256MB (8 << 4)
187#define V3_LB_BASE_ADR_SIZE_512MB (9 << 4)
188#define V3_LB_BASE_ADR_SIZE_1GB (10 << 4)
189#define V3_LB_BASE_ADR_SIZE_2GB (11 << 4)
190
191#define v3_addr_to_lb_base(a) ((a) & V3_LB_BASE_ADR_BASE)
192
193/*
194 * LB_MAP0,1 register bits (Local bus -> PCI)
195 */
196#define V3_LB_MAP_MAP_ADR 0xfff0
197#define V3_LB_MAP_TYPE (7 << 1)
198#define V3_LB_MAP_AD_LOW_EN (1 << 0)
199
200#define V3_LB_MAP_TYPE_IACK (0 << 1)
201#define V3_LB_MAP_TYPE_IO (1 << 1)
202#define V3_LB_MAP_TYPE_MEM (3 << 1)
203#define V3_LB_MAP_TYPE_CONFIG (5 << 1)
204#define V3_LB_MAP_TYPE_MEM_MULTIPLE (6 << 1)
205
206#define v3_addr_to_lb_map(a) (((a) >> 16) & V3_LB_MAP_MAP_ADR)
207
208/*
209 * LB_BASE2 register bits (Local bus -> PCI IO)
210 */
211#define V3_LB_BASE2_ADR_BASE 0xff00
212#define V3_LB_BASE2_SWAP (3 << 6)
213#define V3_LB_BASE2_ENABLE (1 << 0)
214
215#define v3_addr_to_lb_base2(a) (((a) >> 16) & V3_LB_BASE2_ADR_BASE)
216
217/*
218 * LB_MAP2 register bits (Local bus -> PCI IO)
219 */
220#define V3_LB_MAP2_MAP_ADR 0xff00
221
222#define v3_addr_to_lb_map2(a) (((a) >> 16) & V3_LB_MAP2_MAP_ADR)
40 223
41/* 224/*
42 * The V3 PCI interface chip in Integrator provides several windows from 225 * The V3 PCI interface chip in Integrator provides several windows from
@@ -101,15 +284,28 @@
101 * the mappings into PCI memory. 284 * the mappings into PCI memory.
102 */ 285 */
103 286
287/* Filled in by probe */
288static void __iomem *pci_v3_base;
289/* CPU side memory ranges */
290static struct resource conf_mem; /* FIXME: remap this instead of static map */
291static struct resource io_mem;
292static struct resource non_mem;
293static struct resource pre_mem;
294/* PCI side memory ranges */
295static u64 non_mem_pci;
296static u64 non_mem_pci_sz;
297static u64 pre_mem_pci;
298static u64 pre_mem_pci_sz;
299
104// V3 access routines 300// V3 access routines
105#define v3_writeb(o,v) __raw_writeb(v, PCI_V3_VADDR + (unsigned int)(o)) 301#define v3_writeb(o,v) __raw_writeb(v, pci_v3_base + (unsigned int)(o))
106#define v3_readb(o) (__raw_readb(PCI_V3_VADDR + (unsigned int)(o))) 302#define v3_readb(o) (__raw_readb(pci_v3_base + (unsigned int)(o)))
107 303
108#define v3_writew(o,v) __raw_writew(v, PCI_V3_VADDR + (unsigned int)(o)) 304#define v3_writew(o,v) __raw_writew(v, pci_v3_base + (unsigned int)(o))
109#define v3_readw(o) (__raw_readw(PCI_V3_VADDR + (unsigned int)(o))) 305#define v3_readw(o) (__raw_readw(pci_v3_base + (unsigned int)(o)))
110 306
111#define v3_writel(o,v) __raw_writel(v, PCI_V3_VADDR + (unsigned int)(o)) 307#define v3_writel(o,v) __raw_writel(v, pci_v3_base + (unsigned int)(o))
112#define v3_readl(o) (__raw_readl(PCI_V3_VADDR + (unsigned int)(o))) 308#define v3_readl(o) (__raw_readl(pci_v3_base + (unsigned int)(o)))
113 309
114/*============================================================================ 310/*============================================================================
115 * 311 *
@@ -165,19 +361,6 @@
165 */ 361 */
166static DEFINE_RAW_SPINLOCK(v3_lock); 362static DEFINE_RAW_SPINLOCK(v3_lock);
167 363
168#define PCI_BUS_NONMEM_START 0x00000000
169#define PCI_BUS_NONMEM_SIZE SZ_256M
170
171#define PCI_BUS_PREMEM_START PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE
172#define PCI_BUS_PREMEM_SIZE SZ_256M
173
174#if PCI_BUS_NONMEM_START & 0x000fffff
175#error PCI_BUS_NONMEM_START must be megabyte aligned
176#endif
177#if PCI_BUS_PREMEM_START & 0x000fffff
178#error PCI_BUS_PREMEM_START must be megabyte aligned
179#endif
180
181#undef V3_LB_BASE_PREFETCH 364#undef V3_LB_BASE_PREFETCH
182#define V3_LB_BASE_PREFETCH 0 365#define V3_LB_BASE_PREFETCH 0
183 366
@@ -243,13 +426,13 @@ static void __iomem *v3_open_config_window(struct pci_bus *bus,
243 * prefetchable), this frees up base1 for re-use by 426 * prefetchable), this frees up base1 for re-use by
244 * configuration memory 427 * configuration memory
245 */ 428 */
246 v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE) | 429 v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(non_mem.start) |
247 V3_LB_BASE_ADR_SIZE_512MB | V3_LB_BASE_ENABLE); 430 V3_LB_BASE_ADR_SIZE_512MB | V3_LB_BASE_ENABLE);
248 431
249 /* 432 /*
250 * Set up base1/map1 to point into configuration space. 433 * Set up base1/map1 to point into configuration space.
251 */ 434 */
252 v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(PHYS_PCI_CONFIG_BASE) | 435 v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(conf_mem.start) |
253 V3_LB_BASE_ADR_SIZE_16MB | V3_LB_BASE_ENABLE); 436 V3_LB_BASE_ADR_SIZE_16MB | V3_LB_BASE_ENABLE);
254 v3_writew(V3_LB_MAP1, mapaddress); 437 v3_writew(V3_LB_MAP1, mapaddress);
255 438
@@ -261,16 +444,16 @@ static void v3_close_config_window(void)
261 /* 444 /*
262 * Reassign base1 for use by prefetchable PCI memory 445 * Reassign base1 for use by prefetchable PCI memory
263 */ 446 */
264 v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE + SZ_256M) | 447 v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(pre_mem.start) |
265 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH | 448 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH |
266 V3_LB_BASE_ENABLE); 449 V3_LB_BASE_ENABLE);
267 v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(PCI_BUS_PREMEM_START) | 450 v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(pre_mem_pci) |
268 V3_LB_MAP_TYPE_MEM_MULTIPLE); 451 V3_LB_MAP_TYPE_MEM_MULTIPLE);
269 452
270 /* 453 /*
271 * And shrink base0 back to a 256M window (NOTE: MAP0 already correct) 454 * And shrink base0 back to a 256M window (NOTE: MAP0 already correct)
272 */ 455 */
273 v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE) | 456 v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(non_mem.start) |
274 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE); 457 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE);
275} 458}
276 459
@@ -337,25 +520,11 @@ static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
337 return PCIBIOS_SUCCESSFUL; 520 return PCIBIOS_SUCCESSFUL;
338} 521}
339 522
340struct pci_ops pci_v3_ops = { 523static struct pci_ops pci_v3_ops = {
341 .read = v3_read_config, 524 .read = v3_read_config,
342 .write = v3_write_config, 525 .write = v3_write_config,
343}; 526};
344 527
345static struct resource non_mem = {
346 .name = "PCI non-prefetchable",
347 .start = PHYS_PCI_MEM_BASE + PCI_BUS_NONMEM_START,
348 .end = PHYS_PCI_MEM_BASE + PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE - 1,
349 .flags = IORESOURCE_MEM,
350};
351
352static struct resource pre_mem = {
353 .name = "PCI prefetchable",
354 .start = PHYS_PCI_MEM_BASE + PCI_BUS_PREMEM_START,
355 .end = PHYS_PCI_MEM_BASE + PCI_BUS_PREMEM_START + PCI_BUS_PREMEM_SIZE - 1,
356 .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH,
357};
358
359static int __init pci_v3_setup_resources(struct pci_sys_data *sys) 528static int __init pci_v3_setup_resources(struct pci_sys_data *sys)
360{ 529{
361 if (request_resource(&iomem_resource, &non_mem)) { 530 if (request_resource(&iomem_resource, &non_mem)) {
@@ -471,7 +640,7 @@ static irqreturn_t v3_irq(int dummy, void *devid)
471 return IRQ_HANDLED; 640 return IRQ_HANDLED;
472} 641}
473 642
474int __init pci_v3_setup(int nr, struct pci_sys_data *sys) 643static int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
475{ 644{
476 int ret = 0; 645 int ret = 0;
477 646
@@ -479,7 +648,7 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
479 return -EINVAL; 648 return -EINVAL;
480 649
481 if (nr == 0) { 650 if (nr == 0) {
482 sys->mem_offset = PHYS_PCI_MEM_BASE; 651 sys->mem_offset = non_mem.start;
483 ret = pci_v3_setup_resources(sys); 652 ret = pci_v3_setup_resources(sys);
484 } 653 }
485 654
@@ -490,18 +659,10 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
490 * V3_LB_BASE? - local bus address 659 * V3_LB_BASE? - local bus address
491 * V3_LB_MAP? - pci bus address 660 * V3_LB_MAP? - pci bus address
492 */ 661 */
493void __init pci_v3_preinit(void) 662static void __init pci_v3_preinit(void)
494{ 663{
495 unsigned long flags; 664 unsigned long flags;
496 unsigned int temp; 665 unsigned int temp;
497 int ret;
498
499 /* Remap the Integrator system controller */
500 ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);
501 if (!ap_syscon_base) {
502 pr_err("unable to remap the AP syscon for PCIv3\n");
503 return;
504 }
505 666
506 pcibios_min_mem = 0x00100000; 667 pcibios_min_mem = 0x00100000;
507 668
@@ -525,25 +686,25 @@ void __init pci_v3_preinit(void)
525 * Setup window 0 - PCI non-prefetchable memory 686 * Setup window 0 - PCI non-prefetchable memory
526 * Local: 0x40000000 Bus: 0x00000000 Size: 256MB 687 * Local: 0x40000000 Bus: 0x00000000 Size: 256MB
527 */ 688 */
528 v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE) | 689 v3_writel(V3_LB_BASE0, v3_addr_to_lb_base(non_mem.start) |
529 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE); 690 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_ENABLE);
530 v3_writew(V3_LB_MAP0, v3_addr_to_lb_map(PCI_BUS_NONMEM_START) | 691 v3_writew(V3_LB_MAP0, v3_addr_to_lb_map(non_mem_pci) |
531 V3_LB_MAP_TYPE_MEM); 692 V3_LB_MAP_TYPE_MEM);
532 693
533 /* 694 /*
534 * Setup window 1 - PCI prefetchable memory 695 * Setup window 1 - PCI prefetchable memory
535 * Local: 0x50000000 Bus: 0x10000000 Size: 256MB 696 * Local: 0x50000000 Bus: 0x10000000 Size: 256MB
536 */ 697 */
537 v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(PHYS_PCI_MEM_BASE + SZ_256M) | 698 v3_writel(V3_LB_BASE1, v3_addr_to_lb_base(pre_mem.start) |
538 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH | 699 V3_LB_BASE_ADR_SIZE_256MB | V3_LB_BASE_PREFETCH |
539 V3_LB_BASE_ENABLE); 700 V3_LB_BASE_ENABLE);
540 v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(PCI_BUS_PREMEM_START) | 701 v3_writew(V3_LB_MAP1, v3_addr_to_lb_map(pre_mem_pci) |
541 V3_LB_MAP_TYPE_MEM_MULTIPLE); 702 V3_LB_MAP_TYPE_MEM_MULTIPLE);
542 703
543 /* 704 /*
544 * Setup window 2 - PCI IO 705 * Setup window 2 - PCI IO
545 */ 706 */
546 v3_writel(V3_LB_BASE2, v3_addr_to_lb_base2(PHYS_PCI_IO_BASE) | 707 v3_writel(V3_LB_BASE2, v3_addr_to_lb_base2(io_mem.start) |
547 V3_LB_BASE_ENABLE); 708 V3_LB_BASE_ENABLE);
548 v3_writew(V3_LB_MAP2, v3_addr_to_lb_map2(0)); 709 v3_writew(V3_LB_MAP2, v3_addr_to_lb_map2(0));
549 710
@@ -578,18 +739,10 @@ void __init pci_v3_preinit(void)
578 v3_writeb(V3_LB_IMASK, 0x28); 739 v3_writeb(V3_LB_IMASK, 0x28);
579 __raw_writel(3, ap_syscon_base + INTEGRATOR_SC_PCIENABLE_OFFSET); 740 __raw_writel(3, ap_syscon_base + INTEGRATOR_SC_PCIENABLE_OFFSET);
580 741
581 /*
582 * Grab the PCI error interrupt.
583 */
584 ret = request_irq(IRQ_AP_V3INT, v3_irq, 0, "V3", NULL);
585 if (ret)
586 printk(KERN_ERR "PCI: unable to grab PCI error "
587 "interrupt: %d\n", ret);
588
589 raw_spin_unlock_irqrestore(&v3_lock, flags); 742 raw_spin_unlock_irqrestore(&v3_lock, flags);
590} 743}
591 744
592void __init pci_v3_postinit(void) 745static void __init pci_v3_postinit(void)
593{ 746{
594 unsigned int pci_cmd; 747 unsigned int pci_cmd;
595 748
@@ -608,5 +761,284 @@ void __init pci_v3_postinit(void)
608 "interrupt: %d\n", ret); 761 "interrupt: %d\n", ret);
609#endif 762#endif
610 763
611 register_isa_ports(PHYS_PCI_MEM_BASE, PHYS_PCI_IO_BASE, 0); 764 register_isa_ports(non_mem.start, io_mem.start, 0);
765}
766
767/*
768 * A small note about bridges and interrupts. The DECchip 21050 (and
769 * later) adheres to the PCI-PCI bridge specification. This says that
770 * the interrupts on the other side of a bridge are swizzled in the
771 * following manner:
772 *
773 * Dev Interrupt Interrupt
774 * Pin on Pin on
775 * Device Connector
776 *
777 * 4 A A
778 * B B
779 * C C
780 * D D
781 *
782 * 5 A B
783 * B C
784 * C D
785 * D A
786 *
787 * 6 A C
788 * B D
789 * C A
790 * D B
791 *
792 * 7 A D
793 * B A
794 * C B
795 * D C
796 *
797 * Where A = pin 1, B = pin 2 and so on and pin=0 = default = A.
798 * Thus, each swizzle is ((pin-1) + (device#-4)) % 4
799 */
800
801/*
802 * This routine handles multiple bridges.
803 */
804static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp)
805{
806 if (*pinp == 0)
807 *pinp = 1;
808
809 return pci_common_swizzle(dev, pinp);
810}
811
812static int irq_tab[4] __initdata = {
813 IRQ_AP_PCIINT0, IRQ_AP_PCIINT1, IRQ_AP_PCIINT2, IRQ_AP_PCIINT3
814};
815
816/*
817 * map the specified device/slot/pin to an IRQ. This works out such
818 * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1.
819 */
820static int __init pci_v3_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
821{
822 int intnr = ((slot - 9) + (pin - 1)) & 3;
823
824 return irq_tab[intnr];
825}
826
827static struct hw_pci pci_v3 __initdata = {
828 .swizzle = pci_v3_swizzle,
829 .setup = pci_v3_setup,
830 .nr_controllers = 1,
831 .ops = &pci_v3_ops,
832 .preinit = pci_v3_preinit,
833 .postinit = pci_v3_postinit,
834};
835
836#ifdef CONFIG_OF
837
838static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin)
839{
840 struct of_irq oirq;
841 int ret;
842
843 ret = of_irq_map_pci(dev, &oirq);
844 if (ret) {
845 dev_err(&dev->dev, "of_irq_map_pci() %d\n", ret);
846 /* Proper return code 0 == NO_IRQ */
847 return 0;
848 }
849
850 return irq_create_of_mapping(oirq.controller, oirq.specifier,
851 oirq.size);
852}
853
854static int __init pci_v3_dtprobe(struct platform_device *pdev,
855 struct device_node *np)
856{
857 struct of_pci_range_parser parser;
858 struct of_pci_range range;
859 struct resource *res;
860 int irq, ret;
861
862 if (of_pci_range_parser_init(&parser, np))
863 return -EINVAL;
864
865 /* Get base for bridge registers */
866 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
867 if (!res) {
868 dev_err(&pdev->dev, "unable to obtain PCIv3 base\n");
869 return -ENODEV;
870 }
871 pci_v3_base = devm_ioremap(&pdev->dev, res->start,
872 resource_size(res));
873 if (!pci_v3_base) {
874 dev_err(&pdev->dev, "unable to remap PCIv3 base\n");
875 return -ENODEV;
876 }
877
878 /* Get and request error IRQ resource */
879 irq = platform_get_irq(pdev, 0);
880 if (irq <= 0) {
881 dev_err(&pdev->dev, "unable to obtain PCIv3 error IRQ\n");
882 return -ENODEV;
883 }
884 ret = devm_request_irq(&pdev->dev, irq, v3_irq, 0,
885 "PCIv3 error", NULL);
886 if (ret < 0) {
887 dev_err(&pdev->dev, "unable to request PCIv3 error IRQ %d (%d)\n", irq, ret);
888 return ret;
889 }
890
891 for_each_of_pci_range(&parser, &range) {
892 if (!range.flags) {
893 of_pci_range_to_resource(&range, np, &conf_mem);
894 conf_mem.name = "PCIv3 config";
895 }
896 if (range.flags & IORESOURCE_IO) {
897 of_pci_range_to_resource(&range, np, &io_mem);
898 io_mem.name = "PCIv3 I/O";
899 }
900 if ((range.flags & IORESOURCE_MEM) &&
901 !(range.flags & IORESOURCE_PREFETCH)) {
902 non_mem_pci = range.pci_addr;
903 non_mem_pci_sz = range.size;
904 of_pci_range_to_resource(&range, np, &non_mem);
905 non_mem.name = "PCIv3 non-prefetched mem";
906 }
907 if ((range.flags & IORESOURCE_MEM) &&
908 (range.flags & IORESOURCE_PREFETCH)) {
909 pre_mem_pci = range.pci_addr;
910 pre_mem_pci_sz = range.size;
911 of_pci_range_to_resource(&range, np, &pre_mem);
912 pre_mem.name = "PCIv3 prefetched mem";
913 }
914 }
915
916 if (!conf_mem.start || !io_mem.start ||
917 !non_mem.start || !pre_mem.start) {
918 dev_err(&pdev->dev, "missing ranges in device node\n");
919 return -EINVAL;
920 }
921
922 pci_v3.map_irq = pci_v3_map_irq_dt;
923 pci_common_init_dev(&pdev->dev, &pci_v3);
924
925 return 0;
926}
927
928#else
929
930static inline int pci_v3_dtprobe(struct platform_device *pdev,
931 struct device_node *np)
932{
933 return -EINVAL;
934}
935
936#endif
937
938static int __init pci_v3_probe(struct platform_device *pdev)
939{
940 struct device_node *np = pdev->dev.of_node;
941 int ret;
942
943 /* Remap the Integrator system controller */
944 ap_syscon_base = ioremap(INTEGRATOR_SC_BASE, 0x100);
945 if (!ap_syscon_base) {
946 dev_err(&pdev->dev, "unable to remap the AP syscon for PCIv3\n");
947 return -ENODEV;
948 }
949
950 /* Device tree probe path */
951 if (np)
952 return pci_v3_dtprobe(pdev, np);
953
954 pci_v3_base = devm_ioremap(&pdev->dev, PHYS_PCI_V3_BASE, SZ_64K);
955 if (!pci_v3_base) {
956 dev_err(&pdev->dev, "unable to remap PCIv3 base\n");
957 return -ENODEV;
958 }
959
960 ret = devm_request_irq(&pdev->dev, IRQ_AP_V3INT, v3_irq, 0, "V3", NULL);
961 if (ret) {
962 dev_err(&pdev->dev, "unable to grab PCI error interrupt: %d\n",
963 ret);
964 return -ENODEV;
965 }
966
967 conf_mem.name = "PCIv3 config";
968 conf_mem.start = PHYS_PCI_CONFIG_BASE;
969 conf_mem.end = PHYS_PCI_CONFIG_BASE + SZ_16M - 1;
970 conf_mem.flags = IORESOURCE_MEM;
971
972 io_mem.name = "PCIv3 I/O";
973 io_mem.start = PHYS_PCI_IO_BASE;
974 io_mem.end = PHYS_PCI_IO_BASE + SZ_16M - 1;
975 io_mem.flags = IORESOURCE_MEM;
976
977 non_mem_pci = 0x00000000;
978 non_mem_pci_sz = SZ_256M;
979 non_mem.name = "PCIv3 non-prefetched mem";
980 non_mem.start = PHYS_PCI_MEM_BASE;
981 non_mem.end = PHYS_PCI_MEM_BASE + SZ_256M - 1;
982 non_mem.flags = IORESOURCE_MEM;
983
984 pre_mem_pci = 0x10000000;
985 pre_mem_pci_sz = SZ_256M;
986 pre_mem.name = "PCIv3 prefetched mem";
987 pre_mem.start = PHYS_PCI_PRE_BASE + SZ_256M;
988 pre_mem.end = PHYS_PCI_PRE_BASE + SZ_256M - 1;
989 pre_mem.flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
990
991 pci_v3.map_irq = pci_v3_map_irq;
992
993 pci_common_init_dev(&pdev->dev, &pci_v3);
994
995 return 0;
996}
997
998static const struct of_device_id pci_ids[] = {
999 { .compatible = "v3,v360epc-pci", },
1000 {},
1001};
1002
1003static struct platform_driver pci_v3_driver = {
1004 .driver = {
1005 .name = "pci-v3",
1006 .of_match_table = pci_ids,
1007 },
1008};
1009
1010static int __init pci_v3_init(void)
1011{
1012 return platform_driver_probe(&pci_v3_driver, pci_v3_probe);
1013}
1014
1015subsys_initcall(pci_v3_init);
1016
1017/*
1018 * Static mappings for the PCIv3 bridge
1019 *
1020 * e8000000 40000000 PCI memory PHYS_PCI_MEM_BASE (max 512M)
1021 * ec000000 61000000 PCI config space PHYS_PCI_CONFIG_BASE (max 16M)
1022 * fee00000 60000000 PCI IO PHYS_PCI_IO_BASE (max 16M)
1023 */
1024static struct map_desc pci_v3_io_desc[] __initdata __maybe_unused = {
1025 {
1026 .virtual = (unsigned long)PCI_MEMORY_VADDR,
1027 .pfn = __phys_to_pfn(PHYS_PCI_MEM_BASE),
1028 .length = SZ_16M,
1029 .type = MT_DEVICE
1030 }, {
1031 .virtual = (unsigned long)PCI_CONFIG_VADDR,
1032 .pfn = __phys_to_pfn(PHYS_PCI_CONFIG_BASE),
1033 .length = SZ_16M,
1034 .type = MT_DEVICE
1035 }
1036};
1037
1038int __init pci_v3_early_init(void)
1039{
1040 iotable_init(pci_v3_io_desc, ARRAY_SIZE(pci_v3_io_desc));
1041 vga_base = (unsigned long)PCI_MEMORY_VADDR;
1042 pci_map_io_early(__phys_to_pfn(PHYS_PCI_IO_BASE));
1043 return 0;
612} 1044}
diff --git a/arch/arm/mach-integrator/pci_v3.h b/arch/arm/mach-integrator/pci_v3.h
new file mode 100644
index 000000000000..755fd29fed4a
--- /dev/null
+++ b/arch/arm/mach-integrator/pci_v3.h
@@ -0,0 +1,2 @@
1/* Simple oneliner include to the PCIv3 early init */
2extern int pci_v3_early_init(void);
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c
index 183dc8b5511b..faaf7d4482c5 100644
--- a/arch/arm/mach-iop13xx/io.c
+++ b/arch/arm/mach-iop13xx/io.c
@@ -23,7 +23,7 @@
23 23
24#include "pci.h" 24#include "pci.h"
25 25
26static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie, 26static void __iomem *__iop13xx_ioremap_caller(phys_addr_t cookie,
27 size_t size, unsigned int mtype, void *caller) 27 size_t size, unsigned int mtype, void *caller)
28{ 28{
29 void __iomem * retval; 29 void __iomem * retval;
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index 3181f61ea63e..1c5bd7637b05 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -469,7 +469,6 @@ void __init iop13xx_platform_init(void)
469 dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); 469 dma_cap_set(DMA_MEMCPY, plat_data->cap_mask);
470 dma_cap_set(DMA_XOR, plat_data->cap_mask); 470 dma_cap_set(DMA_XOR, plat_data->cap_mask);
471 dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); 471 dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask);
472 dma_cap_set(DMA_MEMSET, plat_data->cap_mask);
473 dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); 472 dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask);
474 break; 473 break;
475 case IOP13XX_INIT_ADMA_1: 474 case IOP13XX_INIT_ADMA_1:
@@ -479,7 +478,6 @@ void __init iop13xx_platform_init(void)
479 dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); 478 dma_cap_set(DMA_MEMCPY, plat_data->cap_mask);
480 dma_cap_set(DMA_XOR, plat_data->cap_mask); 479 dma_cap_set(DMA_XOR, plat_data->cap_mask);
481 dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); 480 dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask);
482 dma_cap_set(DMA_MEMSET, plat_data->cap_mask);
483 dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); 481 dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask);
484 break; 482 break;
485 case IOP13XX_INIT_ADMA_2: 483 case IOP13XX_INIT_ADMA_2:
@@ -489,7 +487,6 @@ void __init iop13xx_platform_init(void)
489 dma_cap_set(DMA_MEMCPY, plat_data->cap_mask); 487 dma_cap_set(DMA_MEMCPY, plat_data->cap_mask);
490 dma_cap_set(DMA_XOR, plat_data->cap_mask); 488 dma_cap_set(DMA_XOR, plat_data->cap_mask);
491 dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask); 489 dma_cap_set(DMA_XOR_VAL, plat_data->cap_mask);
492 dma_cap_set(DMA_MEMSET, plat_data->cap_mask);
493 dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask); 490 dma_cap_set(DMA_INTERRUPT, plat_data->cap_mask);
494 dma_cap_set(DMA_PQ, plat_data->cap_mask); 491 dma_cap_set(DMA_PQ, plat_data->cap_mask);
495 dma_cap_set(DMA_PQ_VAL, plat_data->cap_mask); 492 dma_cap_set(DMA_PQ_VAL, plat_data->cap_mask);
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index 73a2d905af8a..30e1ebe3a891 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -235,7 +235,6 @@ config IXP4XX_QMGR
235config IXP4XX_NPE 235config IXP4XX_NPE
236 tristate "IXP4xx Network Processor Engine support" 236 tristate "IXP4xx Network Processor Engine support"
237 select FW_LOADER 237 select FW_LOADER
238 select HOTPLUG
239 help 238 help
240 This driver supports IXP4xx built-in network coprocessors 239 This driver supports IXP4xx built-in network coprocessors
241 and is automatically selected by Ethernet and HSS drivers. 240 and is automatically selected by Ethernet and HSS drivers.
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 6600cff6bd92..d7223b3b81f3 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -559,7 +559,7 @@ void ixp4xx_restart(char mode, const char *cmd)
559 * fallback to the default. 559 * fallback to the default.
560 */ 560 */
561 561
562static void __iomem *ixp4xx_ioremap_caller(unsigned long addr, size_t size, 562static void __iomem *ixp4xx_ioremap_caller(phys_addr_t addr, size_t size,
563 unsigned int mtype, void *caller) 563 unsigned int mtype, void *caller)
564{ 564{
565 if (!is_pci_memory(addr)) 565 if (!is_pci_memory(addr))
diff --git a/arch/arm/mach-keystone/Kconfig b/arch/arm/mach-keystone/Kconfig
new file mode 100644
index 000000000000..51a50e996840
--- /dev/null
+++ b/arch/arm/mach-keystone/Kconfig
@@ -0,0 +1,15 @@
1config ARCH_KEYSTONE
2 bool "Texas Instruments Keystone Devices"
3 depends on ARCH_MULTI_V7
4 select CPU_V7
5 select ARM_GIC
6 select HAVE_ARM_ARCH_TIMER
7 select HAVE_SMP
8 select CLKSRC_MMIO
9 select GENERIC_CLOCKEVENTS
10 select HAVE_SCHED_CLOCK
11 select ARCH_WANT_OPTIONAL_GPIOLIB
12 select ARM_ERRATA_798181 if SMP
13 help
14 Support for boards based on the Texas Instruments Keystone family of
15 SoCs.
diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile
new file mode 100644
index 000000000000..ddc52b05dc84
--- /dev/null
+++ b/arch/arm/mach-keystone/Makefile
@@ -0,0 +1,6 @@
1obj-y := keystone.o smc.o
2
3plus_sec := $(call as-instr,.arch_extension sec,+sec)
4AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec)
5
6obj-$(CONFIG_SMP) += platsmp.o
diff --git a/arch/arm/mach-keystone/Makefile.boot b/arch/arm/mach-keystone/Makefile.boot
new file mode 100644
index 000000000000..f3835c43af61
--- /dev/null
+++ b/arch/arm/mach-keystone/Makefile.boot
@@ -0,0 +1 @@
zreladdr-y := 0x80008000
diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
new file mode 100644
index 000000000000..fe4d9ff93a7e
--- /dev/null
+++ b/arch/arm/mach-keystone/keystone.c
@@ -0,0 +1,75 @@
1/*
2 * Keystone2 based boards and SOC related code.
3 *
4 * Copyright 2013 Texas Instruments, Inc.
5 * Cyril Chemparathy <cyril@ti.com>
6 * Santosh Shilimkar <santosh.shillimkar@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 */
12#include <linux/io.h>
13#include <linux/of.h>
14#include <linux/init.h>
15#include <linux/of_platform.h>
16#include <linux/of_address.h>
17
18#include <asm/setup.h>
19#include <asm/mach/map.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/time.h>
22#include <asm/smp_plat.h>
23
24#include "keystone.h"
25
26#define PLL_RESET_WRITE_KEY_MASK 0xffff0000
27#define PLL_RESET_WRITE_KEY 0x5a69
28#define PLL_RESET BIT(16)
29
30static void __iomem *keystone_rstctrl;
31
32static void __init keystone_init(void)
33{
34 struct device_node *node;
35
36 node = of_find_compatible_node(NULL, NULL, "ti,keystone-reset");
37 if (WARN_ON(!node))
38 pr_warn("ti,keystone-reset node undefined\n");
39
40 keystone_rstctrl = of_iomap(node, 0);
41 if (WARN_ON(!keystone_rstctrl))
42 pr_warn("ti,keystone-reset iomap error\n");
43
44 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
45}
46
47static const char *keystone_match[] __initconst = {
48 "ti,keystone-evm",
49 NULL,
50};
51
52void keystone_restart(char mode, const char *cmd)
53{
54 u32 val;
55
56 BUG_ON(!keystone_rstctrl);
57
58 /* Enable write access to RSTCTRL */
59 val = readl(keystone_rstctrl);
60 val &= PLL_RESET_WRITE_KEY_MASK;
61 val |= PLL_RESET_WRITE_KEY;
62 writel(val, keystone_rstctrl);
63
64 /* Reset the SOC */
65 val = readl(keystone_rstctrl);
66 val &= ~PLL_RESET;
67 writel(val, keystone_rstctrl);
68}
69
70DT_MACHINE_START(KEYSTONE, "Keystone")
71 .smp = smp_ops(keystone_smp_ops),
72 .init_machine = keystone_init,
73 .dt_compat = keystone_match,
74 .restart = keystone_restart,
75MACHINE_END
diff --git a/arch/arm/mach-keystone/keystone.h b/arch/arm/mach-keystone/keystone.h
new file mode 100644
index 000000000000..60bef9dedb12
--- /dev/null
+++ b/arch/arm/mach-keystone/keystone.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright 2013 Texas Instruments, Inc.
3 * Cyril Chemparathy <cyril@ti.com>
4 * Santosh Shilimkar <santosh.shillimkar@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 */
10
11#ifndef __KEYSTONE_H__
12#define __KEYSTONE_H__
13
14#define KEYSTONE_MON_CPU_UP_IDX 0x00
15
16#ifndef __ASSEMBLER__
17
18extern struct smp_operations keystone_smp_ops;
19extern void secondary_startup(void);
20extern u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr);
21
22#endif /* __ASSEMBLER__ */
23#endif /* __KEYSTONE_H__ */
diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c
new file mode 100644
index 000000000000..1d4181e1daf2
--- /dev/null
+++ b/arch/arm/mach-keystone/platsmp.c
@@ -0,0 +1,43 @@
1/*
2 * Keystone SOC SMP platform code
3 *
4 * Copyright 2013 Texas Instruments, Inc.
5 * Cyril Chemparathy <cyril@ti.com>
6 * Santosh Shilimkar <santosh.shillimkar@ti.com>
7 *
8 * Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/smp.h>
17#include <linux/io.h>
18
19#include <asm/smp_plat.h>
20#include <asm/prom.h>
21
22#include "keystone.h"
23
24static int __cpuinit keystone_smp_boot_secondary(unsigned int cpu,
25 struct task_struct *idle)
26{
27 unsigned long start = virt_to_phys(&secondary_startup);
28 int error;
29
30 pr_debug("keystone-smp: booting cpu %d, vector %08lx\n",
31 cpu, start);
32
33 error = keystone_cpu_smc(KEYSTONE_MON_CPU_UP_IDX, cpu, start);
34 if (error)
35 pr_err("CPU %d bringup failed with %d\n", cpu, error);
36
37 return error;
38}
39
40struct smp_operations keystone_smp_ops __initdata = {
41 .smp_init_cpus = arm_dt_init_cpu_maps,
42 .smp_boot_secondary = keystone_smp_boot_secondary,
43};
diff --git a/arch/arm/mach-keystone/smc.S b/arch/arm/mach-keystone/smc.S
new file mode 100644
index 000000000000..9b9e4f7b241e
--- /dev/null
+++ b/arch/arm/mach-keystone/smc.S
@@ -0,0 +1,29 @@
1/*
2 * Keystone Secure APIs
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 * Santosh Shilimkar <santosh.shilimkar@ti.com>
6 *
7 * This program is free software,you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/linkage.h>
13
14/**
15 * u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr)
16 *
17 * Low level CPU monitor API
18 * @command: Monitor command.
19 * @cpu: CPU Number
20 * @addr: Kernel jump address for boot CPU
21 *
22 * Return: Non zero value on failure
23 */
24ENTRY(keystone_cpu_smc)
25 stmfd sp!, {r4-r12, lr}
26 smc #0
27 dsb
28 ldmfd sp!, {r4-r12, pc}
29ENDPROC(keystone_cpu_smc)
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 7509a89af967..b634f9650a7b 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -8,12 +8,6 @@ config MACH_D2NET_V2
8 Say 'Y' here if you want your kernel to support the 8 Say 'Y' here if you want your kernel to support the
9 LaCie d2 Network v2 NAS. 9 LaCie d2 Network v2 NAS.
10 10
11config MACH_DB88F6281_BP
12 bool "Marvell DB-88F6281-BP Development Board"
13 help
14 Say 'Y' here if you want your kernel to support the
15 Marvell DB-88F6281-BP Development Board.
16
17config MACH_DOCKSTAR 11config MACH_DOCKSTAR
18 bool "Seagate FreeAgent DockStar" 12 bool "Seagate FreeAgent DockStar"
19 help 13 help
@@ -134,13 +128,12 @@ comment "Device tree entries"
134 128
135config ARCH_KIRKWOOD_DT 129config ARCH_KIRKWOOD_DT
136 bool "Marvell Kirkwood Flattened Device Tree" 130 bool "Marvell Kirkwood Flattened Device Tree"
131 select KIRKWOOD_CLK
137 select POWER_SUPPLY 132 select POWER_SUPPLY
138 select POWER_RESET 133 select POWER_RESET
139 select POWER_RESET_GPIO 134 select POWER_RESET_GPIO
140 select REGULATOR 135 select REGULATOR
141 select REGULATOR_FIXED_VOLTAGE 136 select REGULATOR_FIXED_VOLTAGE
142 select MVEBU_CLK_CORE
143 select MVEBU_CLK_GATING
144 select USE_OF 137 select USE_OF
145 help 138 help
146 Say 'Y' here if you want your kernel to support the 139 Say 'Y' here if you want your kernel to support the
@@ -153,6 +146,13 @@ config MACH_CLOUDBOX_DT
153 Say 'Y' here if you want your kernel to support the LaCie 146 Say 'Y' here if you want your kernel to support the LaCie
154 CloudBox NAS, using Flattened Device Tree. 147 CloudBox NAS, using Flattened Device Tree.
155 148
149config MACH_DB88F628X_BP_DT
150 bool "Marvell DB-88F628x-BP Development Board (Flattened Device Tree)"
151 help
152 Say 'Y' here if you want your kernel to support the Marvell
153 DB-88F6281-BP and DB-88F6282-BP Development Board (Flattened
154 Device Tree).
155
156config MACH_DLINK_KIRKWOOD_DT 156config MACH_DLINK_KIRKWOOD_DT
157 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" 157 bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
158 select ARCH_KIRKWOOD_DT 158 select ARCH_KIRKWOOD_DT
@@ -227,6 +227,7 @@ config MACH_KM_KIRKWOOD_DT
227config MACH_LSXL_DT 227config MACH_LSXL_DT
228 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)" 228 bool "Buffalo Linkstation LS-XHL, LS-CHLv2 (Flattened Device Tree)"
229 select ARCH_KIRKWOOD_DT 229 select ARCH_KIRKWOOD_DT
230 select POWER_RESET_RESTART
230 help 231 help
231 Say 'Y' here if you want your kernel to support the 232 Say 'Y' here if you want your kernel to support the
232 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using 233 Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
@@ -272,14 +273,6 @@ config MACH_NETSPACE_V2_DT
272 Say 'Y' here if you want your kernel to support the LaCie 273 Say 'Y' here if you want your kernel to support the LaCie
273 Network Space v2 NAS, using Flattened Device Tree. 274 Network Space v2 NAS, using Flattened Device Tree.
274 275
275config MACH_NSA310_DT
276 bool "ZyXEL NSA-310 (Flattened Device Tree)"
277 select ARCH_KIRKWOOD_DT
278 select ARM_ATAG_DTB_COMPAT
279 help
280 Say 'Y' here if you want your kernel to support the
281 ZyXEL NSA-310 board (Flattened Device Tree).
282
283config MACH_OPENBLOCKS_A6_DT 276config MACH_OPENBLOCKS_A6_DT
284 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)" 277 bool "Plat'Home OpenBlocks A6 (Flattened Device Tree)"
285 select ARCH_KIRKWOOD_DT 278 select ARCH_KIRKWOOD_DT
@@ -296,6 +289,13 @@ config MACH_READYNAS_DT
296 Say 'Y' here if you want your kernel to support the 289 Say 'Y' here if you want your kernel to support the
297 NETGEAR ReadyNAS Duo v2 using Fattened Device Tree. 290 NETGEAR ReadyNAS Duo v2 using Fattened Device Tree.
298 291
292config MACH_SHEEVAPLUG_DT
293 bool "Marvell (eSATA) SheevaPlug (Flattened Device Tree)"
294 select ARCH_KIRKWOOD_DT
295 help
296 Say 'Y' here if you want your kernel to support the
297 Marvell (eSATA) SheevaPlug (Flattened Device Tree).
298
299config MACH_TOPKICK_DT 299config MACH_TOPKICK_DT
300 bool "USI Topkick (Flattened Device Tree)" 300 bool "USI Topkick (Flattened Device Tree)"
301 select ARCH_KIRKWOOD_DT 301 select ARCH_KIRKWOOD_DT
@@ -308,6 +308,7 @@ config MACH_TS219_DT
308 select ARCH_KIRKWOOD_DT 308 select ARCH_KIRKWOOD_DT
309 select ARM_APPENDED_DTB 309 select ARM_APPENDED_DTB
310 select ARM_ATAG_DTB_COMPAT 310 select ARM_ATAG_DTB_COMPAT
311 select POWER_RESET_QNAP
311 help 312 help
312 Say 'Y' here if you want your kernel to support the QNAP 313 Say 'Y' here if you want your kernel to support the QNAP
313 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and 314 TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index e1f3735d3415..ac4cd75dd499 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -1,7 +1,6 @@
1obj-y += common.o irq.o pcie.o mpp.o 1obj-y += common.o irq.o pcie.o mpp.o
2 2
3obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o 3obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o
4obj-$(CONFIG_MACH_DB88F6281_BP) += db88f6281-bp-setup.o
5obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o 4obj-$(CONFIG_MACH_DOCKSTAR) += dockstar-setup.o
6obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o 5obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG) += sheevaplug-setup.o
7obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o 6obj-$(CONFIG_MACH_GURUPLUG) += guruplug-setup.o
@@ -21,6 +20,7 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
21 20
22obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 21obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
23obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o 22obj-$(CONFIG_MACH_CLOUDBOX_DT) += board-ns2.o
23obj-$(CONFIG_MACH_DB88F628X_BP_DT) += board-db88f628x-bp.o
24obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o 24obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
25obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o 25obj-$(CONFIG_MACH_DOCKSTAR_DT) += board-dockstar.o
26obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o 26obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
@@ -37,8 +37,8 @@ obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT) += board-ns2.o
37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o 37obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT) += board-ns2.o
38obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o 38obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT) += board-ns2.o
39obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o 39obj-$(CONFIG_MACH_NETSPACE_V2_DT) += board-ns2.o
40obj-$(CONFIG_MACH_NSA310_DT) += board-nsa310.o
41obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o 40obj-$(CONFIG_MACH_OPENBLOCKS_A6_DT) += board-openblocks_a6.o
42obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o 41obj-$(CONFIG_MACH_READYNAS_DT) += board-readynas.o
42obj-$(CONFIG_MACH_SHEEVAPLUG_DT) += board-sheevaplug.o
43obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o 43obj-$(CONFIG_MACH_TOPKICK_DT) += board-usi_topkick.o
44obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o 44obj-$(CONFIG_MACH_TS219_DT) += board-ts219.o tsx1x-common.o
diff --git a/arch/arm/mach-kirkwood/board-db88f628x-bp.c b/arch/arm/mach-kirkwood/board-db88f628x-bp.c
new file mode 100644
index 000000000000..2f574bc8ed40
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-db88f628x-bp.c
@@ -0,0 +1,24 @@
1/*
2 * Saeed Bishara <saeed@marvell.com>
3 *
4 * Marvell DB-88F628{1,2}-BP Development 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/of.h>
14#include <linux/mv643xx_eth.h>
15#include "common.h"
16
17static struct mv643xx_eth_platform_data db88f628x_ge00_data = {
18 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
19};
20
21void __init db88f628x_init(void)
22{
23 kirkwood_ge00_init(&db88f628x_ge00_data);
24}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index e9647b80cb59..6e122ed3282f 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -15,7 +15,6 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/clk-provider.h> 17#include <linux/clk-provider.h>
18#include <linux/clk/mvebu.h>
19#include <linux/kexec.h> 18#include <linux/kexec.h>
20#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
21#include <asm/mach/map.h> 20#include <asm/mach/map.h>
@@ -25,11 +24,6 @@
25#include <plat/common.h> 24#include <plat/common.h>
26#include "common.h" 25#include "common.h"
27 26
28static struct of_device_id kirkwood_dt_match_table[] __initdata = {
29 { .compatible = "simple-bus", },
30 { }
31};
32
33/* 27/*
34 * There are still devices that doesn't know about DT yet. Get clock 28 * There are still devices that doesn't know about DT yet. Get clock
35 * gates here and add a clock lookup alias, so that old platform 29 * gates here and add a clock lookup alias, so that old platform
@@ -77,7 +71,7 @@ static void __init kirkwood_legacy_clk_init(void)
77 71
78static void __init kirkwood_of_clk_init(void) 72static void __init kirkwood_of_clk_init(void)
79{ 73{
80 mvebu_clocks_init(); 74 of_clk_init(NULL);
81 kirkwood_legacy_clk_init(); 75 kirkwood_legacy_clk_init();
82} 76}
83 77
@@ -97,6 +91,8 @@ static void __init kirkwood_dt_init(void)
97 91
98 kirkwood_l2_init(); 92 kirkwood_l2_init();
99 93
94 kirkwood_cpufreq_init();
95
100 /* Setup root of clk tree */ 96 /* Setup root of clk tree */
101 kirkwood_of_clk_init(); 97 kirkwood_of_clk_init();
102 98
@@ -112,6 +108,9 @@ static void __init kirkwood_dt_init(void)
112 if (of_machine_is_compatible("globalscale,guruplug")) 108 if (of_machine_is_compatible("globalscale,guruplug"))
113 guruplug_dt_init(); 109 guruplug_dt_init();
114 110
111 if (of_machine_is_compatible("globalscale,sheevaplug"))
112 sheevaplug_dt_init();
113
115 if (of_machine_is_compatible("dlink,dns-kirkwood")) 114 if (of_machine_is_compatible("dlink,dns-kirkwood"))
116 dnskw_init(); 115 dnskw_init();
117 116
@@ -147,6 +146,10 @@ static void __init kirkwood_dt_init(void)
147 of_machine_is_compatible("lacie,netspace_v2")) 146 of_machine_is_compatible("lacie,netspace_v2"))
148 ns2_init(); 147 ns2_init();
149 148
149 if (of_machine_is_compatible("marvell,db-88f6281-bp") ||
150 of_machine_is_compatible("marvell,db-88f6282-bp"))
151 db88f628x_init();
152
150 if (of_machine_is_compatible("mpl,cec4")) 153 if (of_machine_is_compatible("mpl,cec4"))
151 mplcec4_init(); 154 mplcec4_init();
152 155
@@ -159,12 +162,13 @@ static void __init kirkwood_dt_init(void)
159 if (of_machine_is_compatible("usi,topkick")) 162 if (of_machine_is_compatible("usi,topkick"))
160 usi_topkick_init(); 163 usi_topkick_init();
161 164
162 of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); 165 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
163} 166}
164 167
165static const char * const kirkwood_dt_board_compat[] = { 168static const char * const kirkwood_dt_board_compat[] = {
166 "globalscale,dreamplug", 169 "globalscale,dreamplug",
167 "globalscale,guruplug", 170 "globalscale,guruplug",
171 "globalscale,sheevaplug",
168 "dlink,dns-320", 172 "dlink,dns-320",
169 "dlink,dns-325", 173 "dlink,dns-325",
170 "iom,iconnect", 174 "iom,iconnect",
@@ -181,6 +185,8 @@ static const char * const kirkwood_dt_board_compat[] = {
181 "lacie,netspace_max_v2", 185 "lacie,netspace_max_v2",
182 "lacie,netspace_mini_v2", 186 "lacie,netspace_mini_v2",
183 "lacie,netspace_v2", 187 "lacie,netspace_v2",
188 "marvell,db-88f6281-bp",
189 "marvell,db-88f6282-bp",
184 "mpl,cec4", 190 "mpl,cec4",
185 "netgear,readynas-duo-v2", 191 "netgear,readynas-duo-v2",
186 "plathome,openblocks-a6", 192 "plathome,openblocks-a6",
diff --git a/arch/arm/mach-kirkwood/board-iconnect.c b/arch/arm/mach-kirkwood/board-iconnect.c
index c8ebde4919e2..98b5ad1bba90 100644
--- a/arch/arm/mach-kirkwood/board-iconnect.c
+++ b/arch/arm/mach-kirkwood/board-iconnect.c
@@ -22,11 +22,3 @@ void __init iconnect_init(void)
22{ 22{
23 kirkwood_ge00_init(&iconnect_ge00_data); 23 kirkwood_ge00_init(&iconnect_ge00_data);
24} 24}
25
26static int __init iconnect_pci_init(void)
27{
28 if (of_machine_is_compatible("iom,iconnect"))
29 kirkwood_pcie_init(KW_PCIE0);
30 return 0;
31}
32subsys_initcall(iconnect_pci_init);
diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
index 4ec8b7ae784a..348395238df6 100644
--- a/arch/arm/mach-kirkwood/board-lsxl.c
+++ b/arch/arm/mach-kirkwood/board-lsxl.c
@@ -25,19 +25,6 @@ static struct mv643xx_eth_platform_data lsxl_ge01_data = {
25 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 25 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
26}; 26};
27 27
28/*
29 * On the LS-XHL/LS-CHLv2, the shutdown process is following:
30 * - Userland monitors key events until the power switch goes to off position
31 * - The board reboots
32 * - U-boot starts and goes into an idle mode waiting for the user
33 * to move the switch to ON position
34 *
35 */
36static void lsxl_power_off(void)
37{
38 kirkwood_restart('h', NULL);
39}
40
41void __init lsxl_init(void) 28void __init lsxl_init(void)
42{ 29{
43 /* 30 /*
@@ -46,7 +33,4 @@ void __init lsxl_init(void)
46 33
47 kirkwood_ge00_init(&lsxl_ge00_data); 34 kirkwood_ge00_init(&lsxl_ge00_data);
48 kirkwood_ge01_init(&lsxl_ge01_data); 35 kirkwood_ge01_init(&lsxl_ge01_data);
49
50 /* register power-off method */
51 pm_power_off = lsxl_power_off;
52} 36}
diff --git a/arch/arm/mach-kirkwood/board-mplcec4.c b/arch/arm/mach-kirkwood/board-mplcec4.c
index 7d6dc669e17f..938712e248f1 100644
--- a/arch/arm/mach-kirkwood/board-mplcec4.c
+++ b/arch/arm/mach-kirkwood/board-mplcec4.c
@@ -29,7 +29,6 @@ void __init mplcec4_init(void)
29 */ 29 */
30 kirkwood_ge00_init(&mplcec4_ge00_data); 30 kirkwood_ge00_init(&mplcec4_ge00_data);
31 kirkwood_ge01_init(&mplcec4_ge01_data); 31 kirkwood_ge01_init(&mplcec4_ge01_data);
32 kirkwood_pcie_init(KW_PCIE0);
33} 32}
34 33
35 34
diff --git a/arch/arm/mach-kirkwood/board-nsa310.c b/arch/arm/mach-kirkwood/board-nsa310.c
deleted file mode 100644
index 55ade93b93bf..000000000000
--- a/arch/arm/mach-kirkwood/board-nsa310.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/nsa-310-setup.c
3 *
4 * ZyXEL NSA-310 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 <mach/kirkwood.h>
14#include <linux/of.h>
15#include "common.h"
16
17static int __init nsa310_pci_init(void)
18{
19 if (of_machine_is_compatible("zyxel,nsa310"))
20 kirkwood_pcie_init(KW_PCIE0);
21
22 return 0;
23}
24
25subsys_initcall(nsa310_pci_init);
diff --git a/arch/arm/mach-kirkwood/board-readynas.c b/arch/arm/mach-kirkwood/board-readynas.c
index fb42c20e273f..341b82d9cadb 100644
--- a/arch/arm/mach-kirkwood/board-readynas.c
+++ b/arch/arm/mach-kirkwood/board-readynas.c
@@ -24,5 +24,4 @@ static struct mv643xx_eth_platform_data netgear_readynas_ge00_data = {
24void __init netgear_readynas_init(void) 24void __init netgear_readynas_init(void)
25{ 25{
26 kirkwood_ge00_init(&netgear_readynas_ge00_data); 26 kirkwood_ge00_init(&netgear_readynas_ge00_data);
27 kirkwood_pcie_init(KW_PCIE0);
28} 27}
diff --git a/arch/arm/mach-kirkwood/board-sheevaplug.c b/arch/arm/mach-kirkwood/board-sheevaplug.c
new file mode 100644
index 000000000000..fa389373ca74
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-sheevaplug.c
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-kirkwood/board-sheevaplug.c
3 *
4 * Marvell Sheevaplug Reference Board Init for drivers not converted to
5 * flattened device tree yet.
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#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/mv643xx_eth.h>
15#include "common.h"
16
17static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
18 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
19};
20
21void __init sheevaplug_dt_init(void)
22{
23 /*
24 * Basic setup. Needs to be called early.
25 */
26 kirkwood_ge00_init(&sheevaplug_ge00_data);
27}
diff --git a/arch/arm/mach-kirkwood/board-ts219.c b/arch/arm/mach-kirkwood/board-ts219.c
index 4695d5f35fc9..860f44ab457d 100644
--- a/arch/arm/mach-kirkwood/board-ts219.c
+++ b/arch/arm/mach-kirkwood/board-ts219.c
@@ -23,7 +23,6 @@
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <mach/kirkwood.h> 24#include <mach/kirkwood.h>
25#include "common.h" 25#include "common.h"
26#include "tsx1x-common.h"
27 26
28static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = { 27static struct mv643xx_eth_platform_data qnap_ts219_ge00_data = {
29 .phy_addr = MV643XX_ETH_PHY_ADDR(8), 28 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
@@ -38,6 +37,4 @@ void __init qnap_dt_ts219_init(void)
38 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0); 37 qnap_ts219_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
39 38
40 kirkwood_ge00_init(&qnap_ts219_ge00_data); 39 kirkwood_ge00_init(&qnap_ts219_ge00_data);
41
42 pm_power_off = qnap_tsx1x_power_off;
43} 40}
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index f38922897563..7c72c725b711 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -598,6 +598,29 @@ void __init kirkwood_audio_init(void)
598} 598}
599 599
600/***************************************************************************** 600/*****************************************************************************
601 * CPU Frequency
602 ****************************************************************************/
603static struct resource kirkwood_cpufreq_resources[] = {
604 [0] = {
605 .start = CPU_CONTROL_PHYS,
606 .end = CPU_CONTROL_PHYS + 3,
607 .flags = IORESOURCE_MEM,
608 },
609};
610
611static struct platform_device kirkwood_cpufreq_device = {
612 .name = "kirkwood-cpufreq",
613 .id = -1,
614 .num_resources = ARRAY_SIZE(kirkwood_cpufreq_resources),
615 .resource = kirkwood_cpufreq_resources,
616};
617
618void __init kirkwood_cpufreq_init(void)
619{
620 platform_device_register(&kirkwood_cpufreq_device);
621}
622
623/*****************************************************************************
601 * General 624 * General
602 ****************************************************************************/ 625 ****************************************************************************/
603/* 626/*
@@ -648,30 +671,6 @@ char * __init kirkwood_id(void)
648 671
649void __init kirkwood_setup_wins(void) 672void __init kirkwood_setup_wins(void)
650{ 673{
651 /*
652 * The PCIe windows will no longer be statically allocated
653 * here once Kirkwood is migrated to the pci-mvebu driver.
654 */
655 mvebu_mbus_add_window_remap_flags("pcie0.0",
656 KIRKWOOD_PCIE_IO_PHYS_BASE,
657 KIRKWOOD_PCIE_IO_SIZE,
658 KIRKWOOD_PCIE_IO_BUS_BASE,
659 MVEBU_MBUS_PCI_IO);
660 mvebu_mbus_add_window_remap_flags("pcie0.0",
661 KIRKWOOD_PCIE_MEM_PHYS_BASE,
662 KIRKWOOD_PCIE_MEM_SIZE,
663 MVEBU_MBUS_NO_REMAP,
664 MVEBU_MBUS_PCI_MEM);
665 mvebu_mbus_add_window_remap_flags("pcie1.0",
666 KIRKWOOD_PCIE1_IO_PHYS_BASE,
667 KIRKWOOD_PCIE1_IO_SIZE,
668 KIRKWOOD_PCIE1_IO_BUS_BASE,
669 MVEBU_MBUS_PCI_IO);
670 mvebu_mbus_add_window_remap_flags("pcie1.0",
671 KIRKWOOD_PCIE1_MEM_PHYS_BASE,
672 KIRKWOOD_PCIE1_MEM_SIZE,
673 MVEBU_MBUS_NO_REMAP,
674 MVEBU_MBUS_PCI_MEM);
675 mvebu_mbus_add_window("nand", KIRKWOOD_NAND_MEM_PHYS_BASE, 674 mvebu_mbus_add_window("nand", KIRKWOOD_NAND_MEM_PHYS_BASE,
676 KIRKWOOD_NAND_MEM_SIZE); 675 KIRKWOOD_NAND_MEM_SIZE);
677 mvebu_mbus_add_window("sram", KIRKWOOD_SRAM_PHYS_BASE, 676 mvebu_mbus_add_window("sram", KIRKWOOD_SRAM_PHYS_BASE,
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 21da3b1ebd7b..1c09f3f93fbb 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -51,6 +51,8 @@ void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts,
51 int (*dev_ready)(struct mtd_info *)); 51 int (*dev_ready)(struct mtd_info *));
52void kirkwood_audio_init(void); 52void kirkwood_audio_init(void);
53void kirkwood_cpuidle_init(void); 53void kirkwood_cpuidle_init(void);
54void kirkwood_cpufreq_init(void);
55
54void kirkwood_restart(char, const char *); 56void kirkwood_restart(char, const char *);
55void kirkwood_clk_init(void); 57void kirkwood_clk_init(void);
56 58
@@ -65,6 +67,11 @@ void guruplug_dt_init(void);
65#else 67#else
66static inline void guruplug_dt_init(void) {}; 68static inline void guruplug_dt_init(void) {};
67#endif 69#endif
70#ifdef CONFIG_MACH_SHEEVAPLUG_DT
71void sheevaplug_dt_init(void);
72#else
73static inline void sheevaplug_dt_init(void) {};
74#endif
68#ifdef CONFIG_MACH_TS219_DT 75#ifdef CONFIG_MACH_TS219_DT
69void qnap_dt_ts219_init(void); 76void qnap_dt_ts219_init(void);
70#else 77#else
@@ -119,6 +126,12 @@ void km_kirkwood_init(void);
119static inline void km_kirkwood_init(void) {}; 126static inline void km_kirkwood_init(void) {};
120#endif 127#endif
121 128
129#ifdef CONFIG_MACH_DB88F628X_BP_DT
130void db88f628x_init(void);
131#else
132static inline void db88f628x_init(void) {};
133#endif
134
122#ifdef CONFIG_MACH_MPLCEC4_DT 135#ifdef CONFIG_MACH_MPLCEC4_DT
123void mplcec4_init(void); 136void mplcec4_init(void);
124#else 137#else
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
deleted file mode 100644
index 5a369fe74754..000000000000
--- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * arch/arm/mach-kirkwood/db88f6281-bp-setup.c
3 *
4 * Marvell DB-88F6281-BP Development 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/sizes.h>
14#include <linux/platform_device.h>
15#include <linux/mtd/partitions.h>
16#include <linux/ata_platform.h>
17#include <linux/mv643xx_eth.h>
18#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <mach/kirkwood.h>
21#include <linux/platform_data/mmc-mvsdio.h>
22#include "common.h"
23#include "mpp.h"
24
25static struct mtd_partition db88f6281_nand_parts[] = {
26 {
27 .name = "u-boot",
28 .offset = 0,
29 .size = SZ_1M
30 }, {
31 .name = "uImage",
32 .offset = MTDPART_OFS_NXTBLK,
33 .size = SZ_4M
34 }, {
35 .name = "root",
36 .offset = MTDPART_OFS_NXTBLK,
37 .size = MTDPART_SIZ_FULL
38 },
39};
40
41static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
42 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
43};
44
45static struct mv_sata_platform_data db88f6281_sata_data = {
46 .n_ports = 2,
47};
48
49static struct mvsdio_platform_data db88f6281_mvsdio_data = {
50 .gpio_write_protect = 37,
51 .gpio_card_detect = 38,
52};
53
54static unsigned int db88f6281_mpp_config[] __initdata = {
55 MPP0_NF_IO2,
56 MPP1_NF_IO3,
57 MPP2_NF_IO4,
58 MPP3_NF_IO5,
59 MPP4_NF_IO6,
60 MPP5_NF_IO7,
61 MPP18_NF_IO0,
62 MPP19_NF_IO1,
63 MPP37_GPIO,
64 MPP38_GPIO,
65 0
66};
67
68static void __init db88f6281_init(void)
69{
70 /*
71 * Basic setup. Needs to be called early.
72 */
73 kirkwood_init();
74 kirkwood_mpp_conf(db88f6281_mpp_config);
75
76 kirkwood_nand_init(ARRAY_AND_SIZE(db88f6281_nand_parts), 25);
77 kirkwood_ehci_init();
78 kirkwood_ge00_init(&db88f6281_ge00_data);
79 kirkwood_sata_init(&db88f6281_sata_data);
80 kirkwood_uart0_init();
81 kirkwood_sdio_init(&db88f6281_mvsdio_data);
82}
83
84static int __init db88f6281_pci_init(void)
85{
86 if (machine_is_db88f6281_bp()) {
87 u32 dev, rev;
88
89 kirkwood_pcie_id(&dev, &rev);
90 if (dev == MV88F6282_DEV_ID)
91 kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
92 else
93 kirkwood_pcie_init(KW_PCIE0);
94 }
95 return 0;
96}
97subsys_initcall(db88f6281_pci_init);
98
99MACHINE_START(DB88F6281_BP, "Marvell DB-88F6281-BP Development Board")
100 /* Maintainer: Saeed Bishara <saeed@marvell.com> */
101 .atag_offset = 0x100,
102 .init_machine = db88f6281_init,
103 .map_io = kirkwood_map_io,
104 .init_early = kirkwood_init_early,
105 .init_irq = kirkwood_init_irq,
106 .init_time = kirkwood_timer_init,
107 .restart = kirkwood_restart,
108MACHINE_END
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index 5c82b7dce4e2..d4cbe5e81bb4 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -17,6 +17,7 @@
17#define CPU_CONFIG_ERROR_PROP 0x00000004 17#define CPU_CONFIG_ERROR_PROP 0x00000004
18 18
19#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104) 19#define CPU_CONTROL (BRIDGE_VIRT_BASE + 0x0104)
20#define CPU_CONTROL_PHYS (BRIDGE_PHYS_BASE + 0x0104)
20#define CPU_RESET 0x00000002 21#define CPU_RESET 0x00000002
21 22
22#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108) 23#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
@@ -69,6 +70,7 @@
69#define CGC_RUNIT (1 << 7) 70#define CGC_RUNIT (1 << 7)
70#define CGC_XOR0 (1 << 8) 71#define CGC_XOR0 (1 << 8)
71#define CGC_AUDIO (1 << 9) 72#define CGC_AUDIO (1 << 9)
73#define CGC_POWERSAVE (1 << 11)
72#define CGC_SATA0 (1 << 14) 74#define CGC_SATA0 (1 << 14)
73#define CGC_SATA1 (1 << 15) 75#define CGC_SATA1 (1 << 15)
74#define CGC_XOR1 (1 << 16) 76#define CGC_XOR1 (1 << 16)
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 827cde42414f..e96fd71abd76 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -22,9 +22,10 @@ static unsigned int __init kirkwood_variant(void)
22 22
23 kirkwood_pcie_id(&dev, &rev); 23 kirkwood_pcie_id(&dev, &rev);
24 24
25 if ((dev == MV88F6281_DEV_ID && rev >= MV88F6281_REV_A0) || 25 if (dev == MV88F6281_DEV_ID && rev >= MV88F6281_REV_A0)
26 (dev == MV88F6282_DEV_ID))
27 return MPP_F6281_MASK; 26 return MPP_F6281_MASK;
27 if (dev == MV88F6282_DEV_ID)
28 return MPP_F6282_MASK;
28 if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0) 29 if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0)
29 return MPP_F6192_MASK; 30 return MPP_F6192_MASK;
30 if (dev == MV88F6180_DEV_ID) 31 if (dev == MV88F6180_DEV_ID)
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index 7f43e6c2f8c0..ddcb09f5bdd3 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -12,6 +12,7 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/mbus.h>
15#include <video/vga.h> 16#include <video/vga.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
17#include <asm/mach/pci.h> 18#include <asm/mach/pci.h>
@@ -253,6 +254,27 @@ static void __init add_pcie_port(int index, void __iomem *base)
253 254
254void __init kirkwood_pcie_init(unsigned int portmask) 255void __init kirkwood_pcie_init(unsigned int portmask)
255{ 256{
257 mvebu_mbus_add_window_remap_flags("pcie0.0",
258 KIRKWOOD_PCIE_IO_PHYS_BASE,
259 KIRKWOOD_PCIE_IO_SIZE,
260 KIRKWOOD_PCIE_IO_BUS_BASE,
261 MVEBU_MBUS_PCI_IO);
262 mvebu_mbus_add_window_remap_flags("pcie0.0",
263 KIRKWOOD_PCIE_MEM_PHYS_BASE,
264 KIRKWOOD_PCIE_MEM_SIZE,
265 MVEBU_MBUS_NO_REMAP,
266 MVEBU_MBUS_PCI_MEM);
267 mvebu_mbus_add_window_remap_flags("pcie1.0",
268 KIRKWOOD_PCIE1_IO_PHYS_BASE,
269 KIRKWOOD_PCIE1_IO_SIZE,
270 KIRKWOOD_PCIE1_IO_BUS_BASE,
271 MVEBU_MBUS_PCI_IO);
272 mvebu_mbus_add_window_remap_flags("pcie1.0",
273 KIRKWOOD_PCIE1_MEM_PHYS_BASE,
274 KIRKWOOD_PCIE1_MEM_SIZE,
275 MVEBU_MBUS_NO_REMAP,
276 MVEBU_MBUS_PCI_MEM);
277
256 vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE; 278 vga_base = KIRKWOOD_PCIE_MEM_PHYS_BASE;
257 279
258 if (portmask & KW_PCIE0) 280 if (portmask & KW_PCIE0)
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 5b660ec09ef5..0c002099c3a3 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -210,7 +210,7 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
210 .invert_pixclock = 0, 210 .invert_pixclock = 0,
211}; 211};
212 212
213static unsigned int aspenite_matrix_key_map[] = { 213static const unsigned int aspenite_matrix_key_map[] = {
214 KEY(0, 6, KEY_UP), /* SW 4 */ 214 KEY(0, 6, KEY_UP), /* SW 4 */
215 KEY(0, 7, KEY_DOWN), /* SW 5 */ 215 KEY(0, 7, KEY_DOWN), /* SW 5 */
216 KEY(1, 6, KEY_LEFT), /* SW 6 */ 216 KEY(1, 6, KEY_LEFT), /* SW 6 */
@@ -219,11 +219,15 @@ static unsigned int aspenite_matrix_key_map[] = {
219 KEY(4, 7, KEY_ESC), /* SW 9 */ 219 KEY(4, 7, KEY_ESC), /* SW 9 */
220}; 220};
221 221
222static struct matrix_keymap_data aspenite_matrix_keymap_data = {
223 .keymap = aspenite_matrix_key_map,
224 .keymap_size = ARRAY_SIZE(aspenite_matrix_key_map),
225};
226
222static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = { 227static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
223 .matrix_key_rows = 5, 228 .matrix_key_rows = 5,
224 .matrix_key_cols = 8, 229 .matrix_key_cols = 8,
225 .matrix_key_map = aspenite_matrix_key_map, 230 .matrix_keymap_data = &aspenite_matrix_keymap_data,
226 .matrix_key_map_size = ARRAY_SIZE(aspenite_matrix_key_map),
227 .debounce_interval = 30, 231 .debounce_interval = 30,
228}; 232};
229 233
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index e4d95b4c6bb2..6aa53fb29d26 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -61,11 +61,15 @@ static unsigned int teton_bga_matrix_key_map[] = {
61 KEY(1, 7, KEY_RIGHT), 61 KEY(1, 7, KEY_RIGHT),
62}; 62};
63 63
64static struct matrix_keymap_data teton_bga_matrix_keymap_data = {
65 .keymap = teton_bga_matrix_key_map,
66 .keymap_size = ARRAY_SIZE(teton_bga_matrix_key_map),
67};
68
64static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = { 69static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
65 .matrix_key_rows = 2, 70 .matrix_key_rows = 2,
66 .matrix_key_cols = 8, 71 .matrix_key_cols = 8,
67 .matrix_key_map = teton_bga_matrix_key_map, 72 .matrix_keymap_data = &teton_bga_matrix_keymap_data,
68 .matrix_key_map_size = ARRAY_SIZE(teton_bga_matrix_key_map),
69 .debounce_interval = 30, 73 .debounce_interval = 30,
70}; 74};
71 75
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index fceb093b9494..614e41e7881b 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -48,9 +48,7 @@ config ARCH_MSM8X60
48 select CPU_V7 48 select CPU_V7
49 select GPIO_MSM_V2 49 select GPIO_MSM_V2
50 select HAVE_SMP 50 select HAVE_SMP
51 select MSM_GPIOMUX
52 select MSM_SCM if SMP 51 select MSM_SCM if SMP
53 select MSM_V2_TLMM
54 select USE_OF 52 select USE_OF
55 53
56config ARCH_MSM8960 54config ARCH_MSM8960
@@ -58,9 +56,8 @@ config ARCH_MSM8960
58 select ARM_GIC 56 select ARM_GIC
59 select CPU_V7 57 select CPU_V7
60 select HAVE_SMP 58 select HAVE_SMP
61 select MSM_GPIOMUX 59 select GPIO_MSM_V2
62 select MSM_SCM if SMP 60 select MSM_SCM if SMP
63 select MSM_V2_TLMM
64 select USE_OF 61 select USE_OF
65 62
66config MSM_HAS_DEBUG_UART_HS 63config MSM_HAS_DEBUG_UART_HS
@@ -124,10 +121,10 @@ config MSM_SMD
124 bool 121 bool
125 122
126config MSM_GPIOMUX 123config MSM_GPIOMUX
127 bool 124 depends on !(ARCH_MSM8X60 || ARCH_MSM8960)
128 125 bool "MSM V1 TLMM GPIOMUX architecture"
129config MSM_V2_TLMM 126 help
130 bool 127 Support for MSM V1 TLMM GPIOMUX architecture.
131 128
132config MSM_SCM 129config MSM_SCM
133 bool 130 bool
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 17519faf082f..d257ff40e16b 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -1,16 +1,18 @@
1obj-y += io.o timer.o 1obj-y += io.o timer.o
2obj-y += clock.o 2obj-y += clock.o
3obj-$(CONFIG_DEBUG_FS) += clock-debug.o
4 3
5obj-$(CONFIG_MSM_VIC) += irq-vic.o 4obj-$(CONFIG_MSM_VIC) += irq-vic.o
6obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o 5obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
7 6
8obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o 7obj-$(CONFIG_ARCH_MSM7X00A) += irq.o
9obj-$(CONFIG_ARCH_MSM7X30) += dma.o 8obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
10obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
11 9
12obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o 10obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
13 11
12obj-$(CONFIG_ARCH_MSM7X00A) += dma.o
13obj-$(CONFIG_ARCH_MSM7X30) += dma.o
14obj-$(CONFIG_ARCH_QSD8X50) += dma.o
15
14obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 16obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
15obj-$(CONFIG_MSM_SMD) += last_radio_log.o 17obj-$(CONFIG_MSM_SMD) += last_radio_log.o
16obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o 18obj-$(CONFIG_MSM_SCM) += scm.o scm-boot.o
@@ -27,7 +29,5 @@ obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
27obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o 29obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
28obj-$(CONFIG_ARCH_MSM8X60) += board-dt-8660.o 30obj-$(CONFIG_ARCH_MSM8X60) += board-dt-8660.o
29obj-$(CONFIG_ARCH_MSM8960) += board-dt-8960.o 31obj-$(CONFIG_ARCH_MSM8960) += board-dt-8960.o
30 32obj-$(CONFIG_MSM_GPIOMUX) += gpiomux.o
31obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o 33obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o
32obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o
33obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o
diff --git a/arch/arm/mach-msm/board-dt-8660.c b/arch/arm/mach-msm/board-dt-8660.c
index 7dcfc5300bbd..492f5cd87b0a 100644
--- a/arch/arm/mach-msm/board-dt-8660.c
+++ b/arch/arm/mach-msm/board-dt-8660.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/irqchip.h>
15#include <linux/of.h> 14#include <linux/of.h>
16#include <linux/of_platform.h> 15#include <linux/of_platform.h>
17 16
@@ -44,7 +43,6 @@ static const char *msm8x60_fluid_match[] __initdata = {
44DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)") 43DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
45 .smp = smp_ops(msm_smp_ops), 44 .smp = smp_ops(msm_smp_ops),
46 .map_io = msm_map_msm8x60_io, 45 .map_io = msm_map_msm8x60_io,
47 .init_irq = irqchip_init,
48 .init_machine = msm8x60_dt_init, 46 .init_machine = msm8x60_dt_init,
49 .init_late = msm8x60_init_late, 47 .init_late = msm8x60_init_late,
50 .init_time = msm_dt_timer_init, 48 .init_time = msm_dt_timer_init,
diff --git a/arch/arm/mach-msm/board-dt-8960.c b/arch/arm/mach-msm/board-dt-8960.c
index 73019363ffa4..bb5530957c4f 100644
--- a/arch/arm/mach-msm/board-dt-8960.c
+++ b/arch/arm/mach-msm/board-dt-8960.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/irqchip.h>
15#include <linux/of_platform.h> 14#include <linux/of_platform.h>
16 15
17#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
@@ -31,7 +30,6 @@ static const char * const msm8960_dt_match[] __initconst = {
31DT_MACHINE_START(MSM8960_DT, "Qualcomm MSM (Flattened Device Tree)") 30DT_MACHINE_START(MSM8960_DT, "Qualcomm MSM (Flattened Device Tree)")
32 .smp = smp_ops(msm_smp_ops), 31 .smp = smp_ops(msm_smp_ops),
33 .map_io = msm_map_msm8960_io, 32 .map_io = msm_map_msm8960_io,
34 .init_irq = irqchip_init,
35 .init_time = msm_dt_timer_init, 33 .init_time = msm_dt_timer_init,
36 .init_machine = msm_dt_init, 34 .init_machine = msm_dt_init,
37 .dt_compat = msm8960_dt_match, 35 .dt_compat = msm8960_dt_match,
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 82eaf88d2026..803651ad4f62 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -59,6 +59,7 @@ static struct platform_device smc91x_device = {
59}; 59};
60 60
61static struct platform_device *devices[] __initdata = { 61static struct platform_device *devices[] __initdata = {
62 &msm_clock_7x01a,
62 &msm_device_gpio_7201, 63 &msm_device_gpio_7201,
63 &msm_device_uart3, 64 &msm_device_uart3,
64 &msm_device_smd, 65 &msm_device_smd,
@@ -91,7 +92,6 @@ static void __init halibut_fixup(struct tag *tags, char **cmdline,
91static void __init halibut_map_io(void) 92static void __init halibut_map_io(void)
92{ 93{
93 msm_map_common_io(); 94 msm_map_common_io();
94 msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
95} 95}
96 96
97static void __init halibut_init_late(void) 97static void __init halibut_init_late(void)
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index 520c141acd03..db3d8c0bc8a4 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -89,6 +89,7 @@ struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
89}; 89};
90 90
91static struct platform_device *devices[] __initdata = { 91static struct platform_device *devices[] __initdata = {
92 &msm_clock_7x30,
92 &msm_device_gpio_7x30, 93 &msm_device_gpio_7x30,
93#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER) 94#if defined(CONFIG_SERIAL_MSM) || defined(CONFIG_MSM_SERIAL_DEBUGGER)
94 &msm_device_uart2, 95 &msm_device_uart2,
@@ -116,7 +117,6 @@ static void __init msm7x30_init(void)
116static void __init msm7x30_map_io(void) 117static void __init msm7x30_map_io(void)
117{ 118{
118 msm_map_msm7x30_io(); 119 msm_map_msm7x30_io();
119 msm_clock_init(msm_clocks_7x30, msm_num_clocks_7x30);
120} 120}
121 121
122static void __init msm7x30_init_late(void) 122static void __init msm7x30_init_late(void)
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 38a532d6937c..f14a73d86bc0 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -89,6 +89,7 @@ static struct msm_otg_platform_data msm_otg_pdata = {
89}; 89};
90 90
91static struct platform_device *devices[] __initdata = { 91static struct platform_device *devices[] __initdata = {
92 &msm_clock_8x50,
92 &msm_device_gpio_8x50, 93 &msm_device_gpio_8x50,
93 &msm_device_uart3, 94 &msm_device_uart3,
94 &msm_device_smd, 95 &msm_device_smd,
@@ -172,7 +173,6 @@ static void __init qsd8x50_init_mmc(void)
172static void __init qsd8x50_map_io(void) 173static void __init qsd8x50_map_io(void)
173{ 174{
174 msm_map_qsd8x50_io(); 175 msm_map_qsd8x50_io();
175 msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50);
176} 176}
177 177
178static void __init qsd8x50_init_irq(void) 178static void __init qsd8x50_init_irq(void)
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index f9a5db6d2ced..77b0a26f897f 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -7,7 +7,6 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/leds.h> 9#include <linux/leds.h>
10#include <linux/clk.h>
11#include <linux/err.h> 10#include <linux/err.h>
12 11
13#include <asm/io.h> 12#include <asm/io.h>
@@ -19,6 +18,7 @@
19 18
20#include "board-trout.h" 19#include "board-trout.h"
21#include "proc_comm.h" 20#include "proc_comm.h"
21#include "clock-pcom.h"
22#include "devices.h" 22#include "devices.h"
23 23
24#define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255 24#define TROUT_DEFAULT_BACKLIGHT_BRIGHTNESS 255
@@ -170,7 +170,6 @@ static struct mddi_table mddi_toshiba_init_table[] = {
170#define INTMASK_VWAKEOUT (1U << 0) 170#define INTMASK_VWAKEOUT (1U << 0)
171 171
172 172
173static struct clk *gp_clk;
174static int trout_new_backlight = 1; 173static int trout_new_backlight = 1;
175static struct vreg *vreg_mddi_1v5; 174static struct vreg *vreg_mddi_1v5;
176static struct vreg *vreg_lcm_2v85; 175static struct vreg *vreg_lcm_2v85;
@@ -273,18 +272,14 @@ int __init trout_init_panel(void)
273 } else { 272 } else {
274 uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT, 273 uint32_t config = PCOM_GPIO_CFG(27, 1, GPIO_OUTPUT,
275 GPIO_NO_PULL, GPIO_8MA); 274 GPIO_NO_PULL, GPIO_8MA);
275 uint32_t id = P_GP_CLK;
276 uint32_t rate = 19200000;
277
276 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0); 278 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, 0);
277 279
278 gp_clk = clk_get(NULL, "gp_clk"); 280 msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
279 if (IS_ERR(gp_clk)) { 281 if (id < 0)
280 printk(KERN_ERR "trout_init_panel: could not get gp" 282 pr_err("trout_init_panel: set clock rate failed\n");
281 "clock\n");
282 gp_clk = NULL;
283 }
284 rc = clk_set_rate(gp_clk, 19200000);
285 if (rc)
286 printk(KERN_ERR "trout_init_panel: set clock rate "
287 "failed\n");
288 } 283 }
289 284
290 rc = platform_device_register(&msm_device_mdp); 285 rc = platform_device_register(&msm_device_mdp);
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 80fe1c5ff5c1..64a46eb4fc49 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -36,6 +36,7 @@
36extern int trout_init_mmc(unsigned int); 36extern int trout_init_mmc(unsigned int);
37 37
38static struct platform_device *devices[] __initdata = { 38static struct platform_device *devices[] __initdata = {
39 &msm_clock_7x01a,
39 &msm_device_gpio_7201, 40 &msm_device_gpio_7201,
40 &msm_device_uart3, 41 &msm_device_uart3,
41 &msm_device_smd, 42 &msm_device_smd,
@@ -94,8 +95,6 @@ static void __init trout_map_io(void)
94 /* route UART3 to the "H2W" extended usb connector */ 95 /* route UART3 to the "H2W" extended usb connector */
95 writeb(0x80, TROUT_CPLD_BASE + 0x00); 96 writeb(0x80, TROUT_CPLD_BASE + 0x00);
96#endif 97#endif
97
98 msm_clock_init(msm_clocks_7x01a, msm_num_clocks_7x01a);
99} 98}
100 99
101static void __init trout_init_late(void) 100static void __init trout_init_late(void)
diff --git a/arch/arm/mach-msm/clock-7x30.h b/arch/arm/mach-msm/clock-7x30.h
deleted file mode 100644
index 14104453688b..000000000000
--- a/arch/arm/mach-msm/clock-7x30.h
+++ /dev/null
@@ -1,155 +0,0 @@
1/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
14#define __ARCH_ARM_MACH_MSM_CLOCK_7X30_H
15
16enum {
17 L_7X30_NONE_CLK = -1,
18 L_7X30_ADM_CLK,
19 L_7X30_I2C_CLK,
20 L_7X30_I2C_2_CLK,
21 L_7X30_QUP_I2C_CLK,
22 L_7X30_UART1DM_CLK,
23 L_7X30_UART1DM_P_CLK,
24 L_7X30_UART2DM_CLK,
25 L_7X30_UART2DM_P_CLK,
26 L_7X30_EMDH_CLK,
27 L_7X30_EMDH_P_CLK,
28 L_7X30_PMDH_CLK,
29 L_7X30_PMDH_P_CLK,
30 L_7X30_GRP_2D_CLK,
31 L_7X30_GRP_2D_P_CLK,
32 L_7X30_GRP_3D_SRC_CLK,
33 L_7X30_GRP_3D_CLK,
34 L_7X30_GRP_3D_P_CLK,
35 L_7X30_IMEM_CLK,
36 L_7X30_SDC1_CLK,
37 L_7X30_SDC1_P_CLK,
38 L_7X30_SDC2_CLK,
39 L_7X30_SDC2_P_CLK,
40 L_7X30_SDC3_CLK,
41 L_7X30_SDC3_P_CLK,
42 L_7X30_SDC4_CLK,
43 L_7X30_SDC4_P_CLK,
44 L_7X30_MDP_CLK,
45 L_7X30_MDP_P_CLK,
46 L_7X30_MDP_LCDC_PCLK_CLK,
47 L_7X30_MDP_LCDC_PAD_PCLK_CLK,
48 L_7X30_MDP_VSYNC_CLK,
49 L_7X30_MI2S_CODEC_RX_M_CLK,
50 L_7X30_MI2S_CODEC_RX_S_CLK,
51 L_7X30_MI2S_CODEC_TX_M_CLK,
52 L_7X30_MI2S_CODEC_TX_S_CLK,
53 L_7X30_MI2S_M_CLK,
54 L_7X30_MI2S_S_CLK,
55 L_7X30_LPA_CODEC_CLK,
56 L_7X30_LPA_CORE_CLK,
57 L_7X30_LPA_P_CLK,
58 L_7X30_MIDI_CLK,
59 L_7X30_MDC_CLK,
60 L_7X30_ROTATOR_IMEM_CLK,
61 L_7X30_ROTATOR_P_CLK,
62 L_7X30_SDAC_M_CLK,
63 L_7X30_SDAC_CLK,
64 L_7X30_UART1_CLK,
65 L_7X30_UART2_CLK,
66 L_7X30_UART3_CLK,
67 L_7X30_TV_CLK,
68 L_7X30_TV_DAC_CLK,
69 L_7X30_TV_ENC_CLK,
70 L_7X30_HDMI_CLK,
71 L_7X30_TSIF_REF_CLK,
72 L_7X30_TSIF_P_CLK,
73 L_7X30_USB_HS_SRC_CLK,
74 L_7X30_USB_HS_CLK,
75 L_7X30_USB_HS_CORE_CLK,
76 L_7X30_USB_HS_P_CLK,
77 L_7X30_USB_HS2_CLK,
78 L_7X30_USB_HS2_CORE_CLK,
79 L_7X30_USB_HS2_P_CLK,
80 L_7X30_USB_HS3_CLK,
81 L_7X30_USB_HS3_CORE_CLK,
82 L_7X30_USB_HS3_P_CLK,
83 L_7X30_VFE_CLK,
84 L_7X30_VFE_P_CLK,
85 L_7X30_VFE_MDC_CLK,
86 L_7X30_VFE_CAMIF_CLK,
87 L_7X30_CAMIF_PAD_P_CLK,
88 L_7X30_CAM_M_CLK,
89 L_7X30_JPEG_CLK,
90 L_7X30_JPEG_P_CLK,
91 L_7X30_VPE_CLK,
92 L_7X30_MFC_CLK,
93 L_7X30_MFC_DIV2_CLK,
94 L_7X30_MFC_P_CLK,
95 L_7X30_SPI_CLK,
96 L_7X30_SPI_P_CLK,
97 L_7X30_CSI0_CLK,
98 L_7X30_CSI0_VFE_CLK,
99 L_7X30_CSI0_P_CLK,
100 L_7X30_CSI1_CLK,
101 L_7X30_CSI1_VFE_CLK,
102 L_7X30_CSI1_P_CLK,
103 L_7X30_GLBL_ROOT_CLK,
104
105 L_7X30_AXI_LI_VG_CLK,
106 L_7X30_AXI_LI_GRP_CLK,
107 L_7X30_AXI_LI_JPEG_CLK,
108 L_7X30_AXI_GRP_2D_CLK,
109 L_7X30_AXI_MFC_CLK,
110 L_7X30_AXI_VPE_CLK,
111 L_7X30_AXI_LI_VFE_CLK,
112 L_7X30_AXI_LI_APPS_CLK,
113 L_7X30_AXI_MDP_CLK,
114 L_7X30_AXI_IMEM_CLK,
115 L_7X30_AXI_LI_ADSP_A_CLK,
116 L_7X30_AXI_ROTATOR_CLK,
117
118 L_7X30_NR_CLKS
119};
120
121struct clk_ops;
122extern struct clk_ops clk_ops_7x30;
123
124struct clk_ops *clk_7x30_is_local(uint32_t id);
125int clk_7x30_init(void);
126
127void pll_enable(uint32_t pll);
128void pll_disable(uint32_t pll);
129
130extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable);
131
132#define CLK_7X30(clk_name, clk_id, clk_dev, clk_flags) { \
133 .con_id = clk_name, \
134 .dev_id = clk_dev, \
135 .clk = &(struct clk){ \
136 .id = L_7X30_##clk_id, \
137 .remote_id = P_##clk_id, \
138 .flags = clk_flags, \
139 .dbg_name = #clk_id, \
140 }, \
141 }
142
143#define CLK_7X30S(clk_name, l_id, r_id, clk_dev, clk_flags) { \
144 .con_id = clk_name, \
145 .dev_id = clk_dev, \
146 .clk = &(struct clk){ \
147 .id = L_7X30_##l_id, \
148 .remote_id = P_##r_id, \
149 .flags = clk_flags, \
150 .dbg_name = #l_id, \
151 .ops = &clk_ops_pcom, \
152 }, \
153 }
154
155#endif
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c
deleted file mode 100644
index 4886404d42f5..000000000000
--- a/arch/arm/mach-msm/clock-debug.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
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/module.h>
18#include <linux/ctype.h>
19#include <linux/debugfs.h>
20#include <linux/clk.h>
21#include "clock.h"
22
23static int clock_debug_rate_set(void *data, u64 val)
24{
25 struct clk *clock = data;
26 int ret;
27
28 /* Only increases to max rate will succeed, but that's actually good
29 * for debugging purposes so we don't check for error. */
30 if (clock->flags & CLK_MAX)
31 clk_set_max_rate(clock, val);
32 if (clock->flags & CLK_MIN)
33 ret = clk_set_min_rate(clock, val);
34 else
35 ret = clk_set_rate(clock, val);
36 if (ret != 0)
37 printk(KERN_ERR "clk_set%s_rate failed (%d)\n",
38 (clock->flags & CLK_MIN) ? "_min" : "", ret);
39 return ret;
40}
41
42static int clock_debug_rate_get(void *data, u64 *val)
43{
44 struct clk *clock = data;
45 *val = clk_get_rate(clock);
46 return 0;
47}
48
49DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_debug_rate_get,
50 clock_debug_rate_set, "%llu\n");
51
52static int clock_debug_enable_set(void *data, u64 val)
53{
54 struct clk *clock = data;
55 int rc = 0;
56
57 if (val)
58 rc = clock->ops->enable(clock->id);
59 else
60 clock->ops->disable(clock->id);
61
62 return rc;
63}
64
65static int clock_debug_enable_get(void *data, u64 *val)
66{
67 struct clk *clock = data;
68
69 *val = clock->ops->is_enabled(clock->id);
70
71 return 0;
72}
73
74DEFINE_SIMPLE_ATTRIBUTE(clock_enable_fops, clock_debug_enable_get,
75 clock_debug_enable_set, "%llu\n");
76
77static int clock_debug_local_get(void *data, u64 *val)
78{
79 struct clk *clock = data;
80
81 *val = clock->ops->is_local(clock->id);
82
83 return 0;
84}
85
86DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get,
87 NULL, "%llu\n");
88
89static struct dentry *debugfs_base;
90
91int __init clock_debug_init(void)
92{
93 debugfs_base = debugfs_create_dir("clk", NULL);
94 if (!debugfs_base)
95 return -ENOMEM;
96 return 0;
97}
98
99int __init clock_debug_add(struct clk *clock)
100{
101 char temp[50], *ptr;
102 struct dentry *clk_dir;
103
104 if (!debugfs_base)
105 return -ENOMEM;
106
107 strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1);
108 for (ptr = temp; *ptr; ptr++)
109 *ptr = tolower(*ptr);
110
111 clk_dir = debugfs_create_dir(temp, debugfs_base);
112 if (!clk_dir)
113 return -ENOMEM;
114
115 if (!debugfs_create_file("rate", S_IRUGO | S_IWUSR, clk_dir,
116 clock, &clock_rate_fops))
117 goto error;
118
119 if (!debugfs_create_file("enable", S_IRUGO | S_IWUSR, clk_dir,
120 clock, &clock_enable_fops))
121 goto error;
122
123 if (!debugfs_create_file("is_local", S_IRUGO, clk_dir, clock,
124 &clock_local_fops))
125 goto error;
126 return 0;
127error:
128 debugfs_remove_recursive(clk_dir);
129 return -ENOMEM;
130}
diff --git a/arch/arm/mach-msm/clock-pcom.c b/arch/arm/mach-msm/clock-pcom.c
index a52c970df157..9a80449518e6 100644
--- a/arch/arm/mach-msm/clock-pcom.c
+++ b/arch/arm/mach-msm/clock-pcom.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2007 Google, Inc. 2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. 3 * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
4 * 4 *
5 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -13,20 +13,33 @@
13 * 13 *
14 */ 14 */
15 15
16#include <linux/kernel.h>
16#include <linux/err.h> 17#include <linux/err.h>
17#include <linux/ctype.h> 18#include <linux/platform_device.h>
18#include <linux/stddef.h> 19#include <linux/module.h>
20#include <linux/clk-provider.h>
21#include <linux/clkdev.h>
22
19#include <mach/clk.h> 23#include <mach/clk.h>
20 24
21#include "proc_comm.h" 25#include "proc_comm.h"
22#include "clock.h" 26#include "clock.h"
23#include "clock-pcom.h" 27#include "clock-pcom.h"
24 28
25/* 29struct clk_pcom {
26 * glue for the proc_comm interface 30 unsigned id;
27 */ 31 unsigned long flags;
28static int pc_clk_enable(unsigned id) 32 struct msm_clk msm_clk;
33};
34
35static inline struct clk_pcom *to_clk_pcom(struct clk_hw *hw)
29{ 36{
37 return container_of(to_msm_clk(hw), struct clk_pcom, msm_clk);
38}
39
40static int pc_clk_enable(struct clk_hw *hw)
41{
42 unsigned id = to_clk_pcom(hw)->id;
30 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_ENABLE, &id, NULL); 43 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_ENABLE, &id, NULL);
31 if (rc < 0) 44 if (rc < 0)
32 return rc; 45 return rc;
@@ -34,14 +47,16 @@ static int pc_clk_enable(unsigned id)
34 return (int)id < 0 ? -EINVAL : 0; 47 return (int)id < 0 ? -EINVAL : 0;
35} 48}
36 49
37static void pc_clk_disable(unsigned id) 50static void pc_clk_disable(struct clk_hw *hw)
38{ 51{
52 unsigned id = to_clk_pcom(hw)->id;
39 msm_proc_comm(PCOM_CLKCTL_RPC_DISABLE, &id, NULL); 53 msm_proc_comm(PCOM_CLKCTL_RPC_DISABLE, &id, NULL);
40} 54}
41 55
42int pc_clk_reset(unsigned id, enum clk_reset_action action) 56static int pc_clk_reset(struct clk_hw *hw, enum clk_reset_action action)
43{ 57{
44 int rc; 58 int rc;
59 unsigned id = to_clk_pcom(hw)->id;
45 60
46 if (action == CLK_RESET_ASSERT) 61 if (action == CLK_RESET_ASSERT)
47 rc = msm_proc_comm(PCOM_CLKCTL_RPC_RESET_ASSERT, &id, NULL); 62 rc = msm_proc_comm(PCOM_CLKCTL_RPC_RESET_ASSERT, &id, NULL);
@@ -54,85 +69,109 @@ int pc_clk_reset(unsigned id, enum clk_reset_action action)
54 return (int)id < 0 ? -EINVAL : 0; 69 return (int)id < 0 ? -EINVAL : 0;
55} 70}
56 71
57static int pc_clk_set_rate(unsigned id, unsigned rate) 72static int pc_clk_set_rate(struct clk_hw *hw, unsigned long new_rate,
73 unsigned long p_rate)
58{ 74{
59 /* The rate _might_ be rounded off to the nearest KHz value by the 75 struct clk_pcom *p = to_clk_pcom(hw);
76 unsigned id = p->id, rate = new_rate;
77 int rc;
78
79 /*
80 * The rate _might_ be rounded off to the nearest KHz value by the
60 * remote function. So a return value of 0 doesn't necessarily mean 81 * remote function. So a return value of 0 doesn't necessarily mean
61 * that the exact rate was set successfully. 82 * that the exact rate was set successfully.
62 */ 83 */
63 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate); 84 if (p->flags & CLKFLAG_MIN)
64 if (rc < 0) 85 rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
65 return rc;
66 else
67 return (int)id < 0 ? -EINVAL : 0;
68}
69
70static int pc_clk_set_min_rate(unsigned id, unsigned rate)
71{
72 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MIN_RATE, &id, &rate);
73 if (rc < 0)
74 return rc;
75 else
76 return (int)id < 0 ? -EINVAL : 0;
77}
78
79static int pc_clk_set_max_rate(unsigned id, unsigned rate)
80{
81 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_MAX_RATE, &id, &rate);
82 if (rc < 0)
83 return rc;
84 else 86 else
85 return (int)id < 0 ? -EINVAL : 0; 87 rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_RATE, &id, &rate);
86}
87
88static int pc_clk_set_flags(unsigned id, unsigned flags)
89{
90 int rc = msm_proc_comm(PCOM_CLKCTL_RPC_SET_FLAGS, &id, &flags);
91 if (rc < 0) 88 if (rc < 0)
92 return rc; 89 return rc;
93 else 90 else
94 return (int)id < 0 ? -EINVAL : 0; 91 return (int)id < 0 ? -EINVAL : 0;
95} 92}
96 93
97static unsigned pc_clk_get_rate(unsigned id) 94static unsigned long pc_clk_recalc_rate(struct clk_hw *hw, unsigned long p_rate)
98{ 95{
96 unsigned id = to_clk_pcom(hw)->id;
99 if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, NULL)) 97 if (msm_proc_comm(PCOM_CLKCTL_RPC_RATE, &id, NULL))
100 return 0; 98 return 0;
101 else 99 else
102 return id; 100 return id;
103} 101}
104 102
105static unsigned pc_clk_is_enabled(unsigned id) 103static int pc_clk_is_enabled(struct clk_hw *hw)
106{ 104{
105 unsigned id = to_clk_pcom(hw)->id;
107 if (msm_proc_comm(PCOM_CLKCTL_RPC_ENABLED, &id, NULL)) 106 if (msm_proc_comm(PCOM_CLKCTL_RPC_ENABLED, &id, NULL))
108 return 0; 107 return 0;
109 else 108 else
110 return id; 109 return id;
111} 110}
112 111
113static long pc_clk_round_rate(unsigned id, unsigned rate) 112static long pc_clk_round_rate(struct clk_hw *hw, unsigned long rate,
113 unsigned long *p_rate)
114{ 114{
115
116 /* Not really supported; pc_clk_set_rate() does rounding on it's own. */ 115 /* Not really supported; pc_clk_set_rate() does rounding on it's own. */
117 return rate; 116 return rate;
118} 117}
119 118
120static bool pc_clk_is_local(unsigned id) 119static struct clk_ops clk_ops_pcom = {
121{
122 return false;
123}
124
125struct clk_ops clk_ops_pcom = {
126 .enable = pc_clk_enable, 120 .enable = pc_clk_enable,
127 .disable = pc_clk_disable, 121 .disable = pc_clk_disable,
128 .auto_off = pc_clk_disable,
129 .reset = pc_clk_reset,
130 .set_rate = pc_clk_set_rate, 122 .set_rate = pc_clk_set_rate,
131 .set_min_rate = pc_clk_set_min_rate, 123 .recalc_rate = pc_clk_recalc_rate,
132 .set_max_rate = pc_clk_set_max_rate,
133 .set_flags = pc_clk_set_flags,
134 .get_rate = pc_clk_get_rate,
135 .is_enabled = pc_clk_is_enabled, 124 .is_enabled = pc_clk_is_enabled,
136 .round_rate = pc_clk_round_rate, 125 .round_rate = pc_clk_round_rate,
137 .is_local = pc_clk_is_local,
138}; 126};
127
128static int msm_clock_pcom_probe(struct platform_device *pdev)
129{
130 const struct pcom_clk_pdata *pdata = pdev->dev.platform_data;
131 int i, ret;
132
133 for (i = 0; i < pdata->num_lookups; i++) {
134 const struct clk_pcom_desc *desc = &pdata->lookup[i];
135 struct clk *c;
136 struct clk_pcom *p;
137 struct clk_hw *hw;
138 struct clk_init_data init;
139
140 p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
141 if (!p)
142 return -ENOMEM;
143
144 p->id = desc->id;
145 p->flags = desc->flags;
146 p->msm_clk.reset = pc_clk_reset;
147
148 hw = &p->msm_clk.hw;
149 hw->init = &init;
150
151 init.name = desc->name;
152 init.ops = &clk_ops_pcom;
153 init.num_parents = 0;
154 init.flags = CLK_IS_ROOT;
155
156 if (!(p->flags & CLKFLAG_AUTO_OFF))
157 init.flags |= CLK_IGNORE_UNUSED;
158
159 c = devm_clk_register(&pdev->dev, hw);
160 ret = clk_register_clkdev(c, desc->con, desc->dev);
161 if (ret)
162 return ret;
163 }
164
165 return 0;
166}
167
168static struct platform_driver msm_clock_pcom_driver = {
169 .probe = msm_clock_pcom_probe,
170 .driver = {
171 .name = "msm-clock-pcom",
172 .owner = THIS_MODULE,
173 },
174};
175module_platform_driver(msm_clock_pcom_driver);
176
177MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-msm/clock-pcom.h b/arch/arm/mach-msm/clock-pcom.h
index 974d0032f3a3..5bb164fd46a8 100644
--- a/arch/arm/mach-msm/clock-pcom.h
+++ b/arch/arm/mach-msm/clock-pcom.h
@@ -1,4 +1,5 @@
1/* Copyright (c) 2009, Code Aurora Forum. All rights reserved. 1/*
2 * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
2 * 3 *
3 * 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
4 * it under the terms of the GNU General Public License version 2 and 5 * it under the terms of the GNU General Public License version 2 and
@@ -120,21 +121,25 @@
120 121
121#define P_NR_CLKS 102 122#define P_NR_CLKS 102
122 123
123struct clk_ops; 124struct clk_pcom_desc {
124extern struct clk_ops clk_ops_pcom; 125 unsigned id;
126 const char *name;
127 const char *con;
128 const char *dev;
129 unsigned long flags;
130};
125 131
126int pc_clk_reset(unsigned id, enum clk_reset_action action); 132struct pcom_clk_pdata {
133 struct clk_pcom_desc *lookup;
134 u32 num_lookups;
135};
127 136
128#define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \ 137#define CLK_PCOM(clk_name, clk_id, clk_dev, clk_flags) { \
129 .con_id = clk_name, \ 138 .id = P_##clk_id, \
130 .dev_id = clk_dev, \ 139 .name = #clk_id, \
131 .clk = &(struct clk){ \ 140 .con = clk_name, \
132 .id = P_##clk_id, \ 141 .dev = clk_dev, \
133 .remote_id = P_##clk_id, \ 142 .flags = clk_flags, \
134 .ops = &clk_ops_pcom, \
135 .flags = clk_flags, \
136 .dbg_name = #clk_id, \
137 }, \
138 } 143 }
139 144
140#endif 145#endif
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index d9145dfc2a3b..35ea02b52483 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -1,7 +1,7 @@
1/* arch/arm/mach-msm/clock.c 1/* arch/arm/mach-msm/clock.c
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -14,171 +14,15 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/clk-provider.h>
18#include <linux/list.h>
19#include <linux/err.h>
20#include <linux/spinlock.h>
21#include <linux/pm_qos.h>
22#include <linux/mutex.h>
23#include <linux/clk.h>
24#include <linux/string.h>
25#include <linux/module.h> 18#include <linux/module.h>
26#include <linux/clkdev.h>
27 19
28#include "clock.h" 20#include "clock.h"
29 21
30static DEFINE_MUTEX(clocks_mutex);
31static DEFINE_SPINLOCK(clocks_lock);
32static LIST_HEAD(clocks);
33
34/*
35 * Standard clock functions defined in include/linux/clk.h
36 */
37int clk_enable(struct clk *clk)
38{
39 unsigned long flags;
40 spin_lock_irqsave(&clocks_lock, flags);
41 clk->count++;
42 if (clk->count == 1)
43 clk->ops->enable(clk->id);
44 spin_unlock_irqrestore(&clocks_lock, flags);
45 return 0;
46}
47EXPORT_SYMBOL(clk_enable);
48
49void clk_disable(struct clk *clk)
50{
51 unsigned long flags;
52 spin_lock_irqsave(&clocks_lock, flags);
53 BUG_ON(clk->count == 0);
54 clk->count--;
55 if (clk->count == 0)
56 clk->ops->disable(clk->id);
57 spin_unlock_irqrestore(&clocks_lock, flags);
58}
59EXPORT_SYMBOL(clk_disable);
60
61int clk_reset(struct clk *clk, enum clk_reset_action action) 22int clk_reset(struct clk *clk, enum clk_reset_action action)
62{ 23{
63 return clk->ops->reset(clk->remote_id, action); 24 struct clk_hw *hw = __clk_get_hw(clk);
25 struct msm_clk *m = to_msm_clk(hw);
26 return m->reset(hw, action);
64} 27}
65EXPORT_SYMBOL(clk_reset); 28EXPORT_SYMBOL(clk_reset);
66
67unsigned long clk_get_rate(struct clk *clk)
68{
69 return clk->ops->get_rate(clk->id);
70}
71EXPORT_SYMBOL(clk_get_rate);
72
73int clk_set_rate(struct clk *clk, unsigned long rate)
74{
75 int ret;
76 if (clk->flags & CLKFLAG_MAX) {
77 ret = clk->ops->set_max_rate(clk->id, rate);
78 if (ret)
79 return ret;
80 }
81 if (clk->flags & CLKFLAG_MIN) {
82 ret = clk->ops->set_min_rate(clk->id, rate);
83 if (ret)
84 return ret;
85 }
86
87 if (clk->flags & CLKFLAG_MAX || clk->flags & CLKFLAG_MIN)
88 return ret;
89
90 return clk->ops->set_rate(clk->id, rate);
91}
92EXPORT_SYMBOL(clk_set_rate);
93
94long clk_round_rate(struct clk *clk, unsigned long rate)
95{
96 return clk->ops->round_rate(clk->id, rate);
97}
98EXPORT_SYMBOL(clk_round_rate);
99
100int clk_set_min_rate(struct clk *clk, unsigned long rate)
101{
102 return clk->ops->set_min_rate(clk->id, rate);
103}
104EXPORT_SYMBOL(clk_set_min_rate);
105
106int clk_set_max_rate(struct clk *clk, unsigned long rate)
107{
108 return clk->ops->set_max_rate(clk->id, rate);
109}
110EXPORT_SYMBOL(clk_set_max_rate);
111
112int clk_set_parent(struct clk *clk, struct clk *parent)
113{
114 return -ENOSYS;
115}
116EXPORT_SYMBOL(clk_set_parent);
117
118struct clk *clk_get_parent(struct clk *clk)
119{
120 return ERR_PTR(-ENOSYS);
121}
122EXPORT_SYMBOL(clk_get_parent);
123
124int clk_set_flags(struct clk *clk, unsigned long flags)
125{
126 if (clk == NULL || IS_ERR(clk))
127 return -EINVAL;
128 return clk->ops->set_flags(clk->id, flags);
129}
130EXPORT_SYMBOL(clk_set_flags);
131
132/* EBI1 is the only shared clock that several clients want to vote on as of
133 * this commit. If this changes in the future, then it might be better to
134 * make clk_min_rate handle the voting or make ebi1_clk_set_min_rate more
135 * generic to support different clocks.
136 */
137static struct clk *ebi1_clk;
138
139void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)
140{
141 unsigned n;
142
143 mutex_lock(&clocks_mutex);
144 for (n = 0; n < num_clocks; n++) {
145 clkdev_add(&clock_tbl[n]);
146 list_add_tail(&clock_tbl[n].clk->list, &clocks);
147 }
148 mutex_unlock(&clocks_mutex);
149
150 ebi1_clk = clk_get(NULL, "ebi1_clk");
151 BUG_ON(ebi1_clk == NULL);
152
153}
154
155/* The bootloader and/or AMSS may have left various clocks enabled.
156 * Disable any clocks that belong to us (CLKFLAG_AUTO_OFF) but have
157 * not been explicitly enabled by a clk_enable() call.
158 */
159static int __init clock_late_init(void)
160{
161 unsigned long flags;
162 struct clk *clk;
163 unsigned count = 0;
164
165 clock_debug_init();
166 mutex_lock(&clocks_mutex);
167 list_for_each_entry(clk, &clocks, list) {
168 clock_debug_add(clk);
169 if (clk->flags & CLKFLAG_AUTO_OFF) {
170 spin_lock_irqsave(&clocks_lock, flags);
171 if (!clk->count) {
172 count++;
173 clk->ops->auto_off(clk->id);
174 }
175 spin_unlock_irqrestore(&clocks_lock, flags);
176 }
177 }
178 mutex_unlock(&clocks_mutex);
179 pr_info("clock_late_init() disabled %d unused clocks\n", count);
180 return 0;
181}
182
183late_initcall(clock_late_init);
184
diff --git a/arch/arm/mach-msm/clock.h b/arch/arm/mach-msm/clock.h
index 2c007f606d29..42d29dd7aafc 100644
--- a/arch/arm/mach-msm/clock.h
+++ b/arch/arm/mach-msm/clock.h
@@ -1,7 +1,7 @@
1/* arch/arm/mach-msm/clock.h 1/* arch/arm/mach-msm/clock.h
2 * 2 *
3 * Copyright (C) 2007 Google, Inc. 3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. 4 * Copyright (c) 2007-2012, The Linux Foundation. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * License version 2, as published by the Free Software Foundation, and
@@ -17,56 +17,27 @@
17#ifndef __ARCH_ARM_MACH_MSM_CLOCK_H 17#ifndef __ARCH_ARM_MACH_MSM_CLOCK_H
18#define __ARCH_ARM_MACH_MSM_CLOCK_H 18#define __ARCH_ARM_MACH_MSM_CLOCK_H
19 19
20#include <linux/init.h> 20#include <linux/clk-provider.h>
21#include <linux/list.h>
22#include <mach/clk.h> 21#include <mach/clk.h>
23 22
24#define CLKFLAG_INVERT 0x00000001
25#define CLKFLAG_NOINVERT 0x00000002
26#define CLKFLAG_NONEST 0x00000004
27#define CLKFLAG_NORESET 0x00000008
28
29#define CLK_FIRST_AVAILABLE_FLAG 0x00000100 23#define CLK_FIRST_AVAILABLE_FLAG 0x00000100
30#define CLKFLAG_AUTO_OFF 0x00000200 24#define CLKFLAG_AUTO_OFF 0x00000200
31#define CLKFLAG_MIN 0x00000400 25#define CLKFLAG_MIN 0x00000400
32#define CLKFLAG_MAX 0x00000800 26#define CLKFLAG_MAX 0x00000800
33 27
34struct clk_ops {
35 int (*enable)(unsigned id);
36 void (*disable)(unsigned id);
37 void (*auto_off)(unsigned id);
38 int (*reset)(unsigned id, enum clk_reset_action action);
39 int (*set_rate)(unsigned id, unsigned rate);
40 int (*set_min_rate)(unsigned id, unsigned rate);
41 int (*set_max_rate)(unsigned id, unsigned rate);
42 int (*set_flags)(unsigned id, unsigned flags);
43 unsigned (*get_rate)(unsigned id);
44 unsigned (*is_enabled)(unsigned id);
45 long (*round_rate)(unsigned id, unsigned rate);
46 bool (*is_local)(unsigned id);
47};
48
49struct clk {
50 uint32_t id;
51 uint32_t remote_id;
52 uint32_t count;
53 uint32_t flags;
54 struct clk_ops *ops;
55 const char *dbg_name;
56 struct list_head list;
57};
58
59#define OFF CLKFLAG_AUTO_OFF 28#define OFF CLKFLAG_AUTO_OFF
60#define CLK_MIN CLKFLAG_MIN 29#define CLK_MIN CLKFLAG_MIN
61#define CLK_MAX CLKFLAG_MAX 30#define CLK_MAX CLKFLAG_MAX
62#define CLK_MINMAX (CLK_MIN | CLK_MAX) 31#define CLK_MINMAX (CLK_MIN | CLK_MAX)
63 32
64#ifdef CONFIG_DEBUG_FS 33struct msm_clk {
65int __init clock_debug_init(void); 34 int (*reset)(struct clk_hw *hw, enum clk_reset_action action);
66int __init clock_debug_add(struct clk *clock); 35 struct clk_hw hw;
67#else 36};
68static inline int __init clock_debug_init(void) { return 0; } 37
69static inline int __init clock_debug_add(struct clk *clock) { return 0; } 38static inline struct msm_clk *to_msm_clk(struct clk_hw *hw)
70#endif 39{
40 return container_of(hw, struct msm_clk, hw);
41}
71 42
72#endif 43#endif
diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
index ce8215a269e5..421cf7751a80 100644
--- a/arch/arm/mach-msm/common.h
+++ b/arch/arm/mach-msm/common.h
@@ -23,7 +23,7 @@ extern void msm_map_msm8x60_io(void);
23extern void msm_map_msm8960_io(void); 23extern void msm_map_msm8960_io(void);
24extern void msm_map_qsd8x50_io(void); 24extern void msm_map_qsd8x50_io(void);
25 25
26extern void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size, 26extern void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
27 unsigned int mtype, void *caller); 27 unsigned int mtype, void *caller);
28 28
29extern struct smp_operations msm_smp_ops; 29extern struct smp_operations msm_smp_ops;
diff --git a/arch/arm/mach-msm/core.h b/arch/arm/mach-msm/core.h
deleted file mode 100644
index a9bab53dddf4..000000000000
--- a/arch/arm/mach-msm/core.h
+++ /dev/null
@@ -1,2 +0,0 @@
1extern struct smp_operations msm_smp_ops;
2extern void msm_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index 1a0a2306b115..6d50fb964863 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -425,7 +425,7 @@ struct platform_device msm_device_mdp = {
425 .resource = resources_mdp, 425 .resource = resources_mdp,
426}; 426};
427 427
428struct clk_lookup msm_clocks_7x01a[] = { 428static struct clk_pcom_desc msm_clocks_7x01a[] = {
429 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 429 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
430 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 430 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
431 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0), 431 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, 0),
@@ -469,4 +469,12 @@ struct clk_lookup msm_clocks_7x01a[] = {
469 CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF), 469 CLK_PCOM("vfe_mdc_clk", VFE_MDC_CLK, NULL, OFF),
470}; 470};
471 471
472unsigned msm_num_clocks_7x01a = ARRAY_SIZE(msm_clocks_7x01a); 472static struct pcom_clk_pdata msm_clock_7x01a_pdata = {
473 .lookup = msm_clocks_7x01a,
474 .num_lookups = ARRAY_SIZE(msm_clocks_7x01a),
475};
476
477struct platform_device msm_clock_7x01a = {
478 .name = "msm-clock-pcom",
479 .dev.platform_data = &msm_clock_7x01a_pdata,
480};
diff --git a/arch/arm/mach-msm/devices-msm7x30.c b/arch/arm/mach-msm/devices-msm7x30.c
index 12f482c07740..d4db75acff56 100644
--- a/arch/arm/mach-msm/devices-msm7x30.c
+++ b/arch/arm/mach-msm/devices-msm7x30.c
@@ -28,8 +28,8 @@
28 28
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30 30
31#include "clock.h"
31#include "clock-pcom.h" 32#include "clock-pcom.h"
32#include "clock-7x30.h"
33 33
34#include <linux/platform_data/mmc-msm_sdcc.h> 34#include <linux/platform_data/mmc-msm_sdcc.h>
35 35
@@ -161,7 +161,7 @@ struct platform_device msm_device_hsusb_host = {
161 }, 161 },
162}; 162};
163 163
164struct clk_lookup msm_clocks_7x30[] = { 164static struct clk_pcom_desc msm_clocks_7x30[] = {
165 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 165 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
166 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0), 166 CLK_PCOM("adsp_clk", ADSP_CLK, NULL, 0),
167 CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0), 167 CLK_PCOM("cam_m_clk", CAM_M_CLK, NULL, 0),
@@ -177,7 +177,6 @@ struct clk_lookup msm_clocks_7x30[] = {
177 CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK, NULL, 0), 177 CLK_PCOM("grp_2d_pclk", GRP_2D_P_CLK, NULL, 0),
178 CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0), 178 CLK_PCOM("grp_clk", GRP_3D_CLK, NULL, 0),
179 CLK_PCOM("grp_pclk", GRP_3D_P_CLK, NULL, 0), 179 CLK_PCOM("grp_pclk", GRP_3D_P_CLK, NULL, 0),
180 CLK_7X30S("grp_src_clk", GRP_3D_SRC_CLK, GRP_3D_CLK, NULL, 0),
181 CLK_PCOM("hdmi_clk", HDMI_CLK, NULL, 0), 180 CLK_PCOM("hdmi_clk", HDMI_CLK, NULL, 0),
182 CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF), 181 CLK_PCOM("imem_clk", IMEM_CLK, NULL, OFF),
183 CLK_PCOM("jpeg_clk", JPEG_CLK, NULL, OFF), 182 CLK_PCOM("jpeg_clk", JPEG_CLK, NULL, OFF),
@@ -210,7 +209,6 @@ struct clk_lookup msm_clocks_7x30[] = {
210 CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF), 209 CLK_PCOM("sdac_clk", SDAC_CLK, NULL, OFF),
211 CLK_PCOM("spi_clk", SPI_CLK, NULL, 0), 210 CLK_PCOM("spi_clk", SPI_CLK, NULL, 0),
212 CLK_PCOM("spi_pclk", SPI_P_CLK, NULL, 0), 211 CLK_PCOM("spi_pclk", SPI_P_CLK, NULL, 0),
213 CLK_7X30S("tv_src_clk", TV_CLK, TV_ENC_CLK, NULL, 0),
214 CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0), 212 CLK_PCOM("tv_dac_clk", TV_DAC_CLK, NULL, 0),
215 CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0), 213 CLK_PCOM("tv_enc_clk", TV_ENC_CLK, NULL, 0),
216 CLK_PCOM("uart_clk", UART2_CLK, "msm_serial.1", 0), 214 CLK_PCOM("uart_clk", UART2_CLK, "msm_serial.1", 0),
@@ -237,5 +235,12 @@ struct clk_lookup msm_clocks_7x30[] = {
237 CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0), 235 CLK_PCOM("csi_vfe_clk", CSI0_VFE_CLK, NULL, 0),
238}; 236};
239 237
240unsigned msm_num_clocks_7x30 = ARRAY_SIZE(msm_clocks_7x30); 238static struct pcom_clk_pdata msm_clock_7x30_pdata = {
239 .lookup = msm_clocks_7x30,
240 .num_lookups = ARRAY_SIZE(msm_clocks_7x30),
241};
241 242
243struct platform_device msm_clock_7x30 = {
244 .name = "msm-clock-pcom",
245 .dev.platform_data = &msm_clock_7x30_pdata,
246};
diff --git a/arch/arm/mach-msm/devices-qsd8x50.c b/arch/arm/mach-msm/devices-qsd8x50.c
index 2e1b3ec9dfc7..f5518112284b 100644
--- a/arch/arm/mach-msm/devices-qsd8x50.c
+++ b/arch/arm/mach-msm/devices-qsd8x50.c
@@ -28,6 +28,7 @@
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29 29
30#include <linux/platform_data/mmc-msm_sdcc.h> 30#include <linux/platform_data/mmc-msm_sdcc.h>
31#include "clock.h"
31#include "clock-pcom.h" 32#include "clock-pcom.h"
32 33
33static struct resource msm_gpio_resources[] = { 34static struct resource msm_gpio_resources[] = {
@@ -322,7 +323,7 @@ int __init msm_add_sdcc(unsigned int controller,
322 return platform_device_register(pdev); 323 return platform_device_register(pdev);
323} 324}
324 325
325struct clk_lookup msm_clocks_8x50[] = { 326static struct clk_pcom_desc msm_clocks_8x50[] = {
326 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0), 327 CLK_PCOM("adm_clk", ADM_CLK, NULL, 0),
327 CLK_PCOM("ce_clk", CE_CLK, NULL, 0), 328 CLK_PCOM("ce_clk", CE_CLK, NULL, 0),
328 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN), 329 CLK_PCOM("ebi1_clk", EBI1_CLK, NULL, CLK_MIN),
@@ -376,5 +377,12 @@ struct clk_lookup msm_clocks_8x50[] = {
376 CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0), 377 CLK_PCOM("usb_phy_clk", USB_PHY_CLK, NULL, 0),
377}; 378};
378 379
379unsigned msm_num_clocks_8x50 = ARRAY_SIZE(msm_clocks_8x50); 380static struct pcom_clk_pdata msm_clock_8x50_pdata = {
381 .lookup = msm_clocks_8x50,
382 .num_lookups = ARRAY_SIZE(msm_clocks_8x50),
383};
380 384
385struct platform_device msm_clock_8x50 = {
386 .name = "msm-clock-pcom",
387 .dev.platform_data = &msm_clock_8x50_pdata,
388};
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index da902cf51161..dccefad9f9b9 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -16,10 +16,6 @@
16#ifndef __ARCH_ARM_MACH_MSM_DEVICES_H 16#ifndef __ARCH_ARM_MACH_MSM_DEVICES_H
17#define __ARCH_ARM_MACH_MSM_DEVICES_H 17#define __ARCH_ARM_MACH_MSM_DEVICES_H
18 18
19#include <linux/clkdev.h>
20
21#include "clock.h"
22
23extern struct platform_device msm_device_gpio_7201; 19extern struct platform_device msm_device_gpio_7201;
24extern struct platform_device msm_device_gpio_7x30; 20extern struct platform_device msm_device_gpio_7x30;
25extern struct platform_device msm_device_gpio_8x50; 21extern struct platform_device msm_device_gpio_8x50;
@@ -50,13 +46,8 @@ extern struct platform_device msm_device_mddi0;
50extern struct platform_device msm_device_mddi1; 46extern struct platform_device msm_device_mddi1;
51extern struct platform_device msm_device_mdp; 47extern struct platform_device msm_device_mdp;
52 48
53extern struct clk_lookup msm_clocks_7x01a[]; 49extern struct platform_device msm_clock_7x01a;
54extern unsigned msm_num_clocks_7x01a; 50extern struct platform_device msm_clock_7x30;
55 51extern struct platform_device msm_clock_8x50;
56extern struct clk_lookup msm_clocks_7x30[];
57extern unsigned msm_num_clocks_7x30;
58
59extern struct clk_lookup msm_clocks_8x50[];
60extern unsigned msm_num_clocks_8x50;
61 52
62#endif 53#endif
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
index b279fd8a31b1..f8f6adfa07c6 100644
--- a/arch/arm/mach-msm/dma.c
+++ b/arch/arm/mach-msm/dma.c
@@ -284,6 +284,7 @@ static int __init msm_init_datamover(void)
284 clk = clk_get(NULL, "adm_clk"); 284 clk = clk_get(NULL, "adm_clk");
285 if (IS_ERR(clk)) 285 if (IS_ERR(clk))
286 return PTR_ERR(clk); 286 return PTR_ERR(clk);
287 clk_prepare(clk);
287 msm_dmov_clk = clk; 288 msm_dmov_clk = clk;
288 ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL); 289 ret = request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
289 if (ret) 290 if (ret)
@@ -291,6 +292,4 @@ static int __init msm_init_datamover(void)
291 disable_irq(INT_ADM_AARM); 292 disable_irq(INT_ADM_AARM);
292 return 0; 293 return 0;
293} 294}
294 295module_init(msm_init_datamover);
295arch_initcall(msm_init_datamover);
296
diff --git a/arch/arm/mach-msm/gpiomux-v2.c b/arch/arm/mach-msm/gpiomux-v2.c
deleted file mode 100644
index 273396d2b127..000000000000
--- a/arch/arm/mach-msm/gpiomux-v2.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#include <linux/io.h>
18#include <mach/msm_iomap.h>
19#include "gpiomux.h"
20
21void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
22{
23 writel(val & ~GPIOMUX_CTL_MASK,
24 MSM_TLMM_BASE + 0x1000 + (0x10 * gpio));
25}
diff --git a/arch/arm/mach-msm/gpiomux-v2.h b/arch/arm/mach-msm/gpiomux-v2.h
deleted file mode 100644
index 3bf10e7f0381..000000000000
--- a/arch/arm/mach-msm/gpiomux-v2.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17#ifndef __ARCH_ARM_MACH_MSM_GPIOMUX_V2_H
18#define __ARCH_ARM_MACH_MSM_GPIOMUX_V2_H
19
20#define GPIOMUX_NGPIOS 173
21
22typedef u16 gpiomux_config_t;
23
24enum {
25 GPIOMUX_DRV_2MA = 0UL << 6,
26 GPIOMUX_DRV_4MA = 1UL << 6,
27 GPIOMUX_DRV_6MA = 2UL << 6,
28 GPIOMUX_DRV_8MA = 3UL << 6,
29 GPIOMUX_DRV_10MA = 4UL << 6,
30 GPIOMUX_DRV_12MA = 5UL << 6,
31 GPIOMUX_DRV_14MA = 6UL << 6,
32 GPIOMUX_DRV_16MA = 7UL << 6,
33};
34
35enum {
36 GPIOMUX_FUNC_GPIO = 0UL << 2,
37 GPIOMUX_FUNC_1 = 1UL << 2,
38 GPIOMUX_FUNC_2 = 2UL << 2,
39 GPIOMUX_FUNC_3 = 3UL << 2,
40 GPIOMUX_FUNC_4 = 4UL << 2,
41 GPIOMUX_FUNC_5 = 5UL << 2,
42 GPIOMUX_FUNC_6 = 6UL << 2,
43 GPIOMUX_FUNC_7 = 7UL << 2,
44 GPIOMUX_FUNC_8 = 8UL << 2,
45 GPIOMUX_FUNC_9 = 9UL << 2,
46 GPIOMUX_FUNC_A = 10UL << 2,
47 GPIOMUX_FUNC_B = 11UL << 2,
48 GPIOMUX_FUNC_C = 12UL << 2,
49 GPIOMUX_FUNC_D = 13UL << 2,
50 GPIOMUX_FUNC_E = 14UL << 2,
51 GPIOMUX_FUNC_F = 15UL << 2,
52};
53
54enum {
55 GPIOMUX_PULL_NONE = 0UL,
56 GPIOMUX_PULL_DOWN = 1UL,
57 GPIOMUX_PULL_KEEPER = 2UL,
58 GPIOMUX_PULL_UP = 3UL,
59};
60
61#endif
diff --git a/arch/arm/mach-msm/gpiomux.c b/arch/arm/mach-msm/gpiomux.c
index 53af21abd155..2b8e2d217082 100644
--- a/arch/arm/mach-msm/gpiomux.c
+++ b/arch/arm/mach-msm/gpiomux.c
@@ -17,9 +17,24 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include "gpiomux.h" 19#include "gpiomux.h"
20#include "proc_comm.h"
20 21
21static DEFINE_SPINLOCK(gpiomux_lock); 22static DEFINE_SPINLOCK(gpiomux_lock);
22 23
24static void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val)
25{
26 unsigned tlmm_config = (val & ~GPIOMUX_CTL_MASK) |
27 ((gpio & 0x3ff) << 4);
28 unsigned tlmm_disable = 0;
29 int rc;
30
31 rc = msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX,
32 &tlmm_config, &tlmm_disable);
33 if (rc)
34 pr_err("%s: unexpected proc_comm failure %d: %08x %08x\n",
35 __func__, rc, tlmm_config, tlmm_disable);
36}
37
23int msm_gpiomux_write(unsigned gpio, 38int msm_gpiomux_write(unsigned gpio,
24 gpiomux_config_t active, 39 gpiomux_config_t active,
25 gpiomux_config_t suspended) 40 gpiomux_config_t suspended)
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h
index 00459f6ee13c..8e82f41a8923 100644
--- a/arch/arm/mach-msm/gpiomux.h
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -20,12 +20,7 @@
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <mach/msm_gpiomux.h> 22#include <mach/msm_gpiomux.h>
23
24#if defined(CONFIG_MSM_V2_TLMM)
25#include "gpiomux-v2.h"
26#else
27#include "gpiomux-v1.h" 23#include "gpiomux-v1.h"
28#endif
29 24
30/** 25/**
31 * struct msm_gpiomux_config: gpiomux settings for one gpio line. 26 * struct msm_gpiomux_config: gpiomux settings for one gpio line.
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
index 8cebedb11233..c34e246a3e07 100644
--- a/arch/arm/mach-msm/include/mach/board.h
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -20,16 +20,11 @@
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/platform_data/mmc-msm_sdcc.h> 21#include <linux/platform_data/mmc-msm_sdcc.h>
22 22
23/* platform device data structures */
24
25struct clk_lookup;
26
27/* common init routines for use by arch/arm/mach-msm/board-*.c */ 23/* common init routines for use by arch/arm/mach-msm/board-*.c */
28 24
29void __init msm_add_devices(void); 25void __init msm_add_devices(void);
30void __init msm_init_irq(void); 26void __init msm_init_irq(void);
31void __init msm_init_gpio(void); 27void __init msm_init_gpio(void);
32void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks);
33int __init msm_add_sdcc(unsigned int controller, 28int __init msm_add_sdcc(unsigned int controller,
34 struct msm_mmc_platform_data *plat, 29 struct msm_mmc_platform_data *plat,
35 unsigned int stat_irq, unsigned long stat_irq_flags); 30 unsigned int stat_irq, unsigned long stat_irq_flags);
diff --git a/arch/arm/mach-msm/include/mach/clk.h b/arch/arm/mach-msm/include/mach/clk.h
index e8d38428d813..fd4f4a7a83b3 100644
--- a/arch/arm/mach-msm/include/mach/clk.h
+++ b/arch/arm/mach-msm/include/mach/clk.h
@@ -25,16 +25,7 @@ enum clk_reset_action {
25 25
26struct clk; 26struct clk;
27 27
28/* Rate is minimum clock rate in Hz */
29int clk_set_min_rate(struct clk *clk, unsigned long rate);
30
31/* Rate is maximum clock rate in Hz */
32int clk_set_max_rate(struct clk *clk, unsigned long rate);
33
34/* Assert/Deassert reset to a hardware block associated with a clock */ 28/* Assert/Deassert reset to a hardware block associated with a clock */
35int clk_reset(struct clk *clk, enum clk_reset_action action); 29int clk_reset(struct clk *clk, enum clk_reset_action action);
36 30
37/* Set clock-specific configuration parameters */
38int clk_set_flags(struct clk *clk, unsigned long flags);
39
40#endif 31#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
index 9819a556acae..7bca8d7108d6 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
@@ -32,13 +32,6 @@
32 * 32 *
33 */ 33 */
34 34
35
36#define MSM8960_QGIC_DIST_PHYS 0x02000000
37#define MSM8960_QGIC_DIST_SIZE SZ_4K
38
39#define MSM8960_QGIC_CPU_PHYS 0x02002000
40#define MSM8960_QGIC_CPU_SIZE SZ_4K
41
42#define MSM8960_TMR_PHYS 0x0200A000 35#define MSM8960_TMR_PHYS 0x0200A000
43#define MSM8960_TMR_SIZE SZ_4K 36#define MSM8960_TMR_SIZE SZ_4K
44 37
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
index 199372e62def..75a7b62c1c74 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
@@ -35,12 +35,6 @@
35 * 35 *
36 */ 36 */
37 37
38#define MSM8X60_QGIC_DIST_PHYS 0x02080000
39#define MSM8X60_QGIC_DIST_SIZE SZ_4K
40
41#define MSM8X60_QGIC_CPU_PHYS 0x02081000
42#define MSM8X60_QGIC_CPU_SIZE SZ_4K
43
44#define MSM_TLMM_BASE IOMEM(0xF0004000) 38#define MSM_TLMM_BASE IOMEM(0xF0004000)
45#define MSM_TLMM_PHYS 0x00800000 39#define MSM_TLMM_PHYS 0x00800000
46#define MSM_TLMM_SIZE SZ_16K 40#define MSM_TLMM_SIZE SZ_16K
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index 2ab7cf0919b3..c56e81ffdcde 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -62,8 +62,6 @@
62 62
63/* Virtual addresses shared across all MSM targets. */ 63/* Virtual addresses shared across all MSM targets. */
64#define MSM_CSR_BASE IOMEM(0xE0001000) 64#define MSM_CSR_BASE IOMEM(0xE0001000)
65#define MSM_QGIC_DIST_BASE IOMEM(0xF0000000)
66#define MSM_QGIC_CPU_BASE IOMEM(0xF0001000)
67#define MSM_TMR_BASE IOMEM(0xF0200000) 65#define MSM_TMR_BASE IOMEM(0xF0200000)
68#define MSM_TMR0_BASE IOMEM(0xF0201000) 66#define MSM_TMR0_BASE IOMEM(0xF0201000)
69#define MSM_GPIO1_BASE IOMEM(0xE0003000) 67#define MSM_GPIO1_BASE IOMEM(0xE0003000)
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index 123ef9cbce1b..3dc04ccaf59f 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -107,8 +107,6 @@ void __init msm_map_qsd8x50_io(void)
107 107
108#ifdef CONFIG_ARCH_MSM8X60 108#ifdef CONFIG_ARCH_MSM8X60
109static struct map_desc msm8x60_io_desc[] __initdata = { 109static struct map_desc msm8x60_io_desc[] __initdata = {
110 MSM_CHIP_DEVICE(QGIC_DIST, MSM8X60),
111 MSM_CHIP_DEVICE(QGIC_CPU, MSM8X60),
112 MSM_CHIP_DEVICE(TMR, MSM8X60), 110 MSM_CHIP_DEVICE(TMR, MSM8X60),
113 MSM_CHIP_DEVICE(TMR0, MSM8X60), 111 MSM_CHIP_DEVICE(TMR0, MSM8X60),
114#ifdef CONFIG_DEBUG_MSM8660_UART 112#ifdef CONFIG_DEBUG_MSM8660_UART
@@ -124,8 +122,6 @@ void __init msm_map_msm8x60_io(void)
124 122
125#ifdef CONFIG_ARCH_MSM8960 123#ifdef CONFIG_ARCH_MSM8960
126static struct map_desc msm8960_io_desc[] __initdata = { 124static struct map_desc msm8960_io_desc[] __initdata = {
127 MSM_CHIP_DEVICE(QGIC_DIST, MSM8960),
128 MSM_CHIP_DEVICE(QGIC_CPU, MSM8960),
129 MSM_CHIP_DEVICE(TMR, MSM8960), 125 MSM_CHIP_DEVICE(TMR, MSM8960),
130 MSM_CHIP_DEVICE(TMR0, MSM8960), 126 MSM_CHIP_DEVICE(TMR0, MSM8960),
131#ifdef CONFIG_DEBUG_MSM8960_UART 127#ifdef CONFIG_DEBUG_MSM8960_UART
@@ -172,7 +168,7 @@ void __init msm_map_msm7x30_io(void)
172} 168}
173#endif /* CONFIG_ARCH_MSM7X30 */ 169#endif /* CONFIG_ARCH_MSM7X30 */
174 170
175void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size, 171void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
176 unsigned int mtype, void *caller) 172 unsigned int mtype, void *caller)
177{ 173{
178 if (mtype == MT_DEVICE) { 174 if (mtype == MT_DEVICE) {
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 80a8bcacd9d5..9eb63d724602 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -10,12 +10,11 @@ config ARCH_MVEBU
10 select PLAT_ORION 10 select PLAT_ORION
11 select SPARSE_IRQ 11 select SPARSE_IRQ
12 select CLKDEV_LOOKUP 12 select CLKDEV_LOOKUP
13 select MVEBU_CLK_CORE
14 select MVEBU_CLK_CPU
15 select MVEBU_CLK_GATING
16 select MVEBU_MBUS 13 select MVEBU_MBUS
17 select ZONE_DMA if ARM_LPAE 14 select ZONE_DMA if ARM_LPAE
18 select ARCH_REQUIRE_GPIOLIB 15 select ARCH_REQUIRE_GPIOLIB
16 select MIGHT_HAVE_PCI
17 select PCI_QUIRKS if PCI
19 18
20if ARCH_MVEBU 19if ARCH_MVEBU
21 20
@@ -30,6 +29,7 @@ config MACH_ARMADA_370_XP
30 29
31config MACH_ARMADA_370 30config MACH_ARMADA_370
32 bool "Marvell Armada 370 boards" 31 bool "Marvell Armada 370 boards"
32 select ARMADA_370_CLK
33 select MACH_ARMADA_370_XP 33 select MACH_ARMADA_370_XP
34 select PINCTRL_ARMADA_370 34 select PINCTRL_ARMADA_370
35 help 35 help
@@ -38,6 +38,7 @@ config MACH_ARMADA_370
38 38
39config MACH_ARMADA_XP 39config MACH_ARMADA_XP
40 bool "Marvell Armada XP boards" 40 bool "Marvell Armada XP boards"
41 select ARMADA_XP_CLK
41 select MACH_ARMADA_370_XP 42 select MACH_ARMADA_370_XP
42 select PINCTRL_ARMADA_XP 43 select PINCTRL_ARMADA_XP
43 help 44 help
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 1c48890bb72b..97cbb8021919 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -14,13 +14,13 @@
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/clk-provider.h>
18#include <linux/of_address.h>
17#include <linux/of_platform.h> 19#include <linux/of_platform.h>
18#include <linux/io.h> 20#include <linux/io.h>
19#include <linux/time-armada-370-xp.h> 21#include <linux/time-armada-370-xp.h>
20#include <linux/clk/mvebu.h>
21#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
22#include <linux/mbus.h> 23#include <linux/mbus.h>
23#include <linux/irqchip.h>
24#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
@@ -29,45 +29,49 @@
29#include "common.h" 29#include "common.h"
30#include "coherency.h" 30#include "coherency.h"
31 31
32static struct map_desc armada_370_xp_io_desc[] __initdata = { 32static void __init armada_370_xp_map_io(void)
33 {
34 .virtual = (unsigned long) ARMADA_370_XP_REGS_VIRT_BASE,
35 .pfn = __phys_to_pfn(ARMADA_370_XP_REGS_PHYS_BASE),
36 .length = ARMADA_370_XP_REGS_SIZE,
37 .type = MT_DEVICE,
38 },
39};
40
41void __init armada_370_xp_map_io(void)
42{ 33{
43 iotable_init(armada_370_xp_io_desc, ARRAY_SIZE(armada_370_xp_io_desc)); 34 debug_ll_io_init();
44} 35}
45 36
46void __init armada_370_xp_timer_and_clk_init(void) 37/*
47{ 38 * This initialization will be replaced by a DT-based
48 mvebu_clocks_init(); 39 * initialization once the mvebu-mbus driver gains DT support.
49 armada_370_xp_timer_init(); 40 */
50}
51 41
52void __init armada_370_xp_init_early(void) 42#define ARMADA_370_XP_MBUS_WINS_OFFS 0x20000
43#define ARMADA_370_XP_MBUS_WINS_SIZE 0x100
44#define ARMADA_370_XP_SDRAM_WINS_OFFS 0x20180
45#define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20
46
47static void __init armada_370_xp_mbus_init(void)
53{ 48{
54 char *mbus_soc_name; 49 char *mbus_soc_name;
50 struct device_node *dn;
51 const __be32 mbus_wins_offs = cpu_to_be32(ARMADA_370_XP_MBUS_WINS_OFFS);
52 const __be32 sdram_wins_offs = cpu_to_be32(ARMADA_370_XP_SDRAM_WINS_OFFS);
55 53
56 /*
57 * This initialization will be replaced by a DT-based
58 * initialization once the mvebu-mbus driver gains DT support.
59 */
60 if (of_machine_is_compatible("marvell,armada370")) 54 if (of_machine_is_compatible("marvell,armada370"))
61 mbus_soc_name = "marvell,armada370-mbus"; 55 mbus_soc_name = "marvell,armada370-mbus";
62 else 56 else
63 mbus_soc_name = "marvell,armadaxp-mbus"; 57 mbus_soc_name = "marvell,armadaxp-mbus";
64 58
59 dn = of_find_node_by_name(NULL, "internal-regs");
60 BUG_ON(!dn);
61
65 mvebu_mbus_init(mbus_soc_name, 62 mvebu_mbus_init(mbus_soc_name,
66 ARMADA_370_XP_MBUS_WINS_BASE, 63 of_translate_address(dn, &mbus_wins_offs),
67 ARMADA_370_XP_MBUS_WINS_SIZE, 64 ARMADA_370_XP_MBUS_WINS_SIZE,
68 ARMADA_370_XP_SDRAM_WINS_BASE, 65 of_translate_address(dn, &sdram_wins_offs),
69 ARMADA_370_XP_SDRAM_WINS_SIZE); 66 ARMADA_370_XP_SDRAM_WINS_SIZE);
67}
70 68
69static void __init armada_370_xp_timer_and_clk_init(void)
70{
71 of_clk_init(NULL);
72 armada_370_xp_timer_init();
73 coherency_init();
74 armada_370_xp_mbus_init();
71#ifdef CONFIG_CACHE_L2X0 75#ifdef CONFIG_CACHE_L2X0
72 l2x0_of_init(0, ~0UL); 76 l2x0_of_init(0, ~0UL);
73#endif 77#endif
@@ -76,7 +80,6 @@ void __init armada_370_xp_init_early(void)
76static void __init armada_370_xp_dt_init(void) 80static void __init armada_370_xp_dt_init(void)
77{ 81{
78 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 82 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
79 coherency_init();
80} 83}
81 84
82static const char * const armada_370_xp_dt_compat[] = { 85static const char * const armada_370_xp_dt_compat[] = {
@@ -88,8 +91,6 @@ DT_MACHINE_START(ARMADA_XP_DT, "Marvell Armada 370/XP (Device Tree)")
88 .smp = smp_ops(armada_xp_smp_ops), 91 .smp = smp_ops(armada_xp_smp_ops),
89 .init_machine = armada_370_xp_dt_init, 92 .init_machine = armada_370_xp_dt_init,
90 .map_io = armada_370_xp_map_io, 93 .map_io = armada_370_xp_map_io,
91 .init_early = armada_370_xp_init_early,
92 .init_irq = irqchip_init,
93 .init_time = armada_370_xp_timer_and_clk_init, 94 .init_time = armada_370_xp_timer_and_clk_init,
94 .restart = mvebu_restart, 95 .restart = mvebu_restart,
95 .dt_compat = armada_370_xp_dt_compat, 96 .dt_compat = armada_370_xp_dt_compat,
diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index 2070e1b4f342..c612b2c4ed6c 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -15,16 +15,6 @@
15#ifndef __MACH_ARMADA_370_XP_H 15#ifndef __MACH_ARMADA_370_XP_H
16#define __MACH_ARMADA_370_XP_H 16#define __MACH_ARMADA_370_XP_H
17 17
18#define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000
19#define ARMADA_370_XP_REGS_VIRT_BASE IOMEM(0xfec00000)
20#define ARMADA_370_XP_REGS_SIZE SZ_1M
21
22/* These defines can go away once mvebu-mbus has a DT binding */
23#define ARMADA_370_XP_MBUS_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20000)
24#define ARMADA_370_XP_MBUS_WINS_SIZE 0x100
25#define ARMADA_370_XP_SDRAM_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20180)
26#define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20
27
28#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
29#include <linux/cpumask.h> 19#include <linux/cpumask.h>
30 20
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 8278960066c3..be117591f7f2 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -25,16 +25,11 @@
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <asm/smp_plat.h> 27#include <asm/smp_plat.h>
28#include <asm/cacheflush.h>
28#include "armada-370-xp.h" 29#include "armada-370-xp.h"
29 30
30/* 31unsigned long __cpuinitdata coherency_phys_base;
31 * Some functions in this file are called very early during SMP 32static void __iomem *coherency_base;
32 * initialization. At that time the device tree framework is not yet
33 * ready, and it is not possible to get the register address to
34 * ioremap it. That's why the pointer below is given with an initial
35 * value matching its virtual mapping
36 */
37static void __iomem *coherency_base = ARMADA_370_XP_REGS_VIRT_BASE + 0x20200;
38static void __iomem *coherency_cpu_base; 33static void __iomem *coherency_cpu_base;
39 34
40/* Coherency fabric registers */ 35/* Coherency fabric registers */
@@ -47,18 +42,6 @@ static struct of_device_id of_coherency_table[] = {
47 { /* end of list */ }, 42 { /* end of list */ },
48}; 43};
49 44
50#ifdef CONFIG_SMP
51int coherency_get_cpu_count(void)
52{
53 int reg, cnt;
54
55 reg = readl(coherency_base + COHERENCY_FABRIC_CFG_OFFSET);
56 cnt = (reg & 0xF) + 1;
57
58 return cnt;
59}
60#endif
61
62/* Function defined in coherency_ll.S */ 45/* Function defined in coherency_ll.S */
63int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id); 46int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id);
64 47
@@ -143,13 +126,31 @@ int __init coherency_init(void)
143 126
144 np = of_find_matching_node(NULL, of_coherency_table); 127 np = of_find_matching_node(NULL, of_coherency_table);
145 if (np) { 128 if (np) {
129 struct resource res;
146 pr_info("Initializing Coherency fabric\n"); 130 pr_info("Initializing Coherency fabric\n");
131 of_address_to_resource(np, 0, &res);
132 coherency_phys_base = res.start;
133 /*
134 * Ensure secondary CPUs will see the updated value,
135 * which they read before they join the coherency
136 * fabric, and therefore before they are coherent with
137 * the boot CPU cache.
138 */
139 sync_cache_w(&coherency_phys_base);
147 coherency_base = of_iomap(np, 0); 140 coherency_base = of_iomap(np, 0);
148 coherency_cpu_base = of_iomap(np, 1); 141 coherency_cpu_base = of_iomap(np, 1);
149 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); 142 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
150 bus_register_notifier(&platform_bus_type,
151 &mvebu_hwcc_platform_nb);
152 } 143 }
153 144
154 return 0; 145 return 0;
155} 146}
147
148static int __init coherency_late_init(void)
149{
150 if (of_find_matching_node(NULL, of_coherency_table))
151 bus_register_notifier(&platform_bus_type,
152 &mvebu_hwcc_platform_nb);
153 return 0;
154}
155
156postcore_initcall(coherency_late_init);
diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h
index 2f428137f6fe..df33ad8a6c08 100644
--- a/arch/arm/mach-mvebu/coherency.h
+++ b/arch/arm/mach-mvebu/coherency.h
@@ -14,10 +14,6 @@
14#ifndef __MACH_370_XP_COHERENCY_H 14#ifndef __MACH_370_XP_COHERENCY_H
15#define __MACH_370_XP_COHERENCY_H 15#define __MACH_370_XP_COHERENCY_H
16 16
17#ifdef CONFIG_SMP
18int coherency_get_cpu_count(void);
19#endif
20
21int set_cpu_coherent(int cpu_id, int smp_group_id); 17int set_cpu_coherent(int cpu_id, int smp_group_id);
22int coherency_init(void); 18int coherency_init(void);
23 19
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index aa27bc2ffb60..98defd5e92cd 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -15,6 +15,8 @@
15#ifndef __ARCH_MVEBU_COMMON_H 15#ifndef __ARCH_MVEBU_COMMON_H
16#define __ARCH_MVEBU_COMMON_H 16#define __ARCH_MVEBU_COMMON_H
17 17
18#define ARMADA_XP_MAX_CPUS 4
19
18void mvebu_restart(char mode, const char *cmd); 20void mvebu_restart(char mode, const char *cmd);
19 21
20void armada_370_xp_init_irq(void); 22void armada_370_xp_init_irq(void);
diff --git a/arch/arm/mach-mvebu/headsmp.S b/arch/arm/mach-mvebu/headsmp.S
index a06e0ede8c08..7147300c8af2 100644
--- a/arch/arm/mach-mvebu/headsmp.S
+++ b/arch/arm/mach-mvebu/headsmp.S
@@ -21,12 +21,6 @@
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24/*
25 * At this stage the secondary CPUs don't have acces yet to the MMU, so
26 * we have to provide physical addresses
27 */
28#define ARMADA_XP_CFB_BASE 0xD0020200
29
30 __CPUINIT 24 __CPUINIT
31 25
32/* 26/*
@@ -35,15 +29,21 @@
35 * startup 29 * startup
36 */ 30 */
37ENTRY(armada_xp_secondary_startup) 31ENTRY(armada_xp_secondary_startup)
32 /* Get coherency fabric base physical address */
33 adr r0, 1f
34 ldr r1, [r0]
35 ldr r0, [r0, r1]
38 36
39 /* Read CPU id */ 37 /* Read CPU id */
40 mrc p15, 0, r1, c0, c0, 5 38 mrc p15, 0, r1, c0, c0, 5
41 and r1, r1, #0xF 39 and r1, r1, #0xF
42 40
43 /* Add CPU to coherency fabric */ 41 /* Add CPU to coherency fabric */
44 ldr r0, =ARMADA_XP_CFB_BASE
45
46 bl ll_set_cpu_coherent 42 bl ll_set_cpu_coherent
47 b secondary_startup 43 b secondary_startup
48 44
49ENDPROC(armada_xp_secondary_startup) 45ENDPROC(armada_xp_secondary_startup)
46
47 .align 2
481:
49 .long coherency_phys_base - .
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 875ea748391c..93f2f3ab45f1 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -88,8 +88,16 @@ static int __cpuinit armada_xp_boot_secondary(unsigned int cpu,
88 88
89static void __init armada_xp_smp_init_cpus(void) 89static void __init armada_xp_smp_init_cpus(void)
90{ 90{
91 struct device_node *np;
91 unsigned int i, ncores; 92 unsigned int i, ncores;
92 ncores = coherency_get_cpu_count(); 93
94 np = of_find_node_by_name(NULL, "cpus");
95 if (!np)
96 panic("No 'cpus' node found\n");
97
98 ncores = of_get_child_count(np);
99 if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
100 panic("Invalid number of CPUs in DT\n");
93 101
94 /* Limit possible CPUs to defconfig */ 102 /* Limit possible CPUs to defconfig */
95 if (ncores > nr_cpu_ids) { 103 if (ncores > nr_cpu_ids) {
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 4dc2fbba0ecd..616fe0210da1 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -3,7 +3,6 @@ config SOC_IMX23
3 select ARM_AMBA 3 select ARM_AMBA
4 select ARM_CPU_SUSPEND if PM 4 select ARM_CPU_SUSPEND if PM
5 select CPU_ARM926T 5 select CPU_ARM926T
6 select HAVE_PWM
7 select PINCTRL_IMX23 6 select PINCTRL_IMX23
8 7
9config SOC_IMX28 8config SOC_IMX28
@@ -12,7 +11,6 @@ config SOC_IMX28
12 select ARM_CPU_SUSPEND if PM 11 select ARM_CPU_SUSPEND if PM
13 select CPU_ARM926T 12 select CPU_ARM926T
14 select HAVE_CAN_FLEXCAN if CAN 13 select HAVE_CAN_FLEXCAN if CAN
15 select HAVE_PWM
16 select PINCTRL_IMX28 14 select PINCTRL_IMX28
17 15
18config ARCH_MXS 16config ARCH_MXS
@@ -25,6 +23,7 @@ config ARCH_MXS
25 select GENERIC_CLOCKEVENTS 23 select GENERIC_CLOCKEVENTS
26 select HAVE_CLK_PREPARE 24 select HAVE_CLK_PREPARE
27 select PINCTRL 25 select PINCTRL
26 select SOC_BUS
28 select SOC_IMX23 27 select SOC_IMX23
29 select SOC_IMX28 28 select SOC_IMX28
30 select STMP_DEVICE 29 select STMP_DEVICE
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 5b62b6489d4b..7fa611c1b287 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -19,13 +19,13 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/irqchip.h>
23#include <linux/irqchip/mxs.h> 22#include <linux/irqchip/mxs.h>
24#include <linux/micrel_phy.h> 23#include <linux/micrel_phy.h>
25#include <linux/of_address.h> 24#include <linux/of_address.h>
26#include <linux/of_platform.h> 25#include <linux/of_platform.h>
27#include <linux/phy.h> 26#include <linux/phy.h>
28#include <linux/pinctrl/consumer.h> 27#include <linux/pinctrl/consumer.h>
28#include <linux/sys_soc.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/mach/time.h> 31#include <asm/mach/time.h>
@@ -39,12 +39,28 @@
39#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0 0x2 39#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0 0x2
40#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1 0x3 40#define MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR1 0x3
41 41
42#define HW_DIGCTL_CHIPID 0x310
43#define HW_DIGCTL_CHIPID_MASK (0xffff << 16)
44#define HW_DIGCTL_REV_MASK 0xff
45#define HW_DIGCTL_CHIPID_MX23 (0x3780 << 16)
46#define HW_DIGCTL_CHIPID_MX28 (0x2800 << 16)
47
48#define MXS_CHIP_REVISION_1_0 0x10
49#define MXS_CHIP_REVISION_1_1 0x11
50#define MXS_CHIP_REVISION_1_2 0x12
51#define MXS_CHIP_REVISION_1_3 0x13
52#define MXS_CHIP_REVISION_1_4 0x14
53#define MXS_CHIP_REV_UNKNOWN 0xff
54
42#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr)) 55#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
43 56
44#define MXS_SET_ADDR 0x4 57#define MXS_SET_ADDR 0x4
45#define MXS_CLR_ADDR 0x8 58#define MXS_CLR_ADDR 0x8
46#define MXS_TOG_ADDR 0xc 59#define MXS_TOG_ADDR 0xc
47 60
61static u32 chipid;
62static u32 socid;
63
48static inline void __mxs_setl(u32 mask, void __iomem *reg) 64static inline void __mxs_setl(u32 mask, void __iomem *reg)
49{ 65{
50 __raw_writel(mask, reg + MXS_SET_ADDR); 66 __raw_writel(mask, reg + MXS_SET_ADDR);
@@ -352,29 +368,123 @@ static void __init tx28_post_init(void)
352 pinctrl_put(pctl); 368 pinctrl_put(pctl);
353} 369}
354 370
355static void __init cfa10049_init(void) 371static void __init crystalfontz_init(void)
356{ 372{
357 update_fec_mac_prop(OUI_CRYSTALFONTZ); 373 update_fec_mac_prop(OUI_CRYSTALFONTZ);
358} 374}
359 375
360static void __init cfa10037_init(void) 376static const char __init *mxs_get_soc_id(void)
361{ 377{
362 update_fec_mac_prop(OUI_CRYSTALFONTZ); 378 struct device_node *np;
379 void __iomem *digctl_base;
380
381 np = of_find_compatible_node(NULL, NULL, "fsl,imx23-digctl");
382 digctl_base = of_iomap(np, 0);
383 WARN_ON(!digctl_base);
384
385 chipid = readl(digctl_base + HW_DIGCTL_CHIPID);
386 socid = chipid & HW_DIGCTL_CHIPID_MASK;
387
388 iounmap(digctl_base);
389 of_node_put(np);
390
391 switch (socid) {
392 case HW_DIGCTL_CHIPID_MX23:
393 return "i.MX23";
394 case HW_DIGCTL_CHIPID_MX28:
395 return "i.MX28";
396 default:
397 return "Unknown";
398 }
399}
400
401static u32 __init mxs_get_cpu_rev(void)
402{
403 u32 rev = chipid & HW_DIGCTL_REV_MASK;
404
405 switch (socid) {
406 case HW_DIGCTL_CHIPID_MX23:
407 switch (rev) {
408 case 0x0:
409 return MXS_CHIP_REVISION_1_0;
410 case 0x1:
411 return MXS_CHIP_REVISION_1_1;
412 case 0x2:
413 return MXS_CHIP_REVISION_1_2;
414 case 0x3:
415 return MXS_CHIP_REVISION_1_3;
416 case 0x4:
417 return MXS_CHIP_REVISION_1_4;
418 default:
419 return MXS_CHIP_REV_UNKNOWN;
420 }
421 case HW_DIGCTL_CHIPID_MX28:
422 switch (rev) {
423 case 0x0:
424 return MXS_CHIP_REVISION_1_1;
425 case 0x1:
426 return MXS_CHIP_REVISION_1_2;
427 default:
428 return MXS_CHIP_REV_UNKNOWN;
429 }
430 default:
431 return MXS_CHIP_REV_UNKNOWN;
432 }
433}
434
435static const char __init *mxs_get_revision(void)
436{
437 u32 rev = mxs_get_cpu_rev();
438
439 if (rev != MXS_CHIP_REV_UNKNOWN)
440 return kasprintf(GFP_KERNEL, "TO%d.%d", (rev >> 4) & 0xf,
441 rev & 0xf);
442 else
443 return kasprintf(GFP_KERNEL, "%s", "Unknown");
363} 444}
364 445
365static void __init mxs_machine_init(void) 446static void __init mxs_machine_init(void)
366{ 447{
448 struct device_node *root;
449 struct device *parent;
450 struct soc_device *soc_dev;
451 struct soc_device_attribute *soc_dev_attr;
452 int ret;
453
454 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
455 if (!soc_dev_attr)
456 return;
457
458 root = of_find_node_by_path("/");
459 ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
460 if (ret)
461 return;
462
463 soc_dev_attr->family = "Freescale MXS Family";
464 soc_dev_attr->soc_id = mxs_get_soc_id();
465 soc_dev_attr->revision = mxs_get_revision();
466
467 soc_dev = soc_device_register(soc_dev_attr);
468 if (IS_ERR(soc_dev)) {
469 kfree(soc_dev_attr->revision);
470 kfree(soc_dev_attr);
471 return;
472 }
473
474 parent = soc_device_to_device(soc_dev);
475
367 if (of_machine_is_compatible("fsl,imx28-evk")) 476 if (of_machine_is_compatible("fsl,imx28-evk"))
368 imx28_evk_init(); 477 imx28_evk_init();
369 else if (of_machine_is_compatible("bluegiga,apx4devkit")) 478 else if (of_machine_is_compatible("bluegiga,apx4devkit"))
370 apx4devkit_init(); 479 apx4devkit_init();
371 else if (of_machine_is_compatible("crystalfontz,cfa10037")) 480 else if (of_machine_is_compatible("crystalfontz,cfa10037") ||
372 cfa10037_init(); 481 of_machine_is_compatible("crystalfontz,cfa10049") ||
373 else if (of_machine_is_compatible("crystalfontz,cfa10049")) 482 of_machine_is_compatible("crystalfontz,cfa10055") ||
374 cfa10049_init(); 483 of_machine_is_compatible("crystalfontz,cfa10057"))
484 crystalfontz_init();
375 485
376 of_platform_populate(NULL, of_default_bus_match_table, 486 of_platform_populate(NULL, of_default_bus_match_table,
377 mxs_auxdata_lookup, NULL); 487 mxs_auxdata_lookup, parent);
378 488
379 if (of_machine_is_compatible("karo,tx28")) 489 if (of_machine_is_compatible("karo,tx28"))
380 tx28_post_init(); 490 tx28_post_init();
@@ -434,8 +544,6 @@ static const char *mxs_dt_compat[] __initdata = {
434}; 544};
435 545
436DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)") 546DT_MACHINE_START(MXS, "Freescale MXS (Device Tree)")
437 .map_io = debug_ll_io_init,
438 .init_irq = irqchip_init,
439 .handle_irq = icoll_handle_irq, 547 .handle_irq = icoll_handle_irq,
440 .init_time = mxs_timer_init, 548 .init_time = mxs_timer_init,
441 .init_machine = mxs_machine_init, 549 .init_machine = mxs_machine_init,
diff --git a/arch/arm/mach-mxs/pm.h b/arch/arm/mach-mxs/pm.h
index f57e7cdece2e..09d77b00a96b 100644
--- a/arch/arm/mach-mxs/pm.h
+++ b/arch/arm/mach-mxs/pm.h
@@ -9,6 +9,10 @@
9#ifndef __ARCH_MXS_PM_H 9#ifndef __ARCH_MXS_PM_H
10#define __ARCH_MXS_PM_H 10#define __ARCH_MXS_PM_H
11 11
12#ifdef CONFIG_PM
12void mxs_pm_init(void); 13void mxs_pm_init(void);
14#else
15#define mxs_pm_init NULL
16#endif
13 17
14#endif 18#endif
diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig
index 9b9d105f194c..5981c3db9b41 100644
--- a/arch/arm/mach-nomadik/Kconfig
+++ b/arch/arm/mach-nomadik/Kconfig
@@ -6,6 +6,7 @@ config ARCH_NOMADIK
6 select ARM_VIC 6 select ARM_VIC
7 select CLKSRC_NOMADIK_MTU 7 select CLKSRC_NOMADIK_MTU
8 select CLKSRC_NOMADIK_MTU_SCHED_CLOCK 8 select CLKSRC_NOMADIK_MTU_SCHED_CLOCK
9 select CLKSRC_OF
9 select COMMON_CLK 10 select COMMON_CLK
10 select CPU_ARM926T 11 select CPU_ARM926T
11 select GENERIC_CLOCKEVENTS 12 select GENERIC_CLOCKEVENTS
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 59f6ff5c9bae..2df209ed1a07 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -25,11 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/irqchip.h>
29#include <linux/platform_data/clk-nomadik.h> 28#include <linux/platform_data/clk-nomadik.h>
30#include <linux/platform_data/pinctrl-nomadik.h> 29#include <linux/clocksource.h>
31#include <linux/pinctrl/machine.h>
32#include <linux/platform_data/clocksource-nomadik-mtu.h>
33#include <linux/of_irq.h> 30#include <linux/of_irq.h>
34#include <linux/of_gpio.h> 31#include <linux/of_gpio.h>
35#include <linux/of_address.h> 32#include <linux/of_address.h>
@@ -91,48 +88,6 @@
91#define NOMADIK_L2CC_BASE 0x10210000 /* L2 Cache controller */ 88#define NOMADIK_L2CC_BASE 0x10210000 /* L2 Cache controller */
92#define NOMADIK_UART1_VBASE 0xF01FB000 89#define NOMADIK_UART1_VBASE 0xF01FB000
93 90
94static unsigned long out_low[] = { PIN_OUTPUT_LOW };
95static unsigned long out_high[] = { PIN_OUTPUT_HIGH };
96static unsigned long in_nopull[] = { PIN_INPUT_NOPULL };
97static unsigned long in_pullup[] = { PIN_INPUT_PULLUP };
98
99static struct pinctrl_map __initdata nhk8815_pinmap[] = {
100 PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-stn8815", "u0_a_1", "u0"),
101 PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl-stn8815", "u1_a_1", "u1"),
102 /* Hog in MMC/SD card mux */
103 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-stn8815", "mmcsd_a_1", "mmcsd"),
104 /* MCCLK */
105 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO8_B10", out_low),
106 /* MCCMD */
107 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO9_A10", in_pullup),
108 /* MCCMDDIR */
109 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO10_C11", out_high),
110 /* MCDAT3-0 */
111 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO11_B11", in_pullup),
112 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO12_A11", in_pullup),
113 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO13_C12", in_pullup),
114 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO14_B12", in_pullup),
115 /* MCDAT0DIR */
116 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO15_A12", out_high),
117 /* MCDAT31DIR */
118 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO16_C13", out_high),
119 /* MCMSFBCLK */
120 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO24_C15", in_pullup),
121 /* CD input GPIO */
122 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO111_H21", in_nopull),
123 /* CD bias drive */
124 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO112_J21", out_low),
125 /* I2C0 */
126 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO62_D3", in_pullup),
127 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO63_D2", in_pullup),
128 /* I2C1 */
129 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO53_L4", in_pullup),
130 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO54_L3", in_pullup),
131 /* I2C2 */
132 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO73_C21", in_pullup),
133 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-stn8815", "GPIO74_C20", in_pullup),
134};
135
136/* This is needed for LL-debug/earlyprintk/debug-macro.S */ 91/* This is needed for LL-debug/earlyprintk/debug-macro.S */
137static struct map_desc cpu8815_io_desc[] __initdata = { 92static struct map_desc cpu8815_io_desc[] __initdata = {
138 { 93 {
@@ -172,7 +127,7 @@ static void __init cpu8815_timer_init_of(void)
172 /* We need this to be up now */ 127 /* We need this to be up now */
173 nomadik_clk_init(); 128 nomadik_clk_init();
174 129
175 mtu = of_find_node_by_path("/mtu0"); 130 mtu = of_find_node_by_path("/mtu@101e2000");
176 if (!mtu) 131 if (!mtu)
177 return; 132 return;
178 base = of_iomap(mtu, 0); 133 base = of_iomap(mtu, 0);
@@ -188,7 +143,7 @@ static void __init cpu8815_timer_init_of(void)
188 src_cr |= SRC_CR_INIT_VAL; 143 src_cr |= SRC_CR_INIT_VAL;
189 writel(src_cr, base); 144 writel(src_cr, base);
190 145
191 nmdk_timer_init(base, irq); 146 clocksource_of_init();
192} 147}
193 148
194static struct fsmc_nand_timings cpu8815_nand_timings = { 149static struct fsmc_nand_timings cpu8815_nand_timings = {
@@ -280,28 +235,10 @@ device_initcall(cpu8815_mmcsd_init);
280 235
281/* These are mostly to get the right device names for the clock lookups */ 236/* These are mostly to get the right device names for the clock lookups */
282static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { 237static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = {
283 OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE,
284 "gpio.0", NULL),
285 OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO1_BASE,
286 "gpio.1", NULL),
287 OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO2_BASE,
288 "gpio.2", NULL),
289 OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO3_BASE,
290 "gpio.3", NULL),
291 OF_DEV_AUXDATA("stericsson,nmk-pinctrl-stn8815", 0,
292 "pinctrl-stn8815", NULL),
293 OF_DEV_AUXDATA("arm,primecell", NOMADIK_UART0_BASE,
294 "uart0", NULL),
295 OF_DEV_AUXDATA("arm,primecell", NOMADIK_UART1_BASE,
296 "uart1", NULL),
297 OF_DEV_AUXDATA("arm,primecell", NOMADIK_RNG_BASE,
298 "rng", NULL),
299 OF_DEV_AUXDATA("arm,primecell", NOMADIK_RTC_BASE,
300 "rtc-pl031", NULL),
301 OF_DEV_AUXDATA("stericsson,fsmc-nand", NOMADIK_FSMC_BASE, 238 OF_DEV_AUXDATA("stericsson,fsmc-nand", NOMADIK_FSMC_BASE,
302 "fsmc-nand", &cpu8815_nand_data), 239 NULL, &cpu8815_nand_data),
303 OF_DEV_AUXDATA("arm,primecell", NOMADIK_SDI_BASE, 240 OF_DEV_AUXDATA("arm,primecell", NOMADIK_SDI_BASE,
304 "mmci", &mmcsd_plat_data), 241 NULL, &mmcsd_plat_data),
305 { /* sentinel */ }, 242 { /* sentinel */ },
306}; 243};
307 244
@@ -311,7 +248,6 @@ static void __init cpu8815_init_of(void)
311 /* At full speed latency must be >=2, so 0x249 in low bits */ 248 /* At full speed latency must be >=2, so 0x249 in low bits */
312 l2x0_of_init(0x00730249, 0xfe000fff); 249 l2x0_of_init(0x00730249, 0xfe000fff);
313#endif 250#endif
314 pinctrl_register_mappings(nhk8815_pinmap, ARRAY_SIZE(nhk8815_pinmap));
315 of_platform_populate(NULL, of_default_bus_match_table, 251 of_platform_populate(NULL, of_default_bus_match_table,
316 cpu8815_auxdata_lookup, NULL); 252 cpu8815_auxdata_lookup, NULL);
317} 253}
@@ -323,7 +259,6 @@ static const char * cpu8815_board_compat[] = {
323 259
324DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") 260DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815")
325 .map_io = cpu8815_map_io, 261 .map_io = cpu8815_map_io,
326 .init_irq = irqchip_init,
327 .init_time = cpu8815_timer_init_of, 262 .init_time = cpu8815_timer_init_of,
328 .init_machine = cpu8815_init_of, 263 .init_machine = cpu8815_init_of,
329 .restart = cpu8815_restart, 264 .restart = cpu8815_restart,
diff --git a/arch/arm/mach-nspire/Kconfig b/arch/arm/mach-nspire/Kconfig
new file mode 100644
index 000000000000..59d8f0a70919
--- /dev/null
+++ b/arch/arm/mach-nspire/Kconfig
@@ -0,0 +1,16 @@
1config ARCH_NSPIRE
2 bool "TI-NSPIRE based"
3 depends on ARCH_MULTI_V4_V5
4 depends on MMU
5 select CPU_ARM926T
6 select COMMON_CLK
7 select GENERIC_CLOCKEVENTS
8 select GENERIC_IRQ_CHIP
9 select SPARSE_IRQ
10 select ARM_AMBA
11 select ARM_VIC
12 select ARM_TIMER_SP804
13 select USE_OF
14 select CLKSRC_OF
15 help
16 This enables support for systems using the TI-NSPIRE CPU
diff --git a/arch/arm/mach-nspire/Makefile b/arch/arm/mach-nspire/Makefile
new file mode 100644
index 000000000000..1bec256eba07
--- /dev/null
+++ b/arch/arm/mach-nspire/Makefile
@@ -0,0 +1,2 @@
1obj-y += nspire.o
2obj-y += clcd.o
diff --git a/arch/arm/mach-nspire/Makefile.boot b/arch/arm/mach-nspire/Makefile.boot
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/arch/arm/mach-nspire/Makefile.boot
diff --git a/arch/arm/mach-nspire/clcd.c b/arch/arm/mach-nspire/clcd.c
new file mode 100644
index 000000000000..abea12617b17
--- /dev/null
+++ b/arch/arm/mach-nspire/clcd.c
@@ -0,0 +1,119 @@
1/*
2 * linux/arch/arm/mach-nspire/clcd.c
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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/init.h>
13#include <linux/of.h>
14#include <linux/amba/bus.h>
15#include <linux/amba/clcd.h>
16#include <linux/dma-mapping.h>
17
18static struct clcd_panel nspire_cx_lcd_panel = {
19 .mode = {
20 .name = "Color LCD",
21 .refresh = 60,
22 .xres = 320,
23 .yres = 240,
24 .sync = 0,
25 .vmode = FB_VMODE_NONINTERLACED,
26 .pixclock = 1,
27 .hsync_len = 6,
28 .vsync_len = 1,
29 .right_margin = 50,
30 .left_margin = 38,
31 .lower_margin = 3,
32 .upper_margin = 17,
33 },
34 .width = 65, /* ~6.50 cm */
35 .height = 49, /* ~4.87 cm */
36 .tim2 = TIM2_IPC,
37 .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1),
38 .bpp = 16,
39 .caps = CLCD_CAP_565,
40};
41
42static struct clcd_panel nspire_classic_lcd_panel = {
43 .mode = {
44 .name = "Grayscale LCD",
45 .refresh = 60,
46 .xres = 320,
47 .yres = 240,
48 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
49 .vmode = FB_VMODE_NONINTERLACED,
50 .pixclock = 1,
51 .hsync_len = 6,
52 .vsync_len = 1,
53 .right_margin = 6,
54 .left_margin = 6,
55 },
56 .width = 71, /* 7.11cm */
57 .height = 53, /* 5.33cm */
58 .tim2 = 0x80007d0,
59 .cntl = CNTL_LCDMONO8,
60 .bpp = 8,
61 .grayscale = 1,
62 .caps = CLCD_CAP_5551,
63};
64
65int nspire_clcd_setup(struct clcd_fb *fb)
66{
67 struct clcd_panel *panel;
68 size_t panel_size;
69 const char *type;
70 dma_addr_t dma;
71 int err;
72
73 BUG_ON(!fb->dev->dev.of_node);
74
75 err = of_property_read_string(fb->dev->dev.of_node, "lcd-type", &type);
76 if (err) {
77 pr_err("CLCD: Could not find lcd-type property\n");
78 return err;
79 }
80
81 if (!strcmp(type, "cx")) {
82 panel = &nspire_cx_lcd_panel;
83 } else if (!strcmp(type, "classic")) {
84 panel = &nspire_classic_lcd_panel;
85 } else {
86 pr_err("CLCD: Unknown lcd-type %s\n", type);
87 return -EINVAL;
88 }
89
90 panel_size = ((panel->mode.xres * panel->mode.yres) * panel->bpp) / 8;
91 panel_size = ALIGN(panel_size, PAGE_SIZE);
92
93 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
94 panel_size, &dma, GFP_KERNEL);
95
96 if (!fb->fb.screen_base) {
97 pr_err("CLCD: unable to map framebuffer\n");
98 return -ENOMEM;
99 }
100
101 fb->fb.fix.smem_start = dma;
102 fb->fb.fix.smem_len = panel_size;
103 fb->panel = panel;
104
105 return 0;
106}
107
108int nspire_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
109{
110 return dma_mmap_writecombine(&fb->dev->dev, vma,
111 fb->fb.screen_base, fb->fb.fix.smem_start,
112 fb->fb.fix.smem_len);
113}
114
115void nspire_clcd_remove(struct clcd_fb *fb)
116{
117 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
118 fb->fb.screen_base, fb->fb.fix.smem_start);
119}
diff --git a/arch/arm/mach-nspire/clcd.h b/arch/arm/mach-nspire/clcd.h
new file mode 100644
index 000000000000..8c33d2c18371
--- /dev/null
+++ b/arch/arm/mach-nspire/clcd.h
@@ -0,0 +1,14 @@
1/*
2 * linux/arch/arm/mach-nspire/clcd.h
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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
12int nspire_clcd_setup(struct clcd_fb *fb);
13int nspire_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma);
14void nspire_clcd_remove(struct clcd_fb *fb);
diff --git a/arch/arm/mach-nspire/mmio.h b/arch/arm/mach-nspire/mmio.h
new file mode 100644
index 000000000000..8813471af4cf
--- /dev/null
+++ b/arch/arm/mach-nspire/mmio.h
@@ -0,0 +1,20 @@
1/*
2 * linux/arch/arm/mach-nspire/mmio.h
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
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#define NSPIRE_MISC_PHYS_BASE 0x900A0000
13#define NSPIRE_MISC_HWRESET 0x08
14
15#define NSPIRE_PWR_PHYS_BASE 0x900B0000
16#define NSPIRE_PWR_VIRT_BASE 0xFEEB0000
17#define NSPIRE_PWR_BUS_DISABLE1 0x18
18#define NSPIRE_PWR_BUS_DISABLE2 0x20
19
20#define NSPIRE_LCD_PHYS_BASE 0xC0000000
diff --git a/arch/arm/mach-nspire/nspire.c b/arch/arm/mach-nspire/nspire.c
new file mode 100644
index 000000000000..99e26092a9f7
--- /dev/null
+++ b/arch/arm/mach-nspire/nspire.c
@@ -0,0 +1,89 @@
1/*
2 * linux/arch/arm/mach-nspire/nspire.c
3 *
4 * Copyright (C) 2013 Daniel Tang <tangrs@tangrs.id.au>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 */
11#include <linux/init.h>
12#include <linux/of_irq.h>
13#include <linux/of_address.h>
14#include <linux/of_platform.h>
15#include <linux/irqchip.h>
16#include <linux/irqchip/arm-vic.h>
17#include <linux/clk-provider.h>
18#include <linux/clkdev.h>
19#include <linux/amba/bus.h>
20#include <linux/amba/clcd.h>
21#include <linux/clocksource.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach-types.h>
25#include <asm/mach/map.h>
26
27#include <asm/hardware/timer-sp.h>
28
29#include "mmio.h"
30#include "clcd.h"
31
32static const char *nspire_dt_match[] __initconst = {
33 "ti,nspire",
34 "ti,nspire-cx",
35 "ti,nspire-tp",
36 "ti,nspire-clp",
37 NULL,
38};
39
40static void __init nspire_map_io(void)
41{
42 debug_ll_io_init();
43}
44
45static struct clcd_board nspire_clcd_data = {
46 .name = "LCD",
47 .caps = CLCD_CAP_5551 | CLCD_CAP_565,
48 .check = clcdfb_check,
49 .decode = clcdfb_decode,
50 .setup = nspire_clcd_setup,
51 .mmap = nspire_clcd_mmap,
52 .remove = nspire_clcd_remove,
53};
54
55
56static struct of_dev_auxdata nspire_auxdata[] __initdata = {
57 OF_DEV_AUXDATA("arm,pl111", NSPIRE_LCD_PHYS_BASE,
58 NULL, &nspire_clcd_data),
59 { }
60};
61
62static void __init nspire_init(void)
63{
64 of_platform_populate(NULL, of_default_bus_match_table,
65 nspire_auxdata, NULL);
66}
67
68static void __init nspire_init_time(void)
69{
70 of_clk_init(NULL);
71 clocksource_of_init();
72}
73
74static void nspire_restart(char mode, const char *cmd)
75{
76 void __iomem *base = ioremap(NSPIRE_MISC_PHYS_BASE, SZ_4K);
77 if (!base)
78 return;
79
80 writel(2, base + NSPIRE_MISC_HWRESET);
81}
82
83DT_MACHINE_START(NSPIRE, "TI-NSPIRE")
84 .dt_compat = nspire_dt_match,
85 .map_io = nspire_map_io,
86 .init_time = nspire_init_time,
87 .init_machine = nspire_init,
88 .restart = nspire_restart,
89MACHINE_END
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 222d58c0ae76..3889b6cd211e 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -19,10 +19,6 @@ obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
19# Power Management 19# Power Management
20obj-$(CONFIG_PM) += pm.o sleep.o 20obj-$(CONFIG_PM) += pm.o sleep.o
21 21
22# DSP
23obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
24mailbox_mach-objs := mailbox.o
25
26i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o 22i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
27obj-y += $(i2c-omap-m) $(i2c-omap-y) 23obj-y += $(i2c-omap-m) $(i2c-omap-y)
28 24
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 0dac3d239e32..fd90cafc2e36 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -41,7 +41,6 @@
41#include <mach/mux.h> 41#include <mach/mux.h>
42#include <linux/omap-dma.h> 42#include <linux/omap-dma.h>
43#include <mach/tc.h> 43#include <mach/tc.h>
44#include <mach/irda.h>
45#include <linux/platform_data/keypad-omap.h> 44#include <linux/platform_data/keypad-omap.h>
46#include <mach/flash.h> 45#include <mach/flash.h>
47 46
@@ -50,7 +49,6 @@
50 49
51#include "common.h" 50#include "common.h"
52#include "board-h2.h" 51#include "board-h2.h"
53#include "dma.h"
54 52
55/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */ 53/* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
56#define OMAP1610_ETHR_START 0x04000300 54#define OMAP1610_ETHR_START 0x04000300
@@ -276,39 +274,6 @@ static struct platform_device h2_kp_device = {
276 .resource = h2_kp_resources, 274 .resource = h2_kp_resources,
277}; 275};
278 276
279#define H2_IRDA_FIRSEL_GPIO_PIN 17
280
281static struct omap_irda_config h2_irda_data = {
282 .transceiver_cap = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
283 .rx_channel = OMAP_DMA_UART3_RX,
284 .tx_channel = OMAP_DMA_UART3_TX,
285 .dest_start = UART3_THR,
286 .src_start = UART3_RHR,
287 .tx_trigger = 0,
288 .rx_trigger = 0,
289};
290
291static struct resource h2_irda_resources[] = {
292 [0] = {
293 .start = INT_UART3,
294 .end = INT_UART3,
295 .flags = IORESOURCE_IRQ,
296 },
297};
298
299static u64 irda_dmamask = 0xffffffff;
300
301static struct platform_device h2_irda_device = {
302 .name = "omapirda",
303 .id = 0,
304 .dev = {
305 .platform_data = &h2_irda_data,
306 .dma_mask = &irda_dmamask,
307 },
308 .num_resources = ARRAY_SIZE(h2_irda_resources),
309 .resource = h2_irda_resources,
310};
311
312static struct gpio_led h2_gpio_led_pins[] = { 277static struct gpio_led h2_gpio_led_pins[] = {
313 { 278 {
314 .name = "h2:red", 279 .name = "h2:red",
@@ -339,7 +304,6 @@ static struct platform_device *h2_devices[] __initdata = {
339 &h2_nor_device, 304 &h2_nor_device,
340 &h2_nand_device, 305 &h2_nand_device,
341 &h2_smc91x_device, 306 &h2_smc91x_device,
342 &h2_irda_device,
343 &h2_kp_device, 307 &h2_kp_device,
344 &h2_gpio_leds, 308 &h2_gpio_leds,
345}; 309};
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 62a15e289c79..91449c5cb70f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -234,16 +234,26 @@ static struct i2c_board_info nokia770_i2c_board_info_2[] __initdata = {
234 { 234 {
235 I2C_BOARD_INFO("retu-mfd", 0x01), 235 I2C_BOARD_INFO("retu-mfd", 0x01),
236 }, 236 },
237 {
238 I2C_BOARD_INFO("tahvo-mfd", 0x02),
239 },
237}; 240};
238 241
239static void __init nokia770_cbus_init(void) 242static void __init nokia770_cbus_init(void)
240{ 243{
241 const int retu_irq_gpio = 62; 244 const int retu_irq_gpio = 62;
245 const int tahvo_irq_gpio = 40;
242 246
243 if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ")) 247 if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ"))
244 return; 248 return;
249 if (gpio_request_one(tahvo_irq_gpio, GPIOF_IN, "Tahvo IRQ")) {
250 gpio_free(retu_irq_gpio);
251 return;
252 }
245 irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING); 253 irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
254 irq_set_irq_type(gpio_to_irq(tahvo_irq_gpio), IRQ_TYPE_EDGE_RISING);
246 nokia770_i2c_board_info_2[0].irq = gpio_to_irq(retu_irq_gpio); 255 nokia770_i2c_board_info_2[0].irq = gpio_to_irq(retu_irq_gpio);
256 nokia770_i2c_board_info_2[1].irq = gpio_to_irq(tahvo_irq_gpio);
247 i2c_register_board_info(2, nokia770_i2c_board_info_2, 257 i2c_register_board_info(2, nokia770_i2c_board_info_2,
248 ARRAY_SIZE(nokia770_i2c_board_info_2)); 258 ARRAY_SIZE(nokia770_i2c_board_info_2));
249 platform_device_register(&nokia770_cbus_device); 259 platform_device_register(&nokia770_cbus_device);
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 845a1a7aef95..3b8e98f4353c 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -38,14 +38,12 @@
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <mach/tc.h> 39#include <mach/tc.h>
40#include <linux/omap-dma.h> 40#include <linux/omap-dma.h>
41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 41#include <linux/platform_data/keypad-omap.h>
43 42
44#include <mach/hardware.h> 43#include <mach/hardware.h>
45#include <mach/usb.h> 44#include <mach/usb.h>
46 45
47#include "common.h" 46#include "common.h"
48#include "dma.h"
49 47
50#define PALMTE_USBDETECT_GPIO 0 48#define PALMTE_USBDETECT_GPIO 0
51#define PALMTE_USB_OR_DC_GPIO 1 49#define PALMTE_USB_OR_DC_GPIO 1
@@ -167,40 +165,11 @@ static struct platform_device palmte_backlight_device = {
167 }, 165 },
168}; 166};
169 167
170static struct omap_irda_config palmte_irda_config = {
171 .transceiver_cap = IR_SIRMODE,
172 .rx_channel = OMAP_DMA_UART3_RX,
173 .tx_channel = OMAP_DMA_UART3_TX,
174 .dest_start = UART3_THR,
175 .src_start = UART3_RHR,
176 .tx_trigger = 0,
177 .rx_trigger = 0,
178};
179
180static struct resource palmte_irda_resources[] = {
181 [0] = {
182 .start = INT_UART3,
183 .end = INT_UART3,
184 .flags = IORESOURCE_IRQ,
185 },
186};
187
188static struct platform_device palmte_irda_device = {
189 .name = "omapirda",
190 .id = -1,
191 .dev = {
192 .platform_data = &palmte_irda_config,
193 },
194 .num_resources = ARRAY_SIZE(palmte_irda_resources),
195 .resource = palmte_irda_resources,
196};
197
198static struct platform_device *palmte_devices[] __initdata = { 168static struct platform_device *palmte_devices[] __initdata = {
199 &palmte_rom_device, 169 &palmte_rom_device,
200 &palmte_kp_device, 170 &palmte_kp_device,
201 &palmte_lcd_device, 171 &palmte_lcd_device,
202 &palmte_backlight_device, 172 &palmte_backlight_device,
203 &palmte_irda_device,
204}; 173};
205 174
206static struct omap_usb_config palmte_usb_config __initdata = { 175static struct omap_usb_config palmte_usb_config __initdata = {
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 65a4a3e357f2..ca501208825f 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -38,14 +38,12 @@
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <linux/omap-dma.h> 39#include <linux/omap-dma.h>
40#include <mach/tc.h> 40#include <mach/tc.h>
41#include <mach/irda.h>
42#include <linux/platform_data/keypad-omap.h> 41#include <linux/platform_data/keypad-omap.h>
43 42
44#include <mach/hardware.h> 43#include <mach/hardware.h>
45#include <mach/usb.h> 44#include <mach/usb.h>
46 45
47#include "common.h" 46#include "common.h"
48#include "dma.h"
49 47
50#define PALMTT_USBDETECT_GPIO 0 48#define PALMTT_USBDETECT_GPIO 0
51#define PALMTT_CABLE_GPIO 1 49#define PALMTT_CABLE_GPIO 1
@@ -163,33 +161,6 @@ static struct platform_device palmtt_lcd_device = {
163 .name = "lcd_palmtt", 161 .name = "lcd_palmtt",
164 .id = -1, 162 .id = -1,
165}; 163};
166static struct omap_irda_config palmtt_irda_config = {
167 .transceiver_cap = IR_SIRMODE,
168 .rx_channel = OMAP_DMA_UART3_RX,
169 .tx_channel = OMAP_DMA_UART3_TX,
170 .dest_start = UART3_THR,
171 .src_start = UART3_RHR,
172 .tx_trigger = 0,
173 .rx_trigger = 0,
174};
175
176static struct resource palmtt_irda_resources[] = {
177 [0] = {
178 .start = INT_UART3,
179 .end = INT_UART3,
180 .flags = IORESOURCE_IRQ,
181 },
182};
183
184static struct platform_device palmtt_irda_device = {
185 .name = "omapirda",
186 .id = -1,
187 .dev = {
188 .platform_data = &palmtt_irda_config,
189 },
190 .num_resources = ARRAY_SIZE(palmtt_irda_resources),
191 .resource = palmtt_irda_resources,
192};
193 164
194static struct platform_device palmtt_spi_device = { 165static struct platform_device palmtt_spi_device = {
195 .name = "spi_palmtt", 166 .name = "spi_palmtt",
@@ -234,7 +205,6 @@ static struct platform_device *palmtt_devices[] __initdata = {
234 &palmtt_flash_device, 205 &palmtt_flash_device,
235 &palmtt_kp_device, 206 &palmtt_kp_device,
236 &palmtt_lcd_device, 207 &palmtt_lcd_device,
237 &palmtt_irda_device,
238 &palmtt_spi_device, 208 &palmtt_spi_device,
239 &palmtt_backlight_device, 209 &palmtt_backlight_device,
240 &palmtt_led_device, 210 &palmtt_led_device,
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 01c970071fd8..470e12d67360 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -40,14 +40,12 @@
40#include <mach/mux.h> 40#include <mach/mux.h>
41#include <linux/omap-dma.h> 41#include <linux/omap-dma.h>
42#include <mach/tc.h> 42#include <mach/tc.h>
43#include <mach/irda.h>
44#include <linux/platform_data/keypad-omap.h> 43#include <linux/platform_data/keypad-omap.h>
45 44
46#include <mach/hardware.h> 45#include <mach/hardware.h>
47#include <mach/usb.h> 46#include <mach/usb.h>
48 47
49#include "common.h" 48#include "common.h"
50#include "dma.h"
51 49
52#define PALMZ71_USBDETECT_GPIO 0 50#define PALMZ71_USBDETECT_GPIO 0
53#define PALMZ71_PENIRQ_GPIO 6 51#define PALMZ71_PENIRQ_GPIO 6
@@ -153,34 +151,6 @@ static struct platform_device palmz71_lcd_device = {
153 .id = -1, 151 .id = -1,
154}; 152};
155 153
156static struct omap_irda_config palmz71_irda_config = {
157 .transceiver_cap = IR_SIRMODE,
158 .rx_channel = OMAP_DMA_UART3_RX,
159 .tx_channel = OMAP_DMA_UART3_TX,
160 .dest_start = UART3_THR,
161 .src_start = UART3_RHR,
162 .tx_trigger = 0,
163 .rx_trigger = 0,
164};
165
166static struct resource palmz71_irda_resources[] = {
167 [0] = {
168 .start = INT_UART3,
169 .end = INT_UART3,
170 .flags = IORESOURCE_IRQ,
171 },
172};
173
174static struct platform_device palmz71_irda_device = {
175 .name = "omapirda",
176 .id = -1,
177 .dev = {
178 .platform_data = &palmz71_irda_config,
179 },
180 .num_resources = ARRAY_SIZE(palmz71_irda_resources),
181 .resource = palmz71_irda_resources,
182};
183
184static struct platform_device palmz71_spi_device = { 154static struct platform_device palmz71_spi_device = {
185 .name = "spi_palmz71", 155 .name = "spi_palmz71",
186 .id = -1, 156 .id = -1,
@@ -202,7 +172,6 @@ static struct platform_device *devices[] __initdata = {
202 &palmz71_rom_device, 172 &palmz71_rom_device,
203 &palmz71_kp_device, 173 &palmz71_kp_device,
204 &palmz71_lcd_device, 174 &palmz71_lcd_device,
205 &palmz71_irda_device,
206 &palmz71_spi_device, 175 &palmz71_spi_device,
207 &palmz71_backlight_device, 176 &palmz71_backlight_device,
208}; 177};
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 9732a98f3e06..0a8d3349149c 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -37,7 +37,6 @@
37#include <mach/flash.h> 37#include <mach/flash.h>
38#include <mach/mux.h> 38#include <mach/mux.h>
39#include <linux/omap-dma.h> 39#include <linux/omap-dma.h>
40#include <mach/irda.h>
41#include <mach/tc.h> 40#include <mach/tc.h>
42#include <mach/board-sx1.h> 41#include <mach/board-sx1.h>
43 42
@@ -45,7 +44,6 @@
45#include <mach/usb.h> 44#include <mach/usb.h>
46 45
47#include "common.h" 46#include "common.h"
48#include "dma.h"
49 47
50/* Write to I2C device */ 48/* Write to I2C device */
51int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) 49int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
@@ -228,39 +226,6 @@ static struct platform_device sx1_kp_device = {
228 .resource = sx1_kp_resources, 226 .resource = sx1_kp_resources,
229}; 227};
230 228
231/*----------- IRDA -------------------------*/
232
233static struct omap_irda_config sx1_irda_data = {
234 .transceiver_cap = IR_SIRMODE,
235 .rx_channel = OMAP_DMA_UART3_RX,
236 .tx_channel = OMAP_DMA_UART3_TX,
237 .dest_start = UART3_THR,
238 .src_start = UART3_RHR,
239 .tx_trigger = 0,
240 .rx_trigger = 0,
241};
242
243static struct resource sx1_irda_resources[] = {
244 [0] = {
245 .start = INT_UART3,
246 .end = INT_UART3,
247 .flags = IORESOURCE_IRQ,
248 },
249};
250
251static u64 irda_dmamask = 0xffffffff;
252
253static struct platform_device sx1_irda_device = {
254 .name = "omapirda",
255 .id = 0,
256 .dev = {
257 .platform_data = &sx1_irda_data,
258 .dma_mask = &irda_dmamask,
259 },
260 .num_resources = ARRAY_SIZE(sx1_irda_resources),
261 .resource = sx1_irda_resources,
262};
263
264/*----------- MTD -------------------------*/ 229/*----------- MTD -------------------------*/
265 230
266static struct mtd_partition sx1_partitions[] = { 231static struct mtd_partition sx1_partitions[] = {
@@ -366,7 +331,6 @@ static struct omap_lcd_config sx1_lcd_config __initdata = {
366static struct platform_device *sx1_devices[] __initdata = { 331static struct platform_device *sx1_devices[] __initdata = {
367 &sx1_flash_device, 332 &sx1_flash_device,
368 &sx1_kp_device, 333 &sx1_kp_device,
369 &sx1_irda_device,
370}; 334};
371 335
372/*-----------------------------------------*/ 336/*-----------------------------------------*/
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 0af635205e8a..325e6030095e 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -30,7 +30,6 @@
30 30
31#include "common.h" 31#include "common.h"
32#include "clock.h" 32#include "clock.h"
33#include "dma.h"
34#include "mmc.h" 33#include "mmc.h"
35#include "sram.h" 34#include "sram.h"
36 35
@@ -223,16 +222,16 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
223 case 0: 222 case 0:
224 base = OMAP1_MMC1_BASE; 223 base = OMAP1_MMC1_BASE;
225 irq = INT_MMC; 224 irq = INT_MMC;
226 rx_req = OMAP_DMA_MMC_RX; 225 rx_req = 22;
227 tx_req = OMAP_DMA_MMC_TX; 226 tx_req = 21;
228 break; 227 break;
229 case 1: 228 case 1:
230 if (!cpu_is_omap16xx()) 229 if (!cpu_is_omap16xx())
231 return; 230 return;
232 base = OMAP1_MMC2_BASE; 231 base = OMAP1_MMC2_BASE;
233 irq = INT_1610_MMC2; 232 irq = INT_1610_MMC2;
234 rx_req = OMAP_DMA_MMC2_RX; 233 rx_req = 55;
235 tx_req = OMAP_DMA_MMC2_TX; 234 tx_req = 54;
236 break; 235 break;
237 default: 236 default:
238 continue; 237 continue;
diff --git a/arch/arm/mach-omap1/dma.c b/arch/arm/mach-omap1/dma.c
index a94b3a718d1a..5bb8ce86d54b 100644
--- a/arch/arm/mach-omap1/dma.c
+++ b/arch/arm/mach-omap1/dma.c
@@ -30,8 +30,6 @@
30 30
31#include <mach/irqs.h> 31#include <mach/irqs.h>
32 32
33#include "dma.h"
34
35#define OMAP1_DMA_BASE (0xfffed800) 33#define OMAP1_DMA_BASE (0xfffed800)
36#define OMAP1_LOGICAL_DMA_CH_COUNT 17 34#define OMAP1_LOGICAL_DMA_CH_COUNT 17
37#define OMAP1_DMA_STRIDE 0x40 35#define OMAP1_DMA_STRIDE 0x40
diff --git a/arch/arm/mach-omap1/dma.h b/arch/arm/mach-omap1/dma.h
deleted file mode 100644
index d05909c96715..000000000000
--- a/arch/arm/mach-omap1/dma.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * OMAP1 DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP1_DMA_CHANNEL_H
20#define __OMAP1_DMA_CHANNEL_H
21
22/* DMA channels for omap1 */
23#define OMAP_DMA_NO_DEVICE 0
24#define OMAP_DMA_MCBSP1_TX 8
25#define OMAP_DMA_MCBSP1_RX 9
26#define OMAP_DMA_MCBSP3_TX 10
27#define OMAP_DMA_MCBSP3_RX 11
28#define OMAP_DMA_MCBSP2_TX 16
29#define OMAP_DMA_MCBSP2_RX 17
30#define OMAP_DMA_UART3_TX 18
31#define OMAP_DMA_UART3_RX 19
32#define OMAP_DMA_CAMERA_IF_RX 20
33#define OMAP_DMA_MMC_TX 21
34#define OMAP_DMA_MMC_RX 22
35#define OMAP_DMA_USB_W2FC_RX0 26
36#define OMAP_DMA_USB_W2FC_TX0 29
37
38/* These are only for 1610 */
39#define OMAP_DMA_MMC2_TX 54
40#define OMAP_DMA_MMC2_RX 55
41
42#endif /* __OMAP1_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap1/include/mach/irda.h b/arch/arm/mach-omap1/include/mach/irda.h
deleted file mode 100644
index 40f60339d1c6..000000000000
--- a/arch/arm/mach-omap1/include/mach/irda.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/irda.h
3 *
4 * Copyright (C) 2005-2006 Komal Shah <komal_shah802003@yahoo.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#ifndef ASMARM_ARCH_IRDA_H
11#define ASMARM_ARCH_IRDA_H
12
13/* board specific transceiver capabilities */
14
15#define IR_SEL 1 /* Selects IrDA */
16#define IR_SIRMODE 2
17#define IR_FIRMODE 4
18#define IR_MIRMODE 8
19
20struct omap_irda_config {
21 int transceiver_cap;
22 int (*transceiver_mode)(struct device *dev, int mode);
23 int (*select_irda)(struct device *dev, int state);
24 int rx_channel;
25 int tx_channel;
26 unsigned long dest_start;
27 unsigned long src_start;
28 int tx_trigger;
29 int rx_trigger;
30 int mode;
31};
32
33#endif
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index 77924be37d41..26a2b01c7c4f 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -32,8 +32,6 @@
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/lcdc.h> 33#include <mach/lcdc.h>
34 34
35#include "dma.h"
36
37int omap_lcd_dma_running(void) 35int omap_lcd_dma_running(void)
38{ 36{
39 /* 37 /*
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
deleted file mode 100644
index efc8f207f6fc..000000000000
--- a/arch/arm/mach-omap1/mailbox.c
+++ /dev/null
@@ -1,199 +0,0 @@
1/*
2 * Mailbox reservation modules for OMAP1
3 *
4 * Copyright (C) 2006-2009 Nokia Corporation
5 * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/module.h>
13#include <linux/interrupt.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <plat/mailbox.h>
17
18#define MAILBOX_ARM2DSP1 0x00
19#define MAILBOX_ARM2DSP1b 0x04
20#define MAILBOX_DSP2ARM1 0x08
21#define MAILBOX_DSP2ARM1b 0x0c
22#define MAILBOX_DSP2ARM2 0x10
23#define MAILBOX_DSP2ARM2b 0x14
24#define MAILBOX_ARM2DSP1_Flag 0x18
25#define MAILBOX_DSP2ARM1_Flag 0x1c
26#define MAILBOX_DSP2ARM2_Flag 0x20
27
28static void __iomem *mbox_base;
29
30struct omap_mbox1_fifo {
31 unsigned long cmd;
32 unsigned long data;
33 unsigned long flag;
34};
35
36struct omap_mbox1_priv {
37 struct omap_mbox1_fifo tx_fifo;
38 struct omap_mbox1_fifo rx_fifo;
39};
40
41static inline int mbox_read_reg(size_t ofs)
42{
43 return __raw_readw(mbox_base + ofs);
44}
45
46static inline void mbox_write_reg(u32 val, size_t ofs)
47{
48 __raw_writew(val, mbox_base + ofs);
49}
50
51/* msg */
52static mbox_msg_t omap1_mbox_fifo_read(struct omap_mbox *mbox)
53{
54 struct omap_mbox1_fifo *fifo =
55 &((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
56 mbox_msg_t msg;
57
58 msg = mbox_read_reg(fifo->data);
59 msg |= ((mbox_msg_t) mbox_read_reg(fifo->cmd)) << 16;
60
61 return msg;
62}
63
64static void
65omap1_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
66{
67 struct omap_mbox1_fifo *fifo =
68 &((struct omap_mbox1_priv *)mbox->priv)->tx_fifo;
69
70 mbox_write_reg(msg & 0xffff, fifo->data);
71 mbox_write_reg(msg >> 16, fifo->cmd);
72}
73
74static int omap1_mbox_fifo_empty(struct omap_mbox *mbox)
75{
76 return 0;
77}
78
79static int omap1_mbox_fifo_full(struct omap_mbox *mbox)
80{
81 struct omap_mbox1_fifo *fifo =
82 &((struct omap_mbox1_priv *)mbox->priv)->rx_fifo;
83
84 return mbox_read_reg(fifo->flag);
85}
86
87/* irq */
88static void
89omap1_mbox_enable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
90{
91 if (irq == IRQ_RX)
92 enable_irq(mbox->irq);
93}
94
95static void
96omap1_mbox_disable_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
97{
98 if (irq == IRQ_RX)
99 disable_irq(mbox->irq);
100}
101
102static int
103omap1_mbox_is_irq(struct omap_mbox *mbox, omap_mbox_type_t irq)
104{
105 if (irq == IRQ_TX)
106 return 0;
107 return 1;
108}
109
110static struct omap_mbox_ops omap1_mbox_ops = {
111 .type = OMAP_MBOX_TYPE1,
112 .fifo_read = omap1_mbox_fifo_read,
113 .fifo_write = omap1_mbox_fifo_write,
114 .fifo_empty = omap1_mbox_fifo_empty,
115 .fifo_full = omap1_mbox_fifo_full,
116 .enable_irq = omap1_mbox_enable_irq,
117 .disable_irq = omap1_mbox_disable_irq,
118 .is_irq = omap1_mbox_is_irq,
119};
120
121/* FIXME: the following struct should be created automatically by the user id */
122
123/* DSP */
124static struct omap_mbox1_priv omap1_mbox_dsp_priv = {
125 .tx_fifo = {
126 .cmd = MAILBOX_ARM2DSP1b,
127 .data = MAILBOX_ARM2DSP1,
128 .flag = MAILBOX_ARM2DSP1_Flag,
129 },
130 .rx_fifo = {
131 .cmd = MAILBOX_DSP2ARM1b,
132 .data = MAILBOX_DSP2ARM1,
133 .flag = MAILBOX_DSP2ARM1_Flag,
134 },
135};
136
137static struct omap_mbox mbox_dsp_info = {
138 .name = "dsp",
139 .ops = &omap1_mbox_ops,
140 .priv = &omap1_mbox_dsp_priv,
141};
142
143static struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
144
145static int omap1_mbox_probe(struct platform_device *pdev)
146{
147 struct resource *mem;
148 int ret;
149 struct omap_mbox **list;
150
151 list = omap1_mboxes;
152 list[0]->irq = platform_get_irq_byname(pdev, "dsp");
153
154 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
155 mbox_base = ioremap(mem->start, resource_size(mem));
156 if (!mbox_base)
157 return -ENOMEM;
158
159 ret = omap_mbox_register(&pdev->dev, list);
160 if (ret) {
161 iounmap(mbox_base);
162 return ret;
163 }
164
165 return 0;
166}
167
168static int omap1_mbox_remove(struct platform_device *pdev)
169{
170 omap_mbox_unregister();
171 iounmap(mbox_base);
172 return 0;
173}
174
175static struct platform_driver omap1_mbox_driver = {
176 .probe = omap1_mbox_probe,
177 .remove = omap1_mbox_remove,
178 .driver = {
179 .name = "omap-mailbox",
180 },
181};
182
183static int __init omap1_mbox_init(void)
184{
185 return platform_driver_register(&omap1_mbox_driver);
186}
187
188static void __exit omap1_mbox_exit(void)
189{
190 platform_driver_unregister(&omap1_mbox_driver);
191}
192
193module_init(omap1_mbox_init);
194module_exit(omap1_mbox_exit);
195
196MODULE_LICENSE("GPL v2");
197MODULE_DESCRIPTION("omap mailbox: omap1 architecture specific functions");
198MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>");
199MODULE_ALIAS("platform:omap1-mailbox");
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index b0d4723c9a90..8ed67f8d1762 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -27,7 +27,6 @@
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28 28
29#include "iomap.h" 29#include "iomap.h"
30#include "dma.h"
31 30
32#define DPS_RSTCT2_PER_EN (1 << 0) 31#define DPS_RSTCT2_PER_EN (1 << 0)
33#define DSP_RSTCT2_WD_PER_EN (1 << 1) 32#define DSP_RSTCT2_WD_PER_EN (1 << 1)
@@ -114,12 +113,12 @@ struct resource omap7xx_mcbsp_res[][6] = {
114 }, 113 },
115 { 114 {
116 .name = "rx", 115 .name = "rx",
117 .start = OMAP_DMA_MCBSP1_RX, 116 .start = 9,
118 .flags = IORESOURCE_DMA, 117 .flags = IORESOURCE_DMA,
119 }, 118 },
120 { 119 {
121 .name = "tx", 120 .name = "tx",
122 .start = OMAP_DMA_MCBSP1_TX, 121 .start = 8,
123 .flags = IORESOURCE_DMA, 122 .flags = IORESOURCE_DMA,
124 }, 123 },
125 }, 124 },
@@ -141,12 +140,12 @@ struct resource omap7xx_mcbsp_res[][6] = {
141 }, 140 },
142 { 141 {
143 .name = "rx", 142 .name = "rx",
144 .start = OMAP_DMA_MCBSP3_RX, 143 .start = 11,
145 .flags = IORESOURCE_DMA, 144 .flags = IORESOURCE_DMA,
146 }, 145 },
147 { 146 {
148 .name = "tx", 147 .name = "tx",
149 .start = OMAP_DMA_MCBSP3_TX, 148 .start = 10,
150 .flags = IORESOURCE_DMA, 149 .flags = IORESOURCE_DMA,
151 }, 150 },
152 }, 151 },
@@ -191,12 +190,12 @@ struct resource omap15xx_mcbsp_res[][6] = {
191 }, 190 },
192 { 191 {
193 .name = "rx", 192 .name = "rx",
194 .start = OMAP_DMA_MCBSP1_RX, 193 .start = 9,
195 .flags = IORESOURCE_DMA, 194 .flags = IORESOURCE_DMA,
196 }, 195 },
197 { 196 {
198 .name = "tx", 197 .name = "tx",
199 .start = OMAP_DMA_MCBSP1_TX, 198 .start = 8,
200 .flags = IORESOURCE_DMA, 199 .flags = IORESOURCE_DMA,
201 }, 200 },
202 }, 201 },
@@ -218,12 +217,12 @@ struct resource omap15xx_mcbsp_res[][6] = {
218 }, 217 },
219 { 218 {
220 .name = "rx", 219 .name = "rx",
221 .start = OMAP_DMA_MCBSP2_RX, 220 .start = 17,
222 .flags = IORESOURCE_DMA, 221 .flags = IORESOURCE_DMA,
223 }, 222 },
224 { 223 {
225 .name = "tx", 224 .name = "tx",
226 .start = OMAP_DMA_MCBSP2_TX, 225 .start = 16,
227 .flags = IORESOURCE_DMA, 226 .flags = IORESOURCE_DMA,
228 }, 227 },
229 }, 228 },
@@ -245,12 +244,12 @@ struct resource omap15xx_mcbsp_res[][6] = {
245 }, 244 },
246 { 245 {
247 .name = "rx", 246 .name = "rx",
248 .start = OMAP_DMA_MCBSP3_RX, 247 .start = 11,
249 .flags = IORESOURCE_DMA, 248 .flags = IORESOURCE_DMA,
250 }, 249 },
251 { 250 {
252 .name = "tx", 251 .name = "tx",
253 .start = OMAP_DMA_MCBSP3_TX, 252 .start = 10,
254 .flags = IORESOURCE_DMA, 253 .flags = IORESOURCE_DMA,
255 }, 254 },
256 }, 255 },
@@ -298,12 +297,12 @@ struct resource omap16xx_mcbsp_res[][6] = {
298 }, 297 },
299 { 298 {
300 .name = "rx", 299 .name = "rx",
301 .start = OMAP_DMA_MCBSP1_RX, 300 .start = 9,
302 .flags = IORESOURCE_DMA, 301 .flags = IORESOURCE_DMA,
303 }, 302 },
304 { 303 {
305 .name = "tx", 304 .name = "tx",
306 .start = OMAP_DMA_MCBSP1_TX, 305 .start = 8,
307 .flags = IORESOURCE_DMA, 306 .flags = IORESOURCE_DMA,
308 }, 307 },
309 }, 308 },
@@ -325,12 +324,12 @@ struct resource omap16xx_mcbsp_res[][6] = {
325 }, 324 },
326 { 325 {
327 .name = "rx", 326 .name = "rx",
328 .start = OMAP_DMA_MCBSP2_RX, 327 .start = 17,
329 .flags = IORESOURCE_DMA, 328 .flags = IORESOURCE_DMA,
330 }, 329 },
331 { 330 {
332 .name = "tx", 331 .name = "tx",
333 .start = OMAP_DMA_MCBSP2_TX, 332 .start = 16,
334 .flags = IORESOURCE_DMA, 333 .flags = IORESOURCE_DMA,
335 }, 334 },
336 }, 335 },
@@ -352,12 +351,12 @@ struct resource omap16xx_mcbsp_res[][6] = {
352 }, 351 },
353 { 352 {
354 .name = "rx", 353 .name = "rx",
355 .start = OMAP_DMA_MCBSP3_RX, 354 .start = 11,
356 .flags = IORESOURCE_DMA, 355 .flags = IORESOURCE_DMA,
357 }, 356 },
358 { 357 {
359 .name = "tx", 358 .name = "tx",
360 .start = OMAP_DMA_MCBSP3_TX, 359 .start = 10,
361 .flags = IORESOURCE_DMA, 360 .flags = IORESOURCE_DMA,
362 }, 361 },
363 }, 362 },
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index f49cd51e162a..c7b32a966f67 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -4,6 +4,7 @@ config ARCH_OMAP
4config ARCH_OMAP2PLUS 4config ARCH_OMAP2PLUS
5 bool "TI OMAP2/3/4/5 SoCs with device tree support" if (ARCH_MULTI_V6 || ARCH_MULTI_V7) 5 bool "TI OMAP2/3/4/5 SoCs with device tree support" if (ARCH_MULTI_V6 || ARCH_MULTI_V7)
6 select ARCH_HAS_CPUFREQ 6 select ARCH_HAS_CPUFREQ
7 select ARCH_HAS_BANDGAP
7 select ARCH_HAS_HOLES_MEMORYMODEL 8 select ARCH_HAS_HOLES_MEMORYMODEL
8 select ARCH_OMAP 9 select ARCH_OMAP
9 select ARCH_REQUIRE_GPIOLIB 10 select ARCH_REQUIRE_GPIOLIB
@@ -17,6 +18,7 @@ config ARCH_OMAP2PLUS
17 select PROC_DEVICETREE if PROC_FS 18 select PROC_DEVICETREE if PROC_FS
18 select SOC_BUS 19 select SOC_BUS
19 select SPARSE_IRQ 20 select SPARSE_IRQ
21 select TI_PRIV_EDMA
20 select USE_OF 22 select USE_OF
21 help 23 help
22 Systems based on OMAP2, OMAP3, OMAP4 or OMAP5 24 Systems based on OMAP2, OMAP3, OMAP4 or OMAP5
@@ -149,6 +151,14 @@ config SOC_AM33XX
149 select MULTI_IRQ_HANDLER 151 select MULTI_IRQ_HANDLER
150 select COMMON_CLK 152 select COMMON_CLK
151 153
154config SOC_AM43XX
155 bool "TI AM43x"
156 select CPU_V7
157 select MULTI_IRQ_HANDLER
158 select ARM_GIC
159 select COMMON_CLK
160 select MACH_OMAP_GENERIC
161
152config OMAP_PACKAGE_ZAF 162config OMAP_PACKAGE_ZAF
153 bool 163 bool
154 164
@@ -167,12 +177,6 @@ config OMAP_PACKAGE_CUS
167config OMAP_PACKAGE_CBP 177config OMAP_PACKAGE_CBP
168 bool 178 bool
169 179
170config OMAP_PACKAGE_CBL
171 bool
172
173config OMAP_PACKAGE_CBS
174 bool
175
176comment "OMAP Board Type" 180comment "OMAP Board Type"
177 depends on ARCH_OMAP2PLUS 181 depends on ARCH_OMAP2PLUS
178 182
@@ -378,22 +382,6 @@ config MACH_TI8148EVM
378 depends on SOC_TI81XX 382 depends on SOC_TI81XX
379 default y 383 default y
380 384
381config MACH_OMAP_4430SDP
382 bool "OMAP 4430 SDP board"
383 default y
384 depends on ARCH_OMAP4
385 select OMAP_PACKAGE_CBL
386 select OMAP_PACKAGE_CBS
387 select REGULATOR_FIXED_VOLTAGE if REGULATOR
388
389config MACH_OMAP4_PANDA
390 bool "OMAP4 Panda Board"
391 default y
392 depends on ARCH_OMAP4
393 select OMAP_PACKAGE_CBL
394 select OMAP_PACKAGE_CBS
395 select REGULATOR_FIXED_VOLTAGE if REGULATOR
396
397config OMAP3_EMU 385config OMAP3_EMU
398 bool "OMAP3 debugging peripherals" 386 bool "OMAP3 debugging peripherals"
399 depends on ARCH_OMAP3 387 depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 55a9d6777683..ea5a27ff9941 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
22obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common) 22obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
23obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common) 23obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
24obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common) 24obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
25obj-$(CONFIG_SOC_AM43XX) += $(hwmod-common) $(secure-common)
25 26
26ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 27ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
27obj-y += mcbsp.o 28obj-y += mcbsp.o
@@ -34,10 +35,10 @@ obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
34 35
35smp-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 36smp-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
36smp-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 37smp-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
37omap-4-5-common = omap4-common.o omap-wakeupgen.o \ 38omap-4-5-common = omap4-common.o omap-wakeupgen.o
38 sleep44xx.o 39obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common) $(smp-y) sleep44xx.o
39obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common) $(smp-y) 40obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common) $(smp-y) sleep44xx.o
40obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common) $(smp-y) 41obj-$(CONFIG_SOC_AM43XX) += $(omap-4-5-common)
41 42
42plus_sec := $(call as-instr,.arch_extension sec,+sec) 43plus_sec := $(call as-instr,.arch_extension sec,+sec)
43AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) 44AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -58,12 +59,13 @@ obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o
58obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o 59obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o
59obj-$(CONFIG_SOC_AM33XX) += am33xx-restart.o 60obj-$(CONFIG_SOC_AM33XX) += am33xx-restart.o
60obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o 61obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o
62obj-$(CONFIG_ARCH_OMAP4) += omap4-restart.o
63obj-$(CONFIG_SOC_OMAP5) += omap4-restart.o
61 64
62# Pin multiplexing 65# Pin multiplexing
63obj-$(CONFIG_SOC_OMAP2420) += mux2420.o 66obj-$(CONFIG_SOC_OMAP2420) += mux2420.o
64obj-$(CONFIG_SOC_OMAP2430) += mux2430.o 67obj-$(CONFIG_SOC_OMAP2430) += mux2430.o
65obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o 68obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o
66obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o
67 69
68# SMS/SDRC 70# SMS/SDRC
69obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o 71obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
@@ -110,6 +112,7 @@ obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
110obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o 112obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
111obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 113obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
112obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o 114obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
115obj-$(CONFIG_SOC_AM43XX) += prm33xx.o cm33xx.o
113omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 116omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
114 prcm_mpu44xx.o prminst44xx.o \ 117 prcm_mpu44xx.o prminst44xx.o \
115 vc44xx_data.o vp44xx_data.o 118 vc44xx_data.o vp44xx_data.o
@@ -125,8 +128,9 @@ obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o
125obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) 128obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common)
126obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o 129obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o
127obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common) 130obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
128obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o 131obj-$(CONFIG_SOC_AM43XX) += $(voltagedomain-common)
129obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common) 132obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
133obj-$(CONFIG_SOC_OMAP5) += voltagedomains54xx_data.o
130 134
131# OMAP powerdomain framework 135# OMAP powerdomain framework
132powerdomain-common += powerdomain.o powerdomain-common.o 136powerdomain-common += powerdomain.o powerdomain-common.o
@@ -140,7 +144,9 @@ obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common)
140obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o 144obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
141obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common) 145obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
142obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o 146obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
147obj-$(CONFIG_SOC_AM43XX) += $(powerdomain-common)
143obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common) 148obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
149obj-$(CONFIG_SOC_OMAP5) += powerdomains54xx_data.o
144 150
145# PRCM clockdomain control 151# PRCM clockdomain control
146clockdomain-common += clockdomain.o 152clockdomain-common += clockdomain.o
@@ -155,7 +161,9 @@ obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common)
155obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o 161obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
156obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common) 162obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
157obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o 163obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
164obj-$(CONFIG_SOC_AM43XX) += $(clockdomain-common)
158obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common) 165obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
166obj-$(CONFIG_SOC_OMAP5) += clockdomains54xx_data.o
159 167
160# Clock framework 168# Clock framework
161obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o 169obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
@@ -198,14 +206,12 @@ obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_2xxx_3xxx_interconnect_data.o
198obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_3xxx_data.o 206obj-$(CONFIG_ARCH_OMAP3) += omap_hwmod_3xxx_data.o
199obj-$(CONFIG_SOC_AM33XX) += omap_hwmod_33xx_data.o 207obj-$(CONFIG_SOC_AM33XX) += omap_hwmod_33xx_data.o
200obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o 208obj-$(CONFIG_ARCH_OMAP4) += omap_hwmod_44xx_data.o
209obj-$(CONFIG_SOC_OMAP5) += omap_hwmod_54xx_data.o
201 210
202# EMU peripherals 211# EMU peripherals
203obj-$(CONFIG_OMAP3_EMU) += emu.o 212obj-$(CONFIG_OMAP3_EMU) += emu.o
204obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o 213obj-$(CONFIG_HW_PERF_EVENTS) += pmu.o
205 214
206obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
207mailbox_mach-objs := mailbox.o
208
209iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o 215iommu-$(CONFIG_OMAP_IOMMU) := omap-iommu.o
210obj-y += $(iommu-m) $(iommu-y) 216obj-y += $(iommu-m) $(iommu-y)
211 217
@@ -251,8 +257,6 @@ obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o
251obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o 257obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o
252obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o 258obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o
253obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o 259obj-$(CONFIG_MACH_TOUCHBOOK) += board-omap3touchbook.o
254obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
255obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o
256 260
257obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o 261obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
258 262
diff --git a/arch/arm/mach-omap2/am33xx.h b/arch/arm/mach-omap2/am33xx.h
index 43296c1af9ee..5eef093e6738 100644
--- a/arch/arm/mach-omap2/am33xx.h
+++ b/arch/arm/mach-omap2/am33xx.h
@@ -21,6 +21,7 @@
21#define AM33XX_SCM_BASE 0x44E10000 21#define AM33XX_SCM_BASE 0x44E10000
22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE 22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE
23#define AM33XX_PRCM_BASE 0x44E00000 23#define AM33XX_PRCM_BASE 0x44E00000
24#define AM43XX_PRCM_BASE 0x44DF0000
24#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + 0x3FC) 25#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + 0x3FC)
25 26
26#endif /* __ASM_ARCH_AM33XX_H */ 27#endif /* __ASM_ARCH_AM33XX_H */
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
deleted file mode 100644
index 56a9a4f855c7..000000000000
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ /dev/null
@@ -1,765 +0,0 @@
1/*
2 * Board support file for OMAP4430 SDP.
3 *
4 * Copyright (C) 2009 Texas Instruments
5 *
6 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
7 *
8 * Based on mach-omap2/board-3430sdp.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/init.h>
17#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
20#include <linux/usb/otg.h>
21#include <linux/spi/spi.h>
22#include <linux/i2c/twl.h>
23#include <linux/mfd/twl6040.h>
24#include <linux/gpio_keys.h>
25#include <linux/regulator/machine.h>
26#include <linux/regulator/fixed.h>
27#include <linux/pwm.h>
28#include <linux/leds.h>
29#include <linux/leds_pwm.h>
30#include <linux/pwm_backlight.h>
31#include <linux/irqchip/arm-gic.h>
32#include <linux/platform_data/omap4-keypad.h>
33#include <linux/usb/musb.h>
34#include <linux/usb/phy.h>
35
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39
40#include "common.h"
41#include "omap4-keypad.h"
42#include <linux/wl12xx.h>
43#include <linux/platform_data/omap-abe-twl6040.h>
44
45#include "soc.h"
46#include "mux.h"
47#include "mmc.h"
48#include "hsmmc.h"
49#include "control.h"
50#include "common-board-devices.h"
51#include "dss-common.h"
52
53#define ETH_KS8851_IRQ 34
54#define ETH_KS8851_POWER_ON 48
55#define ETH_KS8851_QUART 138
56#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
57#define OMAP4_SFH7741_ENABLE_GPIO 188
58
59#define GPIO_WIFI_PMENA 54
60#define GPIO_WIFI_IRQ 53
61
62static const int sdp4430_keymap[] = {
63 KEY(0, 0, KEY_E),
64 KEY(0, 1, KEY_R),
65 KEY(0, 2, KEY_T),
66 KEY(0, 3, KEY_HOME),
67 KEY(0, 4, KEY_F5),
68 KEY(0, 5, KEY_UNKNOWN),
69 KEY(0, 6, KEY_I),
70 KEY(0, 7, KEY_LEFTSHIFT),
71
72 KEY(1, 0, KEY_D),
73 KEY(1, 1, KEY_F),
74 KEY(1, 2, KEY_G),
75 KEY(1, 3, KEY_SEND),
76 KEY(1, 4, KEY_F6),
77 KEY(1, 5, KEY_UNKNOWN),
78 KEY(1, 6, KEY_K),
79 KEY(1, 7, KEY_ENTER),
80
81 KEY(2, 0, KEY_X),
82 KEY(2, 1, KEY_C),
83 KEY(2, 2, KEY_V),
84 KEY(2, 3, KEY_END),
85 KEY(2, 4, KEY_F7),
86 KEY(2, 5, KEY_UNKNOWN),
87 KEY(2, 6, KEY_DOT),
88 KEY(2, 7, KEY_CAPSLOCK),
89
90 KEY(3, 0, KEY_Z),
91 KEY(3, 1, KEY_KPPLUS),
92 KEY(3, 2, KEY_B),
93 KEY(3, 3, KEY_F1),
94 KEY(3, 4, KEY_F8),
95 KEY(3, 5, KEY_UNKNOWN),
96 KEY(3, 6, KEY_O),
97 KEY(3, 7, KEY_SPACE),
98
99 KEY(4, 0, KEY_W),
100 KEY(4, 1, KEY_Y),
101 KEY(4, 2, KEY_U),
102 KEY(4, 3, KEY_F2),
103 KEY(4, 4, KEY_VOLUMEUP),
104 KEY(4, 5, KEY_UNKNOWN),
105 KEY(4, 6, KEY_L),
106 KEY(4, 7, KEY_LEFT),
107
108 KEY(5, 0, KEY_S),
109 KEY(5, 1, KEY_H),
110 KEY(5, 2, KEY_J),
111 KEY(5, 3, KEY_F3),
112 KEY(5, 4, KEY_F9),
113 KEY(5, 5, KEY_VOLUMEDOWN),
114 KEY(5, 6, KEY_M),
115 KEY(5, 7, KEY_RIGHT),
116
117 KEY(6, 0, KEY_Q),
118 KEY(6, 1, KEY_A),
119 KEY(6, 2, KEY_N),
120 KEY(6, 3, KEY_BACK),
121 KEY(6, 4, KEY_BACKSPACE),
122 KEY(6, 5, KEY_UNKNOWN),
123 KEY(6, 6, KEY_P),
124 KEY(6, 7, KEY_UP),
125
126 KEY(7, 0, KEY_PROG1),
127 KEY(7, 1, KEY_PROG2),
128 KEY(7, 2, KEY_PROG3),
129 KEY(7, 3, KEY_PROG4),
130 KEY(7, 4, KEY_F4),
131 KEY(7, 5, KEY_UNKNOWN),
132 KEY(7, 6, KEY_OK),
133 KEY(7, 7, KEY_DOWN),
134};
135static struct omap_device_pad keypad_pads[] = {
136 { .name = "kpd_col1.kpd_col1",
137 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
138 },
139 { .name = "kpd_col1.kpd_col1",
140 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
141 },
142 { .name = "kpd_col2.kpd_col2",
143 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
144 },
145 { .name = "kpd_col3.kpd_col3",
146 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
147 },
148 { .name = "kpd_col4.kpd_col4",
149 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
150 },
151 { .name = "kpd_col5.kpd_col5",
152 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
153 },
154 { .name = "gpmc_a23.kpd_col7",
155 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
156 },
157 { .name = "gpmc_a22.kpd_col6",
158 .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
159 },
160 { .name = "kpd_row0.kpd_row0",
161 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
162 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
163 },
164 { .name = "kpd_row1.kpd_row1",
165 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
166 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
167 },
168 { .name = "kpd_row2.kpd_row2",
169 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
170 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
171 },
172 { .name = "kpd_row3.kpd_row3",
173 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
174 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
175 },
176 { .name = "kpd_row4.kpd_row4",
177 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
178 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
179 },
180 { .name = "kpd_row5.kpd_row5",
181 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
182 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
183 },
184 { .name = "gpmc_a18.kpd_row6",
185 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
186 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
187 },
188 { .name = "gpmc_a19.kpd_row7",
189 .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
190 OMAP_MUX_MODE1 | OMAP_INPUT_EN,
191 },
192};
193
194static struct matrix_keymap_data sdp4430_keymap_data = {
195 .keymap = sdp4430_keymap,
196 .keymap_size = ARRAY_SIZE(sdp4430_keymap),
197};
198
199static struct omap4_keypad_platform_data sdp4430_keypad_data = {
200 .keymap_data = &sdp4430_keymap_data,
201 .rows = 8,
202 .cols = 8,
203};
204
205static struct omap_board_data keypad_data = {
206 .id = 1,
207 .pads = keypad_pads,
208 .pads_cnt = ARRAY_SIZE(keypad_pads),
209};
210
211static struct gpio_led sdp4430_gpio_leds[] = {
212 {
213 .name = "omap4:green:debug0",
214 .gpio = 61,
215 },
216 {
217 .name = "omap4:green:debug1",
218 .gpio = 30,
219 },
220 {
221 .name = "omap4:green:debug2",
222 .gpio = 7,
223 },
224 {
225 .name = "omap4:green:debug3",
226 .gpio = 8,
227 },
228 {
229 .name = "omap4:green:debug4",
230 .gpio = 50,
231 },
232 {
233 .name = "omap4:blue:user",
234 .gpio = 169,
235 },
236 {
237 .name = "omap4:red:user",
238 .gpio = 170,
239 },
240 {
241 .name = "omap4:green:user",
242 .gpio = 139,
243 },
244
245};
246
247static struct gpio_keys_button sdp4430_gpio_keys[] = {
248 {
249 .desc = "Proximity Sensor",
250 .type = EV_SW,
251 .code = SW_FRONT_PROXIMITY,
252 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
253 .active_low = 0,
254 }
255};
256
257static struct gpio_led_platform_data sdp4430_led_data = {
258 .leds = sdp4430_gpio_leds,
259 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
260};
261
262static struct pwm_lookup sdp4430_pwm_lookup[] = {
263 PWM_LOOKUP("twl-pwm", 0, "leds_pwm", "omap4::keypad"),
264 PWM_LOOKUP("twl-pwm", 1, "pwm-backlight", NULL),
265 PWM_LOOKUP("twl-pwmled", 0, "leds_pwm", "omap4:green:chrg"),
266};
267
268static struct led_pwm sdp4430_pwm_leds[] = {
269 {
270 .name = "omap4::keypad",
271 .max_brightness = 127,
272 .pwm_period_ns = 7812500,
273 },
274 {
275 .name = "omap4:green:chrg",
276 .max_brightness = 255,
277 .pwm_period_ns = 7812500,
278 },
279};
280
281static struct led_pwm_platform_data sdp4430_pwm_data = {
282 .num_leds = ARRAY_SIZE(sdp4430_pwm_leds),
283 .leds = sdp4430_pwm_leds,
284};
285
286static struct platform_device sdp4430_leds_pwm = {
287 .name = "leds_pwm",
288 .id = -1,
289 .dev = {
290 .platform_data = &sdp4430_pwm_data,
291 },
292};
293
294/* Dummy regulator for pwm-backlight driver */
295static struct regulator_consumer_supply backlight_supply =
296 REGULATOR_SUPPLY("enable", "pwm-backlight");
297
298static struct platform_pwm_backlight_data sdp4430_backlight_data = {
299 .max_brightness = 127,
300 .dft_brightness = 127,
301 .pwm_period_ns = 7812500,
302};
303
304static struct platform_device sdp4430_backlight_pwm = {
305 .name = "pwm-backlight",
306 .id = -1,
307 .dev = {
308 .platform_data = &sdp4430_backlight_data,
309 },
310};
311
312static int omap_prox_activate(struct device *dev)
313{
314 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
315 return 0;
316}
317
318static void omap_prox_deactivate(struct device *dev)
319{
320 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
321}
322
323static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
324 .buttons = sdp4430_gpio_keys,
325 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
326 .enable = omap_prox_activate,
327 .disable = omap_prox_deactivate,
328};
329
330static struct platform_device sdp4430_gpio_keys_device = {
331 .name = "gpio-keys",
332 .id = -1,
333 .dev = {
334 .platform_data = &sdp4430_gpio_keys_data,
335 },
336};
337
338static struct platform_device sdp4430_leds_gpio = {
339 .name = "leds-gpio",
340 .id = -1,
341 .dev = {
342 .platform_data = &sdp4430_led_data,
343 },
344};
345static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
346 {
347 .modalias = "ks8851",
348 .bus_num = 1,
349 .chip_select = 0,
350 .max_speed_hz = 24000000,
351 /*
352 * .irq is set to gpio_to_irq(ETH_KS8851_IRQ)
353 * in omap_4430sdp_init
354 */
355 },
356};
357
358static struct gpio sdp4430_eth_gpios[] __initdata = {
359 { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" },
360 { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" },
361 { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" },
362};
363
364static int __init omap_ethernet_init(void)
365{
366 int status;
367
368 /* Request of GPIO lines */
369 status = gpio_request_array(sdp4430_eth_gpios,
370 ARRAY_SIZE(sdp4430_eth_gpios));
371 if (status)
372 pr_err("Cannot request ETH GPIOs\n");
373
374 return status;
375}
376
377static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
378 REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
379 REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
380};
381
382static struct regulator_init_data sdp4430_vbat_data = {
383 .constraints = {
384 .always_on = 1,
385 },
386 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vbat_supply),
387 .consumer_supplies = sdp4430_vbat_supply,
388};
389
390static struct fixed_voltage_config sdp4430_vbat_pdata = {
391 .supply_name = "VBAT",
392 .microvolts = 3750000,
393 .init_data = &sdp4430_vbat_data,
394 .gpio = -EINVAL,
395};
396
397static struct platform_device sdp4430_vbat = {
398 .name = "reg-fixed-voltage",
399 .id = -1,
400 .dev = {
401 .platform_data = &sdp4430_vbat_pdata,
402 },
403};
404
405static struct platform_device sdp4430_dmic_codec = {
406 .name = "dmic-codec",
407 .id = -1,
408};
409
410static struct platform_device sdp4430_hdmi_audio_codec = {
411 .name = "hdmi-audio-codec",
412 .id = -1,
413};
414
415static struct omap_abe_twl6040_data sdp4430_abe_audio_data = {
416 .card_name = "SDP4430",
417 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
418 .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
419 .has_ep = 1,
420 .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
421 .has_vibra = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
422
423 .has_dmic = 1,
424 .has_hsmic = 1,
425 .has_mainmic = 1,
426 .has_submic = 1,
427 .has_afm = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
428
429 .jack_detection = 1,
430 /* MCLK input is 38.4MHz */
431 .mclk_freq = 38400000,
432};
433
434static struct platform_device sdp4430_abe_audio = {
435 .name = "omap-abe-twl6040",
436 .id = -1,
437 .dev = {
438 .platform_data = &sdp4430_abe_audio_data,
439 },
440};
441
442static struct platform_device *sdp4430_devices[] __initdata = {
443 &sdp4430_gpio_keys_device,
444 &sdp4430_leds_gpio,
445 &sdp4430_leds_pwm,
446 &sdp4430_backlight_pwm,
447 &sdp4430_vbat,
448 &sdp4430_dmic_codec,
449 &sdp4430_abe_audio,
450 &sdp4430_hdmi_audio_codec,
451};
452
453static struct omap_musb_board_data musb_board_data = {
454 .interface_type = MUSB_INTERFACE_UTMI,
455 .mode = MUSB_OTG,
456 .power = 100,
457};
458
459static struct omap2_hsmmc_info mmc[] = {
460 {
461 .mmc = 2,
462 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
463 .gpio_cd = -EINVAL,
464 .gpio_wp = -EINVAL,
465 .nonremovable = true,
466 .ocr_mask = MMC_VDD_29_30,
467 .no_off_init = true,
468 },
469 {
470 .mmc = 1,
471 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
472 .gpio_cd = -EINVAL,
473 .gpio_wp = -EINVAL,
474 },
475 {
476 .mmc = 5,
477 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
478 .pm_caps = MMC_PM_KEEP_POWER,
479 .gpio_cd = -EINVAL,
480 .gpio_wp = -EINVAL,
481 .ocr_mask = MMC_VDD_165_195,
482 .nonremovable = true,
483 },
484 {} /* Terminator */
485};
486
487static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
488 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
489};
490
491static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
492 .supply = "vmmc",
493 .dev_name = "omap_hsmmc.4",
494};
495
496static struct regulator_init_data sdp4430_vmmc5 = {
497 .constraints = {
498 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
499 },
500 .num_consumer_supplies = 1,
501 .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
502};
503
504static struct fixed_voltage_config sdp4430_vwlan = {
505 .supply_name = "vwl1271",
506 .microvolts = 1800000, /* 1.8V */
507 .gpio = GPIO_WIFI_PMENA,
508 .startup_delay = 70000, /* 70msec */
509 .enable_high = 1,
510 .enabled_at_boot = 0,
511 .init_data = &sdp4430_vmmc5,
512};
513
514static struct platform_device omap_vwlan_device = {
515 .name = "reg-fixed-voltage",
516 .id = 1,
517 .dev = {
518 .platform_data = &sdp4430_vwlan,
519 },
520};
521
522static struct regulator_init_data sdp4430_vaux1 = {
523 .constraints = {
524 .min_uV = 1000000,
525 .max_uV = 3000000,
526 .apply_uV = true,
527 .valid_modes_mask = REGULATOR_MODE_NORMAL
528 | REGULATOR_MODE_STANDBY,
529 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
530 | REGULATOR_CHANGE_MODE
531 | REGULATOR_CHANGE_STATUS,
532 },
533 .num_consumer_supplies = ARRAY_SIZE(sdp4430_vaux_supply),
534 .consumer_supplies = sdp4430_vaux_supply,
535};
536
537static struct regulator_init_data sdp4430_vusim = {
538 .constraints = {
539 .min_uV = 1200000,
540 .max_uV = 2900000,
541 .apply_uV = true,
542 .valid_modes_mask = REGULATOR_MODE_NORMAL
543 | REGULATOR_MODE_STANDBY,
544 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
545 | REGULATOR_CHANGE_MODE
546 | REGULATOR_CHANGE_STATUS,
547 },
548};
549
550static struct twl6040_codec_data twl6040_codec = {
551 /* single-step ramp for headset and handsfree */
552 .hs_left_step = 0x0f,
553 .hs_right_step = 0x0f,
554 .hf_left_step = 0x1d,
555 .hf_right_step = 0x1d,
556};
557
558static struct twl6040_vibra_data twl6040_vibra = {
559 .vibldrv_res = 8,
560 .vibrdrv_res = 3,
561 .viblmotor_res = 10,
562 .vibrmotor_res = 10,
563 .vddvibl_uV = 0, /* fixed volt supply - VBAT */
564 .vddvibr_uV = 0, /* fixed volt supply - VBAT */
565};
566
567static struct twl6040_platform_data twl6040_data = {
568 .codec = &twl6040_codec,
569 .vibra = &twl6040_vibra,
570 .audpwron_gpio = 127,
571};
572
573static struct i2c_board_info __initdata sdp4430_i2c_1_boardinfo[] = {
574 {
575 I2C_BOARD_INFO("twl6040", 0x4b),
576 .irq = 119 + OMAP44XX_IRQ_GIC_START,
577 .platform_data = &twl6040_data,
578 },
579};
580
581static struct twl4030_platform_data sdp4430_twldata = {
582 /* Regulators */
583 .vusim = &sdp4430_vusim,
584 .vaux1 = &sdp4430_vaux1,
585};
586
587static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
588 {
589 I2C_BOARD_INFO("tmp105", 0x48),
590 },
591 {
592 I2C_BOARD_INFO("bh1780", 0x29),
593 },
594};
595static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
596 {
597 I2C_BOARD_INFO("hmc5843", 0x1e),
598 },
599};
600static int __init omap4_i2c_init(void)
601{
602 omap4_pmic_get_config(&sdp4430_twldata, TWL_COMMON_PDATA_USB,
603 TWL_COMMON_REGULATOR_VDAC |
604 TWL_COMMON_REGULATOR_VAUX2 |
605 TWL_COMMON_REGULATOR_VAUX3 |
606 TWL_COMMON_REGULATOR_VMMC |
607 TWL_COMMON_REGULATOR_VPP |
608 TWL_COMMON_REGULATOR_VANA |
609 TWL_COMMON_REGULATOR_VCXIO |
610 TWL_COMMON_REGULATOR_VUSB |
611 TWL_COMMON_REGULATOR_CLK32KG |
612 TWL_COMMON_REGULATOR_V1V8 |
613 TWL_COMMON_REGULATOR_V2V1);
614 omap4_pmic_init("twl6030", &sdp4430_twldata, sdp4430_i2c_1_boardinfo,
615 ARRAY_SIZE(sdp4430_i2c_1_boardinfo));
616 omap_register_i2c_bus(2, 400, NULL, 0);
617 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
618 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
619 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
620 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
621 return 0;
622}
623
624static void __init omap_sfh7741prox_init(void)
625{
626 int error;
627
628 error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
629 GPIOF_OUT_INIT_LOW, "sfh7741");
630 if (error < 0)
631 pr_err("%s:failed to request GPIO %d, error %d\n",
632 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
633}
634
635#ifdef CONFIG_OMAP_MUX
636static struct omap_board_mux board_mux[] __initdata = {
637 OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
638 /* NIRQ2 for twl6040 */
639 OMAP4_MUX(SYS_NIRQ2, OMAP_MUX_MODE0 |
640 OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
641 /* GPIO_127 for twl6040 */
642 OMAP4_MUX(HDQ_SIO, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
643 /* McPDM */
644 OMAP4_MUX(ABE_PDM_UL_DATA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
645 OMAP4_MUX(ABE_PDM_DL_DATA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
646 OMAP4_MUX(ABE_PDM_FRAME, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
647 OMAP4_MUX(ABE_PDM_LB_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
648 OMAP4_MUX(ABE_CLKS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
649 /* DMIC */
650 OMAP4_MUX(ABE_DMIC_CLK1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
651 OMAP4_MUX(ABE_DMIC_DIN1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
652 OMAP4_MUX(ABE_DMIC_DIN2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
653 OMAP4_MUX(ABE_DMIC_DIN3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
654 /* McBSP1 */
655 OMAP4_MUX(ABE_MCBSP1_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
656 OMAP4_MUX(ABE_MCBSP1_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
657 OMAP4_MUX(ABE_MCBSP1_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT |
658 OMAP_PULL_ENA),
659 OMAP4_MUX(ABE_MCBSP1_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
660 /* McBSP2 */
661 OMAP4_MUX(ABE_MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
662 OMAP4_MUX(ABE_MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
663 OMAP4_MUX(ABE_MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT |
664 OMAP_PULL_ENA),
665 OMAP4_MUX(ABE_MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
666
667 { .reg_offset = OMAP_MUX_TERMINATOR },
668};
669
670#else
671#define board_mux NULL
672 #endif
673
674static void __init omap4_sdp4430_wifi_mux_init(void)
675{
676 omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
677 OMAP_PIN_OFF_WAKEUPENABLE);
678 omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
679
680 omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
681 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
682 omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
683 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
684 omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
685 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
686 omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
687 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
688 omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
689 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
690 omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
691 OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
692
693}
694
695static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
696 .board_ref_clock = WL12XX_REFCLOCK_26,
697 .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
698};
699
700static void __init omap4_sdp4430_wifi_init(void)
701{
702 int ret;
703
704 omap4_sdp4430_wifi_mux_init();
705 omap4_sdp4430_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ);
706 ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data);
707 if (ret)
708 pr_err("Error setting wl12xx data: %d\n", ret);
709 ret = platform_device_register(&omap_vwlan_device);
710 if (ret)
711 pr_err("Error registering wl12xx device: %d\n", ret);
712}
713
714static void __init omap_4430sdp_init(void)
715{
716 int status;
717 int package = OMAP_PACKAGE_CBS;
718
719 if (omap_rev() == OMAP4430_REV_ES1_0)
720 package = OMAP_PACKAGE_CBL;
721 omap4_mux_init(board_mux, NULL, package);
722
723 omap4_i2c_init();
724 omap_sfh7741prox_init();
725 regulator_register_always_on(0, "backlight-enable",
726 &backlight_supply, 1, 0);
727 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
728 omap_serial_init();
729 omap_sdrc_init(NULL, NULL);
730 omap4_sdp4430_wifi_init();
731 omap4_twl6030_hsmmc_init(mmc);
732
733 usb_bind_phy("musb-hdrc.2.auto", 0, "omap-usb2.3.auto");
734 usb_musb_init(&musb_board_data);
735
736 status = omap_ethernet_init();
737 if (status) {
738 pr_err("Ethernet initialization failed: %d\n", status);
739 } else {
740 sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ);
741 spi_register_board_info(sdp4430_spi_board_info,
742 ARRAY_SIZE(sdp4430_spi_board_info));
743 }
744
745 pwm_add_table(sdp4430_pwm_lookup, ARRAY_SIZE(sdp4430_pwm_lookup));
746 status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
747 if (status)
748 pr_err("Keypad initialization failed: %d\n", status);
749
750 omap_4430sdp_display_init();
751}
752
753MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
754 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
755 .atag_offset = 0x100,
756 .smp = smp_ops(omap4_smp_ops),
757 .reserve = omap_reserve,
758 .map_io = omap4_map_io,
759 .init_early = omap4430_init_early,
760 .init_irq = gic_init_irq,
761 .init_machine = omap_4430sdp_init,
762 .init_late = omap4430_init_late,
763 .init_time = omap4_local_timer_init,
764 .restart = omap44xx_restart,
765MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index ee6218c74807..d4622ed26252 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -293,7 +293,8 @@ static struct regulator_consumer_supply cm_t35_vsim_supply[] = {
293static struct regulator_consumer_supply cm_t35_vio_supplies[] = { 293static struct regulator_consumer_supply cm_t35_vio_supplies[] = {
294 REGULATOR_SUPPLY("vcc", "spi1.0"), 294 REGULATOR_SUPPLY("vcc", "spi1.0"),
295 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 295 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
296 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), 296 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
297 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
297}; 298};
298 299
299/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ 300/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 576420544178..f1d91ba5d1ac 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -222,6 +222,7 @@ static struct twl4030_gpio_platform_data devkit8000_gpio_data = {
222 222
223static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = { 223static struct regulator_consumer_supply devkit8000_vpll1_supplies[] = {
224 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 224 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
225 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
225 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), 226 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
226}; 227};
227 228
diff --git a/arch/arm/mach-omap2/board-flash.c b/arch/arm/mach-omap2/board-flash.c
index c33adea0247c..fc20a61f6b2a 100644
--- a/arch/arm/mach-omap2/board-flash.c
+++ b/arch/arm/mach-omap2/board-flash.c
@@ -112,6 +112,9 @@ struct gpmc_timings nand_default_timings[1] = {
112 .cs_rd_off = 36, 112 .cs_rd_off = 36,
113 .cs_wr_off = 36, 113 .cs_wr_off = 36,
114 114
115 .we_on = 6,
116 .oe_on = 6,
117
115 .adv_on = 6, 118 .adv_on = 6,
116 .adv_rd_off = 24, 119 .adv_rd_off = 24,
117 .adv_wr_off = 36, 120 .adv_wr_off = 36,
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 88aa6b1835c3..e5fbfed69aa2 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -185,3 +185,19 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
185 .restart = omap44xx_restart, 185 .restart = omap44xx_restart,
186MACHINE_END 186MACHINE_END
187#endif 187#endif
188
189#ifdef CONFIG_SOC_AM43XX
190static const char *am43_boards_compat[] __initdata = {
191 "ti,am43",
192 NULL,
193};
194
195DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
196 .map_io = am33xx_map_io,
197 .init_early = am43xx_init_early,
198 .init_irq = omap_gic_of_init,
199 .init_machine = omap_generic_init,
200 .init_time = omap3_sync32k_timer_init,
201 .dt_compat = am43_boards_compat,
202MACHINE_END
203#endif
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d0d17bc58d9b..62e4f701b63b 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -272,7 +272,8 @@ static struct regulator_init_data ldp_vaux1 = {
272 272
273static struct regulator_consumer_supply ldp_vpll2_supplies[] = { 273static struct regulator_consumer_supply ldp_vpll2_supplies[] = {
274 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 274 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
275 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"), 275 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
276 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
276}; 277};
277 278
278static struct regulator_init_data ldp_vpll2 = { 279static struct regulator_init_data ldp_vpll2 = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index f76d0de7b406..8c026269baca 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -174,6 +174,7 @@ static struct panel_sharp_ls037v7dw01_data omap3_evm_lcd_data = {
174 .ud_gpio = OMAP3EVM_LCD_PANEL_UD, 174 .ud_gpio = OMAP3EVM_LCD_PANEL_UD,
175}; 175};
176 176
177#ifdef CONFIG_BROKEN
177static void __init omap3_evm_display_init(void) 178static void __init omap3_evm_display_init(void)
178{ 179{
179 int r; 180 int r;
@@ -193,6 +194,7 @@ static void __init omap3_evm_display_init(void)
193 else 194 else
194 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); 195 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
195} 196}
197#endif
196 198
197static struct omap_dss_device omap3_evm_lcd_device = { 199static struct omap_dss_device omap3_evm_lcd_device = {
198 .name = "lcd", 200 .name = "lcd",
@@ -715,7 +717,9 @@ static void __init omap3_evm_init(void)
715 717
716 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); 718 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
717 omap3evm_init_smsc911x(); 719 omap3evm_init_smsc911x();
720#ifdef CONFIG_BROKEN
718 omap3_evm_display_init(); 721 omap3_evm_display_init();
722#endif
719 omap3_evm_wl12xx_init(); 723 omap3_evm_wl12xx_init();
720 omap_twl4030_audio_init("omap3evm", NULL); 724 omap_twl4030_audio_init("omap3evm", NULL);
721} 725}
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 28133d5b4fed..b1547a0edfcd 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -343,6 +343,7 @@ static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
343static struct regulator_consumer_supply pandora_vdds_supplies[] = { 343static struct regulator_consumer_supply pandora_vdds_supplies[] = {
344 REGULATOR_SUPPLY("vdds_sdi", "omapdss"), 344 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
345 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 345 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
346 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
346 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), 347 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
347}; 348};
348 349
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
deleted file mode 100644
index 1e2c75eee912..000000000000
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ /dev/null
@@ -1,455 +0,0 @@
1/*
2 * Board support file for OMAP4430 based PandaBoard.
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * Author: David Anders <x0132446@ti.com>
7 *
8 * Based on mach-omap2/board-4430sdp.c
9 *
10 * Author: Santosh Shilimkar <santosh.shilimkar@ti.com>
11 *
12 * Based on mach-omap2/board-3430sdp.c
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22#include <linux/clk.h>
23#include <linux/io.h>
24#include <linux/leds.h>
25#include <linux/gpio.h>
26#include <linux/usb/otg.h>
27#include <linux/i2c/twl.h>
28#include <linux/mfd/twl6040.h>
29#include <linux/regulator/machine.h>
30#include <linux/regulator/fixed.h>
31#include <linux/ti_wilink_st.h>
32#include <linux/usb/musb.h>
33#include <linux/usb/phy.h>
34#include <linux/usb/nop-usb-xceiv.h>
35#include <linux/wl12xx.h>
36#include <linux/irqchip/arm-gic.h>
37#include <linux/platform_data/omap-abe-twl6040.h>
38
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42
43#include "common.h"
44#include "soc.h"
45#include "mmc.h"
46#include "hsmmc.h"
47#include "control.h"
48#include "mux.h"
49#include "common-board-devices.h"
50#include "dss-common.h"
51
52#define GPIO_HUB_POWER 1
53#define GPIO_HUB_NRESET 62
54#define GPIO_WIFI_PMENA 43
55#define GPIO_WIFI_IRQ 53
56
57/* wl127x BT, FM, GPS connectivity chip */
58static struct ti_st_plat_data wilink_platform_data = {
59 .nshutdown_gpio = 46,
60 .dev_name = "/dev/ttyO1",
61 .flow_cntrl = 1,
62 .baud_rate = 3000000,
63 .chip_enable = NULL,
64 .suspend = NULL,
65 .resume = NULL,
66};
67
68static struct platform_device wl1271_device = {
69 .name = "kim",
70 .id = -1,
71 .dev = {
72 .platform_data = &wilink_platform_data,
73 },
74};
75
76static struct gpio_led gpio_leds[] = {
77 {
78 .name = "pandaboard::status1",
79 .default_trigger = "heartbeat",
80 .gpio = 7,
81 },
82 {
83 .name = "pandaboard::status2",
84 .default_trigger = "mmc0",
85 .gpio = 8,
86 },
87};
88
89static struct gpio_led_platform_data gpio_led_info = {
90 .leds = gpio_leds,
91 .num_leds = ARRAY_SIZE(gpio_leds),
92};
93
94static struct platform_device leds_gpio = {
95 .name = "leds-gpio",
96 .id = -1,
97 .dev = {
98 .platform_data = &gpio_led_info,
99 },
100};
101
102static struct omap_abe_twl6040_data panda_abe_audio_data = {
103 /* Audio out */
104 .has_hs = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
105 /* HandsFree through expansion connector */
106 .has_hf = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
107 /* PandaBoard: FM TX, PandaBoardES: can be connected to audio out */
108 .has_aux = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
109 /* PandaBoard: FM RX, PandaBoardES: audio in */
110 .has_afm = ABE_TWL6040_LEFT | ABE_TWL6040_RIGHT,
111 /* No jack detection. */
112 .jack_detection = 0,
113 /* MCLK input is 38.4MHz */
114 .mclk_freq = 38400000,
115
116};
117
118static struct platform_device panda_abe_audio = {
119 .name = "omap-abe-twl6040",
120 .id = -1,
121 .dev = {
122 .platform_data = &panda_abe_audio_data,
123 },
124};
125
126static struct platform_device panda_hdmi_audio_codec = {
127 .name = "hdmi-audio-codec",
128 .id = -1,
129};
130
131static struct platform_device btwilink_device = {
132 .name = "btwilink",
133 .id = -1,
134};
135
136/* PHY device on HS USB Port 1 i.e. nop_usb_xceiv.1 */
137static struct nop_usb_xceiv_platform_data hsusb1_phy_data = {
138 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
139 .clk_rate = 19200000,
140};
141
142static struct usbhs_phy_data phy_data[] __initdata = {
143 {
144 .port = 1,
145 .reset_gpio = GPIO_HUB_NRESET,
146 .vcc_gpio = GPIO_HUB_POWER,
147 .vcc_polarity = 1,
148 .platform_data = &hsusb1_phy_data,
149 },
150};
151
152static struct platform_device *panda_devices[] __initdata = {
153 &leds_gpio,
154 &wl1271_device,
155 &panda_abe_audio,
156 &panda_hdmi_audio_codec,
157 &btwilink_device,
158};
159
160static struct usbhs_omap_platform_data usbhs_bdata __initdata = {
161 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
162};
163
164static void __init omap4_ehci_init(void)
165{
166 int ret;
167
168 /* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
169 ret = clk_add_alias("main_clk", "nop_usb_xceiv.1", "auxclk3_ck", NULL);
170 if (ret)
171 pr_err("Failed to add main_clk alias to auxclk3_ck\n");
172
173 usbhs_init_phys(phy_data, ARRAY_SIZE(phy_data));
174 usbhs_init(&usbhs_bdata);
175}
176
177static struct omap_musb_board_data musb_board_data = {
178 .interface_type = MUSB_INTERFACE_UTMI,
179 .mode = MUSB_OTG,
180 .power = 100,
181};
182
183static struct omap2_hsmmc_info mmc[] = {
184 {
185 .mmc = 1,
186 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
187 .gpio_wp = -EINVAL,
188 .gpio_cd = -EINVAL,
189 },
190 {
191 .name = "wl1271",
192 .mmc = 5,
193 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
194 .gpio_wp = -EINVAL,
195 .gpio_cd = -EINVAL,
196 .ocr_mask = MMC_VDD_165_195,
197 .nonremovable = true,
198 },
199 {} /* Terminator */
200};
201
202static struct regulator_consumer_supply omap4_panda_vmmc5_supply[] = {
203 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.4"),
204};
205
206static struct regulator_init_data panda_vmmc5 = {
207 .constraints = {
208 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
209 },
210 .num_consumer_supplies = ARRAY_SIZE(omap4_panda_vmmc5_supply),
211 .consumer_supplies = omap4_panda_vmmc5_supply,
212};
213
214static struct fixed_voltage_config panda_vwlan = {
215 .supply_name = "vwl1271",
216 .microvolts = 1800000, /* 1.8V */
217 .gpio = GPIO_WIFI_PMENA,
218 .startup_delay = 70000, /* 70msec */
219 .enable_high = 1,
220 .enabled_at_boot = 0,
221 .init_data = &panda_vmmc5,
222};
223
224static struct platform_device omap_vwlan_device = {
225 .name = "reg-fixed-voltage",
226 .id = 1,
227 .dev = {
228 .platform_data = &panda_vwlan,
229 },
230};
231
232static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
233 .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
234};
235
236static struct twl6040_codec_data twl6040_codec = {
237 /* single-step ramp for headset and handsfree */
238 .hs_left_step = 0x0f,
239 .hs_right_step = 0x0f,
240 .hf_left_step = 0x1d,
241 .hf_right_step = 0x1d,
242};
243
244static struct twl6040_platform_data twl6040_data = {
245 .codec = &twl6040_codec,
246 .audpwron_gpio = 127,
247};
248
249static struct i2c_board_info __initdata panda_i2c_1_boardinfo[] = {
250 {
251 I2C_BOARD_INFO("twl6040", 0x4b),
252 .irq = 119 + OMAP44XX_IRQ_GIC_START,
253 .platform_data = &twl6040_data,
254 },
255};
256
257/* Panda board uses the common PMIC configuration */
258static struct twl4030_platform_data omap4_panda_twldata;
259
260/*
261 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
262 * is connected as I2C slave device, and can be accessed at address 0x50
263 */
264static struct i2c_board_info __initdata panda_i2c_eeprom[] = {
265 {
266 I2C_BOARD_INFO("eeprom", 0x50),
267 },
268};
269
270static int __init omap4_panda_i2c_init(void)
271{
272 omap4_pmic_get_config(&omap4_panda_twldata, TWL_COMMON_PDATA_USB,
273 TWL_COMMON_REGULATOR_VDAC |
274 TWL_COMMON_REGULATOR_VAUX2 |
275 TWL_COMMON_REGULATOR_VAUX3 |
276 TWL_COMMON_REGULATOR_VMMC |
277 TWL_COMMON_REGULATOR_VPP |
278 TWL_COMMON_REGULATOR_VANA |
279 TWL_COMMON_REGULATOR_VCXIO |
280 TWL_COMMON_REGULATOR_VUSB |
281 TWL_COMMON_REGULATOR_CLK32KG |
282 TWL_COMMON_REGULATOR_V1V8 |
283 TWL_COMMON_REGULATOR_V2V1);
284 omap4_pmic_init("twl6030", &omap4_panda_twldata, panda_i2c_1_boardinfo,
285 ARRAY_SIZE(panda_i2c_1_boardinfo));
286 omap_register_i2c_bus(2, 400, NULL, 0);
287 /*
288 * Bus 3 is attached to the DVI port where devices like the pico DLP
289 * projector don't work reliably with 400kHz
290 */
291 omap_register_i2c_bus(3, 100, panda_i2c_eeprom,
292 ARRAY_SIZE(panda_i2c_eeprom));
293 omap_register_i2c_bus(4, 400, NULL, 0);
294 return 0;
295}
296
297#ifdef CONFIG_OMAP_MUX
298static struct omap_board_mux board_mux[] __initdata = {
299 /* WLAN IRQ - GPIO 53 */
300 OMAP4_MUX(GPMC_NCS3, OMAP_MUX_MODE3 | OMAP_PIN_INPUT),
301 /* WLAN POWER ENABLE - GPIO 43 */
302 OMAP4_MUX(GPMC_A19, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
303 /* WLAN SDIO: MMC5 CMD */
304 OMAP4_MUX(SDMMC5_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
305 /* WLAN SDIO: MMC5 CLK */
306 OMAP4_MUX(SDMMC5_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
307 /* WLAN SDIO: MMC5 DAT[0-3] */
308 OMAP4_MUX(SDMMC5_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
309 OMAP4_MUX(SDMMC5_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
310 OMAP4_MUX(SDMMC5_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
311 OMAP4_MUX(SDMMC5_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
312 /* gpio 0 - TFP410 PD */
313 OMAP4_MUX(KPD_COL1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE3),
314 /* dispc2_data23 */
315 OMAP4_MUX(USBB2_ULPITLL_STP, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
316 /* dispc2_data22 */
317 OMAP4_MUX(USBB2_ULPITLL_DIR, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
318 /* dispc2_data21 */
319 OMAP4_MUX(USBB2_ULPITLL_NXT, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
320 /* dispc2_data20 */
321 OMAP4_MUX(USBB2_ULPITLL_DAT0, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
322 /* dispc2_data19 */
323 OMAP4_MUX(USBB2_ULPITLL_DAT1, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
324 /* dispc2_data18 */
325 OMAP4_MUX(USBB2_ULPITLL_DAT2, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
326 /* dispc2_data15 */
327 OMAP4_MUX(USBB2_ULPITLL_DAT3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
328 /* dispc2_data14 */
329 OMAP4_MUX(USBB2_ULPITLL_DAT4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
330 /* dispc2_data13 */
331 OMAP4_MUX(USBB2_ULPITLL_DAT5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
332 /* dispc2_data12 */
333 OMAP4_MUX(USBB2_ULPITLL_DAT6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
334 /* dispc2_data11 */
335 OMAP4_MUX(USBB2_ULPITLL_DAT7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
336 /* dispc2_data10 */
337 OMAP4_MUX(DPM_EMU3, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
338 /* dispc2_data9 */
339 OMAP4_MUX(DPM_EMU4, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
340 /* dispc2_data16 */
341 OMAP4_MUX(DPM_EMU5, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
342 /* dispc2_data17 */
343 OMAP4_MUX(DPM_EMU6, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
344 /* dispc2_hsync */
345 OMAP4_MUX(DPM_EMU7, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
346 /* dispc2_pclk */
347 OMAP4_MUX(DPM_EMU8, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
348 /* dispc2_vsync */
349 OMAP4_MUX(DPM_EMU9, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
350 /* dispc2_de */
351 OMAP4_MUX(DPM_EMU10, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
352 /* dispc2_data8 */
353 OMAP4_MUX(DPM_EMU11, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
354 /* dispc2_data7 */
355 OMAP4_MUX(DPM_EMU12, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
356 /* dispc2_data6 */
357 OMAP4_MUX(DPM_EMU13, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
358 /* dispc2_data5 */
359 OMAP4_MUX(DPM_EMU14, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
360 /* dispc2_data4 */
361 OMAP4_MUX(DPM_EMU15, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
362 /* dispc2_data3 */
363 OMAP4_MUX(DPM_EMU16, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
364 /* dispc2_data2 */
365 OMAP4_MUX(DPM_EMU17, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
366 /* dispc2_data1 */
367 OMAP4_MUX(DPM_EMU18, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
368 /* dispc2_data0 */
369 OMAP4_MUX(DPM_EMU19, OMAP_PIN_OUTPUT | OMAP_MUX_MODE5),
370 /* NIRQ2 for twl6040 */
371 OMAP4_MUX(SYS_NIRQ2, OMAP_MUX_MODE0 |
372 OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE),
373 /* GPIO_127 for twl6040 */
374 OMAP4_MUX(HDQ_SIO, OMAP_MUX_MODE3 | OMAP_PIN_OUTPUT),
375 /* McPDM */
376 OMAP4_MUX(ABE_PDM_UL_DATA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
377 OMAP4_MUX(ABE_PDM_DL_DATA, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
378 OMAP4_MUX(ABE_PDM_FRAME, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
379 OMAP4_MUX(ABE_PDM_LB_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
380 OMAP4_MUX(ABE_CLKS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
381 /* McBSP1 */
382 OMAP4_MUX(ABE_MCBSP1_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
383 OMAP4_MUX(ABE_MCBSP1_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
384 OMAP4_MUX(ABE_MCBSP1_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT |
385 OMAP_PULL_ENA),
386 OMAP4_MUX(ABE_MCBSP1_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
387
388 /* UART2 - BT/FM/GPS shared transport */
389 OMAP4_MUX(UART2_CTS, OMAP_PIN_INPUT | OMAP_MUX_MODE0),
390 OMAP4_MUX(UART2_RTS, OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
391 OMAP4_MUX(UART2_RX, OMAP_PIN_INPUT | OMAP_MUX_MODE0),
392 OMAP4_MUX(UART2_TX, OMAP_PIN_OUTPUT | OMAP_MUX_MODE0),
393
394 { .reg_offset = OMAP_MUX_TERMINATOR },
395};
396
397#else
398#define board_mux NULL
399#endif
400
401
402static void omap4_panda_init_rev(void)
403{
404 if (cpu_is_omap443x()) {
405 /* PandaBoard 4430 */
406 /* ASoC audio configuration */
407 panda_abe_audio_data.card_name = "PandaBoard";
408 panda_abe_audio_data.has_hsmic = 1;
409 } else {
410 /* PandaBoard ES */
411 /* ASoC audio configuration */
412 panda_abe_audio_data.card_name = "PandaBoardES";
413 }
414}
415
416static void __init omap4_panda_init(void)
417{
418 int package = OMAP_PACKAGE_CBS;
419 int ret;
420
421 if (omap_rev() == OMAP4430_REV_ES1_0)
422 package = OMAP_PACKAGE_CBL;
423 omap4_mux_init(board_mux, NULL, package);
424
425 omap_panda_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ);
426 ret = wl12xx_set_platform_data(&omap_panda_wlan_data);
427 if (ret)
428 pr_err("error setting wl12xx data: %d\n", ret);
429
430 omap4_panda_init_rev();
431 omap4_panda_i2c_init();
432 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
433 platform_device_register(&omap_vwlan_device);
434 omap_serial_init();
435 omap_sdrc_init(NULL, NULL);
436 omap4_twl6030_hsmmc_init(mmc);
437 omap4_ehci_init();
438 usb_bind_phy("musb-hdrc.2.auto", 0, "omap-usb2.3.auto");
439 usb_musb_init(&musb_board_data);
440 omap4_panda_display_init();
441}
442
443MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
444 /* Maintainer: David Anders - Texas Instruments Inc */
445 .atag_offset = 0x100,
446 .smp = smp_ops(omap4_smp_ops),
447 .reserve = omap_reserve,
448 .map_io = omap4_map_io,
449 .init_early = omap4430_init_early,
450 .init_irq = gic_init_irq,
451 .init_machine = omap4_panda_init,
452 .init_late = omap4430_init_late,
453 .init_time = omap4_local_timer_init,
454 .restart = omap44xx_restart,
455MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 4ca6b680aa72..5748b5d06c23 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -68,6 +68,7 @@
68 68
69#define OVERO_SMSC911X_CS 5 69#define OVERO_SMSC911X_CS 5
70#define OVERO_SMSC911X_GPIO 176 70#define OVERO_SMSC911X_GPIO 176
71#define OVERO_SMSC911X_NRESET 64
71#define OVERO_SMSC911X2_CS 4 72#define OVERO_SMSC911X2_CS 4
72#define OVERO_SMSC911X2_GPIO 65 73#define OVERO_SMSC911X2_GPIO 65
73 74
@@ -122,7 +123,7 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
122 .id = 0, 123 .id = 0,
123 .cs = OVERO_SMSC911X_CS, 124 .cs = OVERO_SMSC911X_CS,
124 .gpio_irq = OVERO_SMSC911X_GPIO, 125 .gpio_irq = OVERO_SMSC911X_GPIO,
125 .gpio_reset = -EINVAL, 126 .gpio_reset = OVERO_SMSC911X_NRESET,
126 .flags = SMSC911X_USE_32BIT, 127 .flags = SMSC911X_USE_32BIT,
127}; 128};
128 129
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 18ca61e300b3..9c2dd102fbbb 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -553,6 +553,7 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {
553 553
554static struct regulator_consumer_supply rx51_vaux1_consumers[] = { 554static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
555 REGULATOR_SUPPLY("vdds_sdi", "omapdss"), 555 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
556 REGULATOR_SUPPLY("vdds_sdi", "omapdss_sdi.0"),
556 /* Si4713 supply */ 557 /* Si4713 supply */
557 REGULATOR_SUPPLY("vdd", "2-0063"), 558 REGULATOR_SUPPLY("vdd", "2-0063"),
558 /* lis3lv02d */ 559 /* lis3lv02d */
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
index af3544ce4f02..ba6534d7f155 100644
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -431,15 +431,11 @@ DEFINE_STRUCT_CLK(aes0_fck, dpll_core_ck_parents, clk_ops_null);
431 * - Driver code is not yet migrated to use hwmod/runtime pm 431 * - Driver code is not yet migrated to use hwmod/runtime pm
432 * - Modules outside kernel access (to disable them by default) 432 * - Modules outside kernel access (to disable them by default)
433 * 433 *
434 * - debugss
435 * - mmu (gfx domain) 434 * - mmu (gfx domain)
436 * - cefuse 435 * - cefuse
437 * - usbotg_fck (its additional clock and not really a modulemode) 436 * - usbotg_fck (its additional clock and not really a modulemode)
438 * - ieee5000 437 * - ieee5000
439 */ 438 */
440DEFINE_CLK_GATE(debugss_ick, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
441 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
442 0x0, NULL);
443 439
444DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0, 440DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
445 AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT, 441 AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
@@ -862,6 +858,69 @@ static struct clk_hw_omap wdt1_fck_hw = {
862 858
863DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops); 859DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
864 860
861static const char *pwmss_clk_parents[] = {
862 "dpll_per_m2_ck",
863};
864
865static const struct clk_ops ehrpwm_tbclk_ops = {
866 .enable = &omap2_dflt_clk_enable,
867 .disable = &omap2_dflt_clk_disable,
868};
869
870DEFINE_CLK_OMAP_MUX_GATE(ehrpwm0_tbclk, "l4ls_clkdm",
871 NULL, NULL, 0,
872 AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
873 AM33XX_PWMSS0_TBCLKEN_SHIFT,
874 NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
875
876DEFINE_CLK_OMAP_MUX_GATE(ehrpwm1_tbclk, "l4ls_clkdm",
877 NULL, NULL, 0,
878 AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
879 AM33XX_PWMSS1_TBCLKEN_SHIFT,
880 NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
881
882DEFINE_CLK_OMAP_MUX_GATE(ehrpwm2_tbclk, "l4ls_clkdm",
883 NULL, NULL, 0,
884 AM33XX_CTRL_REGADDR(AM33XX_PWMSS_TBCLK_CLKCTRL),
885 AM33XX_PWMSS2_TBCLKEN_SHIFT,
886 NULL, pwmss_clk_parents, ehrpwm_tbclk_ops);
887
888/*
889 * debugss optional clocks
890 */
891DEFINE_CLK_GATE(dbg_sysclk_ck, "sys_clkin_ck", &sys_clkin_ck,
892 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
893 AM33XX_OPTFCLKEN_DBGSYSCLK_SHIFT, 0x0, NULL);
894
895DEFINE_CLK_GATE(dbg_clka_ck, "dpll_core_m4_ck", &dpll_core_m4_ck,
896 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
897 AM33XX_OPTCLK_DEBUG_CLKA_SHIFT, 0x0, NULL);
898
899static const char *stm_pmd_clock_mux_ck_parents[] = {
900 "dbg_sysclk_ck", "dbg_clka_ck",
901};
902
903DEFINE_CLK_MUX(stm_pmd_clock_mux_ck, stm_pmd_clock_mux_ck_parents, NULL, 0x0,
904 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_STM_PMD_CLKSEL_SHIFT,
905 AM33XX_STM_PMD_CLKSEL_WIDTH, 0x0, NULL);
906
907DEFINE_CLK_MUX(trace_pmd_clk_mux_ck, stm_pmd_clock_mux_ck_parents, NULL, 0x0,
908 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
909 AM33XX_TRC_PMD_CLKSEL_SHIFT,
910 AM33XX_TRC_PMD_CLKSEL_WIDTH, 0x0, NULL);
911
912DEFINE_CLK_DIVIDER(stm_clk_div_ck, "stm_pmd_clock_mux_ck",
913 &stm_pmd_clock_mux_ck, 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
914 AM33XX_STM_PMD_CLKDIVSEL_SHIFT,
915 AM33XX_STM_PMD_CLKDIVSEL_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
916 NULL);
917
918DEFINE_CLK_DIVIDER(trace_clk_div_ck, "trace_pmd_clk_mux_ck",
919 &trace_pmd_clk_mux_ck, 0x0, AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
920 AM33XX_TRC_PMD_CLKDIVSEL_SHIFT,
921 AM33XX_TRC_PMD_CLKDIVSEL_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
922 NULL);
923
865/* 924/*
866 * clkdev 925 * clkdev
867 */ 926 */
@@ -899,7 +958,6 @@ static struct omap_clk am33xx_clks[] = {
899 CLK("481cc000.d_can", NULL, &dcan0_fck), 958 CLK("481cc000.d_can", NULL, &dcan0_fck),
900 CLK(NULL, "dcan1_fck", &dcan1_fck), 959 CLK(NULL, "dcan1_fck", &dcan1_fck),
901 CLK("481d0000.d_can", NULL, &dcan1_fck), 960 CLK("481d0000.d_can", NULL, &dcan1_fck),
902 CLK(NULL, "debugss_ick", &debugss_ick),
903 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk), 961 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk),
904 CLK(NULL, "mcasp0_fck", &mcasp0_fck), 962 CLK(NULL, "mcasp0_fck", &mcasp0_fck),
905 CLK(NULL, "mcasp1_fck", &mcasp1_fck), 963 CLK(NULL, "mcasp1_fck", &mcasp1_fck),
@@ -942,6 +1000,16 @@ static struct omap_clk am33xx_clks[] = {
942 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck), 1000 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck),
943 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick), 1001 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick),
944 CLK(NULL, "timer_sys_ck", &sys_clkin_ck), 1002 CLK(NULL, "timer_sys_ck", &sys_clkin_ck),
1003 CLK(NULL, "dbg_sysclk_ck", &dbg_sysclk_ck),
1004 CLK(NULL, "dbg_clka_ck", &dbg_clka_ck),
1005 CLK(NULL, "stm_pmd_clock_mux_ck", &stm_pmd_clock_mux_ck),
1006 CLK(NULL, "trace_pmd_clk_mux_ck", &trace_pmd_clk_mux_ck),
1007 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck),
1008 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck),
1009 CLK(NULL, "clkout2_ck", &clkout2_ck),
1010 CLK("48300200.ehrpwm", "tbclk", &ehrpwm0_tbclk),
1011 CLK("48302200.ehrpwm", "tbclk", &ehrpwm1_tbclk),
1012 CLK("48304200.ehrpwm", "tbclk", &ehrpwm2_tbclk),
945}; 1013};
946 1014
947 1015
@@ -952,6 +1020,7 @@ static const char *enable_init_clks[] = {
952 "l4hs_gclk", 1020 "l4hs_gclk",
953 "l4fw_gclk", 1021 "l4fw_gclk",
954 "l4ls_gclk", 1022 "l4ls_gclk",
1023 "clkout2_ck", /* Required for external peripherals like, Audio codecs */
955}; 1024};
956 1025
957int __init am33xx_clk_init(void) 1026int __init am33xx_clk_init(void)
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 45cd26430d1f..334b76745900 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -3329,11 +3329,7 @@ static struct omap_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
3329 CLK(NULL, "cpefuse_fck", &cpefuse_fck), 3329 CLK(NULL, "cpefuse_fck", &cpefuse_fck),
3330 CLK(NULL, "ts_fck", &ts_fck), 3330 CLK(NULL, "ts_fck", &ts_fck),
3331 CLK(NULL, "usbtll_fck", &usbtll_fck), 3331 CLK(NULL, "usbtll_fck", &usbtll_fck),
3332 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck),
3333 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck),
3334 CLK(NULL, "usbtll_ick", &usbtll_ick), 3332 CLK(NULL, "usbtll_ick", &usbtll_ick),
3335 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick),
3336 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick),
3337 CLK("omap_hsmmc.2", "ick", &mmchs3_ick), 3333 CLK("omap_hsmmc.2", "ick", &mmchs3_ick),
3338 CLK(NULL, "mmchs3_ick", &mmchs3_ick), 3334 CLK(NULL, "mmchs3_ick", &mmchs3_ick),
3339 CLK(NULL, "mmchs3_fck", &mmchs3_fck), 3335 CLK(NULL, "mmchs3_fck", &mmchs3_fck),
@@ -3343,7 +3339,6 @@ static struct omap_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
3343 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck), 3339 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck),
3344 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck), 3340 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck),
3345 CLK(NULL, "usbhost_ick", &usbhost_ick), 3341 CLK(NULL, "usbhost_ick", &usbhost_ick),
3346 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick),
3347}; 3342};
3348 3343
3349/* 3344/*
@@ -3463,12 +3458,6 @@ static struct omap_clk omap3xxx_clks[] = {
3463 CLK(NULL, "utmi_p2_gfclk", &dummy_ck), 3458 CLK(NULL, "utmi_p2_gfclk", &dummy_ck),
3464 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck), 3459 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck),
3465 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck), 3460 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck),
3466 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck),
3467 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck),
3468 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck),
3469 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck),
3470 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck),
3471 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck),
3472 CLK(NULL, "init_60m_fclk", &dummy_ck), 3461 CLK(NULL, "init_60m_fclk", &dummy_ck),
3473 CLK(NULL, "gpt1_fck", &gpt1_fck), 3462 CLK(NULL, "gpt1_fck", &gpt1_fck),
3474 CLK(NULL, "aes2_ick", &aes2_ick), 3463 CLK(NULL, "aes2_ick", &aes2_ick),
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index 8f3bf4e50908..bbd6a3f717e6 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -20,11 +20,12 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/clk-provider.h>
23#include <linux/io.h> 24#include <linux/io.h>
24 25
25#include "clock.h" 26#include "clock.h"
26#include "clock36xx.h" 27#include "clock36xx.h"
27 28#define to_clk_divider(_hw) container_of(_hw, struct clk_divider, hw)
28 29
29/** 30/**
30 * omap36xx_pwrdn_clk_enable_with_hsdiv_restore - enable clocks suffering 31 * omap36xx_pwrdn_clk_enable_with_hsdiv_restore - enable clocks suffering
@@ -39,29 +40,28 @@
39 */ 40 */
40int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk) 41int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
41{ 42{
42 struct clk_hw_omap *parent; 43 struct clk_divider *parent;
43 struct clk_hw *parent_hw; 44 struct clk_hw *parent_hw;
44 u32 dummy_v, orig_v, clksel_shift; 45 u32 dummy_v, orig_v;
45 int ret; 46 int ret;
46 47
47 /* Clear PWRDN bit of HSDIVIDER */ 48 /* Clear PWRDN bit of HSDIVIDER */
48 ret = omap2_dflt_clk_enable(clk); 49 ret = omap2_dflt_clk_enable(clk);
49 50
50 parent_hw = __clk_get_hw(__clk_get_parent(clk->clk)); 51 parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
51 parent = to_clk_hw_omap(parent_hw); 52 parent = to_clk_divider(parent_hw);
52 53
53 /* Restore the dividers */ 54 /* Restore the dividers */
54 if (!ret) { 55 if (!ret) {
55 clksel_shift = __ffs(parent->clksel_mask); 56 orig_v = __raw_readl(parent->reg);
56 orig_v = __raw_readl(parent->clksel_reg);
57 dummy_v = orig_v; 57 dummy_v = orig_v;
58 58
59 /* Write any other value different from the Read value */ 59 /* Write any other value different from the Read value */
60 dummy_v ^= (1 << clksel_shift); 60 dummy_v ^= (1 << parent->shift);
61 __raw_writel(dummy_v, parent->clksel_reg); 61 __raw_writel(dummy_v, parent->reg);
62 62
63 /* Write the original divider */ 63 /* Write the original divider */
64 __raw_writel(orig_v, parent->clksel_reg); 64 __raw_writel(orig_v, parent->reg);
65 } 65 }
66 66
67 return ret; 67 return ret;
diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h
index 2da37656a693..daeecf1b89fa 100644
--- a/arch/arm/mach-omap2/clockdomain.h
+++ b/arch/arm/mach-omap2/clockdomain.h
@@ -216,6 +216,7 @@ extern void __init omap243x_clockdomains_init(void);
216extern void __init omap3xxx_clockdomains_init(void); 216extern void __init omap3xxx_clockdomains_init(void);
217extern void __init am33xx_clockdomains_init(void); 217extern void __init am33xx_clockdomains_init(void);
218extern void __init omap44xx_clockdomains_init(void); 218extern void __init omap44xx_clockdomains_init(void);
219extern void __init omap54xx_clockdomains_init(void);
219 220
220extern void clkdm_add_autodeps(struct clockdomain *clkdm); 221extern void clkdm_add_autodeps(struct clockdomain *clkdm);
221extern void clkdm_del_autodeps(struct clockdomain *clkdm); 222extern void clkdm_del_autodeps(struct clockdomain *clkdm);
diff --git a/arch/arm/mach-omap2/clockdomains54xx_data.c b/arch/arm/mach-omap2/clockdomains54xx_data.c
new file mode 100644
index 000000000000..1a3c69d2e14c
--- /dev/null
+++ b/arch/arm/mach-omap2/clockdomains54xx_data.c
@@ -0,0 +1,464 @@
1/*
2 * OMAP54XX Clock domains framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * Abhijit Pagare (abhijitpagare@ti.com)
7 * Benoit Cousson (b-cousson@ti.com)
8 * Paul Walmsley (paul@pwsan.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#include <linux/kernel.h>
22#include <linux/io.h>
23
24#include "clockdomain.h"
25#include "cm1_54xx.h"
26#include "cm2_54xx.h"
27
28#include "cm-regbits-54xx.h"
29#include "prm54xx.h"
30#include "prcm44xx.h"
31#include "prcm_mpu54xx.h"
32
33/* Static Dependencies for OMAP4 Clock Domains */
34
35static struct clkdm_dep c2c_wkup_sleep_deps[] = {
36 { .clkdm_name = "abe_clkdm" },
37 { .clkdm_name = "emif_clkdm" },
38 { .clkdm_name = "iva_clkdm" },
39 { .clkdm_name = "l3init_clkdm" },
40 { .clkdm_name = "l3main1_clkdm" },
41 { .clkdm_name = "l3main2_clkdm" },
42 { .clkdm_name = "l4cfg_clkdm" },
43 { .clkdm_name = "l4per_clkdm" },
44 { NULL },
45};
46
47static struct clkdm_dep cam_wkup_sleep_deps[] = {
48 { .clkdm_name = "emif_clkdm" },
49 { .clkdm_name = "iva_clkdm" },
50 { .clkdm_name = "l3main1_clkdm" },
51 { NULL },
52};
53
54static struct clkdm_dep dma_wkup_sleep_deps[] = {
55 { .clkdm_name = "abe_clkdm" },
56 { .clkdm_name = "dss_clkdm" },
57 { .clkdm_name = "emif_clkdm" },
58 { .clkdm_name = "ipu_clkdm" },
59 { .clkdm_name = "iva_clkdm" },
60 { .clkdm_name = "l3init_clkdm" },
61 { .clkdm_name = "l3main1_clkdm" },
62 { .clkdm_name = "l4cfg_clkdm" },
63 { .clkdm_name = "l4per_clkdm" },
64 { .clkdm_name = "l4sec_clkdm" },
65 { .clkdm_name = "wkupaon_clkdm" },
66 { NULL },
67};
68
69static struct clkdm_dep dsp_wkup_sleep_deps[] = {
70 { .clkdm_name = "abe_clkdm" },
71 { .clkdm_name = "emif_clkdm" },
72 { .clkdm_name = "iva_clkdm" },
73 { .clkdm_name = "l3init_clkdm" },
74 { .clkdm_name = "l3main1_clkdm" },
75 { .clkdm_name = "l3main2_clkdm" },
76 { .clkdm_name = "l4cfg_clkdm" },
77 { .clkdm_name = "l4per_clkdm" },
78 { .clkdm_name = "wkupaon_clkdm" },
79 { NULL },
80};
81
82static struct clkdm_dep dss_wkup_sleep_deps[] = {
83 { .clkdm_name = "emif_clkdm" },
84 { .clkdm_name = "iva_clkdm" },
85 { .clkdm_name = "l3main2_clkdm" },
86 { NULL },
87};
88
89static struct clkdm_dep gpu_wkup_sleep_deps[] = {
90 { .clkdm_name = "emif_clkdm" },
91 { .clkdm_name = "iva_clkdm" },
92 { .clkdm_name = "l3main1_clkdm" },
93 { NULL },
94};
95
96static struct clkdm_dep ipu_wkup_sleep_deps[] = {
97 { .clkdm_name = "abe_clkdm" },
98 { .clkdm_name = "dsp_clkdm" },
99 { .clkdm_name = "dss_clkdm" },
100 { .clkdm_name = "emif_clkdm" },
101 { .clkdm_name = "gpu_clkdm" },
102 { .clkdm_name = "iva_clkdm" },
103 { .clkdm_name = "l3init_clkdm" },
104 { .clkdm_name = "l3main1_clkdm" },
105 { .clkdm_name = "l3main2_clkdm" },
106 { .clkdm_name = "l4cfg_clkdm" },
107 { .clkdm_name = "l4per_clkdm" },
108 { .clkdm_name = "l4sec_clkdm" },
109 { .clkdm_name = "wkupaon_clkdm" },
110 { NULL },
111};
112
113static struct clkdm_dep iva_wkup_sleep_deps[] = {
114 { .clkdm_name = "emif_clkdm" },
115 { .clkdm_name = "l3main1_clkdm" },
116 { NULL },
117};
118
119static struct clkdm_dep l3init_wkup_sleep_deps[] = {
120 { .clkdm_name = "abe_clkdm" },
121 { .clkdm_name = "emif_clkdm" },
122 { .clkdm_name = "iva_clkdm" },
123 { .clkdm_name = "l4cfg_clkdm" },
124 { .clkdm_name = "l4per_clkdm" },
125 { .clkdm_name = "l4sec_clkdm" },
126 { .clkdm_name = "wkupaon_clkdm" },
127 { NULL },
128};
129
130static struct clkdm_dep l4sec_wkup_sleep_deps[] = {
131 { .clkdm_name = "emif_clkdm" },
132 { .clkdm_name = "l3main1_clkdm" },
133 { .clkdm_name = "l4per_clkdm" },
134 { NULL },
135};
136
137static struct clkdm_dep mipiext_wkup_sleep_deps[] = {
138 { .clkdm_name = "abe_clkdm" },
139 { .clkdm_name = "emif_clkdm" },
140 { .clkdm_name = "iva_clkdm" },
141 { .clkdm_name = "l3init_clkdm" },
142 { .clkdm_name = "l3main1_clkdm" },
143 { .clkdm_name = "l3main2_clkdm" },
144 { .clkdm_name = "l4cfg_clkdm" },
145 { .clkdm_name = "l4per_clkdm" },
146 { NULL },
147};
148
149static struct clkdm_dep mpu_wkup_sleep_deps[] = {
150 { .clkdm_name = "abe_clkdm" },
151 { .clkdm_name = "dsp_clkdm" },
152 { .clkdm_name = "dss_clkdm" },
153 { .clkdm_name = "emif_clkdm" },
154 { .clkdm_name = "gpu_clkdm" },
155 { .clkdm_name = "ipu_clkdm" },
156 { .clkdm_name = "iva_clkdm" },
157 { .clkdm_name = "l3init_clkdm" },
158 { .clkdm_name = "l3main1_clkdm" },
159 { .clkdm_name = "l3main2_clkdm" },
160 { .clkdm_name = "l4cfg_clkdm" },
161 { .clkdm_name = "l4per_clkdm" },
162 { .clkdm_name = "l4sec_clkdm" },
163 { .clkdm_name = "wkupaon_clkdm" },
164 { NULL },
165};
166
167static struct clockdomain l4sec_54xx_clkdm = {
168 .name = "l4sec_clkdm",
169 .pwrdm = { .name = "core_pwrdm" },
170 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
171 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
172 .clkdm_offs = OMAP54XX_CM_CORE_CORE_L4SEC_CDOFFS,
173 .dep_bit = OMAP54XX_L4SEC_STATDEP_SHIFT,
174 .wkdep_srcs = l4sec_wkup_sleep_deps,
175 .sleepdep_srcs = l4sec_wkup_sleep_deps,
176 .flags = CLKDM_CAN_HWSUP_SWSUP,
177};
178
179static struct clockdomain iva_54xx_clkdm = {
180 .name = "iva_clkdm",
181 .pwrdm = { .name = "iva_pwrdm" },
182 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
183 .cm_inst = OMAP54XX_CM_CORE_IVA_INST,
184 .clkdm_offs = OMAP54XX_CM_CORE_IVA_IVA_CDOFFS,
185 .dep_bit = OMAP54XX_IVA_STATDEP_SHIFT,
186 .wkdep_srcs = iva_wkup_sleep_deps,
187 .sleepdep_srcs = iva_wkup_sleep_deps,
188 .flags = CLKDM_CAN_HWSUP_SWSUP,
189};
190
191static struct clockdomain mipiext_54xx_clkdm = {
192 .name = "mipiext_clkdm",
193 .pwrdm = { .name = "core_pwrdm" },
194 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
195 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
196 .clkdm_offs = OMAP54XX_CM_CORE_CORE_MIPIEXT_CDOFFS,
197 .wkdep_srcs = mipiext_wkup_sleep_deps,
198 .sleepdep_srcs = mipiext_wkup_sleep_deps,
199 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
200};
201
202static struct clockdomain l3main2_54xx_clkdm = {
203 .name = "l3main2_clkdm",
204 .pwrdm = { .name = "core_pwrdm" },
205 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
206 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
207 .clkdm_offs = OMAP54XX_CM_CORE_CORE_L3MAIN2_CDOFFS,
208 .dep_bit = OMAP54XX_L3MAIN2_STATDEP_SHIFT,
209 .flags = CLKDM_CAN_HWSUP,
210};
211
212static struct clockdomain l3main1_54xx_clkdm = {
213 .name = "l3main1_clkdm",
214 .pwrdm = { .name = "core_pwrdm" },
215 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
216 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
217 .clkdm_offs = OMAP54XX_CM_CORE_CORE_L3MAIN1_CDOFFS,
218 .dep_bit = OMAP54XX_L3MAIN1_STATDEP_SHIFT,
219 .flags = CLKDM_CAN_HWSUP,
220};
221
222static struct clockdomain custefuse_54xx_clkdm = {
223 .name = "custefuse_clkdm",
224 .pwrdm = { .name = "custefuse_pwrdm" },
225 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
226 .cm_inst = OMAP54XX_CM_CORE_CUSTEFUSE_INST,
227 .clkdm_offs = OMAP54XX_CM_CORE_CUSTEFUSE_CUSTEFUSE_CDOFFS,
228 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
229};
230
231static struct clockdomain ipu_54xx_clkdm = {
232 .name = "ipu_clkdm",
233 .pwrdm = { .name = "core_pwrdm" },
234 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
235 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
236 .clkdm_offs = OMAP54XX_CM_CORE_CORE_IPU_CDOFFS,
237 .dep_bit = OMAP54XX_IPU_STATDEP_SHIFT,
238 .wkdep_srcs = ipu_wkup_sleep_deps,
239 .sleepdep_srcs = ipu_wkup_sleep_deps,
240 .flags = CLKDM_CAN_HWSUP_SWSUP,
241};
242
243static struct clockdomain l4cfg_54xx_clkdm = {
244 .name = "l4cfg_clkdm",
245 .pwrdm = { .name = "core_pwrdm" },
246 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
247 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
248 .clkdm_offs = OMAP54XX_CM_CORE_CORE_L4CFG_CDOFFS,
249 .dep_bit = OMAP54XX_L4CFG_STATDEP_SHIFT,
250 .flags = CLKDM_CAN_HWSUP,
251};
252
253static struct clockdomain abe_54xx_clkdm = {
254 .name = "abe_clkdm",
255 .pwrdm = { .name = "abe_pwrdm" },
256 .prcm_partition = OMAP54XX_CM_CORE_AON_PARTITION,
257 .cm_inst = OMAP54XX_CM_CORE_AON_ABE_INST,
258 .clkdm_offs = OMAP54XX_CM_CORE_AON_ABE_ABE_CDOFFS,
259 .dep_bit = OMAP54XX_ABE_STATDEP_SHIFT,
260 .flags = CLKDM_CAN_HWSUP_SWSUP,
261};
262
263static struct clockdomain dss_54xx_clkdm = {
264 .name = "dss_clkdm",
265 .pwrdm = { .name = "dss_pwrdm" },
266 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
267 .cm_inst = OMAP54XX_CM_CORE_DSS_INST,
268 .clkdm_offs = OMAP54XX_CM_CORE_DSS_DSS_CDOFFS,
269 .dep_bit = OMAP54XX_DSS_STATDEP_SHIFT,
270 .wkdep_srcs = dss_wkup_sleep_deps,
271 .sleepdep_srcs = dss_wkup_sleep_deps,
272 .flags = CLKDM_CAN_HWSUP_SWSUP,
273};
274
275static struct clockdomain dsp_54xx_clkdm = {
276 .name = "dsp_clkdm",
277 .pwrdm = { .name = "dsp_pwrdm" },
278 .prcm_partition = OMAP54XX_CM_CORE_AON_PARTITION,
279 .cm_inst = OMAP54XX_CM_CORE_AON_DSP_INST,
280 .clkdm_offs = OMAP54XX_CM_CORE_AON_DSP_DSP_CDOFFS,
281 .dep_bit = OMAP54XX_DSP_STATDEP_SHIFT,
282 .wkdep_srcs = dsp_wkup_sleep_deps,
283 .sleepdep_srcs = dsp_wkup_sleep_deps,
284 .flags = CLKDM_CAN_HWSUP_SWSUP,
285};
286
287static struct clockdomain c2c_54xx_clkdm = {
288 .name = "c2c_clkdm",
289 .pwrdm = { .name = "core_pwrdm" },
290 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
291 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
292 .clkdm_offs = OMAP54XX_CM_CORE_CORE_C2C_CDOFFS,
293 .wkdep_srcs = c2c_wkup_sleep_deps,
294 .sleepdep_srcs = c2c_wkup_sleep_deps,
295 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
296};
297
298static struct clockdomain l4per_54xx_clkdm = {
299 .name = "l4per_clkdm",
300 .pwrdm = { .name = "core_pwrdm" },
301 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
302 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
303 .clkdm_offs = OMAP54XX_CM_CORE_CORE_L4PER_CDOFFS,
304 .dep_bit = OMAP54XX_L4PER_STATDEP_SHIFT,
305 .flags = CLKDM_CAN_HWSUP_SWSUP,
306};
307
308static struct clockdomain gpu_54xx_clkdm = {
309 .name = "gpu_clkdm",
310 .pwrdm = { .name = "gpu_pwrdm" },
311 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
312 .cm_inst = OMAP54XX_CM_CORE_GPU_INST,
313 .clkdm_offs = OMAP54XX_CM_CORE_GPU_GPU_CDOFFS,
314 .dep_bit = OMAP54XX_GPU_STATDEP_SHIFT,
315 .wkdep_srcs = gpu_wkup_sleep_deps,
316 .sleepdep_srcs = gpu_wkup_sleep_deps,
317 .flags = CLKDM_CAN_HWSUP_SWSUP,
318};
319
320static struct clockdomain wkupaon_54xx_clkdm = {
321 .name = "wkupaon_clkdm",
322 .pwrdm = { .name = "wkupaon_pwrdm" },
323 .prcm_partition = OMAP54XX_PRM_PARTITION,
324 .cm_inst = OMAP54XX_PRM_WKUPAON_CM_INST,
325 .clkdm_offs = OMAP54XX_PRM_WKUPAON_CM_WKUPAON_CDOFFS,
326 .dep_bit = OMAP54XX_WKUPAON_STATDEP_SHIFT,
327 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
328};
329
330static struct clockdomain mpu0_54xx_clkdm = {
331 .name = "mpu0_clkdm",
332 .pwrdm = { .name = "cpu0_pwrdm" },
333 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION,
334 .cm_inst = OMAP54XX_PRCM_MPU_CM_C0_INST,
335 .clkdm_offs = OMAP54XX_PRCM_MPU_CM_C0_CPU0_CDOFFS,
336 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
337};
338
339static struct clockdomain mpu1_54xx_clkdm = {
340 .name = "mpu1_clkdm",
341 .pwrdm = { .name = "cpu1_pwrdm" },
342 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION,
343 .cm_inst = OMAP54XX_PRCM_MPU_CM_C1_INST,
344 .clkdm_offs = OMAP54XX_PRCM_MPU_CM_C1_CPU1_CDOFFS,
345 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
346};
347
348static struct clockdomain coreaon_54xx_clkdm = {
349 .name = "coreaon_clkdm",
350 .pwrdm = { .name = "coreaon_pwrdm" },
351 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
352 .cm_inst = OMAP54XX_CM_CORE_COREAON_INST,
353 .clkdm_offs = OMAP54XX_CM_CORE_COREAON_COREAON_CDOFFS,
354 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
355};
356
357static struct clockdomain mpu_54xx_clkdm = {
358 .name = "mpu_clkdm",
359 .pwrdm = { .name = "mpu_pwrdm" },
360 .prcm_partition = OMAP54XX_CM_CORE_AON_PARTITION,
361 .cm_inst = OMAP54XX_CM_CORE_AON_MPU_INST,
362 .clkdm_offs = OMAP54XX_CM_CORE_AON_MPU_MPU_CDOFFS,
363 .wkdep_srcs = mpu_wkup_sleep_deps,
364 .sleepdep_srcs = mpu_wkup_sleep_deps,
365 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
366};
367
368static struct clockdomain l3init_54xx_clkdm = {
369 .name = "l3init_clkdm",
370 .pwrdm = { .name = "l3init_pwrdm" },
371 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
372 .cm_inst = OMAP54XX_CM_CORE_L3INIT_INST,
373 .clkdm_offs = OMAP54XX_CM_CORE_L3INIT_L3INIT_CDOFFS,
374 .dep_bit = OMAP54XX_L3INIT_STATDEP_SHIFT,
375 .wkdep_srcs = l3init_wkup_sleep_deps,
376 .sleepdep_srcs = l3init_wkup_sleep_deps,
377 .flags = CLKDM_CAN_HWSUP_SWSUP,
378};
379
380static struct clockdomain dma_54xx_clkdm = {
381 .name = "dma_clkdm",
382 .pwrdm = { .name = "core_pwrdm" },
383 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
384 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
385 .clkdm_offs = OMAP54XX_CM_CORE_CORE_DMA_CDOFFS,
386 .wkdep_srcs = dma_wkup_sleep_deps,
387 .sleepdep_srcs = dma_wkup_sleep_deps,
388 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
389};
390
391static struct clockdomain l3instr_54xx_clkdm = {
392 .name = "l3instr_clkdm",
393 .pwrdm = { .name = "core_pwrdm" },
394 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
395 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
396 .clkdm_offs = OMAP54XX_CM_CORE_CORE_L3INSTR_CDOFFS,
397};
398
399static struct clockdomain emif_54xx_clkdm = {
400 .name = "emif_clkdm",
401 .pwrdm = { .name = "core_pwrdm" },
402 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
403 .cm_inst = OMAP54XX_CM_CORE_CORE_INST,
404 .clkdm_offs = OMAP54XX_CM_CORE_CORE_EMIF_CDOFFS,
405 .dep_bit = OMAP54XX_EMIF_STATDEP_SHIFT,
406 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
407};
408
409static struct clockdomain emu_54xx_clkdm = {
410 .name = "emu_clkdm",
411 .pwrdm = { .name = "emu_pwrdm" },
412 .prcm_partition = OMAP54XX_PRM_PARTITION,
413 .cm_inst = OMAP54XX_PRM_EMU_CM_INST,
414 .clkdm_offs = OMAP54XX_PRM_EMU_CM_EMU_CDOFFS,
415 .flags = CLKDM_CAN_FORCE_WAKEUP | CLKDM_CAN_HWSUP,
416};
417
418static struct clockdomain cam_54xx_clkdm = {
419 .name = "cam_clkdm",
420 .pwrdm = { .name = "cam_pwrdm" },
421 .prcm_partition = OMAP54XX_CM_CORE_PARTITION,
422 .cm_inst = OMAP54XX_CM_CORE_CAM_INST,
423 .clkdm_offs = OMAP54XX_CM_CORE_CAM_CAM_CDOFFS,
424 .wkdep_srcs = cam_wkup_sleep_deps,
425 .sleepdep_srcs = cam_wkup_sleep_deps,
426 .flags = CLKDM_CAN_HWSUP_SWSUP,
427};
428
429/* As clockdomains are added or removed above, this list must also be changed */
430static struct clockdomain *clockdomains_omap54xx[] __initdata = {
431 &l4sec_54xx_clkdm,
432 &iva_54xx_clkdm,
433 &mipiext_54xx_clkdm,
434 &l3main2_54xx_clkdm,
435 &l3main1_54xx_clkdm,
436 &custefuse_54xx_clkdm,
437 &ipu_54xx_clkdm,
438 &l4cfg_54xx_clkdm,
439 &abe_54xx_clkdm,
440 &dss_54xx_clkdm,
441 &dsp_54xx_clkdm,
442 &c2c_54xx_clkdm,
443 &l4per_54xx_clkdm,
444 &gpu_54xx_clkdm,
445 &wkupaon_54xx_clkdm,
446 &mpu0_54xx_clkdm,
447 &mpu1_54xx_clkdm,
448 &coreaon_54xx_clkdm,
449 &mpu_54xx_clkdm,
450 &l3init_54xx_clkdm,
451 &dma_54xx_clkdm,
452 &l3instr_54xx_clkdm,
453 &emif_54xx_clkdm,
454 &emu_54xx_clkdm,
455 &cam_54xx_clkdm,
456 NULL
457};
458
459void __init omap54xx_clockdomains_init(void)
460{
461 clkdm_register_platform_funcs(&omap4_clkdm_operations);
462 clkdm_register_clkdms(clockdomains_omap54xx);
463 clkdm_complete_init();
464}
diff --git a/arch/arm/mach-omap2/cm-regbits-54xx.h b/arch/arm/mach-omap2/cm-regbits-54xx.h
new file mode 100644
index 000000000000..e83b8e352b6e
--- /dev/null
+++ b/arch/arm/mach-omap2/cm-regbits-54xx.h
@@ -0,0 +1,1737 @@
1/*
2 * OMAP54xx Clock Management register bits
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley (paul@pwsan.com)
7 * Rajendra Nayak (rnayak@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#ifndef __ARCH_ARM_MACH_OMAP2_CM_REGBITS_54XX_H
22#define __ARCH_ARM_MACH_OMAP2_CM_REGBITS_54XX_H
23
24/* Used by CM_DSP_DYNAMICDEP, CM_L3MAIN1_DYNAMICDEP, CM_MPU_DYNAMICDEP */
25#define OMAP54XX_ABE_DYNDEP_SHIFT 3
26#define OMAP54XX_ABE_DYNDEP_WIDTH 0x1
27#define OMAP54XX_ABE_DYNDEP_MASK (1 << 3)
28
29/*
30 * Used by CM_C2C_STATICDEP, CM_DMA_STATICDEP, CM_DSP_STATICDEP,
31 * CM_IPU_STATICDEP, CM_L3INIT_STATICDEP, CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
32 */
33#define OMAP54XX_ABE_STATDEP_SHIFT 3
34#define OMAP54XX_ABE_STATDEP_WIDTH 0x1
35#define OMAP54XX_ABE_STATDEP_MASK (1 << 3)
36
37/*
38 * Used by CM_AUTOIDLE_DPLL_ABE, CM_AUTOIDLE_DPLL_CORE, CM_AUTOIDLE_DPLL_IVA,
39 * CM_AUTOIDLE_DPLL_MPU, CM_AUTOIDLE_DPLL_PER, CM_AUTOIDLE_DPLL_UNIPRO1,
40 * CM_AUTOIDLE_DPLL_UNIPRO2, CM_AUTOIDLE_DPLL_USB
41 */
42#define OMAP54XX_AUTO_DPLL_MODE_SHIFT 0
43#define OMAP54XX_AUTO_DPLL_MODE_WIDTH 0x3
44#define OMAP54XX_AUTO_DPLL_MODE_MASK (0x7 << 0)
45
46/* Used by CM_L3MAIN2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
47#define OMAP54XX_C2C_DYNDEP_SHIFT 18
48#define OMAP54XX_C2C_DYNDEP_WIDTH 0x1
49#define OMAP54XX_C2C_DYNDEP_MASK (1 << 18)
50
51/* Used by CM_MPU_STATICDEP */
52#define OMAP54XX_C2C_STATDEP_SHIFT 18
53#define OMAP54XX_C2C_STATDEP_WIDTH 0x1
54#define OMAP54XX_C2C_STATDEP_MASK (1 << 18)
55
56/* Used by CM_IPU_DYNAMICDEP, CM_L3MAIN2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
57#define OMAP54XX_CAM_DYNDEP_SHIFT 9
58#define OMAP54XX_CAM_DYNDEP_WIDTH 0x1
59#define OMAP54XX_CAM_DYNDEP_MASK (1 << 9)
60
61/*
62 * Used by CM_DMA_STATICDEP, CM_DSP_STATICDEP, CM_IPU_STATICDEP,
63 * CM_MPU_STATICDEP
64 */
65#define OMAP54XX_CAM_STATDEP_SHIFT 9
66#define OMAP54XX_CAM_STATDEP_WIDTH 0x1
67#define OMAP54XX_CAM_STATDEP_MASK (1 << 9)
68
69/* Used by CM_ABE_CLKSTCTRL */
70#define OMAP54XX_CLKACTIVITY_ABE_24M_GFCLK_SHIFT 13
71#define OMAP54XX_CLKACTIVITY_ABE_24M_GFCLK_WIDTH 0x1
72#define OMAP54XX_CLKACTIVITY_ABE_24M_GFCLK_MASK (1 << 13)
73
74/* Used by CM_ABE_CLKSTCTRL */
75#define OMAP54XX_CLKACTIVITY_ABE_32K_CLK_SHIFT 12
76#define OMAP54XX_CLKACTIVITY_ABE_32K_CLK_WIDTH 0x1
77#define OMAP54XX_CLKACTIVITY_ABE_32K_CLK_MASK (1 << 12)
78
79/* Used by CM_ABE_CLKSTCTRL */
80#define OMAP54XX_CLKACTIVITY_ABE_GICLK_SHIFT 9
81#define OMAP54XX_CLKACTIVITY_ABE_GICLK_WIDTH 0x1
82#define OMAP54XX_CLKACTIVITY_ABE_GICLK_MASK (1 << 9)
83
84/* Used by CM_WKUPAON_CLKSTCTRL */
85#define OMAP54XX_CLKACTIVITY_ABE_LP_CLK_SHIFT 9
86#define OMAP54XX_CLKACTIVITY_ABE_LP_CLK_WIDTH 0x1
87#define OMAP54XX_CLKACTIVITY_ABE_LP_CLK_MASK (1 << 9)
88
89/* Used by CM_ABE_CLKSTCTRL */
90#define OMAP54XX_CLKACTIVITY_ABE_SYS_CLK_SHIFT 11
91#define OMAP54XX_CLKACTIVITY_ABE_SYS_CLK_WIDTH 0x1
92#define OMAP54XX_CLKACTIVITY_ABE_SYS_CLK_MASK (1 << 11)
93
94/* Used by CM_ABE_CLKSTCTRL */
95#define OMAP54XX_CLKACTIVITY_ABE_X2_CLK_SHIFT 8
96#define OMAP54XX_CLKACTIVITY_ABE_X2_CLK_WIDTH 0x1
97#define OMAP54XX_CLKACTIVITY_ABE_X2_CLK_MASK (1 << 8)
98
99/* Used by CM_DSS_CLKSTCTRL */
100#define OMAP54XX_CLKACTIVITY_BB2D_GFCLK_SHIFT 13
101#define OMAP54XX_CLKACTIVITY_BB2D_GFCLK_WIDTH 0x1
102#define OMAP54XX_CLKACTIVITY_BB2D_GFCLK_MASK (1 << 13)
103
104/* Used by CM_C2C_CLKSTCTRL */
105#define OMAP54XX_CLKACTIVITY_C2C_GFCLK_SHIFT 9
106#define OMAP54XX_CLKACTIVITY_C2C_GFCLK_WIDTH 0x1
107#define OMAP54XX_CLKACTIVITY_C2C_GFCLK_MASK (1 << 9)
108
109/* Used by CM_C2C_CLKSTCTRL */
110#define OMAP54XX_CLKACTIVITY_C2C_GICLK_SHIFT 10
111#define OMAP54XX_CLKACTIVITY_C2C_GICLK_WIDTH 0x1
112#define OMAP54XX_CLKACTIVITY_C2C_GICLK_MASK (1 << 10)
113
114/* Used by CM_C2C_CLKSTCTRL */
115#define OMAP54XX_CLKACTIVITY_C2C_L4_GICLK_SHIFT 8
116#define OMAP54XX_CLKACTIVITY_C2C_L4_GICLK_WIDTH 0x1
117#define OMAP54XX_CLKACTIVITY_C2C_L4_GICLK_MASK (1 << 8)
118
119/* Used by CM_CAM_CLKSTCTRL */
120#define OMAP54XX_CLKACTIVITY_CAM_BOOST_GCLK_SHIFT 11
121#define OMAP54XX_CLKACTIVITY_CAM_BOOST_GCLK_WIDTH 0x1
122#define OMAP54XX_CLKACTIVITY_CAM_BOOST_GCLK_MASK (1 << 11)
123
124/* Used by CM_CAM_CLKSTCTRL */
125#define OMAP54XX_CLKACTIVITY_CAM_GCLK_SHIFT 8
126#define OMAP54XX_CLKACTIVITY_CAM_GCLK_WIDTH 0x1
127#define OMAP54XX_CLKACTIVITY_CAM_GCLK_MASK (1 << 8)
128
129/* Used by CM_CAM_CLKSTCTRL */
130#define OMAP54XX_CLKACTIVITY_CAM_L3_GICLK_SHIFT 12
131#define OMAP54XX_CLKACTIVITY_CAM_L3_GICLK_WIDTH 0x1
132#define OMAP54XX_CLKACTIVITY_CAM_L3_GICLK_MASK (1 << 12)
133
134/* Used by CM_COREAON_CLKSTCTRL */
135#define OMAP54XX_CLKACTIVITY_COREAON_32K_GFCLK_SHIFT 12
136#define OMAP54XX_CLKACTIVITY_COREAON_32K_GFCLK_WIDTH 0x1
137#define OMAP54XX_CLKACTIVITY_COREAON_32K_GFCLK_MASK (1 << 12)
138
139/* Used by CM_COREAON_CLKSTCTRL */
140#define OMAP54XX_CLKACTIVITY_COREAON_IO_SRCOMP_GFCLK_SHIFT 14
141#define OMAP54XX_CLKACTIVITY_COREAON_IO_SRCOMP_GFCLK_WIDTH 0x1
142#define OMAP54XX_CLKACTIVITY_COREAON_IO_SRCOMP_GFCLK_MASK (1 << 14)
143
144/* Used by CM_COREAON_CLKSTCTRL */
145#define OMAP54XX_CLKACTIVITY_COREAON_L4_GICLK_SHIFT 8
146#define OMAP54XX_CLKACTIVITY_COREAON_L4_GICLK_WIDTH 0x1
147#define OMAP54XX_CLKACTIVITY_COREAON_L4_GICLK_MASK (1 << 8)
148
149/* Used by CM_CAM_CLKSTCTRL */
150#define OMAP54XX_CLKACTIVITY_CSI_PHY_GFCLK_SHIFT 9
151#define OMAP54XX_CLKACTIVITY_CSI_PHY_GFCLK_WIDTH 0x1
152#define OMAP54XX_CLKACTIVITY_CSI_PHY_GFCLK_MASK (1 << 9)
153
154/* Used by CM_CUSTEFUSE_CLKSTCTRL */
155#define OMAP54XX_CLKACTIVITY_CUSTEFUSE_L4_GICLK_SHIFT 8
156#define OMAP54XX_CLKACTIVITY_CUSTEFUSE_L4_GICLK_WIDTH 0x1
157#define OMAP54XX_CLKACTIVITY_CUSTEFUSE_L4_GICLK_MASK (1 << 8)
158
159/* Used by CM_CUSTEFUSE_CLKSTCTRL */
160#define OMAP54XX_CLKACTIVITY_CUSTEFUSE_SYS_GFCLK_SHIFT 9
161#define OMAP54XX_CLKACTIVITY_CUSTEFUSE_SYS_GFCLK_WIDTH 0x1
162#define OMAP54XX_CLKACTIVITY_CUSTEFUSE_SYS_GFCLK_MASK (1 << 9)
163
164/* Used by CM_EMIF_CLKSTCTRL */
165#define OMAP54XX_CLKACTIVITY_DLL_GCLK_SHIFT 9
166#define OMAP54XX_CLKACTIVITY_DLL_GCLK_WIDTH 0x1
167#define OMAP54XX_CLKACTIVITY_DLL_GCLK_MASK (1 << 9)
168
169/* Used by CM_DMA_CLKSTCTRL */
170#define OMAP54XX_CLKACTIVITY_DMA_L3_GICLK_SHIFT 8
171#define OMAP54XX_CLKACTIVITY_DMA_L3_GICLK_WIDTH 0x1
172#define OMAP54XX_CLKACTIVITY_DMA_L3_GICLK_MASK (1 << 8)
173
174/* Used by CM_DSP_CLKSTCTRL */
175#define OMAP54XX_CLKACTIVITY_DSP_GCLK_SHIFT 8
176#define OMAP54XX_CLKACTIVITY_DSP_GCLK_WIDTH 0x1
177#define OMAP54XX_CLKACTIVITY_DSP_GCLK_MASK (1 << 8)
178
179/* Used by CM_DSS_CLKSTCTRL */
180#define OMAP54XX_CLKACTIVITY_DSS_GFCLK_SHIFT 9
181#define OMAP54XX_CLKACTIVITY_DSS_GFCLK_WIDTH 0x1
182#define OMAP54XX_CLKACTIVITY_DSS_GFCLK_MASK (1 << 9)
183
184/* Used by CM_DSS_CLKSTCTRL */
185#define OMAP54XX_CLKACTIVITY_DSS_L3_GICLK_SHIFT 8
186#define OMAP54XX_CLKACTIVITY_DSS_L3_GICLK_WIDTH 0x1
187#define OMAP54XX_CLKACTIVITY_DSS_L3_GICLK_MASK (1 << 8)
188
189/* Used by CM_DSS_CLKSTCTRL */
190#define OMAP54XX_CLKACTIVITY_DSS_SYS_GFCLK_SHIFT 10
191#define OMAP54XX_CLKACTIVITY_DSS_SYS_GFCLK_WIDTH 0x1
192#define OMAP54XX_CLKACTIVITY_DSS_SYS_GFCLK_MASK (1 << 10)
193
194/* Used by CM_EMIF_CLKSTCTRL */
195#define OMAP54XX_CLKACTIVITY_EMIF_L3_GICLK_SHIFT 8
196#define OMAP54XX_CLKACTIVITY_EMIF_L3_GICLK_WIDTH 0x1
197#define OMAP54XX_CLKACTIVITY_EMIF_L3_GICLK_MASK (1 << 8)
198
199/* Used by CM_EMIF_CLKSTCTRL */
200#define OMAP54XX_CLKACTIVITY_EMIF_LL_GCLK_SHIFT 11
201#define OMAP54XX_CLKACTIVITY_EMIF_LL_GCLK_WIDTH 0x1
202#define OMAP54XX_CLKACTIVITY_EMIF_LL_GCLK_MASK (1 << 11)
203
204/* Used by CM_EMIF_CLKSTCTRL */
205#define OMAP54XX_CLKACTIVITY_EMIF_PHY_GCLK_SHIFT 10
206#define OMAP54XX_CLKACTIVITY_EMIF_PHY_GCLK_WIDTH 0x1
207#define OMAP54XX_CLKACTIVITY_EMIF_PHY_GCLK_MASK (1 << 10)
208
209/* Used by CM_EMU_CLKSTCTRL */
210#define OMAP54XX_CLKACTIVITY_EMU_SYS_GCLK_SHIFT 8
211#define OMAP54XX_CLKACTIVITY_EMU_SYS_GCLK_WIDTH 0x1
212#define OMAP54XX_CLKACTIVITY_EMU_SYS_GCLK_MASK (1 << 8)
213
214/* Used by CM_CAM_CLKSTCTRL */
215#define OMAP54XX_CLKACTIVITY_FDIF_GCLK_SHIFT 10
216#define OMAP54XX_CLKACTIVITY_FDIF_GCLK_WIDTH 0x1
217#define OMAP54XX_CLKACTIVITY_FDIF_GCLK_MASK (1 << 10)
218
219/* Used by CM_ABE_CLKSTCTRL */
220#define OMAP54XX_CLKACTIVITY_FUNC_24M_GFCLK_SHIFT 10
221#define OMAP54XX_CLKACTIVITY_FUNC_24M_GFCLK_WIDTH 0x1
222#define OMAP54XX_CLKACTIVITY_FUNC_24M_GFCLK_MASK (1 << 10)
223
224/* Used by CM_GPU_CLKSTCTRL */
225#define OMAP54XX_CLKACTIVITY_GPU_CORE_GCLK_SHIFT 9
226#define OMAP54XX_CLKACTIVITY_GPU_CORE_GCLK_WIDTH 0x1
227#define OMAP54XX_CLKACTIVITY_GPU_CORE_GCLK_MASK (1 << 9)
228
229/* Used by CM_GPU_CLKSTCTRL */
230#define OMAP54XX_CLKACTIVITY_GPU_HYD_GCLK_SHIFT 10
231#define OMAP54XX_CLKACTIVITY_GPU_HYD_GCLK_WIDTH 0x1
232#define OMAP54XX_CLKACTIVITY_GPU_HYD_GCLK_MASK (1 << 10)
233
234/* Used by CM_GPU_CLKSTCTRL */
235#define OMAP54XX_CLKACTIVITY_GPU_SYS_GCLK_SHIFT 8
236#define OMAP54XX_CLKACTIVITY_GPU_SYS_GCLK_WIDTH 0x1
237#define OMAP54XX_CLKACTIVITY_GPU_SYS_GCLK_MASK (1 << 8)
238
239/* Used by CM_DSS_CLKSTCTRL */
240#define OMAP54XX_CLKACTIVITY_HDMI_CEC_GFCLK_SHIFT 12
241#define OMAP54XX_CLKACTIVITY_HDMI_CEC_GFCLK_WIDTH 0x1
242#define OMAP54XX_CLKACTIVITY_HDMI_CEC_GFCLK_MASK (1 << 12)
243
244/* Used by CM_DSS_CLKSTCTRL */
245#define OMAP54XX_CLKACTIVITY_HDMI_PHY_GFCLK_SHIFT 11
246#define OMAP54XX_CLKACTIVITY_HDMI_PHY_GFCLK_WIDTH 0x1
247#define OMAP54XX_CLKACTIVITY_HDMI_PHY_GFCLK_MASK (1 << 11)
248
249/* Used by CM_L3INIT_CLKSTCTRL */
250#define OMAP54XX_CLKACTIVITY_HSIC_P1_480M_GFCLK_SHIFT 20
251#define OMAP54XX_CLKACTIVITY_HSIC_P1_480M_GFCLK_WIDTH 0x1
252#define OMAP54XX_CLKACTIVITY_HSIC_P1_480M_GFCLK_MASK (1 << 20)
253
254/* Used by CM_L3INIT_CLKSTCTRL */
255#define OMAP54XX_CLKACTIVITY_HSIC_P1_GFCLK_SHIFT 26
256#define OMAP54XX_CLKACTIVITY_HSIC_P1_GFCLK_WIDTH 0x1
257#define OMAP54XX_CLKACTIVITY_HSIC_P1_GFCLK_MASK (1 << 26)
258
259/* Used by CM_L3INIT_CLKSTCTRL */
260#define OMAP54XX_CLKACTIVITY_HSIC_P2_480M_GFCLK_SHIFT 21
261#define OMAP54XX_CLKACTIVITY_HSIC_P2_480M_GFCLK_WIDTH 0x1
262#define OMAP54XX_CLKACTIVITY_HSIC_P2_480M_GFCLK_MASK (1 << 21)
263
264/* Used by CM_L3INIT_CLKSTCTRL */
265#define OMAP54XX_CLKACTIVITY_HSIC_P2_GFCLK_SHIFT 27
266#define OMAP54XX_CLKACTIVITY_HSIC_P2_GFCLK_WIDTH 0x1
267#define OMAP54XX_CLKACTIVITY_HSIC_P2_GFCLK_MASK (1 << 27)
268
269/* Used by CM_L3INIT_CLKSTCTRL */
270#define OMAP54XX_CLKACTIVITY_HSIC_P3_480M_GFCLK_SHIFT 6
271#define OMAP54XX_CLKACTIVITY_HSIC_P3_480M_GFCLK_WIDTH 0x1
272#define OMAP54XX_CLKACTIVITY_HSIC_P3_480M_GFCLK_MASK (1 << 6)
273
274/* Used by CM_L3INIT_CLKSTCTRL */
275#define OMAP54XX_CLKACTIVITY_HSIC_P3_GFCLK_SHIFT 7
276#define OMAP54XX_CLKACTIVITY_HSIC_P3_GFCLK_WIDTH 0x1
277#define OMAP54XX_CLKACTIVITY_HSIC_P3_GFCLK_MASK (1 << 7)
278
279/* Used by CM_L3INIT_CLKSTCTRL */
280#define OMAP54XX_CLKACTIVITY_HSI_GFCLK_SHIFT 16
281#define OMAP54XX_CLKACTIVITY_HSI_GFCLK_WIDTH 0x1
282#define OMAP54XX_CLKACTIVITY_HSI_GFCLK_MASK (1 << 16)
283
284/* Used by CM_IPU_CLKSTCTRL */
285#define OMAP54XX_CLKACTIVITY_IPU_GCLK_SHIFT 8
286#define OMAP54XX_CLKACTIVITY_IPU_GCLK_WIDTH 0x1
287#define OMAP54XX_CLKACTIVITY_IPU_GCLK_MASK (1 << 8)
288
289/* Used by CM_IVA_CLKSTCTRL */
290#define OMAP54XX_CLKACTIVITY_IVA_GCLK_SHIFT 8
291#define OMAP54XX_CLKACTIVITY_IVA_GCLK_WIDTH 0x1
292#define OMAP54XX_CLKACTIVITY_IVA_GCLK_MASK (1 << 8)
293
294/* Used by CM_L3INIT_CLKSTCTRL */
295#define OMAP54XX_CLKACTIVITY_L3INIT_48M_GFCLK_SHIFT 12
296#define OMAP54XX_CLKACTIVITY_L3INIT_48M_GFCLK_WIDTH 0x1
297#define OMAP54XX_CLKACTIVITY_L3INIT_48M_GFCLK_MASK (1 << 12)
298
299/* Used by CM_L3INIT_CLKSTCTRL */
300#define OMAP54XX_CLKACTIVITY_L3INIT_60M_P1_GFCLK_SHIFT 28
301#define OMAP54XX_CLKACTIVITY_L3INIT_60M_P1_GFCLK_WIDTH 0x1
302#define OMAP54XX_CLKACTIVITY_L3INIT_60M_P1_GFCLK_MASK (1 << 28)
303
304/* Used by CM_L3INIT_CLKSTCTRL */
305#define OMAP54XX_CLKACTIVITY_L3INIT_60M_P2_GFCLK_SHIFT 29
306#define OMAP54XX_CLKACTIVITY_L3INIT_60M_P2_GFCLK_WIDTH 0x1
307#define OMAP54XX_CLKACTIVITY_L3INIT_60M_P2_GFCLK_MASK (1 << 29)
308
309/* Used by CM_L3INIT_CLKSTCTRL */
310#define OMAP54XX_CLKACTIVITY_L3INIT_L3_GICLK_SHIFT 8
311#define OMAP54XX_CLKACTIVITY_L3INIT_L3_GICLK_WIDTH 0x1
312#define OMAP54XX_CLKACTIVITY_L3INIT_L3_GICLK_MASK (1 << 8)
313
314/* Used by CM_L3INIT_CLKSTCTRL */
315#define OMAP54XX_CLKACTIVITY_L3INIT_L4_GICLK_SHIFT 9
316#define OMAP54XX_CLKACTIVITY_L3INIT_L4_GICLK_WIDTH 0x1
317#define OMAP54XX_CLKACTIVITY_L3INIT_L4_GICLK_MASK (1 << 9)
318
319/* Used by CM_L3INIT_CLKSTCTRL */
320#define OMAP54XX_CLKACTIVITY_L3INIT_USB_OTG_SS_LFPS_TX_GFCLK_SHIFT 11
321#define OMAP54XX_CLKACTIVITY_L3INIT_USB_OTG_SS_LFPS_TX_GFCLK_WIDTH 0x1
322#define OMAP54XX_CLKACTIVITY_L3INIT_USB_OTG_SS_LFPS_TX_GFCLK_MASK (1 << 11)
323
324/* Used by CM_L3INSTR_CLKSTCTRL */
325#define OMAP54XX_CLKACTIVITY_L3INSTR_DLL_AGING_GCLK_SHIFT 9
326#define OMAP54XX_CLKACTIVITY_L3INSTR_DLL_AGING_GCLK_WIDTH 0x1
327#define OMAP54XX_CLKACTIVITY_L3INSTR_DLL_AGING_GCLK_MASK (1 << 9)
328
329/* Used by CM_L3INSTR_CLKSTCTRL */
330#define OMAP54XX_CLKACTIVITY_L3INSTR_L3_GICLK_SHIFT 8
331#define OMAP54XX_CLKACTIVITY_L3INSTR_L3_GICLK_WIDTH 0x1
332#define OMAP54XX_CLKACTIVITY_L3INSTR_L3_GICLK_MASK (1 << 8)
333
334/* Used by CM_L3INSTR_CLKSTCTRL */
335#define OMAP54XX_CLKACTIVITY_L3INSTR_TS_GCLK_SHIFT 10
336#define OMAP54XX_CLKACTIVITY_L3INSTR_TS_GCLK_WIDTH 0x1
337#define OMAP54XX_CLKACTIVITY_L3INSTR_TS_GCLK_MASK (1 << 10)
338
339/* Used by CM_L3MAIN1_CLKSTCTRL */
340#define OMAP54XX_CLKACTIVITY_L3MAIN1_L3_GICLK_SHIFT 8
341#define OMAP54XX_CLKACTIVITY_L3MAIN1_L3_GICLK_WIDTH 0x1
342#define OMAP54XX_CLKACTIVITY_L3MAIN1_L3_GICLK_MASK (1 << 8)
343
344/* Used by CM_L3MAIN2_CLKSTCTRL */
345#define OMAP54XX_CLKACTIVITY_L3MAIN2_L3_GICLK_SHIFT 8
346#define OMAP54XX_CLKACTIVITY_L3MAIN2_L3_GICLK_WIDTH 0x1
347#define OMAP54XX_CLKACTIVITY_L3MAIN2_L3_GICLK_MASK (1 << 8)
348
349/* Used by CM_L4CFG_CLKSTCTRL */
350#define OMAP54XX_CLKACTIVITY_L4CFG_L4_GICLK_SHIFT 8
351#define OMAP54XX_CLKACTIVITY_L4CFG_L4_GICLK_WIDTH 0x1
352#define OMAP54XX_CLKACTIVITY_L4CFG_L4_GICLK_MASK (1 << 8)
353
354/* Used by CM_L4PER_CLKSTCTRL */
355#define OMAP54XX_CLKACTIVITY_L4PER_L4_GICLK_SHIFT 8
356#define OMAP54XX_CLKACTIVITY_L4PER_L4_GICLK_WIDTH 0x1
357#define OMAP54XX_CLKACTIVITY_L4PER_L4_GICLK_MASK (1 << 8)
358
359/* Used by CM_L4SEC_CLKSTCTRL */
360#define OMAP54XX_CLKACTIVITY_L4SEC_L3_GICLK_SHIFT 8
361#define OMAP54XX_CLKACTIVITY_L4SEC_L3_GICLK_WIDTH 0x1
362#define OMAP54XX_CLKACTIVITY_L4SEC_L3_GICLK_MASK (1 << 8)
363
364/* Used by CM_L4SEC_CLKSTCTRL */
365#define OMAP54XX_CLKACTIVITY_L4SEC_L4_GICLK_SHIFT 9
366#define OMAP54XX_CLKACTIVITY_L4SEC_L4_GICLK_WIDTH 0x1
367#define OMAP54XX_CLKACTIVITY_L4SEC_L4_GICLK_MASK (1 << 9)
368
369/* Used by CM_MIPIEXT_CLKSTCTRL */
370#define OMAP54XX_CLKACTIVITY_MIPIEXT_L3_GICLK_SHIFT 8
371#define OMAP54XX_CLKACTIVITY_MIPIEXT_L3_GICLK_WIDTH 0x1
372#define OMAP54XX_CLKACTIVITY_MIPIEXT_L3_GICLK_MASK (1 << 8)
373
374/* Used by CM_MIPIEXT_CLKSTCTRL */
375#define OMAP54XX_CLKACTIVITY_MIPIEXT_PHY_REF_GFCLK_SHIFT 11
376#define OMAP54XX_CLKACTIVITY_MIPIEXT_PHY_REF_GFCLK_WIDTH 0x1
377#define OMAP54XX_CLKACTIVITY_MIPIEXT_PHY_REF_GFCLK_MASK (1 << 11)
378
379/* Used by CM_L3INIT_CLKSTCTRL */
380#define OMAP54XX_CLKACTIVITY_MMC1_32K_GFCLK_SHIFT 2
381#define OMAP54XX_CLKACTIVITY_MMC1_32K_GFCLK_WIDTH 0x1
382#define OMAP54XX_CLKACTIVITY_MMC1_32K_GFCLK_MASK (1 << 2)
383
384/* Used by CM_L3INIT_CLKSTCTRL */
385#define OMAP54XX_CLKACTIVITY_MMC1_GFCLK_SHIFT 17
386#define OMAP54XX_CLKACTIVITY_MMC1_GFCLK_WIDTH 0x1
387#define OMAP54XX_CLKACTIVITY_MMC1_GFCLK_MASK (1 << 17)
388
389/* Used by CM_L3INIT_CLKSTCTRL */
390#define OMAP54XX_CLKACTIVITY_MMC2_GFCLK_SHIFT 18
391#define OMAP54XX_CLKACTIVITY_MMC2_GFCLK_WIDTH 0x1
392#define OMAP54XX_CLKACTIVITY_MMC2_GFCLK_MASK (1 << 18)
393
394/* Used by CM_MPU_CLKSTCTRL */
395#define OMAP54XX_CLKACTIVITY_MPU_GCLK_SHIFT 8
396#define OMAP54XX_CLKACTIVITY_MPU_GCLK_WIDTH 0x1
397#define OMAP54XX_CLKACTIVITY_MPU_GCLK_MASK (1 << 8)
398
399/* Used by CM_ABE_CLKSTCTRL */
400#define OMAP54XX_CLKACTIVITY_PAD_CLKS_SHIFT 14
401#define OMAP54XX_CLKACTIVITY_PAD_CLKS_WIDTH 0x1
402#define OMAP54XX_CLKACTIVITY_PAD_CLKS_MASK (1 << 14)
403
404/* Used by CM_ABE_CLKSTCTRL */
405#define OMAP54XX_CLKACTIVITY_PAD_SLIMBUS1_CLK_SHIFT 15
406#define OMAP54XX_CLKACTIVITY_PAD_SLIMBUS1_CLK_WIDTH 0x1
407#define OMAP54XX_CLKACTIVITY_PAD_SLIMBUS1_CLK_MASK (1 << 15)
408
409/* Used by CM_L3INIT_CLKSTCTRL */
410#define OMAP54XX_CLKACTIVITY_PAD_XCLK60MHSP1_SHIFT 3
411#define OMAP54XX_CLKACTIVITY_PAD_XCLK60MHSP1_WIDTH 0x1
412#define OMAP54XX_CLKACTIVITY_PAD_XCLK60MHSP1_MASK (1 << 3)
413
414/* Used by CM_L3INIT_CLKSTCTRL */
415#define OMAP54XX_CLKACTIVITY_PAD_XCLK60MHSP2_SHIFT 4
416#define OMAP54XX_CLKACTIVITY_PAD_XCLK60MHSP2_WIDTH 0x1
417#define OMAP54XX_CLKACTIVITY_PAD_XCLK60MHSP2_MASK (1 << 4)
418
419/* Used by CM_L4PER_CLKSTCTRL */
420#define OMAP54XX_CLKACTIVITY_PER_12M_GFCLK_SHIFT 15
421#define OMAP54XX_CLKACTIVITY_PER_12M_GFCLK_WIDTH 0x1
422#define OMAP54XX_CLKACTIVITY_PER_12M_GFCLK_MASK (1 << 15)
423
424/* Used by CM_L4PER_CLKSTCTRL */
425#define OMAP54XX_CLKACTIVITY_PER_32K_GFCLK_SHIFT 17
426#define OMAP54XX_CLKACTIVITY_PER_32K_GFCLK_WIDTH 0x1
427#define OMAP54XX_CLKACTIVITY_PER_32K_GFCLK_MASK (1 << 17)
428
429/* Used by CM_L4PER_CLKSTCTRL */
430#define OMAP54XX_CLKACTIVITY_PER_48M_GFCLK_SHIFT 18
431#define OMAP54XX_CLKACTIVITY_PER_48M_GFCLK_WIDTH 0x1
432#define OMAP54XX_CLKACTIVITY_PER_48M_GFCLK_MASK (1 << 18)
433
434/* Used by CM_L4PER_CLKSTCTRL */
435#define OMAP54XX_CLKACTIVITY_PER_96M_GFCLK_SHIFT 19
436#define OMAP54XX_CLKACTIVITY_PER_96M_GFCLK_WIDTH 0x1
437#define OMAP54XX_CLKACTIVITY_PER_96M_GFCLK_MASK (1 << 19)
438
439/* Used by CM_L3INIT_CLKSTCTRL */
440#define OMAP54XX_CLKACTIVITY_SATA_REF_GFCLK_SHIFT 19
441#define OMAP54XX_CLKACTIVITY_SATA_REF_GFCLK_WIDTH 0x1
442#define OMAP54XX_CLKACTIVITY_SATA_REF_GFCLK_MASK (1 << 19)
443
444/* Used by CM_COREAON_CLKSTCTRL */
445#define OMAP54XX_CLKACTIVITY_SR_CORE_SYS_GFCLK_SHIFT 11
446#define OMAP54XX_CLKACTIVITY_SR_CORE_SYS_GFCLK_WIDTH 0x1
447#define OMAP54XX_CLKACTIVITY_SR_CORE_SYS_GFCLK_MASK (1 << 11)
448
449/* Used by CM_COREAON_CLKSTCTRL */
450#define OMAP54XX_CLKACTIVITY_SR_MM_SYS_GFCLK_SHIFT 10
451#define OMAP54XX_CLKACTIVITY_SR_MM_SYS_GFCLK_WIDTH 0x1
452#define OMAP54XX_CLKACTIVITY_SR_MM_SYS_GFCLK_MASK (1 << 10)
453
454/* Used by CM_COREAON_CLKSTCTRL */
455#define OMAP54XX_CLKACTIVITY_SR_MPU_SYS_GFCLK_SHIFT 9
456#define OMAP54XX_CLKACTIVITY_SR_MPU_SYS_GFCLK_WIDTH 0x1
457#define OMAP54XX_CLKACTIVITY_SR_MPU_SYS_GFCLK_MASK (1 << 9)
458
459/* Used by CM_WKUPAON_CLKSTCTRL */
460#define OMAP54XX_CLKACTIVITY_SYS_CLK_SHIFT 8
461#define OMAP54XX_CLKACTIVITY_SYS_CLK_WIDTH 0x1
462#define OMAP54XX_CLKACTIVITY_SYS_CLK_MASK (1 << 8)
463
464/* Used by CM_WKUPAON_CLKSTCTRL */
465#define OMAP54XX_CLKACTIVITY_SYS_CLK_ALL_SHIFT 15
466#define OMAP54XX_CLKACTIVITY_SYS_CLK_ALL_WIDTH 0x1
467#define OMAP54XX_CLKACTIVITY_SYS_CLK_ALL_MASK (1 << 15)
468
469/* Used by CM_WKUPAON_CLKSTCTRL */
470#define OMAP54XX_CLKACTIVITY_SYS_CLK_FUNC_SHIFT 14
471#define OMAP54XX_CLKACTIVITY_SYS_CLK_FUNC_WIDTH 0x1
472#define OMAP54XX_CLKACTIVITY_SYS_CLK_FUNC_MASK (1 << 14)
473
474/* Used by CM_L4PER_CLKSTCTRL */
475#define OMAP54XX_CLKACTIVITY_TIMER10_GFCLK_SHIFT 9
476#define OMAP54XX_CLKACTIVITY_TIMER10_GFCLK_WIDTH 0x1
477#define OMAP54XX_CLKACTIVITY_TIMER10_GFCLK_MASK (1 << 9)
478
479/* Used by CM_L4PER_CLKSTCTRL */
480#define OMAP54XX_CLKACTIVITY_TIMER11_GFCLK_SHIFT 10
481#define OMAP54XX_CLKACTIVITY_TIMER11_GFCLK_WIDTH 0x1
482#define OMAP54XX_CLKACTIVITY_TIMER11_GFCLK_MASK (1 << 10)
483
484/* Used by CM_L4PER_CLKSTCTRL */
485#define OMAP54XX_CLKACTIVITY_TIMER2_GFCLK_SHIFT 11
486#define OMAP54XX_CLKACTIVITY_TIMER2_GFCLK_WIDTH 0x1
487#define OMAP54XX_CLKACTIVITY_TIMER2_GFCLK_MASK (1 << 11)
488
489/* Used by CM_L4PER_CLKSTCTRL */
490#define OMAP54XX_CLKACTIVITY_TIMER3_GFCLK_SHIFT 12
491#define OMAP54XX_CLKACTIVITY_TIMER3_GFCLK_WIDTH 0x1
492#define OMAP54XX_CLKACTIVITY_TIMER3_GFCLK_MASK (1 << 12)
493
494/* Used by CM_L4PER_CLKSTCTRL */
495#define OMAP54XX_CLKACTIVITY_TIMER4_GFCLK_SHIFT 13
496#define OMAP54XX_CLKACTIVITY_TIMER4_GFCLK_WIDTH 0x1
497#define OMAP54XX_CLKACTIVITY_TIMER4_GFCLK_MASK (1 << 13)
498
499/* Used by CM_L4PER_CLKSTCTRL */
500#define OMAP54XX_CLKACTIVITY_TIMER9_GFCLK_SHIFT 14
501#define OMAP54XX_CLKACTIVITY_TIMER9_GFCLK_WIDTH 0x1
502#define OMAP54XX_CLKACTIVITY_TIMER9_GFCLK_MASK (1 << 14)
503
504/* Used by CM_L3INIT_CLKSTCTRL */
505#define OMAP54XX_CLKACTIVITY_TLL_CH0_GFCLK_SHIFT 22
506#define OMAP54XX_CLKACTIVITY_TLL_CH0_GFCLK_WIDTH 0x1
507#define OMAP54XX_CLKACTIVITY_TLL_CH0_GFCLK_MASK (1 << 22)
508
509/* Used by CM_L3INIT_CLKSTCTRL */
510#define OMAP54XX_CLKACTIVITY_TLL_CH1_GFCLK_SHIFT 23
511#define OMAP54XX_CLKACTIVITY_TLL_CH1_GFCLK_WIDTH 0x1
512#define OMAP54XX_CLKACTIVITY_TLL_CH1_GFCLK_MASK (1 << 23)
513
514/* Used by CM_L3INIT_CLKSTCTRL */
515#define OMAP54XX_CLKACTIVITY_TLL_CH2_GFCLK_SHIFT 24
516#define OMAP54XX_CLKACTIVITY_TLL_CH2_GFCLK_WIDTH 0x1
517#define OMAP54XX_CLKACTIVITY_TLL_CH2_GFCLK_MASK (1 << 24)
518
519/* Used by CM_MIPIEXT_CLKSTCTRL */
520#define OMAP54XX_CLKACTIVITY_UNIPRO1_DPLL_CLK_SHIFT 10
521#define OMAP54XX_CLKACTIVITY_UNIPRO1_DPLL_CLK_WIDTH 0x1
522#define OMAP54XX_CLKACTIVITY_UNIPRO1_DPLL_CLK_MASK (1 << 10)
523
524/* Used by CM_MIPIEXT_CLKSTCTRL */
525#define OMAP54XX_CLKACTIVITY_UNIPRO1_PHY_GFCLK_SHIFT 13
526#define OMAP54XX_CLKACTIVITY_UNIPRO1_PHY_GFCLK_WIDTH 0x1
527#define OMAP54XX_CLKACTIVITY_UNIPRO1_PHY_GFCLK_MASK (1 << 13)
528
529/* Used by CM_MIPIEXT_CLKSTCTRL */
530#define OMAP54XX_CLKACTIVITY_UNIPRO1_TXPHY_LS_GFCLK_SHIFT 12
531#define OMAP54XX_CLKACTIVITY_UNIPRO1_TXPHY_LS_GFCLK_WIDTH 0x1
532#define OMAP54XX_CLKACTIVITY_UNIPRO1_TXPHY_LS_GFCLK_MASK (1 << 12)
533
534/* Used by CM_L3INIT_CLKSTCTRL */
535#define OMAP54XX_CLKACTIVITY_UNIPRO2_DPLL_CLK_SHIFT 10
536#define OMAP54XX_CLKACTIVITY_UNIPRO2_DPLL_CLK_WIDTH 0x1
537#define OMAP54XX_CLKACTIVITY_UNIPRO2_DPLL_CLK_MASK (1 << 10)
538
539/* Used by CM_L3INIT_CLKSTCTRL */
540#define OMAP54XX_CLKACTIVITY_UNIPRO2_PHY_GFCLK_SHIFT 13
541#define OMAP54XX_CLKACTIVITY_UNIPRO2_PHY_GFCLK_WIDTH 0x1
542#define OMAP54XX_CLKACTIVITY_UNIPRO2_PHY_GFCLK_MASK (1 << 13)
543
544/* Used by CM_L3INIT_CLKSTCTRL */
545#define OMAP54XX_CLKACTIVITY_UNIPRO2_PHY_REF_GFCLK_SHIFT 5
546#define OMAP54XX_CLKACTIVITY_UNIPRO2_PHY_REF_GFCLK_WIDTH 0x1
547#define OMAP54XX_CLKACTIVITY_UNIPRO2_PHY_REF_GFCLK_MASK (1 << 5)
548
549/* Used by CM_L3INIT_CLKSTCTRL */
550#define OMAP54XX_CLKACTIVITY_USB_DPLL_CLK_SHIFT 14
551#define OMAP54XX_CLKACTIVITY_USB_DPLL_CLK_WIDTH 0x1
552#define OMAP54XX_CLKACTIVITY_USB_DPLL_CLK_MASK (1 << 14)
553
554/* Used by CM_L3INIT_CLKSTCTRL */
555#define OMAP54XX_CLKACTIVITY_USB_DPLL_HS_CLK_SHIFT 15
556#define OMAP54XX_CLKACTIVITY_USB_DPLL_HS_CLK_WIDTH 0x1
557#define OMAP54XX_CLKACTIVITY_USB_DPLL_HS_CLK_MASK (1 << 15)
558
559/* Used by CM_L3INIT_CLKSTCTRL */
560#define OMAP54XX_CLKACTIVITY_USB_OTG_SS_REF_CLK_SHIFT 31
561#define OMAP54XX_CLKACTIVITY_USB_OTG_SS_REF_CLK_WIDTH 0x1
562#define OMAP54XX_CLKACTIVITY_USB_OTG_SS_REF_CLK_MASK (1 << 31)
563
564/* Used by CM_L3INIT_CLKSTCTRL */
565#define OMAP54XX_CLKACTIVITY_UTMI_P3_GFCLK_SHIFT 30
566#define OMAP54XX_CLKACTIVITY_UTMI_P3_GFCLK_WIDTH 0x1
567#define OMAP54XX_CLKACTIVITY_UTMI_P3_GFCLK_MASK (1 << 30)
568
569/* Used by CM_L3INIT_CLKSTCTRL */
570#define OMAP54XX_CLKACTIVITY_UTMI_ROOT_GFCLK_SHIFT 25
571#define OMAP54XX_CLKACTIVITY_UTMI_ROOT_GFCLK_WIDTH 0x1
572#define OMAP54XX_CLKACTIVITY_UTMI_ROOT_GFCLK_MASK (1 << 25)
573
574/* Used by CM_WKUPAON_CLKSTCTRL */
575#define OMAP54XX_CLKACTIVITY_WKUPAON_32K_GFCLK_SHIFT 11
576#define OMAP54XX_CLKACTIVITY_WKUPAON_32K_GFCLK_WIDTH 0x1
577#define OMAP54XX_CLKACTIVITY_WKUPAON_32K_GFCLK_MASK (1 << 11)
578
579/* Used by CM_WKUPAON_CLKSTCTRL */
580#define OMAP54XX_CLKACTIVITY_WKUPAON_GICLK_SHIFT 12
581#define OMAP54XX_CLKACTIVITY_WKUPAON_GICLK_WIDTH 0x1
582#define OMAP54XX_CLKACTIVITY_WKUPAON_GICLK_MASK (1 << 12)
583
584/* Used by CM_WKUPAON_CLKSTCTRL */
585#define OMAP54XX_CLKACTIVITY_WKUPAON_IO_SRCOMP_GFCLK_SHIFT 13
586#define OMAP54XX_CLKACTIVITY_WKUPAON_IO_SRCOMP_GFCLK_WIDTH 0x1
587#define OMAP54XX_CLKACTIVITY_WKUPAON_IO_SRCOMP_GFCLK_MASK (1 << 13)
588
589/* Used by CM_COREAON_IO_SRCOMP_CLKCTRL, CM_WKUPAON_IO_SRCOMP_CLKCTRL */
590#define OMAP54XX_CLKEN_SRCOMP_FCLK_SHIFT 8
591#define OMAP54XX_CLKEN_SRCOMP_FCLK_WIDTH 0x1
592#define OMAP54XX_CLKEN_SRCOMP_FCLK_MASK (1 << 8)
593
594/*
595 * Used by CM_ABE_TIMER5_CLKCTRL, CM_ABE_TIMER6_CLKCTRL, CM_ABE_TIMER7_CLKCTRL,
596 * CM_ABE_TIMER8_CLKCTRL, CM_L3INIT_HSI_CLKCTRL, CM_L4PER_TIMER10_CLKCTRL,
597 * CM_L4PER_TIMER11_CLKCTRL, CM_L4PER_TIMER2_CLKCTRL, CM_L4PER_TIMER3_CLKCTRL,
598 * CM_L4PER_TIMER4_CLKCTRL, CM_L4PER_TIMER9_CLKCTRL, CM_WKUPAON_TIMER1_CLKCTRL
599 */
600#define OMAP54XX_CLKSEL_SHIFT 24
601#define OMAP54XX_CLKSEL_WIDTH 0x1
602#define OMAP54XX_CLKSEL_MASK (1 << 24)
603
604/*
605 * Renamed from CLKSEL Used by CM_CLKSEL_ABE_DSS_SYS, CM_CLKSEL_ABE_PLL_REF,
606 * CM_CLKSEL_USB_60MHZ, CM_CLKSEL_WKUPAON
607 */
608#define OMAP54XX_CLKSEL_0_0_SHIFT 0
609#define OMAP54XX_CLKSEL_0_0_WIDTH 0x1
610#define OMAP54XX_CLKSEL_0_0_MASK (1 << 0)
611
612/* Renamed from CLKSEL Used by CM_BYPCLK_DPLL_IVA, CM_BYPCLK_DPLL_MPU */
613#define OMAP54XX_CLKSEL_0_1_SHIFT 0
614#define OMAP54XX_CLKSEL_0_1_WIDTH 0x2
615#define OMAP54XX_CLKSEL_0_1_MASK (0x3 << 0)
616
617/* Renamed from CLKSEL Used by CM_L3INSTR_CTRL_MODULE_BANDGAP_CLKCTRL */
618#define OMAP54XX_CLKSEL_24_25_SHIFT 24
619#define OMAP54XX_CLKSEL_24_25_WIDTH 0x2
620#define OMAP54XX_CLKSEL_24_25_MASK (0x3 << 24)
621
622/* Used by CM_MPU_MPU_CLKCTRL */
623#define OMAP54XX_CLKSEL_ABE_DIV_MODE_SHIFT 26
624#define OMAP54XX_CLKSEL_ABE_DIV_MODE_WIDTH 0x1
625#define OMAP54XX_CLKSEL_ABE_DIV_MODE_MASK (1 << 26)
626
627/* Used by CM_ABE_AESS_CLKCTRL */
628#define OMAP54XX_CLKSEL_AESS_FCLK_SHIFT 24
629#define OMAP54XX_CLKSEL_AESS_FCLK_WIDTH 0x1
630#define OMAP54XX_CLKSEL_AESS_FCLK_MASK (1 << 24)
631
632/* Used by CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL */
633#define OMAP54XX_CLKSEL_DIV_SHIFT 25
634#define OMAP54XX_CLKSEL_DIV_WIDTH 0x1
635#define OMAP54XX_CLKSEL_DIV_MASK (1 << 25)
636
637/* Used by CM_MPU_MPU_CLKCTRL */
638#define OMAP54XX_CLKSEL_EMIF_DIV_MODE_SHIFT 24
639#define OMAP54XX_CLKSEL_EMIF_DIV_MODE_WIDTH 0x2
640#define OMAP54XX_CLKSEL_EMIF_DIV_MODE_MASK (0x3 << 24)
641
642/* Used by CM_CAM_FDIF_CLKCTRL */
643#define OMAP54XX_CLKSEL_FCLK_SHIFT 24
644#define OMAP54XX_CLKSEL_FCLK_WIDTH 0x1
645#define OMAP54XX_CLKSEL_FCLK_MASK (1 << 24)
646
647/* Used by CM_GPU_GPU_CLKCTRL */
648#define OMAP54XX_CLKSEL_GPU_CORE_GCLK_SHIFT 24
649#define OMAP54XX_CLKSEL_GPU_CORE_GCLK_WIDTH 0x1
650#define OMAP54XX_CLKSEL_GPU_CORE_GCLK_MASK (1 << 24)
651
652/* Used by CM_GPU_GPU_CLKCTRL */
653#define OMAP54XX_CLKSEL_GPU_HYD_GCLK_SHIFT 25
654#define OMAP54XX_CLKSEL_GPU_HYD_GCLK_WIDTH 0x1
655#define OMAP54XX_CLKSEL_GPU_HYD_GCLK_MASK (1 << 25)
656
657/* Used by CM_GPU_GPU_CLKCTRL */
658#define OMAP54XX_CLKSEL_GPU_SYS_CLK_SHIFT 26
659#define OMAP54XX_CLKSEL_GPU_SYS_CLK_WIDTH 0x1
660#define OMAP54XX_CLKSEL_GPU_SYS_CLK_MASK (1 << 26)
661
662/*
663 * Used by CM_ABE_DMIC_CLKCTRL, CM_ABE_MCASP_CLKCTRL, CM_ABE_MCBSP1_CLKCTRL,
664 * CM_ABE_MCBSP2_CLKCTRL, CM_ABE_MCBSP3_CLKCTRL
665 */
666#define OMAP54XX_CLKSEL_INTERNAL_SOURCE_SHIFT 26
667#define OMAP54XX_CLKSEL_INTERNAL_SOURCE_WIDTH 0x2
668#define OMAP54XX_CLKSEL_INTERNAL_SOURCE_MASK (0x3 << 26)
669
670/* Used by CM_CLKSEL_CORE */
671#define OMAP54XX_CLKSEL_L3_SHIFT 4
672#define OMAP54XX_CLKSEL_L3_WIDTH 0x1
673#define OMAP54XX_CLKSEL_L3_MASK (1 << 4)
674
675/* Renamed from CLKSEL_L3 Used by CM_SHADOW_FREQ_CONFIG2 */
676#define OMAP54XX_CLKSEL_L3_1_1_SHIFT 1
677#define OMAP54XX_CLKSEL_L3_1_1_WIDTH 0x1
678#define OMAP54XX_CLKSEL_L3_1_1_MASK (1 << 1)
679
680/* Used by CM_CLKSEL_CORE */
681#define OMAP54XX_CLKSEL_L4_SHIFT 8
682#define OMAP54XX_CLKSEL_L4_WIDTH 0x1
683#define OMAP54XX_CLKSEL_L4_MASK (1 << 8)
684
685/* Used by CM_EMIF_EMIF1_CLKCTRL */
686#define OMAP54XX_CLKSEL_LL_SHIFT 24
687#define OMAP54XX_CLKSEL_LL_WIDTH 0x1
688#define OMAP54XX_CLKSEL_LL_MASK (1 << 24)
689
690/* Used by CM_CLKSEL_ABE */
691#define OMAP54XX_CLKSEL_OPP_SHIFT 0
692#define OMAP54XX_CLKSEL_OPP_WIDTH 0x2
693#define OMAP54XX_CLKSEL_OPP_MASK (0x3 << 0)
694
695/* Renamed from CLKSEL_OPP Used by CM_L3INIT_UNIPRO2_CLKCTRL */
696#define OMAP54XX_CLKSEL_OPP_24_24_SHIFT 24
697#define OMAP54XX_CLKSEL_OPP_24_24_WIDTH 0x1
698#define OMAP54XX_CLKSEL_OPP_24_24_MASK (1 << 24)
699
700/*
701 * Used by CM_ABE_DMIC_CLKCTRL, CM_ABE_MCASP_CLKCTRL, CM_ABE_MCBSP1_CLKCTRL,
702 * CM_ABE_MCBSP2_CLKCTRL, CM_ABE_MCBSP3_CLKCTRL
703 */
704#define OMAP54XX_CLKSEL_SOURCE_SHIFT 24
705#define OMAP54XX_CLKSEL_SOURCE_WIDTH 0x2
706#define OMAP54XX_CLKSEL_SOURCE_MASK (0x3 << 24)
707
708/*
709 * Renamed from CLKSEL_SOURCE Used by CM_L3INIT_MMC1_CLKCTRL,
710 * CM_L3INIT_MMC2_CLKCTRL
711 */
712#define OMAP54XX_CLKSEL_SOURCE_L3INIT_MMC1_SHIFT 24
713#define OMAP54XX_CLKSEL_SOURCE_L3INIT_MMC1_WIDTH 0x1
714#define OMAP54XX_CLKSEL_SOURCE_L3INIT_MMC1_MASK (1 << 24)
715
716/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
717#define OMAP54XX_CLKSEL_UTMI_P1_SHIFT 24
718#define OMAP54XX_CLKSEL_UTMI_P1_WIDTH 0x1
719#define OMAP54XX_CLKSEL_UTMI_P1_MASK (1 << 24)
720
721/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
722#define OMAP54XX_CLKSEL_UTMI_P2_SHIFT 25
723#define OMAP54XX_CLKSEL_UTMI_P2_WIDTH 0x1
724#define OMAP54XX_CLKSEL_UTMI_P2_MASK (1 << 25)
725
726/*
727 * Used by CM_DIV_H11_DPLL_CORE, CM_DIV_H11_DPLL_IVA, CM_DIV_H11_DPLL_PER,
728 * CM_DIV_H12_DPLL_CORE, CM_DIV_H12_DPLL_IVA, CM_DIV_H12_DPLL_PER,
729 * CM_DIV_H13_DPLL_CORE, CM_DIV_H13_DPLL_PER, CM_DIV_H14_DPLL_CORE,
730 * CM_DIV_H14_DPLL_PER, CM_DIV_H21_DPLL_CORE, CM_DIV_H22_DPLL_CORE,
731 * CM_DIV_H23_DPLL_CORE, CM_DIV_H24_DPLL_CORE, CM_DIV_M2_DPLL_ABE,
732 * CM_DIV_M2_DPLL_CORE, CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER,
733 * CM_DIV_M2_DPLL_UNIPRO1, CM_DIV_M2_DPLL_UNIPRO2, CM_DIV_M2_DPLL_USB,
734 * CM_DIV_M3_DPLL_ABE, CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER
735 */
736#define OMAP54XX_CLKST_SHIFT 9
737#define OMAP54XX_CLKST_WIDTH 0x1
738#define OMAP54XX_CLKST_MASK (1 << 9)
739
740/*
741 * Used by CM_ABE_CLKSTCTRL, CM_C2C_CLKSTCTRL, CM_CAM_CLKSTCTRL,
742 * CM_COREAON_CLKSTCTRL, CM_CUSTEFUSE_CLKSTCTRL, CM_DMA_CLKSTCTRL,
743 * CM_DSP_CLKSTCTRL, CM_DSS_CLKSTCTRL, CM_EMIF_CLKSTCTRL, CM_EMU_CLKSTCTRL,
744 * CM_GPU_CLKSTCTRL, CM_IPU_CLKSTCTRL, CM_IVA_CLKSTCTRL, CM_L3INIT_CLKSTCTRL,
745 * CM_L3INSTR_CLKSTCTRL, CM_L3MAIN1_CLKSTCTRL, CM_L3MAIN2_CLKSTCTRL,
746 * CM_L4CFG_CLKSTCTRL, CM_L4PER_CLKSTCTRL, CM_L4SEC_CLKSTCTRL,
747 * CM_MIPIEXT_CLKSTCTRL, CM_MPU_CLKSTCTRL, CM_WKUPAON_CLKSTCTRL
748 */
749#define OMAP54XX_CLKTRCTRL_SHIFT 0
750#define OMAP54XX_CLKTRCTRL_WIDTH 0x2
751#define OMAP54XX_CLKTRCTRL_MASK (0x3 << 0)
752
753/* Used by CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_PER */
754#define OMAP54XX_CLKX2ST_SHIFT 11
755#define OMAP54XX_CLKX2ST_WIDTH 0x1
756#define OMAP54XX_CLKX2ST_MASK (1 << 11)
757
758/* Used by CM_L4CFG_DYNAMICDEP */
759#define OMAP54XX_COREAON_DYNDEP_SHIFT 16
760#define OMAP54XX_COREAON_DYNDEP_WIDTH 0x1
761#define OMAP54XX_COREAON_DYNDEP_MASK (1 << 16)
762
763/* Used by CM_DSP_STATICDEP, CM_IPU_STATICDEP, CM_MPU_STATICDEP */
764#define OMAP54XX_COREAON_STATDEP_SHIFT 16
765#define OMAP54XX_COREAON_STATDEP_WIDTH 0x1
766#define OMAP54XX_COREAON_STATDEP_MASK (1 << 16)
767
768/* Used by CM_L4CFG_DYNAMICDEP */
769#define OMAP54XX_CUSTEFUSE_DYNDEP_SHIFT 17
770#define OMAP54XX_CUSTEFUSE_DYNDEP_WIDTH 0x1
771#define OMAP54XX_CUSTEFUSE_DYNDEP_MASK (1 << 17)
772
773/* Used by CM_DSP_STATICDEP, CM_IPU_STATICDEP, CM_MPU_STATICDEP */
774#define OMAP54XX_CUSTEFUSE_STATDEP_SHIFT 17
775#define OMAP54XX_CUSTEFUSE_STATDEP_WIDTH 0x1
776#define OMAP54XX_CUSTEFUSE_STATDEP_MASK (1 << 17)
777
778/* Used by REVISION_CM_CORE, REVISION_CM_CORE_AON */
779#define OMAP54XX_CUSTOM_SHIFT 6
780#define OMAP54XX_CUSTOM_WIDTH 0x2
781#define OMAP54XX_CUSTOM_MASK (0x3 << 6)
782
783/*
784 * Used by CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE, CM_CLKSEL_DPLL_IVA,
785 * CM_CLKSEL_DPLL_MPU, CM_CLKSEL_DPLL_PER, CM_CLKSEL_DPLL_UNIPRO1,
786 * CM_CLKSEL_DPLL_UNIPRO2, CM_CLKSEL_DPLL_USB
787 */
788#define OMAP54XX_DCC_EN_SHIFT 22
789#define OMAP54XX_DCC_EN_WIDTH 0x1
790#define OMAP54XX_DCC_EN_MASK (1 << 22)
791
792/*
793 * Used by CM_CORE_AON_DEBUG_CM_CORE_AON_FD_TRANS,
794 * CM_CORE_AON_DEBUG_DSS_FD_TRANS, CM_CORE_AON_DEBUG_EMIF_FD_TRANS,
795 * CM_CORE_AON_DEBUG_L4SEC_FD_TRANS
796 */
797#define OMAP54XX_CM_DEBUG_OUT_SHIFT 0
798#define OMAP54XX_CM_DEBUG_OUT_WIDTH 0xd
799#define OMAP54XX_CM_DEBUG_OUT_MASK (0x1fff << 0)
800
801/*
802 * Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_ABE_FD_TRANS,
803 * CM_CORE_AON_DEBUG_L3INIT_FD_TRANS, CM_CORE_AON_DEBUG_L4PER_FD_TRANS
804 */
805#define OMAP54XX_DEBUG_OUT_0_31_SHIFT 0
806#define OMAP54XX_DEBUG_OUT_0_31_WIDTH 0x20
807#define OMAP54XX_DEBUG_OUT_0_31_MASK (0xffffffff << 0)
808
809/*
810 * Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_C2C_FD_TRANS,
811 * CM_CORE_AON_DEBUG_COREAON_FD_TRANS, CM_CORE_AON_DEBUG_L4CFG_FD_TRANS
812 */
813#define OMAP54XX_DEBUG_OUT_0_8_SHIFT 0
814#define OMAP54XX_DEBUG_OUT_0_8_WIDTH 0x9
815#define OMAP54XX_DEBUG_OUT_0_8_MASK (0x1ff << 0)
816
817/*
818 * Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_CUSTEFUSE_FD_TRANS,
819 * CM_CORE_AON_DEBUG_DMA_FD_TRANS, CM_CORE_AON_DEBUG_L3MAIN1_FD_TRANS
820 */
821#define OMAP54XX_DEBUG_OUT_0_4_SHIFT 0
822#define OMAP54XX_DEBUG_OUT_0_4_WIDTH 0x5
823#define OMAP54XX_DEBUG_OUT_0_4_MASK (0x1f << 0)
824
825/*
826 * Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_DSP_FD_TRANS,
827 * CM_CORE_AON_DEBUG_IPU_FD_TRANS, CM_CORE_AON_DEBUG_MPU_FD_TRANS
828 */
829#define OMAP54XX_DEBUG_OUT_0_5_SHIFT 0
830#define OMAP54XX_DEBUG_OUT_0_5_WIDTH 0x6
831#define OMAP54XX_DEBUG_OUT_0_5_MASK (0x3f << 0)
832
833/*
834 * Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_CAM_FD_TRANS,
835 * CM_CORE_AON_DEBUG_MIPIEXT_FD_TRANS
836 */
837#define OMAP54XX_DEBUG_OUT_0_10_SHIFT 0
838#define OMAP54XX_DEBUG_OUT_0_10_WIDTH 0xb
839#define OMAP54XX_DEBUG_OUT_0_10_MASK (0x7ff << 0)
840
841/*
842 * Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_IVA_FD_TRANS,
843 * CM_CORE_AON_DEBUG_L3MAIN2_FD_TRANS
844 */
845#define OMAP54XX_DEBUG_OUT_0_6_SHIFT 0
846#define OMAP54XX_DEBUG_OUT_0_6_WIDTH 0x7
847#define OMAP54XX_DEBUG_OUT_0_6_MASK (0x7f << 0)
848
849/* Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_ABE_FD_TRANS2 */
850#define OMAP54XX_DEBUG_OUT_0_19_SHIFT 0
851#define OMAP54XX_DEBUG_OUT_0_19_WIDTH 0x14
852#define OMAP54XX_DEBUG_OUT_0_19_MASK (0xfffff << 0)
853
854/* Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_GPU_FD_TRANS */
855#define OMAP54XX_DEBUG_OUT_0_9_SHIFT 0
856#define OMAP54XX_DEBUG_OUT_0_9_WIDTH 0xa
857#define OMAP54XX_DEBUG_OUT_0_9_MASK (0x3ff << 0)
858
859/* Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_L3INIT_FD_TRANS2 */
860#define OMAP54XX_DEBUG_OUT_0_26_SHIFT 0
861#define OMAP54XX_DEBUG_OUT_0_26_WIDTH 0x1b
862#define OMAP54XX_DEBUG_OUT_0_26_MASK (0x7ffffff << 0)
863
864/* Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_L3INSTR_FD_TRANS */
865#define OMAP54XX_DEBUG_OUT_0_13_SHIFT 0
866#define OMAP54XX_DEBUG_OUT_0_13_WIDTH 0xe
867#define OMAP54XX_DEBUG_OUT_0_13_MASK (0x3fff << 0)
868
869/* Renamed from DEBUG_OUT Used by CM_CORE_AON_DEBUG_L4PER_FD_TRANS2 */
870#define OMAP54XX_DEBUG_OUT_0_21_SHIFT 0
871#define OMAP54XX_DEBUG_OUT_0_21_WIDTH 0x16
872#define OMAP54XX_DEBUG_OUT_0_21_MASK (0x3fffff << 0)
873
874/*
875 * Used by CM_SSC_DELTAMSTEP_DPLL_ABE, CM_SSC_DELTAMSTEP_DPLL_CORE,
876 * CM_SSC_DELTAMSTEP_DPLL_IVA, CM_SSC_DELTAMSTEP_DPLL_MPU,
877 * CM_SSC_DELTAMSTEP_DPLL_PER
878 */
879#define OMAP54XX_DELTAMSTEP_SHIFT 0
880#define OMAP54XX_DELTAMSTEP_WIDTH 0x14
881#define OMAP54XX_DELTAMSTEP_MASK (0xfffff << 0)
882
883/*
884 * Renamed from DELTAMSTEP Used by CM_SSC_DELTAMSTEP_DPLL_UNIPRO1,
885 * CM_SSC_DELTAMSTEP_DPLL_UNIPRO2, CM_SSC_DELTAMSTEP_DPLL_USB
886 */
887#define OMAP54XX_DELTAMSTEP_0_20_SHIFT 0
888#define OMAP54XX_DELTAMSTEP_0_20_WIDTH 0x15
889#define OMAP54XX_DELTAMSTEP_0_20_MASK (0x1fffff << 0)
890
891/*
892 * Used by CM_DIV_H11_DPLL_CORE, CM_DIV_H11_DPLL_IVA, CM_DIV_H11_DPLL_PER,
893 * CM_DIV_H12_DPLL_CORE, CM_DIV_H12_DPLL_IVA, CM_DIV_H12_DPLL_PER,
894 * CM_DIV_H13_DPLL_CORE, CM_DIV_H13_DPLL_PER, CM_DIV_H14_DPLL_CORE,
895 * CM_DIV_H14_DPLL_PER, CM_DIV_H21_DPLL_CORE, CM_DIV_H22_DPLL_CORE,
896 * CM_DIV_H23_DPLL_CORE, CM_DIV_H24_DPLL_CORE
897 */
898#define OMAP54XX_DIVHS_SHIFT 0
899#define OMAP54XX_DIVHS_WIDTH 0x6
900#define OMAP54XX_DIVHS_MASK (0x3f << 0)
901
902/*
903 * Renamed from DIVHS Used by CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_CORE,
904 * CM_DIV_M2_DPLL_MPU, CM_DIV_M2_DPLL_PER, CM_DIV_M3_DPLL_ABE,
905 * CM_DIV_M3_DPLL_CORE, CM_DIV_M3_DPLL_PER
906 */
907#define OMAP54XX_DIVHS_0_4_SHIFT 0
908#define OMAP54XX_DIVHS_0_4_WIDTH 0x5
909#define OMAP54XX_DIVHS_0_4_MASK (0x1f << 0)
910
911/*
912 * Renamed from DIVHS Used by CM_DIV_M2_DPLL_UNIPRO1, CM_DIV_M2_DPLL_UNIPRO2,
913 * CM_DIV_M2_DPLL_USB
914 */
915#define OMAP54XX_DIVHS_0_6_SHIFT 0
916#define OMAP54XX_DIVHS_0_6_WIDTH 0x7
917#define OMAP54XX_DIVHS_0_6_MASK (0x7f << 0)
918
919/* Used by CM_DLL_CTRL */
920#define OMAP54XX_DLL_OVERRIDE_SHIFT 0
921#define OMAP54XX_DLL_OVERRIDE_WIDTH 0x1
922#define OMAP54XX_DLL_OVERRIDE_MASK (1 << 0)
923
924/* Renamed from DLL_OVERRIDE Used by CM_SHADOW_FREQ_CONFIG1 */
925#define OMAP54XX_DLL_OVERRIDE_2_2_SHIFT 2
926#define OMAP54XX_DLL_OVERRIDE_2_2_WIDTH 0x1
927#define OMAP54XX_DLL_OVERRIDE_2_2_MASK (1 << 2)
928
929/* Used by CM_SHADOW_FREQ_CONFIG1 */
930#define OMAP54XX_DLL_RESET_SHIFT 3
931#define OMAP54XX_DLL_RESET_WIDTH 0x1
932#define OMAP54XX_DLL_RESET_MASK (1 << 3)
933
934/*
935 * Used by CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE, CM_CLKSEL_DPLL_IVA,
936 * CM_CLKSEL_DPLL_MPU, CM_CLKSEL_DPLL_PER, CM_CLKSEL_DPLL_UNIPRO1,
937 * CM_CLKSEL_DPLL_UNIPRO2, CM_CLKSEL_DPLL_USB
938 */
939#define OMAP54XX_DPLL_BYP_CLKSEL_SHIFT 23
940#define OMAP54XX_DPLL_BYP_CLKSEL_WIDTH 0x1
941#define OMAP54XX_DPLL_BYP_CLKSEL_MASK (1 << 23)
942
943/* Used by CM_CLKSEL_DPLL_CORE */
944#define OMAP54XX_DPLL_CLKOUTHIF_CLKSEL_SHIFT 20
945#define OMAP54XX_DPLL_CLKOUTHIF_CLKSEL_WIDTH 0x1
946#define OMAP54XX_DPLL_CLKOUTHIF_CLKSEL_MASK (1 << 20)
947
948/* Used by CM_SHADOW_FREQ_CONFIG1 */
949#define OMAP54XX_DPLL_CORE_DPLL_EN_SHIFT 8
950#define OMAP54XX_DPLL_CORE_DPLL_EN_WIDTH 0x3
951#define OMAP54XX_DPLL_CORE_DPLL_EN_MASK (0x7 << 8)
952
953/* Used by CM_SHADOW_FREQ_CONFIG2 */
954#define OMAP54XX_DPLL_CORE_H12_DIV_SHIFT 2
955#define OMAP54XX_DPLL_CORE_H12_DIV_WIDTH 0x6
956#define OMAP54XX_DPLL_CORE_H12_DIV_MASK (0x3f << 2)
957
958/* Used by CM_SHADOW_FREQ_CONFIG1 */
959#define OMAP54XX_DPLL_CORE_M2_DIV_SHIFT 11
960#define OMAP54XX_DPLL_CORE_M2_DIV_WIDTH 0x5
961#define OMAP54XX_DPLL_CORE_M2_DIV_MASK (0x1f << 11)
962
963/*
964 * Used by CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE, CM_CLKSEL_DPLL_IVA,
965 * CM_CLKSEL_DPLL_MPU, CM_CLKSEL_DPLL_PER
966 */
967#define OMAP54XX_DPLL_DIV_SHIFT 0
968#define OMAP54XX_DPLL_DIV_WIDTH 0x7
969#define OMAP54XX_DPLL_DIV_MASK (0x7f << 0)
970
971/*
972 * Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_UNIPRO1,
973 * CM_CLKSEL_DPLL_UNIPRO2, CM_CLKSEL_DPLL_USB
974 */
975#define OMAP54XX_DPLL_DIV_0_7_SHIFT 0
976#define OMAP54XX_DPLL_DIV_0_7_WIDTH 0x8
977#define OMAP54XX_DPLL_DIV_0_7_MASK (0xff << 0)
978
979/*
980 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
981 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
982 */
983#define OMAP54XX_DPLL_DRIFTGUARD_EN_SHIFT 8
984#define OMAP54XX_DPLL_DRIFTGUARD_EN_WIDTH 0x1
985#define OMAP54XX_DPLL_DRIFTGUARD_EN_MASK (1 << 8)
986
987/*
988 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
989 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO1,
990 * CM_CLKMODE_DPLL_UNIPRO2, CM_CLKMODE_DPLL_USB
991 */
992#define OMAP54XX_DPLL_EN_SHIFT 0
993#define OMAP54XX_DPLL_EN_WIDTH 0x3
994#define OMAP54XX_DPLL_EN_MASK (0x7 << 0)
995
996/*
997 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
998 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
999 */
1000#define OMAP54XX_DPLL_LPMODE_EN_SHIFT 10
1001#define OMAP54XX_DPLL_LPMODE_EN_WIDTH 0x1
1002#define OMAP54XX_DPLL_LPMODE_EN_MASK (1 << 10)
1003
1004/*
1005 * Used by CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE, CM_CLKSEL_DPLL_IVA,
1006 * CM_CLKSEL_DPLL_MPU, CM_CLKSEL_DPLL_PER
1007 */
1008#define OMAP54XX_DPLL_MULT_SHIFT 8
1009#define OMAP54XX_DPLL_MULT_WIDTH 0xb
1010#define OMAP54XX_DPLL_MULT_MASK (0x7ff << 8)
1011
1012/*
1013 * Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_UNIPRO1,
1014 * CM_CLKSEL_DPLL_UNIPRO2, CM_CLKSEL_DPLL_USB
1015 */
1016#define OMAP54XX_DPLL_MULT_UNIPRO1_SHIFT 8
1017#define OMAP54XX_DPLL_MULT_UNIPRO1_WIDTH 0xc
1018#define OMAP54XX_DPLL_MULT_UNIPRO1_MASK (0xfff << 8)
1019
1020/*
1021 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
1022 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER
1023 */
1024#define OMAP54XX_DPLL_REGM4XEN_SHIFT 11
1025#define OMAP54XX_DPLL_REGM4XEN_WIDTH 0x1
1026#define OMAP54XX_DPLL_REGM4XEN_MASK (1 << 11)
1027
1028/* Used by CM_CLKSEL_DPLL_UNIPRO1, CM_CLKSEL_DPLL_UNIPRO2, CM_CLKSEL_DPLL_USB */
1029#define OMAP54XX_DPLL_SD_DIV_SHIFT 24
1030#define OMAP54XX_DPLL_SD_DIV_WIDTH 0x8
1031#define OMAP54XX_DPLL_SD_DIV_MASK (0xff << 24)
1032
1033/* Used by CM_CLKSEL_DPLL_UNIPRO1, CM_CLKSEL_DPLL_UNIPRO2, CM_CLKSEL_DPLL_USB */
1034#define OMAP54XX_DPLL_SELFREQDCO_SHIFT 21
1035#define OMAP54XX_DPLL_SELFREQDCO_WIDTH 0x1
1036#define OMAP54XX_DPLL_SELFREQDCO_MASK (1 << 21)
1037
1038/*
1039 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
1040 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO1,
1041 * CM_CLKMODE_DPLL_UNIPRO2, CM_CLKMODE_DPLL_USB
1042 */
1043#define OMAP54XX_DPLL_SSC_ACK_SHIFT 13
1044#define OMAP54XX_DPLL_SSC_ACK_WIDTH 0x1
1045#define OMAP54XX_DPLL_SSC_ACK_MASK (1 << 13)
1046
1047/*
1048 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
1049 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO1,
1050 * CM_CLKMODE_DPLL_UNIPRO2, CM_CLKMODE_DPLL_USB
1051 */
1052#define OMAP54XX_DPLL_SSC_DOWNSPREAD_SHIFT 14
1053#define OMAP54XX_DPLL_SSC_DOWNSPREAD_WIDTH 0x1
1054#define OMAP54XX_DPLL_SSC_DOWNSPREAD_MASK (1 << 14)
1055
1056/*
1057 * Used by CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE, CM_CLKMODE_DPLL_IVA,
1058 * CM_CLKMODE_DPLL_MPU, CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO1,
1059 * CM_CLKMODE_DPLL_UNIPRO2, CM_CLKMODE_DPLL_USB
1060 */
1061#define OMAP54XX_DPLL_SSC_EN_SHIFT 12
1062#define OMAP54XX_DPLL_SSC_EN_WIDTH 0x1
1063#define OMAP54XX_DPLL_SSC_EN_MASK (1 << 12)
1064
1065/* Used by CM_L4CFG_DYNAMICDEP */
1066#define OMAP54XX_DSP_DYNDEP_SHIFT 1
1067#define OMAP54XX_DSP_DYNDEP_WIDTH 0x1
1068#define OMAP54XX_DSP_DYNDEP_MASK (1 << 1)
1069
1070/* Used by CM_IPU_STATICDEP, CM_MPU_STATICDEP */
1071#define OMAP54XX_DSP_STATDEP_SHIFT 1
1072#define OMAP54XX_DSP_STATDEP_WIDTH 0x1
1073#define OMAP54XX_DSP_STATDEP_MASK (1 << 1)
1074
1075/* Used by CM_L3MAIN2_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
1076#define OMAP54XX_DSS_DYNDEP_SHIFT 8
1077#define OMAP54XX_DSS_DYNDEP_WIDTH 0x1
1078#define OMAP54XX_DSS_DYNDEP_MASK (1 << 8)
1079
1080/* Used by CM_DMA_STATICDEP, CM_IPU_STATICDEP, CM_MPU_STATICDEP */
1081#define OMAP54XX_DSS_STATDEP_SHIFT 8
1082#define OMAP54XX_DSS_STATDEP_WIDTH 0x1
1083#define OMAP54XX_DSS_STATDEP_MASK (1 << 8)
1084
1085/*
1086 * Used by CM_C2C_DYNAMICDEP, CM_L3MAIN1_DYNAMICDEP, CM_L4CFG_DYNAMICDEP,
1087 * CM_MIPIEXT_DYNAMICDEP, CM_MPU_DYNAMICDEP
1088 */
1089#define OMAP54XX_EMIF_DYNDEP_SHIFT 4
1090#define OMAP54XX_EMIF_DYNDEP_WIDTH 0x1
1091#define OMAP54XX_EMIF_DYNDEP_MASK (1 << 4)
1092
1093/*
1094 * Used by CM_C2C_STATICDEP, CM_CAM_STATICDEP, CM_DMA_STATICDEP,
1095 * CM_DSP_STATICDEP, CM_DSS_STATICDEP, CM_GPU_STATICDEP, CM_IPU_STATICDEP,
1096 * CM_IVA_STATICDEP, CM_L3INIT_STATICDEP, CM_L4SEC_STATICDEP,
1097 * CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1098 */
1099#define OMAP54XX_EMIF_STATDEP_SHIFT 4
1100#define OMAP54XX_EMIF_STATDEP_WIDTH 0x1
1101#define OMAP54XX_EMIF_STATDEP_MASK (1 << 4)
1102
1103/* Used by CM_SHADOW_FREQ_CONFIG1 */
1104#define OMAP54XX_FREQ_UPDATE_SHIFT 0
1105#define OMAP54XX_FREQ_UPDATE_WIDTH 0x1
1106#define OMAP54XX_FREQ_UPDATE_MASK (1 << 0)
1107
1108/* Used by REVISION_CM_CORE, REVISION_CM_CORE_AON */
1109#define OMAP54XX_FUNC_SHIFT 16
1110#define OMAP54XX_FUNC_WIDTH 0xc
1111#define OMAP54XX_FUNC_MASK (0xfff << 16)
1112
1113/* Used by CM_SHADOW_FREQ_CONFIG2 */
1114#define OMAP54XX_GPMC_FREQ_UPDATE_SHIFT 0
1115#define OMAP54XX_GPMC_FREQ_UPDATE_WIDTH 0x1
1116#define OMAP54XX_GPMC_FREQ_UPDATE_MASK (1 << 0)
1117
1118/* Used by CM_L3MAIN2_DYNAMICDEP */
1119#define OMAP54XX_GPU_DYNDEP_SHIFT 10
1120#define OMAP54XX_GPU_DYNDEP_WIDTH 0x1
1121#define OMAP54XX_GPU_DYNDEP_MASK (1 << 10)
1122
1123/* Used by CM_IPU_STATICDEP, CM_MPU_STATICDEP */
1124#define OMAP54XX_GPU_STATDEP_SHIFT 10
1125#define OMAP54XX_GPU_STATDEP_WIDTH 0x1
1126#define OMAP54XX_GPU_STATDEP_MASK (1 << 10)
1127
1128/*
1129 * Used by CM_ABE_AESS_CLKCTRL, CM_ABE_DMIC_CLKCTRL, CM_ABE_L4_ABE_CLKCTRL,
1130 * CM_ABE_MCASP_CLKCTRL, CM_ABE_MCBSP1_CLKCTRL, CM_ABE_MCBSP2_CLKCTRL,
1131 * CM_ABE_MCBSP3_CLKCTRL, CM_ABE_MCPDM_CLKCTRL, CM_ABE_SLIMBUS1_CLKCTRL,
1132 * CM_ABE_TIMER5_CLKCTRL, CM_ABE_TIMER6_CLKCTRL, CM_ABE_TIMER7_CLKCTRL,
1133 * CM_ABE_TIMER8_CLKCTRL, CM_ABE_WD_TIMER3_CLKCTRL, CM_C2C_C2C_CLKCTRL,
1134 * CM_C2C_C2C_OCP_FW_CLKCTRL, CM_C2C_MODEM_ICR_CLKCTRL, CM_CAM_CAL_CLKCTRL,
1135 * CM_CAM_FDIF_CLKCTRL, CM_CAM_ISS_CLKCTRL, CM_CM_CORE_AON_PROFILING_CLKCTRL,
1136 * CM_CM_CORE_PROFILING_CLKCTRL, CM_COREAON_SMARTREFLEX_CORE_CLKCTRL,
1137 * CM_COREAON_SMARTREFLEX_MM_CLKCTRL, CM_COREAON_SMARTREFLEX_MPU_CLKCTRL,
1138 * CM_CUSTEFUSE_EFUSE_CTRL_CUST_CLKCTRL, CM_DMA_DMA_SYSTEM_CLKCTRL,
1139 * CM_DSP_DSP_CLKCTRL, CM_DSS_BB2D_CLKCTRL, CM_DSS_DSS_CLKCTRL,
1140 * CM_EMIF_DMM_CLKCTRL, CM_EMIF_EMIF1_CLKCTRL, CM_EMIF_EMIF2_CLKCTRL,
1141 * CM_EMIF_EMIF_OCP_FW_CLKCTRL, CM_EMU_DEBUGSS_CLKCTRL,
1142 * CM_EMU_MPU_EMU_DBG_CLKCTRL, CM_GPU_GPU_CLKCTRL, CM_IPU_IPU_CLKCTRL,
1143 * CM_IVA_IVA_CLKCTRL, CM_IVA_SL2_CLKCTRL, CM_L3INIT_HSI_CLKCTRL,
1144 * CM_L3INIT_IEEE1500_2_OCP_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL,
1145 * CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_MPHY_UNIPRO2_CLKCTRL,
1146 * CM_L3INIT_OCP2SCP1_CLKCTRL, CM_L3INIT_OCP2SCP3_CLKCTRL,
1147 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_UNIPRO2_CLKCTRL,
1148 * CM_L3INIT_USB_HOST_HS_CLKCTRL, CM_L3INIT_USB_OTG_SS_CLKCTRL,
1149 * CM_L3INIT_USB_TLL_HS_CLKCTRL, CM_L3INSTR_CTRL_MODULE_BANDGAP_CLKCTRL,
1150 * CM_L3INSTR_DLL_AGING_CLKCTRL, CM_L3INSTR_L3_INSTR_CLKCTRL,
1151 * CM_L3INSTR_L3_MAIN_3_CLKCTRL, CM_L3INSTR_OCP_WP_NOC_CLKCTRL,
1152 * CM_L3MAIN1_L3_MAIN_1_CLKCTRL, CM_L3MAIN2_GPMC_CLKCTRL,
1153 * CM_L3MAIN2_L3_MAIN_2_CLKCTRL, CM_L3MAIN2_OCMC_RAM_CLKCTRL,
1154 * CM_L4CFG_L4_CFG_CLKCTRL, CM_L4CFG_MAILBOX_CLKCTRL,
1155 * CM_L4CFG_OCP2SCP2_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL,
1156 * CM_L4CFG_SPINLOCK_CLKCTRL, CM_L4PER_ELM_CLKCTRL, CM_L4PER_GPIO2_CLKCTRL,
1157 * CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, CM_L4PER_GPIO5_CLKCTRL,
1158 * CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_GPIO7_CLKCTRL, CM_L4PER_GPIO8_CLKCTRL,
1159 * CM_L4PER_HDQ1W_CLKCTRL, CM_L4PER_I2C1_CLKCTRL, CM_L4PER_I2C2_CLKCTRL,
1160 * CM_L4PER_I2C3_CLKCTRL, CM_L4PER_I2C4_CLKCTRL, CM_L4PER_I2C5_CLKCTRL,
1161 * CM_L4PER_L4_PER_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, CM_L4PER_MCSPI2_CLKCTRL,
1162 * CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, CM_L4PER_MMC3_CLKCTRL,
1163 * CM_L4PER_MMC4_CLKCTRL, CM_L4PER_MMC5_CLKCTRL, CM_L4PER_TIMER10_CLKCTRL,
1164 * CM_L4PER_TIMER11_CLKCTRL, CM_L4PER_TIMER2_CLKCTRL, CM_L4PER_TIMER3_CLKCTRL,
1165 * CM_L4PER_TIMER4_CLKCTRL, CM_L4PER_TIMER9_CLKCTRL, CM_L4PER_UART1_CLKCTRL,
1166 * CM_L4PER_UART2_CLKCTRL, CM_L4PER_UART3_CLKCTRL, CM_L4PER_UART4_CLKCTRL,
1167 * CM_L4PER_UART5_CLKCTRL, CM_L4PER_UART6_CLKCTRL, CM_L4SEC_AES1_CLKCTRL,
1168 * CM_L4SEC_AES2_CLKCTRL, CM_L4SEC_DES3DES_CLKCTRL,
1169 * CM_L4SEC_DMA_CRYPTO_CLKCTRL, CM_L4SEC_FPKA_CLKCTRL, CM_L4SEC_RNG_CLKCTRL,
1170 * CM_L4SEC_SHA2MD5_CLKCTRL, CM_MIPIEXT_LLI_CLKCTRL,
1171 * CM_MIPIEXT_LLI_OCP_FW_CLKCTRL, CM_MIPIEXT_MPHY_CLKCTRL, CM_MPU_MPU_CLKCTRL,
1172 * CM_MPU_MPU_MPU_DBG_CLKCTRL, CM_WKUPAON_COUNTER_32K_CLKCTRL,
1173 * CM_WKUPAON_GPIO1_CLKCTRL, CM_WKUPAON_KBD_CLKCTRL,
1174 * CM_WKUPAON_L4_WKUP_CLKCTRL, CM_WKUPAON_SAR_RAM_CLKCTRL,
1175 * CM_WKUPAON_TIMER12_CLKCTRL, CM_WKUPAON_TIMER1_CLKCTRL,
1176 * CM_WKUPAON_WD_TIMER1_CLKCTRL, CM_WKUPAON_WD_TIMER2_CLKCTRL
1177 */
1178#define OMAP54XX_IDLEST_SHIFT 16
1179#define OMAP54XX_IDLEST_WIDTH 0x2
1180#define OMAP54XX_IDLEST_MASK (0x3 << 16)
1181
1182/* Used by CM_L3MAIN2_DYNAMICDEP */
1183#define OMAP54XX_IPU_DYNDEP_SHIFT 0
1184#define OMAP54XX_IPU_DYNDEP_WIDTH 0x1
1185#define OMAP54XX_IPU_DYNDEP_MASK (1 << 0)
1186
1187/* Used by CM_DMA_STATICDEP, CM_MPU_STATICDEP */
1188#define OMAP54XX_IPU_STATDEP_SHIFT 0
1189#define OMAP54XX_IPU_STATDEP_WIDTH 0x1
1190#define OMAP54XX_IPU_STATDEP_MASK (1 << 0)
1191
1192/* Used by CM_DSP_DYNAMICDEP, CM_L3MAIN2_DYNAMICDEP */
1193#define OMAP54XX_IVA_DYNDEP_SHIFT 2
1194#define OMAP54XX_IVA_DYNDEP_WIDTH 0x1
1195#define OMAP54XX_IVA_DYNDEP_MASK (1 << 2)
1196
1197/*
1198 * Used by CM_C2C_STATICDEP, CM_CAM_STATICDEP, CM_DMA_STATICDEP,
1199 * CM_DSP_STATICDEP, CM_DSS_STATICDEP, CM_GPU_STATICDEP, CM_IPU_STATICDEP,
1200 * CM_L3INIT_STATICDEP, CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1201 */
1202#define OMAP54XX_IVA_STATDEP_SHIFT 2
1203#define OMAP54XX_IVA_STATDEP_WIDTH 0x1
1204#define OMAP54XX_IVA_STATDEP_MASK (1 << 2)
1205
1206/* Used by CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
1207#define OMAP54XX_L3INIT_DYNDEP_SHIFT 7
1208#define OMAP54XX_L3INIT_DYNDEP_WIDTH 0x1
1209#define OMAP54XX_L3INIT_DYNDEP_MASK (1 << 7)
1210
1211/*
1212 * Used by CM_C2C_STATICDEP, CM_DMA_STATICDEP, CM_DSP_STATICDEP,
1213 * CM_IPU_STATICDEP, CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1214 */
1215#define OMAP54XX_L3INIT_STATDEP_SHIFT 7
1216#define OMAP54XX_L3INIT_STATDEP_WIDTH 0x1
1217#define OMAP54XX_L3INIT_STATDEP_MASK (1 << 7)
1218
1219/*
1220 * Used by CM_DSP_DYNAMICDEP, CM_DSS_DYNAMICDEP, CM_L3INIT_DYNAMICDEP,
1221 * CM_L3MAIN2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_MPU_DYNAMICDEP
1222 */
1223#define OMAP54XX_L3MAIN1_DYNDEP_SHIFT 5
1224#define OMAP54XX_L3MAIN1_DYNDEP_WIDTH 0x1
1225#define OMAP54XX_L3MAIN1_DYNDEP_MASK (1 << 5)
1226
1227/*
1228 * Used by CM_C2C_STATICDEP, CM_CAM_STATICDEP, CM_DMA_STATICDEP,
1229 * CM_DSP_STATICDEP, CM_DSS_STATICDEP, CM_GPU_STATICDEP, CM_IPU_STATICDEP,
1230 * CM_IVA_STATICDEP, CM_L3INIT_STATICDEP, CM_L4SEC_STATICDEP,
1231 * CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1232 */
1233#define OMAP54XX_L3MAIN1_STATDEP_SHIFT 5
1234#define OMAP54XX_L3MAIN1_STATDEP_WIDTH 0x1
1235#define OMAP54XX_L3MAIN1_STATDEP_MASK (1 << 5)
1236
1237/*
1238 * Used by CM_C2C_DYNAMICDEP, CM_CAM_DYNAMICDEP, CM_DMA_DYNAMICDEP,
1239 * CM_DSS_DYNAMICDEP, CM_EMU_DYNAMICDEP, CM_GPU_DYNAMICDEP, CM_IPU_DYNAMICDEP,
1240 * CM_IVA_DYNAMICDEP, CM_L3INIT_DYNAMICDEP, CM_L3MAIN1_DYNAMICDEP,
1241 * CM_L4CFG_DYNAMICDEP, CM_L4SEC_DYNAMICDEP, CM_MIPIEXT_DYNAMICDEP
1242 */
1243#define OMAP54XX_L3MAIN2_DYNDEP_SHIFT 6
1244#define OMAP54XX_L3MAIN2_DYNDEP_WIDTH 0x1
1245#define OMAP54XX_L3MAIN2_DYNDEP_MASK (1 << 6)
1246
1247/*
1248 * Used by CM_C2C_STATICDEP, CM_CAM_STATICDEP, CM_DMA_STATICDEP,
1249 * CM_DSP_STATICDEP, CM_DSS_STATICDEP, CM_GPU_STATICDEP, CM_IPU_STATICDEP,
1250 * CM_IVA_STATICDEP, CM_L3INIT_STATICDEP, CM_L4SEC_STATICDEP,
1251 * CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1252 */
1253#define OMAP54XX_L3MAIN2_STATDEP_SHIFT 6
1254#define OMAP54XX_L3MAIN2_STATDEP_WIDTH 0x1
1255#define OMAP54XX_L3MAIN2_STATDEP_MASK (1 << 6)
1256
1257/* Used by CM_L3MAIN1_DYNAMICDEP */
1258#define OMAP54XX_L4CFG_DYNDEP_SHIFT 12
1259#define OMAP54XX_L4CFG_DYNDEP_WIDTH 0x1
1260#define OMAP54XX_L4CFG_DYNDEP_MASK (1 << 12)
1261
1262/*
1263 * Used by CM_C2C_STATICDEP, CM_DMA_STATICDEP, CM_DSP_STATICDEP,
1264 * CM_IPU_STATICDEP, CM_L3INIT_STATICDEP, CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1265 */
1266#define OMAP54XX_L4CFG_STATDEP_SHIFT 12
1267#define OMAP54XX_L4CFG_STATDEP_WIDTH 0x1
1268#define OMAP54XX_L4CFG_STATDEP_MASK (1 << 12)
1269
1270/* Used by CM_L3MAIN2_DYNAMICDEP */
1271#define OMAP54XX_L4PER_DYNDEP_SHIFT 13
1272#define OMAP54XX_L4PER_DYNDEP_WIDTH 0x1
1273#define OMAP54XX_L4PER_DYNDEP_MASK (1 << 13)
1274
1275/*
1276 * Used by CM_C2C_STATICDEP, CM_DMA_STATICDEP, CM_DSP_STATICDEP,
1277 * CM_IPU_STATICDEP, CM_L3INIT_STATICDEP, CM_L4SEC_STATICDEP,
1278 * CM_MIPIEXT_STATICDEP, CM_MPU_STATICDEP
1279 */
1280#define OMAP54XX_L4PER_STATDEP_SHIFT 13
1281#define OMAP54XX_L4PER_STATDEP_WIDTH 0x1
1282#define OMAP54XX_L4PER_STATDEP_MASK (1 << 13)
1283
1284/* Used by CM_L3MAIN2_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
1285#define OMAP54XX_L4SEC_DYNDEP_SHIFT 14
1286#define OMAP54XX_L4SEC_DYNDEP_WIDTH 0x1
1287#define OMAP54XX_L4SEC_DYNDEP_MASK (1 << 14)
1288
1289/*
1290 * Used by CM_DMA_STATICDEP, CM_IPU_STATICDEP, CM_L3INIT_STATICDEP,
1291 * CM_MPU_STATICDEP
1292 */
1293#define OMAP54XX_L4SEC_STATDEP_SHIFT 14
1294#define OMAP54XX_L4SEC_STATDEP_WIDTH 0x1
1295#define OMAP54XX_L4SEC_STATDEP_MASK (1 << 14)
1296
1297/* Used by CM_L3MAIN2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
1298#define OMAP54XX_MIPIEXT_DYNDEP_SHIFT 21
1299#define OMAP54XX_MIPIEXT_DYNDEP_WIDTH 0x1
1300#define OMAP54XX_MIPIEXT_DYNDEP_MASK (1 << 21)
1301
1302/* Used by CM_MPU_STATICDEP */
1303#define OMAP54XX_MIPIEXT_STATDEP_SHIFT 21
1304#define OMAP54XX_MIPIEXT_STATDEP_WIDTH 0x1
1305#define OMAP54XX_MIPIEXT_STATDEP_MASK (1 << 21)
1306
1307/*
1308 * Used by CM_SSC_MODFREQDIV_DPLL_ABE, CM_SSC_MODFREQDIV_DPLL_CORE,
1309 * CM_SSC_MODFREQDIV_DPLL_IVA, CM_SSC_MODFREQDIV_DPLL_MPU,
1310 * CM_SSC_MODFREQDIV_DPLL_PER, CM_SSC_MODFREQDIV_DPLL_UNIPRO1,
1311 * CM_SSC_MODFREQDIV_DPLL_UNIPRO2, CM_SSC_MODFREQDIV_DPLL_USB
1312 */
1313#define OMAP54XX_MODFREQDIV_EXPONENT_SHIFT 8
1314#define OMAP54XX_MODFREQDIV_EXPONENT_WIDTH 0x3
1315#define OMAP54XX_MODFREQDIV_EXPONENT_MASK (0x7 << 8)
1316
1317/*
1318 * Used by CM_SSC_MODFREQDIV_DPLL_ABE, CM_SSC_MODFREQDIV_DPLL_CORE,
1319 * CM_SSC_MODFREQDIV_DPLL_IVA, CM_SSC_MODFREQDIV_DPLL_MPU,
1320 * CM_SSC_MODFREQDIV_DPLL_PER, CM_SSC_MODFREQDIV_DPLL_UNIPRO1,
1321 * CM_SSC_MODFREQDIV_DPLL_UNIPRO2, CM_SSC_MODFREQDIV_DPLL_USB
1322 */
1323#define OMAP54XX_MODFREQDIV_MANTISSA_SHIFT 0
1324#define OMAP54XX_MODFREQDIV_MANTISSA_WIDTH 0x7
1325#define OMAP54XX_MODFREQDIV_MANTISSA_MASK (0x7f << 0)
1326
1327/*
1328 * Used by CM_ABE_AESS_CLKCTRL, CM_ABE_DMIC_CLKCTRL, CM_ABE_L4_ABE_CLKCTRL,
1329 * CM_ABE_MCASP_CLKCTRL, CM_ABE_MCBSP1_CLKCTRL, CM_ABE_MCBSP2_CLKCTRL,
1330 * CM_ABE_MCBSP3_CLKCTRL, CM_ABE_MCPDM_CLKCTRL, CM_ABE_SLIMBUS1_CLKCTRL,
1331 * CM_ABE_TIMER5_CLKCTRL, CM_ABE_TIMER6_CLKCTRL, CM_ABE_TIMER7_CLKCTRL,
1332 * CM_ABE_TIMER8_CLKCTRL, CM_ABE_WD_TIMER3_CLKCTRL, CM_C2C_C2C_CLKCTRL,
1333 * CM_C2C_C2C_OCP_FW_CLKCTRL, CM_C2C_MODEM_ICR_CLKCTRL, CM_CAM_CAL_CLKCTRL,
1334 * CM_CAM_FDIF_CLKCTRL, CM_CAM_ISS_CLKCTRL, CM_CM_CORE_AON_PROFILING_CLKCTRL,
1335 * CM_CM_CORE_PROFILING_CLKCTRL, CM_COREAON_SMARTREFLEX_CORE_CLKCTRL,
1336 * CM_COREAON_SMARTREFLEX_MM_CLKCTRL, CM_COREAON_SMARTREFLEX_MPU_CLKCTRL,
1337 * CM_CUSTEFUSE_EFUSE_CTRL_CUST_CLKCTRL, CM_DMA_DMA_SYSTEM_CLKCTRL,
1338 * CM_DSP_DSP_CLKCTRL, CM_DSS_BB2D_CLKCTRL, CM_DSS_DSS_CLKCTRL,
1339 * CM_EMIF_DMM_CLKCTRL, CM_EMIF_EMIF1_CLKCTRL, CM_EMIF_EMIF2_CLKCTRL,
1340 * CM_EMIF_EMIF_OCP_FW_CLKCTRL, CM_EMU_DEBUGSS_CLKCTRL,
1341 * CM_EMU_MPU_EMU_DBG_CLKCTRL, CM_GPU_GPU_CLKCTRL, CM_IPU_IPU_CLKCTRL,
1342 * CM_IVA_IVA_CLKCTRL, CM_IVA_SL2_CLKCTRL, CM_L3INIT_HSI_CLKCTRL,
1343 * CM_L3INIT_IEEE1500_2_OCP_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL,
1344 * CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_MPHY_UNIPRO2_CLKCTRL,
1345 * CM_L3INIT_OCP2SCP1_CLKCTRL, CM_L3INIT_OCP2SCP3_CLKCTRL,
1346 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_UNIPRO2_CLKCTRL,
1347 * CM_L3INIT_USB_HOST_HS_CLKCTRL, CM_L3INIT_USB_OTG_SS_CLKCTRL,
1348 * CM_L3INIT_USB_TLL_HS_CLKCTRL, CM_L3INSTR_CTRL_MODULE_BANDGAP_CLKCTRL,
1349 * CM_L3INSTR_DLL_AGING_CLKCTRL, CM_L3INSTR_L3_INSTR_CLKCTRL,
1350 * CM_L3INSTR_L3_MAIN_3_CLKCTRL, CM_L3INSTR_OCP_WP_NOC_CLKCTRL,
1351 * CM_L3MAIN1_L3_MAIN_1_CLKCTRL, CM_L3MAIN2_GPMC_CLKCTRL,
1352 * CM_L3MAIN2_L3_MAIN_2_CLKCTRL, CM_L3MAIN2_OCMC_RAM_CLKCTRL,
1353 * CM_L4CFG_L4_CFG_CLKCTRL, CM_L4CFG_MAILBOX_CLKCTRL,
1354 * CM_L4CFG_OCP2SCP2_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL,
1355 * CM_L4CFG_SPINLOCK_CLKCTRL, CM_L4PER_ELM_CLKCTRL, CM_L4PER_GPIO2_CLKCTRL,
1356 * CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, CM_L4PER_GPIO5_CLKCTRL,
1357 * CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_GPIO7_CLKCTRL, CM_L4PER_GPIO8_CLKCTRL,
1358 * CM_L4PER_HDQ1W_CLKCTRL, CM_L4PER_I2C1_CLKCTRL, CM_L4PER_I2C2_CLKCTRL,
1359 * CM_L4PER_I2C3_CLKCTRL, CM_L4PER_I2C4_CLKCTRL, CM_L4PER_I2C5_CLKCTRL,
1360 * CM_L4PER_L4_PER_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, CM_L4PER_MCSPI2_CLKCTRL,
1361 * CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, CM_L4PER_MMC3_CLKCTRL,
1362 * CM_L4PER_MMC4_CLKCTRL, CM_L4PER_MMC5_CLKCTRL, CM_L4PER_TIMER10_CLKCTRL,
1363 * CM_L4PER_TIMER11_CLKCTRL, CM_L4PER_TIMER2_CLKCTRL, CM_L4PER_TIMER3_CLKCTRL,
1364 * CM_L4PER_TIMER4_CLKCTRL, CM_L4PER_TIMER9_CLKCTRL, CM_L4PER_UART1_CLKCTRL,
1365 * CM_L4PER_UART2_CLKCTRL, CM_L4PER_UART3_CLKCTRL, CM_L4PER_UART4_CLKCTRL,
1366 * CM_L4PER_UART5_CLKCTRL, CM_L4PER_UART6_CLKCTRL, CM_L4SEC_AES1_CLKCTRL,
1367 * CM_L4SEC_AES2_CLKCTRL, CM_L4SEC_DES3DES_CLKCTRL,
1368 * CM_L4SEC_DMA_CRYPTO_CLKCTRL, CM_L4SEC_FPKA_CLKCTRL, CM_L4SEC_RNG_CLKCTRL,
1369 * CM_L4SEC_SHA2MD5_CLKCTRL, CM_MIPIEXT_LLI_CLKCTRL,
1370 * CM_MIPIEXT_LLI_OCP_FW_CLKCTRL, CM_MIPIEXT_MPHY_CLKCTRL, CM_MPU_MPU_CLKCTRL,
1371 * CM_MPU_MPU_MPU_DBG_CLKCTRL, CM_WKUPAON_COUNTER_32K_CLKCTRL,
1372 * CM_WKUPAON_GPIO1_CLKCTRL, CM_WKUPAON_KBD_CLKCTRL,
1373 * CM_WKUPAON_L4_WKUP_CLKCTRL, CM_WKUPAON_SAR_RAM_CLKCTRL,
1374 * CM_WKUPAON_TIMER12_CLKCTRL, CM_WKUPAON_TIMER1_CLKCTRL,
1375 * CM_WKUPAON_WD_TIMER1_CLKCTRL, CM_WKUPAON_WD_TIMER2_CLKCTRL
1376 */
1377#define OMAP54XX_MODULEMODE_SHIFT 0
1378#define OMAP54XX_MODULEMODE_WIDTH 0x2
1379#define OMAP54XX_MODULEMODE_MASK (0x3 << 0)
1380
1381/* Used by CM_L4CFG_DYNAMICDEP */
1382#define OMAP54XX_MPU_DYNDEP_SHIFT 19
1383#define OMAP54XX_MPU_DYNDEP_WIDTH 0x1
1384#define OMAP54XX_MPU_DYNDEP_MASK (1 << 19)
1385
1386/* Used by CM_DSS_DSS_CLKCTRL */
1387#define OMAP54XX_OPTFCLKEN_32KHZ_CLK_SHIFT 11
1388#define OMAP54XX_OPTFCLKEN_32KHZ_CLK_WIDTH 0x1
1389#define OMAP54XX_OPTFCLKEN_32KHZ_CLK_MASK (1 << 11)
1390
1391/* Renamed from OPTFCLKEN_32KHZ_CLK Used by CM_L3INIT_MMC1_CLKCTRL */
1392#define OMAP54XX_OPTFCLKEN_32KHZ_CLK_8_8_SHIFT 8
1393#define OMAP54XX_OPTFCLKEN_32KHZ_CLK_8_8_WIDTH 0x1
1394#define OMAP54XX_OPTFCLKEN_32KHZ_CLK_8_8_MASK (1 << 8)
1395
1396/* Used by CM_DSS_DSS_CLKCTRL */
1397#define OMAP54XX_OPTFCLKEN_48MHZ_CLK_SHIFT 9
1398#define OMAP54XX_OPTFCLKEN_48MHZ_CLK_WIDTH 0x1
1399#define OMAP54XX_OPTFCLKEN_48MHZ_CLK_MASK (1 << 9)
1400
1401/* Used by CM_COREAON_USB_PHY_CORE_CLKCTRL */
1402#define OMAP54XX_OPTFCLKEN_CLK32K_SHIFT 8
1403#define OMAP54XX_OPTFCLKEN_CLK32K_WIDTH 0x1
1404#define OMAP54XX_OPTFCLKEN_CLK32K_MASK (1 << 8)
1405
1406/* Used by CM_CAM_ISS_CLKCTRL */
1407#define OMAP54XX_OPTFCLKEN_CTRLCLK_SHIFT 8
1408#define OMAP54XX_OPTFCLKEN_CTRLCLK_WIDTH 0x1
1409#define OMAP54XX_OPTFCLKEN_CTRLCLK_MASK (1 << 8)
1410
1411/*
1412 * Used by CM_L4PER_GPIO2_CLKCTRL, CM_L4PER_GPIO3_CLKCTRL,
1413 * CM_L4PER_GPIO4_CLKCTRL, CM_L4PER_GPIO5_CLKCTRL, CM_L4PER_GPIO6_CLKCTRL,
1414 * CM_L4PER_GPIO7_CLKCTRL, CM_L4PER_GPIO8_CLKCTRL, CM_WKUPAON_GPIO1_CLKCTRL
1415 */
1416#define OMAP54XX_OPTFCLKEN_DBCLK_SHIFT 8
1417#define OMAP54XX_OPTFCLKEN_DBCLK_WIDTH 0x1
1418#define OMAP54XX_OPTFCLKEN_DBCLK_MASK (1 << 8)
1419
1420/* Used by CM_EMIF_EMIF_DLL_CLKCTRL */
1421#define OMAP54XX_OPTFCLKEN_DLL_CLK_SHIFT 8
1422#define OMAP54XX_OPTFCLKEN_DLL_CLK_WIDTH 0x1
1423#define OMAP54XX_OPTFCLKEN_DLL_CLK_MASK (1 << 8)
1424
1425/* Used by CM_DSS_DSS_CLKCTRL */
1426#define OMAP54XX_OPTFCLKEN_DSSCLK_SHIFT 8
1427#define OMAP54XX_OPTFCLKEN_DSSCLK_WIDTH 0x1
1428#define OMAP54XX_OPTFCLKEN_DSSCLK_MASK (1 << 8)
1429
1430/* Used by CM_ABE_SLIMBUS1_CLKCTRL */
1431#define OMAP54XX_OPTFCLKEN_FCLK0_SHIFT 8
1432#define OMAP54XX_OPTFCLKEN_FCLK0_WIDTH 0x1
1433#define OMAP54XX_OPTFCLKEN_FCLK0_MASK (1 << 8)
1434
1435/* Used by CM_ABE_SLIMBUS1_CLKCTRL */
1436#define OMAP54XX_OPTFCLKEN_FCLK1_SHIFT 9
1437#define OMAP54XX_OPTFCLKEN_FCLK1_WIDTH 0x1
1438#define OMAP54XX_OPTFCLKEN_FCLK1_MASK (1 << 9)
1439
1440/* Used by CM_ABE_SLIMBUS1_CLKCTRL */
1441#define OMAP54XX_OPTFCLKEN_FCLK2_SHIFT 10
1442#define OMAP54XX_OPTFCLKEN_FCLK2_WIDTH 0x1
1443#define OMAP54XX_OPTFCLKEN_FCLK2_MASK (1 << 10)
1444
1445/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1446#define OMAP54XX_OPTFCLKEN_FUNC48M_CLK_SHIFT 15
1447#define OMAP54XX_OPTFCLKEN_FUNC48M_CLK_WIDTH 0x1
1448#define OMAP54XX_OPTFCLKEN_FUNC48M_CLK_MASK (1 << 15)
1449
1450/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1451#define OMAP54XX_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT 13
1452#define OMAP54XX_OPTFCLKEN_HSIC480M_P1_CLK_WIDTH 0x1
1453#define OMAP54XX_OPTFCLKEN_HSIC480M_P1_CLK_MASK (1 << 13)
1454
1455/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1456#define OMAP54XX_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT 14
1457#define OMAP54XX_OPTFCLKEN_HSIC480M_P2_CLK_WIDTH 0x1
1458#define OMAP54XX_OPTFCLKEN_HSIC480M_P2_CLK_MASK (1 << 14)
1459
1460/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1461#define OMAP54XX_OPTFCLKEN_HSIC480M_P3_CLK_SHIFT 7
1462#define OMAP54XX_OPTFCLKEN_HSIC480M_P3_CLK_WIDTH 0x1
1463#define OMAP54XX_OPTFCLKEN_HSIC480M_P3_CLK_MASK (1 << 7)
1464
1465/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1466#define OMAP54XX_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT 11
1467#define OMAP54XX_OPTFCLKEN_HSIC60M_P1_CLK_WIDTH 0x1
1468#define OMAP54XX_OPTFCLKEN_HSIC60M_P1_CLK_MASK (1 << 11)
1469
1470/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1471#define OMAP54XX_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT 12
1472#define OMAP54XX_OPTFCLKEN_HSIC60M_P2_CLK_WIDTH 0x1
1473#define OMAP54XX_OPTFCLKEN_HSIC60M_P2_CLK_MASK (1 << 12)
1474
1475/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1476#define OMAP54XX_OPTFCLKEN_HSIC60M_P3_CLK_SHIFT 6
1477#define OMAP54XX_OPTFCLKEN_HSIC60M_P3_CLK_WIDTH 0x1
1478#define OMAP54XX_OPTFCLKEN_HSIC60M_P3_CLK_MASK (1 << 6)
1479
1480/* Used by CM_L3INIT_USB_OTG_SS_CLKCTRL */
1481#define OMAP54XX_OPTFCLKEN_REFCLK960M_SHIFT 8
1482#define OMAP54XX_OPTFCLKEN_REFCLK960M_WIDTH 0x1
1483#define OMAP54XX_OPTFCLKEN_REFCLK960M_MASK (1 << 8)
1484
1485/* Used by CM_L3INIT_SATA_CLKCTRL */
1486#define OMAP54XX_OPTFCLKEN_REF_CLK_SHIFT 8
1487#define OMAP54XX_OPTFCLKEN_REF_CLK_WIDTH 0x1
1488#define OMAP54XX_OPTFCLKEN_REF_CLK_MASK (1 << 8)
1489
1490/* Used by CM_WKUPAON_SCRM_CLKCTRL */
1491#define OMAP54XX_OPTFCLKEN_SCRM_CORE_SHIFT 8
1492#define OMAP54XX_OPTFCLKEN_SCRM_CORE_WIDTH 0x1
1493#define OMAP54XX_OPTFCLKEN_SCRM_CORE_MASK (1 << 8)
1494
1495/* Used by CM_WKUPAON_SCRM_CLKCTRL */
1496#define OMAP54XX_OPTFCLKEN_SCRM_PER_SHIFT 9
1497#define OMAP54XX_OPTFCLKEN_SCRM_PER_WIDTH 0x1
1498#define OMAP54XX_OPTFCLKEN_SCRM_PER_MASK (1 << 9)
1499
1500/* Used by CM_ABE_SLIMBUS1_CLKCTRL */
1501#define OMAP54XX_OPTFCLKEN_SLIMBUS_CLK_SHIFT 11
1502#define OMAP54XX_OPTFCLKEN_SLIMBUS_CLK_WIDTH 0x1
1503#define OMAP54XX_OPTFCLKEN_SLIMBUS_CLK_MASK (1 << 11)
1504
1505/* Used by CM_DSS_DSS_CLKCTRL */
1506#define OMAP54XX_OPTFCLKEN_SYS_CLK_SHIFT 10
1507#define OMAP54XX_OPTFCLKEN_SYS_CLK_WIDTH 0x1
1508#define OMAP54XX_OPTFCLKEN_SYS_CLK_MASK (1 << 10)
1509
1510/* Used by CM_MIPIEXT_LLI_CLKCTRL */
1511#define OMAP54XX_OPTFCLKEN_TXPHY_CLK_SHIFT 8
1512#define OMAP54XX_OPTFCLKEN_TXPHY_CLK_WIDTH 0x1
1513#define OMAP54XX_OPTFCLKEN_TXPHY_CLK_MASK (1 << 8)
1514
1515/* Used by CM_MIPIEXT_LLI_CLKCTRL */
1516#define OMAP54XX_OPTFCLKEN_TXPHY_LS_CLK_SHIFT 9
1517#define OMAP54XX_OPTFCLKEN_TXPHY_LS_CLK_WIDTH 0x1
1518#define OMAP54XX_OPTFCLKEN_TXPHY_LS_CLK_MASK (1 << 9)
1519
1520/* Used by CM_L3INIT_USB_TLL_HS_CLKCTRL */
1521#define OMAP54XX_OPTFCLKEN_USB_CH0_CLK_SHIFT 8
1522#define OMAP54XX_OPTFCLKEN_USB_CH0_CLK_WIDTH 0x1
1523#define OMAP54XX_OPTFCLKEN_USB_CH0_CLK_MASK (1 << 8)
1524
1525/* Used by CM_L3INIT_USB_TLL_HS_CLKCTRL */
1526#define OMAP54XX_OPTFCLKEN_USB_CH1_CLK_SHIFT 9
1527#define OMAP54XX_OPTFCLKEN_USB_CH1_CLK_WIDTH 0x1
1528#define OMAP54XX_OPTFCLKEN_USB_CH1_CLK_MASK (1 << 9)
1529
1530/* Used by CM_L3INIT_USB_TLL_HS_CLKCTRL */
1531#define OMAP54XX_OPTFCLKEN_USB_CH2_CLK_SHIFT 10
1532#define OMAP54XX_OPTFCLKEN_USB_CH2_CLK_WIDTH 0x1
1533#define OMAP54XX_OPTFCLKEN_USB_CH2_CLK_MASK (1 << 10)
1534
1535/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1536#define OMAP54XX_OPTFCLKEN_UTMI_P1_CLK_SHIFT 8
1537#define OMAP54XX_OPTFCLKEN_UTMI_P1_CLK_WIDTH 0x1
1538#define OMAP54XX_OPTFCLKEN_UTMI_P1_CLK_MASK (1 << 8)
1539
1540/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1541#define OMAP54XX_OPTFCLKEN_UTMI_P2_CLK_SHIFT 9
1542#define OMAP54XX_OPTFCLKEN_UTMI_P2_CLK_WIDTH 0x1
1543#define OMAP54XX_OPTFCLKEN_UTMI_P2_CLK_MASK (1 << 9)
1544
1545/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL */
1546#define OMAP54XX_OPTFCLKEN_UTMI_P3_CLK_SHIFT 10
1547#define OMAP54XX_OPTFCLKEN_UTMI_P3_CLK_WIDTH 0x1
1548#define OMAP54XX_OPTFCLKEN_UTMI_P3_CLK_MASK (1 << 10)
1549
1550/* Used by CM_CORE_AON_DEBUG_OUT, CM_CORE_DEBUG_OUT */
1551#define OMAP54XX_OUTPUT_SHIFT 0
1552#define OMAP54XX_OUTPUT_WIDTH 0x20
1553#define OMAP54XX_OUTPUT_MASK (0xffffffff << 0)
1554
1555/* Used by CM_CLKSEL_ABE */
1556#define OMAP54XX_PAD_CLKS_GATE_SHIFT 8
1557#define OMAP54XX_PAD_CLKS_GATE_WIDTH 0x1
1558#define OMAP54XX_PAD_CLKS_GATE_MASK (1 << 8)
1559
1560/* Used by CM_RESTORE_ST */
1561#define OMAP54XX_PHASE1_COMPLETED_SHIFT 0
1562#define OMAP54XX_PHASE1_COMPLETED_WIDTH 0x1
1563#define OMAP54XX_PHASE1_COMPLETED_MASK (1 << 0)
1564
1565/* Used by CM_RESTORE_ST */
1566#define OMAP54XX_PHASE2A_COMPLETED_SHIFT 1
1567#define OMAP54XX_PHASE2A_COMPLETED_WIDTH 0x1
1568#define OMAP54XX_PHASE2A_COMPLETED_MASK (1 << 1)
1569
1570/* Used by CM_RESTORE_ST */
1571#define OMAP54XX_PHASE2B_COMPLETED_SHIFT 2
1572#define OMAP54XX_PHASE2B_COMPLETED_WIDTH 0x1
1573#define OMAP54XX_PHASE2B_COMPLETED_MASK (1 << 2)
1574
1575/* Used by CM_DYN_DEP_PRESCAL */
1576#define OMAP54XX_PRESCAL_SHIFT 0
1577#define OMAP54XX_PRESCAL_WIDTH 0x6
1578#define OMAP54XX_PRESCAL_MASK (0x3f << 0)
1579
1580/* Used by REVISION_CM_CORE, REVISION_CM_CORE_AON */
1581#define OMAP54XX_R_RTL_SHIFT 11
1582#define OMAP54XX_R_RTL_WIDTH 0x5
1583#define OMAP54XX_R_RTL_MASK (0x1f << 11)
1584
1585/* Used by CM_L3INIT_USB_HOST_HS_CLKCTRL, CM_L3INIT_USB_TLL_HS_CLKCTRL */
1586#define OMAP54XX_SAR_MODE_SHIFT 4
1587#define OMAP54XX_SAR_MODE_WIDTH 0x1
1588#define OMAP54XX_SAR_MODE_MASK (1 << 4)
1589
1590/* Used by REVISION_CM_CORE, REVISION_CM_CORE_AON */
1591#define OMAP54XX_SCHEME_SHIFT 30
1592#define OMAP54XX_SCHEME_WIDTH 0x2
1593#define OMAP54XX_SCHEME_MASK (0x3 << 30)
1594
1595/* Used by CM_L4CFG_DYNAMICDEP */
1596#define OMAP54XX_SDMA_DYNDEP_SHIFT 11
1597#define OMAP54XX_SDMA_DYNDEP_WIDTH 0x1
1598#define OMAP54XX_SDMA_DYNDEP_MASK (1 << 11)
1599
1600/* Used by CM_IPU_STATICDEP, CM_MPU_STATICDEP */
1601#define OMAP54XX_SDMA_STATDEP_SHIFT 11
1602#define OMAP54XX_SDMA_STATDEP_WIDTH 0x1
1603#define OMAP54XX_SDMA_STATDEP_MASK (1 << 11)
1604
1605/* Used by CM_CORE_AON_DEBUG_CFG */
1606#define OMAP54XX_SEL0_SHIFT 0
1607#define OMAP54XX_SEL0_WIDTH 0x7
1608#define OMAP54XX_SEL0_MASK (0x7f << 0)
1609
1610/* Renamed from SEL0 Used by CM_CORE_DEBUG_CFG */
1611#define OMAP54XX_SEL0_0_7_SHIFT 0
1612#define OMAP54XX_SEL0_0_7_WIDTH 0x8
1613#define OMAP54XX_SEL0_0_7_MASK (0xff << 0)
1614
1615/* Used by CM_CORE_AON_DEBUG_CFG */
1616#define OMAP54XX_SEL1_SHIFT 8
1617#define OMAP54XX_SEL1_WIDTH 0x7
1618#define OMAP54XX_SEL1_MASK (0x7f << 8)
1619
1620/* Renamed from SEL1 Used by CM_CORE_DEBUG_CFG */
1621#define OMAP54XX_SEL1_CORE_DEBUG_CFG_SHIFT 8
1622#define OMAP54XX_SEL1_CORE_DEBUG_CFG_WIDTH 0x8
1623#define OMAP54XX_SEL1_CORE_DEBUG_CFG_MASK (0xff << 8)
1624
1625/* Used by CM_CORE_AON_DEBUG_CFG */
1626#define OMAP54XX_SEL2_SHIFT 16
1627#define OMAP54XX_SEL2_WIDTH 0x7
1628#define OMAP54XX_SEL2_MASK (0x7f << 16)
1629
1630/* Renamed from SEL2 Used by CM_CORE_DEBUG_CFG */
1631#define OMAP54XX_SEL2_CORE_DEBUG_CFG_SHIFT 16
1632#define OMAP54XX_SEL2_CORE_DEBUG_CFG_WIDTH 0x8
1633#define OMAP54XX_SEL2_CORE_DEBUG_CFG_MASK (0xff << 16)
1634
1635/* Used by CM_CORE_AON_DEBUG_CFG */
1636#define OMAP54XX_SEL3_SHIFT 24
1637#define OMAP54XX_SEL3_WIDTH 0x7
1638#define OMAP54XX_SEL3_MASK (0x7f << 24)
1639
1640/* Renamed from SEL3 Used by CM_CORE_DEBUG_CFG */
1641#define OMAP54XX_SEL3_CORE_DEBUG_CFG_SHIFT 24
1642#define OMAP54XX_SEL3_CORE_DEBUG_CFG_WIDTH 0x8
1643#define OMAP54XX_SEL3_CORE_DEBUG_CFG_MASK (0xff << 24)
1644
1645/* Used by CM_CLKSEL_ABE */
1646#define OMAP54XX_SLIMBUS1_CLK_GATE_SHIFT 10
1647#define OMAP54XX_SLIMBUS1_CLK_GATE_WIDTH 0x1
1648#define OMAP54XX_SLIMBUS1_CLK_GATE_MASK (1 << 10)
1649
1650/*
1651 * Used by CM_ABE_AESS_CLKCTRL, CM_C2C_C2C_CLKCTRL, CM_CAM_FDIF_CLKCTRL,
1652 * CM_CAM_ISS_CLKCTRL, CM_DMA_DMA_SYSTEM_CLKCTRL, CM_DSP_DSP_CLKCTRL,
1653 * CM_DSS_BB2D_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_EMU_DEBUGSS_CLKCTRL,
1654 * CM_GPU_GPU_CLKCTRL, CM_IPU_IPU_CLKCTRL, CM_IVA_IVA_CLKCTRL,
1655 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_IEEE1500_2_OCP_CLKCTRL,
1656 * CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_SATA_CLKCTRL,
1657 * CM_L3INIT_UNIPRO2_CLKCTRL, CM_L3INIT_USB_HOST_HS_CLKCTRL,
1658 * CM_L3INIT_USB_OTG_SS_CLKCTRL, CM_L4SEC_DMA_CRYPTO_CLKCTRL,
1659 * CM_MIPIEXT_LLI_CLKCTRL, CM_MPU_MPU_CLKCTRL
1660 */
1661#define OMAP54XX_STBYST_SHIFT 18
1662#define OMAP54XX_STBYST_WIDTH 0x1
1663#define OMAP54XX_STBYST_MASK (1 << 18)
1664
1665/*
1666 * Used by CM_IDLEST_DPLL_ABE, CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_IVA,
1667 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER, CM_IDLEST_DPLL_UNIPRO1,
1668 * CM_IDLEST_DPLL_UNIPRO2, CM_IDLEST_DPLL_USB
1669 */
1670#define OMAP54XX_ST_DPLL_CLK_SHIFT 0
1671#define OMAP54XX_ST_DPLL_CLK_WIDTH 0x1
1672#define OMAP54XX_ST_DPLL_CLK_MASK (1 << 0)
1673
1674/*
1675 * Used by CM_CLKDCOLDO_DPLL_UNIPRO1, CM_CLKDCOLDO_DPLL_UNIPRO2,
1676 * CM_CLKDCOLDO_DPLL_USB
1677 */
1678#define OMAP54XX_ST_DPLL_CLKDCOLDO_SHIFT 9
1679#define OMAP54XX_ST_DPLL_CLKDCOLDO_WIDTH 0x1
1680#define OMAP54XX_ST_DPLL_CLKDCOLDO_MASK (1 << 9)
1681
1682/*
1683 * Used by CM_IDLEST_DPLL_ABE, CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_IVA,
1684 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER, CM_IDLEST_DPLL_UNIPRO1,
1685 * CM_IDLEST_DPLL_UNIPRO2, CM_IDLEST_DPLL_USB
1686 */
1687#define OMAP54XX_ST_DPLL_INIT_SHIFT 4
1688#define OMAP54XX_ST_DPLL_INIT_WIDTH 0x1
1689#define OMAP54XX_ST_DPLL_INIT_MASK (1 << 4)
1690
1691/*
1692 * Used by CM_IDLEST_DPLL_ABE, CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_IVA,
1693 * CM_IDLEST_DPLL_MPU, CM_IDLEST_DPLL_PER, CM_IDLEST_DPLL_UNIPRO1,
1694 * CM_IDLEST_DPLL_UNIPRO2, CM_IDLEST_DPLL_USB
1695 */
1696#define OMAP54XX_ST_DPLL_MODE_SHIFT 1
1697#define OMAP54XX_ST_DPLL_MODE_WIDTH 0x3
1698#define OMAP54XX_ST_DPLL_MODE_MASK (0x7 << 1)
1699
1700/* Used by CM_CLKSEL_SYS */
1701#define OMAP54XX_SYS_CLKSEL_SHIFT 0
1702#define OMAP54XX_SYS_CLKSEL_WIDTH 0x3
1703#define OMAP54XX_SYS_CLKSEL_MASK (0x7 << 0)
1704
1705/*
1706 * Used by CM_C2C_DYNAMICDEP, CM_DSP_DYNAMICDEP, CM_EMU_DYNAMICDEP,
1707 * CM_IPU_DYNAMICDEP, CM_L3MAIN1_DYNAMICDEP, CM_L3MAIN2_DYNAMICDEP,
1708 * CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP, CM_MIPIEXT_DYNAMICDEP,
1709 * CM_MPU_DYNAMICDEP
1710 */
1711#define OMAP54XX_WINDOWSIZE_SHIFT 24
1712#define OMAP54XX_WINDOWSIZE_WIDTH 0x4
1713#define OMAP54XX_WINDOWSIZE_MASK (0xf << 24)
1714
1715/* Used by CM_L3MAIN1_DYNAMICDEP */
1716#define OMAP54XX_WKUPAON_DYNDEP_SHIFT 15
1717#define OMAP54XX_WKUPAON_DYNDEP_WIDTH 0x1
1718#define OMAP54XX_WKUPAON_DYNDEP_MASK (1 << 15)
1719
1720/*
1721 * Used by CM_DMA_STATICDEP, CM_DSP_STATICDEP, CM_IPU_STATICDEP,
1722 * CM_L3INIT_STATICDEP, CM_MPU_STATICDEP
1723 */
1724#define OMAP54XX_WKUPAON_STATDEP_SHIFT 15
1725#define OMAP54XX_WKUPAON_STATDEP_WIDTH 0x1
1726#define OMAP54XX_WKUPAON_STATDEP_MASK (1 << 15)
1727
1728/* Used by REVISION_CM_CORE, REVISION_CM_CORE_AON */
1729#define OMAP54XX_X_MAJOR_SHIFT 8
1730#define OMAP54XX_X_MAJOR_WIDTH 0x3
1731#define OMAP54XX_X_MAJOR_MASK (0x7 << 8)
1732
1733/* Used by REVISION_CM_CORE, REVISION_CM_CORE_AON */
1734#define OMAP54XX_Y_MINOR_SHIFT 0
1735#define OMAP54XX_Y_MINOR_WIDTH 0x6
1736#define OMAP54XX_Y_MINOR_MASK (0x3f << 0)
1737#endif
diff --git a/arch/arm/mach-omap2/cm1_44xx.h b/arch/arm/mach-omap2/cm1_44xx.h
index 1bc00dc4876c..5ae8fe39d6ee 100644
--- a/arch/arm/mach-omap2/cm1_44xx.h
+++ b/arch/arm/mach-omap2/cm1_44xx.h
@@ -25,6 +25,8 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_CM1_44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_CM1_44XX_H
26#define __ARCH_ARM_MACH_OMAP2_CM1_44XX_H 26#define __ARCH_ARM_MACH_OMAP2_CM1_44XX_H
27 27
28#include "cm_44xx_54xx.h"
29
28/* CM1 base address */ 30/* CM1 base address */
29#define OMAP4430_CM1_BASE 0x4a004000 31#define OMAP4430_CM1_BASE 0x4a004000
30 32
@@ -217,9 +219,4 @@
217#define OMAP4_CM1_ABE_WDT3_CLKCTRL_OFFSET 0x0088 219#define OMAP4_CM1_ABE_WDT3_CLKCTRL_OFFSET 0x0088
218#define OMAP4430_CM1_ABE_WDT3_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_INST, 0x0088) 220#define OMAP4430_CM1_ABE_WDT3_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_INST, 0x0088)
219 221
220/* Function prototypes */
221extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
222extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
223extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
224
225#endif 222#endif
diff --git a/arch/arm/mach-omap2/cm1_54xx.h b/arch/arm/mach-omap2/cm1_54xx.h
new file mode 100644
index 000000000000..90b3348e6672
--- /dev/null
+++ b/arch/arm/mach-omap2/cm1_54xx.h
@@ -0,0 +1,213 @@
1/*
2 * OMAP54xx CM1 instance offset macros
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley (paul@pwsan.com)
7 * Rajendra Nayak (rnayak@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 *
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_CM1_54XX_H
23#define __ARCH_ARM_MACH_OMAP2_CM1_54XX_H
24
25#include "cm_44xx_54xx.h"
26
27/* CM1 base address */
28#define OMAP54XX_CM_CORE_AON_BASE 0x4a004000
29
30#define OMAP54XX_CM_CORE_AON_REGADDR(inst, reg) \
31 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE + (inst) + (reg))
32
33/* CM_CORE_AON instances */
34#define OMAP54XX_CM_CORE_AON_OCP_SOCKET_INST 0x0000
35#define OMAP54XX_CM_CORE_AON_CKGEN_INST 0x0100
36#define OMAP54XX_CM_CORE_AON_MPU_INST 0x0300
37#define OMAP54XX_CM_CORE_AON_DSP_INST 0x0400
38#define OMAP54XX_CM_CORE_AON_ABE_INST 0x0500
39#define OMAP54XX_CM_CORE_AON_RESTORE_INST 0x0e00
40#define OMAP54XX_CM_CORE_AON_INSTR_INST 0x0f00
41
42/* CM_CORE_AON clockdomain register offsets (from instance start) */
43#define OMAP54XX_CM_CORE_AON_MPU_MPU_CDOFFS 0x0000
44#define OMAP54XX_CM_CORE_AON_DSP_DSP_CDOFFS 0x0000
45#define OMAP54XX_CM_CORE_AON_ABE_ABE_CDOFFS 0x0000
46
47/* CM_CORE_AON */
48
49/* CM_CORE_AON.OCP_SOCKET_CM_CORE_AON register offsets */
50#define OMAP54XX_REVISION_CM_CORE_AON_OFFSET 0x0000
51#define OMAP54XX_CM_CM_CORE_AON_PROFILING_CLKCTRL_OFFSET 0x0040
52#define OMAP54XX_CM_CM_CORE_AON_PROFILING_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_OCP_SOCKET_INST, 0x0040)
53#define OMAP54XX_CM_CORE_AON_DEBUG_CFG_OFFSET 0x0080
54#define OMAP54XX_CM_CORE_AON_DEBUG_OUT_OFFSET 0x0084
55#define OMAP54XX_CM_CORE_AON_DEBUG_MPU_FD_TRANS_OFFSET 0x0090
56#define OMAP54XX_CM_CORE_AON_DEBUG_DSP_FD_TRANS_OFFSET 0x0094
57#define OMAP54XX_CM_CORE_AON_DEBUG_ABE_FD_TRANS_OFFSET 0x0098
58#define OMAP54XX_CM_CORE_AON_DEBUG_ABE_FD_TRANS2_OFFSET 0x009c
59#define OMAP54XX_CM_CORE_AON_DEBUG_CM_CORE_AON_FD_TRANS_OFFSET 0x00a0
60#define OMAP54XX_CM_CORE_AON_DEBUG_C2C_FD_TRANS_OFFSET 0x00a4
61#define OMAP54XX_CM_CORE_AON_DEBUG_CAM_FD_TRANS_OFFSET 0x00a8
62#define OMAP54XX_CM_CORE_AON_DEBUG_COREAON_FD_TRANS_OFFSET 0x00ac
63#define OMAP54XX_CM_CORE_AON_DEBUG_CUSTEFUSE_FD_TRANS_OFFSET 0x00b0
64#define OMAP54XX_CM_CORE_AON_DEBUG_DMA_FD_TRANS_OFFSET 0x00b4
65#define OMAP54XX_CM_CORE_AON_DEBUG_DSS_FD_TRANS_OFFSET 0x00b8
66#define OMAP54XX_CM_CORE_AON_DEBUG_EMIF_FD_TRANS_OFFSET 0x00bc
67#define OMAP54XX_CM_CORE_AON_DEBUG_GPU_FD_TRANS_OFFSET 0x00c0
68#define OMAP54XX_CM_CORE_AON_DEBUG_IPU_FD_TRANS_OFFSET 0x00c4
69#define OMAP54XX_CM_CORE_AON_DEBUG_IVA_FD_TRANS_OFFSET 0x00c8
70#define OMAP54XX_CM_CORE_AON_DEBUG_L3INIT_FD_TRANS_OFFSET 0x00cc
71#define OMAP54XX_CM_CORE_AON_DEBUG_L3INIT_FD_TRANS2_OFFSET 0x00d0
72#define OMAP54XX_CM_CORE_AON_DEBUG_L3INSTR_FD_TRANS_OFFSET 0x00d4
73#define OMAP54XX_CM_CORE_AON_DEBUG_L3MAIN1_FD_TRANS_OFFSET 0x00d8
74#define OMAP54XX_CM_CORE_AON_DEBUG_L3MAIN2_FD_TRANS_OFFSET 0x00dc
75#define OMAP54XX_CM_CORE_AON_DEBUG_L4CFG_FD_TRANS_OFFSET 0x00e0
76#define OMAP54XX_CM_CORE_AON_DEBUG_L4PER_FD_TRANS_OFFSET 0x00e4
77#define OMAP54XX_CM_CORE_AON_DEBUG_L4PER_FD_TRANS2_OFFSET 0x00e8
78#define OMAP54XX_CM_CORE_AON_DEBUG_L4SEC_FD_TRANS_OFFSET 0x00ec
79#define OMAP54XX_CM_CORE_AON_DEBUG_MIPIEXT_FD_TRANS_OFFSET 0x00f0
80
81/* CM_CORE_AON.CKGEN_CM_CORE_AON register offsets */
82#define OMAP54XX_CM_CLKSEL_CORE_OFFSET 0x0000
83#define OMAP54XX_CM_CLKSEL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0000)
84#define OMAP54XX_CM_CLKSEL_ABE_OFFSET 0x0008
85#define OMAP54XX_CM_CLKSEL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0008)
86#define OMAP54XX_CM_DLL_CTRL_OFFSET 0x0010
87#define OMAP54XX_CM_CLKMODE_DPLL_CORE_OFFSET 0x0020
88#define OMAP54XX_CM_CLKMODE_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0020)
89#define OMAP54XX_CM_IDLEST_DPLL_CORE_OFFSET 0x0024
90#define OMAP54XX_CM_IDLEST_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0024)
91#define OMAP54XX_CM_AUTOIDLE_DPLL_CORE_OFFSET 0x0028
92#define OMAP54XX_CM_AUTOIDLE_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0028)
93#define OMAP54XX_CM_CLKSEL_DPLL_CORE_OFFSET 0x002c
94#define OMAP54XX_CM_CLKSEL_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x002c)
95#define OMAP54XX_CM_DIV_M2_DPLL_CORE_OFFSET 0x0030
96#define OMAP54XX_CM_DIV_M2_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0030)
97#define OMAP54XX_CM_DIV_M3_DPLL_CORE_OFFSET 0x0034
98#define OMAP54XX_CM_DIV_M3_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0034)
99#define OMAP54XX_CM_DIV_H11_DPLL_CORE_OFFSET 0x0038
100#define OMAP54XX_CM_DIV_H11_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0038)
101#define OMAP54XX_CM_DIV_H12_DPLL_CORE_OFFSET 0x003c
102#define OMAP54XX_CM_DIV_H12_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x003c)
103#define OMAP54XX_CM_DIV_H13_DPLL_CORE_OFFSET 0x0040
104#define OMAP54XX_CM_DIV_H13_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0040)
105#define OMAP54XX_CM_DIV_H14_DPLL_CORE_OFFSET 0x0044
106#define OMAP54XX_CM_DIV_H14_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0044)
107#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_CORE_OFFSET 0x0048
108#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_CORE_OFFSET 0x004c
109#define OMAP54XX_CM_DIV_H21_DPLL_CORE_OFFSET 0x0050
110#define OMAP54XX_CM_DIV_H21_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0050)
111#define OMAP54XX_CM_DIV_H22_DPLL_CORE_OFFSET 0x0054
112#define OMAP54XX_CM_DIV_H22_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0054)
113#define OMAP54XX_CM_DIV_H23_DPLL_CORE_OFFSET 0x0058
114#define OMAP54XX_CM_DIV_H23_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0058)
115#define OMAP54XX_CM_DIV_H24_DPLL_CORE_OFFSET 0x005c
116#define OMAP54XX_CM_DIV_H24_DPLL_CORE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x005c)
117#define OMAP54XX_CM_CLKMODE_DPLL_MPU_OFFSET 0x0060
118#define OMAP54XX_CM_CLKMODE_DPLL_MPU OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0060)
119#define OMAP54XX_CM_IDLEST_DPLL_MPU_OFFSET 0x0064
120#define OMAP54XX_CM_IDLEST_DPLL_MPU OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0064)
121#define OMAP54XX_CM_AUTOIDLE_DPLL_MPU_OFFSET 0x0068
122#define OMAP54XX_CM_AUTOIDLE_DPLL_MPU OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0068)
123#define OMAP54XX_CM_CLKSEL_DPLL_MPU_OFFSET 0x006c
124#define OMAP54XX_CM_CLKSEL_DPLL_MPU OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x006c)
125#define OMAP54XX_CM_DIV_M2_DPLL_MPU_OFFSET 0x0070
126#define OMAP54XX_CM_DIV_M2_DPLL_MPU OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x0070)
127#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_MPU_OFFSET 0x0088
128#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_MPU_OFFSET 0x008c
129#define OMAP54XX_CM_BYPCLK_DPLL_MPU_OFFSET 0x009c
130#define OMAP54XX_CM_BYPCLK_DPLL_MPU OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x009c)
131#define OMAP54XX_CM_CLKMODE_DPLL_IVA_OFFSET 0x00a0
132#define OMAP54XX_CM_CLKMODE_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00a0)
133#define OMAP54XX_CM_IDLEST_DPLL_IVA_OFFSET 0x00a4
134#define OMAP54XX_CM_IDLEST_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00a4)
135#define OMAP54XX_CM_AUTOIDLE_DPLL_IVA_OFFSET 0x00a8
136#define OMAP54XX_CM_AUTOIDLE_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00a8)
137#define OMAP54XX_CM_CLKSEL_DPLL_IVA_OFFSET 0x00ac
138#define OMAP54XX_CM_CLKSEL_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00ac)
139#define OMAP54XX_CM_DIV_H11_DPLL_IVA_OFFSET 0x00b8
140#define OMAP54XX_CM_DIV_H11_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00b8)
141#define OMAP54XX_CM_DIV_H12_DPLL_IVA_OFFSET 0x00bc
142#define OMAP54XX_CM_DIV_H12_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00bc)
143#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_IVA_OFFSET 0x00c8
144#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_IVA_OFFSET 0x00cc
145#define OMAP54XX_CM_BYPCLK_DPLL_IVA_OFFSET 0x00dc
146#define OMAP54XX_CM_BYPCLK_DPLL_IVA OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00dc)
147#define OMAP54XX_CM_CLKMODE_DPLL_ABE_OFFSET 0x00e0
148#define OMAP54XX_CM_CLKMODE_DPLL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00e0)
149#define OMAP54XX_CM_IDLEST_DPLL_ABE_OFFSET 0x00e4
150#define OMAP54XX_CM_IDLEST_DPLL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00e4)
151#define OMAP54XX_CM_AUTOIDLE_DPLL_ABE_OFFSET 0x00e8
152#define OMAP54XX_CM_AUTOIDLE_DPLL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00e8)
153#define OMAP54XX_CM_CLKSEL_DPLL_ABE_OFFSET 0x00ec
154#define OMAP54XX_CM_CLKSEL_DPLL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00ec)
155#define OMAP54XX_CM_DIV_M2_DPLL_ABE_OFFSET 0x00f0
156#define OMAP54XX_CM_DIV_M2_DPLL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00f0)
157#define OMAP54XX_CM_DIV_M3_DPLL_ABE_OFFSET 0x00f4
158#define OMAP54XX_CM_DIV_M3_DPLL_ABE OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_CKGEN_INST, 0x00f4)
159#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_ABE_OFFSET 0x0108
160#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_ABE_OFFSET 0x010c
161#define OMAP54XX_CM_SHADOW_FREQ_CONFIG1_OFFSET 0x0160
162#define OMAP54XX_CM_SHADOW_FREQ_CONFIG2_OFFSET 0x0164
163#define OMAP54XX_CM_DYN_DEP_PRESCAL_OFFSET 0x0170
164#define OMAP54XX_CM_RESTORE_ST_OFFSET 0x0180
165
166/* CM_CORE_AON.MPU_CM_CORE_AON register offsets */
167#define OMAP54XX_CM_MPU_CLKSTCTRL_OFFSET 0x0000
168#define OMAP54XX_CM_MPU_STATICDEP_OFFSET 0x0004
169#define OMAP54XX_CM_MPU_DYNAMICDEP_OFFSET 0x0008
170#define OMAP54XX_CM_MPU_MPU_CLKCTRL_OFFSET 0x0020
171#define OMAP54XX_CM_MPU_MPU_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_MPU_INST, 0x0020)
172#define OMAP54XX_CM_MPU_MPU_MPU_DBG_CLKCTRL_OFFSET 0x0028
173#define OMAP54XX_CM_MPU_MPU_MPU_DBG_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_MPU_INST, 0x0028)
174
175/* CM_CORE_AON.DSP_CM_CORE_AON register offsets */
176#define OMAP54XX_CM_DSP_CLKSTCTRL_OFFSET 0x0000
177#define OMAP54XX_CM_DSP_STATICDEP_OFFSET 0x0004
178#define OMAP54XX_CM_DSP_DYNAMICDEP_OFFSET 0x0008
179#define OMAP54XX_CM_DSP_DSP_CLKCTRL_OFFSET 0x0020
180#define OMAP54XX_CM_DSP_DSP_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_DSP_INST, 0x0020)
181
182/* CM_CORE_AON.ABE_CM_CORE_AON register offsets */
183#define OMAP54XX_CM_ABE_CLKSTCTRL_OFFSET 0x0000
184#define OMAP54XX_CM_ABE_L4_ABE_CLKCTRL_OFFSET 0x0020
185#define OMAP54XX_CM_ABE_L4_ABE_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0020)
186#define OMAP54XX_CM_ABE_AESS_CLKCTRL_OFFSET 0x0028
187#define OMAP54XX_CM_ABE_AESS_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0028)
188#define OMAP54XX_CM_ABE_MCPDM_CLKCTRL_OFFSET 0x0030
189#define OMAP54XX_CM_ABE_MCPDM_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0030)
190#define OMAP54XX_CM_ABE_DMIC_CLKCTRL_OFFSET 0x0038
191#define OMAP54XX_CM_ABE_DMIC_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0038)
192#define OMAP54XX_CM_ABE_MCASP_CLKCTRL_OFFSET 0x0040
193#define OMAP54XX_CM_ABE_MCASP_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0040)
194#define OMAP54XX_CM_ABE_MCBSP1_CLKCTRL_OFFSET 0x0048
195#define OMAP54XX_CM_ABE_MCBSP1_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0048)
196#define OMAP54XX_CM_ABE_MCBSP2_CLKCTRL_OFFSET 0x0050
197#define OMAP54XX_CM_ABE_MCBSP2_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0050)
198#define OMAP54XX_CM_ABE_MCBSP3_CLKCTRL_OFFSET 0x0058
199#define OMAP54XX_CM_ABE_MCBSP3_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0058)
200#define OMAP54XX_CM_ABE_SLIMBUS1_CLKCTRL_OFFSET 0x0060
201#define OMAP54XX_CM_ABE_SLIMBUS1_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0060)
202#define OMAP54XX_CM_ABE_TIMER5_CLKCTRL_OFFSET 0x0068
203#define OMAP54XX_CM_ABE_TIMER5_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0068)
204#define OMAP54XX_CM_ABE_TIMER6_CLKCTRL_OFFSET 0x0070
205#define OMAP54XX_CM_ABE_TIMER6_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0070)
206#define OMAP54XX_CM_ABE_TIMER7_CLKCTRL_OFFSET 0x0078
207#define OMAP54XX_CM_ABE_TIMER7_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0078)
208#define OMAP54XX_CM_ABE_TIMER8_CLKCTRL_OFFSET 0x0080
209#define OMAP54XX_CM_ABE_TIMER8_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0080)
210#define OMAP54XX_CM_ABE_WD_TIMER3_CLKCTRL_OFFSET 0x0088
211#define OMAP54XX_CM_ABE_WD_TIMER3_CLKCTRL OMAP54XX_CM_CORE_AON_REGADDR(OMAP54XX_CM_CORE_AON_ABE_INST, 0x0088)
212
213#endif
diff --git a/arch/arm/mach-omap2/cm2_44xx.h b/arch/arm/mach-omap2/cm2_44xx.h
index b9de72da1a8e..ee5136d7cdda 100644
--- a/arch/arm/mach-omap2/cm2_44xx.h
+++ b/arch/arm/mach-omap2/cm2_44xx.h
@@ -25,6 +25,8 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_CM2_44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_CM2_44XX_H
26#define __ARCH_ARM_MACH_OMAP2_CM2_44XX_H 26#define __ARCH_ARM_MACH_OMAP2_CM2_44XX_H
27 27
28#include "cm_44xx_54xx.h"
29
28/* CM2 base address */ 30/* CM2 base address */
29#define OMAP4430_CM2_BASE 0x4a008000 31#define OMAP4430_CM2_BASE 0x4a008000
30 32
@@ -449,9 +451,4 @@
449#define OMAP4_CM_CEFUSE_CEFUSE_CLKCTRL_OFFSET 0x0020 451#define OMAP4_CM_CEFUSE_CEFUSE_CLKCTRL_OFFSET 0x0020
450#define OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CEFUSE_INST, 0x0020) 452#define OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CEFUSE_INST, 0x0020)
451 453
452/* Function prototypes */
453extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
454extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
455extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
456
457#endif 454#endif
diff --git a/arch/arm/mach-omap2/cm2_54xx.h b/arch/arm/mach-omap2/cm2_54xx.h
new file mode 100644
index 000000000000..2683231b299b
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2_54xx.h
@@ -0,0 +1,389 @@
1/*
2 * OMAP54xx CM2 instance offset macros
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley (paul@pwsan.com)
7 * Rajendra Nayak (rnayak@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#ifndef __ARCH_ARM_MACH_OMAP2_CM2_54XX_H
22#define __ARCH_ARM_MACH_OMAP2_CM2_54XX_H
23
24#include "cm_44xx_54xx.h"
25
26/* CM2 base address */
27#define OMAP54XX_CM_CORE_BASE 0x4a008000
28
29#define OMAP54XX_CM_CORE_REGADDR(inst, reg) \
30 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE + (inst) + (reg))
31
32/* CM_CORE instances */
33#define OMAP54XX_CM_CORE_OCP_SOCKET_INST 0x0000
34#define OMAP54XX_CM_CORE_CKGEN_INST 0x0100
35#define OMAP54XX_CM_CORE_COREAON_INST 0x0600
36#define OMAP54XX_CM_CORE_CORE_INST 0x0700
37#define OMAP54XX_CM_CORE_IVA_INST 0x1200
38#define OMAP54XX_CM_CORE_CAM_INST 0x1300
39#define OMAP54XX_CM_CORE_DSS_INST 0x1400
40#define OMAP54XX_CM_CORE_GPU_INST 0x1500
41#define OMAP54XX_CM_CORE_L3INIT_INST 0x1600
42#define OMAP54XX_CM_CORE_CUSTEFUSE_INST 0x1700
43#define OMAP54XX_CM_CORE_RESTORE_INST 0x1e00
44#define OMAP54XX_CM_CORE_INSTR_INST 0x1f00
45
46/* CM_CORE clockdomain register offsets (from instance start) */
47#define OMAP54XX_CM_CORE_COREAON_COREAON_CDOFFS 0x0000
48#define OMAP54XX_CM_CORE_CORE_L3MAIN1_CDOFFS 0x0000
49#define OMAP54XX_CM_CORE_CORE_L3MAIN2_CDOFFS 0x0100
50#define OMAP54XX_CM_CORE_CORE_IPU_CDOFFS 0x0200
51#define OMAP54XX_CM_CORE_CORE_DMA_CDOFFS 0x0300
52#define OMAP54XX_CM_CORE_CORE_EMIF_CDOFFS 0x0400
53#define OMAP54XX_CM_CORE_CORE_C2C_CDOFFS 0x0500
54#define OMAP54XX_CM_CORE_CORE_L4CFG_CDOFFS 0x0600
55#define OMAP54XX_CM_CORE_CORE_L3INSTR_CDOFFS 0x0700
56#define OMAP54XX_CM_CORE_CORE_MIPIEXT_CDOFFS 0x0800
57#define OMAP54XX_CM_CORE_CORE_L4PER_CDOFFS 0x0900
58#define OMAP54XX_CM_CORE_CORE_L4SEC_CDOFFS 0x0a80
59#define OMAP54XX_CM_CORE_IVA_IVA_CDOFFS 0x0000
60#define OMAP54XX_CM_CORE_CAM_CAM_CDOFFS 0x0000
61#define OMAP54XX_CM_CORE_DSS_DSS_CDOFFS 0x0000
62#define OMAP54XX_CM_CORE_GPU_GPU_CDOFFS 0x0000
63#define OMAP54XX_CM_CORE_L3INIT_L3INIT_CDOFFS 0x0000
64#define OMAP54XX_CM_CORE_CUSTEFUSE_CUSTEFUSE_CDOFFS 0x0000
65
66/* CM_CORE */
67
68/* CM_CORE.OCP_SOCKET_CM_CORE register offsets */
69#define OMAP54XX_REVISION_CM_CORE_OFFSET 0x0000
70#define OMAP54XX_CM_CM_CORE_PROFILING_CLKCTRL_OFFSET 0x0040
71#define OMAP54XX_CM_CM_CORE_PROFILING_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_OCP_SOCKET_INST, 0x0040)
72#define OMAP54XX_CM_CORE_DEBUG_CFG_OFFSET 0x0080
73#define OMAP54XX_CM_CORE_DEBUG_OUT_OFFSET 0x0084
74
75/* CM_CORE.CKGEN_CM_CORE register offsets */
76#define OMAP54XX_CM_CLKSEL_USB_60MHZ_OFFSET 0x0004
77#define OMAP54XX_CM_CLKSEL_USB_60MHZ OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0004)
78#define OMAP54XX_CM_CLKMODE_DPLL_PER_OFFSET 0x0040
79#define OMAP54XX_CM_CLKMODE_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0040)
80#define OMAP54XX_CM_IDLEST_DPLL_PER_OFFSET 0x0044
81#define OMAP54XX_CM_IDLEST_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0044)
82#define OMAP54XX_CM_AUTOIDLE_DPLL_PER_OFFSET 0x0048
83#define OMAP54XX_CM_AUTOIDLE_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0048)
84#define OMAP54XX_CM_CLKSEL_DPLL_PER_OFFSET 0x004c
85#define OMAP54XX_CM_CLKSEL_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x004c)
86#define OMAP54XX_CM_DIV_M2_DPLL_PER_OFFSET 0x0050
87#define OMAP54XX_CM_DIV_M2_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0050)
88#define OMAP54XX_CM_DIV_M3_DPLL_PER_OFFSET 0x0054
89#define OMAP54XX_CM_DIV_M3_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0054)
90#define OMAP54XX_CM_DIV_H11_DPLL_PER_OFFSET 0x0058
91#define OMAP54XX_CM_DIV_H11_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0058)
92#define OMAP54XX_CM_DIV_H12_DPLL_PER_OFFSET 0x005c
93#define OMAP54XX_CM_DIV_H12_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x005c)
94#define OMAP54XX_CM_DIV_H13_DPLL_PER_OFFSET 0x0060
95#define OMAP54XX_CM_DIV_H13_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0060)
96#define OMAP54XX_CM_DIV_H14_DPLL_PER_OFFSET 0x0064
97#define OMAP54XX_CM_DIV_H14_DPLL_PER OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0064)
98#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_PER_OFFSET 0x0068
99#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_PER_OFFSET 0x006c
100#define OMAP54XX_CM_CLKMODE_DPLL_USB_OFFSET 0x0080
101#define OMAP54XX_CM_CLKMODE_DPLL_USB OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0080)
102#define OMAP54XX_CM_IDLEST_DPLL_USB_OFFSET 0x0084
103#define OMAP54XX_CM_IDLEST_DPLL_USB OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0084)
104#define OMAP54XX_CM_AUTOIDLE_DPLL_USB_OFFSET 0x0088
105#define OMAP54XX_CM_AUTOIDLE_DPLL_USB OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0088)
106#define OMAP54XX_CM_CLKSEL_DPLL_USB_OFFSET 0x008c
107#define OMAP54XX_CM_CLKSEL_DPLL_USB OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x008c)
108#define OMAP54XX_CM_DIV_M2_DPLL_USB_OFFSET 0x0090
109#define OMAP54XX_CM_DIV_M2_DPLL_USB OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0090)
110#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_USB_OFFSET 0x00a8
111#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_USB_OFFSET 0x00ac
112#define OMAP54XX_CM_CLKDCOLDO_DPLL_USB_OFFSET 0x00b4
113#define OMAP54XX_CM_CLKDCOLDO_DPLL_USB OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00b4)
114#define OMAP54XX_CM_CLKMODE_DPLL_UNIPRO2_OFFSET 0x00c0
115#define OMAP54XX_CM_CLKMODE_DPLL_UNIPRO2 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00c0)
116#define OMAP54XX_CM_IDLEST_DPLL_UNIPRO2_OFFSET 0x00c4
117#define OMAP54XX_CM_IDLEST_DPLL_UNIPRO2 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00c4)
118#define OMAP54XX_CM_AUTOIDLE_DPLL_UNIPRO2_OFFSET 0x00c8
119#define OMAP54XX_CM_AUTOIDLE_DPLL_UNIPRO2 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00c8)
120#define OMAP54XX_CM_CLKSEL_DPLL_UNIPRO2_OFFSET 0x00cc
121#define OMAP54XX_CM_CLKSEL_DPLL_UNIPRO2 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00cc)
122#define OMAP54XX_CM_DIV_M2_DPLL_UNIPRO2_OFFSET 0x00d0
123#define OMAP54XX_CM_DIV_M2_DPLL_UNIPRO2 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00d0)
124#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_UNIPRO2_OFFSET 0x00e8
125#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_UNIPRO2_OFFSET 0x00ec
126#define OMAP54XX_CM_CLKDCOLDO_DPLL_UNIPRO2_OFFSET 0x00f4
127#define OMAP54XX_CM_CLKDCOLDO_DPLL_UNIPRO2 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x00f4)
128#define OMAP54XX_CM_CLKMODE_DPLL_UNIPRO1_OFFSET 0x0100
129#define OMAP54XX_CM_CLKMODE_DPLL_UNIPRO1 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0100)
130#define OMAP54XX_CM_IDLEST_DPLL_UNIPRO1_OFFSET 0x0104
131#define OMAP54XX_CM_IDLEST_DPLL_UNIPRO1 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0104)
132#define OMAP54XX_CM_AUTOIDLE_DPLL_UNIPRO1_OFFSET 0x0108
133#define OMAP54XX_CM_AUTOIDLE_DPLL_UNIPRO1 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0108)
134#define OMAP54XX_CM_CLKSEL_DPLL_UNIPRO1_OFFSET 0x010c
135#define OMAP54XX_CM_CLKSEL_DPLL_UNIPRO1 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x010c)
136#define OMAP54XX_CM_DIV_M2_DPLL_UNIPRO1_OFFSET 0x0110
137#define OMAP54XX_CM_DIV_M2_DPLL_UNIPRO1 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0110)
138#define OMAP54XX_CM_SSC_DELTAMSTEP_DPLL_UNIPRO1_OFFSET 0x0128
139#define OMAP54XX_CM_SSC_MODFREQDIV_DPLL_UNIPRO1_OFFSET 0x012c
140#define OMAP54XX_CM_CLKDCOLDO_DPLL_UNIPRO1_OFFSET 0x0134
141#define OMAP54XX_CM_CLKDCOLDO_DPLL_UNIPRO1 OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CKGEN_INST, 0x0134)
142
143/* CM_CORE.COREAON_CM_CORE register offsets */
144#define OMAP54XX_CM_COREAON_CLKSTCTRL_OFFSET 0x0000
145#define OMAP54XX_CM_COREAON_SMARTREFLEX_MPU_CLKCTRL_OFFSET 0x0028
146#define OMAP54XX_CM_COREAON_SMARTREFLEX_MPU_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_COREAON_INST, 0x0028)
147#define OMAP54XX_CM_COREAON_SMARTREFLEX_MM_CLKCTRL_OFFSET 0x0030
148#define OMAP54XX_CM_COREAON_SMARTREFLEX_MM_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_COREAON_INST, 0x0030)
149#define OMAP54XX_CM_COREAON_SMARTREFLEX_CORE_CLKCTRL_OFFSET 0x0038
150#define OMAP54XX_CM_COREAON_SMARTREFLEX_CORE_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_COREAON_INST, 0x0038)
151#define OMAP54XX_CM_COREAON_USB_PHY_CORE_CLKCTRL_OFFSET 0x0040
152#define OMAP54XX_CM_COREAON_USB_PHY_CORE_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_COREAON_INST, 0x0040)
153#define OMAP54XX_CM_COREAON_IO_SRCOMP_CLKCTRL_OFFSET 0x0050
154#define OMAP54XX_CM_COREAON_IO_SRCOMP_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_COREAON_INST, 0x0050)
155
156/* CM_CORE.CORE_CM_CORE register offsets */
157#define OMAP54XX_CM_L3MAIN1_CLKSTCTRL_OFFSET 0x0000
158#define OMAP54XX_CM_L3MAIN1_DYNAMICDEP_OFFSET 0x0008
159#define OMAP54XX_CM_L3MAIN1_L3_MAIN_1_CLKCTRL_OFFSET 0x0020
160#define OMAP54XX_CM_L3MAIN1_L3_MAIN_1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0020)
161#define OMAP54XX_CM_L3MAIN2_CLKSTCTRL_OFFSET 0x0100
162#define OMAP54XX_CM_L3MAIN2_DYNAMICDEP_OFFSET 0x0108
163#define OMAP54XX_CM_L3MAIN2_L3_MAIN_2_CLKCTRL_OFFSET 0x0120
164#define OMAP54XX_CM_L3MAIN2_L3_MAIN_2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0120)
165#define OMAP54XX_CM_L3MAIN2_GPMC_CLKCTRL_OFFSET 0x0128
166#define OMAP54XX_CM_L3MAIN2_GPMC_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0128)
167#define OMAP54XX_CM_L3MAIN2_OCMC_RAM_CLKCTRL_OFFSET 0x0130
168#define OMAP54XX_CM_L3MAIN2_OCMC_RAM_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0130)
169#define OMAP54XX_CM_IPU_CLKSTCTRL_OFFSET 0x0200
170#define OMAP54XX_CM_IPU_STATICDEP_OFFSET 0x0204
171#define OMAP54XX_CM_IPU_DYNAMICDEP_OFFSET 0x0208
172#define OMAP54XX_CM_IPU_IPU_CLKCTRL_OFFSET 0x0220
173#define OMAP54XX_CM_IPU_IPU_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0220)
174#define OMAP54XX_CM_DMA_CLKSTCTRL_OFFSET 0x0300
175#define OMAP54XX_CM_DMA_STATICDEP_OFFSET 0x0304
176#define OMAP54XX_CM_DMA_DYNAMICDEP_OFFSET 0x0308
177#define OMAP54XX_CM_DMA_DMA_SYSTEM_CLKCTRL_OFFSET 0x0320
178#define OMAP54XX_CM_DMA_DMA_SYSTEM_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0320)
179#define OMAP54XX_CM_EMIF_CLKSTCTRL_OFFSET 0x0400
180#define OMAP54XX_CM_EMIF_DMM_CLKCTRL_OFFSET 0x0420
181#define OMAP54XX_CM_EMIF_DMM_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0420)
182#define OMAP54XX_CM_EMIF_EMIF_OCP_FW_CLKCTRL_OFFSET 0x0428
183#define OMAP54XX_CM_EMIF_EMIF_OCP_FW_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0428)
184#define OMAP54XX_CM_EMIF_EMIF1_CLKCTRL_OFFSET 0x0430
185#define OMAP54XX_CM_EMIF_EMIF1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0430)
186#define OMAP54XX_CM_EMIF_EMIF2_CLKCTRL_OFFSET 0x0438
187#define OMAP54XX_CM_EMIF_EMIF2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0438)
188#define OMAP54XX_CM_EMIF_EMIF_DLL_CLKCTRL_OFFSET 0x0440
189#define OMAP54XX_CM_EMIF_EMIF_DLL_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0440)
190#define OMAP54XX_CM_C2C_CLKSTCTRL_OFFSET 0x0500
191#define OMAP54XX_CM_C2C_STATICDEP_OFFSET 0x0504
192#define OMAP54XX_CM_C2C_DYNAMICDEP_OFFSET 0x0508
193#define OMAP54XX_CM_C2C_C2C_CLKCTRL_OFFSET 0x0520
194#define OMAP54XX_CM_C2C_C2C_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0520)
195#define OMAP54XX_CM_C2C_MODEM_ICR_CLKCTRL_OFFSET 0x0528
196#define OMAP54XX_CM_C2C_MODEM_ICR_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0528)
197#define OMAP54XX_CM_C2C_C2C_OCP_FW_CLKCTRL_OFFSET 0x0530
198#define OMAP54XX_CM_C2C_C2C_OCP_FW_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0530)
199#define OMAP54XX_CM_L4CFG_CLKSTCTRL_OFFSET 0x0600
200#define OMAP54XX_CM_L4CFG_DYNAMICDEP_OFFSET 0x0608
201#define OMAP54XX_CM_L4CFG_L4_CFG_CLKCTRL_OFFSET 0x0620
202#define OMAP54XX_CM_L4CFG_L4_CFG_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0620)
203#define OMAP54XX_CM_L4CFG_SPINLOCK_CLKCTRL_OFFSET 0x0628
204#define OMAP54XX_CM_L4CFG_SPINLOCK_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0628)
205#define OMAP54XX_CM_L4CFG_MAILBOX_CLKCTRL_OFFSET 0x0630
206#define OMAP54XX_CM_L4CFG_MAILBOX_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0630)
207#define OMAP54XX_CM_L4CFG_SAR_ROM_CLKCTRL_OFFSET 0x0638
208#define OMAP54XX_CM_L4CFG_SAR_ROM_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0638)
209#define OMAP54XX_CM_L4CFG_OCP2SCP2_CLKCTRL_OFFSET 0x0640
210#define OMAP54XX_CM_L4CFG_OCP2SCP2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0640)
211#define OMAP54XX_CM_L3INSTR_CLKSTCTRL_OFFSET 0x0700
212#define OMAP54XX_CM_L3INSTR_L3_MAIN_3_CLKCTRL_OFFSET 0x0720
213#define OMAP54XX_CM_L3INSTR_L3_MAIN_3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0720)
214#define OMAP54XX_CM_L3INSTR_L3_INSTR_CLKCTRL_OFFSET 0x0728
215#define OMAP54XX_CM_L3INSTR_L3_INSTR_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0728)
216#define OMAP54XX_CM_L3INSTR_OCP_WP_NOC_CLKCTRL_OFFSET 0x0740
217#define OMAP54XX_CM_L3INSTR_OCP_WP_NOC_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0740)
218#define OMAP54XX_CM_L3INSTR_DLL_AGING_CLKCTRL_OFFSET 0x0748
219#define OMAP54XX_CM_L3INSTR_DLL_AGING_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0748)
220#define OMAP54XX_CM_L3INSTR_CTRL_MODULE_BANDGAP_CLKCTRL_OFFSET 0x0750
221#define OMAP54XX_CM_L3INSTR_CTRL_MODULE_BANDGAP_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0750)
222#define OMAP54XX_CM_MIPIEXT_CLKSTCTRL_OFFSET 0x0800
223#define OMAP54XX_CM_MIPIEXT_STATICDEP_OFFSET 0x0804
224#define OMAP54XX_CM_MIPIEXT_DYNAMICDEP_OFFSET 0x0808
225#define OMAP54XX_CM_MIPIEXT_LLI_CLKCTRL_OFFSET 0x0820
226#define OMAP54XX_CM_MIPIEXT_LLI_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0820)
227#define OMAP54XX_CM_MIPIEXT_LLI_OCP_FW_CLKCTRL_OFFSET 0x0828
228#define OMAP54XX_CM_MIPIEXT_LLI_OCP_FW_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0828)
229#define OMAP54XX_CM_MIPIEXT_MPHY_CLKCTRL_OFFSET 0x0830
230#define OMAP54XX_CM_MIPIEXT_MPHY_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0830)
231#define OMAP54XX_CM_L4PER_CLKSTCTRL_OFFSET 0x0900
232#define OMAP54XX_CM_L4PER_DYNAMICDEP_OFFSET 0x0908
233#define OMAP54XX_CM_L4PER_TIMER10_CLKCTRL_OFFSET 0x0928
234#define OMAP54XX_CM_L4PER_TIMER10_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0928)
235#define OMAP54XX_CM_L4PER_TIMER11_CLKCTRL_OFFSET 0x0930
236#define OMAP54XX_CM_L4PER_TIMER11_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0930)
237#define OMAP54XX_CM_L4PER_TIMER2_CLKCTRL_OFFSET 0x0938
238#define OMAP54XX_CM_L4PER_TIMER2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0938)
239#define OMAP54XX_CM_L4PER_TIMER3_CLKCTRL_OFFSET 0x0940
240#define OMAP54XX_CM_L4PER_TIMER3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0940)
241#define OMAP54XX_CM_L4PER_TIMER4_CLKCTRL_OFFSET 0x0948
242#define OMAP54XX_CM_L4PER_TIMER4_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0948)
243#define OMAP54XX_CM_L4PER_TIMER9_CLKCTRL_OFFSET 0x0950
244#define OMAP54XX_CM_L4PER_TIMER9_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0950)
245#define OMAP54XX_CM_L4PER_ELM_CLKCTRL_OFFSET 0x0958
246#define OMAP54XX_CM_L4PER_ELM_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0958)
247#define OMAP54XX_CM_L4PER_GPIO2_CLKCTRL_OFFSET 0x0960
248#define OMAP54XX_CM_L4PER_GPIO2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0960)
249#define OMAP54XX_CM_L4PER_GPIO3_CLKCTRL_OFFSET 0x0968
250#define OMAP54XX_CM_L4PER_GPIO3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0968)
251#define OMAP54XX_CM_L4PER_GPIO4_CLKCTRL_OFFSET 0x0970
252#define OMAP54XX_CM_L4PER_GPIO4_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0970)
253#define OMAP54XX_CM_L4PER_GPIO5_CLKCTRL_OFFSET 0x0978
254#define OMAP54XX_CM_L4PER_GPIO5_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0978)
255#define OMAP54XX_CM_L4PER_GPIO6_CLKCTRL_OFFSET 0x0980
256#define OMAP54XX_CM_L4PER_GPIO6_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0980)
257#define OMAP54XX_CM_L4PER_HDQ1W_CLKCTRL_OFFSET 0x0988
258#define OMAP54XX_CM_L4PER_HDQ1W_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0988)
259#define OMAP54XX_CM_L4PER_I2C1_CLKCTRL_OFFSET 0x09a0
260#define OMAP54XX_CM_L4PER_I2C1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09a0)
261#define OMAP54XX_CM_L4PER_I2C2_CLKCTRL_OFFSET 0x09a8
262#define OMAP54XX_CM_L4PER_I2C2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09a8)
263#define OMAP54XX_CM_L4PER_I2C3_CLKCTRL_OFFSET 0x09b0
264#define OMAP54XX_CM_L4PER_I2C3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09b0)
265#define OMAP54XX_CM_L4PER_I2C4_CLKCTRL_OFFSET 0x09b8
266#define OMAP54XX_CM_L4PER_I2C4_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09b8)
267#define OMAP54XX_CM_L4PER_L4_PER_CLKCTRL_OFFSET 0x09c0
268#define OMAP54XX_CM_L4PER_L4_PER_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09c0)
269#define OMAP54XX_CM_L4PER_MCSPI1_CLKCTRL_OFFSET 0x09f0
270#define OMAP54XX_CM_L4PER_MCSPI1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09f0)
271#define OMAP54XX_CM_L4PER_MCSPI2_CLKCTRL_OFFSET 0x09f8
272#define OMAP54XX_CM_L4PER_MCSPI2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x09f8)
273#define OMAP54XX_CM_L4PER_MCSPI3_CLKCTRL_OFFSET 0x0a00
274#define OMAP54XX_CM_L4PER_MCSPI3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a00)
275#define OMAP54XX_CM_L4PER_MCSPI4_CLKCTRL_OFFSET 0x0a08
276#define OMAP54XX_CM_L4PER_MCSPI4_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a08)
277#define OMAP54XX_CM_L4PER_GPIO7_CLKCTRL_OFFSET 0x0a10
278#define OMAP54XX_CM_L4PER_GPIO7_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a10)
279#define OMAP54XX_CM_L4PER_GPIO8_CLKCTRL_OFFSET 0x0a18
280#define OMAP54XX_CM_L4PER_GPIO8_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a18)
281#define OMAP54XX_CM_L4PER_MMC3_CLKCTRL_OFFSET 0x0a20
282#define OMAP54XX_CM_L4PER_MMC3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a20)
283#define OMAP54XX_CM_L4PER_MMC4_CLKCTRL_OFFSET 0x0a28
284#define OMAP54XX_CM_L4PER_MMC4_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a28)
285#define OMAP54XX_CM_L4PER_UART1_CLKCTRL_OFFSET 0x0a40
286#define OMAP54XX_CM_L4PER_UART1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a40)
287#define OMAP54XX_CM_L4PER_UART2_CLKCTRL_OFFSET 0x0a48
288#define OMAP54XX_CM_L4PER_UART2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a48)
289#define OMAP54XX_CM_L4PER_UART3_CLKCTRL_OFFSET 0x0a50
290#define OMAP54XX_CM_L4PER_UART3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a50)
291#define OMAP54XX_CM_L4PER_UART4_CLKCTRL_OFFSET 0x0a58
292#define OMAP54XX_CM_L4PER_UART4_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a58)
293#define OMAP54XX_CM_L4PER_MMC5_CLKCTRL_OFFSET 0x0a60
294#define OMAP54XX_CM_L4PER_MMC5_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a60)
295#define OMAP54XX_CM_L4PER_I2C5_CLKCTRL_OFFSET 0x0a68
296#define OMAP54XX_CM_L4PER_I2C5_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a68)
297#define OMAP54XX_CM_L4PER_UART5_CLKCTRL_OFFSET 0x0a70
298#define OMAP54XX_CM_L4PER_UART5_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a70)
299#define OMAP54XX_CM_L4PER_UART6_CLKCTRL_OFFSET 0x0a78
300#define OMAP54XX_CM_L4PER_UART6_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0a78)
301#define OMAP54XX_CM_L4SEC_CLKSTCTRL_OFFSET 0x0a80
302#define OMAP54XX_CM_L4SEC_STATICDEP_OFFSET 0x0a84
303#define OMAP54XX_CM_L4SEC_DYNAMICDEP_OFFSET 0x0a88
304#define OMAP54XX_CM_L4SEC_AES1_CLKCTRL_OFFSET 0x0aa0
305#define OMAP54XX_CM_L4SEC_AES1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0aa0)
306#define OMAP54XX_CM_L4SEC_AES2_CLKCTRL_OFFSET 0x0aa8
307#define OMAP54XX_CM_L4SEC_AES2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0aa8)
308#define OMAP54XX_CM_L4SEC_DES3DES_CLKCTRL_OFFSET 0x0ab0
309#define OMAP54XX_CM_L4SEC_DES3DES_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0ab0)
310#define OMAP54XX_CM_L4SEC_FPKA_CLKCTRL_OFFSET 0x0ab8
311#define OMAP54XX_CM_L4SEC_FPKA_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0ab8)
312#define OMAP54XX_CM_L4SEC_RNG_CLKCTRL_OFFSET 0x0ac0
313#define OMAP54XX_CM_L4SEC_RNG_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0ac0)
314#define OMAP54XX_CM_L4SEC_SHA2MD5_CLKCTRL_OFFSET 0x0ac8
315#define OMAP54XX_CM_L4SEC_SHA2MD5_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0ac8)
316#define OMAP54XX_CM_L4SEC_DMA_CRYPTO_CLKCTRL_OFFSET 0x0ad8
317#define OMAP54XX_CM_L4SEC_DMA_CRYPTO_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CORE_INST, 0x0ad8)
318
319/* CM_CORE.IVA_CM_CORE register offsets */
320#define OMAP54XX_CM_IVA_CLKSTCTRL_OFFSET 0x0000
321#define OMAP54XX_CM_IVA_STATICDEP_OFFSET 0x0004
322#define OMAP54XX_CM_IVA_DYNAMICDEP_OFFSET 0x0008
323#define OMAP54XX_CM_IVA_IVA_CLKCTRL_OFFSET 0x0020
324#define OMAP54XX_CM_IVA_IVA_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_IVA_INST, 0x0020)
325#define OMAP54XX_CM_IVA_SL2_CLKCTRL_OFFSET 0x0028
326#define OMAP54XX_CM_IVA_SL2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_IVA_INST, 0x0028)
327
328/* CM_CORE.CAM_CM_CORE register offsets */
329#define OMAP54XX_CM_CAM_CLKSTCTRL_OFFSET 0x0000
330#define OMAP54XX_CM_CAM_STATICDEP_OFFSET 0x0004
331#define OMAP54XX_CM_CAM_DYNAMICDEP_OFFSET 0x0008
332#define OMAP54XX_CM_CAM_ISS_CLKCTRL_OFFSET 0x0020
333#define OMAP54XX_CM_CAM_ISS_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CAM_INST, 0x0020)
334#define OMAP54XX_CM_CAM_FDIF_CLKCTRL_OFFSET 0x0028
335#define OMAP54XX_CM_CAM_FDIF_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CAM_INST, 0x0028)
336#define OMAP54XX_CM_CAM_CAL_CLKCTRL_OFFSET 0x0030
337#define OMAP54XX_CM_CAM_CAL_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CAM_INST, 0x0030)
338
339/* CM_CORE.DSS_CM_CORE register offsets */
340#define OMAP54XX_CM_DSS_CLKSTCTRL_OFFSET 0x0000
341#define OMAP54XX_CM_DSS_STATICDEP_OFFSET 0x0004
342#define OMAP54XX_CM_DSS_DYNAMICDEP_OFFSET 0x0008
343#define OMAP54XX_CM_DSS_DSS_CLKCTRL_OFFSET 0x0020
344#define OMAP54XX_CM_DSS_DSS_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_DSS_INST, 0x0020)
345#define OMAP54XX_CM_DSS_BB2D_CLKCTRL_OFFSET 0x0030
346#define OMAP54XX_CM_DSS_BB2D_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_DSS_INST, 0x0030)
347
348/* CM_CORE.GPU_CM_CORE register offsets */
349#define OMAP54XX_CM_GPU_CLKSTCTRL_OFFSET 0x0000
350#define OMAP54XX_CM_GPU_STATICDEP_OFFSET 0x0004
351#define OMAP54XX_CM_GPU_DYNAMICDEP_OFFSET 0x0008
352#define OMAP54XX_CM_GPU_GPU_CLKCTRL_OFFSET 0x0020
353#define OMAP54XX_CM_GPU_GPU_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_GPU_INST, 0x0020)
354
355/* CM_CORE.L3INIT_CM_CORE register offsets */
356#define OMAP54XX_CM_L3INIT_CLKSTCTRL_OFFSET 0x0000
357#define OMAP54XX_CM_L3INIT_STATICDEP_OFFSET 0x0004
358#define OMAP54XX_CM_L3INIT_DYNAMICDEP_OFFSET 0x0008
359#define OMAP54XX_CM_L3INIT_MMC1_CLKCTRL_OFFSET 0x0028
360#define OMAP54XX_CM_L3INIT_MMC1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0028)
361#define OMAP54XX_CM_L3INIT_MMC2_CLKCTRL_OFFSET 0x0030
362#define OMAP54XX_CM_L3INIT_MMC2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0030)
363#define OMAP54XX_CM_L3INIT_HSI_CLKCTRL_OFFSET 0x0038
364#define OMAP54XX_CM_L3INIT_HSI_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0038)
365#define OMAP54XX_CM_L3INIT_UNIPRO2_CLKCTRL_OFFSET 0x0040
366#define OMAP54XX_CM_L3INIT_UNIPRO2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0040)
367#define OMAP54XX_CM_L3INIT_MPHY_UNIPRO2_CLKCTRL_OFFSET 0x0048
368#define OMAP54XX_CM_L3INIT_MPHY_UNIPRO2_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0048)
369#define OMAP54XX_CM_L3INIT_USB_HOST_HS_CLKCTRL_OFFSET 0x0058
370#define OMAP54XX_CM_L3INIT_USB_HOST_HS_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0058)
371#define OMAP54XX_CM_L3INIT_USB_TLL_HS_CLKCTRL_OFFSET 0x0068
372#define OMAP54XX_CM_L3INIT_USB_TLL_HS_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0068)
373#define OMAP54XX_CM_L3INIT_IEEE1500_2_OCP_CLKCTRL_OFFSET 0x0078
374#define OMAP54XX_CM_L3INIT_IEEE1500_2_OCP_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0078)
375#define OMAP54XX_CM_L3INIT_SATA_CLKCTRL_OFFSET 0x0088
376#define OMAP54XX_CM_L3INIT_SATA_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x0088)
377#define OMAP54XX_CM_L3INIT_OCP2SCP1_CLKCTRL_OFFSET 0x00e0
378#define OMAP54XX_CM_L3INIT_OCP2SCP1_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x00e0)
379#define OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL_OFFSET 0x00e8
380#define OMAP54XX_CM_L3INIT_OCP2SCP3_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x00e8)
381#define OMAP54XX_CM_L3INIT_USB_OTG_SS_CLKCTRL_OFFSET 0x00f0
382#define OMAP54XX_CM_L3INIT_USB_OTG_SS_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_L3INIT_INST, 0x00f0)
383
384/* CM_CORE.CUSTEFUSE_CM_CORE register offsets */
385#define OMAP54XX_CM_CUSTEFUSE_CLKSTCTRL_OFFSET 0x0000
386#define OMAP54XX_CM_CUSTEFUSE_EFUSE_CTRL_CUST_CLKCTRL_OFFSET 0x0020
387#define OMAP54XX_CM_CUSTEFUSE_EFUSE_CTRL_CUST_CLKCTRL OMAP54XX_CM_CORE_REGADDR(OMAP54XX_CM_CORE_CUSTEFUSE_INST, 0x0020)
388
389#endif
diff --git a/arch/arm/mach-omap2/cm33xx.h b/arch/arm/mach-omap2/cm33xx.h
index 64f4bafe7bd9..9d1f4fcdebbb 100644
--- a/arch/arm/mach-omap2/cm33xx.h
+++ b/arch/arm/mach-omap2/cm33xx.h
@@ -383,7 +383,7 @@ extern void am33xx_cm_clkdm_disable_hwsup(s16 inst, u16 cdoffs);
383extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs); 383extern void am33xx_cm_clkdm_force_sleep(s16 inst, u16 cdoffs);
384extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs); 384extern void am33xx_cm_clkdm_force_wakeup(s16 inst, u16 cdoffs);
385 385
386#ifdef CONFIG_SOC_AM33XX 386#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
387extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs, 387extern int am33xx_cm_wait_module_idle(u16 inst, s16 cdoffs,
388 u16 clkctrl_offs); 388 u16 clkctrl_offs);
389extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs, 389extern void am33xx_cm_module_enable(u8 mode, u16 inst, s16 cdoffs,
diff --git a/arch/arm/mach-omap2/cm_44xx_54xx.h b/arch/arm/mach-omap2/cm_44xx_54xx.h
new file mode 100644
index 000000000000..cbb211690321
--- /dev/null
+++ b/arch/arm/mach-omap2/cm_44xx_54xx.h
@@ -0,0 +1,36 @@
1/*
2 * OMAP44xx and OMAP54xx CM1/CM2 function prototypes
3 *
4 * Copyright (C) 2009-2013 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 */
22
23#ifndef __ARCH_ARM_MACH_OMAP2_CM_44XX_54XX_H
24#define __ARCH_ARM_MACH_OMAP2_CM_44XX_55XX_H
25
26/* CM1 Function prototypes */
27extern u32 omap4_cm1_read_inst_reg(s16 inst, u16 idx);
28extern void omap4_cm1_write_inst_reg(u32 val, s16 inst, u16 idx);
29extern u32 omap4_cm1_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
30
31/* CM2 Function prototypes */
32extern u32 omap4_cm2_read_inst_reg(s16 inst, u16 idx);
33extern void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 idx);
34extern u32 omap4_cm2_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
35
36#endif
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index d555cf2459e1..72cab3f4f16d 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -96,6 +96,7 @@ void am33xx_init_early(void);
96void am35xx_init_early(void); 96void am35xx_init_early(void);
97void ti81xx_init_early(void); 97void ti81xx_init_early(void);
98void am33xx_init_early(void); 98void am33xx_init_early(void);
99void am43xx_init_early(void);
99void omap4430_init_early(void); 100void omap4430_init_early(void);
100void omap5_init_early(void); 101void omap5_init_early(void);
101void omap3_init_late(void); /* Do not use this one */ 102void omap3_init_late(void); /* Do not use this one */
@@ -237,8 +238,8 @@ extern void omap_do_wfi(void);
237 238
238#ifdef CONFIG_SMP 239#ifdef CONFIG_SMP
239/* Needed for secondary core boot */ 240/* Needed for secondary core boot */
240extern void omap_secondary_startup(void); 241extern void omap4_secondary_startup(void);
241extern void omap_secondary_startup_4460(void); 242extern void omap4460_secondary_startup(void);
242extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask); 243extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
243extern void omap_auxcoreboot_addr(u32 cpu_addr); 244extern void omap_auxcoreboot_addr(u32 cpu_addr);
244extern u32 omap_read_auxcoreboot0(void); 245extern u32 omap_read_auxcoreboot0(void);
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 2adb2683f074..31e0dfe4a4ea 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -249,6 +249,7 @@ void omap_ctrl_write_dsp_boot_addr(u32 bootaddr)
249 u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTADDR : 249 u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTADDR :
250 cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTADDR : 250 cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTADDR :
251 cpu_is_omap44xx() ? OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR : 251 cpu_is_omap44xx() ? OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR :
252 soc_is_omap54xx() ? OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR :
252 0; 253 0;
253 254
254 if (!offset) { 255 if (!offset) {
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index e6c328128a0a..f7d7c2ef1b40 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -358,6 +358,18 @@
358#define AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH 0x2 358#define AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH 0x2
359#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK (0x3 << 22) 359#define AM33XX_CONTROL_STATUS_SYSBOOT1_MASK (0x3 << 22)
360 360
361/* AM33XX PWMSS Control register */
362#define AM33XX_PWMSS_TBCLK_CLKCTRL 0x664
363
364/* AM33XX PWMSS Control bitfields */
365#define AM33XX_PWMSS0_TBCLKEN_SHIFT 0
366#define AM33XX_PWMSS1_TBCLKEN_SHIFT 1
367#define AM33XX_PWMSS2_TBCLKEN_SHIFT 2
368
369/* DEV Feature register to identify AM33XX features */
370#define AM33XX_DEV_FEATURE 0x604
371#define AM33XX_SGX_MASK BIT(29)
372
361/* CONTROL OMAP STATUS register to identify OMAP3 features */ 373/* CONTROL OMAP STATUS register to identify OMAP3 features */
362#define OMAP3_CONTROL_OMAP_STATUS 0x044c 374#define OMAP3_CONTROL_OMAP_STATUS 0x044c
363 375
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 4269fc145698..aef96e45cb20 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -15,12 +15,13 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/gpio.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/of.h> 20#include <linux/of.h>
20#include <linux/pinctrl/machine.h> 21#include <linux/pinctrl/machine.h>
21#include <linux/platform_data/omap4-keypad.h> 22#include <linux/platform_data/omap4-keypad.h>
22#include <linux/platform_data/omap_ocp2scp.h> 23#include <linux/wl12xx.h>
23#include <linux/usb/omap_control_usb.h> 24#include <linux/platform_data/mailbox-omap.h>
24 25
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
@@ -37,7 +38,6 @@
37#include "mux.h" 38#include "mux.h"
38#include "control.h" 39#include "control.h"
39#include "devices.h" 40#include "devices.h"
40#include "dma.h"
41 41
42#define L3_MODULES_MAX_LEN 12 42#define L3_MODULES_MAX_LEN 12
43#define L3_MODULES 3 43#define L3_MODULES 3
@@ -253,49 +253,6 @@ static inline void omap_init_camera(void)
253#endif 253#endif
254} 254}
255 255
256#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
257static struct omap_control_usb_platform_data omap4_control_usb_pdata = {
258 .type = 1,
259};
260
261struct resource omap4_control_usb_res[] = {
262 {
263 .name = "control_dev_conf",
264 .start = 0x4a002300,
265 .end = 0x4a002303,
266 .flags = IORESOURCE_MEM,
267 },
268 {
269 .name = "otghs_control",
270 .start = 0x4a00233c,
271 .end = 0x4a00233f,
272 .flags = IORESOURCE_MEM,
273 },
274};
275
276static struct platform_device omap4_control_usb = {
277 .name = "omap-control-usb",
278 .id = -1,
279 .dev = {
280 .platform_data = &omap4_control_usb_pdata,
281 },
282 .num_resources = 2,
283 .resource = omap4_control_usb_res,
284};
285
286static inline void __init omap_init_control_usb(void)
287{
288 if (!cpu_is_omap44xx())
289 return;
290
291 if (platform_device_register(&omap4_control_usb))
292 pr_err("Error registering omap_control_usb device\n");
293}
294
295#else
296static inline void omap_init_control_usb(void) { }
297#endif /* CONFIG_OMAP_CONTROL_USB */
298
299int __init omap4_keyboard_init(struct omap4_keypad_platform_data 256int __init omap4_keyboard_init(struct omap4_keypad_platform_data
300 *sdp4430_keypad_data, struct omap_board_data *bdata) 257 *sdp4430_keypad_data, struct omap_board_data *bdata)
301{ 258{
@@ -327,25 +284,31 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
327 return 0; 284 return 0;
328} 285}
329 286
330#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) 287#if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
331static inline void __init omap_init_mbox(void) 288static inline void __init omap_init_mbox(void)
332{ 289{
333 struct omap_hwmod *oh; 290 struct omap_hwmod *oh;
334 struct platform_device *pdev; 291 struct platform_device *pdev;
292 struct omap_mbox_pdata *pdata;
335 293
336 oh = omap_hwmod_lookup("mailbox"); 294 oh = omap_hwmod_lookup("mailbox");
337 if (!oh) { 295 if (!oh) {
338 pr_err("%s: unable to find hwmod\n", __func__); 296 pr_err("%s: unable to find hwmod\n", __func__);
339 return; 297 return;
340 } 298 }
299 if (!oh->dev_attr) {
300 pr_err("%s: hwmod doesn't have valid attrs\n", __func__);
301 return;
302 }
341 303
342 pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0); 304 pdata = (struct omap_mbox_pdata *)oh->dev_attr;
305 pdev = omap_device_build("omap-mailbox", -1, oh, pdata, sizeof(*pdata));
343 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", 306 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
344 __func__, PTR_ERR(pdev)); 307 __func__, PTR_ERR(pdev));
345} 308}
346#else 309#else
347static inline void omap_init_mbox(void) { } 310static inline void omap_init_mbox(void) { }
348#endif /* CONFIG_OMAP_MBOX_FWK */ 311#endif /* CONFIG_OMAP2PLUS_MBOX */
349 312
350static inline void omap_init_sti(void) {} 313static inline void omap_init_sti(void) {}
351 314
@@ -374,10 +337,8 @@ static void __init omap_init_mcpdm(void)
374 struct platform_device *pdev; 337 struct platform_device *pdev;
375 338
376 oh = omap_hwmod_lookup("mcpdm"); 339 oh = omap_hwmod_lookup("mcpdm");
377 if (!oh) { 340 if (!oh)
378 printk(KERN_ERR "Could not look up mcpdm hw_mod\n");
379 return; 341 return;
380 }
381 342
382 pdev = omap_device_build("omap-mcpdm", -1, oh, NULL, 0); 343 pdev = omap_device_build("omap-mcpdm", -1, oh, NULL, 0);
383 WARN(IS_ERR(pdev), "Can't build omap_device for omap-mcpdm.\n"); 344 WARN(IS_ERR(pdev), "Can't build omap_device for omap-mcpdm.\n");
@@ -395,10 +356,8 @@ static void __init omap_init_dmic(void)
395 struct platform_device *pdev; 356 struct platform_device *pdev;
396 357
397 oh = omap_hwmod_lookup("dmic"); 358 oh = omap_hwmod_lookup("dmic");
398 if (!oh) { 359 if (!oh)
399 pr_err("Could not look up dmic hw_mod\n");
400 return; 360 return;
401 }
402 361
403 pdev = omap_device_build("omap-dmic", -1, oh, NULL, 0); 362 pdev = omap_device_build("omap-dmic", -1, oh, NULL, 0);
404 WARN(IS_ERR(pdev), "Can't build omap_device for omap-dmic.\n"); 363 WARN(IS_ERR(pdev), "Can't build omap_device for omap-dmic.\n");
@@ -421,10 +380,8 @@ static void __init omap_init_hdmi_audio(void)
421 struct platform_device *pdev; 380 struct platform_device *pdev;
422 381
423 oh = omap_hwmod_lookup("dss_hdmi"); 382 oh = omap_hwmod_lookup("dss_hdmi");
424 if (!oh) { 383 if (!oh)
425 printk(KERN_ERR "Could not look up dss_hdmi hw_mod\n");
426 return; 384 return;
427 }
428 385
429 pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0); 386 pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0);
430 WARN(IS_ERR(pdev), 387 WARN(IS_ERR(pdev),
@@ -557,80 +514,38 @@ static void omap_init_vout(void)
557static inline void omap_init_vout(void) {} 514static inline void omap_init_vout(void) {}
558#endif 515#endif
559 516
560#if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE) 517#if IS_ENABLED(CONFIG_WL12XX)
561static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)
562{
563 int cnt = 0;
564 518
565 while (ocp2scp_dev->drv_name != NULL) { 519static struct wl12xx_platform_data wl12xx __initdata;
566 cnt++;
567 ocp2scp_dev++;
568 }
569
570 return cnt;
571}
572 520
573static void __init omap_init_ocp2scp(void) 521void __init omap_init_wl12xx_of(void)
574{ 522{
575 struct omap_hwmod *oh; 523 int ret;
576 struct platform_device *pdev;
577 int bus_id = -1, dev_cnt = 0, i;
578 struct omap_ocp2scp_dev *ocp2scp_dev;
579 const char *oh_name, *name;
580 struct omap_ocp2scp_platform_data *pdata;
581
582 if (!cpu_is_omap44xx())
583 return;
584
585 oh_name = "ocp2scp_usb_phy";
586 name = "omap-ocp2scp";
587
588 oh = omap_hwmod_lookup(oh_name);
589 if (!oh) {
590 pr_err("%s: could not find omap_hwmod for %s\n", __func__,
591 oh_name);
592 return;
593 }
594 524
595 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); 525 if (!of_have_populated_dt())
596 if (!pdata) {
597 pr_err("%s: No memory for ocp2scp pdata\n", __func__);
598 return; 526 return;
599 }
600 527
601 ocp2scp_dev = oh->dev_attr; 528 if (of_machine_is_compatible("ti,omap4-sdp")) {
602 dev_cnt = count_ocp2scp_devices(ocp2scp_dev); 529 wl12xx.board_ref_clock = WL12XX_REFCLOCK_26;
603 530 wl12xx.board_tcxo_clock = WL12XX_TCXOCLOCK_26;
604 if (!dev_cnt) { 531 wl12xx.irq = gpio_to_irq(53);
605 pr_err("%s: No devices connected to ocp2scp\n", __func__); 532 } else if (of_machine_is_compatible("ti,omap4-panda")) {
606 kfree(pdata); 533 wl12xx.board_ref_clock = WL12XX_REFCLOCK_38;
534 wl12xx.irq = gpio_to_irq(53);
535 } else {
607 return; 536 return;
608 } 537 }
609 538
610 pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *) 539 ret = wl12xx_set_platform_data(&wl12xx);
611 * dev_cnt, GFP_KERNEL); 540 if (ret) {
612 if (!pdata->devices) { 541 pr_err("error setting wl12xx data: %d\n", ret);
613 pr_err("%s: No memory for ocp2scp pdata devices\n", __func__);
614 kfree(pdata);
615 return;
616 }
617
618 for (i = 0; i < dev_cnt; i++, ocp2scp_dev++)
619 pdata->devices[i] = ocp2scp_dev;
620
621 pdata->dev_cnt = dev_cnt;
622
623 pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata));
624 if (IS_ERR(pdev)) {
625 pr_err("Could not build omap_device for %s %s\n",
626 name, oh_name);
627 kfree(pdata->devices);
628 kfree(pdata);
629 return; 542 return;
630 } 543 }
631} 544}
632#else 545#else
633static inline void omap_init_ocp2scp(void) { } 546static inline void omap_init_wl12xx_of(void)
547{
548}
634#endif 549#endif
635 550
636/*-------------------------------------------------------------------------*/ 551/*-------------------------------------------------------------------------*/
@@ -651,17 +566,18 @@ static int __init omap2_init_devices(void)
651 omap_init_mbox(); 566 omap_init_mbox();
652 /* If dtb is there, the devices will be created dynamically */ 567 /* If dtb is there, the devices will be created dynamically */
653 if (!of_have_populated_dt()) { 568 if (!of_have_populated_dt()) {
654 omap_init_control_usb();
655 omap_init_dmic(); 569 omap_init_dmic();
656 omap_init_mcpdm(); 570 omap_init_mcpdm();
657 omap_init_mcspi(); 571 omap_init_mcspi();
658 omap_init_sham(); 572 omap_init_sham();
659 omap_init_aes(); 573 omap_init_aes();
574 } else {
575 /* These can be removed when bindings are done */
576 omap_init_wl12xx_of();
660 } 577 }
661 omap_init_sti(); 578 omap_init_sti();
662 omap_init_rng(); 579 omap_init_rng();
663 omap_init_vout(); 580 omap_init_vout();
664 omap_init_ocp2scp();
665 581
666 return 0; 582 return 0;
667} 583}
diff --git a/arch/arm/mach-omap2/dma.h b/arch/arm/mach-omap2/dma.h
deleted file mode 100644
index 65f80cacf178..000000000000
--- a/arch/arm/mach-omap2/dma.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * OMAP2PLUS DMA channel definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __OMAP2PLUS_DMA_CHANNEL_H
20#define __OMAP2PLUS_DMA_CHANNEL_H
21
22
23/* DMA channels for 24xx */
24#define OMAP24XX_DMA_NO_DEVICE 0
25#define OMAP24XX_DMA_EXT_DMAREQ0 2 /* S_DMA_1 */
26#define OMAP24XX_DMA_EXT_DMAREQ1 3 /* S_DMA_2 */
27#define OMAP24XX_DMA_GPMC 4 /* S_DMA_3 */
28#define OMAP24XX_DMA_AES_TX 9 /* S_DMA_8 */
29#define OMAP24XX_DMA_AES_RX 10 /* S_DMA_9 */
30#define OMAP242X_DMA_EXT_DMAREQ2 14 /* S_DMA_13 */
31#define OMAP242X_DMA_EXT_DMAREQ3 15 /* S_DMA_14 */
32#define OMAP242X_DMA_EXT_DMAREQ4 16 /* S_DMA_15 */
33#define OMAP34XX_DMA_I2C3_TX 25 /* S_DMA_24 */
34#define OMAP34XX_DMA_I2C3_RX 26 /* S_DMA_25 */
35#define OMAP24XX_DMA_I2C1_TX 27 /* S_DMA_26 */
36#define OMAP24XX_DMA_I2C1_RX 28 /* S_DMA_27 */
37#define OMAP24XX_DMA_I2C2_TX 29 /* S_DMA_28 */
38#define OMAP24XX_DMA_I2C2_RX 30 /* S_DMA_29 */
39#define OMAP24XX_DMA_MMC2_TX 47 /* S_DMA_46 */
40#define OMAP24XX_DMA_MMC2_RX 48 /* S_DMA_47 */
41#define OMAP24XX_DMA_UART1_TX 49 /* S_DMA_48 */
42#define OMAP24XX_DMA_UART1_RX 50 /* S_DMA_49 */
43#define OMAP24XX_DMA_UART2_TX 51 /* S_DMA_50 */
44#define OMAP24XX_DMA_UART2_RX 52 /* S_DMA_51 */
45#define OMAP24XX_DMA_UART3_TX 53 /* S_DMA_52 */
46#define OMAP24XX_DMA_UART3_RX 54 /* S_DMA_53 */
47#define OMAP24XX_DMA_MMC1_TX 61 /* S_DMA_60 */
48#define OMAP24XX_DMA_MMC1_RX 62 /* S_DMA_61 */
49#define OMAP242X_DMA_EXT_DMAREQ5 64 /* S_DMA_63 */
50#define OMAP34XX_DMA_AES2_TX 65 /* S_DMA_64 */
51#define OMAP34XX_DMA_AES2_RX 66 /* S_DMA_65 */
52#define OMAP34XX_DMA_SHA1MD5_RX 69 /* S_DMA_68 */
53
54#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
55#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
56
57/* Only for AM35xx */
58#define AM35XX_DMA_UART4_TX 54
59#define AM35XX_DMA_UART4_RX 55
60
61#endif /* __OMAP2PLUS_DMA_CHANNEL_H */
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index d9c27195caf0..662c7fd633cc 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -43,44 +43,6 @@ static struct platform_device gpmc_nand_device = {
43 .resource = gpmc_nand_resource, 43 .resource = gpmc_nand_resource,
44}; 44};
45 45
46static int omap2_nand_gpmc_retime(
47 struct omap_nand_platform_data *gpmc_nand_data,
48 struct gpmc_timings *gpmc_t)
49{
50 struct gpmc_timings t;
51 int err;
52
53 memset(&t, 0, sizeof(t));
54 t.sync_clk = gpmc_t->sync_clk;
55 t.cs_on = gpmc_t->cs_on;
56 t.adv_on = gpmc_t->adv_on;
57
58 /* Read */
59 t.adv_rd_off = gpmc_t->adv_rd_off;
60 t.oe_on = t.adv_on;
61 t.access = gpmc_t->access;
62 t.oe_off = gpmc_t->oe_off;
63 t.cs_rd_off = gpmc_t->cs_rd_off;
64 t.rd_cycle = gpmc_t->rd_cycle;
65
66 /* Write */
67 t.adv_wr_off = gpmc_t->adv_wr_off;
68 t.we_on = t.oe_on;
69 if (cpu_is_omap34xx()) {
70 t.wr_data_mux_bus = gpmc_t->wr_data_mux_bus;
71 t.wr_access = gpmc_t->wr_access;
72 }
73 t.we_off = gpmc_t->we_off;
74 t.cs_wr_off = gpmc_t->cs_wr_off;
75 t.wr_cycle = gpmc_t->wr_cycle;
76
77 err = gpmc_cs_set_timings(gpmc_nand_data->cs, &t);
78 if (err)
79 return err;
80
81 return 0;
82}
83
84static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) 46static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
85{ 47{
86 /* support only OMAP3 class */ 48 /* support only OMAP3 class */
@@ -131,7 +93,7 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
131 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT); 93 gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
132 94
133 if (gpmc_t) { 95 if (gpmc_t) {
134 err = omap2_nand_gpmc_retime(gpmc_nand_data, gpmc_t); 96 err = gpmc_cs_set_timings(gpmc_nand_data->cs, gpmc_t);
135 if (err < 0) { 97 if (err < 0) {
136 dev_err(dev, "Unable to set gpmc timings: %d\n", err); 98 dev_err(dev, "Unable to set gpmc timings: %d\n", err);
137 return err; 99 return err;
@@ -140,8 +102,6 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
140 if (gpmc_nand_data->of_node) { 102 if (gpmc_nand_data->of_node) {
141 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s); 103 gpmc_read_settings_dt(gpmc_nand_data->of_node, &s);
142 } else { 104 } else {
143 s.device_nand = true;
144
145 /* Enable RD PIN Monitoring Reg */ 105 /* Enable RD PIN Monitoring Reg */
146 if (gpmc_nand_data->dev_ready) { 106 if (gpmc_nand_data->dev_ready) {
147 s.wait_on_read = true; 107 s.wait_on_read = true;
@@ -149,6 +109,8 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
149 } 109 }
150 } 110 }
151 111
112 s.device_nand = true;
113
152 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16) 114 if (gpmc_nand_data->devsize == NAND_BUSWIDTH_16)
153 s.device_width = GPMC_DEVWIDTH_16BIT; 115 s.device_width = GPMC_DEVWIDTH_16BIT;
154 else 116 else
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 6c4da1254f53..1c7969e965d7 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -30,6 +30,7 @@
30#include <linux/of_mtd.h> 30#include <linux/of_mtd.h>
31#include <linux/of_device.h> 31#include <linux/of_device.h>
32#include <linux/mtd/nand.h> 32#include <linux/mtd/nand.h>
33#include <linux/pm_runtime.h>
33 34
34#include <linux/platform_data/mtd-nand-omap2.h> 35#include <linux/platform_data/mtd-nand-omap2.h>
35 36
@@ -155,6 +156,7 @@ static struct resource gpmc_cs_mem[GPMC_CS_NUM];
155static DEFINE_SPINLOCK(gpmc_mem_lock); 156static DEFINE_SPINLOCK(gpmc_mem_lock);
156/* Define chip-selects as reserved by default until probe completes */ 157/* Define chip-selects as reserved by default until probe completes */
157static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1); 158static unsigned int gpmc_cs_map = ((1 << GPMC_CS_NUM) - 1);
159static unsigned int gpmc_cs_num = GPMC_CS_NUM;
158static unsigned int gpmc_nr_waitpins; 160static unsigned int gpmc_nr_waitpins;
159static struct device *gpmc_dev; 161static struct device *gpmc_dev;
160static int gpmc_irq; 162static int gpmc_irq;
@@ -521,8 +523,10 @@ static int gpmc_cs_remap(int cs, u32 base)
521 int ret; 523 int ret;
522 u32 old_base, size; 524 u32 old_base, size;
523 525
524 if (cs > GPMC_CS_NUM) 526 if (cs > gpmc_cs_num) {
527 pr_err("%s: requested chip-select is disabled\n", __func__);
525 return -ENODEV; 528 return -ENODEV;
529 }
526 gpmc_cs_get_memconf(cs, &old_base, &size); 530 gpmc_cs_get_memconf(cs, &old_base, &size);
527 if (base == old_base) 531 if (base == old_base)
528 return 0; 532 return 0;
@@ -545,9 +549,10 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
545 struct resource *res = &gpmc_cs_mem[cs]; 549 struct resource *res = &gpmc_cs_mem[cs];
546 int r = -1; 550 int r = -1;
547 551
548 if (cs > GPMC_CS_NUM) 552 if (cs > gpmc_cs_num) {
553 pr_err("%s: requested chip-select is disabled\n", __func__);
549 return -ENODEV; 554 return -ENODEV;
550 555 }
551 size = gpmc_mem_align(size); 556 size = gpmc_mem_align(size);
552 if (size > (1 << GPMC_SECTION_SHIFT)) 557 if (size > (1 << GPMC_SECTION_SHIFT))
553 return -ENOMEM; 558 return -ENOMEM;
@@ -582,7 +587,7 @@ EXPORT_SYMBOL(gpmc_cs_request);
582void gpmc_cs_free(int cs) 587void gpmc_cs_free(int cs)
583{ 588{
584 spin_lock(&gpmc_mem_lock); 589 spin_lock(&gpmc_mem_lock);
585 if (cs >= GPMC_CS_NUM || cs < 0 || !gpmc_cs_reserved(cs)) { 590 if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) {
586 printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs); 591 printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
587 BUG(); 592 BUG();
588 spin_unlock(&gpmc_mem_lock); 593 spin_unlock(&gpmc_mem_lock);
@@ -777,7 +782,7 @@ static void gpmc_mem_exit(void)
777{ 782{
778 int cs; 783 int cs;
779 784
780 for (cs = 0; cs < GPMC_CS_NUM; cs++) { 785 for (cs = 0; cs < gpmc_cs_num; cs++) {
781 if (!gpmc_cs_mem_enabled(cs)) 786 if (!gpmc_cs_mem_enabled(cs))
782 continue; 787 continue;
783 gpmc_cs_delete_mem(cs); 788 gpmc_cs_delete_mem(cs);
@@ -798,7 +803,7 @@ static void gpmc_mem_init(void)
798 gpmc_mem_root.end = GPMC_MEM_END; 803 gpmc_mem_root.end = GPMC_MEM_END;
799 804
800 /* Reserve all regions that has been set up by bootloader */ 805 /* Reserve all regions that has been set up by bootloader */
801 for (cs = 0; cs < GPMC_CS_NUM; cs++) { 806 for (cs = 0; cs < gpmc_cs_num; cs++) {
802 u32 base, size; 807 u32 base, size;
803 808
804 if (!gpmc_cs_mem_enabled(cs)) 809 if (!gpmc_cs_mem_enabled(cs))
@@ -1245,7 +1250,6 @@ void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p)
1245 1250
1246 p->sync_read = of_property_read_bool(np, "gpmc,sync-read"); 1251 p->sync_read = of_property_read_bool(np, "gpmc,sync-read");
1247 p->sync_write = of_property_read_bool(np, "gpmc,sync-write"); 1252 p->sync_write = of_property_read_bool(np, "gpmc,sync-write");
1248 p->device_nand = of_property_read_bool(np, "gpmc,device-nand");
1249 of_property_read_u32(np, "gpmc,device-width", &p->device_width); 1253 of_property_read_u32(np, "gpmc,device-width", &p->device_width);
1250 of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data); 1254 of_property_read_u32(np, "gpmc,mux-add-data", &p->mux_add_data);
1251 1255
@@ -1345,6 +1349,13 @@ static const char * const nand_ecc_opts[] = {
1345 [OMAP_ECC_BCH8_CODE_HW] = "bch8", 1349 [OMAP_ECC_BCH8_CODE_HW] = "bch8",
1346}; 1350};
1347 1351
1352static const char * const nand_xfer_types[] = {
1353 [NAND_OMAP_PREFETCH_POLLED] = "prefetch-polled",
1354 [NAND_OMAP_POLLED] = "polled",
1355 [NAND_OMAP_PREFETCH_DMA] = "prefetch-dma",
1356 [NAND_OMAP_PREFETCH_IRQ] = "prefetch-irq",
1357};
1358
1348static int gpmc_probe_nand_child(struct platform_device *pdev, 1359static int gpmc_probe_nand_child(struct platform_device *pdev,
1349 struct device_node *child) 1360 struct device_node *child)
1350{ 1361{
@@ -1374,6 +1385,13 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
1374 break; 1385 break;
1375 } 1386 }
1376 1387
1388 if (!of_property_read_string(child, "ti,nand-xfer-type", &s))
1389 for (val = 0; val < ARRAY_SIZE(nand_xfer_types); val++)
1390 if (!strcasecmp(s, nand_xfer_types[val])) {
1391 gpmc_nand_data->xfer_type = val;
1392 break;
1393 }
1394
1377 val = of_get_nand_bus_width(child); 1395 val = of_get_nand_bus_width(child);
1378 if (val == 16) 1396 if (val == 16)
1379 gpmc_nand_data->devsize = NAND_BUSWIDTH_16; 1397 gpmc_nand_data->devsize = NAND_BUSWIDTH_16;
@@ -1513,6 +1531,20 @@ static int gpmc_probe_dt(struct platform_device *pdev)
1513 if (!of_id) 1531 if (!of_id)
1514 return 0; 1532 return 0;
1515 1533
1534 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-cs",
1535 &gpmc_cs_num);
1536 if (ret < 0) {
1537 pr_err("%s: number of chip-selects not defined\n", __func__);
1538 return ret;
1539 } else if (gpmc_cs_num < 1) {
1540 pr_err("%s: all chip-selects are disabled\n", __func__);
1541 return -EINVAL;
1542 } else if (gpmc_cs_num > GPMC_CS_NUM) {
1543 pr_err("%s: number of supported chip-selects cannot be > %d\n",
1544 __func__, GPMC_CS_NUM);
1545 return -EINVAL;
1546 }
1547
1516 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins", 1548 ret = of_property_read_u32(pdev->dev.of_node, "gpmc,num-waitpins",
1517 &gpmc_nr_waitpins); 1549 &gpmc_nr_waitpins);
1518 if (ret < 0) { 1550 if (ret < 0) {
@@ -1577,7 +1609,8 @@ static int gpmc_probe(struct platform_device *pdev)
1577 return PTR_ERR(gpmc_l3_clk); 1609 return PTR_ERR(gpmc_l3_clk);
1578 } 1610 }
1579 1611
1580 clk_prepare_enable(gpmc_l3_clk); 1612 pm_runtime_enable(&pdev->dev);
1613 pm_runtime_get_sync(&pdev->dev);
1581 1614
1582 gpmc_dev = &pdev->dev; 1615 gpmc_dev = &pdev->dev;
1583 1616
@@ -1610,12 +1643,14 @@ static int gpmc_probe(struct platform_device *pdev)
1610 /* Now the GPMC is initialised, unreserve the chip-selects */ 1643 /* Now the GPMC is initialised, unreserve the chip-selects */
1611 gpmc_cs_map = 0; 1644 gpmc_cs_map = 0;
1612 1645
1613 if (!pdev->dev.of_node) 1646 if (!pdev->dev.of_node) {
1647 gpmc_cs_num = GPMC_CS_NUM;
1614 gpmc_nr_waitpins = GPMC_NR_WAITPINS; 1648 gpmc_nr_waitpins = GPMC_NR_WAITPINS;
1649 }
1615 1650
1616 rc = gpmc_probe_dt(pdev); 1651 rc = gpmc_probe_dt(pdev);
1617 if (rc < 0) { 1652 if (rc < 0) {
1618 clk_disable_unprepare(gpmc_l3_clk); 1653 pm_runtime_put_sync(&pdev->dev);
1619 clk_put(gpmc_l3_clk); 1654 clk_put(gpmc_l3_clk);
1620 dev_err(gpmc_dev, "failed to probe DT parameters\n"); 1655 dev_err(gpmc_dev, "failed to probe DT parameters\n");
1621 return rc; 1656 return rc;
@@ -1628,10 +1663,30 @@ static int gpmc_remove(struct platform_device *pdev)
1628{ 1663{
1629 gpmc_free_irq(); 1664 gpmc_free_irq();
1630 gpmc_mem_exit(); 1665 gpmc_mem_exit();
1666 pm_runtime_put_sync(&pdev->dev);
1667 pm_runtime_disable(&pdev->dev);
1631 gpmc_dev = NULL; 1668 gpmc_dev = NULL;
1632 return 0; 1669 return 0;
1633} 1670}
1634 1671
1672#ifdef CONFIG_PM_SLEEP
1673static int gpmc_suspend(struct device *dev)
1674{
1675 omap3_gpmc_save_context();
1676 pm_runtime_put_sync(dev);
1677 return 0;
1678}
1679
1680static int gpmc_resume(struct device *dev)
1681{
1682 pm_runtime_get_sync(dev);
1683 omap3_gpmc_restore_context();
1684 return 0;
1685}
1686#endif
1687
1688static SIMPLE_DEV_PM_OPS(gpmc_pm_ops, gpmc_suspend, gpmc_resume);
1689
1635static struct platform_driver gpmc_driver = { 1690static struct platform_driver gpmc_driver = {
1636 .probe = gpmc_probe, 1691 .probe = gpmc_probe,
1637 .remove = gpmc_remove, 1692 .remove = gpmc_remove,
@@ -1639,6 +1694,7 @@ static struct platform_driver gpmc_driver = {
1639 .name = DEVICE_NAME, 1694 .name = DEVICE_NAME,
1640 .owner = THIS_MODULE, 1695 .owner = THIS_MODULE,
1641 .of_match_table = of_match_ptr(gpmc_dt_ids), 1696 .of_match_table = of_match_ptr(gpmc_dt_ids),
1697 .pm = &gpmc_pm_ops,
1642 }, 1698 },
1643}; 1699};
1644 1700
@@ -1701,7 +1757,6 @@ static irqreturn_t gpmc_handle_irq(int irq, void *dev)
1701 return IRQ_HANDLED; 1757 return IRQ_HANDLED;
1702} 1758}
1703 1759
1704#ifdef CONFIG_ARCH_OMAP3
1705static struct omap3_gpmc_regs gpmc_context; 1760static struct omap3_gpmc_regs gpmc_context;
1706 1761
1707void omap3_gpmc_save_context(void) 1762void omap3_gpmc_save_context(void)
@@ -1715,7 +1770,7 @@ void omap3_gpmc_save_context(void)
1715 gpmc_context.prefetch_config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1); 1770 gpmc_context.prefetch_config1 = gpmc_read_reg(GPMC_PREFETCH_CONFIG1);
1716 gpmc_context.prefetch_config2 = gpmc_read_reg(GPMC_PREFETCH_CONFIG2); 1771 gpmc_context.prefetch_config2 = gpmc_read_reg(GPMC_PREFETCH_CONFIG2);
1717 gpmc_context.prefetch_control = gpmc_read_reg(GPMC_PREFETCH_CONTROL); 1772 gpmc_context.prefetch_control = gpmc_read_reg(GPMC_PREFETCH_CONTROL);
1718 for (i = 0; i < GPMC_CS_NUM; i++) { 1773 for (i = 0; i < gpmc_cs_num; i++) {
1719 gpmc_context.cs_context[i].is_valid = gpmc_cs_mem_enabled(i); 1774 gpmc_context.cs_context[i].is_valid = gpmc_cs_mem_enabled(i);
1720 if (gpmc_context.cs_context[i].is_valid) { 1775 if (gpmc_context.cs_context[i].is_valid) {
1721 gpmc_context.cs_context[i].config1 = 1776 gpmc_context.cs_context[i].config1 =
@@ -1747,7 +1802,7 @@ void omap3_gpmc_restore_context(void)
1747 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, gpmc_context.prefetch_config1); 1802 gpmc_write_reg(GPMC_PREFETCH_CONFIG1, gpmc_context.prefetch_config1);
1748 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, gpmc_context.prefetch_config2); 1803 gpmc_write_reg(GPMC_PREFETCH_CONFIG2, gpmc_context.prefetch_config2);
1749 gpmc_write_reg(GPMC_PREFETCH_CONTROL, gpmc_context.prefetch_control); 1804 gpmc_write_reg(GPMC_PREFETCH_CONTROL, gpmc_context.prefetch_control);
1750 for (i = 0; i < GPMC_CS_NUM; i++) { 1805 for (i = 0; i < gpmc_cs_num; i++) {
1751 if (gpmc_context.cs_context[i].is_valid) { 1806 if (gpmc_context.cs_context[i].is_valid) {
1752 gpmc_cs_write_reg(i, GPMC_CS_CONFIG1, 1807 gpmc_cs_write_reg(i, GPMC_CS_CONFIG1,
1753 gpmc_context.cs_context[i].config1); 1808 gpmc_context.cs_context[i].config1);
@@ -1766,4 +1821,3 @@ void omap3_gpmc_restore_context(void)
1766 } 1821 }
1767 } 1822 }
1768} 1823}
1769#endif /* CONFIG_ARCH_OMAP3 */
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 2ef1f8714fcf..07d4c7b35754 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -29,7 +29,6 @@
29 29
30static u16 control_pbias_offset; 30static u16 control_pbias_offset;
31static u16 control_devconf1_offset; 31static u16 control_devconf1_offset;
32static u16 control_mmc1;
33 32
34#define HSMMC_NAME_LEN 9 33#define HSMMC_NAME_LEN 9
35 34
@@ -121,57 +120,6 @@ static void omap_hsmmc1_after_set_reg(struct device *dev, int slot,
121 } 120 }
122} 121}
123 122
124static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
125 int power_on, int vdd)
126{
127 u32 reg;
128
129 /*
130 * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
131 * card with Vcc regulator (from twl4030 or whatever). OMAP has both
132 * 1.8V and 3.0V modes, controlled by the PBIAS register.
133 */
134 reg = omap4_ctrl_pad_readl(control_pbias_offset);
135 reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
136 OMAP4_MMC1_PWRDNZ_MASK |
137 OMAP4_MMC1_PBIASLITE_VMODE_MASK);
138 omap4_ctrl_pad_writel(reg, control_pbias_offset);
139}
140
141static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
142 int power_on, int vdd)
143{
144 u32 reg;
145 unsigned long timeout;
146
147 if (power_on) {
148 reg = omap4_ctrl_pad_readl(control_pbias_offset);
149 reg |= OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK;
150 if ((1 << vdd) <= MMC_VDD_165_195)
151 reg &= ~OMAP4_MMC1_PBIASLITE_VMODE_MASK;
152 else
153 reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK;
154 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
155 OMAP4_MMC1_PWRDNZ_MASK);
156 omap4_ctrl_pad_writel(reg, control_pbias_offset);
157
158 timeout = jiffies + msecs_to_jiffies(5);
159 do {
160 reg = omap4_ctrl_pad_readl(control_pbias_offset);
161 if (!(reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK))
162 break;
163 usleep_range(100, 200);
164 } while (!time_after(jiffies, timeout));
165
166 if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
167 pr_err("Pbias Voltage is not same as LDO\n");
168 /* Caution : On VMODE_ERROR Power Down MMC IO */
169 reg &= ~(OMAP4_MMC1_PWRDNZ_MASK);
170 omap4_ctrl_pad_writel(reg, control_pbias_offset);
171 }
172 }
173}
174
175static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc) 123static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc)
176{ 124{
177 u32 reg; 125 u32 reg;
@@ -317,11 +265,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
317 mmc->slots[0].pm_caps = c->pm_caps; 265 mmc->slots[0].pm_caps = c->pm_caps;
318 mmc->slots[0].internal_clock = !c->ext_clock; 266 mmc->slots[0].internal_clock = !c->ext_clock;
319 mmc->max_freq = c->max_freq; 267 mmc->max_freq = c->max_freq;
320 if (cpu_is_omap44xx()) 268 mmc->reg_offset = 0;
321 mmc->reg_offset = OMAP4_MMC_REG_OFFSET;
322 else
323 mmc->reg_offset = 0;
324
325 mmc->get_context_loss_count = hsmmc_get_context_loss; 269 mmc->get_context_loss_count = hsmmc_get_context_loss;
326 270
327 mmc->slots[0].switch_pin = c->gpio_cd; 271 mmc->slots[0].switch_pin = c->gpio_cd;
@@ -368,24 +312,14 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
368 if (!soc_is_am35xx()) 312 if (!soc_is_am35xx())
369 mmc->slots[0].features |= HSMMC_HAS_PBIAS; 313 mmc->slots[0].features |= HSMMC_HAS_PBIAS;
370 314
371 if (cpu_is_omap44xx() && (omap_rev() > OMAP4430_REV_ES1_0))
372 mmc->slots[0].features |= HSMMC_HAS_UPDATED_RESET;
373
374 switch (c->mmc) { 315 switch (c->mmc) {
375 case 1: 316 case 1:
376 if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { 317 if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
377 /* on-chip level shifting via PBIAS0/PBIAS1 */ 318 /* on-chip level shifting via PBIAS0/PBIAS1 */
378 if (cpu_is_omap44xx()) { 319 mmc->slots[0].before_set_reg =
379 mmc->slots[0].before_set_reg = 320 omap_hsmmc1_before_set_reg;
380 omap4_hsmmc1_before_set_reg; 321 mmc->slots[0].after_set_reg =
381 mmc->slots[0].after_set_reg = 322 omap_hsmmc1_after_set_reg;
382 omap4_hsmmc1_after_set_reg;
383 } else {
384 mmc->slots[0].before_set_reg =
385 omap_hsmmc1_before_set_reg;
386 mmc->slots[0].after_set_reg =
387 omap_hsmmc1_after_set_reg;
388 }
389 } 323 }
390 324
391 if (soc_is_am35xx()) 325 if (soc_is_am35xx())
@@ -563,34 +497,17 @@ free_mmc:
563 497
564void __init omap_hsmmc_init(struct omap2_hsmmc_info *controllers) 498void __init omap_hsmmc_init(struct omap2_hsmmc_info *controllers)
565{ 499{
566 u32 reg;
567
568 if (omap_hsmmc_done) 500 if (omap_hsmmc_done)
569 return; 501 return;
570 502
571 omap_hsmmc_done = 1; 503 omap_hsmmc_done = 1;
572 504
573 if (!cpu_is_omap44xx()) { 505 if (cpu_is_omap2430()) {
574 if (cpu_is_omap2430()) { 506 control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
575 control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE; 507 control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
576 control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
577 } else {
578 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
579 control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
580 }
581 } else { 508 } else {
582 control_pbias_offset = 509 control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
583 OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_PBIASLITE; 510 control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
584 control_mmc1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_MMC1;
585 reg = omap4_ctrl_pad_readl(control_mmc1);
586 reg |= (OMAP4_SDMMC1_PUSTRENGTH_GRP0_MASK |
587 OMAP4_SDMMC1_PUSTRENGTH_GRP1_MASK);
588 reg &= ~(OMAP4_SDMMC1_PUSTRENGTH_GRP2_MASK |
589 OMAP4_SDMMC1_PUSTRENGTH_GRP3_MASK);
590 reg |= (OMAP4_SDMMC1_DR0_SPEEDCTRL_MASK |
591 OMAP4_SDMMC1_DR1_SPEEDCTRL_MASK |
592 OMAP4_SDMMC1_DR2_SPEEDCTRL_MASK);
593 omap4_ctrl_pad_writel(reg, control_mmc1);
594 } 511 }
595 512
596 for (; controllers->mmc; controllers++) 513 for (; controllers->mmc; controllers++)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1272c41d4749..2dc62a25f2c3 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -55,7 +55,7 @@ int omap_type(void)
55 55
56 if (cpu_is_omap24xx()) { 56 if (cpu_is_omap24xx()) {
57 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS); 57 val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
58 } else if (soc_is_am33xx()) { 58 } else if (soc_is_am33xx() || soc_is_am43xx()) {
59 val = omap_ctrl_readl(AM33XX_CONTROL_STATUS); 59 val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
60 } else if (cpu_is_omap34xx()) { 60 } else if (cpu_is_omap34xx()) {
61 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS); 61 val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
@@ -209,6 +209,8 @@ static void __init omap3_cpuinfo(void)
209 cpu_name = "TI816X"; 209 cpu_name = "TI816X";
210 } else if (soc_is_am335x()) { 210 } else if (soc_is_am335x()) {
211 cpu_name = "AM335X"; 211 cpu_name = "AM335X";
212 } else if (soc_is_am437x()) {
213 cpu_name = "AM437x";
212 } else if (cpu_is_ti814x()) { 214 } else if (cpu_is_ti814x()) {
213 cpu_name = "TI814X"; 215 cpu_name = "TI814X";
214 } else if (omap3_has_iva() && omap3_has_sgx()) { 216 } else if (omap3_has_iva() && omap3_has_sgx()) {
@@ -302,6 +304,19 @@ void __init ti81xx_check_features(void)
302 omap3_cpuinfo(); 304 omap3_cpuinfo();
303} 305}
304 306
307void __init am33xx_check_features(void)
308{
309 u32 status;
310
311 omap_features = OMAP3_HAS_NEON;
312
313 status = omap_ctrl_readl(AM33XX_DEV_FEATURE);
314 if (status & AM33XX_SGX_MASK)
315 omap_features |= OMAP3_HAS_SGX;
316
317 omap3_cpuinfo();
318}
319
305void __init omap3xxx_check_revision(void) 320void __init omap3xxx_check_revision(void)
306{ 321{
307 const char *cpu_rev; 322 const char *cpu_rev;
@@ -405,11 +420,18 @@ void __init omap3xxx_check_revision(void)
405 cpu_rev = "1.0"; 420 cpu_rev = "1.0";
406 break; 421 break;
407 case 1: 422 case 1:
408 /* FALLTHROUGH */
409 default:
410 omap_revision = TI8168_REV_ES1_1; 423 omap_revision = TI8168_REV_ES1_1;
411 cpu_rev = "1.1"; 424 cpu_rev = "1.1";
412 break; 425 break;
426 case 2:
427 omap_revision = TI8168_REV_ES2_0;
428 cpu_rev = "2.0";
429 break;
430 case 3:
431 /* FALLTHROUGH */
432 default:
433 omap_revision = TI8168_REV_ES2_1;
434 cpu_rev = "2.1";
413 } 435 }
414 break; 436 break;
415 case 0xb944: 437 case 0xb944:
@@ -430,6 +452,10 @@ void __init omap3xxx_check_revision(void)
430 break; 452 break;
431 } 453 }
432 break; 454 break;
455 case 0xb98c:
456 omap_revision = AM437X_REV_ES1_0;
457 cpu_rev = "1.0";
458 break;
433 case 0xb8f2: 459 case 0xb8f2:
434 switch (rev) { 460 switch (rev) {
435 case 0: 461 case 0:
@@ -601,7 +627,7 @@ void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
601 627
602#ifdef CONFIG_SOC_BUS 628#ifdef CONFIG_SOC_BUS
603 629
604static const char const *omap_types[] = { 630static const char * const omap_types[] = {
605 [OMAP2_DEVICE_TYPE_TEST] = "TST", 631 [OMAP2_DEVICE_TYPE_TEST] = "TST",
606 [OMAP2_DEVICE_TYPE_EMU] = "EMU", 632 [OMAP2_DEVICE_TYPE_EMU] = "EMU",
607 [OMAP2_DEVICE_TYPE_SEC] = "HS", 633 [OMAP2_DEVICE_TYPE_SEC] = "HS",
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 09abf99e9e57..fe3253a100e7 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -202,7 +202,7 @@ static struct map_desc omapti81xx_io_desc[] __initdata = {
202}; 202};
203#endif 203#endif
204 204
205#ifdef CONFIG_SOC_AM33XX 205#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
206static struct map_desc omapam33xx_io_desc[] __initdata = { 206static struct map_desc omapam33xx_io_desc[] __initdata = {
207 { 207 {
208 .virtual = L4_34XX_VIRT, 208 .virtual = L4_34XX_VIRT,
@@ -318,7 +318,7 @@ void __init ti81xx_map_io(void)
318} 318}
319#endif 319#endif
320 320
321#ifdef CONFIG_SOC_AM33XX 321#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
322void __init am33xx_map_io(void) 322void __init am33xx_map_io(void)
323{ 323{
324 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 324 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
@@ -576,8 +576,7 @@ void __init am33xx_init_early(void)
576 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE)); 576 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
577 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL); 577 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
578 omap3xxx_check_revision(); 578 omap3xxx_check_revision();
579 ti81xx_check_features(); 579 am33xx_check_features();
580 am33xx_voltagedomains_init();
581 am33xx_powerdomains_init(); 580 am33xx_powerdomains_init();
582 am33xx_clockdomains_init(); 581 am33xx_clockdomains_init();
583 am33xx_hwmod_init(); 582 am33xx_hwmod_init();
@@ -586,6 +585,19 @@ void __init am33xx_init_early(void)
586} 585}
587#endif 586#endif
588 587
588#ifdef CONFIG_SOC_AM43XX
589void __init am43xx_init_early(void)
590{
591 omap2_set_globals_tap(AM335X_CLASS,
592 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
593 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
594 NULL);
595 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE));
596 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM43XX_PRCM_BASE), NULL);
597 omap3xxx_check_revision();
598}
599#endif
600
589#ifdef CONFIG_ARCH_OMAP4 601#ifdef CONFIG_ARCH_OMAP4
590void __init omap4430_init_early(void) 602void __init omap4430_init_early(void)
591{ 603{
@@ -631,7 +643,13 @@ void __init omap5_init_early(void)
631 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 643 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
632 omap_prm_base_init(); 644 omap_prm_base_init();
633 omap_cm_base_init(); 645 omap_cm_base_init();
646 omap44xx_prm_init();
634 omap5xxx_check_revision(); 647 omap5xxx_check_revision();
648 omap54xx_voltagedomains_init();
649 omap54xx_powerdomains_init();
650 omap54xx_clockdomains_init();
651 omap54xx_hwmod_init();
652 omap_hwmod_init_postsetup();
635} 653}
636#endif 654#endif
637 655
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
deleted file mode 100644
index 0b080267b7f6..000000000000
--- a/arch/arm/mach-omap2/mailbox.c
+++ /dev/null
@@ -1,430 +0,0 @@
1/*
2 * Mailbox reservation modules for OMAP2/3
3 *
4 * Copyright (C) 2006-2009 Nokia Corporation
5 * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
6 * and Paul Mundt
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/module.h>
14#include <linux/clk.h>
15#include <linux/err.h>
16#include <linux/platform_device.h>
17#include <linux/io.h>
18#include <linux/pm_runtime.h>
19
20#include <plat/mailbox.h>
21
22#include "soc.h"
23
24#define MAILBOX_REVISION 0x000
25#define MAILBOX_MESSAGE(m) (0x040 + 4 * (m))
26#define MAILBOX_FIFOSTATUS(m) (0x080 + 4 * (m))
27#define MAILBOX_MSGSTATUS(m) (0x0c0 + 4 * (m))
28#define MAILBOX_IRQSTATUS(u) (0x100 + 8 * (u))
29#define MAILBOX_IRQENABLE(u) (0x104 + 8 * (u))
30
31#define OMAP4_MAILBOX_IRQSTATUS(u) (0x104 + 0x10 * (u))
32#define OMAP4_MAILBOX_IRQENABLE(u) (0x108 + 0x10 * (u))
33#define OMAP4_MAILBOX_IRQENABLE_CLR(u) (0x10c + 0x10 * (u))
34
35#define MAILBOX_IRQ_NEWMSG(m) (1 << (2 * (m)))
36#define MAILBOX_IRQ_NOTFULL(m) (1 << (2 * (m) + 1))
37
38#define MBOX_REG_SIZE 0x120
39
40#define OMAP4_MBOX_REG_SIZE 0x130
41
42#define MBOX_NR_REGS (MBOX_REG_SIZE / sizeof(u32))
43#define OMAP4_MBOX_NR_REGS (OMAP4_MBOX_REG_SIZE / sizeof(u32))
44
45static void __iomem *mbox_base;
46
47struct omap_mbox2_fifo {
48 unsigned long msg;
49 unsigned long fifo_stat;
50 unsigned long msg_stat;
51};
52
53struct omap_mbox2_priv {
54 struct omap_mbox2_fifo tx_fifo;
55 struct omap_mbox2_fifo rx_fifo;
56 unsigned long irqenable;
57 unsigned long irqstatus;
58 u32 newmsg_bit;
59 u32 notfull_bit;
60 u32 ctx[OMAP4_MBOX_NR_REGS];
61 unsigned long irqdisable;
62};
63
64static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
65 omap_mbox_type_t irq);
66
67static inline unsigned int mbox_read_reg(size_t ofs)
68{
69 return __raw_readl(mbox_base + ofs);
70}
71
72static inline void mbox_write_reg(u32 val, size_t ofs)
73{
74 __raw_writel(val, mbox_base + ofs);
75}
76
77/* Mailbox H/W preparations */
78static int omap2_mbox_startup(struct omap_mbox *mbox)
79{
80 u32 l;
81
82 pm_runtime_enable(mbox->dev->parent);
83 pm_runtime_get_sync(mbox->dev->parent);
84
85 l = mbox_read_reg(MAILBOX_REVISION);
86 pr_debug("omap mailbox rev %d.%d\n", (l & 0xf0) >> 4, (l & 0x0f));
87
88 return 0;
89}
90
91static void omap2_mbox_shutdown(struct omap_mbox *mbox)
92{
93 pm_runtime_put_sync(mbox->dev->parent);
94 pm_runtime_disable(mbox->dev->parent);
95}
96
97/* Mailbox FIFO handle functions */
98static mbox_msg_t omap2_mbox_fifo_read(struct omap_mbox *mbox)
99{
100 struct omap_mbox2_fifo *fifo =
101 &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo;
102 return (mbox_msg_t) mbox_read_reg(fifo->msg);
103}
104
105static void omap2_mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
106{
107 struct omap_mbox2_fifo *fifo =
108 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
109 mbox_write_reg(msg, fifo->msg);
110}
111
112static int omap2_mbox_fifo_empty(struct omap_mbox *mbox)
113{
114 struct omap_mbox2_fifo *fifo =
115 &((struct omap_mbox2_priv *)mbox->priv)->rx_fifo;
116 return (mbox_read_reg(fifo->msg_stat) == 0);
117}
118
119static int omap2_mbox_fifo_full(struct omap_mbox *mbox)
120{
121 struct omap_mbox2_fifo *fifo =
122 &((struct omap_mbox2_priv *)mbox->priv)->tx_fifo;
123 return mbox_read_reg(fifo->fifo_stat);
124}
125
126/* Mailbox IRQ handle functions */
127static void omap2_mbox_enable_irq(struct omap_mbox *mbox,
128 omap_mbox_type_t irq)
129{
130 struct omap_mbox2_priv *p = mbox->priv;
131 u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
132
133 l = mbox_read_reg(p->irqenable);
134 l |= bit;
135 mbox_write_reg(l, p->irqenable);
136}
137
138static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
139 omap_mbox_type_t irq)
140{
141 struct omap_mbox2_priv *p = mbox->priv;
142 u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
143
144 if (!cpu_is_omap44xx())
145 bit = mbox_read_reg(p->irqdisable) & ~bit;
146
147 mbox_write_reg(bit, p->irqdisable);
148}
149
150static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
151 omap_mbox_type_t irq)
152{
153 struct omap_mbox2_priv *p = mbox->priv;
154 u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
155
156 mbox_write_reg(bit, p->irqstatus);
157
158 /* Flush posted write for irq status to avoid spurious interrupts */
159 mbox_read_reg(p->irqstatus);
160}
161
162static int omap2_mbox_is_irq(struct omap_mbox *mbox,
163 omap_mbox_type_t irq)
164{
165 struct omap_mbox2_priv *p = mbox->priv;
166 u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
167 u32 enable = mbox_read_reg(p->irqenable);
168 u32 status = mbox_read_reg(p->irqstatus);
169
170 return (int)(enable & status & bit);
171}
172
173static void omap2_mbox_save_ctx(struct omap_mbox *mbox)
174{
175 int i;
176 struct omap_mbox2_priv *p = mbox->priv;
177 int nr_regs;
178 if (cpu_is_omap44xx())
179 nr_regs = OMAP4_MBOX_NR_REGS;
180 else
181 nr_regs = MBOX_NR_REGS;
182 for (i = 0; i < nr_regs; i++) {
183 p->ctx[i] = mbox_read_reg(i * sizeof(u32));
184
185 dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__,
186 i, p->ctx[i]);
187 }
188}
189
190static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
191{
192 int i;
193 struct omap_mbox2_priv *p = mbox->priv;
194 int nr_regs;
195 if (cpu_is_omap44xx())
196 nr_regs = OMAP4_MBOX_NR_REGS;
197 else
198 nr_regs = MBOX_NR_REGS;
199 for (i = 0; i < nr_regs; i++) {
200 mbox_write_reg(p->ctx[i], i * sizeof(u32));
201
202 dev_dbg(mbox->dev, "%s: [%02x] %08x\n", __func__,
203 i, p->ctx[i]);
204 }
205}
206
207static struct omap_mbox_ops omap2_mbox_ops = {
208 .type = OMAP_MBOX_TYPE2,
209 .startup = omap2_mbox_startup,
210 .shutdown = omap2_mbox_shutdown,
211 .fifo_read = omap2_mbox_fifo_read,
212 .fifo_write = omap2_mbox_fifo_write,
213 .fifo_empty = omap2_mbox_fifo_empty,
214 .fifo_full = omap2_mbox_fifo_full,
215 .enable_irq = omap2_mbox_enable_irq,
216 .disable_irq = omap2_mbox_disable_irq,
217 .ack_irq = omap2_mbox_ack_irq,
218 .is_irq = omap2_mbox_is_irq,
219 .save_ctx = omap2_mbox_save_ctx,
220 .restore_ctx = omap2_mbox_restore_ctx,
221};
222
223/*
224 * MAILBOX 0: ARM -> DSP,
225 * MAILBOX 1: ARM <- DSP.
226 * MAILBOX 2: ARM -> IVA,
227 * MAILBOX 3: ARM <- IVA.
228 */
229
230/* FIXME: the following structs should be filled automatically by the user id */
231
232#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP2)
233/* DSP */
234static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
235 .tx_fifo = {
236 .msg = MAILBOX_MESSAGE(0),
237 .fifo_stat = MAILBOX_FIFOSTATUS(0),
238 },
239 .rx_fifo = {
240 .msg = MAILBOX_MESSAGE(1),
241 .msg_stat = MAILBOX_MSGSTATUS(1),
242 },
243 .irqenable = MAILBOX_IRQENABLE(0),
244 .irqstatus = MAILBOX_IRQSTATUS(0),
245 .notfull_bit = MAILBOX_IRQ_NOTFULL(0),
246 .newmsg_bit = MAILBOX_IRQ_NEWMSG(1),
247 .irqdisable = MAILBOX_IRQENABLE(0),
248};
249
250struct omap_mbox mbox_dsp_info = {
251 .name = "dsp",
252 .ops = &omap2_mbox_ops,
253 .priv = &omap2_mbox_dsp_priv,
254};
255#endif
256
257#if defined(CONFIG_ARCH_OMAP3)
258struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL };
259#endif
260
261#if defined(CONFIG_SOC_OMAP2420)
262/* IVA */
263static struct omap_mbox2_priv omap2_mbox_iva_priv = {
264 .tx_fifo = {
265 .msg = MAILBOX_MESSAGE(2),
266 .fifo_stat = MAILBOX_FIFOSTATUS(2),
267 },
268 .rx_fifo = {
269 .msg = MAILBOX_MESSAGE(3),
270 .msg_stat = MAILBOX_MSGSTATUS(3),
271 },
272 .irqenable = MAILBOX_IRQENABLE(3),
273 .irqstatus = MAILBOX_IRQSTATUS(3),
274 .notfull_bit = MAILBOX_IRQ_NOTFULL(2),
275 .newmsg_bit = MAILBOX_IRQ_NEWMSG(3),
276 .irqdisable = MAILBOX_IRQENABLE(3),
277};
278
279static struct omap_mbox mbox_iva_info = {
280 .name = "iva",
281 .ops = &omap2_mbox_ops,
282 .priv = &omap2_mbox_iva_priv,
283};
284#endif
285
286#ifdef CONFIG_ARCH_OMAP2
287struct omap_mbox *omap2_mboxes[] = {
288 &mbox_dsp_info,
289#ifdef CONFIG_SOC_OMAP2420
290 &mbox_iva_info,
291#endif
292 NULL
293};
294#endif
295
296#if defined(CONFIG_ARCH_OMAP4)
297/* OMAP4 */
298static struct omap_mbox2_priv omap2_mbox_1_priv = {
299 .tx_fifo = {
300 .msg = MAILBOX_MESSAGE(0),
301 .fifo_stat = MAILBOX_FIFOSTATUS(0),
302 },
303 .rx_fifo = {
304 .msg = MAILBOX_MESSAGE(1),
305 .msg_stat = MAILBOX_MSGSTATUS(1),
306 },
307 .irqenable = OMAP4_MAILBOX_IRQENABLE(0),
308 .irqstatus = OMAP4_MAILBOX_IRQSTATUS(0),
309 .notfull_bit = MAILBOX_IRQ_NOTFULL(0),
310 .newmsg_bit = MAILBOX_IRQ_NEWMSG(1),
311 .irqdisable = OMAP4_MAILBOX_IRQENABLE_CLR(0),
312};
313
314struct omap_mbox mbox_1_info = {
315 .name = "mailbox-1",
316 .ops = &omap2_mbox_ops,
317 .priv = &omap2_mbox_1_priv,
318};
319
320static struct omap_mbox2_priv omap2_mbox_2_priv = {
321 .tx_fifo = {
322 .msg = MAILBOX_MESSAGE(3),
323 .fifo_stat = MAILBOX_FIFOSTATUS(3),
324 },
325 .rx_fifo = {
326 .msg = MAILBOX_MESSAGE(2),
327 .msg_stat = MAILBOX_MSGSTATUS(2),
328 },
329 .irqenable = OMAP4_MAILBOX_IRQENABLE(0),
330 .irqstatus = OMAP4_MAILBOX_IRQSTATUS(0),
331 .notfull_bit = MAILBOX_IRQ_NOTFULL(3),
332 .newmsg_bit = MAILBOX_IRQ_NEWMSG(2),
333 .irqdisable = OMAP4_MAILBOX_IRQENABLE_CLR(0),
334};
335
336struct omap_mbox mbox_2_info = {
337 .name = "mailbox-2",
338 .ops = &omap2_mbox_ops,
339 .priv = &omap2_mbox_2_priv,
340};
341
342struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
343#endif
344
345static int omap2_mbox_probe(struct platform_device *pdev)
346{
347 struct resource *mem;
348 int ret;
349 struct omap_mbox **list;
350
351 if (false)
352 ;
353#if defined(CONFIG_ARCH_OMAP3)
354 else if (cpu_is_omap34xx()) {
355 list = omap3_mboxes;
356
357 list[0]->irq = platform_get_irq(pdev, 0);
358 }
359#endif
360#if defined(CONFIG_ARCH_OMAP2)
361 else if (cpu_is_omap2430()) {
362 list = omap2_mboxes;
363
364 list[0]->irq = platform_get_irq(pdev, 0);
365 } else if (cpu_is_omap2420()) {
366 list = omap2_mboxes;
367
368 list[0]->irq = platform_get_irq_byname(pdev, "dsp");
369 list[1]->irq = platform_get_irq_byname(pdev, "iva");
370 }
371#endif
372#if defined(CONFIG_ARCH_OMAP4)
373 else if (cpu_is_omap44xx()) {
374 list = omap4_mboxes;
375
376 list[0]->irq = list[1]->irq = platform_get_irq(pdev, 0);
377 }
378#endif
379 else {
380 pr_err("%s: platform not supported\n", __func__);
381 return -ENODEV;
382 }
383
384 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
385 mbox_base = ioremap(mem->start, resource_size(mem));
386 if (!mbox_base)
387 return -ENOMEM;
388
389 ret = omap_mbox_register(&pdev->dev, list);
390 if (ret) {
391 iounmap(mbox_base);
392 return ret;
393 }
394
395 return 0;
396}
397
398static int omap2_mbox_remove(struct platform_device *pdev)
399{
400 omap_mbox_unregister();
401 iounmap(mbox_base);
402 return 0;
403}
404
405static struct platform_driver omap2_mbox_driver = {
406 .probe = omap2_mbox_probe,
407 .remove = omap2_mbox_remove,
408 .driver = {
409 .name = "omap-mailbox",
410 },
411};
412
413static int __init omap2_mbox_init(void)
414{
415 return platform_driver_register(&omap2_mbox_driver);
416}
417
418static void __exit omap2_mbox_exit(void)
419{
420 platform_driver_unregister(&omap2_mbox_driver);
421}
422
423module_init(omap2_mbox_init);
424module_exit(omap2_mbox_exit);
425
426MODULE_LICENSE("GPL v2");
427MODULE_DESCRIPTION("omap mailbox: omap2/3/4 architecture specific functions");
428MODULE_AUTHOR("Hiroshi DOYU <Hiroshi.DOYU@nokia.com>");
429MODULE_AUTHOR("Paul Mundt");
430MODULE_ALIAS("platform:omap2-mailbox");
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
index fdb22f14021f..5d2080ef7923 100644
--- a/arch/arm/mach-omap2/mux.h
+++ b/arch/arm/mach-omap2/mux.h
@@ -10,7 +10,6 @@
10#include "mux2420.h" 10#include "mux2420.h"
11#include "mux2430.h" 11#include "mux2430.h"
12#include "mux34xx.h" 12#include "mux34xx.h"
13#include "mux44xx.h"
14 13
15#define OMAP_MUX_TERMINATOR 0xffff 14#define OMAP_MUX_TERMINATOR 0xffff
16 15
@@ -64,8 +63,6 @@
64 63
65/* Flags for omapX_mux_init */ 64/* Flags for omapX_mux_init */
66#define OMAP_PACKAGE_MASK 0xffff 65#define OMAP_PACKAGE_MASK 0xffff
67#define OMAP_PACKAGE_CBS 8 /* 547-pin 0.40 0.40 */
68#define OMAP_PACKAGE_CBL 7 /* 547-pin 0.40 0.40 */
69#define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */ 66#define OMAP_PACKAGE_CBP 6 /* 515-pin 0.40 0.50 */
70#define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */ 67#define OMAP_PACKAGE_CUS 5 /* 423-pin 0.65 */
71#define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */ 68#define OMAP_PACKAGE_CBB 4 /* 515-pin 0.40 0.50 */
diff --git a/arch/arm/mach-omap2/mux44xx.c b/arch/arm/mach-omap2/mux44xx.c
deleted file mode 100644
index f5a74daab2ff..000000000000
--- a/arch/arm/mach-omap2/mux44xx.c
+++ /dev/null
@@ -1,1356 +0,0 @@
1/*
2 * OMAP44xx ES1.0 pin mux definition
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 *
6 * Benoit Cousson (b-cousson@ti.com)
7 *
8 * - Based on mux34xx.c done by Tony Lindgren <tony@atomide.com>
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20#include <linux/module.h>
21#include <linux/init.h>
22
23#include "mux.h"
24
25#ifdef CONFIG_OMAP_MUX
26
27#define _OMAP4_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
28{ \
29 .reg_offset = (OMAP4_CTRL_MODULE_PAD_##M0##_OFFSET), \
30 .gpio = (g), \
31 .muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \
32}
33
34#else
35
36#define _OMAP4_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
37{ \
38 .reg_offset = (OMAP4_CTRL_MODULE_PAD_##M0##_OFFSET), \
39 .gpio = (g), \
40}
41
42#endif
43
44#define _OMAP4_BALLENTRY(M0, bb, bt) \
45{ \
46 .reg_offset = (OMAP4_CTRL_MODULE_PAD_##M0##_OFFSET), \
47 .balls = { bb, bt }, \
48}
49
50/*
51 * Superset of all mux modes for omap4 ES1.0
52 */
53static struct omap_mux __initdata omap4_core_muxmodes[] = {
54 _OMAP4_MUXENTRY(GPMC_AD0, 0, "gpmc_ad0", "sdmmc2_dat0", NULL, NULL,
55 NULL, NULL, NULL, NULL),
56 _OMAP4_MUXENTRY(GPMC_AD1, 0, "gpmc_ad1", "sdmmc2_dat1", NULL, NULL,
57 NULL, NULL, NULL, NULL),
58 _OMAP4_MUXENTRY(GPMC_AD2, 0, "gpmc_ad2", "sdmmc2_dat2", NULL, NULL,
59 NULL, NULL, NULL, NULL),
60 _OMAP4_MUXENTRY(GPMC_AD3, 0, "gpmc_ad3", "sdmmc2_dat3", NULL, NULL,
61 NULL, NULL, NULL, NULL),
62 _OMAP4_MUXENTRY(GPMC_AD4, 0, "gpmc_ad4", "sdmmc2_dat4",
63 "sdmmc2_dir_dat0", NULL, NULL, NULL, NULL, NULL),
64 _OMAP4_MUXENTRY(GPMC_AD5, 0, "gpmc_ad5", "sdmmc2_dat5",
65 "sdmmc2_dir_dat1", NULL, NULL, NULL, NULL, NULL),
66 _OMAP4_MUXENTRY(GPMC_AD6, 0, "gpmc_ad6", "sdmmc2_dat6",
67 "sdmmc2_dir_cmd", NULL, NULL, NULL, NULL, NULL),
68 _OMAP4_MUXENTRY(GPMC_AD7, 0, "gpmc_ad7", "sdmmc2_dat7",
69 "sdmmc2_clk_fdbk", NULL, NULL, NULL, NULL, NULL),
70 _OMAP4_MUXENTRY(GPMC_AD8, 32, "gpmc_ad8", "kpd_row0", "c2c_data15",
71 "gpio_32", NULL, NULL, NULL, NULL),
72 _OMAP4_MUXENTRY(GPMC_AD9, 33, "gpmc_ad9", "kpd_row1", "c2c_data14",
73 "gpio_33", NULL, NULL, NULL, NULL),
74 _OMAP4_MUXENTRY(GPMC_AD10, 34, "gpmc_ad10", "kpd_row2", "c2c_data13",
75 "gpio_34", NULL, NULL, NULL, NULL),
76 _OMAP4_MUXENTRY(GPMC_AD11, 35, "gpmc_ad11", "kpd_row3", "c2c_data12",
77 "gpio_35", NULL, NULL, NULL, NULL),
78 _OMAP4_MUXENTRY(GPMC_AD12, 36, "gpmc_ad12", "kpd_col0", "c2c_data11",
79 "gpio_36", NULL, NULL, NULL, NULL),
80 _OMAP4_MUXENTRY(GPMC_AD13, 37, "gpmc_ad13", "kpd_col1", "c2c_data10",
81 "gpio_37", NULL, NULL, NULL, NULL),
82 _OMAP4_MUXENTRY(GPMC_AD14, 38, "gpmc_ad14", "kpd_col2", "c2c_data9",
83 "gpio_38", NULL, NULL, NULL, NULL),
84 _OMAP4_MUXENTRY(GPMC_AD15, 39, "gpmc_ad15", "kpd_col3", "c2c_data8",
85 "gpio_39", NULL, NULL, NULL, NULL),
86 _OMAP4_MUXENTRY(GPMC_A16, 40, "gpmc_a16", "kpd_row4", "c2c_datain0",
87 "gpio_40", "venc_656_data0", NULL, NULL, NULL),
88 _OMAP4_MUXENTRY(GPMC_A17, 41, "gpmc_a17", "kpd_row5", "c2c_datain1",
89 "gpio_41", "venc_656_data1", NULL, NULL, "safe_mode"),
90 _OMAP4_MUXENTRY(GPMC_A18, 42, "gpmc_a18", "kpd_row6", "c2c_datain2",
91 "gpio_42", "venc_656_data2", NULL, NULL, "safe_mode"),
92 _OMAP4_MUXENTRY(GPMC_A19, 43, "gpmc_a19", "kpd_row7", "c2c_datain3",
93 "gpio_43", "venc_656_data3", NULL, NULL, "safe_mode"),
94 _OMAP4_MUXENTRY(GPMC_A20, 44, "gpmc_a20", "kpd_col4", "c2c_datain4",
95 "gpio_44", "venc_656_data4", NULL, NULL, "safe_mode"),
96 _OMAP4_MUXENTRY(GPMC_A21, 45, "gpmc_a21", "kpd_col5", "c2c_datain5",
97 "gpio_45", "venc_656_data5", NULL, NULL, "safe_mode"),
98 _OMAP4_MUXENTRY(GPMC_A22, 46, "gpmc_a22", "kpd_col6", "c2c_datain6",
99 "gpio_46", "venc_656_data6", NULL, NULL, "safe_mode"),
100 _OMAP4_MUXENTRY(GPMC_A23, 47, "gpmc_a23", "kpd_col7", "c2c_datain7",
101 "gpio_47", "venc_656_data7", NULL, NULL, "safe_mode"),
102 _OMAP4_MUXENTRY(GPMC_A24, 48, "gpmc_a24", NULL, "c2c_clkout0",
103 "gpio_48", NULL, NULL, NULL, "safe_mode"),
104 _OMAP4_MUXENTRY(GPMC_A25, 49, "gpmc_a25", NULL, "c2c_clkout1",
105 "gpio_49", NULL, NULL, NULL, "safe_mode"),
106 _OMAP4_MUXENTRY(GPMC_NCS0, 50, "gpmc_ncs0", NULL, NULL, "gpio_50",
107 "sys_ndmareq0", NULL, NULL, NULL),
108 _OMAP4_MUXENTRY(GPMC_NCS1, 51, "gpmc_ncs1", NULL, "c2c_dataout6",
109 "gpio_51", NULL, NULL, NULL, "safe_mode"),
110 _OMAP4_MUXENTRY(GPMC_NCS2, 52, "gpmc_ncs2", NULL, "c2c_dataout7",
111 "gpio_52", NULL, NULL, NULL, "safe_mode"),
112 _OMAP4_MUXENTRY(GPMC_NCS3, 53, "gpmc_ncs3", "gpmc_dir",
113 "c2c_dataout4", "gpio_53", NULL, NULL, NULL,
114 "safe_mode"),
115 _OMAP4_MUXENTRY(GPMC_NWP, 54, "gpmc_nwp", "dsi1_te0", NULL, "gpio_54",
116 "sys_ndmareq1", NULL, NULL, NULL),
117 _OMAP4_MUXENTRY(GPMC_CLK, 55, "gpmc_clk", NULL, NULL, "gpio_55",
118 "sys_ndmareq2", NULL, NULL, NULL),
119 _OMAP4_MUXENTRY(GPMC_NADV_ALE, 56, "gpmc_nadv_ale", "dsi1_te1", NULL,
120 "gpio_56", "sys_ndmareq3", NULL, NULL, NULL),
121 _OMAP4_MUXENTRY(GPMC_NOE, 0, "gpmc_noe", "sdmmc2_clk", NULL, NULL,
122 NULL, NULL, NULL, NULL),
123 _OMAP4_MUXENTRY(GPMC_NWE, 0, "gpmc_nwe", "sdmmc2_cmd", NULL, NULL,
124 NULL, NULL, NULL, NULL),
125 _OMAP4_MUXENTRY(GPMC_NBE0_CLE, 59, "gpmc_nbe0_cle", "dsi2_te0", NULL,
126 "gpio_59", NULL, NULL, NULL, NULL),
127 _OMAP4_MUXENTRY(GPMC_NBE1, 60, "gpmc_nbe1", NULL, "c2c_dataout5",
128 "gpio_60", NULL, NULL, NULL, "safe_mode"),
129 _OMAP4_MUXENTRY(GPMC_WAIT0, 61, "gpmc_wait0", "dsi2_te1", NULL,
130 "gpio_61", NULL, NULL, NULL, NULL),
131 _OMAP4_MUXENTRY(GPMC_WAIT1, 62, "gpmc_wait1", NULL, "c2c_dataout2",
132 "gpio_62", NULL, NULL, NULL, "safe_mode"),
133 _OMAP4_MUXENTRY(C2C_DATA11, 100, "c2c_data11", "usbc1_icusb_txen",
134 "c2c_dataout3", "gpio_100", "sys_ndmareq0", NULL,
135 NULL, "safe_mode"),
136 _OMAP4_MUXENTRY(C2C_DATA12, 101, "c2c_data12", "dsi1_te0",
137 "c2c_clkin0", "gpio_101", "sys_ndmareq1", NULL, NULL,
138 "safe_mode"),
139 _OMAP4_MUXENTRY(C2C_DATA13, 102, "c2c_data13", "dsi1_te1",
140 "c2c_clkin1", "gpio_102", "sys_ndmareq2", NULL, NULL,
141 "safe_mode"),
142 _OMAP4_MUXENTRY(C2C_DATA14, 103, "c2c_data14", "dsi2_te0",
143 "c2c_dataout0", "gpio_103", "sys_ndmareq3", NULL,
144 NULL, "safe_mode"),
145 _OMAP4_MUXENTRY(C2C_DATA15, 104, "c2c_data15", "dsi2_te1",
146 "c2c_dataout1", "gpio_104", NULL, NULL, NULL,
147 "safe_mode"),
148 _OMAP4_MUXENTRY(HDMI_HPD, 63, "hdmi_hpd", NULL, NULL, "gpio_63", NULL,
149 NULL, NULL, "safe_mode"),
150 _OMAP4_MUXENTRY(HDMI_CEC, 64, "hdmi_cec", NULL, NULL, "gpio_64", NULL,
151 NULL, NULL, "safe_mode"),
152 _OMAP4_MUXENTRY(HDMI_DDC_SCL, 65, "hdmi_ddc_scl", NULL, NULL,
153 "gpio_65", NULL, NULL, NULL, "safe_mode"),
154 _OMAP4_MUXENTRY(HDMI_DDC_SDA, 66, "hdmi_ddc_sda", NULL, NULL,
155 "gpio_66", NULL, NULL, NULL, "safe_mode"),
156 _OMAP4_MUXENTRY(CSI21_DX0, 0, "csi21_dx0", NULL, NULL, "gpi_67", NULL,
157 NULL, NULL, "safe_mode"),
158 _OMAP4_MUXENTRY(CSI21_DY0, 0, "csi21_dy0", NULL, NULL, "gpi_68", NULL,
159 NULL, NULL, "safe_mode"),
160 _OMAP4_MUXENTRY(CSI21_DX1, 0, "csi21_dx1", NULL, NULL, "gpi_69", NULL,
161 NULL, NULL, "safe_mode"),
162 _OMAP4_MUXENTRY(CSI21_DY1, 0, "csi21_dy1", NULL, NULL, "gpi_70", NULL,
163 NULL, NULL, "safe_mode"),
164 _OMAP4_MUXENTRY(CSI21_DX2, 0, "csi21_dx2", NULL, NULL, "gpi_71", NULL,
165 NULL, NULL, "safe_mode"),
166 _OMAP4_MUXENTRY(CSI21_DY2, 0, "csi21_dy2", NULL, NULL, "gpi_72", NULL,
167 NULL, NULL, "safe_mode"),
168 _OMAP4_MUXENTRY(CSI21_DX3, 0, "csi21_dx3", NULL, NULL, "gpi_73", NULL,
169 NULL, NULL, "safe_mode"),
170 _OMAP4_MUXENTRY(CSI21_DY3, 0, "csi21_dy3", NULL, NULL, "gpi_74", NULL,
171 NULL, NULL, "safe_mode"),
172 _OMAP4_MUXENTRY(CSI21_DX4, 0, "csi21_dx4", NULL, NULL, "gpi_75", NULL,
173 NULL, NULL, "safe_mode"),
174 _OMAP4_MUXENTRY(CSI21_DY4, 0, "csi21_dy4", NULL, NULL, "gpi_76", NULL,
175 NULL, NULL, "safe_mode"),
176 _OMAP4_MUXENTRY(CSI22_DX0, 0, "csi22_dx0", NULL, NULL, "gpi_77", NULL,
177 NULL, NULL, "safe_mode"),
178 _OMAP4_MUXENTRY(CSI22_DY0, 0, "csi22_dy0", NULL, NULL, "gpi_78", NULL,
179 NULL, NULL, "safe_mode"),
180 _OMAP4_MUXENTRY(CSI22_DX1, 0, "csi22_dx1", NULL, NULL, "gpi_79", NULL,
181 NULL, NULL, "safe_mode"),
182 _OMAP4_MUXENTRY(CSI22_DY1, 0, "csi22_dy1", NULL, NULL, "gpi_80", NULL,
183 NULL, NULL, "safe_mode"),
184 _OMAP4_MUXENTRY(CAM_SHUTTER, 81, "cam_shutter", NULL, NULL, "gpio_81",
185 NULL, NULL, NULL, "safe_mode"),
186 _OMAP4_MUXENTRY(CAM_STROBE, 82, "cam_strobe", NULL, NULL, "gpio_82",
187 NULL, NULL, NULL, "safe_mode"),
188 _OMAP4_MUXENTRY(CAM_GLOBALRESET, 83, "cam_globalreset", NULL, NULL,
189 "gpio_83", NULL, NULL, NULL, "safe_mode"),
190 _OMAP4_MUXENTRY(USBB1_ULPITLL_CLK, 84, "usbb1_ulpitll_clk",
191 "hsi1_cawake", NULL, "gpio_84", "usbb1_ulpiphy_clk",
192 NULL, "hw_dbg20", "safe_mode"),
193 _OMAP4_MUXENTRY(USBB1_ULPITLL_STP, 85, "usbb1_ulpitll_stp",
194 "hsi1_cadata", "mcbsp4_clkr", "gpio_85",
195 "usbb1_ulpiphy_stp", "usbb1_mm_rxdp", "hw_dbg21",
196 "safe_mode"),
197 _OMAP4_MUXENTRY(USBB1_ULPITLL_DIR, 86, "usbb1_ulpitll_dir",
198 "hsi1_caflag", "mcbsp4_fsr", "gpio_86",
199 "usbb1_ulpiphy_dir", NULL, "hw_dbg22", "safe_mode"),
200 _OMAP4_MUXENTRY(USBB1_ULPITLL_NXT, 87, "usbb1_ulpitll_nxt",
201 "hsi1_acready", "mcbsp4_fsx", "gpio_87",
202 "usbb1_ulpiphy_nxt", "usbb1_mm_rxdm", "hw_dbg23",
203 "safe_mode"),
204 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT0, 88, "usbb1_ulpitll_dat0",
205 "hsi1_acwake", "mcbsp4_clkx", "gpio_88",
206 "usbb1_ulpiphy_dat0", "usbb1_mm_rxrcv", "hw_dbg24",
207 "safe_mode"),
208 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT1, 89, "usbb1_ulpitll_dat1",
209 "hsi1_acdata", "mcbsp4_dx", "gpio_89",
210 "usbb1_ulpiphy_dat1", "usbb1_mm_txse0", "hw_dbg25",
211 "safe_mode"),
212 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT2, 90, "usbb1_ulpitll_dat2",
213 "hsi1_acflag", "mcbsp4_dr", "gpio_90",
214 "usbb1_ulpiphy_dat2", "usbb1_mm_txdat", "hw_dbg26",
215 "safe_mode"),
216 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT3, 91, "usbb1_ulpitll_dat3",
217 "hsi1_caready", NULL, "gpio_91", "usbb1_ulpiphy_dat3",
218 "usbb1_mm_txen", "hw_dbg27", "safe_mode"),
219 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT4, 92, "usbb1_ulpitll_dat4",
220 "dmtimer8_pwm_evt", "abe_mcbsp3_dr", "gpio_92",
221 "usbb1_ulpiphy_dat4", NULL, "hw_dbg28", "safe_mode"),
222 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT5, 93, "usbb1_ulpitll_dat5",
223 "dmtimer9_pwm_evt", "abe_mcbsp3_dx", "gpio_93",
224 "usbb1_ulpiphy_dat5", NULL, "hw_dbg29", "safe_mode"),
225 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT6, 94, "usbb1_ulpitll_dat6",
226 "dmtimer10_pwm_evt", "abe_mcbsp3_clkx", "gpio_94",
227 "usbb1_ulpiphy_dat6", "abe_dmic_din3", "hw_dbg30",
228 "safe_mode"),
229 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT7, 95, "usbb1_ulpitll_dat7",
230 "dmtimer11_pwm_evt", "abe_mcbsp3_fsx", "gpio_95",
231 "usbb1_ulpiphy_dat7", "abe_dmic_clk3", "hw_dbg31",
232 "safe_mode"),
233 _OMAP4_MUXENTRY(USBB1_HSIC_DATA, 96, "usbb1_hsic_data", NULL, NULL,
234 "gpio_96", NULL, NULL, NULL, "safe_mode"),
235 _OMAP4_MUXENTRY(USBB1_HSIC_STROBE, 97, "usbb1_hsic_strobe", NULL,
236 NULL, "gpio_97", NULL, NULL, NULL, "safe_mode"),
237 _OMAP4_MUXENTRY(USBC1_ICUSB_DP, 98, "usbc1_icusb_dp", NULL, NULL,
238 "gpio_98", NULL, NULL, NULL, "safe_mode"),
239 _OMAP4_MUXENTRY(USBC1_ICUSB_DM, 99, "usbc1_icusb_dm", NULL, NULL,
240 "gpio_99", NULL, NULL, NULL, "safe_mode"),
241 _OMAP4_MUXENTRY(SDMMC1_CLK, 100, "sdmmc1_clk", NULL, "dpm_emu19",
242 "gpio_100", NULL, NULL, NULL, "safe_mode"),
243 _OMAP4_MUXENTRY(SDMMC1_CMD, 101, "sdmmc1_cmd", NULL, "uart1_rx",
244 "gpio_101", NULL, NULL, NULL, "safe_mode"),
245 _OMAP4_MUXENTRY(SDMMC1_DAT0, 102, "sdmmc1_dat0", NULL, "dpm_emu18",
246 "gpio_102", NULL, NULL, NULL, "safe_mode"),
247 _OMAP4_MUXENTRY(SDMMC1_DAT1, 103, "sdmmc1_dat1", NULL, "dpm_emu17",
248 "gpio_103", NULL, NULL, NULL, "safe_mode"),
249 _OMAP4_MUXENTRY(SDMMC1_DAT2, 104, "sdmmc1_dat2", NULL, "dpm_emu16",
250 "gpio_104", "jtag_tms_tmsc", NULL, NULL, "safe_mode"),
251 _OMAP4_MUXENTRY(SDMMC1_DAT3, 105, "sdmmc1_dat3", NULL, "dpm_emu15",
252 "gpio_105", "jtag_tck", NULL, NULL, "safe_mode"),
253 _OMAP4_MUXENTRY(SDMMC1_DAT4, 106, "sdmmc1_dat4", NULL, NULL,
254 "gpio_106", NULL, NULL, NULL, "safe_mode"),
255 _OMAP4_MUXENTRY(SDMMC1_DAT5, 107, "sdmmc1_dat5", NULL, NULL,
256 "gpio_107", NULL, NULL, NULL, "safe_mode"),
257 _OMAP4_MUXENTRY(SDMMC1_DAT6, 108, "sdmmc1_dat6", NULL, NULL,
258 "gpio_108", NULL, NULL, NULL, "safe_mode"),
259 _OMAP4_MUXENTRY(SDMMC1_DAT7, 109, "sdmmc1_dat7", NULL, NULL,
260 "gpio_109", NULL, NULL, NULL, "safe_mode"),
261 _OMAP4_MUXENTRY(ABE_MCBSP2_CLKX, 110, "abe_mcbsp2_clkx", "mcspi2_clk",
262 "abe_mcasp_ahclkx", "gpio_110", "usbb2_mm_rxdm",
263 NULL, NULL, "safe_mode"),
264 _OMAP4_MUXENTRY(ABE_MCBSP2_DR, 111, "abe_mcbsp2_dr", "mcspi2_somi",
265 "abe_mcasp_axr", "gpio_111", "usbb2_mm_rxdp", NULL,
266 NULL, "safe_mode"),
267 _OMAP4_MUXENTRY(ABE_MCBSP2_DX, 112, "abe_mcbsp2_dx", "mcspi2_simo",
268 "abe_mcasp_amute", "gpio_112", "usbb2_mm_rxrcv", NULL,
269 NULL, "safe_mode"),
270 _OMAP4_MUXENTRY(ABE_MCBSP2_FSX, 113, "abe_mcbsp2_fsx", "mcspi2_cs0",
271 "abe_mcasp_afsx", "gpio_113", "usbb2_mm_txen", NULL,
272 NULL, "safe_mode"),
273 _OMAP4_MUXENTRY(ABE_MCBSP1_CLKX, 114, "abe_mcbsp1_clkx",
274 "abe_slimbus1_clock", NULL, "gpio_114", NULL, NULL,
275 NULL, "safe_mode"),
276 _OMAP4_MUXENTRY(ABE_MCBSP1_DR, 115, "abe_mcbsp1_dr",
277 "abe_slimbus1_data", NULL, "gpio_115", NULL, NULL,
278 NULL, "safe_mode"),
279 _OMAP4_MUXENTRY(ABE_MCBSP1_DX, 116, "abe_mcbsp1_dx", "sdmmc3_dat2",
280 "abe_mcasp_aclkx", "gpio_116", NULL, NULL, NULL,
281 "safe_mode"),
282 _OMAP4_MUXENTRY(ABE_MCBSP1_FSX, 117, "abe_mcbsp1_fsx", "sdmmc3_dat3",
283 "abe_mcasp_amutein", "gpio_117", NULL, NULL, NULL,
284 "safe_mode"),
285 _OMAP4_MUXENTRY(ABE_PDM_UL_DATA, 0, "abe_pdm_ul_data",
286 "abe_mcbsp3_dr", NULL, NULL, NULL, NULL, NULL,
287 "safe_mode"),
288 _OMAP4_MUXENTRY(ABE_PDM_DL_DATA, 0, "abe_pdm_dl_data",
289 "abe_mcbsp3_dx", NULL, NULL, NULL, NULL, NULL,
290 "safe_mode"),
291 _OMAP4_MUXENTRY(ABE_PDM_FRAME, 0, "abe_pdm_frame", "abe_mcbsp3_clkx",
292 NULL, NULL, NULL, NULL, NULL, "safe_mode"),
293 _OMAP4_MUXENTRY(ABE_PDM_LB_CLK, 0, "abe_pdm_lb_clk", "abe_mcbsp3_fsx",
294 NULL, NULL, NULL, NULL, NULL, "safe_mode"),
295 _OMAP4_MUXENTRY(ABE_CLKS, 118, "abe_clks", NULL, NULL, "gpio_118",
296 NULL, NULL, NULL, "safe_mode"),
297 _OMAP4_MUXENTRY(ABE_DMIC_CLK1, 119, "abe_dmic_clk1", NULL, NULL,
298 "gpio_119", "usbb2_mm_txse0", NULL, NULL,
299 "safe_mode"),
300 _OMAP4_MUXENTRY(ABE_DMIC_DIN1, 120, "abe_dmic_din1", NULL, NULL,
301 "gpio_120", "usbb2_mm_txdat", NULL, NULL,
302 "safe_mode"),
303 _OMAP4_MUXENTRY(ABE_DMIC_DIN2, 121, "abe_dmic_din2", "slimbus2_clock",
304 NULL, "gpio_121", NULL, NULL, NULL, "safe_mode"),
305 _OMAP4_MUXENTRY(ABE_DMIC_DIN3, 122, "abe_dmic_din3", "slimbus2_data",
306 "abe_dmic_clk2", "gpio_122", NULL, NULL, NULL,
307 "safe_mode"),
308 _OMAP4_MUXENTRY(UART2_CTS, 123, "uart2_cts", "sdmmc3_clk", NULL,
309 "gpio_123", NULL, NULL, NULL, "safe_mode"),
310 _OMAP4_MUXENTRY(UART2_RTS, 124, "uart2_rts", "sdmmc3_cmd", NULL,
311 "gpio_124", NULL, NULL, NULL, "safe_mode"),
312 _OMAP4_MUXENTRY(UART2_RX, 125, "uart2_rx", "sdmmc3_dat0", NULL,
313 "gpio_125", NULL, NULL, NULL, "safe_mode"),
314 _OMAP4_MUXENTRY(UART2_TX, 126, "uart2_tx", "sdmmc3_dat1", NULL,
315 "gpio_126", NULL, NULL, NULL, "safe_mode"),
316 _OMAP4_MUXENTRY(HDQ_SIO, 127, "hdq_sio", "i2c3_sccb", "i2c2_sccb",
317 "gpio_127", NULL, NULL, NULL, "safe_mode"),
318 _OMAP4_MUXENTRY(I2C1_SCL, 0, "i2c1_scl", NULL, NULL, NULL, NULL, NULL,
319 NULL, NULL),
320 _OMAP4_MUXENTRY(I2C1_SDA, 0, "i2c1_sda", NULL, NULL, NULL, NULL, NULL,
321 NULL, NULL),
322 _OMAP4_MUXENTRY(I2C2_SCL, 128, "i2c2_scl", "uart1_rx", NULL,
323 "gpio_128", NULL, NULL, NULL, "safe_mode"),
324 _OMAP4_MUXENTRY(I2C2_SDA, 129, "i2c2_sda", "uart1_tx", NULL,
325 "gpio_129", NULL, NULL, NULL, "safe_mode"),
326 _OMAP4_MUXENTRY(I2C3_SCL, 130, "i2c3_scl", NULL, NULL, "gpio_130",
327 NULL, NULL, NULL, "safe_mode"),
328 _OMAP4_MUXENTRY(I2C3_SDA, 131, "i2c3_sda", NULL, NULL, "gpio_131",
329 NULL, NULL, NULL, "safe_mode"),
330 _OMAP4_MUXENTRY(I2C4_SCL, 132, "i2c4_scl", NULL, NULL, "gpio_132",
331 NULL, NULL, NULL, "safe_mode"),
332 _OMAP4_MUXENTRY(I2C4_SDA, 133, "i2c4_sda", NULL, NULL, "gpio_133",
333 NULL, NULL, NULL, "safe_mode"),
334 _OMAP4_MUXENTRY(MCSPI1_CLK, 134, "mcspi1_clk", NULL, NULL, "gpio_134",
335 NULL, NULL, NULL, "safe_mode"),
336 _OMAP4_MUXENTRY(MCSPI1_SOMI, 135, "mcspi1_somi", NULL, NULL,
337 "gpio_135", NULL, NULL, NULL, "safe_mode"),
338 _OMAP4_MUXENTRY(MCSPI1_SIMO, 136, "mcspi1_simo", NULL, NULL,
339 "gpio_136", NULL, NULL, NULL, "safe_mode"),
340 _OMAP4_MUXENTRY(MCSPI1_CS0, 137, "mcspi1_cs0", NULL, NULL, "gpio_137",
341 NULL, NULL, NULL, "safe_mode"),
342 _OMAP4_MUXENTRY(MCSPI1_CS1, 138, "mcspi1_cs1", "uart1_rx", NULL,
343 "gpio_138", NULL, NULL, NULL, "safe_mode"),
344 _OMAP4_MUXENTRY(MCSPI1_CS2, 139, "mcspi1_cs2", "uart1_cts",
345 "slimbus2_clock", "gpio_139", NULL, NULL, NULL,
346 "safe_mode"),
347 _OMAP4_MUXENTRY(MCSPI1_CS3, 140, "mcspi1_cs3", "uart1_rts",
348 "slimbus2_data", "gpio_140", NULL, NULL, NULL,
349 "safe_mode"),
350 _OMAP4_MUXENTRY(UART3_CTS_RCTX, 141, "uart3_cts_rctx", "uart1_tx",
351 NULL, "gpio_141", NULL, NULL, NULL, "safe_mode"),
352 _OMAP4_MUXENTRY(UART3_RTS_SD, 142, "uart3_rts_sd", NULL, NULL,
353 "gpio_142", NULL, NULL, NULL, "safe_mode"),
354 _OMAP4_MUXENTRY(UART3_RX_IRRX, 143, "uart3_rx_irrx",
355 "dmtimer8_pwm_evt", NULL, "gpio_143", NULL, NULL,
356 NULL, "safe_mode"),
357 _OMAP4_MUXENTRY(UART3_TX_IRTX, 144, "uart3_tx_irtx",
358 "dmtimer9_pwm_evt", NULL, "gpio_144", NULL, NULL,
359 NULL, "safe_mode"),
360 _OMAP4_MUXENTRY(SDMMC5_CLK, 145, "sdmmc5_clk", "mcspi2_clk",
361 "usbc1_icusb_dp", "gpio_145", NULL, NULL, NULL,
362 "safe_mode"),
363 _OMAP4_MUXENTRY(SDMMC5_CMD, 146, "sdmmc5_cmd", "mcspi2_simo",
364 "usbc1_icusb_dm", "gpio_146", NULL, NULL, NULL,
365 "safe_mode"),
366 _OMAP4_MUXENTRY(SDMMC5_DAT0, 147, "sdmmc5_dat0", "mcspi2_somi",
367 "usbc1_icusb_rcv", "gpio_147", NULL, NULL, NULL,
368 "safe_mode"),
369 _OMAP4_MUXENTRY(SDMMC5_DAT1, 148, "sdmmc5_dat1", NULL,
370 "usbc1_icusb_txen", "gpio_148", NULL, NULL, NULL,
371 "safe_mode"),
372 _OMAP4_MUXENTRY(SDMMC5_DAT2, 149, "sdmmc5_dat2", "mcspi2_cs1", NULL,
373 "gpio_149", NULL, NULL, NULL, "safe_mode"),
374 _OMAP4_MUXENTRY(SDMMC5_DAT3, 150, "sdmmc5_dat3", "mcspi2_cs0", NULL,
375 "gpio_150", NULL, NULL, NULL, "safe_mode"),
376 _OMAP4_MUXENTRY(MCSPI4_CLK, 151, "mcspi4_clk", "sdmmc4_clk", NULL,
377 "gpio_151", NULL, NULL, NULL, "safe_mode"),
378 _OMAP4_MUXENTRY(MCSPI4_SIMO, 152, "mcspi4_simo", "sdmmc4_cmd", NULL,
379 "gpio_152", NULL, NULL, NULL, "safe_mode"),
380 _OMAP4_MUXENTRY(MCSPI4_SOMI, 153, "mcspi4_somi", "sdmmc4_dat0", NULL,
381 "gpio_153", NULL, NULL, NULL, "safe_mode"),
382 _OMAP4_MUXENTRY(MCSPI4_CS0, 154, "mcspi4_cs0", "sdmmc4_dat3", NULL,
383 "gpio_154", NULL, NULL, NULL, "safe_mode"),
384 _OMAP4_MUXENTRY(UART4_RX, 155, "uart4_rx", "sdmmc4_dat2", NULL,
385 "gpio_155", NULL, NULL, NULL, "safe_mode"),
386 _OMAP4_MUXENTRY(UART4_TX, 156, "uart4_tx", "sdmmc4_dat1", NULL,
387 "gpio_156", NULL, NULL, NULL, "safe_mode"),
388 _OMAP4_MUXENTRY(USBB2_ULPITLL_CLK, 157, "usbb2_ulpitll_clk",
389 "usbb2_ulpiphy_clk", "sdmmc4_cmd", "gpio_157",
390 "hsi2_cawake", NULL, NULL, "safe_mode"),
391 _OMAP4_MUXENTRY(USBB2_ULPITLL_STP, 158, "usbb2_ulpitll_stp",
392 "usbb2_ulpiphy_stp", "sdmmc4_clk", "gpio_158",
393 "hsi2_cadata", "dispc2_data23", NULL, "reserved"),
394 _OMAP4_MUXENTRY(USBB2_ULPITLL_DIR, 159, "usbb2_ulpitll_dir",
395 "usbb2_ulpiphy_dir", "sdmmc4_dat0", "gpio_159",
396 "hsi2_caflag", "dispc2_data22", NULL, "reserved"),
397 _OMAP4_MUXENTRY(USBB2_ULPITLL_NXT, 160, "usbb2_ulpitll_nxt",
398 "usbb2_ulpiphy_nxt", "sdmmc4_dat1", "gpio_160",
399 "hsi2_acready", "dispc2_data21", NULL, "reserved"),
400 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT0, 161, "usbb2_ulpitll_dat0",
401 "usbb2_ulpiphy_dat0", "sdmmc4_dat2", "gpio_161",
402 "hsi2_acwake", "dispc2_data20", NULL, "reserved"),
403 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT1, 162, "usbb2_ulpitll_dat1",
404 "usbb2_ulpiphy_dat1", "sdmmc4_dat3", "gpio_162",
405 "hsi2_acdata", "dispc2_data19", NULL, "reserved"),
406 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT2, 163, "usbb2_ulpitll_dat2",
407 "usbb2_ulpiphy_dat2", "sdmmc3_dat2", "gpio_163",
408 "hsi2_acflag", "dispc2_data18", NULL, "reserved"),
409 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT3, 164, "usbb2_ulpitll_dat3",
410 "usbb2_ulpiphy_dat3", "sdmmc3_dat1", "gpio_164",
411 "hsi2_caready", "dispc2_data15", NULL, "reserved"),
412 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT4, 165, "usbb2_ulpitll_dat4",
413 "usbb2_ulpiphy_dat4", "sdmmc3_dat0", "gpio_165",
414 "mcspi3_somi", "dispc2_data14", NULL, "reserved"),
415 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT5, 166, "usbb2_ulpitll_dat5",
416 "usbb2_ulpiphy_dat5", "sdmmc3_dat3", "gpio_166",
417 "mcspi3_cs0", "dispc2_data13", NULL, "reserved"),
418 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT6, 167, "usbb2_ulpitll_dat6",
419 "usbb2_ulpiphy_dat6", "sdmmc3_cmd", "gpio_167",
420 "mcspi3_simo", "dispc2_data12", NULL, "reserved"),
421 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT7, 168, "usbb2_ulpitll_dat7",
422 "usbb2_ulpiphy_dat7", "sdmmc3_clk", "gpio_168",
423 "mcspi3_clk", "dispc2_data11", NULL, "reserved"),
424 _OMAP4_MUXENTRY(USBB2_HSIC_DATA, 169, "usbb2_hsic_data", NULL, NULL,
425 "gpio_169", NULL, NULL, NULL, "safe_mode"),
426 _OMAP4_MUXENTRY(USBB2_HSIC_STROBE, 170, "usbb2_hsic_strobe", NULL,
427 NULL, "gpio_170", NULL, NULL, NULL, "safe_mode"),
428 _OMAP4_MUXENTRY(UNIPRO_TX0, 171, "unipro_tx0", "kpd_col0", NULL,
429 "gpio_171", NULL, NULL, NULL, "safe_mode"),
430 _OMAP4_MUXENTRY(UNIPRO_TY0, 172, "unipro_ty0", "kpd_col1", NULL,
431 "gpio_172", NULL, NULL, NULL, "safe_mode"),
432 _OMAP4_MUXENTRY(UNIPRO_TX1, 173, "unipro_tx1", "kpd_col2", NULL,
433 "gpio_173", NULL, NULL, NULL, "safe_mode"),
434 _OMAP4_MUXENTRY(UNIPRO_TY1, 174, "unipro_ty1", "kpd_col3", NULL,
435 "gpio_174", NULL, NULL, NULL, "safe_mode"),
436 _OMAP4_MUXENTRY(UNIPRO_TX2, 0, "unipro_tx2", "kpd_col4", NULL,
437 "gpio_0", NULL, NULL, NULL, "safe_mode"),
438 _OMAP4_MUXENTRY(UNIPRO_TY2, 1, "unipro_ty2", "kpd_col5", NULL,
439 "gpio_1", NULL, NULL, NULL, "safe_mode"),
440 _OMAP4_MUXENTRY(UNIPRO_RX0, 0, "unipro_rx0", "kpd_row0", NULL,
441 "gpi_175", NULL, NULL, NULL, "safe_mode"),
442 _OMAP4_MUXENTRY(UNIPRO_RY0, 0, "unipro_ry0", "kpd_row1", NULL,
443 "gpi_176", NULL, NULL, NULL, "safe_mode"),
444 _OMAP4_MUXENTRY(UNIPRO_RX1, 0, "unipro_rx1", "kpd_row2", NULL,
445 "gpi_177", NULL, NULL, NULL, "safe_mode"),
446 _OMAP4_MUXENTRY(UNIPRO_RY1, 0, "unipro_ry1", "kpd_row3", NULL,
447 "gpi_178", NULL, NULL, NULL, "safe_mode"),
448 _OMAP4_MUXENTRY(UNIPRO_RX2, 0, "unipro_rx2", "kpd_row4", NULL,
449 "gpi_2", NULL, NULL, NULL, "safe_mode"),
450 _OMAP4_MUXENTRY(UNIPRO_RY2, 0, "unipro_ry2", "kpd_row5", NULL,
451 "gpi_3", NULL, NULL, NULL, "safe_mode"),
452 _OMAP4_MUXENTRY(USBA0_OTG_CE, 0, "usba0_otg_ce", NULL, NULL, NULL,
453 NULL, NULL, NULL, NULL),
454 _OMAP4_MUXENTRY(USBA0_OTG_DP, 179, "usba0_otg_dp", "uart3_rx_irrx",
455 "uart2_rx", "gpio_179", NULL, NULL, NULL,
456 "safe_mode"),
457 _OMAP4_MUXENTRY(USBA0_OTG_DM, 180, "usba0_otg_dm", "uart3_tx_irtx",
458 "uart2_tx", "gpio_180", NULL, NULL, NULL,
459 "safe_mode"),
460 _OMAP4_MUXENTRY(FREF_CLK1_OUT, 181, "fref_clk1_out", NULL, NULL,
461 "gpio_181", NULL, NULL, NULL, "safe_mode"),
462 _OMAP4_MUXENTRY(FREF_CLK2_OUT, 182, "fref_clk2_out", NULL, NULL,
463 "gpio_182", NULL, NULL, NULL, "safe_mode"),
464 _OMAP4_MUXENTRY(SYS_NIRQ1, 0, "sys_nirq1", NULL, NULL, NULL, NULL,
465 NULL, NULL, "safe_mode"),
466 _OMAP4_MUXENTRY(SYS_NIRQ2, 183, "sys_nirq2", NULL, NULL, "gpio_183",
467 NULL, NULL, NULL, "safe_mode"),
468 _OMAP4_MUXENTRY(SYS_BOOT0, 184, "sys_boot0", NULL, NULL, "gpio_184",
469 NULL, NULL, NULL, "safe_mode"),
470 _OMAP4_MUXENTRY(SYS_BOOT1, 185, "sys_boot1", NULL, NULL, "gpio_185",
471 NULL, NULL, NULL, "safe_mode"),
472 _OMAP4_MUXENTRY(SYS_BOOT2, 186, "sys_boot2", NULL, NULL, "gpio_186",
473 NULL, NULL, NULL, "safe_mode"),
474 _OMAP4_MUXENTRY(SYS_BOOT3, 187, "sys_boot3", NULL, NULL, "gpio_187",
475 NULL, NULL, NULL, "safe_mode"),
476 _OMAP4_MUXENTRY(SYS_BOOT4, 188, "sys_boot4", NULL, NULL, "gpio_188",
477 NULL, NULL, NULL, "safe_mode"),
478 _OMAP4_MUXENTRY(SYS_BOOT5, 189, "sys_boot5", NULL, NULL, "gpio_189",
479 NULL, NULL, NULL, "safe_mode"),
480 _OMAP4_MUXENTRY(DPM_EMU0, 11, "dpm_emu0", NULL, NULL, "gpio_11", NULL,
481 NULL, "hw_dbg0", "safe_mode"),
482 _OMAP4_MUXENTRY(DPM_EMU1, 12, "dpm_emu1", NULL, NULL, "gpio_12", NULL,
483 NULL, "hw_dbg1", "safe_mode"),
484 _OMAP4_MUXENTRY(DPM_EMU2, 13, "dpm_emu2", "usba0_ulpiphy_clk", NULL,
485 "gpio_13", NULL, "dispc2_fid", "hw_dbg2", "reserved"),
486 _OMAP4_MUXENTRY(DPM_EMU3, 14, "dpm_emu3", "usba0_ulpiphy_stp", NULL,
487 "gpio_14", NULL, "dispc2_data10", "hw_dbg3",
488 "reserved"),
489 _OMAP4_MUXENTRY(DPM_EMU4, 15, "dpm_emu4", "usba0_ulpiphy_dir", NULL,
490 "gpio_15", NULL, "dispc2_data9", "hw_dbg4",
491 "reserved"),
492 _OMAP4_MUXENTRY(DPM_EMU5, 16, "dpm_emu5", "usba0_ulpiphy_nxt", NULL,
493 "gpio_16", "rfbi_te_vsync0", "dispc2_data16",
494 "hw_dbg5", "reserved"),
495 _OMAP4_MUXENTRY(DPM_EMU6, 17, "dpm_emu6", "usba0_ulpiphy_dat0",
496 "uart3_tx_irtx", "gpio_17", "rfbi_hsync0",
497 "dispc2_data17", "hw_dbg6", "reserved"),
498 _OMAP4_MUXENTRY(DPM_EMU7, 18, "dpm_emu7", "usba0_ulpiphy_dat1",
499 "uart3_rx_irrx", "gpio_18", "rfbi_cs0",
500 "dispc2_hsync", "hw_dbg7", "reserved"),
501 _OMAP4_MUXENTRY(DPM_EMU8, 19, "dpm_emu8", "usba0_ulpiphy_dat2",
502 "uart3_rts_sd", "gpio_19", "rfbi_re", "dispc2_pclk",
503 "hw_dbg8", "reserved"),
504 _OMAP4_MUXENTRY(DPM_EMU9, 20, "dpm_emu9", "usba0_ulpiphy_dat3",
505 "uart3_cts_rctx", "gpio_20", "rfbi_we",
506 "dispc2_vsync", "hw_dbg9", "reserved"),
507 _OMAP4_MUXENTRY(DPM_EMU10, 21, "dpm_emu10", "usba0_ulpiphy_dat4",
508 NULL, "gpio_21", "rfbi_a0", "dispc2_de", "hw_dbg10",
509 "reserved"),
510 _OMAP4_MUXENTRY(DPM_EMU11, 22, "dpm_emu11", "usba0_ulpiphy_dat5",
511 NULL, "gpio_22", "rfbi_data8", "dispc2_data8",
512 "hw_dbg11", "reserved"),
513 _OMAP4_MUXENTRY(DPM_EMU12, 23, "dpm_emu12", "usba0_ulpiphy_dat6",
514 NULL, "gpio_23", "rfbi_data7", "dispc2_data7",
515 "hw_dbg12", "reserved"),
516 _OMAP4_MUXENTRY(DPM_EMU13, 24, "dpm_emu13", "usba0_ulpiphy_dat7",
517 NULL, "gpio_24", "rfbi_data6", "dispc2_data6",
518 "hw_dbg13", "reserved"),
519 _OMAP4_MUXENTRY(DPM_EMU14, 25, "dpm_emu14", "sys_drm_msecure",
520 "uart1_rx", "gpio_25", "rfbi_data5", "dispc2_data5",
521 "hw_dbg14", "reserved"),
522 _OMAP4_MUXENTRY(DPM_EMU15, 26, "dpm_emu15", "sys_secure_indicator",
523 NULL, "gpio_26", "rfbi_data4", "dispc2_data4",
524 "hw_dbg15", "reserved"),
525 _OMAP4_MUXENTRY(DPM_EMU16, 27, "dpm_emu16", "dmtimer8_pwm_evt",
526 "dsi1_te0", "gpio_27", "rfbi_data3", "dispc2_data3",
527 "hw_dbg16", "reserved"),
528 _OMAP4_MUXENTRY(DPM_EMU17, 28, "dpm_emu17", "dmtimer9_pwm_evt",
529 "dsi1_te1", "gpio_28", "rfbi_data2", "dispc2_data2",
530 "hw_dbg17", "reserved"),
531 _OMAP4_MUXENTRY(DPM_EMU18, 190, "dpm_emu18", "dmtimer10_pwm_evt",
532 "dsi2_te0", "gpio_190", "rfbi_data1", "dispc2_data1",
533 "hw_dbg18", "reserved"),
534 _OMAP4_MUXENTRY(DPM_EMU19, 191, "dpm_emu19", "dmtimer11_pwm_evt",
535 "dsi2_te1", "gpio_191", "rfbi_data0", "dispc2_data0",
536 "hw_dbg19", "reserved"),
537 { .reg_offset = OMAP_MUX_TERMINATOR },
538};
539
540/*
541 * Balls for 44XX CBL package
542 * 547-pin CBL ES1.0 S-FPGA-N547, 0.40mm Ball Pitch (Top),
543 * 0.40mm Ball Pitch (Bottom)
544 */
545#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
546 && defined(CONFIG_OMAP_PACKAGE_CBL)
547static struct omap_ball __initdata omap4_core_cbl_ball[] = {
548 _OMAP4_BALLENTRY(GPMC_AD0, "c12", NULL),
549 _OMAP4_BALLENTRY(GPMC_AD1, "d12", NULL),
550 _OMAP4_BALLENTRY(GPMC_AD2, "c13", NULL),
551 _OMAP4_BALLENTRY(GPMC_AD3, "d13", NULL),
552 _OMAP4_BALLENTRY(GPMC_AD4, "c15", NULL),
553 _OMAP4_BALLENTRY(GPMC_AD5, "d15", NULL),
554 _OMAP4_BALLENTRY(GPMC_AD6, "a16", NULL),
555 _OMAP4_BALLENTRY(GPMC_AD7, "b16", NULL),
556 _OMAP4_BALLENTRY(GPMC_AD8, "c16", NULL),
557 _OMAP4_BALLENTRY(GPMC_AD9, "d16", NULL),
558 _OMAP4_BALLENTRY(GPMC_AD10, "c17", NULL),
559 _OMAP4_BALLENTRY(GPMC_AD11, "d17", NULL),
560 _OMAP4_BALLENTRY(GPMC_AD12, "c18", NULL),
561 _OMAP4_BALLENTRY(GPMC_AD13, "d18", NULL),
562 _OMAP4_BALLENTRY(GPMC_AD14, "c19", NULL),
563 _OMAP4_BALLENTRY(GPMC_AD15, "d19", NULL),
564 _OMAP4_BALLENTRY(GPMC_A16, "b17", NULL),
565 _OMAP4_BALLENTRY(GPMC_A17, "a18", NULL),
566 _OMAP4_BALLENTRY(GPMC_A18, "b18", NULL),
567 _OMAP4_BALLENTRY(GPMC_A19, "a19", NULL),
568 _OMAP4_BALLENTRY(GPMC_A20, "b19", NULL),
569 _OMAP4_BALLENTRY(GPMC_A21, "b20", NULL),
570 _OMAP4_BALLENTRY(GPMC_A22, "a21", NULL),
571 _OMAP4_BALLENTRY(GPMC_A23, "b21", NULL),
572 _OMAP4_BALLENTRY(GPMC_A24, "c20", NULL),
573 _OMAP4_BALLENTRY(GPMC_A25, "d20", NULL),
574 _OMAP4_BALLENTRY(GPMC_NCS0, "b25", NULL),
575 _OMAP4_BALLENTRY(GPMC_NCS1, "c21", NULL),
576 _OMAP4_BALLENTRY(GPMC_NCS2, "d21", NULL),
577 _OMAP4_BALLENTRY(GPMC_NCS3, "c22", NULL),
578 _OMAP4_BALLENTRY(GPMC_NWP, "c25", NULL),
579 _OMAP4_BALLENTRY(GPMC_CLK, "b22", NULL),
580 _OMAP4_BALLENTRY(GPMC_NADV_ALE, "d25", NULL),
581 _OMAP4_BALLENTRY(GPMC_NOE, "b11", NULL),
582 _OMAP4_BALLENTRY(GPMC_NWE, "b12", NULL),
583 _OMAP4_BALLENTRY(GPMC_NBE0_CLE, "c23", NULL),
584 _OMAP4_BALLENTRY(GPMC_NBE1, "d22", NULL),
585 _OMAP4_BALLENTRY(GPMC_WAIT0, "b26", NULL),
586 _OMAP4_BALLENTRY(GPMC_WAIT1, "b23", NULL),
587 _OMAP4_BALLENTRY(C2C_DATA11, "d23", NULL),
588 _OMAP4_BALLENTRY(C2C_DATA12, "a24", NULL),
589 _OMAP4_BALLENTRY(C2C_DATA13, "b24", NULL),
590 _OMAP4_BALLENTRY(C2C_DATA14, "c24", NULL),
591 _OMAP4_BALLENTRY(C2C_DATA15, "d24", NULL),
592 _OMAP4_BALLENTRY(HDMI_HPD, "b9", NULL),
593 _OMAP4_BALLENTRY(HDMI_CEC, "b10", NULL),
594 _OMAP4_BALLENTRY(HDMI_DDC_SCL, "a8", NULL),
595 _OMAP4_BALLENTRY(HDMI_DDC_SDA, "b8", NULL),
596 _OMAP4_BALLENTRY(CSI21_DX0, "r26", NULL),
597 _OMAP4_BALLENTRY(CSI21_DY0, "r25", NULL),
598 _OMAP4_BALLENTRY(CSI21_DX1, "t26", NULL),
599 _OMAP4_BALLENTRY(CSI21_DY1, "t25", NULL),
600 _OMAP4_BALLENTRY(CSI21_DX2, "u26", NULL),
601 _OMAP4_BALLENTRY(CSI21_DY2, "u25", NULL),
602 _OMAP4_BALLENTRY(CSI21_DX3, "v26", NULL),
603 _OMAP4_BALLENTRY(CSI21_DY3, "v25", NULL),
604 _OMAP4_BALLENTRY(CSI21_DX4, "w26", NULL),
605 _OMAP4_BALLENTRY(CSI21_DY4, "w25", NULL),
606 _OMAP4_BALLENTRY(CSI22_DX0, "m26", NULL),
607 _OMAP4_BALLENTRY(CSI22_DY0, "m25", NULL),
608 _OMAP4_BALLENTRY(CSI22_DX1, "n26", NULL),
609 _OMAP4_BALLENTRY(CSI22_DY1, "n25", NULL),
610 _OMAP4_BALLENTRY(CAM_SHUTTER, "t27", NULL),
611 _OMAP4_BALLENTRY(CAM_STROBE, "u27", NULL),
612 _OMAP4_BALLENTRY(CAM_GLOBALRESET, "v27", NULL),
613 _OMAP4_BALLENTRY(USBB1_ULPITLL_CLK, "ae18", NULL),
614 _OMAP4_BALLENTRY(USBB1_ULPITLL_STP, "ag19", NULL),
615 _OMAP4_BALLENTRY(USBB1_ULPITLL_DIR, "af19", NULL),
616 _OMAP4_BALLENTRY(USBB1_ULPITLL_NXT, "ae19", NULL),
617 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT0, "af18", NULL),
618 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT1, "ag18", NULL),
619 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT2, "ae17", NULL),
620 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT3, "af17", NULL),
621 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT4, "ah17", NULL),
622 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT5, "ae16", NULL),
623 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT6, "af16", NULL),
624 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT7, "ag16", NULL),
625 _OMAP4_BALLENTRY(USBB1_HSIC_DATA, "af14", NULL),
626 _OMAP4_BALLENTRY(USBB1_HSIC_STROBE, "ae14", NULL),
627 _OMAP4_BALLENTRY(USBC1_ICUSB_DP, "h2", NULL),
628 _OMAP4_BALLENTRY(USBC1_ICUSB_DM, "h3", NULL),
629 _OMAP4_BALLENTRY(SDMMC1_CLK, "d2", NULL),
630 _OMAP4_BALLENTRY(SDMMC1_CMD, "e3", NULL),
631 _OMAP4_BALLENTRY(SDMMC1_DAT0, "e4", NULL),
632 _OMAP4_BALLENTRY(SDMMC1_DAT1, "e2", NULL),
633 _OMAP4_BALLENTRY(SDMMC1_DAT2, "e1", NULL),
634 _OMAP4_BALLENTRY(SDMMC1_DAT3, "f4", NULL),
635 _OMAP4_BALLENTRY(SDMMC1_DAT4, "f3", NULL),
636 _OMAP4_BALLENTRY(SDMMC1_DAT5, "f1", NULL),
637 _OMAP4_BALLENTRY(SDMMC1_DAT6, "g4", NULL),
638 _OMAP4_BALLENTRY(SDMMC1_DAT7, "g3", NULL),
639 _OMAP4_BALLENTRY(ABE_MCBSP2_CLKX, "ad27", NULL),
640 _OMAP4_BALLENTRY(ABE_MCBSP2_DR, "ad26", NULL),
641 _OMAP4_BALLENTRY(ABE_MCBSP2_DX, "ad25", NULL),
642 _OMAP4_BALLENTRY(ABE_MCBSP2_FSX, "ac28", NULL),
643 _OMAP4_BALLENTRY(ABE_MCBSP1_CLKX, "ac26", NULL),
644 _OMAP4_BALLENTRY(ABE_MCBSP1_DR, "ac25", NULL),
645 _OMAP4_BALLENTRY(ABE_MCBSP1_DX, "ab25", NULL),
646 _OMAP4_BALLENTRY(ABE_MCBSP1_FSX, "ac27", NULL),
647 _OMAP4_BALLENTRY(ABE_PDM_UL_DATA, "ag25", NULL),
648 _OMAP4_BALLENTRY(ABE_PDM_DL_DATA, "af25", NULL),
649 _OMAP4_BALLENTRY(ABE_PDM_FRAME, "ae25", NULL),
650 _OMAP4_BALLENTRY(ABE_PDM_LB_CLK, "af26", NULL),
651 _OMAP4_BALLENTRY(ABE_CLKS, "ah26", NULL),
652 _OMAP4_BALLENTRY(ABE_DMIC_CLK1, "ae24", NULL),
653 _OMAP4_BALLENTRY(ABE_DMIC_DIN1, "af24", NULL),
654 _OMAP4_BALLENTRY(ABE_DMIC_DIN2, "ag24", NULL),
655 _OMAP4_BALLENTRY(ABE_DMIC_DIN3, "ah24", NULL),
656 _OMAP4_BALLENTRY(UART2_CTS, "ab26", NULL),
657 _OMAP4_BALLENTRY(UART2_RTS, "ab27", NULL),
658 _OMAP4_BALLENTRY(UART2_RX, "aa25", NULL),
659 _OMAP4_BALLENTRY(UART2_TX, "aa26", NULL),
660 _OMAP4_BALLENTRY(HDQ_SIO, "aa27", NULL),
661 _OMAP4_BALLENTRY(I2C1_SCL, "ae28", NULL),
662 _OMAP4_BALLENTRY(I2C1_SDA, "ae26", NULL),
663 _OMAP4_BALLENTRY(I2C2_SCL, "c26", NULL),
664 _OMAP4_BALLENTRY(I2C2_SDA, "d26", NULL),
665 _OMAP4_BALLENTRY(I2C3_SCL, "w27", NULL),
666 _OMAP4_BALLENTRY(I2C3_SDA, "y27", NULL),
667 _OMAP4_BALLENTRY(I2C4_SCL, "ag21", NULL),
668 _OMAP4_BALLENTRY(I2C4_SDA, "ah22", NULL),
669 _OMAP4_BALLENTRY(MCSPI1_CLK, "af22", NULL),
670 _OMAP4_BALLENTRY(MCSPI1_SOMI, "ae22", NULL),
671 _OMAP4_BALLENTRY(MCSPI1_SIMO, "ag22", NULL),
672 _OMAP4_BALLENTRY(MCSPI1_CS0, "ae23", NULL),
673 _OMAP4_BALLENTRY(MCSPI1_CS1, "af23", NULL),
674 _OMAP4_BALLENTRY(MCSPI1_CS2, "ag23", NULL),
675 _OMAP4_BALLENTRY(MCSPI1_CS3, "ah23", NULL),
676 _OMAP4_BALLENTRY(UART3_CTS_RCTX, "f27", NULL),
677 _OMAP4_BALLENTRY(UART3_RTS_SD, "f28", NULL),
678 _OMAP4_BALLENTRY(UART3_RX_IRRX, "g27", NULL),
679 _OMAP4_BALLENTRY(UART3_TX_IRTX, "g28", NULL),
680 _OMAP4_BALLENTRY(SDMMC5_CLK, "ae5", NULL),
681 _OMAP4_BALLENTRY(SDMMC5_CMD, "af5", NULL),
682 _OMAP4_BALLENTRY(SDMMC5_DAT0, "ae4", NULL),
683 _OMAP4_BALLENTRY(SDMMC5_DAT1, "af4", NULL),
684 _OMAP4_BALLENTRY(SDMMC5_DAT2, "ag3", NULL),
685 _OMAP4_BALLENTRY(SDMMC5_DAT3, "af3", NULL),
686 _OMAP4_BALLENTRY(MCSPI4_CLK, "ae21", NULL),
687 _OMAP4_BALLENTRY(MCSPI4_SIMO, "af20", NULL),
688 _OMAP4_BALLENTRY(MCSPI4_SOMI, "af21", NULL),
689 _OMAP4_BALLENTRY(MCSPI4_CS0, "ae20", NULL),
690 _OMAP4_BALLENTRY(UART4_RX, "ag20", NULL),
691 _OMAP4_BALLENTRY(UART4_TX, "ah19", NULL),
692 _OMAP4_BALLENTRY(USBB2_ULPITLL_CLK, "ag12", NULL),
693 _OMAP4_BALLENTRY(USBB2_ULPITLL_STP, "af12", NULL),
694 _OMAP4_BALLENTRY(USBB2_ULPITLL_DIR, "ae12", NULL),
695 _OMAP4_BALLENTRY(USBB2_ULPITLL_NXT, "ag13", NULL),
696 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT0, "ae11", NULL),
697 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT1, "af11", NULL),
698 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT2, "ag11", NULL),
699 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT3, "ah11", NULL),
700 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT4, "ae10", NULL),
701 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT5, "af10", NULL),
702 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT6, "ag10", NULL),
703 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT7, "ae9", NULL),
704 _OMAP4_BALLENTRY(USBB2_HSIC_DATA, "af13", NULL),
705 _OMAP4_BALLENTRY(USBB2_HSIC_STROBE, "ae13", NULL),
706 _OMAP4_BALLENTRY(UNIPRO_TX0, "g26", NULL),
707 _OMAP4_BALLENTRY(UNIPRO_TY0, "g25", NULL),
708 _OMAP4_BALLENTRY(UNIPRO_TX1, "h26", NULL),
709 _OMAP4_BALLENTRY(UNIPRO_TY1, "h25", NULL),
710 _OMAP4_BALLENTRY(UNIPRO_TX2, "j27", NULL),
711 _OMAP4_BALLENTRY(UNIPRO_TY2, "h27", NULL),
712 _OMAP4_BALLENTRY(UNIPRO_RX0, "j26", NULL),
713 _OMAP4_BALLENTRY(UNIPRO_RY0, "j25", NULL),
714 _OMAP4_BALLENTRY(UNIPRO_RX1, "k26", NULL),
715 _OMAP4_BALLENTRY(UNIPRO_RY1, "k25", NULL),
716 _OMAP4_BALLENTRY(UNIPRO_RX2, "l27", NULL),
717 _OMAP4_BALLENTRY(UNIPRO_RY2, "k27", NULL),
718 _OMAP4_BALLENTRY(USBA0_OTG_CE, "c3", NULL),
719 _OMAP4_BALLENTRY(USBA0_OTG_DP, "b5", NULL),
720 _OMAP4_BALLENTRY(USBA0_OTG_DM, "b4", NULL),
721 _OMAP4_BALLENTRY(FREF_CLK1_OUT, "aa28", NULL),
722 _OMAP4_BALLENTRY(FREF_CLK2_OUT, "y28", NULL),
723 _OMAP4_BALLENTRY(SYS_NIRQ1, "ae6", NULL),
724 _OMAP4_BALLENTRY(SYS_NIRQ2, "af6", NULL),
725 _OMAP4_BALLENTRY(SYS_BOOT0, "f26", NULL),
726 _OMAP4_BALLENTRY(SYS_BOOT1, "e27", NULL),
727 _OMAP4_BALLENTRY(SYS_BOOT2, "e26", NULL),
728 _OMAP4_BALLENTRY(SYS_BOOT3, "e25", NULL),
729 _OMAP4_BALLENTRY(SYS_BOOT4, "d28", NULL),
730 _OMAP4_BALLENTRY(SYS_BOOT5, "d27", NULL),
731 _OMAP4_BALLENTRY(DPM_EMU0, "m2", NULL),
732 _OMAP4_BALLENTRY(DPM_EMU1, "n2", NULL),
733 _OMAP4_BALLENTRY(DPM_EMU2, "p2", NULL),
734 _OMAP4_BALLENTRY(DPM_EMU3, "v1", NULL),
735 _OMAP4_BALLENTRY(DPM_EMU4, "v2", NULL),
736 _OMAP4_BALLENTRY(DPM_EMU5, "w1", NULL),
737 _OMAP4_BALLENTRY(DPM_EMU6, "w2", NULL),
738 _OMAP4_BALLENTRY(DPM_EMU7, "w3", NULL),
739 _OMAP4_BALLENTRY(DPM_EMU8, "w4", NULL),
740 _OMAP4_BALLENTRY(DPM_EMU9, "y2", NULL),
741 _OMAP4_BALLENTRY(DPM_EMU10, "y3", NULL),
742 _OMAP4_BALLENTRY(DPM_EMU11, "y4", NULL),
743 _OMAP4_BALLENTRY(DPM_EMU12, "aa1", NULL),
744 _OMAP4_BALLENTRY(DPM_EMU13, "aa2", NULL),
745 _OMAP4_BALLENTRY(DPM_EMU14, "aa3", NULL),
746 _OMAP4_BALLENTRY(DPM_EMU15, "aa4", NULL),
747 _OMAP4_BALLENTRY(DPM_EMU16, "ab2", NULL),
748 _OMAP4_BALLENTRY(DPM_EMU17, "ab3", NULL),
749 _OMAP4_BALLENTRY(DPM_EMU18, "ab4", NULL),
750 _OMAP4_BALLENTRY(DPM_EMU19, "ac4", NULL),
751 { .reg_offset = OMAP_MUX_TERMINATOR },
752};
753#else
754#define omap4_core_cbl_ball NULL
755#endif
756
757/*
758 * Signals different on ES2.0 compared to superset
759 */
760static struct omap_mux __initdata omap4_es2_core_subset[] = {
761 _OMAP4_MUXENTRY(GPMC_AD8, 32, "gpmc_ad8", "kpd_row0", "c2c_data15",
762 "gpio_32", NULL, "sdmmc1_dat0", NULL, NULL),
763 _OMAP4_MUXENTRY(GPMC_AD9, 33, "gpmc_ad9", "kpd_row1", "c2c_data14",
764 "gpio_33", NULL, "sdmmc1_dat1", NULL, NULL),
765 _OMAP4_MUXENTRY(GPMC_AD10, 34, "gpmc_ad10", "kpd_row2", "c2c_data13",
766 "gpio_34", NULL, "sdmmc1_dat2", NULL, NULL),
767 _OMAP4_MUXENTRY(GPMC_AD11, 35, "gpmc_ad11", "kpd_row3", "c2c_data12",
768 "gpio_35", NULL, "sdmmc1_dat3", NULL, NULL),
769 _OMAP4_MUXENTRY(GPMC_AD12, 36, "gpmc_ad12", "kpd_col0", "c2c_data11",
770 "gpio_36", NULL, "sdmmc1_dat4", NULL, NULL),
771 _OMAP4_MUXENTRY(GPMC_AD13, 37, "gpmc_ad13", "kpd_col1", "c2c_data10",
772 "gpio_37", NULL, "sdmmc1_dat5", NULL, NULL),
773 _OMAP4_MUXENTRY(GPMC_AD14, 38, "gpmc_ad14", "kpd_col2", "c2c_data9",
774 "gpio_38", NULL, "sdmmc1_dat6", NULL, NULL),
775 _OMAP4_MUXENTRY(GPMC_AD15, 39, "gpmc_ad15", "kpd_col3", "c2c_data8",
776 "gpio_39", NULL, "sdmmc1_dat7", NULL, NULL),
777 _OMAP4_MUXENTRY(GPMC_A16, 40, "gpmc_a16", "kpd_row4", "c2c_datain0",
778 "gpio_40", "venc_656_data0", NULL, NULL, "safe_mode"),
779 _OMAP4_MUXENTRY(GPMC_A24, 48, "gpmc_a24", "kpd_col8", "c2c_clkout0",
780 "gpio_48", NULL, NULL, NULL, "safe_mode"),
781 _OMAP4_MUXENTRY(GPMC_NCS2, 52, "gpmc_ncs2", "kpd_row8",
782 "c2c_dataout7", "gpio_52", NULL, NULL, NULL,
783 "safe_mode"),
784 _OMAP4_MUXENTRY(GPMC_CLK, 55, "gpmc_clk", NULL, NULL, "gpio_55",
785 "sys_ndmareq2", "sdmmc1_cmd", NULL, NULL),
786 _OMAP4_MUXENTRY(GPMC_NADV_ALE, 56, "gpmc_nadv_ale", "dsi1_te1", NULL,
787 "gpio_56", "sys_ndmareq3", "sdmmc1_clk", NULL, NULL),
788 _OMAP4_MUXENTRY(GPMC_WAIT2, 100, "gpmc_wait2", "usbc1_icusb_txen",
789 "c2c_dataout3", "gpio_100", "sys_ndmareq0", NULL,
790 NULL, "safe_mode"),
791 _OMAP4_MUXENTRY(GPMC_NCS4, 101, "gpmc_ncs4", "dsi1_te0", "c2c_clkin0",
792 "gpio_101", "sys_ndmareq1", NULL, NULL, "safe_mode"),
793 _OMAP4_MUXENTRY(GPMC_NCS5, 102, "gpmc_ncs5", "dsi1_te1", "c2c_clkin1",
794 "gpio_102", "sys_ndmareq2", NULL, NULL, "safe_mode"),
795 _OMAP4_MUXENTRY(GPMC_NCS6, 103, "gpmc_ncs6", "dsi2_te0",
796 "c2c_dataout0", "gpio_103", "sys_ndmareq3", NULL,
797 NULL, "safe_mode"),
798 _OMAP4_MUXENTRY(GPMC_NCS7, 104, "gpmc_ncs7", "dsi2_te1",
799 "c2c_dataout1", "gpio_104", NULL, NULL, NULL,
800 "safe_mode"),
801 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT0, 88, "usbb1_ulpitll_dat0",
802 "hsi1_acwake", "mcbsp4_clkx", "gpio_88",
803 "usbb1_ulpiphy_dat0", "usbb1_mm_txen", "hw_dbg24",
804 "safe_mode"),
805 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT1, 89, "usbb1_ulpitll_dat1",
806 "hsi1_acdata", "mcbsp4_dx", "gpio_89",
807 "usbb1_ulpiphy_dat1", "usbb1_mm_txdat", "hw_dbg25",
808 "safe_mode"),
809 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT2, 90, "usbb1_ulpitll_dat2",
810 "hsi1_acflag", "mcbsp4_dr", "gpio_90",
811 "usbb1_ulpiphy_dat2", "usbb1_mm_txse0", "hw_dbg26",
812 "safe_mode"),
813 _OMAP4_MUXENTRY(USBB1_ULPITLL_DAT3, 91, "usbb1_ulpitll_dat3",
814 "hsi1_caready", NULL, "gpio_91", "usbb1_ulpiphy_dat3",
815 "usbb1_mm_rxrcv", "hw_dbg27", "safe_mode"),
816 _OMAP4_MUXENTRY(ABE_DMIC_CLK1, 119, "abe_dmic_clk1", NULL, NULL,
817 "gpio_119", "usbb2_mm_txse0", "uart4_cts", NULL,
818 "safe_mode"),
819 _OMAP4_MUXENTRY(ABE_DMIC_DIN1, 120, "abe_dmic_din1", NULL, NULL,
820 "gpio_120", "usbb2_mm_txdat", "uart4_rts", NULL,
821 "safe_mode"),
822 _OMAP4_MUXENTRY(ABE_DMIC_DIN2, 121, "abe_dmic_din2", "slimbus2_clock",
823 "abe_mcasp_axr", "gpio_121", NULL,
824 "dmtimer11_pwm_evt", NULL, "safe_mode"),
825 _OMAP4_MUXENTRY(ABE_DMIC_DIN3, 122, "abe_dmic_din3", "slimbus2_data",
826 "abe_dmic_clk2", "gpio_122", NULL, "dmtimer9_pwm_evt",
827 NULL, "safe_mode"),
828 _OMAP4_MUXENTRY(SDMMC5_CLK, 145, "sdmmc5_clk", "mcspi2_clk",
829 "usbc1_icusb_dp", "gpio_145", NULL, "sdmmc2_clk",
830 NULL, "safe_mode"),
831 _OMAP4_MUXENTRY(SDMMC5_CMD, 146, "sdmmc5_cmd", "mcspi2_simo",
832 "usbc1_icusb_dm", "gpio_146", NULL, "sdmmc2_cmd",
833 NULL, "safe_mode"),
834 _OMAP4_MUXENTRY(SDMMC5_DAT0, 147, "sdmmc5_dat0", "mcspi2_somi",
835 "usbc1_icusb_rcv", "gpio_147", NULL, "sdmmc2_dat0",
836 NULL, "safe_mode"),
837 _OMAP4_MUXENTRY(SDMMC5_DAT1, 148, "sdmmc5_dat1", NULL,
838 "usbc1_icusb_txen", "gpio_148", NULL, "sdmmc2_dat1",
839 NULL, "safe_mode"),
840 _OMAP4_MUXENTRY(SDMMC5_DAT2, 149, "sdmmc5_dat2", "mcspi2_cs1", NULL,
841 "gpio_149", NULL, "sdmmc2_dat2", NULL, "safe_mode"),
842 _OMAP4_MUXENTRY(SDMMC5_DAT3, 150, "sdmmc5_dat3", "mcspi2_cs0", NULL,
843 "gpio_150", NULL, "sdmmc2_dat3", NULL, "safe_mode"),
844 _OMAP4_MUXENTRY(MCSPI4_CLK, 151, "mcspi4_clk", "sdmmc4_clk",
845 "kpd_col6", "gpio_151", NULL, NULL, NULL,
846 "safe_mode"),
847 _OMAP4_MUXENTRY(MCSPI4_SIMO, 152, "mcspi4_simo", "sdmmc4_cmd",
848 "kpd_col7", "gpio_152", NULL, NULL, NULL,
849 "safe_mode"),
850 _OMAP4_MUXENTRY(MCSPI4_SOMI, 153, "mcspi4_somi", "sdmmc4_dat0",
851 "kpd_row6", "gpio_153", NULL, NULL, NULL,
852 "safe_mode"),
853 _OMAP4_MUXENTRY(MCSPI4_CS0, 154, "mcspi4_cs0", "sdmmc4_dat3",
854 "kpd_row7", "gpio_154", NULL, NULL, NULL,
855 "safe_mode"),
856 _OMAP4_MUXENTRY(UART4_RX, 155, "uart4_rx", "sdmmc4_dat2", "kpd_row8",
857 "gpio_155", NULL, NULL, NULL, "safe_mode"),
858 _OMAP4_MUXENTRY(UART4_TX, 156, "uart4_tx", "sdmmc4_dat1", "kpd_col8",
859 "gpio_156", NULL, NULL, NULL, "safe_mode"),
860 _OMAP4_MUXENTRY(USBB2_ULPITLL_STP, 158, "usbb2_ulpitll_stp",
861 "usbb2_ulpiphy_stp", "sdmmc4_clk", "gpio_158",
862 "hsi2_cadata", "dispc2_data23", NULL, "safe_mode"),
863 _OMAP4_MUXENTRY(USBB2_ULPITLL_DIR, 159, "usbb2_ulpitll_dir",
864 "usbb2_ulpiphy_dir", "sdmmc4_dat0", "gpio_159",
865 "hsi2_caflag", "dispc2_data22", NULL, "safe_mode"),
866 _OMAP4_MUXENTRY(USBB2_ULPITLL_NXT, 160, "usbb2_ulpitll_nxt",
867 "usbb2_ulpiphy_nxt", "sdmmc4_dat1", "gpio_160",
868 "hsi2_acready", "dispc2_data21", NULL, "safe_mode"),
869 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT0, 161, "usbb2_ulpitll_dat0",
870 "usbb2_ulpiphy_dat0", "sdmmc4_dat2", "gpio_161",
871 "hsi2_acwake", "dispc2_data20", "usbb2_mm_txen",
872 "safe_mode"),
873 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT1, 162, "usbb2_ulpitll_dat1",
874 "usbb2_ulpiphy_dat1", "sdmmc4_dat3", "gpio_162",
875 "hsi2_acdata", "dispc2_data19", "usbb2_mm_txdat",
876 "safe_mode"),
877 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT2, 163, "usbb2_ulpitll_dat2",
878 "usbb2_ulpiphy_dat2", "sdmmc3_dat2", "gpio_163",
879 "hsi2_acflag", "dispc2_data18", "usbb2_mm_txse0",
880 "safe_mode"),
881 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT3, 164, "usbb2_ulpitll_dat3",
882 "usbb2_ulpiphy_dat3", "sdmmc3_dat1", "gpio_164",
883 "hsi2_caready", "dispc2_data15", "rfbi_data15",
884 "safe_mode"),
885 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT4, 165, "usbb2_ulpitll_dat4",
886 "usbb2_ulpiphy_dat4", "sdmmc3_dat0", "gpio_165",
887 "mcspi3_somi", "dispc2_data14", "rfbi_data14",
888 "safe_mode"),
889 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT5, 166, "usbb2_ulpitll_dat5",
890 "usbb2_ulpiphy_dat5", "sdmmc3_dat3", "gpio_166",
891 "mcspi3_cs0", "dispc2_data13", "rfbi_data13",
892 "safe_mode"),
893 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT6, 167, "usbb2_ulpitll_dat6",
894 "usbb2_ulpiphy_dat6", "sdmmc3_cmd", "gpio_167",
895 "mcspi3_simo", "dispc2_data12", "rfbi_data12",
896 "safe_mode"),
897 _OMAP4_MUXENTRY(USBB2_ULPITLL_DAT7, 168, "usbb2_ulpitll_dat7",
898 "usbb2_ulpiphy_dat7", "sdmmc3_clk", "gpio_168",
899 "mcspi3_clk", "dispc2_data11", "rfbi_data11",
900 "safe_mode"),
901 _OMAP4_MUXENTRY(KPD_COL3, 171, "kpd_col3", "kpd_col0", NULL,
902 "gpio_171", NULL, NULL, NULL, "safe_mode"),
903 _OMAP4_MUXENTRY(KPD_COL4, 172, "kpd_col4", "kpd_col1", NULL,
904 "gpio_172", NULL, NULL, NULL, "safe_mode"),
905 _OMAP4_MUXENTRY(KPD_COL5, 173, "kpd_col5", "kpd_col2", NULL,
906 "gpio_173", NULL, NULL, NULL, "safe_mode"),
907 _OMAP4_MUXENTRY(KPD_COL0, 174, "kpd_col0", "kpd_col3", NULL,
908 "gpio_174", NULL, NULL, NULL, "safe_mode"),
909 _OMAP4_MUXENTRY(KPD_COL1, 0, "kpd_col1", "kpd_col4", NULL, "gpio_0",
910 NULL, NULL, NULL, "safe_mode"),
911 _OMAP4_MUXENTRY(KPD_COL2, 1, "kpd_col2", "kpd_col5", NULL, "gpio_1",
912 NULL, NULL, NULL, "safe_mode"),
913 _OMAP4_MUXENTRY(KPD_ROW3, 175, "kpd_row3", "kpd_row0", NULL,
914 "gpio_175", NULL, NULL, NULL, "safe_mode"),
915 _OMAP4_MUXENTRY(KPD_ROW4, 176, "kpd_row4", "kpd_row1", NULL,
916 "gpio_176", NULL, NULL, NULL, "safe_mode"),
917 _OMAP4_MUXENTRY(KPD_ROW5, 177, "kpd_row5", "kpd_row2", NULL,
918 "gpio_177", NULL, NULL, NULL, "safe_mode"),
919 _OMAP4_MUXENTRY(KPD_ROW0, 178, "kpd_row0", "kpd_row3", NULL,
920 "gpio_178", NULL, NULL, NULL, "safe_mode"),
921 _OMAP4_MUXENTRY(KPD_ROW1, 2, "kpd_row1", "kpd_row4", NULL, "gpio_2",
922 NULL, NULL, NULL, "safe_mode"),
923 _OMAP4_MUXENTRY(KPD_ROW2, 3, "kpd_row2", "kpd_row5", NULL, "gpio_3",
924 NULL, NULL, NULL, "safe_mode"),
925 _OMAP4_MUXENTRY(USBA0_OTG_DP, 0, "usba0_otg_dp", "uart3_rx_irrx",
926 "uart2_rx", NULL, NULL, NULL, NULL, "safe_mode"),
927 _OMAP4_MUXENTRY(USBA0_OTG_DM, 0, "usba0_otg_dm", "uart3_tx_irtx",
928 "uart2_tx", NULL, NULL, NULL, NULL, "safe_mode"),
929 _OMAP4_MUXENTRY(DPM_EMU2, 13, "dpm_emu2", "usba0_ulpiphy_clk", NULL,
930 "gpio_13", NULL, "dispc2_fid", "hw_dbg2",
931 "safe_mode"),
932 _OMAP4_MUXENTRY(DPM_EMU3, 14, "dpm_emu3", "usba0_ulpiphy_stp", NULL,
933 "gpio_14", "rfbi_data10", "dispc2_data10", "hw_dbg3",
934 "safe_mode"),
935 _OMAP4_MUXENTRY(DPM_EMU4, 15, "dpm_emu4", "usba0_ulpiphy_dir", NULL,
936 "gpio_15", "rfbi_data9", "dispc2_data9", "hw_dbg4",
937 "safe_mode"),
938 _OMAP4_MUXENTRY(DPM_EMU5, 16, "dpm_emu5", "usba0_ulpiphy_nxt", NULL,
939 "gpio_16", "rfbi_te_vsync0", "dispc2_data16",
940 "hw_dbg5", "safe_mode"),
941 _OMAP4_MUXENTRY(DPM_EMU6, 17, "dpm_emu6", "usba0_ulpiphy_dat0",
942 "uart3_tx_irtx", "gpio_17", "rfbi_hsync0",
943 "dispc2_data17", "hw_dbg6", "safe_mode"),
944 _OMAP4_MUXENTRY(DPM_EMU7, 18, "dpm_emu7", "usba0_ulpiphy_dat1",
945 "uart3_rx_irrx", "gpio_18", "rfbi_cs0",
946 "dispc2_hsync", "hw_dbg7", "safe_mode"),
947 _OMAP4_MUXENTRY(DPM_EMU8, 19, "dpm_emu8", "usba0_ulpiphy_dat2",
948 "uart3_rts_sd", "gpio_19", "rfbi_re", "dispc2_pclk",
949 "hw_dbg8", "safe_mode"),
950 _OMAP4_MUXENTRY(DPM_EMU9, 20, "dpm_emu9", "usba0_ulpiphy_dat3",
951 "uart3_cts_rctx", "gpio_20", "rfbi_we",
952 "dispc2_vsync", "hw_dbg9", "safe_mode"),
953 _OMAP4_MUXENTRY(DPM_EMU10, 21, "dpm_emu10", "usba0_ulpiphy_dat4",
954 NULL, "gpio_21", "rfbi_a0", "dispc2_de", "hw_dbg10",
955 "safe_mode"),
956 _OMAP4_MUXENTRY(DPM_EMU11, 22, "dpm_emu11", "usba0_ulpiphy_dat5",
957 NULL, "gpio_22", "rfbi_data8", "dispc2_data8",
958 "hw_dbg11", "safe_mode"),
959 _OMAP4_MUXENTRY(DPM_EMU12, 23, "dpm_emu12", "usba0_ulpiphy_dat6",
960 NULL, "gpio_23", "rfbi_data7", "dispc2_data7",
961 "hw_dbg12", "safe_mode"),
962 _OMAP4_MUXENTRY(DPM_EMU13, 24, "dpm_emu13", "usba0_ulpiphy_dat7",
963 NULL, "gpio_24", "rfbi_data6", "dispc2_data6",
964 "hw_dbg13", "safe_mode"),
965 _OMAP4_MUXENTRY(DPM_EMU14, 25, "dpm_emu14", "sys_drm_msecure",
966 "uart1_rx", "gpio_25", "rfbi_data5", "dispc2_data5",
967 "hw_dbg14", "safe_mode"),
968 _OMAP4_MUXENTRY(DPM_EMU15, 26, "dpm_emu15", "sys_secure_indicator",
969 NULL, "gpio_26", "rfbi_data4", "dispc2_data4",
970 "hw_dbg15", "safe_mode"),
971 _OMAP4_MUXENTRY(DPM_EMU16, 27, "dpm_emu16", "dmtimer8_pwm_evt",
972 "dsi1_te0", "gpio_27", "rfbi_data3", "dispc2_data3",
973 "hw_dbg16", "safe_mode"),
974 _OMAP4_MUXENTRY(DPM_EMU17, 28, "dpm_emu17", "dmtimer9_pwm_evt",
975 "dsi1_te1", "gpio_28", "rfbi_data2", "dispc2_data2",
976 "hw_dbg17", "safe_mode"),
977 _OMAP4_MUXENTRY(DPM_EMU18, 190, "dpm_emu18", "dmtimer10_pwm_evt",
978 "dsi2_te0", "gpio_190", "rfbi_data1", "dispc2_data1",
979 "hw_dbg18", "safe_mode"),
980 _OMAP4_MUXENTRY(DPM_EMU19, 191, "dpm_emu19", "dmtimer11_pwm_evt",
981 "dsi2_te1", "gpio_191", "rfbi_data0", "dispc2_data0",
982 "hw_dbg19", "safe_mode"),
983 { .reg_offset = OMAP_MUX_TERMINATOR },
984};
985
986/*
987 * Balls for 44XX CBS package
988 * 547-pin CBL ES2.0 S-FPGA-N547, 0.40mm Ball Pitch (Top),
989 * 0.40mm Ball Pitch (Bottom)
990 */
991#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
992 && defined(CONFIG_OMAP_PACKAGE_CBS)
993static struct omap_ball __initdata omap4_core_cbs_ball[] = {
994 _OMAP4_BALLENTRY(GPMC_AD0, "c12", NULL),
995 _OMAP4_BALLENTRY(GPMC_AD1, "d12", NULL),
996 _OMAP4_BALLENTRY(GPMC_AD2, "c13", NULL),
997 _OMAP4_BALLENTRY(GPMC_AD3, "d13", NULL),
998 _OMAP4_BALLENTRY(GPMC_AD4, "c15", NULL),
999 _OMAP4_BALLENTRY(GPMC_AD5, "d15", NULL),
1000 _OMAP4_BALLENTRY(GPMC_AD6, "a16", NULL),
1001 _OMAP4_BALLENTRY(GPMC_AD7, "b16", NULL),
1002 _OMAP4_BALLENTRY(GPMC_AD8, "c16", NULL),
1003 _OMAP4_BALLENTRY(GPMC_AD9, "d16", NULL),
1004 _OMAP4_BALLENTRY(GPMC_AD10, "c17", NULL),
1005 _OMAP4_BALLENTRY(GPMC_AD11, "d17", NULL),
1006 _OMAP4_BALLENTRY(GPMC_AD12, "c18", NULL),
1007 _OMAP4_BALLENTRY(GPMC_AD13, "d18", NULL),
1008 _OMAP4_BALLENTRY(GPMC_AD14, "c19", NULL),
1009 _OMAP4_BALLENTRY(GPMC_AD15, "d19", NULL),
1010 _OMAP4_BALLENTRY(GPMC_A16, "b17", NULL),
1011 _OMAP4_BALLENTRY(GPMC_A17, "a18", NULL),
1012 _OMAP4_BALLENTRY(GPMC_A18, "b18", NULL),
1013 _OMAP4_BALLENTRY(GPMC_A19, "a19", NULL),
1014 _OMAP4_BALLENTRY(GPMC_A20, "b19", NULL),
1015 _OMAP4_BALLENTRY(GPMC_A21, "b20", NULL),
1016 _OMAP4_BALLENTRY(GPMC_A22, "a21", NULL),
1017 _OMAP4_BALLENTRY(GPMC_A23, "b21", NULL),
1018 _OMAP4_BALLENTRY(GPMC_A24, "c20", NULL),
1019 _OMAP4_BALLENTRY(GPMC_A25, "d20", NULL),
1020 _OMAP4_BALLENTRY(GPMC_NCS0, "b25", NULL),
1021 _OMAP4_BALLENTRY(GPMC_NCS1, "c21", NULL),
1022 _OMAP4_BALLENTRY(GPMC_NCS2, "d21", NULL),
1023 _OMAP4_BALLENTRY(GPMC_NCS3, "c22", NULL),
1024 _OMAP4_BALLENTRY(GPMC_NWP, "c25", NULL),
1025 _OMAP4_BALLENTRY(GPMC_CLK, "b22", NULL),
1026 _OMAP4_BALLENTRY(GPMC_NADV_ALE, "d25", NULL),
1027 _OMAP4_BALLENTRY(GPMC_NOE, "b11", NULL),
1028 _OMAP4_BALLENTRY(GPMC_NWE, "b12", NULL),
1029 _OMAP4_BALLENTRY(GPMC_NBE0_CLE, "c23", NULL),
1030 _OMAP4_BALLENTRY(GPMC_NBE1, "d22", NULL),
1031 _OMAP4_BALLENTRY(GPMC_WAIT0, "b26", NULL),
1032 _OMAP4_BALLENTRY(GPMC_WAIT1, "b23", NULL),
1033 _OMAP4_BALLENTRY(GPMC_WAIT2, "d23", NULL),
1034 _OMAP4_BALLENTRY(GPMC_NCS4, "a24", NULL),
1035 _OMAP4_BALLENTRY(GPMC_NCS5, "b24", NULL),
1036 _OMAP4_BALLENTRY(GPMC_NCS6, "c24", NULL),
1037 _OMAP4_BALLENTRY(GPMC_NCS7, "d24", NULL),
1038 _OMAP4_BALLENTRY(HDMI_HPD, "b9", NULL),
1039 _OMAP4_BALLENTRY(HDMI_CEC, "b10", NULL),
1040 _OMAP4_BALLENTRY(HDMI_DDC_SCL, "a8", NULL),
1041 _OMAP4_BALLENTRY(HDMI_DDC_SDA, "b8", NULL),
1042 _OMAP4_BALLENTRY(CSI21_DX0, "r26", NULL),
1043 _OMAP4_BALLENTRY(CSI21_DY0, "r25", NULL),
1044 _OMAP4_BALLENTRY(CSI21_DX1, "t26", NULL),
1045 _OMAP4_BALLENTRY(CSI21_DY1, "t25", NULL),
1046 _OMAP4_BALLENTRY(CSI21_DX2, "u26", NULL),
1047 _OMAP4_BALLENTRY(CSI21_DY2, "u25", NULL),
1048 _OMAP4_BALLENTRY(CSI21_DX3, "v26", NULL),
1049 _OMAP4_BALLENTRY(CSI21_DY3, "v25", NULL),
1050 _OMAP4_BALLENTRY(CSI21_DX4, "w26", NULL),
1051 _OMAP4_BALLENTRY(CSI21_DY4, "w25", NULL),
1052 _OMAP4_BALLENTRY(CSI22_DX0, "m26", NULL),
1053 _OMAP4_BALLENTRY(CSI22_DY0, "m25", NULL),
1054 _OMAP4_BALLENTRY(CSI22_DX1, "n26", NULL),
1055 _OMAP4_BALLENTRY(CSI22_DY1, "n25", NULL),
1056 _OMAP4_BALLENTRY(CAM_SHUTTER, "t27", NULL),
1057 _OMAP4_BALLENTRY(CAM_STROBE, "u27", NULL),
1058 _OMAP4_BALLENTRY(CAM_GLOBALRESET, "v27", NULL),
1059 _OMAP4_BALLENTRY(USBB1_ULPITLL_CLK, "ae18", NULL),
1060 _OMAP4_BALLENTRY(USBB1_ULPITLL_STP, "ag19", NULL),
1061 _OMAP4_BALLENTRY(USBB1_ULPITLL_DIR, "af19", NULL),
1062 _OMAP4_BALLENTRY(USBB1_ULPITLL_NXT, "ae19", NULL),
1063 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT0, "af18", NULL),
1064 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT1, "ag18", NULL),
1065 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT2, "ae17", NULL),
1066 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT3, "af17", NULL),
1067 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT4, "ah17", NULL),
1068 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT5, "ae16", NULL),
1069 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT6, "af16", NULL),
1070 _OMAP4_BALLENTRY(USBB1_ULPITLL_DAT7, "ag16", NULL),
1071 _OMAP4_BALLENTRY(USBB1_HSIC_DATA, "af14", NULL),
1072 _OMAP4_BALLENTRY(USBB1_HSIC_STROBE, "ae14", NULL),
1073 _OMAP4_BALLENTRY(USBC1_ICUSB_DP, "h2", NULL),
1074 _OMAP4_BALLENTRY(USBC1_ICUSB_DM, "h3", NULL),
1075 _OMAP4_BALLENTRY(SDMMC1_CLK, "d2", NULL),
1076 _OMAP4_BALLENTRY(SDMMC1_CMD, "e3", NULL),
1077 _OMAP4_BALLENTRY(SDMMC1_DAT0, "e4", NULL),
1078 _OMAP4_BALLENTRY(SDMMC1_DAT1, "e2", NULL),
1079 _OMAP4_BALLENTRY(SDMMC1_DAT2, "e1", NULL),
1080 _OMAP4_BALLENTRY(SDMMC1_DAT3, "f4", NULL),
1081 _OMAP4_BALLENTRY(SDMMC1_DAT4, "f3", NULL),
1082 _OMAP4_BALLENTRY(SDMMC1_DAT5, "f1", NULL),
1083 _OMAP4_BALLENTRY(SDMMC1_DAT6, "g4", NULL),
1084 _OMAP4_BALLENTRY(SDMMC1_DAT7, "g3", NULL),
1085 _OMAP4_BALLENTRY(ABE_MCBSP2_CLKX, "ad27", NULL),
1086 _OMAP4_BALLENTRY(ABE_MCBSP2_DR, "ad26", NULL),
1087 _OMAP4_BALLENTRY(ABE_MCBSP2_DX, "ad25", NULL),
1088 _OMAP4_BALLENTRY(ABE_MCBSP2_FSX, "ac28", NULL),
1089 _OMAP4_BALLENTRY(ABE_MCBSP1_CLKX, "ac26", NULL),
1090 _OMAP4_BALLENTRY(ABE_MCBSP1_DR, "ac25", NULL),
1091 _OMAP4_BALLENTRY(ABE_MCBSP1_DX, "ab25", NULL),
1092 _OMAP4_BALLENTRY(ABE_MCBSP1_FSX, "ac27", NULL),
1093 _OMAP4_BALLENTRY(ABE_PDM_UL_DATA, "ag25", NULL),
1094 _OMAP4_BALLENTRY(ABE_PDM_DL_DATA, "af25", NULL),
1095 _OMAP4_BALLENTRY(ABE_PDM_FRAME, "ae25", NULL),
1096 _OMAP4_BALLENTRY(ABE_PDM_LB_CLK, "af26", NULL),
1097 _OMAP4_BALLENTRY(ABE_CLKS, "ah26", NULL),
1098 _OMAP4_BALLENTRY(ABE_DMIC_CLK1, "ae24", NULL),
1099 _OMAP4_BALLENTRY(ABE_DMIC_DIN1, "af24", NULL),
1100 _OMAP4_BALLENTRY(ABE_DMIC_DIN2, "ag24", NULL),
1101 _OMAP4_BALLENTRY(ABE_DMIC_DIN3, "ah24", NULL),
1102 _OMAP4_BALLENTRY(UART2_CTS, "ab26", NULL),
1103 _OMAP4_BALLENTRY(UART2_RTS, "ab27", NULL),
1104 _OMAP4_BALLENTRY(UART2_RX, "aa25", NULL),
1105 _OMAP4_BALLENTRY(UART2_TX, "aa26", NULL),
1106 _OMAP4_BALLENTRY(HDQ_SIO, "aa27", NULL),
1107 _OMAP4_BALLENTRY(I2C1_SCL, "ae28", NULL),
1108 _OMAP4_BALLENTRY(I2C1_SDA, "ae26", NULL),
1109 _OMAP4_BALLENTRY(I2C2_SCL, "c26", NULL),
1110 _OMAP4_BALLENTRY(I2C2_SDA, "d26", NULL),
1111 _OMAP4_BALLENTRY(I2C3_SCL, "w27", NULL),
1112 _OMAP4_BALLENTRY(I2C3_SDA, "y27", NULL),
1113 _OMAP4_BALLENTRY(I2C4_SCL, "ag21", NULL),
1114 _OMAP4_BALLENTRY(I2C4_SDA, "ah22", NULL),
1115 _OMAP4_BALLENTRY(MCSPI1_CLK, "af22", NULL),
1116 _OMAP4_BALLENTRY(MCSPI1_SOMI, "ae22", NULL),
1117 _OMAP4_BALLENTRY(MCSPI1_SIMO, "ag22", NULL),
1118 _OMAP4_BALLENTRY(MCSPI1_CS0, "ae23", NULL),
1119 _OMAP4_BALLENTRY(MCSPI1_CS1, "af23", NULL),
1120 _OMAP4_BALLENTRY(MCSPI1_CS2, "ag23", NULL),
1121 _OMAP4_BALLENTRY(MCSPI1_CS3, "ah23", NULL),
1122 _OMAP4_BALLENTRY(UART3_CTS_RCTX, "f27", NULL),
1123 _OMAP4_BALLENTRY(UART3_RTS_SD, "f28", NULL),
1124 _OMAP4_BALLENTRY(UART3_RX_IRRX, "g27", NULL),
1125 _OMAP4_BALLENTRY(UART3_TX_IRTX, "g28", NULL),
1126 _OMAP4_BALLENTRY(SDMMC5_CLK, "ae5", NULL),
1127 _OMAP4_BALLENTRY(SDMMC5_CMD, "af5", NULL),
1128 _OMAP4_BALLENTRY(SDMMC5_DAT0, "ae4", NULL),
1129 _OMAP4_BALLENTRY(SDMMC5_DAT1, "af4", NULL),
1130 _OMAP4_BALLENTRY(SDMMC5_DAT2, "ag3", NULL),
1131 _OMAP4_BALLENTRY(SDMMC5_DAT3, "af3", NULL),
1132 _OMAP4_BALLENTRY(MCSPI4_CLK, "ae21", NULL),
1133 _OMAP4_BALLENTRY(MCSPI4_SIMO, "af20", NULL),
1134 _OMAP4_BALLENTRY(MCSPI4_SOMI, "af21", NULL),
1135 _OMAP4_BALLENTRY(MCSPI4_CS0, "ae20", NULL),
1136 _OMAP4_BALLENTRY(UART4_RX, "ag20", NULL),
1137 _OMAP4_BALLENTRY(UART4_TX, "ah19", NULL),
1138 _OMAP4_BALLENTRY(USBB2_ULPITLL_CLK, "ag12", NULL),
1139 _OMAP4_BALLENTRY(USBB2_ULPITLL_STP, "af12", NULL),
1140 _OMAP4_BALLENTRY(USBB2_ULPITLL_DIR, "ae12", NULL),
1141 _OMAP4_BALLENTRY(USBB2_ULPITLL_NXT, "ag13", NULL),
1142 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT0, "ae11", NULL),
1143 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT1, "af11", NULL),
1144 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT2, "ag11", NULL),
1145 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT3, "ah11", NULL),
1146 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT4, "ae10", NULL),
1147 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT5, "af10", NULL),
1148 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT6, "ag10", NULL),
1149 _OMAP4_BALLENTRY(USBB2_ULPITLL_DAT7, "ae9", NULL),
1150 _OMAP4_BALLENTRY(USBB2_HSIC_DATA, "af13", NULL),
1151 _OMAP4_BALLENTRY(USBB2_HSIC_STROBE, "ae13", NULL),
1152 _OMAP4_BALLENTRY(KPD_COL3, "g26", NULL),
1153 _OMAP4_BALLENTRY(KPD_COL4, "g25", NULL),
1154 _OMAP4_BALLENTRY(KPD_COL5, "h26", NULL),
1155 _OMAP4_BALLENTRY(KPD_COL0, "h25", NULL),
1156 _OMAP4_BALLENTRY(KPD_COL1, "j27", NULL),
1157 _OMAP4_BALLENTRY(KPD_COL2, "h27", NULL),
1158 _OMAP4_BALLENTRY(KPD_ROW3, "j26", NULL),
1159 _OMAP4_BALLENTRY(KPD_ROW4, "j25", NULL),
1160 _OMAP4_BALLENTRY(KPD_ROW5, "k26", NULL),
1161 _OMAP4_BALLENTRY(KPD_ROW0, "k25", NULL),
1162 _OMAP4_BALLENTRY(KPD_ROW1, "l27", NULL),
1163 _OMAP4_BALLENTRY(KPD_ROW2, "k27", NULL),
1164 _OMAP4_BALLENTRY(USBA0_OTG_CE, "c3", NULL),
1165 _OMAP4_BALLENTRY(USBA0_OTG_DP, "b5", NULL),
1166 _OMAP4_BALLENTRY(USBA0_OTG_DM, "b4", NULL),
1167 _OMAP4_BALLENTRY(FREF_CLK1_OUT, "aa28", NULL),
1168 _OMAP4_BALLENTRY(FREF_CLK2_OUT, "y28", NULL),
1169 _OMAP4_BALLENTRY(SYS_NIRQ1, "ae6", NULL),
1170 _OMAP4_BALLENTRY(SYS_NIRQ2, "af6", NULL),
1171 _OMAP4_BALLENTRY(SYS_BOOT0, "f26", NULL),
1172 _OMAP4_BALLENTRY(SYS_BOOT1, "e27", NULL),
1173 _OMAP4_BALLENTRY(SYS_BOOT2, "e26", NULL),
1174 _OMAP4_BALLENTRY(SYS_BOOT3, "e25", NULL),
1175 _OMAP4_BALLENTRY(SYS_BOOT4, "d28", NULL),
1176 _OMAP4_BALLENTRY(SYS_BOOT5, "d27", NULL),
1177 _OMAP4_BALLENTRY(DPM_EMU0, "m2", NULL),
1178 _OMAP4_BALLENTRY(DPM_EMU1, "n2", NULL),
1179 _OMAP4_BALLENTRY(DPM_EMU2, "p2", NULL),
1180 _OMAP4_BALLENTRY(DPM_EMU3, "v1", NULL),
1181 _OMAP4_BALLENTRY(DPM_EMU4, "v2", NULL),
1182 _OMAP4_BALLENTRY(DPM_EMU5, "w1", NULL),
1183 _OMAP4_BALLENTRY(DPM_EMU6, "w2", NULL),
1184 _OMAP4_BALLENTRY(DPM_EMU7, "w3", NULL),
1185 _OMAP4_BALLENTRY(DPM_EMU8, "w4", NULL),
1186 _OMAP4_BALLENTRY(DPM_EMU9, "y2", NULL),
1187 _OMAP4_BALLENTRY(DPM_EMU10, "y3", NULL),
1188 _OMAP4_BALLENTRY(DPM_EMU11, "y4", NULL),
1189 _OMAP4_BALLENTRY(DPM_EMU12, "aa1", NULL),
1190 _OMAP4_BALLENTRY(DPM_EMU13, "aa2", NULL),
1191 _OMAP4_BALLENTRY(DPM_EMU14, "aa3", NULL),
1192 _OMAP4_BALLENTRY(DPM_EMU15, "aa4", NULL),
1193 _OMAP4_BALLENTRY(DPM_EMU16, "ab2", NULL),
1194 _OMAP4_BALLENTRY(DPM_EMU17, "ab3", NULL),
1195 _OMAP4_BALLENTRY(DPM_EMU18, "ab4", NULL),
1196 _OMAP4_BALLENTRY(DPM_EMU19, "ac4", NULL),
1197 { .reg_offset = OMAP_MUX_TERMINATOR },
1198};
1199#else
1200#define omap4_core_cbs_ball NULL
1201#endif
1202
1203/*
1204 * Superset of all mux modes for omap4
1205 */
1206static struct omap_mux __initdata omap4_wkup_muxmodes[] = {
1207 _OMAP4_MUXENTRY(SIM_IO, 0, "sim_io", NULL, NULL, "gpio_wk0", NULL,
1208 NULL, NULL, "safe_mode"),
1209 _OMAP4_MUXENTRY(SIM_CLK, 1, "sim_clk", NULL, NULL, "gpio_wk1", NULL,
1210 NULL, NULL, "safe_mode"),
1211 _OMAP4_MUXENTRY(SIM_RESET, 2, "sim_reset", NULL, NULL, "gpio_wk2",
1212 NULL, NULL, NULL, "safe_mode"),
1213 _OMAP4_MUXENTRY(SIM_CD, 3, "sim_cd", NULL, NULL, "gpio_wk3", NULL,
1214 NULL, NULL, "safe_mode"),
1215 _OMAP4_MUXENTRY(SIM_PWRCTRL, 4, "sim_pwrctrl", NULL, NULL, "gpio_wk4",
1216 NULL, NULL, NULL, "safe_mode"),
1217 _OMAP4_MUXENTRY(SR_SCL, 0, "sr_scl", NULL, NULL, NULL, NULL, NULL,
1218 NULL, NULL),
1219 _OMAP4_MUXENTRY(SR_SDA, 0, "sr_sda", NULL, NULL, NULL, NULL, NULL,
1220 NULL, NULL),
1221 _OMAP4_MUXENTRY(FREF_XTAL_IN, 0, "fref_xtal_in", NULL, NULL, NULL,
1222 "c2c_wakereqin", NULL, NULL, NULL),
1223 _OMAP4_MUXENTRY(FREF_SLICER_IN, 0, "fref_slicer_in", NULL, NULL,
1224 "gpi_wk5", "c2c_wakereqin", NULL, NULL, "safe_mode"),
1225 _OMAP4_MUXENTRY(FREF_CLK_IOREQ, 0, "fref_clk_ioreq", NULL, NULL, NULL,
1226 NULL, NULL, NULL, NULL),
1227 _OMAP4_MUXENTRY(FREF_CLK0_OUT, 6, "fref_clk0_out", "fref_clk1_req",
1228 "sys_drm_msecure", "gpio_wk6", NULL, NULL, NULL,
1229 "safe_mode"),
1230 _OMAP4_MUXENTRY(FREF_CLK3_REQ, 30, "fref_clk3_req", "fref_clk1_req",
1231 "sys_drm_msecure", "gpio_wk30", "c2c_wakereqin", NULL,
1232 NULL, "safe_mode"),
1233 _OMAP4_MUXENTRY(FREF_CLK3_OUT, 31, "fref_clk3_out", "fref_clk2_req",
1234 "sys_secure_indicator", "gpio_wk31", "c2c_wakereqout",
1235 NULL, NULL, "safe_mode"),
1236 _OMAP4_MUXENTRY(FREF_CLK4_REQ, 7, "fref_clk4_req", "fref_clk5_out",
1237 NULL, "gpio_wk7", NULL, NULL, NULL, NULL),
1238 _OMAP4_MUXENTRY(FREF_CLK4_OUT, 8, "fref_clk4_out", NULL, NULL,
1239 "gpio_wk8", NULL, NULL, NULL, NULL),
1240 _OMAP4_MUXENTRY(SYS_32K, 0, "sys_32k", NULL, NULL, NULL, NULL, NULL,
1241 NULL, NULL),
1242 _OMAP4_MUXENTRY(SYS_NRESPWRON, 0, "sys_nrespwron", NULL, NULL, NULL,
1243 NULL, NULL, NULL, NULL),
1244 _OMAP4_MUXENTRY(SYS_NRESWARM, 0, "sys_nreswarm", NULL, NULL, NULL,
1245 NULL, NULL, NULL, NULL),
1246 _OMAP4_MUXENTRY(SYS_PWR_REQ, 0, "sys_pwr_req", NULL, NULL, NULL, NULL,
1247 NULL, NULL, NULL),
1248 _OMAP4_MUXENTRY(SYS_PWRON_RESET_OUT, 29, "sys_pwron_reset_out", NULL,
1249 NULL, "gpio_wk29", NULL, NULL, NULL, NULL),
1250 _OMAP4_MUXENTRY(SYS_BOOT6, 9, "sys_boot6", "dpm_emu18", NULL,
1251 "gpio_wk9", "c2c_wakereqout", NULL, NULL,
1252 "safe_mode"),
1253 _OMAP4_MUXENTRY(SYS_BOOT7, 10, "sys_boot7", "dpm_emu19", NULL,
1254 "gpio_wk10", NULL, NULL, NULL, "safe_mode"),
1255 _OMAP4_MUXENTRY(JTAG_NTRST, 0, "jtag_ntrst", NULL, NULL, NULL, NULL,
1256 NULL, NULL, NULL),
1257 _OMAP4_MUXENTRY(JTAG_TCK, 0, "jtag_tck", NULL, NULL, NULL, NULL, NULL,
1258 NULL, "safe_mode"),
1259 _OMAP4_MUXENTRY(JTAG_RTCK, 0, "jtag_rtck", NULL, NULL, NULL, NULL,
1260 NULL, NULL, NULL),
1261 _OMAP4_MUXENTRY(JTAG_TMS_TMSC, 0, "jtag_tms_tmsc", NULL, NULL, NULL,
1262 NULL, NULL, NULL, "safe_mode"),
1263 _OMAP4_MUXENTRY(JTAG_TDI, 0, "jtag_tdi", NULL, NULL, NULL, NULL, NULL,
1264 NULL, NULL),
1265 _OMAP4_MUXENTRY(JTAG_TDO, 0, "jtag_tdo", NULL, NULL, NULL, NULL, NULL,
1266 NULL, NULL),
1267 { .reg_offset = OMAP_MUX_TERMINATOR },
1268};
1269
1270/*
1271 * Balls for 44XX CBL & CBS package - wakeup partition
1272 * 547-pin CBL ES1.0 S-FPGA-N547, 0.40mm Ball Pitch (Top),
1273 * 0.40mm Ball Pitch (Bottom)
1274 */
1275#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
1276 && defined(CONFIG_OMAP_PACKAGE_CBL)
1277static struct omap_ball __initdata omap4_wkup_cbl_cbs_ball[] = {
1278 _OMAP4_BALLENTRY(SIM_IO, "h4", NULL),
1279 _OMAP4_BALLENTRY(SIM_CLK, "j2", NULL),
1280 _OMAP4_BALLENTRY(SIM_RESET, "g2", NULL),
1281 _OMAP4_BALLENTRY(SIM_CD, "j1", NULL),
1282 _OMAP4_BALLENTRY(SIM_PWRCTRL, "k1", NULL),
1283 _OMAP4_BALLENTRY(SR_SCL, "ag9", NULL),
1284 _OMAP4_BALLENTRY(SR_SDA, "af9", NULL),
1285 _OMAP4_BALLENTRY(FREF_XTAL_IN, "ah6", NULL),
1286 _OMAP4_BALLENTRY(FREF_SLICER_IN, "ag8", NULL),
1287 _OMAP4_BALLENTRY(FREF_CLK_IOREQ, "ad1", NULL),
1288 _OMAP4_BALLENTRY(FREF_CLK0_OUT, "ad2", NULL),
1289 _OMAP4_BALLENTRY(FREF_CLK3_REQ, "ad3", NULL),
1290 _OMAP4_BALLENTRY(FREF_CLK3_OUT, "ad4", NULL),
1291 _OMAP4_BALLENTRY(FREF_CLK4_REQ, "ac2", NULL),
1292 _OMAP4_BALLENTRY(FREF_CLK4_OUT, "ac3", NULL),
1293 _OMAP4_BALLENTRY(SYS_32K, "ag7", NULL),
1294 _OMAP4_BALLENTRY(SYS_NRESPWRON, "ae7", NULL),
1295 _OMAP4_BALLENTRY(SYS_NRESWARM, "af7", NULL),
1296 _OMAP4_BALLENTRY(SYS_PWR_REQ, "ah7", NULL),
1297 _OMAP4_BALLENTRY(SYS_PWRON_RESET_OUT, "ag6", NULL),
1298 _OMAP4_BALLENTRY(SYS_BOOT6, "af8", NULL),
1299 _OMAP4_BALLENTRY(SYS_BOOT7, "ae8", NULL),
1300 _OMAP4_BALLENTRY(JTAG_NTRST, "ah2", NULL),
1301 _OMAP4_BALLENTRY(JTAG_TCK, "ag1", NULL),
1302 _OMAP4_BALLENTRY(JTAG_RTCK, "ae3", NULL),
1303 _OMAP4_BALLENTRY(JTAG_TMS_TMSC, "ah1", NULL),
1304 _OMAP4_BALLENTRY(JTAG_TDI, "ae1", NULL),
1305 _OMAP4_BALLENTRY(JTAG_TDO, "ae2", NULL),
1306 { .reg_offset = OMAP_MUX_TERMINATOR },
1307};
1308#else
1309#define omap4_wkup_cbl_cbs_ball NULL
1310#endif
1311
1312int __init omap4_mux_init(struct omap_board_mux *board_subset,
1313 struct omap_board_mux *board_wkup_subset, int flags)
1314{
1315 struct omap_ball *package_balls_core;
1316 struct omap_ball *package_balls_wkup = omap4_wkup_cbl_cbs_ball;
1317 struct omap_mux *core_muxmodes;
1318 struct omap_mux *core_subset = NULL;
1319 int ret;
1320
1321 switch (flags & OMAP_PACKAGE_MASK) {
1322 case OMAP_PACKAGE_CBL:
1323 pr_debug("%s: OMAP4430 ES1.0 -> OMAP_PACKAGE_CBL\n", __func__);
1324 package_balls_core = omap4_core_cbl_ball;
1325 core_muxmodes = omap4_core_muxmodes;
1326 break;
1327 case OMAP_PACKAGE_CBS:
1328 pr_debug("%s: OMAP4430 ES2.X -> OMAP_PACKAGE_CBS\n", __func__);
1329 package_balls_core = omap4_core_cbs_ball;
1330 core_muxmodes = omap4_core_muxmodes;
1331 core_subset = omap4_es2_core_subset;
1332 break;
1333 default:
1334 pr_err("%s: Unknown omap package, mux disabled\n", __func__);
1335 return -EINVAL;
1336 }
1337
1338 ret = omap_mux_init("core",
1339 OMAP_MUX_GPIO_IN_MODE3,
1340 OMAP4_CTRL_MODULE_PAD_CORE_MUX_PBASE,
1341 OMAP4_CTRL_MODULE_PAD_CORE_MUX_SIZE,
1342 core_muxmodes, core_subset, board_subset,
1343 package_balls_core);
1344 if (ret)
1345 return ret;
1346
1347 ret = omap_mux_init("wkup",
1348 OMAP_MUX_GPIO_IN_MODE3,
1349 OMAP4_CTRL_MODULE_PAD_WKUP_MUX_PBASE,
1350 OMAP4_CTRL_MODULE_PAD_WKUP_MUX_SIZE,
1351 omap4_wkup_muxmodes, NULL, board_wkup_subset,
1352 package_balls_wkup);
1353
1354 return ret;
1355}
1356
diff --git a/arch/arm/mach-omap2/mux44xx.h b/arch/arm/mach-omap2/mux44xx.h
deleted file mode 100644
index c635026cd7e9..000000000000
--- a/arch/arm/mach-omap2/mux44xx.h
+++ /dev/null
@@ -1,298 +0,0 @@
1/*
2 * OMAP44xx MUX registers and bitfields
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 *
6 * Benoit Cousson (b-cousson@ti.com)
7 *
8 * This file is automatically generated from the OMAP hardware databases.
9 * We respectfully ask that any modifications to this file be coordinated
10 * with the public linux-omap@vger.kernel.org mailing list and the
11 * authors above to ensure that the autogeneration scripts are kept
12 * up-to-date with the file contents.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#ifndef __ARCH_ARM_MACH_OMAP2_MUX_44XX_H
20#define __ARCH_ARM_MACH_OMAP2_MUX_44XX_H
21
22#define OMAP4_MUX(M0, mux_value) \
23{ \
24 .reg_offset = (OMAP4_CTRL_MODULE_PAD_##M0##_OFFSET), \
25 .value = (mux_value), \
26}
27
28/* ctrl_module_pad_core base address */
29#define OMAP4_CTRL_MODULE_PAD_CORE_MUX_PBASE 0x4a100000
30
31/* ctrl_module_pad_core registers offset */
32#define OMAP4_CTRL_MODULE_PAD_GPMC_AD0_OFFSET 0x0040
33#define OMAP4_CTRL_MODULE_PAD_GPMC_AD1_OFFSET 0x0042
34#define OMAP4_CTRL_MODULE_PAD_GPMC_AD2_OFFSET 0x0044
35#define OMAP4_CTRL_MODULE_PAD_GPMC_AD3_OFFSET 0x0046
36#define OMAP4_CTRL_MODULE_PAD_GPMC_AD4_OFFSET 0x0048
37#define OMAP4_CTRL_MODULE_PAD_GPMC_AD5_OFFSET 0x004a
38#define OMAP4_CTRL_MODULE_PAD_GPMC_AD6_OFFSET 0x004c
39#define OMAP4_CTRL_MODULE_PAD_GPMC_AD7_OFFSET 0x004e
40#define OMAP4_CTRL_MODULE_PAD_GPMC_AD8_OFFSET 0x0050
41#define OMAP4_CTRL_MODULE_PAD_GPMC_AD9_OFFSET 0x0052
42#define OMAP4_CTRL_MODULE_PAD_GPMC_AD10_OFFSET 0x0054
43#define OMAP4_CTRL_MODULE_PAD_GPMC_AD11_OFFSET 0x0056
44#define OMAP4_CTRL_MODULE_PAD_GPMC_AD12_OFFSET 0x0058
45#define OMAP4_CTRL_MODULE_PAD_GPMC_AD13_OFFSET 0x005a
46#define OMAP4_CTRL_MODULE_PAD_GPMC_AD14_OFFSET 0x005c
47#define OMAP4_CTRL_MODULE_PAD_GPMC_AD15_OFFSET 0x005e
48#define OMAP4_CTRL_MODULE_PAD_GPMC_A16_OFFSET 0x0060
49#define OMAP4_CTRL_MODULE_PAD_GPMC_A17_OFFSET 0x0062
50#define OMAP4_CTRL_MODULE_PAD_GPMC_A18_OFFSET 0x0064
51#define OMAP4_CTRL_MODULE_PAD_GPMC_A19_OFFSET 0x0066
52#define OMAP4_CTRL_MODULE_PAD_GPMC_A20_OFFSET 0x0068
53#define OMAP4_CTRL_MODULE_PAD_GPMC_A21_OFFSET 0x006a
54#define OMAP4_CTRL_MODULE_PAD_GPMC_A22_OFFSET 0x006c
55#define OMAP4_CTRL_MODULE_PAD_GPMC_A23_OFFSET 0x006e
56#define OMAP4_CTRL_MODULE_PAD_GPMC_A24_OFFSET 0x0070
57#define OMAP4_CTRL_MODULE_PAD_GPMC_A25_OFFSET 0x0072
58#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS0_OFFSET 0x0074
59#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS1_OFFSET 0x0076
60#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS2_OFFSET 0x0078
61#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS3_OFFSET 0x007a
62#define OMAP4_CTRL_MODULE_PAD_GPMC_NWP_OFFSET 0x007c
63#define OMAP4_CTRL_MODULE_PAD_GPMC_CLK_OFFSET 0x007e
64#define OMAP4_CTRL_MODULE_PAD_GPMC_NADV_ALE_OFFSET 0x0080
65#define OMAP4_CTRL_MODULE_PAD_GPMC_NOE_OFFSET 0x0082
66#define OMAP4_CTRL_MODULE_PAD_GPMC_NWE_OFFSET 0x0084
67#define OMAP4_CTRL_MODULE_PAD_GPMC_NBE0_CLE_OFFSET 0x0086
68#define OMAP4_CTRL_MODULE_PAD_GPMC_NBE1_OFFSET 0x0088
69#define OMAP4_CTRL_MODULE_PAD_GPMC_WAIT0_OFFSET 0x008a
70#define OMAP4_CTRL_MODULE_PAD_GPMC_WAIT1_OFFSET 0x008c
71#define OMAP4_CTRL_MODULE_PAD_C2C_DATA11_OFFSET 0x008e
72#define OMAP4_CTRL_MODULE_PAD_C2C_DATA12_OFFSET 0x0090
73#define OMAP4_CTRL_MODULE_PAD_C2C_DATA13_OFFSET 0x0092
74#define OMAP4_CTRL_MODULE_PAD_C2C_DATA14_OFFSET 0x0094
75#define OMAP4_CTRL_MODULE_PAD_C2C_DATA15_OFFSET 0x0096
76#define OMAP4_CTRL_MODULE_PAD_HDMI_HPD_OFFSET 0x0098
77#define OMAP4_CTRL_MODULE_PAD_HDMI_CEC_OFFSET 0x009a
78#define OMAP4_CTRL_MODULE_PAD_HDMI_DDC_SCL_OFFSET 0x009c
79#define OMAP4_CTRL_MODULE_PAD_HDMI_DDC_SDA_OFFSET 0x009e
80#define OMAP4_CTRL_MODULE_PAD_CSI21_DX0_OFFSET 0x00a0
81#define OMAP4_CTRL_MODULE_PAD_CSI21_DY0_OFFSET 0x00a2
82#define OMAP4_CTRL_MODULE_PAD_CSI21_DX1_OFFSET 0x00a4
83#define OMAP4_CTRL_MODULE_PAD_CSI21_DY1_OFFSET 0x00a6
84#define OMAP4_CTRL_MODULE_PAD_CSI21_DX2_OFFSET 0x00a8
85#define OMAP4_CTRL_MODULE_PAD_CSI21_DY2_OFFSET 0x00aa
86#define OMAP4_CTRL_MODULE_PAD_CSI21_DX3_OFFSET 0x00ac
87#define OMAP4_CTRL_MODULE_PAD_CSI21_DY3_OFFSET 0x00ae
88#define OMAP4_CTRL_MODULE_PAD_CSI21_DX4_OFFSET 0x00b0
89#define OMAP4_CTRL_MODULE_PAD_CSI21_DY4_OFFSET 0x00b2
90#define OMAP4_CTRL_MODULE_PAD_CSI22_DX0_OFFSET 0x00b4
91#define OMAP4_CTRL_MODULE_PAD_CSI22_DY0_OFFSET 0x00b6
92#define OMAP4_CTRL_MODULE_PAD_CSI22_DX1_OFFSET 0x00b8
93#define OMAP4_CTRL_MODULE_PAD_CSI22_DY1_OFFSET 0x00ba
94#define OMAP4_CTRL_MODULE_PAD_CAM_SHUTTER_OFFSET 0x00bc
95#define OMAP4_CTRL_MODULE_PAD_CAM_STROBE_OFFSET 0x00be
96#define OMAP4_CTRL_MODULE_PAD_CAM_GLOBALRESET_OFFSET 0x00c0
97#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_CLK_OFFSET 0x00c2
98#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_STP_OFFSET 0x00c4
99#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DIR_OFFSET 0x00c6
100#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_NXT_OFFSET 0x00c8
101#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT0_OFFSET 0x00ca
102#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT1_OFFSET 0x00cc
103#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT2_OFFSET 0x00ce
104#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT3_OFFSET 0x00d0
105#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT4_OFFSET 0x00d2
106#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT5_OFFSET 0x00d4
107#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT6_OFFSET 0x00d6
108#define OMAP4_CTRL_MODULE_PAD_USBB1_ULPITLL_DAT7_OFFSET 0x00d8
109#define OMAP4_CTRL_MODULE_PAD_USBB1_HSIC_DATA_OFFSET 0x00da
110#define OMAP4_CTRL_MODULE_PAD_USBB1_HSIC_STROBE_OFFSET 0x00dc
111#define OMAP4_CTRL_MODULE_PAD_USBC1_ICUSB_DP_OFFSET 0x00de
112#define OMAP4_CTRL_MODULE_PAD_USBC1_ICUSB_DM_OFFSET 0x00e0
113#define OMAP4_CTRL_MODULE_PAD_SDMMC1_CLK_OFFSET 0x00e2
114#define OMAP4_CTRL_MODULE_PAD_SDMMC1_CMD_OFFSET 0x00e4
115#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT0_OFFSET 0x00e6
116#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT1_OFFSET 0x00e8
117#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT2_OFFSET 0x00ea
118#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT3_OFFSET 0x00ec
119#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT4_OFFSET 0x00ee
120#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT5_OFFSET 0x00f0
121#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT6_OFFSET 0x00f2
122#define OMAP4_CTRL_MODULE_PAD_SDMMC1_DAT7_OFFSET 0x00f4
123#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP2_CLKX_OFFSET 0x00f6
124#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP2_DR_OFFSET 0x00f8
125#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP2_DX_OFFSET 0x00fa
126#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP2_FSX_OFFSET 0x00fc
127#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP1_CLKX_OFFSET 0x00fe
128#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP1_DR_OFFSET 0x0100
129#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP1_DX_OFFSET 0x0102
130#define OMAP4_CTRL_MODULE_PAD_ABE_MCBSP1_FSX_OFFSET 0x0104
131#define OMAP4_CTRL_MODULE_PAD_ABE_PDM_UL_DATA_OFFSET 0x0106
132#define OMAP4_CTRL_MODULE_PAD_ABE_PDM_DL_DATA_OFFSET 0x0108
133#define OMAP4_CTRL_MODULE_PAD_ABE_PDM_FRAME_OFFSET 0x010a
134#define OMAP4_CTRL_MODULE_PAD_ABE_PDM_LB_CLK_OFFSET 0x010c
135#define OMAP4_CTRL_MODULE_PAD_ABE_CLKS_OFFSET 0x010e
136#define OMAP4_CTRL_MODULE_PAD_ABE_DMIC_CLK1_OFFSET 0x0110
137#define OMAP4_CTRL_MODULE_PAD_ABE_DMIC_DIN1_OFFSET 0x0112
138#define OMAP4_CTRL_MODULE_PAD_ABE_DMIC_DIN2_OFFSET 0x0114
139#define OMAP4_CTRL_MODULE_PAD_ABE_DMIC_DIN3_OFFSET 0x0116
140#define OMAP4_CTRL_MODULE_PAD_UART2_CTS_OFFSET 0x0118
141#define OMAP4_CTRL_MODULE_PAD_UART2_RTS_OFFSET 0x011a
142#define OMAP4_CTRL_MODULE_PAD_UART2_RX_OFFSET 0x011c
143#define OMAP4_CTRL_MODULE_PAD_UART2_TX_OFFSET 0x011e
144#define OMAP4_CTRL_MODULE_PAD_HDQ_SIO_OFFSET 0x0120
145#define OMAP4_CTRL_MODULE_PAD_I2C1_SCL_OFFSET 0x0122
146#define OMAP4_CTRL_MODULE_PAD_I2C1_SDA_OFFSET 0x0124
147#define OMAP4_CTRL_MODULE_PAD_I2C2_SCL_OFFSET 0x0126
148#define OMAP4_CTRL_MODULE_PAD_I2C2_SDA_OFFSET 0x0128
149#define OMAP4_CTRL_MODULE_PAD_I2C3_SCL_OFFSET 0x012a
150#define OMAP4_CTRL_MODULE_PAD_I2C3_SDA_OFFSET 0x012c
151#define OMAP4_CTRL_MODULE_PAD_I2C4_SCL_OFFSET 0x012e
152#define OMAP4_CTRL_MODULE_PAD_I2C4_SDA_OFFSET 0x0130
153#define OMAP4_CTRL_MODULE_PAD_MCSPI1_CLK_OFFSET 0x0132
154#define OMAP4_CTRL_MODULE_PAD_MCSPI1_SOMI_OFFSET 0x0134
155#define OMAP4_CTRL_MODULE_PAD_MCSPI1_SIMO_OFFSET 0x0136
156#define OMAP4_CTRL_MODULE_PAD_MCSPI1_CS0_OFFSET 0x0138
157#define OMAP4_CTRL_MODULE_PAD_MCSPI1_CS1_OFFSET 0x013a
158#define OMAP4_CTRL_MODULE_PAD_MCSPI1_CS2_OFFSET 0x013c
159#define OMAP4_CTRL_MODULE_PAD_MCSPI1_CS3_OFFSET 0x013e
160#define OMAP4_CTRL_MODULE_PAD_UART3_CTS_RCTX_OFFSET 0x0140
161#define OMAP4_CTRL_MODULE_PAD_UART3_RTS_SD_OFFSET 0x0142
162#define OMAP4_CTRL_MODULE_PAD_UART3_RX_IRRX_OFFSET 0x0144
163#define OMAP4_CTRL_MODULE_PAD_UART3_TX_IRTX_OFFSET 0x0146
164#define OMAP4_CTRL_MODULE_PAD_SDMMC5_CLK_OFFSET 0x0148
165#define OMAP4_CTRL_MODULE_PAD_SDMMC5_CMD_OFFSET 0x014a
166#define OMAP4_CTRL_MODULE_PAD_SDMMC5_DAT0_OFFSET 0x014c
167#define OMAP4_CTRL_MODULE_PAD_SDMMC5_DAT1_OFFSET 0x014e
168#define OMAP4_CTRL_MODULE_PAD_SDMMC5_DAT2_OFFSET 0x0150
169#define OMAP4_CTRL_MODULE_PAD_SDMMC5_DAT3_OFFSET 0x0152
170#define OMAP4_CTRL_MODULE_PAD_MCSPI4_CLK_OFFSET 0x0154
171#define OMAP4_CTRL_MODULE_PAD_MCSPI4_SIMO_OFFSET 0x0156
172#define OMAP4_CTRL_MODULE_PAD_MCSPI4_SOMI_OFFSET 0x0158
173#define OMAP4_CTRL_MODULE_PAD_MCSPI4_CS0_OFFSET 0x015a
174#define OMAP4_CTRL_MODULE_PAD_UART4_RX_OFFSET 0x015c
175#define OMAP4_CTRL_MODULE_PAD_UART4_TX_OFFSET 0x015e
176#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_CLK_OFFSET 0x0160
177#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_STP_OFFSET 0x0162
178#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DIR_OFFSET 0x0164
179#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_NXT_OFFSET 0x0166
180#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT0_OFFSET 0x0168
181#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT1_OFFSET 0x016a
182#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT2_OFFSET 0x016c
183#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT3_OFFSET 0x016e
184#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT4_OFFSET 0x0170
185#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT5_OFFSET 0x0172
186#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT6_OFFSET 0x0174
187#define OMAP4_CTRL_MODULE_PAD_USBB2_ULPITLL_DAT7_OFFSET 0x0176
188#define OMAP4_CTRL_MODULE_PAD_USBB2_HSIC_DATA_OFFSET 0x0178
189#define OMAP4_CTRL_MODULE_PAD_USBB2_HSIC_STROBE_OFFSET 0x017a
190#define OMAP4_CTRL_MODULE_PAD_UNIPRO_TX0_OFFSET 0x017c
191#define OMAP4_CTRL_MODULE_PAD_UNIPRO_TY0_OFFSET 0x017e
192#define OMAP4_CTRL_MODULE_PAD_UNIPRO_TX1_OFFSET 0x0180
193#define OMAP4_CTRL_MODULE_PAD_UNIPRO_TY1_OFFSET 0x0182
194#define OMAP4_CTRL_MODULE_PAD_UNIPRO_TX2_OFFSET 0x0184
195#define OMAP4_CTRL_MODULE_PAD_UNIPRO_TY2_OFFSET 0x0186
196#define OMAP4_CTRL_MODULE_PAD_UNIPRO_RX0_OFFSET 0x0188
197#define OMAP4_CTRL_MODULE_PAD_UNIPRO_RY0_OFFSET 0x018a
198#define OMAP4_CTRL_MODULE_PAD_UNIPRO_RX1_OFFSET 0x018c
199#define OMAP4_CTRL_MODULE_PAD_UNIPRO_RY1_OFFSET 0x018e
200#define OMAP4_CTRL_MODULE_PAD_UNIPRO_RX2_OFFSET 0x0190
201#define OMAP4_CTRL_MODULE_PAD_UNIPRO_RY2_OFFSET 0x0192
202#define OMAP4_CTRL_MODULE_PAD_USBA0_OTG_CE_OFFSET 0x0194
203#define OMAP4_CTRL_MODULE_PAD_USBA0_OTG_DP_OFFSET 0x0196
204#define OMAP4_CTRL_MODULE_PAD_USBA0_OTG_DM_OFFSET 0x0198
205#define OMAP4_CTRL_MODULE_PAD_FREF_CLK1_OUT_OFFSET 0x019a
206#define OMAP4_CTRL_MODULE_PAD_FREF_CLK2_OUT_OFFSET 0x019c
207#define OMAP4_CTRL_MODULE_PAD_SYS_NIRQ1_OFFSET 0x019e
208#define OMAP4_CTRL_MODULE_PAD_SYS_NIRQ2_OFFSET 0x01a0
209#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT0_OFFSET 0x01a2
210#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT1_OFFSET 0x01a4
211#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT2_OFFSET 0x01a6
212#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT3_OFFSET 0x01a8
213#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT4_OFFSET 0x01aa
214#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT5_OFFSET 0x01ac
215#define OMAP4_CTRL_MODULE_PAD_DPM_EMU0_OFFSET 0x01ae
216#define OMAP4_CTRL_MODULE_PAD_DPM_EMU1_OFFSET 0x01b0
217#define OMAP4_CTRL_MODULE_PAD_DPM_EMU2_OFFSET 0x01b2
218#define OMAP4_CTRL_MODULE_PAD_DPM_EMU3_OFFSET 0x01b4
219#define OMAP4_CTRL_MODULE_PAD_DPM_EMU4_OFFSET 0x01b6
220#define OMAP4_CTRL_MODULE_PAD_DPM_EMU5_OFFSET 0x01b8
221#define OMAP4_CTRL_MODULE_PAD_DPM_EMU6_OFFSET 0x01ba
222#define OMAP4_CTRL_MODULE_PAD_DPM_EMU7_OFFSET 0x01bc
223#define OMAP4_CTRL_MODULE_PAD_DPM_EMU8_OFFSET 0x01be
224#define OMAP4_CTRL_MODULE_PAD_DPM_EMU9_OFFSET 0x01c0
225#define OMAP4_CTRL_MODULE_PAD_DPM_EMU10_OFFSET 0x01c2
226#define OMAP4_CTRL_MODULE_PAD_DPM_EMU11_OFFSET 0x01c4
227#define OMAP4_CTRL_MODULE_PAD_DPM_EMU12_OFFSET 0x01c6
228#define OMAP4_CTRL_MODULE_PAD_DPM_EMU13_OFFSET 0x01c8
229#define OMAP4_CTRL_MODULE_PAD_DPM_EMU14_OFFSET 0x01ca
230#define OMAP4_CTRL_MODULE_PAD_DPM_EMU15_OFFSET 0x01cc
231#define OMAP4_CTRL_MODULE_PAD_DPM_EMU16_OFFSET 0x01ce
232#define OMAP4_CTRL_MODULE_PAD_DPM_EMU17_OFFSET 0x01d0
233#define OMAP4_CTRL_MODULE_PAD_DPM_EMU18_OFFSET 0x01d2
234#define OMAP4_CTRL_MODULE_PAD_DPM_EMU19_OFFSET 0x01d4
235
236/* ES2.0 only */
237#define OMAP4_CTRL_MODULE_PAD_GPMC_WAIT2_OFFSET 0x008e
238#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS4_OFFSET 0x0090
239#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS5_OFFSET 0x0092
240#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS6_OFFSET 0x0094
241#define OMAP4_CTRL_MODULE_PAD_GPMC_NCS7_OFFSET 0x0096
242
243#define OMAP4_CTRL_MODULE_PAD_KPD_COL3_OFFSET 0x017c
244#define OMAP4_CTRL_MODULE_PAD_KPD_COL4_OFFSET 0x017e
245#define OMAP4_CTRL_MODULE_PAD_KPD_COL5_OFFSET 0x0180
246#define OMAP4_CTRL_MODULE_PAD_KPD_COL0_OFFSET 0x0182
247#define OMAP4_CTRL_MODULE_PAD_KPD_COL1_OFFSET 0x0184
248#define OMAP4_CTRL_MODULE_PAD_KPD_COL2_OFFSET 0x0186
249#define OMAP4_CTRL_MODULE_PAD_KPD_ROW3_OFFSET 0x0188
250#define OMAP4_CTRL_MODULE_PAD_KPD_ROW4_OFFSET 0x018a
251#define OMAP4_CTRL_MODULE_PAD_KPD_ROW5_OFFSET 0x018c
252#define OMAP4_CTRL_MODULE_PAD_KPD_ROW0_OFFSET 0x018e
253#define OMAP4_CTRL_MODULE_PAD_KPD_ROW1_OFFSET 0x0190
254#define OMAP4_CTRL_MODULE_PAD_KPD_ROW2_OFFSET 0x0192
255
256
257#define OMAP4_CTRL_MODULE_PAD_CORE_MUX_SIZE \
258 (OMAP4_CTRL_MODULE_PAD_DPM_EMU19_OFFSET \
259 - OMAP4_CTRL_MODULE_PAD_GPMC_AD0_OFFSET + 2)
260
261/* ctrl_module_pad_wkup base address */
262#define OMAP4_CTRL_MODULE_PAD_WKUP_MUX_PBASE 0x4a31e000
263
264/* ctrl_module_pad_wkup registers offset */
265#define OMAP4_CTRL_MODULE_PAD_SIM_IO_OFFSET 0x0040
266#define OMAP4_CTRL_MODULE_PAD_SIM_CLK_OFFSET 0x0042
267#define OMAP4_CTRL_MODULE_PAD_SIM_RESET_OFFSET 0x0044
268#define OMAP4_CTRL_MODULE_PAD_SIM_CD_OFFSET 0x0046
269#define OMAP4_CTRL_MODULE_PAD_SIM_PWRCTRL_OFFSET 0x0048
270#define OMAP4_CTRL_MODULE_PAD_SR_SCL_OFFSET 0x004a
271#define OMAP4_CTRL_MODULE_PAD_SR_SDA_OFFSET 0x004c
272#define OMAP4_CTRL_MODULE_PAD_FREF_XTAL_IN_OFFSET 0x004e
273#define OMAP4_CTRL_MODULE_PAD_FREF_SLICER_IN_OFFSET 0x0050
274#define OMAP4_CTRL_MODULE_PAD_FREF_CLK_IOREQ_OFFSET 0x0052
275#define OMAP4_CTRL_MODULE_PAD_FREF_CLK0_OUT_OFFSET 0x0054
276#define OMAP4_CTRL_MODULE_PAD_FREF_CLK3_REQ_OFFSET 0x0056
277#define OMAP4_CTRL_MODULE_PAD_FREF_CLK3_OUT_OFFSET 0x0058
278#define OMAP4_CTRL_MODULE_PAD_FREF_CLK4_REQ_OFFSET 0x005a
279#define OMAP4_CTRL_MODULE_PAD_FREF_CLK4_OUT_OFFSET 0x005c
280#define OMAP4_CTRL_MODULE_PAD_SYS_32K_OFFSET 0x005e
281#define OMAP4_CTRL_MODULE_PAD_SYS_NRESPWRON_OFFSET 0x0060
282#define OMAP4_CTRL_MODULE_PAD_SYS_NRESWARM_OFFSET 0x0062
283#define OMAP4_CTRL_MODULE_PAD_SYS_PWR_REQ_OFFSET 0x0064
284#define OMAP4_CTRL_MODULE_PAD_SYS_PWRON_RESET_OUT_OFFSET 0x0066
285#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT6_OFFSET 0x0068
286#define OMAP4_CTRL_MODULE_PAD_SYS_BOOT7_OFFSET 0x006a
287#define OMAP4_CTRL_MODULE_PAD_JTAG_NTRST_OFFSET 0x006c
288#define OMAP4_CTRL_MODULE_PAD_JTAG_TCK_OFFSET 0x006e
289#define OMAP4_CTRL_MODULE_PAD_JTAG_RTCK_OFFSET 0x0070
290#define OMAP4_CTRL_MODULE_PAD_JTAG_TMS_TMSC_OFFSET 0x0072
291#define OMAP4_CTRL_MODULE_PAD_JTAG_TDI_OFFSET 0x0074
292#define OMAP4_CTRL_MODULE_PAD_JTAG_TDO_OFFSET 0x0076
293
294#define OMAP4_CTRL_MODULE_PAD_WKUP_MUX_SIZE \
295 (OMAP4_CTRL_MODULE_PAD_JTAG_TDO_OFFSET \
296 - OMAP4_CTRL_MODULE_PAD_SIM_IO_OFFSET + 2)
297
298#endif
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 0ea09faf327b..4ea308114165 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -49,7 +49,7 @@ END(omap5_secondary_startup)
49 * The primary core will update this flag using a hardware 49 * The primary core will update this flag using a hardware
50 * register AuxCoreBoot0. 50 * register AuxCoreBoot0.
51 */ 51 */
52ENTRY(omap_secondary_startup) 52ENTRY(omap4_secondary_startup)
53hold: ldr r12,=0x103 53hold: ldr r12,=0x103
54 dsb 54 dsb
55 smc #0 @ read from AuxCoreBoot0 55 smc #0 @ read from AuxCoreBoot0
@@ -64,9 +64,9 @@ hold: ldr r12,=0x103
64 * should now contain the SVC stack for this core 64 * should now contain the SVC stack for this core
65 */ 65 */
66 b secondary_startup 66 b secondary_startup
67ENDPROC(omap_secondary_startup) 67ENDPROC(omap4_secondary_startup)
68 68
69ENTRY(omap_secondary_startup_4460) 69ENTRY(omap4460_secondary_startup)
70hold_2: ldr r12,=0x103 70hold_2: ldr r12,=0x103
71 dsb 71 dsb
72 smc #0 @ read from AuxCoreBoot0 72 smc #0 @ read from AuxCoreBoot0
@@ -101,4 +101,4 @@ hold_2: ldr r12,=0x103
101 * should now contain the SVC stack for this core 101 * should now contain the SVC stack for this core
102 */ 102 */
103 b secondary_startup 103 b secondary_startup
104ENDPROC(omap_secondary_startup_4460) 104ENDPROC(omap4460_secondary_startup)
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index e80327b6c81f..f993a4188701 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -71,10 +71,43 @@ struct omap4_cpu_pm_info {
71 void (*secondary_startup)(void); 71 void (*secondary_startup)(void);
72}; 72};
73 73
74/**
75 * struct cpu_pm_ops - CPU pm operations
76 * @finish_suspend: CPU suspend finisher function pointer
77 * @resume: CPU resume function pointer
78 * @scu_prepare: CPU Snoop Control program function pointer
79 *
80 * Structure holds functions pointer for CPU low power operations like
81 * suspend, resume and scu programming.
82 */
83struct cpu_pm_ops {
84 int (*finish_suspend)(unsigned long cpu_state);
85 void (*resume)(void);
86 void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state);
87};
88
74static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); 89static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
75static struct powerdomain *mpuss_pd; 90static struct powerdomain *mpuss_pd;
76static void __iomem *sar_base; 91static void __iomem *sar_base;
77 92
93static int default_finish_suspend(unsigned long cpu_state)
94{
95 omap_do_wfi();
96 return 0;
97}
98
99static void dummy_cpu_resume(void)
100{}
101
102static void dummy_scu_prepare(unsigned int cpu_id, unsigned int cpu_state)
103{}
104
105struct cpu_pm_ops omap_pm_ops = {
106 .finish_suspend = default_finish_suspend,
107 .resume = dummy_cpu_resume,
108 .scu_prepare = dummy_scu_prepare,
109};
110
78/* 111/*
79 * Program the wakeup routine address for the CPU0 and CPU1 112 * Program the wakeup routine address for the CPU0 and CPU1
80 * used for OFF or DORMANT wakeup. 113 * used for OFF or DORMANT wakeup.
@@ -158,11 +191,12 @@ static void save_l2x0_context(void)
158{ 191{
159 u32 val; 192 u32 val;
160 void __iomem *l2x0_base = omap4_get_l2cache_base(); 193 void __iomem *l2x0_base = omap4_get_l2cache_base();
161 194 if (l2x0_base) {
162 val = __raw_readl(l2x0_base + L2X0_AUX_CTRL); 195 val = __raw_readl(l2x0_base + L2X0_AUX_CTRL);
163 __raw_writel(val, sar_base + L2X0_AUXCTRL_OFFSET); 196 __raw_writel(val, sar_base + L2X0_AUXCTRL_OFFSET);
164 val = __raw_readl(l2x0_base + L2X0_PREFETCH_CTRL); 197 val = __raw_readl(l2x0_base + L2X0_PREFETCH_CTRL);
165 __raw_writel(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET); 198 __raw_writel(val, sar_base + L2X0_PREFETCH_CTRL_OFFSET);
199 }
166} 200}
167#else 201#else
168static void save_l2x0_context(void) 202static void save_l2x0_context(void)
@@ -225,14 +259,17 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
225 259
226 cpu_clear_prev_logic_pwrst(cpu); 260 cpu_clear_prev_logic_pwrst(cpu);
227 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); 261 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
228 set_cpu_wakeup_addr(cpu, virt_to_phys(omap4_cpu_resume)); 262 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume));
229 scu_pwrst_prepare(cpu, power_state); 263 omap_pm_ops.scu_prepare(cpu, power_state);
230 l2x0_pwrst_prepare(cpu, save_state); 264 l2x0_pwrst_prepare(cpu, save_state);
231 265
232 /* 266 /*
233 * Call low level function with targeted low power state. 267 * Call low level function with targeted low power state.
234 */ 268 */
235 cpu_suspend(save_state, omap4_finish_suspend); 269 if (save_state)
270 cpu_suspend(save_state, omap_pm_ops.finish_suspend);
271 else
272 omap_pm_ops.finish_suspend(save_state);
236 273
237 /* 274 /*
238 * Restore the CPUx power state to ON otherwise CPUx 275 * Restore the CPUx power state to ON otherwise CPUx
@@ -268,14 +305,14 @@ int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
268 pwrdm_clear_all_prev_pwrst(pm_info->pwrdm); 305 pwrdm_clear_all_prev_pwrst(pm_info->pwrdm);
269 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); 306 pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
270 set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup)); 307 set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup));
271 scu_pwrst_prepare(cpu, power_state); 308 omap_pm_ops.scu_prepare(cpu, power_state);
272 309
273 /* 310 /*
274 * CPU never retuns back if targeted power state is OFF mode. 311 * CPU never retuns back if targeted power state is OFF mode.
275 * CPU ONLINE follows normal CPU ONLINE ptah via 312 * CPU ONLINE follows normal CPU ONLINE ptah via
276 * omap_secondary_startup(). 313 * omap4_secondary_startup().
277 */ 314 */
278 omap4_finish_suspend(cpu_state); 315 omap_pm_ops.finish_suspend(cpu_state);
279 316
280 pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON); 317 pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
281 return 0; 318 return 0;
@@ -319,9 +356,9 @@ int __init omap4_mpuss_init(void)
319 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 356 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
320 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; 357 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
321 if (cpu_is_omap446x()) 358 if (cpu_is_omap446x())
322 pm_info->secondary_startup = omap_secondary_startup_4460; 359 pm_info->secondary_startup = omap4460_secondary_startup;
323 else 360 else
324 pm_info->secondary_startup = omap_secondary_startup; 361 pm_info->secondary_startup = omap4_secondary_startup;
325 362
326 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); 363 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm");
327 if (!pm_info->pwrdm) { 364 if (!pm_info->pwrdm) {
@@ -352,6 +389,12 @@ int __init omap4_mpuss_init(void)
352 389
353 save_l2x0_context(); 390 save_l2x0_context();
354 391
392 if (cpu_is_omap44xx()) {
393 omap_pm_ops.finish_suspend = omap4_finish_suspend;
394 omap_pm_ops.resume = omap4_cpu_resume;
395 omap_pm_ops.scu_prepare = scu_pwrst_prepare;
396 }
397
355 return 0; 398 return 0;
356} 399}
357 400
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 2a551f997aea..98a11463a843 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -87,7 +87,7 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
87 87
88 /* 88 /*
89 * Update the AuxCoreBoot0 with boot state for secondary core. 89 * Update the AuxCoreBoot0 with boot state for secondary core.
90 * omap_secondary_startup() routine will hold the secondary core till 90 * omap4_secondary_startup() routine will hold the secondary core till
91 * the AuxCoreBoot1 register is updated with cpu state 91 * the AuxCoreBoot1 register is updated with cpu state
92 * A barrier is added to ensure that write buffer is drained 92 * A barrier is added to ensure that write buffer is drained
93 */ 93 */
@@ -200,7 +200,7 @@ static void __init omap4_smp_init_cpus(void)
200 200
201static void __init omap4_smp_prepare_cpus(unsigned int max_cpus) 201static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
202{ 202{
203 void *startup_addr = omap_secondary_startup; 203 void *startup_addr = omap4_secondary_startup;
204 void __iomem *base = omap_get_wakeupgen_base(); 204 void __iomem *base = omap_get_wakeupgen_base();
205 205
206 /* 206 /*
@@ -211,7 +211,7 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
211 scu_enable(scu_base); 211 scu_enable(scu_base);
212 212
213 if (cpu_is_omap446x()) { 213 if (cpu_is_omap446x()) {
214 startup_addr = omap_secondary_startup_4460; 214 startup_addr = omap4460_secondary_startup;
215 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD; 215 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
216 } 216 }
217 217
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 13b27ffaf45e..38cd3a69cff3 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -339,19 +339,3 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
339 return 0; 339 return 0;
340} 340}
341#endif 341#endif
342
343/**
344 * omap44xx_restart - trigger a software restart of the SoC
345 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
346 * @cmd: passed from the userspace program rebooting the system (if provided)
347 *
348 * Resets the SoC. For @cmd, see the 'reboot' syscall in
349 * kernel/sys.c. No return value.
350 */
351void omap44xx_restart(char mode, const char *cmd)
352{
353 /* XXX Should save 'cmd' into scratchpad for use after reboot */
354 omap4_prminst_global_warm_sw_reset(); /* never returns */
355 while (1);
356}
357
diff --git a/arch/arm/mach-omap2/omap4-restart.c b/arch/arm/mach-omap2/omap4-restart.c
new file mode 100644
index 000000000000..f90e02e11898
--- /dev/null
+++ b/arch/arm/mach-omap2/omap4-restart.c
@@ -0,0 +1,27 @@
1/*
2 * omap4-restart.c - Common to OMAP4 and OMAP5
3 *
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/types.h>
11#include "prminst44xx.h"
12
13/**
14 * omap44xx_restart - trigger a software restart of the SoC
15 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
16 * @cmd: passed from the userspace program rebooting the system (if provided)
17 *
18 * Resets the SoC. For @cmd, see the 'reboot' syscall in
19 * kernel/sys.c. No return value.
20 */
21void omap44xx_restart(char mode, const char *cmd)
22{
23 /* XXX Should save 'cmd' into scratchpad for use after reboot */
24 omap4_prminst_global_warm_sw_reset(); /* never returns */
25 while (1)
26 ;
27}
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index e6d230700b2b..5cc92874be7e 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -170,9 +170,6 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
170 r->name = dev_name(&pdev->dev); 170 r->name = dev_name(&pdev->dev);
171 } 171 }
172 172
173 if (of_get_property(node, "ti,no_idle_on_suspend", NULL))
174 omap_device_disable_idle_on_suspend(pdev);
175
176 pdev->dev.pm_domain = &omap_device_pm_domain; 173 pdev->dev.pm_domain = &omap_device_pm_domain;
177 174
178odbfd_exit1: 175odbfd_exit1:
@@ -591,11 +588,6 @@ static int _od_runtime_suspend(struct device *dev)
591 return ret; 588 return ret;
592} 589}
593 590
594static int _od_runtime_idle(struct device *dev)
595{
596 return pm_generic_runtime_idle(dev);
597}
598
599static int _od_runtime_resume(struct device *dev) 591static int _od_runtime_resume(struct device *dev)
600{ 592{
601 struct platform_device *pdev = to_platform_device(dev); 593 struct platform_device *pdev = to_platform_device(dev);
@@ -621,8 +613,7 @@ static int _od_suspend_noirq(struct device *dev)
621 613
622 if (!ret && !pm_runtime_status_suspended(dev)) { 614 if (!ret && !pm_runtime_status_suspended(dev)) {
623 if (pm_generic_runtime_suspend(dev) == 0) { 615 if (pm_generic_runtime_suspend(dev) == 0) {
624 if (!(od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND)) 616 omap_device_idle(pdev);
625 omap_device_idle(pdev);
626 od->flags |= OMAP_DEVICE_SUSPENDED; 617 od->flags |= OMAP_DEVICE_SUSPENDED;
627 } 618 }
628 } 619 }
@@ -638,8 +629,7 @@ static int _od_resume_noirq(struct device *dev)
638 if ((od->flags & OMAP_DEVICE_SUSPENDED) && 629 if ((od->flags & OMAP_DEVICE_SUSPENDED) &&
639 !pm_runtime_status_suspended(dev)) { 630 !pm_runtime_status_suspended(dev)) {
640 od->flags &= ~OMAP_DEVICE_SUSPENDED; 631 od->flags &= ~OMAP_DEVICE_SUSPENDED;
641 if (!(od->flags & OMAP_DEVICE_NO_IDLE_ON_SUSPEND)) 632 omap_device_enable(pdev);
642 omap_device_enable(pdev);
643 pm_generic_runtime_resume(dev); 633 pm_generic_runtime_resume(dev);
644 } 634 }
645 635
@@ -653,7 +643,7 @@ static int _od_resume_noirq(struct device *dev)
653struct dev_pm_domain omap_device_pm_domain = { 643struct dev_pm_domain omap_device_pm_domain = {
654 .ops = { 644 .ops = {
655 SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume, 645 SET_RUNTIME_PM_OPS(_od_runtime_suspend, _od_runtime_resume,
656 _od_runtime_idle) 646 NULL)
657 USE_PLATFORM_PM_SLEEP_OPS 647 USE_PLATFORM_PM_SLEEP_OPS
658 .suspend_noirq = _od_suspend_noirq, 648 .suspend_noirq = _od_suspend_noirq,
659 .resume_noirq = _od_resume_noirq, 649 .resume_noirq = _od_resume_noirq,
diff --git a/arch/arm/mach-omap2/omap_device.h b/arch/arm/mach-omap2/omap_device.h
index 044c31d50e5b..17ca1aec2710 100644
--- a/arch/arm/mach-omap2/omap_device.h
+++ b/arch/arm/mach-omap2/omap_device.h
@@ -38,7 +38,6 @@ extern struct dev_pm_domain omap_device_pm_domain;
38 38
39/* omap_device.flags values */ 39/* omap_device.flags values */
40#define OMAP_DEVICE_SUSPENDED BIT(0) 40#define OMAP_DEVICE_SUSPENDED BIT(0)
41#define OMAP_DEVICE_NO_IDLE_ON_SUSPEND BIT(1)
42 41
43/** 42/**
44 * struct omap_device - omap_device wrapper for platform_devices 43 * struct omap_device - omap_device wrapper for platform_devices
@@ -101,13 +100,4 @@ static inline struct omap_device *to_omap_device(struct platform_device *pdev)
101{ 100{
102 return pdev ? pdev->archdata.od : NULL; 101 return pdev ? pdev->archdata.od : NULL;
103} 102}
104
105static inline
106void omap_device_disable_idle_on_suspend(struct platform_device *pdev)
107{
108 struct omap_device *od = to_omap_device(pdev);
109
110 od->flags |= OMAP_DEVICE_NO_IDLE_ON_SUSPEND;
111}
112
113#endif 103#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 0c898f58ac9b..aab33fd814c0 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -699,6 +699,7 @@ extern int omap2420_hwmod_init(void);
699extern int omap2430_hwmod_init(void); 699extern int omap2430_hwmod_init(void);
700extern int omap3xxx_hwmod_init(void); 700extern int omap3xxx_hwmod_init(void);
701extern int omap44xx_hwmod_init(void); 701extern int omap44xx_hwmod_init(void);
702extern int omap54xx_hwmod_init(void);
702extern int am33xx_hwmod_init(void); 703extern int am33xx_hwmod_init(void);
703 704
704extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois); 705extern int __init omap_hwmod_register_links(struct omap_hwmod_ocp_if **ois);
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 5137cc84b504..d8b9d60f854f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -16,6 +16,7 @@
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>
19#include <plat/dmtimer.h> 20#include <plat/dmtimer.h>
20 21
21#include "omap_hwmod.h" 22#include "omap_hwmod.h"
@@ -166,6 +167,18 @@ static struct omap_hwmod omap2420_dma_system_hwmod = {
166}; 167};
167 168
168/* mailbox */ 169/* mailbox */
170static struct omap_mbox_dev_info omap2420_mailbox_info[] = {
171 { .name = "dsp", .tx_id = 0, .rx_id = 1, .irq_id = 0, .usr_id = 0 },
172 { .name = "iva", .tx_id = 2, .rx_id = 3, .irq_id = 1, .usr_id = 3 },
173};
174
175static struct omap_mbox_pdata omap2420_mailbox_attrs = {
176 .num_users = 4,
177 .num_fifos = 6,
178 .info_cnt = ARRAY_SIZE(omap2420_mailbox_info),
179 .info = omap2420_mailbox_info,
180};
181
169static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = { 182static struct omap_hwmod_irq_info omap2420_mailbox_irqs[] = {
170 { .name = "dsp", .irq = 26 + OMAP_INTC_START, }, 183 { .name = "dsp", .irq = 26 + OMAP_INTC_START, },
171 { .name = "iva", .irq = 34 + OMAP_INTC_START, }, 184 { .name = "iva", .irq = 34 + OMAP_INTC_START, },
@@ -186,6 +199,7 @@ static struct omap_hwmod omap2420_mailbox_hwmod = {
186 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT, 199 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
187 }, 200 },
188 }, 201 },
202 .dev_attr = &omap2420_mailbox_attrs,
189}; 203};
190 204
191/* 205/*
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index 4ce999ee3ee9..5b9083461dc5 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -17,6 +17,7 @@
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>
20#include <plat/dmtimer.h> 21#include <plat/dmtimer.h>
21 22
22#include "omap_hwmod.h" 23#include "omap_hwmod.h"
@@ -170,6 +171,17 @@ static struct omap_hwmod omap2430_dma_system_hwmod = {
170}; 171};
171 172
172/* mailbox */ 173/* mailbox */
174static struct omap_mbox_dev_info omap2430_mailbox_info[] = {
175 { .name = "dsp", .tx_id = 0, .rx_id = 1 },
176};
177
178static struct omap_mbox_pdata omap2430_mailbox_attrs = {
179 .num_users = 4,
180 .num_fifos = 6,
181 .info_cnt = ARRAY_SIZE(omap2430_mailbox_info),
182 .info = omap2430_mailbox_info,
183};
184
173static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = { 185static struct omap_hwmod_irq_info omap2430_mailbox_irqs[] = {
174 { .irq = 26 + OMAP_INTC_START, }, 186 { .irq = 26 + OMAP_INTC_START, },
175 { .irq = -1 }, 187 { .irq = -1 },
@@ -189,6 +201,7 @@ static struct omap_hwmod omap2430_mailbox_hwmod = {
189 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT, 201 .idlest_idle_bit = OMAP24XX_ST_MAILBOXES_SHIFT,
190 }, 202 },
191 }, 203 },
204 .dev_attr = &omap2430_mailbox_attrs,
192}; 205};
193 206
194/* mcspi3 */ 207/* mcspi3 */
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 534974e08add..5da7a42a6d90 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
@@ -17,7 +17,6 @@
17#include "hdq1w.h" 17#include "hdq1w.h"
18 18
19#include "omap_hwmod_common_data.h" 19#include "omap_hwmod_common_data.h"
20#include "dma.h"
21 20
22/* UART */ 21/* UART */
23 22
@@ -89,32 +88,32 @@ struct omap_hwmod_class omap2_venc_hwmod_class = {
89 88
90/* Common DMA request line data */ 89/* Common DMA request line data */
91struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[] = { 90struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[] = {
92 { .name = "rx", .dma_req = OMAP24XX_DMA_UART1_RX, }, 91 { .name = "rx", .dma_req = 50, },
93 { .name = "tx", .dma_req = OMAP24XX_DMA_UART1_TX, }, 92 { .name = "tx", .dma_req = 49, },
94 { .dma_req = -1 } 93 { .dma_req = -1 }
95}; 94};
96 95
97struct omap_hwmod_dma_info omap2_uart2_sdma_reqs[] = { 96struct omap_hwmod_dma_info omap2_uart2_sdma_reqs[] = {
98 { .name = "rx", .dma_req = OMAP24XX_DMA_UART2_RX, }, 97 { .name = "rx", .dma_req = 52, },
99 { .name = "tx", .dma_req = OMAP24XX_DMA_UART2_TX, }, 98 { .name = "tx", .dma_req = 51, },
100 { .dma_req = -1 } 99 { .dma_req = -1 }
101}; 100};
102 101
103struct omap_hwmod_dma_info omap2_uart3_sdma_reqs[] = { 102struct omap_hwmod_dma_info omap2_uart3_sdma_reqs[] = {
104 { .name = "rx", .dma_req = OMAP24XX_DMA_UART3_RX, }, 103 { .name = "rx", .dma_req = 54, },
105 { .name = "tx", .dma_req = OMAP24XX_DMA_UART3_TX, }, 104 { .name = "tx", .dma_req = 53, },
106 { .dma_req = -1 } 105 { .dma_req = -1 }
107}; 106};
108 107
109struct omap_hwmod_dma_info omap2_i2c1_sdma_reqs[] = { 108struct omap_hwmod_dma_info omap2_i2c1_sdma_reqs[] = {
110 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C1_TX }, 109 { .name = "tx", .dma_req = 27 },
111 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C1_RX }, 110 { .name = "rx", .dma_req = 28 },
112 { .dma_req = -1 } 111 { .dma_req = -1 }
113}; 112};
114 113
115struct omap_hwmod_dma_info omap2_i2c2_sdma_reqs[] = { 114struct omap_hwmod_dma_info omap2_i2c2_sdma_reqs[] = {
116 { .name = "tx", .dma_req = OMAP24XX_DMA_I2C2_TX }, 115 { .name = "tx", .dma_req = 29 },
117 { .name = "rx", .dma_req = OMAP24XX_DMA_I2C2_RX }, 116 { .name = "rx", .dma_req = 30 },
118 { .dma_req = -1 } 117 { .dma_req = -1 }
119}; 118};
120 119
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 075f7cc51026..28bbd56346a9 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -35,29 +35,6 @@
35 */ 35 */
36 36
37/* 37/*
38 * 'emif_fw' class
39 * instance(s): emif_fw
40 */
41static struct omap_hwmod_class am33xx_emif_fw_hwmod_class = {
42 .name = "emif_fw",
43};
44
45/* emif_fw */
46static struct omap_hwmod am33xx_emif_fw_hwmod = {
47 .name = "emif_fw",
48 .class = &am33xx_emif_fw_hwmod_class,
49 .clkdm_name = "l4fw_clkdm",
50 .main_clk = "l4fw_gclk",
51 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
52 .prcm = {
53 .omap4 = {
54 .clkctrl_offs = AM33XX_CM_PER_EMIF_FW_CLKCTRL_OFFSET,
55 .modulemode = MODULEMODE_SWCTRL,
56 },
57 },
58};
59
60/*
61 * 'emif' class 38 * 'emif' class
62 * instance(s): emif 39 * instance(s): emif
63 */ 40 */
@@ -70,18 +47,12 @@ static struct omap_hwmod_class am33xx_emif_hwmod_class = {
70 .sysc = &am33xx_emif_sysc, 47 .sysc = &am33xx_emif_sysc,
71}; 48};
72 49
73static struct omap_hwmod_irq_info am33xx_emif_irqs[] = {
74 { .name = "ddrerr0", .irq = 101 + OMAP_INTC_START, },
75 { .irq = -1 },
76};
77
78/* emif */ 50/* emif */
79static struct omap_hwmod am33xx_emif_hwmod = { 51static struct omap_hwmod am33xx_emif_hwmod = {
80 .name = "emif", 52 .name = "emif",
81 .class = &am33xx_emif_hwmod_class, 53 .class = &am33xx_emif_hwmod_class,
82 .clkdm_name = "l3_clkdm", 54 .clkdm_name = "l3_clkdm",
83 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 55 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
84 .mpu_irqs = am33xx_emif_irqs,
85 .main_clk = "dpll_ddr_m2_div2_ck", 56 .main_clk = "dpll_ddr_m2_div2_ck",
86 .prcm = { 57 .prcm = {
87 .omap4 = { 58 .omap4 = {
@@ -99,19 +70,11 @@ static struct omap_hwmod_class am33xx_l3_hwmod_class = {
99 .name = "l3", 70 .name = "l3",
100}; 71};
101 72
102/* l3_main (l3_fast) */
103static struct omap_hwmod_irq_info am33xx_l3_main_irqs[] = {
104 { .name = "l3debug", .irq = 9 + OMAP_INTC_START, },
105 { .name = "l3appint", .irq = 10 + OMAP_INTC_START, },
106 { .irq = -1 },
107};
108
109static struct omap_hwmod am33xx_l3_main_hwmod = { 73static struct omap_hwmod am33xx_l3_main_hwmod = {
110 .name = "l3_main", 74 .name = "l3_main",
111 .class = &am33xx_l3_hwmod_class, 75 .class = &am33xx_l3_hwmod_class,
112 .clkdm_name = "l3_clkdm", 76 .clkdm_name = "l3_clkdm",
113 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 77 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
114 .mpu_irqs = am33xx_l3_main_irqs,
115 .main_clk = "l3_gclk", 78 .main_clk = "l3_gclk",
116 .prcm = { 79 .prcm = {
117 .omap4 = { 80 .omap4 = {
@@ -196,20 +159,6 @@ static struct omap_hwmod am33xx_l4_wkup_hwmod = {
196 }, 159 },
197}; 160};
198 161
199/* l4_fw */
200static struct omap_hwmod am33xx_l4_fw_hwmod = {
201 .name = "l4_fw",
202 .class = &am33xx_l4_hwmod_class,
203 .clkdm_name = "l4fw_clkdm",
204 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
205 .prcm = {
206 .omap4 = {
207 .clkctrl_offs = AM33XX_CM_PER_L4FW_CLKCTRL_OFFSET,
208 .modulemode = MODULEMODE_SWCTRL,
209 },
210 },
211};
212
213/* 162/*
214 * 'mpu' class 163 * 'mpu' class
215 */ 164 */
@@ -217,21 +166,11 @@ static struct omap_hwmod_class am33xx_mpu_hwmod_class = {
217 .name = "mpu", 166 .name = "mpu",
218}; 167};
219 168
220/* mpu */
221static struct omap_hwmod_irq_info am33xx_mpu_irqs[] = {
222 { .name = "emuint", .irq = 0 + OMAP_INTC_START, },
223 { .name = "commtx", .irq = 1 + OMAP_INTC_START, },
224 { .name = "commrx", .irq = 2 + OMAP_INTC_START, },
225 { .name = "bench", .irq = 3 + OMAP_INTC_START, },
226 { .irq = -1 },
227};
228
229static struct omap_hwmod am33xx_mpu_hwmod = { 169static struct omap_hwmod am33xx_mpu_hwmod = {
230 .name = "mpu", 170 .name = "mpu",
231 .class = &am33xx_mpu_hwmod_class, 171 .class = &am33xx_mpu_hwmod_class,
232 .clkdm_name = "mpu_clkdm", 172 .clkdm_name = "mpu_clkdm",
233 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 173 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
234 .mpu_irqs = am33xx_mpu_irqs,
235 .main_clk = "dpll_mpu_m2_ck", 174 .main_clk = "dpll_mpu_m2_ck",
236 .prcm = { 175 .prcm = {
237 .omap4 = { 176 .omap4 = {
@@ -253,11 +192,6 @@ static struct omap_hwmod_rst_info am33xx_wkup_m3_resets[] = {
253 { .name = "wkup_m3", .rst_shift = 3, .st_shift = 5 }, 192 { .name = "wkup_m3", .rst_shift = 3, .st_shift = 5 },
254}; 193};
255 194
256static struct omap_hwmod_irq_info am33xx_wkup_m3_irqs[] = {
257 { .name = "txev", .irq = 78 + OMAP_INTC_START, },
258 { .irq = -1 },
259};
260
261/* wkup_m3 */ 195/* wkup_m3 */
262static struct omap_hwmod am33xx_wkup_m3_hwmod = { 196static struct omap_hwmod am33xx_wkup_m3_hwmod = {
263 .name = "wkup_m3", 197 .name = "wkup_m3",
@@ -265,7 +199,6 @@ static struct omap_hwmod am33xx_wkup_m3_hwmod = {
265 .clkdm_name = "l4_wkup_aon_clkdm", 199 .clkdm_name = "l4_wkup_aon_clkdm",
266 /* Keep hardreset asserted */ 200 /* Keep hardreset asserted */
267 .flags = HWMOD_INIT_NO_RESET | HWMOD_NO_IDLEST, 201 .flags = HWMOD_INIT_NO_RESET | HWMOD_NO_IDLEST,
268 .mpu_irqs = am33xx_wkup_m3_irqs,
269 .main_clk = "dpll_core_m4_div2_ck", 202 .main_clk = "dpll_core_m4_div2_ck",
270 .prcm = { 203 .prcm = {
271 .omap4 = { 204 .omap4 = {
@@ -291,25 +224,12 @@ static struct omap_hwmod_rst_info am33xx_pruss_resets[] = {
291 { .name = "pruss", .rst_shift = 1 }, 224 { .name = "pruss", .rst_shift = 1 },
292}; 225};
293 226
294static struct omap_hwmod_irq_info am33xx_pruss_irqs[] = {
295 { .name = "evtout0", .irq = 20 + OMAP_INTC_START, },
296 { .name = "evtout1", .irq = 21 + OMAP_INTC_START, },
297 { .name = "evtout2", .irq = 22 + OMAP_INTC_START, },
298 { .name = "evtout3", .irq = 23 + OMAP_INTC_START, },
299 { .name = "evtout4", .irq = 24 + OMAP_INTC_START, },
300 { .name = "evtout5", .irq = 25 + OMAP_INTC_START, },
301 { .name = "evtout6", .irq = 26 + OMAP_INTC_START, },
302 { .name = "evtout7", .irq = 27 + OMAP_INTC_START, },
303 { .irq = -1 },
304};
305
306/* pru-icss */ 227/* pru-icss */
307/* Pseudo hwmod for reset control purpose only */ 228/* Pseudo hwmod for reset control purpose only */
308static struct omap_hwmod am33xx_pruss_hwmod = { 229static struct omap_hwmod am33xx_pruss_hwmod = {
309 .name = "pruss", 230 .name = "pruss",
310 .class = &am33xx_pruss_hwmod_class, 231 .class = &am33xx_pruss_hwmod_class,
311 .clkdm_name = "pruss_ocp_clkdm", 232 .clkdm_name = "pruss_ocp_clkdm",
312 .mpu_irqs = am33xx_pruss_irqs,
313 .main_clk = "pruss_ocp_gclk", 233 .main_clk = "pruss_ocp_gclk",
314 .prcm = { 234 .prcm = {
315 .omap4 = { 235 .omap4 = {
@@ -329,24 +249,19 @@ static struct omap_hwmod_class am33xx_gfx_hwmod_class = {
329}; 249};
330 250
331static struct omap_hwmod_rst_info am33xx_gfx_resets[] = { 251static struct omap_hwmod_rst_info am33xx_gfx_resets[] = {
332 { .name = "gfx", .rst_shift = 0 }, 252 { .name = "gfx", .rst_shift = 0, .st_shift = 0},
333};
334
335static struct omap_hwmod_irq_info am33xx_gfx_irqs[] = {
336 { .name = "gfxint", .irq = 37 + OMAP_INTC_START, },
337 { .irq = -1 },
338}; 253};
339 254
340static struct omap_hwmod am33xx_gfx_hwmod = { 255static struct omap_hwmod am33xx_gfx_hwmod = {
341 .name = "gfx", 256 .name = "gfx",
342 .class = &am33xx_gfx_hwmod_class, 257 .class = &am33xx_gfx_hwmod_class,
343 .clkdm_name = "gfx_l3_clkdm", 258 .clkdm_name = "gfx_l3_clkdm",
344 .mpu_irqs = am33xx_gfx_irqs,
345 .main_clk = "gfx_fck_div_ck", 259 .main_clk = "gfx_fck_div_ck",
346 .prcm = { 260 .prcm = {
347 .omap4 = { 261 .omap4 = {
348 .clkctrl_offs = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET, 262 .clkctrl_offs = AM33XX_CM_GFX_GFX_CLKCTRL_OFFSET,
349 .rstctrl_offs = AM33XX_RM_GFX_RSTCTRL_OFFSET, 263 .rstctrl_offs = AM33XX_RM_GFX_RSTCTRL_OFFSET,
264 .rstst_offs = AM33XX_RM_GFX_RSTST_OFFSET,
350 .modulemode = MODULEMODE_SWCTRL, 265 .modulemode = MODULEMODE_SWCTRL,
351 }, 266 },
352 }, 267 },
@@ -387,16 +302,10 @@ static struct omap_hwmod_class am33xx_adc_tsc_hwmod_class = {
387 .sysc = &am33xx_adc_tsc_sysc, 302 .sysc = &am33xx_adc_tsc_sysc,
388}; 303};
389 304
390static struct omap_hwmod_irq_info am33xx_adc_tsc_irqs[] = {
391 { .irq = 16 + OMAP_INTC_START, },
392 { .irq = -1 },
393};
394
395static struct omap_hwmod am33xx_adc_tsc_hwmod = { 305static struct omap_hwmod am33xx_adc_tsc_hwmod = {
396 .name = "adc_tsc", 306 .name = "adc_tsc",
397 .class = &am33xx_adc_tsc_hwmod_class, 307 .class = &am33xx_adc_tsc_hwmod_class,
398 .clkdm_name = "l4_wkup_clkdm", 308 .clkdm_name = "l4_wkup_clkdm",
399 .mpu_irqs = am33xx_adc_tsc_irqs,
400 .main_clk = "adc_tsc_fck", 309 .main_clk = "adc_tsc_fck",
401 .prcm = { 310 .prcm = {
402 .omap4 = { 311 .omap4 = {
@@ -515,23 +424,10 @@ static struct omap_hwmod_class am33xx_aes0_hwmod_class = {
515 .sysc = &am33xx_aes0_sysc, 424 .sysc = &am33xx_aes0_sysc,
516}; 425};
517 426
518static struct omap_hwmod_irq_info am33xx_aes0_irqs[] = {
519 { .irq = 103 + OMAP_INTC_START, },
520 { .irq = -1 },
521};
522
523static struct omap_hwmod_dma_info am33xx_aes0_edma_reqs[] = {
524 { .name = "tx", .dma_req = 6, },
525 { .name = "rx", .dma_req = 5, },
526 { .dma_req = -1 }
527};
528
529static struct omap_hwmod am33xx_aes0_hwmod = { 427static struct omap_hwmod am33xx_aes0_hwmod = {
530 .name = "aes", 428 .name = "aes",
531 .class = &am33xx_aes0_hwmod_class, 429 .class = &am33xx_aes0_hwmod_class,
532 .clkdm_name = "l3_clkdm", 430 .clkdm_name = "l3_clkdm",
533 .mpu_irqs = am33xx_aes0_irqs,
534 .sdma_reqs = am33xx_aes0_edma_reqs,
535 .main_clk = "aes0_fck", 431 .main_clk = "aes0_fck",
536 .prcm = { 432 .prcm = {
537 .omap4 = { 433 .omap4 = {
@@ -554,22 +450,10 @@ static struct omap_hwmod_class am33xx_sha0_hwmod_class = {
554 .sysc = &am33xx_sha0_sysc, 450 .sysc = &am33xx_sha0_sysc,
555}; 451};
556 452
557static struct omap_hwmod_irq_info am33xx_sha0_irqs[] = {
558 { .irq = 109 + OMAP_INTC_START, },
559 { .irq = -1 },
560};
561
562static struct omap_hwmod_dma_info am33xx_sha0_edma_reqs[] = {
563 { .name = "rx", .dma_req = 36, },
564 { .dma_req = -1 }
565};
566
567static struct omap_hwmod am33xx_sha0_hwmod = { 453static struct omap_hwmod am33xx_sha0_hwmod = {
568 .name = "sham", 454 .name = "sham",
569 .class = &am33xx_sha0_hwmod_class, 455 .class = &am33xx_sha0_hwmod_class,
570 .clkdm_name = "l3_clkdm", 456 .clkdm_name = "l3_clkdm",
571 .mpu_irqs = am33xx_sha0_irqs,
572 .sdma_reqs = am33xx_sha0_edma_reqs,
573 .main_clk = "l3_gclk", 457 .main_clk = "l3_gclk",
574 .prcm = { 458 .prcm = {
575 .omap4 = { 459 .omap4 = {
@@ -604,16 +488,10 @@ static struct omap_hwmod_class am33xx_smartreflex_hwmod_class = {
604}; 488};
605 489
606/* smartreflex0 */ 490/* smartreflex0 */
607static struct omap_hwmod_irq_info am33xx_smartreflex0_irqs[] = {
608 { .irq = 120 + OMAP_INTC_START, },
609 { .irq = -1 },
610};
611
612static struct omap_hwmod am33xx_smartreflex0_hwmod = { 491static struct omap_hwmod am33xx_smartreflex0_hwmod = {
613 .name = "smartreflex0", 492 .name = "smartreflex0",
614 .class = &am33xx_smartreflex_hwmod_class, 493 .class = &am33xx_smartreflex_hwmod_class,
615 .clkdm_name = "l4_wkup_clkdm", 494 .clkdm_name = "l4_wkup_clkdm",
616 .mpu_irqs = am33xx_smartreflex0_irqs,
617 .main_clk = "smartreflex0_fck", 495 .main_clk = "smartreflex0_fck",
618 .prcm = { 496 .prcm = {
619 .omap4 = { 497 .omap4 = {
@@ -624,16 +502,10 @@ static struct omap_hwmod am33xx_smartreflex0_hwmod = {
624}; 502};
625 503
626/* smartreflex1 */ 504/* smartreflex1 */
627static struct omap_hwmod_irq_info am33xx_smartreflex1_irqs[] = {
628 { .irq = 121 + OMAP_INTC_START, },
629 { .irq = -1 },
630};
631
632static struct omap_hwmod am33xx_smartreflex1_hwmod = { 505static struct omap_hwmod am33xx_smartreflex1_hwmod = {
633 .name = "smartreflex1", 506 .name = "smartreflex1",
634 .class = &am33xx_smartreflex_hwmod_class, 507 .class = &am33xx_smartreflex_hwmod_class,
635 .clkdm_name = "l4_wkup_clkdm", 508 .clkdm_name = "l4_wkup_clkdm",
636 .mpu_irqs = am33xx_smartreflex1_irqs,
637 .main_clk = "smartreflex1_fck", 509 .main_clk = "smartreflex1_fck",
638 .prcm = { 510 .prcm = {
639 .omap4 = { 511 .omap4 = {
@@ -650,17 +522,11 @@ static struct omap_hwmod_class am33xx_control_hwmod_class = {
650 .name = "control", 522 .name = "control",
651}; 523};
652 524
653static struct omap_hwmod_irq_info am33xx_control_irqs[] = {
654 { .irq = 8 + OMAP_INTC_START, },
655 { .irq = -1 },
656};
657
658static struct omap_hwmod am33xx_control_hwmod = { 525static struct omap_hwmod am33xx_control_hwmod = {
659 .name = "control", 526 .name = "control",
660 .class = &am33xx_control_hwmod_class, 527 .class = &am33xx_control_hwmod_class,
661 .clkdm_name = "l4_wkup_clkdm", 528 .clkdm_name = "l4_wkup_clkdm",
662 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 529 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
663 .mpu_irqs = am33xx_control_irqs,
664 .main_clk = "dpll_core_m4_div2_ck", 530 .main_clk = "dpll_core_m4_div2_ck",
665 .prcm = { 531 .prcm = {
666 .omap4 = { 532 .omap4 = {
@@ -690,20 +556,11 @@ static struct omap_hwmod_class am33xx_cpgmac0_hwmod_class = {
690 .sysc = &am33xx_cpgmac_sysc, 556 .sysc = &am33xx_cpgmac_sysc,
691}; 557};
692 558
693static struct omap_hwmod_irq_info am33xx_cpgmac0_irqs[] = {
694 { .name = "c0_rx_thresh_pend", .irq = 40 + OMAP_INTC_START, },
695 { .name = "c0_rx_pend", .irq = 41 + OMAP_INTC_START, },
696 { .name = "c0_tx_pend", .irq = 42 + OMAP_INTC_START, },
697 { .name = "c0_misc_pend", .irq = 43 + OMAP_INTC_START, },
698 { .irq = -1 },
699};
700
701static struct omap_hwmod am33xx_cpgmac0_hwmod = { 559static struct omap_hwmod am33xx_cpgmac0_hwmod = {
702 .name = "cpgmac0", 560 .name = "cpgmac0",
703 .class = &am33xx_cpgmac0_hwmod_class, 561 .class = &am33xx_cpgmac0_hwmod_class,
704 .clkdm_name = "cpsw_125mhz_clkdm", 562 .clkdm_name = "cpsw_125mhz_clkdm",
705 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), 563 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
706 .mpu_irqs = am33xx_cpgmac0_irqs,
707 .main_clk = "cpsw_125mhz_gclk", 564 .main_clk = "cpsw_125mhz_gclk",
708 .prcm = { 565 .prcm = {
709 .omap4 = { 566 .omap4 = {
@@ -735,17 +592,10 @@ static struct omap_hwmod_class am33xx_dcan_hwmod_class = {
735}; 592};
736 593
737/* dcan0 */ 594/* dcan0 */
738static struct omap_hwmod_irq_info am33xx_dcan0_irqs[] = {
739 { .name = "d_can_ms", .irq = 52 + OMAP_INTC_START, },
740 { .name = "d_can_mo", .irq = 53 + OMAP_INTC_START, },
741 { .irq = -1 },
742};
743
744static struct omap_hwmod am33xx_dcan0_hwmod = { 595static struct omap_hwmod am33xx_dcan0_hwmod = {
745 .name = "d_can0", 596 .name = "d_can0",
746 .class = &am33xx_dcan_hwmod_class, 597 .class = &am33xx_dcan_hwmod_class,
747 .clkdm_name = "l4ls_clkdm", 598 .clkdm_name = "l4ls_clkdm",
748 .mpu_irqs = am33xx_dcan0_irqs,
749 .main_clk = "dcan0_fck", 599 .main_clk = "dcan0_fck",
750 .prcm = { 600 .prcm = {
751 .omap4 = { 601 .omap4 = {
@@ -756,16 +606,10 @@ static struct omap_hwmod am33xx_dcan0_hwmod = {
756}; 606};
757 607
758/* dcan1 */ 608/* dcan1 */
759static struct omap_hwmod_irq_info am33xx_dcan1_irqs[] = {
760 { .name = "d_can_ms", .irq = 55 + OMAP_INTC_START, },
761 { .name = "d_can_mo", .irq = 56 + OMAP_INTC_START, },
762 { .irq = -1 },
763};
764static struct omap_hwmod am33xx_dcan1_hwmod = { 609static struct omap_hwmod am33xx_dcan1_hwmod = {
765 .name = "d_can1", 610 .name = "d_can1",
766 .class = &am33xx_dcan_hwmod_class, 611 .class = &am33xx_dcan_hwmod_class,
767 .clkdm_name = "l4ls_clkdm", 612 .clkdm_name = "l4ls_clkdm",
768 .mpu_irqs = am33xx_dcan1_irqs,
769 .main_clk = "dcan1_fck", 613 .main_clk = "dcan1_fck",
770 .prcm = { 614 .prcm = {
771 .omap4 = { 615 .omap4 = {
@@ -792,16 +636,10 @@ static struct omap_hwmod_class am33xx_elm_hwmod_class = {
792 .sysc = &am33xx_elm_sysc, 636 .sysc = &am33xx_elm_sysc,
793}; 637};
794 638
795static struct omap_hwmod_irq_info am33xx_elm_irqs[] = {
796 { .irq = 4 + OMAP_INTC_START, },
797 { .irq = -1 },
798};
799
800static struct omap_hwmod am33xx_elm_hwmod = { 639static struct omap_hwmod am33xx_elm_hwmod = {
801 .name = "elm", 640 .name = "elm",
802 .class = &am33xx_elm_hwmod_class, 641 .class = &am33xx_elm_hwmod_class,
803 .clkdm_name = "l4ls_clkdm", 642 .clkdm_name = "l4ls_clkdm",
804 .mpu_irqs = am33xx_elm_irqs,
805 .main_clk = "l4ls_gclk", 643 .main_clk = "l4ls_gclk",
806 .prcm = { 644 .prcm = {
807 .omap4 = { 645 .omap4 = {
@@ -854,45 +692,26 @@ static struct omap_hwmod am33xx_epwmss0_hwmod = {
854}; 692};
855 693
856/* ecap0 */ 694/* ecap0 */
857static struct omap_hwmod_irq_info am33xx_ecap0_irqs[] = {
858 { .irq = 31 + OMAP_INTC_START, },
859 { .irq = -1 },
860};
861
862static struct omap_hwmod am33xx_ecap0_hwmod = { 695static struct omap_hwmod am33xx_ecap0_hwmod = {
863 .name = "ecap0", 696 .name = "ecap0",
864 .class = &am33xx_ecap_hwmod_class, 697 .class = &am33xx_ecap_hwmod_class,
865 .clkdm_name = "l4ls_clkdm", 698 .clkdm_name = "l4ls_clkdm",
866 .mpu_irqs = am33xx_ecap0_irqs,
867 .main_clk = "l4ls_gclk", 699 .main_clk = "l4ls_gclk",
868}; 700};
869 701
870/* eqep0 */ 702/* eqep0 */
871static struct omap_hwmod_irq_info am33xx_eqep0_irqs[] = {
872 { .irq = 79 + OMAP_INTC_START, },
873 { .irq = -1 },
874};
875
876static struct omap_hwmod am33xx_eqep0_hwmod = { 703static struct omap_hwmod am33xx_eqep0_hwmod = {
877 .name = "eqep0", 704 .name = "eqep0",
878 .class = &am33xx_eqep_hwmod_class, 705 .class = &am33xx_eqep_hwmod_class,
879 .clkdm_name = "l4ls_clkdm", 706 .clkdm_name = "l4ls_clkdm",
880 .mpu_irqs = am33xx_eqep0_irqs,
881 .main_clk = "l4ls_gclk", 707 .main_clk = "l4ls_gclk",
882}; 708};
883 709
884/* ehrpwm0 */ 710/* ehrpwm0 */
885static struct omap_hwmod_irq_info am33xx_ehrpwm0_irqs[] = {
886 { .name = "int", .irq = 86 + OMAP_INTC_START, },
887 { .name = "tzint", .irq = 58 + OMAP_INTC_START, },
888 { .irq = -1 },
889};
890
891static struct omap_hwmod am33xx_ehrpwm0_hwmod = { 711static struct omap_hwmod am33xx_ehrpwm0_hwmod = {
892 .name = "ehrpwm0", 712 .name = "ehrpwm0",
893 .class = &am33xx_ehrpwm_hwmod_class, 713 .class = &am33xx_ehrpwm_hwmod_class,
894 .clkdm_name = "l4ls_clkdm", 714 .clkdm_name = "l4ls_clkdm",
895 .mpu_irqs = am33xx_ehrpwm0_irqs,
896 .main_clk = "l4ls_gclk", 715 .main_clk = "l4ls_gclk",
897}; 716};
898 717
@@ -911,45 +730,26 @@ static struct omap_hwmod am33xx_epwmss1_hwmod = {
911}; 730};
912 731
913/* ecap1 */ 732/* ecap1 */
914static struct omap_hwmod_irq_info am33xx_ecap1_irqs[] = {
915 { .irq = 47 + OMAP_INTC_START, },
916 { .irq = -1 },
917};
918
919static struct omap_hwmod am33xx_ecap1_hwmod = { 733static struct omap_hwmod am33xx_ecap1_hwmod = {
920 .name = "ecap1", 734 .name = "ecap1",
921 .class = &am33xx_ecap_hwmod_class, 735 .class = &am33xx_ecap_hwmod_class,
922 .clkdm_name = "l4ls_clkdm", 736 .clkdm_name = "l4ls_clkdm",
923 .mpu_irqs = am33xx_ecap1_irqs,
924 .main_clk = "l4ls_gclk", 737 .main_clk = "l4ls_gclk",
925}; 738};
926 739
927/* eqep1 */ 740/* eqep1 */
928static struct omap_hwmod_irq_info am33xx_eqep1_irqs[] = {
929 { .irq = 88 + OMAP_INTC_START, },
930 { .irq = -1 },
931};
932
933static struct omap_hwmod am33xx_eqep1_hwmod = { 741static struct omap_hwmod am33xx_eqep1_hwmod = {
934 .name = "eqep1", 742 .name = "eqep1",
935 .class = &am33xx_eqep_hwmod_class, 743 .class = &am33xx_eqep_hwmod_class,
936 .clkdm_name = "l4ls_clkdm", 744 .clkdm_name = "l4ls_clkdm",
937 .mpu_irqs = am33xx_eqep1_irqs,
938 .main_clk = "l4ls_gclk", 745 .main_clk = "l4ls_gclk",
939}; 746};
940 747
941/* ehrpwm1 */ 748/* ehrpwm1 */
942static struct omap_hwmod_irq_info am33xx_ehrpwm1_irqs[] = {
943 { .name = "int", .irq = 87 + OMAP_INTC_START, },
944 { .name = "tzint", .irq = 59 + OMAP_INTC_START, },
945 { .irq = -1 },
946};
947
948static struct omap_hwmod am33xx_ehrpwm1_hwmod = { 749static struct omap_hwmod am33xx_ehrpwm1_hwmod = {
949 .name = "ehrpwm1", 750 .name = "ehrpwm1",
950 .class = &am33xx_ehrpwm_hwmod_class, 751 .class = &am33xx_ehrpwm_hwmod_class,
951 .clkdm_name = "l4ls_clkdm", 752 .clkdm_name = "l4ls_clkdm",
952 .mpu_irqs = am33xx_ehrpwm1_irqs,
953 .main_clk = "l4ls_gclk", 753 .main_clk = "l4ls_gclk",
954}; 754};
955 755
@@ -968,45 +768,26 @@ static struct omap_hwmod am33xx_epwmss2_hwmod = {
968}; 768};
969 769
970/* ecap2 */ 770/* ecap2 */
971static struct omap_hwmod_irq_info am33xx_ecap2_irqs[] = {
972 { .irq = 61 + OMAP_INTC_START, },
973 { .irq = -1 },
974};
975
976static struct omap_hwmod am33xx_ecap2_hwmod = { 771static struct omap_hwmod am33xx_ecap2_hwmod = {
977 .name = "ecap2", 772 .name = "ecap2",
978 .class = &am33xx_ecap_hwmod_class, 773 .class = &am33xx_ecap_hwmod_class,
979 .clkdm_name = "l4ls_clkdm", 774 .clkdm_name = "l4ls_clkdm",
980 .mpu_irqs = am33xx_ecap2_irqs,
981 .main_clk = "l4ls_gclk", 775 .main_clk = "l4ls_gclk",
982}; 776};
983 777
984/* eqep2 */ 778/* eqep2 */
985static struct omap_hwmod_irq_info am33xx_eqep2_irqs[] = {
986 { .irq = 89 + OMAP_INTC_START, },
987 { .irq = -1 },
988};
989
990static struct omap_hwmod am33xx_eqep2_hwmod = { 779static struct omap_hwmod am33xx_eqep2_hwmod = {
991 .name = "eqep2", 780 .name = "eqep2",
992 .class = &am33xx_eqep_hwmod_class, 781 .class = &am33xx_eqep_hwmod_class,
993 .clkdm_name = "l4ls_clkdm", 782 .clkdm_name = "l4ls_clkdm",
994 .mpu_irqs = am33xx_eqep2_irqs,
995 .main_clk = "l4ls_gclk", 783 .main_clk = "l4ls_gclk",
996}; 784};
997 785
998/* ehrpwm2 */ 786/* ehrpwm2 */
999static struct omap_hwmod_irq_info am33xx_ehrpwm2_irqs[] = {
1000 { .name = "int", .irq = 39 + OMAP_INTC_START, },
1001 { .name = "tzint", .irq = 60 + OMAP_INTC_START, },
1002 { .irq = -1 },
1003};
1004
1005static struct omap_hwmod am33xx_ehrpwm2_hwmod = { 787static struct omap_hwmod am33xx_ehrpwm2_hwmod = {
1006 .name = "ehrpwm2", 788 .name = "ehrpwm2",
1007 .class = &am33xx_ehrpwm_hwmod_class, 789 .class = &am33xx_ehrpwm_hwmod_class,
1008 .clkdm_name = "l4ls_clkdm", 790 .clkdm_name = "l4ls_clkdm",
1009 .mpu_irqs = am33xx_ehrpwm2_irqs,
1010 .main_clk = "l4ls_gclk", 791 .main_clk = "l4ls_gclk",
1011}; 792};
1012 793
@@ -1041,17 +822,11 @@ static struct omap_hwmod_opt_clk gpio0_opt_clks[] = {
1041 { .role = "dbclk", .clk = "gpio0_dbclk" }, 822 { .role = "dbclk", .clk = "gpio0_dbclk" },
1042}; 823};
1043 824
1044static struct omap_hwmod_irq_info am33xx_gpio0_irqs[] = {
1045 { .irq = 96 + OMAP_INTC_START, },
1046 { .irq = -1 },
1047};
1048
1049static struct omap_hwmod am33xx_gpio0_hwmod = { 825static struct omap_hwmod am33xx_gpio0_hwmod = {
1050 .name = "gpio1", 826 .name = "gpio1",
1051 .class = &am33xx_gpio_hwmod_class, 827 .class = &am33xx_gpio_hwmod_class,
1052 .clkdm_name = "l4_wkup_clkdm", 828 .clkdm_name = "l4_wkup_clkdm",
1053 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 829 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1054 .mpu_irqs = am33xx_gpio0_irqs,
1055 .main_clk = "dpll_core_m4_div2_ck", 830 .main_clk = "dpll_core_m4_div2_ck",
1056 .prcm = { 831 .prcm = {
1057 .omap4 = { 832 .omap4 = {
@@ -1065,11 +840,6 @@ static struct omap_hwmod am33xx_gpio0_hwmod = {
1065}; 840};
1066 841
1067/* gpio1 */ 842/* gpio1 */
1068static struct omap_hwmod_irq_info am33xx_gpio1_irqs[] = {
1069 { .irq = 98 + OMAP_INTC_START, },
1070 { .irq = -1 },
1071};
1072
1073static struct omap_hwmod_opt_clk gpio1_opt_clks[] = { 843static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
1074 { .role = "dbclk", .clk = "gpio1_dbclk" }, 844 { .role = "dbclk", .clk = "gpio1_dbclk" },
1075}; 845};
@@ -1079,7 +849,6 @@ static struct omap_hwmod am33xx_gpio1_hwmod = {
1079 .class = &am33xx_gpio_hwmod_class, 849 .class = &am33xx_gpio_hwmod_class,
1080 .clkdm_name = "l4ls_clkdm", 850 .clkdm_name = "l4ls_clkdm",
1081 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 851 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1082 .mpu_irqs = am33xx_gpio1_irqs,
1083 .main_clk = "l4ls_gclk", 852 .main_clk = "l4ls_gclk",
1084 .prcm = { 853 .prcm = {
1085 .omap4 = { 854 .omap4 = {
@@ -1093,11 +862,6 @@ static struct omap_hwmod am33xx_gpio1_hwmod = {
1093}; 862};
1094 863
1095/* gpio2 */ 864/* gpio2 */
1096static struct omap_hwmod_irq_info am33xx_gpio2_irqs[] = {
1097 { .irq = 32 + OMAP_INTC_START, },
1098 { .irq = -1 },
1099};
1100
1101static struct omap_hwmod_opt_clk gpio2_opt_clks[] = { 865static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
1102 { .role = "dbclk", .clk = "gpio2_dbclk" }, 866 { .role = "dbclk", .clk = "gpio2_dbclk" },
1103}; 867};
@@ -1107,7 +871,6 @@ static struct omap_hwmod am33xx_gpio2_hwmod = {
1107 .class = &am33xx_gpio_hwmod_class, 871 .class = &am33xx_gpio_hwmod_class,
1108 .clkdm_name = "l4ls_clkdm", 872 .clkdm_name = "l4ls_clkdm",
1109 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 873 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1110 .mpu_irqs = am33xx_gpio2_irqs,
1111 .main_clk = "l4ls_gclk", 874 .main_clk = "l4ls_gclk",
1112 .prcm = { 875 .prcm = {
1113 .omap4 = { 876 .omap4 = {
@@ -1121,11 +884,6 @@ static struct omap_hwmod am33xx_gpio2_hwmod = {
1121}; 884};
1122 885
1123/* gpio3 */ 886/* gpio3 */
1124static struct omap_hwmod_irq_info am33xx_gpio3_irqs[] = {
1125 { .irq = 62 + OMAP_INTC_START, },
1126 { .irq = -1 },
1127};
1128
1129static struct omap_hwmod_opt_clk gpio3_opt_clks[] = { 887static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
1130 { .role = "dbclk", .clk = "gpio3_dbclk" }, 888 { .role = "dbclk", .clk = "gpio3_dbclk" },
1131}; 889};
@@ -1135,7 +893,6 @@ static struct omap_hwmod am33xx_gpio3_hwmod = {
1135 .class = &am33xx_gpio_hwmod_class, 893 .class = &am33xx_gpio_hwmod_class,
1136 .clkdm_name = "l4ls_clkdm", 894 .clkdm_name = "l4ls_clkdm",
1137 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 895 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1138 .mpu_irqs = am33xx_gpio3_irqs,
1139 .main_clk = "l4ls_gclk", 896 .main_clk = "l4ls_gclk",
1140 .prcm = { 897 .prcm = {
1141 .omap4 = { 898 .omap4 = {
@@ -1164,17 +921,11 @@ static struct omap_hwmod_class am33xx_gpmc_hwmod_class = {
1164 .sysc = &gpmc_sysc, 921 .sysc = &gpmc_sysc,
1165}; 922};
1166 923
1167static struct omap_hwmod_irq_info am33xx_gpmc_irqs[] = {
1168 { .irq = 100 + OMAP_INTC_START, },
1169 { .irq = -1 },
1170};
1171
1172static struct omap_hwmod am33xx_gpmc_hwmod = { 924static struct omap_hwmod am33xx_gpmc_hwmod = {
1173 .name = "gpmc", 925 .name = "gpmc",
1174 .class = &am33xx_gpmc_hwmod_class, 926 .class = &am33xx_gpmc_hwmod_class,
1175 .clkdm_name = "l3s_clkdm", 927 .clkdm_name = "l3s_clkdm",
1176 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET), 928 .flags = (HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET),
1177 .mpu_irqs = am33xx_gpmc_irqs,
1178 .main_clk = "l3s_gclk", 929 .main_clk = "l3s_gclk",
1179 .prcm = { 930 .prcm = {
1180 .omap4 = { 931 .omap4 = {
@@ -1208,23 +959,10 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
1208}; 959};
1209 960
1210/* i2c1 */ 961/* i2c1 */
1211static struct omap_hwmod_irq_info i2c1_mpu_irqs[] = {
1212 { .irq = 70 + OMAP_INTC_START, },
1213 { .irq = -1 },
1214};
1215
1216static struct omap_hwmod_dma_info i2c1_edma_reqs[] = {
1217 { .name = "tx", .dma_req = 0, },
1218 { .name = "rx", .dma_req = 0, },
1219 { .dma_req = -1 }
1220};
1221
1222static struct omap_hwmod am33xx_i2c1_hwmod = { 962static struct omap_hwmod am33xx_i2c1_hwmod = {
1223 .name = "i2c1", 963 .name = "i2c1",
1224 .class = &i2c_class, 964 .class = &i2c_class,
1225 .clkdm_name = "l4_wkup_clkdm", 965 .clkdm_name = "l4_wkup_clkdm",
1226 .mpu_irqs = i2c1_mpu_irqs,
1227 .sdma_reqs = i2c1_edma_reqs,
1228 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 966 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1229 .main_clk = "dpll_per_m2_div4_wkupdm_ck", 967 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
1230 .prcm = { 968 .prcm = {
@@ -1237,23 +975,10 @@ static struct omap_hwmod am33xx_i2c1_hwmod = {
1237}; 975};
1238 976
1239/* i2c1 */ 977/* i2c1 */
1240static struct omap_hwmod_irq_info i2c2_mpu_irqs[] = {
1241 { .irq = 71 + OMAP_INTC_START, },
1242 { .irq = -1 },
1243};
1244
1245static struct omap_hwmod_dma_info i2c2_edma_reqs[] = {
1246 { .name = "tx", .dma_req = 0, },
1247 { .name = "rx", .dma_req = 0, },
1248 { .dma_req = -1 }
1249};
1250
1251static struct omap_hwmod am33xx_i2c2_hwmod = { 978static struct omap_hwmod am33xx_i2c2_hwmod = {
1252 .name = "i2c2", 979 .name = "i2c2",
1253 .class = &i2c_class, 980 .class = &i2c_class,
1254 .clkdm_name = "l4ls_clkdm", 981 .clkdm_name = "l4ls_clkdm",
1255 .mpu_irqs = i2c2_mpu_irqs,
1256 .sdma_reqs = i2c2_edma_reqs,
1257 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 982 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1258 .main_clk = "dpll_per_m2_div4_ck", 983 .main_clk = "dpll_per_m2_div4_ck",
1259 .prcm = { 984 .prcm = {
@@ -1266,23 +991,10 @@ static struct omap_hwmod am33xx_i2c2_hwmod = {
1266}; 991};
1267 992
1268/* i2c3 */ 993/* i2c3 */
1269static struct omap_hwmod_dma_info i2c3_edma_reqs[] = {
1270 { .name = "tx", .dma_req = 0, },
1271 { .name = "rx", .dma_req = 0, },
1272 { .dma_req = -1 }
1273};
1274
1275static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {
1276 { .irq = 30 + OMAP_INTC_START, },
1277 { .irq = -1 },
1278};
1279
1280static struct omap_hwmod am33xx_i2c3_hwmod = { 994static struct omap_hwmod am33xx_i2c3_hwmod = {
1281 .name = "i2c3", 995 .name = "i2c3",
1282 .class = &i2c_class, 996 .class = &i2c_class,
1283 .clkdm_name = "l4ls_clkdm", 997 .clkdm_name = "l4ls_clkdm",
1284 .mpu_irqs = i2c3_mpu_irqs,
1285 .sdma_reqs = i2c3_edma_reqs,
1286 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 998 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1287 .main_clk = "dpll_per_m2_div4_ck", 999 .main_clk = "dpll_per_m2_div4_ck",
1288 .prcm = { 1000 .prcm = {
@@ -1309,16 +1021,10 @@ static struct omap_hwmod_class am33xx_lcdc_hwmod_class = {
1309 .sysc = &lcdc_sysc, 1021 .sysc = &lcdc_sysc,
1310}; 1022};
1311 1023
1312static struct omap_hwmod_irq_info am33xx_lcdc_irqs[] = {
1313 { .irq = 36 + OMAP_INTC_START, },
1314 { .irq = -1 },
1315};
1316
1317static struct omap_hwmod am33xx_lcdc_hwmod = { 1024static struct omap_hwmod am33xx_lcdc_hwmod = {
1318 .name = "lcdc", 1025 .name = "lcdc",
1319 .class = &am33xx_lcdc_hwmod_class, 1026 .class = &am33xx_lcdc_hwmod_class,
1320 .clkdm_name = "lcdc_clkdm", 1027 .clkdm_name = "lcdc_clkdm",
1321 .mpu_irqs = am33xx_lcdc_irqs,
1322 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, 1028 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
1323 .main_clk = "lcd_gclk", 1029 .main_clk = "lcd_gclk",
1324 .prcm = { 1030 .prcm = {
@@ -1348,16 +1054,10 @@ static struct omap_hwmod_class am33xx_mailbox_hwmod_class = {
1348 .sysc = &am33xx_mailbox_sysc, 1054 .sysc = &am33xx_mailbox_sysc,
1349}; 1055};
1350 1056
1351static struct omap_hwmod_irq_info am33xx_mailbox_irqs[] = {
1352 { .irq = 77 + OMAP_INTC_START, },
1353 { .irq = -1 },
1354};
1355
1356static struct omap_hwmod am33xx_mailbox_hwmod = { 1057static struct omap_hwmod am33xx_mailbox_hwmod = {
1357 .name = "mailbox", 1058 .name = "mailbox",
1358 .class = &am33xx_mailbox_hwmod_class, 1059 .class = &am33xx_mailbox_hwmod_class,
1359 .clkdm_name = "l4ls_clkdm", 1060 .clkdm_name = "l4ls_clkdm",
1360 .mpu_irqs = am33xx_mailbox_irqs,
1361 .main_clk = "l4ls_gclk", 1061 .main_clk = "l4ls_gclk",
1362 .prcm = { 1062 .prcm = {
1363 .omap4 = { 1063 .omap4 = {
@@ -1384,24 +1084,10 @@ static struct omap_hwmod_class am33xx_mcasp_hwmod_class = {
1384}; 1084};
1385 1085
1386/* mcasp0 */ 1086/* mcasp0 */
1387static struct omap_hwmod_irq_info am33xx_mcasp0_irqs[] = {
1388 { .name = "ax", .irq = 80 + OMAP_INTC_START, },
1389 { .name = "ar", .irq = 81 + OMAP_INTC_START, },
1390 { .irq = -1 },
1391};
1392
1393static struct omap_hwmod_dma_info am33xx_mcasp0_edma_reqs[] = {
1394 { .name = "tx", .dma_req = 8, },
1395 { .name = "rx", .dma_req = 9, },
1396 { .dma_req = -1 }
1397};
1398
1399static struct omap_hwmod am33xx_mcasp0_hwmod = { 1087static struct omap_hwmod am33xx_mcasp0_hwmod = {
1400 .name = "mcasp0", 1088 .name = "mcasp0",
1401 .class = &am33xx_mcasp_hwmod_class, 1089 .class = &am33xx_mcasp_hwmod_class,
1402 .clkdm_name = "l3s_clkdm", 1090 .clkdm_name = "l3s_clkdm",
1403 .mpu_irqs = am33xx_mcasp0_irqs,
1404 .sdma_reqs = am33xx_mcasp0_edma_reqs,
1405 .main_clk = "mcasp0_fck", 1091 .main_clk = "mcasp0_fck",
1406 .prcm = { 1092 .prcm = {
1407 .omap4 = { 1093 .omap4 = {
@@ -1412,24 +1098,10 @@ static struct omap_hwmod am33xx_mcasp0_hwmod = {
1412}; 1098};
1413 1099
1414/* mcasp1 */ 1100/* mcasp1 */
1415static struct omap_hwmod_irq_info am33xx_mcasp1_irqs[] = {
1416 { .name = "ax", .irq = 82 + OMAP_INTC_START, },
1417 { .name = "ar", .irq = 83 + OMAP_INTC_START, },
1418 { .irq = -1 },
1419};
1420
1421static struct omap_hwmod_dma_info am33xx_mcasp1_edma_reqs[] = {
1422 { .name = "tx", .dma_req = 10, },
1423 { .name = "rx", .dma_req = 11, },
1424 { .dma_req = -1 }
1425};
1426
1427static struct omap_hwmod am33xx_mcasp1_hwmod = { 1101static struct omap_hwmod am33xx_mcasp1_hwmod = {
1428 .name = "mcasp1", 1102 .name = "mcasp1",
1429 .class = &am33xx_mcasp_hwmod_class, 1103 .class = &am33xx_mcasp_hwmod_class,
1430 .clkdm_name = "l3s_clkdm", 1104 .clkdm_name = "l3s_clkdm",
1431 .mpu_irqs = am33xx_mcasp1_irqs,
1432 .sdma_reqs = am33xx_mcasp1_edma_reqs,
1433 .main_clk = "mcasp1_fck", 1105 .main_clk = "mcasp1_fck",
1434 .prcm = { 1106 .prcm = {
1435 .omap4 = { 1107 .omap4 = {
@@ -1457,17 +1129,6 @@ static struct omap_hwmod_class am33xx_mmc_hwmod_class = {
1457}; 1129};
1458 1130
1459/* mmc0 */ 1131/* mmc0 */
1460static struct omap_hwmod_irq_info am33xx_mmc0_irqs[] = {
1461 { .irq = 64 + OMAP_INTC_START, },
1462 { .irq = -1 },
1463};
1464
1465static struct omap_hwmod_dma_info am33xx_mmc0_edma_reqs[] = {
1466 { .name = "tx", .dma_req = 24, },
1467 { .name = "rx", .dma_req = 25, },
1468 { .dma_req = -1 }
1469};
1470
1471static struct omap_mmc_dev_attr am33xx_mmc0_dev_attr = { 1132static struct omap_mmc_dev_attr am33xx_mmc0_dev_attr = {
1472 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1133 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1473}; 1134};
@@ -1476,8 +1137,6 @@ static struct omap_hwmod am33xx_mmc0_hwmod = {
1476 .name = "mmc1", 1137 .name = "mmc1",
1477 .class = &am33xx_mmc_hwmod_class, 1138 .class = &am33xx_mmc_hwmod_class,
1478 .clkdm_name = "l4ls_clkdm", 1139 .clkdm_name = "l4ls_clkdm",
1479 .mpu_irqs = am33xx_mmc0_irqs,
1480 .sdma_reqs = am33xx_mmc0_edma_reqs,
1481 .main_clk = "mmc_clk", 1140 .main_clk = "mmc_clk",
1482 .prcm = { 1141 .prcm = {
1483 .omap4 = { 1142 .omap4 = {
@@ -1489,17 +1148,6 @@ static struct omap_hwmod am33xx_mmc0_hwmod = {
1489}; 1148};
1490 1149
1491/* mmc1 */ 1150/* mmc1 */
1492static struct omap_hwmod_irq_info am33xx_mmc1_irqs[] = {
1493 { .irq = 28 + OMAP_INTC_START, },
1494 { .irq = -1 },
1495};
1496
1497static struct omap_hwmod_dma_info am33xx_mmc1_edma_reqs[] = {
1498 { .name = "tx", .dma_req = 2, },
1499 { .name = "rx", .dma_req = 3, },
1500 { .dma_req = -1 }
1501};
1502
1503static struct omap_mmc_dev_attr am33xx_mmc1_dev_attr = { 1151static struct omap_mmc_dev_attr am33xx_mmc1_dev_attr = {
1504 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1152 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1505}; 1153};
@@ -1508,8 +1156,6 @@ static struct omap_hwmod am33xx_mmc1_hwmod = {
1508 .name = "mmc2", 1156 .name = "mmc2",
1509 .class = &am33xx_mmc_hwmod_class, 1157 .class = &am33xx_mmc_hwmod_class,
1510 .clkdm_name = "l4ls_clkdm", 1158 .clkdm_name = "l4ls_clkdm",
1511 .mpu_irqs = am33xx_mmc1_irqs,
1512 .sdma_reqs = am33xx_mmc1_edma_reqs,
1513 .main_clk = "mmc_clk", 1159 .main_clk = "mmc_clk",
1514 .prcm = { 1160 .prcm = {
1515 .omap4 = { 1161 .omap4 = {
@@ -1521,17 +1167,6 @@ static struct omap_hwmod am33xx_mmc1_hwmod = {
1521}; 1167};
1522 1168
1523/* mmc2 */ 1169/* mmc2 */
1524static struct omap_hwmod_irq_info am33xx_mmc2_irqs[] = {
1525 { .irq = 29 + OMAP_INTC_START, },
1526 { .irq = -1 },
1527};
1528
1529static struct omap_hwmod_dma_info am33xx_mmc2_edma_reqs[] = {
1530 { .name = "tx", .dma_req = 64, },
1531 { .name = "rx", .dma_req = 65, },
1532 { .dma_req = -1 }
1533};
1534
1535static struct omap_mmc_dev_attr am33xx_mmc2_dev_attr = { 1170static struct omap_mmc_dev_attr am33xx_mmc2_dev_attr = {
1536 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT, 1171 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1537}; 1172};
@@ -1539,8 +1174,6 @@ static struct omap_hwmod am33xx_mmc2_hwmod = {
1539 .name = "mmc3", 1174 .name = "mmc3",
1540 .class = &am33xx_mmc_hwmod_class, 1175 .class = &am33xx_mmc_hwmod_class,
1541 .clkdm_name = "l3s_clkdm", 1176 .clkdm_name = "l3s_clkdm",
1542 .mpu_irqs = am33xx_mmc2_irqs,
1543 .sdma_reqs = am33xx_mmc2_edma_reqs,
1544 .main_clk = "mmc_clk", 1177 .main_clk = "mmc_clk",
1545 .prcm = { 1178 .prcm = {
1546 .omap4 = { 1179 .omap4 = {
@@ -1569,17 +1202,10 @@ static struct omap_hwmod_class am33xx_rtc_hwmod_class = {
1569 .sysc = &am33xx_rtc_sysc, 1202 .sysc = &am33xx_rtc_sysc,
1570}; 1203};
1571 1204
1572static struct omap_hwmod_irq_info am33xx_rtc_irqs[] = {
1573 { .name = "rtcint", .irq = 75 + OMAP_INTC_START, },
1574 { .name = "rtcalarmint", .irq = 76 + OMAP_INTC_START, },
1575 { .irq = -1 },
1576};
1577
1578static struct omap_hwmod am33xx_rtc_hwmod = { 1205static struct omap_hwmod am33xx_rtc_hwmod = {
1579 .name = "rtc", 1206 .name = "rtc",
1580 .class = &am33xx_rtc_hwmod_class, 1207 .class = &am33xx_rtc_hwmod_class,
1581 .clkdm_name = "l4_rtc_clkdm", 1208 .clkdm_name = "l4_rtc_clkdm",
1582 .mpu_irqs = am33xx_rtc_irqs,
1583 .main_clk = "clk_32768_ck", 1209 .main_clk = "clk_32768_ck",
1584 .prcm = { 1210 .prcm = {
1585 .omap4 = { 1211 .omap4 = {
@@ -1608,19 +1234,6 @@ static struct omap_hwmod_class am33xx_spi_hwmod_class = {
1608}; 1234};
1609 1235
1610/* spi0 */ 1236/* spi0 */
1611static struct omap_hwmod_irq_info am33xx_spi0_irqs[] = {
1612 { .irq = 65 + OMAP_INTC_START, },
1613 { .irq = -1 },
1614};
1615
1616static struct omap_hwmod_dma_info am33xx_mcspi0_edma_reqs[] = {
1617 { .name = "rx0", .dma_req = 17 },
1618 { .name = "tx0", .dma_req = 16 },
1619 { .name = "rx1", .dma_req = 19 },
1620 { .name = "tx1", .dma_req = 18 },
1621 { .dma_req = -1 }
1622};
1623
1624static struct omap2_mcspi_dev_attr mcspi_attrib = { 1237static struct omap2_mcspi_dev_attr mcspi_attrib = {
1625 .num_chipselect = 2, 1238 .num_chipselect = 2,
1626}; 1239};
@@ -1628,8 +1241,6 @@ static struct omap_hwmod am33xx_spi0_hwmod = {
1628 .name = "spi0", 1241 .name = "spi0",
1629 .class = &am33xx_spi_hwmod_class, 1242 .class = &am33xx_spi_hwmod_class,
1630 .clkdm_name = "l4ls_clkdm", 1243 .clkdm_name = "l4ls_clkdm",
1631 .mpu_irqs = am33xx_spi0_irqs,
1632 .sdma_reqs = am33xx_mcspi0_edma_reqs,
1633 .main_clk = "dpll_per_m2_div4_ck", 1244 .main_clk = "dpll_per_m2_div4_ck",
1634 .prcm = { 1245 .prcm = {
1635 .omap4 = { 1246 .omap4 = {
@@ -1641,25 +1252,10 @@ static struct omap_hwmod am33xx_spi0_hwmod = {
1641}; 1252};
1642 1253
1643/* spi1 */ 1254/* spi1 */
1644static struct omap_hwmod_irq_info am33xx_spi1_irqs[] = {
1645 { .irq = 125 + OMAP_INTC_START, },
1646 { .irq = -1 },
1647};
1648
1649static struct omap_hwmod_dma_info am33xx_mcspi1_edma_reqs[] = {
1650 { .name = "rx0", .dma_req = 43 },
1651 { .name = "tx0", .dma_req = 42 },
1652 { .name = "rx1", .dma_req = 45 },
1653 { .name = "tx1", .dma_req = 44 },
1654 { .dma_req = -1 }
1655};
1656
1657static struct omap_hwmod am33xx_spi1_hwmod = { 1255static struct omap_hwmod am33xx_spi1_hwmod = {
1658 .name = "spi1", 1256 .name = "spi1",
1659 .class = &am33xx_spi_hwmod_class, 1257 .class = &am33xx_spi_hwmod_class,
1660 .clkdm_name = "l4ls_clkdm", 1258 .clkdm_name = "l4ls_clkdm",
1661 .mpu_irqs = am33xx_spi1_irqs,
1662 .sdma_reqs = am33xx_mcspi1_edma_reqs,
1663 .main_clk = "dpll_per_m2_div4_ck", 1259 .main_clk = "dpll_per_m2_div4_ck",
1664 .prcm = { 1260 .prcm = {
1665 .omap4 = { 1261 .omap4 = {
@@ -1725,16 +1321,10 @@ static struct omap_hwmod_class am33xx_timer1ms_hwmod_class = {
1725 .sysc = &am33xx_timer1ms_sysc, 1321 .sysc = &am33xx_timer1ms_sysc,
1726}; 1322};
1727 1323
1728static struct omap_hwmod_irq_info am33xx_timer1_irqs[] = {
1729 { .irq = 67 + OMAP_INTC_START, },
1730 { .irq = -1 },
1731};
1732
1733static struct omap_hwmod am33xx_timer1_hwmod = { 1324static struct omap_hwmod am33xx_timer1_hwmod = {
1734 .name = "timer1", 1325 .name = "timer1",
1735 .class = &am33xx_timer1ms_hwmod_class, 1326 .class = &am33xx_timer1ms_hwmod_class,
1736 .clkdm_name = "l4_wkup_clkdm", 1327 .clkdm_name = "l4_wkup_clkdm",
1737 .mpu_irqs = am33xx_timer1_irqs,
1738 .main_clk = "timer1_fck", 1328 .main_clk = "timer1_fck",
1739 .prcm = { 1329 .prcm = {
1740 .omap4 = { 1330 .omap4 = {
@@ -1744,16 +1334,10 @@ static struct omap_hwmod am33xx_timer1_hwmod = {
1744 }, 1334 },
1745}; 1335};
1746 1336
1747static struct omap_hwmod_irq_info am33xx_timer2_irqs[] = {
1748 { .irq = 68 + OMAP_INTC_START, },
1749 { .irq = -1 },
1750};
1751
1752static struct omap_hwmod am33xx_timer2_hwmod = { 1337static struct omap_hwmod am33xx_timer2_hwmod = {
1753 .name = "timer2", 1338 .name = "timer2",
1754 .class = &am33xx_timer_hwmod_class, 1339 .class = &am33xx_timer_hwmod_class,
1755 .clkdm_name = "l4ls_clkdm", 1340 .clkdm_name = "l4ls_clkdm",
1756 .mpu_irqs = am33xx_timer2_irqs,
1757 .main_clk = "timer2_fck", 1341 .main_clk = "timer2_fck",
1758 .prcm = { 1342 .prcm = {
1759 .omap4 = { 1343 .omap4 = {
@@ -1763,16 +1347,10 @@ static struct omap_hwmod am33xx_timer2_hwmod = {
1763 }, 1347 },
1764}; 1348};
1765 1349
1766static struct omap_hwmod_irq_info am33xx_timer3_irqs[] = {
1767 { .irq = 69 + OMAP_INTC_START, },
1768 { .irq = -1 },
1769};
1770
1771static struct omap_hwmod am33xx_timer3_hwmod = { 1350static struct omap_hwmod am33xx_timer3_hwmod = {
1772 .name = "timer3", 1351 .name = "timer3",
1773 .class = &am33xx_timer_hwmod_class, 1352 .class = &am33xx_timer_hwmod_class,
1774 .clkdm_name = "l4ls_clkdm", 1353 .clkdm_name = "l4ls_clkdm",
1775 .mpu_irqs = am33xx_timer3_irqs,
1776 .main_clk = "timer3_fck", 1354 .main_clk = "timer3_fck",
1777 .prcm = { 1355 .prcm = {
1778 .omap4 = { 1356 .omap4 = {
@@ -1782,16 +1360,10 @@ static struct omap_hwmod am33xx_timer3_hwmod = {
1782 }, 1360 },
1783}; 1361};
1784 1362
1785static struct omap_hwmod_irq_info am33xx_timer4_irqs[] = {
1786 { .irq = 92 + OMAP_INTC_START, },
1787 { .irq = -1 },
1788};
1789
1790static struct omap_hwmod am33xx_timer4_hwmod = { 1363static struct omap_hwmod am33xx_timer4_hwmod = {
1791 .name = "timer4", 1364 .name = "timer4",
1792 .class = &am33xx_timer_hwmod_class, 1365 .class = &am33xx_timer_hwmod_class,
1793 .clkdm_name = "l4ls_clkdm", 1366 .clkdm_name = "l4ls_clkdm",
1794 .mpu_irqs = am33xx_timer4_irqs,
1795 .main_clk = "timer4_fck", 1367 .main_clk = "timer4_fck",
1796 .prcm = { 1368 .prcm = {
1797 .omap4 = { 1369 .omap4 = {
@@ -1801,16 +1373,10 @@ static struct omap_hwmod am33xx_timer4_hwmod = {
1801 }, 1373 },
1802}; 1374};
1803 1375
1804static struct omap_hwmod_irq_info am33xx_timer5_irqs[] = {
1805 { .irq = 93 + OMAP_INTC_START, },
1806 { .irq = -1 },
1807};
1808
1809static struct omap_hwmod am33xx_timer5_hwmod = { 1376static struct omap_hwmod am33xx_timer5_hwmod = {
1810 .name = "timer5", 1377 .name = "timer5",
1811 .class = &am33xx_timer_hwmod_class, 1378 .class = &am33xx_timer_hwmod_class,
1812 .clkdm_name = "l4ls_clkdm", 1379 .clkdm_name = "l4ls_clkdm",
1813 .mpu_irqs = am33xx_timer5_irqs,
1814 .main_clk = "timer5_fck", 1380 .main_clk = "timer5_fck",
1815 .prcm = { 1381 .prcm = {
1816 .omap4 = { 1382 .omap4 = {
@@ -1820,16 +1386,10 @@ static struct omap_hwmod am33xx_timer5_hwmod = {
1820 }, 1386 },
1821}; 1387};
1822 1388
1823static struct omap_hwmod_irq_info am33xx_timer6_irqs[] = {
1824 { .irq = 94 + OMAP_INTC_START, },
1825 { .irq = -1 },
1826};
1827
1828static struct omap_hwmod am33xx_timer6_hwmod = { 1389static struct omap_hwmod am33xx_timer6_hwmod = {
1829 .name = "timer6", 1390 .name = "timer6",
1830 .class = &am33xx_timer_hwmod_class, 1391 .class = &am33xx_timer_hwmod_class,
1831 .clkdm_name = "l4ls_clkdm", 1392 .clkdm_name = "l4ls_clkdm",
1832 .mpu_irqs = am33xx_timer6_irqs,
1833 .main_clk = "timer6_fck", 1393 .main_clk = "timer6_fck",
1834 .prcm = { 1394 .prcm = {
1835 .omap4 = { 1395 .omap4 = {
@@ -1839,16 +1399,10 @@ static struct omap_hwmod am33xx_timer6_hwmod = {
1839 }, 1399 },
1840}; 1400};
1841 1401
1842static struct omap_hwmod_irq_info am33xx_timer7_irqs[] = {
1843 { .irq = 95 + OMAP_INTC_START, },
1844 { .irq = -1 },
1845};
1846
1847static struct omap_hwmod am33xx_timer7_hwmod = { 1402static struct omap_hwmod am33xx_timer7_hwmod = {
1848 .name = "timer7", 1403 .name = "timer7",
1849 .class = &am33xx_timer_hwmod_class, 1404 .class = &am33xx_timer_hwmod_class,
1850 .clkdm_name = "l4ls_clkdm", 1405 .clkdm_name = "l4ls_clkdm",
1851 .mpu_irqs = am33xx_timer7_irqs,
1852 .main_clk = "timer7_fck", 1406 .main_clk = "timer7_fck",
1853 .prcm = { 1407 .prcm = {
1854 .omap4 = { 1408 .omap4 = {
@@ -1863,18 +1417,10 @@ static struct omap_hwmod_class am33xx_tpcc_hwmod_class = {
1863 .name = "tpcc", 1417 .name = "tpcc",
1864}; 1418};
1865 1419
1866static struct omap_hwmod_irq_info am33xx_tpcc_irqs[] = {
1867 { .name = "edma0", .irq = 12 + OMAP_INTC_START, },
1868 { .name = "edma0_mperr", .irq = 13 + OMAP_INTC_START, },
1869 { .name = "edma0_err", .irq = 14 + OMAP_INTC_START, },
1870 { .irq = -1 },
1871};
1872
1873static struct omap_hwmod am33xx_tpcc_hwmod = { 1420static struct omap_hwmod am33xx_tpcc_hwmod = {
1874 .name = "tpcc", 1421 .name = "tpcc",
1875 .class = &am33xx_tpcc_hwmod_class, 1422 .class = &am33xx_tpcc_hwmod_class,
1876 .clkdm_name = "l3_clkdm", 1423 .clkdm_name = "l3_clkdm",
1877 .mpu_irqs = am33xx_tpcc_irqs,
1878 .main_clk = "l3_gclk", 1424 .main_clk = "l3_gclk",
1879 .prcm = { 1425 .prcm = {
1880 .omap4 = { 1426 .omap4 = {
@@ -1900,16 +1446,10 @@ static struct omap_hwmod_class am33xx_tptc_hwmod_class = {
1900}; 1446};
1901 1447
1902/* tptc0 */ 1448/* tptc0 */
1903static struct omap_hwmod_irq_info am33xx_tptc0_irqs[] = {
1904 { .irq = 112 + OMAP_INTC_START, },
1905 { .irq = -1 },
1906};
1907
1908static struct omap_hwmod am33xx_tptc0_hwmod = { 1449static struct omap_hwmod am33xx_tptc0_hwmod = {
1909 .name = "tptc0", 1450 .name = "tptc0",
1910 .class = &am33xx_tptc_hwmod_class, 1451 .class = &am33xx_tptc_hwmod_class,
1911 .clkdm_name = "l3_clkdm", 1452 .clkdm_name = "l3_clkdm",
1912 .mpu_irqs = am33xx_tptc0_irqs,
1913 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, 1453 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
1914 .main_clk = "l3_gclk", 1454 .main_clk = "l3_gclk",
1915 .prcm = { 1455 .prcm = {
@@ -1921,16 +1461,10 @@ static struct omap_hwmod am33xx_tptc0_hwmod = {
1921}; 1461};
1922 1462
1923/* tptc1 */ 1463/* tptc1 */
1924static struct omap_hwmod_irq_info am33xx_tptc1_irqs[] = {
1925 { .irq = 113 + OMAP_INTC_START, },
1926 { .irq = -1 },
1927};
1928
1929static struct omap_hwmod am33xx_tptc1_hwmod = { 1464static struct omap_hwmod am33xx_tptc1_hwmod = {
1930 .name = "tptc1", 1465 .name = "tptc1",
1931 .class = &am33xx_tptc_hwmod_class, 1466 .class = &am33xx_tptc_hwmod_class,
1932 .clkdm_name = "l3_clkdm", 1467 .clkdm_name = "l3_clkdm",
1933 .mpu_irqs = am33xx_tptc1_irqs,
1934 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), 1468 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
1935 .main_clk = "l3_gclk", 1469 .main_clk = "l3_gclk",
1936 .prcm = { 1470 .prcm = {
@@ -1942,16 +1476,10 @@ static struct omap_hwmod am33xx_tptc1_hwmod = {
1942}; 1476};
1943 1477
1944/* tptc2 */ 1478/* tptc2 */
1945static struct omap_hwmod_irq_info am33xx_tptc2_irqs[] = {
1946 { .irq = 114 + OMAP_INTC_START, },
1947 { .irq = -1 },
1948};
1949
1950static struct omap_hwmod am33xx_tptc2_hwmod = { 1479static struct omap_hwmod am33xx_tptc2_hwmod = {
1951 .name = "tptc2", 1480 .name = "tptc2",
1952 .class = &am33xx_tptc_hwmod_class, 1481 .class = &am33xx_tptc_hwmod_class,
1953 .clkdm_name = "l3_clkdm", 1482 .clkdm_name = "l3_clkdm",
1954 .mpu_irqs = am33xx_tptc2_irqs,
1955 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY), 1483 .flags = (HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY),
1956 .main_clk = "l3_gclk", 1484 .main_clk = "l3_gclk",
1957 .prcm = { 1485 .prcm = {
@@ -1980,24 +1508,11 @@ static struct omap_hwmod_class uart_class = {
1980}; 1508};
1981 1509
1982/* uart1 */ 1510/* uart1 */
1983static struct omap_hwmod_dma_info uart1_edma_reqs[] = {
1984 { .name = "tx", .dma_req = 26, },
1985 { .name = "rx", .dma_req = 27, },
1986 { .dma_req = -1 }
1987};
1988
1989static struct omap_hwmod_irq_info am33xx_uart1_irqs[] = {
1990 { .irq = 72 + OMAP_INTC_START, },
1991 { .irq = -1 },
1992};
1993
1994static struct omap_hwmod am33xx_uart1_hwmod = { 1511static struct omap_hwmod am33xx_uart1_hwmod = {
1995 .name = "uart1", 1512 .name = "uart1",
1996 .class = &uart_class, 1513 .class = &uart_class,
1997 .clkdm_name = "l4_wkup_clkdm", 1514 .clkdm_name = "l4_wkup_clkdm",
1998 .flags = HWMOD_SWSUP_SIDLE_ACT, 1515 .flags = HWMOD_SWSUP_SIDLE_ACT,
1999 .mpu_irqs = am33xx_uart1_irqs,
2000 .sdma_reqs = uart1_edma_reqs,
2001 .main_clk = "dpll_per_m2_div4_wkupdm_ck", 1516 .main_clk = "dpll_per_m2_div4_wkupdm_ck",
2002 .prcm = { 1517 .prcm = {
2003 .omap4 = { 1518 .omap4 = {
@@ -2007,18 +1522,11 @@ static struct omap_hwmod am33xx_uart1_hwmod = {
2007 }, 1522 },
2008}; 1523};
2009 1524
2010static struct omap_hwmod_irq_info am33xx_uart2_irqs[] = {
2011 { .irq = 73 + OMAP_INTC_START, },
2012 { .irq = -1 },
2013};
2014
2015static struct omap_hwmod am33xx_uart2_hwmod = { 1525static struct omap_hwmod am33xx_uart2_hwmod = {
2016 .name = "uart2", 1526 .name = "uart2",
2017 .class = &uart_class, 1527 .class = &uart_class,
2018 .clkdm_name = "l4ls_clkdm", 1528 .clkdm_name = "l4ls_clkdm",
2019 .flags = HWMOD_SWSUP_SIDLE_ACT, 1529 .flags = HWMOD_SWSUP_SIDLE_ACT,
2020 .mpu_irqs = am33xx_uart2_irqs,
2021 .sdma_reqs = uart1_edma_reqs,
2022 .main_clk = "dpll_per_m2_div4_ck", 1530 .main_clk = "dpll_per_m2_div4_ck",
2023 .prcm = { 1531 .prcm = {
2024 .omap4 = { 1532 .omap4 = {
@@ -2029,24 +1537,11 @@ static struct omap_hwmod am33xx_uart2_hwmod = {
2029}; 1537};
2030 1538
2031/* uart3 */ 1539/* uart3 */
2032static struct omap_hwmod_dma_info uart3_edma_reqs[] = {
2033 { .name = "tx", .dma_req = 30, },
2034 { .name = "rx", .dma_req = 31, },
2035 { .dma_req = -1 }
2036};
2037
2038static struct omap_hwmod_irq_info am33xx_uart3_irqs[] = {
2039 { .irq = 74 + OMAP_INTC_START, },
2040 { .irq = -1 },
2041};
2042
2043static struct omap_hwmod am33xx_uart3_hwmod = { 1540static struct omap_hwmod am33xx_uart3_hwmod = {
2044 .name = "uart3", 1541 .name = "uart3",
2045 .class = &uart_class, 1542 .class = &uart_class,
2046 .clkdm_name = "l4ls_clkdm", 1543 .clkdm_name = "l4ls_clkdm",
2047 .flags = HWMOD_SWSUP_SIDLE_ACT, 1544 .flags = HWMOD_SWSUP_SIDLE_ACT,
2048 .mpu_irqs = am33xx_uart3_irqs,
2049 .sdma_reqs = uart3_edma_reqs,
2050 .main_clk = "dpll_per_m2_div4_ck", 1545 .main_clk = "dpll_per_m2_div4_ck",
2051 .prcm = { 1546 .prcm = {
2052 .omap4 = { 1547 .omap4 = {
@@ -2056,18 +1551,11 @@ static struct omap_hwmod am33xx_uart3_hwmod = {
2056 }, 1551 },
2057}; 1552};
2058 1553
2059static struct omap_hwmod_irq_info am33xx_uart4_irqs[] = {
2060 { .irq = 44 + OMAP_INTC_START, },
2061 { .irq = -1 },
2062};
2063
2064static struct omap_hwmod am33xx_uart4_hwmod = { 1554static struct omap_hwmod am33xx_uart4_hwmod = {
2065 .name = "uart4", 1555 .name = "uart4",
2066 .class = &uart_class, 1556 .class = &uart_class,
2067 .clkdm_name = "l4ls_clkdm", 1557 .clkdm_name = "l4ls_clkdm",
2068 .flags = HWMOD_SWSUP_SIDLE_ACT, 1558 .flags = HWMOD_SWSUP_SIDLE_ACT,
2069 .mpu_irqs = am33xx_uart4_irqs,
2070 .sdma_reqs = uart1_edma_reqs,
2071 .main_clk = "dpll_per_m2_div4_ck", 1559 .main_clk = "dpll_per_m2_div4_ck",
2072 .prcm = { 1560 .prcm = {
2073 .omap4 = { 1561 .omap4 = {
@@ -2077,18 +1565,11 @@ static struct omap_hwmod am33xx_uart4_hwmod = {
2077 }, 1565 },
2078}; 1566};
2079 1567
2080static struct omap_hwmod_irq_info am33xx_uart5_irqs[] = {
2081 { .irq = 45 + OMAP_INTC_START, },
2082 { .irq = -1 },
2083};
2084
2085static struct omap_hwmod am33xx_uart5_hwmod = { 1568static struct omap_hwmod am33xx_uart5_hwmod = {
2086 .name = "uart5", 1569 .name = "uart5",
2087 .class = &uart_class, 1570 .class = &uart_class,
2088 .clkdm_name = "l4ls_clkdm", 1571 .clkdm_name = "l4ls_clkdm",
2089 .flags = HWMOD_SWSUP_SIDLE_ACT, 1572 .flags = HWMOD_SWSUP_SIDLE_ACT,
2090 .mpu_irqs = am33xx_uart5_irqs,
2091 .sdma_reqs = uart1_edma_reqs,
2092 .main_clk = "dpll_per_m2_div4_ck", 1573 .main_clk = "dpll_per_m2_div4_ck",
2093 .prcm = { 1574 .prcm = {
2094 .omap4 = { 1575 .omap4 = {
@@ -2098,18 +1579,11 @@ static struct omap_hwmod am33xx_uart5_hwmod = {
2098 }, 1579 },
2099}; 1580};
2100 1581
2101static struct omap_hwmod_irq_info am33xx_uart6_irqs[] = {
2102 { .irq = 46 + OMAP_INTC_START, },
2103 { .irq = -1 },
2104};
2105
2106static struct omap_hwmod am33xx_uart6_hwmod = { 1582static struct omap_hwmod am33xx_uart6_hwmod = {
2107 .name = "uart6", 1583 .name = "uart6",
2108 .class = &uart_class, 1584 .class = &uart_class,
2109 .clkdm_name = "l4ls_clkdm", 1585 .clkdm_name = "l4ls_clkdm",
2110 .flags = HWMOD_SWSUP_SIDLE_ACT, 1586 .flags = HWMOD_SWSUP_SIDLE_ACT,
2111 .mpu_irqs = am33xx_uart6_irqs,
2112 .sdma_reqs = uart1_edma_reqs,
2113 .main_clk = "dpll_per_m2_div4_ck", 1587 .main_clk = "dpll_per_m2_div4_ck",
2114 .prcm = { 1588 .prcm = {
2115 .omap4 = { 1589 .omap4 = {
@@ -2173,18 +1647,10 @@ static struct omap_hwmod_class am33xx_usbotg_class = {
2173 .sysc = &am33xx_usbhsotg_sysc, 1647 .sysc = &am33xx_usbhsotg_sysc,
2174}; 1648};
2175 1649
2176static struct omap_hwmod_irq_info am33xx_usbss_mpu_irqs[] = {
2177 { .name = "usbss-irq", .irq = 17 + OMAP_INTC_START, },
2178 { .name = "musb0-irq", .irq = 18 + OMAP_INTC_START, },
2179 { .name = "musb1-irq", .irq = 19 + OMAP_INTC_START, },
2180 { .irq = -1, },
2181};
2182
2183static struct omap_hwmod am33xx_usbss_hwmod = { 1650static struct omap_hwmod am33xx_usbss_hwmod = {
2184 .name = "usb_otg_hs", 1651 .name = "usb_otg_hs",
2185 .class = &am33xx_usbotg_class, 1652 .class = &am33xx_usbotg_class,
2186 .clkdm_name = "l3s_clkdm", 1653 .clkdm_name = "l3s_clkdm",
2187 .mpu_irqs = am33xx_usbss_mpu_irqs,
2188 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, 1654 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
2189 .main_clk = "usbotg_fck", 1655 .main_clk = "usbotg_fck",
2190 .prcm = { 1656 .prcm = {
@@ -2200,14 +1666,6 @@ static struct omap_hwmod am33xx_usbss_hwmod = {
2200 * Interfaces 1666 * Interfaces
2201 */ 1667 */
2202 1668
2203/* l4 fw -> emif fw */
2204static struct omap_hwmod_ocp_if am33xx_l4_fw__emif_fw = {
2205 .master = &am33xx_l4_fw_hwmod,
2206 .slave = &am33xx_emif_fw_hwmod,
2207 .clk = "l4fw_gclk",
2208 .user = OCP_USER_MPU,
2209};
2210
2211static struct omap_hwmod_addr_space am33xx_emif_addrs[] = { 1669static struct omap_hwmod_addr_space am33xx_emif_addrs[] = {
2212 { 1670 {
2213 .pa_start = 0x4c000000, 1671 .pa_start = 0x4c000000,
@@ -2265,14 +1723,6 @@ static struct omap_hwmod_ocp_if am33xx_l3_s__l4_wkup = {
2265 .user = OCP_USER_MPU | OCP_USER_SDMA, 1723 .user = OCP_USER_MPU | OCP_USER_SDMA,
2266}; 1724};
2267 1725
2268/* l3 s -> l4 fw */
2269static struct omap_hwmod_ocp_if am33xx_l3_s__l4_fw = {
2270 .master = &am33xx_l3_s_hwmod,
2271 .slave = &am33xx_l4_fw_hwmod,
2272 .clk = "l3s_gclk",
2273 .user = OCP_USER_MPU | OCP_USER_SDMA,
2274};
2275
2276/* l3 main -> l3 instr */ 1726/* l3 main -> l3 instr */
2277static struct omap_hwmod_ocp_if am33xx_l3_main__l3_instr = { 1727static struct omap_hwmod_ocp_if am33xx_l3_main__l3_instr = {
2278 .master = &am33xx_l3_main_hwmod, 1728 .master = &am33xx_l3_main_hwmod,
@@ -2322,261 +1772,114 @@ static struct omap_hwmod_ocp_if am33xx_gfx__l3_main = {
2322}; 1772};
2323 1773
2324/* l4 wkup -> wkup m3 */ 1774/* l4 wkup -> wkup m3 */
2325static struct omap_hwmod_addr_space am33xx_wkup_m3_addrs[] = {
2326 {
2327 .name = "umem",
2328 .pa_start = 0x44d00000,
2329 .pa_end = 0x44d00000 + SZ_16K - 1,
2330 .flags = ADDR_TYPE_RT
2331 },
2332 {
2333 .name = "dmem",
2334 .pa_start = 0x44d80000,
2335 .pa_end = 0x44d80000 + SZ_8K - 1,
2336 .flags = ADDR_TYPE_RT
2337 },
2338 { }
2339};
2340
2341static struct omap_hwmod_ocp_if am33xx_l4_wkup__wkup_m3 = { 1775static struct omap_hwmod_ocp_if am33xx_l4_wkup__wkup_m3 = {
2342 .master = &am33xx_l4_wkup_hwmod, 1776 .master = &am33xx_l4_wkup_hwmod,
2343 .slave = &am33xx_wkup_m3_hwmod, 1777 .slave = &am33xx_wkup_m3_hwmod,
2344 .clk = "dpll_core_m4_div2_ck", 1778 .clk = "dpll_core_m4_div2_ck",
2345 .addr = am33xx_wkup_m3_addrs,
2346 .user = OCP_USER_MPU | OCP_USER_SDMA, 1779 .user = OCP_USER_MPU | OCP_USER_SDMA,
2347}; 1780};
2348 1781
2349/* l4 hs -> pru-icss */ 1782/* l4 hs -> pru-icss */
2350static struct omap_hwmod_addr_space am33xx_pruss_addrs[] = {
2351 {
2352 .pa_start = 0x4a300000,
2353 .pa_end = 0x4a300000 + SZ_512K - 1,
2354 .flags = ADDR_TYPE_RT
2355 },
2356 { }
2357};
2358
2359static struct omap_hwmod_ocp_if am33xx_l4_hs__pruss = { 1783static struct omap_hwmod_ocp_if am33xx_l4_hs__pruss = {
2360 .master = &am33xx_l4_hs_hwmod, 1784 .master = &am33xx_l4_hs_hwmod,
2361 .slave = &am33xx_pruss_hwmod, 1785 .slave = &am33xx_pruss_hwmod,
2362 .clk = "dpll_core_m4_ck", 1786 .clk = "dpll_core_m4_ck",
2363 .addr = am33xx_pruss_addrs,
2364 .user = OCP_USER_MPU | OCP_USER_SDMA, 1787 .user = OCP_USER_MPU | OCP_USER_SDMA,
2365}; 1788};
2366 1789
2367/* l3 main -> gfx */ 1790/* l3 main -> gfx */
2368static struct omap_hwmod_addr_space am33xx_gfx_addrs[] = {
2369 {
2370 .pa_start = 0x56000000,
2371 .pa_end = 0x56000000 + SZ_16M - 1,
2372 .flags = ADDR_TYPE_RT
2373 },
2374 { }
2375};
2376
2377static struct omap_hwmod_ocp_if am33xx_l3_main__gfx = { 1791static struct omap_hwmod_ocp_if am33xx_l3_main__gfx = {
2378 .master = &am33xx_l3_main_hwmod, 1792 .master = &am33xx_l3_main_hwmod,
2379 .slave = &am33xx_gfx_hwmod, 1793 .slave = &am33xx_gfx_hwmod,
2380 .clk = "dpll_core_m4_ck", 1794 .clk = "dpll_core_m4_ck",
2381 .addr = am33xx_gfx_addrs,
2382 .user = OCP_USER_MPU | OCP_USER_SDMA, 1795 .user = OCP_USER_MPU | OCP_USER_SDMA,
2383}; 1796};
2384 1797
2385/* l4 wkup -> smartreflex0 */ 1798/* l4 wkup -> smartreflex0 */
2386static struct omap_hwmod_addr_space am33xx_smartreflex0_addrs[] = {
2387 {
2388 .pa_start = 0x44e37000,
2389 .pa_end = 0x44e37000 + SZ_4K - 1,
2390 .flags = ADDR_TYPE_RT
2391 },
2392 { }
2393};
2394
2395static struct omap_hwmod_ocp_if am33xx_l4_wkup__smartreflex0 = { 1799static struct omap_hwmod_ocp_if am33xx_l4_wkup__smartreflex0 = {
2396 .master = &am33xx_l4_wkup_hwmod, 1800 .master = &am33xx_l4_wkup_hwmod,
2397 .slave = &am33xx_smartreflex0_hwmod, 1801 .slave = &am33xx_smartreflex0_hwmod,
2398 .clk = "dpll_core_m4_div2_ck", 1802 .clk = "dpll_core_m4_div2_ck",
2399 .addr = am33xx_smartreflex0_addrs,
2400 .user = OCP_USER_MPU, 1803 .user = OCP_USER_MPU,
2401}; 1804};
2402 1805
2403/* l4 wkup -> smartreflex1 */ 1806/* l4 wkup -> smartreflex1 */
2404static struct omap_hwmod_addr_space am33xx_smartreflex1_addrs[] = {
2405 {
2406 .pa_start = 0x44e39000,
2407 .pa_end = 0x44e39000 + SZ_4K - 1,
2408 .flags = ADDR_TYPE_RT
2409 },
2410 { }
2411};
2412
2413static struct omap_hwmod_ocp_if am33xx_l4_wkup__smartreflex1 = { 1807static struct omap_hwmod_ocp_if am33xx_l4_wkup__smartreflex1 = {
2414 .master = &am33xx_l4_wkup_hwmod, 1808 .master = &am33xx_l4_wkup_hwmod,
2415 .slave = &am33xx_smartreflex1_hwmod, 1809 .slave = &am33xx_smartreflex1_hwmod,
2416 .clk = "dpll_core_m4_div2_ck", 1810 .clk = "dpll_core_m4_div2_ck",
2417 .addr = am33xx_smartreflex1_addrs,
2418 .user = OCP_USER_MPU, 1811 .user = OCP_USER_MPU,
2419}; 1812};
2420 1813
2421/* l4 wkup -> control */ 1814/* l4 wkup -> control */
2422static struct omap_hwmod_addr_space am33xx_control_addrs[] = {
2423 {
2424 .pa_start = 0x44e10000,
2425 .pa_end = 0x44e10000 + SZ_8K - 1,
2426 .flags = ADDR_TYPE_RT
2427 },
2428 { }
2429};
2430
2431static struct omap_hwmod_ocp_if am33xx_l4_wkup__control = { 1815static struct omap_hwmod_ocp_if am33xx_l4_wkup__control = {
2432 .master = &am33xx_l4_wkup_hwmod, 1816 .master = &am33xx_l4_wkup_hwmod,
2433 .slave = &am33xx_control_hwmod, 1817 .slave = &am33xx_control_hwmod,
2434 .clk = "dpll_core_m4_div2_ck", 1818 .clk = "dpll_core_m4_div2_ck",
2435 .addr = am33xx_control_addrs,
2436 .user = OCP_USER_MPU, 1819 .user = OCP_USER_MPU,
2437}; 1820};
2438 1821
2439/* l4 wkup -> rtc */ 1822/* l4 wkup -> rtc */
2440static struct omap_hwmod_addr_space am33xx_rtc_addrs[] = {
2441 {
2442 .pa_start = 0x44e3e000,
2443 .pa_end = 0x44e3e000 + SZ_4K - 1,
2444 .flags = ADDR_TYPE_RT
2445 },
2446 { }
2447};
2448
2449static struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = { 1823static struct omap_hwmod_ocp_if am33xx_l4_wkup__rtc = {
2450 .master = &am33xx_l4_wkup_hwmod, 1824 .master = &am33xx_l4_wkup_hwmod,
2451 .slave = &am33xx_rtc_hwmod, 1825 .slave = &am33xx_rtc_hwmod,
2452 .clk = "clkdiv32k_ick", 1826 .clk = "clkdiv32k_ick",
2453 .addr = am33xx_rtc_addrs,
2454 .user = OCP_USER_MPU, 1827 .user = OCP_USER_MPU,
2455}; 1828};
2456 1829
2457/* l4 per/ls -> DCAN0 */ 1830/* l4 per/ls -> DCAN0 */
2458static struct omap_hwmod_addr_space am33xx_dcan0_addrs[] = {
2459 {
2460 .pa_start = 0x481CC000,
2461 .pa_end = 0x481CC000 + SZ_4K - 1,
2462 .flags = ADDR_TYPE_RT
2463 },
2464 { }
2465};
2466
2467static struct omap_hwmod_ocp_if am33xx_l4_per__dcan0 = { 1831static struct omap_hwmod_ocp_if am33xx_l4_per__dcan0 = {
2468 .master = &am33xx_l4_ls_hwmod, 1832 .master = &am33xx_l4_ls_hwmod,
2469 .slave = &am33xx_dcan0_hwmod, 1833 .slave = &am33xx_dcan0_hwmod,
2470 .clk = "l4ls_gclk", 1834 .clk = "l4ls_gclk",
2471 .addr = am33xx_dcan0_addrs,
2472 .user = OCP_USER_MPU | OCP_USER_SDMA, 1835 .user = OCP_USER_MPU | OCP_USER_SDMA,
2473}; 1836};
2474 1837
2475/* l4 per/ls -> DCAN1 */ 1838/* l4 per/ls -> DCAN1 */
2476static struct omap_hwmod_addr_space am33xx_dcan1_addrs[] = {
2477 {
2478 .pa_start = 0x481D0000,
2479 .pa_end = 0x481D0000 + SZ_4K - 1,
2480 .flags = ADDR_TYPE_RT
2481 },
2482 { }
2483};
2484
2485static struct omap_hwmod_ocp_if am33xx_l4_per__dcan1 = { 1839static struct omap_hwmod_ocp_if am33xx_l4_per__dcan1 = {
2486 .master = &am33xx_l4_ls_hwmod, 1840 .master = &am33xx_l4_ls_hwmod,
2487 .slave = &am33xx_dcan1_hwmod, 1841 .slave = &am33xx_dcan1_hwmod,
2488 .clk = "l4ls_gclk", 1842 .clk = "l4ls_gclk",
2489 .addr = am33xx_dcan1_addrs,
2490 .user = OCP_USER_MPU | OCP_USER_SDMA, 1843 .user = OCP_USER_MPU | OCP_USER_SDMA,
2491}; 1844};
2492 1845
2493/* l4 per/ls -> GPIO2 */ 1846/* l4 per/ls -> GPIO2 */
2494static struct omap_hwmod_addr_space am33xx_gpio1_addrs[] = {
2495 {
2496 .pa_start = 0x4804C000,
2497 .pa_end = 0x4804C000 + SZ_4K - 1,
2498 .flags = ADDR_TYPE_RT,
2499 },
2500 { }
2501};
2502
2503static struct omap_hwmod_ocp_if am33xx_l4_per__gpio1 = { 1847static struct omap_hwmod_ocp_if am33xx_l4_per__gpio1 = {
2504 .master = &am33xx_l4_ls_hwmod, 1848 .master = &am33xx_l4_ls_hwmod,
2505 .slave = &am33xx_gpio1_hwmod, 1849 .slave = &am33xx_gpio1_hwmod,
2506 .clk = "l4ls_gclk", 1850 .clk = "l4ls_gclk",
2507 .addr = am33xx_gpio1_addrs,
2508 .user = OCP_USER_MPU | OCP_USER_SDMA, 1851 .user = OCP_USER_MPU | OCP_USER_SDMA,
2509}; 1852};
2510 1853
2511/* l4 per/ls -> gpio3 */ 1854/* l4 per/ls -> gpio3 */
2512static struct omap_hwmod_addr_space am33xx_gpio2_addrs[] = {
2513 {
2514 .pa_start = 0x481AC000,
2515 .pa_end = 0x481AC000 + SZ_4K - 1,
2516 .flags = ADDR_TYPE_RT,
2517 },
2518 { }
2519};
2520
2521static struct omap_hwmod_ocp_if am33xx_l4_per__gpio2 = { 1855static struct omap_hwmod_ocp_if am33xx_l4_per__gpio2 = {
2522 .master = &am33xx_l4_ls_hwmod, 1856 .master = &am33xx_l4_ls_hwmod,
2523 .slave = &am33xx_gpio2_hwmod, 1857 .slave = &am33xx_gpio2_hwmod,
2524 .clk = "l4ls_gclk", 1858 .clk = "l4ls_gclk",
2525 .addr = am33xx_gpio2_addrs,
2526 .user = OCP_USER_MPU | OCP_USER_SDMA, 1859 .user = OCP_USER_MPU | OCP_USER_SDMA,
2527}; 1860};
2528 1861
2529/* l4 per/ls -> gpio4 */ 1862/* l4 per/ls -> gpio4 */
2530static struct omap_hwmod_addr_space am33xx_gpio3_addrs[] = {
2531 {
2532 .pa_start = 0x481AE000,
2533 .pa_end = 0x481AE000 + SZ_4K - 1,
2534 .flags = ADDR_TYPE_RT,
2535 },
2536 { }
2537};
2538
2539static struct omap_hwmod_ocp_if am33xx_l4_per__gpio3 = { 1863static struct omap_hwmod_ocp_if am33xx_l4_per__gpio3 = {
2540 .master = &am33xx_l4_ls_hwmod, 1864 .master = &am33xx_l4_ls_hwmod,
2541 .slave = &am33xx_gpio3_hwmod, 1865 .slave = &am33xx_gpio3_hwmod,
2542 .clk = "l4ls_gclk", 1866 .clk = "l4ls_gclk",
2543 .addr = am33xx_gpio3_addrs,
2544 .user = OCP_USER_MPU | OCP_USER_SDMA, 1867 .user = OCP_USER_MPU | OCP_USER_SDMA,
2545}; 1868};
2546 1869
2547/* L4 WKUP -> I2C1 */ 1870/* L4 WKUP -> I2C1 */
2548static struct omap_hwmod_addr_space am33xx_i2c1_addr_space[] = {
2549 {
2550 .pa_start = 0x44E0B000,
2551 .pa_end = 0x44E0B000 + SZ_4K - 1,
2552 .flags = ADDR_TYPE_RT,
2553 },
2554 { }
2555};
2556
2557static struct omap_hwmod_ocp_if am33xx_l4_wkup__i2c1 = { 1871static struct omap_hwmod_ocp_if am33xx_l4_wkup__i2c1 = {
2558 .master = &am33xx_l4_wkup_hwmod, 1872 .master = &am33xx_l4_wkup_hwmod,
2559 .slave = &am33xx_i2c1_hwmod, 1873 .slave = &am33xx_i2c1_hwmod,
2560 .clk = "dpll_core_m4_div2_ck", 1874 .clk = "dpll_core_m4_div2_ck",
2561 .addr = am33xx_i2c1_addr_space,
2562 .user = OCP_USER_MPU, 1875 .user = OCP_USER_MPU,
2563}; 1876};
2564 1877
2565/* L4 WKUP -> GPIO1 */ 1878/* L4 WKUP -> GPIO1 */
2566static struct omap_hwmod_addr_space am33xx_gpio0_addrs[] = {
2567 {
2568 .pa_start = 0x44E07000,
2569 .pa_end = 0x44E07000 + SZ_4K - 1,
2570 .flags = ADDR_TYPE_RT,
2571 },
2572 { }
2573};
2574
2575static struct omap_hwmod_ocp_if am33xx_l4_wkup__gpio0 = { 1879static struct omap_hwmod_ocp_if am33xx_l4_wkup__gpio0 = {
2576 .master = &am33xx_l4_wkup_hwmod, 1880 .master = &am33xx_l4_wkup_hwmod,
2577 .slave = &am33xx_gpio0_hwmod, 1881 .slave = &am33xx_gpio0_hwmod,
2578 .clk = "dpll_core_m4_div2_ck", 1882 .clk = "dpll_core_m4_div2_ck",
2579 .addr = am33xx_gpio0_addrs,
2580 .user = OCP_USER_MPU | OCP_USER_SDMA, 1883 .user = OCP_USER_MPU | OCP_USER_SDMA,
2581}; 1884};
2582 1885
@@ -2598,41 +1901,16 @@ static struct omap_hwmod_ocp_if am33xx_l4_wkup__adc_tsc = {
2598 .user = OCP_USER_MPU, 1901 .user = OCP_USER_MPU,
2599}; 1902};
2600 1903
2601static struct omap_hwmod_addr_space am33xx_cpgmac0_addr_space[] = {
2602 /* cpsw ss */
2603 {
2604 .pa_start = 0x4a100000,
2605 .pa_end = 0x4a100000 + SZ_2K - 1,
2606 },
2607 /* cpsw wr */
2608 {
2609 .pa_start = 0x4a101200,
2610 .pa_end = 0x4a101200 + SZ_256 - 1,
2611 .flags = ADDR_TYPE_RT,
2612 },
2613 { }
2614};
2615
2616static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = { 1904static struct omap_hwmod_ocp_if am33xx_l4_hs__cpgmac0 = {
2617 .master = &am33xx_l4_hs_hwmod, 1905 .master = &am33xx_l4_hs_hwmod,
2618 .slave = &am33xx_cpgmac0_hwmod, 1906 .slave = &am33xx_cpgmac0_hwmod,
2619 .clk = "cpsw_125mhz_gclk", 1907 .clk = "cpsw_125mhz_gclk",
2620 .addr = am33xx_cpgmac0_addr_space,
2621 .user = OCP_USER_MPU, 1908 .user = OCP_USER_MPU,
2622}; 1909};
2623 1910
2624static struct omap_hwmod_addr_space am33xx_mdio_addr_space[] = {
2625 {
2626 .pa_start = 0x4A101000,
2627 .pa_end = 0x4A101000 + SZ_256 - 1,
2628 },
2629 { }
2630};
2631
2632static struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = { 1911static struct omap_hwmod_ocp_if am33xx_cpgmac0__mdio = {
2633 .master = &am33xx_cpgmac0_hwmod, 1912 .master = &am33xx_cpgmac0_hwmod,
2634 .slave = &am33xx_mdio_hwmod, 1913 .slave = &am33xx_mdio_hwmod,
2635 .addr = am33xx_mdio_addr_space,
2636 .user = OCP_USER_MPU, 1914 .user = OCP_USER_MPU,
2637}; 1915};
2638 1916
@@ -2670,51 +1948,24 @@ static struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss0 = {
2670 .user = OCP_USER_MPU, 1948 .user = OCP_USER_MPU,
2671}; 1949};
2672 1950
2673static struct omap_hwmod_addr_space am33xx_ecap0_addr_space[] = {
2674 {
2675 .pa_start = 0x48300100,
2676 .pa_end = 0x48300100 + SZ_128 - 1,
2677 },
2678 { }
2679};
2680
2681static struct omap_hwmod_ocp_if am33xx_epwmss0__ecap0 = { 1951static struct omap_hwmod_ocp_if am33xx_epwmss0__ecap0 = {
2682 .master = &am33xx_epwmss0_hwmod, 1952 .master = &am33xx_epwmss0_hwmod,
2683 .slave = &am33xx_ecap0_hwmod, 1953 .slave = &am33xx_ecap0_hwmod,
2684 .clk = "l4ls_gclk", 1954 .clk = "l4ls_gclk",
2685 .addr = am33xx_ecap0_addr_space,
2686 .user = OCP_USER_MPU, 1955 .user = OCP_USER_MPU,
2687}; 1956};
2688 1957
2689static struct omap_hwmod_addr_space am33xx_eqep0_addr_space[] = {
2690 {
2691 .pa_start = 0x48300180,
2692 .pa_end = 0x48300180 + SZ_128 - 1,
2693 },
2694 { }
2695};
2696
2697static struct omap_hwmod_ocp_if am33xx_epwmss0__eqep0 = { 1958static struct omap_hwmod_ocp_if am33xx_epwmss0__eqep0 = {
2698 .master = &am33xx_epwmss0_hwmod, 1959 .master = &am33xx_epwmss0_hwmod,
2699 .slave = &am33xx_eqep0_hwmod, 1960 .slave = &am33xx_eqep0_hwmod,
2700 .clk = "l4ls_gclk", 1961 .clk = "l4ls_gclk",
2701 .addr = am33xx_eqep0_addr_space,
2702 .user = OCP_USER_MPU, 1962 .user = OCP_USER_MPU,
2703}; 1963};
2704 1964
2705static struct omap_hwmod_addr_space am33xx_ehrpwm0_addr_space[] = {
2706 {
2707 .pa_start = 0x48300200,
2708 .pa_end = 0x48300200 + SZ_128 - 1,
2709 },
2710 { }
2711};
2712
2713static struct omap_hwmod_ocp_if am33xx_epwmss0__ehrpwm0 = { 1965static struct omap_hwmod_ocp_if am33xx_epwmss0__ehrpwm0 = {
2714 .master = &am33xx_epwmss0_hwmod, 1966 .master = &am33xx_epwmss0_hwmod,
2715 .slave = &am33xx_ehrpwm0_hwmod, 1967 .slave = &am33xx_ehrpwm0_hwmod,
2716 .clk = "l4ls_gclk", 1968 .clk = "l4ls_gclk",
2717 .addr = am33xx_ehrpwm0_addr_space,
2718 .user = OCP_USER_MPU, 1969 .user = OCP_USER_MPU,
2719}; 1970};
2720 1971
@@ -2736,51 +1987,24 @@ static struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss1 = {
2736 .user = OCP_USER_MPU, 1987 .user = OCP_USER_MPU,
2737}; 1988};
2738 1989
2739static struct omap_hwmod_addr_space am33xx_ecap1_addr_space[] = {
2740 {
2741 .pa_start = 0x48302100,
2742 .pa_end = 0x48302100 + SZ_128 - 1,
2743 },
2744 { }
2745};
2746
2747static struct omap_hwmod_ocp_if am33xx_epwmss1__ecap1 = { 1990static struct omap_hwmod_ocp_if am33xx_epwmss1__ecap1 = {
2748 .master = &am33xx_epwmss1_hwmod, 1991 .master = &am33xx_epwmss1_hwmod,
2749 .slave = &am33xx_ecap1_hwmod, 1992 .slave = &am33xx_ecap1_hwmod,
2750 .clk = "l4ls_gclk", 1993 .clk = "l4ls_gclk",
2751 .addr = am33xx_ecap1_addr_space,
2752 .user = OCP_USER_MPU, 1994 .user = OCP_USER_MPU,
2753}; 1995};
2754 1996
2755static struct omap_hwmod_addr_space am33xx_eqep1_addr_space[] = {
2756 {
2757 .pa_start = 0x48302180,
2758 .pa_end = 0x48302180 + SZ_128 - 1,
2759 },
2760 { }
2761};
2762
2763static struct omap_hwmod_ocp_if am33xx_epwmss1__eqep1 = { 1997static struct omap_hwmod_ocp_if am33xx_epwmss1__eqep1 = {
2764 .master = &am33xx_epwmss1_hwmod, 1998 .master = &am33xx_epwmss1_hwmod,
2765 .slave = &am33xx_eqep1_hwmod, 1999 .slave = &am33xx_eqep1_hwmod,
2766 .clk = "l4ls_gclk", 2000 .clk = "l4ls_gclk",
2767 .addr = am33xx_eqep1_addr_space,
2768 .user = OCP_USER_MPU, 2001 .user = OCP_USER_MPU,
2769}; 2002};
2770 2003
2771static struct omap_hwmod_addr_space am33xx_ehrpwm1_addr_space[] = {
2772 {
2773 .pa_start = 0x48302200,
2774 .pa_end = 0x48302200 + SZ_128 - 1,
2775 },
2776 { }
2777};
2778
2779static struct omap_hwmod_ocp_if am33xx_epwmss1__ehrpwm1 = { 2004static struct omap_hwmod_ocp_if am33xx_epwmss1__ehrpwm1 = {
2780 .master = &am33xx_epwmss1_hwmod, 2005 .master = &am33xx_epwmss1_hwmod,
2781 .slave = &am33xx_ehrpwm1_hwmod, 2006 .slave = &am33xx_ehrpwm1_hwmod,
2782 .clk = "l4ls_gclk", 2007 .clk = "l4ls_gclk",
2783 .addr = am33xx_ehrpwm1_addr_space,
2784 .user = OCP_USER_MPU, 2008 .user = OCP_USER_MPU,
2785}; 2009};
2786 2010
@@ -2801,51 +2025,24 @@ static struct omap_hwmod_ocp_if am33xx_l4_ls__epwmss2 = {
2801 .user = OCP_USER_MPU, 2025 .user = OCP_USER_MPU,
2802}; 2026};
2803 2027
2804static struct omap_hwmod_addr_space am33xx_ecap2_addr_space[] = {
2805 {
2806 .pa_start = 0x48304100,
2807 .pa_end = 0x48304100 + SZ_128 - 1,
2808 },
2809 { }
2810};
2811
2812static struct omap_hwmod_ocp_if am33xx_epwmss2__ecap2 = { 2028static struct omap_hwmod_ocp_if am33xx_epwmss2__ecap2 = {
2813 .master = &am33xx_epwmss2_hwmod, 2029 .master = &am33xx_epwmss2_hwmod,
2814 .slave = &am33xx_ecap2_hwmod, 2030 .slave = &am33xx_ecap2_hwmod,
2815 .clk = "l4ls_gclk", 2031 .clk = "l4ls_gclk",
2816 .addr = am33xx_ecap2_addr_space,
2817 .user = OCP_USER_MPU, 2032 .user = OCP_USER_MPU,
2818}; 2033};
2819 2034
2820static struct omap_hwmod_addr_space am33xx_eqep2_addr_space[] = {
2821 {
2822 .pa_start = 0x48304180,
2823 .pa_end = 0x48304180 + SZ_128 - 1,
2824 },
2825 { }
2826};
2827
2828static struct omap_hwmod_ocp_if am33xx_epwmss2__eqep2 = { 2035static struct omap_hwmod_ocp_if am33xx_epwmss2__eqep2 = {
2829 .master = &am33xx_epwmss2_hwmod, 2036 .master = &am33xx_epwmss2_hwmod,
2830 .slave = &am33xx_eqep2_hwmod, 2037 .slave = &am33xx_eqep2_hwmod,
2831 .clk = "l4ls_gclk", 2038 .clk = "l4ls_gclk",
2832 .addr = am33xx_eqep2_addr_space,
2833 .user = OCP_USER_MPU, 2039 .user = OCP_USER_MPU,
2834}; 2040};
2835 2041
2836static struct omap_hwmod_addr_space am33xx_ehrpwm2_addr_space[] = {
2837 {
2838 .pa_start = 0x48304200,
2839 .pa_end = 0x48304200 + SZ_128 - 1,
2840 },
2841 { }
2842};
2843
2844static struct omap_hwmod_ocp_if am33xx_epwmss2__ehrpwm2 = { 2042static struct omap_hwmod_ocp_if am33xx_epwmss2__ehrpwm2 = {
2845 .master = &am33xx_epwmss2_hwmod, 2043 .master = &am33xx_epwmss2_hwmod,
2846 .slave = &am33xx_ehrpwm2_hwmod, 2044 .slave = &am33xx_ehrpwm2_hwmod,
2847 .clk = "l4ls_gclk", 2045 .clk = "l4ls_gclk",
2848 .addr = am33xx_ehrpwm2_addr_space,
2849 .user = OCP_USER_MPU, 2046 .user = OCP_USER_MPU,
2850}; 2047};
2851 2048
@@ -2868,37 +2065,17 @@ static struct omap_hwmod_ocp_if am33xx_l3_s__gpmc = {
2868}; 2065};
2869 2066
2870/* i2c2 */ 2067/* i2c2 */
2871static struct omap_hwmod_addr_space am33xx_i2c2_addr_space[] = {
2872 {
2873 .pa_start = 0x4802A000,
2874 .pa_end = 0x4802A000 + SZ_4K - 1,
2875 .flags = ADDR_TYPE_RT,
2876 },
2877 { }
2878};
2879
2880static struct omap_hwmod_ocp_if am33xx_l4_per__i2c2 = { 2068static struct omap_hwmod_ocp_if am33xx_l4_per__i2c2 = {
2881 .master = &am33xx_l4_ls_hwmod, 2069 .master = &am33xx_l4_ls_hwmod,
2882 .slave = &am33xx_i2c2_hwmod, 2070 .slave = &am33xx_i2c2_hwmod,
2883 .clk = "l4ls_gclk", 2071 .clk = "l4ls_gclk",
2884 .addr = am33xx_i2c2_addr_space,
2885 .user = OCP_USER_MPU, 2072 .user = OCP_USER_MPU,
2886}; 2073};
2887 2074
2888static struct omap_hwmod_addr_space am33xx_i2c3_addr_space[] = {
2889 {
2890 .pa_start = 0x4819C000,
2891 .pa_end = 0x4819C000 + SZ_4K - 1,
2892 .flags = ADDR_TYPE_RT
2893 },
2894 { }
2895};
2896
2897static struct omap_hwmod_ocp_if am33xx_l4_per__i2c3 = { 2075static struct omap_hwmod_ocp_if am33xx_l4_per__i2c3 = {
2898 .master = &am33xx_l4_ls_hwmod, 2076 .master = &am33xx_l4_ls_hwmod,
2899 .slave = &am33xx_i2c3_hwmod, 2077 .slave = &am33xx_i2c3_hwmod,
2900 .clk = "l4ls_gclk", 2078 .clk = "l4ls_gclk",
2901 .addr = am33xx_i2c3_addr_space,
2902 .user = OCP_USER_MPU, 2079 .user = OCP_USER_MPU,
2903}; 2080};
2904 2081
@@ -2938,20 +2115,10 @@ static struct omap_hwmod_ocp_if am33xx_l4_per__mailbox = {
2938}; 2115};
2939 2116
2940/* l4 ls -> spinlock */ 2117/* l4 ls -> spinlock */
2941static struct omap_hwmod_addr_space am33xx_spinlock_addrs[] = {
2942 {
2943 .pa_start = 0x480Ca000,
2944 .pa_end = 0x480Ca000 + SZ_4K - 1,
2945 .flags = ADDR_TYPE_RT
2946 },
2947 { }
2948};
2949
2950static struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock = { 2118static struct omap_hwmod_ocp_if am33xx_l4_ls__spinlock = {
2951 .master = &am33xx_l4_ls_hwmod, 2119 .master = &am33xx_l4_ls_hwmod,
2952 .slave = &am33xx_spinlock_hwmod, 2120 .slave = &am33xx_spinlock_hwmod,
2953 .clk = "l4ls_gclk", 2121 .clk = "l4ls_gclk",
2954 .addr = am33xx_spinlock_addrs,
2955 .user = OCP_USER_MPU, 2122 .user = OCP_USER_MPU,
2956}; 2123};
2957 2124
@@ -2973,24 +2140,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp0 = {
2973 .user = OCP_USER_MPU, 2140 .user = OCP_USER_MPU,
2974}; 2141};
2975 2142
2976/* l3 s -> mcasp0 data */
2977static struct omap_hwmod_addr_space am33xx_mcasp0_data_addr_space[] = {
2978 {
2979 .pa_start = 0x46000000,
2980 .pa_end = 0x46000000 + SZ_4M - 1,
2981 .flags = ADDR_TYPE_RT
2982 },
2983 { }
2984};
2985
2986static struct omap_hwmod_ocp_if am33xx_l3_s__mcasp0_data = {
2987 .master = &am33xx_l3_s_hwmod,
2988 .slave = &am33xx_mcasp0_hwmod,
2989 .clk = "l3s_gclk",
2990 .addr = am33xx_mcasp0_data_addr_space,
2991 .user = OCP_USER_SDMA,
2992};
2993
2994/* l4 ls -> mcasp1 */ 2143/* l4 ls -> mcasp1 */
2995static struct omap_hwmod_addr_space am33xx_mcasp1_addr_space[] = { 2144static struct omap_hwmod_addr_space am33xx_mcasp1_addr_space[] = {
2996 { 2145 {
@@ -3009,24 +2158,6 @@ static struct omap_hwmod_ocp_if am33xx_l4_ls__mcasp1 = {
3009 .user = OCP_USER_MPU, 2158 .user = OCP_USER_MPU,
3010}; 2159};
3011 2160
3012/* l3 s -> mcasp1 data */
3013static struct omap_hwmod_addr_space am33xx_mcasp1_data_addr_space[] = {
3014 {
3015 .pa_start = 0x46400000,
3016 .pa_end = 0x46400000 + SZ_4M - 1,
3017 .flags = ADDR_TYPE_RT
3018 },
3019 { }
3020};
3021
3022static struct omap_hwmod_ocp_if am33xx_l3_s__mcasp1_data = {
3023 .master = &am33xx_l3_s_hwmod,
3024 .slave = &am33xx_mcasp1_hwmod,
3025 .clk = "l3s_gclk",
3026 .addr = am33xx_mcasp1_data_addr_space,
3027 .user = OCP_USER_SDMA,
3028};
3029
3030/* l4 ls -> mmc0 */ 2161/* l4 ls -> mmc0 */
3031static struct omap_hwmod_addr_space am33xx_mmc0_addr_space[] = { 2162static struct omap_hwmod_addr_space am33xx_mmc0_addr_space[] = {
3032 { 2163 {
@@ -3082,182 +2213,82 @@ static struct omap_hwmod_ocp_if am33xx_l3_s__mmc2 = {
3082}; 2213};
3083 2214
3084/* l4 ls -> mcspi0 */ 2215/* l4 ls -> mcspi0 */
3085static struct omap_hwmod_addr_space am33xx_mcspi0_addr_space[] = {
3086 {
3087 .pa_start = 0x48030000,
3088 .pa_end = 0x48030000 + SZ_1K - 1,
3089 .flags = ADDR_TYPE_RT,
3090 },
3091 { }
3092};
3093
3094static struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0 = { 2216static struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi0 = {
3095 .master = &am33xx_l4_ls_hwmod, 2217 .master = &am33xx_l4_ls_hwmod,
3096 .slave = &am33xx_spi0_hwmod, 2218 .slave = &am33xx_spi0_hwmod,
3097 .clk = "l4ls_gclk", 2219 .clk = "l4ls_gclk",
3098 .addr = am33xx_mcspi0_addr_space,
3099 .user = OCP_USER_MPU, 2220 .user = OCP_USER_MPU,
3100}; 2221};
3101 2222
3102/* l4 ls -> mcspi1 */ 2223/* l4 ls -> mcspi1 */
3103static struct omap_hwmod_addr_space am33xx_mcspi1_addr_space[] = {
3104 {
3105 .pa_start = 0x481A0000,
3106 .pa_end = 0x481A0000 + SZ_1K - 1,
3107 .flags = ADDR_TYPE_RT,
3108 },
3109 { }
3110};
3111
3112static struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1 = { 2224static struct omap_hwmod_ocp_if am33xx_l4_ls__mcspi1 = {
3113 .master = &am33xx_l4_ls_hwmod, 2225 .master = &am33xx_l4_ls_hwmod,
3114 .slave = &am33xx_spi1_hwmod, 2226 .slave = &am33xx_spi1_hwmod,
3115 .clk = "l4ls_gclk", 2227 .clk = "l4ls_gclk",
3116 .addr = am33xx_mcspi1_addr_space,
3117 .user = OCP_USER_MPU, 2228 .user = OCP_USER_MPU,
3118}; 2229};
3119 2230
3120/* l4 wkup -> timer1 */ 2231/* l4 wkup -> timer1 */
3121static struct omap_hwmod_addr_space am33xx_timer1_addr_space[] = {
3122 {
3123 .pa_start = 0x44E31000,
3124 .pa_end = 0x44E31000 + SZ_1K - 1,
3125 .flags = ADDR_TYPE_RT
3126 },
3127 { }
3128};
3129
3130static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = { 2232static struct omap_hwmod_ocp_if am33xx_l4_wkup__timer1 = {
3131 .master = &am33xx_l4_wkup_hwmod, 2233 .master = &am33xx_l4_wkup_hwmod,
3132 .slave = &am33xx_timer1_hwmod, 2234 .slave = &am33xx_timer1_hwmod,
3133 .clk = "dpll_core_m4_div2_ck", 2235 .clk = "dpll_core_m4_div2_ck",
3134 .addr = am33xx_timer1_addr_space,
3135 .user = OCP_USER_MPU, 2236 .user = OCP_USER_MPU,
3136}; 2237};
3137 2238
3138/* l4 per -> timer2 */ 2239/* l4 per -> timer2 */
3139static struct omap_hwmod_addr_space am33xx_timer2_addr_space[] = {
3140 {
3141 .pa_start = 0x48040000,
3142 .pa_end = 0x48040000 + SZ_1K - 1,
3143 .flags = ADDR_TYPE_RT
3144 },
3145 { }
3146};
3147
3148static struct omap_hwmod_ocp_if am33xx_l4_ls__timer2 = { 2240static struct omap_hwmod_ocp_if am33xx_l4_ls__timer2 = {
3149 .master = &am33xx_l4_ls_hwmod, 2241 .master = &am33xx_l4_ls_hwmod,
3150 .slave = &am33xx_timer2_hwmod, 2242 .slave = &am33xx_timer2_hwmod,
3151 .clk = "l4ls_gclk", 2243 .clk = "l4ls_gclk",
3152 .addr = am33xx_timer2_addr_space,
3153 .user = OCP_USER_MPU, 2244 .user = OCP_USER_MPU,
3154}; 2245};
3155 2246
3156/* l4 per -> timer3 */ 2247/* l4 per -> timer3 */
3157static struct omap_hwmod_addr_space am33xx_timer3_addr_space[] = {
3158 {
3159 .pa_start = 0x48042000,
3160 .pa_end = 0x48042000 + SZ_1K - 1,
3161 .flags = ADDR_TYPE_RT
3162 },
3163 { }
3164};
3165
3166static struct omap_hwmod_ocp_if am33xx_l4_ls__timer3 = { 2248static struct omap_hwmod_ocp_if am33xx_l4_ls__timer3 = {
3167 .master = &am33xx_l4_ls_hwmod, 2249 .master = &am33xx_l4_ls_hwmod,
3168 .slave = &am33xx_timer3_hwmod, 2250 .slave = &am33xx_timer3_hwmod,
3169 .clk = "l4ls_gclk", 2251 .clk = "l4ls_gclk",
3170 .addr = am33xx_timer3_addr_space,
3171 .user = OCP_USER_MPU, 2252 .user = OCP_USER_MPU,
3172}; 2253};
3173 2254
3174/* l4 per -> timer4 */ 2255/* l4 per -> timer4 */
3175static struct omap_hwmod_addr_space am33xx_timer4_addr_space[] = {
3176 {
3177 .pa_start = 0x48044000,
3178 .pa_end = 0x48044000 + SZ_1K - 1,
3179 .flags = ADDR_TYPE_RT
3180 },
3181 { }
3182};
3183
3184static struct omap_hwmod_ocp_if am33xx_l4_ls__timer4 = { 2256static struct omap_hwmod_ocp_if am33xx_l4_ls__timer4 = {
3185 .master = &am33xx_l4_ls_hwmod, 2257 .master = &am33xx_l4_ls_hwmod,
3186 .slave = &am33xx_timer4_hwmod, 2258 .slave = &am33xx_timer4_hwmod,
3187 .clk = "l4ls_gclk", 2259 .clk = "l4ls_gclk",
3188 .addr = am33xx_timer4_addr_space,
3189 .user = OCP_USER_MPU, 2260 .user = OCP_USER_MPU,
3190}; 2261};
3191 2262
3192/* l4 per -> timer5 */ 2263/* l4 per -> timer5 */
3193static struct omap_hwmod_addr_space am33xx_timer5_addr_space[] = {
3194 {
3195 .pa_start = 0x48046000,
3196 .pa_end = 0x48046000 + SZ_1K - 1,
3197 .flags = ADDR_TYPE_RT
3198 },
3199 { }
3200};
3201
3202static struct omap_hwmod_ocp_if am33xx_l4_ls__timer5 = { 2264static struct omap_hwmod_ocp_if am33xx_l4_ls__timer5 = {
3203 .master = &am33xx_l4_ls_hwmod, 2265 .master = &am33xx_l4_ls_hwmod,
3204 .slave = &am33xx_timer5_hwmod, 2266 .slave = &am33xx_timer5_hwmod,
3205 .clk = "l4ls_gclk", 2267 .clk = "l4ls_gclk",
3206 .addr = am33xx_timer5_addr_space,
3207 .user = OCP_USER_MPU, 2268 .user = OCP_USER_MPU,
3208}; 2269};
3209 2270
3210/* l4 per -> timer6 */ 2271/* l4 per -> timer6 */
3211static struct omap_hwmod_addr_space am33xx_timer6_addr_space[] = {
3212 {
3213 .pa_start = 0x48048000,
3214 .pa_end = 0x48048000 + SZ_1K - 1,
3215 .flags = ADDR_TYPE_RT
3216 },
3217 { }
3218};
3219
3220static struct omap_hwmod_ocp_if am33xx_l4_ls__timer6 = { 2272static struct omap_hwmod_ocp_if am33xx_l4_ls__timer6 = {
3221 .master = &am33xx_l4_ls_hwmod, 2273 .master = &am33xx_l4_ls_hwmod,
3222 .slave = &am33xx_timer6_hwmod, 2274 .slave = &am33xx_timer6_hwmod,
3223 .clk = "l4ls_gclk", 2275 .clk = "l4ls_gclk",
3224 .addr = am33xx_timer6_addr_space,
3225 .user = OCP_USER_MPU, 2276 .user = OCP_USER_MPU,
3226}; 2277};
3227 2278
3228/* l4 per -> timer7 */ 2279/* l4 per -> timer7 */
3229static struct omap_hwmod_addr_space am33xx_timer7_addr_space[] = {
3230 {
3231 .pa_start = 0x4804A000,
3232 .pa_end = 0x4804A000 + SZ_1K - 1,
3233 .flags = ADDR_TYPE_RT
3234 },
3235 { }
3236};
3237
3238static struct omap_hwmod_ocp_if am33xx_l4_ls__timer7 = { 2280static struct omap_hwmod_ocp_if am33xx_l4_ls__timer7 = {
3239 .master = &am33xx_l4_ls_hwmod, 2281 .master = &am33xx_l4_ls_hwmod,
3240 .slave = &am33xx_timer7_hwmod, 2282 .slave = &am33xx_timer7_hwmod,
3241 .clk = "l4ls_gclk", 2283 .clk = "l4ls_gclk",
3242 .addr = am33xx_timer7_addr_space,
3243 .user = OCP_USER_MPU, 2284 .user = OCP_USER_MPU,
3244}; 2285};
3245 2286
3246/* l3 main -> tpcc */ 2287/* l3 main -> tpcc */
3247static struct omap_hwmod_addr_space am33xx_tpcc_addr_space[] = {
3248 {
3249 .pa_start = 0x49000000,
3250 .pa_end = 0x49000000 + SZ_32K - 1,
3251 .flags = ADDR_TYPE_RT
3252 },
3253 { }
3254};
3255
3256static struct omap_hwmod_ocp_if am33xx_l3_main__tpcc = { 2288static struct omap_hwmod_ocp_if am33xx_l3_main__tpcc = {
3257 .master = &am33xx_l3_main_hwmod, 2289 .master = &am33xx_l3_main_hwmod,
3258 .slave = &am33xx_tpcc_hwmod, 2290 .slave = &am33xx_tpcc_hwmod,
3259 .clk = "l3_gclk", 2291 .clk = "l3_gclk",
3260 .addr = am33xx_tpcc_addr_space,
3261 .user = OCP_USER_MPU, 2292 .user = OCP_USER_MPU,
3262}; 2293};
3263 2294
@@ -3316,160 +2347,67 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__tptc2 = {
3316}; 2347};
3317 2348
3318/* l4 wkup -> uart1 */ 2349/* l4 wkup -> uart1 */
3319static struct omap_hwmod_addr_space am33xx_uart1_addr_space[] = {
3320 {
3321 .pa_start = 0x44E09000,
3322 .pa_end = 0x44E09000 + SZ_8K - 1,
3323 .flags = ADDR_TYPE_RT,
3324 },
3325 { }
3326};
3327
3328static struct omap_hwmod_ocp_if am33xx_l4_wkup__uart1 = { 2350static struct omap_hwmod_ocp_if am33xx_l4_wkup__uart1 = {
3329 .master = &am33xx_l4_wkup_hwmod, 2351 .master = &am33xx_l4_wkup_hwmod,
3330 .slave = &am33xx_uart1_hwmod, 2352 .slave = &am33xx_uart1_hwmod,
3331 .clk = "dpll_core_m4_div2_ck", 2353 .clk = "dpll_core_m4_div2_ck",
3332 .addr = am33xx_uart1_addr_space,
3333 .user = OCP_USER_MPU, 2354 .user = OCP_USER_MPU,
3334}; 2355};
3335 2356
3336/* l4 ls -> uart2 */ 2357/* l4 ls -> uart2 */
3337static struct omap_hwmod_addr_space am33xx_uart2_addr_space[] = {
3338 {
3339 .pa_start = 0x48022000,
3340 .pa_end = 0x48022000 + SZ_8K - 1,
3341 .flags = ADDR_TYPE_RT,
3342 },
3343 { }
3344};
3345
3346static struct omap_hwmod_ocp_if am33xx_l4_ls__uart2 = { 2358static struct omap_hwmod_ocp_if am33xx_l4_ls__uart2 = {
3347 .master = &am33xx_l4_ls_hwmod, 2359 .master = &am33xx_l4_ls_hwmod,
3348 .slave = &am33xx_uart2_hwmod, 2360 .slave = &am33xx_uart2_hwmod,
3349 .clk = "l4ls_gclk", 2361 .clk = "l4ls_gclk",
3350 .addr = am33xx_uart2_addr_space,
3351 .user = OCP_USER_MPU, 2362 .user = OCP_USER_MPU,
3352}; 2363};
3353 2364
3354/* l4 ls -> uart3 */ 2365/* l4 ls -> uart3 */
3355static struct omap_hwmod_addr_space am33xx_uart3_addr_space[] = {
3356 {
3357 .pa_start = 0x48024000,
3358 .pa_end = 0x48024000 + SZ_8K - 1,
3359 .flags = ADDR_TYPE_RT,
3360 },
3361 { }
3362};
3363
3364static struct omap_hwmod_ocp_if am33xx_l4_ls__uart3 = { 2366static struct omap_hwmod_ocp_if am33xx_l4_ls__uart3 = {
3365 .master = &am33xx_l4_ls_hwmod, 2367 .master = &am33xx_l4_ls_hwmod,
3366 .slave = &am33xx_uart3_hwmod, 2368 .slave = &am33xx_uart3_hwmod,
3367 .clk = "l4ls_gclk", 2369 .clk = "l4ls_gclk",
3368 .addr = am33xx_uart3_addr_space,
3369 .user = OCP_USER_MPU, 2370 .user = OCP_USER_MPU,
3370}; 2371};
3371 2372
3372/* l4 ls -> uart4 */ 2373/* l4 ls -> uart4 */
3373static struct omap_hwmod_addr_space am33xx_uart4_addr_space[] = {
3374 {
3375 .pa_start = 0x481A6000,
3376 .pa_end = 0x481A6000 + SZ_8K - 1,
3377 .flags = ADDR_TYPE_RT,
3378 },
3379 { }
3380};
3381
3382static struct omap_hwmod_ocp_if am33xx_l4_ls__uart4 = { 2374static struct omap_hwmod_ocp_if am33xx_l4_ls__uart4 = {
3383 .master = &am33xx_l4_ls_hwmod, 2375 .master = &am33xx_l4_ls_hwmod,
3384 .slave = &am33xx_uart4_hwmod, 2376 .slave = &am33xx_uart4_hwmod,
3385 .clk = "l4ls_gclk", 2377 .clk = "l4ls_gclk",
3386 .addr = am33xx_uart4_addr_space,
3387 .user = OCP_USER_MPU, 2378 .user = OCP_USER_MPU,
3388}; 2379};
3389 2380
3390/* l4 ls -> uart5 */ 2381/* l4 ls -> uart5 */
3391static struct omap_hwmod_addr_space am33xx_uart5_addr_space[] = {
3392 {
3393 .pa_start = 0x481A8000,
3394 .pa_end = 0x481A8000 + SZ_8K - 1,
3395 .flags = ADDR_TYPE_RT,
3396 },
3397 { }
3398};
3399
3400static struct omap_hwmod_ocp_if am33xx_l4_ls__uart5 = { 2382static struct omap_hwmod_ocp_if am33xx_l4_ls__uart5 = {
3401 .master = &am33xx_l4_ls_hwmod, 2383 .master = &am33xx_l4_ls_hwmod,
3402 .slave = &am33xx_uart5_hwmod, 2384 .slave = &am33xx_uart5_hwmod,
3403 .clk = "l4ls_gclk", 2385 .clk = "l4ls_gclk",
3404 .addr = am33xx_uart5_addr_space,
3405 .user = OCP_USER_MPU, 2386 .user = OCP_USER_MPU,
3406}; 2387};
3407 2388
3408/* l4 ls -> uart6 */ 2389/* l4 ls -> uart6 */
3409static struct omap_hwmod_addr_space am33xx_uart6_addr_space[] = {
3410 {
3411 .pa_start = 0x481aa000,
3412 .pa_end = 0x481aa000 + SZ_8K - 1,
3413 .flags = ADDR_TYPE_RT,
3414 },
3415 { }
3416};
3417
3418static struct omap_hwmod_ocp_if am33xx_l4_ls__uart6 = { 2390static struct omap_hwmod_ocp_if am33xx_l4_ls__uart6 = {
3419 .master = &am33xx_l4_ls_hwmod, 2391 .master = &am33xx_l4_ls_hwmod,
3420 .slave = &am33xx_uart6_hwmod, 2392 .slave = &am33xx_uart6_hwmod,
3421 .clk = "l4ls_gclk", 2393 .clk = "l4ls_gclk",
3422 .addr = am33xx_uart6_addr_space,
3423 .user = OCP_USER_MPU, 2394 .user = OCP_USER_MPU,
3424}; 2395};
3425 2396
3426/* l4 wkup -> wd_timer1 */ 2397/* l4 wkup -> wd_timer1 */
3427static struct omap_hwmod_addr_space am33xx_wd_timer1_addrs[] = {
3428 {
3429 .pa_start = 0x44e35000,
3430 .pa_end = 0x44e35000 + SZ_4K - 1,
3431 .flags = ADDR_TYPE_RT
3432 },
3433 { }
3434};
3435
3436static struct omap_hwmod_ocp_if am33xx_l4_wkup__wd_timer1 = { 2398static struct omap_hwmod_ocp_if am33xx_l4_wkup__wd_timer1 = {
3437 .master = &am33xx_l4_wkup_hwmod, 2399 .master = &am33xx_l4_wkup_hwmod,
3438 .slave = &am33xx_wd_timer1_hwmod, 2400 .slave = &am33xx_wd_timer1_hwmod,
3439 .clk = "dpll_core_m4_div2_ck", 2401 .clk = "dpll_core_m4_div2_ck",
3440 .addr = am33xx_wd_timer1_addrs,
3441 .user = OCP_USER_MPU, 2402 .user = OCP_USER_MPU,
3442}; 2403};
3443 2404
3444/* usbss */ 2405/* usbss */
3445/* l3 s -> USBSS interface */ 2406/* l3 s -> USBSS interface */
3446static struct omap_hwmod_addr_space am33xx_usbss_addr_space[] = {
3447 {
3448 .name = "usbss",
3449 .pa_start = 0x47400000,
3450 .pa_end = 0x47400000 + SZ_4K - 1,
3451 .flags = ADDR_TYPE_RT
3452 },
3453 {
3454 .name = "musb0",
3455 .pa_start = 0x47401000,
3456 .pa_end = 0x47401000 + SZ_2K - 1,
3457 .flags = ADDR_TYPE_RT
3458 },
3459 {
3460 .name = "musb1",
3461 .pa_start = 0x47401800,
3462 .pa_end = 0x47401800 + SZ_2K - 1,
3463 .flags = ADDR_TYPE_RT
3464 },
3465 { }
3466};
3467
3468static struct omap_hwmod_ocp_if am33xx_l3_s__usbss = { 2407static struct omap_hwmod_ocp_if am33xx_l3_s__usbss = {
3469 .master = &am33xx_l3_s_hwmod, 2408 .master = &am33xx_l3_s_hwmod,
3470 .slave = &am33xx_usbss_hwmod, 2409 .slave = &am33xx_usbss_hwmod,
3471 .clk = "l3s_gclk", 2410 .clk = "l3s_gclk",
3472 .addr = am33xx_usbss_addr_space,
3473 .user = OCP_USER_MPU, 2411 .user = OCP_USER_MPU,
3474 .flags = OCPIF_SWSUP_IDLE, 2412 .flags = OCPIF_SWSUP_IDLE,
3475}; 2413};
@@ -3518,13 +2456,11 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
3518}; 2456};
3519 2457
3520static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = { 2458static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3521 &am33xx_l4_fw__emif_fw,
3522 &am33xx_l3_main__emif, 2459 &am33xx_l3_main__emif,
3523 &am33xx_mpu__l3_main, 2460 &am33xx_mpu__l3_main,
3524 &am33xx_mpu__prcm, 2461 &am33xx_mpu__prcm,
3525 &am33xx_l3_s__l4_ls, 2462 &am33xx_l3_s__l4_ls,
3526 &am33xx_l3_s__l4_wkup, 2463 &am33xx_l3_s__l4_wkup,
3527 &am33xx_l3_s__l4_fw,
3528 &am33xx_l3_main__l4_hs, 2464 &am33xx_l3_main__l4_hs,
3529 &am33xx_l3_main__l3_s, 2465 &am33xx_l3_main__l3_s,
3530 &am33xx_l3_main__l3_instr, 2466 &am33xx_l3_main__l3_instr,
@@ -3554,9 +2490,7 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3554 &am33xx_l4_per__i2c3, 2490 &am33xx_l4_per__i2c3,
3555 &am33xx_l4_per__mailbox, 2491 &am33xx_l4_per__mailbox,
3556 &am33xx_l4_ls__mcasp0, 2492 &am33xx_l4_ls__mcasp0,
3557 &am33xx_l3_s__mcasp0_data,
3558 &am33xx_l4_ls__mcasp1, 2493 &am33xx_l4_ls__mcasp1,
3559 &am33xx_l3_s__mcasp1_data,
3560 &am33xx_l4_ls__mmc0, 2494 &am33xx_l4_ls__mmc0,
3561 &am33xx_l4_ls__mmc1, 2495 &am33xx_l4_ls__mmc1,
3562 &am33xx_l3_s__mmc2, 2496 &am33xx_l3_s__mmc2,
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 31c7126eb3bb..f7a3df2fb579 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -25,6 +25,7 @@
25#include <linux/platform_data/asoc-ti-mcbsp.h> 25#include <linux/platform_data/asoc-ti-mcbsp.h>
26#include <linux/platform_data/spi-omap2-mcspi.h> 26#include <linux/platform_data/spi-omap2-mcspi.h>
27#include <linux/platform_data/iommu-omap.h> 27#include <linux/platform_data/iommu-omap.h>
28#include <linux/platform_data/mailbox-omap.h>
28#include <plat/dmtimer.h> 29#include <plat/dmtimer.h>
29 30
30#include "am35xx.h" 31#include "am35xx.h"
@@ -35,7 +36,6 @@
35#include "prm-regbits-34xx.h" 36#include "prm-regbits-34xx.h"
36#include "cm-regbits-34xx.h" 37#include "cm-regbits-34xx.h"
37 38
38#include "dma.h"
39#include "i2c.h" 39#include "i2c.h"
40#include "mmc.h" 40#include "mmc.h"
41#include "wd_timer.h" 41#include "wd_timer.h"
@@ -548,8 +548,8 @@ static struct omap_hwmod_irq_info uart4_mpu_irqs[] = {
548}; 548};
549 549
550static struct omap_hwmod_dma_info uart4_sdma_reqs[] = { 550static struct omap_hwmod_dma_info uart4_sdma_reqs[] = {
551 { .name = "rx", .dma_req = OMAP36XX_DMA_UART4_RX, }, 551 { .name = "rx", .dma_req = 82, },
552 { .name = "tx", .dma_req = OMAP36XX_DMA_UART4_TX, }, 552 { .name = "tx", .dma_req = 81, },
553 { .dma_req = -1 } 553 { .dma_req = -1 }
554}; 554};
555 555
@@ -577,8 +577,8 @@ static struct omap_hwmod_irq_info am35xx_uart4_mpu_irqs[] = {
577}; 577};
578 578
579static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = { 579static struct omap_hwmod_dma_info am35xx_uart4_sdma_reqs[] = {
580 { .name = "rx", .dma_req = AM35XX_DMA_UART4_RX, }, 580 { .name = "rx", .dma_req = 55, },
581 { .name = "tx", .dma_req = AM35XX_DMA_UART4_TX, }, 581 { .name = "tx", .dma_req = 54, },
582 { .dma_req = -1 } 582 { .dma_req = -1 }
583}; 583};
584 584
@@ -857,8 +857,8 @@ static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {
857}; 857};
858 858
859static struct omap_hwmod_dma_info i2c3_sdma_reqs[] = { 859static struct omap_hwmod_dma_info i2c3_sdma_reqs[] = {
860 { .name = "tx", .dma_req = OMAP34XX_DMA_I2C3_TX }, 860 { .name = "tx", .dma_req = 25 },
861 { .name = "rx", .dma_req = OMAP34XX_DMA_I2C3_RX }, 861 { .name = "rx", .dma_req = 26 },
862 { .dma_req = -1 } 862 { .dma_req = -1 }
863}; 863};
864 864
@@ -1505,6 +1505,17 @@ static struct omap_hwmod_class omap3xxx_mailbox_hwmod_class = {
1505 .sysc = &omap3xxx_mailbox_sysc, 1505 .sysc = &omap3xxx_mailbox_sysc,
1506}; 1506};
1507 1507
1508static struct omap_mbox_dev_info omap3xxx_mailbox_info[] = {
1509 { .name = "dsp", .tx_id = 0, .rx_id = 1 },
1510};
1511
1512static struct omap_mbox_pdata omap3xxx_mailbox_attrs = {
1513 .num_users = 2,
1514 .num_fifos = 2,
1515 .info_cnt = ARRAY_SIZE(omap3xxx_mailbox_info),
1516 .info = omap3xxx_mailbox_info,
1517};
1518
1508static struct omap_hwmod_irq_info omap3xxx_mailbox_irqs[] = { 1519static struct omap_hwmod_irq_info omap3xxx_mailbox_irqs[] = {
1509 { .irq = 26 + OMAP_INTC_START, }, 1520 { .irq = 26 + OMAP_INTC_START, },
1510 { .irq = -1 }, 1521 { .irq = -1 },
@@ -1524,6 +1535,7 @@ static struct omap_hwmod omap3xxx_mailbox_hwmod = {
1524 .idlest_idle_bit = OMAP3430_ST_MAILBOXES_SHIFT, 1535 .idlest_idle_bit = OMAP3430_ST_MAILBOXES_SHIFT,
1525 }, 1536 },
1526 }, 1537 },
1538 .dev_attr = &omap3xxx_mailbox_attrs,
1527}; 1539};
1528 1540
1529/* 1541/*
@@ -3581,7 +3593,7 @@ static struct omap_hwmod_irq_info omap3_sham_mpu_irqs[] = {
3581}; 3593};
3582 3594
3583static struct omap_hwmod_dma_info omap3_sham_sdma_reqs[] = { 3595static struct omap_hwmod_dma_info omap3_sham_sdma_reqs[] = {
3584 { .name = "rx", .dma_req = OMAP34XX_DMA_SHA1MD5_RX, }, 3596 { .name = "rx", .dma_req = 69, },
3585 { .dma_req = -1 } 3597 { .dma_req = -1 }
3586}; 3598};
3587 3599
@@ -3642,8 +3654,8 @@ static struct omap_hwmod_class omap3xxx_aes_class = {
3642}; 3654};
3643 3655
3644static struct omap_hwmod_dma_info omap3_aes_sdma_reqs[] = { 3656static struct omap_hwmod_dma_info omap3_aes_sdma_reqs[] = {
3645 { .name = "tx", .dma_req = OMAP34XX_DMA_AES2_TX, }, 3657 { .name = "tx", .dma_req = 65, },
3646 { .name = "rx", .dma_req = OMAP34XX_DMA_AES2_RX, }, 3658 { .name = "rx", .dma_req = 66, },
3647 { .dma_req = -1 } 3659 { .dma_req = -1 }
3648}; 3660};
3649 3661
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 848b6dc67590..d04b5e60fdbe 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -12,6 +12,8 @@
12 * with the public linux-omap@vger.kernel.org mailing list and the 12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept 13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents. 14 * up-to-date with the file contents.
15 * Note that this file is currently not in sync with autogeneration scripts.
16 * The above note to be removed, once it is synced up.
15 * 17 *
16 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as 19 * it under the terms of the GNU General Public License version 2 as
@@ -21,7 +23,6 @@
21#include <linux/io.h> 23#include <linux/io.h>
22#include <linux/platform_data/gpio-omap.h> 24#include <linux/platform_data/gpio-omap.h>
23#include <linux/power/smartreflex.h> 25#include <linux/power/smartreflex.h>
24#include <linux/platform_data/omap_ocp2scp.h>
25#include <linux/i2c-omap.h> 26#include <linux/i2c-omap.h>
26 27
27#include <linux/omap-dma.h> 28#include <linux/omap-dma.h>
@@ -52,27 +53,6 @@
52 */ 53 */
53 54
54/* 55/*
55 * 'c2c_target_fw' class
56 * instance(s): c2c_target_fw
57 */
58static struct omap_hwmod_class omap44xx_c2c_target_fw_hwmod_class = {
59 .name = "c2c_target_fw",
60};
61
62/* c2c_target_fw */
63static struct omap_hwmod omap44xx_c2c_target_fw_hwmod = {
64 .name = "c2c_target_fw",
65 .class = &omap44xx_c2c_target_fw_hwmod_class,
66 .clkdm_name = "d2d_clkdm",
67 .prcm = {
68 .omap4 = {
69 .clkctrl_offs = OMAP4_CM_D2D_SAD2D_FW_CLKCTRL_OFFSET,
70 .context_offs = OMAP4_RM_D2D_SAD2D_FW_CONTEXT_OFFSET,
71 },
72 },
73};
74
75/*
76 * 'dmm' class 56 * 'dmm' class
77 * instance(s): dmm 57 * instance(s): dmm
78 */ 58 */
@@ -81,16 +61,10 @@ static struct omap_hwmod_class omap44xx_dmm_hwmod_class = {
81}; 61};
82 62
83/* dmm */ 63/* dmm */
84static struct omap_hwmod_irq_info omap44xx_dmm_irqs[] = {
85 { .irq = 113 + OMAP44XX_IRQ_GIC_START },
86 { .irq = -1 }
87};
88
89static struct omap_hwmod omap44xx_dmm_hwmod = { 64static struct omap_hwmod omap44xx_dmm_hwmod = {
90 .name = "dmm", 65 .name = "dmm",
91 .class = &omap44xx_dmm_hwmod_class, 66 .class = &omap44xx_dmm_hwmod_class,
92 .clkdm_name = "l3_emif_clkdm", 67 .clkdm_name = "l3_emif_clkdm",
93 .mpu_irqs = omap44xx_dmm_irqs,
94 .prcm = { 68 .prcm = {
95 .omap4 = { 69 .omap4 = {
96 .clkctrl_offs = OMAP4_CM_MEMIF_DMM_CLKCTRL_OFFSET, 70 .clkctrl_offs = OMAP4_CM_MEMIF_DMM_CLKCTRL_OFFSET,
@@ -100,27 +74,6 @@ static struct omap_hwmod omap44xx_dmm_hwmod = {
100}; 74};
101 75
102/* 76/*
103 * 'emif_fw' class
104 * instance(s): emif_fw
105 */
106static struct omap_hwmod_class omap44xx_emif_fw_hwmod_class = {
107 .name = "emif_fw",
108};
109
110/* emif_fw */
111static struct omap_hwmod omap44xx_emif_fw_hwmod = {
112 .name = "emif_fw",
113 .class = &omap44xx_emif_fw_hwmod_class,
114 .clkdm_name = "l3_emif_clkdm",
115 .prcm = {
116 .omap4 = {
117 .clkctrl_offs = OMAP4_CM_MEMIF_EMIF_FW_CLKCTRL_OFFSET,
118 .context_offs = OMAP4_RM_MEMIF_EMIF_FW_CONTEXT_OFFSET,
119 },
120 },
121};
122
123/*
124 * 'l3' class 77 * 'l3' class
125 * instance(s): l3_instr, l3_main_1, l3_main_2, l3_main_3 78 * instance(s): l3_instr, l3_main_1, l3_main_2, l3_main_3
126 */ 79 */
@@ -143,17 +96,10 @@ static struct omap_hwmod omap44xx_l3_instr_hwmod = {
143}; 96};
144 97
145/* l3_main_1 */ 98/* l3_main_1 */
146static struct omap_hwmod_irq_info omap44xx_l3_main_1_irqs[] = {
147 { .name = "dbg_err", .irq = 9 + OMAP44XX_IRQ_GIC_START },
148 { .name = "app_err", .irq = 10 + OMAP44XX_IRQ_GIC_START },
149 { .irq = -1 }
150};
151
152static struct omap_hwmod omap44xx_l3_main_1_hwmod = { 99static struct omap_hwmod omap44xx_l3_main_1_hwmod = {
153 .name = "l3_main_1", 100 .name = "l3_main_1",
154 .class = &omap44xx_l3_hwmod_class, 101 .class = &omap44xx_l3_hwmod_class,
155 .clkdm_name = "l3_1_clkdm", 102 .clkdm_name = "l3_1_clkdm",
156 .mpu_irqs = omap44xx_l3_main_1_irqs,
157 .prcm = { 103 .prcm = {
158 .omap4 = { 104 .omap4 = {
159 .clkctrl_offs = OMAP4_CM_L3_1_L3_1_CLKCTRL_OFFSET, 105 .clkctrl_offs = OMAP4_CM_L3_1_L3_1_CLKCTRL_OFFSET,
@@ -326,29 +272,10 @@ static struct omap_hwmod_class omap44xx_aess_hwmod_class = {
326}; 272};
327 273
328/* aess */ 274/* aess */
329static struct omap_hwmod_irq_info omap44xx_aess_irqs[] = {
330 { .irq = 99 + OMAP44XX_IRQ_GIC_START },
331 { .irq = -1 }
332};
333
334static struct omap_hwmod_dma_info omap44xx_aess_sdma_reqs[] = {
335 { .name = "fifo0", .dma_req = 100 + OMAP44XX_DMA_REQ_START },
336 { .name = "fifo1", .dma_req = 101 + OMAP44XX_DMA_REQ_START },
337 { .name = "fifo2", .dma_req = 102 + OMAP44XX_DMA_REQ_START },
338 { .name = "fifo3", .dma_req = 103 + OMAP44XX_DMA_REQ_START },
339 { .name = "fifo4", .dma_req = 104 + OMAP44XX_DMA_REQ_START },
340 { .name = "fifo5", .dma_req = 105 + OMAP44XX_DMA_REQ_START },
341 { .name = "fifo6", .dma_req = 106 + OMAP44XX_DMA_REQ_START },
342 { .name = "fifo7", .dma_req = 107 + OMAP44XX_DMA_REQ_START },
343 { .dma_req = -1 }
344};
345
346static struct omap_hwmod omap44xx_aess_hwmod = { 275static struct omap_hwmod omap44xx_aess_hwmod = {
347 .name = "aess", 276 .name = "aess",
348 .class = &omap44xx_aess_hwmod_class, 277 .class = &omap44xx_aess_hwmod_class,
349 .clkdm_name = "abe_clkdm", 278 .clkdm_name = "abe_clkdm",
350 .mpu_irqs = omap44xx_aess_irqs,
351 .sdma_reqs = omap44xx_aess_sdma_reqs,
352 .main_clk = "aess_fclk", 279 .main_clk = "aess_fclk",
353 .prcm = { 280 .prcm = {
354 .omap4 = { 281 .omap4 = {
@@ -371,22 +298,10 @@ static struct omap_hwmod_class omap44xx_c2c_hwmod_class = {
371}; 298};
372 299
373/* c2c */ 300/* c2c */
374static struct omap_hwmod_irq_info omap44xx_c2c_irqs[] = {
375 { .irq = 88 + OMAP44XX_IRQ_GIC_START },
376 { .irq = -1 }
377};
378
379static struct omap_hwmod_dma_info omap44xx_c2c_sdma_reqs[] = {
380 { .dma_req = 68 + OMAP44XX_DMA_REQ_START },
381 { .dma_req = -1 }
382};
383
384static struct omap_hwmod omap44xx_c2c_hwmod = { 301static struct omap_hwmod omap44xx_c2c_hwmod = {
385 .name = "c2c", 302 .name = "c2c",
386 .class = &omap44xx_c2c_hwmod_class, 303 .class = &omap44xx_c2c_hwmod_class,
387 .clkdm_name = "d2d_clkdm", 304 .clkdm_name = "d2d_clkdm",
388 .mpu_irqs = omap44xx_c2c_irqs,
389 .sdma_reqs = omap44xx_c2c_sdma_reqs,
390 .prcm = { 305 .prcm = {
391 .omap4 = { 306 .omap4 = {
392 .clkctrl_offs = OMAP4_CM_D2D_SAD2D_CLKCTRL_OFFSET, 307 .clkctrl_offs = OMAP4_CM_D2D_SAD2D_CLKCTRL_OFFSET,
@@ -449,16 +364,10 @@ static struct omap_hwmod_class omap44xx_ctrl_module_hwmod_class = {
449}; 364};
450 365
451/* ctrl_module_core */ 366/* ctrl_module_core */
452static struct omap_hwmod_irq_info omap44xx_ctrl_module_core_irqs[] = {
453 { .irq = 8 + OMAP44XX_IRQ_GIC_START },
454 { .irq = -1 }
455};
456
457static struct omap_hwmod omap44xx_ctrl_module_core_hwmod = { 367static struct omap_hwmod omap44xx_ctrl_module_core_hwmod = {
458 .name = "ctrl_module_core", 368 .name = "ctrl_module_core",
459 .class = &omap44xx_ctrl_module_hwmod_class, 369 .class = &omap44xx_ctrl_module_hwmod_class,
460 .clkdm_name = "l4_cfg_clkdm", 370 .clkdm_name = "l4_cfg_clkdm",
461 .mpu_irqs = omap44xx_ctrl_module_core_irqs,
462 .prcm = { 371 .prcm = {
463 .omap4 = { 372 .omap4 = {
464 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT, 373 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
@@ -601,22 +510,10 @@ static struct omap_hwmod_class omap44xx_dmic_hwmod_class = {
601}; 510};
602 511
603/* dmic */ 512/* dmic */
604static struct omap_hwmod_irq_info omap44xx_dmic_irqs[] = {
605 { .irq = 114 + OMAP44XX_IRQ_GIC_START },
606 { .irq = -1 }
607};
608
609static struct omap_hwmod_dma_info omap44xx_dmic_sdma_reqs[] = {
610 { .dma_req = 66 + OMAP44XX_DMA_REQ_START },
611 { .dma_req = -1 }
612};
613
614static struct omap_hwmod omap44xx_dmic_hwmod = { 513static struct omap_hwmod omap44xx_dmic_hwmod = {
615 .name = "dmic", 514 .name = "dmic",
616 .class = &omap44xx_dmic_hwmod_class, 515 .class = &omap44xx_dmic_hwmod_class,
617 .clkdm_name = "abe_clkdm", 516 .clkdm_name = "abe_clkdm",
618 .mpu_irqs = omap44xx_dmic_irqs,
619 .sdma_reqs = omap44xx_dmic_sdma_reqs,
620 .main_clk = "func_dmic_abe_gfclk", 517 .main_clk = "func_dmic_abe_gfclk",
621 .prcm = { 518 .prcm = {
622 .omap4 = { 519 .omap4 = {
@@ -637,11 +534,6 @@ static struct omap_hwmod_class omap44xx_dsp_hwmod_class = {
637}; 534};
638 535
639/* dsp */ 536/* dsp */
640static struct omap_hwmod_irq_info omap44xx_dsp_irqs[] = {
641 { .irq = 28 + OMAP44XX_IRQ_GIC_START },
642 { .irq = -1 }
643};
644
645static struct omap_hwmod_rst_info omap44xx_dsp_resets[] = { 537static struct omap_hwmod_rst_info omap44xx_dsp_resets[] = {
646 { .name = "dsp", .rst_shift = 0 }, 538 { .name = "dsp", .rst_shift = 0 },
647}; 539};
@@ -650,7 +542,6 @@ static struct omap_hwmod omap44xx_dsp_hwmod = {
650 .name = "dsp", 542 .name = "dsp",
651 .class = &omap44xx_dsp_hwmod_class, 543 .class = &omap44xx_dsp_hwmod_class,
652 .clkdm_name = "tesla_clkdm", 544 .clkdm_name = "tesla_clkdm",
653 .mpu_irqs = omap44xx_dsp_irqs,
654 .rst_lines = omap44xx_dsp_resets, 545 .rst_lines = omap44xx_dsp_resets,
655 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets), 546 .rst_lines_cnt = ARRAY_SIZE(omap44xx_dsp_resets),
656 .main_clk = "dpll_iva_m4x2_ck", 547 .main_clk = "dpll_iva_m4x2_ck",
@@ -992,16 +883,10 @@ static struct omap_hwmod_class omap44xx_elm_hwmod_class = {
992}; 883};
993 884
994/* elm */ 885/* elm */
995static struct omap_hwmod_irq_info omap44xx_elm_irqs[] = {
996 { .irq = 4 + OMAP44XX_IRQ_GIC_START },
997 { .irq = -1 }
998};
999
1000static struct omap_hwmod omap44xx_elm_hwmod = { 886static struct omap_hwmod omap44xx_elm_hwmod = {
1001 .name = "elm", 887 .name = "elm",
1002 .class = &omap44xx_elm_hwmod_class, 888 .class = &omap44xx_elm_hwmod_class,
1003 .clkdm_name = "l4_per_clkdm", 889 .clkdm_name = "l4_per_clkdm",
1004 .mpu_irqs = omap44xx_elm_irqs,
1005 .prcm = { 890 .prcm = {
1006 .omap4 = { 891 .omap4 = {
1007 .clkctrl_offs = OMAP4_CM_L4PER_ELM_CLKCTRL_OFFSET, 892 .clkctrl_offs = OMAP4_CM_L4PER_ELM_CLKCTRL_OFFSET,
@@ -1025,17 +910,11 @@ static struct omap_hwmod_class omap44xx_emif_hwmod_class = {
1025}; 910};
1026 911
1027/* emif1 */ 912/* emif1 */
1028static struct omap_hwmod_irq_info omap44xx_emif1_irqs[] = {
1029 { .irq = 110 + OMAP44XX_IRQ_GIC_START },
1030 { .irq = -1 }
1031};
1032
1033static struct omap_hwmod omap44xx_emif1_hwmod = { 913static struct omap_hwmod omap44xx_emif1_hwmod = {
1034 .name = "emif1", 914 .name = "emif1",
1035 .class = &omap44xx_emif_hwmod_class, 915 .class = &omap44xx_emif_hwmod_class,
1036 .clkdm_name = "l3_emif_clkdm", 916 .clkdm_name = "l3_emif_clkdm",
1037 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 917 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1038 .mpu_irqs = omap44xx_emif1_irqs,
1039 .main_clk = "ddrphy_ck", 918 .main_clk = "ddrphy_ck",
1040 .prcm = { 919 .prcm = {
1041 .omap4 = { 920 .omap4 = {
@@ -1047,17 +926,11 @@ static struct omap_hwmod omap44xx_emif1_hwmod = {
1047}; 926};
1048 927
1049/* emif2 */ 928/* emif2 */
1050static struct omap_hwmod_irq_info omap44xx_emif2_irqs[] = {
1051 { .irq = 111 + OMAP44XX_IRQ_GIC_START },
1052 { .irq = -1 }
1053};
1054
1055static struct omap_hwmod omap44xx_emif2_hwmod = { 929static struct omap_hwmod omap44xx_emif2_hwmod = {
1056 .name = "emif2", 930 .name = "emif2",
1057 .class = &omap44xx_emif_hwmod_class, 931 .class = &omap44xx_emif_hwmod_class,
1058 .clkdm_name = "l3_emif_clkdm", 932 .clkdm_name = "l3_emif_clkdm",
1059 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 933 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1060 .mpu_irqs = omap44xx_emif2_irqs,
1061 .main_clk = "ddrphy_ck", 934 .main_clk = "ddrphy_ck",
1062 .prcm = { 935 .prcm = {
1063 .omap4 = { 936 .omap4 = {
@@ -1098,16 +971,10 @@ static struct omap_hwmod_class omap44xx_fdif_hwmod_class = {
1098}; 971};
1099 972
1100/* fdif */ 973/* fdif */
1101static struct omap_hwmod_irq_info omap44xx_fdif_irqs[] = {
1102 { .irq = 69 + OMAP44XX_IRQ_GIC_START },
1103 { .irq = -1 }
1104};
1105
1106static struct omap_hwmod omap44xx_fdif_hwmod = { 974static struct omap_hwmod omap44xx_fdif_hwmod = {
1107 .name = "fdif", 975 .name = "fdif",
1108 .class = &omap44xx_fdif_hwmod_class, 976 .class = &omap44xx_fdif_hwmod_class,
1109 .clkdm_name = "iss_clkdm", 977 .clkdm_name = "iss_clkdm",
1110 .mpu_irqs = omap44xx_fdif_irqs,
1111 .main_clk = "fdif_fck", 978 .main_clk = "fdif_fck",
1112 .prcm = { 979 .prcm = {
1113 .omap4 = { 980 .omap4 = {
@@ -1148,11 +1015,6 @@ static struct omap_gpio_dev_attr gpio_dev_attr = {
1148}; 1015};
1149 1016
1150/* gpio1 */ 1017/* gpio1 */
1151static struct omap_hwmod_irq_info omap44xx_gpio1_irqs[] = {
1152 { .irq = 29 + OMAP44XX_IRQ_GIC_START },
1153 { .irq = -1 }
1154};
1155
1156static struct omap_hwmod_opt_clk gpio1_opt_clks[] = { 1018static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
1157 { .role = "dbclk", .clk = "gpio1_dbclk" }, 1019 { .role = "dbclk", .clk = "gpio1_dbclk" },
1158}; 1020};
@@ -1161,7 +1023,6 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
1161 .name = "gpio1", 1023 .name = "gpio1",
1162 .class = &omap44xx_gpio_hwmod_class, 1024 .class = &omap44xx_gpio_hwmod_class,
1163 .clkdm_name = "l4_wkup_clkdm", 1025 .clkdm_name = "l4_wkup_clkdm",
1164 .mpu_irqs = omap44xx_gpio1_irqs,
1165 .main_clk = "l4_wkup_clk_mux_ck", 1026 .main_clk = "l4_wkup_clk_mux_ck",
1166 .prcm = { 1027 .prcm = {
1167 .omap4 = { 1028 .omap4 = {
@@ -1176,11 +1037,6 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
1176}; 1037};
1177 1038
1178/* gpio2 */ 1039/* gpio2 */
1179static struct omap_hwmod_irq_info omap44xx_gpio2_irqs[] = {
1180 { .irq = 30 + OMAP44XX_IRQ_GIC_START },
1181 { .irq = -1 }
1182};
1183
1184static struct omap_hwmod_opt_clk gpio2_opt_clks[] = { 1040static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
1185 { .role = "dbclk", .clk = "gpio2_dbclk" }, 1041 { .role = "dbclk", .clk = "gpio2_dbclk" },
1186}; 1042};
@@ -1190,7 +1046,6 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
1190 .class = &omap44xx_gpio_hwmod_class, 1046 .class = &omap44xx_gpio_hwmod_class,
1191 .clkdm_name = "l4_per_clkdm", 1047 .clkdm_name = "l4_per_clkdm",
1192 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 1048 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1193 .mpu_irqs = omap44xx_gpio2_irqs,
1194 .main_clk = "l4_div_ck", 1049 .main_clk = "l4_div_ck",
1195 .prcm = { 1050 .prcm = {
1196 .omap4 = { 1051 .omap4 = {
@@ -1205,11 +1060,6 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
1205}; 1060};
1206 1061
1207/* gpio3 */ 1062/* gpio3 */
1208static struct omap_hwmod_irq_info omap44xx_gpio3_irqs[] = {
1209 { .irq = 31 + OMAP44XX_IRQ_GIC_START },
1210 { .irq = -1 }
1211};
1212
1213static struct omap_hwmod_opt_clk gpio3_opt_clks[] = { 1063static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
1214 { .role = "dbclk", .clk = "gpio3_dbclk" }, 1064 { .role = "dbclk", .clk = "gpio3_dbclk" },
1215}; 1065};
@@ -1219,7 +1069,6 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
1219 .class = &omap44xx_gpio_hwmod_class, 1069 .class = &omap44xx_gpio_hwmod_class,
1220 .clkdm_name = "l4_per_clkdm", 1070 .clkdm_name = "l4_per_clkdm",
1221 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 1071 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1222 .mpu_irqs = omap44xx_gpio3_irqs,
1223 .main_clk = "l4_div_ck", 1072 .main_clk = "l4_div_ck",
1224 .prcm = { 1073 .prcm = {
1225 .omap4 = { 1074 .omap4 = {
@@ -1234,11 +1083,6 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
1234}; 1083};
1235 1084
1236/* gpio4 */ 1085/* gpio4 */
1237static struct omap_hwmod_irq_info omap44xx_gpio4_irqs[] = {
1238 { .irq = 32 + OMAP44XX_IRQ_GIC_START },
1239 { .irq = -1 }
1240};
1241
1242static struct omap_hwmod_opt_clk gpio4_opt_clks[] = { 1086static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
1243 { .role = "dbclk", .clk = "gpio4_dbclk" }, 1087 { .role = "dbclk", .clk = "gpio4_dbclk" },
1244}; 1088};
@@ -1248,7 +1092,6 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
1248 .class = &omap44xx_gpio_hwmod_class, 1092 .class = &omap44xx_gpio_hwmod_class,
1249 .clkdm_name = "l4_per_clkdm", 1093 .clkdm_name = "l4_per_clkdm",
1250 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 1094 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1251 .mpu_irqs = omap44xx_gpio4_irqs,
1252 .main_clk = "l4_div_ck", 1095 .main_clk = "l4_div_ck",
1253 .prcm = { 1096 .prcm = {
1254 .omap4 = { 1097 .omap4 = {
@@ -1263,11 +1106,6 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
1263}; 1106};
1264 1107
1265/* gpio5 */ 1108/* gpio5 */
1266static struct omap_hwmod_irq_info omap44xx_gpio5_irqs[] = {
1267 { .irq = 33 + OMAP44XX_IRQ_GIC_START },
1268 { .irq = -1 }
1269};
1270
1271static struct omap_hwmod_opt_clk gpio5_opt_clks[] = { 1109static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
1272 { .role = "dbclk", .clk = "gpio5_dbclk" }, 1110 { .role = "dbclk", .clk = "gpio5_dbclk" },
1273}; 1111};
@@ -1277,7 +1115,6 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
1277 .class = &omap44xx_gpio_hwmod_class, 1115 .class = &omap44xx_gpio_hwmod_class,
1278 .clkdm_name = "l4_per_clkdm", 1116 .clkdm_name = "l4_per_clkdm",
1279 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 1117 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1280 .mpu_irqs = omap44xx_gpio5_irqs,
1281 .main_clk = "l4_div_ck", 1118 .main_clk = "l4_div_ck",
1282 .prcm = { 1119 .prcm = {
1283 .omap4 = { 1120 .omap4 = {
@@ -1292,11 +1129,6 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
1292}; 1129};
1293 1130
1294/* gpio6 */ 1131/* gpio6 */
1295static struct omap_hwmod_irq_info omap44xx_gpio6_irqs[] = {
1296 { .irq = 34 + OMAP44XX_IRQ_GIC_START },
1297 { .irq = -1 }
1298};
1299
1300static struct omap_hwmod_opt_clk gpio6_opt_clks[] = { 1132static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
1301 { .role = "dbclk", .clk = "gpio6_dbclk" }, 1133 { .role = "dbclk", .clk = "gpio6_dbclk" },
1302}; 1134};
@@ -1306,7 +1138,6 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
1306 .class = &omap44xx_gpio_hwmod_class, 1138 .class = &omap44xx_gpio_hwmod_class,
1307 .clkdm_name = "l4_per_clkdm", 1139 .clkdm_name = "l4_per_clkdm",
1308 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET, 1140 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
1309 .mpu_irqs = omap44xx_gpio6_irqs,
1310 .main_clk = "l4_div_ck", 1141 .main_clk = "l4_div_ck",
1311 .prcm = { 1142 .prcm = {
1312 .omap4 = { 1143 .omap4 = {
@@ -1341,16 +1172,6 @@ static struct omap_hwmod_class omap44xx_gpmc_hwmod_class = {
1341}; 1172};
1342 1173
1343/* gpmc */ 1174/* gpmc */
1344static struct omap_hwmod_irq_info omap44xx_gpmc_irqs[] = {
1345 { .irq = 20 + OMAP44XX_IRQ_GIC_START },
1346 { .irq = -1 }
1347};
1348
1349static struct omap_hwmod_dma_info omap44xx_gpmc_sdma_reqs[] = {
1350 { .dma_req = 3 + OMAP44XX_DMA_REQ_START },
1351 { .dma_req = -1 }
1352};
1353
1354static struct omap_hwmod omap44xx_gpmc_hwmod = { 1175static struct omap_hwmod omap44xx_gpmc_hwmod = {
1355 .name = "gpmc", 1176 .name = "gpmc",
1356 .class = &omap44xx_gpmc_hwmod_class, 1177 .class = &omap44xx_gpmc_hwmod_class,
@@ -1364,8 +1185,6 @@ static struct omap_hwmod omap44xx_gpmc_hwmod = {
1364 * HWMOD_INIT_NO_RESET should be removed ASAP. 1185 * HWMOD_INIT_NO_RESET should be removed ASAP.
1365 */ 1186 */
1366 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 1187 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1367 .mpu_irqs = omap44xx_gpmc_irqs,
1368 .sdma_reqs = omap44xx_gpmc_sdma_reqs,
1369 .prcm = { 1188 .prcm = {
1370 .omap4 = { 1189 .omap4 = {
1371 .clkctrl_offs = OMAP4_CM_L3_2_GPMC_CLKCTRL_OFFSET, 1190 .clkctrl_offs = OMAP4_CM_L3_2_GPMC_CLKCTRL_OFFSET,
@@ -1396,16 +1215,10 @@ static struct omap_hwmod_class omap44xx_gpu_hwmod_class = {
1396}; 1215};
1397 1216
1398/* gpu */ 1217/* gpu */
1399static struct omap_hwmod_irq_info omap44xx_gpu_irqs[] = {
1400 { .irq = 21 + OMAP44XX_IRQ_GIC_START },
1401 { .irq = -1 }
1402};
1403
1404static struct omap_hwmod omap44xx_gpu_hwmod = { 1218static struct omap_hwmod omap44xx_gpu_hwmod = {
1405 .name = "gpu", 1219 .name = "gpu",
1406 .class = &omap44xx_gpu_hwmod_class, 1220 .class = &omap44xx_gpu_hwmod_class,
1407 .clkdm_name = "l3_gfx_clkdm", 1221 .clkdm_name = "l3_gfx_clkdm",
1408 .mpu_irqs = omap44xx_gpu_irqs,
1409 .main_clk = "sgx_clk_mux", 1222 .main_clk = "sgx_clk_mux",
1410 .prcm = { 1223 .prcm = {
1411 .omap4 = { 1224 .omap4 = {
@@ -1436,17 +1249,11 @@ static struct omap_hwmod_class omap44xx_hdq1w_hwmod_class = {
1436}; 1249};
1437 1250
1438/* hdq1w */ 1251/* hdq1w */
1439static struct omap_hwmod_irq_info omap44xx_hdq1w_irqs[] = {
1440 { .irq = 58 + OMAP44XX_IRQ_GIC_START },
1441 { .irq = -1 }
1442};
1443
1444static struct omap_hwmod omap44xx_hdq1w_hwmod = { 1252static struct omap_hwmod omap44xx_hdq1w_hwmod = {
1445 .name = "hdq1w", 1253 .name = "hdq1w",
1446 .class = &omap44xx_hdq1w_hwmod_class, 1254 .class = &omap44xx_hdq1w_hwmod_class,
1447 .clkdm_name = "l4_per_clkdm", 1255 .clkdm_name = "l4_per_clkdm",
1448 .flags = HWMOD_INIT_NO_RESET, /* XXX temporary */ 1256 .flags = HWMOD_INIT_NO_RESET, /* XXX temporary */
1449 .mpu_irqs = omap44xx_hdq1w_irqs,
1450 .main_clk = "func_12m_fclk", 1257 .main_clk = "func_12m_fclk",
1451 .prcm = { 1258 .prcm = {
1452 .omap4 = { 1259 .omap4 = {
@@ -1482,18 +1289,10 @@ static struct omap_hwmod_class omap44xx_hsi_hwmod_class = {
1482}; 1289};
1483 1290
1484/* hsi */ 1291/* hsi */
1485static struct omap_hwmod_irq_info omap44xx_hsi_irqs[] = {
1486 { .name = "mpu_p1", .irq = 67 + OMAP44XX_IRQ_GIC_START },
1487 { .name = "mpu_p2", .irq = 68 + OMAP44XX_IRQ_GIC_START },
1488 { .name = "mpu_dma", .irq = 71 + OMAP44XX_IRQ_GIC_START },
1489 { .irq = -1 }
1490};
1491
1492static struct omap_hwmod omap44xx_hsi_hwmod = { 1292static struct omap_hwmod omap44xx_hsi_hwmod = {
1493 .name = "hsi", 1293 .name = "hsi",
1494 .class = &omap44xx_hsi_hwmod_class, 1294 .class = &omap44xx_hsi_hwmod_class,
1495 .clkdm_name = "l3_init_clkdm", 1295 .clkdm_name = "l3_init_clkdm",
1496 .mpu_irqs = omap44xx_hsi_irqs,
1497 .main_clk = "hsi_fck", 1296 .main_clk = "hsi_fck",
1498 .prcm = { 1297 .prcm = {
1499 .omap4 = { 1298 .omap4 = {
@@ -1533,24 +1332,11 @@ static struct omap_i2c_dev_attr i2c_dev_attr = {
1533}; 1332};
1534 1333
1535/* i2c1 */ 1334/* i2c1 */
1536static struct omap_hwmod_irq_info omap44xx_i2c1_irqs[] = {
1537 { .irq = 56 + OMAP44XX_IRQ_GIC_START },
1538 { .irq = -1 }
1539};
1540
1541static struct omap_hwmod_dma_info omap44xx_i2c1_sdma_reqs[] = {
1542 { .name = "tx", .dma_req = 26 + OMAP44XX_DMA_REQ_START },
1543 { .name = "rx", .dma_req = 27 + OMAP44XX_DMA_REQ_START },
1544 { .dma_req = -1 }
1545};
1546
1547static struct omap_hwmod omap44xx_i2c1_hwmod = { 1335static struct omap_hwmod omap44xx_i2c1_hwmod = {
1548 .name = "i2c1", 1336 .name = "i2c1",
1549 .class = &omap44xx_i2c_hwmod_class, 1337 .class = &omap44xx_i2c_hwmod_class,
1550 .clkdm_name = "l4_per_clkdm", 1338 .clkdm_name = "l4_per_clkdm",
1551 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 1339 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1552 .mpu_irqs = omap44xx_i2c1_irqs,
1553 .sdma_reqs = omap44xx_i2c1_sdma_reqs,
1554 .main_clk = "func_96m_fclk", 1340 .main_clk = "func_96m_fclk",
1555 .prcm = { 1341 .prcm = {
1556 .omap4 = { 1342 .omap4 = {
@@ -1563,24 +1349,11 @@ static struct omap_hwmod omap44xx_i2c1_hwmod = {
1563}; 1349};
1564 1350
1565/* i2c2 */ 1351/* i2c2 */
1566static struct omap_hwmod_irq_info omap44xx_i2c2_irqs[] = {
1567 { .irq = 57 + OMAP44XX_IRQ_GIC_START },
1568 { .irq = -1 }
1569};
1570
1571static struct omap_hwmod_dma_info omap44xx_i2c2_sdma_reqs[] = {
1572 { .name = "tx", .dma_req = 28 + OMAP44XX_DMA_REQ_START },
1573 { .name = "rx", .dma_req = 29 + OMAP44XX_DMA_REQ_START },
1574 { .dma_req = -1 }
1575};
1576
1577static struct omap_hwmod omap44xx_i2c2_hwmod = { 1352static struct omap_hwmod omap44xx_i2c2_hwmod = {
1578 .name = "i2c2", 1353 .name = "i2c2",
1579 .class = &omap44xx_i2c_hwmod_class, 1354 .class = &omap44xx_i2c_hwmod_class,
1580 .clkdm_name = "l4_per_clkdm", 1355 .clkdm_name = "l4_per_clkdm",
1581 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 1356 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1582 .mpu_irqs = omap44xx_i2c2_irqs,
1583 .sdma_reqs = omap44xx_i2c2_sdma_reqs,
1584 .main_clk = "func_96m_fclk", 1357 .main_clk = "func_96m_fclk",
1585 .prcm = { 1358 .prcm = {
1586 .omap4 = { 1359 .omap4 = {
@@ -1593,24 +1366,11 @@ static struct omap_hwmod omap44xx_i2c2_hwmod = {
1593}; 1366};
1594 1367
1595/* i2c3 */ 1368/* i2c3 */
1596static struct omap_hwmod_irq_info omap44xx_i2c3_irqs[] = {
1597 { .irq = 61 + OMAP44XX_IRQ_GIC_START },
1598 { .irq = -1 }
1599};
1600
1601static struct omap_hwmod_dma_info omap44xx_i2c3_sdma_reqs[] = {
1602 { .name = "tx", .dma_req = 24 + OMAP44XX_DMA_REQ_START },
1603 { .name = "rx", .dma_req = 25 + OMAP44XX_DMA_REQ_START },
1604 { .dma_req = -1 }
1605};
1606
1607static struct omap_hwmod omap44xx_i2c3_hwmod = { 1369static struct omap_hwmod omap44xx_i2c3_hwmod = {
1608 .name = "i2c3", 1370 .name = "i2c3",
1609 .class = &omap44xx_i2c_hwmod_class, 1371 .class = &omap44xx_i2c_hwmod_class,
1610 .clkdm_name = "l4_per_clkdm", 1372 .clkdm_name = "l4_per_clkdm",
1611 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 1373 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1612 .mpu_irqs = omap44xx_i2c3_irqs,
1613 .sdma_reqs = omap44xx_i2c3_sdma_reqs,
1614 .main_clk = "func_96m_fclk", 1374 .main_clk = "func_96m_fclk",
1615 .prcm = { 1375 .prcm = {
1616 .omap4 = { 1376 .omap4 = {
@@ -1623,24 +1383,11 @@ static struct omap_hwmod omap44xx_i2c3_hwmod = {
1623}; 1383};
1624 1384
1625/* i2c4 */ 1385/* i2c4 */
1626static struct omap_hwmod_irq_info omap44xx_i2c4_irqs[] = {
1627 { .irq = 62 + OMAP44XX_IRQ_GIC_START },
1628 { .irq = -1 }
1629};
1630
1631static struct omap_hwmod_dma_info omap44xx_i2c4_sdma_reqs[] = {
1632 { .name = "tx", .dma_req = 123 + OMAP44XX_DMA_REQ_START },
1633 { .name = "rx", .dma_req = 124 + OMAP44XX_DMA_REQ_START },
1634 { .dma_req = -1 }
1635};
1636
1637static struct omap_hwmod omap44xx_i2c4_hwmod = { 1386static struct omap_hwmod omap44xx_i2c4_hwmod = {
1638 .name = "i2c4", 1387 .name = "i2c4",
1639 .class = &omap44xx_i2c_hwmod_class, 1388 .class = &omap44xx_i2c_hwmod_class,
1640 .clkdm_name = "l4_per_clkdm", 1389 .clkdm_name = "l4_per_clkdm",
1641 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT, 1390 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
1642 .mpu_irqs = omap44xx_i2c4_irqs,
1643 .sdma_reqs = omap44xx_i2c4_sdma_reqs,
1644 .main_clk = "func_96m_fclk", 1391 .main_clk = "func_96m_fclk",
1645 .prcm = { 1392 .prcm = {
1646 .omap4 = { 1393 .omap4 = {
@@ -1662,11 +1409,6 @@ static struct omap_hwmod_class omap44xx_ipu_hwmod_class = {
1662}; 1409};
1663 1410
1664/* ipu */ 1411/* ipu */
1665static struct omap_hwmod_irq_info omap44xx_ipu_irqs[] = {
1666 { .irq = 100 + OMAP44XX_IRQ_GIC_START },
1667 { .irq = -1 }
1668};
1669
1670static struct omap_hwmod_rst_info omap44xx_ipu_resets[] = { 1412static struct omap_hwmod_rst_info omap44xx_ipu_resets[] = {
1671 { .name = "cpu0", .rst_shift = 0 }, 1413 { .name = "cpu0", .rst_shift = 0 },
1672 { .name = "cpu1", .rst_shift = 1 }, 1414 { .name = "cpu1", .rst_shift = 1 },
@@ -1676,7 +1418,6 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
1676 .name = "ipu", 1418 .name = "ipu",
1677 .class = &omap44xx_ipu_hwmod_class, 1419 .class = &omap44xx_ipu_hwmod_class,
1678 .clkdm_name = "ducati_clkdm", 1420 .clkdm_name = "ducati_clkdm",
1679 .mpu_irqs = omap44xx_ipu_irqs,
1680 .rst_lines = omap44xx_ipu_resets, 1421 .rst_lines = omap44xx_ipu_resets,
1681 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets), 1422 .rst_lines_cnt = ARRAY_SIZE(omap44xx_ipu_resets),
1682 .main_clk = "ducati_clk_mux_ck", 1423 .main_clk = "ducati_clk_mux_ck",
@@ -1721,19 +1462,6 @@ static struct omap_hwmod_class omap44xx_iss_hwmod_class = {
1721}; 1462};
1722 1463
1723/* iss */ 1464/* iss */
1724static struct omap_hwmod_irq_info omap44xx_iss_irqs[] = {
1725 { .irq = 24 + OMAP44XX_IRQ_GIC_START },
1726 { .irq = -1 }
1727};
1728
1729static struct omap_hwmod_dma_info omap44xx_iss_sdma_reqs[] = {
1730 { .name = "1", .dma_req = 8 + OMAP44XX_DMA_REQ_START },
1731 { .name = "2", .dma_req = 9 + OMAP44XX_DMA_REQ_START },
1732 { .name = "3", .dma_req = 11 + OMAP44XX_DMA_REQ_START },
1733 { .name = "4", .dma_req = 12 + OMAP44XX_DMA_REQ_START },
1734 { .dma_req = -1 }
1735};
1736
1737static struct omap_hwmod_opt_clk iss_opt_clks[] = { 1465static struct omap_hwmod_opt_clk iss_opt_clks[] = {
1738 { .role = "ctrlclk", .clk = "iss_ctrlclk" }, 1466 { .role = "ctrlclk", .clk = "iss_ctrlclk" },
1739}; 1467};
@@ -1742,8 +1470,6 @@ static struct omap_hwmod omap44xx_iss_hwmod = {
1742 .name = "iss", 1470 .name = "iss",
1743 .class = &omap44xx_iss_hwmod_class, 1471 .class = &omap44xx_iss_hwmod_class,
1744 .clkdm_name = "iss_clkdm", 1472 .clkdm_name = "iss_clkdm",
1745 .mpu_irqs = omap44xx_iss_irqs,
1746 .sdma_reqs = omap44xx_iss_sdma_reqs,
1747 .main_clk = "ducati_clk_mux_ck", 1473 .main_clk = "ducati_clk_mux_ck",
1748 .prcm = { 1474 .prcm = {
1749 .omap4 = { 1475 .omap4 = {
@@ -1766,13 +1492,6 @@ static struct omap_hwmod_class omap44xx_iva_hwmod_class = {
1766}; 1492};
1767 1493
1768/* iva */ 1494/* iva */
1769static struct omap_hwmod_irq_info omap44xx_iva_irqs[] = {
1770 { .name = "sync_1", .irq = 103 + OMAP44XX_IRQ_GIC_START },
1771 { .name = "sync_0", .irq = 104 + OMAP44XX_IRQ_GIC_START },
1772 { .name = "mailbox_0", .irq = 107 + OMAP44XX_IRQ_GIC_START },
1773 { .irq = -1 }
1774};
1775
1776static struct omap_hwmod_rst_info omap44xx_iva_resets[] = { 1495static struct omap_hwmod_rst_info omap44xx_iva_resets[] = {
1777 { .name = "seq0", .rst_shift = 0 }, 1496 { .name = "seq0", .rst_shift = 0 },
1778 { .name = "seq1", .rst_shift = 1 }, 1497 { .name = "seq1", .rst_shift = 1 },
@@ -1783,7 +1502,6 @@ static struct omap_hwmod omap44xx_iva_hwmod = {
1783 .name = "iva", 1502 .name = "iva",
1784 .class = &omap44xx_iva_hwmod_class, 1503 .class = &omap44xx_iva_hwmod_class,
1785 .clkdm_name = "ivahd_clkdm", 1504 .clkdm_name = "ivahd_clkdm",
1786 .mpu_irqs = omap44xx_iva_irqs,
1787 .rst_lines = omap44xx_iva_resets, 1505 .rst_lines = omap44xx_iva_resets,
1788 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_resets), 1506 .rst_lines_cnt = ARRAY_SIZE(omap44xx_iva_resets),
1789 .main_clk = "dpll_iva_m5x2_ck", 1507 .main_clk = "dpll_iva_m5x2_ck",
@@ -1820,16 +1538,10 @@ static struct omap_hwmod_class omap44xx_kbd_hwmod_class = {
1820}; 1538};
1821 1539
1822/* kbd */ 1540/* kbd */
1823static struct omap_hwmod_irq_info omap44xx_kbd_irqs[] = {
1824 { .irq = 120 + OMAP44XX_IRQ_GIC_START },
1825 { .irq = -1 }
1826};
1827
1828static struct omap_hwmod omap44xx_kbd_hwmod = { 1541static struct omap_hwmod omap44xx_kbd_hwmod = {
1829 .name = "kbd", 1542 .name = "kbd",
1830 .class = &omap44xx_kbd_hwmod_class, 1543 .class = &omap44xx_kbd_hwmod_class,
1831 .clkdm_name = "l4_wkup_clkdm", 1544 .clkdm_name = "l4_wkup_clkdm",
1832 .mpu_irqs = omap44xx_kbd_irqs,
1833 .main_clk = "sys_32k_ck", 1545 .main_clk = "sys_32k_ck",
1834 .prcm = { 1546 .prcm = {
1835 .omap4 = { 1547 .omap4 = {
@@ -1861,16 +1573,10 @@ static struct omap_hwmod_class omap44xx_mailbox_hwmod_class = {
1861}; 1573};
1862 1574
1863/* mailbox */ 1575/* mailbox */
1864static struct omap_hwmod_irq_info omap44xx_mailbox_irqs[] = {
1865 { .irq = 26 + OMAP44XX_IRQ_GIC_START },
1866 { .irq = -1 }
1867};
1868
1869static struct omap_hwmod omap44xx_mailbox_hwmod = { 1576static struct omap_hwmod omap44xx_mailbox_hwmod = {
1870 .name = "mailbox", 1577 .name = "mailbox",
1871 .class = &omap44xx_mailbox_hwmod_class, 1578 .class = &omap44xx_mailbox_hwmod_class,
1872 .clkdm_name = "l4_cfg_clkdm", 1579 .clkdm_name = "l4_cfg_clkdm",
1873 .mpu_irqs = omap44xx_mailbox_irqs,
1874 .prcm = { 1580 .prcm = {
1875 .omap4 = { 1581 .omap4 = {
1876 .clkctrl_offs = OMAP4_CM_L4CFG_MAILBOX_CLKCTRL_OFFSET, 1582 .clkctrl_offs = OMAP4_CM_L4CFG_MAILBOX_CLKCTRL_OFFSET,
@@ -1903,24 +1609,10 @@ static struct omap_hwmod_class omap44xx_mcasp_hwmod_class = {
1903}; 1609};
1904 1610
1905/* mcasp */ 1611/* mcasp */
1906static struct omap_hwmod_irq_info omap44xx_mcasp_irqs[] = {
1907 { .name = "arevt", .irq = 108 + OMAP44XX_IRQ_GIC_START },
1908 { .name = "axevt", .irq = 109 + OMAP44XX_IRQ_GIC_START },
1909 { .irq = -1 }
1910};
1911
1912static struct omap_hwmod_dma_info omap44xx_mcasp_sdma_reqs[] = {
1913 { .name = "axevt", .dma_req = 7 + OMAP44XX_DMA_REQ_START },
1914 { .name = "arevt", .dma_req = 10 + OMAP44XX_DMA_REQ_START },
1915 { .dma_req = -1 }
1916};
1917
1918static struct omap_hwmod omap44xx_mcasp_hwmod = { 1612static struct omap_hwmod omap44xx_mcasp_hwmod = {
1919 .name = "mcasp", 1613 .name = "mcasp",
1920 .class = &omap44xx_mcasp_hwmod_class, 1614 .class = &omap44xx_mcasp_hwmod_class,
1921 .clkdm_name = "abe_clkdm", 1615 .clkdm_name = "abe_clkdm",
1922 .mpu_irqs = omap44xx_mcasp_irqs,
1923 .sdma_reqs = omap44xx_mcasp_sdma_reqs,
1924 .main_clk = "func_mcasp_abe_gfclk", 1616 .main_clk = "func_mcasp_abe_gfclk",
1925 .prcm = { 1617 .prcm = {
1926 .omap4 = { 1618 .omap4 = {
@@ -1951,17 +1643,6 @@ static struct omap_hwmod_class omap44xx_mcbsp_hwmod_class = {
1951}; 1643};
1952 1644
1953/* mcbsp1 */ 1645/* mcbsp1 */
1954static struct omap_hwmod_irq_info omap44xx_mcbsp1_irqs[] = {
1955 { .name = "common", .irq = 17 + OMAP44XX_IRQ_GIC_START },
1956 { .irq = -1 }
1957};
1958
1959static struct omap_hwmod_dma_info omap44xx_mcbsp1_sdma_reqs[] = {
1960 { .name = "tx", .dma_req = 32 + OMAP44XX_DMA_REQ_START },
1961 { .name = "rx", .dma_req = 33 + OMAP44XX_DMA_REQ_START },
1962 { .dma_req = -1 }
1963};
1964
1965static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = { 1646static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
1966 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1647 { .role = "pad_fck", .clk = "pad_clks_ck" },
1967 { .role = "prcm_fck", .clk = "mcbsp1_sync_mux_ck" }, 1648 { .role = "prcm_fck", .clk = "mcbsp1_sync_mux_ck" },
@@ -1971,8 +1652,6 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
1971 .name = "mcbsp1", 1652 .name = "mcbsp1",
1972 .class = &omap44xx_mcbsp_hwmod_class, 1653 .class = &omap44xx_mcbsp_hwmod_class,
1973 .clkdm_name = "abe_clkdm", 1654 .clkdm_name = "abe_clkdm",
1974 .mpu_irqs = omap44xx_mcbsp1_irqs,
1975 .sdma_reqs = omap44xx_mcbsp1_sdma_reqs,
1976 .main_clk = "func_mcbsp1_gfclk", 1655 .main_clk = "func_mcbsp1_gfclk",
1977 .prcm = { 1656 .prcm = {
1978 .omap4 = { 1657 .omap4 = {
@@ -1986,17 +1665,6 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
1986}; 1665};
1987 1666
1988/* mcbsp2 */ 1667/* mcbsp2 */
1989static struct omap_hwmod_irq_info omap44xx_mcbsp2_irqs[] = {
1990 { .name = "common", .irq = 22 + OMAP44XX_IRQ_GIC_START },
1991 { .irq = -1 }
1992};
1993
1994static struct omap_hwmod_dma_info omap44xx_mcbsp2_sdma_reqs[] = {
1995 { .name = "tx", .dma_req = 16 + OMAP44XX_DMA_REQ_START },
1996 { .name = "rx", .dma_req = 17 + OMAP44XX_DMA_REQ_START },
1997 { .dma_req = -1 }
1998};
1999
2000static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = { 1668static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = {
2001 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1669 { .role = "pad_fck", .clk = "pad_clks_ck" },
2002 { .role = "prcm_fck", .clk = "mcbsp2_sync_mux_ck" }, 1670 { .role = "prcm_fck", .clk = "mcbsp2_sync_mux_ck" },
@@ -2006,8 +1674,6 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
2006 .name = "mcbsp2", 1674 .name = "mcbsp2",
2007 .class = &omap44xx_mcbsp_hwmod_class, 1675 .class = &omap44xx_mcbsp_hwmod_class,
2008 .clkdm_name = "abe_clkdm", 1676 .clkdm_name = "abe_clkdm",
2009 .mpu_irqs = omap44xx_mcbsp2_irqs,
2010 .sdma_reqs = omap44xx_mcbsp2_sdma_reqs,
2011 .main_clk = "func_mcbsp2_gfclk", 1677 .main_clk = "func_mcbsp2_gfclk",
2012 .prcm = { 1678 .prcm = {
2013 .omap4 = { 1679 .omap4 = {
@@ -2021,17 +1687,6 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
2021}; 1687};
2022 1688
2023/* mcbsp3 */ 1689/* mcbsp3 */
2024static struct omap_hwmod_irq_info omap44xx_mcbsp3_irqs[] = {
2025 { .name = "common", .irq = 23 + OMAP44XX_IRQ_GIC_START },
2026 { .irq = -1 }
2027};
2028
2029static struct omap_hwmod_dma_info omap44xx_mcbsp3_sdma_reqs[] = {
2030 { .name = "tx", .dma_req = 18 + OMAP44XX_DMA_REQ_START },
2031 { .name = "rx", .dma_req = 19 + OMAP44XX_DMA_REQ_START },
2032 { .dma_req = -1 }
2033};
2034
2035static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = { 1690static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = {
2036 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1691 { .role = "pad_fck", .clk = "pad_clks_ck" },
2037 { .role = "prcm_fck", .clk = "mcbsp3_sync_mux_ck" }, 1692 { .role = "prcm_fck", .clk = "mcbsp3_sync_mux_ck" },
@@ -2041,8 +1696,6 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
2041 .name = "mcbsp3", 1696 .name = "mcbsp3",
2042 .class = &omap44xx_mcbsp_hwmod_class, 1697 .class = &omap44xx_mcbsp_hwmod_class,
2043 .clkdm_name = "abe_clkdm", 1698 .clkdm_name = "abe_clkdm",
2044 .mpu_irqs = omap44xx_mcbsp3_irqs,
2045 .sdma_reqs = omap44xx_mcbsp3_sdma_reqs,
2046 .main_clk = "func_mcbsp3_gfclk", 1699 .main_clk = "func_mcbsp3_gfclk",
2047 .prcm = { 1700 .prcm = {
2048 .omap4 = { 1701 .omap4 = {
@@ -2056,17 +1709,6 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
2056}; 1709};
2057 1710
2058/* mcbsp4 */ 1711/* mcbsp4 */
2059static struct omap_hwmod_irq_info omap44xx_mcbsp4_irqs[] = {
2060 { .name = "common", .irq = 16 + OMAP44XX_IRQ_GIC_START },
2061 { .irq = -1 }
2062};
2063
2064static struct omap_hwmod_dma_info omap44xx_mcbsp4_sdma_reqs[] = {
2065 { .name = "tx", .dma_req = 30 + OMAP44XX_DMA_REQ_START },
2066 { .name = "rx", .dma_req = 31 + OMAP44XX_DMA_REQ_START },
2067 { .dma_req = -1 }
2068};
2069
2070static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = { 1712static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = {
2071 { .role = "pad_fck", .clk = "pad_clks_ck" }, 1713 { .role = "pad_fck", .clk = "pad_clks_ck" },
2072 { .role = "prcm_fck", .clk = "mcbsp4_sync_mux_ck" }, 1714 { .role = "prcm_fck", .clk = "mcbsp4_sync_mux_ck" },
@@ -2076,8 +1718,6 @@ static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
2076 .name = "mcbsp4", 1718 .name = "mcbsp4",
2077 .class = &omap44xx_mcbsp_hwmod_class, 1719 .class = &omap44xx_mcbsp_hwmod_class,
2078 .clkdm_name = "l4_per_clkdm", 1720 .clkdm_name = "l4_per_clkdm",
2079 .mpu_irqs = omap44xx_mcbsp4_irqs,
2080 .sdma_reqs = omap44xx_mcbsp4_sdma_reqs,
2081 .main_clk = "per_mcbsp4_gfclk", 1721 .main_clk = "per_mcbsp4_gfclk",
2082 .prcm = { 1722 .prcm = {
2083 .omap4 = { 1723 .omap4 = {
@@ -2112,17 +1752,6 @@ static struct omap_hwmod_class omap44xx_mcpdm_hwmod_class = {
2112}; 1752};
2113 1753
2114/* mcpdm */ 1754/* mcpdm */
2115static struct omap_hwmod_irq_info omap44xx_mcpdm_irqs[] = {
2116 { .irq = 112 + OMAP44XX_IRQ_GIC_START },
2117 { .irq = -1 }
2118};
2119
2120static struct omap_hwmod_dma_info omap44xx_mcpdm_sdma_reqs[] = {
2121 { .name = "up_link", .dma_req = 64 + OMAP44XX_DMA_REQ_START },
2122 { .name = "dn_link", .dma_req = 65 + OMAP44XX_DMA_REQ_START },
2123 { .dma_req = -1 }
2124};
2125
2126static struct omap_hwmod omap44xx_mcpdm_hwmod = { 1755static struct omap_hwmod omap44xx_mcpdm_hwmod = {
2127 .name = "mcpdm", 1756 .name = "mcpdm",
2128 .class = &omap44xx_mcpdm_hwmod_class, 1757 .class = &omap44xx_mcpdm_hwmod_class,
@@ -2139,8 +1768,6 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
2139 * results 'slow motion' audio playback. 1768 * results 'slow motion' audio playback.
2140 */ 1769 */
2141 .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE, 1770 .flags = HWMOD_EXT_OPT_MAIN_CLK | HWMOD_SWSUP_SIDLE,
2142 .mpu_irqs = omap44xx_mcpdm_irqs,
2143 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,
2144 .main_clk = "pad_clks_ck", 1771 .main_clk = "pad_clks_ck",
2145 .prcm = { 1772 .prcm = {
2146 .omap4 = { 1773 .omap4 = {
@@ -2174,11 +1801,6 @@ static struct omap_hwmod_class omap44xx_mcspi_hwmod_class = {
2174}; 1801};
2175 1802
2176/* mcspi1 */ 1803/* mcspi1 */
2177static struct omap_hwmod_irq_info omap44xx_mcspi1_irqs[] = {
2178 { .irq = 65 + OMAP44XX_IRQ_GIC_START },
2179 { .irq = -1 }
2180};
2181
2182static struct omap_hwmod_dma_info omap44xx_mcspi1_sdma_reqs[] = { 1804static struct omap_hwmod_dma_info omap44xx_mcspi1_sdma_reqs[] = {
2183 { .name = "tx0", .dma_req = 34 + OMAP44XX_DMA_REQ_START }, 1805 { .name = "tx0", .dma_req = 34 + OMAP44XX_DMA_REQ_START },
2184 { .name = "rx0", .dma_req = 35 + OMAP44XX_DMA_REQ_START }, 1806 { .name = "rx0", .dma_req = 35 + OMAP44XX_DMA_REQ_START },
@@ -2200,7 +1822,6 @@ static struct omap_hwmod omap44xx_mcspi1_hwmod = {
2200 .name = "mcspi1", 1822 .name = "mcspi1",
2201 .class = &omap44xx_mcspi_hwmod_class, 1823 .class = &omap44xx_mcspi_hwmod_class,
2202 .clkdm_name = "l4_per_clkdm", 1824 .clkdm_name = "l4_per_clkdm",
2203 .mpu_irqs = omap44xx_mcspi1_irqs,
2204 .sdma_reqs = omap44xx_mcspi1_sdma_reqs, 1825 .sdma_reqs = omap44xx_mcspi1_sdma_reqs,
2205 .main_clk = "func_48m_fclk", 1826 .main_clk = "func_48m_fclk",
2206 .prcm = { 1827 .prcm = {
@@ -2214,11 +1835,6 @@ static struct omap_hwmod omap44xx_mcspi1_hwmod = {
2214}; 1835};
2215 1836
2216/* mcspi2 */ 1837/* mcspi2 */
2217static struct omap_hwmod_irq_info omap44xx_mcspi2_irqs[] = {
2218 { .irq = 66 + OMAP44XX_IRQ_GIC_START },
2219 { .irq = -1 }
2220};
2221
2222static struct omap_hwmod_dma_info omap44xx_mcspi2_sdma_reqs[] = { 1838static struct omap_hwmod_dma_info omap44xx_mcspi2_sdma_reqs[] = {
2223 { .name = "tx0", .dma_req = 42 + OMAP44XX_DMA_REQ_START }, 1839 { .name = "tx0", .dma_req = 42 + OMAP44XX_DMA_REQ_START },
2224 { .name = "rx0", .dma_req = 43 + OMAP44XX_DMA_REQ_START }, 1840 { .name = "rx0", .dma_req = 43 + OMAP44XX_DMA_REQ_START },
@@ -2236,7 +1852,6 @@ static struct omap_hwmod omap44xx_mcspi2_hwmod = {
2236 .name = "mcspi2", 1852 .name = "mcspi2",
2237 .class = &omap44xx_mcspi_hwmod_class, 1853 .class = &omap44xx_mcspi_hwmod_class,
2238 .clkdm_name = "l4_per_clkdm", 1854 .clkdm_name = "l4_per_clkdm",
2239 .mpu_irqs = omap44xx_mcspi2_irqs,
2240 .sdma_reqs = omap44xx_mcspi2_sdma_reqs, 1855 .sdma_reqs = omap44xx_mcspi2_sdma_reqs,
2241 .main_clk = "func_48m_fclk", 1856 .main_clk = "func_48m_fclk",
2242 .prcm = { 1857 .prcm = {
@@ -2250,11 +1865,6 @@ static struct omap_hwmod omap44xx_mcspi2_hwmod = {
2250}; 1865};
2251 1866
2252/* mcspi3 */ 1867/* mcspi3 */
2253static struct omap_hwmod_irq_info omap44xx_mcspi3_irqs[] = {
2254 { .irq = 91 + OMAP44XX_IRQ_GIC_START },
2255 { .irq = -1 }
2256};
2257
2258static struct omap_hwmod_dma_info omap44xx_mcspi3_sdma_reqs[] = { 1868static struct omap_hwmod_dma_info omap44xx_mcspi3_sdma_reqs[] = {
2259 { .name = "tx0", .dma_req = 14 + OMAP44XX_DMA_REQ_START }, 1869 { .name = "tx0", .dma_req = 14 + OMAP44XX_DMA_REQ_START },
2260 { .name = "rx0", .dma_req = 15 + OMAP44XX_DMA_REQ_START }, 1870 { .name = "rx0", .dma_req = 15 + OMAP44XX_DMA_REQ_START },
@@ -2272,7 +1882,6 @@ static struct omap_hwmod omap44xx_mcspi3_hwmod = {
2272 .name = "mcspi3", 1882 .name = "mcspi3",
2273 .class = &omap44xx_mcspi_hwmod_class, 1883 .class = &omap44xx_mcspi_hwmod_class,
2274 .clkdm_name = "l4_per_clkdm", 1884 .clkdm_name = "l4_per_clkdm",
2275 .mpu_irqs = omap44xx_mcspi3_irqs,
2276 .sdma_reqs = omap44xx_mcspi3_sdma_reqs, 1885 .sdma_reqs = omap44xx_mcspi3_sdma_reqs,
2277 .main_clk = "func_48m_fclk", 1886 .main_clk = "func_48m_fclk",
2278 .prcm = { 1887 .prcm = {
@@ -2286,11 +1895,6 @@ static struct omap_hwmod omap44xx_mcspi3_hwmod = {
2286}; 1895};
2287 1896
2288/* mcspi4 */ 1897/* mcspi4 */
2289static struct omap_hwmod_irq_info omap44xx_mcspi4_irqs[] = {
2290 { .irq = 48 + OMAP44XX_IRQ_GIC_START },
2291 { .irq = -1 }
2292};
2293
2294static struct omap_hwmod_dma_info omap44xx_mcspi4_sdma_reqs[] = { 1898static struct omap_hwmod_dma_info omap44xx_mcspi4_sdma_reqs[] = {
2295 { .name = "tx0", .dma_req = 69 + OMAP44XX_DMA_REQ_START }, 1899 { .name = "tx0", .dma_req = 69 + OMAP44XX_DMA_REQ_START },
2296 { .name = "rx0", .dma_req = 70 + OMAP44XX_DMA_REQ_START }, 1900 { .name = "rx0", .dma_req = 70 + OMAP44XX_DMA_REQ_START },
@@ -2306,7 +1910,6 @@ static struct omap_hwmod omap44xx_mcspi4_hwmod = {
2306 .name = "mcspi4", 1910 .name = "mcspi4",
2307 .class = &omap44xx_mcspi_hwmod_class, 1911 .class = &omap44xx_mcspi_hwmod_class,
2308 .clkdm_name = "l4_per_clkdm", 1912 .clkdm_name = "l4_per_clkdm",
2309 .mpu_irqs = omap44xx_mcspi4_irqs,
2310 .sdma_reqs = omap44xx_mcspi4_sdma_reqs, 1913 .sdma_reqs = omap44xx_mcspi4_sdma_reqs,
2311 .main_clk = "func_48m_fclk", 1914 .main_clk = "func_48m_fclk",
2312 .prcm = { 1915 .prcm = {
@@ -2342,11 +1945,6 @@ static struct omap_hwmod_class omap44xx_mmc_hwmod_class = {
2342}; 1945};
2343 1946
2344/* mmc1 */ 1947/* mmc1 */
2345static struct omap_hwmod_irq_info omap44xx_mmc1_irqs[] = {
2346 { .irq = 83 + OMAP44XX_IRQ_GIC_START },
2347 { .irq = -1 }
2348};
2349
2350static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = { 1948static struct omap_hwmod_dma_info omap44xx_mmc1_sdma_reqs[] = {
2351 { .name = "tx", .dma_req = 60 + OMAP44XX_DMA_REQ_START }, 1949 { .name = "tx", .dma_req = 60 + OMAP44XX_DMA_REQ_START },
2352 { .name = "rx", .dma_req = 61 + OMAP44XX_DMA_REQ_START }, 1950 { .name = "rx", .dma_req = 61 + OMAP44XX_DMA_REQ_START },
@@ -2362,7 +1960,6 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
2362 .name = "mmc1", 1960 .name = "mmc1",
2363 .class = &omap44xx_mmc_hwmod_class, 1961 .class = &omap44xx_mmc_hwmod_class,
2364 .clkdm_name = "l3_init_clkdm", 1962 .clkdm_name = "l3_init_clkdm",
2365 .mpu_irqs = omap44xx_mmc1_irqs,
2366 .sdma_reqs = omap44xx_mmc1_sdma_reqs, 1963 .sdma_reqs = omap44xx_mmc1_sdma_reqs,
2367 .main_clk = "hsmmc1_fclk", 1964 .main_clk = "hsmmc1_fclk",
2368 .prcm = { 1965 .prcm = {
@@ -2376,11 +1973,6 @@ static struct omap_hwmod omap44xx_mmc1_hwmod = {
2376}; 1973};
2377 1974
2378/* mmc2 */ 1975/* mmc2 */
2379static struct omap_hwmod_irq_info omap44xx_mmc2_irqs[] = {
2380 { .irq = 86 + OMAP44XX_IRQ_GIC_START },
2381 { .irq = -1 }
2382};
2383
2384static struct omap_hwmod_dma_info omap44xx_mmc2_sdma_reqs[] = { 1976static struct omap_hwmod_dma_info omap44xx_mmc2_sdma_reqs[] = {
2385 { .name = "tx", .dma_req = 46 + OMAP44XX_DMA_REQ_START }, 1977 { .name = "tx", .dma_req = 46 + OMAP44XX_DMA_REQ_START },
2386 { .name = "rx", .dma_req = 47 + OMAP44XX_DMA_REQ_START }, 1978 { .name = "rx", .dma_req = 47 + OMAP44XX_DMA_REQ_START },
@@ -2391,7 +1983,6 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
2391 .name = "mmc2", 1983 .name = "mmc2",
2392 .class = &omap44xx_mmc_hwmod_class, 1984 .class = &omap44xx_mmc_hwmod_class,
2393 .clkdm_name = "l3_init_clkdm", 1985 .clkdm_name = "l3_init_clkdm",
2394 .mpu_irqs = omap44xx_mmc2_irqs,
2395 .sdma_reqs = omap44xx_mmc2_sdma_reqs, 1986 .sdma_reqs = omap44xx_mmc2_sdma_reqs,
2396 .main_clk = "hsmmc2_fclk", 1987 .main_clk = "hsmmc2_fclk",
2397 .prcm = { 1988 .prcm = {
@@ -2404,11 +1995,6 @@ static struct omap_hwmod omap44xx_mmc2_hwmod = {
2404}; 1995};
2405 1996
2406/* mmc3 */ 1997/* mmc3 */
2407static struct omap_hwmod_irq_info omap44xx_mmc3_irqs[] = {
2408 { .irq = 94 + OMAP44XX_IRQ_GIC_START },
2409 { .irq = -1 }
2410};
2411
2412static struct omap_hwmod_dma_info omap44xx_mmc3_sdma_reqs[] = { 1998static struct omap_hwmod_dma_info omap44xx_mmc3_sdma_reqs[] = {
2413 { .name = "tx", .dma_req = 76 + OMAP44XX_DMA_REQ_START }, 1999 { .name = "tx", .dma_req = 76 + OMAP44XX_DMA_REQ_START },
2414 { .name = "rx", .dma_req = 77 + OMAP44XX_DMA_REQ_START }, 2000 { .name = "rx", .dma_req = 77 + OMAP44XX_DMA_REQ_START },
@@ -2419,7 +2005,6 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
2419 .name = "mmc3", 2005 .name = "mmc3",
2420 .class = &omap44xx_mmc_hwmod_class, 2006 .class = &omap44xx_mmc_hwmod_class,
2421 .clkdm_name = "l4_per_clkdm", 2007 .clkdm_name = "l4_per_clkdm",
2422 .mpu_irqs = omap44xx_mmc3_irqs,
2423 .sdma_reqs = omap44xx_mmc3_sdma_reqs, 2008 .sdma_reqs = omap44xx_mmc3_sdma_reqs,
2424 .main_clk = "func_48m_fclk", 2009 .main_clk = "func_48m_fclk",
2425 .prcm = { 2010 .prcm = {
@@ -2432,11 +2017,6 @@ static struct omap_hwmod omap44xx_mmc3_hwmod = {
2432}; 2017};
2433 2018
2434/* mmc4 */ 2019/* mmc4 */
2435static struct omap_hwmod_irq_info omap44xx_mmc4_irqs[] = {
2436 { .irq = 96 + OMAP44XX_IRQ_GIC_START },
2437 { .irq = -1 }
2438};
2439
2440static struct omap_hwmod_dma_info omap44xx_mmc4_sdma_reqs[] = { 2020static struct omap_hwmod_dma_info omap44xx_mmc4_sdma_reqs[] = {
2441 { .name = "tx", .dma_req = 56 + OMAP44XX_DMA_REQ_START }, 2021 { .name = "tx", .dma_req = 56 + OMAP44XX_DMA_REQ_START },
2442 { .name = "rx", .dma_req = 57 + OMAP44XX_DMA_REQ_START }, 2022 { .name = "rx", .dma_req = 57 + OMAP44XX_DMA_REQ_START },
@@ -2447,7 +2027,6 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
2447 .name = "mmc4", 2027 .name = "mmc4",
2448 .class = &omap44xx_mmc_hwmod_class, 2028 .class = &omap44xx_mmc_hwmod_class,
2449 .clkdm_name = "l4_per_clkdm", 2029 .clkdm_name = "l4_per_clkdm",
2450 .mpu_irqs = omap44xx_mmc4_irqs,
2451 .sdma_reqs = omap44xx_mmc4_sdma_reqs, 2030 .sdma_reqs = omap44xx_mmc4_sdma_reqs,
2452 .main_clk = "func_48m_fclk", 2031 .main_clk = "func_48m_fclk",
2453 .prcm = { 2032 .prcm = {
@@ -2460,11 +2039,6 @@ static struct omap_hwmod omap44xx_mmc4_hwmod = {
2460}; 2039};
2461 2040
2462/* mmc5 */ 2041/* mmc5 */
2463static struct omap_hwmod_irq_info omap44xx_mmc5_irqs[] = {
2464 { .irq = 59 + OMAP44XX_IRQ_GIC_START },
2465 { .irq = -1 }
2466};
2467
2468static struct omap_hwmod_dma_info omap44xx_mmc5_sdma_reqs[] = { 2042static struct omap_hwmod_dma_info omap44xx_mmc5_sdma_reqs[] = {
2469 { .name = "tx", .dma_req = 58 + OMAP44XX_DMA_REQ_START }, 2043 { .name = "tx", .dma_req = 58 + OMAP44XX_DMA_REQ_START },
2470 { .name = "rx", .dma_req = 59 + OMAP44XX_DMA_REQ_START }, 2044 { .name = "rx", .dma_req = 59 + OMAP44XX_DMA_REQ_START },
@@ -2475,7 +2049,6 @@ static struct omap_hwmod omap44xx_mmc5_hwmod = {
2475 .name = "mmc5", 2049 .name = "mmc5",
2476 .class = &omap44xx_mmc_hwmod_class, 2050 .class = &omap44xx_mmc_hwmod_class,
2477 .clkdm_name = "l4_per_clkdm", 2051 .clkdm_name = "l4_per_clkdm",
2478 .mpu_irqs = omap44xx_mmc5_irqs,
2479 .sdma_reqs = omap44xx_mmc5_sdma_reqs, 2052 .sdma_reqs = omap44xx_mmc5_sdma_reqs,
2480 .main_clk = "func_48m_fclk", 2053 .main_clk = "func_48m_fclk",
2481 .prcm = { 2054 .prcm = {
@@ -2517,11 +2090,6 @@ static struct omap_mmu_dev_attr mmu_ipu_dev_attr = {
2517}; 2090};
2518 2091
2519static struct omap_hwmod omap44xx_mmu_ipu_hwmod; 2092static struct omap_hwmod omap44xx_mmu_ipu_hwmod;
2520static struct omap_hwmod_irq_info omap44xx_mmu_ipu_irqs[] = {
2521 { .irq = 100 + OMAP44XX_IRQ_GIC_START, },
2522 { .irq = -1 }
2523};
2524
2525static struct omap_hwmod_rst_info omap44xx_mmu_ipu_resets[] = { 2093static struct omap_hwmod_rst_info omap44xx_mmu_ipu_resets[] = {
2526 { .name = "mmu_cache", .rst_shift = 2 }, 2094 { .name = "mmu_cache", .rst_shift = 2 },
2527}; 2095};
@@ -2548,7 +2116,6 @@ static struct omap_hwmod omap44xx_mmu_ipu_hwmod = {
2548 .name = "mmu_ipu", 2116 .name = "mmu_ipu",
2549 .class = &omap44xx_mmu_hwmod_class, 2117 .class = &omap44xx_mmu_hwmod_class,
2550 .clkdm_name = "ducati_clkdm", 2118 .clkdm_name = "ducati_clkdm",
2551 .mpu_irqs = omap44xx_mmu_ipu_irqs,
2552 .rst_lines = omap44xx_mmu_ipu_resets, 2119 .rst_lines = omap44xx_mmu_ipu_resets,
2553 .rst_lines_cnt = ARRAY_SIZE(omap44xx_mmu_ipu_resets), 2120 .rst_lines_cnt = ARRAY_SIZE(omap44xx_mmu_ipu_resets),
2554 .main_clk = "ducati_clk_mux_ck", 2121 .main_clk = "ducati_clk_mux_ck",
@@ -2572,11 +2139,6 @@ static struct omap_mmu_dev_attr mmu_dsp_dev_attr = {
2572}; 2139};
2573 2140
2574static struct omap_hwmod omap44xx_mmu_dsp_hwmod; 2141static struct omap_hwmod omap44xx_mmu_dsp_hwmod;
2575static struct omap_hwmod_irq_info omap44xx_mmu_dsp_irqs[] = {
2576 { .irq = 28 + OMAP44XX_IRQ_GIC_START },
2577 { .irq = -1 }
2578};
2579
2580static struct omap_hwmod_rst_info omap44xx_mmu_dsp_resets[] = { 2142static struct omap_hwmod_rst_info omap44xx_mmu_dsp_resets[] = {
2581 { .name = "mmu_cache", .rst_shift = 1 }, 2143 { .name = "mmu_cache", .rst_shift = 1 },
2582}; 2144};
@@ -2603,7 +2165,6 @@ static struct omap_hwmod omap44xx_mmu_dsp_hwmod = {
2603 .name = "mmu_dsp", 2165 .name = "mmu_dsp",
2604 .class = &omap44xx_mmu_hwmod_class, 2166 .class = &omap44xx_mmu_hwmod_class,
2605 .clkdm_name = "tesla_clkdm", 2167 .clkdm_name = "tesla_clkdm",
2606 .mpu_irqs = omap44xx_mmu_dsp_irqs,
2607 .rst_lines = omap44xx_mmu_dsp_resets, 2168 .rst_lines = omap44xx_mmu_dsp_resets,
2608 .rst_lines_cnt = ARRAY_SIZE(omap44xx_mmu_dsp_resets), 2169 .rst_lines_cnt = ARRAY_SIZE(omap44xx_mmu_dsp_resets),
2609 .main_clk = "dpll_iva_m4x2_ck", 2170 .main_clk = "dpll_iva_m4x2_ck",
@@ -2628,21 +2189,11 @@ static struct omap_hwmod_class omap44xx_mpu_hwmod_class = {
2628}; 2189};
2629 2190
2630/* mpu */ 2191/* mpu */
2631static struct omap_hwmod_irq_info omap44xx_mpu_irqs[] = {
2632 { .name = "pmu0", .irq = 54 + OMAP44XX_IRQ_GIC_START },
2633 { .name = "pmu1", .irq = 55 + OMAP44XX_IRQ_GIC_START },
2634 { .name = "pl310", .irq = 0 + OMAP44XX_IRQ_GIC_START },
2635 { .name = "cti0", .irq = 1 + OMAP44XX_IRQ_GIC_START },
2636 { .name = "cti1", .irq = 2 + OMAP44XX_IRQ_GIC_START },
2637 { .irq = -1 }
2638};
2639
2640static struct omap_hwmod omap44xx_mpu_hwmod = { 2192static struct omap_hwmod omap44xx_mpu_hwmod = {
2641 .name = "mpu", 2193 .name = "mpu",
2642 .class = &omap44xx_mpu_hwmod_class, 2194 .class = &omap44xx_mpu_hwmod_class,
2643 .clkdm_name = "mpuss_clkdm", 2195 .clkdm_name = "mpuss_clkdm",
2644 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET, 2196 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
2645 .mpu_irqs = omap44xx_mpu_irqs,
2646 .main_clk = "dpll_mpu_m2_ck", 2197 .main_clk = "dpll_mpu_m2_ck",
2647 .prcm = { 2198 .prcm = {
2648 .omap4 = { 2199 .omap4 = {
@@ -2695,25 +2246,6 @@ static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = {
2695 .sysc = &omap44xx_ocp2scp_sysc, 2246 .sysc = &omap44xx_ocp2scp_sysc,
2696}; 2247};
2697 2248
2698/* ocp2scp dev_attr */
2699static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
2700 {
2701 .name = "usb_phy",
2702 .start = 0x4a0ad080,
2703 .end = 0x4a0ae000,
2704 .flags = IORESOURCE_MEM,
2705 },
2706 { }
2707};
2708
2709static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
2710 {
2711 .drv_name = "omap-usb2",
2712 .res = omap44xx_usb_phy_and_pll_addrs,
2713 },
2714 { }
2715};
2716
2717/* ocp2scp_usb_phy */ 2249/* ocp2scp_usb_phy */
2718static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { 2250static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2719 .name = "ocp2scp_usb_phy", 2251 .name = "ocp2scp_usb_phy",
@@ -2737,7 +2269,6 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2737 .modulemode = MODULEMODE_HWCTRL, 2269 .modulemode = MODULEMODE_HWCTRL,
2738 }, 2270 },
2739 }, 2271 },
2740 .dev_attr = ocp2scp_dev_attr,
2741}; 2272};
2742 2273
2743/* 2274/*
@@ -2788,11 +2319,6 @@ static struct omap_hwmod omap44xx_cm_core_hwmod = {
2788}; 2319};
2789 2320
2790/* prm */ 2321/* prm */
2791static struct omap_hwmod_irq_info omap44xx_prm_irqs[] = {
2792 { .irq = 11 + OMAP44XX_IRQ_GIC_START },
2793 { .irq = -1 }
2794};
2795
2796static struct omap_hwmod_rst_info omap44xx_prm_resets[] = { 2322static struct omap_hwmod_rst_info omap44xx_prm_resets[] = {
2797 { .name = "rst_global_warm_sw", .rst_shift = 0 }, 2323 { .name = "rst_global_warm_sw", .rst_shift = 0 },
2798 { .name = "rst_global_cold_sw", .rst_shift = 1 }, 2324 { .name = "rst_global_cold_sw", .rst_shift = 1 },
@@ -2801,7 +2327,6 @@ static struct omap_hwmod_rst_info omap44xx_prm_resets[] = {
2801static struct omap_hwmod omap44xx_prm_hwmod = { 2327static struct omap_hwmod omap44xx_prm_hwmod = {
2802 .name = "prm", 2328 .name = "prm",
2803 .class = &omap44xx_prcm_hwmod_class, 2329 .class = &omap44xx_prcm_hwmod_class,
2804 .mpu_irqs = omap44xx_prm_irqs,
2805 .rst_lines = omap44xx_prm_resets, 2330 .rst_lines = omap44xx_prm_resets,
2806 .rst_lines_cnt = ARRAY_SIZE(omap44xx_prm_resets), 2331 .rst_lines_cnt = ARRAY_SIZE(omap44xx_prm_resets),
2807}; 2332};
@@ -2872,23 +2397,6 @@ static struct omap_hwmod_class omap44xx_slimbus_hwmod_class = {
2872}; 2397};
2873 2398
2874/* slimbus1 */ 2399/* slimbus1 */
2875static struct omap_hwmod_irq_info omap44xx_slimbus1_irqs[] = {
2876 { .irq = 97 + OMAP44XX_IRQ_GIC_START },
2877 { .irq = -1 }
2878};
2879
2880static struct omap_hwmod_dma_info omap44xx_slimbus1_sdma_reqs[] = {
2881 { .name = "tx0", .dma_req = 84 + OMAP44XX_DMA_REQ_START },
2882 { .name = "tx1", .dma_req = 85 + OMAP44XX_DMA_REQ_START },
2883 { .name = "tx2", .dma_req = 86 + OMAP44XX_DMA_REQ_START },
2884 { .name = "tx3", .dma_req = 87 + OMAP44XX_DMA_REQ_START },
2885 { .name = "rx0", .dma_req = 88 + OMAP44XX_DMA_REQ_START },
2886 { .name = "rx1", .dma_req = 89 + OMAP44XX_DMA_REQ_START },
2887 { .name = "rx2", .dma_req = 90 + OMAP44XX_DMA_REQ_START },
2888 { .name = "rx3", .dma_req = 91 + OMAP44XX_DMA_REQ_START },
2889 { .dma_req = -1 }
2890};
2891
2892static struct omap_hwmod_opt_clk slimbus1_opt_clks[] = { 2400static struct omap_hwmod_opt_clk slimbus1_opt_clks[] = {
2893 { .role = "fclk_1", .clk = "slimbus1_fclk_1" }, 2401 { .role = "fclk_1", .clk = "slimbus1_fclk_1" },
2894 { .role = "fclk_0", .clk = "slimbus1_fclk_0" }, 2402 { .role = "fclk_0", .clk = "slimbus1_fclk_0" },
@@ -2900,8 +2408,6 @@ static struct omap_hwmod omap44xx_slimbus1_hwmod = {
2900 .name = "slimbus1", 2408 .name = "slimbus1",
2901 .class = &omap44xx_slimbus_hwmod_class, 2409 .class = &omap44xx_slimbus_hwmod_class,
2902 .clkdm_name = "abe_clkdm", 2410 .clkdm_name = "abe_clkdm",
2903 .mpu_irqs = omap44xx_slimbus1_irqs,
2904 .sdma_reqs = omap44xx_slimbus1_sdma_reqs,
2905 .prcm = { 2411 .prcm = {
2906 .omap4 = { 2412 .omap4 = {
2907 .clkctrl_offs = OMAP4_CM1_ABE_SLIMBUS_CLKCTRL_OFFSET, 2413 .clkctrl_offs = OMAP4_CM1_ABE_SLIMBUS_CLKCTRL_OFFSET,
@@ -2914,23 +2420,6 @@ static struct omap_hwmod omap44xx_slimbus1_hwmod = {
2914}; 2420};
2915 2421
2916/* slimbus2 */ 2422/* slimbus2 */
2917static struct omap_hwmod_irq_info omap44xx_slimbus2_irqs[] = {
2918 { .irq = 98 + OMAP44XX_IRQ_GIC_START },
2919 { .irq = -1 }
2920};
2921
2922static struct omap_hwmod_dma_info omap44xx_slimbus2_sdma_reqs[] = {
2923 { .name = "tx0", .dma_req = 92 + OMAP44XX_DMA_REQ_START },
2924 { .name = "tx1", .dma_req = 93 + OMAP44XX_DMA_REQ_START },
2925 { .name = "tx2", .dma_req = 94 + OMAP44XX_DMA_REQ_START },
2926 { .name = "tx3", .dma_req = 95 + OMAP44XX_DMA_REQ_START },
2927 { .name = "rx0", .dma_req = 96 + OMAP44XX_DMA_REQ_START },
2928 { .name = "rx1", .dma_req = 97 + OMAP44XX_DMA_REQ_START },
2929 { .name = "rx2", .dma_req = 98 + OMAP44XX_DMA_REQ_START },
2930 { .name = "rx3", .dma_req = 99 + OMAP44XX_DMA_REQ_START },
2931 { .dma_req = -1 }
2932};
2933
2934static struct omap_hwmod_opt_clk slimbus2_opt_clks[] = { 2423static struct omap_hwmod_opt_clk slimbus2_opt_clks[] = {
2935 { .role = "fclk_1", .clk = "slimbus2_fclk_1" }, 2424 { .role = "fclk_1", .clk = "slimbus2_fclk_1" },
2936 { .role = "fclk_0", .clk = "slimbus2_fclk_0" }, 2425 { .role = "fclk_0", .clk = "slimbus2_fclk_0" },
@@ -2941,8 +2430,6 @@ static struct omap_hwmod omap44xx_slimbus2_hwmod = {
2941 .name = "slimbus2", 2430 .name = "slimbus2",
2942 .class = &omap44xx_slimbus_hwmod_class, 2431 .class = &omap44xx_slimbus_hwmod_class,
2943 .clkdm_name = "l4_per_clkdm", 2432 .clkdm_name = "l4_per_clkdm",
2944 .mpu_irqs = omap44xx_slimbus2_irqs,
2945 .sdma_reqs = omap44xx_slimbus2_sdma_reqs,
2946 .prcm = { 2433 .prcm = {
2947 .omap4 = { 2434 .omap4 = {
2948 .clkctrl_offs = OMAP4_CM_L4PER_SLIMBUS2_CLKCTRL_OFFSET, 2435 .clkctrl_offs = OMAP4_CM_L4PER_SLIMBUS2_CLKCTRL_OFFSET,
@@ -2985,16 +2472,10 @@ static struct omap_smartreflex_dev_attr smartreflex_core_dev_attr = {
2985 .sensor_voltdm_name = "core", 2472 .sensor_voltdm_name = "core",
2986}; 2473};
2987 2474
2988static struct omap_hwmod_irq_info omap44xx_smartreflex_core_irqs[] = {
2989 { .irq = 19 + OMAP44XX_IRQ_GIC_START },
2990 { .irq = -1 }
2991};
2992
2993static struct omap_hwmod omap44xx_smartreflex_core_hwmod = { 2475static struct omap_hwmod omap44xx_smartreflex_core_hwmod = {
2994 .name = "smartreflex_core", 2476 .name = "smartreflex_core",
2995 .class = &omap44xx_smartreflex_hwmod_class, 2477 .class = &omap44xx_smartreflex_hwmod_class,
2996 .clkdm_name = "l4_ao_clkdm", 2478 .clkdm_name = "l4_ao_clkdm",
2997 .mpu_irqs = omap44xx_smartreflex_core_irqs,
2998 2479
2999 .main_clk = "smartreflex_core_fck", 2480 .main_clk = "smartreflex_core_fck",
3000 .prcm = { 2481 .prcm = {
@@ -3012,16 +2493,10 @@ static struct omap_smartreflex_dev_attr smartreflex_iva_dev_attr = {
3012 .sensor_voltdm_name = "iva", 2493 .sensor_voltdm_name = "iva",
3013}; 2494};
3014 2495
3015static struct omap_hwmod_irq_info omap44xx_smartreflex_iva_irqs[] = {
3016 { .irq = 102 + OMAP44XX_IRQ_GIC_START },
3017 { .irq = -1 }
3018};
3019
3020static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = { 2496static struct omap_hwmod omap44xx_smartreflex_iva_hwmod = {
3021 .name = "smartreflex_iva", 2497 .name = "smartreflex_iva",
3022 .class = &omap44xx_smartreflex_hwmod_class, 2498 .class = &omap44xx_smartreflex_hwmod_class,
3023 .clkdm_name = "l4_ao_clkdm", 2499 .clkdm_name = "l4_ao_clkdm",
3024 .mpu_irqs = omap44xx_smartreflex_iva_irqs,
3025 .main_clk = "smartreflex_iva_fck", 2500 .main_clk = "smartreflex_iva_fck",
3026 .prcm = { 2501 .prcm = {
3027 .omap4 = { 2502 .omap4 = {
@@ -3038,16 +2513,10 @@ static struct omap_smartreflex_dev_attr smartreflex_mpu_dev_attr = {
3038 .sensor_voltdm_name = "mpu", 2513 .sensor_voltdm_name = "mpu",
3039}; 2514};
3040 2515
3041static struct omap_hwmod_irq_info omap44xx_smartreflex_mpu_irqs[] = {
3042 { .irq = 18 + OMAP44XX_IRQ_GIC_START },
3043 { .irq = -1 }
3044};
3045
3046static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = { 2516static struct omap_hwmod omap44xx_smartreflex_mpu_hwmod = {
3047 .name = "smartreflex_mpu", 2517 .name = "smartreflex_mpu",
3048 .class = &omap44xx_smartreflex_hwmod_class, 2518 .class = &omap44xx_smartreflex_hwmod_class,
3049 .clkdm_name = "l4_ao_clkdm", 2519 .clkdm_name = "l4_ao_clkdm",
3050 .mpu_irqs = omap44xx_smartreflex_mpu_irqs,
3051 .main_clk = "smartreflex_mpu_fck", 2520 .main_clk = "smartreflex_mpu_fck",
3052 .prcm = { 2521 .prcm = {
3053 .omap4 = { 2522 .omap4 = {
@@ -3155,17 +2624,11 @@ static struct omap_timer_capability_dev_attr capability_dsp_pwm_dev_attr = {
3155}; 2624};
3156 2625
3157/* timer1 */ 2626/* timer1 */
3158static struct omap_hwmod_irq_info omap44xx_timer1_irqs[] = {
3159 { .irq = 37 + OMAP44XX_IRQ_GIC_START },
3160 { .irq = -1 }
3161};
3162
3163static struct omap_hwmod omap44xx_timer1_hwmod = { 2627static struct omap_hwmod omap44xx_timer1_hwmod = {
3164 .name = "timer1", 2628 .name = "timer1",
3165 .class = &omap44xx_timer_1ms_hwmod_class, 2629 .class = &omap44xx_timer_1ms_hwmod_class,
3166 .clkdm_name = "l4_wkup_clkdm", 2630 .clkdm_name = "l4_wkup_clkdm",
3167 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2631 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
3168 .mpu_irqs = omap44xx_timer1_irqs,
3169 .main_clk = "dmt1_clk_mux", 2632 .main_clk = "dmt1_clk_mux",
3170 .prcm = { 2633 .prcm = {
3171 .omap4 = { 2634 .omap4 = {
@@ -3178,17 +2641,11 @@ static struct omap_hwmod omap44xx_timer1_hwmod = {
3178}; 2641};
3179 2642
3180/* timer2 */ 2643/* timer2 */
3181static struct omap_hwmod_irq_info omap44xx_timer2_irqs[] = {
3182 { .irq = 38 + OMAP44XX_IRQ_GIC_START },
3183 { .irq = -1 }
3184};
3185
3186static struct omap_hwmod omap44xx_timer2_hwmod = { 2644static struct omap_hwmod omap44xx_timer2_hwmod = {
3187 .name = "timer2", 2645 .name = "timer2",
3188 .class = &omap44xx_timer_1ms_hwmod_class, 2646 .class = &omap44xx_timer_1ms_hwmod_class,
3189 .clkdm_name = "l4_per_clkdm", 2647 .clkdm_name = "l4_per_clkdm",
3190 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2648 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
3191 .mpu_irqs = omap44xx_timer2_irqs,
3192 .main_clk = "cm2_dm2_mux", 2649 .main_clk = "cm2_dm2_mux",
3193 .prcm = { 2650 .prcm = {
3194 .omap4 = { 2651 .omap4 = {
@@ -3200,16 +2657,10 @@ static struct omap_hwmod omap44xx_timer2_hwmod = {
3200}; 2657};
3201 2658
3202/* timer3 */ 2659/* timer3 */
3203static struct omap_hwmod_irq_info omap44xx_timer3_irqs[] = {
3204 { .irq = 39 + OMAP44XX_IRQ_GIC_START },
3205 { .irq = -1 }
3206};
3207
3208static struct omap_hwmod omap44xx_timer3_hwmod = { 2660static struct omap_hwmod omap44xx_timer3_hwmod = {
3209 .name = "timer3", 2661 .name = "timer3",
3210 .class = &omap44xx_timer_hwmod_class, 2662 .class = &omap44xx_timer_hwmod_class,
3211 .clkdm_name = "l4_per_clkdm", 2663 .clkdm_name = "l4_per_clkdm",
3212 .mpu_irqs = omap44xx_timer3_irqs,
3213 .main_clk = "cm2_dm3_mux", 2664 .main_clk = "cm2_dm3_mux",
3214 .prcm = { 2665 .prcm = {
3215 .omap4 = { 2666 .omap4 = {
@@ -3221,16 +2672,10 @@ static struct omap_hwmod omap44xx_timer3_hwmod = {
3221}; 2672};
3222 2673
3223/* timer4 */ 2674/* timer4 */
3224static struct omap_hwmod_irq_info omap44xx_timer4_irqs[] = {
3225 { .irq = 40 + OMAP44XX_IRQ_GIC_START },
3226 { .irq = -1 }
3227};
3228
3229static struct omap_hwmod omap44xx_timer4_hwmod = { 2675static struct omap_hwmod omap44xx_timer4_hwmod = {
3230 .name = "timer4", 2676 .name = "timer4",
3231 .class = &omap44xx_timer_hwmod_class, 2677 .class = &omap44xx_timer_hwmod_class,
3232 .clkdm_name = "l4_per_clkdm", 2678 .clkdm_name = "l4_per_clkdm",
3233 .mpu_irqs = omap44xx_timer4_irqs,
3234 .main_clk = "cm2_dm4_mux", 2679 .main_clk = "cm2_dm4_mux",
3235 .prcm = { 2680 .prcm = {
3236 .omap4 = { 2681 .omap4 = {
@@ -3242,16 +2687,10 @@ static struct omap_hwmod omap44xx_timer4_hwmod = {
3242}; 2687};
3243 2688
3244/* timer5 */ 2689/* timer5 */
3245static struct omap_hwmod_irq_info omap44xx_timer5_irqs[] = {
3246 { .irq = 41 + OMAP44XX_IRQ_GIC_START },
3247 { .irq = -1 }
3248};
3249
3250static struct omap_hwmod omap44xx_timer5_hwmod = { 2690static struct omap_hwmod omap44xx_timer5_hwmod = {
3251 .name = "timer5", 2691 .name = "timer5",
3252 .class = &omap44xx_timer_hwmod_class, 2692 .class = &omap44xx_timer_hwmod_class,
3253 .clkdm_name = "abe_clkdm", 2693 .clkdm_name = "abe_clkdm",
3254 .mpu_irqs = omap44xx_timer5_irqs,
3255 .main_clk = "timer5_sync_mux", 2694 .main_clk = "timer5_sync_mux",
3256 .prcm = { 2695 .prcm = {
3257 .omap4 = { 2696 .omap4 = {
@@ -3264,16 +2703,10 @@ static struct omap_hwmod omap44xx_timer5_hwmod = {
3264}; 2703};
3265 2704
3266/* timer6 */ 2705/* timer6 */
3267static struct omap_hwmod_irq_info omap44xx_timer6_irqs[] = {
3268 { .irq = 42 + OMAP44XX_IRQ_GIC_START },
3269 { .irq = -1 }
3270};
3271
3272static struct omap_hwmod omap44xx_timer6_hwmod = { 2706static struct omap_hwmod omap44xx_timer6_hwmod = {
3273 .name = "timer6", 2707 .name = "timer6",
3274 .class = &omap44xx_timer_hwmod_class, 2708 .class = &omap44xx_timer_hwmod_class,
3275 .clkdm_name = "abe_clkdm", 2709 .clkdm_name = "abe_clkdm",
3276 .mpu_irqs = omap44xx_timer6_irqs,
3277 .main_clk = "timer6_sync_mux", 2710 .main_clk = "timer6_sync_mux",
3278 .prcm = { 2711 .prcm = {
3279 .omap4 = { 2712 .omap4 = {
@@ -3286,16 +2719,10 @@ static struct omap_hwmod omap44xx_timer6_hwmod = {
3286}; 2719};
3287 2720
3288/* timer7 */ 2721/* timer7 */
3289static struct omap_hwmod_irq_info omap44xx_timer7_irqs[] = {
3290 { .irq = 43 + OMAP44XX_IRQ_GIC_START },
3291 { .irq = -1 }
3292};
3293
3294static struct omap_hwmod omap44xx_timer7_hwmod = { 2722static struct omap_hwmod omap44xx_timer7_hwmod = {
3295 .name = "timer7", 2723 .name = "timer7",
3296 .class = &omap44xx_timer_hwmod_class, 2724 .class = &omap44xx_timer_hwmod_class,
3297 .clkdm_name = "abe_clkdm", 2725 .clkdm_name = "abe_clkdm",
3298 .mpu_irqs = omap44xx_timer7_irqs,
3299 .main_clk = "timer7_sync_mux", 2726 .main_clk = "timer7_sync_mux",
3300 .prcm = { 2727 .prcm = {
3301 .omap4 = { 2728 .omap4 = {
@@ -3308,16 +2735,10 @@ static struct omap_hwmod omap44xx_timer7_hwmod = {
3308}; 2735};
3309 2736
3310/* timer8 */ 2737/* timer8 */
3311static struct omap_hwmod_irq_info omap44xx_timer8_irqs[] = {
3312 { .irq = 44 + OMAP44XX_IRQ_GIC_START },
3313 { .irq = -1 }
3314};
3315
3316static struct omap_hwmod omap44xx_timer8_hwmod = { 2738static struct omap_hwmod omap44xx_timer8_hwmod = {
3317 .name = "timer8", 2739 .name = "timer8",
3318 .class = &omap44xx_timer_hwmod_class, 2740 .class = &omap44xx_timer_hwmod_class,
3319 .clkdm_name = "abe_clkdm", 2741 .clkdm_name = "abe_clkdm",
3320 .mpu_irqs = omap44xx_timer8_irqs,
3321 .main_clk = "timer8_sync_mux", 2742 .main_clk = "timer8_sync_mux",
3322 .prcm = { 2743 .prcm = {
3323 .omap4 = { 2744 .omap4 = {
@@ -3330,16 +2751,10 @@ static struct omap_hwmod omap44xx_timer8_hwmod = {
3330}; 2751};
3331 2752
3332/* timer9 */ 2753/* timer9 */
3333static struct omap_hwmod_irq_info omap44xx_timer9_irqs[] = {
3334 { .irq = 45 + OMAP44XX_IRQ_GIC_START },
3335 { .irq = -1 }
3336};
3337
3338static struct omap_hwmod omap44xx_timer9_hwmod = { 2754static struct omap_hwmod omap44xx_timer9_hwmod = {
3339 .name = "timer9", 2755 .name = "timer9",
3340 .class = &omap44xx_timer_hwmod_class, 2756 .class = &omap44xx_timer_hwmod_class,
3341 .clkdm_name = "l4_per_clkdm", 2757 .clkdm_name = "l4_per_clkdm",
3342 .mpu_irqs = omap44xx_timer9_irqs,
3343 .main_clk = "cm2_dm9_mux", 2758 .main_clk = "cm2_dm9_mux",
3344 .prcm = { 2759 .prcm = {
3345 .omap4 = { 2760 .omap4 = {
@@ -3352,17 +2767,11 @@ static struct omap_hwmod omap44xx_timer9_hwmod = {
3352}; 2767};
3353 2768
3354/* timer10 */ 2769/* timer10 */
3355static struct omap_hwmod_irq_info omap44xx_timer10_irqs[] = {
3356 { .irq = 46 + OMAP44XX_IRQ_GIC_START },
3357 { .irq = -1 }
3358};
3359
3360static struct omap_hwmod omap44xx_timer10_hwmod = { 2770static struct omap_hwmod omap44xx_timer10_hwmod = {
3361 .name = "timer10", 2771 .name = "timer10",
3362 .class = &omap44xx_timer_1ms_hwmod_class, 2772 .class = &omap44xx_timer_1ms_hwmod_class,
3363 .clkdm_name = "l4_per_clkdm", 2773 .clkdm_name = "l4_per_clkdm",
3364 .flags = HWMOD_SET_DEFAULT_CLOCKACT, 2774 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
3365 .mpu_irqs = omap44xx_timer10_irqs,
3366 .main_clk = "cm2_dm10_mux", 2775 .main_clk = "cm2_dm10_mux",
3367 .prcm = { 2776 .prcm = {
3368 .omap4 = { 2777 .omap4 = {
@@ -3375,16 +2784,10 @@ static struct omap_hwmod omap44xx_timer10_hwmod = {
3375}; 2784};
3376 2785
3377/* timer11 */ 2786/* timer11 */
3378static struct omap_hwmod_irq_info omap44xx_timer11_irqs[] = {
3379 { .irq = 47 + OMAP44XX_IRQ_GIC_START },
3380 { .irq = -1 }
3381};
3382
3383static struct omap_hwmod omap44xx_timer11_hwmod = { 2787static struct omap_hwmod omap44xx_timer11_hwmod = {
3384 .name = "timer11", 2788 .name = "timer11",
3385 .class = &omap44xx_timer_hwmod_class, 2789 .class = &omap44xx_timer_hwmod_class,
3386 .clkdm_name = "l4_per_clkdm", 2790 .clkdm_name = "l4_per_clkdm",
3387 .mpu_irqs = omap44xx_timer11_irqs,
3388 .main_clk = "cm2_dm11_mux", 2791 .main_clk = "cm2_dm11_mux",
3389 .prcm = { 2792 .prcm = {
3390 .omap4 = { 2793 .omap4 = {
@@ -3419,24 +2822,11 @@ static struct omap_hwmod_class omap44xx_uart_hwmod_class = {
3419}; 2822};
3420 2823
3421/* uart1 */ 2824/* uart1 */
3422static struct omap_hwmod_irq_info omap44xx_uart1_irqs[] = {
3423 { .irq = 72 + OMAP44XX_IRQ_GIC_START },
3424 { .irq = -1 }
3425};
3426
3427static struct omap_hwmod_dma_info omap44xx_uart1_sdma_reqs[] = {
3428 { .name = "tx", .dma_req = 48 + OMAP44XX_DMA_REQ_START },
3429 { .name = "rx", .dma_req = 49 + OMAP44XX_DMA_REQ_START },
3430 { .dma_req = -1 }
3431};
3432
3433static struct omap_hwmod omap44xx_uart1_hwmod = { 2825static struct omap_hwmod omap44xx_uart1_hwmod = {
3434 .name = "uart1", 2826 .name = "uart1",
3435 .class = &omap44xx_uart_hwmod_class, 2827 .class = &omap44xx_uart_hwmod_class,
3436 .clkdm_name = "l4_per_clkdm", 2828 .clkdm_name = "l4_per_clkdm",
3437 .flags = HWMOD_SWSUP_SIDLE_ACT, 2829 .flags = HWMOD_SWSUP_SIDLE_ACT,
3438 .mpu_irqs = omap44xx_uart1_irqs,
3439 .sdma_reqs = omap44xx_uart1_sdma_reqs,
3440 .main_clk = "func_48m_fclk", 2830 .main_clk = "func_48m_fclk",
3441 .prcm = { 2831 .prcm = {
3442 .omap4 = { 2832 .omap4 = {
@@ -3448,24 +2838,11 @@ static struct omap_hwmod omap44xx_uart1_hwmod = {
3448}; 2838};
3449 2839
3450/* uart2 */ 2840/* uart2 */
3451static struct omap_hwmod_irq_info omap44xx_uart2_irqs[] = {
3452 { .irq = 73 + OMAP44XX_IRQ_GIC_START },
3453 { .irq = -1 }
3454};
3455
3456static struct omap_hwmod_dma_info omap44xx_uart2_sdma_reqs[] = {
3457 { .name = "tx", .dma_req = 50 + OMAP44XX_DMA_REQ_START },
3458 { .name = "rx", .dma_req = 51 + OMAP44XX_DMA_REQ_START },
3459 { .dma_req = -1 }
3460};
3461
3462static struct omap_hwmod omap44xx_uart2_hwmod = { 2841static struct omap_hwmod omap44xx_uart2_hwmod = {
3463 .name = "uart2", 2842 .name = "uart2",
3464 .class = &omap44xx_uart_hwmod_class, 2843 .class = &omap44xx_uart_hwmod_class,
3465 .clkdm_name = "l4_per_clkdm", 2844 .clkdm_name = "l4_per_clkdm",
3466 .flags = HWMOD_SWSUP_SIDLE_ACT, 2845 .flags = HWMOD_SWSUP_SIDLE_ACT,
3467 .mpu_irqs = omap44xx_uart2_irqs,
3468 .sdma_reqs = omap44xx_uart2_sdma_reqs,
3469 .main_clk = "func_48m_fclk", 2846 .main_clk = "func_48m_fclk",
3470 .prcm = { 2847 .prcm = {
3471 .omap4 = { 2848 .omap4 = {
@@ -3477,25 +2854,12 @@ static struct omap_hwmod omap44xx_uart2_hwmod = {
3477}; 2854};
3478 2855
3479/* uart3 */ 2856/* uart3 */
3480static struct omap_hwmod_irq_info omap44xx_uart3_irqs[] = {
3481 { .irq = 74 + OMAP44XX_IRQ_GIC_START },
3482 { .irq = -1 }
3483};
3484
3485static struct omap_hwmod_dma_info omap44xx_uart3_sdma_reqs[] = {
3486 { .name = "tx", .dma_req = 52 + OMAP44XX_DMA_REQ_START },
3487 { .name = "rx", .dma_req = 53 + OMAP44XX_DMA_REQ_START },
3488 { .dma_req = -1 }
3489};
3490
3491static struct omap_hwmod omap44xx_uart3_hwmod = { 2857static struct omap_hwmod omap44xx_uart3_hwmod = {
3492 .name = "uart3", 2858 .name = "uart3",
3493 .class = &omap44xx_uart_hwmod_class, 2859 .class = &omap44xx_uart_hwmod_class,
3494 .clkdm_name = "l4_per_clkdm", 2860 .clkdm_name = "l4_per_clkdm",
3495 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET | 2861 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET |
3496 HWMOD_SWSUP_SIDLE_ACT, 2862 HWMOD_SWSUP_SIDLE_ACT,
3497 .mpu_irqs = omap44xx_uart3_irqs,
3498 .sdma_reqs = omap44xx_uart3_sdma_reqs,
3499 .main_clk = "func_48m_fclk", 2863 .main_clk = "func_48m_fclk",
3500 .prcm = { 2864 .prcm = {
3501 .omap4 = { 2865 .omap4 = {
@@ -3507,24 +2871,11 @@ static struct omap_hwmod omap44xx_uart3_hwmod = {
3507}; 2871};
3508 2872
3509/* uart4 */ 2873/* uart4 */
3510static struct omap_hwmod_irq_info omap44xx_uart4_irqs[] = {
3511 { .irq = 70 + OMAP44XX_IRQ_GIC_START },
3512 { .irq = -1 }
3513};
3514
3515static struct omap_hwmod_dma_info omap44xx_uart4_sdma_reqs[] = {
3516 { .name = "tx", .dma_req = 54 + OMAP44XX_DMA_REQ_START },
3517 { .name = "rx", .dma_req = 55 + OMAP44XX_DMA_REQ_START },
3518 { .dma_req = -1 }
3519};
3520
3521static struct omap_hwmod omap44xx_uart4_hwmod = { 2874static struct omap_hwmod omap44xx_uart4_hwmod = {
3522 .name = "uart4", 2875 .name = "uart4",
3523 .class = &omap44xx_uart_hwmod_class, 2876 .class = &omap44xx_uart_hwmod_class,
3524 .clkdm_name = "l4_per_clkdm", 2877 .clkdm_name = "l4_per_clkdm",
3525 .flags = HWMOD_SWSUP_SIDLE_ACT, 2878 .flags = HWMOD_SWSUP_SIDLE_ACT,
3526 .mpu_irqs = omap44xx_uart4_irqs,
3527 .sdma_reqs = omap44xx_uart4_sdma_reqs,
3528 .main_clk = "func_48m_fclk", 2879 .main_clk = "func_48m_fclk",
3529 .prcm = { 2880 .prcm = {
3530 .omap4 = { 2881 .omap4 = {
@@ -3563,17 +2914,10 @@ static struct omap_hwmod_class omap44xx_usb_host_fs_hwmod_class = {
3563}; 2914};
3564 2915
3565/* usb_host_fs */ 2916/* usb_host_fs */
3566static struct omap_hwmod_irq_info omap44xx_usb_host_fs_irqs[] = {
3567 { .name = "std", .irq = 89 + OMAP44XX_IRQ_GIC_START },
3568 { .name = "smi", .irq = 90 + OMAP44XX_IRQ_GIC_START },
3569 { .irq = -1 }
3570};
3571
3572static struct omap_hwmod omap44xx_usb_host_fs_hwmod = { 2917static struct omap_hwmod omap44xx_usb_host_fs_hwmod = {
3573 .name = "usb_host_fs", 2918 .name = "usb_host_fs",
3574 .class = &omap44xx_usb_host_fs_hwmod_class, 2919 .class = &omap44xx_usb_host_fs_hwmod_class,
3575 .clkdm_name = "l3_init_clkdm", 2920 .clkdm_name = "l3_init_clkdm",
3576 .mpu_irqs = omap44xx_usb_host_fs_irqs,
3577 .main_clk = "usb_host_fs_fck", 2921 .main_clk = "usb_host_fs_fck",
3578 .prcm = { 2922 .prcm = {
3579 .omap4 = { 2923 .omap4 = {
@@ -3607,12 +2951,6 @@ static struct omap_hwmod_class omap44xx_usb_host_hs_hwmod_class = {
3607}; 2951};
3608 2952
3609/* usb_host_hs */ 2953/* usb_host_hs */
3610static struct omap_hwmod_irq_info omap44xx_usb_host_hs_irqs[] = {
3611 { .name = "ohci-irq", .irq = 76 + OMAP44XX_IRQ_GIC_START },
3612 { .name = "ehci-irq", .irq = 77 + OMAP44XX_IRQ_GIC_START },
3613 { .irq = -1 }
3614};
3615
3616static struct omap_hwmod omap44xx_usb_host_hs_hwmod = { 2954static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
3617 .name = "usb_host_hs", 2955 .name = "usb_host_hs",
3618 .class = &omap44xx_usb_host_hs_hwmod_class, 2956 .class = &omap44xx_usb_host_hs_hwmod_class,
@@ -3625,7 +2963,6 @@ static struct omap_hwmod omap44xx_usb_host_hs_hwmod = {
3625 .modulemode = MODULEMODE_SWCTRL, 2963 .modulemode = MODULEMODE_SWCTRL,
3626 }, 2964 },
3627 }, 2965 },
3628 .mpu_irqs = omap44xx_usb_host_hs_irqs,
3629 2966
3630 /* 2967 /*
3631 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock 2968 * Errata: USBHOST Configured In Smart-Idle Can Lead To a Deadlock
@@ -3700,12 +3037,6 @@ static struct omap_hwmod_class omap44xx_usb_otg_hs_hwmod_class = {
3700}; 3037};
3701 3038
3702/* usb_otg_hs */ 3039/* usb_otg_hs */
3703static struct omap_hwmod_irq_info omap44xx_usb_otg_hs_irqs[] = {
3704 { .name = "mc", .irq = 92 + OMAP44XX_IRQ_GIC_START },
3705 { .name = "dma", .irq = 93 + OMAP44XX_IRQ_GIC_START },
3706 { .irq = -1 }
3707};
3708
3709static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = { 3040static struct omap_hwmod_opt_clk usb_otg_hs_opt_clks[] = {
3710 { .role = "xclk", .clk = "usb_otg_hs_xclk" }, 3041 { .role = "xclk", .clk = "usb_otg_hs_xclk" },
3711}; 3042};
@@ -3715,7 +3046,6 @@ static struct omap_hwmod omap44xx_usb_otg_hs_hwmod = {
3715 .class = &omap44xx_usb_otg_hs_hwmod_class, 3046 .class = &omap44xx_usb_otg_hs_hwmod_class,
3716 .clkdm_name = "l3_init_clkdm", 3047 .clkdm_name = "l3_init_clkdm",
3717 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, 3048 .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY,
3718 .mpu_irqs = omap44xx_usb_otg_hs_irqs,
3719 .main_clk = "usb_otg_hs_ick", 3049 .main_clk = "usb_otg_hs_ick",
3720 .prcm = { 3050 .prcm = {
3721 .omap4 = { 3051 .omap4 = {
@@ -3749,16 +3079,10 @@ static struct omap_hwmod_class omap44xx_usb_tll_hs_hwmod_class = {
3749 .sysc = &omap44xx_usb_tll_hs_sysc, 3079 .sysc = &omap44xx_usb_tll_hs_sysc,
3750}; 3080};
3751 3081
3752static struct omap_hwmod_irq_info omap44xx_usb_tll_hs_irqs[] = {
3753 { .name = "tll-irq", .irq = 78 + OMAP44XX_IRQ_GIC_START },
3754 { .irq = -1 }
3755};
3756
3757static struct omap_hwmod omap44xx_usb_tll_hs_hwmod = { 3082static struct omap_hwmod omap44xx_usb_tll_hs_hwmod = {
3758 .name = "usb_tll_hs", 3083 .name = "usb_tll_hs",
3759 .class = &omap44xx_usb_tll_hs_hwmod_class, 3084 .class = &omap44xx_usb_tll_hs_hwmod_class,
3760 .clkdm_name = "l3_init_clkdm", 3085 .clkdm_name = "l3_init_clkdm",
3761 .mpu_irqs = omap44xx_usb_tll_hs_irqs,
3762 .main_clk = "usb_tll_hs_ick", 3086 .main_clk = "usb_tll_hs_ick",
3763 .prcm = { 3087 .prcm = {
3764 .omap4 = { 3088 .omap4 = {
@@ -3794,16 +3118,10 @@ static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = {
3794}; 3118};
3795 3119
3796/* wd_timer2 */ 3120/* wd_timer2 */
3797static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = {
3798 { .irq = 80 + OMAP44XX_IRQ_GIC_START },
3799 { .irq = -1 }
3800};
3801
3802static struct omap_hwmod omap44xx_wd_timer2_hwmod = { 3121static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
3803 .name = "wd_timer2", 3122 .name = "wd_timer2",
3804 .class = &omap44xx_wd_timer_hwmod_class, 3123 .class = &omap44xx_wd_timer_hwmod_class,
3805 .clkdm_name = "l4_wkup_clkdm", 3124 .clkdm_name = "l4_wkup_clkdm",
3806 .mpu_irqs = omap44xx_wd_timer2_irqs,
3807 .main_clk = "sys_32k_ck", 3125 .main_clk = "sys_32k_ck",
3808 .prcm = { 3126 .prcm = {
3809 .omap4 = { 3127 .omap4 = {
@@ -3815,16 +3133,10 @@ static struct omap_hwmod omap44xx_wd_timer2_hwmod = {
3815}; 3133};
3816 3134
3817/* wd_timer3 */ 3135/* wd_timer3 */
3818static struct omap_hwmod_irq_info omap44xx_wd_timer3_irqs[] = {
3819 { .irq = 36 + OMAP44XX_IRQ_GIC_START },
3820 { .irq = -1 }
3821};
3822
3823static struct omap_hwmod omap44xx_wd_timer3_hwmod = { 3136static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
3824 .name = "wd_timer3", 3137 .name = "wd_timer3",
3825 .class = &omap44xx_wd_timer_hwmod_class, 3138 .class = &omap44xx_wd_timer_hwmod_class,
3826 .clkdm_name = "abe_clkdm", 3139 .clkdm_name = "abe_clkdm",
3827 .mpu_irqs = omap44xx_wd_timer3_irqs,
3828 .main_clk = "sys_32k_ck", 3140 .main_clk = "sys_32k_ck",
3829 .prcm = { 3141 .prcm = {
3830 .omap4 = { 3142 .omap4 = {
@@ -3840,32 +3152,6 @@ static struct omap_hwmod omap44xx_wd_timer3_hwmod = {
3840 * interfaces 3152 * interfaces
3841 */ 3153 */
3842 3154
3843static struct omap_hwmod_addr_space omap44xx_c2c_target_fw_addrs[] = {
3844 {
3845 .pa_start = 0x4a204000,
3846 .pa_end = 0x4a2040ff,
3847 .flags = ADDR_TYPE_RT
3848 },
3849 { }
3850};
3851
3852/* c2c -> c2c_target_fw */
3853static struct omap_hwmod_ocp_if omap44xx_c2c__c2c_target_fw = {
3854 .master = &omap44xx_c2c_hwmod,
3855 .slave = &omap44xx_c2c_target_fw_hwmod,
3856 .clk = "div_core_ck",
3857 .addr = omap44xx_c2c_target_fw_addrs,
3858 .user = OCP_USER_MPU,
3859};
3860
3861/* l4_cfg -> c2c_target_fw */
3862static struct omap_hwmod_ocp_if omap44xx_l4_cfg__c2c_target_fw = {
3863 .master = &omap44xx_l4_cfg_hwmod,
3864 .slave = &omap44xx_c2c_target_fw_hwmod,
3865 .clk = "l4_div_ck",
3866 .user = OCP_USER_MPU | OCP_USER_SDMA,
3867};
3868
3869/* l3_main_1 -> dmm */ 3155/* l3_main_1 -> dmm */
3870static struct omap_hwmod_ocp_if omap44xx_l3_main_1__dmm = { 3156static struct omap_hwmod_ocp_if omap44xx_l3_main_1__dmm = {
3871 .master = &omap44xx_l3_main_1_hwmod, 3157 .master = &omap44xx_l3_main_1_hwmod,
@@ -3874,55 +3160,11 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_1__dmm = {
3874 .user = OCP_USER_SDMA, 3160 .user = OCP_USER_SDMA,
3875}; 3161};
3876 3162
3877static struct omap_hwmod_addr_space omap44xx_dmm_addrs[] = {
3878 {
3879 .pa_start = 0x4e000000,
3880 .pa_end = 0x4e0007ff,
3881 .flags = ADDR_TYPE_RT
3882 },
3883 { }
3884};
3885
3886/* mpu -> dmm */ 3163/* mpu -> dmm */
3887static struct omap_hwmod_ocp_if omap44xx_mpu__dmm = { 3164static struct omap_hwmod_ocp_if omap44xx_mpu__dmm = {
3888 .master = &omap44xx_mpu_hwmod, 3165 .master = &omap44xx_mpu_hwmod,
3889 .slave = &omap44xx_dmm_hwmod, 3166 .slave = &omap44xx_dmm_hwmod,
3890 .clk = "l3_div_ck", 3167 .clk = "l3_div_ck",
3891 .addr = omap44xx_dmm_addrs,
3892 .user = OCP_USER_MPU,
3893};
3894
3895/* c2c -> emif_fw */
3896static struct omap_hwmod_ocp_if omap44xx_c2c__emif_fw = {
3897 .master = &omap44xx_c2c_hwmod,
3898 .slave = &omap44xx_emif_fw_hwmod,
3899 .clk = "div_core_ck",
3900 .user = OCP_USER_MPU | OCP_USER_SDMA,
3901};
3902
3903/* dmm -> emif_fw */
3904static struct omap_hwmod_ocp_if omap44xx_dmm__emif_fw = {
3905 .master = &omap44xx_dmm_hwmod,
3906 .slave = &omap44xx_emif_fw_hwmod,
3907 .clk = "l3_div_ck",
3908 .user = OCP_USER_MPU | OCP_USER_SDMA,
3909};
3910
3911static struct omap_hwmod_addr_space omap44xx_emif_fw_addrs[] = {
3912 {
3913 .pa_start = 0x4a20c000,
3914 .pa_end = 0x4a20c0ff,
3915 .flags = ADDR_TYPE_RT
3916 },
3917 { }
3918};
3919
3920/* l4_cfg -> emif_fw */
3921static struct omap_hwmod_ocp_if omap44xx_l4_cfg__emif_fw = {
3922 .master = &omap44xx_l4_cfg_hwmod,
3923 .slave = &omap44xx_emif_fw_hwmod,
3924 .clk = "l4_div_ck",
3925 .addr = omap44xx_emif_fw_addrs,
3926 .user = OCP_USER_MPU, 3168 .user = OCP_USER_MPU,
3927}; 3169};
3928 3170
@@ -3998,32 +3240,14 @@ static struct omap_hwmod_ocp_if omap44xx_mmc2__l3_main_1 = {
3998 .user = OCP_USER_MPU | OCP_USER_SDMA, 3240 .user = OCP_USER_MPU | OCP_USER_SDMA,
3999}; 3241};
4000 3242
4001static struct omap_hwmod_addr_space omap44xx_l3_main_1_addrs[] = {
4002 {
4003 .pa_start = 0x44000000,
4004 .pa_end = 0x44000fff,
4005 .flags = ADDR_TYPE_RT
4006 },
4007 { }
4008};
4009
4010/* mpu -> l3_main_1 */ 3243/* mpu -> l3_main_1 */
4011static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = { 3244static struct omap_hwmod_ocp_if omap44xx_mpu__l3_main_1 = {
4012 .master = &omap44xx_mpu_hwmod, 3245 .master = &omap44xx_mpu_hwmod,
4013 .slave = &omap44xx_l3_main_1_hwmod, 3246 .slave = &omap44xx_l3_main_1_hwmod,
4014 .clk = "l3_div_ck", 3247 .clk = "l3_div_ck",
4015 .addr = omap44xx_l3_main_1_addrs,
4016 .user = OCP_USER_MPU, 3248 .user = OCP_USER_MPU,
4017}; 3249};
4018 3250
4019/* c2c_target_fw -> l3_main_2 */
4020static struct omap_hwmod_ocp_if omap44xx_c2c_target_fw__l3_main_2 = {
4021 .master = &omap44xx_c2c_target_fw_hwmod,
4022 .slave = &omap44xx_l3_main_2_hwmod,
4023 .clk = "l3_div_ck",
4024 .user = OCP_USER_MPU | OCP_USER_SDMA,
4025};
4026
4027/* debugss -> l3_main_2 */ 3251/* debugss -> l3_main_2 */
4028static struct omap_hwmod_ocp_if omap44xx_debugss__l3_main_2 = { 3252static struct omap_hwmod_ocp_if omap44xx_debugss__l3_main_2 = {
4029 .master = &omap44xx_debugss_hwmod, 3253 .master = &omap44xx_debugss_hwmod,
@@ -4088,21 +3312,11 @@ static struct omap_hwmod_ocp_if omap44xx_iva__l3_main_2 = {
4088 .user = OCP_USER_MPU | OCP_USER_SDMA, 3312 .user = OCP_USER_MPU | OCP_USER_SDMA,
4089}; 3313};
4090 3314
4091static struct omap_hwmod_addr_space omap44xx_l3_main_2_addrs[] = {
4092 {
4093 .pa_start = 0x44800000,
4094 .pa_end = 0x44801fff,
4095 .flags = ADDR_TYPE_RT
4096 },
4097 { }
4098};
4099
4100/* l3_main_1 -> l3_main_2 */ 3315/* l3_main_1 -> l3_main_2 */
4101static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_2 = { 3316static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_2 = {
4102 .master = &omap44xx_l3_main_1_hwmod, 3317 .master = &omap44xx_l3_main_1_hwmod,
4103 .slave = &omap44xx_l3_main_2_hwmod, 3318 .slave = &omap44xx_l3_main_2_hwmod,
4104 .clk = "l3_div_ck", 3319 .clk = "l3_div_ck",
4105 .addr = omap44xx_l3_main_2_addrs,
4106 .user = OCP_USER_MPU, 3320 .user = OCP_USER_MPU,
4107}; 3321};
4108 3322
@@ -4138,21 +3352,11 @@ static struct omap_hwmod_ocp_if omap44xx_usb_otg_hs__l3_main_2 = {
4138 .user = OCP_USER_MPU | OCP_USER_SDMA, 3352 .user = OCP_USER_MPU | OCP_USER_SDMA,
4139}; 3353};
4140 3354
4141static struct omap_hwmod_addr_space omap44xx_l3_main_3_addrs[] = {
4142 {
4143 .pa_start = 0x45000000,
4144 .pa_end = 0x45000fff,
4145 .flags = ADDR_TYPE_RT
4146 },
4147 { }
4148};
4149
4150/* l3_main_1 -> l3_main_3 */ 3355/* l3_main_1 -> l3_main_3 */
4151static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_3 = { 3356static struct omap_hwmod_ocp_if omap44xx_l3_main_1__l3_main_3 = {
4152 .master = &omap44xx_l3_main_1_hwmod, 3357 .master = &omap44xx_l3_main_1_hwmod,
4153 .slave = &omap44xx_l3_main_3_hwmod, 3358 .slave = &omap44xx_l3_main_3_hwmod,
4154 .clk = "l3_div_ck", 3359 .clk = "l3_div_ck",
4155 .addr = omap44xx_l3_main_3_addrs,
4156 .user = OCP_USER_MPU, 3360 .user = OCP_USER_MPU,
4157}; 3361};
4158 3362
@@ -4236,21 +3440,11 @@ static struct omap_hwmod_ocp_if omap44xx_mpu__mpu_private = {
4236 .user = OCP_USER_MPU | OCP_USER_SDMA, 3440 .user = OCP_USER_MPU | OCP_USER_SDMA,
4237}; 3441};
4238 3442
4239static struct omap_hwmod_addr_space omap44xx_ocp_wp_noc_addrs[] = {
4240 {
4241 .pa_start = 0x4a102000,
4242 .pa_end = 0x4a10207f,
4243 .flags = ADDR_TYPE_RT
4244 },
4245 { }
4246};
4247
4248/* l4_cfg -> ocp_wp_noc */ 3443/* l4_cfg -> ocp_wp_noc */
4249static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp_wp_noc = { 3444static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp_wp_noc = {
4250 .master = &omap44xx_l4_cfg_hwmod, 3445 .master = &omap44xx_l4_cfg_hwmod,
4251 .slave = &omap44xx_ocp_wp_noc_hwmod, 3446 .slave = &omap44xx_ocp_wp_noc_hwmod,
4252 .clk = "l4_div_ck", 3447 .clk = "l4_div_ck",
4253 .addr = omap44xx_ocp_wp_noc_addrs,
4254 .user = OCP_USER_MPU | OCP_USER_SDMA, 3448 .user = OCP_USER_MPU | OCP_USER_SDMA,
4255}; 3449};
4256 3450
@@ -4340,21 +3534,11 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__c2c = {
4340 .user = OCP_USER_MPU | OCP_USER_SDMA, 3534 .user = OCP_USER_MPU | OCP_USER_SDMA,
4341}; 3535};
4342 3536
4343static struct omap_hwmod_addr_space omap44xx_counter_32k_addrs[] = {
4344 {
4345 .pa_start = 0x4a304000,
4346 .pa_end = 0x4a30401f,
4347 .flags = ADDR_TYPE_RT
4348 },
4349 { }
4350};
4351
4352/* l4_wkup -> counter_32k */ 3537/* l4_wkup -> counter_32k */
4353static struct omap_hwmod_ocp_if omap44xx_l4_wkup__counter_32k = { 3538static struct omap_hwmod_ocp_if omap44xx_l4_wkup__counter_32k = {
4354 .master = &omap44xx_l4_wkup_hwmod, 3539 .master = &omap44xx_l4_wkup_hwmod,
4355 .slave = &omap44xx_counter_32k_hwmod, 3540 .slave = &omap44xx_counter_32k_hwmod,
4356 .clk = "l4_wkup_clk_mux_ck", 3541 .clk = "l4_wkup_clk_mux_ck",
4357 .addr = omap44xx_counter_32k_addrs,
4358 .user = OCP_USER_MPU | OCP_USER_SDMA, 3542 .user = OCP_USER_MPU | OCP_USER_SDMA,
4359}; 3543};
4360 3544
@@ -4430,21 +3614,11 @@ static struct omap_hwmod_ocp_if omap44xx_l4_wkup__ctrl_module_pad_wkup = {
4430 .user = OCP_USER_MPU | OCP_USER_SDMA, 3614 .user = OCP_USER_MPU | OCP_USER_SDMA,
4431}; 3615};
4432 3616
4433static struct omap_hwmod_addr_space omap44xx_debugss_addrs[] = {
4434 {
4435 .pa_start = 0x54160000,
4436 .pa_end = 0x54167fff,
4437 .flags = ADDR_TYPE_RT
4438 },
4439 { }
4440};
4441
4442/* l3_instr -> debugss */ 3617/* l3_instr -> debugss */
4443static struct omap_hwmod_ocp_if omap44xx_l3_instr__debugss = { 3618static struct omap_hwmod_ocp_if omap44xx_l3_instr__debugss = {
4444 .master = &omap44xx_l3_instr_hwmod, 3619 .master = &omap44xx_l3_instr_hwmod,
4445 .slave = &omap44xx_debugss_hwmod, 3620 .slave = &omap44xx_debugss_hwmod,
4446 .clk = "l3_div_ck", 3621 .clk = "l3_div_ck",
4447 .addr = omap44xx_debugss_addrs,
4448 .user = OCP_USER_MPU | OCP_USER_SDMA, 3622 .user = OCP_USER_MPU | OCP_USER_SDMA,
4449}; 3623};
4450 3624
@@ -4466,41 +3640,19 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__dma_system = {
4466 .user = OCP_USER_MPU | OCP_USER_SDMA, 3640 .user = OCP_USER_MPU | OCP_USER_SDMA,
4467}; 3641};
4468 3642
4469static struct omap_hwmod_addr_space omap44xx_dmic_addrs[] = {
4470 {
4471 .name = "mpu",
4472 .pa_start = 0x4012e000,
4473 .pa_end = 0x4012e07f,
4474 .flags = ADDR_TYPE_RT
4475 },
4476 { }
4477};
4478
4479/* l4_abe -> dmic */ 3643/* l4_abe -> dmic */
4480static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = { 3644static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = {
4481 .master = &omap44xx_l4_abe_hwmod, 3645 .master = &omap44xx_l4_abe_hwmod,
4482 .slave = &omap44xx_dmic_hwmod, 3646 .slave = &omap44xx_dmic_hwmod,
4483 .clk = "ocp_abe_iclk", 3647 .clk = "ocp_abe_iclk",
4484 .addr = omap44xx_dmic_addrs,
4485 .user = OCP_USER_MPU, 3648 .user = OCP_USER_MPU,
4486}; 3649};
4487 3650
4488static struct omap_hwmod_addr_space omap44xx_dmic_dma_addrs[] = {
4489 {
4490 .name = "dma",
4491 .pa_start = 0x4902e000,
4492 .pa_end = 0x4902e07f,
4493 .flags = ADDR_TYPE_RT
4494 },
4495 { }
4496};
4497
4498/* l4_abe -> dmic (dma) */ 3651/* l4_abe -> dmic (dma) */
4499static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic_dma = { 3652static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic_dma = {
4500 .master = &omap44xx_l4_abe_hwmod, 3653 .master = &omap44xx_l4_abe_hwmod,
4501 .slave = &omap44xx_dmic_hwmod, 3654 .slave = &omap44xx_dmic_hwmod,
4502 .clk = "ocp_abe_iclk", 3655 .clk = "ocp_abe_iclk",
4503 .addr = omap44xx_dmic_dma_addrs,
4504 .user = OCP_USER_SDMA, 3656 .user = OCP_USER_SDMA,
4505}; 3657};
4506 3658
@@ -4798,42 +3950,6 @@ static struct omap_hwmod_ocp_if omap44xx_l4_per__elm = {
4798 .user = OCP_USER_MPU | OCP_USER_SDMA, 3950 .user = OCP_USER_MPU | OCP_USER_SDMA,
4799}; 3951};
4800 3952
4801static struct omap_hwmod_addr_space omap44xx_emif1_addrs[] = {
4802 {
4803 .pa_start = 0x4c000000,
4804 .pa_end = 0x4c0000ff,
4805 .flags = ADDR_TYPE_RT
4806 },
4807 { }
4808};
4809
4810/* emif_fw -> emif1 */
4811static struct omap_hwmod_ocp_if omap44xx_emif_fw__emif1 = {
4812 .master = &omap44xx_emif_fw_hwmod,
4813 .slave = &omap44xx_emif1_hwmod,
4814 .clk = "l3_div_ck",
4815 .addr = omap44xx_emif1_addrs,
4816 .user = OCP_USER_MPU | OCP_USER_SDMA,
4817};
4818
4819static struct omap_hwmod_addr_space omap44xx_emif2_addrs[] = {
4820 {
4821 .pa_start = 0x4d000000,
4822 .pa_end = 0x4d0000ff,
4823 .flags = ADDR_TYPE_RT
4824 },
4825 { }
4826};
4827
4828/* emif_fw -> emif2 */
4829static struct omap_hwmod_ocp_if omap44xx_emif_fw__emif2 = {
4830 .master = &omap44xx_emif_fw_hwmod,
4831 .slave = &omap44xx_emif2_hwmod,
4832 .clk = "l3_div_ck",
4833 .addr = omap44xx_emif2_addrs,
4834 .user = OCP_USER_MPU | OCP_USER_SDMA,
4835};
4836
4837static struct omap_hwmod_addr_space omap44xx_fdif_addrs[] = { 3953static struct omap_hwmod_addr_space omap44xx_fdif_addrs[] = {
4838 { 3954 {
4839 .pa_start = 0x4a10a000, 3955 .pa_start = 0x4a10a000,
@@ -4852,129 +3968,59 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__fdif = {
4852 .user = OCP_USER_MPU | OCP_USER_SDMA, 3968 .user = OCP_USER_MPU | OCP_USER_SDMA,
4853}; 3969};
4854 3970
4855static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = {
4856 {
4857 .pa_start = 0x4a310000,
4858 .pa_end = 0x4a3101ff,
4859 .flags = ADDR_TYPE_RT
4860 },
4861 { }
4862};
4863
4864/* l4_wkup -> gpio1 */ 3971/* l4_wkup -> gpio1 */
4865static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = { 3972static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
4866 .master = &omap44xx_l4_wkup_hwmod, 3973 .master = &omap44xx_l4_wkup_hwmod,
4867 .slave = &omap44xx_gpio1_hwmod, 3974 .slave = &omap44xx_gpio1_hwmod,
4868 .clk = "l4_wkup_clk_mux_ck", 3975 .clk = "l4_wkup_clk_mux_ck",
4869 .addr = omap44xx_gpio1_addrs,
4870 .user = OCP_USER_MPU | OCP_USER_SDMA, 3976 .user = OCP_USER_MPU | OCP_USER_SDMA,
4871}; 3977};
4872 3978
4873static struct omap_hwmod_addr_space omap44xx_gpio2_addrs[] = {
4874 {
4875 .pa_start = 0x48055000,
4876 .pa_end = 0x480551ff,
4877 .flags = ADDR_TYPE_RT
4878 },
4879 { }
4880};
4881
4882/* l4_per -> gpio2 */ 3979/* l4_per -> gpio2 */
4883static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = { 3980static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = {
4884 .master = &omap44xx_l4_per_hwmod, 3981 .master = &omap44xx_l4_per_hwmod,
4885 .slave = &omap44xx_gpio2_hwmod, 3982 .slave = &omap44xx_gpio2_hwmod,
4886 .clk = "l4_div_ck", 3983 .clk = "l4_div_ck",
4887 .addr = omap44xx_gpio2_addrs,
4888 .user = OCP_USER_MPU | OCP_USER_SDMA, 3984 .user = OCP_USER_MPU | OCP_USER_SDMA,
4889}; 3985};
4890 3986
4891static struct omap_hwmod_addr_space omap44xx_gpio3_addrs[] = {
4892 {
4893 .pa_start = 0x48057000,
4894 .pa_end = 0x480571ff,
4895 .flags = ADDR_TYPE_RT
4896 },
4897 { }
4898};
4899
4900/* l4_per -> gpio3 */ 3987/* l4_per -> gpio3 */
4901static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = { 3988static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = {
4902 .master = &omap44xx_l4_per_hwmod, 3989 .master = &omap44xx_l4_per_hwmod,
4903 .slave = &omap44xx_gpio3_hwmod, 3990 .slave = &omap44xx_gpio3_hwmod,
4904 .clk = "l4_div_ck", 3991 .clk = "l4_div_ck",
4905 .addr = omap44xx_gpio3_addrs,
4906 .user = OCP_USER_MPU | OCP_USER_SDMA, 3992 .user = OCP_USER_MPU | OCP_USER_SDMA,
4907}; 3993};
4908 3994
4909static struct omap_hwmod_addr_space omap44xx_gpio4_addrs[] = {
4910 {
4911 .pa_start = 0x48059000,
4912 .pa_end = 0x480591ff,
4913 .flags = ADDR_TYPE_RT
4914 },
4915 { }
4916};
4917
4918/* l4_per -> gpio4 */ 3995/* l4_per -> gpio4 */
4919static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio4 = { 3996static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio4 = {
4920 .master = &omap44xx_l4_per_hwmod, 3997 .master = &omap44xx_l4_per_hwmod,
4921 .slave = &omap44xx_gpio4_hwmod, 3998 .slave = &omap44xx_gpio4_hwmod,
4922 .clk = "l4_div_ck", 3999 .clk = "l4_div_ck",
4923 .addr = omap44xx_gpio4_addrs,
4924 .user = OCP_USER_MPU | OCP_USER_SDMA, 4000 .user = OCP_USER_MPU | OCP_USER_SDMA,
4925}; 4001};
4926 4002
4927static struct omap_hwmod_addr_space omap44xx_gpio5_addrs[] = {
4928 {
4929 .pa_start = 0x4805b000,
4930 .pa_end = 0x4805b1ff,
4931 .flags = ADDR_TYPE_RT
4932 },
4933 { }
4934};
4935
4936/* l4_per -> gpio5 */ 4003/* l4_per -> gpio5 */
4937static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio5 = { 4004static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio5 = {
4938 .master = &omap44xx_l4_per_hwmod, 4005 .master = &omap44xx_l4_per_hwmod,
4939 .slave = &omap44xx_gpio5_hwmod, 4006 .slave = &omap44xx_gpio5_hwmod,
4940 .clk = "l4_div_ck", 4007 .clk = "l4_div_ck",
4941 .addr = omap44xx_gpio5_addrs,
4942 .user = OCP_USER_MPU | OCP_USER_SDMA, 4008 .user = OCP_USER_MPU | OCP_USER_SDMA,
4943}; 4009};
4944 4010
4945static struct omap_hwmod_addr_space omap44xx_gpio6_addrs[] = {
4946 {
4947 .pa_start = 0x4805d000,
4948 .pa_end = 0x4805d1ff,
4949 .flags = ADDR_TYPE_RT
4950 },
4951 { }
4952};
4953
4954/* l4_per -> gpio6 */ 4011/* l4_per -> gpio6 */
4955static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio6 = { 4012static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio6 = {
4956 .master = &omap44xx_l4_per_hwmod, 4013 .master = &omap44xx_l4_per_hwmod,
4957 .slave = &omap44xx_gpio6_hwmod, 4014 .slave = &omap44xx_gpio6_hwmod,
4958 .clk = "l4_div_ck", 4015 .clk = "l4_div_ck",
4959 .addr = omap44xx_gpio6_addrs,
4960 .user = OCP_USER_MPU | OCP_USER_SDMA, 4016 .user = OCP_USER_MPU | OCP_USER_SDMA,
4961}; 4017};
4962 4018
4963static struct omap_hwmod_addr_space omap44xx_gpmc_addrs[] = {
4964 {
4965 .pa_start = 0x50000000,
4966 .pa_end = 0x500003ff,
4967 .flags = ADDR_TYPE_RT
4968 },
4969 { }
4970};
4971
4972/* l3_main_2 -> gpmc */ 4019/* l3_main_2 -> gpmc */
4973static struct omap_hwmod_ocp_if omap44xx_l3_main_2__gpmc = { 4020static struct omap_hwmod_ocp_if omap44xx_l3_main_2__gpmc = {
4974 .master = &omap44xx_l3_main_2_hwmod, 4021 .master = &omap44xx_l3_main_2_hwmod,
4975 .slave = &omap44xx_gpmc_hwmod, 4022 .slave = &omap44xx_gpmc_hwmod,
4976 .clk = "l3_div_ck", 4023 .clk = "l3_div_ck",
4977 .addr = omap44xx_gpmc_addrs,
4978 .user = OCP_USER_MPU | OCP_USER_SDMA, 4024 .user = OCP_USER_MPU | OCP_USER_SDMA,
4979}; 4025};
4980 4026
@@ -5032,75 +4078,35 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__hsi = {
5032 .user = OCP_USER_MPU | OCP_USER_SDMA, 4078 .user = OCP_USER_MPU | OCP_USER_SDMA,
5033}; 4079};
5034 4080
5035static struct omap_hwmod_addr_space omap44xx_i2c1_addrs[] = {
5036 {
5037 .pa_start = 0x48070000,
5038 .pa_end = 0x480700ff,
5039 .flags = ADDR_TYPE_RT
5040 },
5041 { }
5042};
5043
5044/* l4_per -> i2c1 */ 4081/* l4_per -> i2c1 */
5045static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c1 = { 4082static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c1 = {
5046 .master = &omap44xx_l4_per_hwmod, 4083 .master = &omap44xx_l4_per_hwmod,
5047 .slave = &omap44xx_i2c1_hwmod, 4084 .slave = &omap44xx_i2c1_hwmod,
5048 .clk = "l4_div_ck", 4085 .clk = "l4_div_ck",
5049 .addr = omap44xx_i2c1_addrs,
5050 .user = OCP_USER_MPU | OCP_USER_SDMA, 4086 .user = OCP_USER_MPU | OCP_USER_SDMA,
5051}; 4087};
5052 4088
5053static struct omap_hwmod_addr_space omap44xx_i2c2_addrs[] = {
5054 {
5055 .pa_start = 0x48072000,
5056 .pa_end = 0x480720ff,
5057 .flags = ADDR_TYPE_RT
5058 },
5059 { }
5060};
5061
5062/* l4_per -> i2c2 */ 4089/* l4_per -> i2c2 */
5063static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c2 = { 4090static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c2 = {
5064 .master = &omap44xx_l4_per_hwmod, 4091 .master = &omap44xx_l4_per_hwmod,
5065 .slave = &omap44xx_i2c2_hwmod, 4092 .slave = &omap44xx_i2c2_hwmod,
5066 .clk = "l4_div_ck", 4093 .clk = "l4_div_ck",
5067 .addr = omap44xx_i2c2_addrs,
5068 .user = OCP_USER_MPU | OCP_USER_SDMA, 4094 .user = OCP_USER_MPU | OCP_USER_SDMA,
5069}; 4095};
5070 4096
5071static struct omap_hwmod_addr_space omap44xx_i2c3_addrs[] = {
5072 {
5073 .pa_start = 0x48060000,
5074 .pa_end = 0x480600ff,
5075 .flags = ADDR_TYPE_RT
5076 },
5077 { }
5078};
5079
5080/* l4_per -> i2c3 */ 4097/* l4_per -> i2c3 */
5081static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c3 = { 4098static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c3 = {
5082 .master = &omap44xx_l4_per_hwmod, 4099 .master = &omap44xx_l4_per_hwmod,
5083 .slave = &omap44xx_i2c3_hwmod, 4100 .slave = &omap44xx_i2c3_hwmod,
5084 .clk = "l4_div_ck", 4101 .clk = "l4_div_ck",
5085 .addr = omap44xx_i2c3_addrs,
5086 .user = OCP_USER_MPU | OCP_USER_SDMA, 4102 .user = OCP_USER_MPU | OCP_USER_SDMA,
5087}; 4103};
5088 4104
5089static struct omap_hwmod_addr_space omap44xx_i2c4_addrs[] = {
5090 {
5091 .pa_start = 0x48350000,
5092 .pa_end = 0x483500ff,
5093 .flags = ADDR_TYPE_RT
5094 },
5095 { }
5096};
5097
5098/* l4_per -> i2c4 */ 4105/* l4_per -> i2c4 */
5099static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c4 = { 4106static struct omap_hwmod_ocp_if omap44xx_l4_per__i2c4 = {
5100 .master = &omap44xx_l4_per_hwmod, 4107 .master = &omap44xx_l4_per_hwmod,
5101 .slave = &omap44xx_i2c4_hwmod, 4108 .slave = &omap44xx_i2c4_hwmod,
5102 .clk = "l4_div_ck", 4109 .clk = "l4_div_ck",
5103 .addr = omap44xx_i2c4_addrs,
5104 .user = OCP_USER_MPU | OCP_USER_SDMA, 4110 .user = OCP_USER_MPU | OCP_USER_SDMA,
5105}; 4111};
5106 4112
@@ -5138,39 +4144,19 @@ static struct omap_hwmod_ocp_if __maybe_unused omap44xx_iva__sl2if = {
5138 .user = OCP_USER_IVA, 4144 .user = OCP_USER_IVA,
5139}; 4145};
5140 4146
5141static struct omap_hwmod_addr_space omap44xx_iva_addrs[] = {
5142 {
5143 .pa_start = 0x5a000000,
5144 .pa_end = 0x5a07ffff,
5145 .flags = ADDR_TYPE_RT
5146 },
5147 { }
5148};
5149
5150/* l3_main_2 -> iva */ 4147/* l3_main_2 -> iva */
5151static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iva = { 4148static struct omap_hwmod_ocp_if omap44xx_l3_main_2__iva = {
5152 .master = &omap44xx_l3_main_2_hwmod, 4149 .master = &omap44xx_l3_main_2_hwmod,
5153 .slave = &omap44xx_iva_hwmod, 4150 .slave = &omap44xx_iva_hwmod,
5154 .clk = "l3_div_ck", 4151 .clk = "l3_div_ck",
5155 .addr = omap44xx_iva_addrs,
5156 .user = OCP_USER_MPU, 4152 .user = OCP_USER_MPU,
5157}; 4153};
5158 4154
5159static struct omap_hwmod_addr_space omap44xx_kbd_addrs[] = {
5160 {
5161 .pa_start = 0x4a31c000,
5162 .pa_end = 0x4a31c07f,
5163 .flags = ADDR_TYPE_RT
5164 },
5165 { }
5166};
5167
5168/* l4_wkup -> kbd */ 4155/* l4_wkup -> kbd */
5169static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = { 4156static struct omap_hwmod_ocp_if omap44xx_l4_wkup__kbd = {
5170 .master = &omap44xx_l4_wkup_hwmod, 4157 .master = &omap44xx_l4_wkup_hwmod,
5171 .slave = &omap44xx_kbd_hwmod, 4158 .slave = &omap44xx_kbd_hwmod,
5172 .clk = "l4_wkup_clk_mux_ck", 4159 .clk = "l4_wkup_clk_mux_ck",
5173 .addr = omap44xx_kbd_addrs,
5174 .user = OCP_USER_MPU | OCP_USER_SDMA, 4160 .user = OCP_USER_MPU | OCP_USER_SDMA,
5175}; 4161};
5176 4162
@@ -5228,335 +4214,147 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcasp_dma = {
5228 .user = OCP_USER_SDMA, 4214 .user = OCP_USER_SDMA,
5229}; 4215};
5230 4216
5231static struct omap_hwmod_addr_space omap44xx_mcbsp1_addrs[] = {
5232 {
5233 .name = "mpu",
5234 .pa_start = 0x40122000,
5235 .pa_end = 0x401220ff,
5236 .flags = ADDR_TYPE_RT
5237 },
5238 { }
5239};
5240
5241/* l4_abe -> mcbsp1 */ 4217/* l4_abe -> mcbsp1 */
5242static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1 = { 4218static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1 = {
5243 .master = &omap44xx_l4_abe_hwmod, 4219 .master = &omap44xx_l4_abe_hwmod,
5244 .slave = &omap44xx_mcbsp1_hwmod, 4220 .slave = &omap44xx_mcbsp1_hwmod,
5245 .clk = "ocp_abe_iclk", 4221 .clk = "ocp_abe_iclk",
5246 .addr = omap44xx_mcbsp1_addrs,
5247 .user = OCP_USER_MPU, 4222 .user = OCP_USER_MPU,
5248}; 4223};
5249 4224
5250static struct omap_hwmod_addr_space omap44xx_mcbsp1_dma_addrs[] = {
5251 {
5252 .name = "dma",
5253 .pa_start = 0x49022000,
5254 .pa_end = 0x490220ff,
5255 .flags = ADDR_TYPE_RT
5256 },
5257 { }
5258};
5259
5260/* l4_abe -> mcbsp1 (dma) */ 4225/* l4_abe -> mcbsp1 (dma) */
5261static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1_dma = { 4226static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp1_dma = {
5262 .master = &omap44xx_l4_abe_hwmod, 4227 .master = &omap44xx_l4_abe_hwmod,
5263 .slave = &omap44xx_mcbsp1_hwmod, 4228 .slave = &omap44xx_mcbsp1_hwmod,
5264 .clk = "ocp_abe_iclk", 4229 .clk = "ocp_abe_iclk",
5265 .addr = omap44xx_mcbsp1_dma_addrs,
5266 .user = OCP_USER_SDMA, 4230 .user = OCP_USER_SDMA,
5267}; 4231};
5268 4232
5269static struct omap_hwmod_addr_space omap44xx_mcbsp2_addrs[] = {
5270 {
5271 .name = "mpu",
5272 .pa_start = 0x40124000,
5273 .pa_end = 0x401240ff,
5274 .flags = ADDR_TYPE_RT
5275 },
5276 { }
5277};
5278
5279/* l4_abe -> mcbsp2 */ 4233/* l4_abe -> mcbsp2 */
5280static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2 = { 4234static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2 = {
5281 .master = &omap44xx_l4_abe_hwmod, 4235 .master = &omap44xx_l4_abe_hwmod,
5282 .slave = &omap44xx_mcbsp2_hwmod, 4236 .slave = &omap44xx_mcbsp2_hwmod,
5283 .clk = "ocp_abe_iclk", 4237 .clk = "ocp_abe_iclk",
5284 .addr = omap44xx_mcbsp2_addrs,
5285 .user = OCP_USER_MPU, 4238 .user = OCP_USER_MPU,
5286}; 4239};
5287 4240
5288static struct omap_hwmod_addr_space omap44xx_mcbsp2_dma_addrs[] = {
5289 {
5290 .name = "dma",
5291 .pa_start = 0x49024000,
5292 .pa_end = 0x490240ff,
5293 .flags = ADDR_TYPE_RT
5294 },
5295 { }
5296};
5297
5298/* l4_abe -> mcbsp2 (dma) */ 4241/* l4_abe -> mcbsp2 (dma) */
5299static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2_dma = { 4242static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp2_dma = {
5300 .master = &omap44xx_l4_abe_hwmod, 4243 .master = &omap44xx_l4_abe_hwmod,
5301 .slave = &omap44xx_mcbsp2_hwmod, 4244 .slave = &omap44xx_mcbsp2_hwmod,
5302 .clk = "ocp_abe_iclk", 4245 .clk = "ocp_abe_iclk",
5303 .addr = omap44xx_mcbsp2_dma_addrs,
5304 .user = OCP_USER_SDMA, 4246 .user = OCP_USER_SDMA,
5305}; 4247};
5306 4248
5307static struct omap_hwmod_addr_space omap44xx_mcbsp3_addrs[] = {
5308 {
5309 .name = "mpu",
5310 .pa_start = 0x40126000,
5311 .pa_end = 0x401260ff,
5312 .flags = ADDR_TYPE_RT
5313 },
5314 { }
5315};
5316
5317/* l4_abe -> mcbsp3 */ 4249/* l4_abe -> mcbsp3 */
5318static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3 = { 4250static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3 = {
5319 .master = &omap44xx_l4_abe_hwmod, 4251 .master = &omap44xx_l4_abe_hwmod,
5320 .slave = &omap44xx_mcbsp3_hwmod, 4252 .slave = &omap44xx_mcbsp3_hwmod,
5321 .clk = "ocp_abe_iclk", 4253 .clk = "ocp_abe_iclk",
5322 .addr = omap44xx_mcbsp3_addrs,
5323 .user = OCP_USER_MPU, 4254 .user = OCP_USER_MPU,
5324}; 4255};
5325 4256
5326static struct omap_hwmod_addr_space omap44xx_mcbsp3_dma_addrs[] = {
5327 {
5328 .name = "dma",
5329 .pa_start = 0x49026000,
5330 .pa_end = 0x490260ff,
5331 .flags = ADDR_TYPE_RT
5332 },
5333 { }
5334};
5335
5336/* l4_abe -> mcbsp3 (dma) */ 4257/* l4_abe -> mcbsp3 (dma) */
5337static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3_dma = { 4258static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcbsp3_dma = {
5338 .master = &omap44xx_l4_abe_hwmod, 4259 .master = &omap44xx_l4_abe_hwmod,
5339 .slave = &omap44xx_mcbsp3_hwmod, 4260 .slave = &omap44xx_mcbsp3_hwmod,
5340 .clk = "ocp_abe_iclk", 4261 .clk = "ocp_abe_iclk",
5341 .addr = omap44xx_mcbsp3_dma_addrs,
5342 .user = OCP_USER_SDMA, 4262 .user = OCP_USER_SDMA,
5343}; 4263};
5344 4264
5345static struct omap_hwmod_addr_space omap44xx_mcbsp4_addrs[] = {
5346 {
5347 .pa_start = 0x48096000,
5348 .pa_end = 0x480960ff,
5349 .flags = ADDR_TYPE_RT
5350 },
5351 { }
5352};
5353
5354/* l4_per -> mcbsp4 */ 4265/* l4_per -> mcbsp4 */
5355static struct omap_hwmod_ocp_if omap44xx_l4_per__mcbsp4 = { 4266static struct omap_hwmod_ocp_if omap44xx_l4_per__mcbsp4 = {
5356 .master = &omap44xx_l4_per_hwmod, 4267 .master = &omap44xx_l4_per_hwmod,
5357 .slave = &omap44xx_mcbsp4_hwmod, 4268 .slave = &omap44xx_mcbsp4_hwmod,
5358 .clk = "l4_div_ck", 4269 .clk = "l4_div_ck",
5359 .addr = omap44xx_mcbsp4_addrs,
5360 .user = OCP_USER_MPU | OCP_USER_SDMA, 4270 .user = OCP_USER_MPU | OCP_USER_SDMA,
5361}; 4271};
5362 4272
5363static struct omap_hwmod_addr_space omap44xx_mcpdm_addrs[] = {
5364 {
5365 .name = "mpu",
5366 .pa_start = 0x40132000,
5367 .pa_end = 0x4013207f,
5368 .flags = ADDR_TYPE_RT
5369 },
5370 { }
5371};
5372
5373/* l4_abe -> mcpdm */ 4273/* l4_abe -> mcpdm */
5374static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm = { 4274static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm = {
5375 .master = &omap44xx_l4_abe_hwmod, 4275 .master = &omap44xx_l4_abe_hwmod,
5376 .slave = &omap44xx_mcpdm_hwmod, 4276 .slave = &omap44xx_mcpdm_hwmod,
5377 .clk = "ocp_abe_iclk", 4277 .clk = "ocp_abe_iclk",
5378 .addr = omap44xx_mcpdm_addrs,
5379 .user = OCP_USER_MPU, 4278 .user = OCP_USER_MPU,
5380}; 4279};
5381 4280
5382static struct omap_hwmod_addr_space omap44xx_mcpdm_dma_addrs[] = {
5383 {
5384 .name = "dma",
5385 .pa_start = 0x49032000,
5386 .pa_end = 0x4903207f,
5387 .flags = ADDR_TYPE_RT
5388 },
5389 { }
5390};
5391
5392/* l4_abe -> mcpdm (dma) */ 4281/* l4_abe -> mcpdm (dma) */
5393static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm_dma = { 4282static struct omap_hwmod_ocp_if omap44xx_l4_abe__mcpdm_dma = {
5394 .master = &omap44xx_l4_abe_hwmod, 4283 .master = &omap44xx_l4_abe_hwmod,
5395 .slave = &omap44xx_mcpdm_hwmod, 4284 .slave = &omap44xx_mcpdm_hwmod,
5396 .clk = "ocp_abe_iclk", 4285 .clk = "ocp_abe_iclk",
5397 .addr = omap44xx_mcpdm_dma_addrs,
5398 .user = OCP_USER_SDMA, 4286 .user = OCP_USER_SDMA,
5399}; 4287};
5400 4288
5401static struct omap_hwmod_addr_space omap44xx_mcspi1_addrs[] = {
5402 {
5403 .pa_start = 0x48098000,
5404 .pa_end = 0x480981ff,
5405 .flags = ADDR_TYPE_RT
5406 },
5407 { }
5408};
5409
5410/* l4_per -> mcspi1 */ 4289/* l4_per -> mcspi1 */
5411static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi1 = { 4290static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi1 = {
5412 .master = &omap44xx_l4_per_hwmod, 4291 .master = &omap44xx_l4_per_hwmod,
5413 .slave = &omap44xx_mcspi1_hwmod, 4292 .slave = &omap44xx_mcspi1_hwmod,
5414 .clk = "l4_div_ck", 4293 .clk = "l4_div_ck",
5415 .addr = omap44xx_mcspi1_addrs,
5416 .user = OCP_USER_MPU | OCP_USER_SDMA, 4294 .user = OCP_USER_MPU | OCP_USER_SDMA,
5417}; 4295};
5418 4296
5419static struct omap_hwmod_addr_space omap44xx_mcspi2_addrs[] = {
5420 {
5421 .pa_start = 0x4809a000,
5422 .pa_end = 0x4809a1ff,
5423 .flags = ADDR_TYPE_RT
5424 },
5425 { }
5426};
5427
5428/* l4_per -> mcspi2 */ 4297/* l4_per -> mcspi2 */
5429static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi2 = { 4298static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi2 = {
5430 .master = &omap44xx_l4_per_hwmod, 4299 .master = &omap44xx_l4_per_hwmod,
5431 .slave = &omap44xx_mcspi2_hwmod, 4300 .slave = &omap44xx_mcspi2_hwmod,
5432 .clk = "l4_div_ck", 4301 .clk = "l4_div_ck",
5433 .addr = omap44xx_mcspi2_addrs,
5434 .user = OCP_USER_MPU | OCP_USER_SDMA, 4302 .user = OCP_USER_MPU | OCP_USER_SDMA,
5435}; 4303};
5436 4304
5437static struct omap_hwmod_addr_space omap44xx_mcspi3_addrs[] = {
5438 {
5439 .pa_start = 0x480b8000,
5440 .pa_end = 0x480b81ff,
5441 .flags = ADDR_TYPE_RT
5442 },
5443 { }
5444};
5445
5446/* l4_per -> mcspi3 */ 4305/* l4_per -> mcspi3 */
5447static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi3 = { 4306static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi3 = {
5448 .master = &omap44xx_l4_per_hwmod, 4307 .master = &omap44xx_l4_per_hwmod,
5449 .slave = &omap44xx_mcspi3_hwmod, 4308 .slave = &omap44xx_mcspi3_hwmod,
5450 .clk = "l4_div_ck", 4309 .clk = "l4_div_ck",
5451 .addr = omap44xx_mcspi3_addrs,
5452 .user = OCP_USER_MPU | OCP_USER_SDMA, 4310 .user = OCP_USER_MPU | OCP_USER_SDMA,
5453}; 4311};
5454 4312
5455static struct omap_hwmod_addr_space omap44xx_mcspi4_addrs[] = {
5456 {
5457 .pa_start = 0x480ba000,
5458 .pa_end = 0x480ba1ff,
5459 .flags = ADDR_TYPE_RT
5460 },
5461 { }
5462};
5463
5464/* l4_per -> mcspi4 */ 4313/* l4_per -> mcspi4 */
5465static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi4 = { 4314static struct omap_hwmod_ocp_if omap44xx_l4_per__mcspi4 = {
5466 .master = &omap44xx_l4_per_hwmod, 4315 .master = &omap44xx_l4_per_hwmod,
5467 .slave = &omap44xx_mcspi4_hwmod, 4316 .slave = &omap44xx_mcspi4_hwmod,
5468 .clk = "l4_div_ck", 4317 .clk = "l4_div_ck",
5469 .addr = omap44xx_mcspi4_addrs,
5470 .user = OCP_USER_MPU | OCP_USER_SDMA, 4318 .user = OCP_USER_MPU | OCP_USER_SDMA,
5471}; 4319};
5472 4320
5473static struct omap_hwmod_addr_space omap44xx_mmc1_addrs[] = {
5474 {
5475 .pa_start = 0x4809c000,
5476 .pa_end = 0x4809c3ff,
5477 .flags = ADDR_TYPE_RT
5478 },
5479 { }
5480};
5481
5482/* l4_per -> mmc1 */ 4321/* l4_per -> mmc1 */
5483static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = { 4322static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc1 = {
5484 .master = &omap44xx_l4_per_hwmod, 4323 .master = &omap44xx_l4_per_hwmod,
5485 .slave = &omap44xx_mmc1_hwmod, 4324 .slave = &omap44xx_mmc1_hwmod,
5486 .clk = "l4_div_ck", 4325 .clk = "l4_div_ck",
5487 .addr = omap44xx_mmc1_addrs,
5488 .user = OCP_USER_MPU | OCP_USER_SDMA, 4326 .user = OCP_USER_MPU | OCP_USER_SDMA,
5489}; 4327};
5490 4328
5491static struct omap_hwmod_addr_space omap44xx_mmc2_addrs[] = {
5492 {
5493 .pa_start = 0x480b4000,
5494 .pa_end = 0x480b43ff,
5495 .flags = ADDR_TYPE_RT
5496 },
5497 { }
5498};
5499
5500/* l4_per -> mmc2 */ 4329/* l4_per -> mmc2 */
5501static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc2 = { 4330static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc2 = {
5502 .master = &omap44xx_l4_per_hwmod, 4331 .master = &omap44xx_l4_per_hwmod,
5503 .slave = &omap44xx_mmc2_hwmod, 4332 .slave = &omap44xx_mmc2_hwmod,
5504 .clk = "l4_div_ck", 4333 .clk = "l4_div_ck",
5505 .addr = omap44xx_mmc2_addrs,
5506 .user = OCP_USER_MPU | OCP_USER_SDMA, 4334 .user = OCP_USER_MPU | OCP_USER_SDMA,
5507}; 4335};
5508 4336
5509static struct omap_hwmod_addr_space omap44xx_mmc3_addrs[] = {
5510 {
5511 .pa_start = 0x480ad000,
5512 .pa_end = 0x480ad3ff,
5513 .flags = ADDR_TYPE_RT
5514 },
5515 { }
5516};
5517
5518/* l4_per -> mmc3 */ 4337/* l4_per -> mmc3 */
5519static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc3 = { 4338static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc3 = {
5520 .master = &omap44xx_l4_per_hwmod, 4339 .master = &omap44xx_l4_per_hwmod,
5521 .slave = &omap44xx_mmc3_hwmod, 4340 .slave = &omap44xx_mmc3_hwmod,
5522 .clk = "l4_div_ck", 4341 .clk = "l4_div_ck",
5523 .addr = omap44xx_mmc3_addrs,
5524 .user = OCP_USER_MPU | OCP_USER_SDMA, 4342 .user = OCP_USER_MPU | OCP_USER_SDMA,
5525}; 4343};
5526 4344
5527static struct omap_hwmod_addr_space omap44xx_mmc4_addrs[] = {
5528 {
5529 .pa_start = 0x480d1000,
5530 .pa_end = 0x480d13ff,
5531 .flags = ADDR_TYPE_RT
5532 },
5533 { }
5534};
5535
5536/* l4_per -> mmc4 */ 4345/* l4_per -> mmc4 */
5537static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc4 = { 4346static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc4 = {
5538 .master = &omap44xx_l4_per_hwmod, 4347 .master = &omap44xx_l4_per_hwmod,
5539 .slave = &omap44xx_mmc4_hwmod, 4348 .slave = &omap44xx_mmc4_hwmod,
5540 .clk = "l4_div_ck", 4349 .clk = "l4_div_ck",
5541 .addr = omap44xx_mmc4_addrs,
5542 .user = OCP_USER_MPU | OCP_USER_SDMA, 4350 .user = OCP_USER_MPU | OCP_USER_SDMA,
5543}; 4351};
5544 4352
5545static struct omap_hwmod_addr_space omap44xx_mmc5_addrs[] = {
5546 {
5547 .pa_start = 0x480d5000,
5548 .pa_end = 0x480d53ff,
5549 .flags = ADDR_TYPE_RT
5550 },
5551 { }
5552};
5553
5554/* l4_per -> mmc5 */ 4353/* l4_per -> mmc5 */
5555static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc5 = { 4354static struct omap_hwmod_ocp_if omap44xx_l4_per__mmc5 = {
5556 .master = &omap44xx_l4_per_hwmod, 4355 .master = &omap44xx_l4_per_hwmod,
5557 .slave = &omap44xx_mmc5_hwmod, 4356 .slave = &omap44xx_mmc5_hwmod,
5558 .clk = "l4_div_ck", 4357 .clk = "l4_div_ck",
5559 .addr = omap44xx_mmc5_addrs,
5560 .user = OCP_USER_MPU | OCP_USER_SDMA, 4358 .user = OCP_USER_MPU | OCP_USER_SDMA,
5561}; 4359};
5562 4360
@@ -5568,111 +4366,51 @@ static struct omap_hwmod_ocp_if omap44xx_l3_main_2__ocmc_ram = {
5568 .user = OCP_USER_MPU | OCP_USER_SDMA, 4366 .user = OCP_USER_MPU | OCP_USER_SDMA,
5569}; 4367};
5570 4368
5571static struct omap_hwmod_addr_space omap44xx_ocp2scp_usb_phy_addrs[] = {
5572 {
5573 .pa_start = 0x4a0ad000,
5574 .pa_end = 0x4a0ad01f,
5575 .flags = ADDR_TYPE_RT
5576 },
5577 { }
5578};
5579
5580/* l4_cfg -> ocp2scp_usb_phy */ 4369/* l4_cfg -> ocp2scp_usb_phy */
5581static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp2scp_usb_phy = { 4370static struct omap_hwmod_ocp_if omap44xx_l4_cfg__ocp2scp_usb_phy = {
5582 .master = &omap44xx_l4_cfg_hwmod, 4371 .master = &omap44xx_l4_cfg_hwmod,
5583 .slave = &omap44xx_ocp2scp_usb_phy_hwmod, 4372 .slave = &omap44xx_ocp2scp_usb_phy_hwmod,
5584 .clk = "l4_div_ck", 4373 .clk = "l4_div_ck",
5585 .addr = omap44xx_ocp2scp_usb_phy_addrs,
5586 .user = OCP_USER_MPU | OCP_USER_SDMA, 4374 .user = OCP_USER_MPU | OCP_USER_SDMA,
5587}; 4375};
5588 4376
5589static struct omap_hwmod_addr_space omap44xx_prcm_mpu_addrs[] = {
5590 {
5591 .pa_start = 0x48243000,
5592 .pa_end = 0x48243fff,
5593 .flags = ADDR_TYPE_RT
5594 },
5595 { }
5596};
5597
5598/* mpu_private -> prcm_mpu */ 4377/* mpu_private -> prcm_mpu */
5599static struct omap_hwmod_ocp_if omap44xx_mpu_private__prcm_mpu = { 4378static struct omap_hwmod_ocp_if omap44xx_mpu_private__prcm_mpu = {
5600 .master = &omap44xx_mpu_private_hwmod, 4379 .master = &omap44xx_mpu_private_hwmod,
5601 .slave = &omap44xx_prcm_mpu_hwmod, 4380 .slave = &omap44xx_prcm_mpu_hwmod,
5602 .clk = "l3_div_ck", 4381 .clk = "l3_div_ck",
5603 .addr = omap44xx_prcm_mpu_addrs,
5604 .user = OCP_USER_MPU | OCP_USER_SDMA, 4382 .user = OCP_USER_MPU | OCP_USER_SDMA,
5605}; 4383};
5606 4384
5607static struct omap_hwmod_addr_space omap44xx_cm_core_aon_addrs[] = {
5608 {
5609 .pa_start = 0x4a004000,
5610 .pa_end = 0x4a004fff,
5611 .flags = ADDR_TYPE_RT
5612 },
5613 { }
5614};
5615
5616/* l4_wkup -> cm_core_aon */ 4385/* l4_wkup -> cm_core_aon */
5617static struct omap_hwmod_ocp_if omap44xx_l4_wkup__cm_core_aon = { 4386static struct omap_hwmod_ocp_if omap44xx_l4_wkup__cm_core_aon = {
5618 .master = &omap44xx_l4_wkup_hwmod, 4387 .master = &omap44xx_l4_wkup_hwmod,
5619 .slave = &omap44xx_cm_core_aon_hwmod, 4388 .slave = &omap44xx_cm_core_aon_hwmod,
5620 .clk = "l4_wkup_clk_mux_ck", 4389 .clk = "l4_wkup_clk_mux_ck",
5621 .addr = omap44xx_cm_core_aon_addrs,
5622 .user = OCP_USER_MPU | OCP_USER_SDMA, 4390 .user = OCP_USER_MPU | OCP_USER_SDMA,
5623}; 4391};
5624 4392
5625static struct omap_hwmod_addr_space omap44xx_cm_core_addrs[] = {
5626 {
5627 .pa_start = 0x4a008000,
5628 .pa_end = 0x4a009fff,
5629 .flags = ADDR_TYPE_RT
5630 },
5631 { }
5632};
5633
5634/* l4_cfg -> cm_core */ 4393/* l4_cfg -> cm_core */
5635static struct omap_hwmod_ocp_if omap44xx_l4_cfg__cm_core = { 4394static struct omap_hwmod_ocp_if omap44xx_l4_cfg__cm_core = {
5636 .master = &omap44xx_l4_cfg_hwmod, 4395 .master = &omap44xx_l4_cfg_hwmod,
5637 .slave = &omap44xx_cm_core_hwmod, 4396 .slave = &omap44xx_cm_core_hwmod,
5638 .clk = "l4_div_ck", 4397 .clk = "l4_div_ck",
5639 .addr = omap44xx_cm_core_addrs,
5640 .user = OCP_USER_MPU | OCP_USER_SDMA, 4398 .user = OCP_USER_MPU | OCP_USER_SDMA,
5641}; 4399};
5642 4400
5643static struct omap_hwmod_addr_space omap44xx_prm_addrs[] = {
5644 {
5645 .pa_start = 0x4a306000,
5646 .pa_end = 0x4a307fff,
5647 .flags = ADDR_TYPE_RT
5648 },
5649 { }
5650};
5651
5652/* l4_wkup -> prm */ 4401/* l4_wkup -> prm */
5653static struct omap_hwmod_ocp_if omap44xx_l4_wkup__prm = { 4402static struct omap_hwmod_ocp_if omap44xx_l4_wkup__prm = {
5654 .master = &omap44xx_l4_wkup_hwmod, 4403 .master = &omap44xx_l4_wkup_hwmod,
5655 .slave = &omap44xx_prm_hwmod, 4404 .slave = &omap44xx_prm_hwmod,
5656 .clk = "l4_wkup_clk_mux_ck", 4405 .clk = "l4_wkup_clk_mux_ck",
5657 .addr = omap44xx_prm_addrs,
5658 .user = OCP_USER_MPU | OCP_USER_SDMA, 4406 .user = OCP_USER_MPU | OCP_USER_SDMA,
5659}; 4407};
5660 4408
5661static struct omap_hwmod_addr_space omap44xx_scrm_addrs[] = {
5662 {
5663 .pa_start = 0x4a30a000,
5664 .pa_end = 0x4a30a7ff,
5665 .flags = ADDR_TYPE_RT
5666 },
5667 { }
5668};
5669
5670/* l4_wkup -> scrm */ 4409/* l4_wkup -> scrm */
5671static struct omap_hwmod_ocp_if omap44xx_l4_wkup__scrm = { 4410static struct omap_hwmod_ocp_if omap44xx_l4_wkup__scrm = {
5672 .master = &omap44xx_l4_wkup_hwmod, 4411 .master = &omap44xx_l4_wkup_hwmod,
5673 .slave = &omap44xx_scrm_hwmod, 4412 .slave = &omap44xx_scrm_hwmod,
5674 .clk = "l4_wkup_clk_mux_ck", 4413 .clk = "l4_wkup_clk_mux_ck",
5675 .addr = omap44xx_scrm_addrs,
5676 .user = OCP_USER_MPU | OCP_USER_SDMA, 4414 .user = OCP_USER_MPU | OCP_USER_SDMA,
5677}; 4415};
5678 4416
@@ -5810,447 +4548,195 @@ static struct omap_hwmod_ocp_if omap44xx_l4_cfg__spinlock = {
5810 .user = OCP_USER_MPU | OCP_USER_SDMA, 4548 .user = OCP_USER_MPU | OCP_USER_SDMA,
5811}; 4549};
5812 4550
5813static struct omap_hwmod_addr_space omap44xx_timer1_addrs[] = {
5814 {
5815 .pa_start = 0x4a318000,
5816 .pa_end = 0x4a31807f,
5817 .flags = ADDR_TYPE_RT
5818 },
5819 { }
5820};
5821
5822/* l4_wkup -> timer1 */ 4551/* l4_wkup -> timer1 */
5823static struct omap_hwmod_ocp_if omap44xx_l4_wkup__timer1 = { 4552static struct omap_hwmod_ocp_if omap44xx_l4_wkup__timer1 = {
5824 .master = &omap44xx_l4_wkup_hwmod, 4553 .master = &omap44xx_l4_wkup_hwmod,
5825 .slave = &omap44xx_timer1_hwmod, 4554 .slave = &omap44xx_timer1_hwmod,
5826 .clk = "l4_wkup_clk_mux_ck", 4555 .clk = "l4_wkup_clk_mux_ck",
5827 .addr = omap44xx_timer1_addrs,
5828 .user = OCP_USER_MPU | OCP_USER_SDMA, 4556 .user = OCP_USER_MPU | OCP_USER_SDMA,
5829}; 4557};
5830 4558
5831static struct omap_hwmod_addr_space omap44xx_timer2_addrs[] = {
5832 {
5833 .pa_start = 0x48032000,
5834 .pa_end = 0x4803207f,
5835 .flags = ADDR_TYPE_RT
5836 },
5837 { }
5838};
5839
5840/* l4_per -> timer2 */ 4559/* l4_per -> timer2 */
5841static struct omap_hwmod_ocp_if omap44xx_l4_per__timer2 = { 4560static struct omap_hwmod_ocp_if omap44xx_l4_per__timer2 = {
5842 .master = &omap44xx_l4_per_hwmod, 4561 .master = &omap44xx_l4_per_hwmod,
5843 .slave = &omap44xx_timer2_hwmod, 4562 .slave = &omap44xx_timer2_hwmod,
5844 .clk = "l4_div_ck", 4563 .clk = "l4_div_ck",
5845 .addr = omap44xx_timer2_addrs,
5846 .user = OCP_USER_MPU | OCP_USER_SDMA, 4564 .user = OCP_USER_MPU | OCP_USER_SDMA,
5847}; 4565};
5848 4566
5849static struct omap_hwmod_addr_space omap44xx_timer3_addrs[] = {
5850 {
5851 .pa_start = 0x48034000,
5852 .pa_end = 0x4803407f,
5853 .flags = ADDR_TYPE_RT
5854 },
5855 { }
5856};
5857
5858/* l4_per -> timer3 */ 4567/* l4_per -> timer3 */
5859static struct omap_hwmod_ocp_if omap44xx_l4_per__timer3 = { 4568static struct omap_hwmod_ocp_if omap44xx_l4_per__timer3 = {
5860 .master = &omap44xx_l4_per_hwmod, 4569 .master = &omap44xx_l4_per_hwmod,
5861 .slave = &omap44xx_timer3_hwmod, 4570 .slave = &omap44xx_timer3_hwmod,
5862 .clk = "l4_div_ck", 4571 .clk = "l4_div_ck",
5863 .addr = omap44xx_timer3_addrs,
5864 .user = OCP_USER_MPU | OCP_USER_SDMA, 4572 .user = OCP_USER_MPU | OCP_USER_SDMA,
5865}; 4573};
5866 4574
5867static struct omap_hwmod_addr_space omap44xx_timer4_addrs[] = {
5868 {
5869 .pa_start = 0x48036000,
5870 .pa_end = 0x4803607f,
5871 .flags = ADDR_TYPE_RT
5872 },
5873 { }
5874};
5875
5876/* l4_per -> timer4 */ 4575/* l4_per -> timer4 */
5877static struct omap_hwmod_ocp_if omap44xx_l4_per__timer4 = { 4576static struct omap_hwmod_ocp_if omap44xx_l4_per__timer4 = {
5878 .master = &omap44xx_l4_per_hwmod, 4577 .master = &omap44xx_l4_per_hwmod,
5879 .slave = &omap44xx_timer4_hwmod, 4578 .slave = &omap44xx_timer4_hwmod,
5880 .clk = "l4_div_ck", 4579 .clk = "l4_div_ck",
5881 .addr = omap44xx_timer4_addrs,
5882 .user = OCP_USER_MPU | OCP_USER_SDMA, 4580 .user = OCP_USER_MPU | OCP_USER_SDMA,
5883}; 4581};
5884 4582
5885static struct omap_hwmod_addr_space omap44xx_timer5_addrs[] = {
5886 {
5887 .pa_start = 0x40138000,
5888 .pa_end = 0x4013807f,
5889 .flags = ADDR_TYPE_RT
5890 },
5891 { }
5892};
5893
5894/* l4_abe -> timer5 */ 4583/* l4_abe -> timer5 */
5895static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5 = { 4584static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5 = {
5896 .master = &omap44xx_l4_abe_hwmod, 4585 .master = &omap44xx_l4_abe_hwmod,
5897 .slave = &omap44xx_timer5_hwmod, 4586 .slave = &omap44xx_timer5_hwmod,
5898 .clk = "ocp_abe_iclk", 4587 .clk = "ocp_abe_iclk",
5899 .addr = omap44xx_timer5_addrs,
5900 .user = OCP_USER_MPU, 4588 .user = OCP_USER_MPU,
5901}; 4589};
5902 4590
5903static struct omap_hwmod_addr_space omap44xx_timer5_dma_addrs[] = {
5904 {
5905 .pa_start = 0x49038000,
5906 .pa_end = 0x4903807f,
5907 .flags = ADDR_TYPE_RT
5908 },
5909 { }
5910};
5911
5912/* l4_abe -> timer5 (dma) */ 4591/* l4_abe -> timer5 (dma) */
5913static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5_dma = { 4592static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer5_dma = {
5914 .master = &omap44xx_l4_abe_hwmod, 4593 .master = &omap44xx_l4_abe_hwmod,
5915 .slave = &omap44xx_timer5_hwmod, 4594 .slave = &omap44xx_timer5_hwmod,
5916 .clk = "ocp_abe_iclk", 4595 .clk = "ocp_abe_iclk",
5917 .addr = omap44xx_timer5_dma_addrs,
5918 .user = OCP_USER_SDMA, 4596 .user = OCP_USER_SDMA,
5919}; 4597};
5920 4598
5921static struct omap_hwmod_addr_space omap44xx_timer6_addrs[] = {
5922 {
5923 .pa_start = 0x4013a000,
5924 .pa_end = 0x4013a07f,
5925 .flags = ADDR_TYPE_RT
5926 },
5927 { }
5928};
5929
5930/* l4_abe -> timer6 */ 4599/* l4_abe -> timer6 */
5931static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6 = { 4600static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6 = {
5932 .master = &omap44xx_l4_abe_hwmod, 4601 .master = &omap44xx_l4_abe_hwmod,
5933 .slave = &omap44xx_timer6_hwmod, 4602 .slave = &omap44xx_timer6_hwmod,
5934 .clk = "ocp_abe_iclk", 4603 .clk = "ocp_abe_iclk",
5935 .addr = omap44xx_timer6_addrs,
5936 .user = OCP_USER_MPU, 4604 .user = OCP_USER_MPU,
5937}; 4605};
5938 4606
5939static struct omap_hwmod_addr_space omap44xx_timer6_dma_addrs[] = {
5940 {
5941 .pa_start = 0x4903a000,
5942 .pa_end = 0x4903a07f,
5943 .flags = ADDR_TYPE_RT
5944 },
5945 { }
5946};
5947
5948/* l4_abe -> timer6 (dma) */ 4607/* l4_abe -> timer6 (dma) */
5949static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6_dma = { 4608static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer6_dma = {
5950 .master = &omap44xx_l4_abe_hwmod, 4609 .master = &omap44xx_l4_abe_hwmod,
5951 .slave = &omap44xx_timer6_hwmod, 4610 .slave = &omap44xx_timer6_hwmod,
5952 .clk = "ocp_abe_iclk", 4611 .clk = "ocp_abe_iclk",
5953 .addr = omap44xx_timer6_dma_addrs,
5954 .user = OCP_USER_SDMA, 4612 .user = OCP_USER_SDMA,
5955}; 4613};
5956 4614
5957static struct omap_hwmod_addr_space omap44xx_timer7_addrs[] = {
5958 {
5959 .pa_start = 0x4013c000,
5960 .pa_end = 0x4013c07f,
5961 .flags = ADDR_TYPE_RT
5962 },
5963 { }
5964};
5965
5966/* l4_abe -> timer7 */ 4615/* l4_abe -> timer7 */
5967static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7 = { 4616static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7 = {
5968 .master = &omap44xx_l4_abe_hwmod, 4617 .master = &omap44xx_l4_abe_hwmod,
5969 .slave = &omap44xx_timer7_hwmod, 4618 .slave = &omap44xx_timer7_hwmod,
5970 .clk = "ocp_abe_iclk", 4619 .clk = "ocp_abe_iclk",
5971 .addr = omap44xx_timer7_addrs,
5972 .user = OCP_USER_MPU, 4620 .user = OCP_USER_MPU,
5973}; 4621};
5974 4622
5975static struct omap_hwmod_addr_space omap44xx_timer7_dma_addrs[] = {
5976 {
5977 .pa_start = 0x4903c000,
5978 .pa_end = 0x4903c07f,
5979 .flags = ADDR_TYPE_RT
5980 },
5981 { }
5982};
5983
5984/* l4_abe -> timer7 (dma) */ 4623/* l4_abe -> timer7 (dma) */
5985static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7_dma = { 4624static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer7_dma = {
5986 .master = &omap44xx_l4_abe_hwmod, 4625 .master = &omap44xx_l4_abe_hwmod,
5987 .slave = &omap44xx_timer7_hwmod, 4626 .slave = &omap44xx_timer7_hwmod,
5988 .clk = "ocp_abe_iclk", 4627 .clk = "ocp_abe_iclk",
5989 .addr = omap44xx_timer7_dma_addrs,
5990 .user = OCP_USER_SDMA, 4628 .user = OCP_USER_SDMA,
5991}; 4629};
5992 4630
5993static struct omap_hwmod_addr_space omap44xx_timer8_addrs[] = {
5994 {
5995 .pa_start = 0x4013e000,
5996 .pa_end = 0x4013e07f,
5997 .flags = ADDR_TYPE_RT
5998 },
5999 { }
6000};
6001
6002/* l4_abe -> timer8 */ 4631/* l4_abe -> timer8 */
6003static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8 = { 4632static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8 = {
6004 .master = &omap44xx_l4_abe_hwmod, 4633 .master = &omap44xx_l4_abe_hwmod,
6005 .slave = &omap44xx_timer8_hwmod, 4634 .slave = &omap44xx_timer8_hwmod,
6006 .clk = "ocp_abe_iclk", 4635 .clk = "ocp_abe_iclk",
6007 .addr = omap44xx_timer8_addrs,
6008 .user = OCP_USER_MPU, 4636 .user = OCP_USER_MPU,
6009}; 4637};
6010 4638
6011static struct omap_hwmod_addr_space omap44xx_timer8_dma_addrs[] = {
6012 {
6013 .pa_start = 0x4903e000,
6014 .pa_end = 0x4903e07f,
6015 .flags = ADDR_TYPE_RT
6016 },
6017 { }
6018};
6019
6020/* l4_abe -> timer8 (dma) */ 4639/* l4_abe -> timer8 (dma) */
6021static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8_dma = { 4640static struct omap_hwmod_ocp_if omap44xx_l4_abe__timer8_dma = {
6022 .master = &omap44xx_l4_abe_hwmod, 4641 .master = &omap44xx_l4_abe_hwmod,
6023 .slave = &omap44xx_timer8_hwmod, 4642 .slave = &omap44xx_timer8_hwmod,
6024 .clk = "ocp_abe_iclk", 4643 .clk = "ocp_abe_iclk",
6025 .addr = omap44xx_timer8_dma_addrs,
6026 .user = OCP_USER_SDMA, 4644 .user = OCP_USER_SDMA,
6027}; 4645};
6028 4646
6029static struct omap_hwmod_addr_space omap44xx_timer9_addrs[] = {
6030 {
6031 .pa_start = 0x4803e000,
6032 .pa_end = 0x4803e07f,
6033 .flags = ADDR_TYPE_RT
6034 },
6035 { }
6036};
6037
6038/* l4_per -> timer9 */ 4647/* l4_per -> timer9 */
6039static struct omap_hwmod_ocp_if omap44xx_l4_per__timer9 = { 4648static struct omap_hwmod_ocp_if omap44xx_l4_per__timer9 = {
6040 .master = &omap44xx_l4_per_hwmod, 4649 .master = &omap44xx_l4_per_hwmod,
6041 .slave = &omap44xx_timer9_hwmod, 4650 .slave = &omap44xx_timer9_hwmod,
6042 .clk = "l4_div_ck", 4651 .clk = "l4_div_ck",
6043 .addr = omap44xx_timer9_addrs,
6044 .user = OCP_USER_MPU | OCP_USER_SDMA, 4652 .user = OCP_USER_MPU | OCP_USER_SDMA,
6045}; 4653};
6046 4654
6047static struct omap_hwmod_addr_space omap44xx_timer10_addrs[] = {
6048 {
6049 .pa_start = 0x48086000,
6050 .pa_end = 0x4808607f,
6051 .flags = ADDR_TYPE_RT
6052 },
6053 { }
6054};
6055
6056/* l4_per -> timer10 */ 4655/* l4_per -> timer10 */
6057static struct omap_hwmod_ocp_if omap44xx_l4_per__timer10 = { 4656static struct omap_hwmod_ocp_if omap44xx_l4_per__timer10 = {
6058 .master = &omap44xx_l4_per_hwmod, 4657 .master = &omap44xx_l4_per_hwmod,
6059 .slave = &omap44xx_timer10_hwmod, 4658 .slave = &omap44xx_timer10_hwmod,
6060 .clk = "l4_div_ck", 4659 .clk = "l4_div_ck",
6061 .addr = omap44xx_timer10_addrs,
6062 .user = OCP_USER_MPU | OCP_USER_SDMA, 4660 .user = OCP_USER_MPU | OCP_USER_SDMA,
6063}; 4661};
6064 4662
6065static struct omap_hwmod_addr_space omap44xx_timer11_addrs[] = {
6066 {
6067 .pa_start = 0x48088000,
6068 .pa_end = 0x4808807f,
6069 .flags = ADDR_TYPE_RT
6070 },
6071 { }
6072};
6073
6074/* l4_per -> timer11 */ 4663/* l4_per -> timer11 */
6075static struct omap_hwmod_ocp_if omap44xx_l4_per__timer11 = { 4664static struct omap_hwmod_ocp_if omap44xx_l4_per__timer11 = {
6076 .master = &omap44xx_l4_per_hwmod, 4665 .master = &omap44xx_l4_per_hwmod,
6077 .slave = &omap44xx_timer11_hwmod, 4666 .slave = &omap44xx_timer11_hwmod,
6078 .clk = "l4_div_ck", 4667 .clk = "l4_div_ck",
6079 .addr = omap44xx_timer11_addrs,
6080 .user = OCP_USER_MPU | OCP_USER_SDMA, 4668 .user = OCP_USER_MPU | OCP_USER_SDMA,
6081}; 4669};
6082 4670
6083static struct omap_hwmod_addr_space omap44xx_uart1_addrs[] = {
6084 {
6085 .pa_start = 0x4806a000,
6086 .pa_end = 0x4806a0ff,
6087 .flags = ADDR_TYPE_RT
6088 },
6089 { }
6090};
6091
6092/* l4_per -> uart1 */ 4671/* l4_per -> uart1 */
6093static struct omap_hwmod_ocp_if omap44xx_l4_per__uart1 = { 4672static struct omap_hwmod_ocp_if omap44xx_l4_per__uart1 = {
6094 .master = &omap44xx_l4_per_hwmod, 4673 .master = &omap44xx_l4_per_hwmod,
6095 .slave = &omap44xx_uart1_hwmod, 4674 .slave = &omap44xx_uart1_hwmod,
6096 .clk = "l4_div_ck", 4675 .clk = "l4_div_ck",
6097 .addr = omap44xx_uart1_addrs,
6098 .user = OCP_USER_MPU | OCP_USER_SDMA, 4676 .user = OCP_USER_MPU | OCP_USER_SDMA,
6099}; 4677};
6100 4678
6101static struct omap_hwmod_addr_space omap44xx_uart2_addrs[] = {
6102 {
6103 .pa_start = 0x4806c000,
6104 .pa_end = 0x4806c0ff,
6105 .flags = ADDR_TYPE_RT
6106 },
6107 { }
6108};
6109
6110/* l4_per -> uart2 */ 4679/* l4_per -> uart2 */
6111static struct omap_hwmod_ocp_if omap44xx_l4_per__uart2 = { 4680static struct omap_hwmod_ocp_if omap44xx_l4_per__uart2 = {
6112 .master = &omap44xx_l4_per_hwmod, 4681 .master = &omap44xx_l4_per_hwmod,
6113 .slave = &omap44xx_uart2_hwmod, 4682 .slave = &omap44xx_uart2_hwmod,
6114 .clk = "l4_div_ck", 4683 .clk = "l4_div_ck",
6115 .addr = omap44xx_uart2_addrs,
6116 .user = OCP_USER_MPU | OCP_USER_SDMA, 4684 .user = OCP_USER_MPU | OCP_USER_SDMA,
6117}; 4685};
6118 4686
6119static struct omap_hwmod_addr_space omap44xx_uart3_addrs[] = {
6120 {
6121 .pa_start = 0x48020000,
6122 .pa_end = 0x480200ff,
6123 .flags = ADDR_TYPE_RT
6124 },
6125 { }
6126};
6127
6128/* l4_per -> uart3 */ 4687/* l4_per -> uart3 */
6129static struct omap_hwmod_ocp_if omap44xx_l4_per__uart3 = { 4688static struct omap_hwmod_ocp_if omap44xx_l4_per__uart3 = {
6130 .master = &omap44xx_l4_per_hwmod, 4689 .master = &omap44xx_l4_per_hwmod,
6131 .slave = &omap44xx_uart3_hwmod, 4690 .slave = &omap44xx_uart3_hwmod,
6132 .clk = "l4_div_ck", 4691 .clk = "l4_div_ck",
6133 .addr = omap44xx_uart3_addrs,
6134 .user = OCP_USER_MPU | OCP_USER_SDMA, 4692 .user = OCP_USER_MPU | OCP_USER_SDMA,
6135}; 4693};
6136 4694
6137static struct omap_hwmod_addr_space omap44xx_uart4_addrs[] = {
6138 {
6139 .pa_start = 0x4806e000,
6140 .pa_end = 0x4806e0ff,
6141 .flags = ADDR_TYPE_RT
6142 },
6143 { }
6144};
6145
6146/* l4_per -> uart4 */ 4695/* l4_per -> uart4 */
6147static struct omap_hwmod_ocp_if omap44xx_l4_per__uart4 = { 4696static struct omap_hwmod_ocp_if omap44xx_l4_per__uart4 = {
6148 .master = &omap44xx_l4_per_hwmod, 4697 .master = &omap44xx_l4_per_hwmod,
6149 .slave = &omap44xx_uart4_hwmod, 4698 .slave = &omap44xx_uart4_hwmod,
6150 .clk = "l4_div_ck", 4699 .clk = "l4_div_ck",
6151 .addr = omap44xx_uart4_addrs,
6152 .user = OCP_USER_MPU | OCP_USER_SDMA, 4700 .user = OCP_USER_MPU | OCP_USER_SDMA,
6153}; 4701};
6154 4702
6155static struct omap_hwmod_addr_space omap44xx_usb_host_fs_addrs[] = {
6156 {
6157 .pa_start = 0x4a0a9000,
6158 .pa_end = 0x4a0a93ff,
6159 .flags = ADDR_TYPE_RT
6160 },
6161 { }
6162};
6163
6164/* l4_cfg -> usb_host_fs */ 4703/* l4_cfg -> usb_host_fs */
6165static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_cfg__usb_host_fs = { 4704static struct omap_hwmod_ocp_if __maybe_unused omap44xx_l4_cfg__usb_host_fs = {
6166 .master = &omap44xx_l4_cfg_hwmod, 4705 .master = &omap44xx_l4_cfg_hwmod,
6167 .slave = &omap44xx_usb_host_fs_hwmod, 4706 .slave = &omap44xx_usb_host_fs_hwmod,
6168 .clk = "l4_div_ck", 4707 .clk = "l4_div_ck",
6169 .addr = omap44xx_usb_host_fs_addrs,
6170 .user = OCP_USER_MPU | OCP_USER_SDMA, 4708 .user = OCP_USER_MPU | OCP_USER_SDMA,
6171}; 4709};
6172 4710
6173static struct omap_hwmod_addr_space omap44xx_usb_host_hs_addrs[] = {
6174 {
6175 .name = "uhh",
6176 .pa_start = 0x4a064000,
6177 .pa_end = 0x4a0647ff,
6178 .flags = ADDR_TYPE_RT
6179 },
6180 {
6181 .name = "ohci",
6182 .pa_start = 0x4a064800,
6183 .pa_end = 0x4a064bff,
6184 },
6185 {
6186 .name = "ehci",
6187 .pa_start = 0x4a064c00,
6188 .pa_end = 0x4a064fff,
6189 },
6190 {}
6191};
6192
6193/* l4_cfg -> usb_host_hs */ 4711/* l4_cfg -> usb_host_hs */
6194static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = { 4712static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_host_hs = {
6195 .master = &omap44xx_l4_cfg_hwmod, 4713 .master = &omap44xx_l4_cfg_hwmod,
6196 .slave = &omap44xx_usb_host_hs_hwmod, 4714 .slave = &omap44xx_usb_host_hs_hwmod,
6197 .clk = "l4_div_ck", 4715 .clk = "l4_div_ck",
6198 .addr = omap44xx_usb_host_hs_addrs,
6199 .user = OCP_USER_MPU | OCP_USER_SDMA, 4716 .user = OCP_USER_MPU | OCP_USER_SDMA,
6200}; 4717};
6201 4718
6202static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
6203 {
6204 .pa_start = 0x4a0ab000,
6205 .pa_end = 0x4a0ab7ff,
6206 .flags = ADDR_TYPE_RT
6207 },
6208 { }
6209};
6210
6211/* l4_cfg -> usb_otg_hs */ 4719/* l4_cfg -> usb_otg_hs */
6212static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_otg_hs = { 4720static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_otg_hs = {
6213 .master = &omap44xx_l4_cfg_hwmod, 4721 .master = &omap44xx_l4_cfg_hwmod,
6214 .slave = &omap44xx_usb_otg_hs_hwmod, 4722 .slave = &omap44xx_usb_otg_hs_hwmod,
6215 .clk = "l4_div_ck", 4723 .clk = "l4_div_ck",
6216 .addr = omap44xx_usb_otg_hs_addrs,
6217 .user = OCP_USER_MPU | OCP_USER_SDMA, 4724 .user = OCP_USER_MPU | OCP_USER_SDMA,
6218}; 4725};
6219 4726
6220static struct omap_hwmod_addr_space omap44xx_usb_tll_hs_addrs[] = {
6221 {
6222 .name = "tll",
6223 .pa_start = 0x4a062000,
6224 .pa_end = 0x4a063fff,
6225 .flags = ADDR_TYPE_RT
6226 },
6227 {}
6228};
6229
6230/* l4_cfg -> usb_tll_hs */ 4727/* l4_cfg -> usb_tll_hs */
6231static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = { 4728static struct omap_hwmod_ocp_if omap44xx_l4_cfg__usb_tll_hs = {
6232 .master = &omap44xx_l4_cfg_hwmod, 4729 .master = &omap44xx_l4_cfg_hwmod,
6233 .slave = &omap44xx_usb_tll_hs_hwmod, 4730 .slave = &omap44xx_usb_tll_hs_hwmod,
6234 .clk = "l4_div_ck", 4731 .clk = "l4_div_ck",
6235 .addr = omap44xx_usb_tll_hs_addrs,
6236 .user = OCP_USER_MPU | OCP_USER_SDMA, 4732 .user = OCP_USER_MPU | OCP_USER_SDMA,
6237}; 4733};
6238 4734
6239static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = {
6240 {
6241 .pa_start = 0x4a314000,
6242 .pa_end = 0x4a31407f,
6243 .flags = ADDR_TYPE_RT
6244 },
6245 { }
6246};
6247
6248/* l4_wkup -> wd_timer2 */ 4735/* l4_wkup -> wd_timer2 */
6249static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = { 4736static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = {
6250 .master = &omap44xx_l4_wkup_hwmod, 4737 .master = &omap44xx_l4_wkup_hwmod,
6251 .slave = &omap44xx_wd_timer2_hwmod, 4738 .slave = &omap44xx_wd_timer2_hwmod,
6252 .clk = "l4_wkup_clk_mux_ck", 4739 .clk = "l4_wkup_clk_mux_ck",
6253 .addr = omap44xx_wd_timer2_addrs,
6254 .user = OCP_USER_MPU | OCP_USER_SDMA, 4740 .user = OCP_USER_MPU | OCP_USER_SDMA,
6255}; 4741};
6256 4742
@@ -6290,14 +4776,25 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3_dma = {
6290 .user = OCP_USER_SDMA, 4776 .user = OCP_USER_SDMA,
6291}; 4777};
6292 4778
4779/* mpu -> emif1 */
4780static struct omap_hwmod_ocp_if omap44xx_mpu__emif1 = {
4781 .master = &omap44xx_mpu_hwmod,
4782 .slave = &omap44xx_emif1_hwmod,
4783 .clk = "l3_div_ck",
4784 .user = OCP_USER_MPU | OCP_USER_SDMA,
4785};
4786
4787/* mpu -> emif2 */
4788static struct omap_hwmod_ocp_if omap44xx_mpu__emif2 = {
4789 .master = &omap44xx_mpu_hwmod,
4790 .slave = &omap44xx_emif2_hwmod,
4791 .clk = "l3_div_ck",
4792 .user = OCP_USER_MPU | OCP_USER_SDMA,
4793};
4794
6293static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = { 4795static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6294 &omap44xx_c2c__c2c_target_fw,
6295 &omap44xx_l4_cfg__c2c_target_fw,
6296 &omap44xx_l3_main_1__dmm, 4796 &omap44xx_l3_main_1__dmm,
6297 &omap44xx_mpu__dmm, 4797 &omap44xx_mpu__dmm,
6298 &omap44xx_c2c__emif_fw,
6299 &omap44xx_dmm__emif_fw,
6300 &omap44xx_l4_cfg__emif_fw,
6301 &omap44xx_iva__l3_instr, 4798 &omap44xx_iva__l3_instr,
6302 &omap44xx_l3_main_3__l3_instr, 4799 &omap44xx_l3_main_3__l3_instr,
6303 &omap44xx_ocp_wp_noc__l3_instr, 4800 &omap44xx_ocp_wp_noc__l3_instr,
@@ -6308,7 +4805,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6308 &omap44xx_mmc1__l3_main_1, 4805 &omap44xx_mmc1__l3_main_1,
6309 &omap44xx_mmc2__l3_main_1, 4806 &omap44xx_mmc2__l3_main_1,
6310 &omap44xx_mpu__l3_main_1, 4807 &omap44xx_mpu__l3_main_1,
6311 &omap44xx_c2c_target_fw__l3_main_2,
6312 &omap44xx_debugss__l3_main_2, 4808 &omap44xx_debugss__l3_main_2,
6313 &omap44xx_dma_system__l3_main_2, 4809 &omap44xx_dma_system__l3_main_2,
6314 &omap44xx_fdif__l3_main_2, 4810 &omap44xx_fdif__l3_main_2,
@@ -6364,8 +4860,6 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6364 &omap44xx_l3_main_2__dss_venc, 4860 &omap44xx_l3_main_2__dss_venc,
6365 &omap44xx_l4_per__dss_venc, 4861 &omap44xx_l4_per__dss_venc,
6366 &omap44xx_l4_per__elm, 4862 &omap44xx_l4_per__elm,
6367 &omap44xx_emif_fw__emif1,
6368 &omap44xx_emif_fw__emif2,
6369 &omap44xx_l4_cfg__fdif, 4863 &omap44xx_l4_cfg__fdif,
6370 &omap44xx_l4_wkup__gpio1, 4864 &omap44xx_l4_wkup__gpio1,
6371 &omap44xx_l4_per__gpio2, 4865 &omap44xx_l4_per__gpio2,
@@ -6450,6 +4944,8 @@ static struct omap_hwmod_ocp_if *omap44xx_hwmod_ocp_ifs[] __initdata = {
6450 &omap44xx_l4_wkup__wd_timer2, 4944 &omap44xx_l4_wkup__wd_timer2,
6451 &omap44xx_l4_abe__wd_timer3, 4945 &omap44xx_l4_abe__wd_timer3,
6452 &omap44xx_l4_abe__wd_timer3_dma, 4946 &omap44xx_l4_abe__wd_timer3_dma,
4947 &omap44xx_mpu__emif1,
4948 &omap44xx_mpu__emif2,
6453 NULL, 4949 NULL,
6454}; 4950};
6455 4951
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
new file mode 100644
index 000000000000..f37ae96b70a1
--- /dev/null
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -0,0 +1,2150 @@
1/*
2 * Hardware modules present on the OMAP54xx chips
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley
7 * Benoit Cousson
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#include <linux/io.h>
21#include <linux/platform_data/gpio-omap.h>
22#include <linux/power/smartreflex.h>
23#include <linux/i2c-omap.h>
24
25#include <linux/omap-dma.h>
26#include <linux/platform_data/spi-omap2-mcspi.h>
27#include <linux/platform_data/asoc-ti-mcbsp.h>
28#include <plat/dmtimer.h>
29
30#include "omap_hwmod.h"
31#include "omap_hwmod_common_data.h"
32#include "cm1_54xx.h"
33#include "cm2_54xx.h"
34#include "prm54xx.h"
35#include "prm-regbits-54xx.h"
36#include "i2c.h"
37#include "mmc.h"
38#include "wd_timer.h"
39
40/* Base offset for all OMAP5 interrupts external to MPUSS */
41#define OMAP54XX_IRQ_GIC_START 32
42
43/* Base offset for all OMAP5 dma requests */
44#define OMAP54XX_DMA_REQ_START 1
45
46
47/*
48 * IP blocks
49 */
50
51/*
52 * 'dmm' class
53 * instance(s): dmm
54 */
55static struct omap_hwmod_class omap54xx_dmm_hwmod_class = {
56 .name = "dmm",
57};
58
59/* dmm */
60static struct omap_hwmod omap54xx_dmm_hwmod = {
61 .name = "dmm",
62 .class = &omap54xx_dmm_hwmod_class,
63 .clkdm_name = "emif_clkdm",
64 .prcm = {
65 .omap4 = {
66 .clkctrl_offs = OMAP54XX_CM_EMIF_DMM_CLKCTRL_OFFSET,
67 .context_offs = OMAP54XX_RM_EMIF_DMM_CONTEXT_OFFSET,
68 },
69 },
70};
71
72/*
73 * 'l3' class
74 * instance(s): l3_instr, l3_main_1, l3_main_2, l3_main_3
75 */
76static struct omap_hwmod_class omap54xx_l3_hwmod_class = {
77 .name = "l3",
78};
79
80/* l3_instr */
81static struct omap_hwmod omap54xx_l3_instr_hwmod = {
82 .name = "l3_instr",
83 .class = &omap54xx_l3_hwmod_class,
84 .clkdm_name = "l3instr_clkdm",
85 .prcm = {
86 .omap4 = {
87 .clkctrl_offs = OMAP54XX_CM_L3INSTR_L3_INSTR_CLKCTRL_OFFSET,
88 .context_offs = OMAP54XX_RM_L3INSTR_L3_INSTR_CONTEXT_OFFSET,
89 .modulemode = MODULEMODE_HWCTRL,
90 },
91 },
92};
93
94/* l3_main_1 */
95static struct omap_hwmod omap54xx_l3_main_1_hwmod = {
96 .name = "l3_main_1",
97 .class = &omap54xx_l3_hwmod_class,
98 .clkdm_name = "l3main1_clkdm",
99 .prcm = {
100 .omap4 = {
101 .clkctrl_offs = OMAP54XX_CM_L3MAIN1_L3_MAIN_1_CLKCTRL_OFFSET,
102 .context_offs = OMAP54XX_RM_L3MAIN1_L3_MAIN_1_CONTEXT_OFFSET,
103 },
104 },
105};
106
107/* l3_main_2 */
108static struct omap_hwmod omap54xx_l3_main_2_hwmod = {
109 .name = "l3_main_2",
110 .class = &omap54xx_l3_hwmod_class,
111 .clkdm_name = "l3main2_clkdm",
112 .prcm = {
113 .omap4 = {
114 .clkctrl_offs = OMAP54XX_CM_L3MAIN2_L3_MAIN_2_CLKCTRL_OFFSET,
115 .context_offs = OMAP54XX_RM_L3MAIN2_L3_MAIN_2_CONTEXT_OFFSET,
116 },
117 },
118};
119
120/* l3_main_3 */
121static struct omap_hwmod omap54xx_l3_main_3_hwmod = {
122 .name = "l3_main_3",
123 .class = &omap54xx_l3_hwmod_class,
124 .clkdm_name = "l3instr_clkdm",
125 .prcm = {
126 .omap4 = {
127 .clkctrl_offs = OMAP54XX_CM_L3INSTR_L3_MAIN_3_CLKCTRL_OFFSET,
128 .context_offs = OMAP54XX_RM_L3INSTR_L3_MAIN_3_CONTEXT_OFFSET,
129 .modulemode = MODULEMODE_HWCTRL,
130 },
131 },
132};
133
134/*
135 * 'l4' class
136 * instance(s): l4_abe, l4_cfg, l4_per, l4_wkup
137 */
138static struct omap_hwmod_class omap54xx_l4_hwmod_class = {
139 .name = "l4",
140};
141
142/* l4_abe */
143static struct omap_hwmod omap54xx_l4_abe_hwmod = {
144 .name = "l4_abe",
145 .class = &omap54xx_l4_hwmod_class,
146 .clkdm_name = "abe_clkdm",
147 .prcm = {
148 .omap4 = {
149 .clkctrl_offs = OMAP54XX_CM_ABE_L4_ABE_CLKCTRL_OFFSET,
150 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
151 },
152 },
153};
154
155/* l4_cfg */
156static struct omap_hwmod omap54xx_l4_cfg_hwmod = {
157 .name = "l4_cfg",
158 .class = &omap54xx_l4_hwmod_class,
159 .clkdm_name = "l4cfg_clkdm",
160 .prcm = {
161 .omap4 = {
162 .clkctrl_offs = OMAP54XX_CM_L4CFG_L4_CFG_CLKCTRL_OFFSET,
163 .context_offs = OMAP54XX_RM_L4CFG_L4_CFG_CONTEXT_OFFSET,
164 },
165 },
166};
167
168/* l4_per */
169static struct omap_hwmod omap54xx_l4_per_hwmod = {
170 .name = "l4_per",
171 .class = &omap54xx_l4_hwmod_class,
172 .clkdm_name = "l4per_clkdm",
173 .prcm = {
174 .omap4 = {
175 .clkctrl_offs = OMAP54XX_CM_L4PER_L4_PER_CLKCTRL_OFFSET,
176 .context_offs = OMAP54XX_RM_L4PER_L4_PER_CONTEXT_OFFSET,
177 },
178 },
179};
180
181/* l4_wkup */
182static struct omap_hwmod omap54xx_l4_wkup_hwmod = {
183 .name = "l4_wkup",
184 .class = &omap54xx_l4_hwmod_class,
185 .clkdm_name = "wkupaon_clkdm",
186 .prcm = {
187 .omap4 = {
188 .clkctrl_offs = OMAP54XX_CM_WKUPAON_L4_WKUP_CLKCTRL_OFFSET,
189 .context_offs = OMAP54XX_RM_WKUPAON_L4_WKUP_CONTEXT_OFFSET,
190 },
191 },
192};
193
194/*
195 * 'mpu_bus' class
196 * instance(s): mpu_private
197 */
198static struct omap_hwmod_class omap54xx_mpu_bus_hwmod_class = {
199 .name = "mpu_bus",
200};
201
202/* mpu_private */
203static struct omap_hwmod omap54xx_mpu_private_hwmod = {
204 .name = "mpu_private",
205 .class = &omap54xx_mpu_bus_hwmod_class,
206 .clkdm_name = "mpu_clkdm",
207 .prcm = {
208 .omap4 = {
209 .flags = HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT,
210 },
211 },
212};
213
214/*
215 * 'counter' class
216 * 32-bit ordinary counter, clocked by the falling edge of the 32 khz clock
217 */
218
219static struct omap_hwmod_class_sysconfig omap54xx_counter_sysc = {
220 .rev_offs = 0x0000,
221 .sysc_offs = 0x0010,
222 .sysc_flags = SYSC_HAS_SIDLEMODE,
223 .idlemodes = (SIDLE_FORCE | SIDLE_NO),
224 .sysc_fields = &omap_hwmod_sysc_type1,
225};
226
227static struct omap_hwmod_class omap54xx_counter_hwmod_class = {
228 .name = "counter",
229 .sysc = &omap54xx_counter_sysc,
230};
231
232/* counter_32k */
233static struct omap_hwmod omap54xx_counter_32k_hwmod = {
234 .name = "counter_32k",
235 .class = &omap54xx_counter_hwmod_class,
236 .clkdm_name = "wkupaon_clkdm",
237 .flags = HWMOD_SWSUP_SIDLE,
238 .main_clk = "wkupaon_iclk_mux",
239 .prcm = {
240 .omap4 = {
241 .clkctrl_offs = OMAP54XX_CM_WKUPAON_COUNTER_32K_CLKCTRL_OFFSET,
242 .context_offs = OMAP54XX_RM_WKUPAON_COUNTER_32K_CONTEXT_OFFSET,
243 },
244 },
245};
246
247/*
248 * 'dma' class
249 * dma controller for data exchange between memory to memory (i.e. internal or
250 * external memory) and gp peripherals to memory or memory to gp peripherals
251 */
252
253static struct omap_hwmod_class_sysconfig omap54xx_dma_sysc = {
254 .rev_offs = 0x0000,
255 .sysc_offs = 0x002c,
256 .syss_offs = 0x0028,
257 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
258 SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
259 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
260 SYSS_HAS_RESET_STATUS),
261 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
262 MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART),
263 .sysc_fields = &omap_hwmod_sysc_type1,
264};
265
266static struct omap_hwmod_class omap54xx_dma_hwmod_class = {
267 .name = "dma",
268 .sysc = &omap54xx_dma_sysc,
269};
270
271/* dma dev_attr */
272static struct omap_dma_dev_attr dma_dev_attr = {
273 .dev_caps = RESERVE_CHANNEL | DMA_LINKED_LCH | GLOBAL_PRIORITY |
274 IS_CSSA_32 | IS_CDSA_32 | IS_RW_PRIORITY,
275 .lch_count = 32,
276};
277
278/* dma_system */
279static struct omap_hwmod_irq_info omap54xx_dma_system_irqs[] = {
280 { .name = "0", .irq = 12 + OMAP54XX_IRQ_GIC_START },
281 { .name = "1", .irq = 13 + OMAP54XX_IRQ_GIC_START },
282 { .name = "2", .irq = 14 + OMAP54XX_IRQ_GIC_START },
283 { .name = "3", .irq = 15 + OMAP54XX_IRQ_GIC_START },
284 { .irq = -1 }
285};
286
287static struct omap_hwmod omap54xx_dma_system_hwmod = {
288 .name = "dma_system",
289 .class = &omap54xx_dma_hwmod_class,
290 .clkdm_name = "dma_clkdm",
291 .mpu_irqs = omap54xx_dma_system_irqs,
292 .main_clk = "l3_iclk_div",
293 .prcm = {
294 .omap4 = {
295 .clkctrl_offs = OMAP54XX_CM_DMA_DMA_SYSTEM_CLKCTRL_OFFSET,
296 .context_offs = OMAP54XX_RM_DMA_DMA_SYSTEM_CONTEXT_OFFSET,
297 },
298 },
299 .dev_attr = &dma_dev_attr,
300};
301
302/*
303 * 'dmic' class
304 * digital microphone controller
305 */
306
307static struct omap_hwmod_class_sysconfig omap54xx_dmic_sysc = {
308 .rev_offs = 0x0000,
309 .sysc_offs = 0x0010,
310 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS |
311 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
312 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
313 SIDLE_SMART_WKUP),
314 .sysc_fields = &omap_hwmod_sysc_type2,
315};
316
317static struct omap_hwmod_class omap54xx_dmic_hwmod_class = {
318 .name = "dmic",
319 .sysc = &omap54xx_dmic_sysc,
320};
321
322/* dmic */
323static struct omap_hwmod omap54xx_dmic_hwmod = {
324 .name = "dmic",
325 .class = &omap54xx_dmic_hwmod_class,
326 .clkdm_name = "abe_clkdm",
327 .main_clk = "dmic_gfclk",
328 .prcm = {
329 .omap4 = {
330 .clkctrl_offs = OMAP54XX_CM_ABE_DMIC_CLKCTRL_OFFSET,
331 .context_offs = OMAP54XX_RM_ABE_DMIC_CONTEXT_OFFSET,
332 .modulemode = MODULEMODE_SWCTRL,
333 },
334 },
335};
336
337/*
338 * 'emif' class
339 * external memory interface no1 (wrapper)
340 */
341
342static struct omap_hwmod_class_sysconfig omap54xx_emif_sysc = {
343 .rev_offs = 0x0000,
344};
345
346static struct omap_hwmod_class omap54xx_emif_hwmod_class = {
347 .name = "emif",
348 .sysc = &omap54xx_emif_sysc,
349};
350
351/* emif1 */
352static struct omap_hwmod omap54xx_emif1_hwmod = {
353 .name = "emif1",
354 .class = &omap54xx_emif_hwmod_class,
355 .clkdm_name = "emif_clkdm",
356 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
357 .main_clk = "dpll_core_h11x2_ck",
358 .prcm = {
359 .omap4 = {
360 .clkctrl_offs = OMAP54XX_CM_EMIF_EMIF1_CLKCTRL_OFFSET,
361 .context_offs = OMAP54XX_RM_EMIF_EMIF1_CONTEXT_OFFSET,
362 .modulemode = MODULEMODE_HWCTRL,
363 },
364 },
365};
366
367/* emif2 */
368static struct omap_hwmod omap54xx_emif2_hwmod = {
369 .name = "emif2",
370 .class = &omap54xx_emif_hwmod_class,
371 .clkdm_name = "emif_clkdm",
372 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
373 .main_clk = "dpll_core_h11x2_ck",
374 .prcm = {
375 .omap4 = {
376 .clkctrl_offs = OMAP54XX_CM_EMIF_EMIF2_CLKCTRL_OFFSET,
377 .context_offs = OMAP54XX_RM_EMIF_EMIF2_CONTEXT_OFFSET,
378 .modulemode = MODULEMODE_HWCTRL,
379 },
380 },
381};
382
383/*
384 * 'gpio' class
385 * general purpose io module
386 */
387
388static struct omap_hwmod_class_sysconfig omap54xx_gpio_sysc = {
389 .rev_offs = 0x0000,
390 .sysc_offs = 0x0010,
391 .syss_offs = 0x0114,
392 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
393 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
394 SYSS_HAS_RESET_STATUS),
395 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
396 SIDLE_SMART_WKUP),
397 .sysc_fields = &omap_hwmod_sysc_type1,
398};
399
400static struct omap_hwmod_class omap54xx_gpio_hwmod_class = {
401 .name = "gpio",
402 .sysc = &omap54xx_gpio_sysc,
403 .rev = 2,
404};
405
406/* gpio dev_attr */
407static struct omap_gpio_dev_attr gpio_dev_attr = {
408 .bank_width = 32,
409 .dbck_flag = true,
410};
411
412/* gpio1 */
413static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
414 { .role = "dbclk", .clk = "gpio1_dbclk" },
415};
416
417static struct omap_hwmod omap54xx_gpio1_hwmod = {
418 .name = "gpio1",
419 .class = &omap54xx_gpio_hwmod_class,
420 .clkdm_name = "wkupaon_clkdm",
421 .main_clk = "wkupaon_iclk_mux",
422 .prcm = {
423 .omap4 = {
424 .clkctrl_offs = OMAP54XX_CM_WKUPAON_GPIO1_CLKCTRL_OFFSET,
425 .context_offs = OMAP54XX_RM_WKUPAON_GPIO1_CONTEXT_OFFSET,
426 .modulemode = MODULEMODE_HWCTRL,
427 },
428 },
429 .opt_clks = gpio1_opt_clks,
430 .opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks),
431 .dev_attr = &gpio_dev_attr,
432};
433
434/* gpio2 */
435static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
436 { .role = "dbclk", .clk = "gpio2_dbclk" },
437};
438
439static struct omap_hwmod omap54xx_gpio2_hwmod = {
440 .name = "gpio2",
441 .class = &omap54xx_gpio_hwmod_class,
442 .clkdm_name = "l4per_clkdm",
443 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
444 .main_clk = "l4_root_clk_div",
445 .prcm = {
446 .omap4 = {
447 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO2_CLKCTRL_OFFSET,
448 .context_offs = OMAP54XX_RM_L4PER_GPIO2_CONTEXT_OFFSET,
449 .modulemode = MODULEMODE_HWCTRL,
450 },
451 },
452 .opt_clks = gpio2_opt_clks,
453 .opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks),
454 .dev_attr = &gpio_dev_attr,
455};
456
457/* gpio3 */
458static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
459 { .role = "dbclk", .clk = "gpio3_dbclk" },
460};
461
462static struct omap_hwmod omap54xx_gpio3_hwmod = {
463 .name = "gpio3",
464 .class = &omap54xx_gpio_hwmod_class,
465 .clkdm_name = "l4per_clkdm",
466 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
467 .main_clk = "l4_root_clk_div",
468 .prcm = {
469 .omap4 = {
470 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO3_CLKCTRL_OFFSET,
471 .context_offs = OMAP54XX_RM_L4PER_GPIO3_CONTEXT_OFFSET,
472 .modulemode = MODULEMODE_HWCTRL,
473 },
474 },
475 .opt_clks = gpio3_opt_clks,
476 .opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks),
477 .dev_attr = &gpio_dev_attr,
478};
479
480/* gpio4 */
481static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
482 { .role = "dbclk", .clk = "gpio4_dbclk" },
483};
484
485static struct omap_hwmod omap54xx_gpio4_hwmod = {
486 .name = "gpio4",
487 .class = &omap54xx_gpio_hwmod_class,
488 .clkdm_name = "l4per_clkdm",
489 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
490 .main_clk = "l4_root_clk_div",
491 .prcm = {
492 .omap4 = {
493 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO4_CLKCTRL_OFFSET,
494 .context_offs = OMAP54XX_RM_L4PER_GPIO4_CONTEXT_OFFSET,
495 .modulemode = MODULEMODE_HWCTRL,
496 },
497 },
498 .opt_clks = gpio4_opt_clks,
499 .opt_clks_cnt = ARRAY_SIZE(gpio4_opt_clks),
500 .dev_attr = &gpio_dev_attr,
501};
502
503/* gpio5 */
504static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
505 { .role = "dbclk", .clk = "gpio5_dbclk" },
506};
507
508static struct omap_hwmod omap54xx_gpio5_hwmod = {
509 .name = "gpio5",
510 .class = &omap54xx_gpio_hwmod_class,
511 .clkdm_name = "l4per_clkdm",
512 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
513 .main_clk = "l4_root_clk_div",
514 .prcm = {
515 .omap4 = {
516 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO5_CLKCTRL_OFFSET,
517 .context_offs = OMAP54XX_RM_L4PER_GPIO5_CONTEXT_OFFSET,
518 .modulemode = MODULEMODE_HWCTRL,
519 },
520 },
521 .opt_clks = gpio5_opt_clks,
522 .opt_clks_cnt = ARRAY_SIZE(gpio5_opt_clks),
523 .dev_attr = &gpio_dev_attr,
524};
525
526/* gpio6 */
527static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
528 { .role = "dbclk", .clk = "gpio6_dbclk" },
529};
530
531static struct omap_hwmod omap54xx_gpio6_hwmod = {
532 .name = "gpio6",
533 .class = &omap54xx_gpio_hwmod_class,
534 .clkdm_name = "l4per_clkdm",
535 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
536 .main_clk = "l4_root_clk_div",
537 .prcm = {
538 .omap4 = {
539 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO6_CLKCTRL_OFFSET,
540 .context_offs = OMAP54XX_RM_L4PER_GPIO6_CONTEXT_OFFSET,
541 .modulemode = MODULEMODE_HWCTRL,
542 },
543 },
544 .opt_clks = gpio6_opt_clks,
545 .opt_clks_cnt = ARRAY_SIZE(gpio6_opt_clks),
546 .dev_attr = &gpio_dev_attr,
547};
548
549/* gpio7 */
550static struct omap_hwmod_opt_clk gpio7_opt_clks[] = {
551 { .role = "dbclk", .clk = "gpio7_dbclk" },
552};
553
554static struct omap_hwmod omap54xx_gpio7_hwmod = {
555 .name = "gpio7",
556 .class = &omap54xx_gpio_hwmod_class,
557 .clkdm_name = "l4per_clkdm",
558 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
559 .main_clk = "l4_root_clk_div",
560 .prcm = {
561 .omap4 = {
562 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO7_CLKCTRL_OFFSET,
563 .context_offs = OMAP54XX_RM_L4PER_GPIO7_CONTEXT_OFFSET,
564 .modulemode = MODULEMODE_HWCTRL,
565 },
566 },
567 .opt_clks = gpio7_opt_clks,
568 .opt_clks_cnt = ARRAY_SIZE(gpio7_opt_clks),
569 .dev_attr = &gpio_dev_attr,
570};
571
572/* gpio8 */
573static struct omap_hwmod_opt_clk gpio8_opt_clks[] = {
574 { .role = "dbclk", .clk = "gpio8_dbclk" },
575};
576
577static struct omap_hwmod omap54xx_gpio8_hwmod = {
578 .name = "gpio8",
579 .class = &omap54xx_gpio_hwmod_class,
580 .clkdm_name = "l4per_clkdm",
581 .flags = HWMOD_CONTROL_OPT_CLKS_IN_RESET,
582 .main_clk = "l4_root_clk_div",
583 .prcm = {
584 .omap4 = {
585 .clkctrl_offs = OMAP54XX_CM_L4PER_GPIO8_CLKCTRL_OFFSET,
586 .context_offs = OMAP54XX_RM_L4PER_GPIO8_CONTEXT_OFFSET,
587 .modulemode = MODULEMODE_HWCTRL,
588 },
589 },
590 .opt_clks = gpio8_opt_clks,
591 .opt_clks_cnt = ARRAY_SIZE(gpio8_opt_clks),
592 .dev_attr = &gpio_dev_attr,
593};
594
595/*
596 * 'i2c' class
597 * multimaster high-speed i2c controller
598 */
599
600static struct omap_hwmod_class_sysconfig omap54xx_i2c_sysc = {
601 .sysc_offs = 0x0010,
602 .syss_offs = 0x0090,
603 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY |
604 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
605 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
606 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
607 SIDLE_SMART_WKUP),
608 .clockact = CLOCKACT_TEST_ICLK,
609 .sysc_fields = &omap_hwmod_sysc_type1,
610};
611
612static struct omap_hwmod_class omap54xx_i2c_hwmod_class = {
613 .name = "i2c",
614 .sysc = &omap54xx_i2c_sysc,
615 .reset = &omap_i2c_reset,
616 .rev = OMAP_I2C_IP_VERSION_2,
617};
618
619/* i2c dev_attr */
620static struct omap_i2c_dev_attr i2c_dev_attr = {
621 .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
622};
623
624/* i2c1 */
625static struct omap_hwmod omap54xx_i2c1_hwmod = {
626 .name = "i2c1",
627 .class = &omap54xx_i2c_hwmod_class,
628 .clkdm_name = "l4per_clkdm",
629 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
630 .main_clk = "func_96m_fclk",
631 .prcm = {
632 .omap4 = {
633 .clkctrl_offs = OMAP54XX_CM_L4PER_I2C1_CLKCTRL_OFFSET,
634 .context_offs = OMAP54XX_RM_L4PER_I2C1_CONTEXT_OFFSET,
635 .modulemode = MODULEMODE_SWCTRL,
636 },
637 },
638 .dev_attr = &i2c_dev_attr,
639};
640
641/* i2c2 */
642static struct omap_hwmod omap54xx_i2c2_hwmod = {
643 .name = "i2c2",
644 .class = &omap54xx_i2c_hwmod_class,
645 .clkdm_name = "l4per_clkdm",
646 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
647 .main_clk = "func_96m_fclk",
648 .prcm = {
649 .omap4 = {
650 .clkctrl_offs = OMAP54XX_CM_L4PER_I2C2_CLKCTRL_OFFSET,
651 .context_offs = OMAP54XX_RM_L4PER_I2C2_CONTEXT_OFFSET,
652 .modulemode = MODULEMODE_SWCTRL,
653 },
654 },
655 .dev_attr = &i2c_dev_attr,
656};
657
658/* i2c3 */
659static struct omap_hwmod omap54xx_i2c3_hwmod = {
660 .name = "i2c3",
661 .class = &omap54xx_i2c_hwmod_class,
662 .clkdm_name = "l4per_clkdm",
663 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
664 .main_clk = "func_96m_fclk",
665 .prcm = {
666 .omap4 = {
667 .clkctrl_offs = OMAP54XX_CM_L4PER_I2C3_CLKCTRL_OFFSET,
668 .context_offs = OMAP54XX_RM_L4PER_I2C3_CONTEXT_OFFSET,
669 .modulemode = MODULEMODE_SWCTRL,
670 },
671 },
672 .dev_attr = &i2c_dev_attr,
673};
674
675/* i2c4 */
676static struct omap_hwmod omap54xx_i2c4_hwmod = {
677 .name = "i2c4",
678 .class = &omap54xx_i2c_hwmod_class,
679 .clkdm_name = "l4per_clkdm",
680 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
681 .main_clk = "func_96m_fclk",
682 .prcm = {
683 .omap4 = {
684 .clkctrl_offs = OMAP54XX_CM_L4PER_I2C4_CLKCTRL_OFFSET,
685 .context_offs = OMAP54XX_RM_L4PER_I2C4_CONTEXT_OFFSET,
686 .modulemode = MODULEMODE_SWCTRL,
687 },
688 },
689 .dev_attr = &i2c_dev_attr,
690};
691
692/* i2c5 */
693static struct omap_hwmod omap54xx_i2c5_hwmod = {
694 .name = "i2c5",
695 .class = &omap54xx_i2c_hwmod_class,
696 .clkdm_name = "l4per_clkdm",
697 .flags = HWMOD_16BIT_REG | HWMOD_SET_DEFAULT_CLOCKACT,
698 .main_clk = "func_96m_fclk",
699 .prcm = {
700 .omap4 = {
701 .clkctrl_offs = OMAP54XX_CM_L4PER_I2C5_CLKCTRL_OFFSET,
702 .context_offs = OMAP54XX_RM_L4PER_I2C5_CONTEXT_OFFSET,
703 .modulemode = MODULEMODE_SWCTRL,
704 },
705 },
706 .dev_attr = &i2c_dev_attr,
707};
708
709/*
710 * 'kbd' class
711 * keyboard controller
712 */
713
714static struct omap_hwmod_class_sysconfig omap54xx_kbd_sysc = {
715 .rev_offs = 0x0000,
716 .sysc_offs = 0x0010,
717 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SIDLEMODE |
718 SYSC_HAS_SOFTRESET),
719 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
720 .sysc_fields = &omap_hwmod_sysc_type1,
721};
722
723static struct omap_hwmod_class omap54xx_kbd_hwmod_class = {
724 .name = "kbd",
725 .sysc = &omap54xx_kbd_sysc,
726};
727
728/* kbd */
729static struct omap_hwmod omap54xx_kbd_hwmod = {
730 .name = "kbd",
731 .class = &omap54xx_kbd_hwmod_class,
732 .clkdm_name = "wkupaon_clkdm",
733 .main_clk = "sys_32k_ck",
734 .prcm = {
735 .omap4 = {
736 .clkctrl_offs = OMAP54XX_CM_WKUPAON_KBD_CLKCTRL_OFFSET,
737 .context_offs = OMAP54XX_RM_WKUPAON_KBD_CONTEXT_OFFSET,
738 .modulemode = MODULEMODE_SWCTRL,
739 },
740 },
741};
742
743/*
744 * 'mcbsp' class
745 * multi channel buffered serial port controller
746 */
747
748static struct omap_hwmod_class_sysconfig omap54xx_mcbsp_sysc = {
749 .sysc_offs = 0x008c,
750 .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_ENAWAKEUP |
751 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
752 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
753 .sysc_fields = &omap_hwmod_sysc_type1,
754};
755
756static struct omap_hwmod_class omap54xx_mcbsp_hwmod_class = {
757 .name = "mcbsp",
758 .sysc = &omap54xx_mcbsp_sysc,
759 .rev = MCBSP_CONFIG_TYPE4,
760};
761
762/* mcbsp1 */
763static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
764 { .role = "pad_fck", .clk = "pad_clks_ck" },
765 { .role = "prcm_fck", .clk = "mcbsp1_sync_mux_ck" },
766};
767
768static struct omap_hwmod omap54xx_mcbsp1_hwmod = {
769 .name = "mcbsp1",
770 .class = &omap54xx_mcbsp_hwmod_class,
771 .clkdm_name = "abe_clkdm",
772 .main_clk = "mcbsp1_gfclk",
773 .prcm = {
774 .omap4 = {
775 .clkctrl_offs = OMAP54XX_CM_ABE_MCBSP1_CLKCTRL_OFFSET,
776 .context_offs = OMAP54XX_RM_ABE_MCBSP1_CONTEXT_OFFSET,
777 .modulemode = MODULEMODE_SWCTRL,
778 },
779 },
780 .opt_clks = mcbsp1_opt_clks,
781 .opt_clks_cnt = ARRAY_SIZE(mcbsp1_opt_clks),
782};
783
784/* mcbsp2 */
785static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = {
786 { .role = "pad_fck", .clk = "pad_clks_ck" },
787 { .role = "prcm_fck", .clk = "mcbsp2_sync_mux_ck" },
788};
789
790static struct omap_hwmod omap54xx_mcbsp2_hwmod = {
791 .name = "mcbsp2",
792 .class = &omap54xx_mcbsp_hwmod_class,
793 .clkdm_name = "abe_clkdm",
794 .main_clk = "mcbsp2_gfclk",
795 .prcm = {
796 .omap4 = {
797 .clkctrl_offs = OMAP54XX_CM_ABE_MCBSP2_CLKCTRL_OFFSET,
798 .context_offs = OMAP54XX_RM_ABE_MCBSP2_CONTEXT_OFFSET,
799 .modulemode = MODULEMODE_SWCTRL,
800 },
801 },
802 .opt_clks = mcbsp2_opt_clks,
803 .opt_clks_cnt = ARRAY_SIZE(mcbsp2_opt_clks),
804};
805
806/* mcbsp3 */
807static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = {
808 { .role = "pad_fck", .clk = "pad_clks_ck" },
809 { .role = "prcm_fck", .clk = "mcbsp3_sync_mux_ck" },
810};
811
812static struct omap_hwmod omap54xx_mcbsp3_hwmod = {
813 .name = "mcbsp3",
814 .class = &omap54xx_mcbsp_hwmod_class,
815 .clkdm_name = "abe_clkdm",
816 .main_clk = "mcbsp3_gfclk",
817 .prcm = {
818 .omap4 = {
819 .clkctrl_offs = OMAP54XX_CM_ABE_MCBSP3_CLKCTRL_OFFSET,
820 .context_offs = OMAP54XX_RM_ABE_MCBSP3_CONTEXT_OFFSET,
821 .modulemode = MODULEMODE_SWCTRL,
822 },
823 },
824 .opt_clks = mcbsp3_opt_clks,
825 .opt_clks_cnt = ARRAY_SIZE(mcbsp3_opt_clks),
826};
827
828/*
829 * 'mcpdm' class
830 * multi channel pdm controller (proprietary interface with phoenix power
831 * ic)
832 */
833
834static struct omap_hwmod_class_sysconfig omap54xx_mcpdm_sysc = {
835 .rev_offs = 0x0000,
836 .sysc_offs = 0x0010,
837 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS |
838 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
839 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
840 SIDLE_SMART_WKUP),
841 .sysc_fields = &omap_hwmod_sysc_type2,
842};
843
844static struct omap_hwmod_class omap54xx_mcpdm_hwmod_class = {
845 .name = "mcpdm",
846 .sysc = &omap54xx_mcpdm_sysc,
847};
848
849/* mcpdm */
850static struct omap_hwmod omap54xx_mcpdm_hwmod = {
851 .name = "mcpdm",
852 .class = &omap54xx_mcpdm_hwmod_class,
853 .clkdm_name = "abe_clkdm",
854 /*
855 * It's suspected that the McPDM requires an off-chip main
856 * functional clock, controlled via I2C. This IP block is
857 * currently reset very early during boot, before I2C is
858 * available, so it doesn't seem that we have any choice in
859 * the kernel other than to avoid resetting it. XXX This is
860 * really a hardware issue workaround: every IP block should
861 * be able to source its main functional clock from either
862 * on-chip or off-chip sources. McPDM seems to be the only
863 * current exception.
864 */
865
866 .flags = HWMOD_EXT_OPT_MAIN_CLK,
867 .main_clk = "pad_clks_ck",
868 .prcm = {
869 .omap4 = {
870 .clkctrl_offs = OMAP54XX_CM_ABE_MCPDM_CLKCTRL_OFFSET,
871 .context_offs = OMAP54XX_RM_ABE_MCPDM_CONTEXT_OFFSET,
872 .modulemode = MODULEMODE_SWCTRL,
873 },
874 },
875};
876
877/*
878 * 'mcspi' class
879 * multichannel serial port interface (mcspi) / master/slave synchronous serial
880 * bus
881 */
882
883static struct omap_hwmod_class_sysconfig omap54xx_mcspi_sysc = {
884 .rev_offs = 0x0000,
885 .sysc_offs = 0x0010,
886 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS |
887 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
888 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
889 SIDLE_SMART_WKUP),
890 .sysc_fields = &omap_hwmod_sysc_type2,
891};
892
893static struct omap_hwmod_class omap54xx_mcspi_hwmod_class = {
894 .name = "mcspi",
895 .sysc = &omap54xx_mcspi_sysc,
896 .rev = OMAP4_MCSPI_REV,
897};
898
899/* mcspi1 */
900/* mcspi1 dev_attr */
901static struct omap2_mcspi_dev_attr mcspi1_dev_attr = {
902 .num_chipselect = 4,
903};
904
905static struct omap_hwmod omap54xx_mcspi1_hwmod = {
906 .name = "mcspi1",
907 .class = &omap54xx_mcspi_hwmod_class,
908 .clkdm_name = "l4per_clkdm",
909 .main_clk = "func_48m_fclk",
910 .prcm = {
911 .omap4 = {
912 .clkctrl_offs = OMAP54XX_CM_L4PER_MCSPI1_CLKCTRL_OFFSET,
913 .context_offs = OMAP54XX_RM_L4PER_MCSPI1_CONTEXT_OFFSET,
914 .modulemode = MODULEMODE_SWCTRL,
915 },
916 },
917 .dev_attr = &mcspi1_dev_attr,
918};
919
920/* mcspi2 */
921/* mcspi2 dev_attr */
922static struct omap2_mcspi_dev_attr mcspi2_dev_attr = {
923 .num_chipselect = 2,
924};
925
926static struct omap_hwmod omap54xx_mcspi2_hwmod = {
927 .name = "mcspi2",
928 .class = &omap54xx_mcspi_hwmod_class,
929 .clkdm_name = "l4per_clkdm",
930 .main_clk = "func_48m_fclk",
931 .prcm = {
932 .omap4 = {
933 .clkctrl_offs = OMAP54XX_CM_L4PER_MCSPI2_CLKCTRL_OFFSET,
934 .context_offs = OMAP54XX_RM_L4PER_MCSPI2_CONTEXT_OFFSET,
935 .modulemode = MODULEMODE_SWCTRL,
936 },
937 },
938 .dev_attr = &mcspi2_dev_attr,
939};
940
941/* mcspi3 */
942/* mcspi3 dev_attr */
943static struct omap2_mcspi_dev_attr mcspi3_dev_attr = {
944 .num_chipselect = 2,
945};
946
947static struct omap_hwmod omap54xx_mcspi3_hwmod = {
948 .name = "mcspi3",
949 .class = &omap54xx_mcspi_hwmod_class,
950 .clkdm_name = "l4per_clkdm",
951 .main_clk = "func_48m_fclk",
952 .prcm = {
953 .omap4 = {
954 .clkctrl_offs = OMAP54XX_CM_L4PER_MCSPI3_CLKCTRL_OFFSET,
955 .context_offs = OMAP54XX_RM_L4PER_MCSPI3_CONTEXT_OFFSET,
956 .modulemode = MODULEMODE_SWCTRL,
957 },
958 },
959 .dev_attr = &mcspi3_dev_attr,
960};
961
962/* mcspi4 */
963/* mcspi4 dev_attr */
964static struct omap2_mcspi_dev_attr mcspi4_dev_attr = {
965 .num_chipselect = 1,
966};
967
968static struct omap_hwmod omap54xx_mcspi4_hwmod = {
969 .name = "mcspi4",
970 .class = &omap54xx_mcspi_hwmod_class,
971 .clkdm_name = "l4per_clkdm",
972 .main_clk = "func_48m_fclk",
973 .prcm = {
974 .omap4 = {
975 .clkctrl_offs = OMAP54XX_CM_L4PER_MCSPI4_CLKCTRL_OFFSET,
976 .context_offs = OMAP54XX_RM_L4PER_MCSPI4_CONTEXT_OFFSET,
977 .modulemode = MODULEMODE_SWCTRL,
978 },
979 },
980 .dev_attr = &mcspi4_dev_attr,
981};
982
983/*
984 * 'mmc' class
985 * multimedia card high-speed/sd/sdio (mmc/sd/sdio) host controller
986 */
987
988static struct omap_hwmod_class_sysconfig omap54xx_mmc_sysc = {
989 .rev_offs = 0x0000,
990 .sysc_offs = 0x0010,
991 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_MIDLEMODE |
992 SYSC_HAS_RESET_STATUS | SYSC_HAS_SIDLEMODE |
993 SYSC_HAS_SOFTRESET),
994 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
995 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
996 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
997 .sysc_fields = &omap_hwmod_sysc_type2,
998};
999
1000static struct omap_hwmod_class omap54xx_mmc_hwmod_class = {
1001 .name = "mmc",
1002 .sysc = &omap54xx_mmc_sysc,
1003};
1004
1005/* mmc1 */
1006static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
1007 { .role = "32khz_clk", .clk = "mmc1_32khz_clk" },
1008};
1009
1010/* mmc1 dev_attr */
1011static struct omap_mmc_dev_attr mmc1_dev_attr = {
1012 .flags = OMAP_HSMMC_SUPPORTS_DUAL_VOLT,
1013};
1014
1015static struct omap_hwmod omap54xx_mmc1_hwmod = {
1016 .name = "mmc1",
1017 .class = &omap54xx_mmc_hwmod_class,
1018 .clkdm_name = "l3init_clkdm",
1019 .main_clk = "mmc1_fclk",
1020 .prcm = {
1021 .omap4 = {
1022 .clkctrl_offs = OMAP54XX_CM_L3INIT_MMC1_CLKCTRL_OFFSET,
1023 .context_offs = OMAP54XX_RM_L3INIT_MMC1_CONTEXT_OFFSET,
1024 .modulemode = MODULEMODE_SWCTRL,
1025 },
1026 },
1027 .opt_clks = mmc1_opt_clks,
1028 .opt_clks_cnt = ARRAY_SIZE(mmc1_opt_clks),
1029 .dev_attr = &mmc1_dev_attr,
1030};
1031
1032/* mmc2 */
1033static struct omap_hwmod omap54xx_mmc2_hwmod = {
1034 .name = "mmc2",
1035 .class = &omap54xx_mmc_hwmod_class,
1036 .clkdm_name = "l3init_clkdm",
1037 .main_clk = "mmc2_fclk",
1038 .prcm = {
1039 .omap4 = {
1040 .clkctrl_offs = OMAP54XX_CM_L3INIT_MMC2_CLKCTRL_OFFSET,
1041 .context_offs = OMAP54XX_RM_L3INIT_MMC2_CONTEXT_OFFSET,
1042 .modulemode = MODULEMODE_SWCTRL,
1043 },
1044 },
1045};
1046
1047/* mmc3 */
1048static struct omap_hwmod omap54xx_mmc3_hwmod = {
1049 .name = "mmc3",
1050 .class = &omap54xx_mmc_hwmod_class,
1051 .clkdm_name = "l4per_clkdm",
1052 .main_clk = "func_48m_fclk",
1053 .prcm = {
1054 .omap4 = {
1055 .clkctrl_offs = OMAP54XX_CM_L4PER_MMC3_CLKCTRL_OFFSET,
1056 .context_offs = OMAP54XX_RM_L4PER_MMC3_CONTEXT_OFFSET,
1057 .modulemode = MODULEMODE_SWCTRL,
1058 },
1059 },
1060};
1061
1062/* mmc4 */
1063static struct omap_hwmod omap54xx_mmc4_hwmod = {
1064 .name = "mmc4",
1065 .class = &omap54xx_mmc_hwmod_class,
1066 .clkdm_name = "l4per_clkdm",
1067 .main_clk = "func_48m_fclk",
1068 .prcm = {
1069 .omap4 = {
1070 .clkctrl_offs = OMAP54XX_CM_L4PER_MMC4_CLKCTRL_OFFSET,
1071 .context_offs = OMAP54XX_RM_L4PER_MMC4_CONTEXT_OFFSET,
1072 .modulemode = MODULEMODE_SWCTRL,
1073 },
1074 },
1075};
1076
1077/* mmc5 */
1078static struct omap_hwmod omap54xx_mmc5_hwmod = {
1079 .name = "mmc5",
1080 .class = &omap54xx_mmc_hwmod_class,
1081 .clkdm_name = "l4per_clkdm",
1082 .main_clk = "func_96m_fclk",
1083 .prcm = {
1084 .omap4 = {
1085 .clkctrl_offs = OMAP54XX_CM_L4PER_MMC5_CLKCTRL_OFFSET,
1086 .context_offs = OMAP54XX_RM_L4PER_MMC5_CONTEXT_OFFSET,
1087 .modulemode = MODULEMODE_SWCTRL,
1088 },
1089 },
1090};
1091
1092/*
1093 * 'mpu' class
1094 * mpu sub-system
1095 */
1096
1097static struct omap_hwmod_class omap54xx_mpu_hwmod_class = {
1098 .name = "mpu",
1099};
1100
1101/* mpu */
1102static struct omap_hwmod omap54xx_mpu_hwmod = {
1103 .name = "mpu",
1104 .class = &omap54xx_mpu_hwmod_class,
1105 .clkdm_name = "mpu_clkdm",
1106 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1107 .main_clk = "dpll_mpu_m2_ck",
1108 .prcm = {
1109 .omap4 = {
1110 .clkctrl_offs = OMAP54XX_CM_MPU_MPU_CLKCTRL_OFFSET,
1111 .context_offs = OMAP54XX_RM_MPU_MPU_CONTEXT_OFFSET,
1112 },
1113 },
1114};
1115
1116/*
1117 * 'timer' class
1118 * general purpose timer module with accurate 1ms tick
1119 * This class contains several variants: ['timer_1ms', 'timer']
1120 */
1121
1122static struct omap_hwmod_class_sysconfig omap54xx_timer_1ms_sysc = {
1123 .rev_offs = 0x0000,
1124 .sysc_offs = 0x0010,
1125 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS |
1126 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
1127 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1128 SIDLE_SMART_WKUP),
1129 .sysc_fields = &omap_hwmod_sysc_type2,
1130 .clockact = CLOCKACT_TEST_ICLK,
1131};
1132
1133static struct omap_hwmod_class omap54xx_timer_1ms_hwmod_class = {
1134 .name = "timer",
1135 .sysc = &omap54xx_timer_1ms_sysc,
1136};
1137
1138static struct omap_hwmod_class_sysconfig omap54xx_timer_sysc = {
1139 .rev_offs = 0x0000,
1140 .sysc_offs = 0x0010,
1141 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_RESET_STATUS |
1142 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
1143 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1144 SIDLE_SMART_WKUP),
1145 .sysc_fields = &omap_hwmod_sysc_type2,
1146};
1147
1148static struct omap_hwmod_class omap54xx_timer_hwmod_class = {
1149 .name = "timer",
1150 .sysc = &omap54xx_timer_sysc,
1151};
1152
1153/* timer1 */
1154static struct omap_hwmod omap54xx_timer1_hwmod = {
1155 .name = "timer1",
1156 .class = &omap54xx_timer_1ms_hwmod_class,
1157 .clkdm_name = "wkupaon_clkdm",
1158 .main_clk = "timer1_gfclk_mux",
1159 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
1160 .prcm = {
1161 .omap4 = {
1162 .clkctrl_offs = OMAP54XX_CM_WKUPAON_TIMER1_CLKCTRL_OFFSET,
1163 .context_offs = OMAP54XX_RM_WKUPAON_TIMER1_CONTEXT_OFFSET,
1164 .modulemode = MODULEMODE_SWCTRL,
1165 },
1166 },
1167};
1168
1169/* timer2 */
1170static struct omap_hwmod omap54xx_timer2_hwmod = {
1171 .name = "timer2",
1172 .class = &omap54xx_timer_1ms_hwmod_class,
1173 .clkdm_name = "l4per_clkdm",
1174 .main_clk = "timer2_gfclk_mux",
1175 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
1176 .prcm = {
1177 .omap4 = {
1178 .clkctrl_offs = OMAP54XX_CM_L4PER_TIMER2_CLKCTRL_OFFSET,
1179 .context_offs = OMAP54XX_RM_L4PER_TIMER2_CONTEXT_OFFSET,
1180 .modulemode = MODULEMODE_SWCTRL,
1181 },
1182 },
1183};
1184
1185/* timer3 */
1186static struct omap_hwmod omap54xx_timer3_hwmod = {
1187 .name = "timer3",
1188 .class = &omap54xx_timer_hwmod_class,
1189 .clkdm_name = "l4per_clkdm",
1190 .main_clk = "timer3_gfclk_mux",
1191 .prcm = {
1192 .omap4 = {
1193 .clkctrl_offs = OMAP54XX_CM_L4PER_TIMER3_CLKCTRL_OFFSET,
1194 .context_offs = OMAP54XX_RM_L4PER_TIMER3_CONTEXT_OFFSET,
1195 .modulemode = MODULEMODE_SWCTRL,
1196 },
1197 },
1198};
1199
1200/* timer4 */
1201static struct omap_hwmod omap54xx_timer4_hwmod = {
1202 .name = "timer4",
1203 .class = &omap54xx_timer_hwmod_class,
1204 .clkdm_name = "l4per_clkdm",
1205 .main_clk = "timer4_gfclk_mux",
1206 .prcm = {
1207 .omap4 = {
1208 .clkctrl_offs = OMAP54XX_CM_L4PER_TIMER4_CLKCTRL_OFFSET,
1209 .context_offs = OMAP54XX_RM_L4PER_TIMER4_CONTEXT_OFFSET,
1210 .modulemode = MODULEMODE_SWCTRL,
1211 },
1212 },
1213};
1214
1215/* timer5 */
1216static struct omap_hwmod omap54xx_timer5_hwmod = {
1217 .name = "timer5",
1218 .class = &omap54xx_timer_hwmod_class,
1219 .clkdm_name = "abe_clkdm",
1220 .main_clk = "timer5_gfclk_mux",
1221 .prcm = {
1222 .omap4 = {
1223 .clkctrl_offs = OMAP54XX_CM_ABE_TIMER5_CLKCTRL_OFFSET,
1224 .context_offs = OMAP54XX_RM_ABE_TIMER5_CONTEXT_OFFSET,
1225 .modulemode = MODULEMODE_SWCTRL,
1226 },
1227 },
1228};
1229
1230/* timer6 */
1231static struct omap_hwmod omap54xx_timer6_hwmod = {
1232 .name = "timer6",
1233 .class = &omap54xx_timer_hwmod_class,
1234 .clkdm_name = "abe_clkdm",
1235 .main_clk = "timer6_gfclk_mux",
1236 .prcm = {
1237 .omap4 = {
1238 .clkctrl_offs = OMAP54XX_CM_ABE_TIMER6_CLKCTRL_OFFSET,
1239 .context_offs = OMAP54XX_RM_ABE_TIMER6_CONTEXT_OFFSET,
1240 .modulemode = MODULEMODE_SWCTRL,
1241 },
1242 },
1243};
1244
1245/* timer7 */
1246static struct omap_hwmod omap54xx_timer7_hwmod = {
1247 .name = "timer7",
1248 .class = &omap54xx_timer_hwmod_class,
1249 .clkdm_name = "abe_clkdm",
1250 .main_clk = "timer7_gfclk_mux",
1251 .prcm = {
1252 .omap4 = {
1253 .clkctrl_offs = OMAP54XX_CM_ABE_TIMER7_CLKCTRL_OFFSET,
1254 .context_offs = OMAP54XX_RM_ABE_TIMER7_CONTEXT_OFFSET,
1255 .modulemode = MODULEMODE_SWCTRL,
1256 },
1257 },
1258};
1259
1260/* timer8 */
1261static struct omap_hwmod omap54xx_timer8_hwmod = {
1262 .name = "timer8",
1263 .class = &omap54xx_timer_hwmod_class,
1264 .clkdm_name = "abe_clkdm",
1265 .main_clk = "timer8_gfclk_mux",
1266 .prcm = {
1267 .omap4 = {
1268 .clkctrl_offs = OMAP54XX_CM_ABE_TIMER8_CLKCTRL_OFFSET,
1269 .context_offs = OMAP54XX_RM_ABE_TIMER8_CONTEXT_OFFSET,
1270 .modulemode = MODULEMODE_SWCTRL,
1271 },
1272 },
1273};
1274
1275/* timer9 */
1276static struct omap_hwmod omap54xx_timer9_hwmod = {
1277 .name = "timer9",
1278 .class = &omap54xx_timer_hwmod_class,
1279 .clkdm_name = "l4per_clkdm",
1280 .main_clk = "timer9_gfclk_mux",
1281 .prcm = {
1282 .omap4 = {
1283 .clkctrl_offs = OMAP54XX_CM_L4PER_TIMER9_CLKCTRL_OFFSET,
1284 .context_offs = OMAP54XX_RM_L4PER_TIMER9_CONTEXT_OFFSET,
1285 .modulemode = MODULEMODE_SWCTRL,
1286 },
1287 },
1288};
1289
1290/* timer10 */
1291static struct omap_hwmod omap54xx_timer10_hwmod = {
1292 .name = "timer10",
1293 .class = &omap54xx_timer_1ms_hwmod_class,
1294 .clkdm_name = "l4per_clkdm",
1295 .main_clk = "timer10_gfclk_mux",
1296 .flags = HWMOD_SET_DEFAULT_CLOCKACT,
1297 .prcm = {
1298 .omap4 = {
1299 .clkctrl_offs = OMAP54XX_CM_L4PER_TIMER10_CLKCTRL_OFFSET,
1300 .context_offs = OMAP54XX_RM_L4PER_TIMER10_CONTEXT_OFFSET,
1301 .modulemode = MODULEMODE_SWCTRL,
1302 },
1303 },
1304};
1305
1306/* timer11 */
1307static struct omap_hwmod omap54xx_timer11_hwmod = {
1308 .name = "timer11",
1309 .class = &omap54xx_timer_hwmod_class,
1310 .clkdm_name = "l4per_clkdm",
1311 .main_clk = "timer11_gfclk_mux",
1312 .prcm = {
1313 .omap4 = {
1314 .clkctrl_offs = OMAP54XX_CM_L4PER_TIMER11_CLKCTRL_OFFSET,
1315 .context_offs = OMAP54XX_RM_L4PER_TIMER11_CONTEXT_OFFSET,
1316 .modulemode = MODULEMODE_SWCTRL,
1317 },
1318 },
1319};
1320
1321/*
1322 * 'uart' class
1323 * universal asynchronous receiver/transmitter (uart)
1324 */
1325
1326static struct omap_hwmod_class_sysconfig omap54xx_uart_sysc = {
1327 .rev_offs = 0x0050,
1328 .sysc_offs = 0x0054,
1329 .syss_offs = 0x0058,
1330 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
1331 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
1332 SYSS_HAS_RESET_STATUS),
1333 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1334 SIDLE_SMART_WKUP),
1335 .sysc_fields = &omap_hwmod_sysc_type1,
1336};
1337
1338static struct omap_hwmod_class omap54xx_uart_hwmod_class = {
1339 .name = "uart",
1340 .sysc = &omap54xx_uart_sysc,
1341};
1342
1343/* uart1 */
1344static struct omap_hwmod omap54xx_uart1_hwmod = {
1345 .name = "uart1",
1346 .class = &omap54xx_uart_hwmod_class,
1347 .clkdm_name = "l4per_clkdm",
1348 .main_clk = "func_48m_fclk",
1349 .prcm = {
1350 .omap4 = {
1351 .clkctrl_offs = OMAP54XX_CM_L4PER_UART1_CLKCTRL_OFFSET,
1352 .context_offs = OMAP54XX_RM_L4PER_UART1_CONTEXT_OFFSET,
1353 .modulemode = MODULEMODE_SWCTRL,
1354 },
1355 },
1356};
1357
1358/* uart2 */
1359static struct omap_hwmod omap54xx_uart2_hwmod = {
1360 .name = "uart2",
1361 .class = &omap54xx_uart_hwmod_class,
1362 .clkdm_name = "l4per_clkdm",
1363 .main_clk = "func_48m_fclk",
1364 .prcm = {
1365 .omap4 = {
1366 .clkctrl_offs = OMAP54XX_CM_L4PER_UART2_CLKCTRL_OFFSET,
1367 .context_offs = OMAP54XX_RM_L4PER_UART2_CONTEXT_OFFSET,
1368 .modulemode = MODULEMODE_SWCTRL,
1369 },
1370 },
1371};
1372
1373/* uart3 */
1374static struct omap_hwmod omap54xx_uart3_hwmod = {
1375 .name = "uart3",
1376 .class = &omap54xx_uart_hwmod_class,
1377 .clkdm_name = "l4per_clkdm",
1378 .flags = HWMOD_INIT_NO_IDLE | HWMOD_INIT_NO_RESET,
1379 .main_clk = "func_48m_fclk",
1380 .prcm = {
1381 .omap4 = {
1382 .clkctrl_offs = OMAP54XX_CM_L4PER_UART3_CLKCTRL_OFFSET,
1383 .context_offs = OMAP54XX_RM_L4PER_UART3_CONTEXT_OFFSET,
1384 .modulemode = MODULEMODE_SWCTRL,
1385 },
1386 },
1387};
1388
1389/* uart4 */
1390static struct omap_hwmod omap54xx_uart4_hwmod = {
1391 .name = "uart4",
1392 .class = &omap54xx_uart_hwmod_class,
1393 .clkdm_name = "l4per_clkdm",
1394 .main_clk = "func_48m_fclk",
1395 .prcm = {
1396 .omap4 = {
1397 .clkctrl_offs = OMAP54XX_CM_L4PER_UART4_CLKCTRL_OFFSET,
1398 .context_offs = OMAP54XX_RM_L4PER_UART4_CONTEXT_OFFSET,
1399 .modulemode = MODULEMODE_SWCTRL,
1400 },
1401 },
1402};
1403
1404/* uart5 */
1405static struct omap_hwmod omap54xx_uart5_hwmod = {
1406 .name = "uart5",
1407 .class = &omap54xx_uart_hwmod_class,
1408 .clkdm_name = "l4per_clkdm",
1409 .main_clk = "func_48m_fclk",
1410 .prcm = {
1411 .omap4 = {
1412 .clkctrl_offs = OMAP54XX_CM_L4PER_UART5_CLKCTRL_OFFSET,
1413 .context_offs = OMAP54XX_RM_L4PER_UART5_CONTEXT_OFFSET,
1414 .modulemode = MODULEMODE_SWCTRL,
1415 },
1416 },
1417};
1418
1419/* uart6 */
1420static struct omap_hwmod omap54xx_uart6_hwmod = {
1421 .name = "uart6",
1422 .class = &omap54xx_uart_hwmod_class,
1423 .clkdm_name = "l4per_clkdm",
1424 .main_clk = "func_48m_fclk",
1425 .prcm = {
1426 .omap4 = {
1427 .clkctrl_offs = OMAP54XX_CM_L4PER_UART6_CLKCTRL_OFFSET,
1428 .context_offs = OMAP54XX_RM_L4PER_UART6_CONTEXT_OFFSET,
1429 .modulemode = MODULEMODE_SWCTRL,
1430 },
1431 },
1432};
1433
1434/*
1435 * 'usb_otg_ss' class
1436 * 2.0 super speed (usb_otg_ss) controller
1437 */
1438
1439static struct omap_hwmod_class_sysconfig omap54xx_usb_otg_ss_sysc = {
1440 .rev_offs = 0x0000,
1441 .sysc_offs = 0x0010,
1442 .sysc_flags = (SYSC_HAS_DMADISABLE | SYSC_HAS_MIDLEMODE |
1443 SYSC_HAS_SIDLEMODE),
1444 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1445 SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
1446 MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
1447 .sysc_fields = &omap_hwmod_sysc_type2,
1448};
1449
1450static struct omap_hwmod_class omap54xx_usb_otg_ss_hwmod_class = {
1451 .name = "usb_otg_ss",
1452 .sysc = &omap54xx_usb_otg_ss_sysc,
1453};
1454
1455/* usb_otg_ss */
1456static struct omap_hwmod_opt_clk usb_otg_ss_opt_clks[] = {
1457 { .role = "refclk960m", .clk = "usb_otg_ss_refclk960m" },
1458};
1459
1460static struct omap_hwmod omap54xx_usb_otg_ss_hwmod = {
1461 .name = "usb_otg_ss",
1462 .class = &omap54xx_usb_otg_ss_hwmod_class,
1463 .clkdm_name = "l3init_clkdm",
1464 .flags = HWMOD_SWSUP_SIDLE,
1465 .main_clk = "dpll_core_h13x2_ck",
1466 .prcm = {
1467 .omap4 = {
1468 .clkctrl_offs = OMAP54XX_CM_L3INIT_USB_OTG_SS_CLKCTRL_OFFSET,
1469 .context_offs = OMAP54XX_RM_L3INIT_USB_OTG_SS_CONTEXT_OFFSET,
1470 .modulemode = MODULEMODE_HWCTRL,
1471 },
1472 },
1473 .opt_clks = usb_otg_ss_opt_clks,
1474 .opt_clks_cnt = ARRAY_SIZE(usb_otg_ss_opt_clks),
1475};
1476
1477/*
1478 * 'wd_timer' class
1479 * 32-bit watchdog upward counter that generates a pulse on the reset pin on
1480 * overflow condition
1481 */
1482
1483static struct omap_hwmod_class_sysconfig omap54xx_wd_timer_sysc = {
1484 .rev_offs = 0x0000,
1485 .sysc_offs = 0x0010,
1486 .syss_offs = 0x0014,
1487 .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SIDLEMODE |
1488 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS),
1489 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
1490 SIDLE_SMART_WKUP),
1491 .sysc_fields = &omap_hwmod_sysc_type1,
1492};
1493
1494static struct omap_hwmod_class omap54xx_wd_timer_hwmod_class = {
1495 .name = "wd_timer",
1496 .sysc = &omap54xx_wd_timer_sysc,
1497 .pre_shutdown = &omap2_wd_timer_disable,
1498};
1499
1500/* wd_timer2 */
1501static struct omap_hwmod omap54xx_wd_timer2_hwmod = {
1502 .name = "wd_timer2",
1503 .class = &omap54xx_wd_timer_hwmod_class,
1504 .clkdm_name = "wkupaon_clkdm",
1505 .main_clk = "sys_32k_ck",
1506 .prcm = {
1507 .omap4 = {
1508 .clkctrl_offs = OMAP54XX_CM_WKUPAON_WD_TIMER2_CLKCTRL_OFFSET,
1509 .context_offs = OMAP54XX_RM_WKUPAON_WD_TIMER2_CONTEXT_OFFSET,
1510 .modulemode = MODULEMODE_SWCTRL,
1511 },
1512 },
1513};
1514
1515
1516/*
1517 * Interfaces
1518 */
1519
1520/* l3_main_1 -> dmm */
1521static struct omap_hwmod_ocp_if omap54xx_l3_main_1__dmm = {
1522 .master = &omap54xx_l3_main_1_hwmod,
1523 .slave = &omap54xx_dmm_hwmod,
1524 .clk = "l3_iclk_div",
1525 .user = OCP_USER_SDMA,
1526};
1527
1528/* l3_main_3 -> l3_instr */
1529static struct omap_hwmod_ocp_if omap54xx_l3_main_3__l3_instr = {
1530 .master = &omap54xx_l3_main_3_hwmod,
1531 .slave = &omap54xx_l3_instr_hwmod,
1532 .clk = "l3_iclk_div",
1533 .user = OCP_USER_MPU | OCP_USER_SDMA,
1534};
1535
1536/* l3_main_2 -> l3_main_1 */
1537static struct omap_hwmod_ocp_if omap54xx_l3_main_2__l3_main_1 = {
1538 .master = &omap54xx_l3_main_2_hwmod,
1539 .slave = &omap54xx_l3_main_1_hwmod,
1540 .clk = "l3_iclk_div",
1541 .user = OCP_USER_MPU | OCP_USER_SDMA,
1542};
1543
1544/* l4_cfg -> l3_main_1 */
1545static struct omap_hwmod_ocp_if omap54xx_l4_cfg__l3_main_1 = {
1546 .master = &omap54xx_l4_cfg_hwmod,
1547 .slave = &omap54xx_l3_main_1_hwmod,
1548 .clk = "l3_iclk_div",
1549 .user = OCP_USER_MPU | OCP_USER_SDMA,
1550};
1551
1552/* mpu -> l3_main_1 */
1553static struct omap_hwmod_ocp_if omap54xx_mpu__l3_main_1 = {
1554 .master = &omap54xx_mpu_hwmod,
1555 .slave = &omap54xx_l3_main_1_hwmod,
1556 .clk = "l3_iclk_div",
1557 .user = OCP_USER_MPU,
1558};
1559
1560/* l3_main_1 -> l3_main_2 */
1561static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l3_main_2 = {
1562 .master = &omap54xx_l3_main_1_hwmod,
1563 .slave = &omap54xx_l3_main_2_hwmod,
1564 .clk = "l3_iclk_div",
1565 .user = OCP_USER_MPU,
1566};
1567
1568/* l4_cfg -> l3_main_2 */
1569static struct omap_hwmod_ocp_if omap54xx_l4_cfg__l3_main_2 = {
1570 .master = &omap54xx_l4_cfg_hwmod,
1571 .slave = &omap54xx_l3_main_2_hwmod,
1572 .clk = "l3_iclk_div",
1573 .user = OCP_USER_MPU | OCP_USER_SDMA,
1574};
1575
1576/* l3_main_1 -> l3_main_3 */
1577static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l3_main_3 = {
1578 .master = &omap54xx_l3_main_1_hwmod,
1579 .slave = &omap54xx_l3_main_3_hwmod,
1580 .clk = "l3_iclk_div",
1581 .user = OCP_USER_MPU,
1582};
1583
1584/* l3_main_2 -> l3_main_3 */
1585static struct omap_hwmod_ocp_if omap54xx_l3_main_2__l3_main_3 = {
1586 .master = &omap54xx_l3_main_2_hwmod,
1587 .slave = &omap54xx_l3_main_3_hwmod,
1588 .clk = "l3_iclk_div",
1589 .user = OCP_USER_MPU | OCP_USER_SDMA,
1590};
1591
1592/* l4_cfg -> l3_main_3 */
1593static struct omap_hwmod_ocp_if omap54xx_l4_cfg__l3_main_3 = {
1594 .master = &omap54xx_l4_cfg_hwmod,
1595 .slave = &omap54xx_l3_main_3_hwmod,
1596 .clk = "l3_iclk_div",
1597 .user = OCP_USER_MPU | OCP_USER_SDMA,
1598};
1599
1600/* l3_main_1 -> l4_abe */
1601static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_abe = {
1602 .master = &omap54xx_l3_main_1_hwmod,
1603 .slave = &omap54xx_l4_abe_hwmod,
1604 .clk = "abe_iclk",
1605 .user = OCP_USER_MPU | OCP_USER_SDMA,
1606};
1607
1608/* mpu -> l4_abe */
1609static struct omap_hwmod_ocp_if omap54xx_mpu__l4_abe = {
1610 .master = &omap54xx_mpu_hwmod,
1611 .slave = &omap54xx_l4_abe_hwmod,
1612 .clk = "abe_iclk",
1613 .user = OCP_USER_MPU | OCP_USER_SDMA,
1614};
1615
1616/* l3_main_1 -> l4_cfg */
1617static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_cfg = {
1618 .master = &omap54xx_l3_main_1_hwmod,
1619 .slave = &omap54xx_l4_cfg_hwmod,
1620 .clk = "l4_root_clk_div",
1621 .user = OCP_USER_MPU | OCP_USER_SDMA,
1622};
1623
1624/* l3_main_2 -> l4_per */
1625static struct omap_hwmod_ocp_if omap54xx_l3_main_2__l4_per = {
1626 .master = &omap54xx_l3_main_2_hwmod,
1627 .slave = &omap54xx_l4_per_hwmod,
1628 .clk = "l4_root_clk_div",
1629 .user = OCP_USER_MPU | OCP_USER_SDMA,
1630};
1631
1632/* l3_main_1 -> l4_wkup */
1633static struct omap_hwmod_ocp_if omap54xx_l3_main_1__l4_wkup = {
1634 .master = &omap54xx_l3_main_1_hwmod,
1635 .slave = &omap54xx_l4_wkup_hwmod,
1636 .clk = "wkupaon_iclk_mux",
1637 .user = OCP_USER_MPU | OCP_USER_SDMA,
1638};
1639
1640/* mpu -> mpu_private */
1641static struct omap_hwmod_ocp_if omap54xx_mpu__mpu_private = {
1642 .master = &omap54xx_mpu_hwmod,
1643 .slave = &omap54xx_mpu_private_hwmod,
1644 .clk = "l3_iclk_div",
1645 .user = OCP_USER_MPU | OCP_USER_SDMA,
1646};
1647
1648/* l4_wkup -> counter_32k */
1649static struct omap_hwmod_ocp_if omap54xx_l4_wkup__counter_32k = {
1650 .master = &omap54xx_l4_wkup_hwmod,
1651 .slave = &omap54xx_counter_32k_hwmod,
1652 .clk = "wkupaon_iclk_mux",
1653 .user = OCP_USER_MPU | OCP_USER_SDMA,
1654};
1655
1656static struct omap_hwmod_addr_space omap54xx_dma_system_addrs[] = {
1657 {
1658 .pa_start = 0x4a056000,
1659 .pa_end = 0x4a056fff,
1660 .flags = ADDR_TYPE_RT
1661 },
1662 { }
1663};
1664
1665/* l4_cfg -> dma_system */
1666static struct omap_hwmod_ocp_if omap54xx_l4_cfg__dma_system = {
1667 .master = &omap54xx_l4_cfg_hwmod,
1668 .slave = &omap54xx_dma_system_hwmod,
1669 .clk = "l4_root_clk_div",
1670 .addr = omap54xx_dma_system_addrs,
1671 .user = OCP_USER_MPU | OCP_USER_SDMA,
1672};
1673
1674/* l4_abe -> dmic */
1675static struct omap_hwmod_ocp_if omap54xx_l4_abe__dmic = {
1676 .master = &omap54xx_l4_abe_hwmod,
1677 .slave = &omap54xx_dmic_hwmod,
1678 .clk = "abe_iclk",
1679 .user = OCP_USER_MPU,
1680};
1681
1682/* mpu -> emif1 */
1683static struct omap_hwmod_ocp_if omap54xx_mpu__emif1 = {
1684 .master = &omap54xx_mpu_hwmod,
1685 .slave = &omap54xx_emif1_hwmod,
1686 .clk = "dpll_core_h11x2_ck",
1687 .user = OCP_USER_MPU | OCP_USER_SDMA,
1688};
1689
1690/* mpu -> emif2 */
1691static struct omap_hwmod_ocp_if omap54xx_mpu__emif2 = {
1692 .master = &omap54xx_mpu_hwmod,
1693 .slave = &omap54xx_emif2_hwmod,
1694 .clk = "dpll_core_h11x2_ck",
1695 .user = OCP_USER_MPU | OCP_USER_SDMA,
1696};
1697
1698/* l4_wkup -> gpio1 */
1699static struct omap_hwmod_ocp_if omap54xx_l4_wkup__gpio1 = {
1700 .master = &omap54xx_l4_wkup_hwmod,
1701 .slave = &omap54xx_gpio1_hwmod,
1702 .clk = "wkupaon_iclk_mux",
1703 .user = OCP_USER_MPU | OCP_USER_SDMA,
1704};
1705
1706/* l4_per -> gpio2 */
1707static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio2 = {
1708 .master = &omap54xx_l4_per_hwmod,
1709 .slave = &omap54xx_gpio2_hwmod,
1710 .clk = "l4_root_clk_div",
1711 .user = OCP_USER_MPU | OCP_USER_SDMA,
1712};
1713
1714/* l4_per -> gpio3 */
1715static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio3 = {
1716 .master = &omap54xx_l4_per_hwmod,
1717 .slave = &omap54xx_gpio3_hwmod,
1718 .clk = "l4_root_clk_div",
1719 .user = OCP_USER_MPU | OCP_USER_SDMA,
1720};
1721
1722/* l4_per -> gpio4 */
1723static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio4 = {
1724 .master = &omap54xx_l4_per_hwmod,
1725 .slave = &omap54xx_gpio4_hwmod,
1726 .clk = "l4_root_clk_div",
1727 .user = OCP_USER_MPU | OCP_USER_SDMA,
1728};
1729
1730/* l4_per -> gpio5 */
1731static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio5 = {
1732 .master = &omap54xx_l4_per_hwmod,
1733 .slave = &omap54xx_gpio5_hwmod,
1734 .clk = "l4_root_clk_div",
1735 .user = OCP_USER_MPU | OCP_USER_SDMA,
1736};
1737
1738/* l4_per -> gpio6 */
1739static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio6 = {
1740 .master = &omap54xx_l4_per_hwmod,
1741 .slave = &omap54xx_gpio6_hwmod,
1742 .clk = "l4_root_clk_div",
1743 .user = OCP_USER_MPU | OCP_USER_SDMA,
1744};
1745
1746/* l4_per -> gpio7 */
1747static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio7 = {
1748 .master = &omap54xx_l4_per_hwmod,
1749 .slave = &omap54xx_gpio7_hwmod,
1750 .clk = "l4_root_clk_div",
1751 .user = OCP_USER_MPU | OCP_USER_SDMA,
1752};
1753
1754/* l4_per -> gpio8 */
1755static struct omap_hwmod_ocp_if omap54xx_l4_per__gpio8 = {
1756 .master = &omap54xx_l4_per_hwmod,
1757 .slave = &omap54xx_gpio8_hwmod,
1758 .clk = "l4_root_clk_div",
1759 .user = OCP_USER_MPU | OCP_USER_SDMA,
1760};
1761
1762/* l4_per -> i2c1 */
1763static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c1 = {
1764 .master = &omap54xx_l4_per_hwmod,
1765 .slave = &omap54xx_i2c1_hwmod,
1766 .clk = "l4_root_clk_div",
1767 .user = OCP_USER_MPU | OCP_USER_SDMA,
1768};
1769
1770/* l4_per -> i2c2 */
1771static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c2 = {
1772 .master = &omap54xx_l4_per_hwmod,
1773 .slave = &omap54xx_i2c2_hwmod,
1774 .clk = "l4_root_clk_div",
1775 .user = OCP_USER_MPU | OCP_USER_SDMA,
1776};
1777
1778/* l4_per -> i2c3 */
1779static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c3 = {
1780 .master = &omap54xx_l4_per_hwmod,
1781 .slave = &omap54xx_i2c3_hwmod,
1782 .clk = "l4_root_clk_div",
1783 .user = OCP_USER_MPU | OCP_USER_SDMA,
1784};
1785
1786/* l4_per -> i2c4 */
1787static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c4 = {
1788 .master = &omap54xx_l4_per_hwmod,
1789 .slave = &omap54xx_i2c4_hwmod,
1790 .clk = "l4_root_clk_div",
1791 .user = OCP_USER_MPU | OCP_USER_SDMA,
1792};
1793
1794/* l4_per -> i2c5 */
1795static struct omap_hwmod_ocp_if omap54xx_l4_per__i2c5 = {
1796 .master = &omap54xx_l4_per_hwmod,
1797 .slave = &omap54xx_i2c5_hwmod,
1798 .clk = "l4_root_clk_div",
1799 .user = OCP_USER_MPU | OCP_USER_SDMA,
1800};
1801
1802/* l4_wkup -> kbd */
1803static struct omap_hwmod_ocp_if omap54xx_l4_wkup__kbd = {
1804 .master = &omap54xx_l4_wkup_hwmod,
1805 .slave = &omap54xx_kbd_hwmod,
1806 .clk = "wkupaon_iclk_mux",
1807 .user = OCP_USER_MPU | OCP_USER_SDMA,
1808};
1809
1810/* l4_abe -> mcbsp1 */
1811static struct omap_hwmod_ocp_if omap54xx_l4_abe__mcbsp1 = {
1812 .master = &omap54xx_l4_abe_hwmod,
1813 .slave = &omap54xx_mcbsp1_hwmod,
1814 .clk = "abe_iclk",
1815 .user = OCP_USER_MPU,
1816};
1817
1818/* l4_abe -> mcbsp2 */
1819static struct omap_hwmod_ocp_if omap54xx_l4_abe__mcbsp2 = {
1820 .master = &omap54xx_l4_abe_hwmod,
1821 .slave = &omap54xx_mcbsp2_hwmod,
1822 .clk = "abe_iclk",
1823 .user = OCP_USER_MPU,
1824};
1825
1826/* l4_abe -> mcbsp3 */
1827static struct omap_hwmod_ocp_if omap54xx_l4_abe__mcbsp3 = {
1828 .master = &omap54xx_l4_abe_hwmod,
1829 .slave = &omap54xx_mcbsp3_hwmod,
1830 .clk = "abe_iclk",
1831 .user = OCP_USER_MPU,
1832};
1833
1834/* l4_abe -> mcpdm */
1835static struct omap_hwmod_ocp_if omap54xx_l4_abe__mcpdm = {
1836 .master = &omap54xx_l4_abe_hwmod,
1837 .slave = &omap54xx_mcpdm_hwmod,
1838 .clk = "abe_iclk",
1839 .user = OCP_USER_MPU,
1840};
1841
1842/* l4_per -> mcspi1 */
1843static struct omap_hwmod_ocp_if omap54xx_l4_per__mcspi1 = {
1844 .master = &omap54xx_l4_per_hwmod,
1845 .slave = &omap54xx_mcspi1_hwmod,
1846 .clk = "l4_root_clk_div",
1847 .user = OCP_USER_MPU | OCP_USER_SDMA,
1848};
1849
1850/* l4_per -> mcspi2 */
1851static struct omap_hwmod_ocp_if omap54xx_l4_per__mcspi2 = {
1852 .master = &omap54xx_l4_per_hwmod,
1853 .slave = &omap54xx_mcspi2_hwmod,
1854 .clk = "l4_root_clk_div",
1855 .user = OCP_USER_MPU | OCP_USER_SDMA,
1856};
1857
1858/* l4_per -> mcspi3 */
1859static struct omap_hwmod_ocp_if omap54xx_l4_per__mcspi3 = {
1860 .master = &omap54xx_l4_per_hwmod,
1861 .slave = &omap54xx_mcspi3_hwmod,
1862 .clk = "l4_root_clk_div",
1863 .user = OCP_USER_MPU | OCP_USER_SDMA,
1864};
1865
1866/* l4_per -> mcspi4 */
1867static struct omap_hwmod_ocp_if omap54xx_l4_per__mcspi4 = {
1868 .master = &omap54xx_l4_per_hwmod,
1869 .slave = &omap54xx_mcspi4_hwmod,
1870 .clk = "l4_root_clk_div",
1871 .user = OCP_USER_MPU | OCP_USER_SDMA,
1872};
1873
1874/* l4_per -> mmc1 */
1875static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc1 = {
1876 .master = &omap54xx_l4_per_hwmod,
1877 .slave = &omap54xx_mmc1_hwmod,
1878 .clk = "l3_iclk_div",
1879 .user = OCP_USER_MPU | OCP_USER_SDMA,
1880};
1881
1882/* l4_per -> mmc2 */
1883static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc2 = {
1884 .master = &omap54xx_l4_per_hwmod,
1885 .slave = &omap54xx_mmc2_hwmod,
1886 .clk = "l3_iclk_div",
1887 .user = OCP_USER_MPU | OCP_USER_SDMA,
1888};
1889
1890/* l4_per -> mmc3 */
1891static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc3 = {
1892 .master = &omap54xx_l4_per_hwmod,
1893 .slave = &omap54xx_mmc3_hwmod,
1894 .clk = "l4_root_clk_div",
1895 .user = OCP_USER_MPU | OCP_USER_SDMA,
1896};
1897
1898/* l4_per -> mmc4 */
1899static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc4 = {
1900 .master = &omap54xx_l4_per_hwmod,
1901 .slave = &omap54xx_mmc4_hwmod,
1902 .clk = "l4_root_clk_div",
1903 .user = OCP_USER_MPU | OCP_USER_SDMA,
1904};
1905
1906/* l4_per -> mmc5 */
1907static struct omap_hwmod_ocp_if omap54xx_l4_per__mmc5 = {
1908 .master = &omap54xx_l4_per_hwmod,
1909 .slave = &omap54xx_mmc5_hwmod,
1910 .clk = "l4_root_clk_div",
1911 .user = OCP_USER_MPU | OCP_USER_SDMA,
1912};
1913
1914/* l4_cfg -> mpu */
1915static struct omap_hwmod_ocp_if omap54xx_l4_cfg__mpu = {
1916 .master = &omap54xx_l4_cfg_hwmod,
1917 .slave = &omap54xx_mpu_hwmod,
1918 .clk = "l4_root_clk_div",
1919 .user = OCP_USER_MPU | OCP_USER_SDMA,
1920};
1921
1922/* l4_wkup -> timer1 */
1923static struct omap_hwmod_ocp_if omap54xx_l4_wkup__timer1 = {
1924 .master = &omap54xx_l4_wkup_hwmod,
1925 .slave = &omap54xx_timer1_hwmod,
1926 .clk = "wkupaon_iclk_mux",
1927 .user = OCP_USER_MPU | OCP_USER_SDMA,
1928};
1929
1930/* l4_per -> timer2 */
1931static struct omap_hwmod_ocp_if omap54xx_l4_per__timer2 = {
1932 .master = &omap54xx_l4_per_hwmod,
1933 .slave = &omap54xx_timer2_hwmod,
1934 .clk = "l4_root_clk_div",
1935 .user = OCP_USER_MPU | OCP_USER_SDMA,
1936};
1937
1938/* l4_per -> timer3 */
1939static struct omap_hwmod_ocp_if omap54xx_l4_per__timer3 = {
1940 .master = &omap54xx_l4_per_hwmod,
1941 .slave = &omap54xx_timer3_hwmod,
1942 .clk = "l4_root_clk_div",
1943 .user = OCP_USER_MPU | OCP_USER_SDMA,
1944};
1945
1946/* l4_per -> timer4 */
1947static struct omap_hwmod_ocp_if omap54xx_l4_per__timer4 = {
1948 .master = &omap54xx_l4_per_hwmod,
1949 .slave = &omap54xx_timer4_hwmod,
1950 .clk = "l4_root_clk_div",
1951 .user = OCP_USER_MPU | OCP_USER_SDMA,
1952};
1953
1954/* l4_abe -> timer5 */
1955static struct omap_hwmod_ocp_if omap54xx_l4_abe__timer5 = {
1956 .master = &omap54xx_l4_abe_hwmod,
1957 .slave = &omap54xx_timer5_hwmod,
1958 .clk = "abe_iclk",
1959 .user = OCP_USER_MPU,
1960};
1961
1962/* l4_abe -> timer6 */
1963static struct omap_hwmod_ocp_if omap54xx_l4_abe__timer6 = {
1964 .master = &omap54xx_l4_abe_hwmod,
1965 .slave = &omap54xx_timer6_hwmod,
1966 .clk = "abe_iclk",
1967 .user = OCP_USER_MPU,
1968};
1969
1970/* l4_abe -> timer7 */
1971static struct omap_hwmod_ocp_if omap54xx_l4_abe__timer7 = {
1972 .master = &omap54xx_l4_abe_hwmod,
1973 .slave = &omap54xx_timer7_hwmod,
1974 .clk = "abe_iclk",
1975 .user = OCP_USER_MPU,
1976};
1977
1978/* l4_abe -> timer8 */
1979static struct omap_hwmod_ocp_if omap54xx_l4_abe__timer8 = {
1980 .master = &omap54xx_l4_abe_hwmod,
1981 .slave = &omap54xx_timer8_hwmod,
1982 .clk = "abe_iclk",
1983 .user = OCP_USER_MPU,
1984};
1985
1986/* l4_per -> timer9 */
1987static struct omap_hwmod_ocp_if omap54xx_l4_per__timer9 = {
1988 .master = &omap54xx_l4_per_hwmod,
1989 .slave = &omap54xx_timer9_hwmod,
1990 .clk = "l4_root_clk_div",
1991 .user = OCP_USER_MPU | OCP_USER_SDMA,
1992};
1993
1994/* l4_per -> timer10 */
1995static struct omap_hwmod_ocp_if omap54xx_l4_per__timer10 = {
1996 .master = &omap54xx_l4_per_hwmod,
1997 .slave = &omap54xx_timer10_hwmod,
1998 .clk = "l4_root_clk_div",
1999 .user = OCP_USER_MPU | OCP_USER_SDMA,
2000};
2001
2002/* l4_per -> timer11 */
2003static struct omap_hwmod_ocp_if omap54xx_l4_per__timer11 = {
2004 .master = &omap54xx_l4_per_hwmod,
2005 .slave = &omap54xx_timer11_hwmod,
2006 .clk = "l4_root_clk_div",
2007 .user = OCP_USER_MPU | OCP_USER_SDMA,
2008};
2009
2010/* l4_per -> uart1 */
2011static struct omap_hwmod_ocp_if omap54xx_l4_per__uart1 = {
2012 .master = &omap54xx_l4_per_hwmod,
2013 .slave = &omap54xx_uart1_hwmod,
2014 .clk = "l4_root_clk_div",
2015 .user = OCP_USER_MPU | OCP_USER_SDMA,
2016};
2017
2018/* l4_per -> uart2 */
2019static struct omap_hwmod_ocp_if omap54xx_l4_per__uart2 = {
2020 .master = &omap54xx_l4_per_hwmod,
2021 .slave = &omap54xx_uart2_hwmod,
2022 .clk = "l4_root_clk_div",
2023 .user = OCP_USER_MPU | OCP_USER_SDMA,
2024};
2025
2026/* l4_per -> uart3 */
2027static struct omap_hwmod_ocp_if omap54xx_l4_per__uart3 = {
2028 .master = &omap54xx_l4_per_hwmod,
2029 .slave = &omap54xx_uart3_hwmod,
2030 .clk = "l4_root_clk_div",
2031 .user = OCP_USER_MPU | OCP_USER_SDMA,
2032};
2033
2034/* l4_per -> uart4 */
2035static struct omap_hwmod_ocp_if omap54xx_l4_per__uart4 = {
2036 .master = &omap54xx_l4_per_hwmod,
2037 .slave = &omap54xx_uart4_hwmod,
2038 .clk = "l4_root_clk_div",
2039 .user = OCP_USER_MPU | OCP_USER_SDMA,
2040};
2041
2042/* l4_per -> uart5 */
2043static struct omap_hwmod_ocp_if omap54xx_l4_per__uart5 = {
2044 .master = &omap54xx_l4_per_hwmod,
2045 .slave = &omap54xx_uart5_hwmod,
2046 .clk = "l4_root_clk_div",
2047 .user = OCP_USER_MPU | OCP_USER_SDMA,
2048};
2049
2050/* l4_per -> uart6 */
2051static struct omap_hwmod_ocp_if omap54xx_l4_per__uart6 = {
2052 .master = &omap54xx_l4_per_hwmod,
2053 .slave = &omap54xx_uart6_hwmod,
2054 .clk = "l4_root_clk_div",
2055 .user = OCP_USER_MPU | OCP_USER_SDMA,
2056};
2057
2058/* l4_cfg -> usb_otg_ss */
2059static struct omap_hwmod_ocp_if omap54xx_l4_cfg__usb_otg_ss = {
2060 .master = &omap54xx_l4_cfg_hwmod,
2061 .slave = &omap54xx_usb_otg_ss_hwmod,
2062 .clk = "dpll_core_h13x2_ck",
2063 .user = OCP_USER_MPU | OCP_USER_SDMA,
2064};
2065
2066/* l4_wkup -> wd_timer2 */
2067static struct omap_hwmod_ocp_if omap54xx_l4_wkup__wd_timer2 = {
2068 .master = &omap54xx_l4_wkup_hwmod,
2069 .slave = &omap54xx_wd_timer2_hwmod,
2070 .clk = "wkupaon_iclk_mux",
2071 .user = OCP_USER_MPU | OCP_USER_SDMA,
2072};
2073
2074static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
2075 &omap54xx_l3_main_1__dmm,
2076 &omap54xx_l3_main_3__l3_instr,
2077 &omap54xx_l3_main_2__l3_main_1,
2078 &omap54xx_l4_cfg__l3_main_1,
2079 &omap54xx_mpu__l3_main_1,
2080 &omap54xx_l3_main_1__l3_main_2,
2081 &omap54xx_l4_cfg__l3_main_2,
2082 &omap54xx_l3_main_1__l3_main_3,
2083 &omap54xx_l3_main_2__l3_main_3,
2084 &omap54xx_l4_cfg__l3_main_3,
2085 &omap54xx_l3_main_1__l4_abe,
2086 &omap54xx_mpu__l4_abe,
2087 &omap54xx_l3_main_1__l4_cfg,
2088 &omap54xx_l3_main_2__l4_per,
2089 &omap54xx_l3_main_1__l4_wkup,
2090 &omap54xx_mpu__mpu_private,
2091 &omap54xx_l4_wkup__counter_32k,
2092 &omap54xx_l4_cfg__dma_system,
2093 &omap54xx_l4_abe__dmic,
2094 &omap54xx_mpu__emif1,
2095 &omap54xx_mpu__emif2,
2096 &omap54xx_l4_wkup__gpio1,
2097 &omap54xx_l4_per__gpio2,
2098 &omap54xx_l4_per__gpio3,
2099 &omap54xx_l4_per__gpio4,
2100 &omap54xx_l4_per__gpio5,
2101 &omap54xx_l4_per__gpio6,
2102 &omap54xx_l4_per__gpio7,
2103 &omap54xx_l4_per__gpio8,
2104 &omap54xx_l4_per__i2c1,
2105 &omap54xx_l4_per__i2c2,
2106 &omap54xx_l4_per__i2c3,
2107 &omap54xx_l4_per__i2c4,
2108 &omap54xx_l4_per__i2c5,
2109 &omap54xx_l4_wkup__kbd,
2110 &omap54xx_l4_abe__mcbsp1,
2111 &omap54xx_l4_abe__mcbsp2,
2112 &omap54xx_l4_abe__mcbsp3,
2113 &omap54xx_l4_abe__mcpdm,
2114 &omap54xx_l4_per__mcspi1,
2115 &omap54xx_l4_per__mcspi2,
2116 &omap54xx_l4_per__mcspi3,
2117 &omap54xx_l4_per__mcspi4,
2118 &omap54xx_l4_per__mmc1,
2119 &omap54xx_l4_per__mmc2,
2120 &omap54xx_l4_per__mmc3,
2121 &omap54xx_l4_per__mmc4,
2122 &omap54xx_l4_per__mmc5,
2123 &omap54xx_l4_cfg__mpu,
2124 &omap54xx_l4_wkup__timer1,
2125 &omap54xx_l4_per__timer2,
2126 &omap54xx_l4_per__timer3,
2127 &omap54xx_l4_per__timer4,
2128 &omap54xx_l4_abe__timer5,
2129 &omap54xx_l4_abe__timer6,
2130 &omap54xx_l4_abe__timer7,
2131 &omap54xx_l4_abe__timer8,
2132 &omap54xx_l4_per__timer9,
2133 &omap54xx_l4_per__timer10,
2134 &omap54xx_l4_per__timer11,
2135 &omap54xx_l4_per__uart1,
2136 &omap54xx_l4_per__uart2,
2137 &omap54xx_l4_per__uart3,
2138 &omap54xx_l4_per__uart4,
2139 &omap54xx_l4_per__uart5,
2140 &omap54xx_l4_per__uart6,
2141 &omap54xx_l4_cfg__usb_otg_ss,
2142 &omap54xx_l4_wkup__wd_timer2,
2143 NULL,
2144};
2145
2146int __init omap54xx_hwmod_init(void)
2147{
2148 omap_hwmod_init();
2149 return omap_hwmod_register_links(omap54xx_hwmod_ocp_ifs);
2150}
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index c01859398b54..5a2d8034c8de 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -546,8 +546,10 @@ static void __init prcm_setup_regs(void)
546 /* Clear any pending PRCM interrupts */ 546 /* Clear any pending PRCM interrupts */
547 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); 547 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
548 548
549 if (omap3_has_iva()) 549 /*
550 omap3_iva_idle(); 550 * We need to idle iva2_pwrdm even on am3703 with no iva2.
551 */
552 omap3_iva_idle();
551 553
552 omap3_d2d_idle(); 554 omap3_d2d_idle();
553} 555}
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index a251f87fa2a2..82f0698933d8 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 Power Management Routines 2 * OMAP4+ Power Management Routines
3 * 3 *
4 * Copyright (C) 2010-2011 Texas Instruments, Inc. 4 * Copyright (C) 2010-2013 Texas Instruments, Inc.
5 * Rajendra Nayak <rnayak@ti.com> 5 * Rajendra Nayak <rnayak@ti.com>
6 * Santosh Shilimkar <santosh.shilimkar@ti.com> 6 * Santosh Shilimkar <santosh.shilimkar@ti.com>
7 * 7 *
@@ -135,16 +135,16 @@ static void omap_default_idle(void)
135} 135}
136 136
137/** 137/**
138 * omap4_pm_init - Init routine for OMAP4 PM 138 * omap4_init_static_deps - Add OMAP4 static dependencies
139 * 139 *
140 * Initializes all powerdomain and clockdomain target states 140 * Add needed static clockdomain dependencies on OMAP4 devices.
141 * and all PRCM settings. 141 * Return: 0 on success or 'err' on failures
142 */ 142 */
143int __init omap4_pm_init(void) 143static inline int omap4_init_static_deps(void)
144{ 144{
145 int ret;
146 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm; 145 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm;
147 struct clockdomain *ducati_clkdm, *l3_2_clkdm; 146 struct clockdomain *ducati_clkdm, *l3_2_clkdm;
147 int ret = 0;
148 148
149 if (omap_rev() == OMAP4430_REV_ES1_0) { 149 if (omap_rev() == OMAP4430_REV_ES1_0) {
150 WARN(1, "Power Management not supported on OMAP4430 ES1.0\n"); 150 WARN(1, "Power Management not supported on OMAP4430 ES1.0\n");
@@ -163,7 +163,7 @@ int __init omap4_pm_init(void)
163 ret = pwrdm_for_each(pwrdms_setup, NULL); 163 ret = pwrdm_for_each(pwrdms_setup, NULL);
164 if (ret) { 164 if (ret) {
165 pr_err("Failed to setup powerdomains\n"); 165 pr_err("Failed to setup powerdomains\n");
166 goto err2; 166 return ret;
167 } 167 }
168 168
169 /* 169 /*
@@ -171,6 +171,10 @@ int __init omap4_pm_init(void)
171 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as 171 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
172 * expected. The hardware recommendation is to enable static 172 * expected. The hardware recommendation is to enable static
173 * dependencies for these to avoid system lock ups or random crashes. 173 * dependencies for these to avoid system lock ups or random crashes.
174 * The L4 wakeup depedency is added to workaround the OCP sync hardware
175 * BUG with 32K synctimer which lead to incorrect timer value read
176 * from the 32K counter. The BUG applies for GPTIMER1 and WDT2 which
177 * are part of L4 wakeup clockdomain.
174 */ 178 */
175 mpuss_clkdm = clkdm_lookup("mpuss_clkdm"); 179 mpuss_clkdm = clkdm_lookup("mpuss_clkdm");
176 emif_clkdm = clkdm_lookup("l3_emif_clkdm"); 180 emif_clkdm = clkdm_lookup("l3_emif_clkdm");
@@ -179,7 +183,7 @@ int __init omap4_pm_init(void)
179 ducati_clkdm = clkdm_lookup("ducati_clkdm"); 183 ducati_clkdm = clkdm_lookup("ducati_clkdm");
180 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) || 184 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) ||
181 (!l3_2_clkdm) || (!ducati_clkdm)) 185 (!l3_2_clkdm) || (!ducati_clkdm))
182 goto err2; 186 return -EINVAL;
183 187
184 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm); 188 ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm);
185 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm); 189 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm);
@@ -188,9 +192,42 @@ int __init omap4_pm_init(void)
188 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm); 192 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm);
189 if (ret) { 193 if (ret) {
190 pr_err("Failed to add MPUSS -> L3/EMIF/L4PER, DUCATI -> L3 wakeup dependency\n"); 194 pr_err("Failed to add MPUSS -> L3/EMIF/L4PER, DUCATI -> L3 wakeup dependency\n");
195 return -EINVAL;
196 }
197
198 return ret;
199}
200
201/**
202 * omap4_pm_init - Init routine for OMAP4+ devices
203 *
204 * Initializes all powerdomain and clockdomain target states
205 * and all PRCM settings.
206 * Return: Returns the error code returned by called functions.
207 */
208int __init omap4_pm_init(void)
209{
210 int ret = 0;
211
212 if (omap_rev() == OMAP4430_REV_ES1_0) {
213 WARN(1, "Power Management not supported on OMAP4430 ES1.0\n");
214 return -ENODEV;
215 }
216
217 pr_info("Power Management for TI OMAP4+ devices.\n");
218
219 ret = pwrdm_for_each(pwrdms_setup, NULL);
220 if (ret) {
221 pr_err("Failed to setup powerdomains.\n");
191 goto err2; 222 goto err2;
192 } 223 }
193 224
225 if (cpu_is_omap44xx()) {
226 ret = omap4_init_static_deps();
227 if (ret)
228 goto err2;
229 }
230
194 ret = omap4_mpuss_init(); 231 ret = omap4_mpuss_init();
195 if (ret) { 232 if (ret) {
196 pr_err("Failed to initialise OMAP4 MPUSS\n"); 233 pr_err("Failed to initialise OMAP4 MPUSS\n");
@@ -206,7 +243,8 @@ int __init omap4_pm_init(void)
206 /* Overwrite the default cpu_do_idle() */ 243 /* Overwrite the default cpu_do_idle() */
207 arm_pm_idle = omap_default_idle; 244 arm_pm_idle = omap_default_idle;
208 245
209 omap4_idle_init(); 246 if (cpu_is_omap44xx())
247 omap4_idle_init();
210 248
211err2: 249err2:
212 return ret; 250 return ret;
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 86babd740d41..e233dfcbc186 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -102,6 +102,10 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
102 if (_pwrdm_lookup(pwrdm->name)) 102 if (_pwrdm_lookup(pwrdm->name))
103 return -EEXIST; 103 return -EEXIST;
104 104
105 if (arch_pwrdm && arch_pwrdm->pwrdm_has_voltdm)
106 if (!arch_pwrdm->pwrdm_has_voltdm())
107 goto skip_voltdm;
108
105 voltdm = voltdm_lookup(pwrdm->voltdm.name); 109 voltdm = voltdm_lookup(pwrdm->voltdm.name);
106 if (!voltdm) { 110 if (!voltdm) {
107 pr_err("powerdomain: %s: voltagedomain %s does not exist\n", 111 pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
@@ -111,6 +115,7 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
111 pwrdm->voltdm.ptr = voltdm; 115 pwrdm->voltdm.ptr = voltdm;
112 INIT_LIST_HEAD(&pwrdm->voltdm_node); 116 INIT_LIST_HEAD(&pwrdm->voltdm_node);
113 voltdm_add_pwrdm(voltdm, pwrdm); 117 voltdm_add_pwrdm(voltdm, pwrdm);
118skip_voltdm:
114 spin_lock_init(&pwrdm->_lock); 119 spin_lock_init(&pwrdm->_lock);
115 120
116 list_add(&pwrdm->node, &pwrdm_list); 121 list_add(&pwrdm->node, &pwrdm_list);
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index 140c36074fed..e4d7bd6f94b8 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -166,6 +166,7 @@ struct powerdomain {
166 * @pwrdm_disable_hdwr_sar: Disable Hardware Save-Restore feature for a pd 166 * @pwrdm_disable_hdwr_sar: Disable Hardware Save-Restore feature for a pd
167 * @pwrdm_set_lowpwrstchange: Enable pd transitions from a shallow to deep sleep 167 * @pwrdm_set_lowpwrstchange: Enable pd transitions from a shallow to deep sleep
168 * @pwrdm_wait_transition: Wait for a pd state transition to complete 168 * @pwrdm_wait_transition: Wait for a pd state transition to complete
169 * @pwrdm_has_voltdm: Check if a voltdm association is needed
169 * 170 *
170 * Regarding @pwrdm_set_lowpwrstchange: On the OMAP2 and 3-family 171 * Regarding @pwrdm_set_lowpwrstchange: On the OMAP2 and 3-family
171 * chips, a powerdomain's power state is not allowed to directly 172 * chips, a powerdomain's power state is not allowed to directly
@@ -196,6 +197,7 @@ struct pwrdm_ops {
196 int (*pwrdm_disable_hdwr_sar)(struct powerdomain *pwrdm); 197 int (*pwrdm_disable_hdwr_sar)(struct powerdomain *pwrdm);
197 int (*pwrdm_set_lowpwrstchange)(struct powerdomain *pwrdm); 198 int (*pwrdm_set_lowpwrstchange)(struct powerdomain *pwrdm);
198 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm); 199 int (*pwrdm_wait_transition)(struct powerdomain *pwrdm);
200 int (*pwrdm_has_voltdm)(void);
199}; 201};
200 202
201int pwrdm_register_platform_funcs(struct pwrdm_ops *custom_funcs); 203int pwrdm_register_platform_funcs(struct pwrdm_ops *custom_funcs);
@@ -253,6 +255,7 @@ extern void omap243x_powerdomains_init(void);
253extern void omap3xxx_powerdomains_init(void); 255extern void omap3xxx_powerdomains_init(void);
254extern void am33xx_powerdomains_init(void); 256extern void am33xx_powerdomains_init(void);
255extern void omap44xx_powerdomains_init(void); 257extern void omap44xx_powerdomains_init(void);
258extern void omap54xx_powerdomains_init(void);
256 259
257extern struct pwrdm_ops omap2_pwrdm_operations; 260extern struct pwrdm_ops omap2_pwrdm_operations;
258extern struct pwrdm_ops omap3_pwrdm_operations; 261extern struct pwrdm_ops omap3_pwrdm_operations;
diff --git a/arch/arm/mach-omap2/powerdomains3xxx_data.c b/arch/arm/mach-omap2/powerdomains3xxx_data.c
index f0e14e9efe5a..e2d4bd804523 100644
--- a/arch/arm/mach-omap2/powerdomains3xxx_data.c
+++ b/arch/arm/mach-omap2/powerdomains3xxx_data.c
@@ -336,6 +336,54 @@ static struct powerdomain dpll5_pwrdm = {
336 .voltdm = { .name = "core" }, 336 .voltdm = { .name = "core" },
337}; 337};
338 338
339static struct powerdomain device_81xx_pwrdm = {
340 .name = "device_pwrdm",
341 .prcm_offs = TI81XX_PRM_DEVICE_MOD,
342 .voltdm = { .name = "core" },
343};
344
345static struct powerdomain active_816x_pwrdm = {
346 .name = "active_pwrdm",
347 .prcm_offs = TI816X_PRM_ACTIVE_MOD,
348 .pwrsts = PWRSTS_OFF_ON,
349 .voltdm = { .name = "core" },
350};
351
352static struct powerdomain default_816x_pwrdm = {
353 .name = "default_pwrdm",
354 .prcm_offs = TI81XX_PRM_DEFAULT_MOD,
355 .pwrsts = PWRSTS_OFF_ON,
356 .voltdm = { .name = "core" },
357};
358
359static struct powerdomain ivahd0_816x_pwrdm = {
360 .name = "ivahd0_pwrdm",
361 .prcm_offs = TI816X_PRM_IVAHD0_MOD,
362 .pwrsts = PWRSTS_OFF_ON,
363 .voltdm = { .name = "mpu_iva" },
364};
365
366static struct powerdomain ivahd1_816x_pwrdm = {
367 .name = "ivahd1_pwrdm",
368 .prcm_offs = TI816X_PRM_IVAHD1_MOD,
369 .pwrsts = PWRSTS_OFF_ON,
370 .voltdm = { .name = "mpu_iva" },
371};
372
373static struct powerdomain ivahd2_816x_pwrdm = {
374 .name = "ivahd2_pwrdm",
375 .prcm_offs = TI816X_PRM_IVAHD2_MOD,
376 .pwrsts = PWRSTS_OFF_ON,
377 .voltdm = { .name = "mpu_iva" },
378};
379
380static struct powerdomain sgx_816x_pwrdm = {
381 .name = "sgx_pwrdm",
382 .prcm_offs = TI816X_PRM_SGX_MOD,
383 .pwrsts = PWRSTS_OFF_ON,
384 .voltdm = { .name = "core" },
385};
386
339/* As powerdomains are added or removed above, this list must also be changed */ 387/* As powerdomains are added or removed above, this list must also be changed */
340static struct powerdomain *powerdomains_omap3430_common[] __initdata = { 388static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
341 &wkup_omap2_pwrdm, 389 &wkup_omap2_pwrdm,
@@ -393,6 +441,17 @@ static struct powerdomain *powerdomains_am35x[] __initdata = {
393 NULL 441 NULL
394}; 442};
395 443
444static struct powerdomain *powerdomains_ti81xx[] __initdata = {
445 &device_81xx_pwrdm,
446 &active_816x_pwrdm,
447 &default_816x_pwrdm,
448 &ivahd0_816x_pwrdm,
449 &ivahd1_816x_pwrdm,
450 &ivahd2_816x_pwrdm,
451 &sgx_816x_pwrdm,
452 NULL
453};
454
396void __init omap3xxx_powerdomains_init(void) 455void __init omap3xxx_powerdomains_init(void)
397{ 456{
398 unsigned int rev; 457 unsigned int rev;
@@ -406,6 +465,9 @@ void __init omap3xxx_powerdomains_init(void)
406 465
407 if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) { 466 if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
408 pwrdm_register_pwrdms(powerdomains_am35x); 467 pwrdm_register_pwrdms(powerdomains_am35x);
468 } else if (rev == TI8168_REV_ES1_0 || rev == TI8168_REV_ES1_1
469 || rev == TI8168_REV_ES2_0 || rev == TI8168_REV_ES2_1) {
470 pwrdm_register_pwrdms(powerdomains_ti81xx);
409 } else { 471 } else {
410 pwrdm_register_pwrdms(powerdomains_omap3430_common); 472 pwrdm_register_pwrdms(powerdomains_omap3430_common);
411 473
diff --git a/arch/arm/mach-omap2/powerdomains54xx_data.c b/arch/arm/mach-omap2/powerdomains54xx_data.c
new file mode 100644
index 000000000000..81f8a7cc26ee
--- /dev/null
+++ b/arch/arm/mach-omap2/powerdomains54xx_data.c
@@ -0,0 +1,331 @@
1/*
2 * OMAP54XX Power domains framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 *
6 * Abhijit Pagare (abhijitpagare@ti.com)
7 * Benoit Cousson (b-cousson@ti.com)
8 * Paul Walmsley (paul@pwsan.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23
24#include "powerdomain.h"
25
26#include "prcm-common.h"
27#include "prcm44xx.h"
28#include "prm-regbits-54xx.h"
29#include "prm54xx.h"
30#include "prcm_mpu54xx.h"
31
32/* core_54xx_pwrdm: CORE power domain */
33static struct powerdomain core_54xx_pwrdm = {
34 .name = "core_pwrdm",
35 .voltdm = { .name = "core" },
36 .prcm_offs = OMAP54XX_PRM_CORE_INST,
37 .prcm_partition = OMAP54XX_PRM_PARTITION,
38 .pwrsts = PWRSTS_RET_ON,
39 .pwrsts_logic_ret = PWRSTS_OFF_RET,
40 .banks = 5,
41 .pwrsts_mem_ret = {
42 [0] = PWRSTS_OFF_RET, /* core_nret_bank */
43 [1] = PWRSTS_OFF_RET, /* core_ocmram */
44 [2] = PWRSTS_OFF_RET, /* core_other_bank */
45 [3] = PWRSTS_OFF_RET, /* ipu_l2ram */
46 [4] = PWRSTS_OFF_RET, /* ipu_unicache */
47 },
48 .pwrsts_mem_on = {
49 [0] = PWRSTS_OFF_RET, /* core_nret_bank */
50 [1] = PWRSTS_OFF_RET, /* core_ocmram */
51 [2] = PWRSTS_OFF_RET, /* core_other_bank */
52 [3] = PWRSTS_OFF_RET, /* ipu_l2ram */
53 [4] = PWRSTS_OFF_RET, /* ipu_unicache */
54 },
55 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
56};
57
58/* abe_54xx_pwrdm: Audio back end power domain */
59static struct powerdomain abe_54xx_pwrdm = {
60 .name = "abe_pwrdm",
61 .voltdm = { .name = "core" },
62 .prcm_offs = OMAP54XX_PRM_ABE_INST,
63 .prcm_partition = OMAP54XX_PRM_PARTITION,
64 .pwrsts = PWRSTS_OFF_RET_ON,
65 .pwrsts_logic_ret = PWRSTS_OFF,
66 .banks = 2,
67 .pwrsts_mem_ret = {
68 [0] = PWRSTS_OFF_RET, /* aessmem */
69 [1] = PWRSTS_OFF_RET, /* periphmem */
70 },
71 .pwrsts_mem_on = {
72 [0] = PWRSTS_OFF_RET, /* aessmem */
73 [1] = PWRSTS_OFF_RET, /* periphmem */
74 },
75 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
76};
77
78/* coreaon_54xx_pwrdm: Always ON logic that sits in VDD_CORE voltage domain */
79static struct powerdomain coreaon_54xx_pwrdm = {
80 .name = "coreaon_pwrdm",
81 .voltdm = { .name = "core" },
82 .prcm_offs = OMAP54XX_PRM_COREAON_INST,
83 .prcm_partition = OMAP54XX_PRM_PARTITION,
84 .pwrsts = PWRSTS_ON,
85};
86
87/* dss_54xx_pwrdm: Display subsystem power domain */
88static struct powerdomain dss_54xx_pwrdm = {
89 .name = "dss_pwrdm",
90 .voltdm = { .name = "core" },
91 .prcm_offs = OMAP54XX_PRM_DSS_INST,
92 .prcm_partition = OMAP54XX_PRM_PARTITION,
93 .pwrsts = PWRSTS_OFF_RET_ON,
94 .pwrsts_logic_ret = PWRSTS_OFF,
95 .banks = 1,
96 .pwrsts_mem_ret = {
97 [0] = PWRSTS_OFF_RET, /* dss_mem */
98 },
99 .pwrsts_mem_on = {
100 [0] = PWRSTS_OFF_RET, /* dss_mem */
101 },
102 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
103};
104
105/* cpu0_54xx_pwrdm: MPU0 processor and Neon coprocessor power domain */
106static struct powerdomain cpu0_54xx_pwrdm = {
107 .name = "cpu0_pwrdm",
108 .voltdm = { .name = "mpu" },
109 .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C0_INST,
110 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION,
111 .pwrsts = PWRSTS_OFF_RET_ON,
112 .pwrsts_logic_ret = PWRSTS_OFF_RET,
113 .banks = 1,
114 .pwrsts_mem_ret = {
115 [0] = PWRSTS_OFF_RET, /* cpu0_l1 */
116 },
117 .pwrsts_mem_on = {
118 [0] = PWRSTS_ON, /* cpu0_l1 */
119 },
120};
121
122/* cpu1_54xx_pwrdm: MPU1 processor and Neon coprocessor power domain */
123static struct powerdomain cpu1_54xx_pwrdm = {
124 .name = "cpu1_pwrdm",
125 .voltdm = { .name = "mpu" },
126 .prcm_offs = OMAP54XX_PRCM_MPU_PRM_C1_INST,
127 .prcm_partition = OMAP54XX_PRCM_MPU_PARTITION,
128 .pwrsts = PWRSTS_OFF_RET_ON,
129 .pwrsts_logic_ret = PWRSTS_OFF_RET,
130 .banks = 1,
131 .pwrsts_mem_ret = {
132 [0] = PWRSTS_OFF_RET, /* cpu1_l1 */
133 },
134 .pwrsts_mem_on = {
135 [0] = PWRSTS_ON, /* cpu1_l1 */
136 },
137};
138
139/* emu_54xx_pwrdm: Emulation power domain */
140static struct powerdomain emu_54xx_pwrdm = {
141 .name = "emu_pwrdm",
142 .voltdm = { .name = "wkup" },
143 .prcm_offs = OMAP54XX_PRM_EMU_INST,
144 .prcm_partition = OMAP54XX_PRM_PARTITION,
145 .pwrsts = PWRSTS_OFF_ON,
146 .banks = 1,
147 .pwrsts_mem_ret = {
148 [0] = PWRSTS_OFF_RET, /* emu_bank */
149 },
150 .pwrsts_mem_on = {
151 [0] = PWRSTS_OFF_RET, /* emu_bank */
152 },
153};
154
155/* mpu_54xx_pwrdm: Modena processor and the Neon coprocessor power domain */
156static struct powerdomain mpu_54xx_pwrdm = {
157 .name = "mpu_pwrdm",
158 .voltdm = { .name = "mpu" },
159 .prcm_offs = OMAP54XX_PRM_MPU_INST,
160 .prcm_partition = OMAP54XX_PRM_PARTITION,
161 .pwrsts = PWRSTS_RET_ON,
162 .pwrsts_logic_ret = PWRSTS_OFF_RET,
163 .banks = 2,
164 .pwrsts_mem_ret = {
165 [0] = PWRSTS_OFF_RET, /* mpu_l2 */
166 [1] = PWRSTS_RET, /* mpu_ram */
167 },
168 .pwrsts_mem_on = {
169 [0] = PWRSTS_OFF_RET, /* mpu_l2 */
170 [1] = PWRSTS_OFF_RET, /* mpu_ram */
171 },
172};
173
174/* custefuse_54xx_pwrdm: Customer efuse controller power domain */
175static struct powerdomain custefuse_54xx_pwrdm = {
176 .name = "custefuse_pwrdm",
177 .voltdm = { .name = "core" },
178 .prcm_offs = OMAP54XX_PRM_CUSTEFUSE_INST,
179 .prcm_partition = OMAP54XX_PRM_PARTITION,
180 .pwrsts = PWRSTS_OFF_ON,
181 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
182};
183
184/* dsp_54xx_pwrdm: Tesla processor power domain */
185static struct powerdomain dsp_54xx_pwrdm = {
186 .name = "dsp_pwrdm",
187 .voltdm = { .name = "mm" },
188 .prcm_offs = OMAP54XX_PRM_DSP_INST,
189 .prcm_partition = OMAP54XX_PRM_PARTITION,
190 .pwrsts = PWRSTS_OFF_RET_ON,
191 .pwrsts_logic_ret = PWRSTS_OFF_RET,
192 .banks = 3,
193 .pwrsts_mem_ret = {
194 [0] = PWRSTS_OFF_RET, /* dsp_edma */
195 [1] = PWRSTS_OFF_RET, /* dsp_l1 */
196 [2] = PWRSTS_OFF_RET, /* dsp_l2 */
197 },
198 .pwrsts_mem_on = {
199 [0] = PWRSTS_OFF_RET, /* dsp_edma */
200 [1] = PWRSTS_OFF_RET, /* dsp_l1 */
201 [2] = PWRSTS_OFF_RET, /* dsp_l2 */
202 },
203 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
204};
205
206/* cam_54xx_pwrdm: Camera subsystem power domain */
207static struct powerdomain cam_54xx_pwrdm = {
208 .name = "cam_pwrdm",
209 .voltdm = { .name = "core" },
210 .prcm_offs = OMAP54XX_PRM_CAM_INST,
211 .prcm_partition = OMAP54XX_PRM_PARTITION,
212 .pwrsts = PWRSTS_OFF_ON,
213 .banks = 1,
214 .pwrsts_mem_ret = {
215 [0] = PWRSTS_OFF_RET, /* cam_mem */
216 },
217 .pwrsts_mem_on = {
218 [0] = PWRSTS_OFF_RET, /* cam_mem */
219 },
220 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
221};
222
223/* l3init_54xx_pwrdm: L3 initators pheripherals power domain */
224static struct powerdomain l3init_54xx_pwrdm = {
225 .name = "l3init_pwrdm",
226 .voltdm = { .name = "core" },
227 .prcm_offs = OMAP54XX_PRM_L3INIT_INST,
228 .prcm_partition = OMAP54XX_PRM_PARTITION,
229 .pwrsts = PWRSTS_RET_ON,
230 .pwrsts_logic_ret = PWRSTS_OFF_RET,
231 .banks = 2,
232 .pwrsts_mem_ret = {
233 [0] = PWRSTS_OFF_RET, /* l3init_bank1 */
234 [1] = PWRSTS_OFF_RET, /* l3init_bank2 */
235 },
236 .pwrsts_mem_on = {
237 [0] = PWRSTS_OFF_RET, /* l3init_bank1 */
238 [1] = PWRSTS_OFF_RET, /* l3init_bank2 */
239 },
240 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
241};
242
243/* gpu_54xx_pwrdm: 3D accelerator power domain */
244static struct powerdomain gpu_54xx_pwrdm = {
245 .name = "gpu_pwrdm",
246 .voltdm = { .name = "mm" },
247 .prcm_offs = OMAP54XX_PRM_GPU_INST,
248 .prcm_partition = OMAP54XX_PRM_PARTITION,
249 .pwrsts = PWRSTS_OFF_ON,
250 .banks = 1,
251 .pwrsts_mem_ret = {
252 [0] = PWRSTS_OFF_RET, /* gpu_mem */
253 },
254 .pwrsts_mem_on = {
255 [0] = PWRSTS_OFF_RET, /* gpu_mem */
256 },
257 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
258};
259
260/* wkupaon_54xx_pwrdm: Wake-up power domain */
261static struct powerdomain wkupaon_54xx_pwrdm = {
262 .name = "wkupaon_pwrdm",
263 .voltdm = { .name = "wkup" },
264 .prcm_offs = OMAP54XX_PRM_WKUPAON_INST,
265 .prcm_partition = OMAP54XX_PRM_PARTITION,
266 .pwrsts = PWRSTS_ON,
267 .banks = 1,
268 .pwrsts_mem_ret = {
269 },
270 .pwrsts_mem_on = {
271 [0] = PWRSTS_ON, /* wkup_bank */
272 },
273};
274
275/* iva_54xx_pwrdm: IVA-HD power domain */
276static struct powerdomain iva_54xx_pwrdm = {
277 .name = "iva_pwrdm",
278 .voltdm = { .name = "mm" },
279 .prcm_offs = OMAP54XX_PRM_IVA_INST,
280 .prcm_partition = OMAP54XX_PRM_PARTITION,
281 .pwrsts = PWRSTS_OFF_RET_ON,
282 .pwrsts_logic_ret = PWRSTS_OFF,
283 .banks = 4,
284 .pwrsts_mem_ret = {
285 [0] = PWRSTS_OFF_RET, /* hwa_mem */
286 [1] = PWRSTS_OFF_RET, /* sl2_mem */
287 [2] = PWRSTS_OFF_RET, /* tcm1_mem */
288 [3] = PWRSTS_OFF_RET, /* tcm2_mem */
289 },
290 .pwrsts_mem_on = {
291 [0] = PWRSTS_OFF_RET, /* hwa_mem */
292 [1] = PWRSTS_OFF_RET, /* sl2_mem */
293 [2] = PWRSTS_OFF_RET, /* tcm1_mem */
294 [3] = PWRSTS_OFF_RET, /* tcm2_mem */
295 },
296 .flags = PWRDM_HAS_LOWPOWERSTATECHANGE,
297};
298
299/*
300 * The following power domains are not under SW control
301 *
302 * mpuaon
303 * mmaon
304 */
305
306/* As powerdomains are added or removed above, this list must also be changed */
307static struct powerdomain *powerdomains_omap54xx[] __initdata = {
308 &core_54xx_pwrdm,
309 &abe_54xx_pwrdm,
310 &coreaon_54xx_pwrdm,
311 &dss_54xx_pwrdm,
312 &cpu0_54xx_pwrdm,
313 &cpu1_54xx_pwrdm,
314 &emu_54xx_pwrdm,
315 &mpu_54xx_pwrdm,
316 &custefuse_54xx_pwrdm,
317 &dsp_54xx_pwrdm,
318 &cam_54xx_pwrdm,
319 &l3init_54xx_pwrdm,
320 &gpu_54xx_pwrdm,
321 &wkupaon_54xx_pwrdm,
322 &iva_54xx_pwrdm,
323 NULL
324};
325
326void __init omap54xx_powerdomains_init(void)
327{
328 pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
329 pwrdm_register_pwrdms(powerdomains_omap54xx);
330 pwrdm_complete_init();
331}
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index c7d355fafd24..ff1ac4a82a04 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -48,6 +48,17 @@
48#define OMAP3430_NEON_MOD 0xb00 48#define OMAP3430_NEON_MOD 0xb00
49#define OMAP3430ES2_USBHOST_MOD 0xc00 49#define OMAP3430ES2_USBHOST_MOD 0xc00
50 50
51/*
52 * TI81XX PRM module offsets
53 */
54#define TI81XX_PRM_DEVICE_MOD 0x0000
55#define TI816X_PRM_ACTIVE_MOD 0x0a00
56#define TI81XX_PRM_DEFAULT_MOD 0x0b00
57#define TI816X_PRM_IVAHD0_MOD 0x0c00
58#define TI816X_PRM_IVAHD1_MOD 0x0d00
59#define TI816X_PRM_IVAHD2_MOD 0x0e00
60#define TI816X_PRM_SGX_MOD 0x0f00
61
51/* 24XX register bits shared between CM & PRM registers */ 62/* 24XX register bits shared between CM & PRM registers */
52 63
53/* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */ 64/* CM_FCLKEN1_CORE, CM_ICLKEN1_CORE, PM_WKEN1_CORE shared bits */
diff --git a/arch/arm/mach-omap2/prcm44xx.h b/arch/arm/mach-omap2/prcm44xx.h
index 7334ffb9d2c1..f429cdd5a118 100644
--- a/arch/arm/mach-omap2/prcm44xx.h
+++ b/arch/arm/mach-omap2/prcm44xx.h
@@ -32,6 +32,12 @@
32#define OMAP4430_SCRM_PARTITION 4 32#define OMAP4430_SCRM_PARTITION 4
33#define OMAP4430_PRCM_MPU_PARTITION 5 33#define OMAP4430_PRCM_MPU_PARTITION 5
34 34
35#define OMAP54XX_PRM_PARTITION 1
36#define OMAP54XX_CM_CORE_AON_PARTITION 2
37#define OMAP54XX_CM_CORE_PARTITION 3
38#define OMAP54XX_SCRM_PARTITION 4
39#define OMAP54XX_PRCM_MPU_PARTITION 5
40
35/* 41/*
36 * OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM partition 42 * OMAP4_MAX_PRCM_PARTITIONS: set to the highest value of the PRCM partition
37 * IDs, plus one 43 * IDs, plus one
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 884af7bb4afd..059bd4f49035 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -25,12 +25,9 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "prcm_mpu_44xx_54xx.h"
28#include "common.h" 29#include "common.h"
29 30
30# ifndef __ASSEMBLER__
31extern void __iomem *prcm_mpu_base;
32# endif
33
34#define OMAP4430_PRCM_MPU_BASE 0x48243000 31#define OMAP4430_PRCM_MPU_BASE 0x48243000
35 32
36#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \ 33#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \
@@ -98,13 +95,4 @@ extern void __iomem *prcm_mpu_base;
98#define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET 0x0018 95#define OMAP4_CM_CPU1_CLKSTCTRL_OFFSET 0x0018
99#define OMAP4430_CM_CPU1_CLKSTCTRL OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018) 96#define OMAP4430_CM_CPU1_CLKSTCTRL OMAP44XX_PRCM_MPU_REGADDR(OMAP4430_PRCM_MPU_CPU1_INST, 0x0018)
100 97
101/* Function prototypes */
102# ifndef __ASSEMBLER__
103extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
104extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
105extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
106 s16 idx);
107extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
108# endif
109
110#endif 98#endif
diff --git a/arch/arm/mach-omap2/prcm_mpu54xx.h b/arch/arm/mach-omap2/prcm_mpu54xx.h
new file mode 100644
index 000000000000..bc2ce3288315
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm_mpu54xx.h
@@ -0,0 +1,87 @@
1/*
2 * OMAP54xx PRCM MPU instance offset macros
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley (paul@pwsan.com)
7 * Rajendra Nayak (rnayak@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU54XX_H
22#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU54XX_H
23
24#include "prcm_mpu_44xx_54xx.h"
25#include "common.h"
26
27#define OMAP54XX_PRCM_MPU_BASE 0x48243000
28
29#define OMAP54XX_PRCM_MPU_REGADDR(inst, reg) \
30 OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE + (inst) + (reg))
31
32/* PRCM_MPU instances */
33#define OMAP54XX_PRCM_MPU_OCP_SOCKET_INST 0x0000
34#define OMAP54XX_PRCM_MPU_DEVICE_INST 0x0200
35#define OMAP54XX_PRCM_MPU_PRM_C0_INST 0x0400
36#define OMAP54XX_PRCM_MPU_CM_C0_INST 0x0600
37#define OMAP54XX_PRCM_MPU_PRM_C1_INST 0x0800
38#define OMAP54XX_PRCM_MPU_CM_C1_INST 0x0a00
39
40/* PRCM_MPU clockdomain register offsets (from instance start) */
41#define OMAP54XX_PRCM_MPU_CM_C0_CPU0_CDOFFS 0x0000
42#define OMAP54XX_PRCM_MPU_CM_C1_CPU1_CDOFFS 0x0000
43
44
45/*
46 * PRCM_MPU
47 *
48 * The PRCM_MPU is a local PRCM inside the MPU subsystem. For the PRCM (global)
49 * point of view the PRCM_MPU is a single entity. It shares the same
50 * programming model as the global PRCM and thus can be assimilate as two new
51 * MOD inside the PRCM
52 */
53
54/* PRCM_MPU.PRCM_MPU_OCP_SOCKET register offsets */
55#define OMAP54XX_REVISION_PRCM_MPU_OFFSET 0x0000
56
57/* PRCM_MPU.PRCM_MPU_DEVICE register offsets */
58#define OMAP54XX_PRCM_MPU_PRM_RSTST_OFFSET 0x0000
59#define OMAP54XX_PRCM_MPU_PRM_PSCON_COUNT_OFFSET 0x0004
60#define OMAP54XX_PRM_FRAC_INCREMENTER_NUMERATOR_OFFSET 0x0010
61#define OMAP54XX_PRM_FRAC_INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x0014
62
63/* PRCM_MPU.PRCM_MPU_PRM_C0 register offsets */
64#define OMAP54XX_PM_CPU0_PWRSTCTRL_OFFSET 0x0000
65#define OMAP54XX_PM_CPU0_PWRSTST_OFFSET 0x0004
66#define OMAP54XX_RM_CPU0_CPU0_RSTCTRL_OFFSET 0x0010
67#define OMAP54XX_RM_CPU0_CPU0_RSTST_OFFSET 0x0014
68#define OMAP54XX_RM_CPU0_CPU0_CONTEXT_OFFSET 0x0024
69
70/* PRCM_MPU.PRCM_MPU_CM_C0 register offsets */
71#define OMAP54XX_CM_CPU0_CLKSTCTRL_OFFSET 0x0000
72#define OMAP54XX_CM_CPU0_CPU0_CLKCTRL_OFFSET 0x0020
73#define OMAP54XX_CM_CPU0_CPU0_CLKCTRL OMAP54XX_PRCM_MPU_REGADDR(OMAP54XX_PRCM_MPU_CM_C0_INST, 0x0020)
74
75/* PRCM_MPU.PRCM_MPU_PRM_C1 register offsets */
76#define OMAP54XX_PM_CPU1_PWRSTCTRL_OFFSET 0x0000
77#define OMAP54XX_PM_CPU1_PWRSTST_OFFSET 0x0004
78#define OMAP54XX_RM_CPU1_CPU1_RSTCTRL_OFFSET 0x0010
79#define OMAP54XX_RM_CPU1_CPU1_RSTST_OFFSET 0x0014
80#define OMAP54XX_RM_CPU1_CPU1_CONTEXT_OFFSET 0x0024
81
82/* PRCM_MPU.PRCM_MPU_CM_C1 register offsets */
83#define OMAP54XX_CM_CPU1_CLKSTCTRL_OFFSET 0x0000
84#define OMAP54XX_CM_CPU1_CPU1_CLKCTRL_OFFSET 0x0020
85#define OMAP54XX_CM_CPU1_CPU1_CLKCTRL OMAP54XX_PRCM_MPU_REGADDR(OMAP54XX_PRCM_MPU_CM_C1_INST, 0x0020)
86
87#endif
diff --git a/arch/arm/mach-omap2/prcm_mpu_44xx_54xx.h b/arch/arm/mach-omap2/prcm_mpu_44xx_54xx.h
new file mode 100644
index 000000000000..ca149e70bed0
--- /dev/null
+++ b/arch/arm/mach-omap2/prcm_mpu_44xx_54xx.h
@@ -0,0 +1,36 @@
1/*
2 * OMAP44xx and OMAP54xx PRCM MPU function prototypes
3 *
4 * Copyright (C) 2010, 2013 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 */
22
23#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU_44XX_54XX_H
24#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU_44XX_54XX_H
25
26#ifndef __ASSEMBLER__
27extern void __iomem *prcm_mpu_base;
28
29extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
30extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
31extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
32 s16 idx);
33extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
34#endif
35
36#endif
diff --git a/arch/arm/mach-omap2/prm-regbits-54xx.h b/arch/arm/mach-omap2/prm-regbits-54xx.h
new file mode 100644
index 000000000000..be31b21aa9c6
--- /dev/null
+++ b/arch/arm/mach-omap2/prm-regbits-54xx.h
@@ -0,0 +1,2701 @@
1/*
2 * OMAP54xx Power Management register bits
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley (paul@pwsan.com)
7 * Rajendra Nayak (rnayak@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#ifndef __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_54XX_H
22#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_54XX_H
23
24/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
25#define OMAP54XX_ABBOFF_ACT_SHIFT 1
26#define OMAP54XX_ABBOFF_ACT_WIDTH 0x1
27#define OMAP54XX_ABBOFF_ACT_MASK (1 << 1)
28
29/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
30#define OMAP54XX_ABBOFF_SLEEP_SHIFT 2
31#define OMAP54XX_ABBOFF_SLEEP_WIDTH 0x1
32#define OMAP54XX_ABBOFF_SLEEP_MASK (1 << 2)
33
34/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
35#define OMAP54XX_ABB_MM_DONE_EN_SHIFT 31
36#define OMAP54XX_ABB_MM_DONE_EN_WIDTH 0x1
37#define OMAP54XX_ABB_MM_DONE_EN_MASK (1 << 31)
38
39/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
40#define OMAP54XX_ABB_MM_DONE_ST_SHIFT 31
41#define OMAP54XX_ABB_MM_DONE_ST_WIDTH 0x1
42#define OMAP54XX_ABB_MM_DONE_ST_MASK (1 << 31)
43
44/* Used by PRM_IRQENABLE_MPU_2 */
45#define OMAP54XX_ABB_MPU_DONE_EN_SHIFT 7
46#define OMAP54XX_ABB_MPU_DONE_EN_WIDTH 0x1
47#define OMAP54XX_ABB_MPU_DONE_EN_MASK (1 << 7)
48
49/* Used by PRM_IRQSTATUS_MPU_2 */
50#define OMAP54XX_ABB_MPU_DONE_ST_SHIFT 7
51#define OMAP54XX_ABB_MPU_DONE_ST_WIDTH 0x1
52#define OMAP54XX_ABB_MPU_DONE_ST_MASK (1 << 7)
53
54/* Used by PRM_ABBLDO_MM_SETUP, PRM_ABBLDO_MPU_SETUP */
55#define OMAP54XX_ACTIVE_FBB_SEL_SHIFT 2
56#define OMAP54XX_ACTIVE_FBB_SEL_WIDTH 0x1
57#define OMAP54XX_ACTIVE_FBB_SEL_MASK (1 << 2)
58
59/* Used by PM_ABE_PWRSTCTRL */
60#define OMAP54XX_AESSMEM_ONSTATE_SHIFT 16
61#define OMAP54XX_AESSMEM_ONSTATE_WIDTH 0x2
62#define OMAP54XX_AESSMEM_ONSTATE_MASK (0x3 << 16)
63
64/* Used by PM_ABE_PWRSTCTRL */
65#define OMAP54XX_AESSMEM_RETSTATE_SHIFT 8
66#define OMAP54XX_AESSMEM_RETSTATE_WIDTH 0x1
67#define OMAP54XX_AESSMEM_RETSTATE_MASK (1 << 8)
68
69/* Used by PM_ABE_PWRSTST */
70#define OMAP54XX_AESSMEM_STATEST_SHIFT 4
71#define OMAP54XX_AESSMEM_STATEST_WIDTH 0x2
72#define OMAP54XX_AESSMEM_STATEST_MASK (0x3 << 4)
73
74/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
75#define OMAP54XX_AIPOFF_SHIFT 8
76#define OMAP54XX_AIPOFF_WIDTH 0x1
77#define OMAP54XX_AIPOFF_MASK (1 << 8)
78
79/* Used by PRM_VOLTCTRL */
80#define OMAP54XX_AUTO_CTRL_VDD_CORE_L_SHIFT 0
81#define OMAP54XX_AUTO_CTRL_VDD_CORE_L_WIDTH 0x2
82#define OMAP54XX_AUTO_CTRL_VDD_CORE_L_MASK (0x3 << 0)
83
84/* Used by PRM_VOLTCTRL */
85#define OMAP54XX_AUTO_CTRL_VDD_MM_L_SHIFT 4
86#define OMAP54XX_AUTO_CTRL_VDD_MM_L_WIDTH 0x2
87#define OMAP54XX_AUTO_CTRL_VDD_MM_L_MASK (0x3 << 4)
88
89/* Used by PRM_VOLTCTRL */
90#define OMAP54XX_AUTO_CTRL_VDD_MPU_L_SHIFT 2
91#define OMAP54XX_AUTO_CTRL_VDD_MPU_L_WIDTH 0x2
92#define OMAP54XX_AUTO_CTRL_VDD_MPU_L_MASK (0x3 << 2)
93
94/* Used by PRM_VC_BYPASS_ERRST */
95#define OMAP54XX_BYPS_RA_ERR_SHIFT 1
96#define OMAP54XX_BYPS_RA_ERR_WIDTH 0x1
97#define OMAP54XX_BYPS_RA_ERR_MASK (1 << 1)
98
99/* Used by PRM_VC_BYPASS_ERRST */
100#define OMAP54XX_BYPS_SA_ERR_SHIFT 0
101#define OMAP54XX_BYPS_SA_ERR_WIDTH 0x1
102#define OMAP54XX_BYPS_SA_ERR_MASK (1 << 0)
103
104/* Used by PRM_VC_BYPASS_ERRST */
105#define OMAP54XX_BYPS_TIMEOUT_ERR_SHIFT 2
106#define OMAP54XX_BYPS_TIMEOUT_ERR_WIDTH 0x1
107#define OMAP54XX_BYPS_TIMEOUT_ERR_MASK (1 << 2)
108
109/* Used by PRM_RSTST */
110#define OMAP54XX_C2C_RST_SHIFT 10
111#define OMAP54XX_C2C_RST_WIDTH 0x1
112#define OMAP54XX_C2C_RST_MASK (1 << 10)
113
114/* Used by PM_CAM_PWRSTCTRL */
115#define OMAP54XX_CAM_MEM_ONSTATE_SHIFT 16
116#define OMAP54XX_CAM_MEM_ONSTATE_WIDTH 0x2
117#define OMAP54XX_CAM_MEM_ONSTATE_MASK (0x3 << 16)
118
119/* Used by PM_CAM_PWRSTST */
120#define OMAP54XX_CAM_MEM_STATEST_SHIFT 4
121#define OMAP54XX_CAM_MEM_STATEST_WIDTH 0x2
122#define OMAP54XX_CAM_MEM_STATEST_MASK (0x3 << 4)
123
124/* Used by PRM_CLKREQCTRL */
125#define OMAP54XX_CLKREQ_COND_SHIFT 0
126#define OMAP54XX_CLKREQ_COND_WIDTH 0x3
127#define OMAP54XX_CLKREQ_COND_MASK (0x7 << 0)
128
129/* Used by PRM_VC_SMPS_CORE_CONFIG */
130#define OMAP54XX_CMDRA_VDD_CORE_L_SHIFT 16
131#define OMAP54XX_CMDRA_VDD_CORE_L_WIDTH 0x8
132#define OMAP54XX_CMDRA_VDD_CORE_L_MASK (0xff << 16)
133
134/* Used by PRM_VC_SMPS_MM_CONFIG */
135#define OMAP54XX_CMDRA_VDD_MM_L_SHIFT 16
136#define OMAP54XX_CMDRA_VDD_MM_L_WIDTH 0x8
137#define OMAP54XX_CMDRA_VDD_MM_L_MASK (0xff << 16)
138
139/* Used by PRM_VC_SMPS_MPU_CONFIG */
140#define OMAP54XX_CMDRA_VDD_MPU_L_SHIFT 16
141#define OMAP54XX_CMDRA_VDD_MPU_L_WIDTH 0x8
142#define OMAP54XX_CMDRA_VDD_MPU_L_MASK (0xff << 16)
143
144/* Used by PRM_VC_SMPS_CORE_CONFIG */
145#define OMAP54XX_CMD_VDD_CORE_L_SHIFT 28
146#define OMAP54XX_CMD_VDD_CORE_L_WIDTH 0x1
147#define OMAP54XX_CMD_VDD_CORE_L_MASK (1 << 28)
148
149/* Used by PRM_VC_SMPS_MM_CONFIG */
150#define OMAP54XX_CMD_VDD_MM_L_SHIFT 28
151#define OMAP54XX_CMD_VDD_MM_L_WIDTH 0x1
152#define OMAP54XX_CMD_VDD_MM_L_MASK (1 << 28)
153
154/* Used by PRM_VC_SMPS_MPU_CONFIG */
155#define OMAP54XX_CMD_VDD_MPU_L_SHIFT 28
156#define OMAP54XX_CMD_VDD_MPU_L_WIDTH 0x1
157#define OMAP54XX_CMD_VDD_MPU_L_MASK (1 << 28)
158
159/* Used by PM_CORE_PWRSTCTRL */
160#define OMAP54XX_CORE_OCMRAM_ONSTATE_SHIFT 18
161#define OMAP54XX_CORE_OCMRAM_ONSTATE_WIDTH 0x2
162#define OMAP54XX_CORE_OCMRAM_ONSTATE_MASK (0x3 << 18)
163
164/* Used by PM_CORE_PWRSTCTRL */
165#define OMAP54XX_CORE_OCMRAM_RETSTATE_SHIFT 9
166#define OMAP54XX_CORE_OCMRAM_RETSTATE_WIDTH 0x1
167#define OMAP54XX_CORE_OCMRAM_RETSTATE_MASK (1 << 9)
168
169/* Used by PM_CORE_PWRSTST */
170#define OMAP54XX_CORE_OCMRAM_STATEST_SHIFT 6
171#define OMAP54XX_CORE_OCMRAM_STATEST_WIDTH 0x2
172#define OMAP54XX_CORE_OCMRAM_STATEST_MASK (0x3 << 6)
173
174/* Used by PM_CORE_PWRSTCTRL */
175#define OMAP54XX_CORE_OTHER_BANK_ONSTATE_SHIFT 16
176#define OMAP54XX_CORE_OTHER_BANK_ONSTATE_WIDTH 0x2
177#define OMAP54XX_CORE_OTHER_BANK_ONSTATE_MASK (0x3 << 16)
178
179/* Used by PM_CORE_PWRSTCTRL */
180#define OMAP54XX_CORE_OTHER_BANK_RETSTATE_SHIFT 8
181#define OMAP54XX_CORE_OTHER_BANK_RETSTATE_WIDTH 0x1
182#define OMAP54XX_CORE_OTHER_BANK_RETSTATE_MASK (1 << 8)
183
184/* Used by PM_CORE_PWRSTST */
185#define OMAP54XX_CORE_OTHER_BANK_STATEST_SHIFT 4
186#define OMAP54XX_CORE_OTHER_BANK_STATEST_WIDTH 0x2
187#define OMAP54XX_CORE_OTHER_BANK_STATEST_MASK (0x3 << 4)
188
189/* Used by REVISION_PRM */
190#define OMAP54XX_CUSTOM_SHIFT 6
191#define OMAP54XX_CUSTOM_WIDTH 0x2
192#define OMAP54XX_CUSTOM_MASK (0x3 << 6)
193
194/* Used by PRM_VC_VAL_BYPASS */
195#define OMAP54XX_DATA_SHIFT 16
196#define OMAP54XX_DATA_WIDTH 0x8
197#define OMAP54XX_DATA_MASK (0xff << 16)
198
199/* Used by PRM_DEBUG_CORE_RET_TRANS */
200#define OMAP54XX_PRM_DEBUG_OUT_SHIFT 0
201#define OMAP54XX_PRM_DEBUG_OUT_WIDTH 0x1c
202#define OMAP54XX_PRM_DEBUG_OUT_MASK (0xfffffff << 0)
203
204/* Renamed from DEBUG_OUT Used by PRM_DEBUG_MM_RET_TRANS */
205#define OMAP54XX_DEBUG_OUT_0_9_SHIFT 0
206#define OMAP54XX_DEBUG_OUT_0_9_WIDTH 0xa
207#define OMAP54XX_DEBUG_OUT_0_9_MASK (0x3ff << 0)
208
209/* Renamed from DEBUG_OUT Used by PRM_DEBUG_MPU_RET_TRANS */
210#define OMAP54XX_DEBUG_OUT_0_6_SHIFT 0
211#define OMAP54XX_DEBUG_OUT_0_6_WIDTH 0x7
212#define OMAP54XX_DEBUG_OUT_0_6_MASK (0x7f << 0)
213
214/* Renamed from DEBUG_OUT Used by PRM_DEBUG_OFF_TRANS */
215#define OMAP54XX_DEBUG_OUT_0_31_SHIFT 0
216#define OMAP54XX_DEBUG_OUT_0_31_WIDTH 0x20
217#define OMAP54XX_DEBUG_OUT_0_31_MASK (0xffffffff << 0)
218
219/* Renamed from DEBUG_OUT Used by PRM_DEBUG_WKUPAON_FD_TRANS */
220#define OMAP54XX_DEBUG_OUT_0_11_SHIFT 0
221#define OMAP54XX_DEBUG_OUT_0_11_WIDTH 0xc
222#define OMAP54XX_DEBUG_OUT_0_11_MASK (0xfff << 0)
223
224/* Used by PRM_DEVICE_OFF_CTRL */
225#define OMAP54XX_DEVICE_OFF_ENABLE_SHIFT 0
226#define OMAP54XX_DEVICE_OFF_ENABLE_WIDTH 0x1
227#define OMAP54XX_DEVICE_OFF_ENABLE_MASK (1 << 0)
228
229/* Used by PRM_VC_CFG_I2C_MODE */
230#define OMAP54XX_DFILTEREN_SHIFT 6
231#define OMAP54XX_DFILTEREN_WIDTH 0x1
232#define OMAP54XX_DFILTEREN_MASK (1 << 6)
233
234/* Used by PRM_IRQENABLE_DSP, PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
235#define OMAP54XX_DPLL_ABE_RECAL_EN_SHIFT 4
236#define OMAP54XX_DPLL_ABE_RECAL_EN_WIDTH 0x1
237#define OMAP54XX_DPLL_ABE_RECAL_EN_MASK (1 << 4)
238
239/* Used by PRM_IRQSTATUS_DSP, PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
240#define OMAP54XX_DPLL_ABE_RECAL_ST_SHIFT 4
241#define OMAP54XX_DPLL_ABE_RECAL_ST_WIDTH 0x1
242#define OMAP54XX_DPLL_ABE_RECAL_ST_MASK (1 << 4)
243
244/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
245#define OMAP54XX_DPLL_CORE_RECAL_EN_SHIFT 0
246#define OMAP54XX_DPLL_CORE_RECAL_EN_WIDTH 0x1
247#define OMAP54XX_DPLL_CORE_RECAL_EN_MASK (1 << 0)
248
249/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
250#define OMAP54XX_DPLL_CORE_RECAL_ST_SHIFT 0
251#define OMAP54XX_DPLL_CORE_RECAL_ST_WIDTH 0x1
252#define OMAP54XX_DPLL_CORE_RECAL_ST_MASK (1 << 0)
253
254/* Used by PRM_IRQENABLE_DSP, PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
255#define OMAP54XX_DPLL_IVA_RECAL_EN_SHIFT 2
256#define OMAP54XX_DPLL_IVA_RECAL_EN_WIDTH 0x1
257#define OMAP54XX_DPLL_IVA_RECAL_EN_MASK (1 << 2)
258
259/* Used by PRM_IRQSTATUS_DSP, PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
260#define OMAP54XX_DPLL_IVA_RECAL_ST_SHIFT 2
261#define OMAP54XX_DPLL_IVA_RECAL_ST_WIDTH 0x1
262#define OMAP54XX_DPLL_IVA_RECAL_ST_MASK (1 << 2)
263
264/* Used by PRM_IRQENABLE_MPU */
265#define OMAP54XX_DPLL_MPU_RECAL_EN_SHIFT 1
266#define OMAP54XX_DPLL_MPU_RECAL_EN_WIDTH 0x1
267#define OMAP54XX_DPLL_MPU_RECAL_EN_MASK (1 << 1)
268
269/* Used by PRM_IRQSTATUS_MPU */
270#define OMAP54XX_DPLL_MPU_RECAL_ST_SHIFT 1
271#define OMAP54XX_DPLL_MPU_RECAL_ST_WIDTH 0x1
272#define OMAP54XX_DPLL_MPU_RECAL_ST_MASK (1 << 1)
273
274/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
275#define OMAP54XX_DPLL_PER_RECAL_EN_SHIFT 3
276#define OMAP54XX_DPLL_PER_RECAL_EN_WIDTH 0x1
277#define OMAP54XX_DPLL_PER_RECAL_EN_MASK (1 << 3)
278
279/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
280#define OMAP54XX_DPLL_PER_RECAL_ST_SHIFT 3
281#define OMAP54XX_DPLL_PER_RECAL_ST_WIDTH 0x1
282#define OMAP54XX_DPLL_PER_RECAL_ST_MASK (1 << 3)
283
284/* Used by PM_DSP_PWRSTCTRL */
285#define OMAP54XX_DSP_EDMA_ONSTATE_SHIFT 20
286#define OMAP54XX_DSP_EDMA_ONSTATE_WIDTH 0x2
287#define OMAP54XX_DSP_EDMA_ONSTATE_MASK (0x3 << 20)
288
289/* Used by PM_DSP_PWRSTCTRL */
290#define OMAP54XX_DSP_EDMA_RETSTATE_SHIFT 10
291#define OMAP54XX_DSP_EDMA_RETSTATE_WIDTH 0x1
292#define OMAP54XX_DSP_EDMA_RETSTATE_MASK (1 << 10)
293
294/* Used by PM_DSP_PWRSTST */
295#define OMAP54XX_DSP_EDMA_STATEST_SHIFT 8
296#define OMAP54XX_DSP_EDMA_STATEST_WIDTH 0x2
297#define OMAP54XX_DSP_EDMA_STATEST_MASK (0x3 << 8)
298
299/* Used by PM_DSP_PWRSTCTRL */
300#define OMAP54XX_DSP_L1_ONSTATE_SHIFT 16
301#define OMAP54XX_DSP_L1_ONSTATE_WIDTH 0x2
302#define OMAP54XX_DSP_L1_ONSTATE_MASK (0x3 << 16)
303
304/* Used by PM_DSP_PWRSTCTRL */
305#define OMAP54XX_DSP_L1_RETSTATE_SHIFT 8
306#define OMAP54XX_DSP_L1_RETSTATE_WIDTH 0x1
307#define OMAP54XX_DSP_L1_RETSTATE_MASK (1 << 8)
308
309/* Used by PM_DSP_PWRSTST */
310#define OMAP54XX_DSP_L1_STATEST_SHIFT 4
311#define OMAP54XX_DSP_L1_STATEST_WIDTH 0x2
312#define OMAP54XX_DSP_L1_STATEST_MASK (0x3 << 4)
313
314/* Used by PM_DSP_PWRSTCTRL */
315#define OMAP54XX_DSP_L2_ONSTATE_SHIFT 18
316#define OMAP54XX_DSP_L2_ONSTATE_WIDTH 0x2
317#define OMAP54XX_DSP_L2_ONSTATE_MASK (0x3 << 18)
318
319/* Used by PM_DSP_PWRSTCTRL */
320#define OMAP54XX_DSP_L2_RETSTATE_SHIFT 9
321#define OMAP54XX_DSP_L2_RETSTATE_WIDTH 0x1
322#define OMAP54XX_DSP_L2_RETSTATE_MASK (1 << 9)
323
324/* Used by PM_DSP_PWRSTST */
325#define OMAP54XX_DSP_L2_STATEST_SHIFT 6
326#define OMAP54XX_DSP_L2_STATEST_WIDTH 0x2
327#define OMAP54XX_DSP_L2_STATEST_MASK (0x3 << 6)
328
329/* Used by PM_DSS_PWRSTCTRL */
330#define OMAP54XX_DSS_MEM_ONSTATE_SHIFT 16
331#define OMAP54XX_DSS_MEM_ONSTATE_WIDTH 0x2
332#define OMAP54XX_DSS_MEM_ONSTATE_MASK (0x3 << 16)
333
334/* Used by PM_DSS_PWRSTCTRL */
335#define OMAP54XX_DSS_MEM_RETSTATE_SHIFT 8
336#define OMAP54XX_DSS_MEM_RETSTATE_WIDTH 0x1
337#define OMAP54XX_DSS_MEM_RETSTATE_MASK (1 << 8)
338
339/* Used by PM_DSS_PWRSTST */
340#define OMAP54XX_DSS_MEM_STATEST_SHIFT 4
341#define OMAP54XX_DSS_MEM_STATEST_WIDTH 0x2
342#define OMAP54XX_DSS_MEM_STATEST_MASK (0x3 << 4)
343
344/* Used by PRM_DEVICE_OFF_CTRL */
345#define OMAP54XX_EMIF1_OFFWKUP_DISABLE_SHIFT 8
346#define OMAP54XX_EMIF1_OFFWKUP_DISABLE_WIDTH 0x1
347#define OMAP54XX_EMIF1_OFFWKUP_DISABLE_MASK (1 << 8)
348
349/* Used by PRM_DEVICE_OFF_CTRL */
350#define OMAP54XX_EMIF2_OFFWKUP_DISABLE_SHIFT 9
351#define OMAP54XX_EMIF2_OFFWKUP_DISABLE_WIDTH 0x1
352#define OMAP54XX_EMIF2_OFFWKUP_DISABLE_MASK (1 << 9)
353
354/* Used by PM_EMU_PWRSTCTRL */
355#define OMAP54XX_EMU_BANK_ONSTATE_SHIFT 16
356#define OMAP54XX_EMU_BANK_ONSTATE_WIDTH 0x2
357#define OMAP54XX_EMU_BANK_ONSTATE_MASK (0x3 << 16)
358
359/* Used by PM_EMU_PWRSTST */
360#define OMAP54XX_EMU_BANK_STATEST_SHIFT 4
361#define OMAP54XX_EMU_BANK_STATEST_WIDTH 0x2
362#define OMAP54XX_EMU_BANK_STATEST_MASK (0x3 << 4)
363
364/*
365 * Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP,
366 * PRM_SRAM_WKUP_SETUP
367 */
368#define OMAP54XX_ENABLE_RTA_SHIFT 0
369#define OMAP54XX_ENABLE_RTA_WIDTH 0x1
370#define OMAP54XX_ENABLE_RTA_MASK (1 << 0)
371
372/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
373#define OMAP54XX_ENFUNC1_SHIFT 3
374#define OMAP54XX_ENFUNC1_WIDTH 0x1
375#define OMAP54XX_ENFUNC1_MASK (1 << 3)
376
377/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
378#define OMAP54XX_ENFUNC2_SHIFT 4
379#define OMAP54XX_ENFUNC2_WIDTH 0x1
380#define OMAP54XX_ENFUNC2_MASK (1 << 4)
381
382/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
383#define OMAP54XX_ENFUNC3_SHIFT 5
384#define OMAP54XX_ENFUNC3_WIDTH 0x1
385#define OMAP54XX_ENFUNC3_MASK (1 << 5)
386
387/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
388#define OMAP54XX_ENFUNC4_SHIFT 6
389#define OMAP54XX_ENFUNC4_WIDTH 0x1
390#define OMAP54XX_ENFUNC4_MASK (1 << 6)
391
392/* Used by PRM_SLDO_CORE_SETUP, PRM_SLDO_MM_SETUP, PRM_SLDO_MPU_SETUP */
393#define OMAP54XX_ENFUNC5_SHIFT 7
394#define OMAP54XX_ENFUNC5_WIDTH 0x1
395#define OMAP54XX_ENFUNC5_MASK (1 << 7)
396
397/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
398#define OMAP54XX_ERRORGAIN_SHIFT 16
399#define OMAP54XX_ERRORGAIN_WIDTH 0x8
400#define OMAP54XX_ERRORGAIN_MASK (0xff << 16)
401
402/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
403#define OMAP54XX_ERROROFFSET_SHIFT 24
404#define OMAP54XX_ERROROFFSET_WIDTH 0x8
405#define OMAP54XX_ERROROFFSET_MASK (0xff << 24)
406
407/* Used by PRM_RSTST */
408#define OMAP54XX_EXTERNAL_WARM_RST_SHIFT 5
409#define OMAP54XX_EXTERNAL_WARM_RST_WIDTH 0x1
410#define OMAP54XX_EXTERNAL_WARM_RST_MASK (1 << 5)
411
412/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
413#define OMAP54XX_FORCEUPDATE_SHIFT 1
414#define OMAP54XX_FORCEUPDATE_WIDTH 0x1
415#define OMAP54XX_FORCEUPDATE_MASK (1 << 1)
416
417/* Used by PRM_VP_CORE_VOLTAGE, PRM_VP_MM_VOLTAGE, PRM_VP_MPU_VOLTAGE */
418#define OMAP54XX_FORCEUPDATEWAIT_SHIFT 8
419#define OMAP54XX_FORCEUPDATEWAIT_WIDTH 0x18
420#define OMAP54XX_FORCEUPDATEWAIT_MASK (0xffffff << 8)
421
422/* Used by PRM_IRQENABLE_DSP, PRM_IRQENABLE_IPU */
423#define OMAP54XX_FORCEWKUP_EN_SHIFT 10
424#define OMAP54XX_FORCEWKUP_EN_WIDTH 0x1
425#define OMAP54XX_FORCEWKUP_EN_MASK (1 << 10)
426
427/* Used by PRM_IRQSTATUS_DSP, PRM_IRQSTATUS_IPU */
428#define OMAP54XX_FORCEWKUP_ST_SHIFT 10
429#define OMAP54XX_FORCEWKUP_ST_WIDTH 0x1
430#define OMAP54XX_FORCEWKUP_ST_MASK (1 << 10)
431
432/* Used by REVISION_PRM */
433#define OMAP54XX_FUNC_SHIFT 16
434#define OMAP54XX_FUNC_WIDTH 0xc
435#define OMAP54XX_FUNC_MASK (0xfff << 16)
436
437/* Used by PRM_RSTST */
438#define OMAP54XX_GLOBAL_COLD_RST_SHIFT 0
439#define OMAP54XX_GLOBAL_COLD_RST_WIDTH 0x1
440#define OMAP54XX_GLOBAL_COLD_RST_MASK (1 << 0)
441
442/* Used by PRM_RSTST */
443#define OMAP54XX_GLOBAL_WARM_SW_RST_SHIFT 1
444#define OMAP54XX_GLOBAL_WARM_SW_RST_WIDTH 0x1
445#define OMAP54XX_GLOBAL_WARM_SW_RST_MASK (1 << 1)
446
447/* Used by PRM_IO_PMCTRL */
448#define OMAP54XX_GLOBAL_WUEN_SHIFT 16
449#define OMAP54XX_GLOBAL_WUEN_WIDTH 0x1
450#define OMAP54XX_GLOBAL_WUEN_MASK (1 << 16)
451
452/* Used by PM_GPU_PWRSTCTRL */
453#define OMAP54XX_GPU_MEM_ONSTATE_SHIFT 16
454#define OMAP54XX_GPU_MEM_ONSTATE_WIDTH 0x2
455#define OMAP54XX_GPU_MEM_ONSTATE_MASK (0x3 << 16)
456
457/* Used by PM_GPU_PWRSTST */
458#define OMAP54XX_GPU_MEM_STATEST_SHIFT 4
459#define OMAP54XX_GPU_MEM_STATEST_WIDTH 0x2
460#define OMAP54XX_GPU_MEM_STATEST_MASK (0x3 << 4)
461
462/* Used by PRM_VC_CFG_I2C_MODE */
463#define OMAP54XX_HSMCODE_SHIFT 0
464#define OMAP54XX_HSMCODE_WIDTH 0x3
465#define OMAP54XX_HSMCODE_MASK (0x7 << 0)
466
467/* Used by PRM_VC_CFG_I2C_MODE */
468#define OMAP54XX_HSMODEEN_SHIFT 3
469#define OMAP54XX_HSMODEEN_WIDTH 0x1
470#define OMAP54XX_HSMODEEN_MASK (1 << 3)
471
472/* Used by PRM_VC_CFG_I2C_CLK */
473#define OMAP54XX_HSSCLH_SHIFT 16
474#define OMAP54XX_HSSCLH_WIDTH 0x8
475#define OMAP54XX_HSSCLH_MASK (0xff << 16)
476
477/* Used by PRM_VC_CFG_I2C_CLK */
478#define OMAP54XX_HSSCLL_SHIFT 24
479#define OMAP54XX_HSSCLL_WIDTH 0x8
480#define OMAP54XX_HSSCLL_MASK (0xff << 24)
481
482/* Used by PM_IVA_PWRSTCTRL */
483#define OMAP54XX_HWA_MEM_ONSTATE_SHIFT 16
484#define OMAP54XX_HWA_MEM_ONSTATE_WIDTH 0x2
485#define OMAP54XX_HWA_MEM_ONSTATE_MASK (0x3 << 16)
486
487/* Used by PM_IVA_PWRSTCTRL */
488#define OMAP54XX_HWA_MEM_RETSTATE_SHIFT 8
489#define OMAP54XX_HWA_MEM_RETSTATE_WIDTH 0x1
490#define OMAP54XX_HWA_MEM_RETSTATE_MASK (1 << 8)
491
492/* Used by PM_IVA_PWRSTST */
493#define OMAP54XX_HWA_MEM_STATEST_SHIFT 4
494#define OMAP54XX_HWA_MEM_STATEST_WIDTH 0x2
495#define OMAP54XX_HWA_MEM_STATEST_MASK (0x3 << 4)
496
497/* Used by PRM_RSTST */
498#define OMAP54XX_ICEPICK_RST_SHIFT 9
499#define OMAP54XX_ICEPICK_RST_WIDTH 0x1
500#define OMAP54XX_ICEPICK_RST_MASK (1 << 9)
501
502/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
503#define OMAP54XX_INITVDD_SHIFT 2
504#define OMAP54XX_INITVDD_WIDTH 0x1
505#define OMAP54XX_INITVDD_MASK (1 << 2)
506
507/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
508#define OMAP54XX_INITVOLTAGE_SHIFT 8
509#define OMAP54XX_INITVOLTAGE_WIDTH 0x8
510#define OMAP54XX_INITVOLTAGE_MASK (0xff << 8)
511
512/*
513 * Used by PM_ABE_PWRSTST, PM_CAM_PWRSTST, PM_CORE_PWRSTST,
514 * PM_CUSTEFUSE_PWRSTST, PM_DSP_PWRSTST, PM_DSS_PWRSTST, PM_EMU_PWRSTST,
515 * PM_GPU_PWRSTST, PM_IVA_PWRSTST, PM_L3INIT_PWRSTST, PM_MPU_PWRSTST,
516 * PRM_VOLTST_MM, PRM_VOLTST_MPU
517 */
518#define OMAP54XX_INTRANSITION_SHIFT 20
519#define OMAP54XX_INTRANSITION_WIDTH 0x1
520#define OMAP54XX_INTRANSITION_MASK (1 << 20)
521
522/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
523#define OMAP54XX_IO_EN_SHIFT 9
524#define OMAP54XX_IO_EN_WIDTH 0x1
525#define OMAP54XX_IO_EN_MASK (1 << 9)
526
527/* Used by PRM_IO_PMCTRL */
528#define OMAP54XX_IO_ON_STATUS_SHIFT 5
529#define OMAP54XX_IO_ON_STATUS_WIDTH 0x1
530#define OMAP54XX_IO_ON_STATUS_MASK (1 << 5)
531
532/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
533#define OMAP54XX_IO_ST_SHIFT 9
534#define OMAP54XX_IO_ST_WIDTH 0x1
535#define OMAP54XX_IO_ST_MASK (1 << 9)
536
537/* Used by PM_CORE_PWRSTCTRL */
538#define OMAP54XX_IPU_L2RAM_ONSTATE_SHIFT 20
539#define OMAP54XX_IPU_L2RAM_ONSTATE_WIDTH 0x2
540#define OMAP54XX_IPU_L2RAM_ONSTATE_MASK (0x3 << 20)
541
542/* Used by PM_CORE_PWRSTCTRL */
543#define OMAP54XX_IPU_L2RAM_RETSTATE_SHIFT 10
544#define OMAP54XX_IPU_L2RAM_RETSTATE_WIDTH 0x1
545#define OMAP54XX_IPU_L2RAM_RETSTATE_MASK (1 << 10)
546
547/* Used by PM_CORE_PWRSTST */
548#define OMAP54XX_IPU_L2RAM_STATEST_SHIFT 8
549#define OMAP54XX_IPU_L2RAM_STATEST_WIDTH 0x2
550#define OMAP54XX_IPU_L2RAM_STATEST_MASK (0x3 << 8)
551
552/* Used by PM_CORE_PWRSTCTRL */
553#define OMAP54XX_IPU_UNICACHE_ONSTATE_SHIFT 22
554#define OMAP54XX_IPU_UNICACHE_ONSTATE_WIDTH 0x2
555#define OMAP54XX_IPU_UNICACHE_ONSTATE_MASK (0x3 << 22)
556
557/* Used by PM_CORE_PWRSTCTRL */
558#define OMAP54XX_IPU_UNICACHE_RETSTATE_SHIFT 11
559#define OMAP54XX_IPU_UNICACHE_RETSTATE_WIDTH 0x1
560#define OMAP54XX_IPU_UNICACHE_RETSTATE_MASK (1 << 11)
561
562/* Used by PM_CORE_PWRSTST */
563#define OMAP54XX_IPU_UNICACHE_STATEST_SHIFT 10
564#define OMAP54XX_IPU_UNICACHE_STATEST_WIDTH 0x2
565#define OMAP54XX_IPU_UNICACHE_STATEST_MASK (0x3 << 10)
566
567/* Used by PRM_IO_PMCTRL */
568#define OMAP54XX_ISOCLK_OVERRIDE_SHIFT 0
569#define OMAP54XX_ISOCLK_OVERRIDE_WIDTH 0x1
570#define OMAP54XX_ISOCLK_OVERRIDE_MASK (1 << 0)
571
572/* Used by PRM_IO_PMCTRL */
573#define OMAP54XX_ISOCLK_STATUS_SHIFT 1
574#define OMAP54XX_ISOCLK_STATUS_WIDTH 0x1
575#define OMAP54XX_ISOCLK_STATUS_MASK (1 << 1)
576
577/* Used by PRM_IO_PMCTRL */
578#define OMAP54XX_ISOOVR_EXTEND_SHIFT 4
579#define OMAP54XX_ISOOVR_EXTEND_WIDTH 0x1
580#define OMAP54XX_ISOOVR_EXTEND_MASK (1 << 4)
581
582/* Used by PRM_IO_COUNT */
583#define OMAP54XX_ISO_2_ON_TIME_SHIFT 0
584#define OMAP54XX_ISO_2_ON_TIME_WIDTH 0x8
585#define OMAP54XX_ISO_2_ON_TIME_MASK (0xff << 0)
586
587/* Used by PM_L3INIT_PWRSTCTRL */
588#define OMAP54XX_L3INIT_BANK1_ONSTATE_SHIFT 16
589#define OMAP54XX_L3INIT_BANK1_ONSTATE_WIDTH 0x2
590#define OMAP54XX_L3INIT_BANK1_ONSTATE_MASK (0x3 << 16)
591
592/* Used by PM_L3INIT_PWRSTCTRL */
593#define OMAP54XX_L3INIT_BANK1_RETSTATE_SHIFT 8
594#define OMAP54XX_L3INIT_BANK1_RETSTATE_WIDTH 0x1
595#define OMAP54XX_L3INIT_BANK1_RETSTATE_MASK (1 << 8)
596
597/* Used by PM_L3INIT_PWRSTST */
598#define OMAP54XX_L3INIT_BANK1_STATEST_SHIFT 4
599#define OMAP54XX_L3INIT_BANK1_STATEST_WIDTH 0x2
600#define OMAP54XX_L3INIT_BANK1_STATEST_MASK (0x3 << 4)
601
602/* Used by PM_L3INIT_PWRSTCTRL */
603#define OMAP54XX_L3INIT_BANK2_ONSTATE_SHIFT 18
604#define OMAP54XX_L3INIT_BANK2_ONSTATE_WIDTH 0x2
605#define OMAP54XX_L3INIT_BANK2_ONSTATE_MASK (0x3 << 18)
606
607/* Used by PM_L3INIT_PWRSTCTRL */
608#define OMAP54XX_L3INIT_BANK2_RETSTATE_SHIFT 9
609#define OMAP54XX_L3INIT_BANK2_RETSTATE_WIDTH 0x1
610#define OMAP54XX_L3INIT_BANK2_RETSTATE_MASK (1 << 9)
611
612/* Used by PM_L3INIT_PWRSTST */
613#define OMAP54XX_L3INIT_BANK2_STATEST_SHIFT 6
614#define OMAP54XX_L3INIT_BANK2_STATEST_WIDTH 0x2
615#define OMAP54XX_L3INIT_BANK2_STATEST_MASK (0x3 << 6)
616
617/*
618 * Used by PM_ABE_PWRSTST, PM_CAM_PWRSTST, PM_CORE_PWRSTST,
619 * PM_CUSTEFUSE_PWRSTST, PM_DSP_PWRSTST, PM_DSS_PWRSTST, PM_EMU_PWRSTST,
620 * PM_GPU_PWRSTST, PM_IVA_PWRSTST, PM_L3INIT_PWRSTST, PM_MPU_PWRSTST
621 */
622#define OMAP54XX_LASTPOWERSTATEENTERED_SHIFT 24
623#define OMAP54XX_LASTPOWERSTATEENTERED_WIDTH 0x2
624#define OMAP54XX_LASTPOWERSTATEENTERED_MASK (0x3 << 24)
625
626/* Used by PRM_RSTST */
627#define OMAP54XX_LLI_RST_SHIFT 14
628#define OMAP54XX_LLI_RST_WIDTH 0x1
629#define OMAP54XX_LLI_RST_MASK (1 << 14)
630
631/*
632 * Used by PM_ABE_PWRSTCTRL, PM_CORE_PWRSTCTRL, PM_DSP_PWRSTCTRL,
633 * PM_DSS_PWRSTCTRL, PM_IVA_PWRSTCTRL, PM_L3INIT_PWRSTCTRL, PM_MPU_PWRSTCTRL
634 */
635#define OMAP54XX_LOGICRETSTATE_SHIFT 2
636#define OMAP54XX_LOGICRETSTATE_WIDTH 0x1
637#define OMAP54XX_LOGICRETSTATE_MASK (1 << 2)
638
639/*
640 * Used by PM_ABE_PWRSTST, PM_CAM_PWRSTST, PM_CORE_PWRSTST,
641 * PM_CUSTEFUSE_PWRSTST, PM_DSP_PWRSTST, PM_DSS_PWRSTST, PM_EMU_PWRSTST,
642 * PM_GPU_PWRSTST, PM_IVA_PWRSTST, PM_L3INIT_PWRSTST, PM_MPU_PWRSTST
643 */
644#define OMAP54XX_LOGICSTATEST_SHIFT 2
645#define OMAP54XX_LOGICSTATEST_WIDTH 0x1
646#define OMAP54XX_LOGICSTATEST_MASK (1 << 2)
647
648/*
649 * Used by RM_ABE_AESS_CONTEXT, RM_ABE_DMIC_CONTEXT, RM_ABE_MCASP_CONTEXT,
650 * RM_ABE_MCBSP1_CONTEXT, RM_ABE_MCBSP2_CONTEXT, RM_ABE_MCBSP3_CONTEXT,
651 * RM_ABE_MCPDM_CONTEXT, RM_ABE_SLIMBUS1_CONTEXT, RM_ABE_TIMER5_CONTEXT,
652 * RM_ABE_TIMER6_CONTEXT, RM_ABE_TIMER7_CONTEXT, RM_ABE_TIMER8_CONTEXT,
653 * RM_ABE_WD_TIMER3_CONTEXT, RM_C2C_C2C_CONTEXT, RM_C2C_C2C_OCP_FW_CONTEXT,
654 * RM_CAM_CAL_CONTEXT, RM_CAM_FDIF_CONTEXT, RM_CAM_ISS_CONTEXT,
655 * RM_COREAON_SMARTREFLEX_CORE_CONTEXT, RM_COREAON_SMARTREFLEX_MM_CONTEXT,
656 * RM_COREAON_SMARTREFLEX_MPU_CONTEXT, RM_CUSTEFUSE_EFUSE_CTRL_CUST_CONTEXT,
657 * RM_DSP_DSP_CONTEXT, RM_DSS_BB2D_CONTEXT, RM_DSS_DSS_CONTEXT,
658 * RM_EMIF_DMM_CONTEXT, RM_EMIF_EMIF1_CONTEXT, RM_EMIF_EMIF2_CONTEXT,
659 * RM_EMIF_EMIF_DLL_CONTEXT, RM_EMIF_EMIF_OCP_FW_CONTEXT,
660 * RM_EMU_DEBUGSS_CONTEXT, RM_GPU_GPU_CONTEXT, RM_IPU_IPU_CONTEXT,
661 * RM_IVA_IVA_CONTEXT, RM_IVA_SL2_CONTEXT, RM_L3INIT_IEEE1500_2_OCP_CONTEXT,
662 * RM_L3INIT_OCP2SCP1_CONTEXT, RM_L3INIT_OCP2SCP3_CONTEXT,
663 * RM_L3INIT_SATA_CONTEXT, RM_L3INIT_UNIPRO2_CONTEXT,
664 * RM_L3INSTR_L3_INSTR_CONTEXT, RM_L3INSTR_L3_MAIN_3_CONTEXT,
665 * RM_L3INSTR_OCP_WP_NOC_CONTEXT, RM_L3MAIN1_L3_MAIN_1_CONTEXT,
666 * RM_L3MAIN2_L3_MAIN_2_CONTEXT, RM_L3MAIN2_OCMC_RAM_CONTEXT,
667 * RM_L4CFG_L4_CFG_CONTEXT, RM_L4CFG_OCP2SCP2_CONTEXT,
668 * RM_L4CFG_SAR_ROM_CONTEXT, RM_L4PER_ELM_CONTEXT, RM_L4PER_HDQ1W_CONTEXT,
669 * RM_L4PER_I2C2_CONTEXT, RM_L4PER_I2C3_CONTEXT, RM_L4PER_I2C4_CONTEXT,
670 * RM_L4PER_I2C5_CONTEXT, RM_L4PER_L4_PER_CONTEXT, RM_L4PER_MCSPI1_CONTEXT,
671 * RM_L4PER_MCSPI2_CONTEXT, RM_L4PER_MCSPI3_CONTEXT, RM_L4PER_MCSPI4_CONTEXT,
672 * RM_L4PER_MMC3_CONTEXT, RM_L4PER_MMC4_CONTEXT, RM_L4PER_MMC5_CONTEXT,
673 * RM_L4PER_TIMER10_CONTEXT, RM_L4PER_TIMER11_CONTEXT, RM_L4PER_TIMER2_CONTEXT,
674 * RM_L4PER_TIMER3_CONTEXT, RM_L4PER_TIMER4_CONTEXT, RM_L4PER_TIMER9_CONTEXT,
675 * RM_L4SEC_FPKA_CONTEXT, RM_MIPIEXT_LLI_CONTEXT,
676 * RM_MIPIEXT_LLI_OCP_FW_CONTEXT, RM_MIPIEXT_MPHY_CONTEXT, RM_MPU_MPU_CONTEXT,
677 * RM_WKUPAON_COUNTER_32K_CONTEXT, RM_WKUPAON_GPIO1_CONTEXT,
678 * RM_WKUPAON_KBD_CONTEXT, RM_WKUPAON_L4_WKUP_CONTEXT,
679 * RM_WKUPAON_SAR_RAM_CONTEXT, RM_WKUPAON_TIMER12_CONTEXT,
680 * RM_WKUPAON_TIMER1_CONTEXT, RM_WKUPAON_WD_TIMER1_CONTEXT,
681 * RM_WKUPAON_WD_TIMER2_CONTEXT
682 */
683#define OMAP54XX_LOSTCONTEXT_DFF_SHIFT 0
684#define OMAP54XX_LOSTCONTEXT_DFF_WIDTH 0x1
685#define OMAP54XX_LOSTCONTEXT_DFF_MASK (1 << 0)
686
687/*
688 * Used by RM_C2C_C2C_CONTEXT, RM_C2C_C2C_OCP_FW_CONTEXT,
689 * RM_C2C_MODEM_ICR_CONTEXT, RM_DMA_DMA_SYSTEM_CONTEXT, RM_DSP_DSP_CONTEXT,
690 * RM_DSS_DSS_CONTEXT, RM_EMIF_DMM_CONTEXT, RM_EMIF_EMIF1_CONTEXT,
691 * RM_EMIF_EMIF2_CONTEXT, RM_EMIF_EMIF_OCP_FW_CONTEXT, RM_IPU_IPU_CONTEXT,
692 * RM_L3INIT_HSI_CONTEXT, RM_L3INIT_MMC1_CONTEXT, RM_L3INIT_MMC2_CONTEXT,
693 * RM_L3INIT_USB_HOST_HS_CONTEXT, RM_L3INIT_USB_OTG_SS_CONTEXT,
694 * RM_L3INIT_USB_TLL_HS_CONTEXT, RM_L3INSTR_L3_MAIN_3_CONTEXT,
695 * RM_L3INSTR_OCP_WP_NOC_CONTEXT, RM_L3MAIN1_L3_MAIN_1_CONTEXT,
696 * RM_L3MAIN2_GPMC_CONTEXT, RM_L3MAIN2_L3_MAIN_2_CONTEXT,
697 * RM_L4CFG_L4_CFG_CONTEXT, RM_L4CFG_MAILBOX_CONTEXT,
698 * RM_L4CFG_SPINLOCK_CONTEXT, RM_L4PER_GPIO2_CONTEXT, RM_L4PER_GPIO3_CONTEXT,
699 * RM_L4PER_GPIO4_CONTEXT, RM_L4PER_GPIO5_CONTEXT, RM_L4PER_GPIO6_CONTEXT,
700 * RM_L4PER_GPIO7_CONTEXT, RM_L4PER_GPIO8_CONTEXT, RM_L4PER_I2C1_CONTEXT,
701 * RM_L4PER_L4_PER_CONTEXT, RM_L4PER_UART1_CONTEXT, RM_L4PER_UART2_CONTEXT,
702 * RM_L4PER_UART3_CONTEXT, RM_L4PER_UART4_CONTEXT, RM_L4PER_UART5_CONTEXT,
703 * RM_L4PER_UART6_CONTEXT, RM_L4SEC_AES1_CONTEXT, RM_L4SEC_AES2_CONTEXT,
704 * RM_L4SEC_DES3DES_CONTEXT, RM_L4SEC_DMA_CRYPTO_CONTEXT, RM_L4SEC_RNG_CONTEXT,
705 * RM_L4SEC_SHA2MD5_CONTEXT, RM_MIPIEXT_LLI_CONTEXT,
706 * RM_MIPIEXT_LLI_OCP_FW_CONTEXT, RM_MIPIEXT_MPHY_CONTEXT, RM_MPU_MPU_CONTEXT
707 */
708#define OMAP54XX_LOSTCONTEXT_RFF_SHIFT 1
709#define OMAP54XX_LOSTCONTEXT_RFF_WIDTH 0x1
710#define OMAP54XX_LOSTCONTEXT_RFF_MASK (1 << 1)
711
712/* Used by RM_ABE_AESS_CONTEXT */
713#define OMAP54XX_LOSTMEM_AESSMEM_SHIFT 8
714#define OMAP54XX_LOSTMEM_AESSMEM_WIDTH 0x1
715#define OMAP54XX_LOSTMEM_AESSMEM_MASK (1 << 8)
716
717/* Used by RM_CAM_CAL_CONTEXT */
718#define OMAP54XX_LOSTMEM_CAL_MEM_SHIFT 8
719#define OMAP54XX_LOSTMEM_CAL_MEM_WIDTH 0x1
720#define OMAP54XX_LOSTMEM_CAL_MEM_MASK (1 << 8)
721
722/* Used by RM_CAM_FDIF_CONTEXT, RM_CAM_ISS_CONTEXT */
723#define OMAP54XX_LOSTMEM_CAM_MEM_SHIFT 8
724#define OMAP54XX_LOSTMEM_CAM_MEM_WIDTH 0x1
725#define OMAP54XX_LOSTMEM_CAM_MEM_MASK (1 << 8)
726
727/* Used by RM_EMIF_DMM_CONTEXT */
728#define OMAP54XX_LOSTMEM_CORE_NRET_BANK_SHIFT 9
729#define OMAP54XX_LOSTMEM_CORE_NRET_BANK_WIDTH 0x1
730#define OMAP54XX_LOSTMEM_CORE_NRET_BANK_MASK (1 << 9)
731
732/* Renamed from LOSTMEM_CORE_NRET_BANK Used by RM_L3INSTR_OCP_WP_NOC_CONTEXT */
733#define OMAP54XX_LOSTMEM_CORE_NRET_BANK_8_8_SHIFT 8
734#define OMAP54XX_LOSTMEM_CORE_NRET_BANK_8_8_WIDTH 0x1
735#define OMAP54XX_LOSTMEM_CORE_NRET_BANK_8_8_MASK (1 << 8)
736
737/* Used by RM_L3MAIN2_OCMC_RAM_CONTEXT */
738#define OMAP54XX_LOSTMEM_CORE_OCMRAM_SHIFT 8
739#define OMAP54XX_LOSTMEM_CORE_OCMRAM_WIDTH 0x1
740#define OMAP54XX_LOSTMEM_CORE_OCMRAM_MASK (1 << 8)
741
742/* Used by RM_DMA_DMA_SYSTEM_CONTEXT, RM_EMIF_DMM_CONTEXT */
743#define OMAP54XX_LOSTMEM_CORE_OTHER_BANK_SHIFT 8
744#define OMAP54XX_LOSTMEM_CORE_OTHER_BANK_WIDTH 0x1
745#define OMAP54XX_LOSTMEM_CORE_OTHER_BANK_MASK (1 << 8)
746
747/* Used by RM_DSP_DSP_CONTEXT */
748#define OMAP54XX_LOSTMEM_DSP_EDMA_SHIFT 10
749#define OMAP54XX_LOSTMEM_DSP_EDMA_WIDTH 0x1
750#define OMAP54XX_LOSTMEM_DSP_EDMA_MASK (1 << 10)
751
752/* Used by RM_DSP_DSP_CONTEXT */
753#define OMAP54XX_LOSTMEM_DSP_L1_SHIFT 8
754#define OMAP54XX_LOSTMEM_DSP_L1_WIDTH 0x1
755#define OMAP54XX_LOSTMEM_DSP_L1_MASK (1 << 8)
756
757/* Used by RM_DSP_DSP_CONTEXT */
758#define OMAP54XX_LOSTMEM_DSP_L2_SHIFT 9
759#define OMAP54XX_LOSTMEM_DSP_L2_WIDTH 0x1
760#define OMAP54XX_LOSTMEM_DSP_L2_MASK (1 << 9)
761
762/* Used by RM_DSS_BB2D_CONTEXT, RM_DSS_DSS_CONTEXT */
763#define OMAP54XX_LOSTMEM_DSS_MEM_SHIFT 8
764#define OMAP54XX_LOSTMEM_DSS_MEM_WIDTH 0x1
765#define OMAP54XX_LOSTMEM_DSS_MEM_MASK (1 << 8)
766
767/* Used by RM_EMU_DEBUGSS_CONTEXT */
768#define OMAP54XX_LOSTMEM_EMU_BANK_SHIFT 8
769#define OMAP54XX_LOSTMEM_EMU_BANK_WIDTH 0x1
770#define OMAP54XX_LOSTMEM_EMU_BANK_MASK (1 << 8)
771
772/* Used by RM_GPU_GPU_CONTEXT */
773#define OMAP54XX_LOSTMEM_GPU_MEM_SHIFT 8
774#define OMAP54XX_LOSTMEM_GPU_MEM_WIDTH 0x1
775#define OMAP54XX_LOSTMEM_GPU_MEM_MASK (1 << 8)
776
777/* Used by RM_IVA_IVA_CONTEXT */
778#define OMAP54XX_LOSTMEM_HWA_MEM_SHIFT 10
779#define OMAP54XX_LOSTMEM_HWA_MEM_WIDTH 0x1
780#define OMAP54XX_LOSTMEM_HWA_MEM_MASK (1 << 10)
781
782/* Used by RM_IPU_IPU_CONTEXT */
783#define OMAP54XX_LOSTMEM_IPU_L2RAM_SHIFT 9
784#define OMAP54XX_LOSTMEM_IPU_L2RAM_WIDTH 0x1
785#define OMAP54XX_LOSTMEM_IPU_L2RAM_MASK (1 << 9)
786
787/* Used by RM_IPU_IPU_CONTEXT */
788#define OMAP54XX_LOSTMEM_IPU_UNICACHE_SHIFT 8
789#define OMAP54XX_LOSTMEM_IPU_UNICACHE_WIDTH 0x1
790#define OMAP54XX_LOSTMEM_IPU_UNICACHE_MASK (1 << 8)
791
792/*
793 * Used by RM_L3INIT_HSI_CONTEXT, RM_L3INIT_MMC1_CONTEXT,
794 * RM_L3INIT_MMC2_CONTEXT, RM_L3INIT_SATA_CONTEXT, RM_L3INIT_UNIPRO2_CONTEXT,
795 * RM_L3INIT_USB_OTG_SS_CONTEXT
796 */
797#define OMAP54XX_LOSTMEM_L3INIT_BANK1_SHIFT 8
798#define OMAP54XX_LOSTMEM_L3INIT_BANK1_WIDTH 0x1
799#define OMAP54XX_LOSTMEM_L3INIT_BANK1_MASK (1 << 8)
800
801/* Used by RM_MPU_MPU_CONTEXT */
802#define OMAP54XX_LOSTMEM_MPU_L2_SHIFT 9
803#define OMAP54XX_LOSTMEM_MPU_L2_WIDTH 0x1
804#define OMAP54XX_LOSTMEM_MPU_L2_MASK (1 << 9)
805
806/* Used by RM_MPU_MPU_CONTEXT */
807#define OMAP54XX_LOSTMEM_MPU_RAM_SHIFT 10
808#define OMAP54XX_LOSTMEM_MPU_RAM_WIDTH 0x1
809#define OMAP54XX_LOSTMEM_MPU_RAM_MASK (1 << 10)
810
811/*
812 * Used by RM_L4PER_MMC3_CONTEXT, RM_L4PER_MMC4_CONTEXT, RM_L4PER_MMC5_CONTEXT,
813 * RM_L4SEC_FPKA_CONTEXT
814 */
815#define OMAP54XX_LOSTMEM_NONRETAINED_BANK_SHIFT 8
816#define OMAP54XX_LOSTMEM_NONRETAINED_BANK_WIDTH 0x1
817#define OMAP54XX_LOSTMEM_NONRETAINED_BANK_MASK (1 << 8)
818
819/*
820 * Used by RM_ABE_DMIC_CONTEXT, RM_ABE_MCBSP1_CONTEXT, RM_ABE_MCBSP2_CONTEXT,
821 * RM_ABE_MCBSP3_CONTEXT, RM_ABE_MCPDM_CONTEXT, RM_ABE_SLIMBUS1_CONTEXT
822 */
823#define OMAP54XX_LOSTMEM_PERIHPMEM_SHIFT 8
824#define OMAP54XX_LOSTMEM_PERIHPMEM_WIDTH 0x1
825#define OMAP54XX_LOSTMEM_PERIHPMEM_MASK (1 << 8)
826
827/*
828 * Used by RM_L4PER_UART1_CONTEXT, RM_L4PER_UART2_CONTEXT,
829 * RM_L4PER_UART3_CONTEXT, RM_L4PER_UART4_CONTEXT, RM_L4PER_UART5_CONTEXT,
830 * RM_L4PER_UART6_CONTEXT, RM_L4SEC_DMA_CRYPTO_CONTEXT
831 */
832#define OMAP54XX_LOSTMEM_RETAINED_BANK_SHIFT 8
833#define OMAP54XX_LOSTMEM_RETAINED_BANK_WIDTH 0x1
834#define OMAP54XX_LOSTMEM_RETAINED_BANK_MASK (1 << 8)
835
836/* Used by RM_IVA_SL2_CONTEXT */
837#define OMAP54XX_LOSTMEM_SL2_MEM_SHIFT 8
838#define OMAP54XX_LOSTMEM_SL2_MEM_WIDTH 0x1
839#define OMAP54XX_LOSTMEM_SL2_MEM_MASK (1 << 8)
840
841/* Used by RM_IVA_IVA_CONTEXT */
842#define OMAP54XX_LOSTMEM_TCM1_MEM_SHIFT 8
843#define OMAP54XX_LOSTMEM_TCM1_MEM_WIDTH 0x1
844#define OMAP54XX_LOSTMEM_TCM1_MEM_MASK (1 << 8)
845
846/* Used by RM_IVA_IVA_CONTEXT */
847#define OMAP54XX_LOSTMEM_TCM2_MEM_SHIFT 9
848#define OMAP54XX_LOSTMEM_TCM2_MEM_WIDTH 0x1
849#define OMAP54XX_LOSTMEM_TCM2_MEM_MASK (1 << 9)
850
851/* Used by RM_WKUPAON_SAR_RAM_CONTEXT */
852#define OMAP54XX_LOSTMEM_WKUP_BANK_SHIFT 8
853#define OMAP54XX_LOSTMEM_WKUP_BANK_WIDTH 0x1
854#define OMAP54XX_LOSTMEM_WKUP_BANK_MASK (1 << 8)
855
856/*
857 * Used by PM_ABE_PWRSTCTRL, PM_CAM_PWRSTCTRL, PM_CORE_PWRSTCTRL,
858 * PM_CUSTEFUSE_PWRSTCTRL, PM_DSP_PWRSTCTRL, PM_DSS_PWRSTCTRL,
859 * PM_GPU_PWRSTCTRL, PM_IVA_PWRSTCTRL, PM_L3INIT_PWRSTCTRL, PM_MPU_PWRSTCTRL
860 */
861#define OMAP54XX_LOWPOWERSTATECHANGE_SHIFT 4
862#define OMAP54XX_LOWPOWERSTATECHANGE_WIDTH 0x1
863#define OMAP54XX_LOWPOWERSTATECHANGE_MASK (1 << 4)
864
865/* Used by PRM_DEBUG_TRANS_CFG */
866#define OMAP54XX_MODE_SHIFT 0
867#define OMAP54XX_MODE_WIDTH 0x2
868#define OMAP54XX_MODE_MASK (0x3 << 0)
869
870/* Used by PRM_MODEM_IF_CTRL */
871#define OMAP54XX_MODEM_SHUTDOWN_IRQ_SHIFT 9
872#define OMAP54XX_MODEM_SHUTDOWN_IRQ_WIDTH 0x1
873#define OMAP54XX_MODEM_SHUTDOWN_IRQ_MASK (1 << 9)
874
875/* Used by PRM_MODEM_IF_CTRL */
876#define OMAP54XX_MODEM_WAKE_IRQ_SHIFT 8
877#define OMAP54XX_MODEM_WAKE_IRQ_WIDTH 0x1
878#define OMAP54XX_MODEM_WAKE_IRQ_MASK (1 << 8)
879
880/* Used by PM_MPU_PWRSTCTRL */
881#define OMAP54XX_MPU_L2_ONSTATE_SHIFT 18
882#define OMAP54XX_MPU_L2_ONSTATE_WIDTH 0x2
883#define OMAP54XX_MPU_L2_ONSTATE_MASK (0x3 << 18)
884
885/* Used by PM_MPU_PWRSTCTRL */
886#define OMAP54XX_MPU_L2_RETSTATE_SHIFT 9
887#define OMAP54XX_MPU_L2_RETSTATE_WIDTH 0x1
888#define OMAP54XX_MPU_L2_RETSTATE_MASK (1 << 9)
889
890/* Used by PM_MPU_PWRSTST */
891#define OMAP54XX_MPU_L2_STATEST_SHIFT 6
892#define OMAP54XX_MPU_L2_STATEST_WIDTH 0x2
893#define OMAP54XX_MPU_L2_STATEST_MASK (0x3 << 6)
894
895/* Used by PM_MPU_PWRSTCTRL */
896#define OMAP54XX_MPU_RAM_ONSTATE_SHIFT 20
897#define OMAP54XX_MPU_RAM_ONSTATE_WIDTH 0x2
898#define OMAP54XX_MPU_RAM_ONSTATE_MASK (0x3 << 20)
899
900/* Used by PM_MPU_PWRSTCTRL */
901#define OMAP54XX_MPU_RAM_RETSTATE_SHIFT 10
902#define OMAP54XX_MPU_RAM_RETSTATE_WIDTH 0x1
903#define OMAP54XX_MPU_RAM_RETSTATE_MASK (1 << 10)
904
905/* Used by PM_MPU_PWRSTST */
906#define OMAP54XX_MPU_RAM_STATEST_SHIFT 8
907#define OMAP54XX_MPU_RAM_STATEST_WIDTH 0x2
908#define OMAP54XX_MPU_RAM_STATEST_MASK (0x3 << 8)
909
910/* Used by PRM_RSTST */
911#define OMAP54XX_MPU_SECURITY_VIOL_RST_SHIFT 2
912#define OMAP54XX_MPU_SECURITY_VIOL_RST_WIDTH 0x1
913#define OMAP54XX_MPU_SECURITY_VIOL_RST_MASK (1 << 2)
914
915/* Used by PRM_RSTST */
916#define OMAP54XX_MPU_WDT_RST_SHIFT 3
917#define OMAP54XX_MPU_WDT_RST_WIDTH 0x1
918#define OMAP54XX_MPU_WDT_RST_MASK (1 << 3)
919
920/* Used by PRM_ABBLDO_MM_SETUP, PRM_ABBLDO_MPU_SETUP */
921#define OMAP54XX_NOCAP_SHIFT 4
922#define OMAP54XX_NOCAP_WIDTH 0x1
923#define OMAP54XX_NOCAP_MASK (1 << 4)
924
925/* Used by PM_CORE_PWRSTCTRL */
926#define OMAP54XX_OCP_NRET_BANK_ONSTATE_SHIFT 24
927#define OMAP54XX_OCP_NRET_BANK_ONSTATE_WIDTH 0x2
928#define OMAP54XX_OCP_NRET_BANK_ONSTATE_MASK (0x3 << 24)
929
930/* Used by PM_CORE_PWRSTCTRL */
931#define OMAP54XX_OCP_NRET_BANK_RETSTATE_SHIFT 12
932#define OMAP54XX_OCP_NRET_BANK_RETSTATE_WIDTH 0x1
933#define OMAP54XX_OCP_NRET_BANK_RETSTATE_MASK (1 << 12)
934
935/* Used by PM_CORE_PWRSTST */
936#define OMAP54XX_OCP_NRET_BANK_STATEST_SHIFT 12
937#define OMAP54XX_OCP_NRET_BANK_STATEST_WIDTH 0x2
938#define OMAP54XX_OCP_NRET_BANK_STATEST_MASK (0x3 << 12)
939
940/*
941 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_MM_L,
942 * PRM_VC_VAL_CMD_VDD_MPU_L
943 */
944#define OMAP54XX_OFF_SHIFT 0
945#define OMAP54XX_OFF_WIDTH 0x8
946#define OMAP54XX_OFF_MASK (0xff << 0)
947
948/*
949 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_MM_L,
950 * PRM_VC_VAL_CMD_VDD_MPU_L
951 */
952#define OMAP54XX_ON_SHIFT 24
953#define OMAP54XX_ON_WIDTH 0x8
954#define OMAP54XX_ON_MASK (0xff << 24)
955
956/*
957 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_MM_L,
958 * PRM_VC_VAL_CMD_VDD_MPU_L
959 */
960#define OMAP54XX_ONLP_SHIFT 16
961#define OMAP54XX_ONLP_WIDTH 0x8
962#define OMAP54XX_ONLP_MASK (0xff << 16)
963
964/* Used by PRM_ABBLDO_MM_CTRL, PRM_ABBLDO_MPU_CTRL */
965#define OMAP54XX_OPP_CHANGE_SHIFT 2
966#define OMAP54XX_OPP_CHANGE_WIDTH 0x1
967#define OMAP54XX_OPP_CHANGE_MASK (1 << 2)
968
969/* Used by PRM_VC_VAL_BYPASS */
970#define OMAP54XX_OPP_CHANGE_EMIF_LVL_SHIFT 25
971#define OMAP54XX_OPP_CHANGE_EMIF_LVL_WIDTH 0x1
972#define OMAP54XX_OPP_CHANGE_EMIF_LVL_MASK (1 << 25)
973
974/* Used by PRM_ABBLDO_MM_CTRL, PRM_ABBLDO_MPU_CTRL */
975#define OMAP54XX_OPP_SEL_SHIFT 0
976#define OMAP54XX_OPP_SEL_WIDTH 0x2
977#define OMAP54XX_OPP_SEL_MASK (0x3 << 0)
978
979/* Used by PRM_DEBUG_OUT */
980#define OMAP54XX_OUTPUT_SHIFT 0
981#define OMAP54XX_OUTPUT_WIDTH 0x20
982#define OMAP54XX_OUTPUT_MASK (0xffffffff << 0)
983
984/* Used by PRM_SRAM_COUNT */
985#define OMAP54XX_PCHARGECNT_VALUE_SHIFT 0
986#define OMAP54XX_PCHARGECNT_VALUE_WIDTH 0x6
987#define OMAP54XX_PCHARGECNT_VALUE_MASK (0x3f << 0)
988
989/* Used by PRM_PSCON_COUNT */
990#define OMAP54XX_PCHARGE_TIME_SHIFT 0
991#define OMAP54XX_PCHARGE_TIME_WIDTH 0x8
992#define OMAP54XX_PCHARGE_TIME_MASK (0xff << 0)
993
994/* Used by PM_ABE_PWRSTCTRL */
995#define OMAP54XX_PERIPHMEM_ONSTATE_SHIFT 20
996#define OMAP54XX_PERIPHMEM_ONSTATE_WIDTH 0x2
997#define OMAP54XX_PERIPHMEM_ONSTATE_MASK (0x3 << 20)
998
999/* Used by PM_ABE_PWRSTCTRL */
1000#define OMAP54XX_PERIPHMEM_RETSTATE_SHIFT 10
1001#define OMAP54XX_PERIPHMEM_RETSTATE_WIDTH 0x1
1002#define OMAP54XX_PERIPHMEM_RETSTATE_MASK (1 << 10)
1003
1004/* Used by PM_ABE_PWRSTST */
1005#define OMAP54XX_PERIPHMEM_STATEST_SHIFT 8
1006#define OMAP54XX_PERIPHMEM_STATEST_WIDTH 0x2
1007#define OMAP54XX_PERIPHMEM_STATEST_MASK (0x3 << 8)
1008
1009/* Used by PRM_PHASE1_CNDP */
1010#define OMAP54XX_PHASE1_CNDP_SHIFT 0
1011#define OMAP54XX_PHASE1_CNDP_WIDTH 0x20
1012#define OMAP54XX_PHASE1_CNDP_MASK (0xffffffff << 0)
1013
1014/* Used by PRM_PHASE2A_CNDP */
1015#define OMAP54XX_PHASE2A_CNDP_SHIFT 0
1016#define OMAP54XX_PHASE2A_CNDP_WIDTH 0x20
1017#define OMAP54XX_PHASE2A_CNDP_MASK (0xffffffff << 0)
1018
1019/* Used by PRM_PHASE2B_CNDP */
1020#define OMAP54XX_PHASE2B_CNDP_SHIFT 0
1021#define OMAP54XX_PHASE2B_CNDP_WIDTH 0x20
1022#define OMAP54XX_PHASE2B_CNDP_MASK (0xffffffff << 0)
1023
1024/* Used by PRM_PSCON_COUNT */
1025#define OMAP54XX_PONOUT_2_PGOODIN_TIME_SHIFT 8
1026#define OMAP54XX_PONOUT_2_PGOODIN_TIME_WIDTH 0x8
1027#define OMAP54XX_PONOUT_2_PGOODIN_TIME_MASK (0xff << 8)
1028
1029/*
1030 * Used by PM_ABE_PWRSTCTRL, PM_CAM_PWRSTCTRL, PM_CORE_PWRSTCTRL,
1031 * PM_CUSTEFUSE_PWRSTCTRL, PM_DSP_PWRSTCTRL, PM_DSS_PWRSTCTRL,
1032 * PM_EMU_PWRSTCTRL, PM_GPU_PWRSTCTRL, PM_IVA_PWRSTCTRL, PM_L3INIT_PWRSTCTRL,
1033 * PM_MPU_PWRSTCTRL
1034 */
1035#define OMAP54XX_POWERSTATE_SHIFT 0
1036#define OMAP54XX_POWERSTATE_WIDTH 0x2
1037#define OMAP54XX_POWERSTATE_MASK (0x3 << 0)
1038
1039/*
1040 * Used by PM_ABE_PWRSTST, PM_CAM_PWRSTST, PM_CORE_PWRSTST,
1041 * PM_CUSTEFUSE_PWRSTST, PM_DSP_PWRSTST, PM_DSS_PWRSTST, PM_EMU_PWRSTST,
1042 * PM_GPU_PWRSTST, PM_IVA_PWRSTST, PM_L3INIT_PWRSTST, PM_MPU_PWRSTST
1043 */
1044#define OMAP54XX_POWERSTATEST_SHIFT 0
1045#define OMAP54XX_POWERSTATEST_WIDTH 0x2
1046#define OMAP54XX_POWERSTATEST_MASK (0x3 << 0)
1047
1048/* Used by PRM_PWRREQCTRL */
1049#define OMAP54XX_PWRREQ_COND_SHIFT 0
1050#define OMAP54XX_PWRREQ_COND_WIDTH 0x2
1051#define OMAP54XX_PWRREQ_COND_MASK (0x3 << 0)
1052
1053/* Used by PRM_VC_SMPS_CORE_CONFIG */
1054#define OMAP54XX_RACEN_VDD_CORE_L_SHIFT 27
1055#define OMAP54XX_RACEN_VDD_CORE_L_WIDTH 0x1
1056#define OMAP54XX_RACEN_VDD_CORE_L_MASK (1 << 27)
1057
1058/* Used by PRM_VC_SMPS_MM_CONFIG */
1059#define OMAP54XX_RACEN_VDD_MM_L_SHIFT 27
1060#define OMAP54XX_RACEN_VDD_MM_L_WIDTH 0x1
1061#define OMAP54XX_RACEN_VDD_MM_L_MASK (1 << 27)
1062
1063/* Used by PRM_VC_SMPS_MPU_CONFIG */
1064#define OMAP54XX_RACEN_VDD_MPU_L_SHIFT 27
1065#define OMAP54XX_RACEN_VDD_MPU_L_WIDTH 0x1
1066#define OMAP54XX_RACEN_VDD_MPU_L_MASK (1 << 27)
1067
1068/* Used by PRM_VC_SMPS_CORE_CONFIG */
1069#define OMAP54XX_RAC_VDD_CORE_L_SHIFT 26
1070#define OMAP54XX_RAC_VDD_CORE_L_WIDTH 0x1
1071#define OMAP54XX_RAC_VDD_CORE_L_MASK (1 << 26)
1072
1073/* Used by PRM_VC_SMPS_MM_CONFIG */
1074#define OMAP54XX_RAC_VDD_MM_L_SHIFT 26
1075#define OMAP54XX_RAC_VDD_MM_L_WIDTH 0x1
1076#define OMAP54XX_RAC_VDD_MM_L_MASK (1 << 26)
1077
1078/* Used by PRM_VC_SMPS_MPU_CONFIG */
1079#define OMAP54XX_RAC_VDD_MPU_L_SHIFT 26
1080#define OMAP54XX_RAC_VDD_MPU_L_WIDTH 0x1
1081#define OMAP54XX_RAC_VDD_MPU_L_MASK (1 << 26)
1082
1083/*
1084 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
1085 * PRM_VOLTSETUP_MM_OFF, PRM_VOLTSETUP_MM_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
1086 * PRM_VOLTSETUP_MPU_RET_SLEEP
1087 */
1088#define OMAP54XX_RAMP_DOWN_COUNT_SHIFT 16
1089#define OMAP54XX_RAMP_DOWN_COUNT_WIDTH 0x6
1090#define OMAP54XX_RAMP_DOWN_COUNT_MASK (0x3f << 16)
1091
1092/*
1093 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
1094 * PRM_VOLTSETUP_MM_OFF, PRM_VOLTSETUP_MM_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
1095 * PRM_VOLTSETUP_MPU_RET_SLEEP
1096 */
1097#define OMAP54XX_RAMP_DOWN_PRESCAL_SHIFT 24
1098#define OMAP54XX_RAMP_DOWN_PRESCAL_WIDTH 0x2
1099#define OMAP54XX_RAMP_DOWN_PRESCAL_MASK (0x3 << 24)
1100
1101/*
1102 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
1103 * PRM_VOLTSETUP_MM_OFF, PRM_VOLTSETUP_MM_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
1104 * PRM_VOLTSETUP_MPU_RET_SLEEP
1105 */
1106#define OMAP54XX_RAMP_UP_COUNT_SHIFT 0
1107#define OMAP54XX_RAMP_UP_COUNT_WIDTH 0x6
1108#define OMAP54XX_RAMP_UP_COUNT_MASK (0x3f << 0)
1109
1110/*
1111 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
1112 * PRM_VOLTSETUP_MM_OFF, PRM_VOLTSETUP_MM_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
1113 * PRM_VOLTSETUP_MPU_RET_SLEEP
1114 */
1115#define OMAP54XX_RAMP_UP_PRESCAL_SHIFT 8
1116#define OMAP54XX_RAMP_UP_PRESCAL_WIDTH 0x2
1117#define OMAP54XX_RAMP_UP_PRESCAL_MASK (0x3 << 8)
1118
1119/* Used by PRM_VC_SMPS_CORE_CONFIG */
1120#define OMAP54XX_RAV_VDD_CORE_L_SHIFT 25
1121#define OMAP54XX_RAV_VDD_CORE_L_WIDTH 0x1
1122#define OMAP54XX_RAV_VDD_CORE_L_MASK (1 << 25)
1123
1124/* Used by PRM_VC_SMPS_MM_CONFIG */
1125#define OMAP54XX_RAV_VDD_MM_L_SHIFT 25
1126#define OMAP54XX_RAV_VDD_MM_L_WIDTH 0x1
1127#define OMAP54XX_RAV_VDD_MM_L_MASK (1 << 25)
1128
1129/* Used by PRM_VC_SMPS_MPU_CONFIG */
1130#define OMAP54XX_RAV_VDD_MPU_L_SHIFT 25
1131#define OMAP54XX_RAV_VDD_MPU_L_WIDTH 0x1
1132#define OMAP54XX_RAV_VDD_MPU_L_MASK (1 << 25)
1133
1134/* Used by PRM_VC_VAL_BYPASS */
1135#define OMAP54XX_REGADDR_SHIFT 8
1136#define OMAP54XX_REGADDR_WIDTH 0x8
1137#define OMAP54XX_REGADDR_MASK (0xff << 8)
1138
1139/*
1140 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_MM_L,
1141 * PRM_VC_VAL_CMD_VDD_MPU_L
1142 */
1143#define OMAP54XX_RET_SHIFT 8
1144#define OMAP54XX_RET_WIDTH 0x8
1145#define OMAP54XX_RET_MASK (0xff << 8)
1146
1147/* Used by PRM_SLDO_CORE_CTRL, PRM_SLDO_MM_CTRL, PRM_SLDO_MPU_CTRL */
1148#define OMAP54XX_RETMODE_ENABLE_SHIFT 0
1149#define OMAP54XX_RETMODE_ENABLE_WIDTH 0x1
1150#define OMAP54XX_RETMODE_ENABLE_MASK (1 << 0)
1151
1152/* Used by PRM_RSTTIME */
1153#define OMAP54XX_RSTTIME1_SHIFT 0
1154#define OMAP54XX_RSTTIME1_WIDTH 0xa
1155#define OMAP54XX_RSTTIME1_MASK (0x3ff << 0)
1156
1157/* Used by PRM_RSTTIME */
1158#define OMAP54XX_RSTTIME2_SHIFT 10
1159#define OMAP54XX_RSTTIME2_WIDTH 0x5
1160#define OMAP54XX_RSTTIME2_MASK (0x1f << 10)
1161
1162/* Used by RM_IPU_RSTCTRL, RM_IPU_RSTST */
1163#define OMAP54XX_RST_CPU0_SHIFT 0
1164#define OMAP54XX_RST_CPU0_WIDTH 0x1
1165#define OMAP54XX_RST_CPU0_MASK (1 << 0)
1166
1167/* Used by RM_IPU_RSTCTRL, RM_IPU_RSTST */
1168#define OMAP54XX_RST_CPU1_SHIFT 1
1169#define OMAP54XX_RST_CPU1_WIDTH 0x1
1170#define OMAP54XX_RST_CPU1_MASK (1 << 1)
1171
1172/* Used by RM_DSP_RSTCTRL, RM_DSP_RSTST */
1173#define OMAP54XX_RST_DSP_SHIFT 0
1174#define OMAP54XX_RST_DSP_WIDTH 0x1
1175#define OMAP54XX_RST_DSP_MASK (1 << 0)
1176
1177/* Used by RM_DSP_RSTST */
1178#define OMAP54XX_RST_DSP_EMU_SHIFT 2
1179#define OMAP54XX_RST_DSP_EMU_WIDTH 0x1
1180#define OMAP54XX_RST_DSP_EMU_MASK (1 << 2)
1181
1182/* Used by RM_DSP_RSTST */
1183#define OMAP54XX_RST_DSP_EMU_REQ_SHIFT 3
1184#define OMAP54XX_RST_DSP_EMU_REQ_WIDTH 0x1
1185#define OMAP54XX_RST_DSP_EMU_REQ_MASK (1 << 3)
1186
1187/* Used by RM_DSP_RSTCTRL, RM_DSP_RSTST */
1188#define OMAP54XX_RST_DSP_MMU_CACHE_SHIFT 1
1189#define OMAP54XX_RST_DSP_MMU_CACHE_WIDTH 0x1
1190#define OMAP54XX_RST_DSP_MMU_CACHE_MASK (1 << 1)
1191
1192/* Used by RM_IPU_RSTST */
1193#define OMAP54XX_RST_EMULATION_CPU0_SHIFT 3
1194#define OMAP54XX_RST_EMULATION_CPU0_WIDTH 0x1
1195#define OMAP54XX_RST_EMULATION_CPU0_MASK (1 << 3)
1196
1197/* Used by RM_IPU_RSTST */
1198#define OMAP54XX_RST_EMULATION_CPU1_SHIFT 4
1199#define OMAP54XX_RST_EMULATION_CPU1_WIDTH 0x1
1200#define OMAP54XX_RST_EMULATION_CPU1_MASK (1 << 4)
1201
1202/* Used by RM_IVA_RSTST */
1203#define OMAP54XX_RST_EMULATION_SEQ1_SHIFT 3
1204#define OMAP54XX_RST_EMULATION_SEQ1_WIDTH 0x1
1205#define OMAP54XX_RST_EMULATION_SEQ1_MASK (1 << 3)
1206
1207/* Used by RM_IVA_RSTST */
1208#define OMAP54XX_RST_EMULATION_SEQ2_SHIFT 4
1209#define OMAP54XX_RST_EMULATION_SEQ2_WIDTH 0x1
1210#define OMAP54XX_RST_EMULATION_SEQ2_MASK (1 << 4)
1211
1212/* Used by PRM_RSTCTRL */
1213#define OMAP54XX_RST_GLOBAL_COLD_SW_SHIFT 1
1214#define OMAP54XX_RST_GLOBAL_COLD_SW_WIDTH 0x1
1215#define OMAP54XX_RST_GLOBAL_COLD_SW_MASK (1 << 1)
1216
1217/* Used by PRM_RSTCTRL */
1218#define OMAP54XX_RST_GLOBAL_WARM_SW_SHIFT 0
1219#define OMAP54XX_RST_GLOBAL_WARM_SW_WIDTH 0x1
1220#define OMAP54XX_RST_GLOBAL_WARM_SW_MASK (1 << 0)
1221
1222/* Used by RM_IPU_RSTST */
1223#define OMAP54XX_RST_ICECRUSHER_CPU0_SHIFT 5
1224#define OMAP54XX_RST_ICECRUSHER_CPU0_WIDTH 0x1
1225#define OMAP54XX_RST_ICECRUSHER_CPU0_MASK (1 << 5)
1226
1227/* Used by RM_IPU_RSTST */
1228#define OMAP54XX_RST_ICECRUSHER_CPU1_SHIFT 6
1229#define OMAP54XX_RST_ICECRUSHER_CPU1_WIDTH 0x1
1230#define OMAP54XX_RST_ICECRUSHER_CPU1_MASK (1 << 6)
1231
1232/* Used by RM_IVA_RSTST */
1233#define OMAP54XX_RST_ICECRUSHER_SEQ1_SHIFT 5
1234#define OMAP54XX_RST_ICECRUSHER_SEQ1_WIDTH 0x1
1235#define OMAP54XX_RST_ICECRUSHER_SEQ1_MASK (1 << 5)
1236
1237/* Used by RM_IVA_RSTST */
1238#define OMAP54XX_RST_ICECRUSHER_SEQ2_SHIFT 6
1239#define OMAP54XX_RST_ICECRUSHER_SEQ2_WIDTH 0x1
1240#define OMAP54XX_RST_ICECRUSHER_SEQ2_MASK (1 << 6)
1241
1242/* Used by RM_IPU_RSTCTRL, RM_IPU_RSTST */
1243#define OMAP54XX_RST_IPU_MMU_CACHE_SHIFT 2
1244#define OMAP54XX_RST_IPU_MMU_CACHE_WIDTH 0x1
1245#define OMAP54XX_RST_IPU_MMU_CACHE_MASK (1 << 2)
1246
1247/* Used by RM_IVA_RSTCTRL, RM_IVA_RSTST */
1248#define OMAP54XX_RST_LOGIC_SHIFT 2
1249#define OMAP54XX_RST_LOGIC_WIDTH 0x1
1250#define OMAP54XX_RST_LOGIC_MASK (1 << 2)
1251
1252/* Used by RM_IVA_RSTCTRL, RM_IVA_RSTST */
1253#define OMAP54XX_RST_SEQ1_SHIFT 0
1254#define OMAP54XX_RST_SEQ1_WIDTH 0x1
1255#define OMAP54XX_RST_SEQ1_MASK (1 << 0)
1256
1257/* Used by RM_IVA_RSTCTRL, RM_IVA_RSTST */
1258#define OMAP54XX_RST_SEQ2_SHIFT 1
1259#define OMAP54XX_RST_SEQ2_WIDTH 0x1
1260#define OMAP54XX_RST_SEQ2_MASK (1 << 1)
1261
1262/* Used by REVISION_PRM */
1263#define OMAP54XX_R_RTL_SHIFT 11
1264#define OMAP54XX_R_RTL_WIDTH 0x5
1265#define OMAP54XX_R_RTL_MASK (0x1f << 11)
1266
1267/* Used by PRM_VC_SMPS_CORE_CONFIG */
1268#define OMAP54XX_SA_VDD_CORE_L_SHIFT 0
1269#define OMAP54XX_SA_VDD_CORE_L_WIDTH 0x7
1270#define OMAP54XX_SA_VDD_CORE_L_MASK (0x7f << 0)
1271
1272/* Used by PRM_VC_SMPS_MM_CONFIG */
1273#define OMAP54XX_SA_VDD_MM_L_SHIFT 0
1274#define OMAP54XX_SA_VDD_MM_L_WIDTH 0x7
1275#define OMAP54XX_SA_VDD_MM_L_MASK (0x7f << 0)
1276
1277/* Used by PRM_VC_SMPS_MPU_CONFIG */
1278#define OMAP54XX_SA_VDD_MPU_L_SHIFT 0
1279#define OMAP54XX_SA_VDD_MPU_L_WIDTH 0x7
1280#define OMAP54XX_SA_VDD_MPU_L_MASK (0x7f << 0)
1281
1282/* Used by REVISION_PRM */
1283#define OMAP54XX_SCHEME_SHIFT 30
1284#define OMAP54XX_SCHEME_WIDTH 0x2
1285#define OMAP54XX_SCHEME_MASK (0x3 << 30)
1286
1287/* Used by PRM_VC_CFG_I2C_CLK */
1288#define OMAP54XX_SCLH_SHIFT 0
1289#define OMAP54XX_SCLH_WIDTH 0x8
1290#define OMAP54XX_SCLH_MASK (0xff << 0)
1291
1292/* Used by PRM_VC_CFG_I2C_CLK */
1293#define OMAP54XX_SCLL_SHIFT 8
1294#define OMAP54XX_SCLL_WIDTH 0x8
1295#define OMAP54XX_SCLL_MASK (0xff << 8)
1296
1297/* Used by PRM_RSTST */
1298#define OMAP54XX_SECURE_WDT_RST_SHIFT 4
1299#define OMAP54XX_SECURE_WDT_RST_WIDTH 0x1
1300#define OMAP54XX_SECURE_WDT_RST_MASK (1 << 4)
1301
1302/* Used by PRM_VC_SMPS_CORE_CONFIG */
1303#define OMAP54XX_SEL_SA_VDD_CORE_L_SHIFT 24
1304#define OMAP54XX_SEL_SA_VDD_CORE_L_WIDTH 0x1
1305#define OMAP54XX_SEL_SA_VDD_CORE_L_MASK (1 << 24)
1306
1307/* Used by PRM_VC_SMPS_MM_CONFIG */
1308#define OMAP54XX_SEL_SA_VDD_MM_L_SHIFT 24
1309#define OMAP54XX_SEL_SA_VDD_MM_L_WIDTH 0x1
1310#define OMAP54XX_SEL_SA_VDD_MM_L_MASK (1 << 24)
1311
1312/* Used by PRM_VC_SMPS_MPU_CONFIG */
1313#define OMAP54XX_SEL_SA_VDD_MPU_L_SHIFT 24
1314#define OMAP54XX_SEL_SA_VDD_MPU_L_WIDTH 0x1
1315#define OMAP54XX_SEL_SA_VDD_MPU_L_MASK (1 << 24)
1316
1317/* Used by PM_IVA_PWRSTCTRL */
1318#define OMAP54XX_SL2_MEM_ONSTATE_SHIFT 18
1319#define OMAP54XX_SL2_MEM_ONSTATE_WIDTH 0x2
1320#define OMAP54XX_SL2_MEM_ONSTATE_MASK (0x3 << 18)
1321
1322/* Used by PM_IVA_PWRSTCTRL */
1323#define OMAP54XX_SL2_MEM_RETSTATE_SHIFT 9
1324#define OMAP54XX_SL2_MEM_RETSTATE_WIDTH 0x1
1325#define OMAP54XX_SL2_MEM_RETSTATE_MASK (1 << 9)
1326
1327/* Used by PM_IVA_PWRSTST */
1328#define OMAP54XX_SL2_MEM_STATEST_SHIFT 6
1329#define OMAP54XX_SL2_MEM_STATEST_WIDTH 0x2
1330#define OMAP54XX_SL2_MEM_STATEST_MASK (0x3 << 6)
1331
1332/* Used by PRM_VC_VAL_BYPASS */
1333#define OMAP54XX_SLAVEADDR_SHIFT 0
1334#define OMAP54XX_SLAVEADDR_WIDTH 0x7
1335#define OMAP54XX_SLAVEADDR_MASK (0x7f << 0)
1336
1337/* Used by PRM_SRAM_COUNT */
1338#define OMAP54XX_SLPCNT_VALUE_SHIFT 16
1339#define OMAP54XX_SLPCNT_VALUE_WIDTH 0x8
1340#define OMAP54XX_SLPCNT_VALUE_MASK (0xff << 16)
1341
1342/* Used by PRM_VP_CORE_VSTEPMAX, PRM_VP_MM_VSTEPMAX, PRM_VP_MPU_VSTEPMAX */
1343#define OMAP54XX_SMPSWAITTIMEMAX_SHIFT 8
1344#define OMAP54XX_SMPSWAITTIMEMAX_WIDTH 0x10
1345#define OMAP54XX_SMPSWAITTIMEMAX_MASK (0xffff << 8)
1346
1347/* Used by PRM_VP_CORE_VSTEPMIN, PRM_VP_MM_VSTEPMIN, PRM_VP_MPU_VSTEPMIN */
1348#define OMAP54XX_SMPSWAITTIMEMIN_SHIFT 8
1349#define OMAP54XX_SMPSWAITTIMEMIN_WIDTH 0x10
1350#define OMAP54XX_SMPSWAITTIMEMIN_MASK (0xffff << 8)
1351
1352/* Used by PRM_VC_CORE_ERRST */
1353#define OMAP54XX_SMPS_RA_ERR_CORE_SHIFT 1
1354#define OMAP54XX_SMPS_RA_ERR_CORE_WIDTH 0x1
1355#define OMAP54XX_SMPS_RA_ERR_CORE_MASK (1 << 1)
1356
1357/* Used by PRM_VC_MM_ERRST */
1358#define OMAP54XX_SMPS_RA_ERR_MM_SHIFT 1
1359#define OMAP54XX_SMPS_RA_ERR_MM_WIDTH 0x1
1360#define OMAP54XX_SMPS_RA_ERR_MM_MASK (1 << 1)
1361
1362/* Used by PRM_VC_MPU_ERRST */
1363#define OMAP54XX_SMPS_RA_ERR_MPU_SHIFT 1
1364#define OMAP54XX_SMPS_RA_ERR_MPU_WIDTH 0x1
1365#define OMAP54XX_SMPS_RA_ERR_MPU_MASK (1 << 1)
1366
1367/* Used by PRM_VC_CORE_ERRST */
1368#define OMAP54XX_SMPS_SA_ERR_CORE_SHIFT 0
1369#define OMAP54XX_SMPS_SA_ERR_CORE_WIDTH 0x1
1370#define OMAP54XX_SMPS_SA_ERR_CORE_MASK (1 << 0)
1371
1372/* Used by PRM_VC_MM_ERRST */
1373#define OMAP54XX_SMPS_SA_ERR_MM_SHIFT 0
1374#define OMAP54XX_SMPS_SA_ERR_MM_WIDTH 0x1
1375#define OMAP54XX_SMPS_SA_ERR_MM_MASK (1 << 0)
1376
1377/* Used by PRM_VC_MPU_ERRST */
1378#define OMAP54XX_SMPS_SA_ERR_MPU_SHIFT 0
1379#define OMAP54XX_SMPS_SA_ERR_MPU_WIDTH 0x1
1380#define OMAP54XX_SMPS_SA_ERR_MPU_MASK (1 << 0)
1381
1382/* Used by PRM_VC_CORE_ERRST */
1383#define OMAP54XX_SMPS_TIMEOUT_ERR_CORE_SHIFT 2
1384#define OMAP54XX_SMPS_TIMEOUT_ERR_CORE_WIDTH 0x1
1385#define OMAP54XX_SMPS_TIMEOUT_ERR_CORE_MASK (1 << 2)
1386
1387/* Used by PRM_VC_MM_ERRST */
1388#define OMAP54XX_SMPS_TIMEOUT_ERR_MM_SHIFT 2
1389#define OMAP54XX_SMPS_TIMEOUT_ERR_MM_WIDTH 0x1
1390#define OMAP54XX_SMPS_TIMEOUT_ERR_MM_MASK (1 << 2)
1391
1392/* Used by PRM_VC_MPU_ERRST */
1393#define OMAP54XX_SMPS_TIMEOUT_ERR_MPU_SHIFT 2
1394#define OMAP54XX_SMPS_TIMEOUT_ERR_MPU_WIDTH 0x1
1395#define OMAP54XX_SMPS_TIMEOUT_ERR_MPU_MASK (1 << 2)
1396
1397/* Used by PRM_ABBLDO_MM_SETUP, PRM_ABBLDO_MPU_SETUP */
1398#define OMAP54XX_SR2EN_SHIFT 0
1399#define OMAP54XX_SR2EN_WIDTH 0x1
1400#define OMAP54XX_SR2EN_MASK (1 << 0)
1401
1402/* Used by PRM_ABBLDO_MM_CTRL, PRM_ABBLDO_MPU_CTRL */
1403#define OMAP54XX_SR2_IN_TRANSITION_SHIFT 6
1404#define OMAP54XX_SR2_IN_TRANSITION_WIDTH 0x1
1405#define OMAP54XX_SR2_IN_TRANSITION_MASK (1 << 6)
1406
1407/* Used by PRM_ABBLDO_MM_CTRL, PRM_ABBLDO_MPU_CTRL */
1408#define OMAP54XX_SR2_STATUS_SHIFT 3
1409#define OMAP54XX_SR2_STATUS_WIDTH 0x2
1410#define OMAP54XX_SR2_STATUS_MASK (0x3 << 3)
1411
1412/* Used by PRM_ABBLDO_MM_SETUP, PRM_ABBLDO_MPU_SETUP */
1413#define OMAP54XX_SR2_WTCNT_VALUE_SHIFT 8
1414#define OMAP54XX_SR2_WTCNT_VALUE_WIDTH 0x8
1415#define OMAP54XX_SR2_WTCNT_VALUE_MASK (0xff << 8)
1416
1417/* Used by PRM_SLDO_CORE_CTRL, PRM_SLDO_MM_CTRL, PRM_SLDO_MPU_CTRL */
1418#define OMAP54XX_SRAMLDO_STATUS_SHIFT 8
1419#define OMAP54XX_SRAMLDO_STATUS_WIDTH 0x1
1420#define OMAP54XX_SRAMLDO_STATUS_MASK (1 << 8)
1421
1422/* Used by PRM_SLDO_CORE_CTRL, PRM_SLDO_MM_CTRL, PRM_SLDO_MPU_CTRL */
1423#define OMAP54XX_SRAM_IN_TRANSITION_SHIFT 9
1424#define OMAP54XX_SRAM_IN_TRANSITION_WIDTH 0x1
1425#define OMAP54XX_SRAM_IN_TRANSITION_MASK (1 << 9)
1426
1427/* Used by PRM_VC_CFG_I2C_MODE */
1428#define OMAP54XX_SRMODEEN_SHIFT 4
1429#define OMAP54XX_SRMODEEN_WIDTH 0x1
1430#define OMAP54XX_SRMODEEN_MASK (1 << 4)
1431
1432/* Used by PRM_VOLTSETUP_WARMRESET */
1433#define OMAP54XX_STABLE_COUNT_SHIFT 0
1434#define OMAP54XX_STABLE_COUNT_WIDTH 0x6
1435#define OMAP54XX_STABLE_COUNT_MASK (0x3f << 0)
1436
1437/* Used by PRM_VOLTSETUP_WARMRESET */
1438#define OMAP54XX_STABLE_PRESCAL_SHIFT 8
1439#define OMAP54XX_STABLE_PRESCAL_WIDTH 0x2
1440#define OMAP54XX_STABLE_PRESCAL_MASK (0x3 << 8)
1441
1442/* Used by PRM_BANDGAP_SETUP */
1443#define OMAP54XX_STARTUP_COUNT_SHIFT 0
1444#define OMAP54XX_STARTUP_COUNT_WIDTH 0x8
1445#define OMAP54XX_STARTUP_COUNT_MASK (0xff << 0)
1446
1447/* Renamed from STARTUP_COUNT Used by PRM_SRAM_COUNT */
1448#define OMAP54XX_STARTUP_COUNT_24_31_SHIFT 24
1449#define OMAP54XX_STARTUP_COUNT_24_31_WIDTH 0x8
1450#define OMAP54XX_STARTUP_COUNT_24_31_MASK (0xff << 24)
1451
1452/* Used by PM_IVA_PWRSTCTRL */
1453#define OMAP54XX_TCM1_MEM_ONSTATE_SHIFT 20
1454#define OMAP54XX_TCM1_MEM_ONSTATE_WIDTH 0x2
1455#define OMAP54XX_TCM1_MEM_ONSTATE_MASK (0x3 << 20)
1456
1457/* Used by PM_IVA_PWRSTCTRL */
1458#define OMAP54XX_TCM1_MEM_RETSTATE_SHIFT 10
1459#define OMAP54XX_TCM1_MEM_RETSTATE_WIDTH 0x1
1460#define OMAP54XX_TCM1_MEM_RETSTATE_MASK (1 << 10)
1461
1462/* Used by PM_IVA_PWRSTST */
1463#define OMAP54XX_TCM1_MEM_STATEST_SHIFT 8
1464#define OMAP54XX_TCM1_MEM_STATEST_WIDTH 0x2
1465#define OMAP54XX_TCM1_MEM_STATEST_MASK (0x3 << 8)
1466
1467/* Used by PM_IVA_PWRSTCTRL */
1468#define OMAP54XX_TCM2_MEM_ONSTATE_SHIFT 22
1469#define OMAP54XX_TCM2_MEM_ONSTATE_WIDTH 0x2
1470#define OMAP54XX_TCM2_MEM_ONSTATE_MASK (0x3 << 22)
1471
1472/* Used by PM_IVA_PWRSTCTRL */
1473#define OMAP54XX_TCM2_MEM_RETSTATE_SHIFT 11
1474#define OMAP54XX_TCM2_MEM_RETSTATE_WIDTH 0x1
1475#define OMAP54XX_TCM2_MEM_RETSTATE_MASK (1 << 11)
1476
1477/* Used by PM_IVA_PWRSTST */
1478#define OMAP54XX_TCM2_MEM_STATEST_SHIFT 10
1479#define OMAP54XX_TCM2_MEM_STATEST_WIDTH 0x2
1480#define OMAP54XX_TCM2_MEM_STATEST_MASK (0x3 << 10)
1481
1482/* Used by PRM_VP_CORE_VLIMITTO, PRM_VP_MM_VLIMITTO, PRM_VP_MPU_VLIMITTO */
1483#define OMAP54XX_TIMEOUT_SHIFT 0
1484#define OMAP54XX_TIMEOUT_WIDTH 0x10
1485#define OMAP54XX_TIMEOUT_MASK (0xffff << 0)
1486
1487/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
1488#define OMAP54XX_TIMEOUTEN_SHIFT 3
1489#define OMAP54XX_TIMEOUTEN_WIDTH 0x1
1490#define OMAP54XX_TIMEOUTEN_MASK (1 << 3)
1491
1492/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1493#define OMAP54XX_TRANSITION_EN_SHIFT 8
1494#define OMAP54XX_TRANSITION_EN_WIDTH 0x1
1495#define OMAP54XX_TRANSITION_EN_MASK (1 << 8)
1496
1497/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1498#define OMAP54XX_TRANSITION_ST_SHIFT 8
1499#define OMAP54XX_TRANSITION_ST_WIDTH 0x1
1500#define OMAP54XX_TRANSITION_ST_MASK (1 << 8)
1501
1502/* Used by PRM_DEBUG_TRANS_CFG */
1503#define OMAP54XX_TRIGGER_CLEAR_SHIFT 2
1504#define OMAP54XX_TRIGGER_CLEAR_WIDTH 0x1
1505#define OMAP54XX_TRIGGER_CLEAR_MASK (1 << 2)
1506
1507/* Used by PRM_RSTST */
1508#define OMAP54XX_TSHUT_CORE_RST_SHIFT 13
1509#define OMAP54XX_TSHUT_CORE_RST_WIDTH 0x1
1510#define OMAP54XX_TSHUT_CORE_RST_MASK (1 << 13)
1511
1512/* Used by PRM_RSTST */
1513#define OMAP54XX_TSHUT_MM_RST_SHIFT 12
1514#define OMAP54XX_TSHUT_MM_RST_WIDTH 0x1
1515#define OMAP54XX_TSHUT_MM_RST_MASK (1 << 12)
1516
1517/* Used by PRM_RSTST */
1518#define OMAP54XX_TSHUT_MPU_RST_SHIFT 11
1519#define OMAP54XX_TSHUT_MPU_RST_WIDTH 0x1
1520#define OMAP54XX_TSHUT_MPU_RST_MASK (1 << 11)
1521
1522/* Used by PRM_VC_VAL_BYPASS */
1523#define OMAP54XX_VALID_SHIFT 24
1524#define OMAP54XX_VALID_WIDTH 0x1
1525#define OMAP54XX_VALID_MASK (1 << 24)
1526
1527/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1528#define OMAP54XX_VC_BYPASSACK_EN_SHIFT 14
1529#define OMAP54XX_VC_BYPASSACK_EN_WIDTH 0x1
1530#define OMAP54XX_VC_BYPASSACK_EN_MASK (1 << 14)
1531
1532/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1533#define OMAP54XX_VC_BYPASSACK_ST_SHIFT 14
1534#define OMAP54XX_VC_BYPASSACK_ST_WIDTH 0x1
1535#define OMAP54XX_VC_BYPASSACK_ST_MASK (1 << 14)
1536
1537/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1538#define OMAP54XX_VC_CORE_VPACK_EN_SHIFT 22
1539#define OMAP54XX_VC_CORE_VPACK_EN_WIDTH 0x1
1540#define OMAP54XX_VC_CORE_VPACK_EN_MASK (1 << 22)
1541
1542/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1543#define OMAP54XX_VC_CORE_VPACK_ST_SHIFT 22
1544#define OMAP54XX_VC_CORE_VPACK_ST_WIDTH 0x1
1545#define OMAP54XX_VC_CORE_VPACK_ST_MASK (1 << 22)
1546
1547/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1548#define OMAP54XX_VC_MM_VPACK_EN_SHIFT 30
1549#define OMAP54XX_VC_MM_VPACK_EN_WIDTH 0x1
1550#define OMAP54XX_VC_MM_VPACK_EN_MASK (1 << 30)
1551
1552/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1553#define OMAP54XX_VC_MM_VPACK_ST_SHIFT 30
1554#define OMAP54XX_VC_MM_VPACK_ST_WIDTH 0x1
1555#define OMAP54XX_VC_MM_VPACK_ST_MASK (1 << 30)
1556
1557/* Used by PRM_IRQENABLE_MPU_2 */
1558#define OMAP54XX_VC_MPU_VPACK_EN_SHIFT 6
1559#define OMAP54XX_VC_MPU_VPACK_EN_WIDTH 0x1
1560#define OMAP54XX_VC_MPU_VPACK_EN_MASK (1 << 6)
1561
1562/* Used by PRM_IRQSTATUS_MPU_2 */
1563#define OMAP54XX_VC_MPU_VPACK_ST_SHIFT 6
1564#define OMAP54XX_VC_MPU_VPACK_ST_WIDTH 0x1
1565#define OMAP54XX_VC_MPU_VPACK_ST_MASK (1 << 6)
1566
1567/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1568#define OMAP54XX_VC_RAERR_EN_SHIFT 12
1569#define OMAP54XX_VC_RAERR_EN_WIDTH 0x1
1570#define OMAP54XX_VC_RAERR_EN_MASK (1 << 12)
1571
1572/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1573#define OMAP54XX_VC_RAERR_ST_SHIFT 12
1574#define OMAP54XX_VC_RAERR_ST_WIDTH 0x1
1575#define OMAP54XX_VC_RAERR_ST_MASK (1 << 12)
1576
1577/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1578#define OMAP54XX_VC_SAERR_EN_SHIFT 11
1579#define OMAP54XX_VC_SAERR_EN_WIDTH 0x1
1580#define OMAP54XX_VC_SAERR_EN_MASK (1 << 11)
1581
1582/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1583#define OMAP54XX_VC_SAERR_ST_SHIFT 11
1584#define OMAP54XX_VC_SAERR_ST_WIDTH 0x1
1585#define OMAP54XX_VC_SAERR_ST_MASK (1 << 11)
1586
1587/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1588#define OMAP54XX_VC_TOERR_EN_SHIFT 13
1589#define OMAP54XX_VC_TOERR_EN_WIDTH 0x1
1590#define OMAP54XX_VC_TOERR_EN_MASK (1 << 13)
1591
1592/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1593#define OMAP54XX_VC_TOERR_ST_SHIFT 13
1594#define OMAP54XX_VC_TOERR_ST_WIDTH 0x1
1595#define OMAP54XX_VC_TOERR_ST_MASK (1 << 13)
1596
1597/* Used by PRM_VP_CORE_VLIMITTO, PRM_VP_MM_VLIMITTO, PRM_VP_MPU_VLIMITTO */
1598#define OMAP54XX_VDDMAX_SHIFT 24
1599#define OMAP54XX_VDDMAX_WIDTH 0x8
1600#define OMAP54XX_VDDMAX_MASK (0xff << 24)
1601
1602/* Used by PRM_VP_CORE_VLIMITTO, PRM_VP_MM_VLIMITTO, PRM_VP_MPU_VLIMITTO */
1603#define OMAP54XX_VDDMIN_SHIFT 16
1604#define OMAP54XX_VDDMIN_WIDTH 0x8
1605#define OMAP54XX_VDDMIN_MASK (0xff << 16)
1606
1607/* Used by PRM_VOLTCTRL */
1608#define OMAP54XX_VDD_CORE_I2C_DISABLE_SHIFT 12
1609#define OMAP54XX_VDD_CORE_I2C_DISABLE_WIDTH 0x1
1610#define OMAP54XX_VDD_CORE_I2C_DISABLE_MASK (1 << 12)
1611
1612/* Used by PRM_RSTST */
1613#define OMAP54XX_VDD_CORE_VOLT_MGR_RST_SHIFT 8
1614#define OMAP54XX_VDD_CORE_VOLT_MGR_RST_WIDTH 0x1
1615#define OMAP54XX_VDD_CORE_VOLT_MGR_RST_MASK (1 << 8)
1616
1617/* Used by PRM_VOLTCTRL */
1618#define OMAP54XX_VDD_MM_I2C_DISABLE_SHIFT 14
1619#define OMAP54XX_VDD_MM_I2C_DISABLE_WIDTH 0x1
1620#define OMAP54XX_VDD_MM_I2C_DISABLE_MASK (1 << 14)
1621
1622/* Used by PRM_VOLTCTRL */
1623#define OMAP54XX_VDD_MM_PRESENCE_SHIFT 9
1624#define OMAP54XX_VDD_MM_PRESENCE_WIDTH 0x1
1625#define OMAP54XX_VDD_MM_PRESENCE_MASK (1 << 9)
1626
1627/* Used by PRM_RSTST */
1628#define OMAP54XX_VDD_MM_VOLT_MGR_RST_SHIFT 7
1629#define OMAP54XX_VDD_MM_VOLT_MGR_RST_WIDTH 0x1
1630#define OMAP54XX_VDD_MM_VOLT_MGR_RST_MASK (1 << 7)
1631
1632/* Used by PRM_VOLTCTRL */
1633#define OMAP54XX_VDD_MPU_I2C_DISABLE_SHIFT 13
1634#define OMAP54XX_VDD_MPU_I2C_DISABLE_WIDTH 0x1
1635#define OMAP54XX_VDD_MPU_I2C_DISABLE_MASK (1 << 13)
1636
1637/* Used by PRM_VOLTCTRL */
1638#define OMAP54XX_VDD_MPU_PRESENCE_SHIFT 8
1639#define OMAP54XX_VDD_MPU_PRESENCE_WIDTH 0x1
1640#define OMAP54XX_VDD_MPU_PRESENCE_MASK (1 << 8)
1641
1642/* Used by PRM_RSTST */
1643#define OMAP54XX_VDD_MPU_VOLT_MGR_RST_SHIFT 6
1644#define OMAP54XX_VDD_MPU_VOLT_MGR_RST_WIDTH 0x1
1645#define OMAP54XX_VDD_MPU_VOLT_MGR_RST_MASK (1 << 6)
1646
1647/* Used by PRM_VC_CORE_ERRST */
1648#define OMAP54XX_VFSM_RA_ERR_CORE_SHIFT 4
1649#define OMAP54XX_VFSM_RA_ERR_CORE_WIDTH 0x1
1650#define OMAP54XX_VFSM_RA_ERR_CORE_MASK (1 << 4)
1651
1652/* Used by PRM_VC_MM_ERRST */
1653#define OMAP54XX_VFSM_RA_ERR_MM_SHIFT 4
1654#define OMAP54XX_VFSM_RA_ERR_MM_WIDTH 0x1
1655#define OMAP54XX_VFSM_RA_ERR_MM_MASK (1 << 4)
1656
1657/* Used by PRM_VC_MPU_ERRST */
1658#define OMAP54XX_VFSM_RA_ERR_MPU_SHIFT 4
1659#define OMAP54XX_VFSM_RA_ERR_MPU_WIDTH 0x1
1660#define OMAP54XX_VFSM_RA_ERR_MPU_MASK (1 << 4)
1661
1662/* Used by PRM_VC_CORE_ERRST */
1663#define OMAP54XX_VFSM_SA_ERR_CORE_SHIFT 3
1664#define OMAP54XX_VFSM_SA_ERR_CORE_WIDTH 0x1
1665#define OMAP54XX_VFSM_SA_ERR_CORE_MASK (1 << 3)
1666
1667/* Used by PRM_VC_MM_ERRST */
1668#define OMAP54XX_VFSM_SA_ERR_MM_SHIFT 3
1669#define OMAP54XX_VFSM_SA_ERR_MM_WIDTH 0x1
1670#define OMAP54XX_VFSM_SA_ERR_MM_MASK (1 << 3)
1671
1672/* Used by PRM_VC_MPU_ERRST */
1673#define OMAP54XX_VFSM_SA_ERR_MPU_SHIFT 3
1674#define OMAP54XX_VFSM_SA_ERR_MPU_WIDTH 0x1
1675#define OMAP54XX_VFSM_SA_ERR_MPU_MASK (1 << 3)
1676
1677/* Used by PRM_VC_CORE_ERRST */
1678#define OMAP54XX_VFSM_TIMEOUT_ERR_CORE_SHIFT 5
1679#define OMAP54XX_VFSM_TIMEOUT_ERR_CORE_WIDTH 0x1
1680#define OMAP54XX_VFSM_TIMEOUT_ERR_CORE_MASK (1 << 5)
1681
1682/* Used by PRM_VC_MM_ERRST */
1683#define OMAP54XX_VFSM_TIMEOUT_ERR_MM_SHIFT 5
1684#define OMAP54XX_VFSM_TIMEOUT_ERR_MM_WIDTH 0x1
1685#define OMAP54XX_VFSM_TIMEOUT_ERR_MM_MASK (1 << 5)
1686
1687/* Used by PRM_VC_MPU_ERRST */
1688#define OMAP54XX_VFSM_TIMEOUT_ERR_MPU_SHIFT 5
1689#define OMAP54XX_VFSM_TIMEOUT_ERR_MPU_WIDTH 0x1
1690#define OMAP54XX_VFSM_TIMEOUT_ERR_MPU_MASK (1 << 5)
1691
1692/* Used by PRM_VC_SMPS_CORE_CONFIG */
1693#define OMAP54XX_VOLRA_VDD_CORE_L_SHIFT 8
1694#define OMAP54XX_VOLRA_VDD_CORE_L_WIDTH 0x8
1695#define OMAP54XX_VOLRA_VDD_CORE_L_MASK (0xff << 8)
1696
1697/* Used by PRM_VC_SMPS_MM_CONFIG */
1698#define OMAP54XX_VOLRA_VDD_MM_L_SHIFT 8
1699#define OMAP54XX_VOLRA_VDD_MM_L_WIDTH 0x8
1700#define OMAP54XX_VOLRA_VDD_MM_L_MASK (0xff << 8)
1701
1702/* Used by PRM_VC_SMPS_MPU_CONFIG */
1703#define OMAP54XX_VOLRA_VDD_MPU_L_SHIFT 8
1704#define OMAP54XX_VOLRA_VDD_MPU_L_WIDTH 0x8
1705#define OMAP54XX_VOLRA_VDD_MPU_L_MASK (0xff << 8)
1706
1707/* Used by PRM_VOLTST_MM, PRM_VOLTST_MPU */
1708#define OMAP54XX_VOLTSTATEST_SHIFT 0
1709#define OMAP54XX_VOLTSTATEST_WIDTH 0x2
1710#define OMAP54XX_VOLTSTATEST_MASK (0x3 << 0)
1711
1712/* Used by PRM_VP_CORE_CONFIG, PRM_VP_MM_CONFIG, PRM_VP_MPU_CONFIG */
1713#define OMAP54XX_VPENABLE_SHIFT 0
1714#define OMAP54XX_VPENABLE_WIDTH 0x1
1715#define OMAP54XX_VPENABLE_MASK (1 << 0)
1716
1717/* Used by PRM_VP_CORE_STATUS, PRM_VP_MM_STATUS, PRM_VP_MPU_STATUS */
1718#define OMAP54XX_VPINIDLE_SHIFT 0
1719#define OMAP54XX_VPINIDLE_WIDTH 0x1
1720#define OMAP54XX_VPINIDLE_MASK (1 << 0)
1721
1722/* Used by PRM_VP_CORE_VOLTAGE, PRM_VP_MM_VOLTAGE, PRM_VP_MPU_VOLTAGE */
1723#define OMAP54XX_VPVOLTAGE_SHIFT 0
1724#define OMAP54XX_VPVOLTAGE_WIDTH 0x8
1725#define OMAP54XX_VPVOLTAGE_MASK (0xff << 0)
1726
1727/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1728#define OMAP54XX_VP_CORE_EQVALUE_EN_SHIFT 20
1729#define OMAP54XX_VP_CORE_EQVALUE_EN_WIDTH 0x1
1730#define OMAP54XX_VP_CORE_EQVALUE_EN_MASK (1 << 20)
1731
1732/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1733#define OMAP54XX_VP_CORE_EQVALUE_ST_SHIFT 20
1734#define OMAP54XX_VP_CORE_EQVALUE_ST_WIDTH 0x1
1735#define OMAP54XX_VP_CORE_EQVALUE_ST_MASK (1 << 20)
1736
1737/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1738#define OMAP54XX_VP_CORE_MAXVDD_EN_SHIFT 18
1739#define OMAP54XX_VP_CORE_MAXVDD_EN_WIDTH 0x1
1740#define OMAP54XX_VP_CORE_MAXVDD_EN_MASK (1 << 18)
1741
1742/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1743#define OMAP54XX_VP_CORE_MAXVDD_ST_SHIFT 18
1744#define OMAP54XX_VP_CORE_MAXVDD_ST_WIDTH 0x1
1745#define OMAP54XX_VP_CORE_MAXVDD_ST_MASK (1 << 18)
1746
1747/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1748#define OMAP54XX_VP_CORE_MINVDD_EN_SHIFT 17
1749#define OMAP54XX_VP_CORE_MINVDD_EN_WIDTH 0x1
1750#define OMAP54XX_VP_CORE_MINVDD_EN_MASK (1 << 17)
1751
1752/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1753#define OMAP54XX_VP_CORE_MINVDD_ST_SHIFT 17
1754#define OMAP54XX_VP_CORE_MINVDD_ST_WIDTH 0x1
1755#define OMAP54XX_VP_CORE_MINVDD_ST_MASK (1 << 17)
1756
1757/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1758#define OMAP54XX_VP_CORE_NOSMPSACK_EN_SHIFT 19
1759#define OMAP54XX_VP_CORE_NOSMPSACK_EN_WIDTH 0x1
1760#define OMAP54XX_VP_CORE_NOSMPSACK_EN_MASK (1 << 19)
1761
1762/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1763#define OMAP54XX_VP_CORE_NOSMPSACK_ST_SHIFT 19
1764#define OMAP54XX_VP_CORE_NOSMPSACK_ST_WIDTH 0x1
1765#define OMAP54XX_VP_CORE_NOSMPSACK_ST_MASK (1 << 19)
1766
1767/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1768#define OMAP54XX_VP_CORE_OPPCHANGEDONE_EN_SHIFT 16
1769#define OMAP54XX_VP_CORE_OPPCHANGEDONE_EN_WIDTH 0x1
1770#define OMAP54XX_VP_CORE_OPPCHANGEDONE_EN_MASK (1 << 16)
1771
1772/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1773#define OMAP54XX_VP_CORE_OPPCHANGEDONE_ST_SHIFT 16
1774#define OMAP54XX_VP_CORE_OPPCHANGEDONE_ST_WIDTH 0x1
1775#define OMAP54XX_VP_CORE_OPPCHANGEDONE_ST_MASK (1 << 16)
1776
1777/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1778#define OMAP54XX_VP_CORE_TRANXDONE_EN_SHIFT 21
1779#define OMAP54XX_VP_CORE_TRANXDONE_EN_WIDTH 0x1
1780#define OMAP54XX_VP_CORE_TRANXDONE_EN_MASK (1 << 21)
1781
1782/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1783#define OMAP54XX_VP_CORE_TRANXDONE_ST_SHIFT 21
1784#define OMAP54XX_VP_CORE_TRANXDONE_ST_WIDTH 0x1
1785#define OMAP54XX_VP_CORE_TRANXDONE_ST_MASK (1 << 21)
1786
1787/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1788#define OMAP54XX_VP_MM_EQVALUE_EN_SHIFT 28
1789#define OMAP54XX_VP_MM_EQVALUE_EN_WIDTH 0x1
1790#define OMAP54XX_VP_MM_EQVALUE_EN_MASK (1 << 28)
1791
1792/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1793#define OMAP54XX_VP_MM_EQVALUE_ST_SHIFT 28
1794#define OMAP54XX_VP_MM_EQVALUE_ST_WIDTH 0x1
1795#define OMAP54XX_VP_MM_EQVALUE_ST_MASK (1 << 28)
1796
1797/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1798#define OMAP54XX_VP_MM_MAXVDD_EN_SHIFT 26
1799#define OMAP54XX_VP_MM_MAXVDD_EN_WIDTH 0x1
1800#define OMAP54XX_VP_MM_MAXVDD_EN_MASK (1 << 26)
1801
1802/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1803#define OMAP54XX_VP_MM_MAXVDD_ST_SHIFT 26
1804#define OMAP54XX_VP_MM_MAXVDD_ST_WIDTH 0x1
1805#define OMAP54XX_VP_MM_MAXVDD_ST_MASK (1 << 26)
1806
1807/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1808#define OMAP54XX_VP_MM_MINVDD_EN_SHIFT 25
1809#define OMAP54XX_VP_MM_MINVDD_EN_WIDTH 0x1
1810#define OMAP54XX_VP_MM_MINVDD_EN_MASK (1 << 25)
1811
1812/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1813#define OMAP54XX_VP_MM_MINVDD_ST_SHIFT 25
1814#define OMAP54XX_VP_MM_MINVDD_ST_WIDTH 0x1
1815#define OMAP54XX_VP_MM_MINVDD_ST_MASK (1 << 25)
1816
1817/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1818#define OMAP54XX_VP_MM_NOSMPSACK_EN_SHIFT 27
1819#define OMAP54XX_VP_MM_NOSMPSACK_EN_WIDTH 0x1
1820#define OMAP54XX_VP_MM_NOSMPSACK_EN_MASK (1 << 27)
1821
1822/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1823#define OMAP54XX_VP_MM_NOSMPSACK_ST_SHIFT 27
1824#define OMAP54XX_VP_MM_NOSMPSACK_ST_WIDTH 0x1
1825#define OMAP54XX_VP_MM_NOSMPSACK_ST_MASK (1 << 27)
1826
1827/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1828#define OMAP54XX_VP_MM_OPPCHANGEDONE_EN_SHIFT 24
1829#define OMAP54XX_VP_MM_OPPCHANGEDONE_EN_WIDTH 0x1
1830#define OMAP54XX_VP_MM_OPPCHANGEDONE_EN_MASK (1 << 24)
1831
1832/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1833#define OMAP54XX_VP_MM_OPPCHANGEDONE_ST_SHIFT 24
1834#define OMAP54XX_VP_MM_OPPCHANGEDONE_ST_WIDTH 0x1
1835#define OMAP54XX_VP_MM_OPPCHANGEDONE_ST_MASK (1 << 24)
1836
1837/* Used by PRM_IRQENABLE_IPU, PRM_IRQENABLE_MPU */
1838#define OMAP54XX_VP_MM_TRANXDONE_EN_SHIFT 29
1839#define OMAP54XX_VP_MM_TRANXDONE_EN_WIDTH 0x1
1840#define OMAP54XX_VP_MM_TRANXDONE_EN_MASK (1 << 29)
1841
1842/* Used by PRM_IRQSTATUS_IPU, PRM_IRQSTATUS_MPU */
1843#define OMAP54XX_VP_MM_TRANXDONE_ST_SHIFT 29
1844#define OMAP54XX_VP_MM_TRANXDONE_ST_WIDTH 0x1
1845#define OMAP54XX_VP_MM_TRANXDONE_ST_MASK (1 << 29)
1846
1847/* Used by PRM_IRQENABLE_MPU_2 */
1848#define OMAP54XX_VP_MPU_EQVALUE_EN_SHIFT 4
1849#define OMAP54XX_VP_MPU_EQVALUE_EN_WIDTH 0x1
1850#define OMAP54XX_VP_MPU_EQVALUE_EN_MASK (1 << 4)
1851
1852/* Used by PRM_IRQSTATUS_MPU_2 */
1853#define OMAP54XX_VP_MPU_EQVALUE_ST_SHIFT 4
1854#define OMAP54XX_VP_MPU_EQVALUE_ST_WIDTH 0x1
1855#define OMAP54XX_VP_MPU_EQVALUE_ST_MASK (1 << 4)
1856
1857/* Used by PRM_IRQENABLE_MPU_2 */
1858#define OMAP54XX_VP_MPU_MAXVDD_EN_SHIFT 2
1859#define OMAP54XX_VP_MPU_MAXVDD_EN_WIDTH 0x1
1860#define OMAP54XX_VP_MPU_MAXVDD_EN_MASK (1 << 2)
1861
1862/* Used by PRM_IRQSTATUS_MPU_2 */
1863#define OMAP54XX_VP_MPU_MAXVDD_ST_SHIFT 2
1864#define OMAP54XX_VP_MPU_MAXVDD_ST_WIDTH 0x1
1865#define OMAP54XX_VP_MPU_MAXVDD_ST_MASK (1 << 2)
1866
1867/* Used by PRM_IRQENABLE_MPU_2 */
1868#define OMAP54XX_VP_MPU_MINVDD_EN_SHIFT 1
1869#define OMAP54XX_VP_MPU_MINVDD_EN_WIDTH 0x1
1870#define OMAP54XX_VP_MPU_MINVDD_EN_MASK (1 << 1)
1871
1872/* Used by PRM_IRQSTATUS_MPU_2 */
1873#define OMAP54XX_VP_MPU_MINVDD_ST_SHIFT 1
1874#define OMAP54XX_VP_MPU_MINVDD_ST_WIDTH 0x1
1875#define OMAP54XX_VP_MPU_MINVDD_ST_MASK (1 << 1)
1876
1877/* Used by PRM_IRQENABLE_MPU_2 */
1878#define OMAP54XX_VP_MPU_NOSMPSACK_EN_SHIFT 3
1879#define OMAP54XX_VP_MPU_NOSMPSACK_EN_WIDTH 0x1
1880#define OMAP54XX_VP_MPU_NOSMPSACK_EN_MASK (1 << 3)
1881
1882/* Used by PRM_IRQSTATUS_MPU_2 */
1883#define OMAP54XX_VP_MPU_NOSMPSACK_ST_SHIFT 3
1884#define OMAP54XX_VP_MPU_NOSMPSACK_ST_WIDTH 0x1
1885#define OMAP54XX_VP_MPU_NOSMPSACK_ST_MASK (1 << 3)
1886
1887/* Used by PRM_IRQENABLE_MPU_2 */
1888#define OMAP54XX_VP_MPU_OPPCHANGEDONE_EN_SHIFT 0
1889#define OMAP54XX_VP_MPU_OPPCHANGEDONE_EN_WIDTH 0x1
1890#define OMAP54XX_VP_MPU_OPPCHANGEDONE_EN_MASK (1 << 0)
1891
1892/* Used by PRM_IRQSTATUS_MPU_2 */
1893#define OMAP54XX_VP_MPU_OPPCHANGEDONE_ST_SHIFT 0
1894#define OMAP54XX_VP_MPU_OPPCHANGEDONE_ST_WIDTH 0x1
1895#define OMAP54XX_VP_MPU_OPPCHANGEDONE_ST_MASK (1 << 0)
1896
1897/* Used by PRM_IRQENABLE_MPU_2 */
1898#define OMAP54XX_VP_MPU_TRANXDONE_EN_SHIFT 5
1899#define OMAP54XX_VP_MPU_TRANXDONE_EN_WIDTH 0x1
1900#define OMAP54XX_VP_MPU_TRANXDONE_EN_MASK (1 << 5)
1901
1902/* Used by PRM_IRQSTATUS_MPU_2 */
1903#define OMAP54XX_VP_MPU_TRANXDONE_ST_SHIFT 5
1904#define OMAP54XX_VP_MPU_TRANXDONE_ST_WIDTH 0x1
1905#define OMAP54XX_VP_MPU_TRANXDONE_ST_MASK (1 << 5)
1906
1907/* Used by PRM_SRAM_COUNT */
1908#define OMAP54XX_VSETUPCNT_VALUE_SHIFT 8
1909#define OMAP54XX_VSETUPCNT_VALUE_WIDTH 0x8
1910#define OMAP54XX_VSETUPCNT_VALUE_MASK (0xff << 8)
1911
1912/* Used by PRM_VP_CORE_VSTEPMAX, PRM_VP_MM_VSTEPMAX, PRM_VP_MPU_VSTEPMAX */
1913#define OMAP54XX_VSTEPMAX_SHIFT 0
1914#define OMAP54XX_VSTEPMAX_WIDTH 0x8
1915#define OMAP54XX_VSTEPMAX_MASK (0xff << 0)
1916
1917/* Used by PRM_VP_CORE_VSTEPMIN, PRM_VP_MM_VSTEPMIN, PRM_VP_MPU_VSTEPMIN */
1918#define OMAP54XX_VSTEPMIN_SHIFT 0
1919#define OMAP54XX_VSTEPMIN_WIDTH 0x8
1920#define OMAP54XX_VSTEPMIN_MASK (0xff << 0)
1921
1922/* Used by PM_DSS_DSS_WKDEP */
1923#define OMAP54XX_WKUPDEP_DISPC_DSP_SHIFT 2
1924#define OMAP54XX_WKUPDEP_DISPC_DSP_WIDTH 0x1
1925#define OMAP54XX_WKUPDEP_DISPC_DSP_MASK (1 << 2)
1926
1927/* Used by PM_DSS_DSS_WKDEP */
1928#define OMAP54XX_WKUPDEP_DISPC_IPU_SHIFT 1
1929#define OMAP54XX_WKUPDEP_DISPC_IPU_WIDTH 0x1
1930#define OMAP54XX_WKUPDEP_DISPC_IPU_MASK (1 << 1)
1931
1932/* Used by PM_DSS_DSS_WKDEP */
1933#define OMAP54XX_WKUPDEP_DISPC_MPU_SHIFT 0
1934#define OMAP54XX_WKUPDEP_DISPC_MPU_WIDTH 0x1
1935#define OMAP54XX_WKUPDEP_DISPC_MPU_MASK (1 << 0)
1936
1937/* Used by PM_DSS_DSS_WKDEP */
1938#define OMAP54XX_WKUPDEP_DISPC_SDMA_SHIFT 3
1939#define OMAP54XX_WKUPDEP_DISPC_SDMA_WIDTH 0x1
1940#define OMAP54XX_WKUPDEP_DISPC_SDMA_MASK (1 << 3)
1941
1942/* Used by PM_ABE_DMIC_WKDEP */
1943#define OMAP54XX_WKUPDEP_DMIC_DMA_DSP_SHIFT 6
1944#define OMAP54XX_WKUPDEP_DMIC_DMA_DSP_WIDTH 0x1
1945#define OMAP54XX_WKUPDEP_DMIC_DMA_DSP_MASK (1 << 6)
1946
1947/* Used by PM_ABE_DMIC_WKDEP */
1948#define OMAP54XX_WKUPDEP_DMIC_DMA_SDMA_SHIFT 7
1949#define OMAP54XX_WKUPDEP_DMIC_DMA_SDMA_WIDTH 0x1
1950#define OMAP54XX_WKUPDEP_DMIC_DMA_SDMA_MASK (1 << 7)
1951
1952/* Used by PM_ABE_DMIC_WKDEP */
1953#define OMAP54XX_WKUPDEP_DMIC_IRQ_DSP_SHIFT 2
1954#define OMAP54XX_WKUPDEP_DMIC_IRQ_DSP_WIDTH 0x1
1955#define OMAP54XX_WKUPDEP_DMIC_IRQ_DSP_MASK (1 << 2)
1956
1957/* Used by PM_ABE_DMIC_WKDEP */
1958#define OMAP54XX_WKUPDEP_DMIC_IRQ_MPU_SHIFT 0
1959#define OMAP54XX_WKUPDEP_DMIC_IRQ_MPU_WIDTH 0x1
1960#define OMAP54XX_WKUPDEP_DMIC_IRQ_MPU_MASK (1 << 0)
1961
1962/* Used by PM_DSS_DSS_WKDEP */
1963#define OMAP54XX_WKUPDEP_DSI1_A_DSP_SHIFT 6
1964#define OMAP54XX_WKUPDEP_DSI1_A_DSP_WIDTH 0x1
1965#define OMAP54XX_WKUPDEP_DSI1_A_DSP_MASK (1 << 6)
1966
1967/* Used by PM_DSS_DSS_WKDEP */
1968#define OMAP54XX_WKUPDEP_DSI1_A_IPU_SHIFT 5
1969#define OMAP54XX_WKUPDEP_DSI1_A_IPU_WIDTH 0x1
1970#define OMAP54XX_WKUPDEP_DSI1_A_IPU_MASK (1 << 5)
1971
1972/* Used by PM_DSS_DSS_WKDEP */
1973#define OMAP54XX_WKUPDEP_DSI1_A_MPU_SHIFT 4
1974#define OMAP54XX_WKUPDEP_DSI1_A_MPU_WIDTH 0x1
1975#define OMAP54XX_WKUPDEP_DSI1_A_MPU_MASK (1 << 4)
1976
1977/* Used by PM_DSS_DSS_WKDEP */
1978#define OMAP54XX_WKUPDEP_DSI1_A_SDMA_SHIFT 7
1979#define OMAP54XX_WKUPDEP_DSI1_A_SDMA_WIDTH 0x1
1980#define OMAP54XX_WKUPDEP_DSI1_A_SDMA_MASK (1 << 7)
1981
1982/* Used by PM_DSS_DSS_WKDEP */
1983#define OMAP54XX_WKUPDEP_DSI1_B_DSP_SHIFT 10
1984#define OMAP54XX_WKUPDEP_DSI1_B_DSP_WIDTH 0x1
1985#define OMAP54XX_WKUPDEP_DSI1_B_DSP_MASK (1 << 10)
1986
1987/* Used by PM_DSS_DSS_WKDEP */
1988#define OMAP54XX_WKUPDEP_DSI1_B_IPU_SHIFT 9
1989#define OMAP54XX_WKUPDEP_DSI1_B_IPU_WIDTH 0x1
1990#define OMAP54XX_WKUPDEP_DSI1_B_IPU_MASK (1 << 9)
1991
1992/* Used by PM_DSS_DSS_WKDEP */
1993#define OMAP54XX_WKUPDEP_DSI1_B_MPU_SHIFT 8
1994#define OMAP54XX_WKUPDEP_DSI1_B_MPU_WIDTH 0x1
1995#define OMAP54XX_WKUPDEP_DSI1_B_MPU_MASK (1 << 8)
1996
1997/* Used by PM_DSS_DSS_WKDEP */
1998#define OMAP54XX_WKUPDEP_DSI1_B_SDMA_SHIFT 11
1999#define OMAP54XX_WKUPDEP_DSI1_B_SDMA_WIDTH 0x1
2000#define OMAP54XX_WKUPDEP_DSI1_B_SDMA_MASK (1 << 11)
2001
2002/* Used by PM_DSS_DSS_WKDEP */
2003#define OMAP54XX_WKUPDEP_DSI1_C_DSP_SHIFT 17
2004#define OMAP54XX_WKUPDEP_DSI1_C_DSP_WIDTH 0x1
2005#define OMAP54XX_WKUPDEP_DSI1_C_DSP_MASK (1 << 17)
2006
2007/* Used by PM_DSS_DSS_WKDEP */
2008#define OMAP54XX_WKUPDEP_DSI1_C_IPU_SHIFT 16
2009#define OMAP54XX_WKUPDEP_DSI1_C_IPU_WIDTH 0x1
2010#define OMAP54XX_WKUPDEP_DSI1_C_IPU_MASK (1 << 16)
2011
2012/* Used by PM_DSS_DSS_WKDEP */
2013#define OMAP54XX_WKUPDEP_DSI1_C_MPU_SHIFT 15
2014#define OMAP54XX_WKUPDEP_DSI1_C_MPU_WIDTH 0x1
2015#define OMAP54XX_WKUPDEP_DSI1_C_MPU_MASK (1 << 15)
2016
2017/* Used by PM_DSS_DSS_WKDEP */
2018#define OMAP54XX_WKUPDEP_DSI1_C_SDMA_SHIFT 18
2019#define OMAP54XX_WKUPDEP_DSI1_C_SDMA_WIDTH 0x1
2020#define OMAP54XX_WKUPDEP_DSI1_C_SDMA_MASK (1 << 18)
2021
2022/* Used by PM_WKUPAON_GPIO1_WKDEP */
2023#define OMAP54XX_WKUPDEP_GPIO1_IRQ1_IPU_SHIFT 1
2024#define OMAP54XX_WKUPDEP_GPIO1_IRQ1_IPU_WIDTH 0x1
2025#define OMAP54XX_WKUPDEP_GPIO1_IRQ1_IPU_MASK (1 << 1)
2026
2027/* Used by PM_WKUPAON_GPIO1_WKDEP */
2028#define OMAP54XX_WKUPDEP_GPIO1_IRQ1_MPU_SHIFT 0
2029#define OMAP54XX_WKUPDEP_GPIO1_IRQ1_MPU_WIDTH 0x1
2030#define OMAP54XX_WKUPDEP_GPIO1_IRQ1_MPU_MASK (1 << 0)
2031
2032/* Used by PM_WKUPAON_GPIO1_WKDEP */
2033#define OMAP54XX_WKUPDEP_GPIO1_IRQ2_DSP_SHIFT 6
2034#define OMAP54XX_WKUPDEP_GPIO1_IRQ2_DSP_WIDTH 0x1
2035#define OMAP54XX_WKUPDEP_GPIO1_IRQ2_DSP_MASK (1 << 6)
2036
2037/* Used by PM_L4PER_GPIO2_WKDEP */
2038#define OMAP54XX_WKUPDEP_GPIO2_IRQ1_IPU_SHIFT 1
2039#define OMAP54XX_WKUPDEP_GPIO2_IRQ1_IPU_WIDTH 0x1
2040#define OMAP54XX_WKUPDEP_GPIO2_IRQ1_IPU_MASK (1 << 1)
2041
2042/* Used by PM_L4PER_GPIO2_WKDEP */
2043#define OMAP54XX_WKUPDEP_GPIO2_IRQ1_MPU_SHIFT 0
2044#define OMAP54XX_WKUPDEP_GPIO2_IRQ1_MPU_WIDTH 0x1
2045#define OMAP54XX_WKUPDEP_GPIO2_IRQ1_MPU_MASK (1 << 0)
2046
2047/* Used by PM_L4PER_GPIO2_WKDEP */
2048#define OMAP54XX_WKUPDEP_GPIO2_IRQ2_DSP_SHIFT 6
2049#define OMAP54XX_WKUPDEP_GPIO2_IRQ2_DSP_WIDTH 0x1
2050#define OMAP54XX_WKUPDEP_GPIO2_IRQ2_DSP_MASK (1 << 6)
2051
2052/* Used by PM_L4PER_GPIO3_WKDEP */
2053#define OMAP54XX_WKUPDEP_GPIO3_IRQ1_MPU_SHIFT 0
2054#define OMAP54XX_WKUPDEP_GPIO3_IRQ1_MPU_WIDTH 0x1
2055#define OMAP54XX_WKUPDEP_GPIO3_IRQ1_MPU_MASK (1 << 0)
2056
2057/* Used by PM_L4PER_GPIO3_WKDEP */
2058#define OMAP54XX_WKUPDEP_GPIO3_IRQ2_DSP_SHIFT 6
2059#define OMAP54XX_WKUPDEP_GPIO3_IRQ2_DSP_WIDTH 0x1
2060#define OMAP54XX_WKUPDEP_GPIO3_IRQ2_DSP_MASK (1 << 6)
2061
2062/* Used by PM_L4PER_GPIO4_WKDEP */
2063#define OMAP54XX_WKUPDEP_GPIO4_IRQ1_MPU_SHIFT 0
2064#define OMAP54XX_WKUPDEP_GPIO4_IRQ1_MPU_WIDTH 0x1
2065#define OMAP54XX_WKUPDEP_GPIO4_IRQ1_MPU_MASK (1 << 0)
2066
2067/* Used by PM_L4PER_GPIO4_WKDEP */
2068#define OMAP54XX_WKUPDEP_GPIO4_IRQ2_DSP_SHIFT 6
2069#define OMAP54XX_WKUPDEP_GPIO4_IRQ2_DSP_WIDTH 0x1
2070#define OMAP54XX_WKUPDEP_GPIO4_IRQ2_DSP_MASK (1 << 6)
2071
2072/* Used by PM_L4PER_GPIO5_WKDEP */
2073#define OMAP54XX_WKUPDEP_GPIO5_IRQ1_MPU_SHIFT 0
2074#define OMAP54XX_WKUPDEP_GPIO5_IRQ1_MPU_WIDTH 0x1
2075#define OMAP54XX_WKUPDEP_GPIO5_IRQ1_MPU_MASK (1 << 0)
2076
2077/* Used by PM_L4PER_GPIO5_WKDEP */
2078#define OMAP54XX_WKUPDEP_GPIO5_IRQ2_DSP_SHIFT 6
2079#define OMAP54XX_WKUPDEP_GPIO5_IRQ2_DSP_WIDTH 0x1
2080#define OMAP54XX_WKUPDEP_GPIO5_IRQ2_DSP_MASK (1 << 6)
2081
2082/* Used by PM_L4PER_GPIO6_WKDEP */
2083#define OMAP54XX_WKUPDEP_GPIO6_IRQ1_MPU_SHIFT 0
2084#define OMAP54XX_WKUPDEP_GPIO6_IRQ1_MPU_WIDTH 0x1
2085#define OMAP54XX_WKUPDEP_GPIO6_IRQ1_MPU_MASK (1 << 0)
2086
2087/* Used by PM_L4PER_GPIO6_WKDEP */
2088#define OMAP54XX_WKUPDEP_GPIO6_IRQ2_DSP_SHIFT 6
2089#define OMAP54XX_WKUPDEP_GPIO6_IRQ2_DSP_WIDTH 0x1
2090#define OMAP54XX_WKUPDEP_GPIO6_IRQ2_DSP_MASK (1 << 6)
2091
2092/* Used by PM_L4PER_GPIO7_WKDEP */
2093#define OMAP54XX_WKUPDEP_GPIO7_IRQ1_MPU_SHIFT 0
2094#define OMAP54XX_WKUPDEP_GPIO7_IRQ1_MPU_WIDTH 0x1
2095#define OMAP54XX_WKUPDEP_GPIO7_IRQ1_MPU_MASK (1 << 0)
2096
2097/* Used by PM_L4PER_GPIO8_WKDEP */
2098#define OMAP54XX_WKUPDEP_GPIO8_IRQ1_MPU_SHIFT 0
2099#define OMAP54XX_WKUPDEP_GPIO8_IRQ1_MPU_WIDTH 0x1
2100#define OMAP54XX_WKUPDEP_GPIO8_IRQ1_MPU_MASK (1 << 0)
2101
2102/* Used by PM_DSS_DSS_WKDEP */
2103#define OMAP54XX_WKUPDEP_HDMIDMA_SDMA_SHIFT 19
2104#define OMAP54XX_WKUPDEP_HDMIDMA_SDMA_WIDTH 0x1
2105#define OMAP54XX_WKUPDEP_HDMIDMA_SDMA_MASK (1 << 19)
2106
2107/* Used by PM_DSS_DSS_WKDEP */
2108#define OMAP54XX_WKUPDEP_HDMIIRQ_DSP_SHIFT 14
2109#define OMAP54XX_WKUPDEP_HDMIIRQ_DSP_WIDTH 0x1
2110#define OMAP54XX_WKUPDEP_HDMIIRQ_DSP_MASK (1 << 14)
2111
2112/* Used by PM_DSS_DSS_WKDEP */
2113#define OMAP54XX_WKUPDEP_HDMIIRQ_IPU_SHIFT 13
2114#define OMAP54XX_WKUPDEP_HDMIIRQ_IPU_WIDTH 0x1
2115#define OMAP54XX_WKUPDEP_HDMIIRQ_IPU_MASK (1 << 13)
2116
2117/* Used by PM_DSS_DSS_WKDEP */
2118#define OMAP54XX_WKUPDEP_HDMIIRQ_MPU_SHIFT 12
2119#define OMAP54XX_WKUPDEP_HDMIIRQ_MPU_WIDTH 0x1
2120#define OMAP54XX_WKUPDEP_HDMIIRQ_MPU_MASK (1 << 12)
2121
2122/* Used by PM_L3INIT_HSI_WKDEP */
2123#define OMAP54XX_WKUPDEP_HSI_DSP_DSP_SHIFT 6
2124#define OMAP54XX_WKUPDEP_HSI_DSP_DSP_WIDTH 0x1
2125#define OMAP54XX_WKUPDEP_HSI_DSP_DSP_MASK (1 << 6)
2126
2127/* Used by PM_L3INIT_HSI_WKDEP */
2128#define OMAP54XX_WKUPDEP_HSI_MCU_IPU_SHIFT 1
2129#define OMAP54XX_WKUPDEP_HSI_MCU_IPU_WIDTH 0x1
2130#define OMAP54XX_WKUPDEP_HSI_MCU_IPU_MASK (1 << 1)
2131
2132/* Used by PM_L3INIT_HSI_WKDEP */
2133#define OMAP54XX_WKUPDEP_HSI_MCU_MPU_SHIFT 0
2134#define OMAP54XX_WKUPDEP_HSI_MCU_MPU_WIDTH 0x1
2135#define OMAP54XX_WKUPDEP_HSI_MCU_MPU_MASK (1 << 0)
2136
2137/* Used by PM_L4PER_I2C1_WKDEP */
2138#define OMAP54XX_WKUPDEP_I2C1_DMA_SDMA_SHIFT 7
2139#define OMAP54XX_WKUPDEP_I2C1_DMA_SDMA_WIDTH 0x1
2140#define OMAP54XX_WKUPDEP_I2C1_DMA_SDMA_MASK (1 << 7)
2141
2142/* Used by PM_L4PER_I2C1_WKDEP */
2143#define OMAP54XX_WKUPDEP_I2C1_IRQ_IPU_SHIFT 1
2144#define OMAP54XX_WKUPDEP_I2C1_IRQ_IPU_WIDTH 0x1
2145#define OMAP54XX_WKUPDEP_I2C1_IRQ_IPU_MASK (1 << 1)
2146
2147/* Used by PM_L4PER_I2C1_WKDEP */
2148#define OMAP54XX_WKUPDEP_I2C1_IRQ_MPU_SHIFT 0
2149#define OMAP54XX_WKUPDEP_I2C1_IRQ_MPU_WIDTH 0x1
2150#define OMAP54XX_WKUPDEP_I2C1_IRQ_MPU_MASK (1 << 0)
2151
2152/* Used by PM_L4PER_I2C2_WKDEP */
2153#define OMAP54XX_WKUPDEP_I2C2_DMA_SDMA_SHIFT 7
2154#define OMAP54XX_WKUPDEP_I2C2_DMA_SDMA_WIDTH 0x1
2155#define OMAP54XX_WKUPDEP_I2C2_DMA_SDMA_MASK (1 << 7)
2156
2157/* Used by PM_L4PER_I2C2_WKDEP */
2158#define OMAP54XX_WKUPDEP_I2C2_IRQ_IPU_SHIFT 1
2159#define OMAP54XX_WKUPDEP_I2C2_IRQ_IPU_WIDTH 0x1
2160#define OMAP54XX_WKUPDEP_I2C2_IRQ_IPU_MASK (1 << 1)
2161
2162/* Used by PM_L4PER_I2C2_WKDEP */
2163#define OMAP54XX_WKUPDEP_I2C2_IRQ_MPU_SHIFT 0
2164#define OMAP54XX_WKUPDEP_I2C2_IRQ_MPU_WIDTH 0x1
2165#define OMAP54XX_WKUPDEP_I2C2_IRQ_MPU_MASK (1 << 0)
2166
2167/* Used by PM_L4PER_I2C3_WKDEP */
2168#define OMAP54XX_WKUPDEP_I2C3_DMA_SDMA_SHIFT 7
2169#define OMAP54XX_WKUPDEP_I2C3_DMA_SDMA_WIDTH 0x1
2170#define OMAP54XX_WKUPDEP_I2C3_DMA_SDMA_MASK (1 << 7)
2171
2172/* Used by PM_L4PER_I2C3_WKDEP */
2173#define OMAP54XX_WKUPDEP_I2C3_IRQ_IPU_SHIFT 1
2174#define OMAP54XX_WKUPDEP_I2C3_IRQ_IPU_WIDTH 0x1
2175#define OMAP54XX_WKUPDEP_I2C3_IRQ_IPU_MASK (1 << 1)
2176
2177/* Used by PM_L4PER_I2C3_WKDEP */
2178#define OMAP54XX_WKUPDEP_I2C3_IRQ_MPU_SHIFT 0
2179#define OMAP54XX_WKUPDEP_I2C3_IRQ_MPU_WIDTH 0x1
2180#define OMAP54XX_WKUPDEP_I2C3_IRQ_MPU_MASK (1 << 0)
2181
2182/* Used by PM_L4PER_I2C4_WKDEP */
2183#define OMAP54XX_WKUPDEP_I2C4_DMA_SDMA_SHIFT 7
2184#define OMAP54XX_WKUPDEP_I2C4_DMA_SDMA_WIDTH 0x1
2185#define OMAP54XX_WKUPDEP_I2C4_DMA_SDMA_MASK (1 << 7)
2186
2187/* Used by PM_L4PER_I2C4_WKDEP */
2188#define OMAP54XX_WKUPDEP_I2C4_IRQ_IPU_SHIFT 1
2189#define OMAP54XX_WKUPDEP_I2C4_IRQ_IPU_WIDTH 0x1
2190#define OMAP54XX_WKUPDEP_I2C4_IRQ_IPU_MASK (1 << 1)
2191
2192/* Used by PM_L4PER_I2C4_WKDEP */
2193#define OMAP54XX_WKUPDEP_I2C4_IRQ_MPU_SHIFT 0
2194#define OMAP54XX_WKUPDEP_I2C4_IRQ_MPU_WIDTH 0x1
2195#define OMAP54XX_WKUPDEP_I2C4_IRQ_MPU_MASK (1 << 0)
2196
2197/* Used by PM_L4PER_I2C5_WKDEP */
2198#define OMAP54XX_WKUPDEP_I2C5_IRQ_MPU_SHIFT 0
2199#define OMAP54XX_WKUPDEP_I2C5_IRQ_MPU_WIDTH 0x1
2200#define OMAP54XX_WKUPDEP_I2C5_IRQ_MPU_MASK (1 << 0)
2201
2202/* Used by PM_WKUPAON_KBD_WKDEP */
2203#define OMAP54XX_WKUPDEP_KBD_MPU_SHIFT 0
2204#define OMAP54XX_WKUPDEP_KBD_MPU_WIDTH 0x1
2205#define OMAP54XX_WKUPDEP_KBD_MPU_MASK (1 << 0)
2206
2207/* Used by PM_ABE_MCASP_WKDEP */
2208#define OMAP54XX_WKUPDEP_MCASP_DMA_DSP_SHIFT 6
2209#define OMAP54XX_WKUPDEP_MCASP_DMA_DSP_WIDTH 0x1
2210#define OMAP54XX_WKUPDEP_MCASP_DMA_DSP_MASK (1 << 6)
2211
2212/* Used by PM_ABE_MCASP_WKDEP */
2213#define OMAP54XX_WKUPDEP_MCASP_DMA_SDMA_SHIFT 7
2214#define OMAP54XX_WKUPDEP_MCASP_DMA_SDMA_WIDTH 0x1
2215#define OMAP54XX_WKUPDEP_MCASP_DMA_SDMA_MASK (1 << 7)
2216
2217/* Used by PM_ABE_MCASP_WKDEP */
2218#define OMAP54XX_WKUPDEP_MCASP_IRQ_DSP_SHIFT 2
2219#define OMAP54XX_WKUPDEP_MCASP_IRQ_DSP_WIDTH 0x1
2220#define OMAP54XX_WKUPDEP_MCASP_IRQ_DSP_MASK (1 << 2)
2221
2222/* Used by PM_ABE_MCASP_WKDEP */
2223#define OMAP54XX_WKUPDEP_MCASP_IRQ_MPU_SHIFT 0
2224#define OMAP54XX_WKUPDEP_MCASP_IRQ_MPU_WIDTH 0x1
2225#define OMAP54XX_WKUPDEP_MCASP_IRQ_MPU_MASK (1 << 0)
2226
2227/* Used by PM_ABE_MCBSP1_WKDEP */
2228#define OMAP54XX_WKUPDEP_MCBSP1_DSP_SHIFT 2
2229#define OMAP54XX_WKUPDEP_MCBSP1_DSP_WIDTH 0x1
2230#define OMAP54XX_WKUPDEP_MCBSP1_DSP_MASK (1 << 2)
2231
2232/* Used by PM_ABE_MCBSP1_WKDEP */
2233#define OMAP54XX_WKUPDEP_MCBSP1_MPU_SHIFT 0
2234#define OMAP54XX_WKUPDEP_MCBSP1_MPU_WIDTH 0x1
2235#define OMAP54XX_WKUPDEP_MCBSP1_MPU_MASK (1 << 0)
2236
2237/* Used by PM_ABE_MCBSP1_WKDEP */
2238#define OMAP54XX_WKUPDEP_MCBSP1_SDMA_SHIFT 3
2239#define OMAP54XX_WKUPDEP_MCBSP1_SDMA_WIDTH 0x1
2240#define OMAP54XX_WKUPDEP_MCBSP1_SDMA_MASK (1 << 3)
2241
2242/* Used by PM_ABE_MCBSP2_WKDEP */
2243#define OMAP54XX_WKUPDEP_MCBSP2_DSP_SHIFT 2
2244#define OMAP54XX_WKUPDEP_MCBSP2_DSP_WIDTH 0x1
2245#define OMAP54XX_WKUPDEP_MCBSP2_DSP_MASK (1 << 2)
2246
2247/* Used by PM_ABE_MCBSP2_WKDEP */
2248#define OMAP54XX_WKUPDEP_MCBSP2_MPU_SHIFT 0
2249#define OMAP54XX_WKUPDEP_MCBSP2_MPU_WIDTH 0x1
2250#define OMAP54XX_WKUPDEP_MCBSP2_MPU_MASK (1 << 0)
2251
2252/* Used by PM_ABE_MCBSP2_WKDEP */
2253#define OMAP54XX_WKUPDEP_MCBSP2_SDMA_SHIFT 3
2254#define OMAP54XX_WKUPDEP_MCBSP2_SDMA_WIDTH 0x1
2255#define OMAP54XX_WKUPDEP_MCBSP2_SDMA_MASK (1 << 3)
2256
2257/* Used by PM_ABE_MCBSP3_WKDEP */
2258#define OMAP54XX_WKUPDEP_MCBSP3_DSP_SHIFT 2
2259#define OMAP54XX_WKUPDEP_MCBSP3_DSP_WIDTH 0x1
2260#define OMAP54XX_WKUPDEP_MCBSP3_DSP_MASK (1 << 2)
2261
2262/* Used by PM_ABE_MCBSP3_WKDEP */
2263#define OMAP54XX_WKUPDEP_MCBSP3_MPU_SHIFT 0
2264#define OMAP54XX_WKUPDEP_MCBSP3_MPU_WIDTH 0x1
2265#define OMAP54XX_WKUPDEP_MCBSP3_MPU_MASK (1 << 0)
2266
2267/* Used by PM_ABE_MCBSP3_WKDEP */
2268#define OMAP54XX_WKUPDEP_MCBSP3_SDMA_SHIFT 3
2269#define OMAP54XX_WKUPDEP_MCBSP3_SDMA_WIDTH 0x1
2270#define OMAP54XX_WKUPDEP_MCBSP3_SDMA_MASK (1 << 3)
2271
2272/* Used by PM_ABE_MCPDM_WKDEP */
2273#define OMAP54XX_WKUPDEP_MCPDM_DMA_DSP_SHIFT 6
2274#define OMAP54XX_WKUPDEP_MCPDM_DMA_DSP_WIDTH 0x1
2275#define OMAP54XX_WKUPDEP_MCPDM_DMA_DSP_MASK (1 << 6)
2276
2277/* Used by PM_ABE_MCPDM_WKDEP */
2278#define OMAP54XX_WKUPDEP_MCPDM_DMA_SDMA_SHIFT 7
2279#define OMAP54XX_WKUPDEP_MCPDM_DMA_SDMA_WIDTH 0x1
2280#define OMAP54XX_WKUPDEP_MCPDM_DMA_SDMA_MASK (1 << 7)
2281
2282/* Used by PM_ABE_MCPDM_WKDEP */
2283#define OMAP54XX_WKUPDEP_MCPDM_IRQ_DSP_SHIFT 2
2284#define OMAP54XX_WKUPDEP_MCPDM_IRQ_DSP_WIDTH 0x1
2285#define OMAP54XX_WKUPDEP_MCPDM_IRQ_DSP_MASK (1 << 2)
2286
2287/* Used by PM_ABE_MCPDM_WKDEP */
2288#define OMAP54XX_WKUPDEP_MCPDM_IRQ_MPU_SHIFT 0
2289#define OMAP54XX_WKUPDEP_MCPDM_IRQ_MPU_WIDTH 0x1
2290#define OMAP54XX_WKUPDEP_MCPDM_IRQ_MPU_MASK (1 << 0)
2291
2292/* Used by PM_L4PER_MCSPI1_WKDEP */
2293#define OMAP54XX_WKUPDEP_MCSPI1_DSP_SHIFT 2
2294#define OMAP54XX_WKUPDEP_MCSPI1_DSP_WIDTH 0x1
2295#define OMAP54XX_WKUPDEP_MCSPI1_DSP_MASK (1 << 2)
2296
2297/* Used by PM_L4PER_MCSPI1_WKDEP */
2298#define OMAP54XX_WKUPDEP_MCSPI1_IPU_SHIFT 1
2299#define OMAP54XX_WKUPDEP_MCSPI1_IPU_WIDTH 0x1
2300#define OMAP54XX_WKUPDEP_MCSPI1_IPU_MASK (1 << 1)
2301
2302/* Used by PM_L4PER_MCSPI1_WKDEP */
2303#define OMAP54XX_WKUPDEP_MCSPI1_MPU_SHIFT 0
2304#define OMAP54XX_WKUPDEP_MCSPI1_MPU_WIDTH 0x1
2305#define OMAP54XX_WKUPDEP_MCSPI1_MPU_MASK (1 << 0)
2306
2307/* Used by PM_L4PER_MCSPI1_WKDEP */
2308#define OMAP54XX_WKUPDEP_MCSPI1_SDMA_SHIFT 3
2309#define OMAP54XX_WKUPDEP_MCSPI1_SDMA_WIDTH 0x1
2310#define OMAP54XX_WKUPDEP_MCSPI1_SDMA_MASK (1 << 3)
2311
2312/* Used by PM_L4PER_MCSPI2_WKDEP */
2313#define OMAP54XX_WKUPDEP_MCSPI2_IPU_SHIFT 1
2314#define OMAP54XX_WKUPDEP_MCSPI2_IPU_WIDTH 0x1
2315#define OMAP54XX_WKUPDEP_MCSPI2_IPU_MASK (1 << 1)
2316
2317/* Used by PM_L4PER_MCSPI2_WKDEP */
2318#define OMAP54XX_WKUPDEP_MCSPI2_MPU_SHIFT 0
2319#define OMAP54XX_WKUPDEP_MCSPI2_MPU_WIDTH 0x1
2320#define OMAP54XX_WKUPDEP_MCSPI2_MPU_MASK (1 << 0)
2321
2322/* Used by PM_L4PER_MCSPI2_WKDEP */
2323#define OMAP54XX_WKUPDEP_MCSPI2_SDMA_SHIFT 3
2324#define OMAP54XX_WKUPDEP_MCSPI2_SDMA_WIDTH 0x1
2325#define OMAP54XX_WKUPDEP_MCSPI2_SDMA_MASK (1 << 3)
2326
2327/* Used by PM_L4PER_MCSPI3_WKDEP */
2328#define OMAP54XX_WKUPDEP_MCSPI3_MPU_SHIFT 0
2329#define OMAP54XX_WKUPDEP_MCSPI3_MPU_WIDTH 0x1
2330#define OMAP54XX_WKUPDEP_MCSPI3_MPU_MASK (1 << 0)
2331
2332/* Used by PM_L4PER_MCSPI3_WKDEP */
2333#define OMAP54XX_WKUPDEP_MCSPI3_SDMA_SHIFT 3
2334#define OMAP54XX_WKUPDEP_MCSPI3_SDMA_WIDTH 0x1
2335#define OMAP54XX_WKUPDEP_MCSPI3_SDMA_MASK (1 << 3)
2336
2337/* Used by PM_L4PER_MCSPI4_WKDEP */
2338#define OMAP54XX_WKUPDEP_MCSPI4_MPU_SHIFT 0
2339#define OMAP54XX_WKUPDEP_MCSPI4_MPU_WIDTH 0x1
2340#define OMAP54XX_WKUPDEP_MCSPI4_MPU_MASK (1 << 0)
2341
2342/* Used by PM_L4PER_MCSPI4_WKDEP */
2343#define OMAP54XX_WKUPDEP_MCSPI4_SDMA_SHIFT 3
2344#define OMAP54XX_WKUPDEP_MCSPI4_SDMA_WIDTH 0x1
2345#define OMAP54XX_WKUPDEP_MCSPI4_SDMA_MASK (1 << 3)
2346
2347/* Used by PM_L3INIT_MMC1_WKDEP */
2348#define OMAP54XX_WKUPDEP_MMC1_DSP_SHIFT 2
2349#define OMAP54XX_WKUPDEP_MMC1_DSP_WIDTH 0x1
2350#define OMAP54XX_WKUPDEP_MMC1_DSP_MASK (1 << 2)
2351
2352/* Used by PM_L3INIT_MMC1_WKDEP */
2353#define OMAP54XX_WKUPDEP_MMC1_IPU_SHIFT 1
2354#define OMAP54XX_WKUPDEP_MMC1_IPU_WIDTH 0x1
2355#define OMAP54XX_WKUPDEP_MMC1_IPU_MASK (1 << 1)
2356
2357/* Used by PM_L3INIT_MMC1_WKDEP */
2358#define OMAP54XX_WKUPDEP_MMC1_MPU_SHIFT 0
2359#define OMAP54XX_WKUPDEP_MMC1_MPU_WIDTH 0x1
2360#define OMAP54XX_WKUPDEP_MMC1_MPU_MASK (1 << 0)
2361
2362/* Used by PM_L3INIT_MMC1_WKDEP */
2363#define OMAP54XX_WKUPDEP_MMC1_SDMA_SHIFT 3
2364#define OMAP54XX_WKUPDEP_MMC1_SDMA_WIDTH 0x1
2365#define OMAP54XX_WKUPDEP_MMC1_SDMA_MASK (1 << 3)
2366
2367/* Used by PM_L3INIT_MMC2_WKDEP */
2368#define OMAP54XX_WKUPDEP_MMC2_DSP_SHIFT 2
2369#define OMAP54XX_WKUPDEP_MMC2_DSP_WIDTH 0x1
2370#define OMAP54XX_WKUPDEP_MMC2_DSP_MASK (1 << 2)
2371
2372/* Used by PM_L3INIT_MMC2_WKDEP */
2373#define OMAP54XX_WKUPDEP_MMC2_IPU_SHIFT 1
2374#define OMAP54XX_WKUPDEP_MMC2_IPU_WIDTH 0x1
2375#define OMAP54XX_WKUPDEP_MMC2_IPU_MASK (1 << 1)
2376
2377/* Used by PM_L3INIT_MMC2_WKDEP */
2378#define OMAP54XX_WKUPDEP_MMC2_MPU_SHIFT 0
2379#define OMAP54XX_WKUPDEP_MMC2_MPU_WIDTH 0x1
2380#define OMAP54XX_WKUPDEP_MMC2_MPU_MASK (1 << 0)
2381
2382/* Used by PM_L3INIT_MMC2_WKDEP */
2383#define OMAP54XX_WKUPDEP_MMC2_SDMA_SHIFT 3
2384#define OMAP54XX_WKUPDEP_MMC2_SDMA_WIDTH 0x1
2385#define OMAP54XX_WKUPDEP_MMC2_SDMA_MASK (1 << 3)
2386
2387/* Used by PM_L4PER_MMC3_WKDEP */
2388#define OMAP54XX_WKUPDEP_MMC3_IPU_SHIFT 1
2389#define OMAP54XX_WKUPDEP_MMC3_IPU_WIDTH 0x1
2390#define OMAP54XX_WKUPDEP_MMC3_IPU_MASK (1 << 1)
2391
2392/* Used by PM_L4PER_MMC3_WKDEP */
2393#define OMAP54XX_WKUPDEP_MMC3_MPU_SHIFT 0
2394#define OMAP54XX_WKUPDEP_MMC3_MPU_WIDTH 0x1
2395#define OMAP54XX_WKUPDEP_MMC3_MPU_MASK (1 << 0)
2396
2397/* Used by PM_L4PER_MMC3_WKDEP */
2398#define OMAP54XX_WKUPDEP_MMC3_SDMA_SHIFT 3
2399#define OMAP54XX_WKUPDEP_MMC3_SDMA_WIDTH 0x1
2400#define OMAP54XX_WKUPDEP_MMC3_SDMA_MASK (1 << 3)
2401
2402/* Used by PM_L4PER_MMC4_WKDEP */
2403#define OMAP54XX_WKUPDEP_MMC4_MPU_SHIFT 0
2404#define OMAP54XX_WKUPDEP_MMC4_MPU_WIDTH 0x1
2405#define OMAP54XX_WKUPDEP_MMC4_MPU_MASK (1 << 0)
2406
2407/* Used by PM_L4PER_MMC4_WKDEP */
2408#define OMAP54XX_WKUPDEP_MMC4_SDMA_SHIFT 3
2409#define OMAP54XX_WKUPDEP_MMC4_SDMA_WIDTH 0x1
2410#define OMAP54XX_WKUPDEP_MMC4_SDMA_MASK (1 << 3)
2411
2412/* Used by PM_L4PER_MMC5_WKDEP */
2413#define OMAP54XX_WKUPDEP_MMC5_MPU_SHIFT 0
2414#define OMAP54XX_WKUPDEP_MMC5_MPU_WIDTH 0x1
2415#define OMAP54XX_WKUPDEP_MMC5_MPU_MASK (1 << 0)
2416
2417/* Used by PM_L4PER_MMC5_WKDEP */
2418#define OMAP54XX_WKUPDEP_MMC5_SDMA_SHIFT 3
2419#define OMAP54XX_WKUPDEP_MMC5_SDMA_WIDTH 0x1
2420#define OMAP54XX_WKUPDEP_MMC5_SDMA_MASK (1 << 3)
2421
2422/* Used by PM_L3INIT_SATA_WKDEP */
2423#define OMAP54XX_WKUPDEP_SATA_MPU_SHIFT 0
2424#define OMAP54XX_WKUPDEP_SATA_MPU_WIDTH 0x1
2425#define OMAP54XX_WKUPDEP_SATA_MPU_MASK (1 << 0)
2426
2427/* Used by PM_ABE_SLIMBUS1_WKDEP */
2428#define OMAP54XX_WKUPDEP_SLIMBUS1_DMA_DSP_SHIFT 6
2429#define OMAP54XX_WKUPDEP_SLIMBUS1_DMA_DSP_WIDTH 0x1
2430#define OMAP54XX_WKUPDEP_SLIMBUS1_DMA_DSP_MASK (1 << 6)
2431
2432/* Used by PM_ABE_SLIMBUS1_WKDEP */
2433#define OMAP54XX_WKUPDEP_SLIMBUS1_DMA_SDMA_SHIFT 7
2434#define OMAP54XX_WKUPDEP_SLIMBUS1_DMA_SDMA_WIDTH 0x1
2435#define OMAP54XX_WKUPDEP_SLIMBUS1_DMA_SDMA_MASK (1 << 7)
2436
2437/* Used by PM_ABE_SLIMBUS1_WKDEP */
2438#define OMAP54XX_WKUPDEP_SLIMBUS1_IRQ_DSP_SHIFT 2
2439#define OMAP54XX_WKUPDEP_SLIMBUS1_IRQ_DSP_WIDTH 0x1
2440#define OMAP54XX_WKUPDEP_SLIMBUS1_IRQ_DSP_MASK (1 << 2)
2441
2442/* Used by PM_ABE_SLIMBUS1_WKDEP */
2443#define OMAP54XX_WKUPDEP_SLIMBUS1_IRQ_MPU_SHIFT 0
2444#define OMAP54XX_WKUPDEP_SLIMBUS1_IRQ_MPU_WIDTH 0x1
2445#define OMAP54XX_WKUPDEP_SLIMBUS1_IRQ_MPU_MASK (1 << 0)
2446
2447/* Used by PM_COREAON_SMARTREFLEX_CORE_WKDEP */
2448#define OMAP54XX_WKUPDEP_SMARTREFLEX_CORE_IPU_SHIFT 1
2449#define OMAP54XX_WKUPDEP_SMARTREFLEX_CORE_IPU_WIDTH 0x1
2450#define OMAP54XX_WKUPDEP_SMARTREFLEX_CORE_IPU_MASK (1 << 1)
2451
2452/* Used by PM_COREAON_SMARTREFLEX_CORE_WKDEP */
2453#define OMAP54XX_WKUPDEP_SMARTREFLEX_CORE_MPU_SHIFT 0
2454#define OMAP54XX_WKUPDEP_SMARTREFLEX_CORE_MPU_WIDTH 0x1
2455#define OMAP54XX_WKUPDEP_SMARTREFLEX_CORE_MPU_MASK (1 << 0)
2456
2457/* Used by PM_COREAON_SMARTREFLEX_MM_WKDEP */
2458#define OMAP54XX_WKUPDEP_SMARTREFLEX_MM_MPU_SHIFT 0
2459#define OMAP54XX_WKUPDEP_SMARTREFLEX_MM_MPU_WIDTH 0x1
2460#define OMAP54XX_WKUPDEP_SMARTREFLEX_MM_MPU_MASK (1 << 0)
2461
2462/* Used by PM_COREAON_SMARTREFLEX_MPU_WKDEP */
2463#define OMAP54XX_WKUPDEP_SMARTREFLEX_MPU_MPU_SHIFT 0
2464#define OMAP54XX_WKUPDEP_SMARTREFLEX_MPU_MPU_WIDTH 0x1
2465#define OMAP54XX_WKUPDEP_SMARTREFLEX_MPU_MPU_MASK (1 << 0)
2466
2467/* Used by PM_L4PER_TIMER10_WKDEP */
2468#define OMAP54XX_WKUPDEP_TIMER10_MPU_SHIFT 0
2469#define OMAP54XX_WKUPDEP_TIMER10_MPU_WIDTH 0x1
2470#define OMAP54XX_WKUPDEP_TIMER10_MPU_MASK (1 << 0)
2471
2472/* Used by PM_L4PER_TIMER11_WKDEP */
2473#define OMAP54XX_WKUPDEP_TIMER11_IPU_SHIFT 1
2474#define OMAP54XX_WKUPDEP_TIMER11_IPU_WIDTH 0x1
2475#define OMAP54XX_WKUPDEP_TIMER11_IPU_MASK (1 << 1)
2476
2477/* Used by PM_L4PER_TIMER11_WKDEP */
2478#define OMAP54XX_WKUPDEP_TIMER11_MPU_SHIFT 0
2479#define OMAP54XX_WKUPDEP_TIMER11_MPU_WIDTH 0x1
2480#define OMAP54XX_WKUPDEP_TIMER11_MPU_MASK (1 << 0)
2481
2482/* Used by PM_WKUPAON_TIMER12_WKDEP */
2483#define OMAP54XX_WKUPDEP_TIMER12_MPU_SHIFT 0
2484#define OMAP54XX_WKUPDEP_TIMER12_MPU_WIDTH 0x1
2485#define OMAP54XX_WKUPDEP_TIMER12_MPU_MASK (1 << 0)
2486
2487/* Used by PM_WKUPAON_TIMER1_WKDEP */
2488#define OMAP54XX_WKUPDEP_TIMER1_MPU_SHIFT 0
2489#define OMAP54XX_WKUPDEP_TIMER1_MPU_WIDTH 0x1
2490#define OMAP54XX_WKUPDEP_TIMER1_MPU_MASK (1 << 0)
2491
2492/* Used by PM_L4PER_TIMER2_WKDEP */
2493#define OMAP54XX_WKUPDEP_TIMER2_MPU_SHIFT 0
2494#define OMAP54XX_WKUPDEP_TIMER2_MPU_WIDTH 0x1
2495#define OMAP54XX_WKUPDEP_TIMER2_MPU_MASK (1 << 0)
2496
2497/* Used by PM_L4PER_TIMER3_WKDEP */
2498#define OMAP54XX_WKUPDEP_TIMER3_IPU_SHIFT 1
2499#define OMAP54XX_WKUPDEP_TIMER3_IPU_WIDTH 0x1
2500#define OMAP54XX_WKUPDEP_TIMER3_IPU_MASK (1 << 1)
2501
2502/* Used by PM_L4PER_TIMER3_WKDEP */
2503#define OMAP54XX_WKUPDEP_TIMER3_MPU_SHIFT 0
2504#define OMAP54XX_WKUPDEP_TIMER3_MPU_WIDTH 0x1
2505#define OMAP54XX_WKUPDEP_TIMER3_MPU_MASK (1 << 0)
2506
2507/* Used by PM_L4PER_TIMER4_WKDEP */
2508#define OMAP54XX_WKUPDEP_TIMER4_IPU_SHIFT 1
2509#define OMAP54XX_WKUPDEP_TIMER4_IPU_WIDTH 0x1
2510#define OMAP54XX_WKUPDEP_TIMER4_IPU_MASK (1 << 1)
2511
2512/* Used by PM_L4PER_TIMER4_WKDEP */
2513#define OMAP54XX_WKUPDEP_TIMER4_MPU_SHIFT 0
2514#define OMAP54XX_WKUPDEP_TIMER4_MPU_WIDTH 0x1
2515#define OMAP54XX_WKUPDEP_TIMER4_MPU_MASK (1 << 0)
2516
2517/* Used by PM_ABE_TIMER5_WKDEP */
2518#define OMAP54XX_WKUPDEP_TIMER5_DSP_SHIFT 2
2519#define OMAP54XX_WKUPDEP_TIMER5_DSP_WIDTH 0x1
2520#define OMAP54XX_WKUPDEP_TIMER5_DSP_MASK (1 << 2)
2521
2522/* Used by PM_ABE_TIMER5_WKDEP */
2523#define OMAP54XX_WKUPDEP_TIMER5_MPU_SHIFT 0
2524#define OMAP54XX_WKUPDEP_TIMER5_MPU_WIDTH 0x1
2525#define OMAP54XX_WKUPDEP_TIMER5_MPU_MASK (1 << 0)
2526
2527/* Used by PM_ABE_TIMER6_WKDEP */
2528#define OMAP54XX_WKUPDEP_TIMER6_DSP_SHIFT 2
2529#define OMAP54XX_WKUPDEP_TIMER6_DSP_WIDTH 0x1
2530#define OMAP54XX_WKUPDEP_TIMER6_DSP_MASK (1 << 2)
2531
2532/* Used by PM_ABE_TIMER6_WKDEP */
2533#define OMAP54XX_WKUPDEP_TIMER6_MPU_SHIFT 0
2534#define OMAP54XX_WKUPDEP_TIMER6_MPU_WIDTH 0x1
2535#define OMAP54XX_WKUPDEP_TIMER6_MPU_MASK (1 << 0)
2536
2537/* Used by PM_ABE_TIMER7_WKDEP */
2538#define OMAP54XX_WKUPDEP_TIMER7_DSP_SHIFT 2
2539#define OMAP54XX_WKUPDEP_TIMER7_DSP_WIDTH 0x1
2540#define OMAP54XX_WKUPDEP_TIMER7_DSP_MASK (1 << 2)
2541
2542/* Used by PM_ABE_TIMER7_WKDEP */
2543#define OMAP54XX_WKUPDEP_TIMER7_MPU_SHIFT 0
2544#define OMAP54XX_WKUPDEP_TIMER7_MPU_WIDTH 0x1
2545#define OMAP54XX_WKUPDEP_TIMER7_MPU_MASK (1 << 0)
2546
2547/* Used by PM_ABE_TIMER8_WKDEP */
2548#define OMAP54XX_WKUPDEP_TIMER8_DSP_SHIFT 2
2549#define OMAP54XX_WKUPDEP_TIMER8_DSP_WIDTH 0x1
2550#define OMAP54XX_WKUPDEP_TIMER8_DSP_MASK (1 << 2)
2551
2552/* Used by PM_ABE_TIMER8_WKDEP */
2553#define OMAP54XX_WKUPDEP_TIMER8_MPU_SHIFT 0
2554#define OMAP54XX_WKUPDEP_TIMER8_MPU_WIDTH 0x1
2555#define OMAP54XX_WKUPDEP_TIMER8_MPU_MASK (1 << 0)
2556
2557/* Used by PM_L4PER_TIMER9_WKDEP */
2558#define OMAP54XX_WKUPDEP_TIMER9_IPU_SHIFT 1
2559#define OMAP54XX_WKUPDEP_TIMER9_IPU_WIDTH 0x1
2560#define OMAP54XX_WKUPDEP_TIMER9_IPU_MASK (1 << 1)
2561
2562/* Used by PM_L4PER_TIMER9_WKDEP */
2563#define OMAP54XX_WKUPDEP_TIMER9_MPU_SHIFT 0
2564#define OMAP54XX_WKUPDEP_TIMER9_MPU_WIDTH 0x1
2565#define OMAP54XX_WKUPDEP_TIMER9_MPU_MASK (1 << 0)
2566
2567/* Used by PM_L4PER_UART1_WKDEP */
2568#define OMAP54XX_WKUPDEP_UART1_MPU_SHIFT 0
2569#define OMAP54XX_WKUPDEP_UART1_MPU_WIDTH 0x1
2570#define OMAP54XX_WKUPDEP_UART1_MPU_MASK (1 << 0)
2571
2572/* Used by PM_L4PER_UART1_WKDEP */
2573#define OMAP54XX_WKUPDEP_UART1_SDMA_SHIFT 3
2574#define OMAP54XX_WKUPDEP_UART1_SDMA_WIDTH 0x1
2575#define OMAP54XX_WKUPDEP_UART1_SDMA_MASK (1 << 3)
2576
2577/* Used by PM_L4PER_UART2_WKDEP */
2578#define OMAP54XX_WKUPDEP_UART2_MPU_SHIFT 0
2579#define OMAP54XX_WKUPDEP_UART2_MPU_WIDTH 0x1
2580#define OMAP54XX_WKUPDEP_UART2_MPU_MASK (1 << 0)
2581
2582/* Used by PM_L4PER_UART2_WKDEP */
2583#define OMAP54XX_WKUPDEP_UART2_SDMA_SHIFT 3
2584#define OMAP54XX_WKUPDEP_UART2_SDMA_WIDTH 0x1
2585#define OMAP54XX_WKUPDEP_UART2_SDMA_MASK (1 << 3)
2586
2587/* Used by PM_L4PER_UART3_WKDEP */
2588#define OMAP54XX_WKUPDEP_UART3_DSP_SHIFT 2
2589#define OMAP54XX_WKUPDEP_UART3_DSP_WIDTH 0x1
2590#define OMAP54XX_WKUPDEP_UART3_DSP_MASK (1 << 2)
2591
2592/* Used by PM_L4PER_UART3_WKDEP */
2593#define OMAP54XX_WKUPDEP_UART3_IPU_SHIFT 1
2594#define OMAP54XX_WKUPDEP_UART3_IPU_WIDTH 0x1
2595#define OMAP54XX_WKUPDEP_UART3_IPU_MASK (1 << 1)
2596
2597/* Used by PM_L4PER_UART3_WKDEP */
2598#define OMAP54XX_WKUPDEP_UART3_MPU_SHIFT 0
2599#define OMAP54XX_WKUPDEP_UART3_MPU_WIDTH 0x1
2600#define OMAP54XX_WKUPDEP_UART3_MPU_MASK (1 << 0)
2601
2602/* Used by PM_L4PER_UART3_WKDEP */
2603#define OMAP54XX_WKUPDEP_UART3_SDMA_SHIFT 3
2604#define OMAP54XX_WKUPDEP_UART3_SDMA_WIDTH 0x1
2605#define OMAP54XX_WKUPDEP_UART3_SDMA_MASK (1 << 3)
2606
2607/* Used by PM_L4PER_UART4_WKDEP */
2608#define OMAP54XX_WKUPDEP_UART4_MPU_SHIFT 0
2609#define OMAP54XX_WKUPDEP_UART4_MPU_WIDTH 0x1
2610#define OMAP54XX_WKUPDEP_UART4_MPU_MASK (1 << 0)
2611
2612/* Used by PM_L4PER_UART4_WKDEP */
2613#define OMAP54XX_WKUPDEP_UART4_SDMA_SHIFT 3
2614#define OMAP54XX_WKUPDEP_UART4_SDMA_WIDTH 0x1
2615#define OMAP54XX_WKUPDEP_UART4_SDMA_MASK (1 << 3)
2616
2617/* Used by PM_L4PER_UART5_WKDEP */
2618#define OMAP54XX_WKUPDEP_UART5_MPU_SHIFT 0
2619#define OMAP54XX_WKUPDEP_UART5_MPU_WIDTH 0x1
2620#define OMAP54XX_WKUPDEP_UART5_MPU_MASK (1 << 0)
2621
2622/* Used by PM_L4PER_UART5_WKDEP */
2623#define OMAP54XX_WKUPDEP_UART5_SDMA_SHIFT 3
2624#define OMAP54XX_WKUPDEP_UART5_SDMA_WIDTH 0x1
2625#define OMAP54XX_WKUPDEP_UART5_SDMA_MASK (1 << 3)
2626
2627/* Used by PM_L4PER_UART6_WKDEP */
2628#define OMAP54XX_WKUPDEP_UART6_MPU_SHIFT 0
2629#define OMAP54XX_WKUPDEP_UART6_MPU_WIDTH 0x1
2630#define OMAP54XX_WKUPDEP_UART6_MPU_MASK (1 << 0)
2631
2632/* Used by PM_L4PER_UART6_WKDEP */
2633#define OMAP54XX_WKUPDEP_UART6_SDMA_SHIFT 3
2634#define OMAP54XX_WKUPDEP_UART6_SDMA_WIDTH 0x1
2635#define OMAP54XX_WKUPDEP_UART6_SDMA_MASK (1 << 3)
2636
2637/* Used by PM_L3INIT_UNIPRO2_WKDEP */
2638#define OMAP54XX_WKUPDEP_UNIPRO2_MPU_SHIFT 0
2639#define OMAP54XX_WKUPDEP_UNIPRO2_MPU_WIDTH 0x1
2640#define OMAP54XX_WKUPDEP_UNIPRO2_MPU_MASK (1 << 0)
2641
2642/* Used by PM_L3INIT_USB_HOST_HS_WKDEP */
2643#define OMAP54XX_WKUPDEP_USB_HOST_HS_IPU_SHIFT 1
2644#define OMAP54XX_WKUPDEP_USB_HOST_HS_IPU_WIDTH 0x1
2645#define OMAP54XX_WKUPDEP_USB_HOST_HS_IPU_MASK (1 << 1)
2646
2647/* Used by PM_L3INIT_USB_HOST_HS_WKDEP */
2648#define OMAP54XX_WKUPDEP_USB_HOST_HS_MPU_SHIFT 0
2649#define OMAP54XX_WKUPDEP_USB_HOST_HS_MPU_WIDTH 0x1
2650#define OMAP54XX_WKUPDEP_USB_HOST_HS_MPU_MASK (1 << 0)
2651
2652/* Used by PM_L3INIT_USB_OTG_SS_WKDEP */
2653#define OMAP54XX_WKUPDEP_USB_OTG_SS_IPU_SHIFT 1
2654#define OMAP54XX_WKUPDEP_USB_OTG_SS_IPU_WIDTH 0x1
2655#define OMAP54XX_WKUPDEP_USB_OTG_SS_IPU_MASK (1 << 1)
2656
2657/* Used by PM_L3INIT_USB_OTG_SS_WKDEP */
2658#define OMAP54XX_WKUPDEP_USB_OTG_SS_MPU_SHIFT 0
2659#define OMAP54XX_WKUPDEP_USB_OTG_SS_MPU_WIDTH 0x1
2660#define OMAP54XX_WKUPDEP_USB_OTG_SS_MPU_MASK (1 << 0)
2661
2662/* Used by PM_L3INIT_USB_TLL_HS_WKDEP */
2663#define OMAP54XX_WKUPDEP_USB_TLL_HS_IPU_SHIFT 1
2664#define OMAP54XX_WKUPDEP_USB_TLL_HS_IPU_WIDTH 0x1
2665#define OMAP54XX_WKUPDEP_USB_TLL_HS_IPU_MASK (1 << 1)
2666
2667/* Used by PM_L3INIT_USB_TLL_HS_WKDEP */
2668#define OMAP54XX_WKUPDEP_USB_TLL_HS_MPU_SHIFT 0
2669#define OMAP54XX_WKUPDEP_USB_TLL_HS_MPU_WIDTH 0x1
2670#define OMAP54XX_WKUPDEP_USB_TLL_HS_MPU_MASK (1 << 0)
2671
2672/* Used by PM_WKUPAON_WD_TIMER2_WKDEP */
2673#define OMAP54XX_WKUPDEP_WD_TIMER2_MPU_SHIFT 0
2674#define OMAP54XX_WKUPDEP_WD_TIMER2_MPU_WIDTH 0x1
2675#define OMAP54XX_WKUPDEP_WD_TIMER2_MPU_MASK (1 << 0)
2676
2677/* Used by PM_ABE_WD_TIMER3_WKDEP */
2678#define OMAP54XX_WKUPDEP_WD_TIMER3_MPU_SHIFT 0
2679#define OMAP54XX_WKUPDEP_WD_TIMER3_MPU_WIDTH 0x1
2680#define OMAP54XX_WKUPDEP_WD_TIMER3_MPU_MASK (1 << 0)
2681
2682/* Used by PRM_IO_PMCTRL */
2683#define OMAP54XX_WUCLK_CTRL_SHIFT 8
2684#define OMAP54XX_WUCLK_CTRL_WIDTH 0x1
2685#define OMAP54XX_WUCLK_CTRL_MASK (1 << 8)
2686
2687/* Used by PRM_IO_PMCTRL */
2688#define OMAP54XX_WUCLK_STATUS_SHIFT 9
2689#define OMAP54XX_WUCLK_STATUS_WIDTH 0x1
2690#define OMAP54XX_WUCLK_STATUS_MASK (1 << 9)
2691
2692/* Used by REVISION_PRM */
2693#define OMAP54XX_X_MAJOR_SHIFT 8
2694#define OMAP54XX_X_MAJOR_WIDTH 0x3
2695#define OMAP54XX_X_MAJOR_MASK (0x7 << 8)
2696
2697/* Used by REVISION_PRM */
2698#define OMAP54XX_Y_MINOR_SHIFT 0
2699#define OMAP54XX_Y_MINOR_WIDTH 0x6
2700#define OMAP54XX_Y_MINOR_MASK (0x3f << 0)
2701#endif
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 44c0d7216aa7..720440737744 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -320,6 +320,12 @@ static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
320 return 0; 320 return 0;
321} 321}
322 322
323static int am33xx_check_vcvp(void)
324{
325 /* No VC/VP on am33xx devices */
326 return 0;
327}
328
323struct pwrdm_ops am33xx_pwrdm_operations = { 329struct pwrdm_ops am33xx_pwrdm_operations = {
324 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst, 330 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
325 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst, 331 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
@@ -335,4 +341,5 @@ struct pwrdm_ops am33xx_pwrdm_operations = {
335 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst, 341 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
336 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst, 342 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
337 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition, 343 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
344 .pwrdm_has_voltdm = am33xx_check_vcvp,
338}; 345};
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index 8ee1fbdec561..7db2422faa16 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -25,6 +25,7 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_PRM44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_PRM44XX_H
26#define __ARCH_ARM_MACH_OMAP2_PRM44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRM44XX_H
27 27
28#include "prm44xx_54xx.h"
28#include "prcm-common.h" 29#include "prcm-common.h"
29#include "prm.h" 30#include "prm.h"
30 31
@@ -744,36 +745,4 @@
744#define OMAP4_PRM_VC_ERRST_OFFSET 0x00f8 745#define OMAP4_PRM_VC_ERRST_OFFSET 0x00f8
745#define OMAP4430_PRM_VC_ERRST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_INST, 0x00f8) 746#define OMAP4430_PRM_VC_ERRST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_INST, 0x00f8)
746 747
747/* Function prototypes */
748# ifndef __ASSEMBLER__
749
750extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
751extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
752extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
753
754/* OMAP4-specific VP functions */
755u32 omap4_prm_vp_check_txdone(u8 vp_id);
756void omap4_prm_vp_clear_txdone(u8 vp_id);
757
758/*
759 * OMAP4 access functions for voltage controller (VC) and
760 * voltage proccessor (VP) in the PRM.
761 */
762extern u32 omap4_prm_vcvp_read(u8 offset);
763extern void omap4_prm_vcvp_write(u32 val, u8 offset);
764extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
765
766extern void omap44xx_prm_reconfigure_io_chain(void);
767
768/* PRM interrupt-related functions */
769extern void omap44xx_prm_read_pending_irqs(unsigned long *events);
770extern void omap44xx_prm_ocp_barrier(void);
771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
772extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
773
774extern int __init omap44xx_prm_init(void);
775extern u32 omap44xx_prm_get_reset_sources(void);
776
777# endif
778
779#endif 748#endif
diff --git a/arch/arm/mach-omap2/prm44xx_54xx.h b/arch/arm/mach-omap2/prm44xx_54xx.h
new file mode 100644
index 000000000000..7cd22abb8f15
--- /dev/null
+++ b/arch/arm/mach-omap2/prm44xx_54xx.h
@@ -0,0 +1,58 @@
1/*
2 * OMAP44xx and 54xx PRM common functions
3 *
4 * Copyright (C) 2009-2013 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 */
22
23#ifndef __ARCH_ARM_MACH_OMAP2_PRM44XX_54XX_H
24#define __ARCH_ARM_MACH_OMAP2_PRM44XX_54XX_H
25
26/* Function prototypes */
27#ifndef __ASSEMBLER__
28
29extern u32 omap4_prm_read_inst_reg(s16 inst, u16 idx);
30extern void omap4_prm_write_inst_reg(u32 val, s16 inst, u16 idx);
31extern u32 omap4_prm_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 idx);
32
33/* OMAP4/OMAP5-specific VP functions */
34u32 omap4_prm_vp_check_txdone(u8 vp_id);
35void omap4_prm_vp_clear_txdone(u8 vp_id);
36
37/*
38 * OMAP4/OMAP5 access functions for voltage controller (VC) and
39 * voltage proccessor (VP) in the PRM.
40 */
41extern u32 omap4_prm_vcvp_read(u8 offset);
42extern void omap4_prm_vcvp_write(u32 val, u8 offset);
43extern u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
44
45extern void omap44xx_prm_reconfigure_io_chain(void);
46
47/* PRM interrupt-related functions */
48extern void omap44xx_prm_read_pending_irqs(unsigned long *events);
49extern void omap44xx_prm_ocp_barrier(void);
50extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
51extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
52
53extern int __init omap44xx_prm_init(void);
54extern u32 omap44xx_prm_get_reset_sources(void);
55
56#endif
57
58#endif
diff --git a/arch/arm/mach-omap2/prm54xx.h b/arch/arm/mach-omap2/prm54xx.h
new file mode 100644
index 000000000000..e4411010309c
--- /dev/null
+++ b/arch/arm/mach-omap2/prm54xx.h
@@ -0,0 +1,421 @@
1/*
2 * OMAP54xx PRM instance offset macros
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Paul Walmsley (paul@pwsan.com)
7 * Rajendra Nayak (rnayak@ti.com)
8 * Benoit Cousson (b-cousson@ti.com)
9 *
10 * This file is automatically generated from the OMAP hardware databases.
11 * We respectfully ask that any modifications to this file be coordinated
12 * with the public linux-omap@vger.kernel.org mailing list and the
13 * authors above to ensure that the autogeneration scripts are kept
14 * up-to-date with the file contents.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#ifndef __ARCH_ARM_MACH_OMAP2_PRM54XX_H
22#define __ARCH_ARM_MACH_OMAP2_PRM54XX_H
23
24#include "prm44xx_54xx.h"
25#include "prcm-common.h"
26#include "prm.h"
27
28#define OMAP54XX_PRM_BASE 0x4ae06000
29
30#define OMAP54XX_PRM_REGADDR(inst, reg) \
31 OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE + (inst) + (reg))
32
33
34/* PRM instances */
35#define OMAP54XX_PRM_OCP_SOCKET_INST 0x0000
36#define OMAP54XX_PRM_CKGEN_INST 0x0100
37#define OMAP54XX_PRM_MPU_INST 0x0300
38#define OMAP54XX_PRM_DSP_INST 0x0400
39#define OMAP54XX_PRM_ABE_INST 0x0500
40#define OMAP54XX_PRM_COREAON_INST 0x0600
41#define OMAP54XX_PRM_CORE_INST 0x0700
42#define OMAP54XX_PRM_IVA_INST 0x1200
43#define OMAP54XX_PRM_CAM_INST 0x1300
44#define OMAP54XX_PRM_DSS_INST 0x1400
45#define OMAP54XX_PRM_GPU_INST 0x1500
46#define OMAP54XX_PRM_L3INIT_INST 0x1600
47#define OMAP54XX_PRM_CUSTEFUSE_INST 0x1700
48#define OMAP54XX_PRM_WKUPAON_INST 0x1800
49#define OMAP54XX_PRM_WKUPAON_CM_INST 0x1900
50#define OMAP54XX_PRM_EMU_INST 0x1a00
51#define OMAP54XX_PRM_EMU_CM_INST 0x1b00
52#define OMAP54XX_PRM_DEVICE_INST 0x1c00
53#define OMAP54XX_PRM_INSTR_INST 0x1f00
54
55/* PRM clockdomain register offsets (from instance start) */
56#define OMAP54XX_PRM_WKUPAON_CM_WKUPAON_CDOFFS 0x0000
57#define OMAP54XX_PRM_EMU_CM_EMU_CDOFFS 0x0000
58
59/* PRM */
60
61/* PRM.OCP_SOCKET_PRM register offsets */
62#define OMAP54XX_REVISION_PRM_OFFSET 0x0000
63#define OMAP54XX_PRM_IRQSTATUS_MPU_OFFSET 0x0010
64#define OMAP54XX_PRM_IRQSTATUS_MPU_2_OFFSET 0x0014
65#define OMAP54XX_PRM_IRQENABLE_MPU_OFFSET 0x0018
66#define OMAP54XX_PRM_IRQENABLE_MPU_2_OFFSET 0x001c
67#define OMAP54XX_PRM_IRQSTATUS_IPU_OFFSET 0x0020
68#define OMAP54XX_PRM_IRQENABLE_IPU_OFFSET 0x0028
69#define OMAP54XX_PRM_IRQSTATUS_DSP_OFFSET 0x0030
70#define OMAP54XX_PRM_IRQENABLE_DSP_OFFSET 0x0038
71#define OMAP54XX_CM_PRM_PROFILING_CLKCTRL_OFFSET 0x0040
72#define OMAP54XX_CM_PRM_PROFILING_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_OCP_SOCKET_INST, 0x0040)
73#define OMAP54XX_PRM_DEBUG_OUT_OFFSET 0x0084
74#define OMAP54XX_PRM_DEBUG_TRANS_CFG_OFFSET 0x0090
75#define OMAP54XX_PRM_DEBUG_OFF_TRANS_OFFSET 0x0094
76#define OMAP54XX_PRM_DEBUG_CORE_RET_TRANS_OFFSET 0x0098
77#define OMAP54XX_PRM_DEBUG_MPU_RET_TRANS_OFFSET 0x009c
78#define OMAP54XX_PRM_DEBUG_MM_RET_TRANS_OFFSET 0x00a0
79#define OMAP54XX_PRM_DEBUG_WKUPAON_FD_TRANS_OFFSET 0x00a4
80
81/* PRM.CKGEN_PRM register offsets */
82#define OMAP54XX_CM_CLKSEL_ABE_DSS_SYS_OFFSET 0x0000
83#define OMAP54XX_CM_CLKSEL_ABE_DSS_SYS OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_CKGEN_INST, 0x0000)
84#define OMAP54XX_CM_CLKSEL_WKUPAON_OFFSET 0x0008
85#define OMAP54XX_CM_CLKSEL_WKUPAON OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_CKGEN_INST, 0x0008)
86#define OMAP54XX_CM_CLKSEL_ABE_PLL_REF_OFFSET 0x000c
87#define OMAP54XX_CM_CLKSEL_ABE_PLL_REF OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_CKGEN_INST, 0x000c)
88#define OMAP54XX_CM_CLKSEL_SYS_OFFSET 0x0010
89#define OMAP54XX_CM_CLKSEL_SYS OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_CKGEN_INST, 0x0010)
90
91/* PRM.MPU_PRM register offsets */
92#define OMAP54XX_PM_MPU_PWRSTCTRL_OFFSET 0x0000
93#define OMAP54XX_PM_MPU_PWRSTST_OFFSET 0x0004
94#define OMAP54XX_RM_MPU_MPU_CONTEXT_OFFSET 0x0024
95
96/* PRM.DSP_PRM register offsets */
97#define OMAP54XX_PM_DSP_PWRSTCTRL_OFFSET 0x0000
98#define OMAP54XX_PM_DSP_PWRSTST_OFFSET 0x0004
99#define OMAP54XX_RM_DSP_RSTCTRL_OFFSET 0x0010
100#define OMAP54XX_RM_DSP_RSTST_OFFSET 0x0014
101#define OMAP54XX_RM_DSP_DSP_CONTEXT_OFFSET 0x0024
102
103/* PRM.ABE_PRM register offsets */
104#define OMAP54XX_PM_ABE_PWRSTCTRL_OFFSET 0x0000
105#define OMAP54XX_PM_ABE_PWRSTST_OFFSET 0x0004
106#define OMAP54XX_RM_ABE_AESS_CONTEXT_OFFSET 0x002c
107#define OMAP54XX_PM_ABE_MCPDM_WKDEP_OFFSET 0x0030
108#define OMAP54XX_RM_ABE_MCPDM_CONTEXT_OFFSET 0x0034
109#define OMAP54XX_PM_ABE_DMIC_WKDEP_OFFSET 0x0038
110#define OMAP54XX_RM_ABE_DMIC_CONTEXT_OFFSET 0x003c
111#define OMAP54XX_PM_ABE_MCASP_WKDEP_OFFSET 0x0040
112#define OMAP54XX_RM_ABE_MCASP_CONTEXT_OFFSET 0x0044
113#define OMAP54XX_PM_ABE_MCBSP1_WKDEP_OFFSET 0x0048
114#define OMAP54XX_RM_ABE_MCBSP1_CONTEXT_OFFSET 0x004c
115#define OMAP54XX_PM_ABE_MCBSP2_WKDEP_OFFSET 0x0050
116#define OMAP54XX_RM_ABE_MCBSP2_CONTEXT_OFFSET 0x0054
117#define OMAP54XX_PM_ABE_MCBSP3_WKDEP_OFFSET 0x0058
118#define OMAP54XX_RM_ABE_MCBSP3_CONTEXT_OFFSET 0x005c
119#define OMAP54XX_PM_ABE_SLIMBUS1_WKDEP_OFFSET 0x0060
120#define OMAP54XX_RM_ABE_SLIMBUS1_CONTEXT_OFFSET 0x0064
121#define OMAP54XX_PM_ABE_TIMER5_WKDEP_OFFSET 0x0068
122#define OMAP54XX_RM_ABE_TIMER5_CONTEXT_OFFSET 0x006c
123#define OMAP54XX_PM_ABE_TIMER6_WKDEP_OFFSET 0x0070
124#define OMAP54XX_RM_ABE_TIMER6_CONTEXT_OFFSET 0x0074
125#define OMAP54XX_PM_ABE_TIMER7_WKDEP_OFFSET 0x0078
126#define OMAP54XX_RM_ABE_TIMER7_CONTEXT_OFFSET 0x007c
127#define OMAP54XX_PM_ABE_TIMER8_WKDEP_OFFSET 0x0080
128#define OMAP54XX_RM_ABE_TIMER8_CONTEXT_OFFSET 0x0084
129#define OMAP54XX_PM_ABE_WD_TIMER3_WKDEP_OFFSET 0x0088
130#define OMAP54XX_RM_ABE_WD_TIMER3_CONTEXT_OFFSET 0x008c
131
132/* PRM.COREAON_PRM register offsets */
133#define OMAP54XX_PM_COREAON_SMARTREFLEX_MPU_WKDEP_OFFSET 0x0028
134#define OMAP54XX_RM_COREAON_SMARTREFLEX_MPU_CONTEXT_OFFSET 0x002c
135#define OMAP54XX_PM_COREAON_SMARTREFLEX_MM_WKDEP_OFFSET 0x0030
136#define OMAP54XX_RM_COREAON_SMARTREFLEX_MM_CONTEXT_OFFSET 0x0034
137#define OMAP54XX_PM_COREAON_SMARTREFLEX_CORE_WKDEP_OFFSET 0x0038
138#define OMAP54XX_RM_COREAON_SMARTREFLEX_CORE_CONTEXT_OFFSET 0x003c
139
140/* PRM.CORE_PRM register offsets */
141#define OMAP54XX_PM_CORE_PWRSTCTRL_OFFSET 0x0000
142#define OMAP54XX_PM_CORE_PWRSTST_OFFSET 0x0004
143#define OMAP54XX_RM_L3MAIN1_L3_MAIN_1_CONTEXT_OFFSET 0x0024
144#define OMAP54XX_RM_L3MAIN2_L3_MAIN_2_CONTEXT_OFFSET 0x0124
145#define OMAP54XX_RM_L3MAIN2_GPMC_CONTEXT_OFFSET 0x012c
146#define OMAP54XX_RM_L3MAIN2_OCMC_RAM_CONTEXT_OFFSET 0x0134
147#define OMAP54XX_RM_IPU_RSTCTRL_OFFSET 0x0210
148#define OMAP54XX_RM_IPU_RSTST_OFFSET 0x0214
149#define OMAP54XX_RM_IPU_IPU_CONTEXT_OFFSET 0x0224
150#define OMAP54XX_RM_DMA_DMA_SYSTEM_CONTEXT_OFFSET 0x0324
151#define OMAP54XX_RM_EMIF_DMM_CONTEXT_OFFSET 0x0424
152#define OMAP54XX_RM_EMIF_EMIF_OCP_FW_CONTEXT_OFFSET 0x042c
153#define OMAP54XX_RM_EMIF_EMIF1_CONTEXT_OFFSET 0x0434
154#define OMAP54XX_RM_EMIF_EMIF2_CONTEXT_OFFSET 0x043c
155#define OMAP54XX_RM_EMIF_EMIF_DLL_CONTEXT_OFFSET 0x0444
156#define OMAP54XX_RM_C2C_C2C_CONTEXT_OFFSET 0x0524
157#define OMAP54XX_RM_C2C_MODEM_ICR_CONTEXT_OFFSET 0x052c
158#define OMAP54XX_RM_C2C_C2C_OCP_FW_CONTEXT_OFFSET 0x0534
159#define OMAP54XX_RM_L4CFG_L4_CFG_CONTEXT_OFFSET 0x0624
160#define OMAP54XX_RM_L4CFG_SPINLOCK_CONTEXT_OFFSET 0x062c
161#define OMAP54XX_RM_L4CFG_MAILBOX_CONTEXT_OFFSET 0x0634
162#define OMAP54XX_RM_L4CFG_SAR_ROM_CONTEXT_OFFSET 0x063c
163#define OMAP54XX_RM_L4CFG_OCP2SCP2_CONTEXT_OFFSET 0x0644
164#define OMAP54XX_RM_L3INSTR_L3_MAIN_3_CONTEXT_OFFSET 0x0724
165#define OMAP54XX_RM_L3INSTR_L3_INSTR_CONTEXT_OFFSET 0x072c
166#define OMAP54XX_RM_L3INSTR_OCP_WP_NOC_CONTEXT_OFFSET 0x0744
167#define OMAP54XX_RM_MIPIEXT_LLI_CONTEXT_OFFSET 0x0824
168#define OMAP54XX_RM_MIPIEXT_LLI_OCP_FW_CONTEXT_OFFSET 0x082c
169#define OMAP54XX_RM_MIPIEXT_MPHY_CONTEXT_OFFSET 0x0834
170#define OMAP54XX_PM_L4PER_TIMER10_WKDEP_OFFSET 0x0928
171#define OMAP54XX_RM_L4PER_TIMER10_CONTEXT_OFFSET 0x092c
172#define OMAP54XX_PM_L4PER_TIMER11_WKDEP_OFFSET 0x0930
173#define OMAP54XX_RM_L4PER_TIMER11_CONTEXT_OFFSET 0x0934
174#define OMAP54XX_PM_L4PER_TIMER2_WKDEP_OFFSET 0x0938
175#define OMAP54XX_RM_L4PER_TIMER2_CONTEXT_OFFSET 0x093c
176#define OMAP54XX_PM_L4PER_TIMER3_WKDEP_OFFSET 0x0940
177#define OMAP54XX_RM_L4PER_TIMER3_CONTEXT_OFFSET 0x0944
178#define OMAP54XX_PM_L4PER_TIMER4_WKDEP_OFFSET 0x0948
179#define OMAP54XX_RM_L4PER_TIMER4_CONTEXT_OFFSET 0x094c
180#define OMAP54XX_PM_L4PER_TIMER9_WKDEP_OFFSET 0x0950
181#define OMAP54XX_RM_L4PER_TIMER9_CONTEXT_OFFSET 0x0954
182#define OMAP54XX_RM_L4PER_ELM_CONTEXT_OFFSET 0x095c
183#define OMAP54XX_PM_L4PER_GPIO2_WKDEP_OFFSET 0x0960
184#define OMAP54XX_RM_L4PER_GPIO2_CONTEXT_OFFSET 0x0964
185#define OMAP54XX_PM_L4PER_GPIO3_WKDEP_OFFSET 0x0968
186#define OMAP54XX_RM_L4PER_GPIO3_CONTEXT_OFFSET 0x096c
187#define OMAP54XX_PM_L4PER_GPIO4_WKDEP_OFFSET 0x0970
188#define OMAP54XX_RM_L4PER_GPIO4_CONTEXT_OFFSET 0x0974
189#define OMAP54XX_PM_L4PER_GPIO5_WKDEP_OFFSET 0x0978
190#define OMAP54XX_RM_L4PER_GPIO5_CONTEXT_OFFSET 0x097c
191#define OMAP54XX_PM_L4PER_GPIO6_WKDEP_OFFSET 0x0980
192#define OMAP54XX_RM_L4PER_GPIO6_CONTEXT_OFFSET 0x0984
193#define OMAP54XX_RM_L4PER_HDQ1W_CONTEXT_OFFSET 0x098c
194#define OMAP54XX_PM_L4PER_I2C1_WKDEP_OFFSET 0x09a0
195#define OMAP54XX_RM_L4PER_I2C1_CONTEXT_OFFSET 0x09a4
196#define OMAP54XX_PM_L4PER_I2C2_WKDEP_OFFSET 0x09a8
197#define OMAP54XX_RM_L4PER_I2C2_CONTEXT_OFFSET 0x09ac
198#define OMAP54XX_PM_L4PER_I2C3_WKDEP_OFFSET 0x09b0
199#define OMAP54XX_RM_L4PER_I2C3_CONTEXT_OFFSET 0x09b4
200#define OMAP54XX_PM_L4PER_I2C4_WKDEP_OFFSET 0x09b8
201#define OMAP54XX_RM_L4PER_I2C4_CONTEXT_OFFSET 0x09bc
202#define OMAP54XX_RM_L4PER_L4_PER_CONTEXT_OFFSET 0x09c0
203#define OMAP54XX_PM_L4PER_MCSPI1_WKDEP_OFFSET 0x09f0
204#define OMAP54XX_RM_L4PER_MCSPI1_CONTEXT_OFFSET 0x09f4
205#define OMAP54XX_PM_L4PER_MCSPI2_WKDEP_OFFSET 0x09f8
206#define OMAP54XX_RM_L4PER_MCSPI2_CONTEXT_OFFSET 0x09fc
207#define OMAP54XX_PM_L4PER_MCSPI3_WKDEP_OFFSET 0x0a00
208#define OMAP54XX_RM_L4PER_MCSPI3_CONTEXT_OFFSET 0x0a04
209#define OMAP54XX_PM_L4PER_MCSPI4_WKDEP_OFFSET 0x0a08
210#define OMAP54XX_RM_L4PER_MCSPI4_CONTEXT_OFFSET 0x0a0c
211#define OMAP54XX_PM_L4PER_GPIO7_WKDEP_OFFSET 0x0a10
212#define OMAP54XX_RM_L4PER_GPIO7_CONTEXT_OFFSET 0x0a14
213#define OMAP54XX_PM_L4PER_GPIO8_WKDEP_OFFSET 0x0a18
214#define OMAP54XX_RM_L4PER_GPIO8_CONTEXT_OFFSET 0x0a1c
215#define OMAP54XX_PM_L4PER_MMC3_WKDEP_OFFSET 0x0a20
216#define OMAP54XX_RM_L4PER_MMC3_CONTEXT_OFFSET 0x0a24
217#define OMAP54XX_PM_L4PER_MMC4_WKDEP_OFFSET 0x0a28
218#define OMAP54XX_RM_L4PER_MMC4_CONTEXT_OFFSET 0x0a2c
219#define OMAP54XX_PM_L4PER_UART1_WKDEP_OFFSET 0x0a40
220#define OMAP54XX_RM_L4PER_UART1_CONTEXT_OFFSET 0x0a44
221#define OMAP54XX_PM_L4PER_UART2_WKDEP_OFFSET 0x0a48
222#define OMAP54XX_RM_L4PER_UART2_CONTEXT_OFFSET 0x0a4c
223#define OMAP54XX_PM_L4PER_UART3_WKDEP_OFFSET 0x0a50
224#define OMAP54XX_RM_L4PER_UART3_CONTEXT_OFFSET 0x0a54
225#define OMAP54XX_RM_L4PER_UART4_CONTEXT_OFFSET 0x0a58
226#define OMAP54XX_PM_L4PER_UART4_WKDEP_OFFSET 0x0a5c
227#define OMAP54XX_PM_L4PER_MMC5_WKDEP_OFFSET 0x0a60
228#define OMAP54XX_RM_L4PER_MMC5_CONTEXT_OFFSET 0x0a64
229#define OMAP54XX_PM_L4PER_I2C5_WKDEP_OFFSET 0x0a68
230#define OMAP54XX_RM_L4PER_I2C5_CONTEXT_OFFSET 0x0a6c
231#define OMAP54XX_PM_L4PER_UART5_WKDEP_OFFSET 0x0a70
232#define OMAP54XX_RM_L4PER_UART5_CONTEXT_OFFSET 0x0a74
233#define OMAP54XX_PM_L4PER_UART6_WKDEP_OFFSET 0x0a78
234#define OMAP54XX_RM_L4PER_UART6_CONTEXT_OFFSET 0x0a7c
235#define OMAP54XX_RM_L4SEC_AES1_CONTEXT_OFFSET 0x0aa4
236#define OMAP54XX_RM_L4SEC_AES2_CONTEXT_OFFSET 0x0aac
237#define OMAP54XX_RM_L4SEC_DES3DES_CONTEXT_OFFSET 0x0ab4
238#define OMAP54XX_RM_L4SEC_FPKA_CONTEXT_OFFSET 0x0abc
239#define OMAP54XX_RM_L4SEC_RNG_CONTEXT_OFFSET 0x0ac4
240#define OMAP54XX_RM_L4SEC_SHA2MD5_CONTEXT_OFFSET 0x0acc
241#define OMAP54XX_RM_L4SEC_DMA_CRYPTO_CONTEXT_OFFSET 0x0adc
242
243/* PRM.IVA_PRM register offsets */
244#define OMAP54XX_PM_IVA_PWRSTCTRL_OFFSET 0x0000
245#define OMAP54XX_PM_IVA_PWRSTST_OFFSET 0x0004
246#define OMAP54XX_RM_IVA_RSTCTRL_OFFSET 0x0010
247#define OMAP54XX_RM_IVA_RSTST_OFFSET 0x0014
248#define OMAP54XX_RM_IVA_IVA_CONTEXT_OFFSET 0x0024
249#define OMAP54XX_RM_IVA_SL2_CONTEXT_OFFSET 0x002c
250
251/* PRM.CAM_PRM register offsets */
252#define OMAP54XX_PM_CAM_PWRSTCTRL_OFFSET 0x0000
253#define OMAP54XX_PM_CAM_PWRSTST_OFFSET 0x0004
254#define OMAP54XX_RM_CAM_ISS_CONTEXT_OFFSET 0x0024
255#define OMAP54XX_RM_CAM_FDIF_CONTEXT_OFFSET 0x002c
256#define OMAP54XX_RM_CAM_CAL_CONTEXT_OFFSET 0x0034
257
258/* PRM.DSS_PRM register offsets */
259#define OMAP54XX_PM_DSS_PWRSTCTRL_OFFSET 0x0000
260#define OMAP54XX_PM_DSS_PWRSTST_OFFSET 0x0004
261#define OMAP54XX_PM_DSS_DSS_WKDEP_OFFSET 0x0020
262#define OMAP54XX_RM_DSS_DSS_CONTEXT_OFFSET 0x0024
263#define OMAP54XX_RM_DSS_BB2D_CONTEXT_OFFSET 0x0034
264
265/* PRM.GPU_PRM register offsets */
266#define OMAP54XX_PM_GPU_PWRSTCTRL_OFFSET 0x0000
267#define OMAP54XX_PM_GPU_PWRSTST_OFFSET 0x0004
268#define OMAP54XX_RM_GPU_GPU_CONTEXT_OFFSET 0x0024
269
270/* PRM.L3INIT_PRM register offsets */
271#define OMAP54XX_PM_L3INIT_PWRSTCTRL_OFFSET 0x0000
272#define OMAP54XX_PM_L3INIT_PWRSTST_OFFSET 0x0004
273#define OMAP54XX_PM_L3INIT_MMC1_WKDEP_OFFSET 0x0028
274#define OMAP54XX_RM_L3INIT_MMC1_CONTEXT_OFFSET 0x002c
275#define OMAP54XX_PM_L3INIT_MMC2_WKDEP_OFFSET 0x0030
276#define OMAP54XX_RM_L3INIT_MMC2_CONTEXT_OFFSET 0x0034
277#define OMAP54XX_PM_L3INIT_HSI_WKDEP_OFFSET 0x0038
278#define OMAP54XX_RM_L3INIT_HSI_CONTEXT_OFFSET 0x003c
279#define OMAP54XX_PM_L3INIT_UNIPRO2_WKDEP_OFFSET 0x0040
280#define OMAP54XX_RM_L3INIT_UNIPRO2_CONTEXT_OFFSET 0x0044
281#define OMAP54XX_PM_L3INIT_USB_HOST_HS_WKDEP_OFFSET 0x0058
282#define OMAP54XX_RM_L3INIT_USB_HOST_HS_CONTEXT_OFFSET 0x005c
283#define OMAP54XX_PM_L3INIT_USB_TLL_HS_WKDEP_OFFSET 0x0068
284#define OMAP54XX_RM_L3INIT_USB_TLL_HS_CONTEXT_OFFSET 0x006c
285#define OMAP54XX_RM_L3INIT_IEEE1500_2_OCP_CONTEXT_OFFSET 0x007c
286#define OMAP54XX_PM_L3INIT_SATA_WKDEP_OFFSET 0x0088
287#define OMAP54XX_RM_L3INIT_SATA_CONTEXT_OFFSET 0x008c
288#define OMAP54XX_RM_L3INIT_OCP2SCP1_CONTEXT_OFFSET 0x00e4
289#define OMAP54XX_RM_L3INIT_OCP2SCP3_CONTEXT_OFFSET 0x00ec
290#define OMAP54XX_PM_L3INIT_USB_OTG_SS_WKDEP_OFFSET 0x00f0
291#define OMAP54XX_RM_L3INIT_USB_OTG_SS_CONTEXT_OFFSET 0x00f4
292
293/* PRM.CUSTEFUSE_PRM register offsets */
294#define OMAP54XX_PM_CUSTEFUSE_PWRSTCTRL_OFFSET 0x0000
295#define OMAP54XX_PM_CUSTEFUSE_PWRSTST_OFFSET 0x0004
296#define OMAP54XX_RM_CUSTEFUSE_EFUSE_CTRL_CUST_CONTEXT_OFFSET 0x0024
297
298/* PRM.WKUPAON_PRM register offsets */
299#define OMAP54XX_RM_WKUPAON_L4_WKUP_CONTEXT_OFFSET 0x0024
300#define OMAP54XX_RM_WKUPAON_WD_TIMER1_CONTEXT_OFFSET 0x002c
301#define OMAP54XX_PM_WKUPAON_WD_TIMER2_WKDEP_OFFSET 0x0030
302#define OMAP54XX_RM_WKUPAON_WD_TIMER2_CONTEXT_OFFSET 0x0034
303#define OMAP54XX_PM_WKUPAON_GPIO1_WKDEP_OFFSET 0x0038
304#define OMAP54XX_RM_WKUPAON_GPIO1_CONTEXT_OFFSET 0x003c
305#define OMAP54XX_PM_WKUPAON_TIMER1_WKDEP_OFFSET 0x0040
306#define OMAP54XX_RM_WKUPAON_TIMER1_CONTEXT_OFFSET 0x0044
307#define OMAP54XX_PM_WKUPAON_TIMER12_WKDEP_OFFSET 0x0048
308#define OMAP54XX_RM_WKUPAON_TIMER12_CONTEXT_OFFSET 0x004c
309#define OMAP54XX_RM_WKUPAON_COUNTER_32K_CONTEXT_OFFSET 0x0054
310#define OMAP54XX_RM_WKUPAON_SAR_RAM_CONTEXT_OFFSET 0x0064
311#define OMAP54XX_PM_WKUPAON_KBD_WKDEP_OFFSET 0x0078
312#define OMAP54XX_RM_WKUPAON_KBD_CONTEXT_OFFSET 0x007c
313
314/* PRM.WKUPAON_CM register offsets */
315#define OMAP54XX_CM_WKUPAON_CLKSTCTRL_OFFSET 0x0000
316#define OMAP54XX_CM_WKUPAON_L4_WKUP_CLKCTRL_OFFSET 0x0020
317#define OMAP54XX_CM_WKUPAON_L4_WKUP_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0020)
318#define OMAP54XX_CM_WKUPAON_WD_TIMER1_CLKCTRL_OFFSET 0x0028
319#define OMAP54XX_CM_WKUPAON_WD_TIMER1_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0028)
320#define OMAP54XX_CM_WKUPAON_WD_TIMER2_CLKCTRL_OFFSET 0x0030
321#define OMAP54XX_CM_WKUPAON_WD_TIMER2_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0030)
322#define OMAP54XX_CM_WKUPAON_GPIO1_CLKCTRL_OFFSET 0x0038
323#define OMAP54XX_CM_WKUPAON_GPIO1_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0038)
324#define OMAP54XX_CM_WKUPAON_TIMER1_CLKCTRL_OFFSET 0x0040
325#define OMAP54XX_CM_WKUPAON_TIMER1_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0040)
326#define OMAP54XX_CM_WKUPAON_TIMER12_CLKCTRL_OFFSET 0x0048
327#define OMAP54XX_CM_WKUPAON_TIMER12_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0048)
328#define OMAP54XX_CM_WKUPAON_COUNTER_32K_CLKCTRL_OFFSET 0x0050
329#define OMAP54XX_CM_WKUPAON_COUNTER_32K_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0050)
330#define OMAP54XX_CM_WKUPAON_SAR_RAM_CLKCTRL_OFFSET 0x0060
331#define OMAP54XX_CM_WKUPAON_SAR_RAM_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0060)
332#define OMAP54XX_CM_WKUPAON_KBD_CLKCTRL_OFFSET 0x0078
333#define OMAP54XX_CM_WKUPAON_KBD_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0078)
334#define OMAP54XX_CM_WKUPAON_SCRM_CLKCTRL_OFFSET 0x0090
335#define OMAP54XX_CM_WKUPAON_SCRM_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0090)
336#define OMAP54XX_CM_WKUPAON_IO_SRCOMP_CLKCTRL_OFFSET 0x0098
337#define OMAP54XX_CM_WKUPAON_IO_SRCOMP_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_WKUPAON_CM_INST, 0x0098)
338
339/* PRM.EMU_PRM register offsets */
340#define OMAP54XX_PM_EMU_PWRSTCTRL_OFFSET 0x0000
341#define OMAP54XX_PM_EMU_PWRSTST_OFFSET 0x0004
342#define OMAP54XX_RM_EMU_DEBUGSS_CONTEXT_OFFSET 0x0024
343
344/* PRM.EMU_CM register offsets */
345#define OMAP54XX_CM_EMU_CLKSTCTRL_OFFSET 0x0000
346#define OMAP54XX_CM_EMU_DYNAMICDEP_OFFSET 0x0008
347#define OMAP54XX_CM_EMU_DEBUGSS_CLKCTRL_OFFSET 0x0020
348#define OMAP54XX_CM_EMU_DEBUGSS_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_EMU_CM_INST, 0x0020)
349#define OMAP54XX_CM_EMU_MPU_EMU_DBG_CLKCTRL_OFFSET 0x0028
350#define OMAP54XX_CM_EMU_MPU_EMU_DBG_CLKCTRL OMAP54XX_PRM_REGADDR(OMAP54XX_PRM_EMU_CM_INST, 0x0028)
351
352/* PRM.DEVICE_PRM register offsets */
353#define OMAP54XX_PRM_RSTCTRL_OFFSET 0x0000
354#define OMAP54XX_PRM_RSTST_OFFSET 0x0004
355#define OMAP54XX_PRM_RSTTIME_OFFSET 0x0008
356#define OMAP54XX_PRM_CLKREQCTRL_OFFSET 0x000c
357#define OMAP54XX_PRM_VOLTCTRL_OFFSET 0x0010
358#define OMAP54XX_PRM_PWRREQCTRL_OFFSET 0x0014
359#define OMAP54XX_PRM_PSCON_COUNT_OFFSET 0x0018
360#define OMAP54XX_PRM_IO_COUNT_OFFSET 0x001c
361#define OMAP54XX_PRM_IO_PMCTRL_OFFSET 0x0020
362#define OMAP54XX_PRM_VOLTSETUP_WARMRESET_OFFSET 0x0024
363#define OMAP54XX_PRM_VOLTSETUP_CORE_OFF_OFFSET 0x0028
364#define OMAP54XX_PRM_VOLTSETUP_MPU_OFF_OFFSET 0x002c
365#define OMAP54XX_PRM_VOLTSETUP_MM_OFF_OFFSET 0x0030
366#define OMAP54XX_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET 0x0034
367#define OMAP54XX_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET 0x0038
368#define OMAP54XX_PRM_VOLTSETUP_MM_RET_SLEEP_OFFSET 0x003c
369#define OMAP54XX_PRM_VP_CORE_CONFIG_OFFSET 0x0040
370#define OMAP54XX_PRM_VP_CORE_STATUS_OFFSET 0x0044
371#define OMAP54XX_PRM_VP_CORE_VLIMITTO_OFFSET 0x0048
372#define OMAP54XX_PRM_VP_CORE_VOLTAGE_OFFSET 0x004c
373#define OMAP54XX_PRM_VP_CORE_VSTEPMAX_OFFSET 0x0050
374#define OMAP54XX_PRM_VP_CORE_VSTEPMIN_OFFSET 0x0054
375#define OMAP54XX_PRM_VP_MPU_CONFIG_OFFSET 0x0058
376#define OMAP54XX_PRM_VP_MPU_STATUS_OFFSET 0x005c
377#define OMAP54XX_PRM_VP_MPU_VLIMITTO_OFFSET 0x0060
378#define OMAP54XX_PRM_VP_MPU_VOLTAGE_OFFSET 0x0064
379#define OMAP54XX_PRM_VP_MPU_VSTEPMAX_OFFSET 0x0068
380#define OMAP54XX_PRM_VP_MPU_VSTEPMIN_OFFSET 0x006c
381#define OMAP54XX_PRM_VP_MM_CONFIG_OFFSET 0x0070
382#define OMAP54XX_PRM_VP_MM_STATUS_OFFSET 0x0074
383#define OMAP54XX_PRM_VP_MM_VLIMITTO_OFFSET 0x0078
384#define OMAP54XX_PRM_VP_MM_VOLTAGE_OFFSET 0x007c
385#define OMAP54XX_PRM_VP_MM_VSTEPMAX_OFFSET 0x0080
386#define OMAP54XX_PRM_VP_MM_VSTEPMIN_OFFSET 0x0084
387#define OMAP54XX_PRM_VC_SMPS_CORE_CONFIG_OFFSET 0x0088
388#define OMAP54XX_PRM_VC_SMPS_MM_CONFIG_OFFSET 0x008c
389#define OMAP54XX_PRM_VC_SMPS_MPU_CONFIG_OFFSET 0x0090
390#define OMAP54XX_PRM_VC_VAL_CMD_VDD_CORE_L_OFFSET 0x0094
391#define OMAP54XX_PRM_VC_VAL_CMD_VDD_MM_L_OFFSET 0x0098
392#define OMAP54XX_PRM_VC_VAL_CMD_VDD_MPU_L_OFFSET 0x009c
393#define OMAP54XX_PRM_VC_VAL_BYPASS_OFFSET 0x00a0
394#define OMAP54XX_PRM_VC_CORE_ERRST_OFFSET 0x00a4
395#define OMAP54XX_PRM_VC_MM_ERRST_OFFSET 0x00a8
396#define OMAP54XX_PRM_VC_MPU_ERRST_OFFSET 0x00ac
397#define OMAP54XX_PRM_VC_BYPASS_ERRST_OFFSET 0x00b0
398#define OMAP54XX_PRM_VC_CFG_I2C_MODE_OFFSET 0x00b4
399#define OMAP54XX_PRM_VC_CFG_I2C_CLK_OFFSET 0x00b8
400#define OMAP54XX_PRM_SRAM_COUNT_OFFSET 0x00bc
401#define OMAP54XX_PRM_SRAM_WKUP_SETUP_OFFSET 0x00c0
402#define OMAP54XX_PRM_SLDO_CORE_SETUP_OFFSET 0x00c4
403#define OMAP54XX_PRM_SLDO_CORE_CTRL_OFFSET 0x00c8
404#define OMAP54XX_PRM_SLDO_MPU_SETUP_OFFSET 0x00cc
405#define OMAP54XX_PRM_SLDO_MPU_CTRL_OFFSET 0x00d0
406#define OMAP54XX_PRM_SLDO_MM_SETUP_OFFSET 0x00d4
407#define OMAP54XX_PRM_SLDO_MM_CTRL_OFFSET 0x00d8
408#define OMAP54XX_PRM_ABBLDO_MPU_SETUP_OFFSET 0x00dc
409#define OMAP54XX_PRM_ABBLDO_MPU_CTRL_OFFSET 0x00e0
410#define OMAP54XX_PRM_ABBLDO_MM_SETUP_OFFSET 0x00e4
411#define OMAP54XX_PRM_ABBLDO_MM_CTRL_OFFSET 0x00e8
412#define OMAP54XX_PRM_BANDGAP_SETUP_OFFSET 0x00ec
413#define OMAP54XX_PRM_DEVICE_OFF_CTRL_OFFSET 0x00f0
414#define OMAP54XX_PRM_PHASE1_CNDP_OFFSET 0x00f4
415#define OMAP54XX_PRM_PHASE2A_CNDP_OFFSET 0x00f8
416#define OMAP54XX_PRM_PHASE2B_CNDP_OFFSET 0x00fc
417#define OMAP54XX_PRM_MODEM_IF_CTRL_OFFSET 0x0100
418#define OMAP54XX_PRM_VOLTST_MPU_OFFSET 0x0110
419#define OMAP54XX_PRM_VOLTST_MM_OFFSET 0x0114
420
421#endif
diff --git a/arch/arm/mach-omap2/scrm54xx.h b/arch/arm/mach-omap2/scrm54xx.h
new file mode 100644
index 000000000000..57e86c8f8239
--- /dev/null
+++ b/arch/arm/mach-omap2/scrm54xx.h
@@ -0,0 +1,231 @@
1/*
2 * OMAP54XX SCRM registers and bitfields
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Benoit Cousson (b-cousson@ti.com)
7 *
8 * This file is automatically generated from the OMAP hardware databases.
9 * We respectfully ask that any modifications to this file be coordinated
10 * with the public linux-omap@vger.kernel.org mailing list and the
11 * authors above to ensure that the autogeneration scripts are kept
12 * up-to-date with the file contents.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18
19#ifndef __ARCH_ARM_MACH_OMAP2_SCRM_54XX_H
20#define __ARCH_ARM_MACH_OMAP2_SCRM_54XX_H
21
22#define OMAP5_SCRM_BASE 0x4ae0a000
23
24#define OMAP54XX_SCRM_REGADDR(reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP5_SCRM_BASE + (reg))
26
27/* SCRM */
28
29/* SCRM.SCRM register offsets */
30#define OMAP5_SCRM_REVISION_SCRM_OFFSET 0x0000
31#define OMAP5_SCRM_REVISION_SCRM OMAP54XX_SCRM_REGADDR(0x0000)
32#define OMAP5_SCRM_CLKSETUPTIME_OFFSET 0x0100
33#define OMAP5_SCRM_CLKSETUPTIME OMAP54XX_SCRM_REGADDR(0x0100)
34#define OMAP5_SCRM_PMICSETUPTIME_OFFSET 0x0104
35#define OMAP5_SCRM_PMICSETUPTIME OMAP54XX_SCRM_REGADDR(0x0104)
36#define OMAP5_SCRM_ALTCLKSRC_OFFSET 0x0110
37#define OMAP5_SCRM_ALTCLKSRC OMAP54XX_SCRM_REGADDR(0x0110)
38#define OMAP5_SCRM_MODEMCLKM_OFFSET 0x0118
39#define OMAP5_SCRM_MODEMCLKM OMAP54XX_SCRM_REGADDR(0x0118)
40#define OMAP5_SCRM_D2DCLKM_OFFSET 0x011c
41#define OMAP5_SCRM_D2DCLKM OMAP54XX_SCRM_REGADDR(0x011c)
42#define OMAP5_SCRM_EXTCLKREQ_OFFSET 0x0200
43#define OMAP5_SCRM_EXTCLKREQ OMAP54XX_SCRM_REGADDR(0x0200)
44#define OMAP5_SCRM_ACCCLKREQ_OFFSET 0x0204
45#define OMAP5_SCRM_ACCCLKREQ OMAP54XX_SCRM_REGADDR(0x0204)
46#define OMAP5_SCRM_PWRREQ_OFFSET 0x0208
47#define OMAP5_SCRM_PWRREQ OMAP54XX_SCRM_REGADDR(0x0208)
48#define OMAP5_SCRM_AUXCLKREQ0_OFFSET 0x0210
49#define OMAP5_SCRM_AUXCLKREQ0 OMAP54XX_SCRM_REGADDR(0x0210)
50#define OMAP5_SCRM_AUXCLKREQ1_OFFSET 0x0214
51#define OMAP5_SCRM_AUXCLKREQ1 OMAP54XX_SCRM_REGADDR(0x0214)
52#define OMAP5_SCRM_AUXCLKREQ2_OFFSET 0x0218
53#define OMAP5_SCRM_AUXCLKREQ2 OMAP54XX_SCRM_REGADDR(0x0218)
54#define OMAP5_SCRM_AUXCLKREQ3_OFFSET 0x021c
55#define OMAP5_SCRM_AUXCLKREQ3 OMAP54XX_SCRM_REGADDR(0x021c)
56#define OMAP5_SCRM_AUXCLKREQ4_OFFSET 0x0220
57#define OMAP5_SCRM_AUXCLKREQ4 OMAP54XX_SCRM_REGADDR(0x0220)
58#define OMAP5_SCRM_AUXCLKREQ5_OFFSET 0x0224
59#define OMAP5_SCRM_AUXCLKREQ5 OMAP54XX_SCRM_REGADDR(0x0224)
60#define OMAP5_SCRM_D2DCLKREQ_OFFSET 0x0234
61#define OMAP5_SCRM_D2DCLKREQ OMAP54XX_SCRM_REGADDR(0x0234)
62#define OMAP5_SCRM_AUXCLK0_OFFSET 0x0310
63#define OMAP5_SCRM_AUXCLK0 OMAP54XX_SCRM_REGADDR(0x0310)
64#define OMAP5_SCRM_AUXCLK1_OFFSET 0x0314
65#define OMAP5_SCRM_AUXCLK1 OMAP54XX_SCRM_REGADDR(0x0314)
66#define OMAP5_SCRM_AUXCLK2_OFFSET 0x0318
67#define OMAP5_SCRM_AUXCLK2 OMAP54XX_SCRM_REGADDR(0x0318)
68#define OMAP5_SCRM_AUXCLK3_OFFSET 0x031c
69#define OMAP5_SCRM_AUXCLK3 OMAP54XX_SCRM_REGADDR(0x031c)
70#define OMAP5_SCRM_AUXCLK4_OFFSET 0x0320
71#define OMAP5_SCRM_AUXCLK4 OMAP54XX_SCRM_REGADDR(0x0320)
72#define OMAP5_SCRM_AUXCLK5_OFFSET 0x0324
73#define OMAP5_SCRM_AUXCLK5 OMAP54XX_SCRM_REGADDR(0x0324)
74#define OMAP5_SCRM_RSTTIME_OFFSET 0x0400
75#define OMAP5_SCRM_RSTTIME OMAP54XX_SCRM_REGADDR(0x0400)
76#define OMAP5_SCRM_MODEMRSTCTRL_OFFSET 0x0418
77#define OMAP5_SCRM_MODEMRSTCTRL OMAP54XX_SCRM_REGADDR(0x0418)
78#define OMAP5_SCRM_D2DRSTCTRL_OFFSET 0x041c
79#define OMAP5_SCRM_D2DRSTCTRL OMAP54XX_SCRM_REGADDR(0x041c)
80#define OMAP5_SCRM_EXTPWRONRSTCTRL_OFFSET 0x0420
81#define OMAP5_SCRM_EXTPWRONRSTCTRL OMAP54XX_SCRM_REGADDR(0x0420)
82#define OMAP5_SCRM_EXTWARMRSTST_OFFSET 0x0510
83#define OMAP5_SCRM_EXTWARMRSTST OMAP54XX_SCRM_REGADDR(0x0510)
84#define OMAP5_SCRM_APEWARMRSTST_OFFSET 0x0514
85#define OMAP5_SCRM_APEWARMRSTST OMAP54XX_SCRM_REGADDR(0x0514)
86#define OMAP5_SCRM_MODEMWARMRSTST_OFFSET 0x0518
87#define OMAP5_SCRM_MODEMWARMRSTST OMAP54XX_SCRM_REGADDR(0x0518)
88#define OMAP5_SCRM_D2DWARMRSTST_OFFSET 0x051c
89#define OMAP5_SCRM_D2DWARMRSTST OMAP54XX_SCRM_REGADDR(0x051c)
90
91/*
92 * Used by AUXCLKREQ0, AUXCLKREQ1, AUXCLKREQ2, AUXCLKREQ3, AUXCLKREQ4,
93 * AUXCLKREQ5, D2DCLKREQ
94 */
95#define OMAP5_ACCURACY_SHIFT 1
96#define OMAP5_ACCURACY_WIDTH 0x1
97#define OMAP5_ACCURACY_MASK (1 << 1)
98
99/* Used by APEWARMRSTST */
100#define OMAP5_APEWARMRSTST_SHIFT 1
101#define OMAP5_APEWARMRSTST_WIDTH 0x1
102#define OMAP5_APEWARMRSTST_MASK (1 << 1)
103
104/* Used by AUXCLK0, AUXCLK1, AUXCLK2, AUXCLK3, AUXCLK4, AUXCLK5 */
105#define OMAP5_CLKDIV_SHIFT 16
106#define OMAP5_CLKDIV_WIDTH 0x4
107#define OMAP5_CLKDIV_MASK (0xf << 16)
108
109/* Used by D2DCLKM, MODEMCLKM */
110#define OMAP5_CLK_32KHZ_SHIFT 0
111#define OMAP5_CLK_32KHZ_WIDTH 0x1
112#define OMAP5_CLK_32KHZ_MASK (1 << 0)
113
114/* Used by D2DRSTCTRL, MODEMRSTCTRL */
115#define OMAP5_COLDRST_SHIFT 0
116#define OMAP5_COLDRST_WIDTH 0x1
117#define OMAP5_COLDRST_MASK (1 << 0)
118
119/* Used by D2DWARMRSTST */
120#define OMAP5_D2DWARMRSTST_SHIFT 3
121#define OMAP5_D2DWARMRSTST_WIDTH 0x1
122#define OMAP5_D2DWARMRSTST_MASK (1 << 3)
123
124/* Used by AUXCLK0 */
125#define OMAP5_DISABLECLK_SHIFT 9
126#define OMAP5_DISABLECLK_WIDTH 0x1
127#define OMAP5_DISABLECLK_MASK (1 << 9)
128
129/* Used by CLKSETUPTIME */
130#define OMAP5_DOWNTIME_SHIFT 16
131#define OMAP5_DOWNTIME_WIDTH 0x6
132#define OMAP5_DOWNTIME_MASK (0x3f << 16)
133
134/* Used by AUXCLK0, AUXCLK1, AUXCLK2, AUXCLK3, AUXCLK4, AUXCLK5 */
135#define OMAP5_ENABLE_SHIFT 8
136#define OMAP5_ENABLE_WIDTH 0x1
137#define OMAP5_ENABLE_MASK (1 << 8)
138
139/* Renamed from ENABLE Used by EXTPWRONRSTCTRL */
140#define OMAP5_ENABLE_0_0_SHIFT 0
141#define OMAP5_ENABLE_0_0_WIDTH 0x1
142#define OMAP5_ENABLE_0_0_MASK (1 << 0)
143
144/* Used by ALTCLKSRC */
145#define OMAP5_ENABLE_EXT_SHIFT 3
146#define OMAP5_ENABLE_EXT_WIDTH 0x1
147#define OMAP5_ENABLE_EXT_MASK (1 << 3)
148
149/* Used by ALTCLKSRC */
150#define OMAP5_ENABLE_INT_SHIFT 2
151#define OMAP5_ENABLE_INT_WIDTH 0x1
152#define OMAP5_ENABLE_INT_MASK (1 << 2)
153
154/* Used by EXTWARMRSTST */
155#define OMAP5_EXTWARMRSTST_SHIFT 0
156#define OMAP5_EXTWARMRSTST_WIDTH 0x1
157#define OMAP5_EXTWARMRSTST_MASK (1 << 0)
158
159/*
160 * Used by AUXCLKREQ0, AUXCLKREQ1, AUXCLKREQ2, AUXCLKREQ3, AUXCLKREQ4,
161 * AUXCLKREQ5
162 */
163#define OMAP5_MAPPING_SHIFT 2
164#define OMAP5_MAPPING_WIDTH 0x3
165#define OMAP5_MAPPING_MASK (0x7 << 2)
166
167/* Used by ALTCLKSRC */
168#define OMAP5_MODE_SHIFT 0
169#define OMAP5_MODE_WIDTH 0x2
170#define OMAP5_MODE_MASK (0x3 << 0)
171
172/* Used by MODEMWARMRSTST */
173#define OMAP5_MODEMWARMRSTST_SHIFT 2
174#define OMAP5_MODEMWARMRSTST_WIDTH 0x1
175#define OMAP5_MODEMWARMRSTST_MASK (1 << 2)
176
177/*
178 * Used by ACCCLKREQ, AUXCLK0, AUXCLK1, AUXCLK2, AUXCLK3, AUXCLK4, AUXCLK5,
179 * AUXCLKREQ0, AUXCLKREQ1, AUXCLKREQ2, AUXCLKREQ3, AUXCLKREQ4, AUXCLKREQ5,
180 * D2DCLKREQ, EXTCLKREQ, PWRREQ
181 */
182#define OMAP5_POLARITY_SHIFT 0
183#define OMAP5_POLARITY_WIDTH 0x1
184#define OMAP5_POLARITY_MASK (1 << 0)
185
186/* Used by EXTPWRONRSTCTRL */
187#define OMAP5_PWRONRST_SHIFT 1
188#define OMAP5_PWRONRST_WIDTH 0x1
189#define OMAP5_PWRONRST_MASK (1 << 1)
190
191/* Used by REVISION_SCRM */
192#define OMAP5_REV_SHIFT 0
193#define OMAP5_REV_WIDTH 0x8
194#define OMAP5_REV_MASK (0xff << 0)
195
196/* Used by RSTTIME */
197#define OMAP5_RSTTIME_SHIFT 0
198#define OMAP5_RSTTIME_WIDTH 0x4
199#define OMAP5_RSTTIME_MASK (0xf << 0)
200
201/* Used by CLKSETUPTIME */
202#define OMAP5_SETUPTIME_SHIFT 0
203#define OMAP5_SETUPTIME_WIDTH 0xc
204#define OMAP5_SETUPTIME_MASK (0xfff << 0)
205
206/* Used by PMICSETUPTIME */
207#define OMAP5_SLEEPTIME_SHIFT 0
208#define OMAP5_SLEEPTIME_WIDTH 0x6
209#define OMAP5_SLEEPTIME_MASK (0x3f << 0)
210
211/* Used by AUXCLK0, AUXCLK1, AUXCLK2, AUXCLK3, AUXCLK4, AUXCLK5 */
212#define OMAP5_SRCSELECT_SHIFT 1
213#define OMAP5_SRCSELECT_WIDTH 0x2
214#define OMAP5_SRCSELECT_MASK (0x3 << 1)
215
216/* Used by D2DCLKM */
217#define OMAP5_SYSCLK_SHIFT 1
218#define OMAP5_SYSCLK_WIDTH 0x1
219#define OMAP5_SYSCLK_MASK (1 << 1)
220
221/* Used by PMICSETUPTIME */
222#define OMAP5_WAKEUPTIME_SHIFT 16
223#define OMAP5_WAKEUPTIME_WIDTH 0x6
224#define OMAP5_WAKEUPTIME_MASK (0x3f << 16)
225
226/* Used by D2DRSTCTRL, MODEMRSTCTRL */
227#define OMAP5_WARMRST_SHIFT 1
228#define OMAP5_WARMRST_WIDTH 0x1
229#define OMAP5_WARMRST_MASK (1 << 1)
230
231#endif
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index f6601563aa69..3a674de6cb63 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -63,7 +63,6 @@ struct omap_uart_state {
63static LIST_HEAD(uart_list); 63static LIST_HEAD(uart_list);
64static u8 num_uarts; 64static u8 num_uarts;
65static u8 console_uart_id = -1; 65static u8 console_uart_id = -1;
66static u8 no_console_suspend;
67static u8 uart_debug; 66static u8 uart_debug;
68 67
69#define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */ 68#define DEFAULT_RXDMA_POLLRATE 1 /* RX DMA polling rate (us) */
@@ -176,6 +175,9 @@ static char *cmdline_find_option(char *str)
176 175
177static int __init omap_serial_early_init(void) 176static int __init omap_serial_early_init(void)
178{ 177{
178 if (of_have_populated_dt())
179 return -ENODEV;
180
179 do { 181 do {
180 char oh_name[MAX_UART_HWMOD_NAME_LEN]; 182 char oh_name[MAX_UART_HWMOD_NAME_LEN];
181 struct omap_hwmod *oh; 183 struct omap_hwmod *oh;
@@ -207,9 +209,6 @@ static int __init omap_serial_early_init(void)
207 uart_name, uart->num); 209 uart_name, uart->num);
208 } 210 }
209 211
210 if (cmdline_find_option("no_console_suspend"))
211 no_console_suspend = true;
212
213 /* 212 /*
214 * omap-uart can be used for earlyprintk logs 213 * omap-uart can be used for earlyprintk logs
215 * So if omap-uart is used as console then prevent 214 * So if omap-uart is used as console then prevent
@@ -292,9 +291,6 @@ void __init omap_serial_init_port(struct omap_board_data *bdata,
292 return; 291 return;
293 } 292 }
294 293
295 if ((console_uart_id == bdata->id) && no_console_suspend)
296 omap_device_disable_idle_on_suspend(pdev);
297
298 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); 294 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
299 295
300 if (console_uart_id == bdata->id) { 296 if (console_uart_id == bdata->id) {
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index aee3c8940a30..7a42e1960c3b 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -26,14 +26,14 @@ static int sr_class3_enable(struct omap_sr *sr)
26 } 26 }
27 27
28 omap_vp_enable(sr->voltdm); 28 omap_vp_enable(sr->voltdm);
29 return sr_enable(sr->voltdm, volt); 29 return sr_enable(sr, volt);
30} 30}
31 31
32static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset) 32static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
33{ 33{
34 sr_disable_errgen(sr->voltdm); 34 sr_disable_errgen(sr);
35 omap_vp_disable(sr->voltdm); 35 omap_vp_disable(sr->voltdm);
36 sr_disable(sr->voltdm); 36 sr_disable(sr);
37 if (is_volt_reset) 37 if (is_volt_reset)
38 voltdm_reset(sr->voltdm); 38 voltdm_reset(sr->voltdm);
39 39
@@ -42,7 +42,7 @@ static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
42 42
43static int sr_class3_configure(struct omap_sr *sr) 43static int sr_class3_configure(struct omap_sr *sr)
44{ 44{
45 return sr_configure_errgen(sr->voltdm); 45 return sr_configure_errgen(sr);
46} 46}
47 47
48/* SR class3 structure */ 48/* SR class3 structure */
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index 197cc16870d9..8c616e436bc7 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -96,6 +96,15 @@
96# endif 96# endif
97#endif 97#endif
98 98
99#ifdef CONFIG_SOC_AM43XX
100# ifdef OMAP_NAME
101# undef MULTI_OMAP2
102# define MULTI_OMAP2
103# else
104# define OMAP_NAME am43xx
105# endif
106#endif
107
99/* 108/*
100 * Omap device type i.e. EMU/HS/TST/GP/BAD 109 * Omap device type i.e. EMU/HS/TST/GP/BAD
101 */ 110 */
@@ -187,6 +196,7 @@ IS_OMAP_CLASS(44xx, 0x44)
187IS_AM_CLASS(35xx, 0x35) 196IS_AM_CLASS(35xx, 0x35)
188IS_OMAP_CLASS(54xx, 0x54) 197IS_OMAP_CLASS(54xx, 0x54)
189IS_AM_CLASS(33xx, 0x33) 198IS_AM_CLASS(33xx, 0x33)
199IS_AM_CLASS(43xx, 0x43)
190 200
191IS_TI_CLASS(81xx, 0x81) 201IS_TI_CLASS(81xx, 0x81)
192 202
@@ -202,6 +212,7 @@ IS_OMAP_SUBCLASS(543x, 0x543)
202IS_TI_SUBCLASS(816x, 0x816) 212IS_TI_SUBCLASS(816x, 0x816)
203IS_TI_SUBCLASS(814x, 0x814) 213IS_TI_SUBCLASS(814x, 0x814)
204IS_AM_SUBCLASS(335x, 0x335) 214IS_AM_SUBCLASS(335x, 0x335)
215IS_AM_SUBCLASS(437x, 0x437)
205 216
206#define cpu_is_omap24xx() 0 217#define cpu_is_omap24xx() 0
207#define cpu_is_omap242x() 0 218#define cpu_is_omap242x() 0
@@ -214,6 +225,8 @@ IS_AM_SUBCLASS(335x, 0x335)
214#define soc_is_am35xx() 0 225#define soc_is_am35xx() 0
215#define soc_is_am33xx() 0 226#define soc_is_am33xx() 0
216#define soc_is_am335x() 0 227#define soc_is_am335x() 0
228#define soc_is_am43xx() 0
229#define soc_is_am437x() 0
217#define cpu_is_omap44xx() 0 230#define cpu_is_omap44xx() 0
218#define cpu_is_omap443x() 0 231#define cpu_is_omap443x() 0
219#define cpu_is_omap446x() 0 232#define cpu_is_omap446x() 0
@@ -341,6 +354,13 @@ IS_OMAP_TYPE(3430, 0x3430)
341# define soc_is_am335x() is_am335x() 354# define soc_is_am335x() is_am335x()
342#endif 355#endif
343 356
357#ifdef CONFIG_SOC_AM43XX
358# undef soc_is_am43xx
359# undef soc_is_am437x
360# define soc_is_am43xx() is_am43xx()
361# define soc_is_am437x() is_am437x()
362#endif
363
344# if defined(CONFIG_ARCH_OMAP4) 364# if defined(CONFIG_ARCH_OMAP4)
345# undef cpu_is_omap44xx 365# undef cpu_is_omap44xx
346# undef cpu_is_omap443x 366# undef cpu_is_omap443x
@@ -383,6 +403,8 @@ IS_OMAP_TYPE(3430, 0x3430)
383#define TI816X_CLASS 0x81600034 403#define TI816X_CLASS 0x81600034
384#define TI8168_REV_ES1_0 TI816X_CLASS 404#define TI8168_REV_ES1_0 TI816X_CLASS
385#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8)) 405#define TI8168_REV_ES1_1 (TI816X_CLASS | (0x1 << 8))
406#define TI8168_REV_ES2_0 (TI816X_CLASS | (0x2 << 8))
407#define TI8168_REV_ES2_1 (TI816X_CLASS | (0x3 << 8))
386 408
387#define TI814X_CLASS 0x81400034 409#define TI814X_CLASS 0x81400034
388#define TI8148_REV_ES1_0 TI814X_CLASS 410#define TI8148_REV_ES1_0 TI814X_CLASS
@@ -398,6 +420,9 @@ IS_OMAP_TYPE(3430, 0x3430)
398#define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8)) 420#define AM335X_REV_ES2_0 (AM335X_CLASS | (0x1 << 8))
399#define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8)) 421#define AM335X_REV_ES2_1 (AM335X_CLASS | (0x2 << 8))
400 422
423#define AM437X_CLASS 0x43700000
424#define AM437X_REV_ES1_0 AM437X_CLASS
425
401#define OMAP443X_CLASS 0x44300044 426#define OMAP443X_CLASS 0x44300044
402#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8)) 427#define OMAP4430_REV_ES1_0 (OMAP443X_CLASS | (0x10 << 8))
403#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8)) 428#define OMAP4430_REV_ES2_0 (OMAP443X_CLASS | (0x20 << 8))
@@ -424,6 +449,7 @@ void omap4xxx_check_revision(void);
424void omap5xxx_check_revision(void); 449void omap5xxx_check_revision(void);
425void omap3xxx_check_features(void); 450void omap3xxx_check_features(void);
426void ti81xx_check_features(void); 451void ti81xx_check_features(void);
452void am33xx_check_features(void);
427void omap4xxx_check_features(void); 453void omap4xxx_check_features(void);
428 454
429/* 455/*
diff --git a/arch/arm/mach-omap2/sram.c b/arch/arm/mach-omap2/sram.c
index 0ff0f068bea8..4bd096836235 100644
--- a/arch/arm/mach-omap2/sram.c
+++ b/arch/arm/mach-omap2/sram.c
@@ -119,6 +119,9 @@ static void __init omap_detect_sram(void)
119 if (soc_is_am33xx()) { 119 if (soc_is_am33xx()) {
120 omap_sram_start = AM33XX_SRAM_PA; 120 omap_sram_start = AM33XX_SRAM_PA;
121 omap_sram_size = 0x10000; /* 64K */ 121 omap_sram_size = 0x10000; /* 64K */
122 } else if (soc_is_am43xx()) {
123 omap_sram_start = AM33XX_SRAM_PA;
124 omap_sram_size = SZ_256K;
122 } else if (cpu_is_omap34xx()) { 125 } else if (cpu_is_omap34xx()) {
123 omap_sram_start = OMAP3_SRAM_PA; 126 omap_sram_start = OMAP3_SRAM_PA;
124 omap_sram_size = 0x10000; /* 64K */ 127 omap_sram_size = 0x10000; /* 64K */
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index f8b23b8040d9..3bdb0fb02028 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -582,7 +582,7 @@ OMAP_SYS_32K_TIMER_INIT(2, 1, "timer_32k_ck", "ti,timer-alwon",
582 2, "timer_sys_ck", NULL); 582 2, "timer_sys_ck", NULL);
583#endif /* CONFIG_ARCH_OMAP2 */ 583#endif /* CONFIG_ARCH_OMAP2 */
584 584
585#ifdef CONFIG_ARCH_OMAP3 585#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM43XX)
586OMAP_SYS_32K_TIMER_INIT(3, 1, "timer_32k_ck", "ti,timer-alwon", 586OMAP_SYS_32K_TIMER_INIT(3, 1, "timer_32k_ck", "ti,timer-alwon",
587 2, "timer_sys_ck", NULL); 587 2, "timer_sys_ck", NULL);
588OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure", 588OMAP_SYS_32K_TIMER_INIT(3_secure, 12, "secure_32k_fck", "ti,timer-secure",
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 51e138cc5398..c05898fbd634 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -140,6 +140,7 @@ static struct regulator_init_data omap3_vdac_idata = {
140 140
141static struct regulator_consumer_supply omap3_vpll2_supplies[] = { 141static struct regulator_consumer_supply omap3_vpll2_supplies[] = {
142 REGULATOR_SUPPLY("vdds_dsi", "omapdss"), 142 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
143 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
143 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), 144 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
144}; 145};
145 146
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index aa27d7f5cbb7..2eb19d4d0aa1 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -28,6 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/usb/phy.h> 30#include <linux/usb/phy.h>
31#include <linux/usb/nop-usb-xceiv.h>
31 32
32#include "soc.h" 33#include "soc.h"
33#include "omap_device.h" 34#include "omap_device.h"
@@ -188,125 +189,6 @@ static void __init setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
188 return; 189 return;
189} 190}
190 191
191static
192void __init setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
193{
194 switch (port_mode[0]) {
195 case OMAP_EHCI_PORT_MODE_PHY:
196 omap_mux_init_signal("usbb1_ulpiphy_stp",
197 OMAP_PIN_OUTPUT);
198 omap_mux_init_signal("usbb1_ulpiphy_clk",
199 OMAP_PIN_INPUT_PULLDOWN);
200 omap_mux_init_signal("usbb1_ulpiphy_dir",
201 OMAP_PIN_INPUT_PULLDOWN);
202 omap_mux_init_signal("usbb1_ulpiphy_nxt",
203 OMAP_PIN_INPUT_PULLDOWN);
204 omap_mux_init_signal("usbb1_ulpiphy_dat0",
205 OMAP_PIN_INPUT_PULLDOWN);
206 omap_mux_init_signal("usbb1_ulpiphy_dat1",
207 OMAP_PIN_INPUT_PULLDOWN);
208 omap_mux_init_signal("usbb1_ulpiphy_dat2",
209 OMAP_PIN_INPUT_PULLDOWN);
210 omap_mux_init_signal("usbb1_ulpiphy_dat3",
211 OMAP_PIN_INPUT_PULLDOWN);
212 omap_mux_init_signal("usbb1_ulpiphy_dat4",
213 OMAP_PIN_INPUT_PULLDOWN);
214 omap_mux_init_signal("usbb1_ulpiphy_dat5",
215 OMAP_PIN_INPUT_PULLDOWN);
216 omap_mux_init_signal("usbb1_ulpiphy_dat6",
217 OMAP_PIN_INPUT_PULLDOWN);
218 omap_mux_init_signal("usbb1_ulpiphy_dat7",
219 OMAP_PIN_INPUT_PULLDOWN);
220 break;
221 case OMAP_EHCI_PORT_MODE_TLL:
222 omap_mux_init_signal("usbb1_ulpitll_stp",
223 OMAP_PIN_INPUT_PULLUP);
224 omap_mux_init_signal("usbb1_ulpitll_clk",
225 OMAP_PIN_INPUT_PULLDOWN);
226 omap_mux_init_signal("usbb1_ulpitll_dir",
227 OMAP_PIN_INPUT_PULLDOWN);
228 omap_mux_init_signal("usbb1_ulpitll_nxt",
229 OMAP_PIN_INPUT_PULLDOWN);
230 omap_mux_init_signal("usbb1_ulpitll_dat0",
231 OMAP_PIN_INPUT_PULLDOWN);
232 omap_mux_init_signal("usbb1_ulpitll_dat1",
233 OMAP_PIN_INPUT_PULLDOWN);
234 omap_mux_init_signal("usbb1_ulpitll_dat2",
235 OMAP_PIN_INPUT_PULLDOWN);
236 omap_mux_init_signal("usbb1_ulpitll_dat3",
237 OMAP_PIN_INPUT_PULLDOWN);
238 omap_mux_init_signal("usbb1_ulpitll_dat4",
239 OMAP_PIN_INPUT_PULLDOWN);
240 omap_mux_init_signal("usbb1_ulpitll_dat5",
241 OMAP_PIN_INPUT_PULLDOWN);
242 omap_mux_init_signal("usbb1_ulpitll_dat6",
243 OMAP_PIN_INPUT_PULLDOWN);
244 omap_mux_init_signal("usbb1_ulpitll_dat7",
245 OMAP_PIN_INPUT_PULLDOWN);
246 break;
247 case OMAP_USBHS_PORT_MODE_UNUSED:
248 default:
249 break;
250 }
251 switch (port_mode[1]) {
252 case OMAP_EHCI_PORT_MODE_PHY:
253 omap_mux_init_signal("usbb2_ulpiphy_stp",
254 OMAP_PIN_OUTPUT);
255 omap_mux_init_signal("usbb2_ulpiphy_clk",
256 OMAP_PIN_INPUT_PULLDOWN);
257 omap_mux_init_signal("usbb2_ulpiphy_dir",
258 OMAP_PIN_INPUT_PULLDOWN);
259 omap_mux_init_signal("usbb2_ulpiphy_nxt",
260 OMAP_PIN_INPUT_PULLDOWN);
261 omap_mux_init_signal("usbb2_ulpiphy_dat0",
262 OMAP_PIN_INPUT_PULLDOWN);
263 omap_mux_init_signal("usbb2_ulpiphy_dat1",
264 OMAP_PIN_INPUT_PULLDOWN);
265 omap_mux_init_signal("usbb2_ulpiphy_dat2",
266 OMAP_PIN_INPUT_PULLDOWN);
267 omap_mux_init_signal("usbb2_ulpiphy_dat3",
268 OMAP_PIN_INPUT_PULLDOWN);
269 omap_mux_init_signal("usbb2_ulpiphy_dat4",
270 OMAP_PIN_INPUT_PULLDOWN);
271 omap_mux_init_signal("usbb2_ulpiphy_dat5",
272 OMAP_PIN_INPUT_PULLDOWN);
273 omap_mux_init_signal("usbb2_ulpiphy_dat6",
274 OMAP_PIN_INPUT_PULLDOWN);
275 omap_mux_init_signal("usbb2_ulpiphy_dat7",
276 OMAP_PIN_INPUT_PULLDOWN);
277 break;
278 case OMAP_EHCI_PORT_MODE_TLL:
279 omap_mux_init_signal("usbb2_ulpitll_stp",
280 OMAP_PIN_INPUT_PULLUP);
281 omap_mux_init_signal("usbb2_ulpitll_clk",
282 OMAP_PIN_INPUT_PULLDOWN);
283 omap_mux_init_signal("usbb2_ulpitll_dir",
284 OMAP_PIN_INPUT_PULLDOWN);
285 omap_mux_init_signal("usbb2_ulpitll_nxt",
286 OMAP_PIN_INPUT_PULLDOWN);
287 omap_mux_init_signal("usbb2_ulpitll_dat0",
288 OMAP_PIN_INPUT_PULLDOWN);
289 omap_mux_init_signal("usbb2_ulpitll_dat1",
290 OMAP_PIN_INPUT_PULLDOWN);
291 omap_mux_init_signal("usbb2_ulpitll_dat2",
292 OMAP_PIN_INPUT_PULLDOWN);
293 omap_mux_init_signal("usbb2_ulpitll_dat3",
294 OMAP_PIN_INPUT_PULLDOWN);
295 omap_mux_init_signal("usbb2_ulpitll_dat4",
296 OMAP_PIN_INPUT_PULLDOWN);
297 omap_mux_init_signal("usbb2_ulpitll_dat5",
298 OMAP_PIN_INPUT_PULLDOWN);
299 omap_mux_init_signal("usbb2_ulpitll_dat6",
300 OMAP_PIN_INPUT_PULLDOWN);
301 omap_mux_init_signal("usbb2_ulpitll_dat7",
302 OMAP_PIN_INPUT_PULLDOWN);
303 break;
304 case OMAP_USBHS_PORT_MODE_UNUSED:
305 default:
306 break;
307 }
308}
309
310static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) 192static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
311{ 193{
312 switch (port_mode[0]) { 194 switch (port_mode[0]) {
@@ -404,78 +286,6 @@ static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
404 } 286 }
405} 287}
406 288
407static
408void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
409{
410 switch (port_mode[0]) {
411 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
412 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
413 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
414 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
415 omap_mux_init_signal("usbb1_mm_rxdp",
416 OMAP_PIN_INPUT_PULLDOWN);
417 omap_mux_init_signal("usbb1_mm_rxdm",
418 OMAP_PIN_INPUT_PULLDOWN);
419
420 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
421 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
422 omap_mux_init_signal("usbb1_mm_rxrcv",
423 OMAP_PIN_INPUT_PULLDOWN);
424
425 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
426 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
427 omap_mux_init_signal("usbb1_mm_txen",
428 OMAP_PIN_INPUT_PULLDOWN);
429
430
431 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
432 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
433 omap_mux_init_signal("usbb1_mm_txdat",
434 OMAP_PIN_INPUT_PULLDOWN);
435 omap_mux_init_signal("usbb1_mm_txse0",
436 OMAP_PIN_INPUT_PULLDOWN);
437 break;
438
439 case OMAP_USBHS_PORT_MODE_UNUSED:
440 default:
441 break;
442 }
443
444 switch (port_mode[1]) {
445 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
446 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
447 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
448 case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
449 omap_mux_init_signal("usbb2_mm_rxdp",
450 OMAP_PIN_INPUT_PULLDOWN);
451 omap_mux_init_signal("usbb2_mm_rxdm",
452 OMAP_PIN_INPUT_PULLDOWN);
453
454 case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
455 case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
456 omap_mux_init_signal("usbb2_mm_rxrcv",
457 OMAP_PIN_INPUT_PULLDOWN);
458
459 case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
460 case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
461 omap_mux_init_signal("usbb2_mm_txen",
462 OMAP_PIN_INPUT_PULLDOWN);
463
464
465 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
466 case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
467 omap_mux_init_signal("usbb2_mm_txdat",
468 OMAP_PIN_INPUT_PULLDOWN);
469 omap_mux_init_signal("usbb2_mm_txse0",
470 OMAP_PIN_INPUT_PULLDOWN);
471 break;
472
473 case OMAP_USBHS_PORT_MODE_UNUSED:
474 default:
475 break;
476 }
477}
478
479void __init usbhs_init(struct usbhs_omap_platform_data *pdata) 289void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
480{ 290{
481 struct omap_hwmod *uhh_hwm, *tll_hwm; 291 struct omap_hwmod *uhh_hwm, *tll_hwm;
@@ -489,9 +299,6 @@ void __init usbhs_init(struct usbhs_omap_platform_data *pdata)
489 if (omap_rev() <= OMAP3430_REV_ES2_1) 299 if (omap_rev() <= OMAP3430_REV_ES2_1)
490 pdata->single_ulpi_bypass = true; 300 pdata->single_ulpi_bypass = true;
491 301
492 } else if (cpu_is_omap44xx()) {
493 setup_4430ehci_io_mux(pdata->port_mode);
494 setup_4430ohci_io_mux(pdata->port_mode);
495 } 302 }
496 303
497 uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); 304 uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
@@ -560,7 +367,8 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply,
560 struct regulator_init_data *reg_data; 367 struct regulator_init_data *reg_data;
561 struct fixed_voltage_config *config; 368 struct fixed_voltage_config *config;
562 struct platform_device *pdev; 369 struct platform_device *pdev;
563 int ret; 370 struct platform_device_info pdevinfo;
371 int ret = -ENOMEM;
564 372
565 supplies = kzalloc(sizeof(*supplies), GFP_KERNEL); 373 supplies = kzalloc(sizeof(*supplies), GFP_KERNEL);
566 if (!supplies) 374 if (!supplies)
@@ -571,7 +379,7 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply,
571 379
572 reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL); 380 reg_data = kzalloc(sizeof(*reg_data), GFP_KERNEL);
573 if (!reg_data) 381 if (!reg_data)
574 return -ENOMEM; 382 goto err_data;
575 383
576 reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; 384 reg_data->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
577 reg_data->consumer_supplies = supplies; 385 reg_data->consumer_supplies = supplies;
@@ -580,39 +388,53 @@ static int usbhs_add_regulator(char *name, char *dev_id, char *dev_supply,
580 config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config), 388 config = kmemdup(&hsusb_reg_config, sizeof(hsusb_reg_config),
581 GFP_KERNEL); 389 GFP_KERNEL);
582 if (!config) 390 if (!config)
583 return -ENOMEM; 391 goto err_config;
392
393 config->supply_name = kstrdup(name, GFP_KERNEL);
394 if (!config->supply_name)
395 goto err_supplyname;
584 396
585 config->supply_name = name;
586 config->gpio = gpio; 397 config->gpio = gpio;
587 config->enable_high = polarity; 398 config->enable_high = polarity;
588 config->init_data = reg_data; 399 config->init_data = reg_data;
589 400
590 /* create a regulator device */ 401 /* create a regulator device */
591 pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); 402 memset(&pdevinfo, 0, sizeof(pdevinfo));
592 if (!pdev) 403 pdevinfo.name = reg_name;
593 return -ENOMEM; 404 pdevinfo.id = PLATFORM_DEVID_AUTO;
405 pdevinfo.data = config;
406 pdevinfo.size_data = sizeof(*config);
594 407
595 pdev->id = PLATFORM_DEVID_AUTO; 408 pdev = platform_device_register_full(&pdevinfo);
596 pdev->name = reg_name; 409 if (IS_ERR(pdev)) {
597 pdev->dev.platform_data = config; 410 ret = PTR_ERR(pdev);
411 pr_err("%s: Failed registering regulator %s for %s : %d\n",
412 __func__, name, dev_id, ret);
413 goto err_register;
414 }
598 415
599 ret = platform_device_register(pdev); 416 return 0;
600 if (ret)
601 pr_err("%s: Failed registering regulator %s for %s\n",
602 __func__, name, dev_id);
603 417
418err_register:
419 kfree(config->supply_name);
420err_supplyname:
421 kfree(config);
422err_config:
423 kfree(reg_data);
424err_data:
425 kfree(supplies);
604 return ret; 426 return ret;
605} 427}
606 428
429#define MAX_STR 20
430
607int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys) 431int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
608{ 432{
609 char *rail_name; 433 char rail_name[MAX_STR];
610 int i, len; 434 int i;
611 struct platform_device *pdev; 435 struct platform_device *pdev;
612 char *phy_id; 436 char *phy_id;
613 437 struct platform_device_info pdevinfo;
614 /* the phy_id will be something like "nop_usb_xceiv.1" */
615 len = strlen(nop_name) + 3; /* 3 -> ".1" and NULL terminator */
616 438
617 for (i = 0; i < num_phys; i++) { 439 for (i = 0; i < num_phys; i++) {
618 440
@@ -627,25 +449,26 @@ int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
627 !gpio_is_valid(phy->vcc_gpio)) 449 !gpio_is_valid(phy->vcc_gpio))
628 continue; 450 continue;
629 451
630 /* create a NOP PHY device */ 452 phy_id = kmalloc(MAX_STR, GFP_KERNEL);
631 pdev = kzalloc(sizeof(*pdev), GFP_KERNEL); 453 if (!phy_id) {
632 if (!pdev) 454 pr_err("%s: kmalloc() failed\n", __func__);
633 return -ENOMEM; 455 return -ENOMEM;
456 }
634 457
635 pdev->id = phy->port; 458 /* create a NOP PHY device */
636 pdev->name = nop_name; 459 memset(&pdevinfo, 0, sizeof(pdevinfo));
637 pdev->dev.platform_data = phy->platform_data; 460 pdevinfo.name = nop_name;
638 461 pdevinfo.id = phy->port;
639 phy_id = kmalloc(len, GFP_KERNEL); 462 pdevinfo.data = phy->platform_data;
640 if (!phy_id) 463 pdevinfo.size_data = sizeof(struct nop_usb_xceiv_platform_data);
641 return -ENOMEM; 464
642 465 scnprintf(phy_id, MAX_STR, "nop_usb_xceiv.%d",
643 scnprintf(phy_id, len, "nop_usb_xceiv.%d\n", 466 phy->port);
644 pdev->id); 467 pdev = platform_device_register_full(&pdevinfo);
645 468 if (IS_ERR(pdev)) {
646 if (platform_device_register(pdev)) { 469 pr_err("%s: Failed to register device %s : %ld\n",
647 pr_err("%s: Failed to register device %s\n", 470 __func__, phy_id, PTR_ERR(pdev));
648 __func__, phy_id); 471 kfree(phy_id);
649 continue; 472 continue;
650 } 473 }
651 474
@@ -653,26 +476,15 @@ int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys)
653 476
654 /* Do we need RESET regulator ? */ 477 /* Do we need RESET regulator ? */
655 if (gpio_is_valid(phy->reset_gpio)) { 478 if (gpio_is_valid(phy->reset_gpio)) {
656 479 scnprintf(rail_name, MAX_STR,
657 rail_name = kmalloc(13, GFP_KERNEL); 480 "hsusb%d_reset", phy->port);
658 if (!rail_name)
659 return -ENOMEM;
660
661 scnprintf(rail_name, 13, "hsusb%d_reset", phy->port);
662
663 usbhs_add_regulator(rail_name, phy_id, "reset", 481 usbhs_add_regulator(rail_name, phy_id, "reset",
664 phy->reset_gpio, 1); 482 phy->reset_gpio, 1);
665 } 483 }
666 484
667 /* Do we need VCC regulator ? */ 485 /* Do we need VCC regulator ? */
668 if (gpio_is_valid(phy->vcc_gpio)) { 486 if (gpio_is_valid(phy->vcc_gpio)) {
669 487 scnprintf(rail_name, MAX_STR, "hsusb%d_vcc", phy->port);
670 rail_name = kmalloc(13, GFP_KERNEL);
671 if (!rail_name)
672 return -ENOMEM;
673
674 scnprintf(rail_name, 13, "hsusb%d_vcc", phy->port);
675
676 usbhs_add_regulator(rail_name, phy_id, "vcc", 488 usbhs_add_regulator(rail_name, phy_id, "vcc",
677 phy->vcc_gpio, phy->vcc_polarity); 489 phy->vcc_gpio, phy->vcc_polarity);
678 } 490 }
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index 3242a554ad6b..8c4de2708cf2 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -85,9 +85,6 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
85 musb_plat.mode = board_data->mode; 85 musb_plat.mode = board_data->mode;
86 musb_plat.extvbus = board_data->extvbus; 86 musb_plat.extvbus = board_data->extvbus;
87 87
88 if (cpu_is_omap44xx())
89 musb_plat.has_mailbox = true;
90
91 if (soc_is_am35xx()) { 88 if (soc_is_am35xx()) {
92 oh_name = "am35x_otg_hs"; 89 oh_name = "am35x_otg_hs";
93 name = "musb-am35x"; 90 name = "musb-am35x";
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index a0ce4f10ff13..f7f2879b31b0 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -169,8 +169,8 @@ int omap_voltage_late_init(void);
169 169
170extern void omap2xxx_voltagedomains_init(void); 170extern void omap2xxx_voltagedomains_init(void);
171extern void omap3xxx_voltagedomains_init(void); 171extern void omap3xxx_voltagedomains_init(void);
172extern void am33xx_voltagedomains_init(void);
173extern void omap44xx_voltagedomains_init(void); 172extern void omap44xx_voltagedomains_init(void);
173extern void omap54xx_voltagedomains_init(void);
174 174
175struct voltagedomain *voltdm_lookup(const char *name); 175struct voltagedomain *voltdm_lookup(const char *name);
176void voltdm_init(struct voltagedomain **voltdm_list); 176void voltdm_init(struct voltagedomain **voltdm_list);
diff --git a/arch/arm/mach-omap2/voltagedomains33xx_data.c b/arch/arm/mach-omap2/voltagedomains33xx_data.c
deleted file mode 100644
index 965458dc0cb9..000000000000
--- a/arch/arm/mach-omap2/voltagedomains33xx_data.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * AM33XX voltage domain data
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include "voltage.h"
20
21static struct voltagedomain am33xx_voltdm_mpu = {
22 .name = "mpu",
23};
24
25static struct voltagedomain am33xx_voltdm_core = {
26 .name = "core",
27};
28
29static struct voltagedomain am33xx_voltdm_rtc = {
30 .name = "rtc",
31};
32
33static struct voltagedomain *voltagedomains_am33xx[] __initdata = {
34 &am33xx_voltdm_mpu,
35 &am33xx_voltdm_core,
36 &am33xx_voltdm_rtc,
37 NULL,
38};
39
40void __init am33xx_voltagedomains_init(void)
41{
42 voltdm_init(voltagedomains_am33xx);
43}
diff --git a/arch/arm/mach-omap2/voltagedomains54xx_data.c b/arch/arm/mach-omap2/voltagedomains54xx_data.c
new file mode 100644
index 000000000000..33d22b87252d
--- /dev/null
+++ b/arch/arm/mach-omap2/voltagedomains54xx_data.c
@@ -0,0 +1,92 @@
1/*
2 * OMAP5 Voltage Management Routines
3 *
4 * Based on voltagedomains44xx_data.c
5 *
6 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.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#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/init.h>
15
16#include "common.h"
17
18#include "prm54xx.h"
19#include "voltage.h"
20#include "omap_opp_data.h"
21#include "vc.h"
22#include "vp.h"
23
24static const struct omap_vfsm_instance omap5_vdd_mpu_vfsm = {
25 .voltsetup_reg = OMAP54XX_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
26};
27
28static const struct omap_vfsm_instance omap5_vdd_mm_vfsm = {
29 .voltsetup_reg = OMAP54XX_PRM_VOLTSETUP_MM_RET_SLEEP_OFFSET,
30};
31
32static const struct omap_vfsm_instance omap5_vdd_core_vfsm = {
33 .voltsetup_reg = OMAP54XX_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
34};
35
36static struct voltagedomain omap5_voltdm_mpu = {
37 .name = "mpu",
38 .scalable = true,
39 .read = omap4_prm_vcvp_read,
40 .write = omap4_prm_vcvp_write,
41 .rmw = omap4_prm_vcvp_rmw,
42 .vc = &omap4_vc_mpu,
43 .vfsm = &omap5_vdd_mpu_vfsm,
44 .vp = &omap4_vp_mpu,
45};
46
47static struct voltagedomain omap5_voltdm_mm = {
48 .name = "mm",
49 .scalable = true,
50 .read = omap4_prm_vcvp_read,
51 .write = omap4_prm_vcvp_write,
52 .rmw = omap4_prm_vcvp_rmw,
53 .vc = &omap4_vc_iva,
54 .vfsm = &omap5_vdd_mm_vfsm,
55 .vp = &omap4_vp_iva,
56};
57
58static struct voltagedomain omap5_voltdm_core = {
59 .name = "core",
60 .scalable = true,
61 .read = omap4_prm_vcvp_read,
62 .write = omap4_prm_vcvp_write,
63 .rmw = omap4_prm_vcvp_rmw,
64 .vc = &omap4_vc_core,
65 .vfsm = &omap5_vdd_core_vfsm,
66 .vp = &omap4_vp_core,
67};
68
69static struct voltagedomain omap5_voltdm_wkup = {
70 .name = "wkup",
71};
72
73static struct voltagedomain *voltagedomains_omap5[] __initdata = {
74 &omap5_voltdm_mpu,
75 &omap5_voltdm_mm,
76 &omap5_voltdm_core,
77 &omap5_voltdm_wkup,
78 NULL,
79};
80
81static const char *sys_clk_name __initdata = "sys_clkin";
82
83void __init omap54xx_voltagedomains_init(void)
84{
85 struct voltagedomain *voltdm;
86 int i;
87
88 for (i = 0; voltdm = voltagedomains_omap5[i], voltdm; i++)
89 voltdm->sys_clk.name = sys_clk_name;
90
91 voltdm_init(voltagedomains_omap5);
92};
diff --git a/arch/arm/mach-picoxcell/Kconfig b/arch/arm/mach-picoxcell/Kconfig
index 13bae78b215a..b1022f4315f7 100644
--- a/arch/arm/mach-picoxcell/Kconfig
+++ b/arch/arm/mach-picoxcell/Kconfig
@@ -4,7 +4,6 @@ config ARCH_PICOXCELL
4 select ARM_PATCH_PHYS_VIRT 4 select ARM_PATCH_PHYS_VIRT
5 select ARM_VIC 5 select ARM_VIC
6 select CPU_V6K 6 select CPU_V6K
7 select DW_APB_TIMER
8 select DW_APB_TIMER_OF 7 select DW_APB_TIMER_OF
9 select GENERIC_CLOCKEVENTS 8 select GENERIC_CLOCKEVENTS
10 select HAVE_TCM 9 select HAVE_TCM
diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
index 70b441ad1d18..b13f51bc35cf 100644
--- a/arch/arm/mach-picoxcell/common.c
+++ b/arch/arm/mach-picoxcell/common.c
@@ -8,20 +8,13 @@
8 * All enquiries to support@picochip.com 8 * All enquiries to support@picochip.com
9 */ 9 */
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/irq.h>
12#include <linux/irqchip.h>
13#include <linux/irqdomain.h>
14#include <linux/of.h> 11#include <linux/of.h>
15#include <linux/of_address.h> 12#include <linux/of_address.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h> 13#include <linux/of_platform.h>
18#include <linux/dw_apb_timer.h>
19 14
20#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
21#include <asm/mach/map.h> 16#include <asm/mach/map.h>
22 17
23#include "common.h"
24
25#define PHYS_TO_IO(x) (((x) & 0x00ffffff) | 0xfe000000) 18#define PHYS_TO_IO(x) (((x) & 0x00ffffff) | 0xfe000000)
26#define PICOXCELL_PERIPH_BASE 0x80000000 19#define PICOXCELL_PERIPH_BASE 0x80000000
27#define PICOXCELL_PERIPH_LENGTH SZ_4M 20#define PICOXCELL_PERIPH_LENGTH SZ_4M
@@ -86,9 +79,6 @@ static void picoxcell_wdt_restart(char mode, const char *cmd)
86 79
87DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") 80DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
88 .map_io = picoxcell_map_io, 81 .map_io = picoxcell_map_io,
89 .nr_irqs = NR_IRQS_LEGACY,
90 .init_irq = irqchip_init,
91 .init_time = dw_apb_timer_init,
92 .init_machine = picoxcell_init_machine, 82 .init_machine = picoxcell_init_machine,
93 .dt_compat = picoxcell_dt_match, 83 .dt_compat = picoxcell_dt_match,
94 .restart = picoxcell_wdt_restart, 84 .restart = picoxcell_wdt_restart,
diff --git a/arch/arm/mach-picoxcell/common.h b/arch/arm/mach-picoxcell/common.h
deleted file mode 100644
index 481b42a4ef15..000000000000
--- a/arch/arm/mach-picoxcell/common.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (c) 2011 Picochip Ltd., Jamie Iles
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 * All enquiries to support@picochip.com
9 */
10#ifndef __PICOXCELL_COMMON_H__
11#define __PICOXCELL_COMMON_H__
12
13#include <asm/mach/time.h>
14
15extern void dw_apb_timer_init(void);
16
17#endif /* __PICOXCELL_COMMON_H__ */
diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index 4f94cd87972a..2c70f74fed5d 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -9,7 +9,6 @@
9#include <linux/clocksource.h> 9#include <linux/clocksource.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/irqchip.h>
13#include <asm/sizes.h> 12#include <asm/sizes.h>
14#include <asm/mach-types.h> 13#include <asm/mach-types.h>
15#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
@@ -17,16 +16,6 @@
17#include <linux/of_platform.h> 16#include <linux/of_platform.h>
18#include "common.h" 17#include "common.h"
19 18
20static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
21 { .compatible = "simple-bus", },
22 {},
23};
24
25void __init sirfsoc_mach_init(void)
26{
27 of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
28}
29
30void __init sirfsoc_init_late(void) 19void __init sirfsoc_init_late(void)
31{ 20{
32 sirfsoc_pm_init(); 21 sirfsoc_pm_init();
@@ -55,9 +44,7 @@ DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
55 /* Maintainer: Barry Song <baohua.song@csr.com> */ 44 /* Maintainer: Barry Song <baohua.song@csr.com> */
56 .nr_irqs = 128, 45 .nr_irqs = 128,
57 .map_io = sirfsoc_map_io, 46 .map_io = sirfsoc_map_io,
58 .init_irq = irqchip_init,
59 .init_time = sirfsoc_init_time, 47 .init_time = sirfsoc_init_time,
60 .init_machine = sirfsoc_mach_init,
61 .init_late = sirfsoc_init_late, 48 .init_late = sirfsoc_init_late,
62 .dt_compat = atlas6_dt_match, 49 .dt_compat = atlas6_dt_match,
63 .restart = sirfsoc_restart, 50 .restart = sirfsoc_restart,
@@ -66,18 +53,16 @@ MACHINE_END
66 53
67#ifdef CONFIG_ARCH_PRIMA2 54#ifdef CONFIG_ARCH_PRIMA2
68static const char *prima2_dt_match[] __initdata = { 55static const char *prima2_dt_match[] __initdata = {
69 "sirf,prima2", 56 "sirf,prima2",
70 NULL 57 NULL
71}; 58};
72 59
73DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)") 60DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
74 /* Maintainer: Barry Song <baohua.song@csr.com> */ 61 /* Maintainer: Barry Song <baohua.song@csr.com> */
75 .nr_irqs = 128, 62 .nr_irqs = 128,
76 .map_io = sirfsoc_map_io, 63 .map_io = sirfsoc_map_io,
77 .init_irq = irqchip_init,
78 .init_time = sirfsoc_init_time, 64 .init_time = sirfsoc_init_time,
79 .dma_zone_size = SZ_256M, 65 .dma_zone_size = SZ_256M,
80 .init_machine = sirfsoc_mach_init,
81 .init_late = sirfsoc_init_late, 66 .init_late = sirfsoc_init_late,
82 .dt_compat = prima2_dt_match, 67 .dt_compat = prima2_dt_match,
83 .restart = sirfsoc_restart, 68 .restart = sirfsoc_restart,
@@ -94,9 +79,7 @@ DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
94 /* Maintainer: Barry Song <baohua.song@csr.com> */ 79 /* Maintainer: Barry Song <baohua.song@csr.com> */
95 .smp = smp_ops(sirfsoc_smp_ops), 80 .smp = smp_ops(sirfsoc_smp_ops),
96 .map_io = sirfsoc_map_io, 81 .map_io = sirfsoc_map_io,
97 .init_irq = irqchip_init,
98 .init_time = sirfsoc_init_time, 82 .init_time = sirfsoc_init_time,
99 .init_machine = sirfsoc_mach_init,
100 .init_late = sirfsoc_init_late, 83 .init_late = sirfsoc_init_late,
101 .dt_compat = marco_dt_match, 84 .dt_compat = marco_dt_match,
102 .restart = sirfsoc_restart, 85 .restart = sirfsoc_restart,
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
index 9936c180bf01..02cc34388b05 100644
--- a/arch/arm/mach-prima2/pm.c
+++ b/arch/arm/mach-prima2/pm.c
@@ -9,7 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/suspend.h> 10#include <linux/suspend.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/module.h> 12#include <linux/export.h>
13#include <linux/of.h> 13#include <linux/of.h>
14#include <linux/of_address.h> 14#include <linux/of_address.h>
15#include <linux/of_device.h> 15#include <linux/of_device.h>
@@ -101,8 +101,10 @@ static int __init sirfsoc_of_pwrc_init(void)
101 struct device_node *np; 101 struct device_node *np;
102 102
103 np = of_find_matching_node(NULL, pwrc_ids); 103 np = of_find_matching_node(NULL, pwrc_ids);
104 if (!np) 104 if (!np) {
105 panic("unable to find compatible pwrc node in dtb\n"); 105 pr_err("unable to find compatible sirf pwrc node in dtb\n");
106 return -ENOENT;
107 }
106 108
107 /* 109 /*
108 * pwrc behind rtciobrg is not located in memory space 110 * pwrc behind rtciobrg is not located in memory space
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index 435019ca0a48..d5e0cbc934c0 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -28,8 +28,10 @@ static int __init sirfsoc_of_rstc_init(void)
28 struct device_node *np; 28 struct device_node *np;
29 29
30 np = of_find_matching_node(NULL, rstc_ids); 30 np = of_find_matching_node(NULL, rstc_ids);
31 if (!np) 31 if (!np) {
32 panic("unable to find compatible rstc node in dtb\n"); 32 pr_err("unable to find compatible sirf rstc node in dtb\n");
33 return -ENOENT;
34 }
33 35
34 sirfsoc_rstc_base = of_iomap(np, 0); 36 sirfsoc_rstc_base = of_iomap(np, 0);
35 if (!sirfsoc_rstc_base) 37 if (!sirfsoc_rstc_base)
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 96100dbf5a2e..a8427115ee07 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -615,12 +615,14 @@ endmenu
615config PXA25x 615config PXA25x
616 bool 616 bool
617 select CPU_XSCALE 617 select CPU_XSCALE
618 select CPU_FREQ_TABLE if CPU_FREQ
618 help 619 help
619 Select code specific to PXA21x/25x/26x variants 620 Select code specific to PXA21x/25x/26x variants
620 621
621config PXA27x 622config PXA27x
622 bool 623 bool
623 select CPU_XSCALE 624 select CPU_XSCALE
625 select CPU_FREQ_TABLE if CPU_FREQ
624 help 626 help
625 Select code specific to PXA27x variants 627 Select code specific to PXA27x variants
626 628
@@ -633,6 +635,7 @@ config CPU_PXA26x
633config PXA3xx 635config PXA3xx
634 bool 636 bool
635 select CPU_XSC3 637 select CPU_XSC3
638 select CPU_FREQ_TABLE if CPU_FREQ
636 help 639 help
637 Select code specific to PXA3xx variants 640 Select code specific to PXA3xx variants
638 641
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 446563a7d1ad..f6726bb4eb95 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -833,21 +833,25 @@ static inline void em_x270_init_ac97(void) {}
833#endif 833#endif
834 834
835#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 835#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
836static unsigned int em_x270_module_matrix_keys[] = { 836static const unsigned int em_x270_module_matrix_keys[] = {
837 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B), 837 KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
838 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT), 838 KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
839 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D), 839 KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
840}; 840};
841 841
842static struct matrix_keymap_data em_x270_matrix_keymap_data = {
843 .keymap = em_x270_module_matrix_keys,
844 .keymap_size = ARRAY_SIZE(em_x270_module_matrix_keys),
845};
846
842struct pxa27x_keypad_platform_data em_x270_module_keypad_info = { 847struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
843 /* code map for the matrix keys */ 848 /* code map for the matrix keys */
844 .matrix_key_rows = 3, 849 .matrix_key_rows = 3,
845 .matrix_key_cols = 3, 850 .matrix_key_cols = 3,
846 .matrix_key_map = em_x270_module_matrix_keys, 851 .matrix_keymap_data = &em_x270_matrix_keymap_data,
847 .matrix_key_map_size = ARRAY_SIZE(em_x270_module_matrix_keys),
848}; 852};
849 853
850static unsigned int em_x270_exeda_matrix_keys[] = { 854static const unsigned int em_x270_exeda_matrix_keys[] = {
851 KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL), 855 KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
852 KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE), 856 KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
853 KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL), 857 KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
@@ -889,12 +893,16 @@ static unsigned int em_x270_exeda_matrix_keys[] = {
889 KEY(7, 6, 0), KEY(7, 7, 0), 893 KEY(7, 6, 0), KEY(7, 7, 0),
890}; 894};
891 895
896static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = {
897 .keymap = em_x270_exeda_matrix_keys,
898 .keymap_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
899};
900
892struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = { 901struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
893 /* code map for the matrix keys */ 902 /* code map for the matrix keys */
894 .matrix_key_rows = 8, 903 .matrix_key_rows = 8,
895 .matrix_key_cols = 8, 904 .matrix_key_cols = 8,
896 .matrix_key_map = em_x270_exeda_matrix_keys, 905 .matrix_keymap_data = &em_x270_exeda_matrix_keymap_data,
897 .matrix_key_map_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
898}; 906};
899 907
900static void __init em_x270_init_keypad(void) 908static void __init em_x270_init_keypad(void)
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index dca10709be8f..fe2eb8394dff 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -392,7 +392,7 @@ static unsigned long e6_pin_config[] __initdata = {
392 392
393/* KEYPAD */ 393/* KEYPAD */
394#ifdef CONFIG_MACH_EZX_A780 394#ifdef CONFIG_MACH_EZX_A780
395static unsigned int a780_key_map[] = { 395static const unsigned int a780_key_map[] = {
396 KEY(0, 0, KEY_SEND), 396 KEY(0, 0, KEY_SEND),
397 KEY(0, 1, KEY_BACK), 397 KEY(0, 1, KEY_BACK),
398 KEY(0, 2, KEY_END), 398 KEY(0, 2, KEY_END),
@@ -424,11 +424,15 @@ static unsigned int a780_key_map[] = {
424 KEY(4, 4, KEY_DOWN), 424 KEY(4, 4, KEY_DOWN),
425}; 425};
426 426
427static struct matrix_keymap_data a780_matrix_keymap_data = {
428 .keymap = a780_key_map,
429 .keymap_size = ARRAY_SIZE(a780_key_map),
430};
431
427static struct pxa27x_keypad_platform_data a780_keypad_platform_data = { 432static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
428 .matrix_key_rows = 5, 433 .matrix_key_rows = 5,
429 .matrix_key_cols = 5, 434 .matrix_key_cols = 5,
430 .matrix_key_map = a780_key_map, 435 .matrix_keymap_data = &a780_matrix_keymap_data,
431 .matrix_key_map_size = ARRAY_SIZE(a780_key_map),
432 436
433 .direct_key_map = { KEY_CAMERA }, 437 .direct_key_map = { KEY_CAMERA },
434 .direct_key_num = 1, 438 .direct_key_num = 1,
@@ -438,7 +442,7 @@ static struct pxa27x_keypad_platform_data a780_keypad_platform_data = {
438#endif /* CONFIG_MACH_EZX_A780 */ 442#endif /* CONFIG_MACH_EZX_A780 */
439 443
440#ifdef CONFIG_MACH_EZX_E680 444#ifdef CONFIG_MACH_EZX_E680
441static unsigned int e680_key_map[] = { 445static const unsigned int e680_key_map[] = {
442 KEY(0, 0, KEY_UP), 446 KEY(0, 0, KEY_UP),
443 KEY(0, 1, KEY_RIGHT), 447 KEY(0, 1, KEY_RIGHT),
444 KEY(0, 2, KEY_RESERVED), 448 KEY(0, 2, KEY_RESERVED),
@@ -455,11 +459,15 @@ static unsigned int e680_key_map[] = {
455 KEY(2, 3, KEY_KPENTER), 459 KEY(2, 3, KEY_KPENTER),
456}; 460};
457 461
462static struct matrix_keymap_data e680_matrix_keymap_data = {
463 .keymap = e680_key_map,
464 .keymap_size = ARRAY_SIZE(e680_key_map),
465};
466
458static struct pxa27x_keypad_platform_data e680_keypad_platform_data = { 467static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
459 .matrix_key_rows = 3, 468 .matrix_key_rows = 3,
460 .matrix_key_cols = 4, 469 .matrix_key_cols = 4,
461 .matrix_key_map = e680_key_map, 470 .matrix_keymap_data = &e680_matrix_keymap_data,
462 .matrix_key_map_size = ARRAY_SIZE(e680_key_map),
463 471
464 .direct_key_map = { 472 .direct_key_map = {
465 KEY_CAMERA, 473 KEY_CAMERA,
@@ -476,7 +484,7 @@ static struct pxa27x_keypad_platform_data e680_keypad_platform_data = {
476#endif /* CONFIG_MACH_EZX_E680 */ 484#endif /* CONFIG_MACH_EZX_E680 */
477 485
478#ifdef CONFIG_MACH_EZX_A1200 486#ifdef CONFIG_MACH_EZX_A1200
479static unsigned int a1200_key_map[] = { 487static const unsigned int a1200_key_map[] = {
480 KEY(0, 0, KEY_RESERVED), 488 KEY(0, 0, KEY_RESERVED),
481 KEY(0, 1, KEY_RIGHT), 489 KEY(0, 1, KEY_RIGHT),
482 KEY(0, 2, KEY_PAGEDOWN), 490 KEY(0, 2, KEY_PAGEDOWN),
@@ -513,18 +521,22 @@ static unsigned int a1200_key_map[] = {
513 KEY(4, 5, KEY_RESERVED), 521 KEY(4, 5, KEY_RESERVED),
514}; 522};
515 523
524static struct matrix_keymap_data a1200_matrix_keymap_data = {
525 .keymap = a1200_key_map,
526 .keymap_size = ARRAY_SIZE(a1200_key_map),
527};
528
516static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = { 529static struct pxa27x_keypad_platform_data a1200_keypad_platform_data = {
517 .matrix_key_rows = 5, 530 .matrix_key_rows = 5,
518 .matrix_key_cols = 6, 531 .matrix_key_cols = 6,
519 .matrix_key_map = a1200_key_map, 532 .matrix_keymap_data = &a1200_matrix_keymap_data,
520 .matrix_key_map_size = ARRAY_SIZE(a1200_key_map),
521 533
522 .debounce_interval = 30, 534 .debounce_interval = 30,
523}; 535};
524#endif /* CONFIG_MACH_EZX_A1200 */ 536#endif /* CONFIG_MACH_EZX_A1200 */
525 537
526#ifdef CONFIG_MACH_EZX_E6 538#ifdef CONFIG_MACH_EZX_E6
527static unsigned int e6_key_map[] = { 539static const unsigned int e6_key_map[] = {
528 KEY(0, 0, KEY_RESERVED), 540 KEY(0, 0, KEY_RESERVED),
529 KEY(0, 1, KEY_RIGHT), 541 KEY(0, 1, KEY_RIGHT),
530 KEY(0, 2, KEY_PAGEDOWN), 542 KEY(0, 2, KEY_PAGEDOWN),
@@ -561,18 +573,22 @@ static unsigned int e6_key_map[] = {
561 KEY(4, 5, KEY_PREVIOUSSONG), 573 KEY(4, 5, KEY_PREVIOUSSONG),
562}; 574};
563 575
576static struct matrix_keymap_data e6_keymap_data = {
577 .keymap = e6_key_map,
578 .keymap_size = ARRAY_SIZE(e6_key_map),
579};
580
564static struct pxa27x_keypad_platform_data e6_keypad_platform_data = { 581static struct pxa27x_keypad_platform_data e6_keypad_platform_data = {
565 .matrix_key_rows = 5, 582 .matrix_key_rows = 5,
566 .matrix_key_cols = 6, 583 .matrix_key_cols = 6,
567 .matrix_key_map = e6_key_map, 584 .matrix_keymap_data = &e6_keymap_data,
568 .matrix_key_map_size = ARRAY_SIZE(e6_key_map),
569 585
570 .debounce_interval = 30, 586 .debounce_interval = 30,
571}; 587};
572#endif /* CONFIG_MACH_EZX_E6 */ 588#endif /* CONFIG_MACH_EZX_E6 */
573 589
574#ifdef CONFIG_MACH_EZX_A910 590#ifdef CONFIG_MACH_EZX_A910
575static unsigned int a910_key_map[] = { 591static const unsigned int a910_key_map[] = {
576 KEY(0, 0, KEY_NUMERIC_6), 592 KEY(0, 0, KEY_NUMERIC_6),
577 KEY(0, 1, KEY_RIGHT), 593 KEY(0, 1, KEY_RIGHT),
578 KEY(0, 2, KEY_PAGEDOWN), 594 KEY(0, 2, KEY_PAGEDOWN),
@@ -609,18 +625,22 @@ static unsigned int a910_key_map[] = {
609 KEY(4, 5, KEY_RESERVED), 625 KEY(4, 5, KEY_RESERVED),
610}; 626};
611 627
628static struct matrix_keymap_data a910_matrix_keymap_data = {
629 .keymap = a910_key_map,
630 .keymap_size = ARRAY_SIZE(a910_key_map),
631};
632
612static struct pxa27x_keypad_platform_data a910_keypad_platform_data = { 633static struct pxa27x_keypad_platform_data a910_keypad_platform_data = {
613 .matrix_key_rows = 5, 634 .matrix_key_rows = 5,
614 .matrix_key_cols = 6, 635 .matrix_key_cols = 6,
615 .matrix_key_map = a910_key_map, 636 .matrix_keymap_data = &a910_matrix_keymap_data,
616 .matrix_key_map_size = ARRAY_SIZE(a910_key_map),
617 637
618 .debounce_interval = 30, 638 .debounce_interval = 30,
619}; 639};
620#endif /* CONFIG_MACH_EZX_A910 */ 640#endif /* CONFIG_MACH_EZX_A910 */
621 641
622#ifdef CONFIG_MACH_EZX_E2 642#ifdef CONFIG_MACH_EZX_E2
623static unsigned int e2_key_map[] = { 643static const unsigned int e2_key_map[] = {
624 KEY(0, 0, KEY_NUMERIC_6), 644 KEY(0, 0, KEY_NUMERIC_6),
625 KEY(0, 1, KEY_RIGHT), 645 KEY(0, 1, KEY_RIGHT),
626 KEY(0, 2, KEY_NUMERIC_9), 646 KEY(0, 2, KEY_NUMERIC_9),
@@ -657,11 +677,15 @@ static unsigned int e2_key_map[] = {
657 KEY(4, 5, KEY_RESERVED), 677 KEY(4, 5, KEY_RESERVED),
658}; 678};
659 679
680static struct matrix_keymap_data e2_matrix_keymap_data = {
681 .keymap = e2_key_map,
682 .keymap_size = ARRAY_SIZE(e2_key_map),
683};
684
660static struct pxa27x_keypad_platform_data e2_keypad_platform_data = { 685static struct pxa27x_keypad_platform_data e2_keypad_platform_data = {
661 .matrix_key_rows = 5, 686 .matrix_key_rows = 5,
662 .matrix_key_cols = 6, 687 .matrix_key_cols = 6,
663 .matrix_key_map = e2_key_map, 688 .matrix_keymap_data = &e2_matrix_keymap_data,
664 .matrix_key_map_size = ARRAY_SIZE(e2_key_map),
665 689
666 .debounce_interval = 30, 690 .debounce_interval = 30,
667}; 691};
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
index e848c4607baf..5d665588c7eb 100644
--- a/arch/arm/mach-pxa/littleton.c
+++ b/arch/arm/mach-pxa/littleton.c
@@ -222,7 +222,7 @@ static inline void littleton_init_spi(void) {}
222#endif 222#endif
223 223
224#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 224#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
225static unsigned int littleton_matrix_key_map[] = { 225static const unsigned int littleton_matrix_key_map[] = {
226 /* KEY(row, col, key_code) */ 226 /* KEY(row, col, key_code) */
227 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3), 227 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
228 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7), 228 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
@@ -249,11 +249,15 @@ static unsigned int littleton_matrix_key_map[] = {
249 KEY(3, 1, KEY_F23), /* soft2 */ 249 KEY(3, 1, KEY_F23), /* soft2 */
250}; 250};
251 251
252static struct matrix_keymap_data littleton_matrix_keymap_data = {
253 .keymap = littleton_matrix_key_map,
254 .keymap_size = ARRAY_SIZE(littleton_matrix_key_map),
255};
256
252static struct pxa27x_keypad_platform_data littleton_keypad_info = { 257static struct pxa27x_keypad_platform_data littleton_keypad_info = {
253 .matrix_key_rows = 6, 258 .matrix_key_rows = 6,
254 .matrix_key_cols = 5, 259 .matrix_key_cols = 5,
255 .matrix_key_map = littleton_matrix_key_map, 260 .matrix_keymap_data = &littleton_matrix_keymap_data,
256 .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map),
257 261
258 .enable_rotary0 = 1, 262 .enable_rotary0 = 1,
259 .rotary0_up_key = KEY_UP, 263 .rotary0_up_key = KEY_UP,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7a12c1ba90ff..d2c652318376 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -498,7 +498,7 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = {
498}; 498};
499 499
500#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 500#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
501static unsigned int mainstone_matrix_keys[] = { 501static const unsigned int mainstone_matrix_keys[] = {
502 KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), 502 KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C),
503 KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), 503 KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F),
504 KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I), 504 KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I),
@@ -527,11 +527,15 @@ static unsigned int mainstone_matrix_keys[] = {
527 KEY(4, 6, KEY_SELECT), 527 KEY(4, 6, KEY_SELECT),
528}; 528};
529 529
530static struct matrix_keymap_data mainstone_matrix_keymap_data = {
531 .keymap = mainstone_matrix_keys,
532 .keymap_size = ARRAY_SIZE(mainstone_matrix_keys),
533};
534
530struct pxa27x_keypad_platform_data mainstone_keypad_info = { 535struct pxa27x_keypad_platform_data mainstone_keypad_info = {
531 .matrix_key_rows = 6, 536 .matrix_key_rows = 6,
532 .matrix_key_cols = 7, 537 .matrix_key_cols = 7,
533 .matrix_key_map = mainstone_matrix_keys, 538 .matrix_keymap_data = &mainstone_matrix_keymap_data,
534 .matrix_key_map_size = ARRAY_SIZE(mainstone_matrix_keys),
535 539
536 .enable_rotary0 = 1, 540 .enable_rotary0 = 1,
537 .rotary0_up_key = KEY_UP, 541 .rotary0_up_key = KEY_UP,
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index f8979b943cbf..654b0ac84dea 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -222,7 +222,7 @@ static struct pxafb_mach_info mioa701_pxafb_info = {
222/* 222/*
223 * Keyboard configuration 223 * Keyboard configuration
224 */ 224 */
225static unsigned int mioa701_matrix_keys[] = { 225static const unsigned int mioa701_matrix_keys[] = {
226 KEY(0, 0, KEY_UP), 226 KEY(0, 0, KEY_UP),
227 KEY(0, 1, KEY_RIGHT), 227 KEY(0, 1, KEY_RIGHT),
228 KEY(0, 2, KEY_MEDIA), 228 KEY(0, 2, KEY_MEDIA),
@@ -233,11 +233,16 @@ static unsigned int mioa701_matrix_keys[] = {
233 KEY(2, 1, KEY_PHONE), /* Phone Green key */ 233 KEY(2, 1, KEY_PHONE), /* Phone Green key */
234 KEY(2, 2, KEY_CAMERA) /* Camera key */ 234 KEY(2, 2, KEY_CAMERA) /* Camera key */
235}; 235};
236
237static struct matrix_keymap_data mioa701_matrix_keymap_data = {
238 .keymap = mioa701_matrix_keys,
239 .keymap_size = ARRAY_SIZE(mioa701_matrix_keys),
240};
241
236static struct pxa27x_keypad_platform_data mioa701_keypad_info = { 242static struct pxa27x_keypad_platform_data mioa701_keypad_info = {
237 .matrix_key_rows = 3, 243 .matrix_key_rows = 3,
238 .matrix_key_cols = 3, 244 .matrix_key_cols = 3,
239 .matrix_key_map = mioa701_matrix_keys, 245 .matrix_keymap_data = &mioa701_matrix_keymap_data,
240 .matrix_key_map_size = ARRAY_SIZE(mioa701_matrix_keys),
241}; 246};
242 247
243/* 248/*
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 909b713e5789..cf210b11ffcc 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -173,7 +173,7 @@ static inline void palmld_nor_init(void) {}
173 * GPIO keyboard 173 * GPIO keyboard
174 ******************************************************************************/ 174 ******************************************************************************/
175#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 175#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
176static unsigned int palmld_matrix_keys[] = { 176static const unsigned int palmld_matrix_keys[] = {
177 KEY(0, 1, KEY_F2), 177 KEY(0, 1, KEY_F2),
178 KEY(0, 2, KEY_UP), 178 KEY(0, 2, KEY_UP),
179 179
@@ -190,11 +190,15 @@ static unsigned int palmld_matrix_keys[] = {
190 KEY(3, 2, KEY_LEFT), 190 KEY(3, 2, KEY_LEFT),
191}; 191};
192 192
193static struct matrix_keymap_data palmld_matrix_keymap_data = {
194 .keymap = palmld_matrix_keys,
195 .keymap_size = ARRAY_SIZE(palmld_matrix_keys),
196};
197
193static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = { 198static struct pxa27x_keypad_platform_data palmld_keypad_platform_data = {
194 .matrix_key_rows = 4, 199 .matrix_key_rows = 4,
195 .matrix_key_cols = 3, 200 .matrix_key_cols = 3,
196 .matrix_key_map = palmld_matrix_keys, 201 .matrix_keymap_data = &palmld_matrix_keymap_data,
197 .matrix_key_map_size = ARRAY_SIZE(palmld_matrix_keys),
198 202
199 .debounce_interval = 30, 203 .debounce_interval = 30,
200}; 204};
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 5033fd07968f..3ed9b029428b 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -108,7 +108,7 @@ static unsigned long palmt5_pin_config[] __initdata = {
108 * GPIO keyboard 108 * GPIO keyboard
109 ******************************************************************************/ 109 ******************************************************************************/
110#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 110#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
111static unsigned int palmt5_matrix_keys[] = { 111static const unsigned int palmt5_matrix_keys[] = {
112 KEY(0, 0, KEY_POWER), 112 KEY(0, 0, KEY_POWER),
113 KEY(0, 1, KEY_F1), 113 KEY(0, 1, KEY_F1),
114 KEY(0, 2, KEY_ENTER), 114 KEY(0, 2, KEY_ENTER),
@@ -124,11 +124,15 @@ static unsigned int palmt5_matrix_keys[] = {
124 KEY(3, 2, KEY_LEFT), 124 KEY(3, 2, KEY_LEFT),
125}; 125};
126 126
127static struct matrix_keymap_data palmt5_matrix_keymap_data = {
128 .keymap = palmt5_matrix_keys,
129 .keymap_size = ARRAY_SIZE(palmt5_matrix_keys),
130};
131
127static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = { 132static struct pxa27x_keypad_platform_data palmt5_keypad_platform_data = {
128 .matrix_key_rows = 4, 133 .matrix_key_rows = 4,
129 .matrix_key_cols = 3, 134 .matrix_key_cols = 3,
130 .matrix_key_map = palmt5_matrix_keys, 135 .matrix_keymap_data = &palmt5_matrix_keymap_data,
131 .matrix_key_map_size = ARRAY_SIZE(palmt5_matrix_keys),
132 136
133 .debounce_interval = 30, 137 .debounce_interval = 30,
134}; 138};
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index d82a50b4a803..d8b937c870de 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -168,7 +168,7 @@ static unsigned long centro685_pin_config[] __initdata = {
168 * GPIO keyboard 168 * GPIO keyboard
169 ******************************************************************************/ 169 ******************************************************************************/
170#if IS_ENABLED(CONFIG_KEYBOARD_PXA27x) 170#if IS_ENABLED(CONFIG_KEYBOARD_PXA27x)
171static unsigned int treo680_matrix_keys[] = { 171static const unsigned int treo680_matrix_keys[] = {
172 KEY(0, 0, KEY_F8), /* Red/Off/Power */ 172 KEY(0, 0, KEY_F8), /* Red/Off/Power */
173 KEY(0, 1, KEY_LEFT), 173 KEY(0, 1, KEY_LEFT),
174 KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ 174 KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
@@ -227,7 +227,7 @@ static unsigned int treo680_matrix_keys[] = {
227 KEY(7, 5, KEY_I), 227 KEY(7, 5, KEY_I),
228}; 228};
229 229
230static unsigned int centro_matrix_keys[] = { 230static const unsigned int centro_matrix_keys[] = {
231 KEY(0, 0, KEY_F9), /* Home */ 231 KEY(0, 0, KEY_F9), /* Home */
232 KEY(0, 1, KEY_LEFT), 232 KEY(0, 1, KEY_LEFT),
233 KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ 233 KEY(0, 2, KEY_LEFTCTRL), /* Alternate */
@@ -286,11 +286,20 @@ static unsigned int centro_matrix_keys[] = {
286 KEY(7, 5, KEY_I), 286 KEY(7, 5, KEY_I),
287}; 287};
288 288
289static struct matrix_keymap_data treo680_matrix_keymap_data = {
290 .keymap = treo680_matrix_keys,
291 .keymap_size = ARRAY_SIZE(treo680_matrix_keys),
292};
293
294static struct matrix_keymap_data centro_matrix_keymap_data = {
295 .keymap = centro_matrix_keys,
296 .keymap_size = ARRAY_SIZE(centro_matrix_keys),
297};
298
289static struct pxa27x_keypad_platform_data treo680_keypad_pdata = { 299static struct pxa27x_keypad_platform_data treo680_keypad_pdata = {
290 .matrix_key_rows = 8, 300 .matrix_key_rows = 8,
291 .matrix_key_cols = 7, 301 .matrix_key_cols = 7,
292 .matrix_key_map = treo680_matrix_keys, 302 .matrix_keymap_data = &treo680_matrix_keymap_data,
293 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
294 .direct_key_map = { KEY_CONNECT }, 303 .direct_key_map = { KEY_CONNECT },
295 .direct_key_num = 1, 304 .direct_key_num = 1,
296 305
@@ -301,10 +310,8 @@ static void __init palmtreo_kpc_init(void)
301{ 310{
302 static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata; 311 static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata;
303 312
304 if (machine_is_centro()) { 313 if (machine_is_centro())
305 data->matrix_key_map = centro_matrix_keys; 314 data->matrix_keymap_data = &centro_matrix_keymap_data;
306 data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys);
307 }
308 315
309 pxa_set_keypad_info(&treo680_keypad_pdata); 316 pxa_set_keypad_info(&treo680_keypad_pdata);
310} 317}
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 627c93a7364c..83f830dd8ad8 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -176,7 +176,7 @@ static inline void palmtx_nor_init(void) {}
176 * GPIO keyboard 176 * GPIO keyboard
177 ******************************************************************************/ 177 ******************************************************************************/
178#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 178#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
179static unsigned int palmtx_matrix_keys[] = { 179static const unsigned int palmtx_matrix_keys[] = {
180 KEY(0, 0, KEY_POWER), 180 KEY(0, 0, KEY_POWER),
181 KEY(0, 1, KEY_F1), 181 KEY(0, 1, KEY_F1),
182 KEY(0, 2, KEY_ENTER), 182 KEY(0, 2, KEY_ENTER),
@@ -192,11 +192,15 @@ static unsigned int palmtx_matrix_keys[] = {
192 KEY(3, 2, KEY_LEFT), 192 KEY(3, 2, KEY_LEFT),
193}; 193};
194 194
195static struct matrix_keymap_data palmtx_matrix_keymap_data = {
196 .keymap = palmtx_matrix_keys,
197 .keymap_size = ARRAY_SIZE(palmtx_matrix_keys),
198};
199
195static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = { 200static struct pxa27x_keypad_platform_data palmtx_keypad_platform_data = {
196 .matrix_key_rows = 4, 201 .matrix_key_rows = 4,
197 .matrix_key_cols = 3, 202 .matrix_key_cols = 3,
198 .matrix_key_map = palmtx_matrix_keys, 203 .matrix_keymap_data = &palmtx_matrix_keymap_data,
199 .matrix_key_map_size = ARRAY_SIZE(palmtx_matrix_keys),
200 204
201 .debounce_interval = 30, 205 .debounce_interval = 30,
202}; 206};
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 18b7fcd98592..1a35ddf218da 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -140,7 +140,7 @@ static unsigned long palmz72_pin_config[] __initdata = {
140 * GPIO keyboard 140 * GPIO keyboard
141 ******************************************************************************/ 141 ******************************************************************************/
142#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 142#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
143static unsigned int palmz72_matrix_keys[] = { 143static const unsigned int palmz72_matrix_keys[] = {
144 KEY(0, 0, KEY_POWER), 144 KEY(0, 0, KEY_POWER),
145 KEY(0, 1, KEY_F1), 145 KEY(0, 1, KEY_F1),
146 KEY(0, 2, KEY_ENTER), 146 KEY(0, 2, KEY_ENTER),
@@ -156,11 +156,15 @@ static unsigned int palmz72_matrix_keys[] = {
156 KEY(3, 2, KEY_LEFT), 156 KEY(3, 2, KEY_LEFT),
157}; 157};
158 158
159static struct matrix_keymap_data almz72_matrix_keymap_data = {
160 .keymap = palmz72_matrix_keys,
161 .keymap_size = ARRAY_SIZE(palmz72_matrix_keys),
162};
163
159static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = { 164static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = {
160 .matrix_key_rows = 4, 165 .matrix_key_rows = 4,
161 .matrix_key_cols = 3, 166 .matrix_key_cols = 3,
162 .matrix_key_map = palmz72_matrix_keys, 167 .matrix_keymap_data = &almz72_matrix_keymap_data,
163 .matrix_key_map_size = ARRAY_SIZE(palmz72_matrix_keys),
164 168
165 .debounce_interval = 30, 169 .debounce_interval = 30,
166}; 170};
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index f55979c09a5f..4680efe55345 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -106,7 +106,7 @@ static struct platform_device smc91x_device = {
106}; 106};
107 107
108#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 108#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
109static unsigned int tavorevb_matrix_key_map[] = { 109static const unsigned int tavorevb_matrix_key_map[] = {
110 /* KEY(row, col, key_code) */ 110 /* KEY(row, col, key_code) */
111 KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C), 111 KEY(0, 4, KEY_A), KEY(0, 5, KEY_B), KEY(0, 6, KEY_C),
112 KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G), 112 KEY(1, 4, KEY_E), KEY(1, 5, KEY_F), KEY(1, 6, KEY_G),
@@ -147,11 +147,15 @@ static unsigned int tavorevb_matrix_key_map[] = {
147 KEY(3, 3, KEY_F23), /* soft2 */ 147 KEY(3, 3, KEY_F23), /* soft2 */
148}; 148};
149 149
150static struct matrix_keymap_data tavorevb_matrix_keymap_data = {
151 .keymap = tavorevb_matrix_key_map,
152 .keymap_size = ARRAY_SIZE(tavorevb_matrix_key_map),
153};
154
150static struct pxa27x_keypad_platform_data tavorevb_keypad_info = { 155static struct pxa27x_keypad_platform_data tavorevb_keypad_info = {
151 .matrix_key_rows = 7, 156 .matrix_key_rows = 7,
152 .matrix_key_cols = 7, 157 .matrix_key_cols = 7,
153 .matrix_key_map = tavorevb_matrix_key_map, 158 .matrix_keymap_data = &tavorevb_matrix_keymap_data,
154 .matrix_key_map_size = ARRAY_SIZE(tavorevb_matrix_key_map),
155 .debounce_interval = 30, 159 .debounce_interval = 30,
156}; 160};
157 161
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index 989903a7e467..2513d8f4931f 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -345,7 +345,7 @@ static inline void z2_leds_init(void) {}
345 * GPIO keyboard 345 * GPIO keyboard
346 ******************************************************************************/ 346 ******************************************************************************/
347#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 347#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
348static unsigned int z2_matrix_keys[] = { 348static const unsigned int z2_matrix_keys[] = {
349 KEY(0, 0, KEY_OPTION), 349 KEY(0, 0, KEY_OPTION),
350 KEY(1, 0, KEY_UP), 350 KEY(1, 0, KEY_UP),
351 KEY(2, 0, KEY_DOWN), 351 KEY(2, 0, KEY_DOWN),
@@ -405,11 +405,15 @@ static unsigned int z2_matrix_keys[] = {
405 KEY(5, 7, KEY_DOT), 405 KEY(5, 7, KEY_DOT),
406}; 406};
407 407
408static struct matrix_keymap_data z2_matrix_keymap_data = {
409 .keymap = z2_matrix_keys,
410 .keymap_size = ARRAY_SIZE(z2_matrix_keys),
411};
412
408static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { 413static struct pxa27x_keypad_platform_data z2_keypad_platform_data = {
409 .matrix_key_rows = 7, 414 .matrix_key_rows = 7,
410 .matrix_key_cols = 8, 415 .matrix_key_cols = 8,
411 .matrix_key_map = z2_matrix_keys, 416 .matrix_keymap_data = &z2_matrix_keymap_data,
412 .matrix_key_map_size = ARRAY_SIZE(z2_matrix_keys),
413 417
414 .debounce_interval = 30, 418 .debounce_interval = 30,
415}; 419};
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
index 1f00d650ac27..36cf7cf95ec1 100644
--- a/arch/arm/mach-pxa/zylonite.c
+++ b/arch/arm/mach-pxa/zylonite.c
@@ -263,7 +263,7 @@ static inline void zylonite_init_mmc(void) {}
263#endif 263#endif
264 264
265#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 265#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
266static unsigned int zylonite_matrix_key_map[] = { 266static const unsigned int zylonite_matrix_key_map[] = {
267 /* KEY(row, col, key_code) */ 267 /* KEY(row, col, key_code) */
268 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), 268 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
269 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H), 269 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
@@ -306,11 +306,15 @@ static unsigned int zylonite_matrix_key_map[] = {
306 KEY(0, 3, KEY_AUX), /* contact */ 306 KEY(0, 3, KEY_AUX), /* contact */
307}; 307};
308 308
309static struct matrix_keymap_data zylonite_matrix_keymap_data = {
310 .keymap = zylonite_matrix_key_map,
311 .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
312};
313
309static struct pxa27x_keypad_platform_data zylonite_keypad_info = { 314static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
310 .matrix_key_rows = 8, 315 .matrix_key_rows = 8,
311 .matrix_key_cols = 8, 316 .matrix_key_cols = 8,
312 .matrix_key_map = zylonite_matrix_key_map, 317 .matrix_keymap_data = &zylonite_matrix_keymap_data,
313 .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map),
314 318
315 .enable_rotary0 = 1, 319 .enable_rotary0 = 1,
316 .rotary0_up_key = KEY_UP, 320 .rotary0_up_key = KEY_UP,
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
new file mode 100644
index 000000000000..25ee12b21f01
--- /dev/null
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -0,0 +1,16 @@
1config ARCH_ROCKCHIP
2 bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7
3 select PINCTRL
4 select PINCTRL_ROCKCHIP
5 select ARCH_REQUIRE_GPIOLIB
6 select ARM_GIC
7 select CACHE_L2X0
8 select HAVE_ARM_TWD if LOCAL_TIMERS
9 select HAVE_SMP
10 select LOCAL_TIMERS if SMP
11 select COMMON_CLK
12 select GENERIC_CLOCKEVENTS
13 select DW_APB_TIMER_OF
14 help
15 Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs
16 containing the RK2928, RK30xx and RK31xx series.
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
new file mode 100644
index 000000000000..1547d4fc920a
--- /dev/null
+++ b/arch/arm/mach-rockchip/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
new file mode 100644
index 000000000000..724d2d81f976
--- /dev/null
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -0,0 +1,52 @@
1/*
2 * Device Tree support for Rockchip SoCs
3 *
4 * Copyright (c) 2013 MundoReader S.L.
5 * Author: Heiko Stuebner <heiko@sntech.de>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/of_platform.h>
21#include <linux/irqchip.h>
22#include <linux/dw_apb_timer.h>
23#include <linux/clk-provider.h>
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/hardware/cache-l2x0.h>
27
28static void __init rockchip_timer_init(void)
29{
30 of_clk_init(NULL);
31 clocksource_of_init();
32}
33
34static void __init rockchip_dt_init(void)
35{
36 l2x0_of_init(0, ~0UL);
37 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
38}
39
40static const char * const rockchip_board_dt_compat[] = {
41 "rockchip,rk2928",
42 "rockchip,rk3066a",
43 "rockchip,rk3066b",
44 "rockchip,rk3188",
45 NULL,
46};
47
48DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
49 .init_machine = rockchip_dt_init,
50 .init_time = rockchip_timer_init,
51 .dt_compat = rockchip_board_dt_compat,
52MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index f2f7088bfd22..6d9252e081ce 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -28,9 +28,10 @@ config CPU_S3C2410
28 select CPU_ARM920T 28 select CPU_ARM920T
29 select CPU_LLSERIAL_S3C2410 29 select CPU_LLSERIAL_S3C2410
30 select S3C2410_CLOCK 30 select S3C2410_CLOCK
31 select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX 31 select ARM_S3C2410_CPUFREQ if ARM_S3C24XX_CPUFREQ
32 select S3C2410_PM if PM 32 select S3C2410_PM if PM
33 select SAMSUNG_HRT 33 select SAMSUNG_HRT
34 select SAMSUNG_WDT_RESET
34 help 35 help
35 Support for S3C2410 and S3C2410A family from the S3C24XX line 36 Support for S3C2410 and S3C2410A family from the S3C24XX line
36 of Samsung Mobile CPUs. 37 of Samsung Mobile CPUs.
@@ -81,6 +82,7 @@ config CPU_S3C2442
81config CPU_S3C244X 82config CPU_S3C244X
82 def_bool y 83 def_bool y
83 depends on CPU_S3C2440 || CPU_S3C2442 84 depends on CPU_S3C2440 || CPU_S3C2442
85 select SAMSUNG_WDT_RESET
84 86
85config CPU_S3C2443 87config CPU_S3C2443
86 bool "SAMSUNG S3C2443" 88 bool "SAMSUNG S3C2443"
@@ -204,27 +206,38 @@ config S3C24XX_GPIO_EXTRA128
204 Add an extra 128 gpio numbers to the available GPIO pool. This is 206 Add an extra 128 gpio numbers to the available GPIO pool. This is
205 available for boards that need extra gpios for external devices. 207 available for boards that need extra gpios for external devices.
206 208
209config S3C24XX_PLL
210 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
211 depends on ARM_S3C24XX
212 help
213 Compile in support for changing the PLL frequency from the
214 S3C24XX series CPUfreq driver. The PLL takes time to settle
215 after a frequency change, so by default it is not enabled.
216
217 This also means that the PLL tables for the selected CPU(s) will
218 be built which may increase the size of the kernel image.
219
207# cpu frequency items common between s3c2410 and s3c2440/s3c2442 220# cpu frequency items common between s3c2410 and s3c2440/s3c2442
208 221
209config S3C2410_IOTIMING 222config S3C2410_IOTIMING
210 bool 223 bool
211 depends on CPU_FREQ_S3C24XX 224 depends on ARM_S3C24XX_CPUFREQ
212 help 225 help
213 Internal node to select io timing code that is common to the s3c2410 226 Internal node to select io timing code that is common to the s3c2410
214 and s3c2440/s3c2442 cpu frequency support. 227 and s3c2440/s3c2442 cpu frequency support.
215 228
216config S3C2410_CPUFREQ_UTILS 229config S3C2410_CPUFREQ_UTILS
217 bool 230 bool
218 depends on CPU_FREQ_S3C24XX 231 depends on ARM_S3C24XX_CPUFREQ
219 help 232 help
220 Internal node to select timing code that is common to the s3c2410 233 Internal node to select timing code that is common to the s3c2410
221 and s3c2440/s3c244 cpu frequency support. 234 and s3c2440/s3c244 cpu frequency support.
222 235
223# cpu frequency support common to s3c2412, s3c2413 and s3c2442 236# cpu frequency support common to s3c2412, s3c2413 and s3c2442
224 237
225config S3C2412_IOTIMING 238config S3C2412_IOTIMING
226 bool 239 bool
227 depends on CPU_FREQ_S3C24XX && (CPU_S3C2412 || CPU_S3C2443) 240 depends on ARM_S3C24XX_CPUFREQ && (CPU_S3C2412 || CPU_S3C2443)
228 help 241 help
229 Intel node to select io timing code that is common to the s3c2412 242 Intel node to select io timing code that is common to the s3c2412
230 and the s3c2443. 243 and the s3c2443.
@@ -233,16 +246,9 @@ config S3C2412_IOTIMING
233 246
234if CPU_S3C2410 247if CPU_S3C2410
235 248
236config S3C2410_CPUFREQ
237 bool
238 depends on CPU_FREQ_S3C24XX
239 select S3C2410_CPUFREQ_UTILS
240 help
241 CPU Frequency scaling support for S3C2410
242
243config S3C2410_PLL 249config S3C2410_PLL
244 bool 250 bool
245 depends on S3C2410_CPUFREQ && CPU_FREQ_S3C24XX_PLL 251 depends on ARM_S3C2410_CPUFREQ && S3C24XX_PLL
246 default y 252 default y
247 help 253 help
248 Select the PLL table for the S3C2410 254 Select the PLL table for the S3C2410
@@ -278,7 +284,7 @@ config ARCH_BAST
278 bool "Simtec Electronics BAST (EB2410ITX)" 284 bool "Simtec Electronics BAST (EB2410ITX)"
279 select ISA 285 select ISA
280 select MACH_BAST_IDE 286 select MACH_BAST_IDE
281 select S3C2410_IOTIMING if S3C2410_CPUFREQ 287 select S3C2410_IOTIMING if ARM_S3C2410_CPUFREQ
282 select S3C24XX_DCLK 288 select S3C24XX_DCLK
283 select S3C24XX_SIMTEC_NOR 289 select S3C24XX_SIMTEC_NOR
284 select S3C24XX_SIMTEC_PM if PM 290 select S3C24XX_SIMTEC_PM if PM
@@ -385,14 +391,6 @@ config CPU_S3C2412_ONLY
385 !CPU_S3C2442 && !CPU_S3C2443 391 !CPU_S3C2442 && !CPU_S3C2443
386 default y 392 default y
387 393
388config S3C2412_CPUFREQ
389 bool
390 depends on CPU_FREQ_S3C24XX
391 default y
392 select S3C2412_IOTIMING
393 help
394 CPU Frequency scaling support for S3C2412 and S3C2413 SoC CPUs.
395
396config S3C2412_DMA 394config S3C2412_DMA
397 bool 395 bool
398 help 396 help
@@ -490,18 +488,22 @@ config MACH_SMDK2416
490 help 488 help
491 Say Y here if you are using an SMDK2416 489 Say Y here if you are using an SMDK2416
492 490
491config MACH_S3C2416_DT
492 bool "Samsung S3C2416 machine using devicetree"
493 select CLKSRC_OF
494 select USE_OF
495 select PINCTRL
496 select PINCTRL_S3C24XX
497 help
498 Machine support for Samsung S3C2416 machines with device tree enabled.
499 Select this if a fdt blob is available for the S3C2416 SoC based board.
500 Note: This is under development and not all peripherals can be supported
501 with this machine file.
502
493endif # CPU_S3C2416 503endif # CPU_S3C2416
494 504
495if CPU_S3C2440 505if CPU_S3C2440
496 506
497config S3C2440_CPUFREQ
498 bool "S3C2440/S3C2442 CPU Frequency scaling support"
499 depends on CPU_FREQ_S3C24XX && (CPU_S3C2440 || CPU_S3C2442)
500 default y
501 select S3C2410_CPUFREQ_UTILS
502 help
503 CPU Frequency scaling support for S3C2440 and S3C2442 SoC CPUs.
504
505config S3C2440_DMA 507config S3C2440_DMA
506 bool 508 bool
507 help 509 help
@@ -521,15 +523,15 @@ config S3C2440_XTAL_16934400
521 523
522config S3C2440_PLL_12000000 524config S3C2440_PLL_12000000
523 bool 525 bool
524 depends on S3C2440_CPUFREQ && S3C2440_XTAL_12000000 526 depends on ARM_S3C2440_CPUFREQ && S3C2440_XTAL_12000000
525 default y if CPU_FREQ_S3C24XX_PLL 527 default y if S3C24XX_PLL
526 help 528 help
527 PLL tables for S3C2440 or S3C2442 CPUs with 12MHz crystals. 529 PLL tables for S3C2440 or S3C2442 CPUs with 12MHz crystals.
528 530
529config S3C2440_PLL_16934400 531config S3C2440_PLL_16934400
530 bool 532 bool
531 depends on S3C2440_CPUFREQ && S3C2440_XTAL_16934400 533 depends on ARM_S3C2440_CPUFREQ && S3C2440_XTAL_16934400
532 default y if CPU_FREQ_S3C24XX_PLL 534 default y if S3C24XX_PLL
533 help 535 help
534 PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals. 536 PLL tables for S3C2440 or S3C2442 CPUs with 16.934MHz crystals.
535 537
@@ -583,7 +585,7 @@ config MACH_NEXCODER_2440
583 585
584config MACH_OSIRIS 586config MACH_OSIRIS
585 bool "Simtec IM2440D20 (OSIRIS) module" 587 bool "Simtec IM2440D20 (OSIRIS) module"
586 select S3C2410_IOTIMING if S3C2440_CPUFREQ 588 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
587 select S3C2440_XTAL_12000000 589 select S3C2440_XTAL_12000000
588 select S3C24XX_DCLK 590 select S3C24XX_DCLK
589 select S3C24XX_GPIO_EXTRA128 591 select S3C24XX_GPIO_EXTRA128
@@ -655,7 +657,7 @@ config MACH_RX1950
655 bool "HP iPAQ rx1950" 657 bool "HP iPAQ rx1950"
656 select I2C 658 select I2C
657 select PM_H1940 if PM 659 select PM_H1940 if PM
658 select S3C2410_IOTIMING if S3C2440_CPUFREQ 660 select S3C2410_IOTIMING if ARM_S3C2440_CPUFREQ
659 select S3C2440_XTAL_16934400 661 select S3C2440_XTAL_16934400
660 select S3C24XX_DCLK 662 select S3C24XX_DCLK
661 select S3C24XX_PWM 663 select S3C24XX_PWM
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile
index 6f46ecfc8396..7f54e5b954ca 100644
--- a/arch/arm/mach-s3c24xx/Makefile
+++ b/arch/arm/mach-s3c24xx/Makefile
@@ -17,13 +17,11 @@ obj- :=
17obj-y += common.o 17obj-y += common.o
18 18
19obj-$(CONFIG_CPU_S3C2410) += s3c2410.o 19obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
20obj-$(CONFIG_S3C2410_CPUFREQ) += cpufreq-s3c2410.o
21obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o 20obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o
22obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o 21obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o
23obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o 22obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o
24 23
25obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o 24obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o
26obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o
27obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o 25obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o
28obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o 26obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o
29obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o 27obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep-s3c2412.o
@@ -34,7 +32,6 @@ obj-$(CONFIG_S3C2416_PM) += pm-s3c2416.o
34obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o 32obj-$(CONFIG_CPU_S3C2440) += s3c2440.o clock-s3c2440.o
35obj-$(CONFIG_CPU_S3C2442) += s3c2442.o 33obj-$(CONFIG_CPU_S3C2442) += s3c2442.o
36obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o 34obj-$(CONFIG_CPU_S3C244X) += s3c244x.o clock-s3c244x.o
37obj-$(CONFIG_S3C2440_CPUFREQ) += cpufreq-s3c2440.o
38obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o 35obj-$(CONFIG_S3C2440_DMA) += dma-s3c2440.o
39obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o 36obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
40obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o 37obj-$(CONFIG_S3C2440_PLL_16934400) += pll-s3c2440-16934400.o
@@ -59,9 +56,6 @@ obj-$(CONFIG_S3C2412_IOTIMING) += iotiming-s3c2412.o
59obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o 56obj-$(CONFIG_S3C2443_COMMON) += common-s3c2443.o
60obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o 57obj-$(CONFIG_S3C2443_DMA) += dma-s3c2443.o
61 58
62obj-$(CONFIG_CPU_FREQ_S3C24XX) += cpufreq.o
63obj-$(CONFIG_CPU_FREQ_S3C24XX_DEBUGFS) += cpufreq-debugfs.o
64
65# 59#
66# machine support 60# machine support
67# following is ordered alphabetically by option text. 61# following is ordered alphabetically by option text.
@@ -85,6 +79,7 @@ obj-$(CONFIG_MACH_SMDK2413) += mach-smdk2413.o
85obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o 79obj-$(CONFIG_MACH_VSTMS) += mach-vstms.o
86 80
87obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o 81obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
82obj-$(CONFIG_MACH_S3C2416_DT) += mach-s3c2416-dt.o
88 83
89obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o 84obj-$(CONFIG_MACH_ANUBIS) += mach-anubis.o
90obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o 85obj-$(CONFIG_MACH_AT2440EVB) += mach-at2440evb.o
diff --git a/arch/arm/mach-s3c24xx/cpufreq-debugfs.c b/arch/arm/mach-s3c24xx/cpufreq-debugfs.c
deleted file mode 100644
index 9b7b4289d66c..000000000000
--- a/arch/arm/mach-s3c24xx/cpufreq-debugfs.c
+++ /dev/null
@@ -1,198 +0,0 @@
1/*
2 * Copyright (c) 2009 Simtec Electronics
3 * http://armlinux.simtec.co.uk/
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX CPU Frequency scaling - debugfs status 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/export.h>
15#include <linux/interrupt.h>
16#include <linux/ioport.h>
17#include <linux/cpufreq.h>
18#include <linux/debugfs.h>
19#include <linux/seq_file.h>
20#include <linux/err.h>
21
22#include <plat/cpu-freq-core.h>
23
24static struct dentry *dbgfs_root;
25static struct dentry *dbgfs_file_io;
26static struct dentry *dbgfs_file_info;
27static struct dentry *dbgfs_file_board;
28
29#define print_ns(x) ((x) / 10), ((x) % 10)
30
31static void show_max(struct seq_file *seq, struct s3c_freq *f)
32{
33 seq_printf(seq, "MAX: F=%lu, H=%lu, P=%lu, A=%lu\n",
34 f->fclk, f->hclk, f->pclk, f->armclk);
35}
36
37static int board_show(struct seq_file *seq, void *p)
38{
39 struct s3c_cpufreq_config *cfg;
40 struct s3c_cpufreq_board *brd;
41
42 cfg = s3c_cpufreq_getconfig();
43 if (!cfg) {
44 seq_printf(seq, "no configuration registered\n");
45 return 0;
46 }
47
48 brd = cfg->board;
49 if (!brd) {
50 seq_printf(seq, "no board definition set?\n");
51 return 0;
52 }
53
54 seq_printf(seq, "SDRAM refresh %u ns\n", brd->refresh);
55 seq_printf(seq, "auto_io=%u\n", brd->auto_io);
56 seq_printf(seq, "need_io=%u\n", brd->need_io);
57
58 show_max(seq, &brd->max);
59
60
61 return 0;
62}
63
64static int fops_board_open(struct inode *inode, struct file *file)
65{
66 return single_open(file, board_show, NULL);
67}
68
69static const struct file_operations fops_board = {
70 .open = fops_board_open,
71 .read = seq_read,
72 .llseek = seq_lseek,
73 .release = single_release,
74 .owner = THIS_MODULE,
75};
76
77static int info_show(struct seq_file *seq, void *p)
78{
79 struct s3c_cpufreq_config *cfg;
80
81 cfg = s3c_cpufreq_getconfig();
82 if (!cfg) {
83 seq_printf(seq, "no configuration registered\n");
84 return 0;
85 }
86
87 seq_printf(seq, " FCLK %ld Hz\n", cfg->freq.fclk);
88 seq_printf(seq, " HCLK %ld Hz (%lu.%lu ns)\n",
89 cfg->freq.hclk, print_ns(cfg->freq.hclk_tns));
90 seq_printf(seq, " PCLK %ld Hz\n", cfg->freq.hclk);
91 seq_printf(seq, "ARMCLK %ld Hz\n", cfg->freq.armclk);
92 seq_printf(seq, "\n");
93
94 show_max(seq, &cfg->max);
95
96 seq_printf(seq, "Divisors: P=%d, H=%d, A=%d, dvs=%s\n",
97 cfg->divs.h_divisor, cfg->divs.p_divisor,
98 cfg->divs.arm_divisor, cfg->divs.dvs ? "on" : "off");
99 seq_printf(seq, "\n");
100
101 seq_printf(seq, "lock_pll=%u\n", cfg->lock_pll);
102
103 return 0;
104}
105
106static int fops_info_open(struct inode *inode, struct file *file)
107{
108 return single_open(file, info_show, NULL);
109}
110
111static const struct file_operations fops_info = {
112 .open = fops_info_open,
113 .read = seq_read,
114 .llseek = seq_lseek,
115 .release = single_release,
116 .owner = THIS_MODULE,
117};
118
119static int io_show(struct seq_file *seq, void *p)
120{
121 void (*show_bank)(struct seq_file *, struct s3c_cpufreq_config *, union s3c_iobank *);
122 struct s3c_cpufreq_config *cfg;
123 struct s3c_iotimings *iot;
124 union s3c_iobank *iob;
125 int bank;
126
127 cfg = s3c_cpufreq_getconfig();
128 if (!cfg) {
129 seq_printf(seq, "no configuration registered\n");
130 return 0;
131 }
132
133 show_bank = cfg->info->debug_io_show;
134 if (!show_bank) {
135 seq_printf(seq, "no code to show bank timing\n");
136 return 0;
137 }
138
139 iot = s3c_cpufreq_getiotimings();
140 if (!iot) {
141 seq_printf(seq, "no io timings registered\n");
142 return 0;
143 }
144
145 seq_printf(seq, "hclk period is %lu.%lu ns\n", print_ns(cfg->freq.hclk_tns));
146
147 for (bank = 0; bank < MAX_BANKS; bank++) {
148 iob = &iot->bank[bank];
149
150 seq_printf(seq, "bank %d: ", bank);
151
152 if (!iob->io_2410) {
153 seq_printf(seq, "nothing set\n");
154 continue;
155 }
156
157 show_bank(seq, cfg, iob);
158 }
159
160 return 0;
161}
162
163static int fops_io_open(struct inode *inode, struct file *file)
164{
165 return single_open(file, io_show, NULL);
166}
167
168static const struct file_operations fops_io = {
169 .open = fops_io_open,
170 .read = seq_read,
171 .llseek = seq_lseek,
172 .release = single_release,
173 .owner = THIS_MODULE,
174};
175
176
177static int __init s3c_freq_debugfs_init(void)
178{
179 dbgfs_root = debugfs_create_dir("s3c-cpufreq", NULL);
180 if (IS_ERR(dbgfs_root)) {
181 printk(KERN_ERR "%s: error creating debugfs root\n", __func__);
182 return PTR_ERR(dbgfs_root);
183 }
184
185 dbgfs_file_io = debugfs_create_file("io-timing", S_IRUGO, dbgfs_root,
186 NULL, &fops_io);
187
188 dbgfs_file_info = debugfs_create_file("info", S_IRUGO, dbgfs_root,
189 NULL, &fops_info);
190
191 dbgfs_file_board = debugfs_create_file("board", S_IRUGO, dbgfs_root,
192 NULL, &fops_board);
193
194 return 0;
195}
196
197late_initcall(s3c_freq_debugfs_init);
198
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c
deleted file mode 100644
index cfa0dd8723ec..000000000000
--- a/arch/arm/mach-s3c24xx/cpufreq-s3c2410.c
+++ /dev/null
@@ -1,160 +0,0 @@
1/*
2 * Copyright (c) 2006-2008 Simtec Electronics
3 * http://armlinux.simtec.co.uk/
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 CPU Frequency scaling
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/interrupt.h>
16#include <linux/ioport.h>
17#include <linux/cpufreq.h>
18#include <linux/device.h>
19#include <linux/clk.h>
20#include <linux/err.h>
21#include <linux/io.h>
22
23#include <asm/mach/arch.h>
24#include <asm/mach/map.h>
25
26#include <mach/regs-clock.h>
27
28#include <plat/cpu.h>
29#include <plat/clock.h>
30#include <plat/cpu-freq-core.h>
31
32/* Note, 2410A has an extra mode for 1:4:4 ratio, bit 2 of CLKDIV */
33
34static void s3c2410_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
35{
36 u32 clkdiv = 0;
37
38 if (cfg->divs.h_divisor == 2)
39 clkdiv |= S3C2410_CLKDIVN_HDIVN;
40
41 if (cfg->divs.p_divisor != cfg->divs.h_divisor)
42 clkdiv |= S3C2410_CLKDIVN_PDIVN;
43
44 __raw_writel(clkdiv, S3C2410_CLKDIVN);
45}
46
47static int s3c2410_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
48{
49 unsigned long hclk, fclk, pclk;
50 unsigned int hdiv, pdiv;
51 unsigned long hclk_max;
52
53 fclk = cfg->freq.fclk;
54 hclk_max = cfg->max.hclk;
55
56 cfg->freq.armclk = fclk;
57
58 s3c_freq_dbg("%s: fclk is %lu, max hclk %lu\n",
59 __func__, fclk, hclk_max);
60
61 hdiv = (fclk > cfg->max.hclk) ? 2 : 1;
62 hclk = fclk / hdiv;
63
64 if (hclk > cfg->max.hclk) {
65 s3c_freq_dbg("%s: hclk too big\n", __func__);
66 return -EINVAL;
67 }
68
69 pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
70 pclk = hclk / pdiv;
71
72 if (pclk > cfg->max.pclk) {
73 s3c_freq_dbg("%s: pclk too big\n", __func__);
74 return -EINVAL;
75 }
76
77 pdiv *= hdiv;
78
79 /* record the result */
80 cfg->divs.p_divisor = pdiv;
81 cfg->divs.h_divisor = hdiv;
82
83 return 0;
84}
85
86static struct s3c_cpufreq_info s3c2410_cpufreq_info = {
87 .max = {
88 .fclk = 200000000,
89 .hclk = 100000000,
90 .pclk = 50000000,
91 },
92
93 /* transition latency is about 5ms worst-case, so
94 * set 10ms to be sure */
95 .latency = 10000000,
96
97 .locktime_m = 150,
98 .locktime_u = 150,
99 .locktime_bits = 12,
100
101 .need_pll = 1,
102
103 .name = "s3c2410",
104 .calc_iotiming = s3c2410_iotiming_calc,
105 .set_iotiming = s3c2410_iotiming_set,
106 .get_iotiming = s3c2410_iotiming_get,
107 .resume_clocks = s3c2410_setup_clocks,
108
109 .set_fvco = s3c2410_set_fvco,
110 .set_refresh = s3c2410_cpufreq_setrefresh,
111 .set_divs = s3c2410_cpufreq_setdivs,
112 .calc_divs = s3c2410_cpufreq_calcdivs,
113
114 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
115};
116
117static int s3c2410_cpufreq_add(struct device *dev,
118 struct subsys_interface *sif)
119{
120 return s3c_cpufreq_register(&s3c2410_cpufreq_info);
121}
122
123static struct subsys_interface s3c2410_cpufreq_interface = {
124 .name = "s3c2410_cpufreq",
125 .subsys = &s3c2410_subsys,
126 .add_dev = s3c2410_cpufreq_add,
127};
128
129static int __init s3c2410_cpufreq_init(void)
130{
131 return subsys_interface_register(&s3c2410_cpufreq_interface);
132}
133arch_initcall(s3c2410_cpufreq_init);
134
135static int s3c2410a_cpufreq_add(struct device *dev,
136 struct subsys_interface *sif)
137{
138 /* alter the maximum freq settings for S3C2410A. If a board knows
139 * it only has a maximum of 200, then it should register its own
140 * limits. */
141
142 s3c2410_cpufreq_info.max.fclk = 266000000;
143 s3c2410_cpufreq_info.max.hclk = 133000000;
144 s3c2410_cpufreq_info.max.pclk = 66500000;
145 s3c2410_cpufreq_info.name = "s3c2410a";
146
147 return s3c2410_cpufreq_add(dev, sif);
148}
149
150static struct subsys_interface s3c2410a_cpufreq_interface = {
151 .name = "s3c2410a_cpufreq",
152 .subsys = &s3c2410a_subsys,
153 .add_dev = s3c2410a_cpufreq_add,
154};
155
156static int __init s3c2410a_cpufreq_init(void)
157{
158 return subsys_interface_register(&s3c2410a_cpufreq_interface);
159}
160arch_initcall(s3c2410a_cpufreq_init);
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2412.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2412.c
deleted file mode 100644
index 8bf0f3a77476..000000000000
--- a/arch/arm/mach-s3c24xx/cpufreq-s3c2412.c
+++ /dev/null
@@ -1,258 +0,0 @@
1/*
2 * Copyright 2008 Simtec Electronics
3 * http://armlinux.simtec.co.uk/
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2412 CPU Frequency scalling
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/interrupt.h>
16#include <linux/ioport.h>
17#include <linux/cpufreq.h>
18#include <linux/device.h>
19#include <linux/delay.h>
20#include <linux/clk.h>
21#include <linux/err.h>
22#include <linux/io.h>
23
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26
27#include <mach/regs-clock.h>
28
29#include <plat/cpu.h>
30#include <plat/clock.h>
31#include <plat/cpu-freq-core.h>
32
33#include "s3c2412.h"
34
35/* our clock resources. */
36static struct clk *xtal;
37static struct clk *fclk;
38static struct clk *hclk;
39static struct clk *armclk;
40
41/* HDIV: 1, 2, 3, 4, 6, 8 */
42
43static int s3c2412_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
44{
45 unsigned int hdiv, pdiv, armdiv, dvs;
46 unsigned long hclk, fclk, armclk, armdiv_clk;
47 unsigned long hclk_max;
48
49 fclk = cfg->freq.fclk;
50 armclk = cfg->freq.armclk;
51 hclk_max = cfg->max.hclk;
52
53 /* We can't run hclk above armclk as at the best we have to
54 * have armclk and hclk in dvs mode. */
55
56 if (hclk_max > armclk)
57 hclk_max = armclk;
58
59 s3c_freq_dbg("%s: fclk=%lu, armclk=%lu, hclk_max=%lu\n",
60 __func__, fclk, armclk, hclk_max);
61 s3c_freq_dbg("%s: want f=%lu, arm=%lu, h=%lu, p=%lu\n",
62 __func__, cfg->freq.fclk, cfg->freq.armclk,
63 cfg->freq.hclk, cfg->freq.pclk);
64
65 armdiv = fclk / armclk;
66
67 if (armdiv < 1)
68 armdiv = 1;
69 if (armdiv > 2)
70 armdiv = 2;
71
72 cfg->divs.arm_divisor = armdiv;
73 armdiv_clk = fclk / armdiv;
74
75 hdiv = armdiv_clk / hclk_max;
76 if (hdiv < 1)
77 hdiv = 1;
78
79 cfg->freq.hclk = hclk = armdiv_clk / hdiv;
80
81 /* set dvs depending on whether we reached armclk or not. */
82 cfg->divs.dvs = dvs = armclk < armdiv_clk;
83
84 /* update the actual armclk we achieved. */
85 cfg->freq.armclk = dvs ? hclk : armdiv_clk;
86
87 s3c_freq_dbg("%s: armclk %lu, hclk %lu, armdiv %d, hdiv %d, dvs %d\n",
88 __func__, armclk, hclk, armdiv, hdiv, cfg->divs.dvs);
89
90 if (hdiv > 4)
91 goto invalid;
92
93 pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
94
95 if ((hclk / pdiv) > cfg->max.pclk)
96 pdiv++;
97
98 cfg->freq.pclk = hclk / pdiv;
99
100 s3c_freq_dbg("%s: pdiv %d\n", __func__, pdiv);
101
102 if (pdiv > 2)
103 goto invalid;
104
105 pdiv *= hdiv;
106
107 /* store the result, and then return */
108
109 cfg->divs.h_divisor = hdiv * armdiv;
110 cfg->divs.p_divisor = pdiv * armdiv;
111
112 return 0;
113
114invalid:
115 return -EINVAL;
116}
117
118static void s3c2412_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
119{
120 unsigned long clkdiv;
121 unsigned long olddiv;
122
123 olddiv = clkdiv = __raw_readl(S3C2410_CLKDIVN);
124
125 /* clear off current clock info */
126
127 clkdiv &= ~S3C2412_CLKDIVN_ARMDIVN;
128 clkdiv &= ~S3C2412_CLKDIVN_HDIVN_MASK;
129 clkdiv &= ~S3C2412_CLKDIVN_PDIVN;
130
131 if (cfg->divs.arm_divisor == 2)
132 clkdiv |= S3C2412_CLKDIVN_ARMDIVN;
133
134 clkdiv |= ((cfg->divs.h_divisor / cfg->divs.arm_divisor) - 1);
135
136 if (cfg->divs.p_divisor != cfg->divs.h_divisor)
137 clkdiv |= S3C2412_CLKDIVN_PDIVN;
138
139 s3c_freq_dbg("%s: div %08lx => %08lx\n", __func__, olddiv, clkdiv);
140 __raw_writel(clkdiv, S3C2410_CLKDIVN);
141
142 clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
143}
144
145static void s3c2412_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
146{
147 struct s3c_cpufreq_board *board = cfg->board;
148 unsigned long refresh;
149
150 s3c_freq_dbg("%s: refresh %u ns, hclk %lu\n", __func__,
151 board->refresh, cfg->freq.hclk);
152
153 /* Reduce both the refresh time (in ns) and the frequency (in MHz)
154 * by 10 each to ensure that we do not overflow 32 bit numbers. This
155 * should work for HCLK up to 133MHz and refresh period up to 30usec.
156 */
157
158 refresh = (board->refresh / 10);
159 refresh *= (cfg->freq.hclk / 100);
160 refresh /= (1 * 1000 * 1000); /* 10^6 */
161
162 s3c_freq_dbg("%s: setting refresh 0x%08lx\n", __func__, refresh);
163 __raw_writel(refresh, S3C2412_REFRESH);
164}
165
166/* set the default cpu frequency information, based on an 200MHz part
167 * as we have no other way of detecting the speed rating in software.
168 */
169
170static struct s3c_cpufreq_info s3c2412_cpufreq_info = {
171 .max = {
172 .fclk = 200000000,
173 .hclk = 100000000,
174 .pclk = 50000000,
175 },
176
177 .latency = 5000000, /* 5ms */
178
179 .locktime_m = 150,
180 .locktime_u = 150,
181 .locktime_bits = 16,
182
183 .name = "s3c2412",
184 .set_refresh = s3c2412_cpufreq_setrefresh,
185 .set_divs = s3c2412_cpufreq_setdivs,
186 .calc_divs = s3c2412_cpufreq_calcdivs,
187
188 .calc_iotiming = s3c2412_iotiming_calc,
189 .set_iotiming = s3c2412_iotiming_set,
190 .get_iotiming = s3c2412_iotiming_get,
191
192 .resume_clocks = s3c2412_setup_clocks,
193
194 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs),
195};
196
197static int s3c2412_cpufreq_add(struct device *dev,
198 struct subsys_interface *sif)
199{
200 unsigned long fclk_rate;
201
202 hclk = clk_get(NULL, "hclk");
203 if (IS_ERR(hclk)) {
204 printk(KERN_ERR "%s: cannot find hclk clock\n", __func__);
205 return -ENOENT;
206 }
207
208 fclk = clk_get(NULL, "fclk");
209 if (IS_ERR(fclk)) {
210 printk(KERN_ERR "%s: cannot find fclk clock\n", __func__);
211 goto err_fclk;
212 }
213
214 fclk_rate = clk_get_rate(fclk);
215 if (fclk_rate > 200000000) {
216 printk(KERN_INFO
217 "%s: fclk %ld MHz, assuming 266MHz capable part\n",
218 __func__, fclk_rate / 1000000);
219 s3c2412_cpufreq_info.max.fclk = 266000000;
220 s3c2412_cpufreq_info.max.hclk = 133000000;
221 s3c2412_cpufreq_info.max.pclk = 66000000;
222 }
223
224 armclk = clk_get(NULL, "armclk");
225 if (IS_ERR(armclk)) {
226 printk(KERN_ERR "%s: cannot find arm clock\n", __func__);
227 goto err_armclk;
228 }
229
230 xtal = clk_get(NULL, "xtal");
231 if (IS_ERR(xtal)) {
232 printk(KERN_ERR "%s: cannot find xtal clock\n", __func__);
233 goto err_xtal;
234 }
235
236 return s3c_cpufreq_register(&s3c2412_cpufreq_info);
237
238err_xtal:
239 clk_put(armclk);
240err_armclk:
241 clk_put(fclk);
242err_fclk:
243 clk_put(hclk);
244
245 return -ENOENT;
246}
247
248static struct subsys_interface s3c2412_cpufreq_interface = {
249 .name = "s3c2412_cpufreq",
250 .subsys = &s3c2412_subsys,
251 .add_dev = s3c2412_cpufreq_add,
252};
253
254static int s3c2412_cpufreq_init(void)
255{
256 return subsys_interface_register(&s3c2412_cpufreq_interface);
257}
258arch_initcall(s3c2412_cpufreq_init);
diff --git a/arch/arm/mach-s3c24xx/cpufreq-s3c2440.c b/arch/arm/mach-s3c24xx/cpufreq-s3c2440.c
deleted file mode 100644
index 72b2cc8a5a85..000000000000
--- a/arch/arm/mach-s3c24xx/cpufreq-s3c2440.c
+++ /dev/null
@@ -1,312 +0,0 @@
1/*
2 * Copyright (c) 2006-2009 Simtec Electronics
3 * http://armlinux.simtec.co.uk/
4 * Ben Dooks <ben@simtec.co.uk>
5 * Vincent Sanders <vince@simtec.co.uk>
6 *
7 * S3C2440/S3C2442 CPU Frequency scaling
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/cpufreq.h>
19#include <linux/device.h>
20#include <linux/delay.h>
21#include <linux/clk.h>
22#include <linux/err.h>
23#include <linux/io.h>
24
25#include <mach/hardware.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29
30#include <mach/regs-clock.h>
31
32#include <plat/cpu.h>
33#include <plat/cpu-freq-core.h>
34#include <plat/clock.h>
35
36static struct clk *xtal;
37static struct clk *fclk;
38static struct clk *hclk;
39static struct clk *armclk;
40
41/* HDIV: 1, 2, 3, 4, 6, 8 */
42
43static inline int within_khz(unsigned long a, unsigned long b)
44{
45 long diff = a - b;
46
47 return (diff >= -1000 && diff <= 1000);
48}
49
50/**
51 * s3c2440_cpufreq_calcdivs - calculate divider settings
52 * @cfg: The cpu frequency settings.
53 *
54 * Calcualte the divider values for the given frequency settings
55 * specified in @cfg. The values are stored in @cfg for later use
56 * by the relevant set routine if the request settings can be reached.
57 */
58int s3c2440_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
59{
60 unsigned int hdiv, pdiv;
61 unsigned long hclk, fclk, armclk;
62 unsigned long hclk_max;
63
64 fclk = cfg->freq.fclk;
65 armclk = cfg->freq.armclk;
66 hclk_max = cfg->max.hclk;
67
68 s3c_freq_dbg("%s: fclk is %lu, armclk %lu, max hclk %lu\n",
69 __func__, fclk, armclk, hclk_max);
70
71 if (armclk > fclk) {
72 printk(KERN_WARNING "%s: armclk > fclk\n", __func__);
73 armclk = fclk;
74 }
75
76 /* if we are in DVS, we need HCLK to be <= ARMCLK */
77 if (armclk < fclk && armclk < hclk_max)
78 hclk_max = armclk;
79
80 for (hdiv = 1; hdiv < 9; hdiv++) {
81 if (hdiv == 5 || hdiv == 7)
82 hdiv++;
83
84 hclk = (fclk / hdiv);
85 if (hclk <= hclk_max || within_khz(hclk, hclk_max))
86 break;
87 }
88
89 s3c_freq_dbg("%s: hclk %lu, div %d\n", __func__, hclk, hdiv);
90
91 if (hdiv > 8)
92 goto invalid;
93
94 pdiv = (hclk > cfg->max.pclk) ? 2 : 1;
95
96 if ((hclk / pdiv) > cfg->max.pclk)
97 pdiv++;
98
99 s3c_freq_dbg("%s: pdiv %d\n", __func__, pdiv);
100
101 if (pdiv > 2)
102 goto invalid;
103
104 pdiv *= hdiv;
105
106 /* calculate a valid armclk */
107
108 if (armclk < hclk)
109 armclk = hclk;
110
111 /* if we're running armclk lower than fclk, this really means
112 * that the system should go into dvs mode, which means that
113 * armclk is connected to hclk. */
114 if (armclk < fclk) {
115 cfg->divs.dvs = 1;
116 armclk = hclk;
117 } else
118 cfg->divs.dvs = 0;
119
120 cfg->freq.armclk = armclk;
121
122 /* store the result, and then return */
123
124 cfg->divs.h_divisor = hdiv;
125 cfg->divs.p_divisor = pdiv;
126
127 return 0;
128
129 invalid:
130 return -EINVAL;
131}
132
133#define CAMDIVN_HCLK_HALF (S3C2440_CAMDIVN_HCLK3_HALF | \
134 S3C2440_CAMDIVN_HCLK4_HALF)
135
136/**
137 * s3c2440_cpufreq_setdivs - set the cpu frequency divider settings
138 * @cfg: The cpu frequency settings.
139 *
140 * Set the divisors from the settings in @cfg, which where generated
141 * during the calculation phase by s3c2440_cpufreq_calcdivs().
142 */
143static void s3c2440_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
144{
145 unsigned long clkdiv, camdiv;
146
147 s3c_freq_dbg("%s: divsiors: h=%d, p=%d\n", __func__,
148 cfg->divs.h_divisor, cfg->divs.p_divisor);
149
150 clkdiv = __raw_readl(S3C2410_CLKDIVN);
151 camdiv = __raw_readl(S3C2440_CAMDIVN);
152
153 clkdiv &= ~(S3C2440_CLKDIVN_HDIVN_MASK | S3C2440_CLKDIVN_PDIVN);
154 camdiv &= ~CAMDIVN_HCLK_HALF;
155
156 switch (cfg->divs.h_divisor) {
157 case 1:
158 clkdiv |= S3C2440_CLKDIVN_HDIVN_1;
159 break;
160
161 case 2:
162 clkdiv |= S3C2440_CLKDIVN_HDIVN_2;
163 break;
164
165 case 6:
166 camdiv |= S3C2440_CAMDIVN_HCLK3_HALF;
167 case 3:
168 clkdiv |= S3C2440_CLKDIVN_HDIVN_3_6;
169 break;
170
171 case 8:
172 camdiv |= S3C2440_CAMDIVN_HCLK4_HALF;
173 case 4:
174 clkdiv |= S3C2440_CLKDIVN_HDIVN_4_8;
175 break;
176
177 default:
178 BUG(); /* we don't expect to get here. */
179 }
180
181 if (cfg->divs.p_divisor != cfg->divs.h_divisor)
182 clkdiv |= S3C2440_CLKDIVN_PDIVN;
183
184 /* todo - set pclk. */
185
186 /* Write the divisors first with hclk intentionally halved so that
187 * when we write clkdiv we will under-frequency instead of over. We
188 * then make a short delay and remove the hclk halving if necessary.
189 */
190
191 __raw_writel(camdiv | CAMDIVN_HCLK_HALF, S3C2440_CAMDIVN);
192 __raw_writel(clkdiv, S3C2410_CLKDIVN);
193
194 ndelay(20);
195 __raw_writel(camdiv, S3C2440_CAMDIVN);
196
197 clk_set_parent(armclk, cfg->divs.dvs ? hclk : fclk);
198}
199
200static int run_freq_for(unsigned long max_hclk, unsigned long fclk,
201 int *divs,
202 struct cpufreq_frequency_table *table,
203 size_t table_size)
204{
205 unsigned long freq;
206 int index = 0;
207 int div;
208
209 for (div = *divs; div > 0; div = *divs++) {
210 freq = fclk / div;
211
212 if (freq > max_hclk && div != 1)
213 continue;
214
215 freq /= 1000; /* table is in kHz */
216 index = s3c_cpufreq_addfreq(table, index, table_size, freq);
217 if (index < 0)
218 break;
219 }
220
221 return index;
222}
223
224static int hclk_divs[] = { 1, 2, 3, 4, 6, 8, -1 };
225
226static int s3c2440_cpufreq_calctable(struct s3c_cpufreq_config *cfg,
227 struct cpufreq_frequency_table *table,
228 size_t table_size)
229{
230 int ret;
231
232 WARN_ON(cfg->info == NULL);
233 WARN_ON(cfg->board == NULL);
234
235 ret = run_freq_for(cfg->info->max.hclk,
236 cfg->info->max.fclk,
237 hclk_divs,
238 table, table_size);
239
240 s3c_freq_dbg("%s: returning %d\n", __func__, ret);
241
242 return ret;
243}
244
245struct s3c_cpufreq_info s3c2440_cpufreq_info = {
246 .max = {
247 .fclk = 400000000,
248 .hclk = 133333333,
249 .pclk = 66666666,
250 },
251
252 .locktime_m = 300,
253 .locktime_u = 300,
254 .locktime_bits = 16,
255
256 .name = "s3c244x",
257 .calc_iotiming = s3c2410_iotiming_calc,
258 .set_iotiming = s3c2410_iotiming_set,
259 .get_iotiming = s3c2410_iotiming_get,
260 .set_fvco = s3c2410_set_fvco,
261
262 .set_refresh = s3c2410_cpufreq_setrefresh,
263 .set_divs = s3c2440_cpufreq_setdivs,
264 .calc_divs = s3c2440_cpufreq_calcdivs,
265 .calc_freqtable = s3c2440_cpufreq_calctable,
266
267 .resume_clocks = s3c244x_setup_clocks,
268
269 .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs),
270};
271
272static int s3c2440_cpufreq_add(struct device *dev,
273 struct subsys_interface *sif)
274{
275 xtal = s3c_cpufreq_clk_get(NULL, "xtal");
276 hclk = s3c_cpufreq_clk_get(NULL, "hclk");
277 fclk = s3c_cpufreq_clk_get(NULL, "fclk");
278 armclk = s3c_cpufreq_clk_get(NULL, "armclk");
279
280 if (IS_ERR(xtal) || IS_ERR(hclk) || IS_ERR(fclk) || IS_ERR(armclk)) {
281 printk(KERN_ERR "%s: failed to get clocks\n", __func__);
282 return -ENOENT;
283 }
284
285 return s3c_cpufreq_register(&s3c2440_cpufreq_info);
286}
287
288static struct subsys_interface s3c2440_cpufreq_interface = {
289 .name = "s3c2440_cpufreq",
290 .subsys = &s3c2440_subsys,
291 .add_dev = s3c2440_cpufreq_add,
292};
293
294static int s3c2440_cpufreq_init(void)
295{
296 return subsys_interface_register(&s3c2440_cpufreq_interface);
297}
298
299/* arch_initcall adds the clocks we need, so use subsys_initcall. */
300subsys_initcall(s3c2440_cpufreq_init);
301
302static struct subsys_interface s3c2442_cpufreq_interface = {
303 .name = "s3c2442_cpufreq",
304 .subsys = &s3c2442_subsys,
305 .add_dev = s3c2440_cpufreq_add,
306};
307
308static int s3c2442_cpufreq_init(void)
309{
310 return subsys_interface_register(&s3c2442_cpufreq_interface);
311}
312subsys_initcall(s3c2442_cpufreq_init);
diff --git a/arch/arm/mach-s3c24xx/cpufreq-utils.c b/arch/arm/mach-s3c24xx/cpufreq-utils.c
index ddd8280e3875..2a0aa5684e72 100644
--- a/arch/arm/mach-s3c24xx/cpufreq-utils.c
+++ b/arch/arm/mach-s3c24xx/cpufreq-utils.c
@@ -60,5 +60,5 @@ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
60 */ 60 */
61void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg) 61void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
62{ 62{
63 __raw_writel(cfg->pll.index, S3C2410_MPLLCON); 63 __raw_writel(cfg->pll.driver_data, S3C2410_MPLLCON);
64} 64}
diff --git a/arch/arm/mach-s3c24xx/cpufreq.c b/arch/arm/mach-s3c24xx/cpufreq.c
deleted file mode 100644
index 3c0e78ede0da..000000000000
--- a/arch/arm/mach-s3c24xx/cpufreq.c
+++ /dev/null
@@ -1,711 +0,0 @@
1/*
2 * Copyright (c) 2006-2008 Simtec Electronics
3 * http://armlinux.simtec.co.uk/
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C24XX CPU Frequency scaling
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/interrupt.h>
16#include <linux/ioport.h>
17#include <linux/cpufreq.h>
18#include <linux/cpu.h>
19#include <linux/clk.h>
20#include <linux/err.h>
21#include <linux/io.h>
22#include <linux/device.h>
23#include <linux/sysfs.h>
24#include <linux/slab.h>
25
26#include <asm/mach/arch.h>
27#include <asm/mach/map.h>
28
29#include <plat/cpu.h>
30#include <plat/clock.h>
31#include <plat/cpu-freq-core.h>
32
33#include <mach/regs-clock.h>
34
35/* note, cpufreq support deals in kHz, no Hz */
36
37static struct cpufreq_driver s3c24xx_driver;
38static struct s3c_cpufreq_config cpu_cur;
39static struct s3c_iotimings s3c24xx_iotiming;
40static struct cpufreq_frequency_table *pll_reg;
41static unsigned int last_target = ~0;
42static unsigned int ftab_size;
43static struct cpufreq_frequency_table *ftab;
44
45static struct clk *_clk_mpll;
46static struct clk *_clk_xtal;
47static struct clk *clk_fclk;
48static struct clk *clk_hclk;
49static struct clk *clk_pclk;
50static struct clk *clk_arm;
51
52#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
53struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void)
54{
55 return &cpu_cur;
56}
57
58struct s3c_iotimings *s3c_cpufreq_getiotimings(void)
59{
60 return &s3c24xx_iotiming;
61}
62#endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUGFS */
63
64static void s3c_cpufreq_getcur(struct s3c_cpufreq_config *cfg)
65{
66 unsigned long fclk, pclk, hclk, armclk;
67
68 cfg->freq.fclk = fclk = clk_get_rate(clk_fclk);
69 cfg->freq.hclk = hclk = clk_get_rate(clk_hclk);
70 cfg->freq.pclk = pclk = clk_get_rate(clk_pclk);
71 cfg->freq.armclk = armclk = clk_get_rate(clk_arm);
72
73 cfg->pll.index = __raw_readl(S3C2410_MPLLCON);
74 cfg->pll.frequency = fclk;
75
76 cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10);
77
78 cfg->divs.h_divisor = fclk / hclk;
79 cfg->divs.p_divisor = fclk / pclk;
80}
81
82static inline void s3c_cpufreq_calc(struct s3c_cpufreq_config *cfg)
83{
84 unsigned long pll = cfg->pll.frequency;
85
86 cfg->freq.fclk = pll;
87 cfg->freq.hclk = pll / cfg->divs.h_divisor;
88 cfg->freq.pclk = pll / cfg->divs.p_divisor;
89
90 /* convert hclk into 10ths of nanoseconds for io calcs */
91 cfg->freq.hclk_tns = 1000000000 / (cfg->freq.hclk / 10);
92}
93
94static inline int closer(unsigned int target, unsigned int n, unsigned int c)
95{
96 int diff_cur = abs(target - c);
97 int diff_new = abs(target - n);
98
99 return (diff_new < diff_cur);
100}
101
102static void s3c_cpufreq_show(const char *pfx,
103 struct s3c_cpufreq_config *cfg)
104{
105 s3c_freq_dbg("%s: Fvco=%u, F=%lu, A=%lu, H=%lu (%u), P=%lu (%u)\n",
106 pfx, cfg->pll.frequency, cfg->freq.fclk, cfg->freq.armclk,
107 cfg->freq.hclk, cfg->divs.h_divisor,
108 cfg->freq.pclk, cfg->divs.p_divisor);
109}
110
111/* functions to wrapper the driver info calls to do the cpu specific work */
112
113static void s3c_cpufreq_setio(struct s3c_cpufreq_config *cfg)
114{
115 if (cfg->info->set_iotiming)
116 (cfg->info->set_iotiming)(cfg, &s3c24xx_iotiming);
117}
118
119static int s3c_cpufreq_calcio(struct s3c_cpufreq_config *cfg)
120{
121 if (cfg->info->calc_iotiming)
122 return (cfg->info->calc_iotiming)(cfg, &s3c24xx_iotiming);
123
124 return 0;
125}
126
127static void s3c_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
128{
129 (cfg->info->set_refresh)(cfg);
130}
131
132static void s3c_cpufreq_setdivs(struct s3c_cpufreq_config *cfg)
133{
134 (cfg->info->set_divs)(cfg);
135}
136
137static int s3c_cpufreq_calcdivs(struct s3c_cpufreq_config *cfg)
138{
139 return (cfg->info->calc_divs)(cfg);
140}
141
142static void s3c_cpufreq_setfvco(struct s3c_cpufreq_config *cfg)
143{
144 (cfg->info->set_fvco)(cfg);
145}
146
147static inline void s3c_cpufreq_resume_clocks(void)
148{
149 cpu_cur.info->resume_clocks();
150}
151
152static inline void s3c_cpufreq_updateclk(struct clk *clk,
153 unsigned int freq)
154{
155 clk_set_rate(clk, freq);
156}
157
158static int s3c_cpufreq_settarget(struct cpufreq_policy *policy,
159 unsigned int target_freq,
160 struct cpufreq_frequency_table *pll)
161{
162 struct s3c_cpufreq_freqs freqs;
163 struct s3c_cpufreq_config cpu_new;
164 unsigned long flags;
165
166 cpu_new = cpu_cur; /* copy new from current */
167
168 s3c_cpufreq_show("cur", &cpu_cur);
169
170 /* TODO - check for DMA currently outstanding */
171
172 cpu_new.pll = pll ? *pll : cpu_cur.pll;
173
174 if (pll)
175 freqs.pll_changing = 1;
176
177 /* update our frequencies */
178
179 cpu_new.freq.armclk = target_freq;
180 cpu_new.freq.fclk = cpu_new.pll.frequency;
181
182 if (s3c_cpufreq_calcdivs(&cpu_new) < 0) {
183 printk(KERN_ERR "no divisors for %d\n", target_freq);
184 goto err_notpossible;
185 }
186
187 s3c_freq_dbg("%s: got divs\n", __func__);
188
189 s3c_cpufreq_calc(&cpu_new);
190
191 s3c_freq_dbg("%s: calculated frequencies for new\n", __func__);
192
193 if (cpu_new.freq.hclk != cpu_cur.freq.hclk) {
194 if (s3c_cpufreq_calcio(&cpu_new) < 0) {
195 printk(KERN_ERR "%s: no IO timings\n", __func__);
196 goto err_notpossible;
197 }
198 }
199
200 s3c_cpufreq_show("new", &cpu_new);
201
202 /* setup our cpufreq parameters */
203
204 freqs.old = cpu_cur.freq;
205 freqs.new = cpu_new.freq;
206
207 freqs.freqs.old = cpu_cur.freq.armclk / 1000;
208 freqs.freqs.new = cpu_new.freq.armclk / 1000;
209
210 /* update f/h/p clock settings before we issue the change
211 * notification, so that drivers do not need to do anything
212 * special if they want to recalculate on CPUFREQ_PRECHANGE. */
213
214 s3c_cpufreq_updateclk(_clk_mpll, cpu_new.pll.frequency);
215 s3c_cpufreq_updateclk(clk_fclk, cpu_new.freq.fclk);
216 s3c_cpufreq_updateclk(clk_hclk, cpu_new.freq.hclk);
217 s3c_cpufreq_updateclk(clk_pclk, cpu_new.freq.pclk);
218
219 /* start the frequency change */
220 cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_PRECHANGE);
221
222 /* If hclk is staying the same, then we do not need to
223 * re-write the IO or the refresh timings whilst we are changing
224 * speed. */
225
226 local_irq_save(flags);
227
228 /* is our memory clock slowing down? */
229 if (cpu_new.freq.hclk < cpu_cur.freq.hclk) {
230 s3c_cpufreq_setrefresh(&cpu_new);
231 s3c_cpufreq_setio(&cpu_new);
232 }
233
234 if (cpu_new.freq.fclk == cpu_cur.freq.fclk) {
235 /* not changing PLL, just set the divisors */
236
237 s3c_cpufreq_setdivs(&cpu_new);
238 } else {
239 if (cpu_new.freq.fclk < cpu_cur.freq.fclk) {
240 /* slow the cpu down, then set divisors */
241
242 s3c_cpufreq_setfvco(&cpu_new);
243 s3c_cpufreq_setdivs(&cpu_new);
244 } else {
245 /* set the divisors, then speed up */
246
247 s3c_cpufreq_setdivs(&cpu_new);
248 s3c_cpufreq_setfvco(&cpu_new);
249 }
250 }
251
252 /* did our memory clock speed up */
253 if (cpu_new.freq.hclk > cpu_cur.freq.hclk) {
254 s3c_cpufreq_setrefresh(&cpu_new);
255 s3c_cpufreq_setio(&cpu_new);
256 }
257
258 /* update our current settings */
259 cpu_cur = cpu_new;
260
261 local_irq_restore(flags);
262
263 /* notify everyone we've done this */
264 cpufreq_notify_transition(policy, &freqs.freqs, CPUFREQ_POSTCHANGE);
265
266 s3c_freq_dbg("%s: finished\n", __func__);
267 return 0;
268
269 err_notpossible:
270 printk(KERN_ERR "no compatible settings for %d\n", target_freq);
271 return -EINVAL;
272}
273
274/* s3c_cpufreq_target
275 *
276 * called by the cpufreq core to adjust the frequency that the CPU
277 * is currently running at.
278 */
279
280static int s3c_cpufreq_target(struct cpufreq_policy *policy,
281 unsigned int target_freq,
282 unsigned int relation)
283{
284 struct cpufreq_frequency_table *pll;
285 unsigned int index;
286
287 /* avoid repeated calls which cause a needless amout of duplicated
288 * logging output (and CPU time as the calculation process is
289 * done) */
290 if (target_freq == last_target)
291 return 0;
292
293 last_target = target_freq;
294
295 s3c_freq_dbg("%s: policy %p, target %u, relation %u\n",
296 __func__, policy, target_freq, relation);
297
298 if (ftab) {
299 if (cpufreq_frequency_table_target(policy, ftab,
300 target_freq, relation,
301 &index)) {
302 s3c_freq_dbg("%s: table failed\n", __func__);
303 return -EINVAL;
304 }
305
306 s3c_freq_dbg("%s: adjust %d to entry %d (%u)\n", __func__,
307 target_freq, index, ftab[index].frequency);
308 target_freq = ftab[index].frequency;
309 }
310
311 target_freq *= 1000; /* convert target to Hz */
312
313 /* find the settings for our new frequency */
314
315 if (!pll_reg || cpu_cur.lock_pll) {
316 /* either we've not got any PLL values, or we've locked
317 * to the current one. */
318 pll = NULL;
319 } else {
320 struct cpufreq_policy tmp_policy;
321 int ret;
322
323 /* we keep the cpu pll table in Hz, to ensure we get an
324 * accurate value for the PLL output. */
325
326 tmp_policy.min = policy->min * 1000;
327 tmp_policy.max = policy->max * 1000;
328 tmp_policy.cpu = policy->cpu;
329
330 /* cpufreq_frequency_table_target uses a pointer to 'index'
331 * which is the number of the table entry, not the value of
332 * the table entry's index field. */
333
334 ret = cpufreq_frequency_table_target(&tmp_policy, pll_reg,
335 target_freq, relation,
336 &index);
337
338 if (ret < 0) {
339 printk(KERN_ERR "%s: no PLL available\n", __func__);
340 goto err_notpossible;
341 }
342
343 pll = pll_reg + index;
344
345 s3c_freq_dbg("%s: target %u => %u\n",
346 __func__, target_freq, pll->frequency);
347
348 target_freq = pll->frequency;
349 }
350
351 return s3c_cpufreq_settarget(policy, target_freq, pll);
352
353 err_notpossible:
354 printk(KERN_ERR "no compatible settings for %d\n", target_freq);
355 return -EINVAL;
356}
357
358static unsigned int s3c_cpufreq_get(unsigned int cpu)
359{
360 return clk_get_rate(clk_arm) / 1000;
361}
362
363struct clk *s3c_cpufreq_clk_get(struct device *dev, const char *name)
364{
365 struct clk *clk;
366
367 clk = clk_get(dev, name);
368 if (IS_ERR(clk))
369 printk(KERN_ERR "cpufreq: failed to get clock '%s'\n", name);
370
371 return clk;
372}
373
374static int s3c_cpufreq_init(struct cpufreq_policy *policy)
375{
376 printk(KERN_INFO "%s: initialising policy %p\n", __func__, policy);
377
378 if (policy->cpu != 0)
379 return -EINVAL;
380
381 policy->cur = s3c_cpufreq_get(0);
382 policy->min = policy->cpuinfo.min_freq = 0;
383 policy->max = policy->cpuinfo.max_freq = cpu_cur.info->max.fclk / 1000;
384 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
385
386 /* feed the latency information from the cpu driver */
387 policy->cpuinfo.transition_latency = cpu_cur.info->latency;
388
389 if (ftab)
390 cpufreq_frequency_table_cpuinfo(policy, ftab);
391
392 return 0;
393}
394
395static __init int s3c_cpufreq_initclks(void)
396{
397 _clk_mpll = s3c_cpufreq_clk_get(NULL, "mpll");
398 _clk_xtal = s3c_cpufreq_clk_get(NULL, "xtal");
399 clk_fclk = s3c_cpufreq_clk_get(NULL, "fclk");
400 clk_hclk = s3c_cpufreq_clk_get(NULL, "hclk");
401 clk_pclk = s3c_cpufreq_clk_get(NULL, "pclk");
402 clk_arm = s3c_cpufreq_clk_get(NULL, "armclk");
403
404 if (IS_ERR(clk_fclk) || IS_ERR(clk_hclk) || IS_ERR(clk_pclk) ||
405 IS_ERR(_clk_mpll) || IS_ERR(clk_arm) || IS_ERR(_clk_xtal)) {
406 printk(KERN_ERR "%s: could not get clock(s)\n", __func__);
407 return -ENOENT;
408 }
409
410 printk(KERN_INFO "%s: clocks f=%lu,h=%lu,p=%lu,a=%lu\n", __func__,
411 clk_get_rate(clk_fclk) / 1000,
412 clk_get_rate(clk_hclk) / 1000,
413 clk_get_rate(clk_pclk) / 1000,
414 clk_get_rate(clk_arm) / 1000);
415
416 return 0;
417}
418
419static int s3c_cpufreq_verify(struct cpufreq_policy *policy)
420{
421 if (policy->cpu != 0)
422 return -EINVAL;
423
424 return 0;
425}
426
427#ifdef CONFIG_PM
428static struct cpufreq_frequency_table suspend_pll;
429static unsigned int suspend_freq;
430
431static int s3c_cpufreq_suspend(struct cpufreq_policy *policy)
432{
433 suspend_pll.frequency = clk_get_rate(_clk_mpll);
434 suspend_pll.index = __raw_readl(S3C2410_MPLLCON);
435 suspend_freq = s3c_cpufreq_get(0) * 1000;
436
437 return 0;
438}
439
440static int s3c_cpufreq_resume(struct cpufreq_policy *policy)
441{
442 int ret;
443
444 s3c_freq_dbg("%s: resuming with policy %p\n", __func__, policy);
445
446 last_target = ~0; /* invalidate last_target setting */
447
448 /* first, find out what speed we resumed at. */
449 s3c_cpufreq_resume_clocks();
450
451 /* whilst we will be called later on, we try and re-set the
452 * cpu frequencies as soon as possible so that we do not end
453 * up resuming devices and then immediately having to re-set
454 * a number of settings once these devices have restarted.
455 *
456 * as a note, it is expected devices are not used until they
457 * have been un-suspended and at that time they should have
458 * used the updated clock settings.
459 */
460
461 ret = s3c_cpufreq_settarget(NULL, suspend_freq, &suspend_pll);
462 if (ret) {
463 printk(KERN_ERR "%s: failed to reset pll/freq\n", __func__);
464 return ret;
465 }
466
467 return 0;
468}
469#else
470#define s3c_cpufreq_resume NULL
471#define s3c_cpufreq_suspend NULL
472#endif
473
474static struct cpufreq_driver s3c24xx_driver = {
475 .flags = CPUFREQ_STICKY,
476 .verify = s3c_cpufreq_verify,
477 .target = s3c_cpufreq_target,
478 .get = s3c_cpufreq_get,
479 .init = s3c_cpufreq_init,
480 .suspend = s3c_cpufreq_suspend,
481 .resume = s3c_cpufreq_resume,
482 .name = "s3c24xx",
483};
484
485
486int __init s3c_cpufreq_register(struct s3c_cpufreq_info *info)
487{
488 if (!info || !info->name) {
489 printk(KERN_ERR "%s: failed to pass valid information\n",
490 __func__);
491 return -EINVAL;
492 }
493
494 printk(KERN_INFO "S3C24XX CPU Frequency driver, %s cpu support\n",
495 info->name);
496
497 /* check our driver info has valid data */
498
499 BUG_ON(info->set_refresh == NULL);
500 BUG_ON(info->set_divs == NULL);
501 BUG_ON(info->calc_divs == NULL);
502
503 /* info->set_fvco is optional, depending on whether there
504 * is a need to set the clock code. */
505
506 cpu_cur.info = info;
507
508 /* Note, driver registering should probably update locktime */
509
510 return 0;
511}
512
513int __init s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
514{
515 struct s3c_cpufreq_board *ours;
516
517 if (!board) {
518 printk(KERN_INFO "%s: no board data\n", __func__);
519 return -EINVAL;
520 }
521
522 /* Copy the board information so that each board can make this
523 * initdata. */
524
525 ours = kzalloc(sizeof(struct s3c_cpufreq_board), GFP_KERNEL);
526 if (ours == NULL) {
527 printk(KERN_ERR "%s: no memory\n", __func__);
528 return -ENOMEM;
529 }
530
531 *ours = *board;
532 cpu_cur.board = ours;
533
534 return 0;
535}
536
537int __init s3c_cpufreq_auto_io(void)
538{
539 int ret;
540
541 if (!cpu_cur.info->get_iotiming) {
542 printk(KERN_ERR "%s: get_iotiming undefined\n", __func__);
543 return -ENOENT;
544 }
545
546 printk(KERN_INFO "%s: working out IO settings\n", __func__);
547
548 ret = (cpu_cur.info->get_iotiming)(&cpu_cur, &s3c24xx_iotiming);
549 if (ret)
550 printk(KERN_ERR "%s: failed to get timings\n", __func__);
551
552 return ret;
553}
554
555/* if one or is zero, then return the other, otherwise return the min */
556#define do_min(_a, _b) ((_a) == 0 ? (_b) : (_b) == 0 ? (_a) : min(_a, _b))
557
558/**
559 * s3c_cpufreq_freq_min - find the minimum settings for the given freq.
560 * @dst: The destination structure
561 * @a: One argument.
562 * @b: The other argument.
563 *
564 * Create a minimum of each frequency entry in the 'struct s3c_freq',
565 * unless the entry is zero when it is ignored and the non-zero argument
566 * used.
567 */
568static void s3c_cpufreq_freq_min(struct s3c_freq *dst,
569 struct s3c_freq *a, struct s3c_freq *b)
570{
571 dst->fclk = do_min(a->fclk, b->fclk);
572 dst->hclk = do_min(a->hclk, b->hclk);
573 dst->pclk = do_min(a->pclk, b->pclk);
574 dst->armclk = do_min(a->armclk, b->armclk);
575}
576
577static inline u32 calc_locktime(u32 freq, u32 time_us)
578{
579 u32 result;
580
581 result = freq * time_us;
582 result = DIV_ROUND_UP(result, 1000 * 1000);
583
584 return result;
585}
586
587static void s3c_cpufreq_update_loctkime(void)
588{
589 unsigned int bits = cpu_cur.info->locktime_bits;
590 u32 rate = (u32)clk_get_rate(_clk_xtal);
591 u32 val;
592
593 if (bits == 0) {
594 WARN_ON(1);
595 return;
596 }
597
598 val = calc_locktime(rate, cpu_cur.info->locktime_u) << bits;
599 val |= calc_locktime(rate, cpu_cur.info->locktime_m);
600
601 printk(KERN_INFO "%s: new locktime is 0x%08x\n", __func__, val);
602 __raw_writel(val, S3C2410_LOCKTIME);
603}
604
605static int s3c_cpufreq_build_freq(void)
606{
607 int size, ret;
608
609 if (!cpu_cur.info->calc_freqtable)
610 return -EINVAL;
611
612 kfree(ftab);
613 ftab = NULL;
614
615 size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0);
616 size++;
617
618 ftab = kmalloc(sizeof(struct cpufreq_frequency_table) * size, GFP_KERNEL);
619 if (!ftab) {
620 printk(KERN_ERR "%s: no memory for tables\n", __func__);
621 return -ENOMEM;
622 }
623
624 ftab_size = size;
625
626 ret = cpu_cur.info->calc_freqtable(&cpu_cur, ftab, size);
627 s3c_cpufreq_addfreq(ftab, ret, size, CPUFREQ_TABLE_END);
628
629 return 0;
630}
631
632static int __init s3c_cpufreq_initcall(void)
633{
634 int ret = 0;
635
636 if (cpu_cur.info && cpu_cur.board) {
637 ret = s3c_cpufreq_initclks();
638 if (ret)
639 goto out;
640
641 /* get current settings */
642 s3c_cpufreq_getcur(&cpu_cur);
643 s3c_cpufreq_show("cur", &cpu_cur);
644
645 if (cpu_cur.board->auto_io) {
646 ret = s3c_cpufreq_auto_io();
647 if (ret) {
648 printk(KERN_ERR "%s: failed to get io timing\n",
649 __func__);
650 goto out;
651 }
652 }
653
654 if (cpu_cur.board->need_io && !cpu_cur.info->set_iotiming) {
655 printk(KERN_ERR "%s: no IO support registered\n",
656 __func__);
657 ret = -EINVAL;
658 goto out;
659 }
660
661 if (!cpu_cur.info->need_pll)
662 cpu_cur.lock_pll = 1;
663
664 s3c_cpufreq_update_loctkime();
665
666 s3c_cpufreq_freq_min(&cpu_cur.max, &cpu_cur.board->max,
667 &cpu_cur.info->max);
668
669 if (cpu_cur.info->calc_freqtable)
670 s3c_cpufreq_build_freq();
671
672 ret = cpufreq_register_driver(&s3c24xx_driver);
673 }
674
675 out:
676 return ret;
677}
678
679late_initcall(s3c_cpufreq_initcall);
680
681/**
682 * s3c_plltab_register - register CPU PLL table.
683 * @plls: The list of PLL entries.
684 * @plls_no: The size of the PLL entries @plls.
685 *
686 * Register the given set of PLLs with the system.
687 */
688int __init s3c_plltab_register(struct cpufreq_frequency_table *plls,
689 unsigned int plls_no)
690{
691 struct cpufreq_frequency_table *vals;
692 unsigned int size;
693
694 size = sizeof(struct cpufreq_frequency_table) * (plls_no + 1);
695
696 vals = kmalloc(size, GFP_KERNEL);
697 if (vals) {
698 memcpy(vals, plls, size);
699 pll_reg = vals;
700
701 /* write a terminating entry, we don't store it in the
702 * table that is stored in the kernel */
703 vals += plls_no;
704 vals->frequency = CPUFREQ_TABLE_END;
705
706 printk(KERN_INFO "cpufreq: %d PLL entries\n", plls_no);
707 } else
708 printk(KERN_ERR "cpufreq: no memory for PLL tables\n");
709
710 return vals ? 0 : -ENOMEM;
711}
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2412.c b/arch/arm/mach-s3c24xx/dma-s3c2412.c
index ab1700ec8e64..b7e094671522 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2412.c
@@ -35,121 +35,95 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
35 [DMACH_XD0] = { 35 [DMACH_XD0] = {
36 .name = "xdreq0", 36 .name = "xdreq0",
37 .channels = MAP(S3C2412_DMAREQSEL_XDREQ0), 37 .channels = MAP(S3C2412_DMAREQSEL_XDREQ0),
38 .channels_rx = MAP(S3C2412_DMAREQSEL_XDREQ0),
39 }, 38 },
40 [DMACH_XD1] = { 39 [DMACH_XD1] = {
41 .name = "xdreq1", 40 .name = "xdreq1",
42 .channels = MAP(S3C2412_DMAREQSEL_XDREQ1), 41 .channels = MAP(S3C2412_DMAREQSEL_XDREQ1),
43 .channels_rx = MAP(S3C2412_DMAREQSEL_XDREQ1),
44 }, 42 },
45 [DMACH_SDI] = { 43 [DMACH_SDI] = {
46 .name = "sdi", 44 .name = "sdi",
47 .channels = MAP(S3C2412_DMAREQSEL_SDI), 45 .channels = MAP(S3C2412_DMAREQSEL_SDI),
48 .channels_rx = MAP(S3C2412_DMAREQSEL_SDI),
49 }, 46 },
50 [DMACH_SPI0] = { 47 [DMACH_SPI0_RX] = {
51 .name = "spi0", 48 .name = "spi0-rx",
49 .channels = MAP(S3C2412_DMAREQSEL_SPI0RX),
50 },
51 [DMACH_SPI0_TX] = {
52 .name = "spi0-tx",
52 .channels = MAP(S3C2412_DMAREQSEL_SPI0TX), 53 .channels = MAP(S3C2412_DMAREQSEL_SPI0TX),
53 .channels_rx = MAP(S3C2412_DMAREQSEL_SPI0RX),
54 }, 54 },
55 [DMACH_SPI1] = { 55 [DMACH_SPI1_RX] = {
56 .name = "spi1", 56 .name = "spi1-rx",
57 .channels = MAP(S3C2412_DMAREQSEL_SPI1RX),
58 },
59 [DMACH_SPI1_TX] = {
60 .name = "spi1-tx",
57 .channels = MAP(S3C2412_DMAREQSEL_SPI1TX), 61 .channels = MAP(S3C2412_DMAREQSEL_SPI1TX),
58 .channels_rx = MAP(S3C2412_DMAREQSEL_SPI1RX),
59 }, 62 },
60 [DMACH_UART0] = { 63 [DMACH_UART0] = {
61 .name = "uart0", 64 .name = "uart0",
62 .channels = MAP(S3C2412_DMAREQSEL_UART0_0), 65 .channels = MAP(S3C2412_DMAREQSEL_UART0_0),
63 .channels_rx = MAP(S3C2412_DMAREQSEL_UART0_0),
64 }, 66 },
65 [DMACH_UART1] = { 67 [DMACH_UART1] = {
66 .name = "uart1", 68 .name = "uart1",
67 .channels = MAP(S3C2412_DMAREQSEL_UART1_0), 69 .channels = MAP(S3C2412_DMAREQSEL_UART1_0),
68 .channels_rx = MAP(S3C2412_DMAREQSEL_UART1_0),
69 }, 70 },
70 [DMACH_UART2] = { 71 [DMACH_UART2] = {
71 .name = "uart2", 72 .name = "uart2",
72 .channels = MAP(S3C2412_DMAREQSEL_UART2_0), 73 .channels = MAP(S3C2412_DMAREQSEL_UART2_0),
73 .channels_rx = MAP(S3C2412_DMAREQSEL_UART2_0),
74 }, 74 },
75 [DMACH_UART0_SRC2] = { 75 [DMACH_UART0_SRC2] = {
76 .name = "uart0", 76 .name = "uart0",
77 .channels = MAP(S3C2412_DMAREQSEL_UART0_1), 77 .channels = MAP(S3C2412_DMAREQSEL_UART0_1),
78 .channels_rx = MAP(S3C2412_DMAREQSEL_UART0_1),
79 }, 78 },
80 [DMACH_UART1_SRC2] = { 79 [DMACH_UART1_SRC2] = {
81 .name = "uart1", 80 .name = "uart1",
82 .channels = MAP(S3C2412_DMAREQSEL_UART1_1), 81 .channels = MAP(S3C2412_DMAREQSEL_UART1_1),
83 .channels_rx = MAP(S3C2412_DMAREQSEL_UART1_1),
84 }, 82 },
85 [DMACH_UART2_SRC2] = { 83 [DMACH_UART2_SRC2] = {
86 .name = "uart2", 84 .name = "uart2",
87 .channels = MAP(S3C2412_DMAREQSEL_UART2_1), 85 .channels = MAP(S3C2412_DMAREQSEL_UART2_1),
88 .channels_rx = MAP(S3C2412_DMAREQSEL_UART2_1),
89 }, 86 },
90 [DMACH_TIMER] = { 87 [DMACH_TIMER] = {
91 .name = "timer", 88 .name = "timer",
92 .channels = MAP(S3C2412_DMAREQSEL_TIMER), 89 .channels = MAP(S3C2412_DMAREQSEL_TIMER),
93 .channels_rx = MAP(S3C2412_DMAREQSEL_TIMER),
94 }, 90 },
95 [DMACH_I2S_IN] = { 91 [DMACH_I2S_IN] = {
96 .name = "i2s-sdi", 92 .name = "i2s-sdi",
97 .channels = MAP(S3C2412_DMAREQSEL_I2SRX), 93 .channels = MAP(S3C2412_DMAREQSEL_I2SRX),
98 .channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX),
99 }, 94 },
100 [DMACH_I2S_OUT] = { 95 [DMACH_I2S_OUT] = {
101 .name = "i2s-sdo", 96 .name = "i2s-sdo",
102 .channels = MAP(S3C2412_DMAREQSEL_I2STX), 97 .channels = MAP(S3C2412_DMAREQSEL_I2STX),
103 .channels_rx = MAP(S3C2412_DMAREQSEL_I2STX),
104 }, 98 },
105 [DMACH_USB_EP1] = { 99 [DMACH_USB_EP1] = {
106 .name = "usb-ep1", 100 .name = "usb-ep1",
107 .channels = MAP(S3C2412_DMAREQSEL_USBEP1), 101 .channels = MAP(S3C2412_DMAREQSEL_USBEP1),
108 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP1),
109 }, 102 },
110 [DMACH_USB_EP2] = { 103 [DMACH_USB_EP2] = {
111 .name = "usb-ep2", 104 .name = "usb-ep2",
112 .channels = MAP(S3C2412_DMAREQSEL_USBEP2), 105 .channels = MAP(S3C2412_DMAREQSEL_USBEP2),
113 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP2),
114 }, 106 },
115 [DMACH_USB_EP3] = { 107 [DMACH_USB_EP3] = {
116 .name = "usb-ep3", 108 .name = "usb-ep3",
117 .channels = MAP(S3C2412_DMAREQSEL_USBEP3), 109 .channels = MAP(S3C2412_DMAREQSEL_USBEP3),
118 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP3),
119 }, 110 },
120 [DMACH_USB_EP4] = { 111 [DMACH_USB_EP4] = {
121 .name = "usb-ep4", 112 .name = "usb-ep4",
122 .channels = MAP(S3C2412_DMAREQSEL_USBEP4), 113 .channels = MAP(S3C2412_DMAREQSEL_USBEP4),
123 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP4),
124 }, 114 },
125}; 115};
126 116
127static void s3c2412_dma_direction(struct s3c2410_dma_chan *chan,
128 struct s3c24xx_dma_map *map,
129 enum dma_data_direction dir)
130{
131 unsigned long chsel;
132
133 if (dir == DMA_FROM_DEVICE)
134 chsel = map->channels_rx[0];
135 else
136 chsel = map->channels[0];
137
138 chsel &= ~DMA_CH_VALID;
139 chsel |= S3C2412_DMAREQSEL_HW;
140
141 writel(chsel, chan->regs + S3C2412_DMA_DMAREQSEL);
142}
143
144static void s3c2412_dma_select(struct s3c2410_dma_chan *chan, 117static void s3c2412_dma_select(struct s3c2410_dma_chan *chan,
145 struct s3c24xx_dma_map *map) 118 struct s3c24xx_dma_map *map)
146{ 119{
147 s3c2412_dma_direction(chan, map, chan->source); 120 unsigned long chsel = map->channels[0] & (~DMA_CH_VALID);
121 writel(chsel | S3C2412_DMAREQSEL_HW,
122 chan->regs + S3C2412_DMA_DMAREQSEL);
148} 123}
149 124
150static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = { 125static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
151 .select = s3c2412_dma_select, 126 .select = s3c2412_dma_select,
152 .direction = s3c2412_dma_direction,
153 .dcon_mask = 0, 127 .dcon_mask = 0,
154 .map = s3c2412_dma_mappings, 128 .map = s3c2412_dma_mappings,
155 .map_size = ARRAY_SIZE(s3c2412_dma_mappings), 129 .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
diff --git a/arch/arm/mach-s3c24xx/dma-s3c2443.c b/arch/arm/mach-s3c24xx/dma-s3c2443.c
index 5fe3539dc2b5..95b9f759fe97 100644
--- a/arch/arm/mach-s3c24xx/dma-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/dma-s3c2443.c
@@ -128,7 +128,8 @@ static struct s3c24xx_dma_map __initdata s3c2443_dma_mappings[] = {
128static void s3c2443_dma_select(struct s3c2410_dma_chan *chan, 128static void s3c2443_dma_select(struct s3c2410_dma_chan *chan,
129 struct s3c24xx_dma_map *map) 129 struct s3c24xx_dma_map *map)
130{ 130{
131 writel(map->channels[0] | S3C2443_DMAREQSEL_HW, 131 unsigned long chsel = map->channels[0] & (~DMA_CH_VALID);
132 writel(chsel | S3C2443_DMAREQSEL_HW,
132 chan->regs + S3C2443_DMA_DMAREQSEL); 133 chan->regs + S3C2443_DMA_DMAREQSEL);
133} 134}
134 135
diff --git a/arch/arm/mach-s3c24xx/dma.c b/arch/arm/mach-s3c24xx/dma.c
index aab64909e9a3..4a65cba3295d 100644
--- a/arch/arm/mach-s3c24xx/dma.c
+++ b/arch/arm/mach-s3c24xx/dma.c
@@ -1159,9 +1159,6 @@ int s3c2410_dma_devconfig(enum dma_ch channel,
1159 return -EINVAL; 1159 return -EINVAL;
1160 } 1160 }
1161 1161
1162 if (dma_sel.direction != NULL)
1163 (dma_sel.direction)(chan, chan->map, source);
1164
1165 return 0; 1162 return 0;
1166} 1163}
1167 1164
diff --git a/arch/arm/mach-s3c24xx/s3c2412.h b/arch/arm/mach-s3c24xx/include/mach/s3c2412.h
index 548ced42cbb7..548ced42cbb7 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.h
+++ b/arch/arm/mach-s3c24xx/include/mach/s3c2412.h
diff --git a/arch/arm/mach-s3c24xx/include/mach/uncompress.h b/arch/arm/mach-s3c24xx/include/mach/uncompress.h
index 8b283f847daa..7d2ce205dce8 100644
--- a/arch/arm/mach-s3c24xx/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c24xx/include/mach/uncompress.h
@@ -49,6 +49,9 @@ static void arch_detect_cpu(void)
49 fifo_mask = S3C2410_UFSTAT_TXMASK; 49 fifo_mask = S3C2410_UFSTAT_TXMASK;
50 fifo_max = 15 << S3C2410_UFSTAT_TXSHIFT; 50 fifo_max = 15 << S3C2410_UFSTAT_TXSHIFT;
51 } 51 }
52
53 uart_base = (volatile u8 *) S3C_PA_UART +
54 (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
52} 55}
53 56
54#endif /* __ASM_ARCH_UNCOMPRESS_H */ 57#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s3c24xx/iotiming-s3c2412.c b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
index 663436d9db01..bd064c05c473 100644
--- a/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
+++ b/arch/arm/mach-s3c24xx/iotiming-s3c2412.c
@@ -31,7 +31,7 @@
31#include <plat/cpu-freq-core.h> 31#include <plat/cpu-freq-core.h>
32#include <plat/clock.h> 32#include <plat/clock.h>
33 33
34#include "s3c2412.h" 34#include <mach/s3c2412.h>
35 35
36#define print_ns(x) ((x) / 10), ((x) % 10) 36#define print_ns(x) ((x) / 10), ((x) % 10)
37 37
diff --git a/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
new file mode 100644
index 000000000000..f50454a34f72
--- /dev/null
+++ b/arch/arm/mach-s3c24xx/mach-s3c2416-dt.c
@@ -0,0 +1,91 @@
1/*
2 * Samsung's S3C2416 flattened device tree enabled machine
3 *
4 * Copyright (c) 2012 Heiko Stuebner <heiko@sntech.de>
5 *
6 * based on mach-exynos/mach-exynos4-dt.c
7 *
8 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
9 * http://www.samsung.com
10 * Copyright (c) 2010-2011 Linaro Ltd.
11 * www.linaro.org
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 <linux/clocksource.h>
19#include <linux/irqchip.h>
20#include <linux/of_platform.h>
21#include <linux/serial_core.h>
22
23#include <asm/mach/arch.h>
24#include <mach/map.h>
25
26#include <plat/cpu.h>
27#include <plat/pm.h>
28#include <plat/regs-serial.h>
29
30#include "common.h"
31
32/*
33 * The following lookup table is used to override device names when devices
34 * are registered from device tree. This is temporarily added to enable
35 * device tree support addition for the S3C2416 architecture.
36 *
37 * For drivers that require platform data to be provided from the machine
38 * file, a platform data pointer can also be supplied along with the
39 * devices names. Usually, the platform data elements that cannot be parsed
40 * from the device tree by the drivers (example: function pointers) are
41 * supplied. But it should be noted that this is a temporary mechanism and
42 * at some point, the drivers should be capable of parsing all the platform
43 * data from the device tree.
44 */
45static const struct of_dev_auxdata s3c2416_auxdata_lookup[] __initconst = {
46 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART,
47 "s3c2440-uart.0", NULL),
48 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x4000,
49 "s3c2440-uart.1", NULL),
50 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0x8000,
51 "s3c2440-uart.2", NULL),
52 OF_DEV_AUXDATA("samsung,s3c2440-uart", S3C24XX_PA_UART + 0xC000,
53 "s3c2440-uart.3", NULL),
54 OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC0,
55 "s3c-sdhci.0", NULL),
56 OF_DEV_AUXDATA("samsung,s3c6410-sdhci", S3C_PA_HSMMC1,
57 "s3c-sdhci.1", NULL),
58 OF_DEV_AUXDATA("samsung,s3c2440-i2c", S3C_PA_IIC,
59 "s3c2440-i2c.0", NULL),
60 {},
61};
62
63static void __init s3c2416_dt_map_io(void)
64{
65 s3c24xx_init_io(NULL, 0);
66 s3c24xx_init_clocks(12000000);
67}
68
69static void __init s3c2416_dt_machine_init(void)
70{
71 of_platform_populate(NULL, of_default_bus_match_table,
72 s3c2416_auxdata_lookup, NULL);
73
74 s3c_pm_init();
75}
76
77static char const *s3c2416_dt_compat[] __initdata = {
78 "samsung,s3c2416",
79 "samsung,s3c2450",
80 NULL
81};
82
83DT_MACHINE_START(S3C2416_DT, "Samsung S3C2416 (Flattened Device Tree)")
84 /* Maintainer: Heiko Stuebner <heiko@sntech.de> */
85 .dt_compat = s3c2416_dt_compat,
86 .map_io = s3c2416_dt_map_io,
87 .init_irq = irqchip_init,
88 .init_machine = s3c2416_dt_machine_init,
89 .init_time = clocksource_of_init,
90 .restart = s3c2416_restart,
91MACHINE_END
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2410.c b/arch/arm/mach-s3c24xx/pll-s3c2410.c
index dcf3420a3271..5e37d368594b 100644
--- a/arch/arm/mach-s3c24xx/pll-s3c2410.c
+++ b/arch/arm/mach-s3c24xx/pll-s3c2410.c
@@ -33,36 +33,36 @@
33#include <plat/cpu-freq-core.h> 33#include <plat/cpu-freq-core.h>
34 34
35static struct cpufreq_frequency_table pll_vals_12MHz[] = { 35static struct cpufreq_frequency_table pll_vals_12MHz[] = {
36 { .frequency = 34000000, .index = PLLVAL(82, 2, 3), }, 36 { .frequency = 34000000, .driver_data = PLLVAL(82, 2, 3), },
37 { .frequency = 45000000, .index = PLLVAL(82, 1, 3), }, 37 { .frequency = 45000000, .driver_data = PLLVAL(82, 1, 3), },
38 { .frequency = 51000000, .index = PLLVAL(161, 3, 3), }, 38 { .frequency = 51000000, .driver_data = PLLVAL(161, 3, 3), },
39 { .frequency = 48000000, .index = PLLVAL(120, 2, 3), }, 39 { .frequency = 48000000, .driver_data = PLLVAL(120, 2, 3), },
40 { .frequency = 56000000, .index = PLLVAL(142, 2, 3), }, 40 { .frequency = 56000000, .driver_data = PLLVAL(142, 2, 3), },
41 { .frequency = 68000000, .index = PLLVAL(82, 2, 2), }, 41 { .frequency = 68000000, .driver_data = PLLVAL(82, 2, 2), },
42 { .frequency = 79000000, .index = PLLVAL(71, 1, 2), }, 42 { .frequency = 79000000, .driver_data = PLLVAL(71, 1, 2), },
43 { .frequency = 85000000, .index = PLLVAL(105, 2, 2), }, 43 { .frequency = 85000000, .driver_data = PLLVAL(105, 2, 2), },
44 { .frequency = 90000000, .index = PLLVAL(112, 2, 2), }, 44 { .frequency = 90000000, .driver_data = PLLVAL(112, 2, 2), },
45 { .frequency = 101000000, .index = PLLVAL(127, 2, 2), }, 45 { .frequency = 101000000, .driver_data = PLLVAL(127, 2, 2), },
46 { .frequency = 113000000, .index = PLLVAL(105, 1, 2), }, 46 { .frequency = 113000000, .driver_data = PLLVAL(105, 1, 2), },
47 { .frequency = 118000000, .index = PLLVAL(150, 2, 2), }, 47 { .frequency = 118000000, .driver_data = PLLVAL(150, 2, 2), },
48 { .frequency = 124000000, .index = PLLVAL(116, 1, 2), }, 48 { .frequency = 124000000, .driver_data = PLLVAL(116, 1, 2), },
49 { .frequency = 135000000, .index = PLLVAL(82, 2, 1), }, 49 { .frequency = 135000000, .driver_data = PLLVAL(82, 2, 1), },
50 { .frequency = 147000000, .index = PLLVAL(90, 2, 1), }, 50 { .frequency = 147000000, .driver_data = PLLVAL(90, 2, 1), },
51 { .frequency = 152000000, .index = PLLVAL(68, 1, 1), }, 51 { .frequency = 152000000, .driver_data = PLLVAL(68, 1, 1), },
52 { .frequency = 158000000, .index = PLLVAL(71, 1, 1), }, 52 { .frequency = 158000000, .driver_data = PLLVAL(71, 1, 1), },
53 { .frequency = 170000000, .index = PLLVAL(77, 1, 1), }, 53 { .frequency = 170000000, .driver_data = PLLVAL(77, 1, 1), },
54 { .frequency = 180000000, .index = PLLVAL(82, 1, 1), }, 54 { .frequency = 180000000, .driver_data = PLLVAL(82, 1, 1), },
55 { .frequency = 186000000, .index = PLLVAL(85, 1, 1), }, 55 { .frequency = 186000000, .driver_data = PLLVAL(85, 1, 1), },
56 { .frequency = 192000000, .index = PLLVAL(88, 1, 1), }, 56 { .frequency = 192000000, .driver_data = PLLVAL(88, 1, 1), },
57 { .frequency = 203000000, .index = PLLVAL(161, 3, 1), }, 57 { .frequency = 203000000, .driver_data = PLLVAL(161, 3, 1), },
58 58
59 /* 2410A extras */ 59 /* 2410A extras */
60 60
61 { .frequency = 210000000, .index = PLLVAL(132, 2, 1), }, 61 { .frequency = 210000000, .driver_data = PLLVAL(132, 2, 1), },
62 { .frequency = 226000000, .index = PLLVAL(105, 1, 1), }, 62 { .frequency = 226000000, .driver_data = PLLVAL(105, 1, 1), },
63 { .frequency = 266000000, .index = PLLVAL(125, 1, 1), }, 63 { .frequency = 266000000, .driver_data = PLLVAL(125, 1, 1), },
64 { .frequency = 268000000, .index = PLLVAL(126, 1, 1), }, 64 { .frequency = 268000000, .driver_data = PLLVAL(126, 1, 1), },
65 { .frequency = 270000000, .index = PLLVAL(127, 1, 1), }, 65 { .frequency = 270000000, .driver_data = PLLVAL(127, 1, 1), },
66}; 66};
67 67
68static int s3c2410_plls_add(struct device *dev, struct subsys_interface *sif) 68static int s3c2410_plls_add(struct device *dev, struct subsys_interface *sif)
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c b/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c
index 673781758319..a19460e6e7b0 100644
--- a/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c
+++ b/arch/arm/mach-s3c24xx/pll-s3c2440-12000000.c
@@ -21,33 +21,33 @@
21#include <plat/cpu-freq-core.h> 21#include <plat/cpu-freq-core.h>
22 22
23static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = { 23static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = {
24 { .frequency = 75000000, .index = PLLVAL(0x75, 3, 3), }, /* FVco 600.000000 */ 24 { .frequency = 75000000, .driver_data = PLLVAL(0x75, 3, 3), }, /* FVco 600.000000 */
25 { .frequency = 80000000, .index = PLLVAL(0x98, 4, 3), }, /* FVco 640.000000 */ 25 { .frequency = 80000000, .driver_data = PLLVAL(0x98, 4, 3), }, /* FVco 640.000000 */
26 { .frequency = 90000000, .index = PLLVAL(0x70, 2, 3), }, /* FVco 720.000000 */ 26 { .frequency = 90000000, .driver_data = PLLVAL(0x70, 2, 3), }, /* FVco 720.000000 */
27 { .frequency = 100000000, .index = PLLVAL(0x5c, 1, 3), }, /* FVco 800.000000 */ 27 { .frequency = 100000000, .driver_data = PLLVAL(0x5c, 1, 3), }, /* FVco 800.000000 */
28 { .frequency = 110000000, .index = PLLVAL(0x66, 1, 3), }, /* FVco 880.000000 */ 28 { .frequency = 110000000, .driver_data = PLLVAL(0x66, 1, 3), }, /* FVco 880.000000 */
29 { .frequency = 120000000, .index = PLLVAL(0x70, 1, 3), }, /* FVco 960.000000 */ 29 { .frequency = 120000000, .driver_data = PLLVAL(0x70, 1, 3), }, /* FVco 960.000000 */
30 { .frequency = 150000000, .index = PLLVAL(0x75, 3, 2), }, /* FVco 600.000000 */ 30 { .frequency = 150000000, .driver_data = PLLVAL(0x75, 3, 2), }, /* FVco 600.000000 */
31 { .frequency = 160000000, .index = PLLVAL(0x98, 4, 2), }, /* FVco 640.000000 */ 31 { .frequency = 160000000, .driver_data = PLLVAL(0x98, 4, 2), }, /* FVco 640.000000 */
32 { .frequency = 170000000, .index = PLLVAL(0x4d, 1, 2), }, /* FVco 680.000000 */ 32 { .frequency = 170000000, .driver_data = PLLVAL(0x4d, 1, 2), }, /* FVco 680.000000 */
33 { .frequency = 180000000, .index = PLLVAL(0x70, 2, 2), }, /* FVco 720.000000 */ 33 { .frequency = 180000000, .driver_data = PLLVAL(0x70, 2, 2), }, /* FVco 720.000000 */
34 { .frequency = 190000000, .index = PLLVAL(0x57, 1, 2), }, /* FVco 760.000000 */ 34 { .frequency = 190000000, .driver_data = PLLVAL(0x57, 1, 2), }, /* FVco 760.000000 */
35 { .frequency = 200000000, .index = PLLVAL(0x5c, 1, 2), }, /* FVco 800.000000 */ 35 { .frequency = 200000000, .driver_data = PLLVAL(0x5c, 1, 2), }, /* FVco 800.000000 */
36 { .frequency = 210000000, .index = PLLVAL(0x84, 2, 2), }, /* FVco 840.000000 */ 36 { .frequency = 210000000, .driver_data = PLLVAL(0x84, 2, 2), }, /* FVco 840.000000 */
37 { .frequency = 220000000, .index = PLLVAL(0x66, 1, 2), }, /* FVco 880.000000 */ 37 { .frequency = 220000000, .driver_data = PLLVAL(0x66, 1, 2), }, /* FVco 880.000000 */
38 { .frequency = 230000000, .index = PLLVAL(0x6b, 1, 2), }, /* FVco 920.000000 */ 38 { .frequency = 230000000, .driver_data = PLLVAL(0x6b, 1, 2), }, /* FVco 920.000000 */
39 { .frequency = 240000000, .index = PLLVAL(0x70, 1, 2), }, /* FVco 960.000000 */ 39 { .frequency = 240000000, .driver_data = PLLVAL(0x70, 1, 2), }, /* FVco 960.000000 */
40 { .frequency = 300000000, .index = PLLVAL(0x75, 3, 1), }, /* FVco 600.000000 */ 40 { .frequency = 300000000, .driver_data = PLLVAL(0x75, 3, 1), }, /* FVco 600.000000 */
41 { .frequency = 310000000, .index = PLLVAL(0x93, 4, 1), }, /* FVco 620.000000 */ 41 { .frequency = 310000000, .driver_data = PLLVAL(0x93, 4, 1), }, /* FVco 620.000000 */
42 { .frequency = 320000000, .index = PLLVAL(0x98, 4, 1), }, /* FVco 640.000000 */ 42 { .frequency = 320000000, .driver_data = PLLVAL(0x98, 4, 1), }, /* FVco 640.000000 */
43 { .frequency = 330000000, .index = PLLVAL(0x66, 2, 1), }, /* FVco 660.000000 */ 43 { .frequency = 330000000, .driver_data = PLLVAL(0x66, 2, 1), }, /* FVco 660.000000 */
44 { .frequency = 340000000, .index = PLLVAL(0x4d, 1, 1), }, /* FVco 680.000000 */ 44 { .frequency = 340000000, .driver_data = PLLVAL(0x4d, 1, 1), }, /* FVco 680.000000 */
45 { .frequency = 350000000, .index = PLLVAL(0xa7, 4, 1), }, /* FVco 700.000000 */ 45 { .frequency = 350000000, .driver_data = PLLVAL(0xa7, 4, 1), }, /* FVco 700.000000 */
46 { .frequency = 360000000, .index = PLLVAL(0x70, 2, 1), }, /* FVco 720.000000 */ 46 { .frequency = 360000000, .driver_data = PLLVAL(0x70, 2, 1), }, /* FVco 720.000000 */
47 { .frequency = 370000000, .index = PLLVAL(0xb1, 4, 1), }, /* FVco 740.000000 */ 47 { .frequency = 370000000, .driver_data = PLLVAL(0xb1, 4, 1), }, /* FVco 740.000000 */
48 { .frequency = 380000000, .index = PLLVAL(0x57, 1, 1), }, /* FVco 760.000000 */ 48 { .frequency = 380000000, .driver_data = PLLVAL(0x57, 1, 1), }, /* FVco 760.000000 */
49 { .frequency = 390000000, .index = PLLVAL(0x7a, 2, 1), }, /* FVco 780.000000 */ 49 { .frequency = 390000000, .driver_data = PLLVAL(0x7a, 2, 1), }, /* FVco 780.000000 */
50 { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */ 50 { .frequency = 400000000, .driver_data = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */
51}; 51};
52 52
53static int s3c2440_plls12_add(struct device *dev, struct subsys_interface *sif) 53static int s3c2440_plls12_add(struct device *dev, struct subsys_interface *sif)
diff --git a/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c b/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c
index debfa106289b..1191b2905625 100644
--- a/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c
+++ b/arch/arm/mach-s3c24xx/pll-s3c2440-16934400.c
@@ -21,61 +21,61 @@
21#include <plat/cpu-freq-core.h> 21#include <plat/cpu-freq-core.h>
22 22
23static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = { 23static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = {
24 { .frequency = 78019200, .index = PLLVAL(121, 5, 3), }, /* FVco 624.153600 */ 24 { .frequency = 78019200, .driver_data = PLLVAL(121, 5, 3), }, /* FVco 624.153600 */
25 { .frequency = 84067200, .index = PLLVAL(131, 5, 3), }, /* FVco 672.537600 */ 25 { .frequency = 84067200, .driver_data = PLLVAL(131, 5, 3), }, /* FVco 672.537600 */
26 { .frequency = 90115200, .index = PLLVAL(141, 5, 3), }, /* FVco 720.921600 */ 26 { .frequency = 90115200, .driver_data = PLLVAL(141, 5, 3), }, /* FVco 720.921600 */
27 { .frequency = 96163200, .index = PLLVAL(151, 5, 3), }, /* FVco 769.305600 */ 27 { .frequency = 96163200, .driver_data = PLLVAL(151, 5, 3), }, /* FVco 769.305600 */
28 { .frequency = 102135600, .index = PLLVAL(185, 6, 3), }, /* FVco 817.084800 */ 28 { .frequency = 102135600, .driver_data = PLLVAL(185, 6, 3), }, /* FVco 817.084800 */
29 { .frequency = 108259200, .index = PLLVAL(171, 5, 3), }, /* FVco 866.073600 */ 29 { .frequency = 108259200, .driver_data = PLLVAL(171, 5, 3), }, /* FVco 866.073600 */
30 { .frequency = 114307200, .index = PLLVAL(127, 3, 3), }, /* FVco 914.457600 */ 30 { .frequency = 114307200, .driver_data = PLLVAL(127, 3, 3), }, /* FVco 914.457600 */
31 { .frequency = 120234240, .index = PLLVAL(134, 3, 3), }, /* FVco 961.873920 */ 31 { .frequency = 120234240, .driver_data = PLLVAL(134, 3, 3), }, /* FVco 961.873920 */
32 { .frequency = 126161280, .index = PLLVAL(141, 3, 3), }, /* FVco 1009.290240 */ 32 { .frequency = 126161280, .driver_data = PLLVAL(141, 3, 3), }, /* FVco 1009.290240 */
33 { .frequency = 132088320, .index = PLLVAL(148, 3, 3), }, /* FVco 1056.706560 */ 33 { .frequency = 132088320, .driver_data = PLLVAL(148, 3, 3), }, /* FVco 1056.706560 */
34 { .frequency = 138015360, .index = PLLVAL(155, 3, 3), }, /* FVco 1104.122880 */ 34 { .frequency = 138015360, .driver_data = PLLVAL(155, 3, 3), }, /* FVco 1104.122880 */
35 { .frequency = 144789120, .index = PLLVAL(163, 3, 3), }, /* FVco 1158.312960 */ 35 { .frequency = 144789120, .driver_data = PLLVAL(163, 3, 3), }, /* FVco 1158.312960 */
36 { .frequency = 150100363, .index = PLLVAL(187, 9, 2), }, /* FVco 600.401454 */ 36 { .frequency = 150100363, .driver_data = PLLVAL(187, 9, 2), }, /* FVco 600.401454 */
37 { .frequency = 156038400, .index = PLLVAL(121, 5, 2), }, /* FVco 624.153600 */ 37 { .frequency = 156038400, .driver_data = PLLVAL(121, 5, 2), }, /* FVco 624.153600 */
38 { .frequency = 162086400, .index = PLLVAL(126, 5, 2), }, /* FVco 648.345600 */ 38 { .frequency = 162086400, .driver_data = PLLVAL(126, 5, 2), }, /* FVco 648.345600 */
39 { .frequency = 168134400, .index = PLLVAL(131, 5, 2), }, /* FVco 672.537600 */ 39 { .frequency = 168134400, .driver_data = PLLVAL(131, 5, 2), }, /* FVco 672.537600 */
40 { .frequency = 174048000, .index = PLLVAL(177, 7, 2), }, /* FVco 696.192000 */ 40 { .frequency = 174048000, .driver_data = PLLVAL(177, 7, 2), }, /* FVco 696.192000 */
41 { .frequency = 180230400, .index = PLLVAL(141, 5, 2), }, /* FVco 720.921600 */ 41 { .frequency = 180230400, .driver_data = PLLVAL(141, 5, 2), }, /* FVco 720.921600 */
42 { .frequency = 186278400, .index = PLLVAL(124, 4, 2), }, /* FVco 745.113600 */ 42 { .frequency = 186278400, .driver_data = PLLVAL(124, 4, 2), }, /* FVco 745.113600 */
43 { .frequency = 192326400, .index = PLLVAL(151, 5, 2), }, /* FVco 769.305600 */ 43 { .frequency = 192326400, .driver_data = PLLVAL(151, 5, 2), }, /* FVco 769.305600 */
44 { .frequency = 198132480, .index = PLLVAL(109, 3, 2), }, /* FVco 792.529920 */ 44 { .frequency = 198132480, .driver_data = PLLVAL(109, 3, 2), }, /* FVco 792.529920 */
45 { .frequency = 204271200, .index = PLLVAL(185, 6, 2), }, /* FVco 817.084800 */ 45 { .frequency = 204271200, .driver_data = PLLVAL(185, 6, 2), }, /* FVco 817.084800 */
46 { .frequency = 210268800, .index = PLLVAL(141, 4, 2), }, /* FVco 841.075200 */ 46 { .frequency = 210268800, .driver_data = PLLVAL(141, 4, 2), }, /* FVco 841.075200 */
47 { .frequency = 216518400, .index = PLLVAL(171, 5, 2), }, /* FVco 866.073600 */ 47 { .frequency = 216518400, .driver_data = PLLVAL(171, 5, 2), }, /* FVco 866.073600 */
48 { .frequency = 222264000, .index = PLLVAL(97, 2, 2), }, /* FVco 889.056000 */ 48 { .frequency = 222264000, .driver_data = PLLVAL(97, 2, 2), }, /* FVco 889.056000 */
49 { .frequency = 228614400, .index = PLLVAL(127, 3, 2), }, /* FVco 914.457600 */ 49 { .frequency = 228614400, .driver_data = PLLVAL(127, 3, 2), }, /* FVco 914.457600 */
50 { .frequency = 234259200, .index = PLLVAL(158, 4, 2), }, /* FVco 937.036800 */ 50 { .frequency = 234259200, .driver_data = PLLVAL(158, 4, 2), }, /* FVco 937.036800 */
51 { .frequency = 240468480, .index = PLLVAL(134, 3, 2), }, /* FVco 961.873920 */ 51 { .frequency = 240468480, .driver_data = PLLVAL(134, 3, 2), }, /* FVco 961.873920 */
52 { .frequency = 246960000, .index = PLLVAL(167, 4, 2), }, /* FVco 987.840000 */ 52 { .frequency = 246960000, .driver_data = PLLVAL(167, 4, 2), }, /* FVco 987.840000 */
53 { .frequency = 252322560, .index = PLLVAL(141, 3, 2), }, /* FVco 1009.290240 */ 53 { .frequency = 252322560, .driver_data = PLLVAL(141, 3, 2), }, /* FVco 1009.290240 */
54 { .frequency = 258249600, .index = PLLVAL(114, 2, 2), }, /* FVco 1032.998400 */ 54 { .frequency = 258249600, .driver_data = PLLVAL(114, 2, 2), }, /* FVco 1032.998400 */
55 { .frequency = 264176640, .index = PLLVAL(148, 3, 2), }, /* FVco 1056.706560 */ 55 { .frequency = 264176640, .driver_data = PLLVAL(148, 3, 2), }, /* FVco 1056.706560 */
56 { .frequency = 270950400, .index = PLLVAL(120, 2, 2), }, /* FVco 1083.801600 */ 56 { .frequency = 270950400, .driver_data = PLLVAL(120, 2, 2), }, /* FVco 1083.801600 */
57 { .frequency = 276030720, .index = PLLVAL(155, 3, 2), }, /* FVco 1104.122880 */ 57 { .frequency = 276030720, .driver_data = PLLVAL(155, 3, 2), }, /* FVco 1104.122880 */
58 { .frequency = 282240000, .index = PLLVAL(92, 1, 2), }, /* FVco 1128.960000 */ 58 { .frequency = 282240000, .driver_data = PLLVAL(92, 1, 2), }, /* FVco 1128.960000 */
59 { .frequency = 289578240, .index = PLLVAL(163, 3, 2), }, /* FVco 1158.312960 */ 59 { .frequency = 289578240, .driver_data = PLLVAL(163, 3, 2), }, /* FVco 1158.312960 */
60 { .frequency = 294235200, .index = PLLVAL(131, 2, 2), }, /* FVco 1176.940800 */ 60 { .frequency = 294235200, .driver_data = PLLVAL(131, 2, 2), }, /* FVco 1176.940800 */
61 { .frequency = 300200727, .index = PLLVAL(187, 9, 1), }, /* FVco 600.401454 */ 61 { .frequency = 300200727, .driver_data = PLLVAL(187, 9, 1), }, /* FVco 600.401454 */
62 { .frequency = 306358690, .index = PLLVAL(191, 9, 1), }, /* FVco 612.717380 */ 62 { .frequency = 306358690, .driver_data = PLLVAL(191, 9, 1), }, /* FVco 612.717380 */
63 { .frequency = 312076800, .index = PLLVAL(121, 5, 1), }, /* FVco 624.153600 */ 63 { .frequency = 312076800, .driver_data = PLLVAL(121, 5, 1), }, /* FVco 624.153600 */
64 { .frequency = 318366720, .index = PLLVAL(86, 3, 1), }, /* FVco 636.733440 */ 64 { .frequency = 318366720, .driver_data = PLLVAL(86, 3, 1), }, /* FVco 636.733440 */
65 { .frequency = 324172800, .index = PLLVAL(126, 5, 1), }, /* FVco 648.345600 */ 65 { .frequency = 324172800, .driver_data = PLLVAL(126, 5, 1), }, /* FVco 648.345600 */
66 { .frequency = 330220800, .index = PLLVAL(109, 4, 1), }, /* FVco 660.441600 */ 66 { .frequency = 330220800, .driver_data = PLLVAL(109, 4, 1), }, /* FVco 660.441600 */
67 { .frequency = 336268800, .index = PLLVAL(131, 5, 1), }, /* FVco 672.537600 */ 67 { .frequency = 336268800, .driver_data = PLLVAL(131, 5, 1), }, /* FVco 672.537600 */
68 { .frequency = 342074880, .index = PLLVAL(93, 3, 1), }, /* FVco 684.149760 */ 68 { .frequency = 342074880, .driver_data = PLLVAL(93, 3, 1), }, /* FVco 684.149760 */
69 { .frequency = 348096000, .index = PLLVAL(177, 7, 1), }, /* FVco 696.192000 */ 69 { .frequency = 348096000, .driver_data = PLLVAL(177, 7, 1), }, /* FVco 696.192000 */
70 { .frequency = 355622400, .index = PLLVAL(118, 4, 1), }, /* FVco 711.244800 */ 70 { .frequency = 355622400, .driver_data = PLLVAL(118, 4, 1), }, /* FVco 711.244800 */
71 { .frequency = 360460800, .index = PLLVAL(141, 5, 1), }, /* FVco 720.921600 */ 71 { .frequency = 360460800, .driver_data = PLLVAL(141, 5, 1), }, /* FVco 720.921600 */
72 { .frequency = 366206400, .index = PLLVAL(165, 6, 1), }, /* FVco 732.412800 */ 72 { .frequency = 366206400, .driver_data = PLLVAL(165, 6, 1), }, /* FVco 732.412800 */
73 { .frequency = 372556800, .index = PLLVAL(124, 4, 1), }, /* FVco 745.113600 */ 73 { .frequency = 372556800, .driver_data = PLLVAL(124, 4, 1), }, /* FVco 745.113600 */
74 { .frequency = 378201600, .index = PLLVAL(126, 4, 1), }, /* FVco 756.403200 */ 74 { .frequency = 378201600, .driver_data = PLLVAL(126, 4, 1), }, /* FVco 756.403200 */
75 { .frequency = 384652800, .index = PLLVAL(151, 5, 1), }, /* FVco 769.305600 */ 75 { .frequency = 384652800, .driver_data = PLLVAL(151, 5, 1), }, /* FVco 769.305600 */
76 { .frequency = 391608000, .index = PLLVAL(177, 6, 1), }, /* FVco 783.216000 */ 76 { .frequency = 391608000, .driver_data = PLLVAL(177, 6, 1), }, /* FVco 783.216000 */
77 { .frequency = 396264960, .index = PLLVAL(109, 3, 1), }, /* FVco 792.529920 */ 77 { .frequency = 396264960, .driver_data = PLLVAL(109, 3, 1), }, /* FVco 792.529920 */
78 { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */ 78 { .frequency = 402192000, .driver_data = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */
79}; 79};
80 80
81static int s3c2440_plls169344_add(struct device *dev, 81static int s3c2440_plls169344_add(struct device *dev,
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index d850ea5adac2..ff384acc65b2 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -138,6 +138,7 @@ void __init s3c2410_init_clocks(int xtal)
138 s3c2410_baseclk_add(); 138 s3c2410_baseclk_add();
139 s3c24xx_register_clock(&s3c2410_armclk); 139 s3c24xx_register_clock(&s3c2410_armclk);
140 clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup)); 140 clkdev_add_table(s3c2410_clk_lookup, ARRAY_SIZE(s3c2410_clk_lookup));
141 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
141} 142}
142 143
143struct bus_type s3c2410_subsys = { 144struct bus_type s3c2410_subsys = {
@@ -201,7 +202,7 @@ void s3c2410_restart(char mode, const char *cmd)
201 soft_restart(0); 202 soft_restart(0);
202 } 203 }
203 204
204 arch_wdt_reset(); 205 samsung_wdt_reset();
205 206
206 /* we'll take a jump through zero as a poor second */ 207 /* we'll take a jump through zero as a poor second */
207 soft_restart(0); 208 soft_restart(0);
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index 2a35edb67354..d0423e2544c1 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -133,6 +133,7 @@ void __init s3c244x_init_clocks(int xtal)
133 s3c24xx_register_baseclocks(xtal); 133 s3c24xx_register_baseclocks(xtal);
134 s3c244x_setup_clocks(); 134 s3c244x_setup_clocks();
135 s3c2410_baseclk_add(); 135 s3c2410_baseclk_add();
136 samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
136} 137}
137 138
138/* Since the S3C2442 and S3C2440 share items, put both subsystems here */ 139/* Since the S3C2442 and S3C2440 share items, put both subsystems here */
@@ -202,7 +203,7 @@ void s3c244x_restart(char mode, const char *cmd)
202 if (mode == 's') 203 if (mode == 's')
203 soft_restart(0); 204 soft_restart(0);
204 205
205 arch_wdt_reset(); 206 samsung_wdt_reset();
206 207
207 /* we'll take a jump through zero as a poor second */ 208 /* we'll take a jump through zero as a poor second */
208 soft_restart(0); 209 soft_restart(0);
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 0b9c0ba44834..1aed6f4be1ce 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -183,6 +183,12 @@ core_initcall(s3c64xx_dev_init);
183 183
184void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid) 184void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
185{ 185{
186 /*
187 * FIXME: there is no better place to put this at the moment
188 * (samsung_wdt_reset_init needs clocks)
189 */
190 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
191
186 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__); 192 printk(KERN_DEBUG "%s: initialising interrupts\n", __func__);
187 193
188 /* initialise the pair of VICs */ 194 /* initialise the pair of VICs */
@@ -378,7 +384,7 @@ arch_initcall(s3c64xx_init_irq_eint);
378void s3c64xx_restart(char mode, const char *cmd) 384void s3c64xx_restart(char mode, const char *cmd)
379{ 385{
380 if (mode != 's') 386 if (mode != 's')
381 arch_wdt_reset(); 387 samsung_wdt_reset();
382 388
383 /* if all else fails, or mode was for soft, jump to 0 */ 389 /* if all else fails, or mode was for soft, jump to 0 */
384 soft_restart(0); 390 soft_restart(0);
diff --git a/arch/arm/mach-s3c64xx/include/mach/uncompress.h b/arch/arm/mach-s3c64xx/include/mach/uncompress.h
index c6a82a20bf2a..1c956738b42d 100644
--- a/arch/arm/mach-s3c64xx/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c64xx/include/mach/uncompress.h
@@ -23,6 +23,9 @@ static void arch_detect_cpu(void)
23 /* we do not need to do any cpu detection here at the moment. */ 23 /* we do not need to do any cpu detection here at the moment. */
24 fifo_mask = S3C2440_UFSTAT_TXMASK; 24 fifo_mask = S3C2440_UFSTAT_TXMASK;
25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT; 25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
26
27 uart_base = (volatile u8 *)S3C_PA_UART +
28 (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
26} 29}
27 30
28#endif /* __ASM_ARCH_UNCOMPRESS_H */ 31#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 8ae5800e807f..76d0053bf564 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -173,6 +173,8 @@ void __init s5p64x0_init_io(struct map_desc *mach_desc, int size)
173 s5p_init_cpu(S5P64X0_SYS_ID); 173 s5p_init_cpu(S5P64X0_SYS_ID);
174 174
175 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); 175 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
176 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
177
176} 178}
177 179
178void __init s5p6440_map_io(void) 180void __init s5p6440_map_io(void)
@@ -440,7 +442,7 @@ arch_initcall(s5p64x0_init_irq_eint);
440void s5p64x0_restart(char mode, const char *cmd) 442void s5p64x0_restart(char mode, const char *cmd)
441{ 443{
442 if (mode != 's') 444 if (mode != 's')
443 arch_wdt_reset(); 445 samsung_wdt_reset();
444 446
445 soft_restart(0); 447 soft_restart(0);
446} 448}
diff --git a/arch/arm/mach-s5p64x0/include/mach/uncompress.h b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
index 19e0d64d78c5..bbcc3f669ee3 100644
--- a/arch/arm/mach-s5p64x0/include/mach/uncompress.h
+++ b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
@@ -14,171 +14,21 @@
14#define __ASM_ARCH_UNCOMPRESS_H 14#define __ASM_ARCH_UNCOMPRESS_H
15 15
16#include <mach/map.h> 16#include <mach/map.h>
17#include <plat/uncompress.h>
17 18
18/* 19static void arch_detect_cpu(void)
19 * cannot use commonly <plat/uncompress.h>
20 * because uart base of S5P6440 and S5P6450 is different
21 */
22
23typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
24
25/* uart setup */
26
27unsigned int fifo_mask;
28unsigned int fifo_max;
29
30/* forward declerations */
31
32static void arch_detect_cpu(void);
33
34/* defines for UART registers */
35
36#include <plat/regs-serial.h>
37#include <plat/regs-watchdog.h>
38
39/* working in physical space... */
40#undef S3C2410_WDOGREG
41#define S3C2410_WDOGREG(x) ((S3C24XX_PA_WATCHDOG + (x)))
42
43/* how many bytes we allow into the FIFO at a time in FIFO mode */
44#define FIFO_MAX (14)
45
46unsigned long uart_base;
47
48static __inline__ void get_uart_base(void)
49{ 20{
50 unsigned int chipid; 21 unsigned int chipid;
51 22
52 chipid = *(const volatile unsigned int __force *) 0xE0100118; 23 chipid = *(const volatile unsigned int __force *) 0xE0100118;
53 24
54 uart_base = S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT;
55
56 if ((chipid & 0xff000) == 0x50000) 25 if ((chipid & 0xff000) == 0x50000)
57 uart_base += 0xEC800000; 26 uart_base = (volatile u8 *)S5P6450_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
58 else 27 else
59 uart_base += 0xEC000000; 28 uart_base = (volatile u8 *)S5P6440_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
60}
61
62static __inline__ void uart_wr(unsigned int reg, unsigned int val)
63{
64 volatile unsigned int *ptr;
65
66 get_uart_base();
67 ptr = (volatile unsigned int *)(reg + uart_base);
68 *ptr = val;
69}
70
71static __inline__ unsigned int uart_rd(unsigned int reg)
72{
73 volatile unsigned int *ptr;
74
75 get_uart_base();
76 ptr = (volatile unsigned int *)(reg + uart_base);
77 return *ptr;
78}
79
80/*
81 * we can deal with the case the UARTs are being run
82 * in FIFO mode, so that we don't hold up our execution
83 * waiting for tx to happen...
84 */
85
86static void putc(int ch)
87{
88 if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
89 int level;
90
91 while (1) {
92 level = uart_rd(S3C2410_UFSTAT);
93 level &= fifo_mask;
94
95 if (level < fifo_max)
96 break;
97 }
98
99 } else {
100 /* not using fifos */
101
102 while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE)
103 barrier();
104 }
105 29
106 /* write byte to transmission register */ 30 fifo_mask = S3C2440_UFSTAT_TXMASK;
107 uart_wr(S3C2410_UTXH, ch); 31 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
108}
109
110static inline void flush(void)
111{
112}
113
114#define __raw_writel(d, ad) \
115 do { \
116 *((volatile unsigned int __force *)(ad)) = (d); \
117 } while (0)
118
119
120#ifdef CONFIG_S3C_BOOT_ERROR_RESET
121
122static void arch_decomp_error(const char *x)
123{
124 putstr("\n\n");
125 putstr(x);
126 putstr("\n\n -- System resetting\n");
127
128 __raw_writel(0x4000, S3C2410_WTDAT);
129 __raw_writel(0x4000, S3C2410_WTCNT);
130 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
131
132 while(1);
133}
134
135#define arch_error arch_decomp_error
136#endif
137
138#ifdef CONFIG_S3C_BOOT_UART_FORCE_FIFO
139static inline void arch_enable_uart_fifo(void)
140{
141 u32 fifocon = uart_rd(S3C2410_UFCON);
142
143 if (!(fifocon & S3C2410_UFCON_FIFOMODE)) {
144 fifocon |= S3C2410_UFCON_RESETBOTH;
145 uart_wr(S3C2410_UFCON, fifocon);
146
147 /* wait for fifo reset to complete */
148 while (1) {
149 fifocon = uart_rd(S3C2410_UFCON);
150 if (!(fifocon & S3C2410_UFCON_RESETBOTH))
151 break;
152 }
153 }
154}
155#else
156#define arch_enable_uart_fifo() do { } while(0)
157#endif
158
159static void arch_decomp_setup(void)
160{
161 /*
162 * we may need to setup the uart(s) here if we are not running
163 * on an BAST... the BAST will have left the uarts configured
164 * after calling linux.
165 */
166
167 arch_detect_cpu();
168
169 /*
170 * Enable the UART FIFOs if they where not enabled and our
171 * configuration says we should turn them on.
172 */
173
174 arch_enable_uart_fifo();
175}
176
177
178
179static void arch_detect_cpu(void)
180{
181 /* we do not need to do any cpu detection here at the moment. */
182} 32}
183 33
184#endif /* __ASM_ARCH_UNCOMPRESS_H */ 34#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index cc6e561c9958..511031564d35 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -178,6 +178,7 @@ void __init s5pc100_init_clocks(int xtal)
178 s5p_register_clocks(xtal); 178 s5p_register_clocks(xtal);
179 s5pc100_register_clocks(); 179 s5pc100_register_clocks();
180 s5pc100_setup_clocks(); 180 s5pc100_setup_clocks();
181 samsung_wdt_reset_init(S3C_VA_WATCHDOG);
181} 182}
182 183
183void __init s5pc100_init_irq(void) 184void __init s5pc100_init_irq(void)
@@ -219,7 +220,7 @@ void __init s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no)
219void s5pc100_restart(char mode, const char *cmd) 220void s5pc100_restart(char mode, const char *cmd)
220{ 221{
221 if (mode != 's') 222 if (mode != 's')
222 arch_wdt_reset(); 223 samsung_wdt_reset();
223 224
224 soft_restart(0); 225 soft_restart(0);
225} 226}
diff --git a/arch/arm/mach-s5pc100/include/mach/uncompress.h b/arch/arm/mach-s5pc100/include/mach/uncompress.h
index 01ccf535e76c..720e1339425c 100644
--- a/arch/arm/mach-s5pc100/include/mach/uncompress.h
+++ b/arch/arm/mach-s5pc100/include/mach/uncompress.h
@@ -23,6 +23,8 @@ static void arch_detect_cpu(void)
23 /* we do not need to do any cpu detection here at the moment. */ 23 /* we do not need to do any cpu detection here at the moment. */
24 fifo_mask = S3C2440_UFSTAT_TXMASK; 24 fifo_mask = S3C2440_UFSTAT_TXMASK;
25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT; 25 fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
26
27 uart_base = (volatile u8 *)S5P_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
26} 28}
27 29
28#endif /* __ASM_ARCH_UNCOMPRESS_H */ 30#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/uncompress.h b/arch/arm/mach-s5pv210/include/mach/uncompress.h
index ef977ea8546d..231cb07de058 100644
--- a/arch/arm/mach-s5pv210/include/mach/uncompress.h
+++ b/arch/arm/mach-s5pv210/include/mach/uncompress.h
@@ -21,6 +21,8 @@ static void arch_detect_cpu(void)
21 /* we do not need to do any cpu detection here at the moment. */ 21 /* we do not need to do any cpu detection here at the moment. */
22 fifo_mask = S5PV210_UFSTAT_TXMASK; 22 fifo_mask = S5PV210_UFSTAT_TXMASK;
23 fifo_max = 63 << S5PV210_UFSTAT_TXSHIFT; 23 fifo_max = 63 << S5PV210_UFSTAT_TXSHIFT;
24
25 uart_base = (volatile u8 *)S5P_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
24} 26}
25 27
26#endif /* __ASM_ARCH_UNCOMPRESS_H */ 28#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 1a517e2fe449..3912ce91fee4 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -23,7 +23,7 @@ config ARCH_R8A73A4
23 select ARCH_WANT_OPTIONAL_GPIOLIB 23 select ARCH_WANT_OPTIONAL_GPIOLIB
24 select ARM_GIC 24 select ARM_GIC
25 select CPU_V7 25 select CPU_V7
26 select ARM_ARCH_TIMER 26 select HAVE_ARM_ARCH_TIMER
27 select SH_CLK_CPG 27 select SH_CLK_CPG
28 select RENESAS_IRQC 28 select RENESAS_IRQC
29 29
@@ -36,10 +36,13 @@ config ARCH_R8A7740
36 select RENESAS_INTC_IRQPIN 36 select RENESAS_INTC_IRQPIN
37 37
38config ARCH_R8A7778 38config ARCH_R8A7778
39 bool "R-Car M1 (R8A77780)" 39 bool "R-Car M1A (R8A77781)"
40 select ARCH_WANT_OPTIONAL_GPIOLIB
40 select CPU_V7 41 select CPU_V7
41 select SH_CLK_CPG 42 select SH_CLK_CPG
42 select ARM_GIC 43 select ARM_GIC
44 select USB_ARCH_HAS_EHCI
45 select USB_ARCH_HAS_OHCI
43 46
44config ARCH_R8A7779 47config ARCH_R8A7779
45 bool "R-Car H1 (R8A77790)" 48 bool "R-Car H1 (R8A77790)"
@@ -56,7 +59,7 @@ config ARCH_R8A7790
56 select ARCH_WANT_OPTIONAL_GPIOLIB 59 select ARCH_WANT_OPTIONAL_GPIOLIB
57 select ARM_GIC 60 select ARM_GIC
58 select CPU_V7 61 select CPU_V7
59 select ARM_ARCH_TIMER 62 select HAVE_ARM_ARCH_TIMER
60 select SH_CLK_CPG 63 select SH_CLK_CPG
61 select RENESAS_IRQC 64 select RENESAS_IRQC
62 65
@@ -68,27 +71,6 @@ config ARCH_EMEV2
68 71
69comment "SH-Mobile Board Type" 72comment "SH-Mobile Board Type"
70 73
71config MACH_AP4EVB
72 bool "AP4EVB board"
73 depends on ARCH_SH7372
74 select ARCH_REQUIRE_GPIOLIB
75 select REGULATOR_FIXED_VOLTAGE if REGULATOR
76 select SH_LCD_MIPI_DSI
77 select SND_SOC_AK4642 if SND_SIMPLE_CARD
78
79choice
80 prompt "AP4EVB LCD panel selection"
81 default AP4EVB_QHD
82 depends on MACH_AP4EVB
83
84config AP4EVB_QHD
85 bool "MIPI-DSI QHD (960x540)"
86
87config AP4EVB_WVGA
88 bool "Parallel WVGA (800x480)"
89
90endchoice
91
92config MACH_AG5EVM 74config MACH_AG5EVM
93 bool "AG5EVM board" 75 bool "AG5EVM board"
94 depends on ARCH_SH73A0 76 depends on ARCH_SH73A0
@@ -115,19 +97,27 @@ config MACH_KOTA2
115 select ARCH_REQUIRE_GPIOLIB 97 select ARCH_REQUIRE_GPIOLIB
116 select REGULATOR_FIXED_VOLTAGE if REGULATOR 98 select REGULATOR_FIXED_VOLTAGE if REGULATOR
117 99
118config MACH_BONITO 100config MACH_ARMADILLO800EVA
119 bool "bonito board" 101 bool "Armadillo-800 EVA board"
120 depends on ARCH_R8A7740 102 depends on ARCH_R8A7740
121 select ARCH_REQUIRE_GPIOLIB 103 select ARCH_REQUIRE_GPIOLIB
122 select REGULATOR_FIXED_VOLTAGE if REGULATOR 104 select REGULATOR_FIXED_VOLTAGE if REGULATOR
105 select SND_SOC_WM8978 if SND_SIMPLE_CARD
106 select USE_OF
123 107
124config MACH_ARMADILLO800EVA 108config MACH_ARMADILLO800EVA_REFERENCE
125 bool "Armadillo-800 EVA board" 109 bool "Armadillo-800 EVA board - Reference Device Tree Implementation"
126 depends on ARCH_R8A7740 110 depends on ARCH_R8A7740
127 select ARCH_REQUIRE_GPIOLIB 111 select ARCH_REQUIRE_GPIOLIB
128 select REGULATOR_FIXED_VOLTAGE if REGULATOR 112 select REGULATOR_FIXED_VOLTAGE if REGULATOR
129 select SND_SOC_WM8978 if SND_SIMPLE_CARD 113 select SND_SOC_WM8978 if SND_SIMPLE_CARD
130 select USE_OF 114 select USE_OF
115 ---help---
116 Use reference implementation of Aramdillo800 EVA board support
117 which makes a greater use of device tree at the expense
118 of not supporting a number of devices.
119
120 This is intended to aid developers
131 121
132config MACH_BOCKW 122config MACH_BOCKW
133 bool "BOCK-W platform" 123 bool "BOCK-W platform"
@@ -169,6 +159,8 @@ config MACH_KZM9D
169config MACH_KZM9G 159config MACH_KZM9G
170 bool "KZM-A9-GT board" 160 bool "KZM-A9-GT board"
171 depends on ARCH_SH73A0 161 depends on ARCH_SH73A0
162 select ARCH_HAS_CPUFREQ
163 select ARCH_HAS_OPP
172 select ARCH_REQUIRE_GPIOLIB 164 select ARCH_REQUIRE_GPIOLIB
173 select REGULATOR_FIXED_VOLTAGE if REGULATOR 165 select REGULATOR_FIXED_VOLTAGE if REGULATOR
174 select SND_SOC_AK4642 if SND_SIMPLE_CARD 166 select SND_SOC_AK4642 if SND_SIMPLE_CARD
@@ -194,37 +186,6 @@ config CPU_HAS_INTEVT
194 bool 186 bool
195 default y 187 default y
196 188
197menu "Memory configuration"
198
199config MEMORY_START
200 hex "Physical memory start address"
201 default "0x40000000" if MACH_AP4EVB || MACH_AG5EVM || \
202 MACH_MACKEREL || MACH_BONITO || \
203 MACH_ARMADILLO800EVA || MACH_APE6EVM || \
204 MACH_LAGER
205 default "0x41000000" if MACH_KOTA2
206 default "0x00000000"
207 ---help---
208 Tweak this only when porting to a new machine which does not
209 already have a defconfig. Changing it from the known correct
210 value on any of the known systems will only lead to disaster.
211
212config MEMORY_SIZE
213 hex "Physical memory size"
214 default "0x80000000" if MACH_LAGER
215 default "0x40000000" if MACH_APE6EVM
216 default "0x20000000" if MACH_AG5EVM || MACH_BONITO || \
217 MACH_ARMADILLO800EVA
218 default "0x1e000000" if MACH_KOTA2
219 default "0x10000000" if MACH_AP4EVB || MACH_MACKEREL
220 default "0x04000000"
221 help
222 This sets the default memory size assumed by your kernel. It can
223 be overridden as normal by the 'mem=' argument on the kernel command
224 line.
225
226endmenu
227
228menu "Timer and clock configuration" 189menu "Timer and clock configuration"
229 190
230config SHMOBILE_TIMER_HZ 191config SHMOBILE_TIMER_HZ
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 068f1dadc46b..6165a517f580 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -35,17 +35,16 @@ obj-$(CONFIG_ARCH_R8A7779) += pm-r8a7779.o
35obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o 35obj-$(CONFIG_ARCH_SH73A0) += pm-sh73a0.o
36 36
37# Board objects 37# Board objects
38obj-$(CONFIG_MACH_AP4EVB) += board-ap4evb.o
39obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o 38obj-$(CONFIG_MACH_AG5EVM) += board-ag5evm.o
40obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o 39obj-$(CONFIG_MACH_APE6EVM) += board-ape6evm.o
41obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o 40obj-$(CONFIG_MACH_MACKEREL) += board-mackerel.o
42obj-$(CONFIG_MACH_KOTA2) += board-kota2.o 41obj-$(CONFIG_MACH_KOTA2) += board-kota2.o
43obj-$(CONFIG_MACH_BONITO) += board-bonito.o
44obj-$(CONFIG_MACH_BOCKW) += board-bockw.o 42obj-$(CONFIG_MACH_BOCKW) += board-bockw.o
45obj-$(CONFIG_MACH_MARZEN) += board-marzen.o 43obj-$(CONFIG_MACH_MARZEN) += board-marzen.o
46obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o 44obj-$(CONFIG_MACH_MARZEN_REFERENCE) += board-marzen-reference.o
47obj-$(CONFIG_MACH_LAGER) += board-lager.o 45obj-$(CONFIG_MACH_LAGER) += board-lager.o
48obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o 46obj-$(CONFIG_MACH_ARMADILLO800EVA) += board-armadillo800eva.o
47obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += board-armadillo800eva-reference.o
49obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o 48obj-$(CONFIG_MACH_KZM9D) += board-kzm9d.o
50obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o 49obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o
51obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o 50obj-$(CONFIG_MACH_KZM9G_REFERENCE) += board-kzm9g-reference.o
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 498efd99338d..84c6868580f0 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -1,6 +1,20 @@
1__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \ 1# per-board load address for uImage
2 $$[$(CONFIG_MEMORY_START) + 0x8000]') 2loadaddr-y :=
3loadaddr-$(CONFIG_MACH_AG5EVM) += 0x40008000
4loadaddr-$(CONFIG_MACH_APE6EVM) += 0x40008000
5loadaddr-$(CONFIG_MACH_ARMADILLO800EVA) += 0x40008000
6loadaddr-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE) += 0x40008000
7loadaddr-$(CONFIG_MACH_BOCKW) += 0x60008000
8loadaddr-$(CONFIG_MACH_KOTA2) += 0x41008000
9loadaddr-$(CONFIG_MACH_KZM9D) += 0x40008000
10loadaddr-$(CONFIG_MACH_KZM9G) += 0x41008000
11loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
12loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
13loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
14loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
15loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
3 16
17__ZRELADDR := $(sort $(loadaddr-y))
4 zreladdr-y += $(__ZRELADDR) 18 zreladdr-y += $(__ZRELADDR)
5 19
6# Unsupported legacy stuff 20# Unsupported legacy stuff
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
deleted file mode 100644
index 45f78cadec1d..000000000000
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ /dev/null
@@ -1,1332 +0,0 @@
1/*
2 * AP4EVB board support
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/clk.h>
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/interrupt.h>
24#include <linux/irq.h>
25#include <linux/platform_device.h>
26#include <linux/delay.h>
27#include <linux/mfd/tmio.h>
28#include <linux/mmc/host.h>
29#include <linux/mmc/sh_mobile_sdhi.h>
30#include <linux/mtd/mtd.h>
31#include <linux/mtd/partitions.h>
32#include <linux/mtd/physmap.h>
33#include <linux/mmc/sh_mmcif.h>
34#include <linux/i2c.h>
35#include <linux/i2c/tsc2007.h>
36#include <linux/io.h>
37#include <linux/pinctrl/machine.h>
38#include <linux/regulator/fixed.h>
39#include <linux/regulator/machine.h>
40#include <linux/smsc911x.h>
41#include <linux/sh_intc.h>
42#include <linux/sh_clk.h>
43#include <linux/gpio.h>
44#include <linux/input.h>
45#include <linux/leds.h>
46#include <linux/input/sh_keysc.h>
47#include <linux/usb/r8a66597.h>
48#include <linux/pm_clock.h>
49#include <linux/dma-mapping.h>
50
51#include <media/sh_mobile_ceu.h>
52#include <media/sh_mobile_csi2.h>
53#include <media/soc_camera.h>
54
55#include <sound/sh_fsi.h>
56#include <sound/simple_card.h>
57
58#include <video/sh_mobile_hdmi.h>
59#include <video/sh_mobile_lcdc.h>
60#include <video/sh_mipi_dsi.h>
61
62#include <mach/common.h>
63#include <mach/irqs.h>
64#include <mach/sh7372.h>
65
66#include <asm/mach-types.h>
67#include <asm/mach/arch.h>
68#include <asm/setup.h>
69
70#include "sh-gpio.h"
71
72/*
73 * Address Interface BusWidth note
74 * ------------------------------------------------------------------
75 * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
76 * 0x0800_0000 user area -
77 * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
78 * 0x1400_0000 Ether (LAN9220) 16bit
79 * 0x1600_0000 user area - cannot use with NAND
80 * 0x1800_0000 user area -
81 * 0x1A00_0000 -
82 * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
83 */
84
85/*
86 * NOR Flash ROM
87 *
88 * SW1 | SW2 | SW7 | NOR Flash ROM
89 * bit1 | bit1 bit2 | bit1 | Memory allocation
90 * ------+------------+------+------------------
91 * OFF | ON OFF | ON | Area 0
92 * OFF | ON OFF | OFF | Area 4
93 */
94
95/*
96 * NAND Flash ROM
97 *
98 * SW1 | SW2 | SW7 | NAND Flash ROM
99 * bit1 | bit1 bit2 | bit2 | Memory allocation
100 * ------+------------+------+------------------
101 * OFF | ON OFF | ON | FCE 0
102 * OFF | ON OFF | OFF | FCE 1
103 */
104
105/*
106 * SMSC 9220
107 *
108 * SW1 SMSC 9220
109 * -----------------------
110 * ON access disable
111 * OFF access enable
112 */
113
114/*
115 * LCD / IRQ / KEYSC / IrDA
116 *
117 * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (QHD-TouchScreen)
118 * LCD = 2nd LCDC (WVGA)
119 *
120 * | SW43 |
121 * SW3 | ON | OFF |
122 * -------------+-----------------------+---------------+
123 * ON | KEY / IrDA | LCD |
124 * OFF | KEY / IrDA / IRQ | IRQ |
125 *
126 *
127 * QHD / WVGA display
128 *
129 * You can choice display type on menuconfig.
130 * Then, check above dip-switch.
131 */
132
133/*
134 * USB
135 *
136 * J7 : 1-2 MAX3355E VBUS
137 * 2-3 DC 5.0V
138 *
139 * S39: bit2: off
140 */
141
142/*
143 * FSI/FSMI
144 *
145 * SW41 : ON : SH-Mobile AP4 Audio Mode
146 * : OFF : Bluetooth Audio Mode
147 *
148 * it needs amixer settings for playing
149 *
150 * amixer set "Headphone Enable" on
151 */
152
153/*
154 * MMC0/SDHI1 (CN7)
155 *
156 * J22 : select card voltage
157 * 1-2 pin : 1.8v
158 * 2-3 pin : 3.3v
159 *
160 * SW1 | SW33
161 * | bit1 | bit2 | bit3 | bit4
162 * ------------+------+------+------+-------
163 * MMC0 OFF | OFF | ON | ON | X
164 * SDHI1 OFF | ON | X | OFF | ON
165 *
166 * voltage lebel
167 * CN7 : 1.8v
168 * CN12: 3.3v
169 */
170
171/* Dummy supplies, where voltage doesn't matter */
172static struct regulator_consumer_supply fixed1v8_power_consumers[] =
173{
174 /* J22 default position: 1.8V */
175 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
176 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
177 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
178 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
179};
180
181static struct regulator_consumer_supply fixed3v3_power_consumers[] =
182{
183 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
184 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
185};
186
187static struct regulator_consumer_supply dummy_supplies[] = {
188 REGULATOR_SUPPLY("vddvario", "smsc911x"),
189 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
190};
191
192/* MTD */
193static struct mtd_partition nor_flash_partitions[] = {
194 {
195 .name = "loader",
196 .offset = 0x00000000,
197 .size = 512 * 1024,
198 .mask_flags = MTD_WRITEABLE,
199 },
200 {
201 .name = "bootenv",
202 .offset = MTDPART_OFS_APPEND,
203 .size = 512 * 1024,
204 .mask_flags = MTD_WRITEABLE,
205 },
206 {
207 .name = "kernel_ro",
208 .offset = MTDPART_OFS_APPEND,
209 .size = 8 * 1024 * 1024,
210 .mask_flags = MTD_WRITEABLE,
211 },
212 {
213 .name = "kernel",
214 .offset = MTDPART_OFS_APPEND,
215 .size = 8 * 1024 * 1024,
216 },
217 {
218 .name = "data",
219 .offset = MTDPART_OFS_APPEND,
220 .size = MTDPART_SIZ_FULL,
221 },
222};
223
224static struct physmap_flash_data nor_flash_data = {
225 .width = 2,
226 .parts = nor_flash_partitions,
227 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
228};
229
230static struct resource nor_flash_resources[] = {
231 [0] = {
232 .start = 0x20000000, /* CS0 shadow instead of regular CS0 */
233 .end = 0x28000000 - 1, /* needed by USB MASK ROM boot */
234 .flags = IORESOURCE_MEM,
235 }
236};
237
238static struct platform_device nor_flash_device = {
239 .name = "physmap-flash",
240 .dev = {
241 .platform_data = &nor_flash_data,
242 },
243 .num_resources = ARRAY_SIZE(nor_flash_resources),
244 .resource = nor_flash_resources,
245};
246
247/* SMSC 9220 */
248static struct resource smc911x_resources[] = {
249 {
250 .start = 0x14000000,
251 .end = 0x16000000 - 1,
252 .flags = IORESOURCE_MEM,
253 }, {
254 .start = evt2irq(0x02c0) /* IRQ6A */,
255 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
256 },
257};
258
259static struct smsc911x_platform_config smsc911x_info = {
260 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
261 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
262 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
263};
264
265static struct platform_device smc911x_device = {
266 .name = "smsc911x",
267 .id = -1,
268 .num_resources = ARRAY_SIZE(smc911x_resources),
269 .resource = smc911x_resources,
270 .dev = {
271 .platform_data = &smsc911x_info,
272 },
273};
274
275/*
276 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
277 * connected to GPIO A22 of SH7372 (GPIO 41).
278 */
279static int slot_cn7_get_cd(struct platform_device *pdev)
280{
281 return !gpio_get_value(41);
282}
283/* MERAM */
284static struct sh_mobile_meram_info meram_info = {
285 .addr_mode = SH_MOBILE_MERAM_MODE1,
286};
287
288static struct resource meram_resources[] = {
289 [0] = {
290 .name = "regs",
291 .start = 0xe8000000,
292 .end = 0xe807ffff,
293 .flags = IORESOURCE_MEM,
294 },
295 [1] = {
296 .name = "meram",
297 .start = 0xe8080000,
298 .end = 0xe81fffff,
299 .flags = IORESOURCE_MEM,
300 },
301};
302
303static struct platform_device meram_device = {
304 .name = "sh_mobile_meram",
305 .id = 0,
306 .num_resources = ARRAY_SIZE(meram_resources),
307 .resource = meram_resources,
308 .dev = {
309 .platform_data = &meram_info,
310 },
311};
312
313/* SH_MMCIF */
314static struct resource sh_mmcif_resources[] = {
315 [0] = {
316 .name = "MMCIF",
317 .start = 0xE6BD0000,
318 .end = 0xE6BD00FF,
319 .flags = IORESOURCE_MEM,
320 },
321 [1] = {
322 /* MMC ERR */
323 .start = evt2irq(0x1ac0),
324 .flags = IORESOURCE_IRQ,
325 },
326 [2] = {
327 /* MMC NOR */
328 .start = evt2irq(0x1ae0),
329 .flags = IORESOURCE_IRQ,
330 },
331};
332
333static struct sh_mmcif_plat_data sh_mmcif_plat = {
334 .sup_pclk = 0,
335 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
336 .caps = MMC_CAP_4_BIT_DATA |
337 MMC_CAP_8_BIT_DATA |
338 MMC_CAP_NEEDS_POLL,
339 .get_cd = slot_cn7_get_cd,
340 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
341 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
342};
343
344static struct platform_device sh_mmcif_device = {
345 .name = "sh_mmcif",
346 .id = 0,
347 .dev = {
348 .dma_mask = NULL,
349 .coherent_dma_mask = 0xffffffff,
350 .platform_data = &sh_mmcif_plat,
351 },
352 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
353 .resource = sh_mmcif_resources,
354};
355
356/* SDHI0 */
357static struct sh_mobile_sdhi_info sdhi0_info = {
358 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
359 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
360 .tmio_caps = MMC_CAP_SDIO_IRQ,
361};
362
363static struct resource sdhi0_resources[] = {
364 [0] = {
365 .name = "SDHI0",
366 .start = 0xe6850000,
367 .end = 0xe68500ff,
368 .flags = IORESOURCE_MEM,
369 },
370 [1] = {
371 .start = evt2irq(0x0e00) /* SDHI0_SDHI0I0 */,
372 .flags = IORESOURCE_IRQ,
373 },
374 [2] = {
375 .start = evt2irq(0x0e20) /* SDHI0_SDHI0I1 */,
376 .flags = IORESOURCE_IRQ,
377 },
378 [3] = {
379 .start = evt2irq(0x0e40) /* SDHI0_SDHI0I2 */,
380 .flags = IORESOURCE_IRQ,
381 },
382};
383
384static struct platform_device sdhi0_device = {
385 .name = "sh_mobile_sdhi",
386 .num_resources = ARRAY_SIZE(sdhi0_resources),
387 .resource = sdhi0_resources,
388 .id = 0,
389 .dev = {
390 .platform_data = &sdhi0_info,
391 },
392};
393
394/* SDHI1 */
395static struct sh_mobile_sdhi_info sdhi1_info = {
396 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
397 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
398 .tmio_ocr_mask = MMC_VDD_165_195,
399 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
400 .tmio_caps = MMC_CAP_NEEDS_POLL | MMC_CAP_SDIO_IRQ,
401 .get_cd = slot_cn7_get_cd,
402};
403
404static struct resource sdhi1_resources[] = {
405 [0] = {
406 .name = "SDHI1",
407 .start = 0xe6860000,
408 .end = 0xe68600ff,
409 .flags = IORESOURCE_MEM,
410 },
411 [1] = {
412 .start = evt2irq(0x0e80), /* SDHI1_SDHI1I0 */
413 .flags = IORESOURCE_IRQ,
414 },
415 [2] = {
416 .start = evt2irq(0x0ea0), /* SDHI1_SDHI1I1 */
417 .flags = IORESOURCE_IRQ,
418 },
419 [3] = {
420 .start = evt2irq(0x0ec0), /* SDHI1_SDHI1I2 */
421 .flags = IORESOURCE_IRQ,
422 },
423};
424
425static struct platform_device sdhi1_device = {
426 .name = "sh_mobile_sdhi",
427 .num_resources = ARRAY_SIZE(sdhi1_resources),
428 .resource = sdhi1_resources,
429 .id = 1,
430 .dev = {
431 .platform_data = &sdhi1_info,
432 },
433};
434
435/* USB1 */
436static void usb1_host_port_power(int port, int power)
437{
438 if (!power) /* only power-on supported for now */
439 return;
440
441 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
442 __raw_writew(__raw_readw(IOMEM(0xE68B0008)) | 0x600, IOMEM(0xE68B0008));
443}
444
445static struct r8a66597_platdata usb1_host_data = {
446 .on_chip = 1,
447 .port_power = usb1_host_port_power,
448};
449
450static struct resource usb1_host_resources[] = {
451 [0] = {
452 .name = "USBHS",
453 .start = 0xE68B0000,
454 .end = 0xE68B00E6 - 1,
455 .flags = IORESOURCE_MEM,
456 },
457 [1] = {
458 .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
459 .flags = IORESOURCE_IRQ,
460 },
461};
462
463static struct platform_device usb1_host_device = {
464 .name = "r8a66597_hcd",
465 .id = 1,
466 .dev = {
467 .dma_mask = NULL, /* not use dma */
468 .coherent_dma_mask = 0xffffffff,
469 .platform_data = &usb1_host_data,
470 },
471 .num_resources = ARRAY_SIZE(usb1_host_resources),
472 .resource = usb1_host_resources,
473};
474
475/*
476 * QHD display
477 */
478#ifdef CONFIG_AP4EVB_QHD
479
480/* KEYSC (Needs SW43 set to ON) */
481static struct sh_keysc_info keysc_info = {
482 .mode = SH_KEYSC_MODE_1,
483 .scan_timing = 3,
484 .delay = 2500,
485 .keycodes = {
486 KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
487 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9,
488 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
489 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
490 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
491 },
492};
493
494static struct resource keysc_resources[] = {
495 [0] = {
496 .name = "KEYSC",
497 .start = 0xe61b0000,
498 .end = 0xe61b0063,
499 .flags = IORESOURCE_MEM,
500 },
501 [1] = {
502 .start = evt2irq(0x0be0), /* KEYSC_KEY */
503 .flags = IORESOURCE_IRQ,
504 },
505};
506
507static struct platform_device keysc_device = {
508 .name = "sh_keysc",
509 .id = 0, /* "keysc0" clock */
510 .num_resources = ARRAY_SIZE(keysc_resources),
511 .resource = keysc_resources,
512 .dev = {
513 .platform_data = &keysc_info,
514 },
515};
516
517/* MIPI-DSI */
518static int sh_mipi_set_dot_clock(struct platform_device *pdev,
519 void __iomem *base,
520 int enable)
521{
522 struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
523
524 if (IS_ERR(pck))
525 return PTR_ERR(pck);
526
527 if (enable) {
528 /*
529 * DSIPCLK = 24MHz
530 * D-PHY = DSIPCLK * ((0x6*2)+1) = 312MHz (see .phyctrl)
531 * HsByteCLK = D-PHY/8 = 39MHz
532 *
533 * X * Y * FPS =
534 * (544+72+600+16) * (961+8+8+2) * 30 = 36.1MHz
535 */
536 clk_set_rate(pck, clk_round_rate(pck, 24000000));
537 clk_enable(pck);
538 } else {
539 clk_disable(pck);
540 }
541
542 clk_put(pck);
543
544 return 0;
545}
546
547static struct resource mipidsi0_resources[] = {
548 [0] = {
549 .start = 0xffc60000,
550 .end = 0xffc63073,
551 .flags = IORESOURCE_MEM,
552 },
553 [1] = {
554 .start = 0xffc68000,
555 .end = 0xffc680ef,
556 .flags = IORESOURCE_MEM,
557 },
558};
559
560static struct sh_mipi_dsi_info mipidsi0_info = {
561 .data_format = MIPI_RGB888,
562 .channel = LCDC_CHAN_MAINLCD,
563 .lane = 2,
564 .vsynw_offset = 17,
565 .phyctrl = 0x6 << 8,
566 .flags = SH_MIPI_DSI_SYNC_PULSES_MODE |
567 SH_MIPI_DSI_HSbyteCLK,
568 .set_dot_clock = sh_mipi_set_dot_clock,
569};
570
571static struct platform_device mipidsi0_device = {
572 .name = "sh-mipi-dsi",
573 .num_resources = ARRAY_SIZE(mipidsi0_resources),
574 .resource = mipidsi0_resources,
575 .id = 0,
576 .dev = {
577 .platform_data = &mipidsi0_info,
578 },
579};
580
581static struct platform_device *qhd_devices[] __initdata = {
582 &mipidsi0_device,
583 &keysc_device,
584};
585#endif /* CONFIG_AP4EVB_QHD */
586
587/* LCDC0 */
588static const struct fb_videomode ap4evb_lcdc_modes[] = {
589 {
590#ifdef CONFIG_AP4EVB_QHD
591 .name = "R63302(QHD)",
592 .xres = 544,
593 .yres = 961,
594 .left_margin = 72,
595 .right_margin = 600,
596 .hsync_len = 16,
597 .upper_margin = 8,
598 .lower_margin = 8,
599 .vsync_len = 2,
600 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
601#else
602 .name = "WVGA Panel",
603 .xres = 800,
604 .yres = 480,
605 .left_margin = 220,
606 .right_margin = 110,
607 .hsync_len = 70,
608 .upper_margin = 20,
609 .lower_margin = 5,
610 .vsync_len = 5,
611 .sync = 0,
612#endif
613 },
614};
615
616static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
617 .icb[0] = {
618 .meram_size = 0x40,
619 },
620 .icb[1] = {
621 .meram_size = 0x40,
622 },
623};
624
625static struct sh_mobile_lcdc_info lcdc_info = {
626 .meram_dev = &meram_info,
627 .ch[0] = {
628 .chan = LCDC_CHAN_MAINLCD,
629 .fourcc = V4L2_PIX_FMT_RGB565,
630 .lcd_modes = ap4evb_lcdc_modes,
631 .num_modes = ARRAY_SIZE(ap4evb_lcdc_modes),
632 .meram_cfg = &lcd_meram_cfg,
633#ifdef CONFIG_AP4EVB_QHD
634 .tx_dev = &mipidsi0_device,
635#endif
636 }
637};
638
639static struct resource lcdc_resources[] = {
640 [0] = {
641 .name = "LCDC",
642 .start = 0xfe940000, /* P4-only space */
643 .end = 0xfe943fff,
644 .flags = IORESOURCE_MEM,
645 },
646 [1] = {
647 .start = intcs_evt2irq(0x580),
648 .flags = IORESOURCE_IRQ,
649 },
650};
651
652static struct platform_device lcdc_device = {
653 .name = "sh_mobile_lcdc_fb",
654 .num_resources = ARRAY_SIZE(lcdc_resources),
655 .resource = lcdc_resources,
656 .dev = {
657 .platform_data = &lcdc_info,
658 .coherent_dma_mask = ~0,
659 },
660};
661
662/* FSI */
663#define IRQ_FSI evt2irq(0x1840)
664static struct sh_fsi_platform_info fsi_info = {
665 .port_b = {
666 .flags = SH_FSI_CLK_CPG |
667 SH_FSI_FMT_SPDIF,
668 },
669};
670
671static struct resource fsi_resources[] = {
672 [0] = {
673 .name = "FSI",
674 .start = 0xFE3C0000,
675 .end = 0xFE3C0400 - 1,
676 .flags = IORESOURCE_MEM,
677 },
678 [1] = {
679 .start = IRQ_FSI,
680 .flags = IORESOURCE_IRQ,
681 },
682};
683
684static struct platform_device fsi_device = {
685 .name = "sh_fsi2",
686 .id = -1,
687 .num_resources = ARRAY_SIZE(fsi_resources),
688 .resource = fsi_resources,
689 .dev = {
690 .platform_data = &fsi_info,
691 },
692};
693
694static struct asoc_simple_card_info fsi2_ak4643_info = {
695 .name = "AK4643",
696 .card = "FSI2A-AK4643",
697 .codec = "ak4642-codec.0-0013",
698 .platform = "sh_fsi2",
699 .daifmt = SND_SOC_DAIFMT_LEFT_J,
700 .cpu_dai = {
701 .name = "fsia-dai",
702 .fmt = SND_SOC_DAIFMT_CBS_CFS,
703 },
704 .codec_dai = {
705 .name = "ak4642-hifi",
706 .fmt = SND_SOC_DAIFMT_CBM_CFM,
707 .sysclk = 11289600,
708 },
709};
710
711static struct platform_device fsi_ak4643_device = {
712 .name = "asoc-simple-card",
713 .dev = {
714 .platform_data = &fsi2_ak4643_info,
715 },
716};
717
718/* LCDC1 */
719static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
720 unsigned long *parent_freq);
721
722static struct sh_mobile_hdmi_info hdmi_info = {
723 .flags = HDMI_SND_SRC_SPDIF,
724 .clk_optimize_parent = ap4evb_clk_optimize,
725};
726
727static struct resource hdmi_resources[] = {
728 [0] = {
729 .name = "HDMI",
730 .start = 0xe6be0000,
731 .end = 0xe6be00ff,
732 .flags = IORESOURCE_MEM,
733 },
734 [1] = {
735 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
736 .start = evt2irq(0x17e0),
737 .flags = IORESOURCE_IRQ,
738 },
739};
740
741static struct platform_device hdmi_device = {
742 .name = "sh-mobile-hdmi",
743 .num_resources = ARRAY_SIZE(hdmi_resources),
744 .resource = hdmi_resources,
745 .id = -1,
746 .dev = {
747 .platform_data = &hdmi_info,
748 },
749};
750
751static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
752 unsigned long *parent_freq)
753{
754 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
755 long error;
756
757 if (IS_ERR(hdmi_ick)) {
758 int ret = PTR_ERR(hdmi_ick);
759 pr_err("Cannot get HDMI ICK: %d\n", ret);
760 return ret;
761 }
762
763 error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
764
765 clk_put(hdmi_ick);
766
767 return error;
768}
769
770static const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
771 .icb[0] = {
772 .meram_size = 0x100,
773 },
774 .icb[1] = {
775 .meram_size = 0x100,
776 },
777};
778
779static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
780 .clock_source = LCDC_CLK_EXTERNAL,
781 .meram_dev = &meram_info,
782 .ch[0] = {
783 .chan = LCDC_CHAN_MAINLCD,
784 .fourcc = V4L2_PIX_FMT_RGB565,
785 .interface_type = RGB24,
786 .clock_divider = 1,
787 .flags = LCDC_FLAGS_DWPOL,
788 .meram_cfg = &hdmi_meram_cfg,
789 .tx_dev = &hdmi_device,
790 }
791};
792
793static struct resource lcdc1_resources[] = {
794 [0] = {
795 .name = "LCDC1",
796 .start = 0xfe944000,
797 .end = 0xfe947fff,
798 .flags = IORESOURCE_MEM,
799 },
800 [1] = {
801 .start = intcs_evt2irq(0x1780),
802 .flags = IORESOURCE_IRQ,
803 },
804};
805
806static struct platform_device lcdc1_device = {
807 .name = "sh_mobile_lcdc_fb",
808 .num_resources = ARRAY_SIZE(lcdc1_resources),
809 .resource = lcdc1_resources,
810 .id = 1,
811 .dev = {
812 .platform_data = &sh_mobile_lcdc1_info,
813 .coherent_dma_mask = ~0,
814 },
815};
816
817static struct asoc_simple_card_info fsi2_hdmi_info = {
818 .name = "HDMI",
819 .card = "FSI2B-HDMI",
820 .codec = "sh-mobile-hdmi",
821 .platform = "sh_fsi2",
822 .cpu_dai = {
823 .name = "fsib-dai",
824 .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
825 },
826 .codec_dai = {
827 .name = "sh_mobile_hdmi-hifi",
828 },
829};
830
831static struct platform_device fsi_hdmi_device = {
832 .name = "asoc-simple-card",
833 .id = 1,
834 .dev = {
835 .platform_data = &fsi2_hdmi_info,
836 },
837};
838
839static struct gpio_led ap4evb_leds[] = {
840 {
841 .name = "led4",
842 .gpio = 185,
843 .default_state = LEDS_GPIO_DEFSTATE_ON,
844 },
845 {
846 .name = "led2",
847 .gpio = 186,
848 .default_state = LEDS_GPIO_DEFSTATE_ON,
849 },
850 {
851 .name = "led3",
852 .gpio = 187,
853 .default_state = LEDS_GPIO_DEFSTATE_ON,
854 },
855 {
856 .name = "led1",
857 .gpio = 188,
858 .default_state = LEDS_GPIO_DEFSTATE_ON,
859 }
860};
861
862static struct gpio_led_platform_data ap4evb_leds_pdata = {
863 .num_leds = ARRAY_SIZE(ap4evb_leds),
864 .leds = ap4evb_leds,
865};
866
867static struct platform_device leds_device = {
868 .name = "leds-gpio",
869 .id = 0,
870 .dev = {
871 .platform_data = &ap4evb_leds_pdata,
872 },
873};
874
875static struct i2c_board_info imx074_info = {
876 I2C_BOARD_INFO("imx074", 0x1a),
877};
878
879static struct soc_camera_link imx074_link = {
880 .bus_id = 0,
881 .board_info = &imx074_info,
882 .i2c_adapter_id = 0,
883 .module_name = "imx074",
884};
885
886static struct platform_device ap4evb_camera = {
887 .name = "soc-camera-pdrv",
888 .id = 0,
889 .dev = {
890 .platform_data = &imx074_link,
891 },
892};
893
894static struct sh_csi2_client_config csi2_clients[] = {
895 {
896 .phy = SH_CSI2_PHY_MAIN,
897 .lanes = 0, /* default: 2 lanes */
898 .channel = 0,
899 .pdev = &ap4evb_camera,
900 },
901};
902
903static struct sh_csi2_pdata csi2_info = {
904 .type = SH_CSI2C,
905 .clients = csi2_clients,
906 .num_clients = ARRAY_SIZE(csi2_clients),
907 .flags = SH_CSI2_ECC | SH_CSI2_CRC,
908};
909
910static struct resource csi2_resources[] = {
911 [0] = {
912 .name = "CSI2",
913 .start = 0xffc90000,
914 .end = 0xffc90fff,
915 .flags = IORESOURCE_MEM,
916 },
917 [1] = {
918 .start = intcs_evt2irq(0x17a0),
919 .flags = IORESOURCE_IRQ,
920 },
921};
922
923static struct sh_mobile_ceu_companion csi2 = {
924 .id = 0,
925 .num_resources = ARRAY_SIZE(csi2_resources),
926 .resource = csi2_resources,
927 .platform_data = &csi2_info,
928};
929
930static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
931 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
932 .max_width = 8188,
933 .max_height = 8188,
934 .csi2 = &csi2,
935};
936
937static struct resource ceu_resources[] = {
938 [0] = {
939 .name = "CEU",
940 .start = 0xfe910000,
941 .end = 0xfe91009f,
942 .flags = IORESOURCE_MEM,
943 },
944 [1] = {
945 .start = intcs_evt2irq(0x880),
946 .flags = IORESOURCE_IRQ,
947 },
948 [2] = {
949 /* place holder for contiguous memory */
950 },
951};
952
953static struct platform_device ceu_device = {
954 .name = "sh_mobile_ceu",
955 .id = 0, /* "ceu0" clock */
956 .num_resources = ARRAY_SIZE(ceu_resources),
957 .resource = ceu_resources,
958 .dev = {
959 .platform_data = &sh_mobile_ceu_info,
960 .coherent_dma_mask = 0xffffffff,
961 },
962};
963
964static struct platform_device *ap4evb_devices[] __initdata = {
965 &leds_device,
966 &nor_flash_device,
967 &smc911x_device,
968 &sdhi0_device,
969 &sdhi1_device,
970 &usb1_host_device,
971 &fsi_device,
972 &fsi_ak4643_device,
973 &fsi_hdmi_device,
974 &sh_mmcif_device,
975 &hdmi_device,
976 &lcdc_device,
977 &lcdc1_device,
978 &ceu_device,
979 &ap4evb_camera,
980 &meram_device,
981};
982
983static void __init hdmi_init_pm_clock(void)
984{
985 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
986 int ret;
987 long rate;
988
989 if (IS_ERR(hdmi_ick)) {
990 ret = PTR_ERR(hdmi_ick);
991 pr_err("Cannot get HDMI ICK: %d\n", ret);
992 goto out;
993 }
994
995 ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk);
996 if (ret < 0) {
997 pr_err("Cannot set PLLC2 parent: %d, %d users\n", ret, sh7372_pllc2_clk.usecount);
998 goto out;
999 }
1000
1001 pr_debug("PLLC2 initial frequency %lu\n", clk_get_rate(&sh7372_pllc2_clk));
1002
1003 rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
1004 if (rate < 0) {
1005 pr_err("Cannot get suitable rate: %ld\n", rate);
1006 ret = rate;
1007 goto out;
1008 }
1009
1010 ret = clk_set_rate(&sh7372_pllc2_clk, rate);
1011 if (ret < 0) {
1012 pr_err("Cannot set rate %ld: %d\n", rate, ret);
1013 goto out;
1014 }
1015
1016 pr_debug("PLLC2 set frequency %lu\n", rate);
1017
1018 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
1019 if (ret < 0)
1020 pr_err("Cannot set HDMI parent: %d\n", ret);
1021
1022out:
1023 if (!IS_ERR(hdmi_ick))
1024 clk_put(hdmi_ick);
1025}
1026
1027/* TouchScreen */
1028#ifdef CONFIG_AP4EVB_QHD
1029# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
1030# define GPIO_TSC_PORT 123
1031#else /* WVGA */
1032# define GPIO_TSC_IRQ GPIO_FN_IRQ7_40
1033# define GPIO_TSC_PORT 40
1034#endif
1035
1036#define IRQ28 evt2irq(0x3380) /* IRQ28A */
1037#define IRQ7 evt2irq(0x02e0) /* IRQ7A */
1038static int ts_get_pendown_state(void)
1039{
1040 int val;
1041
1042 gpio_free(GPIO_TSC_IRQ);
1043
1044 gpio_request_one(GPIO_TSC_PORT, GPIOF_IN, NULL);
1045
1046 val = gpio_get_value(GPIO_TSC_PORT);
1047
1048 gpio_request(GPIO_TSC_IRQ, NULL);
1049
1050 return !val;
1051}
1052
1053static int ts_init(void)
1054{
1055 gpio_request(GPIO_TSC_IRQ, NULL);
1056
1057 return 0;
1058}
1059
1060static struct tsc2007_platform_data tsc2007_info = {
1061 .model = 2007,
1062 .x_plate_ohms = 180,
1063 .get_pendown_state = ts_get_pendown_state,
1064 .init_platform_hw = ts_init,
1065};
1066
1067static struct i2c_board_info tsc_device = {
1068 I2C_BOARD_INFO("tsc2007", 0x48),
1069 .type = "tsc2007",
1070 .platform_data = &tsc2007_info,
1071 /*.irq is selected on ap4evb_init */
1072};
1073
1074/* I2C */
1075static struct i2c_board_info i2c0_devices[] = {
1076 {
1077 I2C_BOARD_INFO("ak4643", 0x13),
1078 },
1079};
1080
1081static struct i2c_board_info i2c1_devices[] = {
1082 {
1083 I2C_BOARD_INFO("r2025sd", 0x32),
1084 },
1085};
1086
1087
1088static const struct pinctrl_map ap4evb_pinctrl_map[] = {
1089 /* MMCIF */
1090 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1091 "mmc0_data8_0", "mmc0"),
1092 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh7372",
1093 "mmc0_ctrl_0", "mmc0"),
1094 /* SDHI0 */
1095 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1096 "sdhi0_data4", "sdhi0"),
1097 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1098 "sdhi0_ctrl", "sdhi0"),
1099 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1100 "sdhi0_cd", "sdhi0"),
1101 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1102 "sdhi0_wp", "sdhi0"),
1103 /* SDHI1 */
1104 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1105 "sdhi1_data4", "sdhi1"),
1106 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
1107 "sdhi1_ctrl", "sdhi1"),
1108};
1109
1110#define GPIO_PORT9CR IOMEM(0xE6051009)
1111#define GPIO_PORT10CR IOMEM(0xE605100A)
1112#define USCCR1 IOMEM(0xE6058144)
1113static void __init ap4evb_init(void)
1114{
1115 struct pm_domain_device domain_devices[] = {
1116 { "A4LC", &lcdc1_device, },
1117 { "A4LC", &lcdc_device, },
1118 { "A4MP", &fsi_device, },
1119 { "A3SP", &sh_mmcif_device, },
1120 { "A3SP", &sdhi0_device, },
1121 { "A3SP", &sdhi1_device, },
1122 { "A4R", &ceu_device, },
1123 };
1124 u32 srcr4;
1125 struct clk *clk;
1126
1127 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
1128 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
1129 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
1130 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1131 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
1132
1133 /* External clock source */
1134 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1135
1136 pinctrl_register_mappings(ap4evb_pinctrl_map,
1137 ARRAY_SIZE(ap4evb_pinctrl_map));
1138 sh7372_pinmux_init();
1139
1140 /* enable SCIFA0 */
1141 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
1142 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
1143
1144 /* enable SMSC911X */
1145 gpio_request(GPIO_FN_CS5A, NULL);
1146 gpio_request(GPIO_FN_IRQ6_39, NULL);
1147
1148 /* enable Debug switch (S6) */
1149 gpio_request_one(32, GPIOF_IN | GPIOF_EXPORT, NULL);
1150 gpio_request_one(33, GPIOF_IN | GPIOF_EXPORT, NULL);
1151 gpio_request_one(34, GPIOF_IN | GPIOF_EXPORT, NULL);
1152 gpio_request_one(35, GPIOF_IN | GPIOF_EXPORT, NULL);
1153
1154 /* USB enable */
1155 gpio_request(GPIO_FN_VBUS0_1, NULL);
1156 gpio_request(GPIO_FN_IDIN_1_18, NULL);
1157 gpio_request(GPIO_FN_PWEN_1_115, NULL);
1158 gpio_request(GPIO_FN_OVCN_1_114, NULL);
1159 gpio_request(GPIO_FN_EXTLP_1, NULL);
1160 gpio_request(GPIO_FN_OVCN2_1, NULL);
1161
1162 /* setup USB phy */
1163 __raw_writew(0x8a0a, IOMEM(0xE6058130)); /* USBCR4 */
1164
1165 /* enable FSI2 port A (ak4643) */
1166 gpio_request(GPIO_FN_FSIAIBT, NULL);
1167 gpio_request(GPIO_FN_FSIAILR, NULL);
1168 gpio_request(GPIO_FN_FSIAISLD, NULL);
1169 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1170 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1171
1172 gpio_request(9, NULL);
1173 gpio_request(10, NULL);
1174 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1175 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1176
1177 /* card detect pin for MMC slot (CN7) */
1178 gpio_request_one(41, GPIOF_IN, NULL);
1179
1180 /* setup FSI2 port B (HDMI) */
1181 gpio_request(GPIO_FN_FSIBCK, NULL);
1182 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
1183
1184 /* set SPU2 clock to 119.6 MHz */
1185 clk = clk_get(NULL, "spu_clk");
1186 if (!IS_ERR(clk)) {
1187 clk_set_rate(clk, clk_round_rate(clk, 119600000));
1188 clk_put(clk);
1189 }
1190
1191 /*
1192 * set irq priority, to avoid sound chopping
1193 * when NFS rootfs is used
1194 * FSI(3) > SMSC911X(2)
1195 */
1196 intc_set_priority(IRQ_FSI, 3);
1197
1198 i2c_register_board_info(0, i2c0_devices,
1199 ARRAY_SIZE(i2c0_devices));
1200
1201 i2c_register_board_info(1, i2c1_devices,
1202 ARRAY_SIZE(i2c1_devices));
1203
1204#ifdef CONFIG_AP4EVB_QHD
1205
1206 /*
1207 * For QHD Panel (MIPI-DSI, CONFIG_AP4EVB_QHD=y) and
1208 * IRQ28 for Touch Panel, set dip switches S3, S43 as OFF, ON.
1209 */
1210
1211 /* enable KEYSC */
1212 gpio_request(GPIO_FN_KEYOUT0, NULL);
1213 gpio_request(GPIO_FN_KEYOUT1, NULL);
1214 gpio_request(GPIO_FN_KEYOUT2, NULL);
1215 gpio_request(GPIO_FN_KEYOUT3, NULL);
1216 gpio_request(GPIO_FN_KEYOUT4, NULL);
1217 gpio_request(GPIO_FN_KEYIN0_136, NULL);
1218 gpio_request(GPIO_FN_KEYIN1_135, NULL);
1219 gpio_request(GPIO_FN_KEYIN2_134, NULL);
1220 gpio_request(GPIO_FN_KEYIN3_133, NULL);
1221 gpio_request(GPIO_FN_KEYIN4, NULL);
1222
1223 /* enable TouchScreen */
1224 irq_set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW);
1225
1226 tsc_device.irq = IRQ28;
1227 i2c_register_board_info(1, &tsc_device, 1);
1228
1229 /* LCDC0 */
1230 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
1231 lcdc_info.ch[0].interface_type = RGB24;
1232 lcdc_info.ch[0].clock_divider = 1;
1233 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
1234 lcdc_info.ch[0].panel_cfg.width = 44;
1235 lcdc_info.ch[0].panel_cfg.height = 79;
1236
1237 platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
1238
1239#else
1240 /*
1241 * For WVGA Panel (18-bit RGB, CONFIG_AP4EVB_WVGA=y) and
1242 * IRQ7 for Touch Panel, set dip switches S3, S43 to ON, OFF.
1243 */
1244
1245 gpio_request(GPIO_FN_LCDD17, NULL);
1246 gpio_request(GPIO_FN_LCDD16, NULL);
1247 gpio_request(GPIO_FN_LCDD15, NULL);
1248 gpio_request(GPIO_FN_LCDD14, NULL);
1249 gpio_request(GPIO_FN_LCDD13, NULL);
1250 gpio_request(GPIO_FN_LCDD12, NULL);
1251 gpio_request(GPIO_FN_LCDD11, NULL);
1252 gpio_request(GPIO_FN_LCDD10, NULL);
1253 gpio_request(GPIO_FN_LCDD9, NULL);
1254 gpio_request(GPIO_FN_LCDD8, NULL);
1255 gpio_request(GPIO_FN_LCDD7, NULL);
1256 gpio_request(GPIO_FN_LCDD6, NULL);
1257 gpio_request(GPIO_FN_LCDD5, NULL);
1258 gpio_request(GPIO_FN_LCDD4, NULL);
1259 gpio_request(GPIO_FN_LCDD3, NULL);
1260 gpio_request(GPIO_FN_LCDD2, NULL);
1261 gpio_request(GPIO_FN_LCDD1, NULL);
1262 gpio_request(GPIO_FN_LCDD0, NULL);
1263 gpio_request(GPIO_FN_LCDDISP, NULL);
1264 gpio_request(GPIO_FN_LCDDCK, NULL);
1265
1266 gpio_request_one(189, GPIOF_OUT_INIT_HIGH, NULL); /* backlight */
1267 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1268
1269 lcdc_info.clock_source = LCDC_CLK_BUS;
1270 lcdc_info.ch[0].interface_type = RGB18;
1271 lcdc_info.ch[0].clock_divider = 3;
1272 lcdc_info.ch[0].flags = 0;
1273 lcdc_info.ch[0].panel_cfg.width = 152;
1274 lcdc_info.ch[0].panel_cfg.height = 91;
1275
1276 /* enable TouchScreen */
1277 irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
1278
1279 tsc_device.irq = IRQ7;
1280 i2c_register_board_info(0, &tsc_device, 1);
1281#endif /* CONFIG_AP4EVB_QHD */
1282
1283 /* CEU */
1284
1285 /*
1286 * TODO: reserve memory for V4L2 DMA buffers, when a suitable API
1287 * becomes available
1288 */
1289
1290 /* MIPI-CSI stuff */
1291 gpio_request(GPIO_FN_VIO_CKO, NULL);
1292
1293 clk = clk_get(NULL, "vck1_clk");
1294 if (!IS_ERR(clk)) {
1295 clk_set_rate(clk, clk_round_rate(clk, 13000000));
1296 clk_enable(clk);
1297 clk_put(clk);
1298 }
1299
1300 sh7372_add_standard_devices();
1301
1302 /* HDMI */
1303 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1304 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1305
1306 /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */
1307#define SRCR4 IOMEM(0xe61580bc)
1308 srcr4 = __raw_readl(SRCR4);
1309 __raw_writel(srcr4 | (1 << 13), SRCR4);
1310 udelay(50);
1311 __raw_writel(srcr4 & ~(1 << 13), SRCR4);
1312
1313 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
1314
1315 rmobile_add_devices_to_domains(domain_devices,
1316 ARRAY_SIZE(domain_devices));
1317
1318 hdmi_init_pm_clock();
1319 sh7372_pm_init();
1320 pm_clk_add(&fsi_device.dev, "spu2");
1321 pm_clk_add(&lcdc1_device.dev, "hdmi");
1322}
1323
1324MACHINE_START(AP4EVB, "ap4evb")
1325 .map_io = sh7372_map_io,
1326 .init_early = sh7372_add_early_devices,
1327 .init_irq = sh7372_init_irq,
1328 .handle_irq = shmobile_handle_irq_intc,
1329 .init_machine = ap4evb_init,
1330 .init_late = sh7372_pm_init_late,
1331 .init_time = sh7372_earlytimer_init,
1332MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index 55b8c9fef954..5eb0caa6a7d0 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -26,6 +26,7 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/regulator/fixed.h> 27#include <linux/regulator/fixed.h>
28#include <linux/regulator/machine.h> 28#include <linux/regulator/machine.h>
29#include <linux/sh_clk.h>
29#include <linux/smsc911x.h> 30#include <linux/smsc911x.h>
30#include <mach/common.h> 31#include <mach/common.h>
31#include <mach/irqs.h> 32#include <mach/irqs.h>
@@ -65,7 +66,21 @@ static const struct pinctrl_map ape6evm_pinctrl_map[] = {
65 66
66static void __init ape6evm_add_standard_devices(void) 67static void __init ape6evm_add_standard_devices(void)
67{ 68{
69
70 struct clk *parent;
71 struct clk *mp;
72
68 r8a73a4_clock_init(); 73 r8a73a4_clock_init();
74
75 /* MP clock parent = extal2 */
76 parent = clk_get(NULL, "extal2");
77 mp = clk_get(NULL, "mp");
78 BUG_ON(IS_ERR(parent) || IS_ERR(mp));
79
80 clk_set_parent(mp, parent);
81 clk_put(parent);
82 clk_put(mp);
83
69 pinctrl_register_mappings(ape6evm_pinctrl_map, 84 pinctrl_register_mappings(ape6evm_pinctrl_map,
70 ARRAY_SIZE(ape6evm_pinctrl_map)); 85 ARRAY_SIZE(ape6evm_pinctrl_map));
71 r8a73a4_pinmux_init(); 86 r8a73a4_pinmux_init();
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
new file mode 100644
index 000000000000..03b85fec2ddb
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -0,0 +1,213 @@
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/kernel.h>
25#include <linux/gpio.h>
26#include <linux/io.h>
27#include <linux/pinctrl/machine.h>
28#include <mach/common.h>
29#include <mach/r8a7740.h>
30#include <asm/mach/arch.h>
31#include <asm/hardware/cache-l2x0.h>
32
33/*
34 * CON1 Camera Module
35 * CON2 Extension Bus
36 * CON3 HDMI Output
37 * CON4 Composite Video Output
38 * CON5 H-UDI JTAG
39 * CON6 ARM JTAG
40 * CON7 SD1
41 * CON8 SD2
42 * CON9 RTC BackUp
43 * CON10 Monaural Mic Input
44 * CON11 Stereo Headphone Output
45 * CON12 Audio Line Output(L)
46 * CON13 Audio Line Output(R)
47 * CON14 AWL13 Module
48 * CON15 Extension
49 * CON16 LCD1
50 * CON17 LCD2
51 * CON19 Power Input
52 * CON20 USB1
53 * CON21 USB2
54 * CON22 Serial
55 * CON23 LAN
56 * CON24 USB3
57 * LED1 Camera LED(Yellow)
58 * LED2 Power LED (Green)
59 * ED3-LED6 User LED(Yellow)
60 * LED7 LAN link LED(Green)
61 * LED8 LAN activity LED(Yellow)
62 */
63
64/*
65 * DipSwitch
66 *
67 * SW1
68 *
69 * -12345678-+---------------+----------------------------
70 * 1 | boot | hermit
71 * 0 | boot | OS auto boot
72 * -12345678-+---------------+----------------------------
73 * 00 | boot device | eMMC
74 * 10 | boot device | SDHI0 (CON7)
75 * 01 | boot device | -
76 * 11 | boot device | Extension Buss (CS0)
77 * -12345678-+---------------+----------------------------
78 * 0 | Extension Bus | D8-D15 disable, eMMC enable
79 * 1 | Extension Bus | D8-D15 enable, eMMC disable
80 * -12345678-+---------------+----------------------------
81 * 0 | SDHI1 | COM8 disable, COM14 enable
82 * 1 | SDHI1 | COM8 enable, COM14 disable
83 * -12345678-+---------------+----------------------------
84 * 0 | USB0 | COM20 enable, COM24 disable
85 * 1 | USB0 | COM20 disable, COM24 enable
86 * -12345678-+---------------+----------------------------
87 * 00 | JTAG | SH-X2
88 * 10 | JTAG | ARM
89 * 01 | JTAG | -
90 * 11 | JTAG | Boundary Scan
91 *-----------+---------------+----------------------------
92 */
93
94/*
95 * FSI-WM8978
96 *
97 * this command is required when playback.
98 *
99 * # amixer set "Headphone" 50
100 *
101 * this command is required when capture.
102 *
103 * # amixer set "Input PGA" 15
104 * # amixer set "Left Input Mixer MicP" on
105 * # amixer set "Left Input Mixer MicN" on
106 * # amixer set "Right Input Mixer MicN" on
107 * # amixer set "Right Input Mixer MicP" on
108 */
109
110/*
111 * USB function
112 *
113 * When you use USB Function,
114 * set SW1.6 ON, and connect cable to CN24.
115 *
116 * USBF needs workaround on R8A7740 chip.
117 * These are a little bit complex.
118 * see
119 * usbhsf_power_ctrl()
120 */
121
122static const struct pinctrl_map eva_pinctrl_map[] = {
123 /* SCIFA1 */
124 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.1", "pfc-r8a7740",
125 "scifa1_data", "scifa1"),
126};
127
128static void __init eva_clock_init(void)
129{
130 struct clk *system = clk_get(NULL, "system_clk");
131 struct clk *xtal1 = clk_get(NULL, "extal1");
132 struct clk *usb24s = clk_get(NULL, "usb24s");
133 struct clk *fsibck = clk_get(NULL, "fsibck");
134
135 if (IS_ERR(system) ||
136 IS_ERR(xtal1) ||
137 IS_ERR(usb24s) ||
138 IS_ERR(fsibck)) {
139 pr_err("armadillo800eva board clock init failed\n");
140 goto clock_error;
141 }
142
143 /* armadillo 800 eva extal1 is 24MHz */
144 clk_set_rate(xtal1, 24000000);
145
146 /* usb24s use extal1 (= system) clock (= 24MHz) */
147 clk_set_parent(usb24s, system);
148
149 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
150 clk_set_rate(fsibck, 12288000);
151
152clock_error:
153 if (!IS_ERR(system))
154 clk_put(system);
155 if (!IS_ERR(xtal1))
156 clk_put(xtal1);
157 if (!IS_ERR(usb24s))
158 clk_put(usb24s);
159 if (!IS_ERR(fsibck))
160 clk_put(fsibck);
161}
162
163/*
164 * board init
165 */
166static void __init eva_init(void)
167{
168
169 r8a7740_clock_init(MD_CK0 | MD_CK2);
170 eva_clock_init();
171
172 pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
173 r8a7740_pinmux_init();
174
175 r8a7740_meram_workaround();
176
177 /*
178 * Touchscreen
179 * TODO: Move reset GPIO over to .dts when we can reference it
180 */
181 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
182
183#ifdef CONFIG_CACHE_L2X0
184 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
185 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
186#endif
187
188 r8a7740_add_standard_devices_dt();
189 r8a7740_pm_init();
190}
191
192#define RESCNT2 IOMEM(0xe6188020)
193static void eva_restart(char mode, const char *cmd)
194{
195 /* Do soft power on reset */
196 writel((1 << 31), RESCNT2);
197}
198
199static const char *eva_boards_compat_dt[] __initdata = {
200 "renesas,armadillo800eva-reference",
201 NULL,
202};
203
204DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
205 .map_io = r8a7740_map_io,
206 .init_early = r8a7740_init_delay,
207 .init_irq = r8a7740_init_irq_of,
208 .init_machine = eva_init,
209 .init_time = shmobile_timer_init,
210 .init_late = shmobile_init_late,
211 .dt_compat = eva_boards_compat_dt,
212 .restart = eva_restart,
213MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index b85b2882dbd0..44a621505eeb 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -584,7 +584,7 @@ static struct regulator_init_data vcc_sdhi0_init_data = {
584static struct fixed_voltage_config vcc_sdhi0_info = { 584static struct fixed_voltage_config vcc_sdhi0_info = {
585 .supply_name = "SDHI0 Vcc", 585 .supply_name = "SDHI0 Vcc",
586 .microvolts = 3300000, 586 .microvolts = 3300000,
587 .gpio = GPIO_PORT75, 587 .gpio = 75,
588 .enable_high = 1, 588 .enable_high = 1,
589 .init_data = &vcc_sdhi0_init_data, 589 .init_data = &vcc_sdhi0_init_data,
590}; 590};
@@ -615,7 +615,7 @@ static struct regulator_init_data vccq_sdhi0_init_data = {
615}; 615};
616 616
617static struct gpio vccq_sdhi0_gpios[] = { 617static struct gpio vccq_sdhi0_gpios[] = {
618 {GPIO_PORT17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" }, 618 {17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" },
619}; 619};
620 620
621static struct gpio_regulator_state vccq_sdhi0_states[] = { 621static struct gpio_regulator_state vccq_sdhi0_states[] = {
@@ -626,7 +626,7 @@ static struct gpio_regulator_state vccq_sdhi0_states[] = {
626static struct gpio_regulator_config vccq_sdhi0_info = { 626static struct gpio_regulator_config vccq_sdhi0_info = {
627 .supply_name = "vqmmc", 627 .supply_name = "vqmmc",
628 628
629 .enable_gpio = GPIO_PORT74, 629 .enable_gpio = 74,
630 .enable_high = 1, 630 .enable_high = 1,
631 .enabled_at_boot = 0, 631 .enabled_at_boot = 0,
632 632
@@ -664,7 +664,7 @@ static struct regulator_init_data vcc_sdhi1_init_data = {
664static struct fixed_voltage_config vcc_sdhi1_info = { 664static struct fixed_voltage_config vcc_sdhi1_info = {
665 .supply_name = "SDHI1 Vcc", 665 .supply_name = "SDHI1 Vcc",
666 .microvolts = 3300000, 666 .microvolts = 3300000,
667 .gpio = GPIO_PORT16, 667 .gpio = 16,
668 .enable_high = 1, 668 .enable_high = 1,
669 .init_data = &vcc_sdhi1_init_data, 669 .init_data = &vcc_sdhi1_init_data,
670}; 670};
@@ -693,7 +693,7 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
693 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | 693 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
694 MMC_CAP_POWER_OFF_CARD, 694 MMC_CAP_POWER_OFF_CARD,
695 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 695 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
696 .cd_gpio = GPIO_PORT167, 696 .cd_gpio = 167,
697}; 697};
698 698
699static struct resource sdhi0_resources[] = { 699static struct resource sdhi0_resources[] = {
@@ -736,7 +736,7 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
736 MMC_CAP_POWER_OFF_CARD, 736 MMC_CAP_POWER_OFF_CARD,
737 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 737 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
738 /* Port72 cannot generate IRQs, will be used in polling mode. */ 738 /* Port72 cannot generate IRQs, will be used in polling mode. */
739 .cd_gpio = GPIO_PORT72, 739 .cd_gpio = 72,
740}; 740};
741 741
742static struct resource sdhi1_resources[] = { 742static struct resource sdhi1_resources[] = {
@@ -1046,6 +1046,35 @@ static struct platform_device *eva_devices[] __initdata = {
1046}; 1046};
1047 1047
1048static const struct pinctrl_map eva_pinctrl_map[] = { 1048static const struct pinctrl_map eva_pinctrl_map[] = {
1049 /* CEU0 */
1050 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1051 "ceu0_data_0_7", "ceu0"),
1052 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1053 "ceu0_clk_0", "ceu0"),
1054 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1055 "ceu0_sync", "ceu0"),
1056 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-r8a7740",
1057 "ceu0_field", "ceu0"),
1058 /* FSIA */
1059 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1060 "fsia_sclk_in", "fsia"),
1061 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1062 "fsia_mclk_out", "fsia"),
1063 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1064 "fsia_data_in_1", "fsia"),
1065 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-r8a7740",
1066 "fsia_data_out_0", "fsia"),
1067 /* FSIB */
1068 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740",
1069 "fsib_mclk_in", "fsib"),
1070 /* GETHER */
1071 PIN_MAP_MUX_GROUP_DEFAULT("sh-eth", "pfc-r8a7740",
1072 "gether_mii", "gether"),
1073 PIN_MAP_MUX_GROUP_DEFAULT("sh-eth", "pfc-r8a7740",
1074 "gether_int", "gether"),
1075 /* HDMI */
1076 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740",
1077 "hdmi", "hdmi"),
1049 /* LCD0 */ 1078 /* LCD0 */
1050 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740", 1079 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
1051 "lcd0_data24_0", "lcd0"), 1080 "lcd0_data24_0", "lcd0"),
@@ -1058,6 +1087,9 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
1058 "mmc0_data8_1", "mmc0"), 1087 "mmc0_data8_1", "mmc0"),
1059 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740", 1088 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-r8a7740",
1060 "mmc0_ctrl_1", "mmc0"), 1089 "mmc0_ctrl_1", "mmc0"),
1090 /* SCIFA1 */
1091 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.1", "pfc-r8a7740",
1092 "scifa1_data", "scifa1"),
1061 /* SDHI0 */ 1093 /* SDHI0 */
1062 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740", 1094 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1063 "sdhi0_data4", "sdhi0"), 1095 "sdhi0_data4", "sdhi0"),
@@ -1065,6 +1097,12 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
1065 "sdhi0_ctrl", "sdhi0"), 1097 "sdhi0_ctrl", "sdhi0"),
1066 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740", 1098 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7740",
1067 "sdhi0_wp", "sdhi0"), 1099 "sdhi0_wp", "sdhi0"),
1100 /* ST1232 */
1101 PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740",
1102 "intc_irq10", "intc"),
1103 /* USBHS */
1104 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740",
1105 "intc_irq7_1", "intc"),
1068}; 1106};
1069 1107
1070static void __init eva_clock_init(void) 1108static void __init eva_clock_init(void)
@@ -1119,40 +1157,14 @@ static void __init eva_init(void)
1119 r8a7740_pinmux_init(); 1157 r8a7740_pinmux_init();
1120 r8a7740_meram_workaround(); 1158 r8a7740_meram_workaround();
1121 1159
1122 /* SCIFA1 */
1123 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
1124 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
1125
1126 /* LCDC0 */ 1160 /* LCDC0 */
1127 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
1128
1129 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1161 gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1130 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ 1162 gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
1131 1163
1132 /* Touchscreen */ 1164 /* Touchscreen */
1133 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */ 1165 gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
1134 1166
1135 /* GETHER */ 1167 /* GETHER */
1136 gpio_request(GPIO_FN_ET_CRS, NULL);
1137 gpio_request(GPIO_FN_ET_MDC, NULL);
1138 gpio_request(GPIO_FN_ET_MDIO, NULL);
1139 gpio_request(GPIO_FN_ET_TX_ER, NULL);
1140 gpio_request(GPIO_FN_ET_RX_ER, NULL);
1141 gpio_request(GPIO_FN_ET_ERXD0, NULL);
1142 gpio_request(GPIO_FN_ET_ERXD1, NULL);
1143 gpio_request(GPIO_FN_ET_ERXD2, NULL);
1144 gpio_request(GPIO_FN_ET_ERXD3, NULL);
1145 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
1146 gpio_request(GPIO_FN_ET_TX_EN, NULL);
1147 gpio_request(GPIO_FN_ET_ETXD0, NULL);
1148 gpio_request(GPIO_FN_ET_ETXD1, NULL);
1149 gpio_request(GPIO_FN_ET_ETXD2, NULL);
1150 gpio_request(GPIO_FN_ET_ETXD3, NULL);
1151 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
1152 gpio_request(GPIO_FN_ET_COL, NULL);
1153 gpio_request(GPIO_FN_ET_RX_DV, NULL);
1154 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
1155
1156 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */ 1168 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
1157 1169
1158 /* USB */ 1170 /* USB */
@@ -1163,34 +1175,17 @@ static void __init eva_init(void)
1163 } else { 1175 } else {
1164 /* USB Func */ 1176 /* USB Func */
1165 /* 1177 /*
1166 * A1 chip has 2 IRQ7 pin and it was controled by MSEL register. 1178 * The USBHS interrupt handlers needs to read the IRQ pin value
1167 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide 1179 * (HI/LOW) to diffentiate USB connection and disconnection
1168 * USB connection/disconnection (usbhsf_get_vbus()). 1180 * events (usbhsf_get_vbus()). We thus need to select both the
1169 * This means we needs to select GPIO_FN_IRQ7_PORT209 first, 1181 * intc_irq7_1 pin group and GPIO 209 here.
1170 * and select GPIO 209 here
1171 */ 1182 */
1172 gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
1173 gpio_request_one(209, GPIOF_IN, NULL); 1183 gpio_request_one(209, GPIOF_IN, NULL);
1174 1184
1175 platform_device_register(&usbhsf_device); 1185 platform_device_register(&usbhsf_device);
1176 usb = &usbhsf_device; 1186 usb = &usbhsf_device;
1177 } 1187 }
1178 1188
1179 /* CEU0 */
1180 gpio_request(GPIO_FN_VIO0_D7, NULL);
1181 gpio_request(GPIO_FN_VIO0_D6, NULL);
1182 gpio_request(GPIO_FN_VIO0_D5, NULL);
1183 gpio_request(GPIO_FN_VIO0_D4, NULL);
1184 gpio_request(GPIO_FN_VIO0_D3, NULL);
1185 gpio_request(GPIO_FN_VIO0_D2, NULL);
1186 gpio_request(GPIO_FN_VIO0_D1, NULL);
1187 gpio_request(GPIO_FN_VIO0_D0, NULL);
1188 gpio_request(GPIO_FN_VIO0_CLK, NULL);
1189 gpio_request(GPIO_FN_VIO0_HD, NULL);
1190 gpio_request(GPIO_FN_VIO0_VD, NULL);
1191 gpio_request(GPIO_FN_VIO0_FIELD, NULL);
1192 gpio_request(GPIO_FN_VIO_CKO, NULL);
1193
1194 /* CON1/CON15 Camera */ 1189 /* CON1/CON15 Camera */
1195 gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */ 1190 gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */
1196 gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */ 1191 gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
@@ -1198,24 +1193,11 @@ static void __init eva_init(void)
1198 gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */ 1193 gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */
1199 1194
1200 /* FSI-WM8978 */ 1195 /* FSI-WM8978 */
1201 gpio_request(GPIO_FN_FSIAIBT, NULL);
1202 gpio_request(GPIO_FN_FSIAILR, NULL);
1203 gpio_request(GPIO_FN_FSIAOMC, NULL);
1204 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1205 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
1206
1207 gpio_request(7, NULL); 1196 gpio_request(7, NULL);
1208 gpio_request(8, NULL); 1197 gpio_request(8, NULL);
1209 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */ 1198 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1210 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */ 1199 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
1211 1200
1212 /* FSI-HDMI */
1213 gpio_request(GPIO_FN_FSIBCK, NULL);
1214
1215 /* HDMI */
1216 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1217 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1218
1219 /* 1201 /*
1220 * CAUTION 1202 * CAUTION
1221 * 1203 *
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 38e5e50fb318..d5554646916c 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -18,13 +18,52 @@
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/mfd/tmio.h>
22#include <linux/mmc/host.h>
23#include <linux/mtd/partitions.h>
24#include <linux/pinctrl/machine.h>
21#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/regulator/fixed.h>
27#include <linux/regulator/machine.h>
22#include <linux/smsc911x.h> 28#include <linux/smsc911x.h>
29#include <linux/spi/spi.h>
30#include <linux/spi/flash.h>
23#include <mach/common.h> 31#include <mach/common.h>
24#include <mach/irqs.h> 32#include <mach/irqs.h>
25#include <mach/r8a7778.h> 33#include <mach/r8a7778.h>
26#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
27 35
36/*
37 * CN9(Upper side) SCIF/RCAN selection
38 *
39 * 1,4 3,6
40 * SW40 SCIF RCAN
41 * SW41 SCIF RCAN
42 */
43
44/*
45 * MMC (CN26) pin
46 *
47 * SW6 (D2) 3 pin
48 * SW7 (D5) ON
49 * SW8 (D3) 3 pin
50 * SW10 (D4) 1 pin
51 * SW12 (CLK) 1 pin
52 * SW13 (D6) 3 pin
53 * SW14 (CMD) ON
54 * SW15 (D6) 1 pin
55 * SW16 (D0) ON
56 * SW17 (D1) ON
57 * SW18 (D7) 3 pin
58 * SW19 (MMC) 1 pin
59 */
60
61/* Dummy supplies, where voltage doesn't matter */
62static struct regulator_consumer_supply dummy_supplies[] = {
63 REGULATOR_SUPPLY("vddvario", "smsc911x"),
64 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
65};
66
28static struct smsc911x_platform_config smsc911x_data = { 67static struct smsc911x_platform_config smsc911x_data = {
29 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 68 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
30 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, 69 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
@@ -37,17 +76,128 @@ static struct resource smsc911x_resources[] = {
37 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */ 76 DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
38}; 77};
39 78
79/* USB */
80static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
81
82/* SDHI */
83static struct sh_mobile_sdhi_info sdhi0_info = {
84 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
85 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
86 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
87};
88
89static struct sh_eth_plat_data ether_platform_data __initdata = {
90 .phy = 0x01,
91 .edmac_endian = EDMAC_LITTLE_ENDIAN,
92 .register_type = SH_ETH_REG_FAST_RCAR,
93 .phy_interface = PHY_INTERFACE_MODE_RMII,
94 /*
95 * Although the LINK signal is available on the board, it's connected to
96 * the link/activity LED output of the PHY, thus the link disappears and
97 * reappears after each packet. We'd be better off ignoring such signal
98 * and getting the link state from the PHY indirectly.
99 */
100 .no_ether_link = 1,
101};
102
103/* I2C */
104static struct i2c_board_info i2c0_devices[] = {
105 {
106 I2C_BOARD_INFO("rx8581", 0x51),
107 },
108};
109
110/* HSPI*/
111static struct mtd_partition m25p80_spi_flash_partitions[] = {
112 {
113 .name = "data(spi)",
114 .size = 0x0100000,
115 .offset = 0,
116 },
117};
118
119static struct flash_platform_data spi_flash_data = {
120 .name = "m25p80",
121 .type = "s25fl008k",
122 .parts = m25p80_spi_flash_partitions,
123 .nr_parts = ARRAY_SIZE(m25p80_spi_flash_partitions),
124};
125
126static struct spi_board_info spi_board_info[] __initdata = {
127 {
128 .modalias = "m25p80",
129 .max_speed_hz = 104000000,
130 .chip_select = 0,
131 .bus_num = 0,
132 .mode = SPI_MODE_0,
133 .platform_data = &spi_flash_data,
134 },
135};
136
137/* MMC */
138static struct sh_mmcif_plat_data sh_mmcif_plat = {
139 .sup_pclk = 0,
140 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
141 .caps = MMC_CAP_4_BIT_DATA |
142 MMC_CAP_8_BIT_DATA |
143 MMC_CAP_NEEDS_POLL,
144};
145
146static const struct pinctrl_map bockw_pinctrl_map[] = {
147 /* Ether */
148 PIN_MAP_MUX_GROUP_DEFAULT("r8a777x-ether", "pfc-r8a7778",
149 "ether_rmii", "ether"),
150 /* HSPI0 */
151 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7778",
152 "hspi0_a", "hspi0"),
153 /* MMC */
154 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif", "pfc-r8a7778",
155 "mmc_data8", "mmc"),
156 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif", "pfc-r8a7778",
157 "mmc_ctrl", "mmc"),
158 /* SCIF0 */
159 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
160 "scif0_data_a", "scif0"),
161 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
162 "scif0_ctrl", "scif0"),
163 /* USB */
164 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
165 "usb0", "usb0"),
166 PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
167 "usb1", "usb1"),
168 /* SDHI0 */
169 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
170 "sdhi0", "sdhi0"),
171};
172
173#define FPGA 0x18200000
40#define IRQ0MR 0x30 174#define IRQ0MR 0x30
175#define PFC 0xfffc0000
176#define PUPR4 0x110
41static void __init bockw_init(void) 177static void __init bockw_init(void)
42{ 178{
43 void __iomem *fpga; 179 void __iomem *base;
44 180
45 r8a7778_clock_init(); 181 r8a7778_clock_init();
46 r8a7778_init_irq_extpin(1); 182 r8a7778_init_irq_extpin(1);
47 r8a7778_add_standard_devices(); 183 r8a7778_add_standard_devices();
184 r8a7778_add_usb_phy_device(&usb_phy_platform_data);
185 r8a7778_add_ether_device(&ether_platform_data);
186 r8a7778_add_i2c_device(0);
187 r8a7778_add_hspi_device(0);
188 r8a7778_add_mmc_device(&sh_mmcif_plat);
48 189
49 fpga = ioremap_nocache(0x18200000, SZ_1M); 190 i2c_register_board_info(0, i2c0_devices,
50 if (fpga) { 191 ARRAY_SIZE(i2c0_devices));
192 spi_register_board_info(spi_board_info,
193 ARRAY_SIZE(spi_board_info));
194 pinctrl_register_mappings(bockw_pinctrl_map,
195 ARRAY_SIZE(bockw_pinctrl_map));
196 r8a7778_pinmux_init();
197
198 /* for SMSC */
199 base = ioremap_nocache(FPGA, SZ_1M);
200 if (base) {
51 /* 201 /*
52 * CAUTION 202 * CAUTION
53 * 203 *
@@ -55,16 +205,33 @@ static void __init bockw_init(void)
55 * it should be cared in the future 205 * it should be cared in the future
56 * Now, it is assuming IRQ0 was used only from SMSC. 206 * Now, it is assuming IRQ0 was used only from SMSC.
57 */ 207 */
58 u16 val = ioread16(fpga + IRQ0MR); 208 u16 val = ioread16(base + IRQ0MR);
59 val &= ~(1 << 4); /* enable SMSC911x */ 209 val &= ~(1 << 4); /* enable SMSC911x */
60 iowrite16(val, fpga + IRQ0MR); 210 iowrite16(val, base + IRQ0MR);
61 iounmap(fpga); 211 iounmap(base);
212
213 regulator_register_fixed(0, dummy_supplies,
214 ARRAY_SIZE(dummy_supplies));
62 215
63 platform_device_register_resndata( 216 platform_device_register_resndata(
64 &platform_bus, "smsc911x", -1, 217 &platform_bus, "smsc911x", -1,
65 smsc911x_resources, ARRAY_SIZE(smsc911x_resources), 218 smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
66 &smsc911x_data, sizeof(smsc911x_data)); 219 &smsc911x_data, sizeof(smsc911x_data));
67 } 220 }
221
222 /* for SDHI */
223 base = ioremap_nocache(PFC, 0x200);
224 if (base) {
225 /*
226 * FIXME
227 *
228 * SDHI CD/WP pin needs pull-up
229 */
230 iowrite32(ioread32(base + PUPR4) | (3 << 26), base + PUPR4);
231 iounmap(base);
232
233 r8a7778_sdhi_init(0, &sdhi0_info);
234 }
68} 235}
69 236
70static const char *bockw_boards_compat_dt[] __initdata = { 237static const char *bockw_boards_compat_dt[] __initdata = {
@@ -78,4 +245,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw")
78 .init_machine = bockw_init, 245 .init_machine = bockw_init,
79 .init_time = shmobile_timer_init, 246 .init_time = shmobile_timer_init,
80 .dt_compat = bockw_boards_compat_dt, 247 .dt_compat = bockw_boards_compat_dt,
248 .init_late = r8a7778_init_late,
81MACHINE_END 249MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
deleted file mode 100644
index 70d992c540ae..000000000000
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ /dev/null
@@ -1,495 +0,0 @@
1/*
2 * bonito board support
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#include <linux/kernel.h>
23#include <linux/i2c.h>
24#include <linux/init.h>
25#include <linux/interrupt.h>
26#include <linux/irq.h>
27#include <linux/pinctrl/machine.h>
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h>
32#include <linux/smsc911x.h>
33#include <linux/videodev2.h>
34#include <mach/common.h>
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/time.h>
39#include <asm/hardware/cache-l2x0.h>
40#include <mach/r8a7740.h>
41#include <mach/irqs.h>
42#include <video/sh_mobile_lcdc.h>
43
44/*
45 * CS Address device note
46 *----------------------------------------------------------------
47 * 0 0x0000_0000 NOR Flash (64MB) SW12 : bit3 = OFF
48 * 2 0x0800_0000 ExtNOR (64MB) SW12 : bit3 = OFF
49 * 4 -
50 * 5A -
51 * 5B 0x1600_0000 SRAM (8MB)
52 * 6 0x1800_0000 FPGA (64K)
53 * 0x1801_0000 Ether (4KB)
54 * 0x1801_1000 USB (4KB)
55 */
56
57/*
58 * SW12
59 *
60 * bit1 bit2 bit3
61 *----------------------------------------------------------------------------
62 * ON NOR WriteProtect NAND WriteProtect CS0 ExtNOR / CS2 NOR
63 * OFF NOR Not WriteProtect NAND Not WriteProtect CS0 NOR / CS2 ExtNOR
64 */
65
66/*
67 * SCIFA5 (CN42)
68 *
69 * S38.3 = ON
70 * S39.6 = ON
71 * S43.1 = ON
72 */
73
74/*
75 * LCDC0 (CN3/CN4/CN7)
76 *
77 * S38.1 = OFF
78 * S38.2 = OFF
79 */
80
81/* Dummy supplies, where voltage doesn't matter */
82static struct regulator_consumer_supply dummy_supplies[] = {
83 REGULATOR_SUPPLY("vddvario", "smsc911x"),
84 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
85};
86
87/*
88 * FPGA
89 */
90#define IRQSR0 0x0020
91#define IRQSR1 0x0022
92#define IRQMR0 0x0030
93#define IRQMR1 0x0032
94#define BUSSWMR1 0x0070
95#define BUSSWMR2 0x0072
96#define BUSSWMR3 0x0074
97#define BUSSWMR4 0x0076
98
99#define LCDCR 0x10B4
100#define DEVRSTCR1 0x10D0
101#define DEVRSTCR2 0x10D2
102#define A1MDSR 0x10E0
103#define BVERR 0x1100
104
105/* FPGA IRQ */
106#define FPGA_IRQ_BASE (512)
107#define FPGA_IRQ0 (FPGA_IRQ_BASE)
108#define FPGA_IRQ1 (FPGA_IRQ_BASE + 16)
109#define FPGA_ETH_IRQ (FPGA_IRQ0 + 15)
110static u16 bonito_fpga_read(u32 offset)
111{
112 return __raw_readw(IOMEM(0xf0003000) + offset);
113}
114
115static void bonito_fpga_write(u32 offset, u16 val)
116{
117 __raw_writew(val, IOMEM(0xf0003000) + offset);
118}
119
120static void bonito_fpga_irq_disable(struct irq_data *data)
121{
122 unsigned int irq = data->irq;
123 u32 addr = (irq < 1016) ? IRQMR0 : IRQMR1;
124 int shift = irq % 16;
125
126 bonito_fpga_write(addr, bonito_fpga_read(addr) | (1 << shift));
127}
128
129static void bonito_fpga_irq_enable(struct irq_data *data)
130{
131 unsigned int irq = data->irq;
132 u32 addr = (irq < 1016) ? IRQMR0 : IRQMR1;
133 int shift = irq % 16;
134
135 bonito_fpga_write(addr, bonito_fpga_read(addr) & ~(1 << shift));
136}
137
138static struct irq_chip bonito_fpga_irq_chip __read_mostly = {
139 .name = "bonito FPGA",
140 .irq_mask = bonito_fpga_irq_disable,
141 .irq_unmask = bonito_fpga_irq_enable,
142};
143
144static void bonito_fpga_irq_demux(unsigned int irq, struct irq_desc *desc)
145{
146 u32 val = bonito_fpga_read(IRQSR1) << 16 |
147 bonito_fpga_read(IRQSR0);
148 u32 mask = bonito_fpga_read(IRQMR1) << 16 |
149 bonito_fpga_read(IRQMR0);
150
151 int i;
152
153 val &= ~mask;
154
155 for (i = 0; i < 32; i++) {
156 if (!(val & (1 << i)))
157 continue;
158
159 generic_handle_irq(FPGA_IRQ_BASE + i);
160 }
161}
162
163static void bonito_fpga_init(void)
164{
165 int i;
166
167 bonito_fpga_write(IRQMR0, 0xffff); /* mask all */
168 bonito_fpga_write(IRQMR1, 0xffff); /* mask all */
169
170 /* Device reset */
171 bonito_fpga_write(DEVRSTCR1,
172 (1 << 2)); /* Eth */
173
174 /* FPGA irq require special handling */
175 for (i = FPGA_IRQ_BASE; i < FPGA_IRQ_BASE + 32; i++) {
176 irq_set_chip_and_handler_name(i, &bonito_fpga_irq_chip,
177 handle_level_irq, "level");
178 set_irq_flags(i, IRQF_VALID); /* yuck */
179 }
180
181 irq_set_chained_handler(evt2irq(0x0340), bonito_fpga_irq_demux);
182 irq_set_irq_type(evt2irq(0x0340), IRQ_TYPE_LEVEL_LOW);
183}
184
185/*
186* PMIC settings
187*
188* FIXME
189*
190* bonito board needs some settings by pmic which use i2c access.
191* pmic settings use device_initcall() here for use it.
192*/
193static __u8 *pmic_settings = NULL;
194static __u8 pmic_do_2A[] = {
195 0x1C, 0x09,
196 0x1A, 0x80,
197 0xff, 0xff,
198};
199
200static int __init pmic_init(void)
201{
202 struct i2c_adapter *a = i2c_get_adapter(0);
203 struct i2c_msg msg;
204 __u8 buf[2];
205 int i, ret;
206
207 if (!pmic_settings)
208 return 0;
209 if (!a)
210 return 0;
211
212 msg.addr = 0x46;
213 msg.buf = buf;
214 msg.len = 2;
215 msg.flags = 0;
216
217 for (i = 0; ; i += 2) {
218 buf[0] = pmic_settings[i + 0];
219 buf[1] = pmic_settings[i + 1];
220
221 if ((0xff == buf[0]) && (0xff == buf[1]))
222 break;
223
224 ret = i2c_transfer(a, &msg, 1);
225 if (ret < 0) {
226 pr_err("i2c transfer fail\n");
227 break;
228 }
229 }
230
231 return 0;
232}
233device_initcall(pmic_init);
234
235/*
236 * LCDC0
237 */
238static const struct fb_videomode lcdc0_mode = {
239 .name = "WVGA Panel",
240 .xres = 800,
241 .yres = 480,
242 .left_margin = 88,
243 .right_margin = 40,
244 .hsync_len = 128,
245 .upper_margin = 20,
246 .lower_margin = 5,
247 .vsync_len = 5,
248 .sync = 0,
249};
250
251static struct sh_mobile_lcdc_info lcdc0_info = {
252 .clock_source = LCDC_CLK_BUS,
253 .ch[0] = {
254 .chan = LCDC_CHAN_MAINLCD,
255 .fourcc = V4L2_PIX_FMT_RGB565,
256 .interface_type = RGB24,
257 .clock_divider = 5,
258 .flags = 0,
259 .lcd_modes = &lcdc0_mode,
260 .num_modes = 1,
261 .panel_cfg = {
262 .width = 152,
263 .height = 91,
264 },
265 },
266};
267
268static struct resource lcdc0_resources[] = {
269 [0] = {
270 .name = "LCDC0",
271 .start = 0xfe940000,
272 .end = 0xfe943fff,
273 .flags = IORESOURCE_MEM,
274 },
275 [1] = {
276 .start = intcs_evt2irq(0x0580),
277 .flags = IORESOURCE_IRQ,
278 },
279};
280
281static struct platform_device lcdc0_device = {
282 .name = "sh_mobile_lcdc_fb",
283 .id = 0,
284 .resource = lcdc0_resources,
285 .num_resources = ARRAY_SIZE(lcdc0_resources),
286 .dev = {
287 .platform_data = &lcdc0_info,
288 .coherent_dma_mask = ~0,
289 },
290};
291
292static const struct pinctrl_map lcdc0_pinctrl_map[] = {
293 /* LCD0 */
294 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
295 "lcd0_data24_1", "lcd0"),
296 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
297 "lcd0_lclk_1", "lcd0"),
298 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-r8a7740",
299 "lcd0_sync", "lcd0"),
300};
301
302/*
303 * SMSC 9221
304 */
305static struct resource smsc_resources[] = {
306 [0] = {
307 .start = 0x18010000,
308 .end = 0x18011000 - 1,
309 .flags = IORESOURCE_MEM,
310 },
311 [1] = {
312 .start = FPGA_ETH_IRQ,
313 .flags = IORESOURCE_IRQ,
314 },
315};
316
317static struct smsc911x_platform_config smsc_platdata = {
318 .flags = SMSC911X_USE_16BIT,
319 .phy_interface = PHY_INTERFACE_MODE_MII,
320 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
321 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
322};
323
324static struct platform_device smsc_device = {
325 .name = "smsc911x",
326 .dev = {
327 .platform_data = &smsc_platdata,
328 },
329 .resource = smsc_resources,
330 .num_resources = ARRAY_SIZE(smsc_resources),
331};
332
333/*
334 * core board devices
335 */
336static struct platform_device *bonito_core_devices[] __initdata = {
337};
338
339/*
340 * base board devices
341 */
342static struct platform_device *bonito_base_devices[] __initdata = {
343 &lcdc0_device,
344 &smsc_device,
345};
346
347/*
348 * map I/O
349 */
350static struct map_desc bonito_io_desc[] __initdata = {
351 /*
352 * for FPGA (0x1800000-0x19ffffff)
353 * 0x18000000-0x18002000 -> 0xf0003000-0xf0005000
354 */
355 {
356 .virtual = 0xf0003000,
357 .pfn = __phys_to_pfn(0x18000000),
358 .length = PAGE_SIZE * 2,
359 .type = MT_DEVICE_NONSHARED
360 }
361};
362
363static void __init bonito_map_io(void)
364{
365 r8a7740_map_io();
366 iotable_init(bonito_io_desc, ARRAY_SIZE(bonito_io_desc));
367}
368
369/*
370 * board init
371 */
372#define BIT_ON(sw, bit) (sw & (1 << bit))
373#define BIT_OFF(sw, bit) (!(sw & (1 << bit)))
374
375#define VCCQ1CR IOMEM(0xE6058140)
376#define VCCQ1LCDCR IOMEM(0xE6058186)
377
378static void __init bonito_init(void)
379{
380 u16 val;
381
382 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
383
384 r8a7740_pinmux_init();
385 bonito_fpga_init();
386
387 pmic_settings = pmic_do_2A;
388
389 /*
390 * core board settings
391 */
392
393#ifdef CONFIG_CACHE_L2X0
394 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
395 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
396#endif
397
398 r8a7740_add_standard_devices();
399
400 platform_add_devices(bonito_core_devices,
401 ARRAY_SIZE(bonito_core_devices));
402
403 /*
404 * base board settings
405 */
406 gpio_request_one(176, GPIOF_IN, NULL);
407 if (!gpio_get_value(176)) {
408 u16 bsw2;
409 u16 bsw3;
410 u16 bsw4;
411
412 /*
413 * FPGA
414 */
415 gpio_request(GPIO_FN_CS5B, NULL);
416 gpio_request(GPIO_FN_CS6A, NULL);
417 gpio_request(GPIO_FN_CS5A_PORT105, NULL);
418 gpio_request(GPIO_FN_IRQ10, NULL);
419
420 val = bonito_fpga_read(BVERR);
421 pr_info("bonito version: cpu %02x, base %02x\n",
422 ((val >> 8) & 0xFF),
423 ((val >> 0) & 0xFF));
424
425 bsw2 = bonito_fpga_read(BUSSWMR2);
426 bsw3 = bonito_fpga_read(BUSSWMR3);
427 bsw4 = bonito_fpga_read(BUSSWMR4);
428
429 /*
430 * SCIFA5 (CN42)
431 */
432 if (BIT_OFF(bsw2, 1) && /* S38.3 = ON */
433 BIT_OFF(bsw3, 9) && /* S39.6 = ON */
434 BIT_OFF(bsw4, 4)) { /* S43.1 = ON */
435 gpio_request(GPIO_FN_SCIFA5_TXD_PORT91, NULL);
436 gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL);
437 }
438
439 /*
440 * LCDC0 (CN3)
441 */
442 if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */
443 BIT_ON(bsw2, 2)) { /* S38.2 = OFF */
444 pinctrl_register_mappings(lcdc0_pinctrl_map,
445 ARRAY_SIZE(lcdc0_pinctrl_map));
446 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
447
448 gpio_request_one(61, GPIOF_OUT_INIT_HIGH,
449 NULL); /* LCDDON */
450
451 /* backlight on */
452 bonito_fpga_write(LCDCR, 1);
453
454 /* drivability Max */
455 __raw_writew(0x00FF , VCCQ1LCDCR);
456 __raw_writew(0xFFFF , VCCQ1CR);
457 }
458
459 platform_add_devices(bonito_base_devices,
460 ARRAY_SIZE(bonito_base_devices));
461 }
462}
463
464static void __init bonito_earlytimer_init(void)
465{
466 u16 val;
467 u8 md_ck = 0;
468
469 /* read MD_CK value */
470 val = bonito_fpga_read(A1MDSR);
471 if (val & (1 << 10))
472 md_ck |= MD_CK2;
473 if (val & (1 << 9))
474 md_ck |= MD_CK1;
475 if (val & (1 << 8))
476 md_ck |= MD_CK0;
477
478 r8a7740_clock_init(md_ck);
479 shmobile_earlytimer_init();
480}
481
482static void __init bonito_add_early_devices(void)
483{
484 r8a7740_add_early_devices();
485}
486
487MACHINE_START(BONITO, "bonito")
488 .map_io = bonito_map_io,
489 .init_early = bonito_add_early_devices,
490 .init_irq = r8a7740_init_irq,
491 .handle_irq = shmobile_handle_irq_intc,
492 .init_machine = bonito_init,
493 .init_late = shmobile_init_late,
494 .init_time = bonito_earlytimer_init,
495MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
index c016ccd92433..4368000e1127 100644
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -56,7 +56,7 @@ static struct smsc911x_platform_config smsc911x_platdata = {
56 56
57static struct platform_device smsc91x_device = { 57static struct platform_device smsc91x_device = {
58 .name = "smsc911x", 58 .name = "smsc911x",
59 .id = 0, 59 .id = -1,
60 .dev = { 60 .dev = {
61 .platform_data = &smsc911x_platdata, 61 .platform_data = &smsc911x_platdata,
62 }, 62 },
diff --git a/arch/arm/mach-shmobile/board-kzm9g-reference.c b/arch/arm/mach-shmobile/board-kzm9g-reference.c
index aefa50d385b7..44055fe8a45c 100644
--- a/arch/arm/mach-shmobile/board-kzm9g-reference.c
+++ b/arch/arm/mach-shmobile/board-kzm9g-reference.c
@@ -79,7 +79,6 @@ static void __init kzm_init(void)
79 sh73a0_pinmux_init(); 79 sh73a0_pinmux_init();
80 80
81 /* enable SD */ 81 /* enable SD */
82 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
83 gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */ 82 gpio_request_one(15, GPIOF_OUT_INIT_HIGH, NULL); /* power */
84 83
85 gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */ 84 gpio_request_one(14, GPIOF_OUT_INIT_HIGH, NULL); /* power */
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index e6b775a10aad..165483c9bee2 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -29,6 +29,7 @@
29#include <linux/mmc/host.h> 29#include <linux/mmc/host.h>
30#include <linux/mmc/sh_mmcif.h> 30#include <linux/mmc/sh_mmcif.h>
31#include <linux/mmc/sh_mobile_sdhi.h> 31#include <linux/mmc/sh_mobile_sdhi.h>
32#include <linux/mfd/as3711.h>
32#include <linux/mfd/tmio.h> 33#include <linux/mfd/tmio.h>
33#include <linux/pinctrl/machine.h> 34#include <linux/pinctrl/machine.h>
34#include <linux/pinctrl/pinconf-generic.h> 35#include <linux/pinctrl/pinconf-generic.h>
@@ -606,6 +607,140 @@ static struct platform_device fsi_ak4648_device = {
606}; 607};
607 608
608/* I2C */ 609/* I2C */
610
611/* StepDown1 is used to supply 1.315V to the CPU */
612static struct regulator_init_data as3711_sd1 = {
613 .constraints = {
614 .name = "1.315V CPU",
615 .boot_on = 1,
616 .always_on = 1,
617 .min_uV = 1315000,
618 .max_uV = 1335000,
619 },
620};
621
622/* StepDown2 is used to supply 1.8V to the CPU and to the board */
623static struct regulator_init_data as3711_sd2 = {
624 .constraints = {
625 .name = "1.8V",
626 .boot_on = 1,
627 .always_on = 1,
628 .min_uV = 1800000,
629 .max_uV = 1800000,
630 },
631};
632
633/*
634 * StepDown3 is switched in parallel with StepDown2, seems to be off,
635 * according to read-back pre-set register values
636 */
637
638/* StepDown4 is used to supply 1.215V to the CPU and to the board */
639static struct regulator_init_data as3711_sd4 = {
640 .constraints = {
641 .name = "1.215V",
642 .boot_on = 1,
643 .always_on = 1,
644 .min_uV = 1215000,
645 .max_uV = 1235000,
646 },
647};
648
649/* LDO1 is unused and unconnected */
650
651/* LDO2 is used to supply 2.8V to the CPU */
652static struct regulator_init_data as3711_ldo2 = {
653 .constraints = {
654 .name = "2.8V CPU",
655 .boot_on = 1,
656 .always_on = 1,
657 .min_uV = 2800000,
658 .max_uV = 2800000,
659 },
660};
661
662/* LDO3 is used to supply 3.0V to the CPU */
663static struct regulator_init_data as3711_ldo3 = {
664 .constraints = {
665 .name = "3.0V CPU",
666 .boot_on = 1,
667 .always_on = 1,
668 .min_uV = 3000000,
669 .max_uV = 3000000,
670 },
671};
672
673/* LDO4 is used to supply 2.8V to the board */
674static struct regulator_init_data as3711_ldo4 = {
675 .constraints = {
676 .name = "2.8V",
677 .boot_on = 1,
678 .always_on = 1,
679 .min_uV = 2800000,
680 .max_uV = 2800000,
681 },
682};
683
684/* LDO5 is switched parallel to LDO4, also set to 2.8V */
685static struct regulator_init_data as3711_ldo5 = {
686 .constraints = {
687 .name = "2.8V #2",
688 .boot_on = 1,
689 .always_on = 1,
690 .min_uV = 2800000,
691 .max_uV = 2800000,
692 },
693};
694
695/* LDO6 is unused and unconnected */
696
697/* LDO7 is used to supply 1.15V to the CPU */
698static struct regulator_init_data as3711_ldo7 = {
699 .constraints = {
700 .name = "1.15V CPU",
701 .boot_on = 1,
702 .always_on = 1,
703 .min_uV = 1150000,
704 .max_uV = 1150000,
705 },
706};
707
708/* LDO8 is switched parallel to LDO7, also set to 1.15V */
709static struct regulator_init_data as3711_ldo8 = {
710 .constraints = {
711 .name = "1.15V CPU #2",
712 .boot_on = 1,
713 .always_on = 1,
714 .min_uV = 1150000,
715 .max_uV = 1150000,
716 },
717};
718
719static struct as3711_platform_data as3711_pdata = {
720 .regulator = {
721 .init_data = {
722 [AS3711_REGULATOR_SD_1] = &as3711_sd1,
723 [AS3711_REGULATOR_SD_2] = &as3711_sd2,
724 [AS3711_REGULATOR_SD_4] = &as3711_sd4,
725 [AS3711_REGULATOR_LDO_2] = &as3711_ldo2,
726 [AS3711_REGULATOR_LDO_3] = &as3711_ldo3,
727 [AS3711_REGULATOR_LDO_4] = &as3711_ldo4,
728 [AS3711_REGULATOR_LDO_5] = &as3711_ldo5,
729 [AS3711_REGULATOR_LDO_7] = &as3711_ldo7,
730 [AS3711_REGULATOR_LDO_8] = &as3711_ldo8,
731 },
732 },
733 .backlight = {
734 .su2_fb = "sh_mobile_lcdc_fb.0",
735 .su2_max_uA = 36000,
736 .su2_feedback = AS3711_SU2_CURR_AUTO,
737 .su2_fbprot = AS3711_SU2_GPIO4,
738 .su2_auto_curr1 = true,
739 .su2_auto_curr2 = true,
740 .su2_auto_curr3 = true,
741 },
742};
743
609static struct pcf857x_platform_data pcf8575_pdata = { 744static struct pcf857x_platform_data pcf8575_pdata = {
610 .gpio_base = GPIO_PCF8575_BASE, 745 .gpio_base = GPIO_PCF8575_BASE,
611}; 746};
@@ -625,6 +760,11 @@ static struct i2c_board_info i2c0_devices[] = {
625 I2C_BOARD_INFO("adxl34x", 0x1d), 760 I2C_BOARD_INFO("adxl34x", 0x1d),
626 .irq = irq_pin(26), /* IRQ26 */ 761 .irq = irq_pin(26), /* IRQ26 */
627 }, 762 },
763 {
764 I2C_BOARD_INFO("as3711", 0x40),
765 .irq = intcs_evt2irq(0x3300), /* IRQ24 */
766 .platform_data = &as3711_pdata,
767 },
628}; 768};
629 769
630static struct i2c_board_info i2c1_devices[] = { 770static struct i2c_board_info i2c1_devices[] = {
@@ -663,13 +803,13 @@ static unsigned long pin_pullup_conf[] = {
663 803
664static const struct pinctrl_map kzm_pinctrl_map[] = { 804static const struct pinctrl_map kzm_pinctrl_map[] = {
665 /* FSIA (AK4648) */ 805 /* FSIA (AK4648) */
666 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", 806 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
667 "fsia_mclk_in", "fsia"), 807 "fsia_mclk_in", "fsia"),
668 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", 808 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
669 "fsia_sclk_in", "fsia"), 809 "fsia_sclk_in", "fsia"),
670 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", 810 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
671 "fsia_data_in", "fsia"), 811 "fsia_data_in", "fsia"),
672 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0", 812 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2", "pfc-sh73a0",
673 "fsia_data_out", "fsia"), 813 "fsia_data_out", "fsia"),
674 /* I2C3 */ 814 /* I2C3 */
675 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0", 815 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
@@ -715,59 +855,6 @@ static const struct pinctrl_map kzm_pinctrl_map[] = {
715 "usb_vbus", "usb"), 855 "usb_vbus", "usb"),
716}; 856};
717 857
718/*
719 * FIXME
720 *
721 * This is quick hack for enabling LCDC backlight
722 */
723static int __init as3711_enable_lcdc_backlight(void)
724{
725 struct i2c_adapter *a = i2c_get_adapter(0);
726 struct i2c_msg msg;
727 int i, ret;
728 __u8 magic[] = {
729 0x40, 0x2a,
730 0x43, 0x3c,
731 0x44, 0x3c,
732 0x45, 0x3c,
733 0x54, 0x03,
734 0x51, 0x00,
735 0x51, 0x01,
736 0xff, 0x00, /* wait */
737 0x43, 0xf0,
738 0x44, 0xf0,
739 0x45, 0xf0,
740 };
741
742 if (!of_machine_is_compatible("renesas,kzm9g"))
743 return 0;
744
745 if (!a)
746 return 0;
747
748 msg.addr = 0x40;
749 msg.len = 2;
750 msg.flags = 0;
751
752 for (i = 0; i < ARRAY_SIZE(magic); i += 2) {
753 msg.buf = magic + i;
754
755 if (0xff == msg.buf[0]) {
756 udelay(500);
757 continue;
758 }
759
760 ret = i2c_transfer(a, &msg, 1);
761 if (ret < 0) {
762 pr_err("i2c transfer fail\n");
763 break;
764 }
765 }
766
767 return 0;
768}
769device_initcall(as3711_enable_lcdc_backlight);
770
771static void __init kzm_init(void) 858static void __init kzm_init(void)
772{ 859{
773 regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers, 860 regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
@@ -788,9 +875,6 @@ static void __init kzm_init(void)
788 /* Touchscreen */ 875 /* Touchscreen */
789 gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */ 876 gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */
790 877
791 /* enable SD */
792 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
793
794#ifdef CONFIG_CACHE_L2X0 878#ifdef CONFIG_CACHE_L2X0
795 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 879 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
796 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); 880 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index f587187a8603..d73e21d3ea8a 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -18,19 +18,83 @@
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/gpio.h>
22#include <linux/gpio_keys.h>
23#include <linux/input.h>
21#include <linux/interrupt.h> 24#include <linux/interrupt.h>
22#include <linux/irqchip.h> 25#include <linux/irqchip.h>
23#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/leds.h>
28#include <linux/pinctrl/machine.h>
29#include <linux/platform_data/gpio-rcar.h>
24#include <linux/platform_device.h> 30#include <linux/platform_device.h>
25#include <mach/common.h> 31#include <mach/common.h>
26#include <mach/r8a7790.h> 32#include <mach/r8a7790.h>
27#include <asm/mach-types.h> 33#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
29 35
36/* LEDS */
37static struct gpio_led lager_leds[] = {
38 {
39 .name = "led8",
40 .gpio = RCAR_GP_PIN(5, 17),
41 .default_state = LEDS_GPIO_DEFSTATE_ON,
42 }, {
43 .name = "led7",
44 .gpio = RCAR_GP_PIN(4, 23),
45 .default_state = LEDS_GPIO_DEFSTATE_ON,
46 }, {
47 .name = "led6",
48 .gpio = RCAR_GP_PIN(4, 22),
49 .default_state = LEDS_GPIO_DEFSTATE_ON,
50 },
51};
52
53static __initdata struct gpio_led_platform_data lager_leds_pdata = {
54 .leds = lager_leds,
55 .num_leds = ARRAY_SIZE(lager_leds),
56};
57
58/* GPIO KEY */
59#define GPIO_KEY(c, g, d, ...) \
60 { .code = c, .gpio = g, .desc = d, .active_low = 1 }
61
62static __initdata struct gpio_keys_button gpio_buttons[] = {
63 GPIO_KEY(KEY_4, RCAR_GP_PIN(1, 28), "SW2-pin4"),
64 GPIO_KEY(KEY_3, RCAR_GP_PIN(1, 26), "SW2-pin3"),
65 GPIO_KEY(KEY_2, RCAR_GP_PIN(1, 24), "SW2-pin2"),
66 GPIO_KEY(KEY_1, RCAR_GP_PIN(1, 14), "SW2-pin1"),
67};
68
69static __initdata struct gpio_keys_platform_data lager_keys_pdata = {
70 .buttons = gpio_buttons,
71 .nbuttons = ARRAY_SIZE(gpio_buttons),
72};
73
74static const struct pinctrl_map lager_pinctrl_map[] = {
75 /* SCIF0 (CN19: DEBUG SERIAL0) */
76 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
77 "scif0_data", "scif0"),
78 /* SCIF1 (CN20: DEBUG SERIAL1) */
79 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790",
80 "scif1_data", "scif1"),
81};
82
30static void __init lager_add_standard_devices(void) 83static void __init lager_add_standard_devices(void)
31{ 84{
32 r8a7790_clock_init(); 85 r8a7790_clock_init();
86
87 pinctrl_register_mappings(lager_pinctrl_map,
88 ARRAY_SIZE(lager_pinctrl_map));
89 r8a7790_pinmux_init();
90
33 r8a7790_add_standard_devices(); 91 r8a7790_add_standard_devices();
92 platform_device_register_data(&platform_bus, "leds-gpio", -1,
93 &lager_leds_pdata,
94 sizeof(lager_leds_pdata));
95 platform_device_register_data(&platform_bus, "gpio-keys", -1,
96 &lager_keys_pdata,
97 sizeof(lager_keys_pdata));
34} 98}
35 99
36static const char *lager_boards_compat_dt[] __initdata = { 100static const char *lager_boards_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index fa3407da682a..85f51a849a50 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -1309,6 +1309,49 @@ static struct i2c_board_info i2c1_devices[] = {
1309}; 1309};
1310 1310
1311static const struct pinctrl_map mackerel_pinctrl_map[] = { 1311static const struct pinctrl_map mackerel_pinctrl_map[] = {
1312 /* ADXL34X */
1313 PIN_MAP_MUX_GROUP_DEFAULT("1-0053", "pfc-sh7372",
1314 "intc_irq21", "intc"),
1315 /* CEU */
1316 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-sh7372",
1317 "ceu_data_0_7", "ceu"),
1318 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-sh7372",
1319 "ceu_clk_0", "ceu"),
1320 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-sh7372",
1321 "ceu_sync", "ceu"),
1322 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_ceu.0", "pfc-sh7372",
1323 "ceu_field", "ceu"),
1324 /* FLCTL */
1325 PIN_MAP_MUX_GROUP_DEFAULT("sh_flctl.0", "pfc-sh7372",
1326 "flctl_data", "flctl"),
1327 PIN_MAP_MUX_GROUP_DEFAULT("sh_flctl.0", "pfc-sh7372",
1328 "flctl_ce0", "flctl"),
1329 PIN_MAP_MUX_GROUP_DEFAULT("sh_flctl.0", "pfc-sh7372",
1330 "flctl_ctrl", "flctl"),
1331 /* FSIA (AK4643) */
1332 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-sh7372",
1333 "fsia_sclk_in", "fsia"),
1334 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-sh7372",
1335 "fsia_data_in", "fsia"),
1336 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.0", "pfc-sh7372",
1337 "fsia_data_out", "fsia"),
1338 /* FSIB (HDMI) */
1339 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-sh7372",
1340 "fsib_mclk_in", "fsib"),
1341 /* HDMI */
1342 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-sh7372",
1343 "hdmi", "hdmi"),
1344 /* LCDC */
1345 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh7372",
1346 "lcd_data24", "lcd"),
1347 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh7372",
1348 "lcd_sync", "lcd"),
1349 /* SCIFA0 */
1350 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-sh7372",
1351 "scifa0_data", "scifa0"),
1352 /* SCIFA2 (GT-720F GPS module) */
1353 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh7372",
1354 "scifa2_data", "scifa2"),
1312 /* SDHI0 */ 1355 /* SDHI0 */
1313 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372", 1356 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1314 "sdhi0_data4", "sdhi0"), 1357 "sdhi0_data4", "sdhi0"),
@@ -1316,6 +1359,8 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = {
1316 "sdhi0_ctrl", "sdhi0"), 1359 "sdhi0_ctrl", "sdhi0"),
1317 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372", 1360 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1318 "sdhi0_wp", "sdhi0"), 1361 "sdhi0_wp", "sdhi0"),
1362 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh7372",
1363 "intc_irq26_1", "intc"),
1319 /* SDHI1 */ 1364 /* SDHI1 */
1320#if !IS_ENABLED(CONFIG_MMC_SH_MMCIF) 1365#if !IS_ENABLED(CONFIG_MMC_SH_MMCIF)
1321 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372", 1366 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh7372",
@@ -1334,6 +1379,25 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = {
1334 "sdhi2_data4", "sdhi2"), 1379 "sdhi2_data4", "sdhi2"),
1335 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh7372", 1380 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh7372",
1336 "sdhi2_ctrl", "sdhi2"), 1381 "sdhi2_ctrl", "sdhi2"),
1382 /* SMSC911X */
1383 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-sh7372",
1384 "bsc_cs5a", "bsc"),
1385 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x", "pfc-sh7372",
1386 "intc_irq6_0", "intc"),
1387 /* ST1232 */
1388 PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-sh7372",
1389 "intc_irq7_0", "intc"),
1390 /* TCA6416 */
1391 PIN_MAP_MUX_GROUP_DEFAULT("0-0020", "pfc-sh7372",
1392 "intc_irq9_0", "intc"),
1393 /* USBHS0 */
1394 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372",
1395 "usb0_vbus", "usb0"),
1396 /* USBHS1 */
1397 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
1398 "usb1_vbus", "usb1"),
1399 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372",
1400 "usb1_otg_id_0", "usb1"),
1337}; 1401};
1338 1402
1339#define GPIO_PORT9CR IOMEM(0xE6051009) 1403#define GPIO_PORT9CR IOMEM(0xE6051009)
@@ -1377,61 +1441,18 @@ static void __init mackerel_init(void)
1377 ARRAY_SIZE(mackerel_pinctrl_map)); 1441 ARRAY_SIZE(mackerel_pinctrl_map));
1378 sh7372_pinmux_init(); 1442 sh7372_pinmux_init();
1379 1443
1380 /* enable SCIFA0 */
1381 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
1382 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
1383
1384 /* enable SMSC911X */
1385 gpio_request(GPIO_FN_CS5A, NULL);
1386 gpio_request(GPIO_FN_IRQ6_39, NULL);
1387
1388 /* LCDC */
1389 gpio_request(GPIO_FN_LCDD23, NULL);
1390 gpio_request(GPIO_FN_LCDD22, NULL);
1391 gpio_request(GPIO_FN_LCDD21, NULL);
1392 gpio_request(GPIO_FN_LCDD20, NULL);
1393 gpio_request(GPIO_FN_LCDD19, NULL);
1394 gpio_request(GPIO_FN_LCDD18, NULL);
1395 gpio_request(GPIO_FN_LCDD17, NULL);
1396 gpio_request(GPIO_FN_LCDD16, NULL);
1397 gpio_request(GPIO_FN_LCDD15, NULL);
1398 gpio_request(GPIO_FN_LCDD14, NULL);
1399 gpio_request(GPIO_FN_LCDD13, NULL);
1400 gpio_request(GPIO_FN_LCDD12, NULL);
1401 gpio_request(GPIO_FN_LCDD11, NULL);
1402 gpio_request(GPIO_FN_LCDD10, NULL);
1403 gpio_request(GPIO_FN_LCDD9, NULL);
1404 gpio_request(GPIO_FN_LCDD8, NULL);
1405 gpio_request(GPIO_FN_LCDD7, NULL);
1406 gpio_request(GPIO_FN_LCDD6, NULL);
1407 gpio_request(GPIO_FN_LCDD5, NULL);
1408 gpio_request(GPIO_FN_LCDD4, NULL);
1409 gpio_request(GPIO_FN_LCDD3, NULL);
1410 gpio_request(GPIO_FN_LCDD2, NULL);
1411 gpio_request(GPIO_FN_LCDD1, NULL);
1412 gpio_request(GPIO_FN_LCDD0, NULL);
1413 gpio_request(GPIO_FN_LCDDISP, NULL);
1414 gpio_request(GPIO_FN_LCDDCK, NULL);
1415
1416 /* backlight, off by default */ 1444 /* backlight, off by default */
1417 gpio_request_one(31, GPIOF_OUT_INIT_LOW, NULL); 1445 gpio_request_one(31, GPIOF_OUT_INIT_LOW, NULL);
1418 1446
1419 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ 1447 gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1420 1448
1421 /* USBHS0 */ 1449 /* USBHS0 */
1422 gpio_request(GPIO_FN_VBUS0_0, NULL);
1423 gpio_request_pulldown(GPIO_PORT168CR); /* VBUS0_0 pull down */ 1450 gpio_request_pulldown(GPIO_PORT168CR); /* VBUS0_0 pull down */
1424 1451
1425 /* USBHS1 */ 1452 /* USBHS1 */
1426 gpio_request(GPIO_FN_VBUS0_1, NULL);
1427 gpio_request_pulldown(GPIO_PORT167CR); /* VBUS0_1 pull down */ 1453 gpio_request_pulldown(GPIO_PORT167CR); /* VBUS0_1 pull down */
1428 gpio_request(GPIO_FN_IDIN_1_113, NULL);
1429 1454
1430 /* enable FSI2 port A (ak4643) */ 1455 /* FSI2 port A (ak4643) */
1431 gpio_request(GPIO_FN_FSIAIBT, NULL);
1432 gpio_request(GPIO_FN_FSIAILR, NULL);
1433 gpio_request(GPIO_FN_FSIAISLD, NULL);
1434 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1435 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ 1456 gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */
1436 1457
1437 gpio_request(9, NULL); 1458 gpio_request(9, NULL);
@@ -1441,8 +1462,7 @@ static void __init mackerel_init(void)
1441 1462
1442 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */ 1463 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
1443 1464
1444 /* setup FSI2 port B (HDMI) */ 1465 /* FSI2 port B (HDMI) */
1445 gpio_request(GPIO_FN_FSIBCK, NULL);
1446 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */ 1466 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
1447 1467
1448 /* set SPU2 clock to 119.6 MHz */ 1468 /* set SPU2 clock to 119.6 MHz */
@@ -1452,68 +1472,15 @@ static void __init mackerel_init(void)
1452 clk_put(clk); 1472 clk_put(clk);
1453 } 1473 }
1454 1474
1455 /* enable Keypad */ 1475 /* Keypad */
1456 gpio_request(GPIO_FN_IRQ9_42, NULL);
1457 irq_set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH); 1476 irq_set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
1458 1477
1459 /* enable Touchscreen */ 1478 /* Touchscreen */
1460 gpio_request(GPIO_FN_IRQ7_40, NULL);
1461 irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW); 1479 irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
1462 1480
1463 /* enable Accelerometer */ 1481 /* Accelerometer */
1464 gpio_request(GPIO_FN_IRQ21, NULL);
1465 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); 1482 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
1466 1483
1467 /* SDHI0 PORT172 card-detect IRQ26 */
1468 gpio_request(GPIO_FN_IRQ26_172, NULL);
1469
1470 /* FLCTL */
1471 gpio_request(GPIO_FN_D0_NAF0, NULL);
1472 gpio_request(GPIO_FN_D1_NAF1, NULL);
1473 gpio_request(GPIO_FN_D2_NAF2, NULL);
1474 gpio_request(GPIO_FN_D3_NAF3, NULL);
1475 gpio_request(GPIO_FN_D4_NAF4, NULL);
1476 gpio_request(GPIO_FN_D5_NAF5, NULL);
1477 gpio_request(GPIO_FN_D6_NAF6, NULL);
1478 gpio_request(GPIO_FN_D7_NAF7, NULL);
1479 gpio_request(GPIO_FN_D8_NAF8, NULL);
1480 gpio_request(GPIO_FN_D9_NAF9, NULL);
1481 gpio_request(GPIO_FN_D10_NAF10, NULL);
1482 gpio_request(GPIO_FN_D11_NAF11, NULL);
1483 gpio_request(GPIO_FN_D12_NAF12, NULL);
1484 gpio_request(GPIO_FN_D13_NAF13, NULL);
1485 gpio_request(GPIO_FN_D14_NAF14, NULL);
1486 gpio_request(GPIO_FN_D15_NAF15, NULL);
1487 gpio_request(GPIO_FN_FCE0, NULL);
1488 gpio_request(GPIO_FN_WE0_FWE, NULL);
1489 gpio_request(GPIO_FN_FRB, NULL);
1490 gpio_request(GPIO_FN_A4_FOE, NULL);
1491 gpio_request(GPIO_FN_A5_FCDE, NULL);
1492 gpio_request(GPIO_FN_RD_FSC, NULL);
1493
1494 /* enable GPS module (GT-720F) */
1495 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
1496 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
1497
1498 /* CEU */
1499 gpio_request(GPIO_FN_VIO_CLK, NULL);
1500 gpio_request(GPIO_FN_VIO_VD, NULL);
1501 gpio_request(GPIO_FN_VIO_HD, NULL);
1502 gpio_request(GPIO_FN_VIO_FIELD, NULL);
1503 gpio_request(GPIO_FN_VIO_CKO, NULL);
1504 gpio_request(GPIO_FN_VIO_D7, NULL);
1505 gpio_request(GPIO_FN_VIO_D6, NULL);
1506 gpio_request(GPIO_FN_VIO_D5, NULL);
1507 gpio_request(GPIO_FN_VIO_D4, NULL);
1508 gpio_request(GPIO_FN_VIO_D3, NULL);
1509 gpio_request(GPIO_FN_VIO_D2, NULL);
1510 gpio_request(GPIO_FN_VIO_D1, NULL);
1511 gpio_request(GPIO_FN_VIO_D0, NULL);
1512
1513 /* HDMI */
1514 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1515 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1516
1517 /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */ 1484 /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */
1518 srcr4 = __raw_readl(SRCR4); 1485 srcr4 = __raw_readl(SRCR4);
1519 __raw_writel(srcr4 | (1 << 13), SRCR4); 1486 __raw_writel(srcr4 | (1 << 13), SRCR4);
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index b9594e911ce7..a7d1010505bf 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -28,6 +28,7 @@
28#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/pinctrl/machine.h> 30#include <linux/pinctrl/machine.h>
31#include <linux/platform_data/gpio-rcar.h>
31#include <linux/regulator/fixed.h> 32#include <linux/regulator/fixed.h>
32#include <linux/regulator/machine.h> 33#include <linux/regulator/machine.h>
33#include <linux/smsc911x.h> 34#include <linux/smsc911x.h>
@@ -36,10 +37,6 @@
36#include <linux/mmc/host.h> 37#include <linux/mmc/host.h>
37#include <linux/mmc/sh_mobile_sdhi.h> 38#include <linux/mmc/sh_mobile_sdhi.h>
38#include <linux/mfd/tmio.h> 39#include <linux/mfd/tmio.h>
39#include <linux/usb/otg.h>
40#include <linux/usb/ehci_pdriver.h>
41#include <linux/usb/ohci_pdriver.h>
42#include <linux/pm_runtime.h>
43#include <mach/hardware.h> 40#include <mach/hardware.h>
44#include <mach/r8a7779.h> 41#include <mach/r8a7779.h>
45#include <mach/common.h> 42#include <mach/common.h>
@@ -60,6 +57,8 @@ static struct regulator_consumer_supply dummy_supplies[] = {
60 REGULATOR_SUPPLY("vdd33a", "smsc911x"), 57 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
61}; 58};
62 59
60static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
61
63/* SMSC LAN89218 */ 62/* SMSC LAN89218 */
64static struct resource smsc911x_resources[] = { 63static struct resource smsc911x_resources[] = {
65 [0] = { 64 [0] = {
@@ -68,7 +67,7 @@ static struct resource smsc911x_resources[] = {
68 .flags = IORESOURCE_MEM, 67 .flags = IORESOURCE_MEM,
69 }, 68 },
70 [1] = { 69 [1] = {
71 .start = gic_iid(0x3c), /* IRQ 1 */ 70 .start = irq_pin(1), /* IRQ 1 */
72 .flags = IORESOURCE_IRQ, 71 .flags = IORESOURCE_IRQ,
73 }, 72 },
74}; 73};
@@ -149,39 +148,19 @@ static struct platform_device hspi_device = {
149 .num_resources = ARRAY_SIZE(hspi_resources), 148 .num_resources = ARRAY_SIZE(hspi_resources),
150}; 149};
151 150
152/* USB PHY */
153static struct resource usb_phy_resources[] = {
154 [0] = {
155 .start = 0xffe70000,
156 .end = 0xffe70900 - 1,
157 .flags = IORESOURCE_MEM,
158 },
159 [1] = {
160 .start = 0xfff70000,
161 .end = 0xfff70900 - 1,
162 .flags = IORESOURCE_MEM,
163 },
164};
165
166static struct platform_device usb_phy_device = {
167 .name = "rcar_usb_phy",
168 .resource = usb_phy_resources,
169 .num_resources = ARRAY_SIZE(usb_phy_resources),
170};
171
172/* LEDS */ 151/* LEDS */
173static struct gpio_led marzen_leds[] = { 152static struct gpio_led marzen_leds[] = {
174 { 153 {
175 .name = "led2", 154 .name = "led2",
176 .gpio = 157, 155 .gpio = RCAR_GP_PIN(4, 29),
177 .default_state = LEDS_GPIO_DEFSTATE_ON, 156 .default_state = LEDS_GPIO_DEFSTATE_ON,
178 }, { 157 }, {
179 .name = "led3", 158 .name = "led3",
180 .gpio = 158, 159 .gpio = RCAR_GP_PIN(4, 30),
181 .default_state = LEDS_GPIO_DEFSTATE_ON, 160 .default_state = LEDS_GPIO_DEFSTATE_ON,
182 }, { 161 }, {
183 .name = "led4", 162 .name = "led4",
184 .gpio = 159, 163 .gpio = RCAR_GP_PIN(4, 31),
185 .default_state = LEDS_GPIO_DEFSTATE_ON, 164 .default_state = LEDS_GPIO_DEFSTATE_ON,
186 }, 165 },
187}; 166};
@@ -204,161 +183,9 @@ static struct platform_device *marzen_devices[] __initdata = {
204 &sdhi0_device, 183 &sdhi0_device,
205 &thermal_device, 184 &thermal_device,
206 &hspi_device, 185 &hspi_device,
207 &usb_phy_device,
208 &leds_device, 186 &leds_device,
209}; 187};
210 188
211/* USB */
212static struct usb_phy *phy;
213static int usb_power_on(struct platform_device *pdev)
214{
215 if (IS_ERR(phy))
216 return PTR_ERR(phy);
217
218 pm_runtime_enable(&pdev->dev);
219 pm_runtime_get_sync(&pdev->dev);
220
221 usb_phy_init(phy);
222
223 return 0;
224}
225
226static void usb_power_off(struct platform_device *pdev)
227{
228 if (IS_ERR(phy))
229 return;
230
231 usb_phy_shutdown(phy);
232
233 pm_runtime_put_sync(&pdev->dev);
234 pm_runtime_disable(&pdev->dev);
235}
236
237static struct usb_ehci_pdata ehcix_pdata = {
238 .power_on = usb_power_on,
239 .power_off = usb_power_off,
240 .power_suspend = usb_power_off,
241};
242
243static struct resource ehci0_resources[] = {
244 [0] = {
245 .start = 0xffe70000,
246 .end = 0xffe70400 - 1,
247 .flags = IORESOURCE_MEM,
248 },
249 [1] = {
250 .start = gic_iid(0x4c),
251 .flags = IORESOURCE_IRQ,
252 },
253};
254
255static struct platform_device ehci0_device = {
256 .name = "ehci-platform",
257 .id = 0,
258 .dev = {
259 .dma_mask = &ehci0_device.dev.coherent_dma_mask,
260 .coherent_dma_mask = 0xffffffff,
261 .platform_data = &ehcix_pdata,
262 },
263 .num_resources = ARRAY_SIZE(ehci0_resources),
264 .resource = ehci0_resources,
265};
266
267static struct resource ehci1_resources[] = {
268 [0] = {
269 .start = 0xfff70000,
270 .end = 0xfff70400 - 1,
271 .flags = IORESOURCE_MEM,
272 },
273 [1] = {
274 .start = gic_iid(0x4d),
275 .flags = IORESOURCE_IRQ,
276 },
277};
278
279static struct platform_device ehci1_device = {
280 .name = "ehci-platform",
281 .id = 1,
282 .dev = {
283 .dma_mask = &ehci1_device.dev.coherent_dma_mask,
284 .coherent_dma_mask = 0xffffffff,
285 .platform_data = &ehcix_pdata,
286 },
287 .num_resources = ARRAY_SIZE(ehci1_resources),
288 .resource = ehci1_resources,
289};
290
291static struct usb_ohci_pdata ohcix_pdata = {
292 .power_on = usb_power_on,
293 .power_off = usb_power_off,
294 .power_suspend = usb_power_off,
295};
296
297static struct resource ohci0_resources[] = {
298 [0] = {
299 .start = 0xffe70400,
300 .end = 0xffe70800 - 1,
301 .flags = IORESOURCE_MEM,
302 },
303 [1] = {
304 .start = gic_iid(0x4c),
305 .flags = IORESOURCE_IRQ,
306 },
307};
308
309static struct platform_device ohci0_device = {
310 .name = "ohci-platform",
311 .id = 0,
312 .dev = {
313 .dma_mask = &ohci0_device.dev.coherent_dma_mask,
314 .coherent_dma_mask = 0xffffffff,
315 .platform_data = &ohcix_pdata,
316 },
317 .num_resources = ARRAY_SIZE(ohci0_resources),
318 .resource = ohci0_resources,
319};
320
321static struct resource ohci1_resources[] = {
322 [0] = {
323 .start = 0xfff70400,
324 .end = 0xfff70800 - 1,
325 .flags = IORESOURCE_MEM,
326 },
327 [1] = {
328 .start = gic_iid(0x4d),
329 .flags = IORESOURCE_IRQ,
330 },
331};
332
333static struct platform_device ohci1_device = {
334 .name = "ohci-platform",
335 .id = 1,
336 .dev = {
337 .dma_mask = &ohci1_device.dev.coherent_dma_mask,
338 .coherent_dma_mask = 0xffffffff,
339 .platform_data = &ohcix_pdata,
340 },
341 .num_resources = ARRAY_SIZE(ohci1_resources),
342 .resource = ohci1_resources,
343};
344
345static struct platform_device *marzen_late_devices[] __initdata = {
346 &ehci0_device,
347 &ehci1_device,
348 &ohci0_device,
349 &ohci1_device,
350};
351
352void __init marzen_init_late(void)
353{
354 /* get usb phy */
355 phy = usb_get_phy(USB_PHY_TYPE_USB2);
356
357 shmobile_init_late();
358 platform_add_devices(marzen_late_devices,
359 ARRAY_SIZE(marzen_late_devices));
360}
361
362static const struct pinctrl_map marzen_pinctrl_map[] = { 189static const struct pinctrl_map marzen_pinctrl_map[] = {
363 /* HSPI0 */ 190 /* HSPI0 */
364 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779", 191 PIN_MAP_MUX_GROUP_DEFAULT("sh-hspi.0", "pfc-r8a7779",
@@ -404,8 +231,10 @@ static void __init marzen_init(void)
404 pinctrl_register_mappings(marzen_pinctrl_map, 231 pinctrl_register_mappings(marzen_pinctrl_map,
405 ARRAY_SIZE(marzen_pinctrl_map)); 232 ARRAY_SIZE(marzen_pinctrl_map));
406 r8a7779_pinmux_init(); 233 r8a7779_pinmux_init();
234 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */
407 235
408 r8a7779_add_standard_devices(); 236 r8a7779_add_standard_devices();
237 r8a7779_add_usb_phy_device(&usb_phy_platform_data);
409 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 238 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
410} 239}
411 240
@@ -416,6 +245,6 @@ MACHINE_START(MARZEN, "marzen")
416 .nr_irqs = NR_IRQS_LEGACY, 245 .nr_irqs = NR_IRQS_LEGACY,
417 .init_irq = r8a7779_init_irq, 246 .init_irq = r8a7779_init_irq,
418 .init_machine = marzen_init, 247 .init_machine = marzen_init,
419 .init_late = marzen_init_late, 248 .init_late = r8a7779_init_late,
420 .init_time = r8a7779_earlytimer_init, 249 .init_time = r8a7779_earlytimer_init,
421MACHINE_END 250MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index e710c00c3822..5f7fe628b8a1 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -22,15 +22,44 @@
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 <mach/common.h> 26#include <mach/common.h>
26 27
27#define CPG_BASE 0xe6150000 28#define CPG_BASE 0xe6150000
28#define CPG_LEN 0x270 29#define CPG_LEN 0x270
29 30
30#define MPCKCR 0xe6150080
31#define SMSTPCR2 0xe6150138 31#define SMSTPCR2 0xe6150138
32#define SMSTPCR3 0xe615013c
32#define SMSTPCR5 0xe6150144 33#define SMSTPCR5 0xe6150144
33 34
35#define FRQCRA 0xE6150000
36#define FRQCRB 0xE6150004
37#define VCLKCR1 0xE6150008
38#define VCLKCR2 0xE615000C
39#define VCLKCR3 0xE615001C
40#define VCLKCR4 0xE6150014
41#define VCLKCR5 0xE6150034
42#define ZBCKCR 0xE6150010
43#define SD0CKCR 0xE6150074
44#define SD1CKCR 0xE6150078
45#define SD2CKCR 0xE615007C
46#define MMC0CKCR 0xE6150240
47#define MMC1CKCR 0xE6150244
48#define FSIACKCR 0xE6150018
49#define FSIBCKCR 0xE6150090
50#define MPCKCR 0xe6150080
51#define SPUVCKCR 0xE6150094
52#define HSICKCR 0xE615026C
53#define M4CKCR 0xE6150098
54#define PLLECR 0xE61500D0
55#define PLL1CR 0xE6150028
56#define PLL2CR 0xE615002C
57#define PLL2SCR 0xE61501F4
58#define PLL2HCR 0xE61501E4
59#define CKSCR 0xE61500C0
60
61#define CPG_MAP(o) ((o - CPG_BASE) + cpg_mapping.base)
62
34static struct clk_mapping cpg_mapping = { 63static struct clk_mapping cpg_mapping = {
35 .phys = CPG_BASE, 64 .phys = CPG_BASE,
36 .len = CPG_LEN, 65 .len = CPG_LEN,
@@ -51,29 +80,327 @@ static struct clk extal2_clk = {
51 .mapping = &cpg_mapping, 80 .mapping = &cpg_mapping,
52}; 81};
53 82
83static struct sh_clk_ops followparent_clk_ops = {
84 .recalc = followparent_recalc,
85};
86
87static struct clk main_clk = {
88 /* .parent will be set r8a73a4_clock_init */
89 .ops = &followparent_clk_ops,
90};
91
92SH_CLK_RATIO(div2, 1, 2);
93SH_CLK_RATIO(div4, 1, 4);
94
95SH_FIXED_RATIO_CLK(main_div2_clk, main_clk, div2);
96SH_FIXED_RATIO_CLK(extal1_div2_clk, extal1_clk, div2);
97SH_FIXED_RATIO_CLK(extal2_div2_clk, extal2_clk, div2);
98SH_FIXED_RATIO_CLK(extal2_div4_clk, extal2_clk, div4);
99
100/* External FSIACK/FSIBCK clock */
101static struct clk fsiack_clk = {
102};
103
104static struct clk fsibck_clk = {
105};
106
107/*
108 * PLL clocks
109 */
110static struct clk *pll_parent_main[] = {
111 [0] = &main_clk,
112 [1] = &main_div2_clk
113};
114
115static struct clk *pll_parent_main_extal[8] = {
116 [0] = &main_div2_clk,
117 [1] = &extal2_div2_clk,
118 [3] = &extal2_div4_clk,
119 [4] = &main_clk,
120 [5] = &extal2_clk,
121};
122
123static unsigned long pll_recalc(struct clk *clk)
124{
125 unsigned long mult = 1;
126
127 if (ioread32(CPG_MAP(PLLECR)) & (1 << clk->enable_bit))
128 mult = (((ioread32(clk->mapped_reg) >> 24) & 0x7f) + 1);
129
130 return clk->parent->rate * mult;
131}
132
133static int pll_set_parent(struct clk *clk, struct clk *parent)
134{
135 u32 val;
136 int i, ret;
137
138 if (!clk->parent_table || !clk->parent_num)
139 return -EINVAL;
140
141 /* Search the parent */
142 for (i = 0; i < clk->parent_num; i++)
143 if (clk->parent_table[i] == parent)
144 break;
145
146 if (i == clk->parent_num)
147 return -ENODEV;
148
149 ret = clk_reparent(clk, parent);
150 if (ret < 0)
151 return ret;
152
153 val = ioread32(clk->mapped_reg) &
154 ~(((1 << clk->src_width) - 1) << clk->src_shift);
155
156 iowrite32(val | i << clk->src_shift, clk->mapped_reg);
157
158 return 0;
159}
160
161static struct sh_clk_ops pll_clk_ops = {
162 .recalc = pll_recalc,
163 .set_parent = pll_set_parent,
164};
165
166#define PLL_CLOCK(name, p, pt, w, s, reg, e) \
167 static struct clk name = { \
168 .ops = &pll_clk_ops, \
169 .flags = CLK_ENABLE_ON_INIT, \
170 .parent = p, \
171 .parent_table = pt, \
172 .parent_num = ARRAY_SIZE(pt), \
173 .src_width = w, \
174 .src_shift = s, \
175 .enable_reg = (void __iomem *)reg, \
176 .enable_bit = e, \
177 .mapping = &cpg_mapping, \
178 }
179
180PLL_CLOCK(pll1_clk, &main_clk, pll_parent_main, 1, 7, PLL1CR, 1);
181PLL_CLOCK(pll2_clk, &main_div2_clk, pll_parent_main_extal, 3, 5, PLL2CR, 2);
182PLL_CLOCK(pll2s_clk, &main_div2_clk, pll_parent_main_extal, 3, 5, PLL2SCR, 4);
183PLL_CLOCK(pll2h_clk, &main_div2_clk, pll_parent_main_extal, 3, 5, PLL2HCR, 5);
184
185SH_FIXED_RATIO_CLK(pll1_div2_clk, pll1_clk, div2);
186
54static struct clk *main_clks[] = { 187static struct clk *main_clks[] = {
55 &extalr_clk, 188 &extalr_clk,
56 &extal1_clk, 189 &extal1_clk,
190 &extal1_div2_clk,
57 &extal2_clk, 191 &extal2_clk,
192 &extal2_div2_clk,
193 &extal2_div4_clk,
194 &main_clk,
195 &main_div2_clk,
196 &fsiack_clk,
197 &fsibck_clk,
198 &pll1_clk,
199 &pll1_div2_clk,
200 &pll2_clk,
201 &pll2s_clk,
202 &pll2h_clk,
203};
204
205/* DIV4 */
206static void div4_kick(struct clk *clk)
207{
208 unsigned long value;
209
210 /* set KICK bit in FRQCRB to update hardware setting */
211 value = ioread32(CPG_MAP(FRQCRB));
212 value |= (1 << 31);
213 iowrite32(value, CPG_MAP(FRQCRB));
214}
215
216static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10};
217
218static struct clk_div_mult_table div4_div_mult_table = {
219 .divisors = divisors,
220 .nr_divisors = ARRAY_SIZE(divisors),
221};
222
223static struct clk_div4_table div4_table = {
224 .div_mult_table = &div4_div_mult_table,
225 .kick = div4_kick,
226};
227
228enum {
229 DIV4_I, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
230 DIV4_ZX, DIV4_ZS, DIV4_HP,
231 DIV4_NR };
232
233static struct clk div4_clks[DIV4_NR] = {
234 [DIV4_I] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 20, 0x0dff, CLK_ENABLE_ON_INIT),
235 [DIV4_M3] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
236 [DIV4_B] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 8, 0x0dff, CLK_ENABLE_ON_INIT),
237 [DIV4_M1] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 4, 0x1dff, 0),
238 [DIV4_M2] = SH_CLK_DIV4(&pll1_clk, FRQCRA, 0, 0x1dff, 0),
239 [DIV4_ZX] = SH_CLK_DIV4(&pll1_clk, FRQCRB, 12, 0x0dff, 0),
240 [DIV4_ZS] = SH_CLK_DIV4(&pll1_clk, FRQCRB, 8, 0x0dff, 0),
241 [DIV4_HP] = SH_CLK_DIV4(&pll1_clk, FRQCRB, 4, 0x0dff, 0),
58}; 242};
59 243
60enum { 244enum {
245 DIV6_ZB,
246 DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2,
247 DIV6_MMC0, DIV6_MMC1,
248 DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_VCK4, DIV6_VCK5,
249 DIV6_FSIA, DIV6_FSIB,
250 DIV6_MP, DIV6_M4, DIV6_HSI, DIV6_SPUV,
251 DIV6_NR };
252
253static struct clk *div6_parents[8] = {
254 [0] = &pll1_div2_clk,
255 [1] = &pll2s_clk,
256 [3] = &extal2_clk,
257 [4] = &main_div2_clk,
258 [6] = &extalr_clk,
259};
260
261static struct clk *fsia_parents[4] = {
262 [0] = &pll1_div2_clk,
263 [1] = &pll2s_clk,
264 [2] = &fsiack_clk,
265};
266
267static struct clk *fsib_parents[4] = {
268 [0] = &pll1_div2_clk,
269 [1] = &pll2s_clk,
270 [2] = &fsibck_clk,
271};
272
273static struct clk *mp_parents[4] = {
274 [0] = &pll1_div2_clk,
275 [1] = &pll2s_clk,
276 [2] = &extal2_clk,
277 [3] = &extal2_clk,
278};
279
280static struct clk *m4_parents[2] = {
281 [0] = &pll2s_clk,
282};
283
284static struct clk *hsi_parents[4] = {
285 [0] = &pll2h_clk,
286 [1] = &pll1_div2_clk,
287 [3] = &pll2s_clk,
288};
289
290/*** FIXME ***
291 * SH_CLK_DIV6_EXT() macro doesn't care .mapping
292 * but, it is necessary on R-Car (= ioremap() base CPG)
293 * The difference between
294 * SH_CLK_DIV6_EXT() <--> SH_CLK_MAP_DIV6_EXT()
295 * is only .mapping
296 */
297#define SH_CLK_MAP_DIV6_EXT(_reg, _flags, _parents, \
298 _num_parents, _src_shift, _src_width) \
299{ \
300 .enable_reg = (void __iomem *)_reg, \
301 .enable_bit = 0, /* unused */ \
302 .flags = _flags | CLK_MASK_DIV_ON_DISABLE, \
303 .div_mask = SH_CLK_DIV6_MSK, \
304 .parent_table = _parents, \
305 .parent_num = _num_parents, \
306 .src_shift = _src_shift, \
307 .src_width = _src_width, \
308 .mapping = &cpg_mapping, \
309}
310
311static struct clk div6_clks[DIV6_NR] = {
312 [DIV6_ZB] = SH_CLK_MAP_DIV6_EXT(ZBCKCR, CLK_ENABLE_ON_INIT,
313 div6_parents, 2, 7, 1),
314 [DIV6_SDHI0] = SH_CLK_MAP_DIV6_EXT(SD0CKCR, 0,
315 div6_parents, 2, 6, 2),
316 [DIV6_SDHI1] = SH_CLK_MAP_DIV6_EXT(SD1CKCR, 0,
317 div6_parents, 2, 6, 2),
318 [DIV6_SDHI2] = SH_CLK_MAP_DIV6_EXT(SD2CKCR, 0,
319 div6_parents, 2, 6, 2),
320 [DIV6_MMC0] = SH_CLK_MAP_DIV6_EXT(MMC0CKCR, 0,
321 div6_parents, 2, 6, 2),
322 [DIV6_MMC1] = SH_CLK_MAP_DIV6_EXT(MMC1CKCR, 0,
323 div6_parents, 2, 6, 2),
324 [DIV6_VCK1] = SH_CLK_MAP_DIV6_EXT(VCLKCR1, 0, /* didn't care bit[6-7] */
325 div6_parents, ARRAY_SIZE(div6_parents), 12, 3),
326 [DIV6_VCK2] = SH_CLK_MAP_DIV6_EXT(VCLKCR2, 0, /* didn't care bit[6-7] */
327 div6_parents, ARRAY_SIZE(div6_parents), 12, 3),
328 [DIV6_VCK3] = SH_CLK_MAP_DIV6_EXT(VCLKCR3, 0, /* didn't care bit[6-7] */
329 div6_parents, ARRAY_SIZE(div6_parents), 12, 3),
330 [DIV6_VCK4] = SH_CLK_MAP_DIV6_EXT(VCLKCR4, 0, /* didn't care bit[6-7] */
331 div6_parents, ARRAY_SIZE(div6_parents), 12, 3),
332 [DIV6_VCK5] = SH_CLK_MAP_DIV6_EXT(VCLKCR5, 0, /* didn't care bit[6-7] */
333 div6_parents, ARRAY_SIZE(div6_parents), 12, 3),
334 [DIV6_FSIA] = SH_CLK_MAP_DIV6_EXT(FSIACKCR, 0,
335 fsia_parents, ARRAY_SIZE(fsia_parents), 6, 2),
336 [DIV6_FSIB] = SH_CLK_MAP_DIV6_EXT(FSIBCKCR, 0,
337 fsib_parents, ARRAY_SIZE(fsib_parents), 6, 2),
338 [DIV6_MP] = SH_CLK_MAP_DIV6_EXT(MPCKCR, 0, /* it needs bit[9-11] control */
339 mp_parents, ARRAY_SIZE(mp_parents), 6, 2),
340 /* pll2s will be selected always for M4 */
341 [DIV6_M4] = SH_CLK_MAP_DIV6_EXT(M4CKCR, 0, /* it needs bit[9] control */
342 m4_parents, ARRAY_SIZE(m4_parents), 6, 1),
343 [DIV6_HSI] = SH_CLK_MAP_DIV6_EXT(HSICKCR, 0, /* it needs bit[9] control */
344 hsi_parents, ARRAY_SIZE(hsi_parents), 6, 2),
345 [DIV6_SPUV] = SH_CLK_MAP_DIV6_EXT(SPUVCKCR, 0,
346 mp_parents, ARRAY_SIZE(mp_parents), 6, 2),
347};
348
349/* MSTP */
350enum {
61 MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, 351 MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203,
352 MSTP315, MSTP314, MSTP313, MSTP312, MSTP305,
62 MSTP522, 353 MSTP522,
63 MSTP_NR 354 MSTP_NR
64}; 355};
65 356
66static struct clk mstp_clks[MSTP_NR] = { 357static struct clk mstp_clks[MSTP_NR] = {
67 [MSTP204] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ 358 [MSTP204] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 4, 0), /* SCIFA0 */
68 [MSTP203] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ 359 [MSTP203] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 3, 0), /* SCIFA1 */
69 [MSTP206] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 6, 0), /* SCIFB0 */ 360 [MSTP206] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 6, 0), /* SCIFB0 */
70 [MSTP207] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ 361 [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */
71 [MSTP216] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ 362 [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */
72 [MSTP217] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR2, 17, 0), /* SCIFB3 */ 363 [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */
364 [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */
365 [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */
366 [MSTP313] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI1],SMSTPCR3, 13, 0), /* SDHI1 */
367 [MSTP314] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI0],SMSTPCR3, 14, 0), /* SDHI0 */
368 [MSTP315] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC0],SMSTPCR3, 15, 0), /* MMCIF0 */
73 [MSTP522] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR5, 22, 0), /* Thermal */ 369 [MSTP522] = SH_CLK_MSTP32(&extal2_clk, SMSTPCR5, 22, 0), /* Thermal */
74}; 370};
75 371
76static struct clk_lookup lookups[] = { 372static struct clk_lookup lookups[] = {
373 /* main clock */
374 CLKDEV_CON_ID("extal1", &extal1_clk),
375 CLKDEV_CON_ID("extal1_div2", &extal1_div2_clk),
376 CLKDEV_CON_ID("extal2", &extal2_clk),
377 CLKDEV_CON_ID("extal2_div2", &extal2_div2_clk),
378 CLKDEV_CON_ID("extal2_div4", &extal2_div4_clk),
379 CLKDEV_CON_ID("fsiack", &fsiack_clk),
380 CLKDEV_CON_ID("fsibck", &fsibck_clk),
381
382 /* pll clock */
383 CLKDEV_CON_ID("pll1", &pll1_clk),
384 CLKDEV_CON_ID("pll1_div2", &pll1_div2_clk),
385 CLKDEV_CON_ID("pll2", &pll2_clk),
386 CLKDEV_CON_ID("pll2s", &pll2s_clk),
387 CLKDEV_CON_ID("pll2h", &pll2h_clk),
388
389 /* DIV6 */
390 CLKDEV_CON_ID("zb", &div6_clks[DIV6_ZB]),
391 CLKDEV_CON_ID("vck1", &div6_clks[DIV6_VCK1]),
392 CLKDEV_CON_ID("vck2", &div6_clks[DIV6_VCK2]),
393 CLKDEV_CON_ID("vck3", &div6_clks[DIV6_VCK3]),
394 CLKDEV_CON_ID("vck4", &div6_clks[DIV6_VCK4]),
395 CLKDEV_CON_ID("vck5", &div6_clks[DIV6_VCK5]),
396 CLKDEV_CON_ID("fsia", &div6_clks[DIV6_FSIA]),
397 CLKDEV_CON_ID("fsib", &div6_clks[DIV6_FSIB]),
398 CLKDEV_CON_ID("mp", &div6_clks[DIV6_MP]),
399 CLKDEV_CON_ID("m4", &div6_clks[DIV6_M4]),
400 CLKDEV_CON_ID("hsi", &div6_clks[DIV6_HSI]),
401 CLKDEV_CON_ID("spuv", &div6_clks[DIV6_SPUV]),
402
403 /* MSTP */
77 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 404 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
78 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 405 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
79 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), 406 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
@@ -81,6 +408,16 @@ static struct clk_lookup lookups[] = {
81 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), 408 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]),
82 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), 409 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]),
83 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 410 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
411 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
412 CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
413 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
414 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP312]),
415 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
416 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]),
417 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
418 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]),
419 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
420 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]),
84 421
85 /* for DT */ 422 /* for DT */
86 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), 423 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
@@ -88,22 +425,40 @@ static struct clk_lookup lookups[] = {
88 425
89void __init r8a73a4_clock_init(void) 426void __init r8a73a4_clock_init(void)
90{ 427{
91 void __iomem *cpg_base, *reg; 428 void __iomem *reg;
92 int k, ret = 0; 429 int k, ret = 0;
430 u32 ckscr;
431
432 reg = ioremap_nocache(CKSCR, PAGE_SIZE);
433 BUG_ON(!reg);
434 ckscr = ioread32(reg);
435 iounmap(reg);
93 436
94 /* fix MPCLK to EXTAL2 for now. 437 switch ((ckscr >> 28) & 0x3) {
95 * this is needed until more detailed clock topology is supported 438 case 0:
96 */ 439 main_clk.parent = &extal1_clk;
97 cpg_base = ioremap_nocache(CPG_BASE, CPG_LEN); 440 break;
98 BUG_ON(!cpg_base); 441 case 1:
99 reg = cpg_base + (MPCKCR - CPG_BASE); 442 main_clk.parent = &extal1_div2_clk;
100 iowrite32(ioread32(reg) | 1 << 7 | 0x0c, reg); /* set CKSEL */ 443 break;
101 iounmap(cpg_base); 444 case 2:
445 main_clk.parent = &extal2_clk;
446 break;
447 case 3:
448 main_clk.parent = &extal2_div2_clk;
449 break;
450 }
102 451
103 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 452 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
104 ret = clk_register(main_clks[k]); 453 ret = clk_register(main_clks[k]);
105 454
106 if (!ret) 455 if (!ret)
456 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
457
458 if (!ret)
459 ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
460
461 if (!ret)
107 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); 462 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
108 463
109 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 464 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index c0d39aa6de50..7fd32d604e34 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -266,7 +266,7 @@ static struct clk fsiack_clk = {
266static struct clk fsibck_clk = { 266static struct clk fsibck_clk = {
267}; 267};
268 268
269struct clk *main_clks[] = { 269static struct clk *main_clks[] = {
270 &extalr_clk, 270 &extalr_clk,
271 &extal1_clk, 271 &extal1_clk,
272 &extal2_clk, 272 &extal2_clk,
@@ -317,7 +317,7 @@ enum {
317 DIV4_NR 317 DIV4_NR
318}; 318};
319 319
320struct clk div4_clks[DIV4_NR] = { 320static struct clk div4_clks[DIV4_NR] = {
321 [DIV4_I] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 20, 0x6fff, CLK_ENABLE_ON_INIT), 321 [DIV4_I] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 20, 0x6fff, CLK_ENABLE_ON_INIT),
322 [DIV4_ZG] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 16, 0x6fff, CLK_ENABLE_ON_INIT), 322 [DIV4_ZG] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 16, 0x6fff, CLK_ENABLE_ON_INIT),
323 [DIV4_B] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 8, 0x6fff, CLK_ENABLE_ON_INIT), 323 [DIV4_B] = SH_CLK_DIV4(&pllc1_clk, FRQCRA, 8, 0x6fff, CLK_ENABLE_ON_INIT),
@@ -461,7 +461,7 @@ enum {
461 461
462 MSTP329, MSTP328, MSTP323, MSTP320, 462 MSTP329, MSTP328, MSTP323, MSTP320,
463 MSTP314, MSTP313, MSTP312, 463 MSTP314, MSTP313, MSTP312,
464 MSTP309, 464 MSTP309, MSTP304,
465 465
466 MSTP416, MSTP415, MSTP407, MSTP406, 466 MSTP416, MSTP415, MSTP407, MSTP406,
467 467
@@ -499,6 +499,7 @@ static struct clk mstp_clks[MSTP_NR] = {
499 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */ 499 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
500 [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */ 500 [MSTP312] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
501 [MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 9, 0), /* GEther */ 501 [MSTP309] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 9, 0), /* GEther */
502 [MSTP304] = SH_CLK_MSTP32(&div4_clks[DIV4_CP], SMSTPCR3, 4, 0), /* TPU0 */
502 503
503 [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */ 504 [MSTP416] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 16, 0), /* USBHOST */
504 [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */ 505 [MSTP415] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */
@@ -551,6 +552,7 @@ static struct clk_lookup lookups[] = {
551 CLKDEV_DEV_ID("sh_tmu.4", &mstp_clks[MSTP111]), 552 CLKDEV_DEV_ID("sh_tmu.4", &mstp_clks[MSTP111]),
552 CLKDEV_DEV_ID("sh_tmu.5", &mstp_clks[MSTP111]), 553 CLKDEV_DEV_ID("sh_tmu.5", &mstp_clks[MSTP111]),
553 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), 554 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
555 CLKDEV_DEV_ID("fff20000.i2c", &mstp_clks[MSTP116]),
554 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), 556 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
555 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), 557 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]),
556 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), 558 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]),
@@ -584,6 +586,7 @@ static struct clk_lookup lookups[] = {
584 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), 586 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]),
585 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), 587 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]),
586 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), 588 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]),
589 CLKDEV_DEV_ID("e6c20000.i2c", &mstp_clks[MSTP323]),
587 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]), 590 CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP320]),
588 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 591 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
589 CLKDEV_DEV_ID("e6850000.sdhi", &mstp_clks[MSTP314]), 592 CLKDEV_DEV_ID("e6850000.sdhi", &mstp_clks[MSTP314]),
@@ -592,6 +595,8 @@ static struct clk_lookup lookups[] = {
592 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 595 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
593 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), 596 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]),
594 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]), 597 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]),
598 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]),
599 CLKDEV_DEV_ID("renesas_tpu_pwm", &mstp_clks[MSTP304]),
595 600
596 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), 601 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]),
597 CLKDEV_DEV_ID("e6870000.sdhi", &mstp_clks[MSTP415]), 602 CLKDEV_DEV_ID("e6870000.sdhi", &mstp_clks[MSTP415]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index cd6855290b1f..53798e5037d7 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -23,9 +23,23 @@
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 24 */
25 25
26/*
27 * MD MD MD MD PLLA PLLB EXTAL clki clkz
28 * 19 18 12 11 (HMz) (MHz) (MHz)
29 *----------------------------------------------------------------------------
30 * 1 0 0 0 x21 x21 38.00 800 800
31 * 1 0 0 1 x24 x24 33.33 800 800
32 * 1 0 1 0 x28 x28 28.50 800 800
33 * 1 0 1 1 x32 x32 25.00 800 800
34 * 1 1 0 1 x24 x21 33.33 800 700
35 * 1 1 1 0 x28 x21 28.50 800 600
36 * 1 1 1 1 x32 x24 25.00 800 600
37 */
38
26#include <linux/io.h> 39#include <linux/io.h>
27#include <linux/sh_clk.h> 40#include <linux/sh_clk.h>
28#include <linux/clkdev.h> 41#include <linux/clkdev.h>
42#include <mach/clock.h>
29#include <mach/common.h> 43#include <mach/common.h>
30 44
31#define MSTPCR0 IOMEM(0xffc80030) 45#define MSTPCR0 IOMEM(0xffc80030)
@@ -37,6 +51,9 @@
37#define MSTPCR4 IOMEM(0xffc80050) 51#define MSTPCR4 IOMEM(0xffc80050)
38#define MSTPCR5 IOMEM(0xffc80054) 52#define MSTPCR5 IOMEM(0xffc80054)
39#define MSTPCR6 IOMEM(0xffc80058) 53#define MSTPCR6 IOMEM(0xffc80058)
54#define MODEMR 0xFFCC0020
55
56#define MD(nr) BIT(nr)
40 57
41/* ioremap() through clock mapping mandatory to avoid 58/* ioremap() through clock mapping mandatory to avoid
42 * collision with ARM coherent DMA virtual memory range. 59 * collision with ARM coherent DMA virtual memory range.
@@ -47,37 +64,94 @@ static struct clk_mapping cpg_mapping = {
47 .len = 0x80, 64 .len = 0x80,
48}; 65};
49 66
50static struct clk clkp = { 67static struct clk extal_clk = {
51 .rate = 62500000, /* FIXME: shortcut */ 68 /* .rate will be updated on r8a7778_clock_init() */
52 .flags = CLK_ENABLE_ON_INIT,
53 .mapping = &cpg_mapping, 69 .mapping = &cpg_mapping,
54}; 70};
55 71
72/*
73 * clock ratio of these clock will be updated
74 * on r8a7778_clock_init()
75 */
76SH_FIXED_RATIO_CLK_SET(plla_clk, extal_clk, 1, 1);
77SH_FIXED_RATIO_CLK_SET(pllb_clk, extal_clk, 1, 1);
78SH_FIXED_RATIO_CLK_SET(i_clk, plla_clk, 1, 1);
79SH_FIXED_RATIO_CLK_SET(s_clk, plla_clk, 1, 1);
80SH_FIXED_RATIO_CLK_SET(s1_clk, plla_clk, 1, 1);
81SH_FIXED_RATIO_CLK_SET(s3_clk, plla_clk, 1, 1);
82SH_FIXED_RATIO_CLK_SET(s4_clk, plla_clk, 1, 1);
83SH_FIXED_RATIO_CLK_SET(b_clk, plla_clk, 1, 1);
84SH_FIXED_RATIO_CLK_SET(out_clk, plla_clk, 1, 1);
85SH_FIXED_RATIO_CLK_SET(p_clk, plla_clk, 1, 1);
86SH_FIXED_RATIO_CLK_SET(g_clk, plla_clk, 1, 1);
87SH_FIXED_RATIO_CLK_SET(z_clk, pllb_clk, 1, 1);
88
56static struct clk *main_clks[] = { 89static struct clk *main_clks[] = {
57 &clkp, 90 &extal_clk,
91 &plla_clk,
92 &pllb_clk,
93 &i_clk,
94 &s_clk,
95 &s1_clk,
96 &s3_clk,
97 &s4_clk,
98 &b_clk,
99 &out_clk,
100 &p_clk,
101 &g_clk,
102 &z_clk,
58}; 103};
59 104
60enum { 105enum {
106 MSTP331,
107 MSTP323, MSTP322, MSTP321,
61 MSTP114, 108 MSTP114,
62 MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 109 MSTP100,
110 MSTP030,
111 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
63 MSTP016, MSTP015, 112 MSTP016, MSTP015,
113 MSTP007,
64 MSTP_NR }; 114 MSTP_NR };
65 115
66static struct clk mstp_clks[MSTP_NR] = { 116static struct clk mstp_clks[MSTP_NR] = {
67 [MSTP114] = SH_CLK_MSTP32(&clkp, MSTPCR1, 14, 0), /* Ether */ 117 [MSTP331] = SH_CLK_MSTP32(&s4_clk, MSTPCR3, 31, 0), /* MMC */
68 [MSTP026] = SH_CLK_MSTP32(&clkp, MSTPCR0, 26, 0), /* SCIF0 */ 118 [MSTP323] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 23, 0), /* SDHI0 */
69 [MSTP025] = SH_CLK_MSTP32(&clkp, MSTPCR0, 25, 0), /* SCIF1 */ 119 [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */
70 [MSTP024] = SH_CLK_MSTP32(&clkp, MSTPCR0, 24, 0), /* SCIF2 */ 120 [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */
71 [MSTP023] = SH_CLK_MSTP32(&clkp, MSTPCR0, 23, 0), /* SCIF3 */ 121 [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */
72 [MSTP022] = SH_CLK_MSTP32(&clkp, MSTPCR0, 22, 0), /* SCIF4 */ 122 [MSTP100] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 0, 0), /* USB0/1 */
73 [MSTP021] = SH_CLK_MSTP32(&clkp, MSTPCR0, 21, 0), /* SCIF5 */ 123 [MSTP030] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 30, 0), /* I2C0 */
74 [MSTP016] = SH_CLK_MSTP32(&clkp, MSTPCR0, 16, 0), /* TMU0 */ 124 [MSTP029] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 29, 0), /* I2C1 */
75 [MSTP015] = SH_CLK_MSTP32(&clkp, MSTPCR0, 15, 0), /* TMU1 */ 125 [MSTP028] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 28, 0), /* I2C2 */
126 [MSTP027] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 27, 0), /* I2C3 */
127 [MSTP026] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 26, 0), /* SCIF0 */
128 [MSTP025] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 25, 0), /* SCIF1 */
129 [MSTP024] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 24, 0), /* SCIF2 */
130 [MSTP023] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 23, 0), /* SCIF3 */
131 [MSTP022] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 22, 0), /* SCIF4 */
132 [MSTP021] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 21, 0), /* SCIF5 */
133 [MSTP016] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 16, 0), /* TMU0 */
134 [MSTP015] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 15, 0), /* TMU1 */
135 [MSTP007] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 7, 0), /* HSPI */
76}; 136};
77 137
78static struct clk_lookup lookups[] = { 138static struct clk_lookup lookups[] = {
139 /* main */
140 CLKDEV_CON_ID("shyway_clk", &s_clk),
141 CLKDEV_CON_ID("peripheral_clk", &p_clk),
142
79 /* MSTP32 clocks */ 143 /* MSTP32 clocks */
144 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP331]), /* MMC */
145 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
146 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
147 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
80 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */ 148 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */
149 CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
150 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
151 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
152 CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */
153 CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */
154 CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */
81 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ 155 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
82 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ 156 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
83 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 157 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
@@ -86,12 +160,93 @@ static struct clk_lookup lookups[] = {
86 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */ 160 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP021]), /* SCIF6 */
87 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */ 161 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP016]), /* TMU00 */
88 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP015]), /* TMU01 */ 162 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP015]), /* TMU01 */
163 CLKDEV_DEV_ID("sh-hspi.0", &mstp_clks[MSTP007]), /* HSPI0 */
164 CLKDEV_DEV_ID("sh-hspi.1", &mstp_clks[MSTP007]), /* HSPI1 */
165 CLKDEV_DEV_ID("sh-hspi.2", &mstp_clks[MSTP007]), /* HSPI2 */
89}; 166};
90 167
91void __init r8a7778_clock_init(void) 168void __init r8a7778_clock_init(void)
92{ 169{
170 void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
171 u32 mode;
93 int k, ret = 0; 172 int k, ret = 0;
94 173
174 BUG_ON(!modemr);
175 mode = ioread32(modemr);
176 iounmap(modemr);
177
178 switch (mode & (MD(19) | MD(18) | MD(12) | MD(11))) {
179 case MD(19):
180 extal_clk.rate = 38000000;
181 SH_CLK_SET_RATIO(&plla_clk_ratio, 21, 1);
182 SH_CLK_SET_RATIO(&pllb_clk_ratio, 21, 1);
183 break;
184 case MD(19) | MD(11):
185 extal_clk.rate = 33333333;
186 SH_CLK_SET_RATIO(&plla_clk_ratio, 24, 1);
187 SH_CLK_SET_RATIO(&pllb_clk_ratio, 24, 1);
188 break;
189 case MD(19) | MD(12):
190 extal_clk.rate = 28500000;
191 SH_CLK_SET_RATIO(&plla_clk_ratio, 28, 1);
192 SH_CLK_SET_RATIO(&pllb_clk_ratio, 28, 1);
193 break;
194 case MD(19) | MD(12) | MD(11):
195 extal_clk.rate = 25000000;
196 SH_CLK_SET_RATIO(&plla_clk_ratio, 32, 1);
197 SH_CLK_SET_RATIO(&pllb_clk_ratio, 32, 1);
198 break;
199 case MD(19) | MD(18) | MD(11):
200 extal_clk.rate = 33333333;
201 SH_CLK_SET_RATIO(&plla_clk_ratio, 24, 1);
202 SH_CLK_SET_RATIO(&pllb_clk_ratio, 21, 1);
203 break;
204 case MD(19) | MD(18) | MD(12):
205 extal_clk.rate = 28500000;
206 SH_CLK_SET_RATIO(&plla_clk_ratio, 28, 1);
207 SH_CLK_SET_RATIO(&pllb_clk_ratio, 21, 1);
208 break;
209 case MD(19) | MD(18) | MD(12) | MD(11):
210 extal_clk.rate = 25000000;
211 SH_CLK_SET_RATIO(&plla_clk_ratio, 32, 1);
212 SH_CLK_SET_RATIO(&pllb_clk_ratio, 24, 1);
213 break;
214 default:
215 BUG();
216 }
217
218 if (mode & MD(1)) {
219 SH_CLK_SET_RATIO(&i_clk_ratio, 1, 1);
220 SH_CLK_SET_RATIO(&s_clk_ratio, 1, 3);
221 SH_CLK_SET_RATIO(&s1_clk_ratio, 1, 6);
222 SH_CLK_SET_RATIO(&s3_clk_ratio, 1, 4);
223 SH_CLK_SET_RATIO(&s4_clk_ratio, 1, 8);
224 SH_CLK_SET_RATIO(&p_clk_ratio, 1, 12);
225 SH_CLK_SET_RATIO(&g_clk_ratio, 1, 12);
226 if (mode & MD(2)) {
227 SH_CLK_SET_RATIO(&b_clk_ratio, 1, 18);
228 SH_CLK_SET_RATIO(&out_clk_ratio, 1, 18);
229 } else {
230 SH_CLK_SET_RATIO(&b_clk_ratio, 1, 12);
231 SH_CLK_SET_RATIO(&out_clk_ratio, 1, 12);
232 }
233 } else {
234 SH_CLK_SET_RATIO(&i_clk_ratio, 1, 1);
235 SH_CLK_SET_RATIO(&s_clk_ratio, 1, 4);
236 SH_CLK_SET_RATIO(&s1_clk_ratio, 1, 8);
237 SH_CLK_SET_RATIO(&s3_clk_ratio, 1, 4);
238 SH_CLK_SET_RATIO(&s4_clk_ratio, 1, 8);
239 SH_CLK_SET_RATIO(&p_clk_ratio, 1, 16);
240 SH_CLK_SET_RATIO(&g_clk_ratio, 1, 12);
241 if (mode & MD(2)) {
242 SH_CLK_SET_RATIO(&b_clk_ratio, 1, 16);
243 SH_CLK_SET_RATIO(&out_clk_ratio, 1, 16);
244 } else {
245 SH_CLK_SET_RATIO(&b_clk_ratio, 1, 12);
246 SH_CLK_SET_RATIO(&out_clk_ratio, 1, 12);
247 }
248 }
249
95 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 250 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
96 ret = clk_register(main_clks[k]); 251 ret = clk_register(main_clks[k]);
97 252
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 31d5cd4d9787..9daeb8c37483 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -112,7 +112,7 @@ static struct clk *main_clks[] = {
112}; 112};
113 113
114enum { MSTP323, MSTP322, MSTP321, MSTP320, 114enum { MSTP323, MSTP322, MSTP321, MSTP320,
115 MSTP115, MSTP114, 115 MSTP116, MSTP115, MSTP114,
116 MSTP103, MSTP101, MSTP100, 116 MSTP103, MSTP101, MSTP100,
117 MSTP030, 117 MSTP030,
118 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, 118 MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
@@ -125,6 +125,7 @@ static struct clk mstp_clks[MSTP_NR] = {
125 [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */ 125 [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */
126 [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */ 126 [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */
127 [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */ 127 [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */
128 [MSTP116] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 16, 0), /* PCIe */
128 [MSTP115] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 15, 0), /* SATA */ 129 [MSTP115] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 15, 0), /* SATA */
129 [MSTP114] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 14, 0), /* Ether */ 130 [MSTP114] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 14, 0), /* Ether */
130 [MSTP103] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 3, 0), /* DU */ 131 [MSTP103] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 3, 0), /* DU */
@@ -161,6 +162,7 @@ static struct clk_lookup lookups[] = {
161 CLKDEV_CON_ID("peripheral_clk", &clkp_clk), 162 CLKDEV_CON_ID("peripheral_clk", &clkp_clk),
162 163
163 /* MSTP32 clocks */ 164 /* MSTP32 clocks */
165 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
164 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */ 166 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
165 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */ 167 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
166 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */ 168 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index bad9bf2e34d6..5d71313df52d 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -22,48 +22,228 @@
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 <mach/common.h> 26#include <mach/common.h>
26 27
28/*
29 * MD EXTAL PLL0 PLL1 PLL3
30 * 14 13 19 (MHz) *1 *1
31 *---------------------------------------------------
32 * 0 0 0 15 x 1 x172/2 x208/2 x106
33 * 0 0 1 15 x 1 x172/2 x208/2 x88
34 * 0 1 0 20 x 1 x130/2 x156/2 x80
35 * 0 1 1 20 x 1 x130/2 x156/2 x66
36 * 1 0 0 26 / 2 x200/2 x240/2 x122
37 * 1 0 1 26 / 2 x200/2 x240/2 x102
38 * 1 1 0 30 / 2 x172/2 x208/2 x106
39 * 1 1 1 30 / 2 x172/2 x208/2 x88
40 *
41 * *1 : Table 7.6 indicates VCO ouput (PLLx = VCO/2)
42 * see "p1 / 2" on R8A7790_CLOCK_ROOT() below
43 */
44
45#define MD(nr) (1 << nr)
46
27#define CPG_BASE 0xe6150000 47#define CPG_BASE 0xe6150000
28#define CPG_LEN 0x1000 48#define CPG_LEN 0x1000
29 49
30#define SMSTPCR2 0xe6150138 50#define SMSTPCR2 0xe6150138
51#define SMSTPCR3 0xe615013c
31#define SMSTPCR7 0xe615014c 52#define SMSTPCR7 0xe615014c
32 53
54#define MODEMR 0xE6160060
55#define SDCKCR 0xE6150074
56#define SD2CKCR 0xE6150078
57#define SD3CKCR 0xE615007C
58#define MMC0CKCR 0xE6150240
59#define MMC1CKCR 0xE6150244
60#define SSPCKCR 0xE6150248
61#define SSPRSCKCR 0xE615024C
62
33static struct clk_mapping cpg_mapping = { 63static struct clk_mapping cpg_mapping = {
34 .phys = CPG_BASE, 64 .phys = CPG_BASE,
35 .len = CPG_LEN, 65 .len = CPG_LEN,
36}; 66};
37 67
38static struct clk p_clk = { 68static struct clk extal_clk = {
39 .rate = 65000000, /* shortcut for now */ 69 /* .rate will be updated on r8a7790_clock_init() */
40 .mapping = &cpg_mapping, 70 .mapping = &cpg_mapping,
41}; 71};
42 72
43static struct clk mp_clk = { 73static struct sh_clk_ops followparent_clk_ops = {
44 .rate = 52000000, /* shortcut for now */ 74 .recalc = followparent_recalc,
45 .mapping = &cpg_mapping, 75};
76
77static struct clk main_clk = {
78 /* .parent will be set r8a73a4_clock_init */
79 .ops = &followparent_clk_ops,
46}; 80};
47 81
82/*
83 * clock ratio of these clock will be updated
84 * on r8a7790_clock_init()
85 */
86SH_FIXED_RATIO_CLK_SET(pll1_clk, main_clk, 1, 1);
87SH_FIXED_RATIO_CLK_SET(pll3_clk, main_clk, 1, 1);
88SH_FIXED_RATIO_CLK_SET(lb_clk, pll1_clk, 1, 1);
89SH_FIXED_RATIO_CLK_SET(qspi_clk, pll1_clk, 1, 1);
90
91/* fixed ratio clock */
92SH_FIXED_RATIO_CLK_SET(extal_div2_clk, extal_clk, 1, 2);
93SH_FIXED_RATIO_CLK_SET(cp_clk, extal_clk, 1, 2);
94
95SH_FIXED_RATIO_CLK_SET(pll1_div2_clk, pll1_clk, 1, 2);
96SH_FIXED_RATIO_CLK_SET(zg_clk, pll1_clk, 1, 3);
97SH_FIXED_RATIO_CLK_SET(zx_clk, pll1_clk, 1, 3);
98SH_FIXED_RATIO_CLK_SET(zs_clk, pll1_clk, 1, 6);
99SH_FIXED_RATIO_CLK_SET(hp_clk, pll1_clk, 1, 12);
100SH_FIXED_RATIO_CLK_SET(i_clk, pll1_clk, 1, 2);
101SH_FIXED_RATIO_CLK_SET(b_clk, pll1_clk, 1, 12);
102SH_FIXED_RATIO_CLK_SET(p_clk, pll1_clk, 1, 24);
103SH_FIXED_RATIO_CLK_SET(cl_clk, pll1_clk, 1, 48);
104SH_FIXED_RATIO_CLK_SET(m2_clk, pll1_clk, 1, 8);
105SH_FIXED_RATIO_CLK_SET(imp_clk, pll1_clk, 1, 4);
106SH_FIXED_RATIO_CLK_SET(rclk_clk, pll1_clk, 1, (48 * 1024));
107SH_FIXED_RATIO_CLK_SET(oscclk_clk, pll1_clk, 1, (12 * 1024));
108
109SH_FIXED_RATIO_CLK_SET(zb3_clk, pll3_clk, 1, 4);
110SH_FIXED_RATIO_CLK_SET(zb3d2_clk, pll3_clk, 1, 8);
111SH_FIXED_RATIO_CLK_SET(ddr_clk, pll3_clk, 1, 8);
112SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15);
113
48static struct clk *main_clks[] = { 114static struct clk *main_clks[] = {
115 &extal_clk,
116 &extal_div2_clk,
117 &main_clk,
118 &pll1_clk,
119 &pll1_div2_clk,
120 &pll3_clk,
121 &lb_clk,
122 &qspi_clk,
123 &zg_clk,
124 &zx_clk,
125 &zs_clk,
126 &hp_clk,
127 &i_clk,
128 &b_clk,
49 &p_clk, 129 &p_clk,
130 &cl_clk,
131 &m2_clk,
132 &imp_clk,
133 &rclk_clk,
134 &oscclk_clk,
135 &zb3_clk,
136 &zb3d2_clk,
137 &ddr_clk,
50 &mp_clk, 138 &mp_clk,
139 &cp_clk,
140};
141
142/* SDHI (DIV4) clock */
143static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10 };
144
145static struct clk_div_mult_table div4_div_mult_table = {
146 .divisors = divisors,
147 .nr_divisors = ARRAY_SIZE(divisors),
148};
149
150static struct clk_div4_table div4_table = {
151 .div_mult_table = &div4_div_mult_table,
152};
153
154enum {
155 DIV4_SDH, DIV4_SD0, DIV4_SD1, DIV4_NR
156};
157
158static struct clk div4_clks[DIV4_NR] = {
159 [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT),
160 [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT),
161 [DIV4_SD1] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 0, 0x1de0, CLK_ENABLE_ON_INIT),
162};
163
164/* DIV6 clocks */
165enum {
166 DIV6_SD2, DIV6_SD3,
167 DIV6_MMC0, DIV6_MMC1,
168 DIV6_SSP, DIV6_SSPRS,
169 DIV6_NR
170};
171
172static struct clk div6_clks[DIV6_NR] = {
173 [DIV6_SD2] = SH_CLK_DIV6(&pll1_div2_clk, SD2CKCR, 0),
174 [DIV6_SD3] = SH_CLK_DIV6(&pll1_div2_clk, SD3CKCR, 0),
175 [DIV6_MMC0] = SH_CLK_DIV6(&pll1_div2_clk, MMC0CKCR, 0),
176 [DIV6_MMC1] = SH_CLK_DIV6(&pll1_div2_clk, MMC1CKCR, 0),
177 [DIV6_SSP] = SH_CLK_DIV6(&pll1_div2_clk, SSPCKCR, 0),
178 [DIV6_SSPRS] = SH_CLK_DIV6(&pll1_div2_clk, SSPRSCKCR, 0),
179};
180
181/* MSTP */
182enum {
183 MSTP721, MSTP720,
184 MSTP717, MSTP716,
185 MSTP315, MSTP314, MSTP313, MSTP312, MSTP311, MSTP305, MSTP304,
186 MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202,
187 MSTP_NR
51}; 188};
52 189
53enum { MSTP721, MSTP720,
54 MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP_NR };
55static struct clk mstp_clks[MSTP_NR] = { 190static struct clk mstp_clks[MSTP_NR] = {
56 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */ 191 [MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */
57 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */ 192 [MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
193 [MSTP315] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC0], SMSTPCR3, 15, 0), /* MMC0 */
194 [MSTP314] = SH_CLK_MSTP32(&div4_clks[DIV4_SD0], SMSTPCR3, 14, 0), /* SDHI0 */
195 [MSTP313] = SH_CLK_MSTP32(&div4_clks[DIV4_SD1], SMSTPCR3, 13, 0), /* SDHI1 */
196 [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SD2], SMSTPCR3, 12, 0), /* SDHI2 */
197 [MSTP311] = SH_CLK_MSTP32(&div6_clks[DIV6_SD3], SMSTPCR3, 11, 0), /* SDHI3 */
198 [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1], SMSTPCR3, 5, 0), /* MMC1 */
199 [MSTP304] = SH_CLK_MSTP32(&cp_clk, SMSTPCR3, 4, 0), /* TPU0 */
58 [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */ 200 [MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */
59 [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */ 201 [MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */
60 [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */ 202 [MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */
61 [MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */ 203 [MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */
62 [MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */ 204 [MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */
63 [MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */ 205 [MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */
206 [MSTP717] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 17, 0), /* HSCIF0 */
207 [MSTP716] = SH_CLK_MSTP32(&zs_clk, SMSTPCR7, 16, 0), /* HSCIF1 */
64}; 208};
65 209
66static struct clk_lookup lookups[] = { 210static struct clk_lookup lookups[] = {
211
212 /* main clocks */
213 CLKDEV_CON_ID("extal", &extal_clk),
214 CLKDEV_CON_ID("extal_div2", &extal_div2_clk),
215 CLKDEV_CON_ID("main", &main_clk),
216 CLKDEV_CON_ID("pll1", &pll1_clk),
217 CLKDEV_CON_ID("pll1_div2", &pll1_div2_clk),
218 CLKDEV_CON_ID("pll3", &pll3_clk),
219 CLKDEV_CON_ID("zg", &zg_clk),
220 CLKDEV_CON_ID("zx", &zx_clk),
221 CLKDEV_CON_ID("zs", &zs_clk),
222 CLKDEV_CON_ID("hp", &hp_clk),
223 CLKDEV_CON_ID("i", &i_clk),
224 CLKDEV_CON_ID("b", &b_clk),
225 CLKDEV_CON_ID("lb", &lb_clk),
226 CLKDEV_CON_ID("p", &p_clk),
227 CLKDEV_CON_ID("cl", &cl_clk),
228 CLKDEV_CON_ID("m2", &m2_clk),
229 CLKDEV_CON_ID("imp", &imp_clk),
230 CLKDEV_CON_ID("rclk", &rclk_clk),
231 CLKDEV_CON_ID("oscclk", &oscclk_clk),
232 CLKDEV_CON_ID("zb3", &zb3_clk),
233 CLKDEV_CON_ID("zb3d2", &zb3d2_clk),
234 CLKDEV_CON_ID("ddr", &ddr_clk),
235 CLKDEV_CON_ID("mp", &mp_clk),
236 CLKDEV_CON_ID("qspi", &qspi_clk),
237 CLKDEV_CON_ID("cp", &cp_clk),
238
239 /* DIV4 */
240 CLKDEV_CON_ID("sdh", &div4_clks[DIV4_SDH]),
241
242 /* DIV6 */
243 CLKDEV_CON_ID("ssp", &div6_clks[DIV6_SSP]),
244 CLKDEV_CON_ID("ssprs", &div6_clks[DIV6_SSPRS]),
245
246 /* MSTP */
67 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]), 247 CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
68 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]), 248 CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
69 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]), 249 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
@@ -72,16 +252,77 @@ static struct clk_lookup lookups[] = {
72 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP202]), 252 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP202]),
73 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP721]), 253 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP721]),
74 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), 254 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]),
255 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]),
256 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]),
257 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]),
258 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
259 CLKDEV_DEV_ID("ee100000.sdhi", &mstp_clks[MSTP314]),
260 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
261 CLKDEV_DEV_ID("ee120000.sdhi", &mstp_clks[MSTP313]),
262 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
263 CLKDEV_DEV_ID("ee140000.sdhi", &mstp_clks[MSTP312]),
264 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
265 CLKDEV_DEV_ID("ee160000.sdhi", &mstp_clks[MSTP311]),
266 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]),
267 CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
268 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
75}; 269};
76 270
271#define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31) \
272 extal_clk.rate = e * 1000 * 1000; \
273 main_clk.parent = m; \
274 SH_CLK_SET_RATIO(&pll1_clk_ratio, p1 / 2, 1); \
275 if (mode & MD(19)) \
276 SH_CLK_SET_RATIO(&pll3_clk_ratio, p31, 1); \
277 else \
278 SH_CLK_SET_RATIO(&pll3_clk_ratio, p30, 1)
279
280
77void __init r8a7790_clock_init(void) 281void __init r8a7790_clock_init(void)
78{ 282{
283 void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
284 u32 mode;
79 int k, ret = 0; 285 int k, ret = 0;
80 286
287 BUG_ON(!modemr);
288 mode = ioread32(modemr);
289 iounmap(modemr);
290
291 switch (mode & (MD(14) | MD(13))) {
292 case 0:
293 R8A7790_CLOCK_ROOT(15, &extal_clk, 172, 208, 106, 88);
294 break;
295 case MD(13):
296 R8A7790_CLOCK_ROOT(20, &extal_clk, 130, 156, 80, 66);
297 break;
298 case MD(14):
299 R8A7790_CLOCK_ROOT(26, &extal_div2_clk, 200, 240, 122, 102);
300 break;
301 case MD(13) | MD(14):
302 R8A7790_CLOCK_ROOT(30, &extal_div2_clk, 172, 208, 106, 88);
303 break;
304 }
305
306 if (mode & (MD(18)))
307 SH_CLK_SET_RATIO(&lb_clk_ratio, 1, 36);
308 else
309 SH_CLK_SET_RATIO(&lb_clk_ratio, 1, 24);
310
311 if ((mode & (MD(3) | MD(2) | MD(1))) == MD(2))
312 SH_CLK_SET_RATIO(&qspi_clk_ratio, 1, 16);
313 else
314 SH_CLK_SET_RATIO(&qspi_clk_ratio, 1, 20);
315
81 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 316 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
82 ret = clk_register(main_clks[k]); 317 ret = clk_register(main_clks[k]);
83 318
84 if (!ret) 319 if (!ret)
320 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
321
322 if (!ret)
323 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
324
325 if (!ret)
85 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); 326 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
86 327
87 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 328 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 7e105932c09d..5390c6bbbc02 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -142,15 +142,15 @@ static void pllc2_table_rebuild(struct clk *clk)
142 /* Initialise PLLC2 frequency table */ 142 /* Initialise PLLC2 frequency table */
143 for (i = 0; i < ARRAY_SIZE(pllc2_freq_table) - 2; i++) { 143 for (i = 0; i < ARRAY_SIZE(pllc2_freq_table) - 2; i++) {
144 pllc2_freq_table[i].frequency = clk->parent->rate * (i + 20) * 2; 144 pllc2_freq_table[i].frequency = clk->parent->rate * (i + 20) * 2;
145 pllc2_freq_table[i].index = i; 145 pllc2_freq_table[i].driver_data = i;
146 } 146 }
147 147
148 /* This is a special entry - switching PLL off makes it a repeater */ 148 /* This is a special entry - switching PLL off makes it a repeater */
149 pllc2_freq_table[i].frequency = clk->parent->rate; 149 pllc2_freq_table[i].frequency = clk->parent->rate;
150 pllc2_freq_table[i].index = i; 150 pllc2_freq_table[i].driver_data = i;
151 151
152 pllc2_freq_table[++i].frequency = CPUFREQ_TABLE_END; 152 pllc2_freq_table[++i].frequency = CPUFREQ_TABLE_END;
153 pllc2_freq_table[i].index = i; 153 pllc2_freq_table[i].driver_data = i;
154} 154}
155 155
156static unsigned long pllc2_recalc(struct clk *clk) 156static unsigned long pllc2_recalc(struct clk *clk)
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index 784fbaa4cc55..d9fd0336b910 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -228,6 +228,11 @@ enum { DIV4_I, DIV4_ZG, DIV4_M3, DIV4_B, DIV4_M1, DIV4_M2,
228 228
229static struct clk div4_clks[DIV4_NR] = { 229static struct clk div4_clks[DIV4_NR] = {
230 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT), 230 [DIV4_I] = DIV4(FRQCRA, 20, 0xdff, CLK_ENABLE_ON_INIT),
231 /*
232 * ZG clock is dividing PLL0 frequency to supply SGX. Make sure not to
233 * exceed maximum frequencies of 201.5MHz for VDD_DVFS=1.175 and
234 * 239.2MHz for VDD_DVFS=1.315V.
235 */
231 [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT), 236 [DIV4_ZG] = SH_CLK_DIV4(&pll0_clk, FRQCRA, 16, 0xd7f, CLK_ENABLE_ON_INIT),
232 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT), 237 [DIV4_M3] = DIV4(FRQCRA, 12, 0x1dff, CLK_ENABLE_ON_INIT),
233 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT), 238 [DIV4_B] = DIV4(FRQCRA, 8, 0xdff, CLK_ENABLE_ON_INIT),
@@ -252,6 +257,101 @@ static struct clk twd_clk = {
252 .ops = &twd_clk_ops, 257 .ops = &twd_clk_ops,
253}; 258};
254 259
260static struct sh_clk_ops zclk_ops, kicker_ops;
261static const struct sh_clk_ops *div4_clk_ops;
262
263static int zclk_set_rate(struct clk *clk, unsigned long rate)
264{
265 int ret;
266
267 if (!clk->parent || !__clk_get(clk->parent))
268 return -ENODEV;
269
270 if (readl(FRQCRB) & (1 << 31))
271 return -EBUSY;
272
273 if (rate == clk_get_rate(clk->parent)) {
274 /* 1:1 - switch off divider */
275 __raw_writel(__raw_readl(FRQCRB) & ~(1 << 28), FRQCRB);
276 /* nullify the divider to prepare for the next time */
277 ret = div4_clk_ops->set_rate(clk, rate / 2);
278 if (!ret)
279 ret = frqcr_kick();
280 if (ret > 0)
281 ret = 0;
282 } else {
283 /* Enable the divider */
284 __raw_writel(__raw_readl(FRQCRB) | (1 << 28), FRQCRB);
285
286 ret = frqcr_kick();
287 if (ret >= 0)
288 /*
289 * set the divider - call the DIV4 method, it will kick
290 * FRQCRB too
291 */
292 ret = div4_clk_ops->set_rate(clk, rate);
293 if (ret < 0)
294 goto esetrate;
295 }
296
297esetrate:
298 __clk_put(clk->parent);
299 return ret;
300}
301
302static long zclk_round_rate(struct clk *clk, unsigned long rate)
303{
304 unsigned long div_freq = div4_clk_ops->round_rate(clk, rate),
305 parent_freq = clk_get_rate(clk->parent);
306
307 if (rate > div_freq && abs(parent_freq - rate) < rate - div_freq)
308 return parent_freq;
309
310 return div_freq;
311}
312
313static unsigned long zclk_recalc(struct clk *clk)
314{
315 /*
316 * Must recalculate frequencies in case PLL0 has been changed, even if
317 * the divisor is unused ATM!
318 */
319 unsigned long div_freq = div4_clk_ops->recalc(clk);
320
321 if (__raw_readl(FRQCRB) & (1 << 28))
322 return div_freq;
323
324 return clk_get_rate(clk->parent);
325}
326
327static int kicker_set_rate(struct clk *clk, unsigned long rate)
328{
329 if (__raw_readl(FRQCRB) & (1 << 31))
330 return -EBUSY;
331
332 return div4_clk_ops->set_rate(clk, rate);
333}
334
335static void div4_clk_extend(void)
336{
337 int i;
338
339 div4_clk_ops = div4_clks[0].ops;
340
341 /* Add a kicker-busy check before changing the rate */
342 kicker_ops = *div4_clk_ops;
343 /* We extend the DIV4 clock with a 1:1 pass-through case */
344 zclk_ops = *div4_clk_ops;
345
346 kicker_ops.set_rate = kicker_set_rate;
347 zclk_ops.set_rate = zclk_set_rate;
348 zclk_ops.round_rate = zclk_round_rate;
349 zclk_ops.recalc = zclk_recalc;
350
351 for (i = 0; i < DIV4_NR; i++)
352 div4_clks[i].ops = i == DIV4_Z ? &zclk_ops : &kicker_ops;
353}
354
255enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1, 355enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_ZB1,
256 DIV6_FLCTL, DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2, 356 DIV6_FLCTL, DIV6_SDHI0, DIV6_SDHI1, DIV6_SDHI2,
257 DIV6_FSIA, DIV6_FSIB, DIV6_SUB, 357 DIV6_FSIA, DIV6_FSIB, DIV6_SUB,
@@ -450,7 +550,7 @@ static struct clk *late_main_clks[] = {
450}; 550};
451 551
452enum { MSTP001, 552enum { MSTP001,
453 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, 553 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP112, MSTP100,
454 MSTP219, MSTP218, MSTP217, 554 MSTP219, MSTP218, MSTP217,
455 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 555 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
456 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322, 556 MSTP331, MSTP329, MSTP328, MSTP325, MSTP323, MSTP322,
@@ -471,6 +571,7 @@ static struct clk mstp_clks[MSTP_NR] = {
471 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ 571 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
472 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */ 572 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */
473 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ 573 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */
574 [MSTP112] = MSTP(&div4_clks[DIV4_ZG], SMSTPCR1, 12, 0), /* SGX */
474 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ 575 [MSTP100] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
475 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */ 576 [MSTP219] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 19, 0), /* SCIFA7 */
476 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */ 577 [MSTP218] = MSTP(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* SY-DMAC */
@@ -513,6 +614,9 @@ static struct clk_lookup lookups[] = {
513 CLKDEV_CON_ID("r_clk", &r_clk), 614 CLKDEV_CON_ID("r_clk", &r_clk),
514 CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */ 615 CLKDEV_DEV_ID("smp_twd", &twd_clk), /* smp_twd */
515 616
617 /* DIV4 clocks */
618 CLKDEV_DEV_ID("cpufreq-cpu0", &div4_clks[DIV4_Z]),
619
516 /* DIV6 clocks */ 620 /* DIV6 clocks */
517 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]), 621 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
518 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]), 622 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
@@ -604,8 +708,11 @@ void __init sh73a0_clock_init(void)
604 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 708 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
605 ret = clk_register(main_clks[k]); 709 ret = clk_register(main_clks[k]);
606 710
607 if (!ret) 711 if (!ret) {
608 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table); 712 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
713 if (!ret)
714 div4_clk_extend();
715 }
609 716
610 if (!ret) 717 if (!ret)
611 ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR); 718 ret = sh_clk_div6_reparent_register(div6_clks, DIV6_NR);
diff --git a/arch/arm/mach-shmobile/headsmp-scu.S b/arch/arm/mach-shmobile/headsmp-scu.S
index 7d113f898e7f..6f9865467258 100644
--- a/arch/arm/mach-shmobile/headsmp-scu.S
+++ b/arch/arm/mach-shmobile/headsmp-scu.S
@@ -25,31 +25,24 @@
25 25
26 __CPUINIT 26 __CPUINIT
27/* 27/*
28 * Reset vector for secondary CPUs. 28 * Boot code for secondary CPUs.
29 * 29 *
30 * First we turn on L1 cache coherency for our CPU. Then we jump to 30 * First we turn on L1 cache coherency for our CPU. Then we jump to
31 * shmobile_invalidate_start that invalidates the cache and hands over control 31 * shmobile_invalidate_start that invalidates the cache and hands over control
32 * to the common ARM startup code. 32 * to the common ARM startup code.
33 * This function will be mapped to address 0 by the SBAR register.
34 * A normal branch is out of range here so we need a long jump. We jump to
35 * the physical address as the MMU is still turned off.
36 */ 33 */
37 .align 12 34ENTRY(shmobile_boot_scu)
38ENTRY(shmobile_secondary_vector_scu) 35 @ r0 = SCU base address
39 mrc p15, 0, r0, c0, c0, 5 @ read MIPDR 36 mrc p15, 0, r1, c0, c0, 5 @ read MIPDR
40 and r0, r0, #3 @ mask out cpu ID 37 and r1, r1, #3 @ mask out cpu ID
41 lsl r0, r0, #3 @ we will shift by cpu_id * 8 bits 38 lsl r1, r1, #3 @ we will shift by cpu_id * 8 bits
42 ldr r1, 2f 39 ldr r2, [r0, #8] @ SCU Power Status Register
43 ldr r1, [r1] @ SCU base address
44 ldr r2, [r1, #8] @ SCU Power Status Register
45 mov r3, #3 40 mov r3, #3
46 bic r2, r2, r3, lsl r0 @ Clear bits of our CPU (Run Mode) 41 bic r2, r2, r3, lsl r1 @ Clear bits of our CPU (Run Mode)
47 str r2, [r1, #8] @ write back 42 str r2, [r0, #8] @ write back
48 43
49 ldr pc, 1f 44 b shmobile_invalidate_start
501: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET 45ENDPROC(shmobile_boot_scu)
512: .long shmobile_scu_base - PAGE_OFFSET + PLAT_PHYS_OFFSET
52ENDPROC(shmobile_secondary_vector_scu)
53 46
54 .text 47 .text
55 .globl shmobile_scu_base 48 .globl shmobile_scu_base
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index 96001fd49b6c..559d1ce5f57e 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -27,7 +27,14 @@ ENDPROC(shmobile_invalidate_start)
27 * We need _long_ jump to the physical address. 27 * We need _long_ jump to the physical address.
28 */ 28 */
29 .align 12 29 .align 12
30ENTRY(shmobile_secondary_vector) 30ENTRY(shmobile_boot_vector)
31 ldr r0, 2f
31 ldr pc, 1f 32 ldr pc, 1f
321: .long shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET 33ENDPROC(shmobile_boot_vector)
33ENDPROC(shmobile_secondary_vector) 34
35 .globl shmobile_boot_fn
36shmobile_boot_fn:
371: .space 4
38 .globl shmobile_boot_arg
39shmobile_boot_arg:
402: .space 4
diff --git a/arch/arm/mach-shmobile/include/mach/clock.h b/arch/arm/mach-shmobile/include/mach/clock.h
index 76ac61292e48..03e56074928c 100644
--- a/arch/arm/mach-shmobile/include/mach/clock.h
+++ b/arch/arm/mach-shmobile/include/mach/clock.h
@@ -24,16 +24,16 @@ struct clk name = { \
24} 24}
25 25
26#define SH_FIXED_RATIO_CLK(name, p, r) \ 26#define SH_FIXED_RATIO_CLK(name, p, r) \
27static SH_FIXED_RATIO_CLKg(name, p, r); 27static SH_FIXED_RATIO_CLKg(name, p, r)
28 28
29#define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \ 29#define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \
30 SH_CLK_RATIO(name, m, d); \ 30 SH_CLK_RATIO(name, m, d); \
31 SH_FIXED_RATIO_CLK(name, p, name); 31 SH_FIXED_RATIO_CLK(name, p, name)
32 32
33#define SH_CLK_SET_RATIO(p, m, d) \ 33#define SH_CLK_SET_RATIO(p, m, d) \
34{ \ 34do { \
35 (p)->mul = m; \ 35 (p)->mul = m; \
36 (p)->div = d; \ 36 (p)->div = d; \
37} 37} while (0)
38 38
39#endif 39#endif
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 4634a5d4b63f..e818f029d8e3 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -7,8 +7,10 @@ extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz,
7 unsigned int mult, unsigned int div); 7 unsigned int mult, unsigned int div);
8struct twd_local_timer; 8struct twd_local_timer;
9extern void shmobile_setup_console(void); 9extern void shmobile_setup_console(void);
10extern void shmobile_secondary_vector(void); 10extern void shmobile_boot_vector(void);
11extern void shmobile_secondary_vector_scu(void); 11extern unsigned long shmobile_boot_fn;
12extern unsigned long shmobile_boot_arg;
13extern void shmobile_boot_scu(void);
12struct clk; 14struct clk;
13extern int shmobile_clk_init(void); 15extern int shmobile_clk_init(void);
14extern void shmobile_handle_irq_intc(struct pt_regs *); 16extern void shmobile_handle_irq_intc(struct pt_regs *);
diff --git a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt
deleted file mode 100644
index 9f134dfeffdc..000000000000
--- a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt
+++ /dev/null
@@ -1,93 +0,0 @@
1LIST "partner-jet-setup.txt"
2LIST "(C) Copyright 2010 Renesas Solutions Corp"
3LIST "Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"
4
5LIST "RWT Setting"
6EW 0xE6020004, 0xA500
7EW 0xE6030004, 0xA500
8
9LIST "GPIO Setting"
10EB 0xE6051013, 0xA2
11
12LIST "CPG"
13ED 0xE61500C0, 0x00000002
14
15WAIT 1, 0xFE40009C
16
17LIST "FRQCR"
18ED 0xE6150000, 0x2D1305C3
19ED 0xE61500E0, 0x9E40358E
20ED 0xE6150004, 0x80331050
21
22WAIT 1, 0xFE40009C
23
24ED 0xE61500E4, 0x00002000
25
26WAIT 1, 0xFE40009C
27
28LIST "PLL"
29ED 0xE6150028, 0x00004000
30
31WAIT 1, 0xFE40009C
32
33ED 0xE615002C, 0x93000040
34
35WAIT 1, 0xFE40009C
36
37LIST "SUB/USBClk"
38ED 0xE6150080, 0x00000180
39
40LIST "BSC"
41ED 0xFEC10000, 0x00E0001B
42
43LIST "SBSC1"
44ED 0xFE400354, 0x01AD8000
45ED 0xFE400354, 0x01AD8001
46
47WAIT 5, 0xFE40009C
48
49ED 0xFE400008, 0xBCC90151
50ED 0xFE400040, 0x41774113
51ED 0xFE400044, 0x2712E229
52ED 0xFE400048, 0x20C18505
53ED 0xFE40004C, 0x00110209
54ED 0xFE400010, 0x00000087
55
56WAIT 30, 0xFE40009C
57
58ED 0xFE400084, 0x0000003F
59EB 0xFE500000, 0x00
60
61WAIT 5, 0xFE40009C
62
63ED 0xFE400084, 0x0000FF0A
64EB 0xFE500000, 0x00
65
66WAIT 1, 0xFE40009C
67
68ED 0xFE400084, 0x00002201
69EB 0xFE500000, 0x00
70ED 0xFE400084, 0x00000302
71EB 0xFE500000, 0x00
72EB 0xFE5C0000, 0x00
73ED 0xFE400008, 0xBCC90159
74ED 0xFE40008C, 0x88800004
75ED 0xFE400094, 0x00000004
76ED 0xFE400028, 0xA55A0032
77ED 0xFE40002C, 0xA55A000C
78ED 0xFE400020, 0xA55A2048
79ED 0xFE400008, 0xBCC90959
80
81LIST "Change CPGA setting"
82ED 0xE61500E0, 0x9E40352E
83ED 0xE6150004, 0x80331050
84
85WAIT 1, 0xFE40009C
86
87ED 0xFE400354, 0x01AD8002
88
89LIST "SCIF0 - Serial port for earlyprintk"
90EB 0xE6053098, 0xe1
91EW 0xE6C40000, 0x0000
92EB 0xE6C40004, 0x19
93EW 0xE6C40008, 0x0030
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index b2074e2acb15..d241bfd6926d 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -16,4 +16,9 @@
16#define IRQPIN_BASE 2000 16#define IRQPIN_BASE 2000
17#define irq_pin(nr) ((nr) + IRQPIN_BASE) 17#define irq_pin(nr) ((nr) + IRQPIN_BASE)
18 18
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
19#endif /* __ASM_MACH_IRQS_H */ 24#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-shmobile/include/mach/memory.h b/arch/arm/mach-shmobile/include/mach/memory.h
deleted file mode 100644
index 0ffbe8155c76..000000000000
--- a/arch/arm/mach-shmobile/include/mach/memory.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_MACH_MEMORY_H
2#define __ASM_MACH_MEMORY_H
3
4#define PLAT_PHYS_OFFSET UL(CONFIG_MEMORY_START)
5#define MEM_SIZE UL(CONFIG_MEMORY_SIZE)
6
7#endif /* __ASM_MACH_MEMORY_H */
diff --git a/arch/arm/mach-shmobile/include/mach/mmc-ap4eb.h b/arch/arm/mach-shmobile/include/mach/mmc-ap4eb.h
deleted file mode 100644
index db59fdbda860..000000000000
--- a/arch/arm/mach-shmobile/include/mach/mmc-ap4eb.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef MMC_AP4EB_H
2#define MMC_AP4EB_H
3
4#define PORT185CR (void __iomem *)0xe60520b9
5#define PORT186CR (void __iomem *)0xe60520ba
6#define PORT187CR (void __iomem *)0xe60520bb
7#define PORT188CR (void __iomem *)0xe60520bc
8
9#define PORTR191_160DR (void __iomem *)0xe6056014
10
11static inline void mmc_init_progress(void)
12{
13 /* Initialise LEDS1-4
14 * registers: PORT185CR-PORT188CR (LED1-LED4 Control)
15 * value: 0x10 - enable output
16 */
17 __raw_writeb(0x10, PORT185CR);
18 __raw_writeb(0x10, PORT186CR);
19 __raw_writeb(0x10, PORT187CR);
20 __raw_writeb(0x10, PORT188CR);
21}
22
23static inline void mmc_update_progress(int n)
24{
25 __raw_writel((__raw_readl(PORTR191_160DR) & ~(0xf << 25)) |
26 (1 << (25 + n)), PORTR191_160DR);
27}
28
29#endif /* MMC_AP4EB_H */
diff --git a/arch/arm/mach-shmobile/include/mach/mmc.h b/arch/arm/mach-shmobile/include/mach/mmc.h
index 21a59db638bb..e979b8fc1da2 100644
--- a/arch/arm/mach-shmobile/include/mach/mmc.h
+++ b/arch/arm/mach-shmobile/include/mach/mmc.h
@@ -7,9 +7,7 @@
7 * 7 *
8 **************************************************/ 8 **************************************************/
9 9
10#ifdef CONFIG_MACH_AP4EVB 10#ifdef CONFIG_MACH_MACKEREL
11#include "mach/mmc-ap4eb.h"
12#elif defined(CONFIG_MACH_MACKEREL)
13#include "mach/mmc-mackerel.h" 11#include "mach/mmc-mackerel.h"
14#else 12#else
15#error "unsupported board." 13#error "unsupported board."
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7740.h b/arch/arm/mach-shmobile/include/mach/r8a7740.h
index abdc4d4efa28..b34d19b5ca5c 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7740.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7740.h
@@ -28,494 +28,6 @@
28#define MD_CK1 (1 << 1) 28#define MD_CK1 (1 << 1)
29#define MD_CK0 (1 << 0) 29#define MD_CK0 (1 << 0)
30 30
31/*
32 * Pin Function Controller:
33 * GPIO_FN_xx - GPIO used to select pin function
34 * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
35 */
36enum {
37 /* PORT */
38 GPIO_PORT0, GPIO_PORT1, GPIO_PORT2, GPIO_PORT3, GPIO_PORT4,
39 GPIO_PORT5, GPIO_PORT6, GPIO_PORT7, GPIO_PORT8, GPIO_PORT9,
40
41 GPIO_PORT10, GPIO_PORT11, GPIO_PORT12, GPIO_PORT13, GPIO_PORT14,
42 GPIO_PORT15, GPIO_PORT16, GPIO_PORT17, GPIO_PORT18, GPIO_PORT19,
43
44 GPIO_PORT20, GPIO_PORT21, GPIO_PORT22, GPIO_PORT23, GPIO_PORT24,
45 GPIO_PORT25, GPIO_PORT26, GPIO_PORT27, GPIO_PORT28, GPIO_PORT29,
46
47 GPIO_PORT30, GPIO_PORT31, GPIO_PORT32, GPIO_PORT33, GPIO_PORT34,
48 GPIO_PORT35, GPIO_PORT36, GPIO_PORT37, GPIO_PORT38, GPIO_PORT39,
49
50 GPIO_PORT40, GPIO_PORT41, GPIO_PORT42, GPIO_PORT43, GPIO_PORT44,
51 GPIO_PORT45, GPIO_PORT46, GPIO_PORT47, GPIO_PORT48, GPIO_PORT49,
52
53 GPIO_PORT50, GPIO_PORT51, GPIO_PORT52, GPIO_PORT53, GPIO_PORT54,
54 GPIO_PORT55, GPIO_PORT56, GPIO_PORT57, GPIO_PORT58, GPIO_PORT59,
55
56 GPIO_PORT60, GPIO_PORT61, GPIO_PORT62, GPIO_PORT63, GPIO_PORT64,
57 GPIO_PORT65, GPIO_PORT66, GPIO_PORT67, GPIO_PORT68, GPIO_PORT69,
58
59 GPIO_PORT70, GPIO_PORT71, GPIO_PORT72, GPIO_PORT73, GPIO_PORT74,
60 GPIO_PORT75, GPIO_PORT76, GPIO_PORT77, GPIO_PORT78, GPIO_PORT79,
61
62 GPIO_PORT80, GPIO_PORT81, GPIO_PORT82, GPIO_PORT83, GPIO_PORT84,
63 GPIO_PORT85, GPIO_PORT86, GPIO_PORT87, GPIO_PORT88, GPIO_PORT89,
64
65 GPIO_PORT90, GPIO_PORT91, GPIO_PORT92, GPIO_PORT93, GPIO_PORT94,
66 GPIO_PORT95, GPIO_PORT96, GPIO_PORT97, GPIO_PORT98, GPIO_PORT99,
67
68 GPIO_PORT100, GPIO_PORT101, GPIO_PORT102, GPIO_PORT103, GPIO_PORT104,
69 GPIO_PORT105, GPIO_PORT106, GPIO_PORT107, GPIO_PORT108, GPIO_PORT109,
70
71 GPIO_PORT110, GPIO_PORT111, GPIO_PORT112, GPIO_PORT113, GPIO_PORT114,
72 GPIO_PORT115, GPIO_PORT116, GPIO_PORT117, GPIO_PORT118, GPIO_PORT119,
73
74 GPIO_PORT120, GPIO_PORT121, GPIO_PORT122, GPIO_PORT123, GPIO_PORT124,
75 GPIO_PORT125, GPIO_PORT126, GPIO_PORT127, GPIO_PORT128, GPIO_PORT129,
76
77 GPIO_PORT130, GPIO_PORT131, GPIO_PORT132, GPIO_PORT133, GPIO_PORT134,
78 GPIO_PORT135, GPIO_PORT136, GPIO_PORT137, GPIO_PORT138, GPIO_PORT139,
79
80 GPIO_PORT140, GPIO_PORT141, GPIO_PORT142, GPIO_PORT143, GPIO_PORT144,
81 GPIO_PORT145, GPIO_PORT146, GPIO_PORT147, GPIO_PORT148, GPIO_PORT149,
82
83 GPIO_PORT150, GPIO_PORT151, GPIO_PORT152, GPIO_PORT153, GPIO_PORT154,
84 GPIO_PORT155, GPIO_PORT156, GPIO_PORT157, GPIO_PORT158, GPIO_PORT159,
85
86 GPIO_PORT160, GPIO_PORT161, GPIO_PORT162, GPIO_PORT163, GPIO_PORT164,
87 GPIO_PORT165, GPIO_PORT166, GPIO_PORT167, GPIO_PORT168, GPIO_PORT169,
88
89 GPIO_PORT170, GPIO_PORT171, GPIO_PORT172, GPIO_PORT173, GPIO_PORT174,
90 GPIO_PORT175, GPIO_PORT176, GPIO_PORT177, GPIO_PORT178, GPIO_PORT179,
91
92 GPIO_PORT180, GPIO_PORT181, GPIO_PORT182, GPIO_PORT183, GPIO_PORT184,
93 GPIO_PORT185, GPIO_PORT186, GPIO_PORT187, GPIO_PORT188, GPIO_PORT189,
94
95 GPIO_PORT190, GPIO_PORT191, GPIO_PORT192, GPIO_PORT193, GPIO_PORT194,
96 GPIO_PORT195, GPIO_PORT196, GPIO_PORT197, GPIO_PORT198, GPIO_PORT199,
97
98 GPIO_PORT200, GPIO_PORT201, GPIO_PORT202, GPIO_PORT203, GPIO_PORT204,
99 GPIO_PORT205, GPIO_PORT206, GPIO_PORT207, GPIO_PORT208, GPIO_PORT209,
100
101 GPIO_PORT210, GPIO_PORT211,
102
103 /* IRQ */
104 GPIO_FN_IRQ0_PORT2, GPIO_FN_IRQ0_PORT13,
105 GPIO_FN_IRQ1,
106 GPIO_FN_IRQ2_PORT11, GPIO_FN_IRQ2_PORT12,
107 GPIO_FN_IRQ3_PORT10, GPIO_FN_IRQ3_PORT14,
108 GPIO_FN_IRQ4_PORT15, GPIO_FN_IRQ4_PORT172,
109 GPIO_FN_IRQ5_PORT0, GPIO_FN_IRQ5_PORT1,
110 GPIO_FN_IRQ6_PORT121, GPIO_FN_IRQ6_PORT173,
111 GPIO_FN_IRQ7_PORT120, GPIO_FN_IRQ7_PORT209,
112 GPIO_FN_IRQ8,
113 GPIO_FN_IRQ9_PORT118, GPIO_FN_IRQ9_PORT210,
114 GPIO_FN_IRQ10,
115 GPIO_FN_IRQ11,
116 GPIO_FN_IRQ12_PORT42, GPIO_FN_IRQ12_PORT97,
117 GPIO_FN_IRQ13_PORT64, GPIO_FN_IRQ13_PORT98,
118 GPIO_FN_IRQ14_PORT63, GPIO_FN_IRQ14_PORT99,
119 GPIO_FN_IRQ15_PORT62, GPIO_FN_IRQ15_PORT100,
120 GPIO_FN_IRQ16_PORT68, GPIO_FN_IRQ16_PORT211,
121 GPIO_FN_IRQ17,
122 GPIO_FN_IRQ18,
123 GPIO_FN_IRQ19,
124 GPIO_FN_IRQ20,
125 GPIO_FN_IRQ21,
126 GPIO_FN_IRQ22,
127 GPIO_FN_IRQ23,
128 GPIO_FN_IRQ24,
129 GPIO_FN_IRQ25,
130 GPIO_FN_IRQ26_PORT58, GPIO_FN_IRQ26_PORT81,
131 GPIO_FN_IRQ27_PORT57, GPIO_FN_IRQ27_PORT168,
132 GPIO_FN_IRQ28_PORT56, GPIO_FN_IRQ28_PORT169,
133 GPIO_FN_IRQ29_PORT50, GPIO_FN_IRQ29_PORT170,
134 GPIO_FN_IRQ30_PORT49, GPIO_FN_IRQ30_PORT171,
135 GPIO_FN_IRQ31_PORT41, GPIO_FN_IRQ31_PORT167,
136
137 /* Function */
138
139 /* DBGT */
140 GPIO_FN_DBGMDT2, GPIO_FN_DBGMDT1, GPIO_FN_DBGMDT0,
141 GPIO_FN_DBGMD10, GPIO_FN_DBGMD11, GPIO_FN_DBGMD20,
142 GPIO_FN_DBGMD21,
143
144 /* FSI-A */
145 GPIO_FN_FSIAISLD_PORT0, /* FSIAISLD Port 0/5 */
146 GPIO_FN_FSIAISLD_PORT5,
147 GPIO_FN_FSIASPDIF_PORT9, /* FSIASPDIF Port 9/18 */
148 GPIO_FN_FSIASPDIF_PORT18,
149 GPIO_FN_FSIAOSLD1, GPIO_FN_FSIAOSLD2,
150 GPIO_FN_FSIAOLR, GPIO_FN_FSIAOBT,
151 GPIO_FN_FSIAOSLD, GPIO_FN_FSIAOMC,
152 GPIO_FN_FSIACK, GPIO_FN_FSIAILR,
153 GPIO_FN_FSIAIBT,
154
155 /* FSI-B */
156 GPIO_FN_FSIBCK,
157
158 /* FMSI */
159 GPIO_FN_FMSISLD_PORT1, /* FMSISLD Port 1/6 */
160 GPIO_FN_FMSISLD_PORT6,
161 GPIO_FN_FMSIILR, GPIO_FN_FMSIIBT,
162 GPIO_FN_FMSIOLR, GPIO_FN_FMSIOBT,
163 GPIO_FN_FMSICK, GPIO_FN_FMSOILR,
164 GPIO_FN_FMSOIBT, GPIO_FN_FMSOOLR,
165 GPIO_FN_FMSOOBT, GPIO_FN_FMSOSLD,
166 GPIO_FN_FMSOCK,
167
168 /* SCIFA0 */
169 GPIO_FN_SCIFA0_SCK, GPIO_FN_SCIFA0_CTS,
170 GPIO_FN_SCIFA0_RTS, GPIO_FN_SCIFA0_RXD,
171 GPIO_FN_SCIFA0_TXD,
172
173 /* SCIFA1 */
174 GPIO_FN_SCIFA1_CTS, GPIO_FN_SCIFA1_SCK,
175 GPIO_FN_SCIFA1_RXD, GPIO_FN_SCIFA1_TXD,
176 GPIO_FN_SCIFA1_RTS,
177
178 /* SCIFA2 */
179 GPIO_FN_SCIFA2_SCK_PORT22, /* SCIFA2_SCK Port 22/199 */
180 GPIO_FN_SCIFA2_SCK_PORT199,
181 GPIO_FN_SCIFA2_RXD, GPIO_FN_SCIFA2_TXD,
182 GPIO_FN_SCIFA2_CTS, GPIO_FN_SCIFA2_RTS,
183
184 /* SCIFA3 */
185 GPIO_FN_SCIFA3_RTS_PORT105, /* MSEL5CR_8_0 */
186 GPIO_FN_SCIFA3_SCK_PORT116,
187 GPIO_FN_SCIFA3_CTS_PORT117,
188 GPIO_FN_SCIFA3_RXD_PORT174,
189 GPIO_FN_SCIFA3_TXD_PORT175,
190
191 GPIO_FN_SCIFA3_RTS_PORT161, /* MSEL5CR_8_1 */
192 GPIO_FN_SCIFA3_SCK_PORT158,
193 GPIO_FN_SCIFA3_CTS_PORT162,
194 GPIO_FN_SCIFA3_RXD_PORT159,
195 GPIO_FN_SCIFA3_TXD_PORT160,
196
197 /* SCIFA4 */
198 GPIO_FN_SCIFA4_RXD_PORT12, /* MSEL5CR[12:11] = 00 */
199 GPIO_FN_SCIFA4_TXD_PORT13,
200
201 GPIO_FN_SCIFA4_RXD_PORT204, /* MSEL5CR[12:11] = 01 */
202 GPIO_FN_SCIFA4_TXD_PORT203,
203
204 GPIO_FN_SCIFA4_RXD_PORT94, /* MSEL5CR[12:11] = 10 */
205 GPIO_FN_SCIFA4_TXD_PORT93,
206
207 GPIO_FN_SCIFA4_SCK_PORT21, /* SCIFA4_SCK Port 21/205 */
208 GPIO_FN_SCIFA4_SCK_PORT205,
209
210 /* SCIFA5 */
211 GPIO_FN_SCIFA5_TXD_PORT20, /* MSEL5CR[15:14] = 00 */
212 GPIO_FN_SCIFA5_RXD_PORT10,
213
214 GPIO_FN_SCIFA5_RXD_PORT207, /* MSEL5CR[15:14] = 01 */
215 GPIO_FN_SCIFA5_TXD_PORT208,
216
217 GPIO_FN_SCIFA5_TXD_PORT91, /* MSEL5CR[15:14] = 10 */
218 GPIO_FN_SCIFA5_RXD_PORT92,
219
220 GPIO_FN_SCIFA5_SCK_PORT23, /* SCIFA5_SCK Port 23/206 */
221 GPIO_FN_SCIFA5_SCK_PORT206,
222
223 /* SCIFA6 */
224 GPIO_FN_SCIFA6_SCK, GPIO_FN_SCIFA6_RXD, GPIO_FN_SCIFA6_TXD,
225
226 /* SCIFA7 */
227 GPIO_FN_SCIFA7_TXD, GPIO_FN_SCIFA7_RXD,
228
229 /* SCIFAB */
230 GPIO_FN_SCIFB_SCK_PORT190, /* MSEL5CR_17_0 */
231 GPIO_FN_SCIFB_RXD_PORT191,
232 GPIO_FN_SCIFB_TXD_PORT192,
233 GPIO_FN_SCIFB_RTS_PORT186,
234 GPIO_FN_SCIFB_CTS_PORT187,
235
236 GPIO_FN_SCIFB_SCK_PORT2, /* MSEL5CR_17_1 */
237 GPIO_FN_SCIFB_RXD_PORT3,
238 GPIO_FN_SCIFB_TXD_PORT4,
239 GPIO_FN_SCIFB_RTS_PORT172,
240 GPIO_FN_SCIFB_CTS_PORT173,
241
242 /* LCD0 */
243 GPIO_FN_LCDC0_SELECT,
244
245 /* LCD1 */
246 GPIO_FN_LCDC1_SELECT,
247
248 /* RSPI */
249 GPIO_FN_RSPI_SSL0_A, GPIO_FN_RSPI_SSL1_A,
250 GPIO_FN_RSPI_SSL2_A, GPIO_FN_RSPI_SSL3_A,
251 GPIO_FN_RSPI_MOSI_A, GPIO_FN_RSPI_MISO_A,
252 GPIO_FN_RSPI_CK_A,
253
254 /* VIO CKO */
255 GPIO_FN_VIO_CKO1,
256 GPIO_FN_VIO_CKO2,
257 GPIO_FN_VIO_CKO_1,
258 GPIO_FN_VIO_CKO,
259
260 /* VIO0 */
261 GPIO_FN_VIO0_D0, GPIO_FN_VIO0_D1, GPIO_FN_VIO0_D2,
262 GPIO_FN_VIO0_D3, GPIO_FN_VIO0_D4, GPIO_FN_VIO0_D5,
263 GPIO_FN_VIO0_D6, GPIO_FN_VIO0_D7, GPIO_FN_VIO0_D8,
264 GPIO_FN_VIO0_D9, GPIO_FN_VIO0_D10, GPIO_FN_VIO0_D11,
265 GPIO_FN_VIO0_D12, GPIO_FN_VIO0_VD, GPIO_FN_VIO0_HD,
266 GPIO_FN_VIO0_CLK, GPIO_FN_VIO0_FIELD,
267
268 GPIO_FN_VIO0_D13_PORT26, /* MSEL5CR_27_0 */
269 GPIO_FN_VIO0_D14_PORT25,
270 GPIO_FN_VIO0_D15_PORT24,
271
272 GPIO_FN_VIO0_D13_PORT22, /* MSEL5CR_27_1 */
273 GPIO_FN_VIO0_D14_PORT95,
274 GPIO_FN_VIO0_D15_PORT96,
275
276 /* VIO1 */
277 GPIO_FN_VIO1_D0, GPIO_FN_VIO1_D1, GPIO_FN_VIO1_D2,
278 GPIO_FN_VIO1_D3, GPIO_FN_VIO1_D4, GPIO_FN_VIO1_D5,
279 GPIO_FN_VIO1_D6, GPIO_FN_VIO1_D7, GPIO_FN_VIO1_VD,
280 GPIO_FN_VIO1_HD, GPIO_FN_VIO1_CLK, GPIO_FN_VIO1_FIELD,
281
282 /* TPU0 */
283 GPIO_FN_TPU0TO0, GPIO_FN_TPU0TO1,
284 GPIO_FN_TPU0TO3,
285 GPIO_FN_TPU0TO2_PORT66, /* TPU0TO2 Port 66/202 */
286 GPIO_FN_TPU0TO2_PORT202,
287
288 /* SSP1 0 */
289 GPIO_FN_STP0_IPD0, GPIO_FN_STP0_IPD1, GPIO_FN_STP0_IPD2,
290 GPIO_FN_STP0_IPD3, GPIO_FN_STP0_IPD4, GPIO_FN_STP0_IPD5,
291 GPIO_FN_STP0_IPD6, GPIO_FN_STP0_IPD7, GPIO_FN_STP0_IPEN,
292 GPIO_FN_STP0_IPCLK, GPIO_FN_STP0_IPSYNC,
293
294 /* SSP1 1 */
295 GPIO_FN_STP1_IPD1, GPIO_FN_STP1_IPD2, GPIO_FN_STP1_IPD3,
296 GPIO_FN_STP1_IPD4, GPIO_FN_STP1_IPD5, GPIO_FN_STP1_IPD6,
297 GPIO_FN_STP1_IPD7, GPIO_FN_STP1_IPCLK, GPIO_FN_STP1_IPSYNC,
298
299 GPIO_FN_STP1_IPD0_PORT186, /* MSEL5CR_23_0 */
300 GPIO_FN_STP1_IPEN_PORT187,
301
302 GPIO_FN_STP1_IPD0_PORT194, /* MSEL5CR_23_1 */
303 GPIO_FN_STP1_IPEN_PORT193,
304
305 /* SIM */
306 GPIO_FN_SIM_RST, GPIO_FN_SIM_CLK,
307 GPIO_FN_SIM_D_PORT22, /* SIM_D Port 22/199 */
308 GPIO_FN_SIM_D_PORT199,
309
310 /* MSIOF2 */
311 GPIO_FN_MSIOF2_TXD, GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TSCK,
312 GPIO_FN_MSIOF2_SS2, GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_SS1,
313 GPIO_FN_MSIOF2_MCK1, GPIO_FN_MSIOF2_MCK0, GPIO_FN_MSIOF2_RSYNC,
314 GPIO_FN_MSIOF2_RSCK,
315
316 /* KEYSC */
317 GPIO_FN_KEYIN4, GPIO_FN_KEYIN5,
318 GPIO_FN_KEYIN6, GPIO_FN_KEYIN7,
319 GPIO_FN_KEYOUT0, GPIO_FN_KEYOUT1, GPIO_FN_KEYOUT2,
320 GPIO_FN_KEYOUT3, GPIO_FN_KEYOUT4, GPIO_FN_KEYOUT5,
321 GPIO_FN_KEYOUT6, GPIO_FN_KEYOUT7,
322
323 GPIO_FN_KEYIN0_PORT43, /* MSEL4CR_18_0 */
324 GPIO_FN_KEYIN1_PORT44,
325 GPIO_FN_KEYIN2_PORT45,
326 GPIO_FN_KEYIN3_PORT46,
327
328 GPIO_FN_KEYIN0_PORT58, /* MSEL4CR_18_1 */
329 GPIO_FN_KEYIN1_PORT57,
330 GPIO_FN_KEYIN2_PORT56,
331 GPIO_FN_KEYIN3_PORT55,
332
333 /* VOU */
334 GPIO_FN_DV_D0, GPIO_FN_DV_D1, GPIO_FN_DV_D2, GPIO_FN_DV_D3,
335 GPIO_FN_DV_D4, GPIO_FN_DV_D5, GPIO_FN_DV_D6, GPIO_FN_DV_D7,
336 GPIO_FN_DV_D8, GPIO_FN_DV_D9, GPIO_FN_DV_D10, GPIO_FN_DV_D11,
337 GPIO_FN_DV_D12, GPIO_FN_DV_D13, GPIO_FN_DV_D14, GPIO_FN_DV_D15,
338 GPIO_FN_DV_CLK,
339 GPIO_FN_DV_VSYNC,
340 GPIO_FN_DV_HSYNC,
341
342 /* MEMC */
343 GPIO_FN_MEMC_AD0, GPIO_FN_MEMC_AD1, GPIO_FN_MEMC_AD2,
344 GPIO_FN_MEMC_AD3, GPIO_FN_MEMC_AD4, GPIO_FN_MEMC_AD5,
345 GPIO_FN_MEMC_AD6, GPIO_FN_MEMC_AD7, GPIO_FN_MEMC_AD8,
346 GPIO_FN_MEMC_AD9, GPIO_FN_MEMC_AD10, GPIO_FN_MEMC_AD11,
347 GPIO_FN_MEMC_AD12, GPIO_FN_MEMC_AD13, GPIO_FN_MEMC_AD14,
348 GPIO_FN_MEMC_AD15, GPIO_FN_MEMC_CS0, GPIO_FN_MEMC_INT,
349 GPIO_FN_MEMC_NWE, GPIO_FN_MEMC_NOE,
350
351 GPIO_FN_MEMC_CS1, /* MSEL4CR_6_0 */
352 GPIO_FN_MEMC_ADV,
353 GPIO_FN_MEMC_WAIT,
354 GPIO_FN_MEMC_BUSCLK,
355
356 GPIO_FN_MEMC_A1, /* MSEL4CR_6_1 */
357 GPIO_FN_MEMC_DREQ0,
358 GPIO_FN_MEMC_DREQ1,
359 GPIO_FN_MEMC_A0,
360
361 /* MSIOF0 */
362 GPIO_FN_MSIOF0_SS1, GPIO_FN_MSIOF0_SS2,
363 GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_TXD,
364 GPIO_FN_MSIOF0_MCK0, GPIO_FN_MSIOF0_MCK1,
365 GPIO_FN_MSIOF0_RSYNC, GPIO_FN_MSIOF0_RSCK,
366 GPIO_FN_MSIOF0_TSCK, GPIO_FN_MSIOF0_TSYNC,
367
368 /* MSIOF1 */
369 GPIO_FN_MSIOF1_RSCK, GPIO_FN_MSIOF1_RSYNC,
370 GPIO_FN_MSIOF1_MCK0, GPIO_FN_MSIOF1_MCK1,
371
372 GPIO_FN_MSIOF1_SS2_PORT116, GPIO_FN_MSIOF1_SS1_PORT117,
373 GPIO_FN_MSIOF1_RXD_PORT118, GPIO_FN_MSIOF1_TXD_PORT119,
374 GPIO_FN_MSIOF1_TSYNC_PORT120,
375 GPIO_FN_MSIOF1_TSCK_PORT121, /* MSEL4CR_10_0 */
376
377 GPIO_FN_MSIOF1_SS1_PORT67, GPIO_FN_MSIOF1_TSCK_PORT72,
378 GPIO_FN_MSIOF1_TSYNC_PORT73, GPIO_FN_MSIOF1_TXD_PORT74,
379 GPIO_FN_MSIOF1_RXD_PORT75,
380 GPIO_FN_MSIOF1_SS2_PORT202, /* MSEL4CR_10_1 */
381
382 /* GPIO */
383 GPIO_FN_GPO0, GPIO_FN_GPI0,
384 GPIO_FN_GPO1, GPIO_FN_GPI1,
385
386 /* USB0 */
387 GPIO_FN_USB0_OCI, GPIO_FN_USB0_PPON, GPIO_FN_VBUS,
388
389 /* USB1 */
390 GPIO_FN_USB1_OCI, GPIO_FN_USB1_PPON,
391
392 /* BBIF1 */
393 GPIO_FN_BBIF1_RXD, GPIO_FN_BBIF1_TXD, GPIO_FN_BBIF1_TSYNC,
394 GPIO_FN_BBIF1_TSCK, GPIO_FN_BBIF1_RSCK, GPIO_FN_BBIF1_RSYNC,
395 GPIO_FN_BBIF1_FLOW, GPIO_FN_BBIF1_RX_FLOW_N,
396
397 /* BBIF2 */
398 GPIO_FN_BBIF2_TXD2_PORT5, /* MSEL5CR_0_0 */
399 GPIO_FN_BBIF2_RXD2_PORT60,
400 GPIO_FN_BBIF2_TSYNC2_PORT6,
401 GPIO_FN_BBIF2_TSCK2_PORT59,
402
403 GPIO_FN_BBIF2_RXD2_PORT90, /* MSEL5CR_0_1 */
404 GPIO_FN_BBIF2_TXD2_PORT183,
405 GPIO_FN_BBIF2_TSCK2_PORT89,
406 GPIO_FN_BBIF2_TSYNC2_PORT184,
407
408 /* BSC / FLCTL / PCMCIA */
409 GPIO_FN_CS0, GPIO_FN_CS2, GPIO_FN_CS4,
410 GPIO_FN_CS5B, GPIO_FN_CS6A,
411 GPIO_FN_CS5A_PORT105, /* CS5A PORT 19/105 */
412 GPIO_FN_CS5A_PORT19,
413 GPIO_FN_IOIS16, /* ? */
414
415 GPIO_FN_A0, GPIO_FN_A1, GPIO_FN_A2, GPIO_FN_A3,
416 GPIO_FN_A4_FOE, /* share with FLCTL */
417 GPIO_FN_A5_FCDE, /* share with FLCTL */
418 GPIO_FN_A6, GPIO_FN_A7, GPIO_FN_A8, GPIO_FN_A9,
419 GPIO_FN_A10, GPIO_FN_A11, GPIO_FN_A12, GPIO_FN_A13,
420 GPIO_FN_A14, GPIO_FN_A15, GPIO_FN_A16, GPIO_FN_A17,
421 GPIO_FN_A18, GPIO_FN_A19, GPIO_FN_A20, GPIO_FN_A21,
422 GPIO_FN_A22, GPIO_FN_A23, GPIO_FN_A24, GPIO_FN_A25,
423 GPIO_FN_A26,
424
425 GPIO_FN_D0_NAF0, GPIO_FN_D1_NAF1, /* share with FLCTL */
426 GPIO_FN_D2_NAF2, GPIO_FN_D3_NAF3, /* share with FLCTL */
427 GPIO_FN_D4_NAF4, GPIO_FN_D5_NAF5, /* share with FLCTL */
428 GPIO_FN_D6_NAF6, GPIO_FN_D7_NAF7, /* share with FLCTL */
429 GPIO_FN_D8_NAF8, GPIO_FN_D9_NAF9, /* share with FLCTL */
430 GPIO_FN_D10_NAF10, GPIO_FN_D11_NAF11, /* share with FLCTL */
431 GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, /* share with FLCTL */
432 GPIO_FN_D14_NAF14, GPIO_FN_D15_NAF15, /* share with FLCTL */
433
434 GPIO_FN_D16, GPIO_FN_D17, GPIO_FN_D18, GPIO_FN_D19,
435 GPIO_FN_D20, GPIO_FN_D21, GPIO_FN_D22, GPIO_FN_D23,
436 GPIO_FN_D24, GPIO_FN_D25, GPIO_FN_D26, GPIO_FN_D27,
437 GPIO_FN_D28, GPIO_FN_D29, GPIO_FN_D30, GPIO_FN_D31,
438
439 GPIO_FN_WE0_FWE, /* share with FLCTL */
440 GPIO_FN_WE1,
441 GPIO_FN_WE2_ICIORD, /* share with PCMCIA */
442 GPIO_FN_WE3_ICIOWR, /* share with PCMCIA */
443 GPIO_FN_CKO, GPIO_FN_BS, GPIO_FN_RDWR,
444 GPIO_FN_RD_FSC, /* share with FLCTL */
445 GPIO_FN_WAIT_PORT177, /* WAIT Port 90/177 */
446 GPIO_FN_WAIT_PORT90,
447
448 GPIO_FN_FCE0, GPIO_FN_FCE1, GPIO_FN_FRB, /* FLCTL */
449
450 /* IRDA */
451 GPIO_FN_IRDA_FIRSEL, GPIO_FN_IRDA_IN, GPIO_FN_IRDA_OUT,
452
453 /* ATAPI */
454 GPIO_FN_IDE_D0, GPIO_FN_IDE_D1, GPIO_FN_IDE_D2,
455 GPIO_FN_IDE_D3, GPIO_FN_IDE_D4, GPIO_FN_IDE_D5,
456 GPIO_FN_IDE_D6, GPIO_FN_IDE_D7, GPIO_FN_IDE_D8,
457 GPIO_FN_IDE_D9, GPIO_FN_IDE_D10, GPIO_FN_IDE_D11,
458 GPIO_FN_IDE_D12, GPIO_FN_IDE_D13, GPIO_FN_IDE_D14,
459 GPIO_FN_IDE_D15, GPIO_FN_IDE_A0, GPIO_FN_IDE_A1,
460 GPIO_FN_IDE_A2, GPIO_FN_IDE_CS0, GPIO_FN_IDE_CS1,
461 GPIO_FN_IDE_IOWR, GPIO_FN_IDE_IORD, GPIO_FN_IDE_IORDY,
462 GPIO_FN_IDE_INT, GPIO_FN_IDE_RST, GPIO_FN_IDE_DIRECTION,
463 GPIO_FN_IDE_EXBUF_ENB, GPIO_FN_IDE_IODACK, GPIO_FN_IDE_IODREQ,
464
465 /* RMII */
466 GPIO_FN_RMII_CRS_DV, GPIO_FN_RMII_RX_ER, GPIO_FN_RMII_RXD0,
467 GPIO_FN_RMII_RXD1, GPIO_FN_RMII_TX_EN, GPIO_FN_RMII_TXD0,
468 GPIO_FN_RMII_MDC, GPIO_FN_RMII_TXD1, GPIO_FN_RMII_MDIO,
469 GPIO_FN_RMII_REF50CK, /* for RMII */
470 GPIO_FN_RMII_REF125CK, /* for GMII */
471
472 /* GEther */
473 GPIO_FN_ET_TX_CLK, GPIO_FN_ET_TX_EN, GPIO_FN_ET_ETXD0,
474 GPIO_FN_ET_ETXD1, GPIO_FN_ET_ETXD2, GPIO_FN_ET_ETXD3,
475 GPIO_FN_ET_ETXD4, GPIO_FN_ET_ETXD5, /* for GEther */
476 GPIO_FN_ET_ETXD6, GPIO_FN_ET_ETXD7, /* for GEther */
477 GPIO_FN_ET_COL, GPIO_FN_ET_TX_ER,
478 GPIO_FN_ET_RX_CLK, GPIO_FN_ET_RX_DV,
479 GPIO_FN_ET_ERXD0, GPIO_FN_ET_ERXD1,
480 GPIO_FN_ET_ERXD2, GPIO_FN_ET_ERXD3,
481 GPIO_FN_ET_ERXD4, GPIO_FN_ET_ERXD5, /* for GEther */
482 GPIO_FN_ET_ERXD6, GPIO_FN_ET_ERXD7, /* for GEther */
483 GPIO_FN_ET_RX_ER, GPIO_FN_ET_CRS,
484 GPIO_FN_ET_MDC, GPIO_FN_ET_MDIO,
485 GPIO_FN_ET_LINK, GPIO_FN_ET_PHY_INT,
486 GPIO_FN_ET_WOL, GPIO_FN_ET_GTX_CLK,
487
488 /* DMA0 */
489 GPIO_FN_DREQ0, GPIO_FN_DACK0,
490
491 /* DMA1 */
492 GPIO_FN_DREQ1, GPIO_FN_DACK1,
493
494 /* SYSC */
495 GPIO_FN_RESETOUTS,
496 GPIO_FN_RESETP_PULLUP,
497 GPIO_FN_RESETP_PLAIN,
498
499 /* HDMI */
500 GPIO_FN_HDMI_HPD,
501 GPIO_FN_HDMI_CEC,
502
503 /* SDENC */
504 GPIO_FN_SDENC_CPG,
505 GPIO_FN_SDENC_DV_CLKI,
506
507 /* IRREM */
508 GPIO_FN_IROUT,
509
510 /* DEBUG */
511 GPIO_FN_EDEBGREQ_PULLDOWN,
512 GPIO_FN_EDEBGREQ_PULLUP,
513
514 GPIO_FN_TRACEAUD_FROM_VIO,
515 GPIO_FN_TRACEAUD_FROM_LCDC0,
516 GPIO_FN_TRACEAUD_FROM_MEMC,
517};
518
519/* DMA slave IDs */ 31/* DMA slave IDs */
520enum { 32enum {
521 SHDMA_SLAVE_INVALID, 33 SHDMA_SLAVE_INVALID,
@@ -533,10 +45,13 @@ enum {
533}; 45};
534 46
535extern void r8a7740_meram_workaround(void); 47extern void r8a7740_meram_workaround(void);
48extern void r8a7740_init_delay(void);
536extern void r8a7740_init_irq(void); 49extern void r8a7740_init_irq(void);
50extern void r8a7740_init_irq_of(void);
537extern void r8a7740_map_io(void); 51extern void r8a7740_map_io(void);
538extern void r8a7740_add_early_devices(void); 52extern void r8a7740_add_early_devices(void);
539extern void r8a7740_add_standard_devices(void); 53extern void r8a7740_add_standard_devices(void);
54extern void r8a7740_add_standard_devices_dt(void);
540extern void r8a7740_clock_init(u8 md_ck); 55extern void r8a7740_clock_init(u8 md_ck);
541extern void r8a7740_pinmux_init(void); 56extern void r8a7740_pinmux_init(void);
542extern void r8a7740_pm_init(void); 57extern void r8a7740_pm_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
index 951149e6bcca..851d027a2f06 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -18,15 +18,26 @@
18#ifndef __ASM_R8A7778_H__ 18#ifndef __ASM_R8A7778_H__
19#define __ASM_R8A7778_H__ 19#define __ASM_R8A7778_H__
20 20
21#include <linux/mmc/sh_mmcif.h>
22#include <linux/mmc/sh_mobile_sdhi.h>
21#include <linux/sh_eth.h> 23#include <linux/sh_eth.h>
24#include <linux/platform_data/usb-rcar-phy.h>
22 25
23extern void r8a7778_add_standard_devices(void); 26extern void r8a7778_add_standard_devices(void);
24extern void r8a7778_add_standard_devices_dt(void); 27extern void r8a7778_add_standard_devices_dt(void);
25extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata); 28extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata);
29extern void r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata);
30extern void r8a7778_add_i2c_device(int id);
31extern void r8a7778_add_hspi_device(int id);
32extern void r8a7778_add_mmc_device(struct sh_mmcif_plat_data *info);
33
34extern void r8a7778_init_late(void);
26extern void r8a7778_init_delay(void); 35extern void r8a7778_init_delay(void);
27extern void r8a7778_init_irq(void); 36extern void r8a7778_init_irq(void);
28extern void r8a7778_init_irq_dt(void); 37extern void r8a7778_init_irq_dt(void);
29extern void r8a7778_clock_init(void); 38extern void r8a7778_clock_init(void);
30extern void r8a7778_init_irq_extpin(int irlm); 39extern void r8a7778_init_irq_extpin(int irlm);
40extern void r8a7778_pinmux_init(void);
41extern void r8a7778_sdhi_init(int id, struct sh_mobile_sdhi_info *info);
31 42
32#endif /* __ASM_R8A7778_H__ */ 43#endif /* __ASM_R8A7778_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 188b295938a5..fc47073c7ba9 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -4,6 +4,7 @@
4#include <linux/sh_clk.h> 4#include <linux/sh_clk.h>
5#include <linux/pm_domain.h> 5#include <linux/pm_domain.h>
6#include <linux/sh_eth.h> 6#include <linux/sh_eth.h>
7#include <linux/platform_data/usb-rcar-phy.h>
7 8
8struct platform_device; 9struct platform_device;
9 10
@@ -33,6 +34,8 @@ extern void r8a7779_add_early_devices(void);
33extern void r8a7779_add_standard_devices(void); 34extern void r8a7779_add_standard_devices(void);
34extern void r8a7779_add_standard_devices_dt(void); 35extern void r8a7779_add_standard_devices_dt(void);
35extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); 36extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata);
37extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata);
38extern void r8a7779_init_late(void);
36extern void r8a7779_clock_init(void); 39extern void r8a7779_clock_init(void);
37extern void r8a7779_pinmux_init(void); 40extern void r8a7779_pinmux_init(void);
38extern void r8a7779_pm_init(void); 41extern void r8a7779_pm_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index fd7cba024c39..854a9f0ca040 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -15,397 +15,6 @@
15#include <linux/pm_domain.h> 15#include <linux/pm_domain.h>
16#include <mach/pm-rmobile.h> 16#include <mach/pm-rmobile.h>
17 17
18/*
19 * Pin Function Controller:
20 * GPIO_FN_xx - GPIO used to select pin function
21 * GPIO_PORTxx - GPIO mapped to real I/O pin on CPU
22 */
23enum {
24 /* PORT */
25 GPIO_PORT0, GPIO_PORT1, GPIO_PORT2, GPIO_PORT3, GPIO_PORT4,
26 GPIO_PORT5, GPIO_PORT6, GPIO_PORT7, GPIO_PORT8, GPIO_PORT9,
27
28 GPIO_PORT10, GPIO_PORT11, GPIO_PORT12, GPIO_PORT13, GPIO_PORT14,
29 GPIO_PORT15, GPIO_PORT16, GPIO_PORT17, GPIO_PORT18, GPIO_PORT19,
30
31 GPIO_PORT20, GPIO_PORT21, GPIO_PORT22, GPIO_PORT23, GPIO_PORT24,
32 GPIO_PORT25, GPIO_PORT26, GPIO_PORT27, GPIO_PORT28, GPIO_PORT29,
33
34 GPIO_PORT30, GPIO_PORT31, GPIO_PORT32, GPIO_PORT33, GPIO_PORT34,
35 GPIO_PORT35, GPIO_PORT36, GPIO_PORT37, GPIO_PORT38, GPIO_PORT39,
36
37 GPIO_PORT40, GPIO_PORT41, GPIO_PORT42, GPIO_PORT43, GPIO_PORT44,
38 GPIO_PORT45, GPIO_PORT46, GPIO_PORT47, GPIO_PORT48, GPIO_PORT49,
39
40 GPIO_PORT50, GPIO_PORT51, GPIO_PORT52, GPIO_PORT53, GPIO_PORT54,
41 GPIO_PORT55, GPIO_PORT56, GPIO_PORT57, GPIO_PORT58, GPIO_PORT59,
42
43 GPIO_PORT60, GPIO_PORT61, GPIO_PORT62, GPIO_PORT63, GPIO_PORT64,
44 GPIO_PORT65, GPIO_PORT66, GPIO_PORT67, GPIO_PORT68, GPIO_PORT69,
45
46 GPIO_PORT70, GPIO_PORT71, GPIO_PORT72, GPIO_PORT73, GPIO_PORT74,
47 GPIO_PORT75, GPIO_PORT76, GPIO_PORT77, GPIO_PORT78, GPIO_PORT79,
48
49 GPIO_PORT80, GPIO_PORT81, GPIO_PORT82, GPIO_PORT83, GPIO_PORT84,
50 GPIO_PORT85, GPIO_PORT86, GPIO_PORT87, GPIO_PORT88, GPIO_PORT89,
51
52 GPIO_PORT90, GPIO_PORT91, GPIO_PORT92, GPIO_PORT93, GPIO_PORT94,
53 GPIO_PORT95, GPIO_PORT96, GPIO_PORT97, GPIO_PORT98, GPIO_PORT99,
54
55 GPIO_PORT100, GPIO_PORT101, GPIO_PORT102, GPIO_PORT103, GPIO_PORT104,
56 GPIO_PORT105, GPIO_PORT106, GPIO_PORT107, GPIO_PORT108, GPIO_PORT109,
57
58 GPIO_PORT110, GPIO_PORT111, GPIO_PORT112, GPIO_PORT113, GPIO_PORT114,
59 GPIO_PORT115, GPIO_PORT116, GPIO_PORT117, GPIO_PORT118, GPIO_PORT119,
60
61 GPIO_PORT120, GPIO_PORT121, GPIO_PORT122, GPIO_PORT123, GPIO_PORT124,
62 GPIO_PORT125, GPIO_PORT126, GPIO_PORT127, GPIO_PORT128, GPIO_PORT129,
63
64 GPIO_PORT130, GPIO_PORT131, GPIO_PORT132, GPIO_PORT133, GPIO_PORT134,
65 GPIO_PORT135, GPIO_PORT136, GPIO_PORT137, GPIO_PORT138, GPIO_PORT139,
66
67 GPIO_PORT140, GPIO_PORT141, GPIO_PORT142, GPIO_PORT143, GPIO_PORT144,
68 GPIO_PORT145, GPIO_PORT146, GPIO_PORT147, GPIO_PORT148, GPIO_PORT149,
69
70 GPIO_PORT150, GPIO_PORT151, GPIO_PORT152, GPIO_PORT153, GPIO_PORT154,
71 GPIO_PORT155, GPIO_PORT156, GPIO_PORT157, GPIO_PORT158, GPIO_PORT159,
72
73 GPIO_PORT160, GPIO_PORT161, GPIO_PORT162, GPIO_PORT163, GPIO_PORT164,
74 GPIO_PORT165, GPIO_PORT166, GPIO_PORT167, GPIO_PORT168, GPIO_PORT169,
75
76 GPIO_PORT170, GPIO_PORT171, GPIO_PORT172, GPIO_PORT173, GPIO_PORT174,
77 GPIO_PORT175, GPIO_PORT176, GPIO_PORT177, GPIO_PORT178, GPIO_PORT179,
78
79 GPIO_PORT180, GPIO_PORT181, GPIO_PORT182, GPIO_PORT183, GPIO_PORT184,
80 GPIO_PORT185, GPIO_PORT186, GPIO_PORT187, GPIO_PORT188, GPIO_PORT189,
81
82 GPIO_PORT190,
83
84 /* IRQ */
85 GPIO_FN_IRQ0_6, /* PORT 6 */
86 GPIO_FN_IRQ0_162, /* PORT 162 */
87 GPIO_FN_IRQ1, /* PORT 12 */
88 GPIO_FN_IRQ2_4, /* PORT 4 */
89 GPIO_FN_IRQ2_5, /* PORT 5 */
90 GPIO_FN_IRQ3_8, /* PORT 8 */
91 GPIO_FN_IRQ3_16, /* PORT 16 */
92 GPIO_FN_IRQ4_17, /* PORT 17 */
93 GPIO_FN_IRQ4_163, /* PORT 163 */
94 GPIO_FN_IRQ5, /* PORT 18 */
95 GPIO_FN_IRQ6_39, /* PORT 39 */
96 GPIO_FN_IRQ6_164, /* PORT 164 */
97 GPIO_FN_IRQ7_40, /* PORT 40 */
98 GPIO_FN_IRQ7_167, /* PORT 167 */
99 GPIO_FN_IRQ8_41, /* PORT 41 */
100 GPIO_FN_IRQ8_168, /* PORT 168 */
101 GPIO_FN_IRQ9_42, /* PORT 42 */
102 GPIO_FN_IRQ9_169, /* PORT 169 */
103 GPIO_FN_IRQ10, /* PORT 65 */
104 GPIO_FN_IRQ11, /* PORT 67 */
105 GPIO_FN_IRQ12_80, /* PORT 80 */
106 GPIO_FN_IRQ12_137, /* PORT 137 */
107 GPIO_FN_IRQ13_81, /* PORT 81 */
108 GPIO_FN_IRQ13_145, /* PORT 145 */
109 GPIO_FN_IRQ14_82, /* PORT 82 */
110 GPIO_FN_IRQ14_146, /* PORT 146 */
111 GPIO_FN_IRQ15_83, /* PORT 83 */
112 GPIO_FN_IRQ15_147, /* PORT 147 */
113 GPIO_FN_IRQ16_84, /* PORT 84 */
114 GPIO_FN_IRQ16_170, /* PORT 170 */
115 GPIO_FN_IRQ17, /* PORT 85 */
116 GPIO_FN_IRQ18, /* PORT 86 */
117 GPIO_FN_IRQ19, /* PORT 87 */
118 GPIO_FN_IRQ20, /* PORT 92 */
119 GPIO_FN_IRQ21, /* PORT 93 */
120 GPIO_FN_IRQ22, /* PORT 94 */
121 GPIO_FN_IRQ23, /* PORT 95 */
122 GPIO_FN_IRQ24, /* PORT 112 */
123 GPIO_FN_IRQ25, /* PORT 119 */
124 GPIO_FN_IRQ26_121, /* PORT 121 */
125 GPIO_FN_IRQ26_172, /* PORT 172 */
126 GPIO_FN_IRQ27_122, /* PORT 122 */
127 GPIO_FN_IRQ27_180, /* PORT 180 */
128 GPIO_FN_IRQ28_123, /* PORT 123 */
129 GPIO_FN_IRQ28_181, /* PORT 181 */
130 GPIO_FN_IRQ29_129, /* PORT 129 */
131 GPIO_FN_IRQ29_182, /* PORT 182 */
132 GPIO_FN_IRQ30_130, /* PORT 130 */
133 GPIO_FN_IRQ30_183, /* PORT 183 */
134 GPIO_FN_IRQ31_138, /* PORT 138 */
135 GPIO_FN_IRQ31_184, /* PORT 184 */
136
137 /*
138 * MSIOF0 (PORT 36, 37, 38, 39
139 * 40, 41, 42, 43, 44, 45)
140 */
141 GPIO_FN_MSIOF0_TSYNC, GPIO_FN_MSIOF0_TSCK,
142 GPIO_FN_MSIOF0_RXD, GPIO_FN_MSIOF0_RSCK,
143 GPIO_FN_MSIOF0_RSYNC, GPIO_FN_MSIOF0_MCK0,
144 GPIO_FN_MSIOF0_MCK1, GPIO_FN_MSIOF0_SS1,
145 GPIO_FN_MSIOF0_SS2, GPIO_FN_MSIOF0_TXD,
146
147 /*
148 * MSIOF1 (PORT 39, 40, 41, 42, 43, 44
149 * 84, 85, 86, 87, 88, 89, 90, 91, 92, 93)
150 */
151 GPIO_FN_MSIOF1_TSCK_39, GPIO_FN_MSIOF1_TSYNC_40,
152 GPIO_FN_MSIOF1_TSCK_88, GPIO_FN_MSIOF1_TSYNC_89,
153 GPIO_FN_MSIOF1_TXD_41, GPIO_FN_MSIOF1_RXD_42,
154 GPIO_FN_MSIOF1_TXD_90, GPIO_FN_MSIOF1_RXD_91,
155 GPIO_FN_MSIOF1_SS1_43, GPIO_FN_MSIOF1_SS2_44,
156 GPIO_FN_MSIOF1_SS1_92, GPIO_FN_MSIOF1_SS2_93,
157 GPIO_FN_MSIOF1_RSCK, GPIO_FN_MSIOF1_RSYNC,
158 GPIO_FN_MSIOF1_MCK0, GPIO_FN_MSIOF1_MCK1,
159
160 /*
161 * MSIOF2 (PORT 134, 135, 136, 137, 138, 139
162 * 148, 149, 150, 151)
163 */
164 GPIO_FN_MSIOF2_RSCK, GPIO_FN_MSIOF2_RSYNC,
165 GPIO_FN_MSIOF2_MCK0, GPIO_FN_MSIOF2_MCK1,
166 GPIO_FN_MSIOF2_SS1, GPIO_FN_MSIOF2_SS2,
167 GPIO_FN_MSIOF2_TSYNC, GPIO_FN_MSIOF2_TSCK,
168 GPIO_FN_MSIOF2_RXD, GPIO_FN_MSIOF2_TXD,
169
170 /* MSIOF3 (PORT 76, 77, 78, 79, 80, 81, 82, 83) */
171 GPIO_FN_BBIF1_RXD, GPIO_FN_BBIF1_TSYNC,
172 GPIO_FN_BBIF1_TSCK, GPIO_FN_BBIF1_TXD,
173 GPIO_FN_BBIF1_RSCK, GPIO_FN_BBIF1_RSYNC,
174 GPIO_FN_BBIF1_FLOW, GPIO_FN_BB_RX_FLOW_N,
175
176 /* MSIOF4 (PORT 0, 1, 2, 3) */
177 GPIO_FN_BBIF2_TSCK1, GPIO_FN_BBIF2_TSYNC1,
178 GPIO_FN_BBIF2_TXD1, GPIO_FN_BBIF2_RXD,
179
180 /* FSI (PORT 4, 5, 6, 7, 8, 9, 10, 11, 15) */
181 GPIO_FN_FSIACK, GPIO_FN_FSIBCK,
182 GPIO_FN_FSIAILR, GPIO_FN_FSIAIBT,
183 GPIO_FN_FSIAISLD, GPIO_FN_FSIAOMC,
184 GPIO_FN_FSIAOLR, GPIO_FN_FSIAOBT,
185 GPIO_FN_FSIAOSLD, GPIO_FN_FSIASPDIF_11,
186 GPIO_FN_FSIASPDIF_15,
187
188 /* FMSI (PORT 12, 13, 14, 15, 16, 17, 18, 65) */
189 GPIO_FN_FMSOCK, GPIO_FN_FMSOOLR,
190 GPIO_FN_FMSIOLR, GPIO_FN_FMSOOBT,
191 GPIO_FN_FMSIOBT, GPIO_FN_FMSOSLD,
192 GPIO_FN_FMSOILR, GPIO_FN_FMSIILR,
193 GPIO_FN_FMSOIBT, GPIO_FN_FMSIIBT,
194 GPIO_FN_FMSISLD, GPIO_FN_FMSICK,
195
196 /* SCIFA0 (PORT 152, 153, 156, 157, 158) */
197 GPIO_FN_SCIFA0_TXD, GPIO_FN_SCIFA0_RXD,
198 GPIO_FN_SCIFA0_SCK, GPIO_FN_SCIFA0_RTS,
199 GPIO_FN_SCIFA0_CTS,
200
201 /* SCIFA1 (PORT 154, 155, 159, 160, 161) */
202 GPIO_FN_SCIFA1_TXD, GPIO_FN_SCIFA1_RXD,
203 GPIO_FN_SCIFA1_SCK, GPIO_FN_SCIFA1_RTS,
204 GPIO_FN_SCIFA1_CTS,
205
206 /* SCIFA2 (PORT 94, 95, 96, 97, 98) */
207 GPIO_FN_SCIFA2_CTS1, GPIO_FN_SCIFA2_RTS1,
208 GPIO_FN_SCIFA2_TXD1, GPIO_FN_SCIFA2_RXD1,
209 GPIO_FN_SCIFA2_SCK1,
210
211 /* SCIFA3 (PORT 43, 44,
212 140, 141, 142, 143, 144) */
213 GPIO_FN_SCIFA3_CTS_43, GPIO_FN_SCIFA3_CTS_140,
214 GPIO_FN_SCIFA3_RTS_44, GPIO_FN_SCIFA3_RTS_141,
215 GPIO_FN_SCIFA3_SCK, GPIO_FN_SCIFA3_TXD,
216 GPIO_FN_SCIFA3_RXD,
217
218 /* SCIFA4 (PORT 5, 6) */
219 GPIO_FN_SCIFA4_RXD, GPIO_FN_SCIFA4_TXD,
220
221 /* SCIFA5 (PORT 8, 12) */
222 GPIO_FN_SCIFA5_RXD, GPIO_FN_SCIFA5_TXD,
223
224 /* SCIFB (PORT 162, 163, 164, 165, 166) */
225 GPIO_FN_SCIFB_SCK, GPIO_FN_SCIFB_RTS,
226 GPIO_FN_SCIFB_CTS, GPIO_FN_SCIFB_TXD,
227 GPIO_FN_SCIFB_RXD,
228
229 /*
230 * CEU (PORT 16, 17,
231 * 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
232 * 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
233 * 120)
234 */
235 GPIO_FN_VIO_HD, GPIO_FN_VIO_CKO1, GPIO_FN_VIO_CKO2,
236 GPIO_FN_VIO_VD, GPIO_FN_VIO_CLK, GPIO_FN_VIO_FIELD,
237 GPIO_FN_VIO_CKO,
238 GPIO_FN_VIO_D0, GPIO_FN_VIO_D1, GPIO_FN_VIO_D2,
239 GPIO_FN_VIO_D3, GPIO_FN_VIO_D4, GPIO_FN_VIO_D5,
240 GPIO_FN_VIO_D6, GPIO_FN_VIO_D7, GPIO_FN_VIO_D8,
241 GPIO_FN_VIO_D9, GPIO_FN_VIO_D10, GPIO_FN_VIO_D11,
242 GPIO_FN_VIO_D12, GPIO_FN_VIO_D13, GPIO_FN_VIO_D14,
243 GPIO_FN_VIO_D15,
244
245 /* USB0 (PORT 113, 114, 115, 116, 117, 167) */
246 GPIO_FN_IDIN_0, GPIO_FN_EXTLP_0,
247 GPIO_FN_OVCN2_0, GPIO_FN_PWEN_0,
248 GPIO_FN_OVCN_0, GPIO_FN_VBUS0_0,
249
250 /* USB1 (PORT 18, 113, 114, 115, 116, 117, 138, 162, 168) */
251 GPIO_FN_IDIN_1_18, GPIO_FN_IDIN_1_113,
252 GPIO_FN_PWEN_1_115, GPIO_FN_PWEN_1_138,
253 GPIO_FN_OVCN_1_114, GPIO_FN_OVCN_1_162,
254 GPIO_FN_EXTLP_1, GPIO_FN_OVCN2_1,
255 GPIO_FN_VBUS0_1,
256
257 /* GPIO (PORT 41, 42, 43, 44) */
258 GPIO_FN_GPI0, GPIO_FN_GPI1, GPIO_FN_GPO0, GPIO_FN_GPO1,
259
260 /*
261 * BSC (PORT 19,
262 * 20, 21, 22, 25, 26, 27, 28, 29,
263 * 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
264 * 40, 41, 42, 43, 44, 45,
265 * 62, 63, 64, 65, 66, 67,
266 * 71, 72, 74, 75)
267 */
268 GPIO_FN_BS, GPIO_FN_WE1,
269 GPIO_FN_CKO, GPIO_FN_WAIT, GPIO_FN_RDWR,
270
271 GPIO_FN_A0, GPIO_FN_A1, GPIO_FN_A2, GPIO_FN_A3,
272 GPIO_FN_A6, GPIO_FN_A7, GPIO_FN_A8, GPIO_FN_A9,
273 GPIO_FN_A10, GPIO_FN_A11, GPIO_FN_A12, GPIO_FN_A13,
274 GPIO_FN_A14, GPIO_FN_A15, GPIO_FN_A16, GPIO_FN_A17,
275 GPIO_FN_A18, GPIO_FN_A19, GPIO_FN_A20, GPIO_FN_A21,
276 GPIO_FN_A22, GPIO_FN_A23, GPIO_FN_A24, GPIO_FN_A25,
277 GPIO_FN_A26,
278
279 GPIO_FN_CS0, GPIO_FN_CS2, GPIO_FN_CS4,
280 GPIO_FN_CS5A, GPIO_FN_CS5B, GPIO_FN_CS6A,
281
282 /*
283 * BSC/FLCTL (PORT 23, 24,
284 * 46, 47, 48, 49,
285 * 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
286 * 60, 61, 69, 70)
287 */
288 GPIO_FN_RD_FSC, GPIO_FN_WE0_FWE,
289 GPIO_FN_A4_FOE, GPIO_FN_A5_FCDE,
290 GPIO_FN_D0_NAF0, GPIO_FN_D1_NAF1, GPIO_FN_D2_NAF2,
291 GPIO_FN_D3_NAF3, GPIO_FN_D4_NAF4, GPIO_FN_D5_NAF5,
292 GPIO_FN_D6_NAF6, GPIO_FN_D7_NAF7, GPIO_FN_D8_NAF8,
293 GPIO_FN_D9_NAF9, GPIO_FN_D10_NAF10, GPIO_FN_D11_NAF11,
294 GPIO_FN_D12_NAF12, GPIO_FN_D13_NAF13, GPIO_FN_D14_NAF14,
295 GPIO_FN_D15_NAF15,
296
297 /* SPU2 (PORT 65) */
298 GPIO_FN_VINT_I,
299
300 /* FLCTL (PORT 66, 68, 73) */
301 GPIO_FN_FCE1, GPIO_FN_FCE0, GPIO_FN_FRB,
302
303 /* HSI (PORT 76, 77, 78, 79, 80, 81, 82, 83) */
304 GPIO_FN_GP_RX_FLAG, GPIO_FN_GP_RX_DATA, GPIO_FN_GP_TX_READY,
305 GPIO_FN_GP_RX_WAKE, GPIO_FN_MP_TX_FLAG, GPIO_FN_MP_TX_DATA,
306 GPIO_FN_MP_RX_READY, GPIO_FN_MP_TX_WAKE,
307
308 /*
309 * MFI (PORT 76, 77, 78, 79,
310 * 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
311 * 90, 91, 92, 93, 94, 95, 96, 97, 98, 99)
312 */
313 GPIO_FN_MFIv6, /* see MSEL4CR 6 */
314 GPIO_FN_MFIv4, /* see MSEL4CR 6 */
315
316 GPIO_FN_MEMC_CS0, GPIO_FN_MEMC_BUSCLK_MEMC_A0,
317 GPIO_FN_MEMC_CS1_MEMC_A1, GPIO_FN_MEMC_ADV_MEMC_DREQ0,
318 GPIO_FN_MEMC_WAIT_MEMC_DREQ1, GPIO_FN_MEMC_NOE,
319 GPIO_FN_MEMC_NWE, GPIO_FN_MEMC_INT,
320
321 GPIO_FN_MEMC_AD0, GPIO_FN_MEMC_AD1, GPIO_FN_MEMC_AD2,
322 GPIO_FN_MEMC_AD3, GPIO_FN_MEMC_AD4, GPIO_FN_MEMC_AD5,
323 GPIO_FN_MEMC_AD6, GPIO_FN_MEMC_AD7, GPIO_FN_MEMC_AD8,
324 GPIO_FN_MEMC_AD9, GPIO_FN_MEMC_AD10, GPIO_FN_MEMC_AD11,
325 GPIO_FN_MEMC_AD12, GPIO_FN_MEMC_AD13, GPIO_FN_MEMC_AD14,
326 GPIO_FN_MEMC_AD15,
327
328 /* SIM (PORT 94, 95, 98) */
329 GPIO_FN_SIM_RST, GPIO_FN_SIM_CLK, GPIO_FN_SIM_D,
330
331 /* TPU (PORT 93, 99, 112, 160, 161) */
332 GPIO_FN_TPU0TO0, GPIO_FN_TPU0TO1,
333 GPIO_FN_TPU0TO2_93, GPIO_FN_TPU0TO2_99,
334 GPIO_FN_TPU0TO3,
335
336 /* I2C2 (PORT 110, 111) */
337 GPIO_FN_I2C_SCL2, GPIO_FN_I2C_SDA2,
338
339 /* I2C3(1) (PORT 114, 115) */
340 GPIO_FN_I2C_SCL3, GPIO_FN_I2C_SDA3,
341
342 /* I2C3(2) (PORT 137, 145) */
343 GPIO_FN_I2C_SCL3S, GPIO_FN_I2C_SDA3S,
344
345 /* I2C4(2) (PORT 116, 117) */
346 GPIO_FN_I2C_SCL4, GPIO_FN_I2C_SDA4,
347
348 /* I2C4(2) (PORT 146, 147) */
349 GPIO_FN_I2C_SCL4S, GPIO_FN_I2C_SDA4S,
350
351 /*
352 * KEYSC (PORT 121, 122, 123, 124, 125, 126, 127, 128, 129,
353 * 130, 131, 132, 133, 134, 135, 136)
354 */
355 GPIO_FN_KEYOUT0, GPIO_FN_KEYIN0_121, GPIO_FN_KEYIN0_136,
356 GPIO_FN_KEYOUT1, GPIO_FN_KEYIN1_122, GPIO_FN_KEYIN1_135,
357 GPIO_FN_KEYOUT2, GPIO_FN_KEYIN2_123, GPIO_FN_KEYIN2_134,
358 GPIO_FN_KEYOUT3, GPIO_FN_KEYIN3_124, GPIO_FN_KEYIN3_133,
359 GPIO_FN_KEYOUT4, GPIO_FN_KEYIN4,
360 GPIO_FN_KEYOUT5, GPIO_FN_KEYIN5,
361 GPIO_FN_KEYOUT6, GPIO_FN_KEYIN6,
362 GPIO_FN_KEYOUT7, GPIO_FN_KEYIN7,
363
364 /*
365 * LCDC (PORT 121, 122, 123, 124, 125, 126, 127, 128, 129,
366 * 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
367 * 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
368 * 150, 151)
369 */
370 GPIO_FN_LCDC0_SELECT, /* LCDC 0 */
371 GPIO_FN_LCDC1_SELECT, /* LCDC 1 */
372 GPIO_FN_LCDHSYN, GPIO_FN_LCDCS, GPIO_FN_LCDVSYN,
373 GPIO_FN_LCDDCK, GPIO_FN_LCDWR, GPIO_FN_LCDRD,
374 GPIO_FN_LCDDISP, GPIO_FN_LCDRS, GPIO_FN_LCDLCLK,
375 GPIO_FN_LCDDON,
376
377 GPIO_FN_LCDD0, GPIO_FN_LCDD1, GPIO_FN_LCDD2, GPIO_FN_LCDD3,
378 GPIO_FN_LCDD4, GPIO_FN_LCDD5, GPIO_FN_LCDD6, GPIO_FN_LCDD7,
379 GPIO_FN_LCDD8, GPIO_FN_LCDD9, GPIO_FN_LCDD10, GPIO_FN_LCDD11,
380 GPIO_FN_LCDD12, GPIO_FN_LCDD13, GPIO_FN_LCDD14, GPIO_FN_LCDD15,
381 GPIO_FN_LCDD16, GPIO_FN_LCDD17, GPIO_FN_LCDD18, GPIO_FN_LCDD19,
382 GPIO_FN_LCDD20, GPIO_FN_LCDD21, GPIO_FN_LCDD22, GPIO_FN_LCDD23,
383
384 /* IRDA (PORT 139, 140, 141, 142) */
385 GPIO_FN_IRDA_OUT, GPIO_FN_IRDA_IN, GPIO_FN_IRDA_FIRSEL,
386 GPIO_FN_IROUT_139, GPIO_FN_IROUT_140,
387
388 /* TSIF1 (PORT 156, 157, 158, 159) */
389 GPIO_FN_TS0_1SELECT, /* TSIF0 - 1 select */
390 GPIO_FN_TS0_2SELECT, /* TSIF0 - 2 select */
391 GPIO_FN_TS1_1SELECT, /* TSIF1 - 1 select */
392 GPIO_FN_TS1_2SELECT, /* TSIF1 - 2 select */
393
394 GPIO_FN_TS_SPSYNC1, GPIO_FN_TS_SDAT1,
395 GPIO_FN_TS_SDEN1, GPIO_FN_TS_SCK1,
396
397 /* TSIF2 (PORT 137, 145, 146, 147) */
398 GPIO_FN_TS_SPSYNC2, GPIO_FN_TS_SDAT2,
399 GPIO_FN_TS_SDEN2, GPIO_FN_TS_SCK2,
400
401 /* HDMI (PORT 169, 170) */
402 GPIO_FN_HDMI_HPD, GPIO_FN_HDMI_CEC,
403
404 /* SDENC see MSEL4CR 19 */
405 GPIO_FN_SDENC_CPG,
406 GPIO_FN_SDENC_DV_CLKI,
407};
408
409/* DMA slave IDs */ 18/* DMA slave IDs */
410enum { 19enum {
411 SHDMA_SLAVE_INVALID, 20 SHDMA_SLAVE_INVALID,
@@ -466,6 +75,8 @@ extern void sh7372_intcs_resume(void);
466extern void sh7372_intca_suspend(void); 75extern void sh7372_intca_suspend(void);
467extern void sh7372_intca_resume(void); 76extern void sh7372_intca_resume(void);
468 77
78extern unsigned long sh7372_cpu_resume;
79
469#ifdef CONFIG_PM 80#ifdef CONFIG_PM
470extern void __init sh7372_init_pm_domains(void); 81extern void __init sh7372_init_pm_domains(void);
471#else 82#else
diff --git a/arch/arm/mach-shmobile/include/mach/zboot.h b/arch/arm/mach-shmobile/include/mach/zboot.h
index 9320aff0a20f..f2d8744c1f14 100644
--- a/arch/arm/mach-shmobile/include/mach/zboot.h
+++ b/arch/arm/mach-shmobile/include/mach/zboot.h
@@ -10,11 +10,9 @@
10 * 10 *
11 **************************************************/ 11 **************************************************/
12 12
13#ifdef CONFIG_MACH_AP4EVB 13#ifdef CONFIG_MACH_MACKEREL
14#define MACH_TYPE MACH_TYPE_AP4EVB
15#include "mach/head-ap4evb.txt"
16#elif defined(CONFIG_MACH_MACKEREL)
17#define MACH_TYPE MACH_TYPE_MACKEREL 14#define MACH_TYPE MACH_TYPE_MACKEREL
15#define MEMORY_START 0x40000000
18#include "mach/head-mackerel.txt" 16#include "mach/head-mackerel.txt"
19#else 17#else
20#error "unsupported board." 18#error "unsupported board."
diff --git a/arch/arm/mach-shmobile/intc-r8a7740.c b/arch/arm/mach-shmobile/intc-r8a7740.c
index b741c8409a5a..8871f7717dc8 100644
--- a/arch/arm/mach-shmobile/intc-r8a7740.c
+++ b/arch/arm/mach-shmobile/intc-r8a7740.c
@@ -20,19 +20,15 @@
20 20
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irqchip.h>
23#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
24 25
25void __init r8a7740_init_irq(void) 26static void __init r8a7740_init_irq_common(void)
26{ 27{
27 void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
28 void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
29 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10); 28 void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
30 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10); 29 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
31 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4); 30 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
32 31
33 /* initialize the Generic Interrupt Controller PL390 r0p0 */
34 gic_init(0, 29, gic_dist_base, gic_cpu_base);
35
36 /* route signals to GIC */ 32 /* route signals to GIC */
37 iowrite32(0x0, pfc_inta_ctrl); 33 iowrite32(0x0, pfc_inta_ctrl);
38 34
@@ -54,3 +50,19 @@ void __init r8a7740_init_irq(void)
54 iounmap(intc_msk_base); 50 iounmap(intc_msk_base);
55 iounmap(pfc_inta_ctrl); 51 iounmap(pfc_inta_ctrl);
56} 52}
53
54void __init r8a7740_init_irq_of(void)
55{
56 irqchip_init();
57 r8a7740_init_irq_common();
58}
59
60void __init r8a7740_init_irq(void)
61{
62 void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
63 void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
64
65 /* initialize the Generic Interrupt Controller PL390 r0p0 */
66 gic_init(0, 29, gic_dist_base, gic_cpu_base);
67 r8a7740_init_irq_common();
68}
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index dec9293bb90d..0de75fd394b9 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -351,6 +351,9 @@ static void sh7372_enter_a4s_common(int pllc0_on)
351 351
352static void sh7372_pm_setup_smfram(void) 352static void sh7372_pm_setup_smfram(void)
353{ 353{
354 /* pass physical address of cpu_resume() to assembly resume code */
355 sh7372_cpu_resume = virt_to_phys(cpu_resume);
356
354 memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100); 357 memcpy((void *)SMFRAM, sh7372_resume_core_standby_sysc, 0x100);
355} 358}
356#else 359#else
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 326a4ab0bd5f..00c5a707238b 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -70,29 +70,15 @@ void __init r8a7740_map_io(void)
70} 70}
71 71
72/* PFC */ 72/* PFC */
73static struct resource r8a7740_pfc_resources[] = { 73static const struct resource pfc_resources[] = {
74 [0] = { 74 DEFINE_RES_MEM(0xe6050000, 0x8000),
75 .start = 0xe6050000, 75 DEFINE_RES_MEM(0xe605800c, 0x0020),
76 .end = 0xe6057fff,
77 .flags = IORESOURCE_MEM,
78 },
79 [1] = {
80 .start = 0xe605800c,
81 .end = 0xe605802b,
82 .flags = IORESOURCE_MEM,
83 }
84};
85
86static struct platform_device r8a7740_pfc_device = {
87 .name = "pfc-r8a7740",
88 .id = -1,
89 .resource = r8a7740_pfc_resources,
90 .num_resources = ARRAY_SIZE(r8a7740_pfc_resources),
91}; 76};
92 77
93void __init r8a7740_pinmux_init(void) 78void __init r8a7740_pinmux_init(void)
94{ 79{
95 platform_device_register(&r8a7740_pfc_device); 80 platform_device_register_simple("pfc-r8a7740", -1, pfc_resources,
81 ARRAY_SIZE(pfc_resources));
96} 82}
97 83
98static struct renesas_intc_irqpin_config irqpin0_platform_data = { 84static struct renesas_intc_irqpin_config irqpin0_platform_data = {
@@ -531,11 +517,7 @@ static struct platform_device ipmmu_device = {
531 .num_resources = ARRAY_SIZE(ipmmu_resources), 517 .num_resources = ARRAY_SIZE(ipmmu_resources),
532}; 518};
533 519
534static struct platform_device *r8a7740_early_devices[] __initdata = { 520static struct platform_device *r8a7740_devices_dt[] __initdata = {
535 &irqpin0_device,
536 &irqpin1_device,
537 &irqpin2_device,
538 &irqpin3_device,
539 &scif0_device, 521 &scif0_device,
540 &scif1_device, 522 &scif1_device,
541 &scif2_device, 523 &scif2_device,
@@ -546,6 +528,13 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
546 &scif7_device, 528 &scif7_device,
547 &scifb_device, 529 &scifb_device,
548 &cmt10_device, 530 &cmt10_device,
531};
532
533static struct platform_device *r8a7740_early_devices[] __initdata = {
534 &irqpin0_device,
535 &irqpin1_device,
536 &irqpin2_device,
537 &irqpin3_device,
549 &tmu00_device, 538 &tmu00_device,
550 &tmu01_device, 539 &tmu01_device,
551 &tmu02_device, 540 &tmu02_device,
@@ -965,6 +954,8 @@ void __init r8a7740_add_standard_devices(void)
965 /* add devices */ 954 /* add devices */
966 platform_add_devices(r8a7740_early_devices, 955 platform_add_devices(r8a7740_early_devices,
967 ARRAY_SIZE(r8a7740_early_devices)); 956 ARRAY_SIZE(r8a7740_early_devices));
957 platform_add_devices(r8a7740_devices_dt,
958 ARRAY_SIZE(r8a7740_devices_dt));
968 platform_add_devices(r8a7740_late_devices, 959 platform_add_devices(r8a7740_late_devices,
969 ARRAY_SIZE(r8a7740_late_devices)); 960 ARRAY_SIZE(r8a7740_late_devices));
970 961
@@ -986,6 +977,8 @@ void __init r8a7740_add_early_devices(void)
986{ 977{
987 early_platform_add_devices(r8a7740_early_devices, 978 early_platform_add_devices(r8a7740_early_devices,
988 ARRAY_SIZE(r8a7740_early_devices)); 979 ARRAY_SIZE(r8a7740_early_devices));
980 early_platform_add_devices(r8a7740_devices_dt,
981 ARRAY_SIZE(r8a7740_devices_dt));
989 982
990 /* setup early console here as well */ 983 /* setup early console here as well */
991 shmobile_setup_console(); 984 shmobile_setup_console();
@@ -993,33 +986,29 @@ void __init r8a7740_add_early_devices(void)
993 986
994#ifdef CONFIG_USE_OF 987#ifdef CONFIG_USE_OF
995 988
996void __init r8a7740_add_early_devices_dt(void)
997{
998 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
999
1000 early_platform_add_devices(r8a7740_early_devices,
1001 ARRAY_SIZE(r8a7740_early_devices));
1002
1003 /* setup early console here as well */
1004 shmobile_setup_console();
1005}
1006
1007static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = { 989static const struct of_dev_auxdata r8a7740_auxdata_lookup[] __initconst = {
1008 { } 990 { }
1009}; 991};
1010 992
1011void __init r8a7740_add_standard_devices_dt(void) 993void __init r8a7740_add_standard_devices_dt(void)
1012{ 994{
1013 /* clocks are setup late during boot in the case of DT */ 995 platform_add_devices(r8a7740_devices_dt,
1014 r8a7740_clock_init(0); 996 ARRAY_SIZE(r8a7740_devices_dt));
1015
1016 platform_add_devices(r8a7740_early_devices,
1017 ARRAY_SIZE(r8a7740_early_devices));
1018
1019 of_platform_populate(NULL, of_default_bus_match_table, 997 of_platform_populate(NULL, of_default_bus_match_table,
1020 r8a7740_auxdata_lookup, NULL); 998 r8a7740_auxdata_lookup, NULL);
1021} 999}
1022 1000
1001void __init r8a7740_init_delay(void)
1002{
1003 shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
1004};
1005
1006static void __init r8a7740_generic_init(void)
1007{
1008 r8a7740_clock_init(0);
1009 r8a7740_add_standard_devices_dt();
1010}
1011
1023static const char *r8a7740_boards_compat_dt[] __initdata = { 1012static const char *r8a7740_boards_compat_dt[] __initdata = {
1024 "renesas,r8a7740", 1013 "renesas,r8a7740",
1025 NULL, 1014 NULL,
@@ -1027,9 +1016,10 @@ static const char *r8a7740_boards_compat_dt[] __initdata = {
1027 1016
1028DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)") 1017DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
1029 .map_io = r8a7740_map_io, 1018 .map_io = r8a7740_map_io,
1030 .init_early = r8a7740_add_early_devices_dt, 1019 .init_early = r8a7740_init_delay,
1031 .init_irq = r8a7740_init_irq, 1020 .init_irq = r8a7740_init_irq_of,
1032 .init_machine = r8a7740_add_standard_devices_dt, 1021 .init_machine = r8a7740_generic_init,
1022 .init_time = shmobile_timer_init,
1033 .dt_compat = r8a7740_boards_compat_dt, 1023 .dt_compat = r8a7740_boards_compat_dt,
1034MACHINE_END 1024MACHINE_END
1035 1025
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 30b4a336308f..80c20392ad7c 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -24,11 +24,18 @@
24#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/platform_data/gpio-rcar.h>
27#include <linux/platform_data/irq-renesas-intc-irqpin.h> 28#include <linux/platform_data/irq-renesas-intc-irqpin.h>
28#include <linux/platform_device.h> 29#include <linux/platform_device.h>
29#include <linux/irqchip.h> 30#include <linux/irqchip.h>
30#include <linux/serial_sci.h> 31#include <linux/serial_sci.h>
31#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/pm_runtime.h>
34#include <linux/usb/phy.h>
35#include <linux/usb/hcd.h>
36#include <linux/usb/ehci_pdriver.h>
37#include <linux/usb/ohci_pdriver.h>
38#include <linux/dma-mapping.h>
32#include <mach/irqs.h> 39#include <mach/irqs.h>
33#include <mach/r8a7778.h> 40#include <mach/r8a7778.h>
34#include <mach/common.h> 41#include <mach/common.h>
@@ -80,12 +87,6 @@ static struct sh_timer_config sh_tmu1_platform_data = {
80 .clocksource_rating = 200, 87 .clocksource_rating = 200,
81}; 88};
82 89
83/* Ether */
84static struct resource ether_resources[] = {
85 DEFINE_RES_MEM(0xfde00000, 0x400),
86 DEFINE_RES_IRQ(gic_iid(0x89)),
87};
88
89#define r8a7778_register_tmu(idx) \ 90#define r8a7778_register_tmu(idx) \
90 platform_device_register_resndata( \ 91 platform_device_register_resndata( \
91 &platform_bus, "sh_tmu", idx, \ 92 &platform_bus, "sh_tmu", idx, \
@@ -94,6 +95,244 @@ static struct resource ether_resources[] = {
94 &sh_tmu##idx##_platform_data, \ 95 &sh_tmu##idx##_platform_data, \
95 sizeof(sh_tmu##idx##_platform_data)) 96 sizeof(sh_tmu##idx##_platform_data))
96 97
98/* USB PHY */
99static struct resource usb_phy_resources[] __initdata = {
100 DEFINE_RES_MEM(0xffe70800, 0x100),
101 DEFINE_RES_MEM(0xffe76000, 0x100),
102};
103
104void __init r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata)
105{
106 platform_device_register_resndata(&platform_bus, "rcar_usb_phy", -1,
107 usb_phy_resources,
108 ARRAY_SIZE(usb_phy_resources),
109 pdata, sizeof(*pdata));
110}
111
112/* USB */
113static struct usb_phy *phy;
114
115static int usb_power_on(struct platform_device *pdev)
116{
117 if (IS_ERR(phy))
118 return PTR_ERR(phy);
119
120 pm_runtime_enable(&pdev->dev);
121 pm_runtime_get_sync(&pdev->dev);
122
123 usb_phy_init(phy);
124
125 return 0;
126}
127
128static void usb_power_off(struct platform_device *pdev)
129{
130 if (IS_ERR(phy))
131 return;
132
133 usb_phy_shutdown(phy);
134
135 pm_runtime_put_sync(&pdev->dev);
136 pm_runtime_disable(&pdev->dev);
137}
138
139static int ehci_init_internal_buffer(struct usb_hcd *hcd)
140{
141 /*
142 * Below are recommended values from the datasheet;
143 * see [USB :: Setting of EHCI Internal Buffer].
144 */
145 /* EHCI IP internal buffer setting */
146 iowrite32(0x00ff0040, hcd->regs + 0x0094);
147 /* EHCI IP internal buffer enable */
148 iowrite32(0x00000001, hcd->regs + 0x009C);
149
150 return 0;
151}
152
153static struct usb_ehci_pdata ehci_pdata __initdata = {
154 .power_on = usb_power_on,
155 .power_off = usb_power_off,
156 .power_suspend = usb_power_off,
157 .pre_setup = ehci_init_internal_buffer,
158};
159
160static struct resource ehci_resources[] __initdata = {
161 DEFINE_RES_MEM(0xffe70000, 0x400),
162 DEFINE_RES_IRQ(gic_iid(0x4c)),
163};
164
165static struct usb_ohci_pdata ohci_pdata __initdata = {
166 .power_on = usb_power_on,
167 .power_off = usb_power_off,
168 .power_suspend = usb_power_off,
169};
170
171static struct resource ohci_resources[] __initdata = {
172 DEFINE_RES_MEM(0xffe70400, 0x400),
173 DEFINE_RES_IRQ(gic_iid(0x4c)),
174};
175
176#define USB_PLATFORM_INFO(hci) \
177static struct platform_device_info hci##_info __initdata = { \
178 .parent = &platform_bus, \
179 .name = #hci "-platform", \
180 .id = -1, \
181 .res = hci##_resources, \
182 .num_res = ARRAY_SIZE(hci##_resources), \
183 .data = &hci##_pdata, \
184 .size_data = sizeof(hci##_pdata), \
185 .dma_mask = DMA_BIT_MASK(32), \
186}
187
188USB_PLATFORM_INFO(ehci);
189USB_PLATFORM_INFO(ohci);
190
191/* Ether */
192static struct resource ether_resources[] = {
193 DEFINE_RES_MEM(0xfde00000, 0x400),
194 DEFINE_RES_IRQ(gic_iid(0x89)),
195};
196
197void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata)
198{
199 platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
200 ether_resources,
201 ARRAY_SIZE(ether_resources),
202 pdata, sizeof(*pdata));
203}
204
205/* PFC/GPIO */
206static struct resource pfc_resources[] = {
207 DEFINE_RES_MEM(0xfffc0000, 0x118),
208};
209
210#define R8A7778_GPIO(idx) \
211static struct resource r8a7778_gpio##idx##_resources[] = { \
212 DEFINE_RES_MEM(0xffc40000 + 0x1000 * (idx), 0x30), \
213 DEFINE_RES_IRQ(gic_iid(0x87)), \
214}; \
215 \
216static struct gpio_rcar_config r8a7778_gpio##idx##_platform_data = { \
217 .gpio_base = 32 * (idx), \
218 .irq_base = GPIO_IRQ_BASE(idx), \
219 .number_of_pins = 32, \
220 .pctl_name = "pfc-r8a7778", \
221}
222
223R8A7778_GPIO(0);
224R8A7778_GPIO(1);
225R8A7778_GPIO(2);
226R8A7778_GPIO(3);
227R8A7778_GPIO(4);
228
229#define r8a7778_register_gpio(idx) \
230 platform_device_register_resndata( \
231 &platform_bus, "gpio_rcar", idx, \
232 r8a7778_gpio##idx##_resources, \
233 ARRAY_SIZE(r8a7778_gpio##idx##_resources), \
234 &r8a7778_gpio##idx##_platform_data, \
235 sizeof(r8a7778_gpio##idx##_platform_data))
236
237void __init r8a7778_pinmux_init(void)
238{
239 platform_device_register_simple(
240 "pfc-r8a7778", -1,
241 pfc_resources,
242 ARRAY_SIZE(pfc_resources));
243
244 r8a7778_register_gpio(0);
245 r8a7778_register_gpio(1);
246 r8a7778_register_gpio(2);
247 r8a7778_register_gpio(3);
248 r8a7778_register_gpio(4);
249};
250
251/* SDHI */
252static struct resource sdhi_resources[] = {
253 /* SDHI0 */
254 DEFINE_RES_MEM(0xFFE4C000, 0x100),
255 DEFINE_RES_IRQ(gic_iid(0x77)),
256 /* SDHI1 */
257 DEFINE_RES_MEM(0xFFE4D000, 0x100),
258 DEFINE_RES_IRQ(gic_iid(0x78)),
259 /* SDHI2 */
260 DEFINE_RES_MEM(0xFFE4F000, 0x100),
261 DEFINE_RES_IRQ(gic_iid(0x76)),
262};
263
264void __init r8a7778_sdhi_init(int id,
265 struct sh_mobile_sdhi_info *info)
266{
267 BUG_ON(id < 0 || id > 2);
268
269 platform_device_register_resndata(
270 &platform_bus, "sh_mobile_sdhi", id,
271 sdhi_resources + (2 * id), 2,
272 info, sizeof(*info));
273}
274
275/* I2C */
276static struct resource i2c_resources[] __initdata = {
277 /* I2C0 */
278 DEFINE_RES_MEM(0xffc70000, 0x1000),
279 DEFINE_RES_IRQ(gic_iid(0x63)),
280 /* I2C1 */
281 DEFINE_RES_MEM(0xffc71000, 0x1000),
282 DEFINE_RES_IRQ(gic_iid(0x6e)),
283 /* I2C2 */
284 DEFINE_RES_MEM(0xffc72000, 0x1000),
285 DEFINE_RES_IRQ(gic_iid(0x6c)),
286 /* I2C3 */
287 DEFINE_RES_MEM(0xffc73000, 0x1000),
288 DEFINE_RES_IRQ(gic_iid(0x6d)),
289};
290
291void __init r8a7778_add_i2c_device(int id)
292{
293 BUG_ON(id < 0 || id > 3);
294
295 platform_device_register_simple(
296 "i2c-rcar", id,
297 i2c_resources + (2 * id), 2);
298}
299
300/* HSPI */
301static struct resource hspi_resources[] __initdata = {
302 /* HSPI0 */
303 DEFINE_RES_MEM(0xfffc7000, 0x18),
304 DEFINE_RES_IRQ(gic_iid(0x5f)),
305 /* HSPI1 */
306 DEFINE_RES_MEM(0xfffc8000, 0x18),
307 DEFINE_RES_IRQ(gic_iid(0x74)),
308 /* HSPI2 */
309 DEFINE_RES_MEM(0xfffc6000, 0x18),
310 DEFINE_RES_IRQ(gic_iid(0x75)),
311};
312
313void __init r8a7778_add_hspi_device(int id)
314{
315 BUG_ON(id < 0 || id > 2);
316
317 platform_device_register_simple(
318 "sh-hspi", id,
319 hspi_resources + (2 * id), 2);
320}
321
322/* MMC */
323static struct resource mmc_resources[] __initdata = {
324 DEFINE_RES_MEM(0xffe4e000, 0x100),
325 DEFINE_RES_IRQ(gic_iid(0x5d)),
326};
327
328void __init r8a7778_add_mmc_device(struct sh_mmcif_plat_data *info)
329{
330 platform_device_register_resndata(
331 &platform_bus, "sh_mmcif", -1,
332 mmc_resources, ARRAY_SIZE(mmc_resources),
333 info, sizeof(*info));
334}
335
97void __init r8a7778_add_standard_devices(void) 336void __init r8a7778_add_standard_devices(void)
98{ 337{
99 int i; 338 int i;
@@ -118,12 +357,12 @@ void __init r8a7778_add_standard_devices(void)
118 r8a7778_register_tmu(1); 357 r8a7778_register_tmu(1);
119} 358}
120 359
121void __init r8a7778_add_ether_device(struct sh_eth_plat_data *pdata) 360void __init r8a7778_init_late(void)
122{ 361{
123 platform_device_register_resndata(&platform_bus, "sh_eth", -1, 362 phy = usb_get_phy(USB_PHY_TYPE_USB2);
124 ether_resources, 363
125 ARRAY_SIZE(ether_resources), 364 platform_device_register_full(&ehci_info);
126 pdata, sizeof(*pdata)); 365 platform_device_register_full(&ohci_info);
127} 366}
128 367
129static struct renesas_intc_irqpin_config irqpin_platform_data = { 368static struct renesas_intc_irqpin_config irqpin_platform_data = {
@@ -239,6 +478,7 @@ DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
239 .init_machine = r8a7778_add_standard_devices_dt, 478 .init_machine = r8a7778_add_standard_devices_dt,
240 .init_time = shmobile_timer_init, 479 .init_time = shmobile_timer_init,
241 .dt_compat = r8a7778_compat_dt, 480 .dt_compat = r8a7778_compat_dt,
481 .init_late = r8a7778_init_late,
242MACHINE_END 482MACHINE_END
243 483
244#endif /* CONFIG_USE_OF */ 484#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index b0b394842ea5..398687761f50 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -32,6 +32,11 @@
32#include <linux/sh_intc.h> 32#include <linux/sh_intc.h>
33#include <linux/sh_timer.h> 33#include <linux/sh_timer.h>
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/usb/otg.h>
36#include <linux/usb/hcd.h>
37#include <linux/usb/ehci_pdriver.h>
38#include <linux/usb/ohci_pdriver.h>
39#include <linux/pm_runtime.h>
35#include <mach/hardware.h> 40#include <mach/hardware.h>
36#include <mach/irqs.h> 41#include <mach/irqs.h>
37#include <mach/r8a7779.h> 42#include <mach/r8a7779.h>
@@ -65,11 +70,7 @@ void __init r8a7779_map_io(void)
65} 70}
66 71
67static struct resource r8a7779_pfc_resources[] = { 72static struct resource r8a7779_pfc_resources[] = {
68 [0] = { 73 DEFINE_RES_MEM(0xfffc0000, 0x023c),
69 .start = 0xfffc0000,
70 .end = 0xfffc023b,
71 .flags = IORESOURCE_MEM,
72 },
73}; 74};
74 75
75static struct platform_device r8a7779_pfc_device = { 76static struct platform_device r8a7779_pfc_device = {
@@ -81,15 +82,8 @@ static struct platform_device r8a7779_pfc_device = {
81 82
82#define R8A7779_GPIO(idx, npins) \ 83#define R8A7779_GPIO(idx, npins) \
83static struct resource r8a7779_gpio##idx##_resources[] = { \ 84static struct resource r8a7779_gpio##idx##_resources[] = { \
84 [0] = { \ 85 DEFINE_RES_MEM(0xffc40000 + (0x1000 * (idx)), 0x002c), \
85 .start = 0xffc40000 + 0x1000 * (idx), \ 86 DEFINE_RES_IRQ(gic_iid(0xad + (idx))), \
86 .end = 0xffc4002b + 0x1000 * (idx), \
87 .flags = IORESOURCE_MEM, \
88 }, \
89 [1] = { \
90 .start = gic_iid(0xad + (idx)), \
91 .flags = IORESOURCE_IRQ, \
92 } \
93}; \ 87}; \
94 \ 88 \
95static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = { \ 89static struct gpio_rcar_config r8a7779_gpio##idx##_platform_data = { \
@@ -394,6 +388,165 @@ static struct platform_device sata_device = {
394 }, 388 },
395}; 389};
396 390
391/* USB PHY */
392static struct resource usb_phy_resources[] __initdata = {
393 [0] = {
394 .start = 0xffe70800,
395 .end = 0xffe70900 - 1,
396 .flags = IORESOURCE_MEM,
397 },
398};
399
400/* USB */
401static struct usb_phy *phy;
402
403static int usb_power_on(struct platform_device *pdev)
404{
405 if (IS_ERR(phy))
406 return PTR_ERR(phy);
407
408 pm_runtime_enable(&pdev->dev);
409 pm_runtime_get_sync(&pdev->dev);
410
411 usb_phy_init(phy);
412
413 return 0;
414}
415
416static void usb_power_off(struct platform_device *pdev)
417{
418 if (IS_ERR(phy))
419 return;
420
421 usb_phy_shutdown(phy);
422
423 pm_runtime_put_sync(&pdev->dev);
424 pm_runtime_disable(&pdev->dev);
425}
426
427static int ehci_init_internal_buffer(struct usb_hcd *hcd)
428{
429 /*
430 * Below are recommended values from the datasheet;
431 * see [USB :: Setting of EHCI Internal Buffer].
432 */
433 /* EHCI IP internal buffer setting */
434 iowrite32(0x00ff0040, hcd->regs + 0x0094);
435 /* EHCI IP internal buffer enable */
436 iowrite32(0x00000001, hcd->regs + 0x009C);
437
438 return 0;
439}
440
441static struct usb_ehci_pdata ehcix_pdata = {
442 .power_on = usb_power_on,
443 .power_off = usb_power_off,
444 .power_suspend = usb_power_off,
445 .pre_setup = ehci_init_internal_buffer,
446};
447
448static struct resource ehci0_resources[] = {
449 [0] = {
450 .start = 0xffe70000,
451 .end = 0xffe70400 - 1,
452 .flags = IORESOURCE_MEM,
453 },
454 [1] = {
455 .start = gic_iid(0x4c),
456 .flags = IORESOURCE_IRQ,
457 },
458};
459
460static struct platform_device ehci0_device = {
461 .name = "ehci-platform",
462 .id = 0,
463 .dev = {
464 .dma_mask = &ehci0_device.dev.coherent_dma_mask,
465 .coherent_dma_mask = 0xffffffff,
466 .platform_data = &ehcix_pdata,
467 },
468 .num_resources = ARRAY_SIZE(ehci0_resources),
469 .resource = ehci0_resources,
470};
471
472static struct resource ehci1_resources[] = {
473 [0] = {
474 .start = 0xfff70000,
475 .end = 0xfff70400 - 1,
476 .flags = IORESOURCE_MEM,
477 },
478 [1] = {
479 .start = gic_iid(0x4d),
480 .flags = IORESOURCE_IRQ,
481 },
482};
483
484static struct platform_device ehci1_device = {
485 .name = "ehci-platform",
486 .id = 1,
487 .dev = {
488 .dma_mask = &ehci1_device.dev.coherent_dma_mask,
489 .coherent_dma_mask = 0xffffffff,
490 .platform_data = &ehcix_pdata,
491 },
492 .num_resources = ARRAY_SIZE(ehci1_resources),
493 .resource = ehci1_resources,
494};
495
496static struct usb_ohci_pdata ohcix_pdata = {
497 .power_on = usb_power_on,
498 .power_off = usb_power_off,
499 .power_suspend = usb_power_off,
500};
501
502static struct resource ohci0_resources[] = {
503 [0] = {
504 .start = 0xffe70400,
505 .end = 0xffe70800 - 1,
506 .flags = IORESOURCE_MEM,
507 },
508 [1] = {
509 .start = gic_iid(0x4c),
510 .flags = IORESOURCE_IRQ,
511 },
512};
513
514static struct platform_device ohci0_device = {
515 .name = "ohci-platform",
516 .id = 0,
517 .dev = {
518 .dma_mask = &ohci0_device.dev.coherent_dma_mask,
519 .coherent_dma_mask = 0xffffffff,
520 .platform_data = &ohcix_pdata,
521 },
522 .num_resources = ARRAY_SIZE(ohci0_resources),
523 .resource = ohci0_resources,
524};
525
526static struct resource ohci1_resources[] = {
527 [0] = {
528 .start = 0xfff70400,
529 .end = 0xfff70800 - 1,
530 .flags = IORESOURCE_MEM,
531 },
532 [1] = {
533 .start = gic_iid(0x4d),
534 .flags = IORESOURCE_IRQ,
535 },
536};
537
538static struct platform_device ohci1_device = {
539 .name = "ohci-platform",
540 .id = 1,
541 .dev = {
542 .dma_mask = &ohci1_device.dev.coherent_dma_mask,
543 .coherent_dma_mask = 0xffffffff,
544 .platform_data = &ohcix_pdata,
545 },
546 .num_resources = ARRAY_SIZE(ohci1_resources),
547 .resource = ohci1_resources,
548};
549
397/* Ether */ 550/* Ether */
398static struct resource ether_resources[] = { 551static struct resource ether_resources[] = {
399 { 552 {
@@ -417,7 +570,7 @@ static struct platform_device *r8a7779_devices_dt[] __initdata = {
417 &tmu01_device, 570 &tmu01_device,
418}; 571};
419 572
420static struct platform_device *r8a7779_late_devices[] __initdata = { 573static struct platform_device *r8a7779_standard_devices[] __initdata = {
421 &i2c0_device, 574 &i2c0_device,
422 &i2c1_device, 575 &i2c1_device,
423 &i2c2_device, 576 &i2c2_device,
@@ -437,18 +590,26 @@ void __init r8a7779_add_standard_devices(void)
437 590
438 platform_add_devices(r8a7779_devices_dt, 591 platform_add_devices(r8a7779_devices_dt,
439 ARRAY_SIZE(r8a7779_devices_dt)); 592 ARRAY_SIZE(r8a7779_devices_dt));
440 platform_add_devices(r8a7779_late_devices, 593 platform_add_devices(r8a7779_standard_devices,
441 ARRAY_SIZE(r8a7779_late_devices)); 594 ARRAY_SIZE(r8a7779_standard_devices));
442} 595}
443 596
444void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) 597void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)
445{ 598{
446 platform_device_register_resndata(&platform_bus, "sh_eth", -1, 599 platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
447 ether_resources, 600 ether_resources,
448 ARRAY_SIZE(ether_resources), 601 ARRAY_SIZE(ether_resources),
449 pdata, sizeof(*pdata)); 602 pdata, sizeof(*pdata));
450} 603}
451 604
605void __init r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata)
606{
607 platform_device_register_resndata(&platform_bus, "rcar_usb_phy", -1,
608 usb_phy_resources,
609 ARRAY_SIZE(usb_phy_resources),
610 pdata, sizeof(*pdata));
611}
612
452/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 613/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
453void __init __weak r8a7779_register_twd(void) { } 614void __init __weak r8a7779_register_twd(void) { }
454 615
@@ -481,6 +642,23 @@ void __init r8a7779_add_early_devices(void)
481 */ 642 */
482} 643}
483 644
645static struct platform_device *r8a7779_late_devices[] __initdata = {
646 &ehci0_device,
647 &ehci1_device,
648 &ohci0_device,
649 &ohci1_device,
650};
651
652void __init r8a7779_init_late(void)
653{
654 /* get USB PHY */
655 phy = usb_get_phy(USB_PHY_TYPE_USB2);
656
657 shmobile_init_late();
658 platform_add_devices(r8a7779_late_devices,
659 ARRAY_SIZE(r8a7779_late_devices));
660}
661
484#ifdef CONFIG_USE_OF 662#ifdef CONFIG_USE_OF
485void __init r8a7779_init_delay(void) 663void __init r8a7779_init_delay(void)
486{ 664{
@@ -514,6 +692,7 @@ DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
514 .init_irq = r8a7779_init_irq_dt, 692 .init_irq = r8a7779_init_irq_dt,
515 .init_machine = r8a7779_add_standard_devices_dt, 693 .init_machine = r8a7779_add_standard_devices_dt,
516 .init_time = shmobile_timer_init, 694 .init_time = shmobile_timer_init,
695 .init_late = r8a7779_init_late,
517 .dt_compat = r8a7779_compat_dt, 696 .dt_compat = r8a7779_compat_dt,
518MACHINE_END 697MACHINE_END
519#endif /* CONFIG_USE_OF */ 698#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 49de2d56f86d..28f94752b8ff 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -23,21 +23,55 @@
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/serial_sci.h> 25#include <linux/serial_sci.h>
26#include <linux/platform_data/gpio-rcar.h>
26#include <linux/platform_data/irq-renesas-irqc.h> 27#include <linux/platform_data/irq-renesas-irqc.h>
27#include <mach/common.h> 28#include <mach/common.h>
28#include <mach/irqs.h> 29#include <mach/irqs.h>
29#include <mach/r8a7790.h> 30#include <mach/r8a7790.h>
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31 32
32static const struct resource pfc_resources[] = { 33static struct resource pfc_resources[] __initdata = {
33 DEFINE_RES_MEM(0xe6060000, 0x250), 34 DEFINE_RES_MEM(0xe6060000, 0x250),
34 DEFINE_RES_MEM(0xe6050000, 0x5050),
35}; 35};
36 36
37#define R8A7790_GPIO(idx) \
38static struct resource r8a7790_gpio##idx##_resources[] __initdata = { \
39 DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \
40 DEFINE_RES_IRQ(gic_spi(4 + (idx))), \
41}; \
42 \
43static struct gpio_rcar_config r8a7790_gpio##idx##_platform_data __initdata = { \
44 .gpio_base = 32 * (idx), \
45 .irq_base = 0, \
46 .number_of_pins = 32, \
47 .pctl_name = "pfc-r8a7790", \
48 .has_both_edge_trigger = 1, \
49}; \
50
51R8A7790_GPIO(0);
52R8A7790_GPIO(1);
53R8A7790_GPIO(2);
54R8A7790_GPIO(3);
55R8A7790_GPIO(4);
56R8A7790_GPIO(5);
57
58#define r8a7790_register_gpio(idx) \
59 platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
60 r8a7790_gpio##idx##_resources, \
61 ARRAY_SIZE(r8a7790_gpio##idx##_resources), \
62 &r8a7790_gpio##idx##_platform_data, \
63 sizeof(r8a7790_gpio##idx##_platform_data))
64
37void __init r8a7790_pinmux_init(void) 65void __init r8a7790_pinmux_init(void)
38{ 66{
39 platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, 67 platform_device_register_simple("pfc-r8a7790", -1, pfc_resources,
40 ARRAY_SIZE(pfc_resources)); 68 ARRAY_SIZE(pfc_resources));
69 r8a7790_register_gpio(0);
70 r8a7790_register_gpio(1);
71 r8a7790_register_gpio(2);
72 r8a7790_register_gpio(3);
73 r8a7790_register_gpio(4);
74 r8a7790_register_gpio(5);
41} 75}
42 76
43#define SCIF_COMMON(scif_type, baseaddr, irq) \ 77#define SCIF_COMMON(scif_type, baseaddr, irq) \
@@ -64,12 +98,20 @@ void __init r8a7790_pinmux_init(void)
64[index] = { \ 98[index] = { \
65 SCIF_COMMON(PORT_SCIF, baseaddr, irq), \ 99 SCIF_COMMON(PORT_SCIF, baseaddr, irq), \
66 .scbrr_algo_id = SCBRR_ALGO_2, \ 100 .scbrr_algo_id = SCBRR_ALGO_2, \
67 .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, \ 101 .scscr = SCSCR_RE | SCSCR_TE, \
102}
103
104#define HSCIF_DATA(index, baseaddr, irq) \
105[index] = { \
106 SCIF_COMMON(PORT_HSCIF, baseaddr, irq), \
107 .scbrr_algo_id = SCBRR_ALGO_6, \
108 .scscr = SCSCR_RE | SCSCR_TE, \
68} 109}
69 110
70enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1 }; 111enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFA2, SCIF0, SCIF1,
112 HSCIF0, HSCIF1 };
71 113
72static const struct plat_sci_port scif[] = { 114static struct plat_sci_port scif[] __initdata = {
73 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 115 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
74 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 116 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
75 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */ 117 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
@@ -78,6 +120,8 @@ static const struct plat_sci_port scif[] = {
78 SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */ 120 SCIFA_DATA(SCIFA2, 0xe6c60000, gic_spi(151)), /* SCIFA2 */
79 SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */ 121 SCIF_DATA(SCIF0, 0xe6e60000, gic_spi(152)), /* SCIF0 */
80 SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */ 122 SCIF_DATA(SCIF1, 0xe6e68000, gic_spi(153)), /* SCIF1 */
123 HSCIF_DATA(HSCIF0, 0xe62c0000, gic_spi(154)), /* HSCIF0 */
124 HSCIF_DATA(HSCIF1, 0xe62c8000, gic_spi(155)), /* HSCIF1 */
81}; 125};
82 126
83static inline void r8a7790_register_scif(int idx) 127static inline void r8a7790_register_scif(int idx)
@@ -86,11 +130,11 @@ static inline void r8a7790_register_scif(int idx)
86 sizeof(struct plat_sci_port)); 130 sizeof(struct plat_sci_port));
87} 131}
88 132
89static struct renesas_irqc_config irqc0_data = { 133static struct renesas_irqc_config irqc0_data __initdata = {
90 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */ 134 .irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
91}; 135};
92 136
93static struct resource irqc0_resources[] = { 137static struct resource irqc0_resources[] __initdata = {
94 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */ 138 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
95 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */ 139 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
96 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */ 140 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
@@ -115,6 +159,8 @@ void __init r8a7790_add_standard_devices(void)
115 r8a7790_register_scif(SCIFA2); 159 r8a7790_register_scif(SCIFA2);
116 r8a7790_register_scif(SCIF0); 160 r8a7790_register_scif(SCIF0);
117 r8a7790_register_scif(SCIF1); 161 r8a7790_register_scif(SCIF1);
162 r8a7790_register_scif(HSCIF0);
163 r8a7790_register_scif(HSCIF1);
118 r8a7790_register_irqc(0); 164 r8a7790_register_irqc(0);
119} 165}
120 166
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 9696f3646864..96e7ca1e4e11 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -288,12 +288,7 @@ static struct sh_timer_config tmu00_platform_data = {
288}; 288};
289 289
290static struct resource tmu00_resources[] = { 290static struct resource tmu00_resources[] = {
291 [0] = { 291 [0] = DEFINE_RES_MEM_NAMED(0xfff60008, 0xc, "TMU00"),
292 .name = "TMU00",
293 .start = 0xfff60008,
294 .end = 0xfff60013,
295 .flags = IORESOURCE_MEM,
296 },
297 [1] = { 292 [1] = {
298 .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */ 293 .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
299 .flags = IORESOURCE_IRQ, 294 .flags = IORESOURCE_IRQ,
@@ -318,12 +313,7 @@ static struct sh_timer_config tmu01_platform_data = {
318}; 313};
319 314
320static struct resource tmu01_resources[] = { 315static struct resource tmu01_resources[] = {
321 [0] = { 316 [0] = DEFINE_RES_MEM_NAMED(0xfff60014, 0xc, "TMU00"),
322 .name = "TMU01",
323 .start = 0xfff60014,
324 .end = 0xfff6001f,
325 .flags = IORESOURCE_MEM,
326 },
327 [1] = { 317 [1] = {
328 .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */ 318 .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
329 .flags = IORESOURCE_IRQ, 319 .flags = IORESOURCE_IRQ,
@@ -341,12 +331,7 @@ static struct platform_device tmu01_device = {
341}; 331};
342 332
343static struct resource i2c0_resources[] = { 333static struct resource i2c0_resources[] = {
344 [0] = { 334 [0] = DEFINE_RES_MEM_NAMED(0xe6820000, 0x426, "IIC0"),
345 .name = "IIC0",
346 .start = 0xe6820000,
347 .end = 0xe6820425 - 1,
348 .flags = IORESOURCE_MEM,
349 },
350 [1] = { 335 [1] = {
351 .start = gic_spi(167), 336 .start = gic_spi(167),
352 .end = gic_spi(170), 337 .end = gic_spi(170),
@@ -355,12 +340,7 @@ static struct resource i2c0_resources[] = {
355}; 340};
356 341
357static struct resource i2c1_resources[] = { 342static struct resource i2c1_resources[] = {
358 [0] = { 343 [0] = DEFINE_RES_MEM_NAMED(0xe6822000, 0x426, "IIC1"),
359 .name = "IIC1",
360 .start = 0xe6822000,
361 .end = 0xe6822425 - 1,
362 .flags = IORESOURCE_MEM,
363 },
364 [1] = { 344 [1] = {
365 .start = gic_spi(51), 345 .start = gic_spi(51),
366 .end = gic_spi(54), 346 .end = gic_spi(54),
@@ -369,12 +349,7 @@ static struct resource i2c1_resources[] = {
369}; 349};
370 350
371static struct resource i2c2_resources[] = { 351static struct resource i2c2_resources[] = {
372 [0] = { 352 [0] = DEFINE_RES_MEM_NAMED(0xe6824000, 0x426, "IIC2"),
373 .name = "IIC2",
374 .start = 0xe6824000,
375 .end = 0xe6824425 - 1,
376 .flags = IORESOURCE_MEM,
377 },
378 [1] = { 353 [1] = {
379 .start = gic_spi(171), 354 .start = gic_spi(171),
380 .end = gic_spi(174), 355 .end = gic_spi(174),
@@ -383,12 +358,7 @@ static struct resource i2c2_resources[] = {
383}; 358};
384 359
385static struct resource i2c3_resources[] = { 360static struct resource i2c3_resources[] = {
386 [0] = { 361 [0] = DEFINE_RES_MEM_NAMED(0xe6826000, 0x426, "IIC3"),
387 .name = "IIC3",
388 .start = 0xe6826000,
389 .end = 0xe6826425 - 1,
390 .flags = IORESOURCE_MEM,
391 },
392 [1] = { 362 [1] = {
393 .start = gic_spi(183), 363 .start = gic_spi(183),
394 .end = gic_spi(186), 364 .end = gic_spi(186),
@@ -397,12 +367,7 @@ static struct resource i2c3_resources[] = {
397}; 367};
398 368
399static struct resource i2c4_resources[] = { 369static struct resource i2c4_resources[] = {
400 [0] = { 370 [0] = DEFINE_RES_MEM_NAMED(0xe6828000, 0x426, "IIC4"),
401 .name = "IIC4",
402 .start = 0xe6828000,
403 .end = 0xe6828425 - 1,
404 .flags = IORESOURCE_MEM,
405 },
406 [1] = { 371 [1] = {
407 .start = gic_spi(187), 372 .start = gic_spi(187),
408 .end = gic_spi(190), 373 .end = gic_spi(190),
@@ -623,12 +588,7 @@ static struct sh_dmae_pdata sh73a0_dmae_platform_data = {
623}; 588};
624 589
625static struct resource sh73a0_dmae_resources[] = { 590static struct resource sh73a0_dmae_resources[] = {
626 { 591 DEFINE_RES_MEM(0xfe000020, 0x89e0),
627 /* Registers including DMAOR and channels including DMARSx */
628 .start = 0xfe000020,
629 .end = 0xfe008a00 - 1,
630 .flags = IORESOURCE_MEM,
631 },
632 { 592 {
633 .name = "error_irq", 593 .name = "error_irq",
634 .start = gic_spi(129), 594 .start = gic_spi(129),
@@ -727,18 +687,10 @@ static struct sh_dmae_pdata sh73a0_mpdma_platform_data = {
727 687
728/* Resource order important! */ 688/* Resource order important! */
729static struct resource sh73a0_mpdma_resources[] = { 689static struct resource sh73a0_mpdma_resources[] = {
730 { 690 /* Channel registers and DMAOR */
731 /* Channel registers and DMAOR */ 691 DEFINE_RES_MEM(0xec618020, 0x270),
732 .start = 0xec618020, 692 /* DMARSx */
733 .end = 0xec61828f, 693 DEFINE_RES_MEM(0xec619000, 0xc),
734 .flags = IORESOURCE_MEM,
735 },
736 {
737 /* DMARSx */
738 .start = 0xec619000,
739 .end = 0xec61900b,
740 .flags = IORESOURCE_MEM,
741 },
742 { 694 {
743 .name = "error_irq", 695 .name = "error_irq",
744 .start = gic_spi(181), 696 .start = gic_spi(181),
@@ -785,12 +737,7 @@ static struct platform_device pmu_device = {
785 737
786/* an IPMMU module for ICB */ 738/* an IPMMU module for ICB */
787static struct resource ipmmu_resources[] = { 739static struct resource ipmmu_resources[] = {
788 [0] = { 740 DEFINE_RES_MEM_NAMED(0xfe951000, 0x100, "IPMMU"),
789 .name = "IPMMU",
790 .start = 0xfe951000,
791 .end = 0xfe9510ff,
792 .flags = IORESOURCE_MEM,
793 },
794}; 741};
795 742
796static const char * const ipmmu_dev_names[] = { 743static const char * const ipmmu_dev_names[] = {
@@ -982,11 +929,17 @@ void __init sh73a0_add_standard_devices(void)
982 ARRAY_SIZE(sh73a0_late_devices)); 929 ARRAY_SIZE(sh73a0_late_devices));
983} 930}
984 931
932void __init sh73a0_init_delay(void)
933{
934 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
935}
936
985/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ 937/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
986void __init __weak sh73a0_register_twd(void) { } 938void __init __weak sh73a0_register_twd(void) { }
987 939
988void __init sh73a0_earlytimer_init(void) 940void __init sh73a0_earlytimer_init(void)
989{ 941{
942 sh73a0_init_delay();
990 sh73a0_clock_init(); 943 sh73a0_clock_init();
991 shmobile_earlytimer_init(); 944 shmobile_earlytimer_init();
992 sh73a0_register_twd(); 945 sh73a0_register_twd();
@@ -1005,17 +958,14 @@ void __init sh73a0_add_early_devices(void)
1005 958
1006#ifdef CONFIG_USE_OF 959#ifdef CONFIG_USE_OF
1007 960
1008void __init sh73a0_init_delay(void)
1009{
1010 shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
1011}
1012
1013static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = { 961static const struct of_dev_auxdata sh73a0_auxdata_lookup[] __initconst = {
1014 {}, 962 {},
1015}; 963};
1016 964
1017void __init sh73a0_add_standard_devices_dt(void) 965void __init sh73a0_add_standard_devices_dt(void)
1018{ 966{
967 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, };
968
1019 /* clocks are setup late during boot in the case of DT */ 969 /* clocks are setup late during boot in the case of DT */
1020 sh73a0_clock_init(); 970 sh73a0_clock_init();
1021 971
@@ -1023,6 +973,9 @@ void __init sh73a0_add_standard_devices_dt(void)
1023 ARRAY_SIZE(sh73a0_devices_dt)); 973 ARRAY_SIZE(sh73a0_devices_dt));
1024 of_platform_populate(NULL, of_default_bus_match_table, 974 of_platform_populate(NULL, of_default_bus_match_table,
1025 sh73a0_auxdata_lookup, NULL); 975 sh73a0_auxdata_lookup, NULL);
976
977 /* Instantiate cpufreq-cpu0 */
978 platform_device_register_full(&devinfo);
1026} 979}
1027 980
1028static const char *sh73a0_boards_compat_dt[] __initdata = { 981static const char *sh73a0_boards_compat_dt[] __initdata = {
diff --git a/arch/arm/mach-shmobile/sleep-sh7372.S b/arch/arm/mach-shmobile/sleep-sh7372.S
index a9df53b69ab8..53f4840e4949 100644
--- a/arch/arm/mach-shmobile/sleep-sh7372.S
+++ b/arch/arm/mach-shmobile/sleep-sh7372.S
@@ -40,7 +40,10 @@
40 .global sh7372_resume_core_standby_sysc 40 .global sh7372_resume_core_standby_sysc
41sh7372_resume_core_standby_sysc: 41sh7372_resume_core_standby_sysc:
42 ldr pc, 1f 42 ldr pc, 1f
431: .long cpu_resume - PAGE_OFFSET + PLAT_PHYS_OFFSET 43
44 .globl sh7372_cpu_resume
45sh7372_cpu_resume:
461: .space 4
44 47
45#define SPDCR 0xe6180008 48#define SPDCR 0xe6180008
46 49
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index e38691b4d0dd..80991b35f4ac 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -40,8 +40,10 @@ static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
40{ 40{
41 scu_enable(shmobile_scu_base); 41 scu_enable(shmobile_scu_base);
42 42
43 /* Tell ROM loader about our vector (in headsmp-scu.S) */ 43 /* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */
44 emev2_set_boot_vector(__pa(shmobile_secondary_vector_scu)); 44 emev2_set_boot_vector(__pa(shmobile_boot_vector));
45 shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
46 shmobile_boot_arg = (unsigned long)shmobile_scu_base;
45 47
46 /* enable cache coherency on booting CPU */ 48 /* enable cache coherency on booting CPU */
47 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); 49 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index a853bf182ed5..526cfaae81c1 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -101,8 +101,10 @@ static void __init r8a7779_smp_prepare_cpus(unsigned int max_cpus)
101{ 101{
102 scu_enable(shmobile_scu_base); 102 scu_enable(shmobile_scu_base);
103 103
104 /* Map the reset vector (in headsmp-scu.S) */ 104 /* Map the reset vector (in headsmp-scu.S, headsmp.S) */
105 __raw_writel(__pa(shmobile_secondary_vector_scu), AVECR); 105 __raw_writel(__pa(shmobile_boot_vector), AVECR);
106 shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
107 shmobile_boot_arg = (unsigned long)shmobile_scu_base;
106 108
107 /* enable cache coherency on booting CPU */ 109 /* enable cache coherency on booting CPU */
108 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); 110 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index 496592b6c763..d613113a04bd 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -64,9 +64,11 @@ static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
64{ 64{
65 scu_enable(shmobile_scu_base); 65 scu_enable(shmobile_scu_base);
66 66
67 /* Map the reset vector (in headsmp-scu.S) */ 67 /* Map the reset vector (in headsmp-scu.S, headsmp.S) */
68 __raw_writel(0, APARMBAREA); /* 4k */ 68 __raw_writel(0, APARMBAREA); /* 4k */
69 __raw_writel(__pa(shmobile_secondary_vector_scu), SBAR); 69 __raw_writel(__pa(shmobile_boot_vector), SBAR);
70 shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
71 shmobile_boot_arg = (unsigned long)shmobile_scu_base;
70 72
71 /* enable cache coherency on booting CPU */ 73 /* enable cache coherency on booting CPU */
72 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL); 74 scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index 566e804d4036..dd86db467521 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -7,11 +7,11 @@ config ARCH_SOCFPGA
7 select CLKDEV_LOOKUP 7 select CLKDEV_LOOKUP
8 select COMMON_CLK 8 select COMMON_CLK
9 select CPU_V7 9 select CPU_V7
10 select DW_APB_TIMER
11 select DW_APB_TIMER_OF 10 select DW_APB_TIMER_OF
12 select GENERIC_CLOCKEVENTS 11 select GENERIC_CLOCKEVENTS
13 select GPIO_PL061 if GPIOLIB 12 select GPIO_PL061 if GPIOLIB
14 select HAVE_ARM_SCU 13 select HAVE_ARM_SCU
15 select HAVE_SMP 14 select HAVE_SMP
15 select MFD_SYSCON
16 select SPARSE_IRQ 16 select SPARSE_IRQ
17 select USE_OF 17 select USE_OF
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 46a051359f02..8ea11b472b91 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -14,7 +14,6 @@
14 * You should have received a copy of the GNU General Public License 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/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17#include <linux/dw_apb_timer.h>
18#include <linux/clk-provider.h> 17#include <linux/clk-provider.h>
19#include <linux/irqchip.h> 18#include <linux/irqchip.h>
20#include <linux/of_address.h> 19#include <linux/of_address.h>
@@ -120,7 +119,6 @@ DT_MACHINE_START(SOCFPGA, "Altera SOCFPGA")
120 .smp = smp_ops(socfpga_smp_ops), 119 .smp = smp_ops(socfpga_smp_ops),
121 .map_io = socfpga_map_io, 120 .map_io = socfpga_map_io,
122 .init_irq = socfpga_init_irq, 121 .init_irq = socfpga_init_irq,
123 .init_time = dw_apb_timer_init,
124 .init_machine = socfpga_cyclone5_init, 122 .init_machine = socfpga_cyclone5_init,
125 .restart = socfpga_cyclone5_restart, 123 .restart = socfpga_cyclone5_restart,
126 .dt_compat = altera_dt_match, 124 .dt_compat = altera_dt_match,
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 9eaac2c881ea..7ad003001ab7 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -14,7 +14,6 @@
14#define pr_fmt(fmt) "SPEAr1310: " fmt 14#define pr_fmt(fmt) "SPEAr1310: " fmt
15 15
16#include <linux/amba/pl022.h> 16#include <linux/amba/pl022.h>
17#include <linux/irqchip.h>
18#include <linux/of_platform.h> 17#include <linux/of_platform.h>
19#include <linux/pata_arasan_cf_data.h> 18#include <linux/pata_arasan_cf_data.h>
20#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
@@ -60,7 +59,6 @@ static void __init spear1310_map_io(void)
60DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree") 59DT_MACHINE_START(SPEAR1310_DT, "ST SPEAr1310 SoC with Flattened Device Tree")
61 .smp = smp_ops(spear13xx_smp_ops), 60 .smp = smp_ops(spear13xx_smp_ops),
62 .map_io = spear1310_map_io, 61 .map_io = spear1310_map_io,
63 .init_irq = irqchip_init,
64 .init_time = spear13xx_timer_init, 62 .init_time = spear13xx_timer_init,
65 .init_machine = spear1310_dt_init, 63 .init_machine = spear1310_dt_init,
66 .restart = spear_restart, 64 .restart = spear_restart,
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index a04a7fe76f71..3fb683424729 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -17,7 +17,6 @@
17#include <linux/amba/serial.h> 17#include <linux/amba/serial.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/irqchip.h>
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22#include "generic.h" 21#include "generic.h"
23#include <mach/spear.h> 22#include <mach/spear.h>
@@ -155,7 +154,6 @@ static const char * const spear1340_dt_board_compat[] = {
155DT_MACHINE_START(SPEAR1340_DT, "ST SPEAr1340 SoC with Flattened Device Tree") 154DT_MACHINE_START(SPEAR1340_DT, "ST SPEAr1340 SoC with Flattened Device Tree")
156 .smp = smp_ops(spear13xx_smp_ops), 155 .smp = smp_ops(spear13xx_smp_ops),
157 .map_io = spear13xx_map_io, 156 .map_io = spear13xx_map_io,
158 .init_irq = irqchip_init,
159 .init_time = spear13xx_timer_init, 157 .init_time = spear13xx_timer_init,
160 .init_machine = spear1340_dt_init, 158 .init_machine = spear1340_dt_init,
161 .restart = spear_restart, 159 .restart = spear_restart,
diff --git a/arch/arm/mach-spear/spear300.c b/arch/arm/mach-spear/spear300.c
index bac56e845f7a..b52e48f342f4 100644
--- a/arch/arm/mach-spear/spear300.c
+++ b/arch/arm/mach-spear/spear300.c
@@ -14,7 +14,6 @@
14#define pr_fmt(fmt) "SPEAr300: " fmt 14#define pr_fmt(fmt) "SPEAr300: " fmt
15 15
16#include <linux/amba/pl08x.h> 16#include <linux/amba/pl08x.h>
17#include <linux/irqchip.h>
18#include <linux/of_platform.h> 17#include <linux/of_platform.h>
19#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
20#include "generic.h" 19#include "generic.h"
@@ -212,7 +211,6 @@ static void __init spear300_map_io(void)
212 211
213DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree") 212DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
214 .map_io = spear300_map_io, 213 .map_io = spear300_map_io,
215 .init_irq = irqchip_init,
216 .init_time = spear3xx_timer_init, 214 .init_time = spear3xx_timer_init,
217 .init_machine = spear300_dt_init, 215 .init_machine = spear300_dt_init,
218 .restart = spear_restart, 216 .restart = spear_restart,
diff --git a/arch/arm/mach-spear/spear310.c b/arch/arm/mach-spear/spear310.c
index 6ffbc63d516d..ed2029db391f 100644
--- a/arch/arm/mach-spear/spear310.c
+++ b/arch/arm/mach-spear/spear310.c
@@ -15,7 +15,6 @@
15 15
16#include <linux/amba/pl08x.h> 16#include <linux/amba/pl08x.h>
17#include <linux/amba/serial.h> 17#include <linux/amba/serial.h>
18#include <linux/irqchip.h>
19#include <linux/of_platform.h> 18#include <linux/of_platform.h>
20#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
21#include "generic.h" 20#include "generic.h"
@@ -254,7 +253,6 @@ static void __init spear310_map_io(void)
254 253
255DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree") 254DT_MACHINE_START(SPEAR310_DT, "ST SPEAr310 SoC with Flattened Device Tree")
256 .map_io = spear310_map_io, 255 .map_io = spear310_map_io,
257 .init_irq = irqchip_init,
258 .init_time = spear3xx_timer_init, 256 .init_time = spear3xx_timer_init,
259 .init_machine = spear310_dt_init, 257 .init_machine = spear310_dt_init,
260 .restart = spear_restart, 258 .restart = spear_restart,
diff --git a/arch/arm/mach-spear/spear320.c b/arch/arm/mach-spear/spear320.c
index 6eb3eec65f96..bf634b32a930 100644
--- a/arch/arm/mach-spear/spear320.c
+++ b/arch/arm/mach-spear/spear320.c
@@ -16,7 +16,6 @@
16#include <linux/amba/pl022.h> 16#include <linux/amba/pl022.h>
17#include <linux/amba/pl08x.h> 17#include <linux/amba/pl08x.h>
18#include <linux/amba/serial.h> 18#include <linux/amba/serial.h>
19#include <linux/irqchip.h>
20#include <linux/of_platform.h> 19#include <linux/of_platform.h>
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22#include <asm/mach/map.h> 21#include <asm/mach/map.h>
@@ -269,7 +268,6 @@ static void __init spear320_map_io(void)
269 268
270DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree") 269DT_MACHINE_START(SPEAR320_DT, "ST SPEAr320 SoC with Flattened Device Tree")
271 .map_io = spear320_map_io, 270 .map_io = spear320_map_io,
272 .init_irq = irqchip_init,
273 .init_time = spear3xx_timer_init, 271 .init_time = spear3xx_timer_init,
274 .init_machine = spear320_dt_init, 272 .init_machine = spear320_dt_init,
275 .restart = spear_restart, 273 .restart = spear_restart,
diff --git a/arch/arm/mach-spear/spear6xx.c b/arch/arm/mach-spear/spear6xx.c
index ec8eefbbdfad..8b0295a41226 100644
--- a/arch/arm/mach-spear/spear6xx.c
+++ b/arch/arm/mach-spear/spear6xx.c
@@ -16,7 +16,6 @@
16#include <linux/amba/pl08x.h> 16#include <linux/amba/pl08x.h>
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/irqchip.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/of_address.h> 20#include <linux/of_address.h>
22#include <linux/of_platform.h> 21#include <linux/of_platform.h>
@@ -423,7 +422,6 @@ static const char *spear600_dt_board_compat[] = {
423 422
424DT_MACHINE_START(SPEAR600_DT, "ST SPEAr600 (Flattened Device Tree)") 423DT_MACHINE_START(SPEAR600_DT, "ST SPEAr600 (Flattened Device Tree)")
425 .map_io = spear6xx_map_io, 424 .map_io = spear6xx_map_io,
426 .init_irq = irqchip_init,
427 .init_time = spear6xx_timer_init, 425 .init_time = spear6xx_timer_init,
428 .init_machine = spear600_dt_init, 426 .init_machine = spear600_dt_init,
429 .restart = spear_restart, 427 .restart = spear_restart,
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
new file mode 100644
index 000000000000..d04e3bfe1918
--- /dev/null
+++ b/arch/arm/mach-sti/Kconfig
@@ -0,0 +1,45 @@
1menuconfig ARCH_STI
2 bool "STMicroelectronics Consumer Electronics SOCs with Device Trees" if ARCH_MULTI_V7
3 select GENERIC_CLOCKEVENTS
4 select CLKDEV_LOOKUP
5 select ARM_GIC
6 select ARM_GLOBAL_TIMER
7 select PINCTRL
8 select PINCTRL_ST
9 select MFD_SYSCON
10 select MIGHT_HAVE_CACHE_L2X0
11 select HAVE_SMP
12 select HAVE_ARM_SCU if SMP
13 select ARCH_REQUIRE_GPIOLIB
14 select ARM_ERRATA_720789
15 select ARM_ERRATA_754322
16 select PL310_ERRATA_753970 if CACHE_PL310
17 select PL310_ERRATA_769419 if CACHE_PL310
18 help
19 Include support for STiH41x SOCs like STiH415/416 using the device tree
20 for discovery
21 More information at Documentation/arm/STiH41x and
22 at Documentation/devicetree
23
24
25if ARCH_STI
26
27config SOC_STIH415
28 bool "STiH415 STMicroelectronics Consumer Electronics family"
29 default y
30 help
31 This enables support for STMicroelectronics Digital Consumer
32 Electronics family StiH415 parts, primarily targetted at set-top-box
33 and other digital audio/video applications using Flattned Device
34 Trees.
35
36config SOC_STIH416
37 bool "STiH416 STMicroelectronics Consumer Electronics family"
38 default y
39 help
40 This enables support for STMicroelectronics Digital Consumer
41 Electronics family StiH416 parts, primarily targetted at set-top-box
42 and other digital audio/video applications using Flattened Device
43 Trees.
44
45endif
diff --git a/arch/arm/mach-sti/Makefile b/arch/arm/mach-sti/Makefile
new file mode 100644
index 000000000000..acb330916333
--- /dev/null
+++ b/arch/arm/mach-sti/Makefile
@@ -0,0 +1,2 @@
1obj-$(CONFIG_SMP) += platsmp.o headsmp.o
2obj-$(CONFIG_ARCH_STI) += board-dt.o
diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
new file mode 100644
index 000000000000..8fe6f0c46480
--- /dev/null
+++ b/arch/arm/mach-sti/board-dt.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author(s): Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/clk-provider.h>
11#include <linux/clocksource.h>
12#include <linux/irq.h>
13#include <asm/hardware/cache-l2x0.h>
14#include <asm/mach/arch.h>
15
16#include "smp.h"
17
18void __init stih41x_l2x0_init(void)
19{
20 u32 way_size = 0x4;
21 u32 aux_ctrl;
22 /* may be this can be encoded in macros like BIT*() */
23 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) |
24 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) |
25 (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) |
26 (way_size << L2X0_AUX_CTRL_WAY_SIZE_SHIFT);
27
28 l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
29}
30
31static void __init stih41x_timer_init(void)
32{
33 of_clk_init(NULL);
34 clocksource_of_init();
35 stih41x_l2x0_init();
36}
37
38static const char *stih41x_dt_match[] __initdata = {
39 "st,stih415",
40 "st,stih416",
41 NULL
42};
43
44DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree")
45 .init_time = stih41x_timer_init,
46 .smp = smp_ops(sti_smp_ops),
47 .dt_compat = stih41x_dt_match,
48MACHINE_END
diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S
new file mode 100644
index 000000000000..78ebc7559f53
--- /dev/null
+++ b/arch/arm/mach-sti/headsmp.S
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-sti/headsmp.S
3 *
4 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5 * http://www.st.com
6 *
7 * Cloned from linux/arch/arm/mach-vexpress/headsmp.S
8 *
9 * Copyright (c) 2003 ARM Limited
10 * All Rights Reserved
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#include <linux/linkage.h>
17#include <linux/init.h>
18
19 __INIT
20
21/*
22 * ST specific entry point for secondary CPUs. This provides
23 * a "holding pen" into which all secondary cores are held until we're
24 * ready for them to initialise.
25 */
26ENTRY(sti_secondary_startup)
27 mrc p15, 0, r0, c0, c0, 5
28 and r0, r0, #15
29 adr r4, 1f
30 ldmia r4, {r5, r6}
31 sub r4, r4, r5
32 add r6, r6, r4
33pen: ldr r7, [r6]
34 cmp r7, r0
35 bne pen
36
37 /*
38 * we've been released from the holding pen: secondary_stack
39 * should now contain the SVC stack for this core
40 */
41 b secondary_startup
42
431: .long .
44 .long pen_release
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
new file mode 100644
index 000000000000..977a863468fc
--- /dev/null
+++ b/arch/arm/mach-sti/platsmp.c
@@ -0,0 +1,117 @@
1/*
2 * arch/arm/mach-sti/platsmp.c
3 *
4 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5 * http://www.st.com
6 *
7 * Cloned from linux/arch/arm/mach-vexpress/platsmp.c
8 *
9 * Copyright (C) 2002 ARM Ltd.
10 * All Rights Reserved
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#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/delay.h>
19#include <linux/smp.h>
20#include <linux/io.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23
24#include <asm/cacheflush.h>
25#include <asm/smp_plat.h>
26#include <asm/smp_scu.h>
27
28#include "smp.h"
29
30static void __cpuinit write_pen_release(int val)
31{
32 pen_release = val;
33 smp_wmb();
34 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
35 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
36}
37
38static DEFINE_SPINLOCK(boot_lock);
39
40void __cpuinit sti_secondary_init(unsigned int cpu)
41{
42 trace_hardirqs_off();
43
44 /*
45 * let the primary processor know we're out of the
46 * pen, then head off into the C entry point
47 */
48 write_pen_release(-1);
49
50 /*
51 * Synchronise with the boot thread.
52 */
53 spin_lock(&boot_lock);
54 spin_unlock(&boot_lock);
55}
56
57int __cpuinit sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
58{
59 unsigned long timeout;
60
61 /*
62 * set synchronisation state between this boot processor
63 * and the secondary one
64 */
65 spin_lock(&boot_lock);
66
67 /*
68 * The secondary processor is waiting to be released from
69 * the holding pen - release it, then wait for it to flag
70 * that it has been released by resetting pen_release.
71 *
72 * Note that "pen_release" is the hardware CPU ID, whereas
73 * "cpu" is Linux's internal ID.
74 */
75 write_pen_release(cpu_logical_map(cpu));
76
77 /*
78 * Send the secondary CPU a soft interrupt, thereby causing
79 * it to jump to the secondary entrypoint.
80 */
81 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
82
83 timeout = jiffies + (1 * HZ);
84 while (time_before(jiffies, timeout)) {
85 smp_rmb();
86 if (pen_release == -1)
87 break;
88
89 udelay(10);
90 }
91
92 /*
93 * now the secondary core is starting up let it run its
94 * calibrations, then wait for it to finish
95 */
96 spin_unlock(&boot_lock);
97
98 return pen_release != -1 ? -ENOSYS : 0;
99}
100
101void __init sti_smp_prepare_cpus(unsigned int max_cpus)
102{
103 void __iomem *scu_base = NULL;
104 struct device_node *np = of_find_compatible_node(
105 NULL, NULL, "arm,cortex-a9-scu");
106 if (np) {
107 scu_base = of_iomap(np, 0);
108 scu_enable(scu_base);
109 of_node_put(np);
110 }
111}
112
113struct smp_operations __initdata sti_smp_ops = {
114 .smp_prepare_cpus = sti_smp_prepare_cpus,
115 .smp_secondary_init = sti_secondary_init,
116 .smp_boot_secondary = sti_boot_secondary,
117};
diff --git a/arch/arm/mach-sti/smp.h b/arch/arm/mach-sti/smp.h
new file mode 100644
index 000000000000..1871b72b1a7e
--- /dev/null
+++ b/arch/arm/mach-sti/smp.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-sti/smp.h
3 *
4 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5 * http://www.st.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __MACH_STI_SMP_H
13#define __MACH_STI_SMP_H
14
15extern struct smp_operations sti_smp_ops;
16
17#endif
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 706ce35396b8..84485a10fc3a 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -14,7 +14,6 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/irqchip.h>
18#include <linux/of_address.h> 17#include <linux/of_address.h>
19#include <linux/of_irq.h> 18#include <linux/of_irq.h>
20#include <linux/of_platform.h> 19#include <linux/of_platform.h>
@@ -26,8 +25,6 @@
26#include <asm/mach/map.h> 25#include <asm/mach/map.h>
27#include <asm/system_misc.h> 26#include <asm/system_misc.h>
28 27
29#include "sunxi.h"
30
31#define SUN4I_WATCHDOG_CTRL_REG 0x00 28#define SUN4I_WATCHDOG_CTRL_REG 0x00
32#define SUN4I_WATCHDOG_CTRL_RESTART (1 << 0) 29#define SUN4I_WATCHDOG_CTRL_RESTART (1 << 0)
33#define SUN4I_WATCHDOG_MODE_REG 0x04 30#define SUN4I_WATCHDOG_MODE_REG 0x04
@@ -81,20 +78,6 @@ static void sunxi_setup_restart(void)
81 arm_pm_restart = of_id->data; 78 arm_pm_restart = of_id->data;
82} 79}
83 80
84static struct map_desc sunxi_io_desc[] __initdata = {
85 {
86 .virtual = (unsigned long) SUNXI_REGS_VIRT_BASE,
87 .pfn = __phys_to_pfn(SUNXI_REGS_PHYS_BASE),
88 .length = SUNXI_REGS_SIZE,
89 .type = MT_DEVICE,
90 },
91};
92
93void __init sunxi_map_io(void)
94{
95 iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc));
96}
97
98static void __init sunxi_timer_init(void) 81static void __init sunxi_timer_init(void)
99{ 82{
100 sunxi_init_clocks(); 83 sunxi_init_clocks();
@@ -110,14 +93,13 @@ static void __init sunxi_dt_init(void)
110 93
111static const char * const sunxi_board_dt_compat[] = { 94static const char * const sunxi_board_dt_compat[] = {
112 "allwinner,sun4i-a10", 95 "allwinner,sun4i-a10",
96 "allwinner,sun5i-a10s",
113 "allwinner,sun5i-a13", 97 "allwinner,sun5i-a13",
114 NULL, 98 NULL,
115}; 99};
116 100
117DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)") 101DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
118 .init_machine = sunxi_dt_init, 102 .init_machine = sunxi_dt_init,
119 .map_io = sunxi_map_io,
120 .init_irq = irqchip_init,
121 .init_time = sunxi_timer_init, 103 .init_time = sunxi_timer_init,
122 .dt_compat = sunxi_board_dt_compat, 104 .dt_compat = sunxi_board_dt_compat,
123MACHINE_END 105MACHINE_END
diff --git a/arch/arm/mach-sunxi/sunxi.h b/arch/arm/mach-sunxi/sunxi.h
deleted file mode 100644
index 33b58712adea..000000000000
--- a/arch/arm/mach-sunxi/sunxi.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Generic definitions for Allwinner SunXi SoCs
3 *
4 * Copyright (C) 2012 Maxime Ripard
5 *
6 * Maxime Ripard <maxime.ripard@free-electrons.com>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#ifndef __MACH_SUNXI_H
14#define __MACH_SUNXI_H
15
16#define SUNXI_REGS_PHYS_BASE 0x01c00000
17#define SUNXI_REGS_VIRT_BASE IOMEM(0xf1c00000)
18#define SUNXI_REGS_SIZE (SZ_2M + SZ_1M)
19
20#endif /* __MACH_SUNXI_H */
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 84d72fc36dfe..ef3a8da49b2d 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -28,7 +28,6 @@ config ARCH_TEGRA_2x_SOC
28 select ARM_ERRATA_754327 if SMP 28 select ARM_ERRATA_754327 if SMP
29 select ARM_ERRATA_764369 if SMP 29 select ARM_ERRATA_764369 if SMP
30 select ARM_GIC 30 select ARM_GIC
31 select CPU_FREQ_TABLE if CPU_FREQ
32 select CPU_V7 31 select CPU_V7
33 select PINCTRL 32 select PINCTRL
34 select PINCTRL_TEGRA20 33 select PINCTRL_TEGRA20
@@ -46,7 +45,6 @@ config ARCH_TEGRA_3x_SOC
46 select ARM_ERRATA_754322 45 select ARM_ERRATA_754322
47 select ARM_ERRATA_764369 if SMP 46 select ARM_ERRATA_764369 if SMP
48 select ARM_GIC 47 select ARM_GIC
49 select CPU_FREQ_TABLE if CPU_FREQ
50 select CPU_V7 48 select CPU_V7
51 select PINCTRL 49 select PINCTRL
52 select PINCTRL_TEGRA30 50 select PINCTRL_TEGRA30
@@ -60,10 +58,9 @@ config ARCH_TEGRA_3x_SOC
60 58
61config ARCH_TEGRA_114_SOC 59config ARCH_TEGRA_114_SOC
62 bool "Enable support for Tegra114 family" 60 bool "Enable support for Tegra114 family"
63 select ARM_ARCH_TIMER 61 select HAVE_ARM_ARCH_TIMER
64 select ARM_GIC 62 select ARM_GIC
65 select ARM_L1_CACHE_SHIFT_6 63 select ARM_L1_CACHE_SHIFT_6
66 select CPU_FREQ_TABLE if CPU_FREQ
67 select CPU_V7 64 select CPU_V7
68 select PINCTRL 65 select PINCTRL
69 select PINCTRL_TEGRA114 66 select PINCTRL_TEGRA114
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index d011f0ad49c4..98b184efc110 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
30obj-$(CONFIG_TEGRA_PCI) += pcie.o 30obj-$(CONFIG_TEGRA_PCI) += pcie.o
31 31
32obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o 32obj-$(CONFIG_ARCH_TEGRA_114_SOC) += tegra114_speedo.o
33obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o
33ifeq ($(CONFIG_CPU_IDLE),y) 34ifeq ($(CONFIG_CPU_IDLE),y)
34obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o 35obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o
35endif 36endif
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 9f852c6fe5b9..b25153e2ebaa 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -23,12 +23,13 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/irqchip.h> 25#include <linux/irqchip.h>
26#include <linux/clk/tegra.h> 26#include <linux/clk-provider.h>
27 27
28#include <asm/hardware/cache-l2x0.h> 28#include <asm/hardware/cache-l2x0.h>
29 29
30#include "board.h" 30#include "board.h"
31#include "common.h" 31#include "common.h"
32#include "cpuidle.h"
32#include "fuse.h" 33#include "fuse.h"
33#include "iomap.h" 34#include "iomap.h"
34#include "irq.h" 35#include "irq.h"
@@ -59,7 +60,7 @@ u32 tegra_uart_config[4] = {
59#ifdef CONFIG_OF 60#ifdef CONFIG_OF
60void __init tegra_dt_init_irq(void) 61void __init tegra_dt_init_irq(void)
61{ 62{
62 tegra_clocks_init(); 63 of_clk_init(NULL);
63 tegra_pmc_init(); 64 tegra_pmc_init();
64 tegra_init_irq(); 65 tegra_init_irq();
65 irqchip_init(); 66 irqchip_init();
@@ -108,5 +109,6 @@ void __init tegra_init_early(void)
108void __init tegra_init_late(void) 109void __init tegra_init_late(void)
109{ 110{
110 tegra_init_suspend(); 111 tegra_init_suspend();
112 tegra_cpuidle_init();
111 tegra_powergate_debugfs_init(); 113 tegra_powergate_debugfs_init();
112} 114}
diff --git a/arch/arm/mach-tegra/common.h b/arch/arm/mach-tegra/common.h
index 5900cc44f780..32f8eb3fe344 100644
--- a/arch/arm/mach-tegra/common.h
+++ b/arch/arm/mach-tegra/common.h
@@ -2,3 +2,4 @@ extern struct smp_operations tegra_smp_ops;
2 2
3extern int tegra_cpu_kill(unsigned int cpu); 3extern int tegra_cpu_kill(unsigned int cpu);
4extern void tegra_cpu_die(unsigned int cpu); 4extern void tegra_cpu_die(unsigned int cpu);
5extern int tegra_cpu_disable(unsigned int cpu);
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
index 0cdba8de8c77..706aa4215c36 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
@@ -177,7 +177,6 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
177 struct cpuidle_driver *drv, 177 struct cpuidle_driver *drv,
178 int index) 178 int index)
179{ 179{
180 u32 cpu = is_smp() ? cpu_logical_map(dev->cpu) : dev->cpu;
181 bool entered_lp2 = false; 180 bool entered_lp2 = false;
182 181
183 if (tegra_pending_sgi()) 182 if (tegra_pending_sgi())
@@ -193,16 +192,16 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
193 192
194 local_fiq_disable(); 193 local_fiq_disable();
195 194
196 tegra_set_cpu_in_lp2(cpu); 195 tegra_set_cpu_in_lp2();
197 cpu_pm_enter(); 196 cpu_pm_enter();
198 197
199 if (cpu == 0) 198 if (dev->cpu == 0)
200 entered_lp2 = tegra20_cpu_cluster_power_down(dev, drv, index); 199 entered_lp2 = tegra20_cpu_cluster_power_down(dev, drv, index);
201 else 200 else
202 entered_lp2 = tegra20_idle_enter_lp2_cpu_1(dev, drv, index); 201 entered_lp2 = tegra20_idle_enter_lp2_cpu_1(dev, drv, index);
203 202
204 cpu_pm_exit(); 203 cpu_pm_exit();
205 tegra_clear_cpu_in_lp2(cpu); 204 tegra_clear_cpu_in_lp2();
206 205
207 local_fiq_enable(); 206 local_fiq_enable();
208 207
@@ -214,8 +213,5 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
214 213
215int __init tegra20_cpuidle_init(void) 214int __init tegra20_cpuidle_init(void)
216{ 215{
217#ifdef CONFIG_PM_SLEEP
218 tegra_tear_down_cpu = tegra20_tear_down_cpu;
219#endif
220 return cpuidle_register(&tegra_idle_driver, cpu_possible_mask); 216 return cpuidle_register(&tegra_idle_driver, cpu_possible_mask);
221} 217}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
index 3cf9aca5f3ea..ed2a2a7bae4d 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra30.c
@@ -114,16 +114,15 @@ static int tegra30_idle_lp2(struct cpuidle_device *dev,
114 struct cpuidle_driver *drv, 114 struct cpuidle_driver *drv,
115 int index) 115 int index)
116{ 116{
117 u32 cpu = is_smp() ? cpu_logical_map(dev->cpu) : dev->cpu;
118 bool entered_lp2 = false; 117 bool entered_lp2 = false;
119 bool last_cpu; 118 bool last_cpu;
120 119
121 local_fiq_disable(); 120 local_fiq_disable();
122 121
123 last_cpu = tegra_set_cpu_in_lp2(cpu); 122 last_cpu = tegra_set_cpu_in_lp2();
124 cpu_pm_enter(); 123 cpu_pm_enter();
125 124
126 if (cpu == 0) { 125 if (dev->cpu == 0) {
127 if (last_cpu) 126 if (last_cpu)
128 entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv, 127 entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv,
129 index); 128 index);
@@ -134,7 +133,7 @@ static int tegra30_idle_lp2(struct cpuidle_device *dev,
134 } 133 }
135 134
136 cpu_pm_exit(); 135 cpu_pm_exit();
137 tegra_clear_cpu_in_lp2(cpu); 136 tegra_clear_cpu_in_lp2();
138 137
139 local_fiq_enable(); 138 local_fiq_enable();
140 139
@@ -146,8 +145,5 @@ static int tegra30_idle_lp2(struct cpuidle_device *dev,
146 145
147int __init tegra30_cpuidle_init(void) 146int __init tegra30_cpuidle_init(void)
148{ 147{
149#ifdef CONFIG_PM_SLEEP
150 tegra_tear_down_cpu = tegra30_tear_down_cpu;
151#endif
152 return cpuidle_register(&tegra_idle_driver, NULL); 148 return cpuidle_register(&tegra_idle_driver, NULL);
153} 149}
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
index 4b744c4661e2..e85973cef037 100644
--- a/arch/arm/mach-tegra/cpuidle.c
+++ b/arch/arm/mach-tegra/cpuidle.c
@@ -27,25 +27,20 @@
27#include "fuse.h" 27#include "fuse.h"
28#include "cpuidle.h" 28#include "cpuidle.h"
29 29
30static int __init tegra_cpuidle_init(void) 30void __init tegra_cpuidle_init(void)
31{ 31{
32 int ret;
33
34 switch (tegra_chip_id) { 32 switch (tegra_chip_id) {
35 case TEGRA20: 33 case TEGRA20:
36 ret = tegra20_cpuidle_init(); 34 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
35 tegra20_cpuidle_init();
37 break; 36 break;
38 case TEGRA30: 37 case TEGRA30:
39 ret = tegra30_cpuidle_init(); 38 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC))
39 tegra30_cpuidle_init();
40 break; 40 break;
41 case TEGRA114: 41 case TEGRA114:
42 ret = tegra114_cpuidle_init(); 42 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC))
43 break; 43 tegra114_cpuidle_init();
44 default:
45 ret = -ENODEV;
46 break; 44 break;
47 } 45 }
48
49 return ret;
50} 46}
51device_initcall(tegra_cpuidle_init);
diff --git a/arch/arm/mach-tegra/cpuidle.h b/arch/arm/mach-tegra/cpuidle.h
index d733f75d0208..9ec2c1ab0fa4 100644
--- a/arch/arm/mach-tegra/cpuidle.h
+++ b/arch/arm/mach-tegra/cpuidle.h
@@ -17,22 +17,13 @@
17#ifndef __MACH_TEGRA_CPUIDLE_H 17#ifndef __MACH_TEGRA_CPUIDLE_H
18#define __MACH_TEGRA_CPUIDLE_H 18#define __MACH_TEGRA_CPUIDLE_H
19 19
20#ifdef CONFIG_ARCH_TEGRA_2x_SOC 20#ifdef CONFIG_CPU_IDLE
21int tegra20_cpuidle_init(void); 21int tegra20_cpuidle_init(void);
22#else
23static inline int tegra20_cpuidle_init(void) { return -ENODEV; }
24#endif
25
26#ifdef CONFIG_ARCH_TEGRA_3x_SOC
27int tegra30_cpuidle_init(void); 22int tegra30_cpuidle_init(void);
28#else
29static inline int tegra30_cpuidle_init(void) { return -ENODEV; }
30#endif
31
32#ifdef CONFIG_ARCH_TEGRA_114_SOC
33int tegra114_cpuidle_init(void); 23int tegra114_cpuidle_init(void);
24void tegra_cpuidle_init(void);
34#else 25#else
35static inline int tegra114_cpuidle_init(void) { return -ENODEV; } 26static inline void tegra_cpuidle_init(void) {}
36#endif 27#endif
37 28
38#endif 29#endif
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
index 67eab56699bd..7a29bae799a7 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -25,6 +25,7 @@
25#define FLOW_CTRL_WAITEVENT (2 << 29) 25#define FLOW_CTRL_WAITEVENT (2 << 29)
26#define FLOW_CTRL_WAIT_FOR_INTERRUPT (4 << 29) 26#define FLOW_CTRL_WAIT_FOR_INTERRUPT (4 << 29)
27#define FLOW_CTRL_JTAG_RESUME (1 << 28) 27#define FLOW_CTRL_JTAG_RESUME (1 << 28)
28#define FLOW_CTRL_SCLK_RESUME (1 << 27)
28#define FLOW_CTRL_HALT_CPU_IRQ (1 << 10) 29#define FLOW_CTRL_HALT_CPU_IRQ (1 << 10)
29#define FLOW_CTRL_HALT_CPU_FIQ (1 << 8) 30#define FLOW_CTRL_HALT_CPU_FIQ (1 << 8)
30#define FLOW_CTRL_CPU0_CSR 0x8 31#define FLOW_CTRL_CPU0_CSR 0x8
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index aacc00d05980..def79683bef6 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -19,16 +19,6 @@
19#ifndef __MACH_TEGRA_FUSE_H 19#ifndef __MACH_TEGRA_FUSE_H
20#define __MACH_TEGRA_FUSE_H 20#define __MACH_TEGRA_FUSE_H
21 21
22enum tegra_revision {
23 TEGRA_REVISION_UNKNOWN = 0,
24 TEGRA_REVISION_A01,
25 TEGRA_REVISION_A02,
26 TEGRA_REVISION_A03,
27 TEGRA_REVISION_A03p,
28 TEGRA_REVISION_A04,
29 TEGRA_REVISION_MAX,
30};
31
32#define SKU_ID_T20 8 22#define SKU_ID_T20 8
33#define SKU_ID_T25SE 20 23#define SKU_ID_T25SE 20
34#define SKU_ID_AP25 23 24#define SKU_ID_AP25 23
@@ -40,6 +30,17 @@ enum tegra_revision {
40#define TEGRA30 0x30 30#define TEGRA30 0x30
41#define TEGRA114 0x35 31#define TEGRA114 0x35
42 32
33#ifndef __ASSEMBLY__
34enum tegra_revision {
35 TEGRA_REVISION_UNKNOWN = 0,
36 TEGRA_REVISION_A01,
37 TEGRA_REVISION_A02,
38 TEGRA_REVISION_A03,
39 TEGRA_REVISION_A03p,
40 TEGRA_REVISION_A04,
41 TEGRA_REVISION_MAX,
42};
43
43extern int tegra_sku_id; 44extern int tegra_sku_id;
44extern int tegra_cpu_process_id; 45extern int tegra_cpu_process_id;
45extern int tegra_core_process_id; 46extern int tegra_core_process_id;
@@ -72,5 +73,6 @@ void tegra114_init_speedo_data(void);
72#else 73#else
73static inline void tegra114_init_speedo_data(void) {} 74static inline void tegra114_init_speedo_data(void) {}
74#endif 75#endif
76#endif /* __ASSEMBLY__ */
75 77
76#endif 78#endif
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index 184914a68d73..a52c10e0a857 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -46,6 +46,17 @@ void __ref tegra_cpu_die(unsigned int cpu)
46 BUG(); 46 BUG();
47} 47}
48 48
49int tegra_cpu_disable(unsigned int cpu)
50{
51 switch (tegra_chip_id) {
52 case TEGRA20:
53 case TEGRA30:
54 return cpu == 0 ? -EPERM : 0;
55 default:
56 return 0;
57 }
58}
59
49void __init tegra_hotplug_init(void) 60void __init tegra_hotplug_init(void)
50{ 61{
51 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) 62 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
@@ -55,4 +66,6 @@ void __init tegra_hotplug_init(void)
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_chip_id == TEGRA30)
57 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 68 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
69 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114)
70 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
58} 71}
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index fad4226ef710..24db4ac428ae 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -140,8 +140,31 @@ remove_clamps:
140 140
141static int tegra114_boot_secondary(unsigned int cpu, struct task_struct *idle) 141static int tegra114_boot_secondary(unsigned int cpu, struct task_struct *idle)
142{ 142{
143 int ret = 0;
144
143 cpu = cpu_logical_map(cpu); 145 cpu = cpu_logical_map(cpu);
144 return tegra_pmc_cpu_power_on(cpu); 146
147 if (cpumask_test_cpu(cpu, &tegra_cpu_init_mask)) {
148 /*
149 * Warm boot flow
150 * The flow controller in charge of the power state and
151 * control for each CPU.
152 */
153 /* set SCLK as event trigger for flow controller */
154 flowctrl_write_cpu_csr(cpu, 1);
155 flowctrl_write_cpu_halt(cpu,
156 FLOW_CTRL_WAITEVENT | FLOW_CTRL_SCLK_RESUME);
157 } else {
158 /*
159 * Cold boot flow
160 * The CPU is powered up by toggling PMC directly. It will
161 * also initial power state in flow controller. After that,
162 * the CPU's power state is maintained by flow controller.
163 */
164 ret = tegra_pmc_cpu_power_on(cpu);
165 }
166
167 return ret;
145} 168}
146 169
147static int __cpuinit tegra_boot_secondary(unsigned int cpu, 170static int __cpuinit tegra_boot_secondary(unsigned int cpu,
@@ -173,5 +196,6 @@ struct smp_operations tegra_smp_ops __initdata = {
173#ifdef CONFIG_HOTPLUG_CPU 196#ifdef CONFIG_HOTPLUG_CPU
174 .cpu_kill = tegra_cpu_kill, 197 .cpu_kill = tegra_cpu_kill,
175 .cpu_die = tegra_cpu_die, 198 .cpu_die = tegra_cpu_die,
199 .cpu_disable = tegra_cpu_disable,
176#endif 200#endif
177}; 201};
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 45cf52c7e528..94e69bee3da5 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -44,6 +44,20 @@
44static DEFINE_SPINLOCK(tegra_lp2_lock); 44static DEFINE_SPINLOCK(tegra_lp2_lock);
45void (*tegra_tear_down_cpu)(void); 45void (*tegra_tear_down_cpu)(void);
46 46
47static void tegra_tear_down_cpu_init(void)
48{
49 switch (tegra_chip_id) {
50 case TEGRA20:
51 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
52 tegra_tear_down_cpu = tegra20_tear_down_cpu;
53 break;
54 case TEGRA30:
55 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC))
56 tegra_tear_down_cpu = tegra30_tear_down_cpu;
57 break;
58 }
59}
60
47/* 61/*
48 * restore_cpu_complex 62 * restore_cpu_complex
49 * 63 *
@@ -91,8 +105,9 @@ static void suspend_cpu_complex(void)
91 flowctrl_cpu_suspend_enter(cpu); 105 flowctrl_cpu_suspend_enter(cpu);
92} 106}
93 107
94void tegra_clear_cpu_in_lp2(int phy_cpu_id) 108void tegra_clear_cpu_in_lp2(void)
95{ 109{
110 int phy_cpu_id = cpu_logical_map(smp_processor_id());
96 u32 *cpu_in_lp2 = tegra_cpu_lp2_mask; 111 u32 *cpu_in_lp2 = tegra_cpu_lp2_mask;
97 112
98 spin_lock(&tegra_lp2_lock); 113 spin_lock(&tegra_lp2_lock);
@@ -103,8 +118,9 @@ void tegra_clear_cpu_in_lp2(int phy_cpu_id)
103 spin_unlock(&tegra_lp2_lock); 118 spin_unlock(&tegra_lp2_lock);
104} 119}
105 120
106bool tegra_set_cpu_in_lp2(int phy_cpu_id) 121bool tegra_set_cpu_in_lp2(void)
107{ 122{
123 int phy_cpu_id = cpu_logical_map(smp_processor_id());
108 bool last_cpu = false; 124 bool last_cpu = false;
109 cpumask_t *cpu_lp2_mask = tegra_cpu_lp2_mask; 125 cpumask_t *cpu_lp2_mask = tegra_cpu_lp2_mask;
110 u32 *cpu_in_lp2 = tegra_cpu_lp2_mask; 126 u32 *cpu_in_lp2 = tegra_cpu_lp2_mask;
@@ -192,7 +208,7 @@ static int __cpuinit tegra_suspend_enter(suspend_state_t state)
192 suspend_cpu_complex(); 208 suspend_cpu_complex();
193 switch (mode) { 209 switch (mode) {
194 case TEGRA_SUSPEND_LP2: 210 case TEGRA_SUSPEND_LP2:
195 tegra_set_cpu_in_lp2(0); 211 tegra_set_cpu_in_lp2();
196 break; 212 break;
197 default: 213 default:
198 break; 214 break;
@@ -202,7 +218,7 @@ static int __cpuinit tegra_suspend_enter(suspend_state_t state)
202 218
203 switch (mode) { 219 switch (mode) {
204 case TEGRA_SUSPEND_LP2: 220 case TEGRA_SUSPEND_LP2:
205 tegra_clear_cpu_in_lp2(0); 221 tegra_clear_cpu_in_lp2();
206 break; 222 break;
207 default: 223 default:
208 break; 224 break;
@@ -224,6 +240,7 @@ void __init tegra_init_suspend(void)
224 if (tegra_pmc_get_suspend_mode() == TEGRA_SUSPEND_NONE) 240 if (tegra_pmc_get_suspend_mode() == TEGRA_SUSPEND_NONE)
225 return; 241 return;
226 242
243 tegra_tear_down_cpu_init();
227 tegra_pmc_suspend_init(); 244 tegra_pmc_suspend_init();
228 245
229 suspend_set_ops(&tegra_suspend_ops); 246 suspend_set_ops(&tegra_suspend_ops);
diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h
index 778a4aa7c3fa..94c4b9d9077c 100644
--- a/arch/arm/mach-tegra/pm.h
+++ b/arch/arm/mach-tegra/pm.h
@@ -28,8 +28,8 @@ extern unsigned long l2x0_saved_regs_addr;
28void save_cpu_arch_register(void); 28void save_cpu_arch_register(void);
29void restore_cpu_arch_register(void); 29void restore_cpu_arch_register(void);
30 30
31void tegra_clear_cpu_in_lp2(int phy_cpu_id); 31void tegra_clear_cpu_in_lp2(void);
32bool tegra_set_cpu_in_lp2(int phy_cpu_id); 32bool tegra_set_cpu_in_lp2(void);
33 33
34void tegra_idle_lp2_last(void); 34void tegra_idle_lp2_last(void);
35extern void (*tegra_tear_down_cpu)(void); 35extern void (*tegra_tear_down_cpu)(void);
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 32360e540ce6..eb3fa4aee0e4 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -234,7 +234,7 @@ static const struct of_device_id matches[] __initconst = {
234 { } 234 { }
235}; 235};
236 236
237static void tegra_pmc_parse_dt(void) 237static void __init tegra_pmc_parse_dt(void)
238{ 238{
239 struct device_node *np; 239 struct device_node *np;
240 u32 prop; 240 u32 prop;
diff --git a/arch/arm/mach-tegra/reset-handler.S b/arch/arm/mach-tegra/reset-handler.S
index e6de88a2ea06..39dc9e7834f3 100644
--- a/arch/arm/mach-tegra/reset-handler.S
+++ b/arch/arm/mach-tegra/reset-handler.S
@@ -22,11 +22,11 @@
22#include <asm/hardware/cache-l2x0.h> 22#include <asm/hardware/cache-l2x0.h>
23 23
24#include "flowctrl.h" 24#include "flowctrl.h"
25#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"
28 29
29#define APB_MISC_GP_HIDREV 0x804
30#define PMC_SCRATCH41 0x140 30#define PMC_SCRATCH41 0x140
31 31
32#define RESET_DATA(x) ((TEGRA_RESET_##x)*4) 32#define RESET_DATA(x) ((TEGRA_RESET_##x)*4)
@@ -38,34 +38,40 @@
38 * CPU boot vector when restarting the a CPU following 38 * CPU boot vector when restarting the a CPU following
39 * an LP2 transition. Also branched to by LP0 and LP1 resume after 39 * an LP2 transition. Also branched to by LP0 and LP1 resume after
40 * re-enabling sdram. 40 * re-enabling sdram.
41 *
42 * r6: SoC ID
41 */ 43 */
42ENTRY(tegra_resume) 44ENTRY(tegra_resume)
43 bl v7_invalidate_l1 45 bl v7_invalidate_l1
44 46
45 cpu_id r0 47 cpu_id r0
48 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
49 cmp r6, #TEGRA114
50 beq no_cpu0_chk
51
46 cmp r0, #0 @ CPU0? 52 cmp r0, #0 @ CPU0?
47 THUMB( it ne ) 53 THUMB( it ne )
48 bne cpu_resume @ no 54 bne cpu_resume @ no
55no_cpu0_chk:
49 56
50#ifdef CONFIG_ARCH_TEGRA_3x_SOC
51 /* Are we on Tegra20? */ 57 /* Are we on Tegra20? */
52 mov32 r6, TEGRA_APB_MISC_BASE 58 cmp r6, #TEGRA20
53 ldr r0, [r6, #APB_MISC_GP_HIDREV]
54 and r0, r0, #0xff00
55 cmp r0, #(0x20 << 8)
56 beq 1f @ Yes 59 beq 1f @ Yes
57 /* Clear the flow controller flags for this CPU. */ 60 /* Clear the flow controller flags for this CPU. */
58 mov32 r2, TEGRA_FLOW_CTRL_BASE + FLOW_CTRL_CPU0_CSR @ CPU0 CSR 61 cpu_to_csr_reg r1, r0
59 ldr r1, [r2] 62 mov32 r2, TEGRA_FLOW_CTRL_BASE
63 ldr r1, [r2, r1]
60 /* Clear event & intr flag */ 64 /* Clear event & intr flag */
61 orr r1, r1, \ 65 orr r1, r1, \
62 #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG 66 #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
63 movw r0, #0x0FFD @ enable, cluster_switch, immed, & bitmaps 67 movw r0, #0x3FFD @ enable, cluster_switch, immed, bitmaps
68 @ & ext flags for CPU power mgnt
64 bic r1, r1, r0 69 bic r1, r1, r0
65 str r1, [r2] 70 str r1, [r2]
661: 711:
67#endif
68 72
73 check_cpu_part_num 0xc09, r8, r9
74 bne not_ca9
69#ifdef CONFIG_HAVE_ARM_SCU 75#ifdef CONFIG_HAVE_ARM_SCU
70 /* enable SCU */ 76 /* enable SCU */
71 mov32 r0, TEGRA_ARM_PERIF_BASE 77 mov32 r0, TEGRA_ARM_PERIF_BASE
@@ -76,6 +82,7 @@ ENTRY(tegra_resume)
76 82
77 /* L2 cache resume & re-enable */ 83 /* L2 cache resume & re-enable */
78 l2_cache_resume r0, r1, r2, l2x0_saved_regs_addr 84 l2_cache_resume r0, r1, r2, l2x0_saved_regs_addr
85not_ca9:
79 86
80 b cpu_resume 87 b cpu_resume
81ENDPROC(tegra_resume) 88ENDPROC(tegra_resume)
@@ -98,7 +105,7 @@ ENTRY(__tegra_cpu_reset_handler_start)
98 * Register usage within the reset handler: 105 * Register usage within the reset handler:
99 * 106 *
100 * Others: scratch 107 * Others: scratch
101 * R6 = SoC ID << 8 108 * R6 = SoC ID
102 * R7 = CPU present (to the OS) mask 109 * R7 = CPU present (to the OS) mask
103 * R8 = CPU in LP1 state mask 110 * R8 = CPU in LP1 state mask
104 * R9 = CPU in LP2 state mask 111 * R9 = CPU in LP2 state mask
@@ -115,12 +122,10 @@ ENTRY(__tegra_cpu_reset_handler)
115 122
116 cpsid aif, 0x13 @ SVC mode, interrupts disabled 123 cpsid aif, 0x13 @ SVC mode, interrupts disabled
117 124
118 mov32 r6, TEGRA_APB_MISC_BASE 125 tegra_get_soc_id TEGRA_APB_MISC_BASE, r6
119 ldr r6, [r6, #APB_MISC_GP_HIDREV]
120 and r6, r6, #0xff00
121#ifdef CONFIG_ARCH_TEGRA_2x_SOC 126#ifdef CONFIG_ARCH_TEGRA_2x_SOC
122t20_check: 127t20_check:
123 cmp r6, #(0x20 << 8) 128 cmp r6, #TEGRA20
124 bne after_t20_check 129 bne after_t20_check
125t20_errata: 130t20_errata:
126 # Tegra20 is a Cortex-A9 r1p1 131 # Tegra20 is a Cortex-A9 r1p1
@@ -136,7 +141,7 @@ after_t20_check:
136#endif 141#endif
137#ifdef CONFIG_ARCH_TEGRA_3x_SOC 142#ifdef CONFIG_ARCH_TEGRA_3x_SOC
138t30_check: 143t30_check:
139 cmp r6, #(0x30 << 8) 144 cmp r6, #TEGRA30
140 bne after_t30_check 145 bne after_t30_check
141t30_errata: 146t30_errata:
142 # Tegra30 is a Cortex-A9 r2p9 147 # Tegra30 is a Cortex-A9 r2p9
@@ -163,7 +168,7 @@ after_errata:
163 168
164#ifdef CONFIG_ARCH_TEGRA_2x_SOC 169#ifdef CONFIG_ARCH_TEGRA_2x_SOC
165 /* Are we on Tegra20? */ 170 /* Are we on Tegra20? */
166 cmp r6, #(0x20 << 8) 171 cmp r6, #TEGRA20
167 bne 1f 172 bne 1f
168 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */ 173 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
169 mov32 r5, TEGRA_PMC_BASE 174 mov32 r5, TEGRA_PMC_BASE
@@ -186,11 +191,14 @@ __is_not_lp2:
186 191
187#ifdef CONFIG_SMP 192#ifdef CONFIG_SMP
188 /* 193 /*
189 * Can only be secondary boot (initial or hotplug) but CPU 0 194 * Can only be secondary boot (initial or hotplug)
190 * cannot be here. 195 * CPU0 can't be here for Tegra20/30
191 */ 196 */
197 cmp r6, #TEGRA114
198 beq __no_cpu0_chk
192 cmp r10, #0 199 cmp r10, #0
193 bleq __die @ CPU0 cannot be here 200 bleq __die @ CPU0 cannot be here
201__no_cpu0_chk:
194 ldr lr, [r12, #RESET_DATA(STARTUP_SECONDARY)] 202 ldr lr, [r12, #RESET_DATA(STARTUP_SECONDARY)]
195 cmp lr, #0 203 cmp lr, #0
196 bleq __die @ no secondary startup handler 204 bleq __die @ no secondary startup handler
@@ -210,10 +218,7 @@ __die:
210 mov32 r7, TEGRA_CLK_RESET_BASE 218 mov32 r7, TEGRA_CLK_RESET_BASE
211 219
212 /* Are we on Tegra20? */ 220 /* Are we on Tegra20? */
213 mov32 r6, TEGRA_APB_MISC_BASE 221 cmp r6, #TEGRA20
214 ldr r0, [r6, #APB_MISC_GP_HIDREV]
215 and r0, r0, #0xff00
216 cmp r0, #(0x20 << 8)
217 bne 1f 222 bne 1f
218 223
219#ifdef CONFIG_ARCH_TEGRA_2x_SOC 224#ifdef CONFIG_ARCH_TEGRA_2x_SOC
diff --git a/arch/arm/mach-tegra/sleep-tegra30.S b/arch/arm/mach-tegra/sleep-tegra30.S
index d29dfcce948d..ada8821b48be 100644
--- a/arch/arm/mach-tegra/sleep-tegra30.S
+++ b/arch/arm/mach-tegra/sleep-tegra30.S
@@ -19,6 +19,7 @@
19#include <asm/assembler.h> 19#include <asm/assembler.h>
20#include <asm/asm-offsets.h> 20#include <asm/asm-offsets.h>
21 21
22#include "fuse.h"
22#include "sleep.h" 23#include "sleep.h"
23#include "flowctrl.h" 24#include "flowctrl.h"
24 25
@@ -43,14 +44,19 @@ ENDPROC(tegra30_hotplug_shutdown)
43 * 44 *
44 * Puts the current CPU in wait-for-event mode on the flow controller 45 * Puts the current CPU in wait-for-event mode on the flow controller
45 * and powergates it -- flags (in R0) indicate the request type. 46 * and powergates it -- flags (in R0) indicate the request type.
46 * Must never be called for CPU 0.
47 * 47 *
48 * corrupts r0-r4, r12 48 * r10 = SoC ID
49 * corrupts r0-r4, r10-r12
49 */ 50 */
50ENTRY(tegra30_cpu_shutdown) 51ENTRY(tegra30_cpu_shutdown)
51 cpu_id r3 52 cpu_id r3
53 tegra_get_soc_id TEGRA_APB_MISC_VIRT, r10
54 cmp r10, #TEGRA30
55 bne _no_cpu0_chk @ It's not Tegra30
56
52 cmp r3, #0 57 cmp r3, #0
53 moveq pc, lr @ Must never be called for CPU 0 58 moveq pc, lr @ Must never be called for CPU 0
59_no_cpu0_chk:
54 60
55 ldr r12, =TEGRA_FLOW_CTRL_VIRT 61 ldr r12, =TEGRA_FLOW_CTRL_VIRT
56 cpu_to_csr_reg r1, r3 62 cpu_to_csr_reg r1, r3
@@ -65,7 +71,9 @@ ENTRY(tegra30_cpu_shutdown)
65 movw r12, \ 71 movw r12, \
66 FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \ 72 FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG | \
67 FLOW_CTRL_CSR_ENABLE 73 FLOW_CTRL_CSR_ENABLE
68 mov r4, #(1 << 4) 74 cmp r10, #TEGRA30
75 moveq r4, #(1 << 4) @ wfe bitmap
76 movne r4, #(1 << 8) @ wfi bitmap
69 ARM( orr r12, r12, r4, lsl r3 ) 77 ARM( orr r12, r12, r4, lsl r3 )
70 THUMB( lsl r4, r4, r3 ) 78 THUMB( lsl r4, r4, r3 )
71 THUMB( orr r12, r12, r4 ) 79 THUMB( orr r12, r12, r4 )
@@ -79,9 +87,20 @@ delay_1:
79 cpsid a @ disable imprecise aborts. 87 cpsid a @ disable imprecise aborts.
80 ldr r3, [r1] @ read CSR 88 ldr r3, [r1] @ read CSR
81 str r3, [r1] @ clear CSR 89 str r3, [r1] @ clear CSR
90
82 tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN 91 tst r0, #TEGRA30_POWER_HOTPLUG_SHUTDOWN
92 beq flow_ctrl_setting_for_lp2
93
94 /* flow controller set up for hotplug */
95 mov r3, #FLOW_CTRL_WAITEVENT @ For hotplug
96 b flow_ctrl_done
97flow_ctrl_setting_for_lp2:
98 /* flow controller set up for LP2 */
99 cmp r10, #TEGRA30
83 moveq r3, #FLOW_CTRL_WAIT_FOR_INTERRUPT @ For LP2 100 moveq r3, #FLOW_CTRL_WAIT_FOR_INTERRUPT @ For LP2
84 movne r3, #FLOW_CTRL_WAITEVENT @ For hotplug 101 movne r3, #FLOW_CTRL_WAITEVENT
102flow_ctrl_done:
103 cmp r10, #TEGRA30
85 str r3, [r2] 104 str r3, [r2]
86 ldr r0, [r2] 105 ldr r0, [r2]
87 b wfe_war 106 b wfe_war
@@ -89,7 +108,8 @@ delay_1:
89__cpu_reset_again: 108__cpu_reset_again:
90 dsb 109 dsb
91 .align 5 110 .align 5
92 wfe @ CPU should be power gated here 111 wfeeq @ CPU should be power gated here
112 wfine
93wfe_war: 113wfe_war:
94 b __cpu_reset_again 114 b __cpu_reset_again
95 115
diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S
index 364d84523fba..9daaef26b0f6 100644
--- a/arch/arm/mach-tegra/sleep.S
+++ b/arch/arm/mach-tegra/sleep.S
@@ -106,9 +106,11 @@ ENTRY(tegra_shut_off_mmu)
106 isb 106 isb
107#ifdef CONFIG_CACHE_L2X0 107#ifdef CONFIG_CACHE_L2X0
108 /* Disable L2 cache */ 108 /* Disable L2 cache */
109 mov32 r4, TEGRA_ARM_PERIF_BASE + 0x3000 109 check_cpu_part_num 0xc09, r9, r10
110 mov r5, #0 110 movweq r4, #:lower16:(TEGRA_ARM_PERIF_BASE + 0x3000)
111 str r5, [r4, #L2X0_CTRL] 111 movteq r4, #:upper16:(TEGRA_ARM_PERIF_BASE + 0x3000)
112 moveq r5, #0
113 streq r5, [r4, #L2X0_CTRL]
112#endif 114#endif
113 mov pc, r0 115 mov pc, r0
114ENDPROC(tegra_shut_off_mmu) 116ENDPROC(tegra_shut_off_mmu)
diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h
index 2080fb12ce26..98b7da698f2b 100644
--- a/arch/arm/mach-tegra/sleep.h
+++ b/arch/arm/mach-tegra/sleep.h
@@ -25,6 +25,8 @@
25 + IO_PPSB_VIRT) 25 + IO_PPSB_VIRT)
26#define TEGRA_CLK_RESET_VIRT (TEGRA_CLK_RESET_BASE - IO_PPSB_PHYS \ 26#define TEGRA_CLK_RESET_VIRT (TEGRA_CLK_RESET_BASE - IO_PPSB_PHYS \
27 + IO_PPSB_VIRT) 27 + IO_PPSB_VIRT)
28#define TEGRA_APB_MISC_VIRT (TEGRA_APB_MISC_BASE - IO_APB_PHYS \
29 + IO_APB_VIRT)
28#define TEGRA_PMC_VIRT (TEGRA_PMC_BASE - IO_APB_PHYS + IO_APB_VIRT) 30#define TEGRA_PMC_VIRT (TEGRA_PMC_BASE - IO_APB_PHYS + IO_APB_VIRT)
29 31
30/* PMC_SCRATCH37-39 and 41 are used for tegra_pen_lock and idle */ 32/* PMC_SCRATCH37-39 and 41 are used for tegra_pen_lock and idle */
@@ -70,19 +72,40 @@
70 movt \reg, #:upper16:\val 72 movt \reg, #:upper16:\val
71.endm 73.endm
72 74
75/* Marco to check CPU part num */
76.macro check_cpu_part_num part_num, tmp1, tmp2
77 mrc p15, 0, \tmp1, c0, c0, 0
78 ubfx \tmp1, \tmp1, #4, #12
79 mov32 \tmp2, \part_num
80 cmp \tmp1, \tmp2
81.endm
82
73/* Macro to exit SMP coherency. */ 83/* Macro to exit SMP coherency. */
74.macro exit_smp, tmp1, tmp2 84.macro exit_smp, tmp1, tmp2
75 mrc p15, 0, \tmp1, c1, c0, 1 @ ACTLR 85 mrc p15, 0, \tmp1, c1, c0, 1 @ ACTLR
76 bic \tmp1, \tmp1, #(1<<6) | (1<<0) @ clear ACTLR.SMP | ACTLR.FW 86 bic \tmp1, \tmp1, #(1<<6) | (1<<0) @ clear ACTLR.SMP | ACTLR.FW
77 mcr p15, 0, \tmp1, c1, c0, 1 @ ACTLR 87 mcr p15, 0, \tmp1, c1, c0, 1 @ ACTLR
78 isb 88 isb
79 cpu_id \tmp1 89#ifdef CONFIG_HAVE_ARM_SCU
80 mov \tmp1, \tmp1, lsl #2 90 check_cpu_part_num 0xc09, \tmp1, \tmp2
81 mov \tmp2, #0xf 91 mrceq p15, 0, \tmp1, c0, c0, 5
82 mov \tmp2, \tmp2, lsl \tmp1 92 andeq \tmp1, \tmp1, #0xF
83 mov32 \tmp1, TEGRA_ARM_PERIF_VIRT + 0xC 93 moveq \tmp1, \tmp1, lsl #2
84 str \tmp2, [\tmp1] @ invalidate SCU tags for CPU 94 moveq \tmp2, #0xf
95 moveq \tmp2, \tmp2, lsl \tmp1
96 ldreq \tmp1, =(TEGRA_ARM_PERIF_VIRT + 0xC)
97 streq \tmp2, [\tmp1] @ invalidate SCU tags for CPU
85 dsb 98 dsb
99#endif
100.endm
101
102/* Macro to check Tegra revision */
103#define APB_MISC_GP_HIDREV 0x804
104.macro tegra_get_soc_id base, tmp1
105 mov32 \tmp1, \base
106 ldr \tmp1, [\tmp1, #APB_MISC_GP_HIDREV]
107 and \tmp1, \tmp1, #0xff00
108 mov \tmp1, \tmp1, lsr #8
86.endm 109.endm
87 110
88/* Macro to resume & re-enable L2 cache */ 111/* Macro to resume & re-enable L2 cache */
diff --git a/arch/arm/mach-tegra/tegra2_emc.c b/arch/arm/mach-tegra/tegra2_emc.c
index 31e69a019bdd..3ae4a7f1a2fb 100644
--- a/arch/arm/mach-tegra/tegra2_emc.c
+++ b/arch/arm/mach-tegra/tegra2_emc.c
@@ -183,7 +183,7 @@ static struct device_node *tegra_emc_ramcode_devnode(struct device_node *np)
183 u32 reg; 183 u32 reg;
184 184
185 for_each_child_of_node(np, iter) { 185 for_each_child_of_node(np, iter) {
186 if (of_property_read_u32(np, "nvidia,ram-code", &reg)) 186 if (of_property_read_u32(iter, "nvidia,ram-code", &reg))
187 continue; 187 continue;
188 if (reg == tegra_bct_strapping) 188 if (reg == tegra_bct_strapping)
189 return of_node_get(iter); 189 return of_node_get(iter);
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index 1f597647d431..a85adcd00882 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -1,24 +1,46 @@
1if ARCH_U300
2
3menu "ST-Ericsson AB U300/U335 Platform" 1menu "ST-Ericsson AB U300/U335 Platform"
4 2
5comment "ST-Ericsson Mobile Platform Products" 3comment "ST-Ericsson Mobile Platform Products"
6 4
7config MACH_U300 5config ARCH_U300
8 bool "U300" 6 bool "ST-Ericsson U300 Series" if ARCH_MULTI_V5
7 depends on MMU
8 select ARCH_REQUIRE_GPIOLIB
9 select ARM_AMBA
10 select ARM_PATCH_PHYS_VIRT
11 select ARM_VIC
12 select CLKDEV_LOOKUP
13 select CLKSRC_MMIO
14 select CLKSRC_OF
15 select COMMON_CLK
16 select CPU_ARM926T
17 select GENERIC_CLOCKEVENTS
18 select HAVE_TCM
9 select PINCTRL 19 select PINCTRL
10 select PINCTRL_COH901 20 select PINCTRL_COH901
11 select PINCTRL_U300 21 select PINCTRL_U300
22 select SPARSE_IRQ
23 select MFD_SYSCON
24 select USE_OF
25 help
26 Support for ST-Ericsson U300 series mobile platforms.
12 27
13comment "ST-Ericsson U300/U335 Feature Selections" 28comment "ST-Ericsson U300/U335 Feature Selections"
14 29
30config MACH_U300
31 depends on ARCH_U300
32 bool "U300"
33 default y
34
15config U300_DEBUG 35config U300_DEBUG
36 depends on ARCH_U300
16 bool "Debug support for U300" 37 bool "Debug support for U300"
17 depends on PM 38 depends on PM
18 help 39 help
19 Debug support for U300 in sysfs, procfs etc. 40 Debug support for U300 in sysfs, procfs etc.
20 41
21config MACH_U300_SPIDUMMY 42config MACH_U300_SPIDUMMY
43 depends on ARCH_U300
22 bool "SSP/SPI dummy chip" 44 bool "SSP/SPI dummy chip"
23 select SPI 45 select SPI
24 select SPI_MASTER 46 select SPI_MASTER
@@ -31,5 +53,3 @@ config MACH_U300_SPIDUMMY
31 SPI framework and ARM PL022 support. 53 SPI framework and ARM PL022 support.
32 54
33endmenu 55endmenu
34
35endif
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile
index 5a86c58da396..0f362b64fb87 100644
--- a/arch/arm/mach-u300/Makefile
+++ b/arch/arm/mach-u300/Makefile
@@ -7,7 +7,5 @@ obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_SPI_PL022) += spi.o
11obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o 10obj-$(CONFIG_MACH_U300_SPIDUMMY) += dummyspichip.o
12obj-$(CONFIG_I2C_STU300) += i2c.o
13obj-$(CONFIG_REGULATOR_AB3100) += regulator.o 11obj-$(CONFIG_REGULATOR_AB3100) += regulator.o
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index a683d17b2ce4..4f7ac2a11452 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -9,46 +9,157 @@
9 * Author: Linus Walleij <linus.walleij@stericsson.com> 9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */ 10 */
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/spinlock.h>
14#include <linux/interrupt.h>
15#include <linux/bitops.h>
16#include <linux/device.h>
17#include <linux/mm.h>
18#include <linux/termios.h>
19#include <linux/dmaengine.h>
20#include <linux/amba/bus.h>
21#include <linux/amba/mmci.h>
22#include <linux/amba/serial.h>
23#include <linux/platform_device.h>
24#include <linux/gpio.h>
25#include <linux/clk.h>
26#include <linux/err.h>
27#include <linux/mtd/nand.h>
28#include <linux/mtd/fsmc.h>
29#include <linux/pinctrl/machine.h> 12#include <linux/pinctrl/machine.h>
30#include <linux/pinctrl/pinconf-generic.h> 13#include <linux/pinctrl/pinconf-generic.h>
31#include <linux/dma-mapping.h>
32#include <linux/platform_data/clk-u300.h> 14#include <linux/platform_data/clk-u300.h>
33#include <linux/platform_data/pinctrl-coh901.h> 15#include <linux/irqchip.h>
34#include <linux/platform_data/dma-coh901318.h> 16#include <linux/of_address.h>
35#include <linux/irqchip/arm-vic.h> 17#include <linux/of_platform.h>
18#include <linux/clocksource.h>
19#include <linux/clk.h>
36 20
37#include <asm/types.h>
38#include <asm/setup.h>
39#include <asm/memory.h>
40#include <asm/mach/map.h> 21#include <asm/mach/map.h>
41#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
43 23
44#include <mach/hardware.h> 24/*
45#include <mach/syscon.h> 25 * These are the large blocks of memory allocated for I/O.
46#include <mach/irqs.h> 26 * the defines are used for setting up the I/O memory mapping.
27 */
28
29/* NAND Flash CS0 */
30#define U300_NAND_CS0_PHYS_BASE 0x80000000
31/* NFIF */
32#define U300_NAND_IF_PHYS_BASE 0x9f800000
33/* ALE, CLE offset for FSMC NAND */
34#define PLAT_NAND_CLE (1 << 16)
35#define PLAT_NAND_ALE (1 << 17)
36/* AHB Peripherals */
37#define U300_AHB_PER_PHYS_BASE 0xa0000000
38#define U300_AHB_PER_VIRT_BASE 0xff010000
39/* FAST Peripherals */
40#define U300_FAST_PER_PHYS_BASE 0xc0000000
41#define U300_FAST_PER_VIRT_BASE 0xff020000
42/* SLOW Peripherals */
43#define U300_SLOW_PER_PHYS_BASE 0xc0010000
44#define U300_SLOW_PER_VIRT_BASE 0xff000000
45/* Boot ROM */
46#define U300_BOOTROM_PHYS_BASE 0xffff0000
47#define U300_BOOTROM_VIRT_BASE 0xffff0000
48/* SEMI config base */
49#define U300_SEMI_CONFIG_BASE 0x2FFE0000
50
51/*
52 * AHB peripherals
53 */
54
55/* AHB Peripherals Bridge Controller */
56#define U300_AHB_BRIDGE_BASE (U300_AHB_PER_PHYS_BASE+0x0000)
57/* Vectored Interrupt Controller 0, servicing 32 interrupts */
58#define U300_INTCON0_BASE (U300_AHB_PER_PHYS_BASE+0x1000)
59#define U300_INTCON0_VBASE IOMEM(U300_AHB_PER_VIRT_BASE+0x1000)
60/* Vectored Interrupt Controller 1, servicing 32 interrupts */
61#define U300_INTCON1_BASE (U300_AHB_PER_PHYS_BASE+0x2000)
62#define U300_INTCON1_VBASE IOMEM(U300_AHB_PER_VIRT_BASE+0x2000)
63/* Memory Stick Pro (MSPRO) controller */
64#define U300_MSPRO_BASE (U300_AHB_PER_PHYS_BASE+0x3000)
65/* EMIF Configuration Area */
66#define U300_EMIF_CFG_BASE (U300_AHB_PER_PHYS_BASE+0x4000)
67
68/*
69 * FAST peripherals
70 */
71
72/* FAST bridge control */
73#define U300_FAST_BRIDGE_BASE (U300_FAST_PER_PHYS_BASE+0x0000)
74/* MMC/SD controller */
75#define U300_MMCSD_BASE (U300_FAST_PER_PHYS_BASE+0x1000)
76/* PCM I2S0 controller */
77#define U300_PCM_I2S0_BASE (U300_FAST_PER_PHYS_BASE+0x2000)
78/* PCM I2S1 controller */
79#define U300_PCM_I2S1_BASE (U300_FAST_PER_PHYS_BASE+0x3000)
80/* I2C0 controller */
81#define U300_I2C0_BASE (U300_FAST_PER_PHYS_BASE+0x4000)
82/* I2C1 controller */
83#define U300_I2C1_BASE (U300_FAST_PER_PHYS_BASE+0x5000)
84/* SPI controller */
85#define U300_SPI_BASE (U300_FAST_PER_PHYS_BASE+0x6000)
86/* Fast UART1 on U335 only */
87#define U300_UART1_BASE (U300_FAST_PER_PHYS_BASE+0x7000)
88
89/*
90 * SLOW peripherals
91 */
92
93/* SLOW bridge control */
94#define U300_SLOW_BRIDGE_BASE (U300_SLOW_PER_PHYS_BASE)
95/* SYSCON */
96#define U300_SYSCON_BASE (U300_SLOW_PER_PHYS_BASE+0x1000)
97#define U300_SYSCON_VBASE IOMEM(U300_SLOW_PER_VIRT_BASE+0x1000)
98/* Watchdog */
99#define U300_WDOG_BASE (U300_SLOW_PER_PHYS_BASE+0x2000)
100/* UART0 */
101#define U300_UART0_BASE (U300_SLOW_PER_PHYS_BASE+0x3000)
102/* APP side special timer */
103#define U300_TIMER_APP_BASE (U300_SLOW_PER_PHYS_BASE+0x4000)
104#define U300_TIMER_APP_VBASE IOMEM(U300_SLOW_PER_VIRT_BASE+0x4000)
105/* Keypad */
106#define U300_KEYPAD_BASE (U300_SLOW_PER_PHYS_BASE+0x5000)
107/* GPIO */
108#define U300_GPIO_BASE (U300_SLOW_PER_PHYS_BASE+0x6000)
109/* RTC */
110#define U300_RTC_BASE (U300_SLOW_PER_PHYS_BASE+0x7000)
111/* Bus tracer */
112#define U300_BUSTR_BASE (U300_SLOW_PER_PHYS_BASE+0x8000)
113/* Event handler (hardware queue) */
114#define U300_EVHIST_BASE (U300_SLOW_PER_PHYS_BASE+0x9000)
115/* Genric Timer */
116#define U300_TIMER_BASE (U300_SLOW_PER_PHYS_BASE+0xa000)
117/* PPM */
118#define U300_PPM_BASE (U300_SLOW_PER_PHYS_BASE+0xb000)
119
120/*
121 * REST peripherals
122 */
123
124/* ISP (image signal processor) */
125#define U300_ISP_BASE (0xA0008000)
126/* DMA Controller base */
127#define U300_DMAC_BASE (0xC0020000)
128/* MSL Base */
129#define U300_MSL_BASE (0xc0022000)
130/* APEX Base */
131#define U300_APEX_BASE (0xc0030000)
132/* Video Encoder Base */
133#define U300_VIDEOENC_BASE (0xc0080000)
134/* XGAM Base */
135#define U300_XGAM_BASE (0xd0000000)
136
137/*
138 * SYSCON addresses applicable to the core machine.
139 */
47 140
48#include "timer.h" 141/* Chip ID register 16bit (R/-) */
49#include "spi.h" 142#define U300_SYSCON_CIDR (0x400)
50#include "i2c.h" 143/* SMCR */
51#include "u300-gpio.h" 144#define U300_SYSCON_SMCR (0x4d0)
145#define U300_SYSCON_SMCR_FIELD_MASK (0x000e)
146#define U300_SYSCON_SMCR_SEMI_SREFACK_IND (0x0008)
147#define U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE (0x0004)
148#define U300_SYSCON_SMCR_SEMI_EXT_BOOT_MODE_ENABLE (0x0002)
149/* CPU_SW_DBGEN Software Debug Enable 16bit (R/W) */
150#define U300_SYSCON_CSDR (0x4f0)
151#define U300_SYSCON_CSDR_SW_DEBUG_ENABLE (0x0001)
152/* PRINT_CONTROL Print Control 16bit (R/-) */
153#define U300_SYSCON_PCR (0x4f8)
154#define U300_SYSCON_PCR_SERV_IND (0x0001)
155/* BOOT_CONTROL 16bit (R/-) */
156#define U300_SYSCON_BCR (0x4fc)
157#define U300_SYSCON_BCR_ACC_CPU_SUBSYS_VINITHI_IND (0x0400)
158#define U300_SYSCON_BCR_APP_CPU_SUBSYS_VINITHI_IND (0x0200)
159#define U300_SYSCON_BCR_EXTRA_BOOT_OPTION_MASK (0x01FC)
160#define U300_SYSCON_BCR_APP_BOOT_SERV_MASK (0x0003)
161
162static void __iomem *syscon_base;
52 163
53/* 164/*
54 * Static I/O mappings that are needed for booting the U300 platforms. The 165 * Static I/O mappings that are needed for booting the U300 platforms. The
@@ -82,365 +193,6 @@ static void __init u300_map_io(void)
82 iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc)); 193 iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc));
83} 194}
84 195
85/*
86 * Declaration of devices found on the U300 board and
87 * their respective memory locations.
88 */
89
90static struct amba_pl011_data uart0_plat_data = {
91#ifdef CONFIG_COH901318
92 .dma_filter = coh901318_filter_id,
93 .dma_rx_param = (void *) U300_DMA_UART0_RX,
94 .dma_tx_param = (void *) U300_DMA_UART0_TX,
95#endif
96};
97
98/* Slow device at 0x3000 offset */
99static AMBA_APB_DEVICE(uart0, "uart0", 0, U300_UART0_BASE,
100 { IRQ_U300_UART0 }, &uart0_plat_data);
101
102/* The U335 have an additional UART1 on the APP CPU */
103static struct amba_pl011_data uart1_plat_data = {
104#ifdef CONFIG_COH901318
105 .dma_filter = coh901318_filter_id,
106 .dma_rx_param = (void *) U300_DMA_UART1_RX,
107 .dma_tx_param = (void *) U300_DMA_UART1_TX,
108#endif
109};
110
111/* Fast device at 0x7000 offset */
112static AMBA_APB_DEVICE(uart1, "uart1", 0, U300_UART1_BASE,
113 { IRQ_U300_UART1 }, &uart1_plat_data);
114
115/* AHB device at 0x4000 offset */
116static AMBA_APB_DEVICE(pl172, "pl172", 0, U300_EMIF_CFG_BASE, { }, NULL);
117
118/* Fast device at 0x6000 offset */
119static AMBA_APB_DEVICE(pl022, "pl022", 0, U300_SPI_BASE,
120 { IRQ_U300_SPI }, NULL);
121
122/* Fast device at 0x1000 offset */
123#define U300_MMCSD_IRQS { IRQ_U300_MMCSD_MCIINTR0, IRQ_U300_MMCSD_MCIINTR1 }
124
125static struct mmci_platform_data mmcsd_platform_data = {
126 /*
127 * Do not set ocr_mask or voltage translation function,
128 * we have a regulator we can control instead.
129 */
130 .f_max = 24000000,
131 .gpio_wp = -1,
132 .gpio_cd = U300_GPIO_PIN_MMC_CD,
133 .cd_invert = true,
134 .capabilities = MMC_CAP_MMC_HIGHSPEED |
135 MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
136#ifdef CONFIG_COH901318
137 .dma_filter = coh901318_filter_id,
138 .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
139 /* Don't specify a TX channel, this RX channel is bidirectional */
140#endif
141};
142
143static AMBA_APB_DEVICE(mmcsd, "mmci", 0, U300_MMCSD_BASE,
144 U300_MMCSD_IRQS, &mmcsd_platform_data);
145
146/*
147 * The order of device declaration may be important, since some devices
148 * have dependencies on other devices being initialized first.
149 */
150static struct amba_device *amba_devs[] __initdata = {
151 &uart0_device,
152 &uart1_device,
153 &pl022_device,
154 &pl172_device,
155 &mmcsd_device,
156};
157
158/* Here follows a list of all hw resources that the platform devices
159 * allocate. Note, clock dependencies are not included
160 */
161
162static struct resource gpio_resources[] = {
163 {
164 .start = U300_GPIO_BASE,
165 .end = (U300_GPIO_BASE + SZ_4K - 1),
166 .flags = IORESOURCE_MEM,
167 },
168 {
169 .name = "gpio0",
170 .start = IRQ_U300_GPIO_PORT0,
171 .end = IRQ_U300_GPIO_PORT0,
172 .flags = IORESOURCE_IRQ,
173 },
174 {
175 .name = "gpio1",
176 .start = IRQ_U300_GPIO_PORT1,
177 .end = IRQ_U300_GPIO_PORT1,
178 .flags = IORESOURCE_IRQ,
179 },
180 {
181 .name = "gpio2",
182 .start = IRQ_U300_GPIO_PORT2,
183 .end = IRQ_U300_GPIO_PORT2,
184 .flags = IORESOURCE_IRQ,
185 },
186 {
187 .name = "gpio3",
188 .start = IRQ_U300_GPIO_PORT3,
189 .end = IRQ_U300_GPIO_PORT3,
190 .flags = IORESOURCE_IRQ,
191 },
192 {
193 .name = "gpio4",
194 .start = IRQ_U300_GPIO_PORT4,
195 .end = IRQ_U300_GPIO_PORT4,
196 .flags = IORESOURCE_IRQ,
197 },
198 {
199 .name = "gpio5",
200 .start = IRQ_U300_GPIO_PORT5,
201 .end = IRQ_U300_GPIO_PORT5,
202 .flags = IORESOURCE_IRQ,
203 },
204 {
205 .name = "gpio6",
206 .start = IRQ_U300_GPIO_PORT6,
207 .end = IRQ_U300_GPIO_PORT6,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211
212static struct resource keypad_resources[] = {
213 {
214 .start = U300_KEYPAD_BASE,
215 .end = U300_KEYPAD_BASE + SZ_4K - 1,
216 .flags = IORESOURCE_MEM,
217 },
218 {
219 .name = "coh901461-press",
220 .start = IRQ_U300_KEYPAD_KEYBF,
221 .end = IRQ_U300_KEYPAD_KEYBF,
222 .flags = IORESOURCE_IRQ,
223 },
224 {
225 .name = "coh901461-release",
226 .start = IRQ_U300_KEYPAD_KEYBR,
227 .end = IRQ_U300_KEYPAD_KEYBR,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct resource rtc_resources[] = {
233 {
234 .start = U300_RTC_BASE,
235 .end = U300_RTC_BASE + SZ_4K - 1,
236 .flags = IORESOURCE_MEM,
237 },
238 {
239 .start = IRQ_U300_RTC,
240 .end = IRQ_U300_RTC,
241 .flags = IORESOURCE_IRQ,
242 },
243};
244
245/*
246 * Fsmc does have IRQs: #43 and #44 (NFIF and NFIF2)
247 * but these are not yet used by the driver.
248 */
249static struct resource fsmc_resources[] = {
250 {
251 .name = "nand_addr",
252 .start = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_ALE,
253 .end = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_ALE + SZ_16K - 1,
254 .flags = IORESOURCE_MEM,
255 },
256 {
257 .name = "nand_cmd",
258 .start = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_CLE,
259 .end = U300_NAND_CS0_PHYS_BASE + PLAT_NAND_CLE + SZ_16K - 1,
260 .flags = IORESOURCE_MEM,
261 },
262 {
263 .name = "nand_data",
264 .start = U300_NAND_CS0_PHYS_BASE,
265 .end = U300_NAND_CS0_PHYS_BASE + SZ_16K - 1,
266 .flags = IORESOURCE_MEM,
267 },
268 {
269 .name = "fsmc_regs",
270 .start = U300_NAND_IF_PHYS_BASE,
271 .end = U300_NAND_IF_PHYS_BASE + SZ_4K - 1,
272 .flags = IORESOURCE_MEM,
273 },
274};
275
276static struct resource i2c0_resources[] = {
277 {
278 .start = U300_I2C0_BASE,
279 .end = U300_I2C0_BASE + SZ_4K - 1,
280 .flags = IORESOURCE_MEM,
281 },
282 {
283 .start = IRQ_U300_I2C0,
284 .end = IRQ_U300_I2C0,
285 .flags = IORESOURCE_IRQ,
286 },
287};
288
289static struct resource i2c1_resources[] = {
290 {
291 .start = U300_I2C1_BASE,
292 .end = U300_I2C1_BASE + SZ_4K - 1,
293 .flags = IORESOURCE_MEM,
294 },
295 {
296 .start = IRQ_U300_I2C1,
297 .end = IRQ_U300_I2C1,
298 .flags = IORESOURCE_IRQ,
299 },
300
301};
302
303static struct resource wdog_resources[] = {
304 {
305 .start = U300_WDOG_BASE,
306 .end = U300_WDOG_BASE + SZ_4K - 1,
307 .flags = IORESOURCE_MEM,
308 },
309 {
310 .start = IRQ_U300_WDOG,
311 .end = IRQ_U300_WDOG,
312 .flags = IORESOURCE_IRQ,
313 }
314};
315
316static struct resource dma_resource[] = {
317 {
318 .start = U300_DMAC_BASE,
319 .end = U300_DMAC_BASE + PAGE_SIZE - 1,
320 .flags = IORESOURCE_MEM,
321 },
322 {
323 .start = IRQ_U300_DMA,
324 .end = IRQ_U300_DMA,
325 .flags = IORESOURCE_IRQ,
326 }
327};
328
329
330static struct resource pinctrl_resources[] = {
331 {
332 .start = U300_SYSCON_BASE,
333 .end = U300_SYSCON_BASE + SZ_4K - 1,
334 .flags = IORESOURCE_MEM,
335 },
336};
337
338static struct platform_device wdog_device = {
339 .name = "coh901327_wdog",
340 .id = -1,
341 .num_resources = ARRAY_SIZE(wdog_resources),
342 .resource = wdog_resources,
343};
344
345static struct platform_device i2c0_device = {
346 .name = "stu300",
347 .id = 0,
348 .num_resources = ARRAY_SIZE(i2c0_resources),
349 .resource = i2c0_resources,
350};
351
352static struct platform_device i2c1_device = {
353 .name = "stu300",
354 .id = 1,
355 .num_resources = ARRAY_SIZE(i2c1_resources),
356 .resource = i2c1_resources,
357};
358
359static struct platform_device pinctrl_device = {
360 .name = "pinctrl-u300",
361 .id = -1,
362 .num_resources = ARRAY_SIZE(pinctrl_resources),
363 .resource = pinctrl_resources,
364};
365
366/*
367 * The different variants have a few different versions of the
368 * GPIO block, with different number of ports.
369 */
370static struct u300_gpio_platform u300_gpio_plat = {
371 .ports = 7,
372 .gpio_base = 0,
373};
374
375static struct platform_device gpio_device = {
376 .name = "u300-gpio",
377 .id = -1,
378 .num_resources = ARRAY_SIZE(gpio_resources),
379 .resource = gpio_resources,
380 .dev = {
381 .platform_data = &u300_gpio_plat,
382 },
383};
384
385static struct platform_device keypad_device = {
386 .name = "keypad",
387 .id = -1,
388 .num_resources = ARRAY_SIZE(keypad_resources),
389 .resource = keypad_resources,
390};
391
392static struct platform_device rtc_device = {
393 .name = "rtc-coh901331",
394 .id = -1,
395 .num_resources = ARRAY_SIZE(rtc_resources),
396 .resource = rtc_resources,
397};
398
399static struct mtd_partition u300_partitions[] = {
400 {
401 .name = "bootrecords",
402 .offset = 0,
403 .size = SZ_128K,
404 },
405 {
406 .name = "free",
407 .offset = SZ_128K,
408 .size = 8064 * SZ_1K,
409 },
410 {
411 .name = "platform",
412 .offset = 8192 * SZ_1K,
413 .size = 253952 * SZ_1K,
414 },
415};
416
417static struct fsmc_nand_platform_data nand_platform_data = {
418 .partitions = u300_partitions,
419 .nr_partitions = ARRAY_SIZE(u300_partitions),
420 .options = NAND_SKIP_BBTSCAN,
421 .width = FSMC_NAND_BW8,
422};
423
424static struct platform_device nand_device = {
425 .name = "fsmc-nand",
426 .id = -1,
427 .resource = fsmc_resources,
428 .num_resources = ARRAY_SIZE(fsmc_resources),
429 .dev = {
430 .platform_data = &nand_platform_data,
431 },
432};
433
434static struct platform_device dma_device = {
435 .name = "coh901318",
436 .id = -1,
437 .resource = dma_resource,
438 .num_resources = ARRAY_SIZE(dma_resource),
439 .dev = {
440 .coherent_dma_mask = ~0,
441 },
442};
443
444static unsigned long pin_pullup_conf[] = { 196static unsigned long pin_pullup_conf[] = {
445 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1), 197 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1),
446}; 198};
@@ -467,61 +219,6 @@ static struct pinctrl_map __initdata u300_pinmux_map[] = {
467 pin_highz_conf), 219 pin_highz_conf),
468}; 220};
469 221
470/*
471 * Notice that AMBA devices are initialized before platform devices.
472 *
473 */
474static struct platform_device *platform_devs[] __initdata = {
475 &dma_device,
476 &i2c0_device,
477 &i2c1_device,
478 &keypad_device,
479 &rtc_device,
480 &pinctrl_device,
481 &gpio_device,
482 &nand_device,
483 &wdog_device,
484};
485
486/*
487 * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected
488 * together so some interrupts are connected to the first one and some
489 * to the second one.
490 */
491static void __init u300_init_irq(void)
492{
493 u32 mask[2] = {0, 0};
494 struct clk *clk;
495 int i;
496
497 /* initialize clocking early, we want to clock the INTCON */
498 u300_clk_init(U300_SYSCON_VBASE);
499
500 /* Bootstrap EMIF and SEMI clocks */
501 clk = clk_get_sys("pl172", NULL);
502 BUG_ON(IS_ERR(clk));
503 clk_prepare_enable(clk);
504 clk = clk_get_sys("semi", NULL);
505 BUG_ON(IS_ERR(clk));
506 clk_prepare_enable(clk);
507
508 /* Clock the interrupt controller */
509 clk = clk_get_sys("intcon", NULL);
510 BUG_ON(IS_ERR(clk));
511 clk_prepare_enable(clk);
512
513 for (i = 0; i < U300_VIC_IRQS_END; i++)
514 set_bit(i, (unsigned long *) &mask[0]);
515 vic_init((void __iomem *) U300_INTCON0_VBASE, IRQ_U300_INTCON0_START,
516 mask[0], mask[0]);
517 vic_init((void __iomem *) U300_INTCON1_VBASE, IRQ_U300_INTCON1_START,
518 mask[1], mask[1]);
519}
520
521
522/*
523 * U300 platforms peripheral handling
524 */
525struct db_chip { 222struct db_chip {
526 u16 chipid; 223 u16 chipid;
527 const char *name; 224 const char *name;
@@ -578,7 +275,7 @@ static void __init u300_init_check_chip(void)
578 const char unknown[] = "UNKNOWN"; 275 const char unknown[] = "UNKNOWN";
579 276
580 /* Read out and print chip ID */ 277 /* Read out and print chip ID */
581 val = readw(U300_SYSCON_VBASE + U300_SYSCON_CIDR); 278 val = readw(syscon_base + U300_SYSCON_CIDR);
582 /* This is in funky bigendian order... */ 279 /* This is in funky bigendian order... */
583 val = (val & 0xFFU) << 8 | (val >> 8); 280 val = (val & 0xFFU) << 8 | (val >> 8);
584 chip = db_chips; 281 chip = db_chips;
@@ -600,74 +297,6 @@ static void __init u300_init_check_chip(void)
600 } 297 }
601} 298}
602 299
603/*
604 * Some devices and their resources require reserved physical memory from
605 * the end of the available RAM. This function traverses the list of devices
606 * and assigns actual addresses to these.
607 */
608static void __init u300_assign_physmem(void)
609{
610 unsigned long curr_start = __pa(high_memory);
611 int i, j;
612
613 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) {
614 for (j = 0; j < platform_devs[i]->num_resources; j++) {
615 struct resource *const res =
616 &platform_devs[i]->resource[j];
617
618 if (IORESOURCE_MEM == res->flags &&
619 0 == res->start) {
620 res->start = curr_start;
621 res->end += curr_start;
622 curr_start += resource_size(res);
623
624 printk(KERN_INFO "core.c: Mapping RAM " \
625 "%#x-%#x to device %s:%s\n",
626 res->start, res->end,
627 platform_devs[i]->name, res->name);
628 }
629 }
630 }
631}
632
633static void __init u300_init_machine(void)
634{
635 int i;
636 u16 val;
637
638 /* Check what platform we run and print some status information */
639 u300_init_check_chip();
640
641 /* Initialize SPI device with some board specifics */
642 u300_spi_init(&pl022_device);
643
644 /* Register the AMBA devices in the AMBA bus abstraction layer */
645 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
646 struct amba_device *d = amba_devs[i];
647 amba_device_register(d, &iomem_resource);
648 }
649
650 u300_assign_physmem();
651
652 /* Initialize pinmuxing */
653 pinctrl_register_mappings(u300_pinmux_map,
654 ARRAY_SIZE(u300_pinmux_map));
655
656 /* Register subdevices on the I2C buses */
657 u300_i2c_register_board_devices();
658
659 /* Register the platform devices */
660 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
661
662 /* Register subdevices on the SPI bus */
663 u300_spi_register_board_devices();
664
665 /* Enable SEMI self refresh */
666 val = readw(U300_SYSCON_VBASE + U300_SYSCON_SMCR) |
667 U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE;
668 writew(val, U300_SYSCON_VBASE + U300_SYSCON_SMCR);
669}
670
671/* Forward declare this function from the watchdog */ 300/* Forward declare this function from the watchdog */
672void coh901327_watchdog_reset(void); 301void coh901327_watchdog_reset(void);
673 302
@@ -688,13 +317,99 @@ static void u300_restart(char mode, const char *cmd)
688 while (1); 317 while (1);
689} 318}
690 319
691MACHINE_START(U300, "Ericsson AB U335 S335/B335 Prototype Board") 320/* These are mostly to get the right device names for the clock lookups */
692 /* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */ 321static struct of_dev_auxdata u300_auxdata_lookup[] __initdata = {
693 .atag_offset = 0x100, 322 OF_DEV_AUXDATA("stericsson,pinctrl-u300", U300_SYSCON_BASE,
323 "pinctrl-u300", NULL),
324 OF_DEV_AUXDATA("stericsson,gpio-coh901", U300_GPIO_BASE,
325 "u300-gpio", NULL),
326 OF_DEV_AUXDATA("stericsson,coh901327", U300_WDOG_BASE,
327 "coh901327_wdog", NULL),
328 OF_DEV_AUXDATA("stericsson,coh901331", U300_RTC_BASE,
329 "rtc-coh901331", NULL),
330 OF_DEV_AUXDATA("stericsson,coh901318", U300_DMAC_BASE,
331 "coh901318", NULL),
332 OF_DEV_AUXDATA("stericsson,fsmc-nand", U300_NAND_IF_PHYS_BASE,
333 "fsmc-nand", NULL),
334 OF_DEV_AUXDATA("arm,primecell", U300_UART0_BASE,
335 "uart0", NULL),
336 OF_DEV_AUXDATA("arm,primecell", U300_UART1_BASE,
337 "uart1", NULL),
338 OF_DEV_AUXDATA("arm,primecell", U300_SPI_BASE,
339 "pl022", NULL),
340 OF_DEV_AUXDATA("st,ddci2c", U300_I2C0_BASE,
341 "stu300.0", NULL),
342 OF_DEV_AUXDATA("st,ddci2c", U300_I2C1_BASE,
343 "stu300.1", NULL),
344 OF_DEV_AUXDATA("arm,primecell", U300_MMCSD_BASE,
345 "mmci", NULL),
346 { /* sentinel */ },
347};
348
349static void __init u300_init_irq_dt(void)
350{
351 struct device_node *syscon;
352 struct clk *clk;
353
354 syscon = of_find_node_by_path("/syscon@c0011000");
355 if (!syscon) {
356 pr_crit("could not find syscon node\n");
357 return;
358 }
359 syscon_base = of_iomap(syscon, 0);
360 if (!syscon_base) {
361 pr_crit("could not remap syscon\n");
362 return;
363 }
364 /* initialize clocking early, we want to clock the INTCON */
365 u300_clk_init(syscon_base);
366
367 /* Bootstrap EMIF and SEMI clocks */
368 clk = clk_get_sys("pl172", NULL);
369 BUG_ON(IS_ERR(clk));
370 clk_prepare_enable(clk);
371 clk = clk_get_sys("semi", NULL);
372 BUG_ON(IS_ERR(clk));
373 clk_prepare_enable(clk);
374
375 /* Clock the interrupt controller */
376 clk = clk_get_sys("intcon", NULL);
377 BUG_ON(IS_ERR(clk));
378 clk_prepare_enable(clk);
379
380 irqchip_init();
381}
382
383static void __init u300_init_machine_dt(void)
384{
385 u16 val;
386
387 /* Check what platform we run and print some status information */
388 u300_init_check_chip();
389
390 /* Initialize pinmuxing */
391 pinctrl_register_mappings(u300_pinmux_map,
392 ARRAY_SIZE(u300_pinmux_map));
393
394 of_platform_populate(NULL, of_default_bus_match_table,
395 u300_auxdata_lookup, NULL);
396
397 /* Enable SEMI self refresh */
398 val = readw(syscon_base + U300_SYSCON_SMCR) |
399 U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE;
400 writew(val, syscon_base + U300_SYSCON_SMCR);
401}
402
403static const char * u300_board_compat[] = {
404 "stericsson,u300",
405 NULL,
406};
407
408DT_MACHINE_START(U300_DT, "U300 S335/B335 (Device Tree)")
694 .map_io = u300_map_io, 409 .map_io = u300_map_io,
695 .nr_irqs = 0, 410 .init_irq = u300_init_irq_dt,
696 .init_irq = u300_init_irq, 411 .init_time = clocksource_of_init,
697 .init_time = u300_timer_init, 412 .init_machine = u300_init_machine_dt,
698 .init_machine = u300_init_machine,
699 .restart = u300_restart, 413 .restart = u300_restart,
414 .dt_compat = u300_board_compat,
700MACHINE_END 415MACHINE_END
diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 2785cb67b5e8..ec0283cf9a32 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -263,28 +263,22 @@ static int pl022_dummy_remove(struct spi_device *spi)
263 return 0; 263 return 0;
264} 264}
265 265
266static const struct of_device_id pl022_dummy_dt_match[] = {
267 { .compatible = "arm,pl022-dummy" },
268 {},
269};
270
266static struct spi_driver pl022_dummy_driver = { 271static struct spi_driver pl022_dummy_driver = {
267 .driver = { 272 .driver = {
268 .name = "spi-dummy", 273 .name = "spi-dummy",
269 .owner = THIS_MODULE, 274 .owner = THIS_MODULE,
275 .of_match_table = pl022_dummy_dt_match,
270 }, 276 },
271 .probe = pl022_dummy_probe, 277 .probe = pl022_dummy_probe,
272 .remove = pl022_dummy_remove, 278 .remove = pl022_dummy_remove,
273}; 279};
274 280
275static int __init pl022_init_dummy(void) 281module_spi_driver(pl022_dummy_driver);
276{
277 return spi_register_driver(&pl022_dummy_driver);
278}
279
280static void __exit pl022_exit_dummy(void)
281{
282 spi_unregister_driver(&pl022_dummy_driver);
283}
284
285module_init(pl022_init_dummy);
286module_exit(pl022_exit_dummy);
287
288MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>"); 282MODULE_AUTHOR("Linus Walleij <linus.walleij@stericsson.com>");
289MODULE_DESCRIPTION("PL022 SSP/SPI DUMMY Linux driver"); 283MODULE_DESCRIPTION("PL022 SSP/SPI DUMMY Linux driver");
290MODULE_LICENSE("GPL"); 284MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-u300/i2c.c b/arch/arm/mach-u300/i2c.c
deleted file mode 100644
index 96800aa1316d..000000000000
--- a/arch/arm/mach-u300/i2c.c
+++ /dev/null
@@ -1,285 +0,0 @@
1/*
2 * arch/arm/mach-u300/i2c.c
3 *
4 * Copyright (C) 2009-2012 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * Register board i2c devices
8 * Author: Linus Walleij <linus.walleij@stericsson.com>
9 */
10#include <linux/kernel.h>
11#include <linux/i2c.h>
12#include <linux/mfd/ab3100.h>
13#include <linux/regulator/machine.h>
14#include <linux/amba/bus.h>
15#include <mach/irqs.h>
16
17/*
18 * Initial settings of ab3100 registers.
19 * Common for below LDO regulator settings are that
20 * bit 7-5 controls voltage. Bit 4 turns regulator ON(1) or OFF(0).
21 * Bit 3-2 controls sleep enable and bit 1-0 controls sleep mode.
22 */
23
24/* LDO_A 0x16: 2.75V, ON, SLEEP_A, SLEEP OFF GND */
25#define LDO_A_SETTING 0x16
26/* LDO_C 0x10: 2.65V, ON, SLEEP_A or B, SLEEP full power */
27#define LDO_C_SETTING 0x10
28/* LDO_D 0x10: 2.65V, ON, sleep mode not used */
29#define LDO_D_SETTING 0x10
30/* LDO_E 0x10: 1.8V, ON, SLEEP_A or B, SLEEP full power */
31#define LDO_E_SETTING 0x10
32/* LDO_E SLEEP 0x00: 1.8V, not used, SLEEP_A or B, not used */
33#define LDO_E_SLEEP_SETTING 0x00
34/* LDO_F 0xD0: 2.5V, ON, SLEEP_A or B, SLEEP full power */
35#define LDO_F_SETTING 0xD0
36/* LDO_G 0x00: 2.85V, OFF, SLEEP_A or B, SLEEP full power */
37#define LDO_G_SETTING 0x00
38/* LDO_H 0x18: 2.75V, ON, SLEEP_B, SLEEP full power */
39#define LDO_H_SETTING 0x18
40/* LDO_K 0x00: 2.75V, OFF, SLEEP_A or B, SLEEP full power */
41#define LDO_K_SETTING 0x00
42/* LDO_EXT 0x00: Voltage not set, OFF, not used, not used */
43#define LDO_EXT_SETTING 0x00
44/* BUCK 0x7D: 1.2V, ON, SLEEP_A and B, SLEEP low power */
45#define BUCK_SETTING 0x7D
46/* BUCK SLEEP 0xAC: 1.05V, Not used, SLEEP_A and B, Not used */
47#define BUCK_SLEEP_SETTING 0xAC
48
49#ifdef CONFIG_AB3100_CORE
50static struct regulator_consumer_supply supply_ldo_c[] = {
51 {
52 .dev_name = "ab3100-codec",
53 .supply = "vaudio", /* Powers the codec */
54 },
55};
56
57/*
58 * This one needs to be a supply so we can turn it off
59 * in order to shut down the system.
60 */
61static struct regulator_consumer_supply supply_ldo_d[] = {
62 {
63 .supply = "vana15", /* Powers the SoC (CPU etc) */
64 },
65};
66
67static struct regulator_consumer_supply supply_ldo_g[] = {
68 {
69 .dev_name = "mmci",
70 .supply = "vmmc", /* Powers MMC/SD card */
71 },
72};
73
74static struct regulator_consumer_supply supply_ldo_h[] = {
75 {
76 .dev_name = "xgam_pdi",
77 .supply = "vdisp", /* Powers camera, display etc */
78 },
79};
80
81static struct regulator_consumer_supply supply_ldo_k[] = {
82 {
83 .dev_name = "irda",
84 .supply = "vir", /* Power IrDA */
85 },
86};
87
88/*
89 * This is a placeholder for whoever wish to use the
90 * external power.
91 */
92static struct regulator_consumer_supply supply_ldo_ext[] = {
93 {
94 .supply = "vext", /* External power */
95 },
96};
97
98/* Preset (hardware defined) voltages for these regulators */
99#define LDO_A_VOLTAGE 2750000
100#define LDO_C_VOLTAGE 2650000
101#define LDO_D_VOLTAGE 2650000
102
103static struct ab3100_platform_data ab3100_plf_data = {
104 .reg_constraints = {
105 /* LDO A routing and constraints */
106 {
107 .constraints = {
108 .name = "vrad",
109 .min_uV = LDO_A_VOLTAGE,
110 .max_uV = LDO_A_VOLTAGE,
111 .valid_modes_mask = REGULATOR_MODE_NORMAL,
112 .always_on = 1,
113 .boot_on = 1,
114 },
115 },
116 /* LDO C routing and constraints */
117 {
118 .constraints = {
119 .min_uV = LDO_C_VOLTAGE,
120 .max_uV = LDO_C_VOLTAGE,
121 .valid_modes_mask = REGULATOR_MODE_NORMAL,
122 },
123 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_c),
124 .consumer_supplies = supply_ldo_c,
125 },
126 /* LDO D routing and constraints */
127 {
128 .constraints = {
129 .min_uV = LDO_D_VOLTAGE,
130 .max_uV = LDO_D_VOLTAGE,
131 .valid_modes_mask = REGULATOR_MODE_NORMAL,
132 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
133 /*
134 * Actually this is boot_on but we need
135 * to reference count it externally to
136 * be able to shut down the system.
137 */
138 },
139 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_d),
140 .consumer_supplies = supply_ldo_d,
141 },
142 /* LDO E routing and constraints */
143 {
144 .constraints = {
145 .name = "vio",
146 .min_uV = 1800000,
147 .max_uV = 1800000,
148 .valid_modes_mask = REGULATOR_MODE_NORMAL,
149 .always_on = 1,
150 .boot_on = 1,
151 },
152 },
153 /* LDO F routing and constraints */
154 {
155 .constraints = {
156 .name = "vana25",
157 .min_uV = 2500000,
158 .max_uV = 2500000,
159 .valid_modes_mask = REGULATOR_MODE_NORMAL,
160 .always_on = 1,
161 .boot_on = 1,
162 },
163 },
164 /* LDO G routing and constraints */
165 {
166 .constraints = {
167 .min_uV = 1500000,
168 .max_uV = 2850000,
169 .valid_modes_mask = REGULATOR_MODE_NORMAL,
170 .valid_ops_mask =
171 REGULATOR_CHANGE_VOLTAGE |
172 REGULATOR_CHANGE_STATUS,
173 },
174 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_g),
175 .consumer_supplies = supply_ldo_g,
176 },
177 /* LDO H routing and constraints */
178 {
179 .constraints = {
180 .min_uV = 1200000,
181 .max_uV = 2750000,
182 .valid_modes_mask = REGULATOR_MODE_NORMAL,
183 .valid_ops_mask =
184 REGULATOR_CHANGE_VOLTAGE |
185 REGULATOR_CHANGE_STATUS,
186 },
187 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_h),
188 .consumer_supplies = supply_ldo_h,
189 },
190 /* LDO K routing and constraints */
191 {
192 .constraints = {
193 .min_uV = 1800000,
194 .max_uV = 2750000,
195 .valid_modes_mask = REGULATOR_MODE_NORMAL,
196 .valid_ops_mask =
197 REGULATOR_CHANGE_VOLTAGE |
198 REGULATOR_CHANGE_STATUS,
199 },
200 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_k),
201 .consumer_supplies = supply_ldo_k,
202 },
203 /* External regulator interface. No fixed voltage specified.
204 * If we knew the voltage of the external regulator and it
205 * was connected on the board, we could add the (fixed)
206 * voltage for it here.
207 */
208 {
209 .constraints = {
210 .min_uV = 0,
211 .max_uV = 0,
212 .valid_modes_mask = REGULATOR_MODE_NORMAL,
213 .valid_ops_mask =
214 REGULATOR_CHANGE_STATUS,
215 },
216 .num_consumer_supplies = ARRAY_SIZE(supply_ldo_ext),
217 .consumer_supplies = supply_ldo_ext,
218 },
219 /* Buck converter routing and constraints */
220 {
221 .constraints = {
222 .name = "vcore",
223 .min_uV = 1200000,
224 .max_uV = 1800000,
225 .valid_modes_mask = REGULATOR_MODE_NORMAL,
226 .valid_ops_mask =
227 REGULATOR_CHANGE_VOLTAGE,
228 .always_on = 1,
229 .boot_on = 1,
230 },
231 },
232 },
233 .reg_initvals = {
234 LDO_A_SETTING,
235 LDO_C_SETTING,
236 LDO_E_SETTING,
237 LDO_E_SLEEP_SETTING,
238 LDO_F_SETTING,
239 LDO_G_SETTING,
240 LDO_H_SETTING,
241 LDO_K_SETTING,
242 LDO_EXT_SETTING,
243 BUCK_SETTING,
244 BUCK_SLEEP_SETTING,
245 LDO_D_SETTING,
246 },
247};
248#endif
249
250static struct i2c_board_info __initdata bus0_i2c_board_info[] = {
251#ifdef CONFIG_AB3100_CORE
252 {
253 .type = "ab3100",
254 .addr = 0x48,
255 .irq = IRQ_U300_IRQ0_EXT,
256 .platform_data = &ab3100_plf_data,
257 },
258#else
259 { },
260#endif
261};
262
263static struct i2c_board_info __initdata bus1_i2c_board_info[] = {
264 {
265 .type = "fwcam",
266 .addr = 0x10,
267 },
268 {
269 .type = "fwcam",
270 .addr = 0x5d,
271 },
272};
273
274void __init u300_i2c_register_board_devices(void)
275{
276 i2c_register_board_info(0, bus0_i2c_board_info,
277 ARRAY_SIZE(bus0_i2c_board_info));
278 /*
279 * This makes the core shut down all unused regulators
280 * after all the initcalls have completed.
281 */
282 regulator_has_full_constraints();
283 i2c_register_board_info(1, bus1_i2c_board_info,
284 ARRAY_SIZE(bus1_i2c_board_info));
285}
diff --git a/arch/arm/mach-u300/i2c.h b/arch/arm/mach-u300/i2c.h
deleted file mode 100644
index 485c02e5c06d..000000000000
--- a/arch/arm/mach-u300/i2c.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/arm/mach-u300/i2c.h
3 *
4 * Copyright (C) 2009 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * Register board i2c devices
8 * Author: Linus Walleij <linus.walleij@stericsson.com>
9 */
10
11#ifndef MACH_U300_I2C_H
12#define MACH_U300_I2C_H
13
14#ifdef CONFIG_I2C_STU300
15void __init u300_i2c_register_board_devices(void);
16#else
17/* Compile out this stuff if no I2C adapter is available */
18static inline void __init u300_i2c_register_board_devices(void)
19{
20}
21#endif
22
23#endif
diff --git a/arch/arm/mach-u300/include/mach/hardware.h b/arch/arm/mach-u300/include/mach/hardware.h
deleted file mode 100644
index b99d4ce0ac2b..000000000000
--- a/arch/arm/mach-u300/include/mach/hardware.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * arch/arm/mach-u300/include/mach/hardware.h
3 */
4#include <asm/sizes.h>
5#include <mach/u300-regs.h>
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h
deleted file mode 100644
index 21d5e76a6cd3..000000000000
--- a/arch/arm/mach-u300/include/mach/irqs.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/irqs.h
4 *
5 *
6 * Copyright (C) 2006-2012 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * IRQ channel definitions for the U300 platforms.
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */
11
12#ifndef __MACH_IRQS_H
13#define __MACH_IRQS_H
14
15#define IRQ_U300_INTCON0_START 32
16#define IRQ_U300_INTCON1_START 64
17/* These are on INTCON0 - 30 lines */
18#define IRQ_U300_IRQ0_EXT 32
19#define IRQ_U300_IRQ1_EXT 33
20#define IRQ_U300_DMA 34
21#define IRQ_U300_VIDEO_ENC_0 35
22#define IRQ_U300_VIDEO_ENC_1 36
23#define IRQ_U300_AAIF_RX 37
24#define IRQ_U300_AAIF_TX 38
25#define IRQ_U300_AAIF_VGPIO 39
26#define IRQ_U300_AAIF_WAKEUP 40
27#define IRQ_U300_PCM_I2S0_FRAME 41
28#define IRQ_U300_PCM_I2S0_FIFO 42
29#define IRQ_U300_PCM_I2S1_FRAME 43
30#define IRQ_U300_PCM_I2S1_FIFO 44
31#define IRQ_U300_XGAM_GAMCON 45
32#define IRQ_U300_XGAM_CDI 46
33#define IRQ_U300_XGAM_CDICON 47
34#define IRQ_U300_XGAM_PDI 49
35#define IRQ_U300_XGAM_PDICON 50
36#define IRQ_U300_XGAM_GAMEACC 51
37#define IRQ_U300_XGAM_MCIDCT 52
38#define IRQ_U300_APEX 53
39#define IRQ_U300_UART0 54
40#define IRQ_U300_SPI 55
41#define IRQ_U300_TIMER_APP_OS 56
42#define IRQ_U300_TIMER_APP_DD 57
43#define IRQ_U300_TIMER_APP_GP1 58
44#define IRQ_U300_TIMER_APP_GP2 59
45#define IRQ_U300_TIMER_OS 60
46#define IRQ_U300_TIMER_MS 61
47#define IRQ_U300_KEYPAD_KEYBF 62
48#define IRQ_U300_KEYPAD_KEYBR 63
49/* These are on INTCON1 - 32 lines */
50#define IRQ_U300_GPIO_PORT0 64
51#define IRQ_U300_GPIO_PORT1 65
52#define IRQ_U300_GPIO_PORT2 66
53
54/* These are for DB3150, DB3200 and DB3350 */
55#define IRQ_U300_WDOG 67
56#define IRQ_U300_EVHIST 68
57#define IRQ_U300_MSPRO 69
58#define IRQ_U300_MMCSD_MCIINTR0 70
59#define IRQ_U300_MMCSD_MCIINTR1 71
60#define IRQ_U300_I2C0 72
61#define IRQ_U300_I2C1 73
62#define IRQ_U300_RTC 74
63#define IRQ_U300_NFIF 75
64#define IRQ_U300_NFIF2 76
65
66/* The DB3350-specific interrupt lines */
67#define IRQ_U300_ISP_F0 77
68#define IRQ_U300_ISP_F1 78
69#define IRQ_U300_ISP_F2 79
70#define IRQ_U300_ISP_F3 80
71#define IRQ_U300_ISP_F4 81
72#define IRQ_U300_GPIO_PORT3 82
73#define IRQ_U300_SYSCON_PLL_LOCK 83
74#define IRQ_U300_UART1 84
75#define IRQ_U300_GPIO_PORT4 85
76#define IRQ_U300_GPIO_PORT5 86
77#define IRQ_U300_GPIO_PORT6 87
78#define U300_VIC_IRQS_END 88
79
80#endif
diff --git a/arch/arm/mach-u300/include/mach/syscon.h b/arch/arm/mach-u300/include/mach/syscon.h
deleted file mode 100644
index 10bdd0be9774..000000000000
--- a/arch/arm/mach-u300/include/mach/syscon.h
+++ /dev/null
@@ -1,592 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/syscon.h
4 *
5 *
6 * Copyright (C) 2008-2012 ST-Ericsson AB
7 *
8 * Author: Rickard Andersson <rickard.andersson@stericsson.com>
9 */
10
11#ifndef __MACH_SYSCON_H
12#define __MACH_SYSCON_H
13
14/*
15 * All register defines for SYSCON registers that concerns individual
16 * block clocks and reset lines are registered here. This is because
17 * we don't want any other file to try to fool around with this stuff.
18 */
19
20/* APP side SYSCON registers */
21/* TODO: this is incomplete. Add all from asic_syscon_map.h eventually. */
22/* CLK Control Register 16bit (R/W) */
23#define U300_SYSCON_CCR (0x0000)
24#define U300_SYSCON_CCR_I2S1_USE_VCXO (0x0040)
25#define U300_SYSCON_CCR_I2S0_USE_VCXO (0x0020)
26#define U300_SYSCON_CCR_TURN_VCXO_ON (0x0008)
27#define U300_SYSCON_CCR_CLKING_PERFORMANCE_MASK (0x0007)
28#define U300_SYSCON_CCR_CLKING_PERFORMANCE_LOW_POWER (0x04)
29#define U300_SYSCON_CCR_CLKING_PERFORMANCE_LOW (0x03)
30#define U300_SYSCON_CCR_CLKING_PERFORMANCE_INTERMEDIATE (0x02)
31#define U300_SYSCON_CCR_CLKING_PERFORMANCE_HIGH (0x01)
32#define U300_SYSCON_CCR_CLKING_PERFORMANCE_BEST (0x00)
33/* CLK Status Register 16bit (R/W) */
34#define U300_SYSCON_CSR (0x0004)
35#define U300_SYSCON_CSR_PLL208_LOCK_IND (0x0002)
36#define U300_SYSCON_CSR_PLL13_LOCK_IND (0x0001)
37/* Reset lines for SLOW devices 16bit (R/W) */
38#define U300_SYSCON_RSR (0x0014)
39#define U300_SYSCON_RSR_PPM_RESET_EN (0x0200)
40#define U300_SYSCON_RSR_ACC_TMR_RESET_EN (0x0100)
41#define U300_SYSCON_RSR_APP_TMR_RESET_EN (0x0080)
42#define U300_SYSCON_RSR_RTC_RESET_EN (0x0040)
43#define U300_SYSCON_RSR_KEYPAD_RESET_EN (0x0020)
44#define U300_SYSCON_RSR_GPIO_RESET_EN (0x0010)
45#define U300_SYSCON_RSR_EH_RESET_EN (0x0008)
46#define U300_SYSCON_RSR_BTR_RESET_EN (0x0004)
47#define U300_SYSCON_RSR_UART_RESET_EN (0x0002)
48#define U300_SYSCON_RSR_SLOW_BRIDGE_RESET_EN (0x0001)
49/* Reset lines for FAST devices 16bit (R/W) */
50#define U300_SYSCON_RFR (0x0018)
51#define U300_SYSCON_RFR_UART1_RESET_ENABLE (0x0080)
52#define U300_SYSCON_RFR_SPI_RESET_ENABLE (0x0040)
53#define U300_SYSCON_RFR_MMC_RESET_ENABLE (0x0020)
54#define U300_SYSCON_RFR_PCM_I2S1_RESET_ENABLE (0x0010)
55#define U300_SYSCON_RFR_PCM_I2S0_RESET_ENABLE (0x0008)
56#define U300_SYSCON_RFR_I2C1_RESET_ENABLE (0x0004)
57#define U300_SYSCON_RFR_I2C0_RESET_ENABLE (0x0002)
58#define U300_SYSCON_RFR_FAST_BRIDGE_RESET_ENABLE (0x0001)
59/* Reset lines for the rest of the peripherals 16bit (R/W) */
60#define U300_SYSCON_RRR (0x001c)
61#define U300_SYSCON_RRR_CDS_RESET_EN (0x4000)
62#define U300_SYSCON_RRR_ISP_RESET_EN (0x2000)
63#define U300_SYSCON_RRR_INTCON_RESET_EN (0x1000)
64#define U300_SYSCON_RRR_MSPRO_RESET_EN (0x0800)
65#define U300_SYSCON_RRR_XGAM_RESET_EN (0x0100)
66#define U300_SYSCON_RRR_XGAM_VC_SYNC_RESET_EN (0x0080)
67#define U300_SYSCON_RRR_NANDIF_RESET_EN (0x0040)
68#define U300_SYSCON_RRR_EMIF_RESET_EN (0x0020)
69#define U300_SYSCON_RRR_DMAC_RESET_EN (0x0010)
70#define U300_SYSCON_RRR_CPU_RESET_EN (0x0008)
71#define U300_SYSCON_RRR_APEX_RESET_EN (0x0004)
72#define U300_SYSCON_RRR_AHB_RESET_EN (0x0002)
73#define U300_SYSCON_RRR_AAIF_RESET_EN (0x0001)
74/* Clock enable for SLOW peripherals 16bit (R/W) */
75#define U300_SYSCON_CESR (0x0020)
76#define U300_SYSCON_CESR_PPM_CLK_EN (0x0200)
77#define U300_SYSCON_CESR_ACC_TMR_CLK_EN (0x0100)
78#define U300_SYSCON_CESR_APP_TMR_CLK_EN (0x0080)
79#define U300_SYSCON_CESR_KEYPAD_CLK_EN (0x0040)
80#define U300_SYSCON_CESR_GPIO_CLK_EN (0x0010)
81#define U300_SYSCON_CESR_EH_CLK_EN (0x0008)
82#define U300_SYSCON_CESR_BTR_CLK_EN (0x0004)
83#define U300_SYSCON_CESR_UART_CLK_EN (0x0002)
84#define U300_SYSCON_CESR_SLOW_BRIDGE_CLK_EN (0x0001)
85/* Clock enable for FAST peripherals 16bit (R/W) */
86#define U300_SYSCON_CEFR (0x0024)
87#define U300_SYSCON_CEFR_UART1_CLK_EN (0x0200)
88#define U300_SYSCON_CEFR_I2S1_CORE_CLK_EN (0x0100)
89#define U300_SYSCON_CEFR_I2S0_CORE_CLK_EN (0x0080)
90#define U300_SYSCON_CEFR_SPI_CLK_EN (0x0040)
91#define U300_SYSCON_CEFR_MMC_CLK_EN (0x0020)
92#define U300_SYSCON_CEFR_I2S1_CLK_EN (0x0010)
93#define U300_SYSCON_CEFR_I2S0_CLK_EN (0x0008)
94#define U300_SYSCON_CEFR_I2C1_CLK_EN (0x0004)
95#define U300_SYSCON_CEFR_I2C0_CLK_EN (0x0002)
96#define U300_SYSCON_CEFR_FAST_BRIDGE_CLK_EN (0x0001)
97/* Clock enable for the rest of the peripherals 16bit (R/W) */
98#define U300_SYSCON_CERR (0x0028)
99#define U300_SYSCON_CERR_CDS_CLK_EN (0x2000)
100#define U300_SYSCON_CERR_ISP_CLK_EN (0x1000)
101#define U300_SYSCON_CERR_MSPRO_CLK_EN (0x0800)
102#define U300_SYSCON_CERR_AHB_SUBSYS_BRIDGE_CLK_EN (0x0400)
103#define U300_SYSCON_CERR_SEMI_CLK_EN (0x0200)
104#define U300_SYSCON_CERR_XGAM_CLK_EN (0x0100)
105#define U300_SYSCON_CERR_VIDEO_ENC_CLK_EN (0x0080)
106#define U300_SYSCON_CERR_NANDIF_CLK_EN (0x0040)
107#define U300_SYSCON_CERR_EMIF_CLK_EN (0x0020)
108#define U300_SYSCON_CERR_DMAC_CLK_EN (0x0010)
109#define U300_SYSCON_CERR_CPU_CLK_EN (0x0008)
110#define U300_SYSCON_CERR_APEX_CLK_EN (0x0004)
111#define U300_SYSCON_CERR_AHB_CLK_EN (0x0002)
112#define U300_SYSCON_CERR_AAIF_CLK_EN (0x0001)
113/* Single block clock enable 16bit (-/W) */
114#define U300_SYSCON_SBCER (0x002c)
115#define U300_SYSCON_SBCER_PPM_CLK_EN (0x0009)
116#define U300_SYSCON_SBCER_ACC_TMR_CLK_EN (0x0008)
117#define U300_SYSCON_SBCER_APP_TMR_CLK_EN (0x0007)
118#define U300_SYSCON_SBCER_KEYPAD_CLK_EN (0x0006)
119#define U300_SYSCON_SBCER_GPIO_CLK_EN (0x0004)
120#define U300_SYSCON_SBCER_EH_CLK_EN (0x0003)
121#define U300_SYSCON_SBCER_BTR_CLK_EN (0x0002)
122#define U300_SYSCON_SBCER_UART_CLK_EN (0x0001)
123#define U300_SYSCON_SBCER_SLOW_BRIDGE_CLK_EN (0x0000)
124#define U300_SYSCON_SBCER_UART1_CLK_EN (0x0019)
125#define U300_SYSCON_SBCER_I2S1_CORE_CLK_EN (0x0018)
126#define U300_SYSCON_SBCER_I2S0_CORE_CLK_EN (0x0017)
127#define U300_SYSCON_SBCER_SPI_CLK_EN (0x0016)
128#define U300_SYSCON_SBCER_MMC_CLK_EN (0x0015)
129#define U300_SYSCON_SBCER_I2S1_CLK_EN (0x0014)
130#define U300_SYSCON_SBCER_I2S0_CLK_EN (0x0013)
131#define U300_SYSCON_SBCER_I2C1_CLK_EN (0x0012)
132#define U300_SYSCON_SBCER_I2C0_CLK_EN (0x0011)
133#define U300_SYSCON_SBCER_FAST_BRIDGE_CLK_EN (0x0010)
134#define U300_SYSCON_SBCER_CDS_CLK_EN (0x002D)
135#define U300_SYSCON_SBCER_ISP_CLK_EN (0x002C)
136#define U300_SYSCON_SBCER_MSPRO_CLK_EN (0x002B)
137#define U300_SYSCON_SBCER_AHB_SUBSYS_BRIDGE_CLK_EN (0x002A)
138#define U300_SYSCON_SBCER_SEMI_CLK_EN (0x0029)
139#define U300_SYSCON_SBCER_XGAM_CLK_EN (0x0028)
140#define U300_SYSCON_SBCER_VIDEO_ENC_CLK_EN (0x0027)
141#define U300_SYSCON_SBCER_NANDIF_CLK_EN (0x0026)
142#define U300_SYSCON_SBCER_EMIF_CLK_EN (0x0025)
143#define U300_SYSCON_SBCER_DMAC_CLK_EN (0x0024)
144#define U300_SYSCON_SBCER_CPU_CLK_EN (0x0023)
145#define U300_SYSCON_SBCER_APEX_CLK_EN (0x0022)
146#define U300_SYSCON_SBCER_AHB_CLK_EN (0x0021)
147#define U300_SYSCON_SBCER_AAIF_CLK_EN (0x0020)
148/* Single block clock disable 16bit (-/W) */
149#define U300_SYSCON_SBCDR (0x0030)
150/* Same values as above for SBCER */
151/* Clock force SLOW peripherals 16bit (R/W) */
152#define U300_SYSCON_CFSR (0x003c)
153#define U300_SYSCON_CFSR_PPM_CLK_FORCE_EN (0x0200)
154#define U300_SYSCON_CFSR_ACC_TMR_CLK_FORCE_EN (0x0100)
155#define U300_SYSCON_CFSR_APP_TMR_CLK_FORCE_EN (0x0080)
156#define U300_SYSCON_CFSR_KEYPAD_CLK_FORCE_EN (0x0020)
157#define U300_SYSCON_CFSR_GPIO_CLK_FORCE_EN (0x0010)
158#define U300_SYSCON_CFSR_EH_CLK_FORCE_EN (0x0008)
159#define U300_SYSCON_CFSR_BTR_CLK_FORCE_EN (0x0004)
160#define U300_SYSCON_CFSR_UART_CLK_FORCE_EN (0x0002)
161#define U300_SYSCON_CFSR_SLOW_BRIDGE_CLK_FORCE_EN (0x0001)
162/* Clock force FAST peripherals 16bit (R/W) */
163#define U300_SYSCON_CFFR (0x40)
164/* Values not defined. Define if you want to use them. */
165/* Clock force the rest of the peripherals 16bit (R/W) */
166#define U300_SYSCON_CFRR (0x44)
167#define U300_SYSCON_CFRR_CDS_CLK_FORCE_EN (0x2000)
168#define U300_SYSCON_CFRR_ISP_CLK_FORCE_EN (0x1000)
169#define U300_SYSCON_CFRR_MSPRO_CLK_FORCE_EN (0x0800)
170#define U300_SYSCON_CFRR_AHB_SUBSYS_BRIDGE_CLK_FORCE_EN (0x0400)
171#define U300_SYSCON_CFRR_SEMI_CLK_FORCE_EN (0x0200)
172#define U300_SYSCON_CFRR_XGAM_CLK_FORCE_EN (0x0100)
173#define U300_SYSCON_CFRR_VIDEO_ENC_CLK_FORCE_EN (0x0080)
174#define U300_SYSCON_CFRR_NANDIF_CLK_FORCE_EN (0x0040)
175#define U300_SYSCON_CFRR_EMIF_CLK_FORCE_EN (0x0020)
176#define U300_SYSCON_CFRR_DMAC_CLK_FORCE_EN (0x0010)
177#define U300_SYSCON_CFRR_CPU_CLK_FORCE_EN (0x0008)
178#define U300_SYSCON_CFRR_APEX_CLK_FORCE_EN (0x0004)
179#define U300_SYSCON_CFRR_AHB_CLK_FORCE_EN (0x0002)
180#define U300_SYSCON_CFRR_AAIF_CLK_FORCE_EN (0x0001)
181/* PLL208 Frequency Control 16bit (R/W) */
182#define U300_SYSCON_PFCR (0x48)
183#define U300_SYSCON_PFCR_DPLL_MULT_NUM (0x000F)
184/* Power Management Control 16bit (R/W) */
185#define U300_SYSCON_PMCR (0x50)
186#define U300_SYSCON_PMCR_DCON_ENABLE (0x0002)
187#define U300_SYSCON_PMCR_PWR_MGNT_ENABLE (0x0001)
188/*
189 * All other clocking registers moved to clock.c!
190 */
191/* Reset Out 16bit (R/W) */
192#define U300_SYSCON_RCR (0x6c)
193#define U300_SYSCON_RCR_RESOUT0_RST_N_DISABLE (0x0001)
194/* EMIF Slew Rate Control 16bit (R/W) */
195#define U300_SYSCON_SRCLR (0x70)
196#define U300_SYSCON_SRCLR_MASK (0x03FF)
197#define U300_SYSCON_SRCLR_VALUE (0x03FF)
198#define U300_SYSCON_SRCLR_EMIF_1_SLRC_5_B (0x0200)
199#define U300_SYSCON_SRCLR_EMIF_1_SLRC_5_A (0x0100)
200#define U300_SYSCON_SRCLR_EMIF_1_SLRC_4_B (0x0080)
201#define U300_SYSCON_SRCLR_EMIF_1_SLRC_4_A (0x0040)
202#define U300_SYSCON_SRCLR_EMIF_1_SLRC_3_B (0x0020)
203#define U300_SYSCON_SRCLR_EMIF_1_SLRC_3_A (0x0010)
204#define U300_SYSCON_SRCLR_EMIF_1_SLRC_2_B (0x0008)
205#define U300_SYSCON_SRCLR_EMIF_1_SLRC_2_A (0x0004)
206#define U300_SYSCON_SRCLR_EMIF_1_SLRC_1_B (0x0002)
207#define U300_SYSCON_SRCLR_EMIF_1_SLRC_1_A (0x0001)
208/* EMIF Clock Control Register 16bit (R/W) */
209#define U300_SYSCON_ECCR (0x0078)
210#define U300_SYSCON_ECCR_MASK (0x000F)
211#define U300_SYSCON_ECCR_EMIF_1_STATIC_CLK_EN_N_DISABLE (0x0008)
212#define U300_SYSCON_ECCR_EMIF_1_RET_OUT_CLK_EN_N_DISABLE (0x0004)
213#define U300_SYSCON_ECCR_EMIF_MEMCLK_RET_EN_N_DISABLE (0x0002)
214#define U300_SYSCON_ECCR_EMIF_SDRCLK_RET_EN_N_DISABLE (0x0001)
215/* Step one for killing the applications system 16bit (-/W) */
216#define U300_SYSCON_KA1R (0x0080)
217#define U300_SYSCON_KA1R_MASK (0xFFFF)
218#define U300_SYSCON_KA1R_VALUE (0xFFFF)
219/* Step two for killing the application system 16bit (-/W) */
220#define U300_SYSCON_KA2R (0x0084)
221#define U300_SYSCON_KA2R_MASK (0xFFFF)
222#define U300_SYSCON_KA2R_VALUE (0xFFFF)
223/* MMC/MSPRO frequency divider register 0 16bit (R/W) */
224#define U300_SYSCON_MMF0R (0x90)
225#define U300_SYSCON_MMF0R_MASK (0x00FF)
226#define U300_SYSCON_MMF0R_FREQ_0_HIGH_MASK (0x00F0)
227#define U300_SYSCON_MMF0R_FREQ_0_LOW_MASK (0x000F)
228/* MMC/MSPRO frequency divider register 1 16bit (R/W) */
229#define U300_SYSCON_MMF1R (0x94)
230#define U300_SYSCON_MMF1R_MASK (0x00FF)
231#define U300_SYSCON_MMF1R_FREQ_1_HIGH_MASK (0x00F0)
232#define U300_SYSCON_MMF1R_FREQ_1_LOW_MASK (0x000F)
233/* AAIF control register 16 bit (R/W) */
234#define U300_SYSCON_AAIFCR (0x98)
235#define U300_SYSCON_AAIFCR_MASK (0x0003)
236#define U300_SYSCON_AAIFCR_AASW_CTRL_MASK (0x0003)
237#define U300_SYSCON_AAIFCR_AASW_CTRL_FUNCTIONAL (0x0000)
238#define U300_SYSCON_AAIFCR_AASW_CTRL_MONITORING (0x0001)
239#define U300_SYSCON_AAIFCR_AASW_CTRL_ACC_TO_EXT (0x0002)
240#define U300_SYSCON_AAIFCR_AASW_CTRL_APP_TO_EXT (0x0003)
241/* Clock control for the MMC and MSPRO blocks 16bit (R/W) */
242#define U300_SYSCON_MMCR (0x9C)
243#define U300_SYSCON_MMCR_MASK (0x0003)
244#define U300_SYSCON_MMCR_MMC_FB_CLK_SEL_ENABLE (0x0002)
245#define U300_SYSCON_MMCR_MSPRO_FREQSEL_ENABLE (0x0001)
246/* Pull up/down control (R/W) */
247#define U300_SYSCON_PUCR (0x104)
248#define U300_SYSCON_PUCR_EMIF_1_WAIT_N_PU_ENABLE (0x0200)
249#define U300_SYSCON_PUCR_EMIF_1_NFIF_READY_PU_ENABLE (0x0100)
250#define U300_SYSCON_PUCR_EMIF_1_16BIT_PU_ENABLE (0x0080)
251#define U300_SYSCON_PUCR_EMIF_1_8BIT_PU_ENABLE (0x0040)
252#define U300_SYSCON_PUCR_KEY_IN_PU_EN_MASK (0x003F)
253/* SYS_0_CLK_CONTROL first clock control 16bit (R/W) */
254#define U300_SYSCON_S0CCR (0x120)
255#define U300_SYSCON_S0CCR_FIELD_MASK (0x43FF)
256#define U300_SYSCON_S0CCR_CLOCK_REQ (0x4000)
257#define U300_SYSCON_S0CCR_CLOCK_REQ_MONITOR (0x2000)
258#define U300_SYSCON_S0CCR_CLOCK_INV (0x0200)
259#define U300_SYSCON_S0CCR_CLOCK_FREQ_MASK (0x01E0)
260#define U300_SYSCON_S0CCR_CLOCK_SELECT_MASK (0x001E)
261#define U300_SYSCON_S0CCR_CLOCK_ENABLE (0x0001)
262#define U300_SYSCON_S0CCR_SEL_MCLK (0x8<<1)
263#define U300_SYSCON_S0CCR_SEL_ACC_FSM_CLK (0xA<<1)
264#define U300_SYSCON_S0CCR_SEL_PLL60_48_CLK (0xC<<1)
265#define U300_SYSCON_S0CCR_SEL_PLL60_60_CLK (0xD<<1)
266#define U300_SYSCON_S0CCR_SEL_ACC_PLL208_CLK (0xE<<1)
267#define U300_SYSCON_S0CCR_SEL_APP_PLL13_CLK (0x0<<1)
268#define U300_SYSCON_S0CCR_SEL_APP_FSM_CLK (0x2<<1)
269#define U300_SYSCON_S0CCR_SEL_RTC_CLK (0x4<<1)
270#define U300_SYSCON_S0CCR_SEL_APP_PLL208_CLK (0x6<<1)
271/* SYS_1_CLK_CONTROL second clock control 16 bit (R/W) */
272#define U300_SYSCON_S1CCR (0x124)
273#define U300_SYSCON_S1CCR_FIELD_MASK (0x43FF)
274#define U300_SYSCON_S1CCR_CLOCK_REQ (0x4000)
275#define U300_SYSCON_S1CCR_CLOCK_REQ_MONITOR (0x2000)
276#define U300_SYSCON_S1CCR_CLOCK_INV (0x0200)
277#define U300_SYSCON_S1CCR_CLOCK_FREQ_MASK (0x01E0)
278#define U300_SYSCON_S1CCR_CLOCK_SELECT_MASK (0x001E)
279#define U300_SYSCON_S1CCR_CLOCK_ENABLE (0x0001)
280#define U300_SYSCON_S1CCR_SEL_MCLK (0x8<<1)
281#define U300_SYSCON_S1CCR_SEL_ACC_FSM_CLK (0xA<<1)
282#define U300_SYSCON_S1CCR_SEL_PLL60_48_CLK (0xC<<1)
283#define U300_SYSCON_S1CCR_SEL_PLL60_60_CLK (0xD<<1)
284#define U300_SYSCON_S1CCR_SEL_ACC_PLL208_CLK (0xE<<1)
285#define U300_SYSCON_S1CCR_SEL_ACC_PLL13_CLK (0x0<<1)
286#define U300_SYSCON_S1CCR_SEL_APP_FSM_CLK (0x2<<1)
287#define U300_SYSCON_S1CCR_SEL_RTC_CLK (0x4<<1)
288#define U300_SYSCON_S1CCR_SEL_APP_PLL208_CLK (0x6<<1)
289/* SYS_2_CLK_CONTROL third clock contol 16 bit (R/W) */
290#define U300_SYSCON_S2CCR (0x128)
291#define U300_SYSCON_S2CCR_FIELD_MASK (0xC3FF)
292#define U300_SYSCON_S2CCR_CLK_STEAL (0x8000)
293#define U300_SYSCON_S2CCR_CLOCK_REQ (0x4000)
294#define U300_SYSCON_S2CCR_CLOCK_REQ_MONITOR (0x2000)
295#define U300_SYSCON_S2CCR_CLOCK_INV (0x0200)
296#define U300_SYSCON_S2CCR_CLOCK_FREQ_MASK (0x01E0)
297#define U300_SYSCON_S2CCR_CLOCK_SELECT_MASK (0x001E)
298#define U300_SYSCON_S2CCR_CLOCK_ENABLE (0x0001)
299#define U300_SYSCON_S2CCR_SEL_MCLK (0x8<<1)
300#define U300_SYSCON_S2CCR_SEL_ACC_FSM_CLK (0xA<<1)
301#define U300_SYSCON_S2CCR_SEL_PLL60_48_CLK (0xC<<1)
302#define U300_SYSCON_S2CCR_SEL_PLL60_60_CLK (0xD<<1)
303#define U300_SYSCON_S2CCR_SEL_ACC_PLL208_CLK (0xE<<1)
304#define U300_SYSCON_S2CCR_SEL_ACC_PLL13_CLK (0x0<<1)
305#define U300_SYSCON_S2CCR_SEL_APP_FSM_CLK (0x2<<1)
306#define U300_SYSCON_S2CCR_SEL_RTC_CLK (0x4<<1)
307#define U300_SYSCON_S2CCR_SEL_APP_PLL208_CLK (0x6<<1)
308/* SYS_MISC_CONTROL, miscellaneous 16bit (R/W) */
309#define U300_SYSCON_MCR (0x12c)
310#define U300_SYSCON_MCR_FIELD_MASK (0x00FF)
311#define U300_SYSCON_MCR_PMGEN_CR_4_MASK (0x00C0)
312#define U300_SYSCON_MCR_PMGEN_CR_4_GPIO (0x0000)
313#define U300_SYSCON_MCR_PMGEN_CR_4_SPI (0x0040)
314#define U300_SYSCON_MCR_PMGEN_CR_4_AAIF (0x00C0)
315#define U300_SYSCON_MCR_PMGEN_CR_2_MASK (0x0030)
316#define U300_SYSCON_MCR_PMGEN_CR_2_GPIO (0x0000)
317#define U300_SYSCON_MCR_PMGEN_CR_2_EMIF_1_STATIC (0x0010)
318#define U300_SYSCON_MCR_PMGEN_CR_2_DSP (0x0020)
319#define U300_SYSCON_MCR_PMGEN_CR_2_AAIF (0x0030)
320#define U300_SYSCON_MCR_PMGEN_CR_0_MASK (0x000C)
321#define U300_SYSCON_MCR_PMGEN_CR_0_EMIF_1_SDRAM_M1 (0x0000)
322#define U300_SYSCON_MCR_PMGEN_CR_0_EMIF_1_SDRAM_M2 (0x0004)
323#define U300_SYSCON_MCR_PMGEN_CR_0_EMIF_1_SDRAM_M3 (0x0008)
324#define U300_SYSCON_MCR_PMGEN_CR_0_EMIF_0_SDRAM (0x000C)
325#define U300_SYSCON_MCR_PM1G_MODE_ENABLE (0x0002)
326#define U300_SYSCON_MCR_PMTG5_MODE_ENABLE (0x0001)
327/* SC_PLL_IRQ_CONTROL 16bit (R/W) */
328#define U300_SYSCON_PICR (0x0130)
329#define U300_SYSCON_PICR_MASK (0x00FF)
330#define U300_SYSCON_PICR_FORCE_PLL208_LOCK_LOW_ENABLE (0x0080)
331#define U300_SYSCON_PICR_FORCE_PLL208_LOCK_HIGH_ENABLE (0x0040)
332#define U300_SYSCON_PICR_FORCE_PLL13_LOCK_LOW_ENABLE (0x0020)
333#define U300_SYSCON_PICR_FORCE_PLL13_LOCK_HIGH_ENABLE (0x0010)
334#define U300_SYSCON_PICR_IRQMASK_PLL13_UNLOCK_ENABLE (0x0008)
335#define U300_SYSCON_PICR_IRQMASK_PLL13_LOCK_ENABLE (0x0004)
336#define U300_SYSCON_PICR_IRQMASK_PLL208_UNLOCK_ENABLE (0x0002)
337#define U300_SYSCON_PICR_IRQMASK_PLL208_LOCK_ENABLE (0x0001)
338/* SC_PLL_IRQ_STATUS 16 bit (R/-) */
339#define U300_SYSCON_PISR (0x0134)
340#define U300_SYSCON_PISR_MASK (0x000F)
341#define U300_SYSCON_PISR_PLL13_UNLOCK_IND (0x0008)
342#define U300_SYSCON_PISR_PLL13_LOCK_IND (0x0004)
343#define U300_SYSCON_PISR_PLL208_UNLOCK_IND (0x0002)
344#define U300_SYSCON_PISR_PLL208_LOCK_IND (0x0001)
345/* SC_PLL_IRQ_CLEAR 16 bit (-/W) */
346#define U300_SYSCON_PICLR (0x0138)
347#define U300_SYSCON_PICLR_MASK (0x000F)
348#define U300_SYSCON_PICLR_RWMASK (0x0000)
349#define U300_SYSCON_PICLR_PLL13_UNLOCK_SC (0x0008)
350#define U300_SYSCON_PICLR_PLL13_LOCK_SC (0x0004)
351#define U300_SYSCON_PICLR_PLL208_UNLOCK_SC (0x0002)
352#define U300_SYSCON_PICLR_PLL208_LOCK_SC (0x0001)
353/* CAMIF_CONTROL 16 bit (-/W) */
354#define U300_SYSCON_CICR (0x013C)
355#define U300_SYSCON_CICR_MASK (0x0FFF)
356#define U300_SYSCON_CICR_APP_SUBLVDS_TESTMODE_MASK (0x0F00)
357#define U300_SYSCON_CICR_APP_SUBLVDS_TESTMODE_PORT1 (0x0C00)
358#define U300_SYSCON_CICR_APP_SUBLVDS_TESTMODE_PORT0 (0x0300)
359#define U300_SYSCON_CICR_APP_SUBLVDS_RESCON_MASK (0x00F0)
360#define U300_SYSCON_CICR_APP_SUBLVDS_RESCON_PORT1 (0x00C0)
361#define U300_SYSCON_CICR_APP_SUBLVDS_RESCON_PORT0 (0x0030)
362#define U300_SYSCON_CICR_APP_SUBLVDS_PWR_DWN_N_MASK (0x000F)
363#define U300_SYSCON_CICR_APP_SUBLVDS_PWR_DWN_N_PORT1 (0x000C)
364#define U300_SYSCON_CICR_APP_SUBLVDS_PWR_DWN_N_PORT0 (0x0003)
365/* Clock activity observability register 0 */
366#define U300_SYSCON_C0OAR (0x140)
367#define U300_SYSCON_C0OAR_MASK (0xFFFF)
368#define U300_SYSCON_C0OAR_VALUE (0xFFFF)
369#define U300_SYSCON_C0OAR_BT_H_CLK (0x8000)
370#define U300_SYSCON_C0OAR_ASPB_P_CLK (0x4000)
371#define U300_SYSCON_C0OAR_APP_SEMI_H_CLK (0x2000)
372#define U300_SYSCON_C0OAR_APP_SEMI_CLK (0x1000)
373#define U300_SYSCON_C0OAR_APP_MMC_MSPRO_CLK (0x0800)
374#define U300_SYSCON_C0OAR_APP_I2S1_CLK (0x0400)
375#define U300_SYSCON_C0OAR_APP_I2S0_CLK (0x0200)
376#define U300_SYSCON_C0OAR_APP_CPU_CLK (0x0100)
377#define U300_SYSCON_C0OAR_APP_52_CLK (0x0080)
378#define U300_SYSCON_C0OAR_APP_208_CLK (0x0040)
379#define U300_SYSCON_C0OAR_APP_104_CLK (0x0020)
380#define U300_SYSCON_C0OAR_APEX_CLK (0x0010)
381#define U300_SYSCON_C0OAR_AHPB_M_H_CLK (0x0008)
382#define U300_SYSCON_C0OAR_AHB_CLK (0x0004)
383#define U300_SYSCON_C0OAR_AFPB_P_CLK (0x0002)
384#define U300_SYSCON_C0OAR_AAIF_CLK (0x0001)
385/* Clock activity observability register 1 */
386#define U300_SYSCON_C1OAR (0x144)
387#define U300_SYSCON_C1OAR_MASK (0x3FFE)
388#define U300_SYSCON_C1OAR_VALUE (0x3FFE)
389#define U300_SYSCON_C1OAR_NFIF_F_CLK (0x2000)
390#define U300_SYSCON_C1OAR_MSPRO_CLK (0x1000)
391#define U300_SYSCON_C1OAR_MMC_P_CLK (0x0800)
392#define U300_SYSCON_C1OAR_MMC_CLK (0x0400)
393#define U300_SYSCON_C1OAR_KP_P_CLK (0x0200)
394#define U300_SYSCON_C1OAR_I2C1_P_CLK (0x0100)
395#define U300_SYSCON_C1OAR_I2C0_P_CLK (0x0080)
396#define U300_SYSCON_C1OAR_GPIO_CLK (0x0040)
397#define U300_SYSCON_C1OAR_EMIF_MPMC_CLK (0x0020)
398#define U300_SYSCON_C1OAR_EMIF_H_CLK (0x0010)
399#define U300_SYSCON_C1OAR_EVHIST_CLK (0x0008)
400#define U300_SYSCON_C1OAR_PPM_CLK (0x0004)
401#define U300_SYSCON_C1OAR_DMA_CLK (0x0002)
402/* Clock activity observability register 2 */
403#define U300_SYSCON_C2OAR (0x148)
404#define U300_SYSCON_C2OAR_MASK (0x0FFF)
405#define U300_SYSCON_C2OAR_VALUE (0x0FFF)
406#define U300_SYSCON_C2OAR_XGAM_CDI_CLK (0x0800)
407#define U300_SYSCON_C2OAR_XGAM_CLK (0x0400)
408#define U300_SYSCON_C2OAR_VC_H_CLK (0x0200)
409#define U300_SYSCON_C2OAR_VC_CLK (0x0100)
410#define U300_SYSCON_C2OAR_UA_P_CLK (0x0080)
411#define U300_SYSCON_C2OAR_TMR1_CLK (0x0040)
412#define U300_SYSCON_C2OAR_TMR0_CLK (0x0020)
413#define U300_SYSCON_C2OAR_SPI_P_CLK (0x0010)
414#define U300_SYSCON_C2OAR_PCM_I2S1_CORE_CLK (0x0008)
415#define U300_SYSCON_C2OAR_PCM_I2S1_CLK (0x0004)
416#define U300_SYSCON_C2OAR_PCM_I2S0_CORE_CLK (0x0002)
417#define U300_SYSCON_C2OAR_PCM_I2S0_CLK (0x0001)
418
419/* Chip ID register 16bit (R/-) */
420#define U300_SYSCON_CIDR (0x400)
421/* Video IRQ clear 16bit (R/W) */
422#define U300_SYSCON_VICR (0x404)
423#define U300_SYSCON_VICR_VIDEO1_IRQ_CLEAR_ENABLE (0x0002)
424#define U300_SYSCON_VICR_VIDEO0_IRQ_CLEAR_ENABLE (0x0001)
425/* SMCR */
426#define U300_SYSCON_SMCR (0x4d0)
427#define U300_SYSCON_SMCR_FIELD_MASK (0x000e)
428#define U300_SYSCON_SMCR_SEMI_SREFACK_IND (0x0008)
429#define U300_SYSCON_SMCR_SEMI_SREFREQ_ENABLE (0x0004)
430#define U300_SYSCON_SMCR_SEMI_EXT_BOOT_MODE_ENABLE (0x0002)
431/* CPU_SW_DBGEN Software Debug Enable 16bit (R/W) */
432#define U300_SYSCON_CSDR (0x4f0)
433#define U300_SYSCON_CSDR_SW_DEBUG_ENABLE (0x0001)
434/* PRINT_CONTROL Print Control 16bit (R/-) */
435#define U300_SYSCON_PCR (0x4f8)
436#define U300_SYSCON_PCR_SERV_IND (0x0001)
437/* BOOT_CONTROL 16bit (R/-) */
438#define U300_SYSCON_BCR (0x4fc)
439#define U300_SYSCON_BCR_ACC_CPU_SUBSYS_VINITHI_IND (0x0400)
440#define U300_SYSCON_BCR_APP_CPU_SUBSYS_VINITHI_IND (0x0200)
441#define U300_SYSCON_BCR_EXTRA_BOOT_OPTION_MASK (0x01FC)
442#define U300_SYSCON_BCR_APP_BOOT_SERV_MASK (0x0003)
443
444
445/* CPU clock defines */
446/**
447 * CPU high frequency in MHz
448 */
449#define SYSCON_CPU_CLOCK_HIGH 208
450/**
451 * CPU medium frequency in MHz
452 */
453#define SYSCON_CPU_CLOCK_MEDIUM 52
454/**
455 * CPU low frequency in MHz
456 */
457#define SYSCON_CPU_CLOCK_LOW 13
458
459/* EMIF clock defines */
460/**
461 * EMIF high frequency in MHz
462 */
463#define SYSCON_EMIF_CLOCK_HIGH 104
464/**
465 * EMIF medium frequency in MHz
466 */
467#define SYSCON_EMIF_CLOCK_MEDIUM 52
468/**
469 * EMIF low frequency in MHz
470 */
471#define SYSCON_EMIF_CLOCK_LOW 13
472
473/* AHB clock defines */
474/**
475 * AHB high frequency in MHz
476 */
477#define SYSCON_AHB_CLOCK_HIGH 52
478/**
479 * AHB medium frequency in MHz
480 */
481#define SYSCON_AHB_CLOCK_MEDIUM 26
482/**
483 * AHB low frequency in MHz
484 */
485#define SYSCON_AHB_CLOCK_LOW 7 /* i.e 13/2=6.5MHz */
486
487enum syscon_busmaster {
488 SYSCON_BM_DMAC,
489 SYSCON_BM_XGAM,
490 SYSCON_BM_VIDEO_ENC
491};
492
493/* Selectr a resistor or a set of resistors */
494enum syscon_pull_up_down {
495 SYSCON_PU_KEY_IN_EN,
496 SYSCON_PU_EMIF_1_8_BIT_EN,
497 SYSCON_PU_EMIF_1_16_BIT_EN,
498 SYSCON_PU_EMIF_1_NFIF_READY_EN,
499 SYSCON_PU_EMIF_1_NFIF_WAIT_N_EN,
500};
501
502/*
503 * Note that this array must match the order of the array "clk_reg"
504 * in syscon.c
505 */
506enum syscon_clk {
507 SYSCON_CLKCONTROL_SLOW_BRIDGE,
508 SYSCON_CLKCONTROL_UART,
509 SYSCON_CLKCONTROL_BTR,
510 SYSCON_CLKCONTROL_EH,
511 SYSCON_CLKCONTROL_GPIO,
512 SYSCON_CLKCONTROL_KEYPAD,
513 SYSCON_CLKCONTROL_APP_TIMER,
514 SYSCON_CLKCONTROL_ACC_TIMER,
515 SYSCON_CLKCONTROL_FAST_BRIDGE,
516 SYSCON_CLKCONTROL_I2C0,
517 SYSCON_CLKCONTROL_I2C1,
518 SYSCON_CLKCONTROL_I2S0,
519 SYSCON_CLKCONTROL_I2S1,
520 SYSCON_CLKCONTROL_MMC,
521 SYSCON_CLKCONTROL_SPI,
522 SYSCON_CLKCONTROL_I2S0_CORE,
523 SYSCON_CLKCONTROL_I2S1_CORE,
524 SYSCON_CLKCONTROL_UART1,
525 SYSCON_CLKCONTROL_AAIF,
526 SYSCON_CLKCONTROL_AHB,
527 SYSCON_CLKCONTROL_APEX,
528 SYSCON_CLKCONTROL_CPU,
529 SYSCON_CLKCONTROL_DMA,
530 SYSCON_CLKCONTROL_EMIF,
531 SYSCON_CLKCONTROL_NAND_IF,
532 SYSCON_CLKCONTROL_VIDEO_ENC,
533 SYSCON_CLKCONTROL_XGAM,
534 SYSCON_CLKCONTROL_SEMI,
535 SYSCON_CLKCONTROL_AHB_SUBSYS,
536 SYSCON_CLKCONTROL_MSPRO
537};
538
539enum syscon_sysclk_mode {
540 SYSCON_SYSCLK_DISABLED,
541 SYSCON_SYSCLK_M_CLK,
542 SYSCON_SYSCLK_ACC_FSM,
543 SYSCON_SYSCLK_PLL60_48,
544 SYSCON_SYSCLK_PLL60_60,
545 SYSCON_SYSCLK_ACC_PLL208,
546 SYSCON_SYSCLK_APP_PLL13,
547 SYSCON_SYSCLK_APP_FSM,
548 SYSCON_SYSCLK_RTC,
549 SYSCON_SYSCLK_APP_PLL208
550};
551
552enum syscon_sysclk_req {
553 SYSCON_SYSCLKREQ_DISABLED,
554 SYSCON_SYSCLKREQ_ACTIVE_LOW,
555 SYSCON_SYSCLKREQ_MONITOR
556};
557
558enum syscon_clk_mode {
559 SYSCON_CLKMODE_OFF,
560 SYSCON_CLKMODE_DEFAULT,
561 SYSCON_CLKMODE_LOW,
562 SYSCON_CLKMODE_MEDIUM,
563 SYSCON_CLKMODE_HIGH,
564 SYSCON_CLKMODE_PERMANENT,
565 SYSCON_CLKMODE_ON,
566};
567
568enum syscon_call_mode {
569 SYSCON_CLKCALL_NOWAIT,
570 SYSCON_CLKCALL_WAIT,
571};
572
573int syscon_dc_on(bool keep_power_on);
574int syscon_set_busmaster_active_state(enum syscon_busmaster busmaster,
575 bool active);
576bool syscon_get_busmaster_active_state(void);
577int syscon_set_sleep_mask(enum syscon_clk,
578 bool sleep_ctrl);
579int syscon_config_sysclk(u32 sysclk,
580 enum syscon_sysclk_mode sysclkmode,
581 bool inverse,
582 u32 divisor,
583 enum syscon_sysclk_req sysclkreq);
584bool syscon_can_turn_off_semi_clock(void);
585
586/* This function is restricted to core.c */
587int syscon_request_normal_power(bool req);
588
589/* This function is restricted to be used by platform_speed.c */
590int syscon_speed_request(enum syscon_call_mode wait_mode,
591 enum syscon_clk_mode req_clk_mode);
592#endif /* __MACH_SYSCON_H */
diff --git a/arch/arm/mach-u300/include/mach/timex.h b/arch/arm/mach-u300/include/mach/timex.h
deleted file mode 100644
index f233b72633f6..000000000000
--- a/arch/arm/mach-u300/include/mach/timex.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/timex.h
4 *
5 *
6 * Copyright (C) 2006-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * Platform tick rate definition.
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */
11#ifndef __MACH_TIMEX_H
12#define __MACH_TIMEX_H
13
14/* This is for the APP OS GP1 (General Purpose 1) timer */
15#define CLOCK_TICK_RATE 1000000
16
17#endif
diff --git a/arch/arm/mach-u300/include/mach/u300-regs.h b/arch/arm/mach-u300/include/mach/u300-regs.h
deleted file mode 100644
index 0320495efc4d..000000000000
--- a/arch/arm/mach-u300/include/mach/u300-regs.h
+++ /dev/null
@@ -1,165 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/u300-regs.h
4 *
5 *
6 * Copyright (C) 2006-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * Basic register address definitions in physical memory and
9 * some block definitions for core devices like the timer.
10 * Author: Linus Walleij <linus.walleij@stericsson.com>
11 */
12
13#ifndef __MACH_U300_REGS_H
14#define __MACH_U300_REGS_H
15
16/*
17 * These are the large blocks of memory allocated for I/O.
18 * the defines are used for setting up the I/O memory mapping.
19 */
20
21/* NAND Flash CS0 */
22#define U300_NAND_CS0_PHYS_BASE 0x80000000
23
24/* NFIF */
25#define U300_NAND_IF_PHYS_BASE 0x9f800000
26
27/* ALE, CLE offset for FSMC NAND */
28#define PLAT_NAND_CLE (1 << 16)
29#define PLAT_NAND_ALE (1 << 17)
30
31/* AHB Peripherals */
32#define U300_AHB_PER_PHYS_BASE 0xa0000000
33#define U300_AHB_PER_VIRT_BASE 0xff010000
34
35/* FAST Peripherals */
36#define U300_FAST_PER_PHYS_BASE 0xc0000000
37#define U300_FAST_PER_VIRT_BASE 0xff020000
38
39/* SLOW Peripherals */
40#define U300_SLOW_PER_PHYS_BASE 0xc0010000
41#define U300_SLOW_PER_VIRT_BASE 0xff000000
42
43/* Boot ROM */
44#define U300_BOOTROM_PHYS_BASE 0xffff0000
45#define U300_BOOTROM_VIRT_BASE 0xffff0000
46
47/* SEMI config base */
48#define U300_SEMI_CONFIG_BASE 0x2FFE0000
49
50/*
51 * AHB peripherals
52 */
53
54/* AHB Peripherals Bridge Controller */
55#define U300_AHB_BRIDGE_BASE (U300_AHB_PER_PHYS_BASE+0x0000)
56
57/* Vectored Interrupt Controller 0, servicing 32 interrupts */
58#define U300_INTCON0_BASE (U300_AHB_PER_PHYS_BASE+0x1000)
59#define U300_INTCON0_VBASE IOMEM(U300_AHB_PER_VIRT_BASE+0x1000)
60
61/* Vectored Interrupt Controller 1, servicing 32 interrupts */
62#define U300_INTCON1_BASE (U300_AHB_PER_PHYS_BASE+0x2000)
63#define U300_INTCON1_VBASE IOMEM(U300_AHB_PER_VIRT_BASE+0x2000)
64
65/* Memory Stick Pro (MSPRO) controller */
66#define U300_MSPRO_BASE (U300_AHB_PER_PHYS_BASE+0x3000)
67
68/* EMIF Configuration Area */
69#define U300_EMIF_CFG_BASE (U300_AHB_PER_PHYS_BASE+0x4000)
70
71
72/*
73 * FAST peripherals
74 */
75
76/* FAST bridge control */
77#define U300_FAST_BRIDGE_BASE (U300_FAST_PER_PHYS_BASE+0x0000)
78
79/* MMC/SD controller */
80#define U300_MMCSD_BASE (U300_FAST_PER_PHYS_BASE+0x1000)
81
82/* PCM I2S0 controller */
83#define U300_PCM_I2S0_BASE (U300_FAST_PER_PHYS_BASE+0x2000)
84
85/* PCM I2S1 controller */
86#define U300_PCM_I2S1_BASE (U300_FAST_PER_PHYS_BASE+0x3000)
87
88/* I2C0 controller */
89#define U300_I2C0_BASE (U300_FAST_PER_PHYS_BASE+0x4000)
90
91/* I2C1 controller */
92#define U300_I2C1_BASE (U300_FAST_PER_PHYS_BASE+0x5000)
93
94/* SPI controller */
95#define U300_SPI_BASE (U300_FAST_PER_PHYS_BASE+0x6000)
96
97/* Fast UART1 on U335 only */
98#define U300_UART1_BASE (U300_FAST_PER_PHYS_BASE+0x7000)
99
100/*
101 * SLOW peripherals
102 */
103
104/* SLOW bridge control */
105#define U300_SLOW_BRIDGE_BASE (U300_SLOW_PER_PHYS_BASE)
106
107/* SYSCON */
108#define U300_SYSCON_BASE (U300_SLOW_PER_PHYS_BASE+0x1000)
109#define U300_SYSCON_VBASE IOMEM(U300_SLOW_PER_VIRT_BASE+0x1000)
110
111/* Watchdog */
112#define U300_WDOG_BASE (U300_SLOW_PER_PHYS_BASE+0x2000)
113
114/* UART0 */
115#define U300_UART0_BASE (U300_SLOW_PER_PHYS_BASE+0x3000)
116
117/* APP side special timer */
118#define U300_TIMER_APP_BASE (U300_SLOW_PER_PHYS_BASE+0x4000)
119#define U300_TIMER_APP_VBASE IOMEM(U300_SLOW_PER_VIRT_BASE+0x4000)
120
121/* Keypad */
122#define U300_KEYPAD_BASE (U300_SLOW_PER_PHYS_BASE+0x5000)
123
124/* GPIO */
125#define U300_GPIO_BASE (U300_SLOW_PER_PHYS_BASE+0x6000)
126
127/* RTC */
128#define U300_RTC_BASE (U300_SLOW_PER_PHYS_BASE+0x7000)
129
130/* Bus tracer */
131#define U300_BUSTR_BASE (U300_SLOW_PER_PHYS_BASE+0x8000)
132
133/* Event handler (hardware queue) */
134#define U300_EVHIST_BASE (U300_SLOW_PER_PHYS_BASE+0x9000)
135
136/* Genric Timer */
137#define U300_TIMER_BASE (U300_SLOW_PER_PHYS_BASE+0xa000)
138
139/* PPM */
140#define U300_PPM_BASE (U300_SLOW_PER_PHYS_BASE+0xb000)
141
142
143/*
144 * REST peripherals
145 */
146
147/* ISP (image signal processor) */
148#define U300_ISP_BASE (0xA0008000)
149
150/* DMA Controller base */
151#define U300_DMAC_BASE (0xC0020000)
152
153/* MSL Base */
154#define U300_MSL_BASE (0xc0022000)
155
156/* APEX Base */
157#define U300_APEX_BASE (0xc0030000)
158
159/* Video Encoder Base */
160#define U300_VIDEOENC_BASE (0xc0080000)
161
162/* XGAM Base */
163#define U300_XGAM_BASE (0xd0000000)
164
165#endif
diff --git a/arch/arm/mach-u300/include/mach/uncompress.h b/arch/arm/mach-u300/include/mach/uncompress.h
deleted file mode 100644
index 783e7e60101b..000000000000
--- a/arch/arm/mach-u300/include/mach/uncompress.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * arch/arm/mach-u300/include/mach/uncompress.h
3 *
4 * Copyright (C) 2003 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#define AMBA_UART_DR (*(volatile unsigned char *)0xc0013000)
21#define AMBA_UART_LCRH (*(volatile unsigned char *)0xc001302C)
22#define AMBA_UART_CR (*(volatile unsigned char *)0xc0013030)
23#define AMBA_UART_FR (*(volatile unsigned char *)0xc0013018)
24
25/*
26 * This does not append a newline
27 */
28static inline void putc(int c)
29{
30 while (AMBA_UART_FR & (1 << 5))
31 barrier();
32
33 AMBA_UART_DR = c;
34}
35
36static inline void flush(void)
37{
38 while (AMBA_UART_FR & (1 << 3))
39 barrier();
40}
41
42/*
43 * nothing to do
44 */
45#define arch_decomp_setup()
diff --git a/arch/arm/mach-u300/regulator.c b/arch/arm/mach-u300/regulator.c
index 9c53f01c62eb..bf40cd478fe9 100644
--- a/arch/arm/mach-u300/regulator.c
+++ b/arch/arm/mach-u300/regulator.c
@@ -10,11 +10,18 @@
10#include <linux/device.h> 10#include <linux/device.h>
11#include <linux/signal.h> 11#include <linux/signal.h>
12#include <linux/err.h> 12#include <linux/err.h>
13#include <linux/of.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/regulator/machine.h>
13#include <linux/regulator/consumer.h> 17#include <linux/regulator/consumer.h>
14/* Those are just for writing in syscon */ 18#include <linux/mfd/syscon.h>
15#include <linux/io.h> 19#include <linux/regmap.h>
16#include <mach/hardware.h> 20
17#include <mach/syscon.h> 21/* Power Management Control 16bit (R/W) */
22#define U300_SYSCON_PMCR (0x50)
23#define U300_SYSCON_PMCR_DCON_ENABLE (0x0002)
24#define U300_SYSCON_PMCR_PWR_MGNT_ENABLE (0x0001)
18 25
19/* 26/*
20 * Regulators that power the board and chip and which are 27 * Regulators that power the board and chip and which are
@@ -47,13 +54,28 @@ void u300_pm_poweroff(void)
47/* 54/*
48 * Hog the regulators needed to power up the board. 55 * Hog the regulators needed to power up the board.
49 */ 56 */
50static int __init u300_init_boardpower(void) 57static int __init __u300_init_boardpower(struct platform_device *pdev)
51{ 58{
59 struct device_node *np = pdev->dev.of_node;
60 struct device_node *syscon_np;
61 struct regmap *regmap;
52 int err; 62 int err;
53 u32 val;
54 63
55 pr_info("U300: setting up board power\n"); 64 pr_info("U300: setting up board power\n");
56 main_power_15 = regulator_get(NULL, "vana15"); 65
66 syscon_np = of_parse_phandle(np, "syscon", 0);
67 if (!syscon_np) {
68 pr_crit("U300: no syscon node\n");
69 return -ENODEV;
70 }
71 regmap = syscon_node_to_regmap(syscon_np);
72 if (!regmap) {
73 pr_crit("U300: could not locate syscon regmap\n");
74 return -ENODEV;
75 }
76
77 main_power_15 = regulator_get(&pdev->dev, "vana15");
78
57 if (IS_ERR(main_power_15)) { 79 if (IS_ERR(main_power_15)) {
58 pr_err("could not get vana15"); 80 pr_err("could not get vana15");
59 return PTR_ERR(main_power_15); 81 return PTR_ERR(main_power_15);
@@ -72,9 +94,8 @@ static int __init u300_init_boardpower(void)
72 * the rest of the U300 power management is implemented. 94 * the rest of the U300 power management is implemented.
73 */ 95 */
74 pr_info("U300: disable system controller pull-up\n"); 96 pr_info("U300: disable system controller pull-up\n");
75 val = readw(U300_SYSCON_VBASE + U300_SYSCON_PMCR); 97 regmap_update_bits(regmap, U300_SYSCON_PMCR,
76 val &= ~U300_SYSCON_PMCR_DCON_ENABLE; 98 U300_SYSCON_PMCR_DCON_ENABLE, 0);
77 writew(val, U300_SYSCON_VBASE + U300_SYSCON_PMCR);
78 99
79 /* Register globally exported PM poweroff hook */ 100 /* Register globally exported PM poweroff hook */
80 pm_power_off = u300_pm_poweroff; 101 pm_power_off = u300_pm_poweroff;
@@ -82,7 +103,31 @@ static int __init u300_init_boardpower(void)
82 return 0; 103 return 0;
83} 104}
84 105
106static int __init s365_board_probe(struct platform_device *pdev)
107{
108 return __u300_init_boardpower(pdev);
109}
110
111static const struct of_device_id s365_board_match[] = {
112 { .compatible = "stericsson,s365" },
113 {},
114};
115
116static struct platform_driver s365_board_driver = {
117 .driver = {
118 .name = "s365-board",
119 .owner = THIS_MODULE,
120 .of_match_table = s365_board_match,
121 },
122};
123
85/* 124/*
86 * So at module init time we hog the regulator! 125 * So at module init time we hog the regulator!
87 */ 126 */
88module_init(u300_init_boardpower); 127static int __init u300_init_boardpower(void)
128{
129 return platform_driver_probe(&s365_board_driver,
130 s365_board_probe);
131}
132
133device_initcall(u300_init_boardpower);
diff --git a/arch/arm/mach-u300/spi.c b/arch/arm/mach-u300/spi.c
deleted file mode 100644
index 910698293d64..000000000000
--- a/arch/arm/mach-u300/spi.c
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * arch/arm/mach-u300/spi.c
3 *
4 * Copyright (C) 2009 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * Author: Linus Walleij <linus.walleij@stericsson.com>
8 */
9#include <linux/device.h>
10#include <linux/amba/bus.h>
11#include <linux/spi/spi.h>
12#include <linux/amba/pl022.h>
13#include <linux/platform_data/dma-coh901318.h>
14#include <linux/err.h>
15
16/*
17 * The following is for the actual devices on the SSP/SPI bus
18 */
19#ifdef CONFIG_MACH_U300_SPIDUMMY
20static void select_dummy_chip(u32 chipselect)
21{
22 pr_debug("CORE: %s called with CS=0x%x (%s)\n",
23 __func__,
24 chipselect,
25 chipselect ? "unselect chip" : "select chip");
26 /*
27 * Here you would write the chip select value to the GPIO pins if
28 * this was a real chip (but this is a loopback dummy).
29 */
30}
31
32struct pl022_config_chip dummy_chip_info = {
33 /* available POLLING_TRANSFER, INTERRUPT_TRANSFER, DMA_TRANSFER */
34 .com_mode = DMA_TRANSFER,
35 .iface = SSP_INTERFACE_MOTOROLA_SPI,
36 /* We can only act as master but SSP_SLAVE is possible in theory */
37 .hierarchy = SSP_MASTER,
38 /* 0 = drive TX even as slave, 1 = do not drive TX as slave */
39 .slave_tx_disable = 0,
40 .rx_lev_trig = SSP_RX_4_OR_MORE_ELEM,
41 .tx_lev_trig = SSP_TX_4_OR_MORE_EMPTY_LOC,
42 .ctrl_len = SSP_BITS_12,
43 .wait_state = SSP_MWIRE_WAIT_ZERO,
44 .duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
45 /*
46 * This is where you insert a call to a function to enable CS
47 * (usually GPIO) for a certain chip.
48 */
49 .cs_control = select_dummy_chip,
50};
51#endif
52
53static struct spi_board_info u300_spi_devices[] = {
54#ifdef CONFIG_MACH_U300_SPIDUMMY
55 {
56 /* A dummy chip used for loopback tests */
57 .modalias = "spi-dummy",
58 /* Really dummy, pass in additional chip config here */
59 .platform_data = NULL,
60 /* This defines how the controller shall handle the device */
61 .controller_data = &dummy_chip_info,
62 /* .irq - no external IRQ routed from this device */
63 .max_speed_hz = 1000000,
64 .bus_num = 0, /* Only one bus on this chip */
65 .chip_select = 0,
66 /* Means SPI_CS_HIGH, change if e.g low CS */
67 .mode = SPI_MODE_1 | SPI_LOOP,
68 },
69#endif
70};
71
72static struct pl022_ssp_controller ssp_platform_data = {
73 /* If you have several SPI buses this varies, we have only bus 0 */
74 .bus_id = 0,
75 /*
76 * On the APP CPU GPIO 4, 5 and 6 are connected as generic
77 * chip selects for SPI. (Same on U330, U335 and U365.)
78 * TODO: make sure the GPIO driver can select these properly
79 * and do padmuxing accordingly too.
80 */
81 .num_chipselect = 3,
82#ifdef CONFIG_COH901318
83 .enable_dma = 1,
84 .dma_filter = coh901318_filter_id,
85 .dma_rx_param = (void *) U300_DMA_SPI_RX,
86 .dma_tx_param = (void *) U300_DMA_SPI_TX,
87#else
88 .enable_dma = 0,
89#endif
90};
91
92
93void __init u300_spi_init(struct amba_device *adev)
94{
95 adev->dev.platform_data = &ssp_platform_data;
96}
97
98void __init u300_spi_register_board_devices(void)
99{
100 /* Register any SPI devices */
101 spi_register_board_info(u300_spi_devices, ARRAY_SIZE(u300_spi_devices));
102}
diff --git a/arch/arm/mach-u300/spi.h b/arch/arm/mach-u300/spi.h
deleted file mode 100644
index bd3d867e240f..000000000000
--- a/arch/arm/mach-u300/spi.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-u300/spi.h
3 *
4 * Copyright (C) 2009 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2
6 *
7 * Author: Linus Walleij <linus.walleij@stericsson.com>
8 */
9#ifndef SPI_H
10#define SPI_H
11#include <linux/amba/bus.h>
12
13#ifdef CONFIG_SPI_PL022
14void __init u300_spi_init(struct amba_device *adev);
15void __init u300_spi_register_board_devices(void);
16#else
17/* Compile out SPI support if PL022 is not selected */
18static inline void __init u300_spi_init(struct amba_device *adev)
19{
20}
21static inline void __init u300_spi_register_board_devices(void)
22{
23}
24#endif
25
26#endif
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index d9e73209c9b8..390ae5feb1d0 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -18,17 +18,15 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21 21#include <linux/delay.h>
22#include <mach/hardware.h> 22#include <linux/of_address.h>
23#include <mach/irqs.h> 23#include <linux/of_irq.h>
24 24
25/* Generic stuff */ 25/* Generic stuff */
26#include <asm/sched_clock.h> 26#include <asm/sched_clock.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29 29
30#include "timer.h"
31
32/* 30/*
33 * APP side special timer registers 31 * APP side special timer registers
34 * This timer contains four timers which can fire an interrupt each. 32 * This timer contains four timers which can fire an interrupt each.
@@ -189,6 +187,8 @@
189#define TICKS_PER_JIFFY ((CLOCK_TICK_RATE + (HZ/2)) / HZ) 187#define TICKS_PER_JIFFY ((CLOCK_TICK_RATE + (HZ/2)) / HZ)
190#define US_PER_TICK ((1000000 + (HZ/2)) / HZ) 188#define US_PER_TICK ((1000000 + (HZ/2)) / HZ)
191 189
190static void __iomem *u300_timer_base;
191
192/* 192/*
193 * The u300_set_mode() function is always called first, if we 193 * The u300_set_mode() function is always called first, if we
194 * have oneshot timer active, the oneshot scheduling function 194 * have oneshot timer active, the oneshot scheduling function
@@ -201,28 +201,28 @@ static void u300_set_mode(enum clock_event_mode mode,
201 case CLOCK_EVT_MODE_PERIODIC: 201 case CLOCK_EVT_MODE_PERIODIC:
202 /* Disable interrupts on GPT1 */ 202 /* Disable interrupts on GPT1 */
203 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE, 203 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
204 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 204 u300_timer_base + U300_TIMER_APP_GPT1IE);
205 /* Disable GP1 while we're reprogramming it. */ 205 /* Disable GP1 while we're reprogramming it. */
206 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE, 206 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
207 U300_TIMER_APP_VBASE + U300_TIMER_APP_DGPT1); 207 u300_timer_base + U300_TIMER_APP_DGPT1);
208 /* 208 /*
209 * Set the periodic mode to a certain number of ticks per 209 * Set the periodic mode to a certain number of ticks per
210 * jiffy. 210 * jiffy.
211 */ 211 */
212 writel(TICKS_PER_JIFFY, 212 writel(TICKS_PER_JIFFY,
213 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1TC); 213 u300_timer_base + U300_TIMER_APP_GPT1TC);
214 /* 214 /*
215 * Set continuous mode, so the timer keeps triggering 215 * Set continuous mode, so the timer keeps triggering
216 * interrupts. 216 * interrupts.
217 */ 217 */
218 writel(U300_TIMER_APP_SGPT1M_MODE_CONTINUOUS, 218 writel(U300_TIMER_APP_SGPT1M_MODE_CONTINUOUS,
219 U300_TIMER_APP_VBASE + U300_TIMER_APP_SGPT1M); 219 u300_timer_base + U300_TIMER_APP_SGPT1M);
220 /* Enable timer interrupts */ 220 /* Enable timer interrupts */
221 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE, 221 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE,
222 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 222 u300_timer_base + U300_TIMER_APP_GPT1IE);
223 /* Then enable the OS timer again */ 223 /* Then enable the OS timer again */
224 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE, 224 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE,
225 U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT1); 225 u300_timer_base + U300_TIMER_APP_EGPT1);
226 break; 226 break;
227 case CLOCK_EVT_MODE_ONESHOT: 227 case CLOCK_EVT_MODE_ONESHOT:
228 /* Just break; here? */ 228 /* Just break; here? */
@@ -233,33 +233,33 @@ static void u300_set_mode(enum clock_event_mode mode,
233 */ 233 */
234 /* Disable interrupts on GPT1 */ 234 /* Disable interrupts on GPT1 */
235 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE, 235 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
236 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 236 u300_timer_base + U300_TIMER_APP_GPT1IE);
237 /* Disable GP1 while we're reprogramming it. */ 237 /* Disable GP1 while we're reprogramming it. */
238 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE, 238 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
239 U300_TIMER_APP_VBASE + U300_TIMER_APP_DGPT1); 239 u300_timer_base + U300_TIMER_APP_DGPT1);
240 /* 240 /*
241 * Expire far in the future, u300_set_next_event() will be 241 * Expire far in the future, u300_set_next_event() will be
242 * called soon... 242 * called soon...
243 */ 243 */
244 writel(0xFFFFFFFF, U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1TC); 244 writel(0xFFFFFFFF, u300_timer_base + U300_TIMER_APP_GPT1TC);
245 /* We run one shot per tick here! */ 245 /* We run one shot per tick here! */
246 writel(U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT, 246 writel(U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT,
247 U300_TIMER_APP_VBASE + U300_TIMER_APP_SGPT1M); 247 u300_timer_base + U300_TIMER_APP_SGPT1M);
248 /* Enable interrupts for this timer */ 248 /* Enable interrupts for this timer */
249 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE, 249 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE,
250 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 250 u300_timer_base + U300_TIMER_APP_GPT1IE);
251 /* Enable timer */ 251 /* Enable timer */
252 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE, 252 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE,
253 U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT1); 253 u300_timer_base + U300_TIMER_APP_EGPT1);
254 break; 254 break;
255 case CLOCK_EVT_MODE_UNUSED: 255 case CLOCK_EVT_MODE_UNUSED:
256 case CLOCK_EVT_MODE_SHUTDOWN: 256 case CLOCK_EVT_MODE_SHUTDOWN:
257 /* Disable interrupts on GP1 */ 257 /* Disable interrupts on GP1 */
258 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE, 258 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
259 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 259 u300_timer_base + U300_TIMER_APP_GPT1IE);
260 /* Disable GP1 */ 260 /* Disable GP1 */
261 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE, 261 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
262 U300_TIMER_APP_VBASE + U300_TIMER_APP_DGPT1); 262 u300_timer_base + U300_TIMER_APP_DGPT1);
263 break; 263 break;
264 case CLOCK_EVT_MODE_RESUME: 264 case CLOCK_EVT_MODE_RESUME:
265 /* Ignore this call */ 265 /* Ignore this call */
@@ -281,27 +281,27 @@ static int u300_set_next_event(unsigned long cycles,
281{ 281{
282 /* Disable interrupts on GPT1 */ 282 /* Disable interrupts on GPT1 */
283 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE, 283 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
284 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 284 u300_timer_base + U300_TIMER_APP_GPT1IE);
285 /* Disable GP1 while we're reprogramming it. */ 285 /* Disable GP1 while we're reprogramming it. */
286 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE, 286 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
287 U300_TIMER_APP_VBASE + U300_TIMER_APP_DGPT1); 287 u300_timer_base + U300_TIMER_APP_DGPT1);
288 /* Reset the General Purpose timer 1. */ 288 /* Reset the General Purpose timer 1. */
289 writel(U300_TIMER_APP_RGPT1_TIMER_RESET, 289 writel(U300_TIMER_APP_RGPT1_TIMER_RESET,
290 U300_TIMER_APP_VBASE + U300_TIMER_APP_RGPT1); 290 u300_timer_base + U300_TIMER_APP_RGPT1);
291 /* IRQ in n * cycles */ 291 /* IRQ in n * cycles */
292 writel(cycles, U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1TC); 292 writel(cycles, u300_timer_base + U300_TIMER_APP_GPT1TC);
293 /* 293 /*
294 * We run one shot per tick here! (This is necessary to reconfigure, 294 * We run one shot per tick here! (This is necessary to reconfigure,
295 * the timer will tilt if you don't!) 295 * the timer will tilt if you don't!)
296 */ 296 */
297 writel(U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT, 297 writel(U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT,
298 U300_TIMER_APP_VBASE + U300_TIMER_APP_SGPT1M); 298 u300_timer_base + U300_TIMER_APP_SGPT1M);
299 /* Enable timer interrupts */ 299 /* Enable timer interrupts */
300 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE, 300 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE,
301 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IE); 301 u300_timer_base + U300_TIMER_APP_GPT1IE);
302 /* Then enable the OS timer again */ 302 /* Then enable the OS timer again */
303 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE, 303 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE,
304 U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT1); 304 u300_timer_base + U300_TIMER_APP_EGPT1);
305 return 0; 305 return 0;
306} 306}
307 307
@@ -320,8 +320,9 @@ static irqreturn_t u300_timer_interrupt(int irq, void *dev_id)
320{ 320{
321 struct clock_event_device *evt = &clockevent_u300_1mhz; 321 struct clock_event_device *evt = &clockevent_u300_1mhz;
322 /* ACK/Clear timer IRQ for the APP GPT1 Timer */ 322 /* ACK/Clear timer IRQ for the APP GPT1 Timer */
323
323 writel(U300_TIMER_APP_GPT1IA_IRQ_ACK, 324 writel(U300_TIMER_APP_GPT1IA_IRQ_ACK,
324 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT1IA); 325 u300_timer_base + U300_TIMER_APP_GPT1IA);
325 evt->event_handler(evt); 326 evt->event_handler(evt);
326 return IRQ_HANDLED; 327 return IRQ_HANDLED;
327} 328}
@@ -342,65 +343,88 @@ static struct irqaction u300_timer_irq = {
342 343
343static u32 notrace u300_read_sched_clock(void) 344static u32 notrace u300_read_sched_clock(void)
344{ 345{
345 return readl(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC); 346 return readl(u300_timer_base + U300_TIMER_APP_GPT2CC);
347}
348
349static unsigned long u300_read_current_timer(void)
350{
351 return readl(u300_timer_base + U300_TIMER_APP_GPT2CC);
346} 352}
347 353
354static struct delay_timer u300_delay_timer;
348 355
349/* 356/*
350 * This sets up the system timers, clock source and clock event. 357 * This sets up the system timers, clock source and clock event.
351 */ 358 */
352void __init u300_timer_init(void) 359static void __init u300_timer_init_of(struct device_node *np)
353{ 360{
361 struct resource irq_res;
362 int irq;
354 struct clk *clk; 363 struct clk *clk;
355 unsigned long rate; 364 unsigned long rate;
356 365
366 u300_timer_base = of_iomap(np, 0);
367 if (!u300_timer_base)
368 panic("could not ioremap system timer\n");
369
370 /* Get the IRQ for the GP1 timer */
371 irq = of_irq_to_resource(np, 2, &irq_res);
372 if (irq <= 0)
373 panic("no IRQ for system timer\n");
374
375 pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq);
376
357 /* Clock the interrupt controller */ 377 /* Clock the interrupt controller */
358 clk = clk_get_sys("apptimer", NULL); 378 clk = of_clk_get(np, 0);
359 BUG_ON(IS_ERR(clk)); 379 BUG_ON(IS_ERR(clk));
360 clk_prepare_enable(clk); 380 clk_prepare_enable(clk);
361 rate = clk_get_rate(clk); 381 rate = clk_get_rate(clk);
362 382
363 setup_sched_clock(u300_read_sched_clock, 32, rate); 383 setup_sched_clock(u300_read_sched_clock, 32, rate);
364 384
385 u300_delay_timer.read_current_timer = &u300_read_current_timer;
386 u300_delay_timer.freq = rate;
387 register_current_timer_delay(&u300_delay_timer);
388
365 /* 389 /*
366 * Disable the "OS" and "DD" timers - these are designed for Symbian! 390 * Disable the "OS" and "DD" timers - these are designed for Symbian!
367 * Example usage in cnh1601578 cpu subsystem pd_timer_app.c 391 * Example usage in cnh1601578 cpu subsystem pd_timer_app.c
368 */ 392 */
369 writel(U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE, 393 writel(U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE,
370 U300_TIMER_APP_VBASE + U300_TIMER_APP_CRC); 394 u300_timer_base + U300_TIMER_APP_CRC);
371 writel(U300_TIMER_APP_ROST_TIMER_RESET, 395 writel(U300_TIMER_APP_ROST_TIMER_RESET,
372 U300_TIMER_APP_VBASE + U300_TIMER_APP_ROST); 396 u300_timer_base + U300_TIMER_APP_ROST);
373 writel(U300_TIMER_APP_DOST_TIMER_DISABLE, 397 writel(U300_TIMER_APP_DOST_TIMER_DISABLE,
374 U300_TIMER_APP_VBASE + U300_TIMER_APP_DOST); 398 u300_timer_base + U300_TIMER_APP_DOST);
375 writel(U300_TIMER_APP_RDDT_TIMER_RESET, 399 writel(U300_TIMER_APP_RDDT_TIMER_RESET,
376 U300_TIMER_APP_VBASE + U300_TIMER_APP_RDDT); 400 u300_timer_base + U300_TIMER_APP_RDDT);
377 writel(U300_TIMER_APP_DDDT_TIMER_DISABLE, 401 writel(U300_TIMER_APP_DDDT_TIMER_DISABLE,
378 U300_TIMER_APP_VBASE + U300_TIMER_APP_DDDT); 402 u300_timer_base + U300_TIMER_APP_DDDT);
379 403
380 /* Reset the General Purpose timer 1. */ 404 /* Reset the General Purpose timer 1. */
381 writel(U300_TIMER_APP_RGPT1_TIMER_RESET, 405 writel(U300_TIMER_APP_RGPT1_TIMER_RESET,
382 U300_TIMER_APP_VBASE + U300_TIMER_APP_RGPT1); 406 u300_timer_base + U300_TIMER_APP_RGPT1);
383 407
384 /* Set up the IRQ handler */ 408 /* Set up the IRQ handler */
385 setup_irq(IRQ_U300_TIMER_APP_GP1, &u300_timer_irq); 409 setup_irq(irq, &u300_timer_irq);
386 410
387 /* Reset the General Purpose timer 2 */ 411 /* Reset the General Purpose timer 2 */
388 writel(U300_TIMER_APP_RGPT2_TIMER_RESET, 412 writel(U300_TIMER_APP_RGPT2_TIMER_RESET,
389 U300_TIMER_APP_VBASE + U300_TIMER_APP_RGPT2); 413 u300_timer_base + U300_TIMER_APP_RGPT2);
390 /* Set this timer to run around forever */ 414 /* Set this timer to run around forever */
391 writel(0xFFFFFFFFU, U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2TC); 415 writel(0xFFFFFFFFU, u300_timer_base + U300_TIMER_APP_GPT2TC);
392 /* Set continuous mode so it wraps around */ 416 /* Set continuous mode so it wraps around */
393 writel(U300_TIMER_APP_SGPT2M_MODE_CONTINUOUS, 417 writel(U300_TIMER_APP_SGPT2M_MODE_CONTINUOUS,
394 U300_TIMER_APP_VBASE + U300_TIMER_APP_SGPT2M); 418 u300_timer_base + U300_TIMER_APP_SGPT2M);
395 /* Disable timer interrupts */ 419 /* Disable timer interrupts */
396 writel(U300_TIMER_APP_GPT2IE_IRQ_DISABLE, 420 writel(U300_TIMER_APP_GPT2IE_IRQ_DISABLE,
397 U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2IE); 421 u300_timer_base + U300_TIMER_APP_GPT2IE);
398 /* Then enable the GP2 timer to use as a free running us counter */ 422 /* Then enable the GP2 timer to use as a free running us counter */
399 writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE, 423 writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE,
400 U300_TIMER_APP_VBASE + U300_TIMER_APP_EGPT2); 424 u300_timer_base + U300_TIMER_APP_EGPT2);
401 425
402 /* Use general purpose timer 2 as clock source */ 426 /* Use general purpose timer 2 as clock source */
403 if (clocksource_mmio_init(U300_TIMER_APP_VBASE + U300_TIMER_APP_GPT2CC, 427 if (clocksource_mmio_init(u300_timer_base + U300_TIMER_APP_GPT2CC,
404 "GPT2", rate, 300, 32, clocksource_mmio_readl_up)) 428 "GPT2", rate, 300, 32, clocksource_mmio_readl_up))
405 pr_err("timer: failed to initialize U300 clock source\n"); 429 pr_err("timer: failed to initialize U300 clock source\n");
406 430
@@ -413,3 +437,6 @@ void __init u300_timer_init(void)
413 * used by hrtimers! 437 * used by hrtimers!
414 */ 438 */
415} 439}
440
441CLOCKSOURCE_OF_DECLARE(u300_timer, "stericsson,u300-apptimer",
442 u300_timer_init_of);
diff --git a/arch/arm/mach-u300/timer.h b/arch/arm/mach-u300/timer.h
deleted file mode 100644
index d34287bc34f5..000000000000
--- a/arch/arm/mach-u300/timer.h
+++ /dev/null
@@ -1 +0,0 @@
1extern void u300_timer_init(void);
diff --git a/arch/arm/mach-u300/u300-gpio.h b/arch/arm/mach-u300/u300-gpio.h
deleted file mode 100644
index 83f50772e169..000000000000
--- a/arch/arm/mach-u300/u300-gpio.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Individual pin assignments for the B335/S335.
3 * Notice that the actual usage of these pins depends on the
4 * PAD MUX settings, that is why the same number can potentially
5 * appear several times. In the reference design each pin is only
6 * used for one purpose. These were determined by inspecting the
7 * S365 schematic.
8 */
9#define U300_GPIO_PIN_UART_RX 0
10#define U300_GPIO_PIN_UART_TX 1
11#define U300_GPIO_PIN_UART_CTS 2
12#define U300_GPIO_PIN_UART_RTS 3
13#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
14#define U300_GPIO_PIN_GPIO05 5 /* Unrouted */
15#define U300_GPIO_PIN_MS_CD 6 /* Memory Stick Card insertion */
16#define U300_GPIO_PIN_GPIO07 7 /* Test point TP2430 */
17
18#define U300_GPIO_PIN_GPIO08 8 /* Test point TP2437 */
19#define U300_GPIO_PIN_GPIO09 9 /* Test point TP2431 */
20#define U300_GPIO_PIN_GPIO10 10 /* Test point TP2432 */
21#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
22#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
23#define U300_GPIO_PIN_CAM_SUB_STANDBY 13 /* Camera SUB standby */
24#define U300_GPIO_PIN_GPIO14 14 /* Test point TP2436 */
25#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
26
27#define U300_GPIO_PIN_GPIO16 16 /* Test point TP2438 */
28#define U300_GPIO_PIN_PHFSENSE 17 /* Headphone jack sensing */
29#define U300_GPIO_PIN_GPIO18 18 /* Test point TP2439 */
30#define U300_GPIO_PIN_GPIO19 19 /* Routed somewhere */
31#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
32#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
33#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
34#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
35
36#define U300_GPIO_PIN_GPIO24 24 /* Unrouted */
37#define U300_GPIO_PIN_GPIO25 25 /* Unrouted */
38#define U300_GPIO_PIN_GPIO26 26 /* Unrouted */
39#define U300_GPIO_PIN_GPIO27 27 /* Unrouted */
40#define U300_GPIO_PIN_GPIO28 28 /* Unrouted */
41#define U300_GPIO_PIN_GPIO29 29 /* Unrouted */
42#define U300_GPIO_PIN_GPIO30 30 /* Unrouted */
43#define U300_GPIO_PIN_GPIO31 31 /* Unrouted */
44
45#define U300_GPIO_PIN_GPIO32 32 /* Unrouted */
46#define U300_GPIO_PIN_GPIO33 33 /* Unrouted */
47#define U300_GPIO_PIN_GPIO34 34 /* Unrouted */
48#define U300_GPIO_PIN_GPIO35 35 /* Unrouted */
49#define U300_GPIO_PIN_GPIO36 36 /* Unrouted */
50#define U300_GPIO_PIN_GPIO37 37 /* Unrouted */
51#define U300_GPIO_PIN_GPIO38 38 /* Unrouted */
52#define U300_GPIO_PIN_GPIO39 39 /* Unrouted */
53
54#define U300_GPIO_PIN_GPIO40 40 /* Unrouted */
55#define U300_GPIO_PIN_GPIO41 41 /* Unrouted */
56#define U300_GPIO_PIN_GPIO42 42 /* Unrouted */
57#define U300_GPIO_PIN_GPIO43 43 /* Unrouted */
58#define U300_GPIO_PIN_GPIO44 44 /* Unrouted */
59#define U300_GPIO_PIN_GPIO45 45 /* Unrouted */
60#define U300_GPIO_PIN_GPIO46 46 /* Unrouted */
61#define U300_GPIO_PIN_GPIO47 47 /* Unrouted */
62
63#define U300_GPIO_PIN_GPIO48 48 /* Unrouted */
64#define U300_GPIO_PIN_GPIO49 49 /* Unrouted */
65#define U300_GPIO_PIN_GPIO50 50 /* Unrouted */
66#define U300_GPIO_PIN_GPIO51 51 /* Unrouted */
67#define U300_GPIO_PIN_GPIO52 52 /* Unrouted */
68#define U300_GPIO_PIN_GPIO53 53 /* Unrouted */
69#define U300_GPIO_PIN_GPIO54 54 /* Unrouted */
70#define U300_GPIO_PIN_GPIO55 55 /* Unrouted */
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c
index aba9e5692958..bfe443daf4b0 100644
--- a/arch/arm/mach-ux500/board-mop500-audio.c
+++ b/arch/arm/mach-ux500/board-mop500-audio.c
@@ -21,28 +21,14 @@
21 21
22static struct stedma40_chan_cfg msp0_dma_rx = { 22static struct stedma40_chan_cfg msp0_dma_rx = {
23 .high_priority = true, 23 .high_priority = true,
24 .dir = STEDMA40_PERIPH_TO_MEM, 24 .dir = DMA_DEV_TO_MEM,
25 25 .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0,
26 .src_dev_type = DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX,
27 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
28
29 .src_info.psize = STEDMA40_PSIZE_LOG_4,
30 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
31
32 /* data_width is set during configuration */
33}; 26};
34 27
35static struct stedma40_chan_cfg msp0_dma_tx = { 28static struct stedma40_chan_cfg msp0_dma_tx = {
36 .high_priority = true, 29 .high_priority = true,
37 .dir = STEDMA40_MEM_TO_PERIPH, 30 .dir = DMA_MEM_TO_DEV,
38 31 .dev_type = DB8500_DMA_DEV31_MSP0_SLIM0_CH0,
39 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
40 .dst_dev_type = DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX,
41
42 .src_info.psize = STEDMA40_PSIZE_LOG_4,
43 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
44
45 /* data_width is set during configuration */
46}; 32};
47 33
48struct msp_i2s_platform_data msp0_platform_data = { 34struct msp_i2s_platform_data msp0_platform_data = {
@@ -53,28 +39,14 @@ struct msp_i2s_platform_data msp0_platform_data = {
53 39
54static struct stedma40_chan_cfg msp1_dma_rx = { 40static struct stedma40_chan_cfg msp1_dma_rx = {
55 .high_priority = true, 41 .high_priority = true,
56 .dir = STEDMA40_PERIPH_TO_MEM, 42 .dir = DMA_DEV_TO_MEM,
57 43 .dev_type = DB8500_DMA_DEV30_MSP3,
58 .src_dev_type = DB8500_DMA_DEV30_MSP3_RX,
59 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
60
61 .src_info.psize = STEDMA40_PSIZE_LOG_4,
62 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
63
64 /* data_width is set during configuration */
65}; 44};
66 45
67static struct stedma40_chan_cfg msp1_dma_tx = { 46static struct stedma40_chan_cfg msp1_dma_tx = {
68 .high_priority = true, 47 .high_priority = true,
69 .dir = STEDMA40_MEM_TO_PERIPH, 48 .dir = DMA_MEM_TO_DEV,
70 49 .dev_type = DB8500_DMA_DEV30_MSP1,
71 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
72 .dst_dev_type = DB8500_DMA_DEV30_MSP1_TX,
73
74 .src_info.psize = STEDMA40_PSIZE_LOG_4,
75 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
76
77 /* data_width is set during configuration */
78}; 50};
79 51
80struct msp_i2s_platform_data msp1_platform_data = { 52struct msp_i2s_platform_data msp1_platform_data = {
@@ -85,32 +57,16 @@ struct msp_i2s_platform_data msp1_platform_data = {
85 57
86static struct stedma40_chan_cfg msp2_dma_rx = { 58static struct stedma40_chan_cfg msp2_dma_rx = {
87 .high_priority = true, 59 .high_priority = true,
88 .dir = STEDMA40_PERIPH_TO_MEM, 60 .dir = DMA_DEV_TO_MEM,
89 61 .dev_type = DB8500_DMA_DEV14_MSP2,
90 .src_dev_type = DB8500_DMA_DEV14_MSP2_RX,
91 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
92
93 /* MSP2 DMA doesn't work with PSIZE == 4 on DB8500v2 */
94 .src_info.psize = STEDMA40_PSIZE_LOG_1,
95 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
96
97 /* data_width is set during configuration */
98}; 62};
99 63
100static struct stedma40_chan_cfg msp2_dma_tx = { 64static struct stedma40_chan_cfg msp2_dma_tx = {
101 .high_priority = true, 65 .high_priority = true,
102 .dir = STEDMA40_MEM_TO_PERIPH, 66 .dir = DMA_MEM_TO_DEV,
103 67 .dev_type = DB8500_DMA_DEV14_MSP2,
104 .src_dev_type = STEDMA40_DEV_DST_MEMORY,
105 .dst_dev_type = DB8500_DMA_DEV14_MSP2_TX,
106
107 .src_info.psize = STEDMA40_PSIZE_LOG_4,
108 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
109
110 .use_fixed_channel = true, 68 .use_fixed_channel = true,
111 .phy_channel = 1, 69 .phy_channel = 1,
112
113 /* data_width is set during configuration */
114}; 70};
115 71
116static struct platform_device *db8500_add_msp_i2s(struct device *parent, 72static struct platform_device *db8500_add_msp_i2s(struct device *parent,
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index 947bd9eca079..7936d40a5c37 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -9,6 +9,7 @@
9#include <linux/bug.h> 9#include <linux/bug.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pinctrl/machine.h> 11#include <linux/pinctrl/machine.h>
12#include <linux/pinctrl/pinconf-generic.h>
12#include <linux/platform_data/pinctrl-nomadik.h> 13#include <linux/platform_data/pinctrl-nomadik.h>
13 14
14#include <asm/mach-types.h> 15#include <asm/mach-types.h>
@@ -34,6 +35,11 @@ BIAS(in_pd, PIN_INPUT_PULLDOWN);
34BIAS(out_hi, PIN_OUTPUT_HIGH); 35BIAS(out_hi, PIN_OUTPUT_HIGH);
35BIAS(out_lo, PIN_OUTPUT_LOW); 36BIAS(out_lo, PIN_OUTPUT_LOW);
36BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE); 37BIAS(out_lo_slpm_nowkup, PIN_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE);
38
39BIAS(abx500_out_lo, PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, 0));
40BIAS(abx500_in_pd, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 1));
41BIAS(abx500_in_nopull, PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0));
42
37/* These also force them into GPIO mode */ 43/* These also force them into GPIO mode */
38BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED); 44BIAS(gpio_in_pu, PIN_INPUT_PULLUP|PIN_GPIOMODE_ENABLED);
39BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED); 45BIAS(gpio_in_pd, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED);
@@ -42,8 +48,6 @@ BIAS(gpio_in_pd_slpm_gpio_nopull, PIN_INPUT_PULLDOWN|PIN_GPIOMODE_ENABLED|PIN_SL
42BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED); 48BIAS(gpio_out_hi, PIN_OUTPUT_HIGH|PIN_GPIOMODE_ENABLED);
43BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED); 49BIAS(gpio_out_lo, PIN_OUTPUT_LOW|PIN_GPIOMODE_ENABLED);
44/* Sleep modes */ 50/* Sleep modes */
45BIAS(slpm_in_nopull_wkup, PIN_SLEEPMODE_ENABLED|
46 PIN_SLPM_DIR_INPUT|PIN_SLPM_PULL_NONE|PIN_SLPM_WAKEUP_ENABLE);
47BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED| 51BIAS(slpm_in_wkup_pdis, PIN_SLEEPMODE_ENABLED|
48 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 52 PIN_SLPM_DIR_INPUT|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
49BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED| 53BIAS(slpm_in_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
@@ -54,8 +58,6 @@ BIAS(slpm_wkup_pdis_en, PIN_SLEEPMODE_ENABLED|
54 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED); 58 PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_ENABLED);
55BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED| 59BIAS(slpm_out_lo_pdis, PIN_SLEEPMODE_ENABLED|
56 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED); 60 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_DISABLE|PIN_SLPM_PDIS_DISABLED);
57BIAS(slpm_out_lo_wkup, PIN_SLEEPMODE_ENABLED|
58 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE);
59BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED| 61BIAS(slpm_out_lo_wkup_pdis, PIN_SLEEPMODE_ENABLED|
60 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED); 62 PIN_SLPM_OUTPUT_LOW|PIN_SLPM_WAKEUP_ENABLE|PIN_SLPM_PDIS_DISABLED);
61BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH| 63BIAS(slpm_out_hi_wkup_pdis, PIN_SLEEPMODE_ENABLED|PIN_SLPM_OUTPUT_HIGH|
@@ -97,6 +99,252 @@ BIAS(out_wkup_pdis, PIN_SLPM_DIR_OUTPUT|PIN_SLPM_WAKEUP_ENABLE|
97#define DB8500_PIN_STATE(pin, conf, dev, state) \ 99#define DB8500_PIN_STATE(pin, conf, dev, state) \
98 PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-db8500", pin, conf) 100 PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-db8500", pin, conf)
99 101
102#define AB8500_MUX_HOG(group, func) \
103 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-ab8500.0", group, func)
104#define AB8500_PIN_HOG(pin, conf) \
105 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-ab8500.0", pin, abx500_##conf)
106
107#define AB8500_MUX_STATE(group, func, dev, state) \
108 PIN_MAP_MUX_GROUP(dev, state, "pinctrl-ab8500.0", group, func)
109#define AB8500_PIN_STATE(pin, conf, dev, state) \
110 PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-ab8500.0", pin, abx500_##conf)
111
112#define AB8505_MUX_HOG(group, func) \
113 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-ab8505.0", group, func)
114#define AB8505_PIN_HOG(pin, conf) \
115 PIN_MAP_CONFIGS_PIN_HOG_DEFAULT("pinctrl-ab8505.0", pin, abx500_##conf)
116
117#define AB8505_MUX_STATE(group, func, dev, state) \
118 PIN_MAP_MUX_GROUP(dev, state, "pinctrl-ab8505.0", group, func)
119#define AB8505_PIN_STATE(pin, conf, dev, state) \
120 PIN_MAP_CONFIGS_PIN(dev, state, "pinctrl-ab8505.0", pin, abx500_##conf)
121
122static struct pinctrl_map __initdata ab8500_pinmap[] = {
123 /* Sysclkreq2 */
124 AB8500_MUX_STATE("sysclkreq2_d_1", "sysclkreq", "regulator.35", PINCTRL_STATE_DEFAULT),
125 AB8500_PIN_STATE("GPIO1_T10", in_nopull, "regulator.35", PINCTRL_STATE_DEFAULT),
126 /* sysclkreq2 disable, mux in gpio configured in input pulldown */
127 AB8500_MUX_STATE("gpio1_a_1", "gpio", "regulator.35", PINCTRL_STATE_SLEEP),
128 AB8500_PIN_STATE("GPIO1_T10", in_pd, "regulator.35", PINCTRL_STATE_SLEEP),
129
130 /* pins 2 is muxed in GPIO, configured in INPUT PULL DOWN */
131 AB8500_MUX_HOG("gpio2_a_1", "gpio"),
132 AB8500_PIN_HOG("GPIO2_T9", in_pd),
133
134 /* Sysclkreq4 */
135 AB8500_MUX_STATE("sysclkreq4_d_1", "sysclkreq", "regulator.36", PINCTRL_STATE_DEFAULT),
136 AB8500_PIN_STATE("GPIO3_U9", in_nopull, "regulator.36", PINCTRL_STATE_DEFAULT),
137 /* sysclkreq4 disable, mux in gpio configured in input pulldown */
138 AB8500_MUX_STATE("gpio3_a_1", "gpio", "regulator.36", PINCTRL_STATE_SLEEP),
139 AB8500_PIN_STATE("GPIO3_U9", in_pd, "regulator.36", PINCTRL_STATE_SLEEP),
140
141 /* pins 4 is muxed in GPIO, configured in INPUT PULL DOWN */
142 AB8500_MUX_HOG("gpio4_a_1", "gpio"),
143 AB8500_PIN_HOG("GPIO4_W2", in_pd),
144
145 /*
146 * pins 6,7,8 and 9 are muxed in YCBCR0123
147 * configured in INPUT PULL UP
148 */
149 AB8500_MUX_HOG("ycbcr0123_d_1", "ycbcr"),
150 AB8500_PIN_HOG("GPIO6_Y18", in_nopull),
151 AB8500_PIN_HOG("GPIO7_AA20", in_nopull),
152 AB8500_PIN_HOG("GPIO8_W18", in_nopull),
153 AB8500_PIN_HOG("GPIO9_AA19", in_nopull),
154
155 /*
156 * pins 10,11,12 and 13 are muxed in GPIO
157 * configured in INPUT PULL DOWN
158 */
159 AB8500_MUX_HOG("gpio10_d_1", "gpio"),
160 AB8500_PIN_HOG("GPIO10_U17", in_pd),
161
162 AB8500_MUX_HOG("gpio11_d_1", "gpio"),
163 AB8500_PIN_HOG("GPIO11_AA18", in_pd),
164
165 AB8500_MUX_HOG("gpio12_d_1", "gpio"),
166 AB8500_PIN_HOG("GPIO12_U16", in_pd),
167
168 AB8500_MUX_HOG("gpio13_d_1", "gpio"),
169 AB8500_PIN_HOG("GPIO13_W17", in_pd),
170
171 /*
172 * pins 14,15 are muxed in PWM1 and PWM2
173 * configured in INPUT PULL DOWN
174 */
175 AB8500_MUX_HOG("pwmout1_d_1", "pwmout"),
176 AB8500_PIN_HOG("GPIO14_F14", in_pd),
177
178 AB8500_MUX_HOG("pwmout2_d_1", "pwmout"),
179 AB8500_PIN_HOG("GPIO15_B17", in_pd),
180
181 /*
182 * pins 16 is muxed in GPIO
183 * configured in INPUT PULL DOWN
184 */
185 AB8500_MUX_HOG("gpio16_a_1", "gpio"),
186 AB8500_PIN_HOG("GPIO14_F14", in_pd),
187
188 /*
189 * pins 17,18,19 and 20 are muxed in AUDIO interface 1
190 * configured in INPUT PULL DOWN
191 */
192 AB8500_MUX_HOG("adi1_d_1", "adi1"),
193 AB8500_PIN_HOG("GPIO17_P5", in_pd),
194 AB8500_PIN_HOG("GPIO18_R5", in_pd),
195 AB8500_PIN_HOG("GPIO19_U5", in_pd),
196 AB8500_PIN_HOG("GPIO20_T5", in_pd),
197
198 /*
199 * pins 21,22 and 23 are muxed in USB UICC
200 * configured in INPUT PULL DOWN
201 */
202 AB8500_MUX_HOG("usbuicc_d_1", "usbuicc"),
203 AB8500_PIN_HOG("GPIO21_H19", in_pd),
204 AB8500_PIN_HOG("GPIO22_G20", in_pd),
205 AB8500_PIN_HOG("GPIO23_G19", in_pd),
206
207 /*
208 * pins 24,25 are muxed in GPIO
209 * configured in INPUT PULL DOWN
210 */
211 AB8500_MUX_HOG("gpio24_a_1", "gpio"),
212 AB8500_PIN_HOG("GPIO24_T14", in_pd),
213
214 AB8500_MUX_HOG("gpio25_a_1", "gpio"),
215 AB8500_PIN_HOG("GPIO25_R16", in_pd),
216
217 /*
218 * pins 26 is muxed in GPIO
219 * configured in OUTPUT LOW
220 */
221 AB8500_MUX_HOG("gpio26_d_1", "gpio"),
222 AB8500_PIN_HOG("GPIO26_M16", out_lo),
223
224 /*
225 * pins 27,28 are muxed in DMIC12
226 * configured in INPUT PULL DOWN
227 */
228 AB8500_MUX_HOG("dmic12_d_1", "dmic"),
229 AB8500_PIN_HOG("GPIO27_J6", in_pd),
230 AB8500_PIN_HOG("GPIO28_K6", in_pd),
231
232 /*
233 * pins 29,30 are muxed in DMIC34
234 * configured in INPUT PULL DOWN
235 */
236 AB8500_MUX_HOG("dmic34_d_1", "dmic"),
237 AB8500_PIN_HOG("GPIO29_G6", in_pd),
238 AB8500_PIN_HOG("GPIO30_H6", in_pd),
239
240 /*
241 * pins 31,32 are muxed in DMIC56
242 * configured in INPUT PULL DOWN
243 */
244 AB8500_MUX_HOG("dmic56_d_1", "dmic"),
245 AB8500_PIN_HOG("GPIO31_F5", in_pd),
246 AB8500_PIN_HOG("GPIO32_G5", in_pd),
247
248 /*
249 * pins 34 is muxed in EXTCPENA
250 * configured INPUT PULL DOWN
251 */
252 AB8500_MUX_HOG("extcpena_d_1", "extcpena"),
253 AB8500_PIN_HOG("GPIO34_R17", in_pd),
254
255 /*
256 * pins 35 is muxed in GPIO
257 * configured in OUTPUT LOW
258 */
259 AB8500_MUX_HOG("gpio35_d_1", "gpio"),
260 AB8500_PIN_HOG("GPIO35_W15", in_pd),
261
262 /*
263 * pins 36,37,38 and 39 are muxed in GPIO
264 * configured in INPUT PULL DOWN
265 */
266 AB8500_MUX_HOG("gpio36_a_1", "gpio"),
267 AB8500_PIN_HOG("GPIO36_A17", in_pd),
268
269 AB8500_MUX_HOG("gpio37_a_1", "gpio"),
270 AB8500_PIN_HOG("GPIO37_E15", in_pd),
271
272 AB8500_MUX_HOG("gpio38_a_1", "gpio"),
273 AB8500_PIN_HOG("GPIO38_C17", in_pd),
274
275 AB8500_MUX_HOG("gpio39_a_1", "gpio"),
276 AB8500_PIN_HOG("GPIO39_E16", in_pd),
277
278 /*
279 * pins 40 and 41 are muxed in MODCSLSDA
280 * configured INPUT PULL DOWN
281 */
282 AB8500_MUX_HOG("modsclsda_d_1", "modsclsda"),
283 AB8500_PIN_HOG("GPIO40_T19", in_pd),
284 AB8500_PIN_HOG("GPIO41_U19", in_pd),
285
286 /*
287 * pins 42 is muxed in GPIO
288 * configured INPUT PULL DOWN
289 */
290 AB8500_MUX_HOG("gpio42_a_1", "gpio"),
291 AB8500_PIN_HOG("GPIO42_U2", in_pd),
292};
293
294static struct pinctrl_map __initdata ab8505_pinmap[] = {
295 /* Sysclkreq2 */
296 AB8505_MUX_STATE("sysclkreq2_d_1", "sysclkreq", "regulator.36", PINCTRL_STATE_DEFAULT),
297 AB8505_PIN_STATE("GPIO1_N4", in_nopull, "regulator.36", PINCTRL_STATE_DEFAULT),
298 /* sysclkreq2 disable, mux in gpio configured in input pulldown */
299 AB8505_MUX_STATE("gpio1_a_1", "gpio", "regulator.36", PINCTRL_STATE_SLEEP),
300 AB8505_PIN_STATE("GPIO1_N4", in_pd, "regulator.36", PINCTRL_STATE_SLEEP),
301
302 /* pins 2 is muxed in GPIO, configured in INPUT PULL DOWN */
303 AB8505_MUX_HOG("gpio2_a_1", "gpio"),
304 AB8505_PIN_HOG("GPIO2_R5", in_pd),
305
306 /* Sysclkreq4 */
307 AB8505_MUX_STATE("sysclkreq4_d_1", "sysclkreq", "regulator.37", PINCTRL_STATE_DEFAULT),
308 AB8505_PIN_STATE("GPIO3_P5", in_nopull, "regulator.37", PINCTRL_STATE_DEFAULT),
309 /* sysclkreq4 disable, mux in gpio configured in input pulldown */
310 AB8505_MUX_STATE("gpio3_a_1", "gpio", "regulator.37", PINCTRL_STATE_SLEEP),
311 AB8505_PIN_STATE("GPIO3_P5", in_pd, "regulator.37", PINCTRL_STATE_SLEEP),
312
313 AB8505_MUX_HOG("gpio10_d_1", "gpio"),
314 AB8505_PIN_HOG("GPIO10_B16", in_pd),
315
316 AB8505_MUX_HOG("gpio11_d_1", "gpio"),
317 AB8505_PIN_HOG("GPIO11_B17", in_pd),
318
319 AB8505_MUX_HOG("gpio13_d_1", "gpio"),
320 AB8505_PIN_HOG("GPIO13_D17", in_nopull),
321
322 AB8505_MUX_HOG("pwmout1_d_1", "pwmout"),
323 AB8505_PIN_HOG("GPIO14_C16", in_pd),
324
325 AB8505_MUX_HOG("adi2_d_1", "adi2"),
326 AB8505_PIN_HOG("GPIO17_P2", in_pd),
327 AB8505_PIN_HOG("GPIO18_N3", in_pd),
328 AB8505_PIN_HOG("GPIO19_T1", in_pd),
329 AB8505_PIN_HOG("GPIO20_P3", in_pd),
330
331 AB8505_MUX_HOG("gpio34_a_1", "gpio"),
332 AB8505_PIN_HOG("GPIO34_H14", in_pd),
333
334 AB8505_MUX_HOG("modsclsda_d_1", "modsclsda"),
335 AB8505_PIN_HOG("GPIO40_J15", in_pd),
336 AB8505_PIN_HOG("GPIO41_J14", in_pd),
337
338 AB8505_MUX_HOG("gpio50_d_1", "gpio"),
339 AB8505_PIN_HOG("GPIO50_L4", in_nopull),
340
341 AB8505_MUX_HOG("resethw_d_1", "resethw"),
342 AB8505_PIN_HOG("GPIO52_D16", in_pd),
343
344 AB8505_MUX_HOG("service_d_1", "service"),
345 AB8505_PIN_HOG("GPIO53_D15", in_pd),
346};
347
100/* Pin control settings */ 348/* Pin control settings */
101static struct pinctrl_map __initdata mop500_family_pinmap[] = { 349static struct pinctrl_map __initdata mop500_family_pinmap[] = {
102 /* 350 /*
@@ -174,17 +422,12 @@ static struct pinctrl_map __initdata mop500_family_pinmap[] = {
174 DB8500_PIN_SLEEP("GPIO4_AH6", slpm_in_wkup_pdis, "uart1"), 422 DB8500_PIN_SLEEP("GPIO4_AH6", slpm_in_wkup_pdis, "uart1"),
175 DB8500_PIN_SLEEP("GPIO5_AG6", slpm_out_wkup_pdis, "uart1"), 423 DB8500_PIN_SLEEP("GPIO5_AG6", slpm_out_wkup_pdis, "uart1"),
176 /* MSP1 for ALSA codec */ 424 /* MSP1 for ALSA codec */
177 DB8500_MUX("msp1txrx_a_1", "msp1", "ux500-msp-i2s.1"), 425 DB8500_MUX_HOG("msp1txrx_a_1", "msp1"),
178 DB8500_MUX("msp1_a_1", "msp1", "ux500-msp-i2s.1"), 426 DB8500_MUX_HOG("msp1_a_1", "msp1"),
179 DB8500_PIN("GPIO33_AF2", out_lo_slpm_nowkup, "ux500-msp-i2s.1"), 427 DB8500_PIN_HOG("GPIO33_AF2", out_lo_slpm_nowkup),
180 DB8500_PIN("GPIO34_AE1", in_nopull_slpm_nowkup, "ux500-msp-i2s.1"), 428 DB8500_PIN_HOG("GPIO34_AE1", in_nopull_slpm_nowkup),
181 DB8500_PIN("GPIO35_AE2", in_nopull_slpm_nowkup, "ux500-msp-i2s.1"), 429 DB8500_PIN_HOG("GPIO35_AE2", in_nopull_slpm_nowkup),
182 DB8500_PIN("GPIO36_AG2", in_nopull_slpm_nowkup, "ux500-msp-i2s.1"), 430 DB8500_PIN_HOG("GPIO36_AG2", in_nopull_slpm_nowkup),
183 /* MSP1 sleep state */
184 DB8500_PIN_SLEEP("GPIO33_AF2", slpm_out_lo_wkup, "ux500-msp-i2s.1"),
185 DB8500_PIN_SLEEP("GPIO34_AE1", slpm_in_nopull_wkup, "ux500-msp-i2s.1"),
186 DB8500_PIN_SLEEP("GPIO35_AE2", slpm_in_nopull_wkup, "ux500-msp-i2s.1"),
187 DB8500_PIN_SLEEP("GPIO36_AG2", slpm_in_nopull_wkup, "ux500-msp-i2s.1"),
188 /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */ 431 /* Mux in LCD data lines 8 thru 11 and LCDA CLK for MCDE TVOUT */
189 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"), 432 DB8500_MUX("lcd_d8_d11_a_1", "lcd", "mcde-tvout"),
190 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"), 433 DB8500_MUX("lcdaclk_b_1", "lcda", "mcde-tvout"),
@@ -821,6 +1064,12 @@ void __init mop500_pinmaps_init(void)
821 pinctrl_register_mappings(mop500_pinmap, 1064 pinctrl_register_mappings(mop500_pinmap,
822 ARRAY_SIZE(mop500_pinmap)); 1065 ARRAY_SIZE(mop500_pinmap));
823 mop500_href_family_pinmaps_init(); 1066 mop500_href_family_pinmaps_init();
1067 if (machine_is_u8520())
1068 pinctrl_register_mappings(ab8505_pinmap,
1069 ARRAY_SIZE(ab8505_pinmap));
1070 else
1071 pinctrl_register_mappings(ab8500_pinmap,
1072 ARRAY_SIZE(ab8500_pinmap));
824} 1073}
825 1074
826void __init snowball_pinmaps_init(void) 1075void __init snowball_pinmaps_init(void)
@@ -831,6 +1080,8 @@ void __init snowball_pinmaps_init(void)
831 ARRAY_SIZE(snowball_pinmap)); 1080 ARRAY_SIZE(snowball_pinmap));
832 pinctrl_register_mappings(u8500_pinmap, 1081 pinctrl_register_mappings(u8500_pinmap,
833 ARRAY_SIZE(u8500_pinmap)); 1082 ARRAY_SIZE(u8500_pinmap));
1083 pinctrl_register_mappings(ab8500_pinmap,
1084 ARRAY_SIZE(ab8500_pinmap));
834} 1085}
835 1086
836void __init hrefv60_pinmaps_init(void) 1087void __init hrefv60_pinmaps_init(void)
@@ -840,4 +1091,6 @@ void __init hrefv60_pinmaps_init(void)
840 pinctrl_register_mappings(hrefv60_pinmap, 1091 pinctrl_register_mappings(hrefv60_pinmap,
841 ARRAY_SIZE(hrefv60_pinmap)); 1092 ARRAY_SIZE(hrefv60_pinmap));
842 mop500_href_family_pinmaps_init(); 1093 mop500_href_family_pinmaps_init();
1094 pinctrl_register_mappings(ab8500_pinmap,
1095 ARRAY_SIZE(ab8500_pinmap));
843} 1096}
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index d6b7c8556fa1..0dc44c683427 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -999,7 +999,6 @@ struct ab8500_regulator_platform_data ab8500_regulator_plat_data = {
999 .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), 999 .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators),
1000}; 1000};
1001 1001
1002/* Use the AB8500 init settings for AB8505 as they are the same right now */
1003struct ab8500_regulator_platform_data ab8505_regulator_plat_data = { 1002struct ab8500_regulator_platform_data ab8505_regulator_plat_data = {
1004 .reg_init = ab8505_reg_init, 1003 .reg_init = ab8505_reg_init,
1005 .num_reg_init = ARRAY_SIZE(ab8505_reg_init), 1004 .num_reg_init = ARRAY_SIZE(ab8505_reg_init),
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 0ef38775a0c1..b3e61a38e5c8 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -34,29 +34,25 @@
34#ifdef CONFIG_STE_DMA40 34#ifdef CONFIG_STE_DMA40
35struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = { 35struct stedma40_chan_cfg mop500_sdi0_dma_cfg_rx = {
36 .mode = STEDMA40_MODE_LOGICAL, 36 .mode = STEDMA40_MODE_LOGICAL,
37 .dir = STEDMA40_PERIPH_TO_MEM, 37 .dir = DMA_DEV_TO_MEM,
38 .src_dev_type = DB8500_DMA_DEV29_SD_MM0_RX, 38 .dev_type = DB8500_DMA_DEV29_SD_MM0,
39 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
40 .src_info.data_width = STEDMA40_WORD_WIDTH,
41 .dst_info.data_width = STEDMA40_WORD_WIDTH,
42}; 39};
43 40
44static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = { 41static struct stedma40_chan_cfg mop500_sdi0_dma_cfg_tx = {
45 .mode = STEDMA40_MODE_LOGICAL, 42 .mode = STEDMA40_MODE_LOGICAL,
46 .dir = STEDMA40_MEM_TO_PERIPH, 43 .dir = DMA_MEM_TO_DEV,
47 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 44 .dev_type = DB8500_DMA_DEV29_SD_MM0,
48 .dst_dev_type = DB8500_DMA_DEV29_SD_MM0_TX,
49 .src_info.data_width = STEDMA40_WORD_WIDTH,
50 .dst_info.data_width = STEDMA40_WORD_WIDTH,
51}; 45};
52#endif 46#endif
53 47
54struct mmci_platform_data mop500_sdi0_data = { 48struct mmci_platform_data mop500_sdi0_data = {
55 .ocr_mask = MMC_VDD_29_30, 49 .f_max = 100000000,
56 .f_max = 50000000,
57 .capabilities = MMC_CAP_4_BIT_DATA | 50 .capabilities = MMC_CAP_4_BIT_DATA |
58 MMC_CAP_SD_HIGHSPEED | 51 MMC_CAP_SD_HIGHSPEED |
59 MMC_CAP_MMC_HIGHSPEED, 52 MMC_CAP_MMC_HIGHSPEED |
53 MMC_CAP_ERASE |
54 MMC_CAP_UHS_SDR12 |
55 MMC_CAP_UHS_SDR25,
60 .gpio_wp = -1, 56 .gpio_wp = -1,
61 .sigdir = MCI_ST_FBCLKEN | 57 .sigdir = MCI_ST_FBCLKEN |
62 MCI_ST_CMDDIREN | 58 MCI_ST_CMDDIREN |
@@ -87,27 +83,22 @@ void mop500_sdi_tc35892_init(struct device *parent)
87#ifdef CONFIG_STE_DMA40 83#ifdef CONFIG_STE_DMA40
88static struct stedma40_chan_cfg sdi1_dma_cfg_rx = { 84static struct stedma40_chan_cfg sdi1_dma_cfg_rx = {
89 .mode = STEDMA40_MODE_LOGICAL, 85 .mode = STEDMA40_MODE_LOGICAL,
90 .dir = STEDMA40_PERIPH_TO_MEM, 86 .dir = DMA_DEV_TO_MEM,
91 .src_dev_type = DB8500_DMA_DEV32_SD_MM1_RX, 87 .dev_type = DB8500_DMA_DEV32_SD_MM1,
92 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
93 .src_info.data_width = STEDMA40_WORD_WIDTH,
94 .dst_info.data_width = STEDMA40_WORD_WIDTH,
95}; 88};
96 89
97static struct stedma40_chan_cfg sdi1_dma_cfg_tx = { 90static struct stedma40_chan_cfg sdi1_dma_cfg_tx = {
98 .mode = STEDMA40_MODE_LOGICAL, 91 .mode = STEDMA40_MODE_LOGICAL,
99 .dir = STEDMA40_MEM_TO_PERIPH, 92 .dir = DMA_MEM_TO_DEV,
100 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 93 .dev_type = DB8500_DMA_DEV32_SD_MM1,
101 .dst_dev_type = DB8500_DMA_DEV32_SD_MM1_TX,
102 .src_info.data_width = STEDMA40_WORD_WIDTH,
103 .dst_info.data_width = STEDMA40_WORD_WIDTH,
104}; 94};
105#endif 95#endif
106 96
107struct mmci_platform_data mop500_sdi1_data = { 97struct mmci_platform_data mop500_sdi1_data = {
108 .ocr_mask = MMC_VDD_29_30, 98 .ocr_mask = MMC_VDD_29_30,
109 .f_max = 50000000, 99 .f_max = 100000000,
110 .capabilities = MMC_CAP_4_BIT_DATA, 100 .capabilities = MMC_CAP_4_BIT_DATA |
101 MMC_CAP_NONREMOVABLE,
111 .gpio_cd = -1, 102 .gpio_cd = -1,
112 .gpio_wp = -1, 103 .gpio_wp = -1,
113#ifdef CONFIG_STE_DMA40 104#ifdef CONFIG_STE_DMA40
@@ -124,28 +115,26 @@ struct mmci_platform_data mop500_sdi1_data = {
124#ifdef CONFIG_STE_DMA40 115#ifdef CONFIG_STE_DMA40
125struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = { 116struct stedma40_chan_cfg mop500_sdi2_dma_cfg_rx = {
126 .mode = STEDMA40_MODE_LOGICAL, 117 .mode = STEDMA40_MODE_LOGICAL,
127 .dir = STEDMA40_PERIPH_TO_MEM, 118 .dir = DMA_DEV_TO_MEM,
128 .src_dev_type = DB8500_DMA_DEV28_SD_MM2_RX, 119 .dev_type = DB8500_DMA_DEV28_SD_MM2,
129 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
130 .src_info.data_width = STEDMA40_WORD_WIDTH,
131 .dst_info.data_width = STEDMA40_WORD_WIDTH,
132}; 120};
133 121
134static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = { 122static struct stedma40_chan_cfg mop500_sdi2_dma_cfg_tx = {
135 .mode = STEDMA40_MODE_LOGICAL, 123 .mode = STEDMA40_MODE_LOGICAL,
136 .dir = STEDMA40_MEM_TO_PERIPH, 124 .dir = DMA_MEM_TO_DEV,
137 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 125 .dev_type = DB8500_DMA_DEV28_SD_MM2,
138 .dst_dev_type = DB8500_DMA_DEV28_SD_MM2_TX,
139 .src_info.data_width = STEDMA40_WORD_WIDTH,
140 .dst_info.data_width = STEDMA40_WORD_WIDTH,
141}; 126};
142#endif 127#endif
143 128
144struct mmci_platform_data mop500_sdi2_data = { 129struct mmci_platform_data mop500_sdi2_data = {
145 .ocr_mask = MMC_VDD_165_195, 130 .ocr_mask = MMC_VDD_165_195,
146 .f_max = 50000000, 131 .f_max = 100000000,
147 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | 132 .capabilities = MMC_CAP_4_BIT_DATA |
148 MMC_CAP_MMC_HIGHSPEED, 133 MMC_CAP_8_BIT_DATA |
134 MMC_CAP_NONREMOVABLE |
135 MMC_CAP_MMC_HIGHSPEED |
136 MMC_CAP_ERASE |
137 MMC_CAP_CMD23,
149 .gpio_cd = -1, 138 .gpio_cd = -1,
150 .gpio_wp = -1, 139 .gpio_wp = -1,
151#ifdef CONFIG_STE_DMA40 140#ifdef CONFIG_STE_DMA40
@@ -162,28 +151,25 @@ struct mmci_platform_data mop500_sdi2_data = {
162#ifdef CONFIG_STE_DMA40 151#ifdef CONFIG_STE_DMA40
163struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = { 152struct stedma40_chan_cfg mop500_sdi4_dma_cfg_rx = {
164 .mode = STEDMA40_MODE_LOGICAL, 153 .mode = STEDMA40_MODE_LOGICAL,
165 .dir = STEDMA40_PERIPH_TO_MEM, 154 .dir = DMA_DEV_TO_MEM,
166 .src_dev_type = DB8500_DMA_DEV42_SD_MM4_RX, 155 .dev_type = DB8500_DMA_DEV42_SD_MM4,
167 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
168 .src_info.data_width = STEDMA40_WORD_WIDTH,
169 .dst_info.data_width = STEDMA40_WORD_WIDTH,
170}; 156};
171 157
172static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = { 158static struct stedma40_chan_cfg mop500_sdi4_dma_cfg_tx = {
173 .mode = STEDMA40_MODE_LOGICAL, 159 .mode = STEDMA40_MODE_LOGICAL,
174 .dir = STEDMA40_MEM_TO_PERIPH, 160 .dir = DMA_MEM_TO_DEV,
175 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 161 .dev_type = DB8500_DMA_DEV42_SD_MM4,
176 .dst_dev_type = DB8500_DMA_DEV42_SD_MM4_TX,
177 .src_info.data_width = STEDMA40_WORD_WIDTH,
178 .dst_info.data_width = STEDMA40_WORD_WIDTH,
179}; 162};
180#endif 163#endif
181 164
182struct mmci_platform_data mop500_sdi4_data = { 165struct mmci_platform_data mop500_sdi4_data = {
183 .ocr_mask = MMC_VDD_29_30, 166 .f_max = 100000000,
184 .f_max = 50000000, 167 .capabilities = MMC_CAP_4_BIT_DATA |
185 .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | 168 MMC_CAP_8_BIT_DATA |
186 MMC_CAP_MMC_HIGHSPEED, 169 MMC_CAP_NONREMOVABLE |
170 MMC_CAP_MMC_HIGHSPEED |
171 MMC_CAP_ERASE |
172 MMC_CAP_CMD23,
187 .gpio_cd = -1, 173 .gpio_cd = -1,
188 .gpio_wp = -1, 174 .gpio_wp = -1,
189#ifdef CONFIG_STE_DMA40 175#ifdef CONFIG_STE_DMA40
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 78389de94dde..df5d27a532e9 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -413,47 +413,23 @@ static void mop500_prox_deactivate(struct device *dev)
413 regulator_put(prox_regulator); 413 regulator_put(prox_regulator);
414} 414}
415 415
416void mop500_snowball_ethernet_clock_enable(void)
417{
418 struct clk *clk;
419
420 clk = clk_get_sys("fsmc", NULL);
421 if (!IS_ERR(clk))
422 clk_prepare_enable(clk);
423}
424
425static struct cryp_platform_data u8500_cryp1_platform_data = { 416static struct cryp_platform_data u8500_cryp1_platform_data = {
426 .mem_to_engine = { 417 .mem_to_engine = {
427 .dir = STEDMA40_MEM_TO_PERIPH, 418 .dir = DMA_MEM_TO_DEV,
428 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 419 .dev_type = DB8500_DMA_DEV48_CAC1,
429 .dst_dev_type = DB8500_DMA_DEV48_CAC1_TX,
430 .src_info.data_width = STEDMA40_WORD_WIDTH,
431 .dst_info.data_width = STEDMA40_WORD_WIDTH,
432 .mode = STEDMA40_MODE_LOGICAL, 420 .mode = STEDMA40_MODE_LOGICAL,
433 .src_info.psize = STEDMA40_PSIZE_LOG_4,
434 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
435 }, 421 },
436 .engine_to_mem = { 422 .engine_to_mem = {
437 .dir = STEDMA40_PERIPH_TO_MEM, 423 .dir = DMA_DEV_TO_MEM,
438 .src_dev_type = DB8500_DMA_DEV48_CAC1_RX, 424 .dev_type = DB8500_DMA_DEV48_CAC1,
439 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
440 .src_info.data_width = STEDMA40_WORD_WIDTH,
441 .dst_info.data_width = STEDMA40_WORD_WIDTH,
442 .mode = STEDMA40_MODE_LOGICAL, 425 .mode = STEDMA40_MODE_LOGICAL,
443 .src_info.psize = STEDMA40_PSIZE_LOG_4,
444 .dst_info.psize = STEDMA40_PSIZE_LOG_4,
445 } 426 }
446}; 427};
447 428
448static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = { 429static struct stedma40_chan_cfg u8500_hash_dma_cfg_tx = {
449 .dir = STEDMA40_MEM_TO_PERIPH, 430 .dir = DMA_MEM_TO_DEV,
450 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 431 .dev_type = DB8500_DMA_DEV50_HAC1_TX,
451 .dst_dev_type = DB8500_DMA_DEV50_HAC1_TX,
452 .src_info.data_width = STEDMA40_WORD_WIDTH,
453 .dst_info.data_width = STEDMA40_WORD_WIDTH,
454 .mode = STEDMA40_MODE_LOGICAL, 432 .mode = STEDMA40_MODE_LOGICAL,
455 .src_info.psize = STEDMA40_PSIZE_LOG_16,
456 .dst_info.psize = STEDMA40_PSIZE_LOG_16,
457}; 433};
458 434
459static struct hash_platform_data u8500_hash1_platform_data = { 435static struct hash_platform_data u8500_hash1_platform_data = {
@@ -470,20 +446,14 @@ static struct platform_device *mop500_platform_devs[] __initdata = {
470#ifdef CONFIG_STE_DMA40 446#ifdef CONFIG_STE_DMA40
471static struct stedma40_chan_cfg ssp0_dma_cfg_rx = { 447static struct stedma40_chan_cfg ssp0_dma_cfg_rx = {
472 .mode = STEDMA40_MODE_LOGICAL, 448 .mode = STEDMA40_MODE_LOGICAL,
473 .dir = STEDMA40_PERIPH_TO_MEM, 449 .dir = DMA_DEV_TO_MEM,
474 .src_dev_type = DB8500_DMA_DEV8_SSP0_RX, 450 .dev_type = DB8500_DMA_DEV8_SSP0,
475 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
476 .src_info.data_width = STEDMA40_BYTE_WIDTH,
477 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
478}; 451};
479 452
480static struct stedma40_chan_cfg ssp0_dma_cfg_tx = { 453static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
481 .mode = STEDMA40_MODE_LOGICAL, 454 .mode = STEDMA40_MODE_LOGICAL,
482 .dir = STEDMA40_MEM_TO_PERIPH, 455 .dir = DMA_MEM_TO_DEV,
483 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 456 .dev_type = DB8500_DMA_DEV8_SSP0,
484 .dst_dev_type = DB8500_DMA_DEV8_SSP0_TX,
485 .src_info.data_width = STEDMA40_BYTE_WIDTH,
486 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
487}; 457};
488#endif 458#endif
489 459
@@ -511,56 +481,38 @@ static void __init mop500_spi_init(struct device *parent)
511#ifdef CONFIG_STE_DMA40 481#ifdef CONFIG_STE_DMA40
512static struct stedma40_chan_cfg uart0_dma_cfg_rx = { 482static struct stedma40_chan_cfg uart0_dma_cfg_rx = {
513 .mode = STEDMA40_MODE_LOGICAL, 483 .mode = STEDMA40_MODE_LOGICAL,
514 .dir = STEDMA40_PERIPH_TO_MEM, 484 .dir = DMA_DEV_TO_MEM,
515 .src_dev_type = DB8500_DMA_DEV13_UART0_RX, 485 .dev_type = DB8500_DMA_DEV13_UART0,
516 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
517 .src_info.data_width = STEDMA40_BYTE_WIDTH,
518 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
519}; 486};
520 487
521static struct stedma40_chan_cfg uart0_dma_cfg_tx = { 488static struct stedma40_chan_cfg uart0_dma_cfg_tx = {
522 .mode = STEDMA40_MODE_LOGICAL, 489 .mode = STEDMA40_MODE_LOGICAL,
523 .dir = STEDMA40_MEM_TO_PERIPH, 490 .dir = DMA_MEM_TO_DEV,
524 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 491 .dev_type = DB8500_DMA_DEV13_UART0,
525 .dst_dev_type = DB8500_DMA_DEV13_UART0_TX,
526 .src_info.data_width = STEDMA40_BYTE_WIDTH,
527 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
528}; 492};
529 493
530static struct stedma40_chan_cfg uart1_dma_cfg_rx = { 494static struct stedma40_chan_cfg uart1_dma_cfg_rx = {
531 .mode = STEDMA40_MODE_LOGICAL, 495 .mode = STEDMA40_MODE_LOGICAL,
532 .dir = STEDMA40_PERIPH_TO_MEM, 496 .dir = DMA_DEV_TO_MEM,
533 .src_dev_type = DB8500_DMA_DEV12_UART1_RX, 497 .dev_type = DB8500_DMA_DEV12_UART1,
534 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
535 .src_info.data_width = STEDMA40_BYTE_WIDTH,
536 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
537}; 498};
538 499
539static struct stedma40_chan_cfg uart1_dma_cfg_tx = { 500static struct stedma40_chan_cfg uart1_dma_cfg_tx = {
540 .mode = STEDMA40_MODE_LOGICAL, 501 .mode = STEDMA40_MODE_LOGICAL,
541 .dir = STEDMA40_MEM_TO_PERIPH, 502 .dir = DMA_MEM_TO_DEV,
542 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 503 .dev_type = DB8500_DMA_DEV12_UART1,
543 .dst_dev_type = DB8500_DMA_DEV12_UART1_TX,
544 .src_info.data_width = STEDMA40_BYTE_WIDTH,
545 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
546}; 504};
547 505
548static struct stedma40_chan_cfg uart2_dma_cfg_rx = { 506static struct stedma40_chan_cfg uart2_dma_cfg_rx = {
549 .mode = STEDMA40_MODE_LOGICAL, 507 .mode = STEDMA40_MODE_LOGICAL,
550 .dir = STEDMA40_PERIPH_TO_MEM, 508 .dir = DMA_DEV_TO_MEM,
551 .src_dev_type = DB8500_DMA_DEV11_UART2_RX, 509 .dev_type = DB8500_DMA_DEV11_UART2,
552 .dst_dev_type = STEDMA40_DEV_DST_MEMORY,
553 .src_info.data_width = STEDMA40_BYTE_WIDTH,
554 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
555}; 510};
556 511
557static struct stedma40_chan_cfg uart2_dma_cfg_tx = { 512static struct stedma40_chan_cfg uart2_dma_cfg_tx = {
558 .mode = STEDMA40_MODE_LOGICAL, 513 .mode = STEDMA40_MODE_LOGICAL,
559 .dir = STEDMA40_MEM_TO_PERIPH, 514 .dir = DMA_MEM_TO_DEV,
560 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, 515 .dev_type = DB8500_DMA_DEV11_UART2,
561 .dst_dev_type = DB8500_DMA_DEV11_UART2_TX,
562 .src_info.data_width = STEDMA40_BYTE_WIDTH,
563 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
564}; 516};
565#endif 517#endif
566 518
@@ -674,7 +626,7 @@ static void __init snowball_init_machine(void)
674 mop500_audio_init(parent); 626 mop500_audio_init(parent);
675 mop500_uart_init(parent); 627 mop500_uart_init(parent);
676 628
677 mop500_snowball_ethernet_clock_enable(); 629 u8500_cryp1_hash1_init(parent);
678 630
679 /* This board has full regulator constraints */ 631 /* This board has full regulator constraints */
680 regulator_has_full_constraints(); 632 regulator_has_full_constraints();
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 49514b825034..d6fab166cbf1 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -93,6 +93,7 @@ extern struct amba_pl011_data uart0_plat;
93extern struct amba_pl011_data uart1_plat; 93extern struct amba_pl011_data uart1_plat;
94extern struct amba_pl011_data uart2_plat; 94extern struct amba_pl011_data uart2_plat;
95extern struct pl022_ssp_controller ssp0_plat; 95extern struct pl022_ssp_controller ssp0_plat;
96extern struct stedma40_platform_data dma40_plat_data;
96 97
97extern void mop500_sdi_init(struct device *parent); 98extern void mop500_sdi_init(struct device *parent);
98extern void snowball_sdi_init(struct device *parent); 99extern void snowball_sdi_init(struct device *parent);
@@ -104,7 +105,6 @@ void __init mop500_pinmaps_init(void);
104void __init snowball_pinmaps_init(void); 105void __init snowball_pinmaps_init(void);
105void __init hrefv60_pinmaps_init(void); 106void __init hrefv60_pinmaps_init(void);
106void mop500_audio_init(struct device *parent); 107void mop500_audio_init(struct device *parent);
107void mop500_snowball_ethernet_clock_enable(void);
108 108
109int __init mop500_uib_init(void); 109int __init mop500_uib_init(void);
110void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info, 110void mop500_uib_i2c_add(int busnum, struct i2c_board_info *info,
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index f58615b5c601..82ccf1d98735 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -42,7 +42,8 @@ static int __init ux500_l2x0_init(void)
42 if (cpu_is_u8500_family() || cpu_is_ux540_family()) 42 if (cpu_is_u8500_family() || cpu_is_ux540_family())
43 l2x0_base = __io_address(U8500_L2CC_BASE); 43 l2x0_base = __io_address(U8500_L2CC_BASE);
44 else 44 else
45 ux500_unknown_soc(); 45 /* Non-Ux500 platform */
46 return -ENODEV;
46 47
47 /* Unlock before init */ 48 /* Unlock before init */
48 ux500_l2x0_unlock(); 49 ux500_l2x0_unlock();
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 46cca52890bc..12eee8167525 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -162,26 +162,15 @@ static void __init db8500_add_gpios(struct device *parent)
162 dbx500_add_pinctrl(parent, "pinctrl-db8500", U8500_PRCMU_BASE); 162 dbx500_add_pinctrl(parent, "pinctrl-db8500", U8500_PRCMU_BASE);
163} 163}
164 164
165static int usb_db8500_rx_dma_cfg[] = { 165static int usb_db8500_dma_cfg[] = {
166 DB8500_DMA_DEV38_USB_OTG_IEP_1_9, 166 DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9,
167 DB8500_DMA_DEV37_USB_OTG_IEP_2_10, 167 DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10,
168 DB8500_DMA_DEV36_USB_OTG_IEP_3_11, 168 DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11,
169 DB8500_DMA_DEV19_USB_OTG_IEP_4_12, 169 DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12,
170 DB8500_DMA_DEV18_USB_OTG_IEP_5_13, 170 DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13,
171 DB8500_DMA_DEV17_USB_OTG_IEP_6_14, 171 DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14,
172 DB8500_DMA_DEV16_USB_OTG_IEP_7_15, 172 DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15,
173 DB8500_DMA_DEV39_USB_OTG_IEP_8 173 DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8
174};
175
176static int usb_db8500_tx_dma_cfg[] = {
177 DB8500_DMA_DEV38_USB_OTG_OEP_1_9,
178 DB8500_DMA_DEV37_USB_OTG_OEP_2_10,
179 DB8500_DMA_DEV36_USB_OTG_OEP_3_11,
180 DB8500_DMA_DEV19_USB_OTG_OEP_4_12,
181 DB8500_DMA_DEV18_USB_OTG_OEP_5_13,
182 DB8500_DMA_DEV17_USB_OTG_OEP_6_14,
183 DB8500_DMA_DEV16_USB_OTG_OEP_7_15,
184 DB8500_DMA_DEV39_USB_OTG_OEP_8
185}; 174};
186 175
187static const char *db8500_read_soc_id(void) 176static const char *db8500_read_soc_id(void)
@@ -215,7 +204,7 @@ struct device * __init u8500_init_devices(void)
215 204
216 db8500_add_rtc(parent); 205 db8500_add_rtc(parent);
217 db8500_add_gpios(parent); 206 db8500_add_gpios(parent);
218 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 207 db8500_add_usb(parent, usb_db8500_dma_cfg, usb_db8500_dma_cfg);
219 208
220 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) 209 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
221 platform_devs[i]->dev.parent = parent; 210 platform_devs[i]->dev.parent = parent;
@@ -226,34 +215,13 @@ struct device * __init u8500_init_devices(void)
226} 215}
227 216
228#ifdef CONFIG_MACH_UX500_DT 217#ifdef CONFIG_MACH_UX500_DT
229
230/* TODO: Once all pieces are DT:ed, remove completely. */
231static struct device * __init u8500_of_init_devices(void)
232{
233 struct device *parent = db8500_soc_device_init();
234
235 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
236
237 u8500_dma40_device.dev.parent = parent;
238
239 /*
240 * Devices to be DT:ed:
241 * u8500_dma40_device = todo
242 * db8500_pmu_device = done
243 * db8500_prcmu_device = done
244 */
245 platform_device_register(&u8500_dma40_device);
246
247 return parent;
248}
249
250static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { 218static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
251 /* Requires call-back bindings. */ 219 /* Requires call-back bindings. */
252 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), 220 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata),
253 /* Requires DMA bindings. */ 221 /* Requires DMA bindings. */
254 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat), 222 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", NULL),
255 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat), 223 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL),
256 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat), 224 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL),
257 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat), 225 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
258 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), 226 OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data),
259 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), 227 OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data),
@@ -274,11 +242,16 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
274 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL), 242 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80128000, "nmk-i2c.2", NULL),
275 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL), 243 OF_DEV_AUXDATA("st,nomadik-i2c", 0x80110000, "nmk-i2c.3", NULL),
276 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL), 244 OF_DEV_AUXDATA("st,nomadik-i2c", 0x8012a000, "nmk-i2c.4", NULL),
245 OF_DEV_AUXDATA("stericsson,db8500-musb", 0xa03e0000, "musb-ux500.0", NULL),
277 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", 246 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
278 &db8500_prcmu_pdata), 247 &db8500_prcmu_pdata),
279 OF_DEV_AUXDATA("smsc,lan9115", 0x50000000, "smsc911x.0", NULL), 248 OF_DEV_AUXDATA("smsc,lan9115", 0x50000000, "smsc911x.0", NULL),
249 OF_DEV_AUXDATA("stericsson,ux500-cryp", 0xa03cb000, "cryp1", NULL),
250 OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL),
251 OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0",
252 NULL),
280 /* Requires device name bindings. */ 253 /* Requires device name bindings. */
281 OF_DEV_AUXDATA("stericsson,nmk-pinctrl", U8500_PRCMU_BASE, 254 OF_DEV_AUXDATA("stericsson,db8500-pinctrl", U8500_PRCMU_BASE,
282 "pinctrl-db8500", NULL), 255 "pinctrl-db8500", NULL),
283 /* Requires clock name and DMA bindings. */ 256 /* Requires clock name and DMA bindings. */
284 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, 257 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000,
@@ -289,6 +262,18 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
289 "ux500-msp-i2s.2", &msp2_platform_data), 262 "ux500-msp-i2s.2", &msp2_platform_data),
290 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000, 263 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000,
291 "ux500-msp-i2s.3", &msp3_platform_data), 264 "ux500-msp-i2s.3", &msp3_platform_data),
265 /* Requires clock name bindings and channel address lookup table. */
266 OF_DEV_AUXDATA("stericsson,db8500-dma40", 0x801C0000, "dma40.0", NULL),
267 {},
268};
269
270static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = {
271 /* Requires DMA bindings. */
272 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", NULL),
273 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", NULL),
274 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", NULL),
275 OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu",
276 &db8500_prcmu_pdata),
292 {}, 277 {},
293}; 278};
294 279
@@ -302,24 +287,25 @@ static const struct of_device_id u8500_local_bus_nodes[] = {
302 287
303static void __init u8500_init_machine(void) 288static void __init u8500_init_machine(void)
304{ 289{
305 struct device *parent = NULL; 290 struct device *parent = db8500_soc_device_init();
306 291
307 /* Pinmaps must be in place before devices register */ 292 /* Pinmaps must be in place before devices register */
308 if (of_machine_is_compatible("st-ericsson,mop500")) 293 if (of_machine_is_compatible("st-ericsson,mop500"))
309 mop500_pinmaps_init(); 294 mop500_pinmaps_init();
310 else if (of_machine_is_compatible("calaosystems,snowball-a9500")) { 295 else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
311 snowball_pinmaps_init(); 296 snowball_pinmaps_init();
312 mop500_snowball_ethernet_clock_enable();
313 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) 297 } else if (of_machine_is_compatible("st-ericsson,hrefv60+"))
314 hrefv60_pinmaps_init(); 298 hrefv60_pinmaps_init();
315 else if (of_machine_is_compatible("st-ericsson,ccu9540")) {} 299 else if (of_machine_is_compatible("st-ericsson,ccu9540")) {}
316 /* TODO: Add pinmaps for ccu9540 board. */ 300 /* TODO: Add pinmaps for ccu9540 board. */
317 301
318 /* TODO: Export SoC, USB, cpu-freq and DMA40 */ 302 /* automatically probe child nodes of dbx5x0 devices */
319 parent = u8500_of_init_devices(); 303 if (of_machine_is_compatible("st-ericsson,u8540"))
320 304 of_platform_populate(NULL, u8500_local_bus_nodes,
321 /* automatically probe child nodes of db8500 device */ 305 u8540_auxdata_lookup, parent);
322 of_platform_populate(NULL, u8500_local_bus_nodes, u8500_auxdata_lookup, parent); 306 else
307 of_platform_populate(NULL, u8500_local_bus_nodes,
308 u8500_auxdata_lookup, parent);
323} 309}
324 310
325static const char * stericsson_dt_platform_compat[] = { 311static const char * stericsson_dt_platform_compat[] = {
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index b6145ea51641..e6fb0239151b 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -76,13 +76,15 @@ void __init ux500_init_irq(void)
76 } else if (cpu_is_u9540()) { 76 } else if (cpu_is_u9540()) {
77 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 77 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1);
78 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 78 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1);
79 u8500_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE, 79 u9540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
80 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE, 80 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
81 U8500_CLKRST6_BASE); 81 U8500_CLKRST6_BASE);
82 } else if (cpu_is_u8540()) { 82 } else if (cpu_is_u8540()) {
83 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1); 83 prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
84 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1); 84 ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1);
85 u8540_clk_init(); 85 u8540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE,
86 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE,
87 U8500_CLKRST6_BASE);
86 } 88 }
87} 89}
88 90
diff --git a/arch/arm/mach-ux500/db8500-regs.h b/arch/arm/mach-ux500/db8500-regs.h
index b2d7a0b98629..27399553c841 100644
--- a/arch/arm/mach-ux500/db8500-regs.h
+++ b/arch/arm/mach-ux500/db8500-regs.h
@@ -102,7 +102,6 @@
102#define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000) 102#define U8500_PRCMU_BASE (U8500_PER4_BASE + 0x07000)
103#define U9540_DMC1_BASE (U8500_PER4_BASE + 0x0A000) 103#define U9540_DMC1_BASE (U8500_PER4_BASE + 0x0A000)
104#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000) 104#define U8500_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x68000)
105#define U9540_PRCMU_TCDM_BASE (U8500_PER4_BASE + 0x6A000)
106#define U8500_PRCMU_TCPM_BASE (U8500_PER4_BASE + 0x60000) 105#define U8500_PRCMU_TCPM_BASE (U8500_PER4_BASE + 0x60000)
107#define U8500_PRCMU_TIMER_3_BASE (U8500_PER4_BASE + 0x07338) 106#define U8500_PRCMU_TIMER_3_BASE (U8500_PER4_BASE + 0x07338)
108#define U8500_PRCMU_TIMER_4_BASE (U8500_PER4_BASE + 0x07450) 107#define U8500_PRCMU_TIMER_4_BASE (U8500_PER4_BASE + 0x07450)
@@ -184,7 +183,7 @@
184#define U8500_IO_VIRTUAL 0xf0000000 183#define U8500_IO_VIRTUAL 0xf0000000
185#define U8500_IO_PHYSICAL 0xa0000000 184#define U8500_IO_PHYSICAL 0xa0000000
186/* This is where we map in the ROM to check ASIC IDs */ 185/* This is where we map in the ROM to check ASIC IDs */
187#define UX500_VIRT_ROM 0xf0000000 186#define UX500_VIRT_ROM IOMEM(0xf0000000)
188 187
189/* This macro is used in assembly, so no cast */ 188/* This macro is used in assembly, so no cast */
190#define IO_ADDRESS(x) \ 189#define IO_ADDRESS(x) \
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index 1cf94ce0feec..516a6f57d159 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -42,128 +42,7 @@ static struct resource dma40_resources[] = {
42 } 42 }
43}; 43};
44 44
45/* Default configuration for physcial memcpy */ 45struct stedma40_platform_data dma40_plat_data = {
46struct stedma40_chan_cfg dma40_memcpy_conf_phy = {
47 .mode = STEDMA40_MODE_PHYSICAL,
48 .dir = STEDMA40_MEM_TO_MEM,
49
50 .src_info.data_width = STEDMA40_BYTE_WIDTH,
51 .src_info.psize = STEDMA40_PSIZE_PHY_1,
52 .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
53
54 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
55 .dst_info.psize = STEDMA40_PSIZE_PHY_1,
56 .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
57};
58/* Default configuration for logical memcpy */
59struct stedma40_chan_cfg dma40_memcpy_conf_log = {
60 .dir = STEDMA40_MEM_TO_MEM,
61
62 .src_info.data_width = STEDMA40_BYTE_WIDTH,
63 .src_info.psize = STEDMA40_PSIZE_LOG_1,
64 .src_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
65
66 .dst_info.data_width = STEDMA40_BYTE_WIDTH,
67 .dst_info.psize = STEDMA40_PSIZE_LOG_1,
68 .dst_info.flow_ctrl = STEDMA40_NO_FLOW_CTRL,
69};
70
71/*
72 * Mapping between destination event lines and physical device address.
73 * The event line is tied to a device and therefore the address is constant.
74 * When the address comes from a primecell it will be configured in runtime
75 * and we set the address to -1 as a placeholder.
76 */
77static const dma_addr_t dma40_tx_map[DB8500_DMA_NR_DEV] = {
78 /* MUSB - these will be runtime-reconfigured */
79 [DB8500_DMA_DEV39_USB_OTG_OEP_8] = -1,
80 [DB8500_DMA_DEV16_USB_OTG_OEP_7_15] = -1,
81 [DB8500_DMA_DEV17_USB_OTG_OEP_6_14] = -1,
82 [DB8500_DMA_DEV18_USB_OTG_OEP_5_13] = -1,
83 [DB8500_DMA_DEV19_USB_OTG_OEP_4_12] = -1,
84 [DB8500_DMA_DEV36_USB_OTG_OEP_3_11] = -1,
85 [DB8500_DMA_DEV37_USB_OTG_OEP_2_10] = -1,
86 [DB8500_DMA_DEV38_USB_OTG_OEP_1_9] = -1,
87 /* PrimeCells - run-time configured */
88 [DB8500_DMA_DEV0_SPI0_TX] = -1,
89 [DB8500_DMA_DEV1_SD_MMC0_TX] = -1,
90 [DB8500_DMA_DEV2_SD_MMC1_TX] = -1,
91 [DB8500_DMA_DEV3_SD_MMC2_TX] = -1,
92 [DB8500_DMA_DEV8_SSP0_TX] = -1,
93 [DB8500_DMA_DEV9_SSP1_TX] = -1,
94 [DB8500_DMA_DEV11_UART2_TX] = -1,
95 [DB8500_DMA_DEV12_UART1_TX] = -1,
96 [DB8500_DMA_DEV13_UART0_TX] = -1,
97 [DB8500_DMA_DEV28_SD_MM2_TX] = -1,
98 [DB8500_DMA_DEV29_SD_MM0_TX] = -1,
99 [DB8500_DMA_DEV32_SD_MM1_TX] = -1,
100 [DB8500_DMA_DEV33_SPI2_TX] = -1,
101 [DB8500_DMA_DEV35_SPI1_TX] = -1,
102 [DB8500_DMA_DEV40_SPI3_TX] = -1,
103 [DB8500_DMA_DEV41_SD_MM3_TX] = -1,
104 [DB8500_DMA_DEV42_SD_MM4_TX] = -1,
105 [DB8500_DMA_DEV43_SD_MM5_TX] = -1,
106 [DB8500_DMA_DEV14_MSP2_TX] = U8500_MSP2_BASE + MSP_TX_RX_REG_OFFSET,
107 [DB8500_DMA_DEV30_MSP1_TX] = U8500_MSP1_BASE + MSP_TX_RX_REG_OFFSET,
108 [DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX] = U8500_MSP0_BASE + MSP_TX_RX_REG_OFFSET,
109 [DB8500_DMA_DEV48_CAC1_TX] = U8500_CRYP1_BASE + CRYP1_TX_REG_OFFSET,
110 [DB8500_DMA_DEV50_HAC1_TX] = U8500_HASH1_BASE + HASH1_TX_REG_OFFSET,
111};
112
113/* Mapping between source event lines and physical device address */
114static const dma_addr_t dma40_rx_map[DB8500_DMA_NR_DEV] = {
115 /* MUSB - these will be runtime-reconfigured */
116 [DB8500_DMA_DEV39_USB_OTG_IEP_8] = -1,
117 [DB8500_DMA_DEV16_USB_OTG_IEP_7_15] = -1,
118 [DB8500_DMA_DEV17_USB_OTG_IEP_6_14] = -1,
119 [DB8500_DMA_DEV18_USB_OTG_IEP_5_13] = -1,
120 [DB8500_DMA_DEV19_USB_OTG_IEP_4_12] = -1,
121 [DB8500_DMA_DEV36_USB_OTG_IEP_3_11] = -1,
122 [DB8500_DMA_DEV37_USB_OTG_IEP_2_10] = -1,
123 [DB8500_DMA_DEV38_USB_OTG_IEP_1_9] = -1,
124 /* PrimeCells */
125 [DB8500_DMA_DEV0_SPI0_RX] = -1,
126 [DB8500_DMA_DEV1_SD_MMC0_RX] = -1,
127 [DB8500_DMA_DEV2_SD_MMC1_RX] = -1,
128 [DB8500_DMA_DEV3_SD_MMC2_RX] = -1,
129 [DB8500_DMA_DEV8_SSP0_RX] = -1,
130 [DB8500_DMA_DEV9_SSP1_RX] = -1,
131 [DB8500_DMA_DEV11_UART2_RX] = -1,
132 [DB8500_DMA_DEV12_UART1_RX] = -1,
133 [DB8500_DMA_DEV13_UART0_RX] = -1,
134 [DB8500_DMA_DEV28_SD_MM2_RX] = -1,
135 [DB8500_DMA_DEV29_SD_MM0_RX] = -1,
136 [DB8500_DMA_DEV32_SD_MM1_RX] = -1,
137 [DB8500_DMA_DEV33_SPI2_RX] = -1,
138 [DB8500_DMA_DEV35_SPI1_RX] = -1,
139 [DB8500_DMA_DEV40_SPI3_RX] = -1,
140 [DB8500_DMA_DEV41_SD_MM3_RX] = -1,
141 [DB8500_DMA_DEV42_SD_MM4_RX] = -1,
142 [DB8500_DMA_DEV43_SD_MM5_RX] = -1,
143 [DB8500_DMA_DEV14_MSP2_RX] = U8500_MSP2_BASE + MSP_TX_RX_REG_OFFSET,
144 [DB8500_DMA_DEV30_MSP3_RX] = U8500_MSP3_BASE + MSP_TX_RX_REG_OFFSET,
145 [DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX] = U8500_MSP0_BASE + MSP_TX_RX_REG_OFFSET,
146 [DB8500_DMA_DEV48_CAC1_RX] = U8500_CRYP1_BASE + CRYP1_RX_REG_OFFSET,
147};
148
149/* Reserved event lines for memcpy only */
150static int dma40_memcpy_event[] = {
151 DB8500_DMA_MEMCPY_TX_0,
152 DB8500_DMA_MEMCPY_TX_1,
153 DB8500_DMA_MEMCPY_TX_2,
154 DB8500_DMA_MEMCPY_TX_3,
155 DB8500_DMA_MEMCPY_TX_4,
156 DB8500_DMA_MEMCPY_TX_5,
157};
158
159static struct stedma40_platform_data dma40_plat_data = {
160 .dev_len = DB8500_DMA_NR_DEV,
161 .dev_rx = dma40_rx_map,
162 .dev_tx = dma40_tx_map,
163 .memcpy = dma40_memcpy_event,
164 .memcpy_len = ARRAY_SIZE(dma40_memcpy_event),
165 .memcpy_conf_phy = &dma40_memcpy_conf_phy,
166 .memcpy_conf_log = &dma40_memcpy_conf_log,
167 .disabled_channels = {-1}, 46 .disabled_channels = {-1},
168}; 47};
169 48
@@ -227,7 +106,7 @@ static struct resource db8500_prcmu_res[] = {
227 { 106 {
228 .name = "prcmu-tcpm", 107 .name = "prcmu-tcpm",
229 .start = U8500_PRCMU_TCPM_BASE, 108 .start = U8500_PRCMU_TCPM_BASE,
230 .end = U8500_PRCMU_TCPM_BASE + SZ_4K - 1, 109 .end = U8500_PRCMU_TCPM_BASE + SZ_32K - 1,
231 .flags = IORESOURCE_MEM, 110 .flags = IORESOURCE_MEM,
232 }, 111 },
233}; 112};
diff --git a/arch/arm/mach-ux500/id.c b/arch/arm/mach-ux500/id.c
index 0d33d1a06955..392f2fdb37d0 100644
--- a/arch/arm/mach-ux500/id.c
+++ b/arch/arm/mach-ux500/id.c
@@ -21,11 +21,11 @@
21 21
22struct dbx500_asic_id dbx500_id; 22struct dbx500_asic_id dbx500_id;
23 23
24static unsigned int ux500_read_asicid(phys_addr_t addr) 24static unsigned int __init ux500_read_asicid(phys_addr_t addr)
25{ 25{
26 phys_addr_t base = addr & ~0xfff; 26 phys_addr_t base = addr & ~0xfff;
27 struct map_desc desc = { 27 struct map_desc desc = {
28 .virtual = UX500_VIRT_ROM, 28 .virtual = (unsigned long)UX500_VIRT_ROM,
29 .pfn = __phys_to_pfn(base), 29 .pfn = __phys_to_pfn(base),
30 .length = SZ_16K, 30 .length = SZ_16K,
31 .type = MT_DEVICE, 31 .type = MT_DEVICE,
@@ -37,7 +37,7 @@ static unsigned int ux500_read_asicid(phys_addr_t addr)
37 local_flush_tlb_all(); 37 local_flush_tlb_all();
38 flush_cache_all(); 38 flush_cache_all();
39 39
40 return readl(IOMEM(UX500_VIRT_ROM + (addr & 0xfff))); 40 return readl(UX500_VIRT_ROM + (addr & 0xfff));
41} 41}
42 42
43static void ux500_print_soc_info(unsigned int asicid) 43static void ux500_print_soc_info(unsigned int asicid)
diff --git a/arch/arm/mach-ux500/ste-dma40-db8500.h b/arch/arm/mach-ux500/ste-dma40-db8500.h
index a616419bea76..0296ae5b0fd9 100644
--- a/arch/arm/mach-ux500/ste-dma40-db8500.h
+++ b/arch/arm/mach-ux500/ste-dma40-db8500.h
@@ -12,133 +12,74 @@
12 12
13#define DB8500_DMA_NR_DEV 64 13#define DB8500_DMA_NR_DEV 64
14 14
15enum dma_src_dev_type { 15/*
16 DB8500_DMA_DEV0_SPI0_RX = 0, 16 * Unless otherwise specified, all channels numbers are used for
17 DB8500_DMA_DEV1_SD_MMC0_RX = 1, 17 * TX & RX, and can be used for either source or destination
18 DB8500_DMA_DEV2_SD_MMC1_RX = 2, 18 * channels.
19 DB8500_DMA_DEV3_SD_MMC2_RX = 3, 19 */
20 DB8500_DMA_DEV4_I2C1_RX = 4, 20enum dma_dev_type {
21 DB8500_DMA_DEV5_I2C3_RX = 5, 21 DB8500_DMA_DEV0_SPI0 = 0,
22 DB8500_DMA_DEV6_I2C2_RX = 6, 22 DB8500_DMA_DEV1_SD_MMC0 = 1,
23 DB8500_DMA_DEV7_I2C4_RX = 7, /* Only on V1 and later */ 23 DB8500_DMA_DEV2_SD_MMC1 = 2,
24 DB8500_DMA_DEV8_SSP0_RX = 8, 24 DB8500_DMA_DEV3_SD_MMC2 = 3,
25 DB8500_DMA_DEV9_SSP1_RX = 9, 25 DB8500_DMA_DEV4_I2C1 = 4,
26 DB8500_DMA_DEV10_MCDE_RX = 10, 26 DB8500_DMA_DEV5_I2C3 = 5,
27 DB8500_DMA_DEV11_UART2_RX = 11, 27 DB8500_DMA_DEV6_I2C2 = 6,
28 DB8500_DMA_DEV12_UART1_RX = 12, 28 DB8500_DMA_DEV7_I2C4 = 7, /* Only on V1 and later */
29 DB8500_DMA_DEV13_UART0_RX = 13, 29 DB8500_DMA_DEV8_SSP0 = 8,
30 DB8500_DMA_DEV14_MSP2_RX = 14, 30 DB8500_DMA_DEV9_SSP1 = 9,
31 DB8500_DMA_DEV15_I2C0_RX = 15, 31 DB8500_DMA_DEV10_MCDE_RX = 10, /* RX only */
32 DB8500_DMA_DEV16_USB_OTG_IEP_7_15 = 16, 32 DB8500_DMA_DEV11_UART2 = 11,
33 DB8500_DMA_DEV17_USB_OTG_IEP_6_14 = 17, 33 DB8500_DMA_DEV12_UART1 = 12,
34 DB8500_DMA_DEV18_USB_OTG_IEP_5_13 = 18, 34 DB8500_DMA_DEV13_UART0 = 13,
35 DB8500_DMA_DEV19_USB_OTG_IEP_4_12 = 19, 35 DB8500_DMA_DEV14_MSP2 = 14,
36 DB8500_DMA_DEV20_SLIM0_CH0_RX_HSI_RX_CH0 = 20, 36 DB8500_DMA_DEV15_I2C0 = 15,
37 DB8500_DMA_DEV21_SLIM0_CH1_RX_HSI_RX_CH1 = 21, 37 DB8500_DMA_DEV16_USB_OTG_IEP_AND_OEP_7_15 = 16,
38 DB8500_DMA_DEV22_SLIM0_CH2_RX_HSI_RX_CH2 = 22, 38 DB8500_DMA_DEV17_USB_OTG_IEP_AND_OEP_6_14 = 17,
39 DB8500_DMA_DEV23_SLIM0_CH3_RX_HSI_RX_CH3 = 23, 39 DB8500_DMA_DEV18_USB_OTG_IEP_AND_OEP_5_13 = 18,
40 DB8500_DMA_DEV24_SRC_SXA0_RX_TX = 24, 40 DB8500_DMA_DEV19_USB_OTG_IEP_AND_OEP_4_12 = 19,
41 DB8500_DMA_DEV25_SRC_SXA1_RX_TX = 25, 41 DB8500_DMA_DEV20_SLIM0_CH0_HSI_CH0 = 20,
42 DB8500_DMA_DEV26_SRC_SXA2_RX_TX = 26, 42 DB8500_DMA_DEV21_SLIM0_CH1_HSI_CH1 = 21,
43 DB8500_DMA_DEV27_SRC_SXA3_RX_TX = 27, 43 DB8500_DMA_DEV22_SLIM0_CH2_HSI_CH2 = 22,
44 DB8500_DMA_DEV28_SD_MM2_RX = 28, 44 DB8500_DMA_DEV23_SLIM0_CH3_HSI_CH3 = 23,
45 DB8500_DMA_DEV29_SD_MM0_RX = 29, 45 DB8500_DMA_DEV24_SXA0 = 24,
46 DB8500_DMA_DEV30_MSP1_RX = 30, 46 DB8500_DMA_DEV25_SXA1 = 25,
47 DB8500_DMA_DEV26_SXA2 = 26,
48 DB8500_DMA_DEV27_SXA3 = 27,
49 DB8500_DMA_DEV28_SD_MM2 = 28,
50 DB8500_DMA_DEV29_SD_MM0 = 29,
51 DB8500_DMA_DEV30_MSP1 = 30,
47 /* On DB8500v2, MSP3 RX replaces MSP1 RX */ 52 /* On DB8500v2, MSP3 RX replaces MSP1 RX */
48 DB8500_DMA_DEV30_MSP3_RX = 30, 53 DB8500_DMA_DEV30_MSP3 = 30,
49 DB8500_DMA_DEV31_MSP0_RX_SLIM0_CH0_RX = 31, 54 DB8500_DMA_DEV31_MSP0_SLIM0_CH0 = 31,
50 DB8500_DMA_DEV32_SD_MM1_RX = 32, 55 DB8500_DMA_DEV32_SD_MM1 = 32,
51 DB8500_DMA_DEV33_SPI2_RX = 33, 56 DB8500_DMA_DEV33_SPI2 = 33,
52 DB8500_DMA_DEV34_I2C3_RX2 = 34, 57 DB8500_DMA_DEV34_I2C3_RX2_TX2 = 34,
53 DB8500_DMA_DEV35_SPI1_RX = 35, 58 DB8500_DMA_DEV35_SPI1 = 35,
54 DB8500_DMA_DEV36_USB_OTG_IEP_3_11 = 36, 59 DB8500_DMA_DEV36_USB_OTG_IEP_AND_OEP_3_11 = 36,
55 DB8500_DMA_DEV37_USB_OTG_IEP_2_10 = 37, 60 DB8500_DMA_DEV37_USB_OTG_IEP_AND_OEP_2_10 = 37,
56 DB8500_DMA_DEV38_USB_OTG_IEP_1_9 = 38, 61 DB8500_DMA_DEV38_USB_OTG_IEP_AND_OEP_1_9 = 38,
57 DB8500_DMA_DEV39_USB_OTG_IEP_8 = 39, 62 DB8500_DMA_DEV39_USB_OTG_IEP_AND_OEP_8 = 39,
58 DB8500_DMA_DEV40_SPI3_RX = 40, 63 DB8500_DMA_DEV40_SPI3 = 40,
59 DB8500_DMA_DEV41_SD_MM3_RX = 41, 64 DB8500_DMA_DEV41_SD_MM3 = 41,
60 DB8500_DMA_DEV42_SD_MM4_RX = 42, 65 DB8500_DMA_DEV42_SD_MM4 = 42,
61 DB8500_DMA_DEV43_SD_MM5_RX = 43, 66 DB8500_DMA_DEV43_SD_MM5 = 43,
62 DB8500_DMA_DEV44_SRC_SXA4_RX_TX = 44, 67 DB8500_DMA_DEV44_SXA4 = 44,
63 DB8500_DMA_DEV45_SRC_SXA5_RX_TX = 45, 68 DB8500_DMA_DEV45_SXA5 = 45,
64 DB8500_DMA_DEV46_SLIM0_CH8_RX_SRC_SXA6_RX_TX = 46, 69 DB8500_DMA_DEV46_SLIM0_CH8_SRC_SXA6 = 46,
65 DB8500_DMA_DEV47_SLIM0_CH9_RX_SRC_SXA7_RX_TX = 47, 70 DB8500_DMA_DEV47_SLIM0_CH9_SRC_SXA7 = 47,
66 DB8500_DMA_DEV48_CAC1_RX = 48, 71 DB8500_DMA_DEV48_CAC1 = 48,
67 /* 49, 50 and 51 are not used */ 72 DB8500_DMA_DEV49_CAC1_TX_HAC1_TX = 49, /* TX only */
68 DB8500_DMA_DEV52_SLIM0_CH4_RX_HSI_RX_CH4 = 52, 73 DB8500_DMA_DEV50_HAC1_TX = 50, /* TX only */
69 DB8500_DMA_DEV53_SLIM0_CH5_RX_HSI_RX_CH5 = 53, 74 DB8500_DMA_MEMCPY_TX_0 = 51, /* TX only */
70 DB8500_DMA_DEV54_SLIM0_CH6_RX_HSI_RX_CH6 = 54, 75 DB8500_DMA_DEV52_SLIM0_CH4_HSI_CH4 = 52,
71 DB8500_DMA_DEV55_SLIM0_CH7_RX_HSI_RX_CH7 = 55, 76 DB8500_DMA_DEV53_SLIM0_CH5_HSI_CH5 = 53,
72 /* 56, 57, 58, 59 and 60 are not used */ 77 DB8500_DMA_DEV54_SLIM0_CH6_HSI_CH6 = 54,
73 DB8500_DMA_DEV61_CAC0_RX = 61, 78 DB8500_DMA_DEV55_SLIM0_CH7_HSI_CH7 = 55,
74 /* 62 and 63 are not used */ 79 /* 56 -> 60 are channels reserved for memcpy only */
75}; 80 DB8500_DMA_DEV61_CAC0 = 61,
76 81 DB8500_DMA_DEV62_CAC0_TX_HAC0_TX = 62, /* TX only */
77enum dma_dest_dev_type { 82 DB8500_DMA_DEV63_HAC0_TX = 63, /* TX only */
78 DB8500_DMA_DEV0_SPI0_TX = 0,
79 DB8500_DMA_DEV1_SD_MMC0_TX = 1,
80 DB8500_DMA_DEV2_SD_MMC1_TX = 2,
81 DB8500_DMA_DEV3_SD_MMC2_TX = 3,
82 DB8500_DMA_DEV4_I2C1_TX = 4,
83 DB8500_DMA_DEV5_I2C3_TX = 5,
84 DB8500_DMA_DEV6_I2C2_TX = 6,
85 DB8500_DMA_DEV7_I2C4_TX = 7, /* Only on V1 and later */
86 DB8500_DMA_DEV8_SSP0_TX = 8,
87 DB8500_DMA_DEV9_SSP1_TX = 9,
88 /* 10 is not used*/
89 DB8500_DMA_DEV11_UART2_TX = 11,
90 DB8500_DMA_DEV12_UART1_TX = 12,
91 DB8500_DMA_DEV13_UART0_TX = 13,
92 DB8500_DMA_DEV14_MSP2_TX = 14,
93 DB8500_DMA_DEV15_I2C0_TX = 15,
94 DB8500_DMA_DEV16_USB_OTG_OEP_7_15 = 16,
95 DB8500_DMA_DEV17_USB_OTG_OEP_6_14 = 17,
96 DB8500_DMA_DEV18_USB_OTG_OEP_5_13 = 18,
97 DB8500_DMA_DEV19_USB_OTG_OEP_4_12 = 19,
98 DB8500_DMA_DEV20_SLIM0_CH0_TX_HSI_TX_CH0 = 20,
99 DB8500_DMA_DEV21_SLIM0_CH1_TX_HSI_TX_CH1 = 21,
100 DB8500_DMA_DEV22_SLIM0_CH2_TX_HSI_TX_CH2 = 22,
101 DB8500_DMA_DEV23_SLIM0_CH3_TX_HSI_TX_CH3 = 23,
102 DB8500_DMA_DEV24_DST_SXA0_RX_TX = 24,
103 DB8500_DMA_DEV25_DST_SXA1_RX_TX = 25,
104 DB8500_DMA_DEV26_DST_SXA2_RX_TX = 26,
105 DB8500_DMA_DEV27_DST_SXA3_RX_TX = 27,
106 DB8500_DMA_DEV28_SD_MM2_TX = 28,
107 DB8500_DMA_DEV29_SD_MM0_TX = 29,
108 DB8500_DMA_DEV30_MSP1_TX = 30,
109 DB8500_DMA_DEV31_MSP0_TX_SLIM0_CH0_TX = 31,
110 DB8500_DMA_DEV32_SD_MM1_TX = 32,
111 DB8500_DMA_DEV33_SPI2_TX = 33,
112 DB8500_DMA_DEV34_I2C3_TX2 = 34,
113 DB8500_DMA_DEV35_SPI1_TX = 35,
114 DB8500_DMA_DEV36_USB_OTG_OEP_3_11 = 36,
115 DB8500_DMA_DEV37_USB_OTG_OEP_2_10 = 37,
116 DB8500_DMA_DEV38_USB_OTG_OEP_1_9 = 38,
117 DB8500_DMA_DEV39_USB_OTG_OEP_8 = 39,
118 DB8500_DMA_DEV40_SPI3_TX = 40,
119 DB8500_DMA_DEV41_SD_MM3_TX = 41,
120 DB8500_DMA_DEV42_SD_MM4_TX = 42,
121 DB8500_DMA_DEV43_SD_MM5_TX = 43,
122 DB8500_DMA_DEV44_DST_SXA4_RX_TX = 44,
123 DB8500_DMA_DEV45_DST_SXA5_RX_TX = 45,
124 DB8500_DMA_DEV46_SLIM0_CH8_TX_DST_SXA6_RX_TX = 46,
125 DB8500_DMA_DEV47_SLIM0_CH9_TX_DST_SXA7_RX_TX = 47,
126 DB8500_DMA_DEV48_CAC1_TX = 48,
127 DB8500_DMA_DEV49_CAC1_TX_HAC1_TX = 49,
128 DB8500_DMA_DEV50_HAC1_TX = 50,
129 DB8500_DMA_MEMCPY_TX_0 = 51,
130 DB8500_DMA_DEV52_SLIM1_CH4_TX_HSI_TX_CH4 = 52,
131 DB8500_DMA_DEV53_SLIM1_CH5_TX_HSI_TX_CH5 = 53,
132 DB8500_DMA_DEV54_SLIM1_CH6_TX_HSI_TX_CH6 = 54,
133 DB8500_DMA_DEV55_SLIM1_CH7_TX_HSI_TX_CH7 = 55,
134 DB8500_DMA_MEMCPY_TX_1 = 56,
135 DB8500_DMA_MEMCPY_TX_2 = 57,
136 DB8500_DMA_MEMCPY_TX_3 = 58,
137 DB8500_DMA_MEMCPY_TX_4 = 59,
138 DB8500_DMA_MEMCPY_TX_5 = 60,
139 DB8500_DMA_DEV61_CAC0_TX = 61,
140 DB8500_DMA_DEV62_CAC0_TX_HAC0_TX = 62,
141 DB8500_DMA_DEV63_HAC0_TX = 63,
142}; 83};
143 84
144#endif 85#endif
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 2dfc72f7cd8a..b7bd8d3a5507 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -14,25 +14,15 @@
14 14
15#define MUSB_DMA40_RX_CH { \ 15#define MUSB_DMA40_RX_CH { \
16 .mode = STEDMA40_MODE_LOGICAL, \ 16 .mode = STEDMA40_MODE_LOGICAL, \
17 .dir = STEDMA40_PERIPH_TO_MEM, \ 17 .dir = DMA_DEV_TO_MEM, \
18 .dst_dev_type = STEDMA40_DEV_DST_MEMORY, \
19 .src_info.data_width = STEDMA40_WORD_WIDTH, \
20 .dst_info.data_width = STEDMA40_WORD_WIDTH, \
21 .src_info.psize = STEDMA40_PSIZE_LOG_16, \
22 .dst_info.psize = STEDMA40_PSIZE_LOG_16, \
23 } 18 }
24 19
25#define MUSB_DMA40_TX_CH { \ 20#define MUSB_DMA40_TX_CH { \
26 .mode = STEDMA40_MODE_LOGICAL, \ 21 .mode = STEDMA40_MODE_LOGICAL, \
27 .dir = STEDMA40_MEM_TO_PERIPH, \ 22 .dir = DMA_MEM_TO_DEV, \
28 .src_dev_type = STEDMA40_DEV_SRC_MEMORY, \
29 .src_info.data_width = STEDMA40_WORD_WIDTH, \
30 .dst_info.data_width = STEDMA40_WORD_WIDTH, \
31 .src_info.psize = STEDMA40_PSIZE_LOG_16, \
32 .dst_info.psize = STEDMA40_PSIZE_LOG_16, \
33 } 23 }
34 24
35static struct stedma40_chan_cfg musb_dma_rx_ch[UX500_MUSB_DMA_NUM_RX_CHANNELS] 25static struct stedma40_chan_cfg musb_dma_rx_ch[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS]
36 = { 26 = {
37 MUSB_DMA40_RX_CH, 27 MUSB_DMA40_RX_CH,
38 MUSB_DMA40_RX_CH, 28 MUSB_DMA40_RX_CH,
@@ -44,7 +34,7 @@ static struct stedma40_chan_cfg musb_dma_rx_ch[UX500_MUSB_DMA_NUM_RX_CHANNELS]
44 MUSB_DMA40_RX_CH 34 MUSB_DMA40_RX_CH
45}; 35};
46 36
47static struct stedma40_chan_cfg musb_dma_tx_ch[UX500_MUSB_DMA_NUM_TX_CHANNELS] 37static struct stedma40_chan_cfg musb_dma_tx_ch[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS]
48 = { 38 = {
49 MUSB_DMA40_TX_CH, 39 MUSB_DMA40_TX_CH,
50 MUSB_DMA40_TX_CH, 40 MUSB_DMA40_TX_CH,
@@ -56,7 +46,7 @@ static struct stedma40_chan_cfg musb_dma_tx_ch[UX500_MUSB_DMA_NUM_TX_CHANNELS]
56 MUSB_DMA40_TX_CH, 46 MUSB_DMA40_TX_CH,
57}; 47};
58 48
59static void *ux500_dma_rx_param_array[UX500_MUSB_DMA_NUM_RX_CHANNELS] = { 49static void *ux500_dma_rx_param_array[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS] = {
60 &musb_dma_rx_ch[0], 50 &musb_dma_rx_ch[0],
61 &musb_dma_rx_ch[1], 51 &musb_dma_rx_ch[1],
62 &musb_dma_rx_ch[2], 52 &musb_dma_rx_ch[2],
@@ -67,7 +57,7 @@ static void *ux500_dma_rx_param_array[UX500_MUSB_DMA_NUM_RX_CHANNELS] = {
67 &musb_dma_rx_ch[7] 57 &musb_dma_rx_ch[7]
68}; 58};
69 59
70static void *ux500_dma_tx_param_array[UX500_MUSB_DMA_NUM_TX_CHANNELS] = { 60static void *ux500_dma_tx_param_array[UX500_MUSB_DMA_NUM_RX_TX_CHANNELS] = {
71 &musb_dma_tx_ch[0], 61 &musb_dma_tx_ch[0],
72 &musb_dma_tx_ch[1], 62 &musb_dma_tx_ch[1],
73 &musb_dma_tx_ch[2], 63 &musb_dma_tx_ch[2],
@@ -81,23 +71,11 @@ static void *ux500_dma_tx_param_array[UX500_MUSB_DMA_NUM_TX_CHANNELS] = {
81static struct ux500_musb_board_data musb_board_data = { 71static struct ux500_musb_board_data musb_board_data = {
82 .dma_rx_param_array = ux500_dma_rx_param_array, 72 .dma_rx_param_array = ux500_dma_rx_param_array,
83 .dma_tx_param_array = ux500_dma_tx_param_array, 73 .dma_tx_param_array = ux500_dma_tx_param_array,
84 .num_rx_channels = UX500_MUSB_DMA_NUM_RX_CHANNELS,
85 .num_tx_channels = UX500_MUSB_DMA_NUM_TX_CHANNELS,
86 .dma_filter = stedma40_filter, 74 .dma_filter = stedma40_filter,
87}; 75};
88 76
89static u64 ux500_musb_dmamask = DMA_BIT_MASK(32);
90
91static struct musb_hdrc_config musb_hdrc_config = {
92 .multipoint = true,
93 .dyn_fifo = true,
94 .num_eps = 16,
95 .ram_bits = 16,
96};
97
98static struct musb_hdrc_platform_data musb_platform_data = { 77static struct musb_hdrc_platform_data musb_platform_data = {
99 .mode = MUSB_OTG, 78 .mode = MUSB_OTG,
100 .config = &musb_hdrc_config,
101 .board_data = &musb_board_data, 79 .board_data = &musb_board_data,
102}; 80};
103 81
@@ -118,27 +96,26 @@ struct platform_device ux500_musb_device = {
118 .id = 0, 96 .id = 0,
119 .dev = { 97 .dev = {
120 .platform_data = &musb_platform_data, 98 .platform_data = &musb_platform_data,
121 .dma_mask = &ux500_musb_dmamask,
122 .coherent_dma_mask = DMA_BIT_MASK(32), 99 .coherent_dma_mask = DMA_BIT_MASK(32),
123 }, 100 },
124 .num_resources = ARRAY_SIZE(usb_resources), 101 .num_resources = ARRAY_SIZE(usb_resources),
125 .resource = usb_resources, 102 .resource = usb_resources,
126}; 103};
127 104
128static inline void ux500_usb_dma_update_rx_ch_config(int *src_dev_type) 105static inline void ux500_usb_dma_update_rx_ch_config(int *dev_type)
129{ 106{
130 u32 idx; 107 u32 idx;
131 108
132 for (idx = 0; idx < UX500_MUSB_DMA_NUM_RX_CHANNELS; idx++) 109 for (idx = 0; idx < UX500_MUSB_DMA_NUM_RX_TX_CHANNELS; idx++)
133 musb_dma_rx_ch[idx].src_dev_type = src_dev_type[idx]; 110 musb_dma_rx_ch[idx].dev_type = dev_type[idx];
134} 111}
135 112
136static inline void ux500_usb_dma_update_tx_ch_config(int *dst_dev_type) 113static inline void ux500_usb_dma_update_tx_ch_config(int *dev_type)
137{ 114{
138 u32 idx; 115 u32 idx;
139 116
140 for (idx = 0; idx < UX500_MUSB_DMA_NUM_TX_CHANNELS; idx++) 117 for (idx = 0; idx < UX500_MUSB_DMA_NUM_RX_TX_CHANNELS; idx++)
141 musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx]; 118 musb_dma_tx_ch[idx].dev_type = dev_type[idx];
142} 119}
143 120
144void ux500_add_usb(struct device *parent, resource_size_t base, int irq, 121void ux500_add_usb(struct device *parent, resource_size_t base, int irq,
diff --git a/arch/arm/mach-vexpress/Kconfig b/arch/arm/mach-vexpress/Kconfig
index 5907e10c37fd..b8bbabec6310 100644
--- a/arch/arm/mach-vexpress/Kconfig
+++ b/arch/arm/mach-vexpress/Kconfig
@@ -57,4 +57,13 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
57config ARCH_VEXPRESS_CA9X4 57config ARCH_VEXPRESS_CA9X4
58 bool "Versatile Express Cortex-A9x4 tile" 58 bool "Versatile Express Cortex-A9x4 tile"
59 59
60config ARCH_VEXPRESS_DCSCB
61 bool "Dual Cluster System Control Block (DCSCB) support"
62 depends on MCPM
63 select ARM_CCI
64 help
65 Support for the Dual Cluster System Configuration Block (DCSCB).
66 This is needed to provide CPU and cluster power management
67 on RTSM implementing big.LITTLE.
68
60endmenu 69endmenu
diff --git a/arch/arm/mach-vexpress/Makefile b/arch/arm/mach-vexpress/Makefile
index 42703e8b4d3b..48ba89a8149f 100644
--- a/arch/arm/mach-vexpress/Makefile
+++ b/arch/arm/mach-vexpress/Makefile
@@ -6,5 +6,6 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
6 6
7obj-y := v2m.o 7obj-y := v2m.o
8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o 8obj-$(CONFIG_ARCH_VEXPRESS_CA9X4) += ct-ca9x4.o
9obj-$(CONFIG_ARCH_VEXPRESS_DCSCB) += dcscb.o dcscb_setup.o
9obj-$(CONFIG_SMP) += platsmp.o 10obj-$(CONFIG_SMP) += platsmp.o
10obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 11obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
diff --git a/arch/arm/mach-vexpress/core.h b/arch/arm/mach-vexpress/core.h
index f134cd4a85f1..bde4374ab6d5 100644
--- a/arch/arm/mach-vexpress/core.h
+++ b/arch/arm/mach-vexpress/core.h
@@ -6,6 +6,8 @@
6 6
7void vexpress_dt_smp_map_io(void); 7void vexpress_dt_smp_map_io(void);
8 8
9bool vexpress_smp_init_ops(void);
10
9extern struct smp_operations vexpress_smp_ops; 11extern struct smp_operations vexpress_smp_ops;
10 12
11extern void vexpress_cpu_die(unsigned int cpu); 13extern void vexpress_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c
new file mode 100644
index 000000000000..16d57a8a9d5a
--- /dev/null
+++ b/arch/arm/mach-vexpress/dcscb.c
@@ -0,0 +1,253 @@
1/*
2 * arch/arm/mach-vexpress/dcscb.c - Dual Cluster System Configuration Block
3 *
4 * Created by: Nicolas Pitre, May 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/io.h>
15#include <linux/spinlock.h>
16#include <linux/errno.h>
17#include <linux/of_address.h>
18#include <linux/vexpress.h>
19#include <linux/arm-cci.h>
20
21#include <asm/mcpm.h>
22#include <asm/proc-fns.h>
23#include <asm/cacheflush.h>
24#include <asm/cputype.h>
25#include <asm/cp15.h>
26
27
28#define RST_HOLD0 0x0
29#define RST_HOLD1 0x4
30#define SYS_SWRESET 0x8
31#define RST_STAT0 0xc
32#define RST_STAT1 0x10
33#define EAG_CFG_R 0x20
34#define EAG_CFG_W 0x24
35#define KFC_CFG_R 0x28
36#define KFC_CFG_W 0x2c
37#define DCS_CFG_R 0x30
38
39/*
40 * We can't use regular spinlocks. In the switcher case, it is possible
41 * for an outbound CPU to call power_down() while its inbound counterpart
42 * is already live using the same logical CPU number which trips lockdep
43 * debugging.
44 */
45static arch_spinlock_t dcscb_lock = __ARCH_SPIN_LOCK_UNLOCKED;
46
47static void __iomem *dcscb_base;
48static int dcscb_use_count[4][2];
49static int dcscb_allcpus_mask[2];
50
51static int dcscb_power_up(unsigned int cpu, unsigned int cluster)
52{
53 unsigned int rst_hold, cpumask = (1 << cpu);
54 unsigned int all_mask = dcscb_allcpus_mask[cluster];
55
56 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
57 if (cpu >= 4 || cluster >= 2)
58 return -EINVAL;
59
60 /*
61 * Since this is called with IRQs enabled, and no arch_spin_lock_irq
62 * variant exists, we need to disable IRQs manually here.
63 */
64 local_irq_disable();
65 arch_spin_lock(&dcscb_lock);
66
67 dcscb_use_count[cpu][cluster]++;
68 if (dcscb_use_count[cpu][cluster] == 1) {
69 rst_hold = readl_relaxed(dcscb_base + RST_HOLD0 + cluster * 4);
70 if (rst_hold & (1 << 8)) {
71 /* remove cluster reset and add individual CPU's reset */
72 rst_hold &= ~(1 << 8);
73 rst_hold |= all_mask;
74 }
75 rst_hold &= ~(cpumask | (cpumask << 4));
76 writel_relaxed(rst_hold, dcscb_base + RST_HOLD0 + cluster * 4);
77 } else if (dcscb_use_count[cpu][cluster] != 2) {
78 /*
79 * The only possible values are:
80 * 0 = CPU down
81 * 1 = CPU (still) up
82 * 2 = CPU requested to be up before it had a chance
83 * to actually make itself down.
84 * Any other value is a bug.
85 */
86 BUG();
87 }
88
89 arch_spin_unlock(&dcscb_lock);
90 local_irq_enable();
91
92 return 0;
93}
94
95static void dcscb_power_down(void)
96{
97 unsigned int mpidr, cpu, cluster, rst_hold, cpumask, all_mask;
98 bool last_man = false, skip_wfi = false;
99
100 mpidr = read_cpuid_mpidr();
101 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
102 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
103 cpumask = (1 << cpu);
104 all_mask = dcscb_allcpus_mask[cluster];
105
106 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
107 BUG_ON(cpu >= 4 || cluster >= 2);
108
109 __mcpm_cpu_going_down(cpu, cluster);
110
111 arch_spin_lock(&dcscb_lock);
112 BUG_ON(__mcpm_cluster_state(cluster) != CLUSTER_UP);
113 dcscb_use_count[cpu][cluster]--;
114 if (dcscb_use_count[cpu][cluster] == 0) {
115 rst_hold = readl_relaxed(dcscb_base + RST_HOLD0 + cluster * 4);
116 rst_hold |= cpumask;
117 if (((rst_hold | (rst_hold >> 4)) & all_mask) == all_mask) {
118 rst_hold |= (1 << 8);
119 last_man = true;
120 }
121 writel_relaxed(rst_hold, dcscb_base + RST_HOLD0 + cluster * 4);
122 } else if (dcscb_use_count[cpu][cluster] == 1) {
123 /*
124 * A power_up request went ahead of us.
125 * Even if we do not want to shut this CPU down,
126 * the caller expects a certain state as if the WFI
127 * was aborted. So let's continue with cache cleaning.
128 */
129 skip_wfi = true;
130 } else
131 BUG();
132
133 if (last_man && __mcpm_outbound_enter_critical(cpu, cluster)) {
134 arch_spin_unlock(&dcscb_lock);
135
136 /*
137 * Flush all cache levels for this cluster.
138 *
139 * A15/A7 can hit in the cache with SCTLR.C=0, so we don't need
140 * a preliminary flush here for those CPUs. At least, that's
141 * the theory -- without the extra flush, Linux explodes on
142 * RTSM (to be investigated).
143 */
144 flush_cache_all();
145 set_cr(get_cr() & ~CR_C);
146 flush_cache_all();
147
148 /*
149 * This is a harmless no-op. On platforms with a real
150 * outer cache this might either be needed or not,
151 * depending on where the outer cache sits.
152 */
153 outer_flush_all();
154
155 /* Disable local coherency by clearing the ACTLR "SMP" bit: */
156 set_auxcr(get_auxcr() & ~(1 << 6));
157
158 /*
159 * Disable cluster-level coherency by masking
160 * incoming snoops and DVM messages:
161 */
162 cci_disable_port_by_cpu(mpidr);
163
164 __mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
165 } else {
166 arch_spin_unlock(&dcscb_lock);
167
168 /*
169 * Flush the local CPU cache.
170 *
171 * A15/A7 can hit in the cache with SCTLR.C=0, so we don't need
172 * a preliminary flush here for those CPUs. At least, that's
173 * the theory -- without the extra flush, Linux explodes on
174 * RTSM (to be investigated).
175 */
176 flush_cache_louis();
177 set_cr(get_cr() & ~CR_C);
178 flush_cache_louis();
179
180 /* Disable local coherency by clearing the ACTLR "SMP" bit: */
181 set_auxcr(get_auxcr() & ~(1 << 6));
182 }
183
184 __mcpm_cpu_down(cpu, cluster);
185
186 /* Now we are prepared for power-down, do it: */
187 dsb();
188 if (!skip_wfi)
189 wfi();
190
191 /* Not dead at this point? Let our caller cope. */
192}
193
194static const struct mcpm_platform_ops dcscb_power_ops = {
195 .power_up = dcscb_power_up,
196 .power_down = dcscb_power_down,
197};
198
199static void __init dcscb_usage_count_init(void)
200{
201 unsigned int mpidr, cpu, cluster;
202
203 mpidr = read_cpuid_mpidr();
204 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
205 cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
206
207 pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
208 BUG_ON(cpu >= 4 || cluster >= 2);
209 dcscb_use_count[cpu][cluster] = 1;
210}
211
212extern void dcscb_power_up_setup(unsigned int affinity_level);
213
214static int __init dcscb_init(void)
215{
216 struct device_node *node;
217 unsigned int cfg;
218 int ret;
219
220 if (!cci_probed())
221 return -ENODEV;
222
223 node = of_find_compatible_node(NULL, NULL, "arm,rtsm,dcscb");
224 if (!node)
225 return -ENODEV;
226 dcscb_base = of_iomap(node, 0);
227 if (!dcscb_base)
228 return -EADDRNOTAVAIL;
229 cfg = readl_relaxed(dcscb_base + DCS_CFG_R);
230 dcscb_allcpus_mask[0] = (1 << (((cfg >> 16) >> (0 << 2)) & 0xf)) - 1;
231 dcscb_allcpus_mask[1] = (1 << (((cfg >> 16) >> (1 << 2)) & 0xf)) - 1;
232 dcscb_usage_count_init();
233
234 ret = mcpm_platform_register(&dcscb_power_ops);
235 if (!ret)
236 ret = mcpm_sync_init(dcscb_power_up_setup);
237 if (ret) {
238 iounmap(dcscb_base);
239 return ret;
240 }
241
242 pr_info("VExpress DCSCB support installed\n");
243
244 /*
245 * Future entries into the kernel can now go
246 * through the cluster entry vectors.
247 */
248 vexpress_flags_set(virt_to_phys(mcpm_entry_point));
249
250 return 0;
251}
252
253early_initcall(dcscb_init);
diff --git a/arch/arm/mach-vexpress/dcscb_setup.S b/arch/arm/mach-vexpress/dcscb_setup.S
new file mode 100644
index 000000000000..4bb7fbe0f621
--- /dev/null
+++ b/arch/arm/mach-vexpress/dcscb_setup.S
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/include/asm/dcscb_setup.S
3 *
4 * Created by: Dave Martin, 2012-06-22
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/linkage.h>
13
14
15ENTRY(dcscb_power_up_setup)
16
17 cmp r0, #0 @ check affinity level
18 beq 2f
19
20/*
21 * Enable cluster-level coherency, in preparation for turning on the MMU.
22 * The ACTLR SMP bit does not need to be set here, because cpu_resume()
23 * already restores that.
24 *
25 * A15/A7 may not require explicit L2 invalidation on reset, dependent
26 * on hardware integration decisions.
27 * For now, this code assumes that L2 is either already invalidated,
28 * or invalidation is not required.
29 */
30
31 b cci_enable_port_for_self
32
332: @ Implementation-specific local CPU setup operations should go here,
34 @ if any. In this case, there is nothing to do.
35
36 bx lr
37
38ENDPROC(dcscb_power_up_setup)
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index dc1ace55d557..993c9ae5dc5e 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -12,9 +12,11 @@
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of.h>
15#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
16#include <linux/vexpress.h> 17#include <linux/vexpress.h>
17 18
19#include <asm/mcpm.h>
18#include <asm/smp_scu.h> 20#include <asm/smp_scu.h>
19#include <asm/mach/map.h> 21#include <asm/mach/map.h>
20 22
@@ -203,3 +205,21 @@ struct smp_operations __initdata vexpress_smp_ops = {
203 .cpu_die = vexpress_cpu_die, 205 .cpu_die = vexpress_cpu_die,
204#endif 206#endif
205}; 207};
208
209bool __init vexpress_smp_init_ops(void)
210{
211#ifdef CONFIG_MCPM
212 /*
213 * The best way to detect a multi-cluster configuration at the moment
214 * is to look for the presence of a CCI in the system.
215 * Override the default vexpress_smp_ops if so.
216 */
217 struct device_node *node;
218 node = of_find_compatible_node(NULL, NULL, "arm,cci-400");
219 if (node && of_device_is_available(node)) {
220 mcpm_smp_set_ops();
221 return true;
222 }
223#endif
224 return false;
225}
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 8802030df98d..95a469e23e37 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -9,7 +9,6 @@
9#include <linux/clocksource.h> 9#include <linux/clocksource.h>
10#include <linux/smp.h> 10#include <linux/smp.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/irqchip.h>
13#include <linux/of_address.h> 12#include <linux/of_address.h>
14#include <linux/of_fdt.h> 13#include <linux/of_fdt.h>
15#include <linux/of_irq.h> 14#include <linux/of_irq.h>
@@ -456,9 +455,9 @@ static const char * const v2m_dt_match[] __initconst = {
456DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") 455DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express")
457 .dt_compat = v2m_dt_match, 456 .dt_compat = v2m_dt_match,
458 .smp = smp_ops(vexpress_smp_ops), 457 .smp = smp_ops(vexpress_smp_ops),
458 .smp_init = smp_init_ops(vexpress_smp_init_ops),
459 .map_io = v2m_dt_map_io, 459 .map_io = v2m_dt_map_io,
460 .init_early = v2m_dt_init_early, 460 .init_early = v2m_dt_init_early,
461 .init_irq = irqchip_init,
462 .init_time = v2m_dt_timer_init, 461 .init_time = v2m_dt_timer_init,
463 .init_machine = v2m_dt_init, 462 .init_machine = v2m_dt_init,
464MACHINE_END 463MACHINE_END
diff --git a/arch/arm/mach-virt/Kconfig b/arch/arm/mach-virt/Kconfig
index 8958f0d896bc..081d46929436 100644
--- a/arch/arm/mach-virt/Kconfig
+++ b/arch/arm/mach-virt/Kconfig
@@ -2,7 +2,7 @@ config ARCH_VIRT
2 bool "Dummy Virtual Machine" if ARCH_MULTI_V7 2 bool "Dummy Virtual Machine" if ARCH_MULTI_V7
3 select ARCH_WANT_OPTIONAL_GPIOLIB 3 select ARCH_WANT_OPTIONAL_GPIOLIB
4 select ARM_GIC 4 select ARM_GIC
5 select ARM_ARCH_TIMER 5 select HAVE_ARM_ARCH_TIMER
6 select ARM_PSCI 6 select ARM_PSCI
7 select HAVE_SMP 7 select HAVE_SMP
8 select CPU_V7 8 select CPU_V7
diff --git a/arch/arm/mach-virt/Makefile b/arch/arm/mach-virt/Makefile
index 042afc1f8c44..7ddbfa60227f 100644
--- a/arch/arm/mach-virt/Makefile
+++ b/arch/arm/mach-virt/Makefile
@@ -3,4 +3,3 @@
3# 3#
4 4
5obj-y := virt.o 5obj-y := virt.o
6obj-$(CONFIG_SMP) += platsmp.o
diff --git a/arch/arm/mach-virt/platsmp.c b/arch/arm/mach-virt/platsmp.c
deleted file mode 100644
index f4143f5bfa5b..000000000000
--- a/arch/arm/mach-virt/platsmp.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Dummy Virtual Machine - does what it says on the tin.
3 *
4 * Copyright (C) 2012 ARM Ltd
5 * Author: Will Deacon <will.deacon@arm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <linux/init.h>
21#include <linux/smp.h>
22#include <linux/of.h>
23
24#include <asm/psci.h>
25#include <asm/smp_plat.h>
26
27extern void secondary_startup(void);
28
29static void __init virt_smp_init_cpus(void)
30{
31}
32
33static void __init virt_smp_prepare_cpus(unsigned int max_cpus)
34{
35}
36
37static int __cpuinit virt_boot_secondary(unsigned int cpu,
38 struct task_struct *idle)
39{
40 if (psci_ops.cpu_on)
41 return psci_ops.cpu_on(cpu_logical_map(cpu),
42 __pa(secondary_startup));
43 return -ENODEV;
44}
45
46struct smp_operations __initdata virt_smp_ops = {
47 .smp_init_cpus = virt_smp_init_cpus,
48 .smp_prepare_cpus = virt_smp_prepare_cpus,
49 .smp_boot_secondary = virt_boot_secondary,
50};
diff --git a/arch/arm/mach-virt/virt.c b/arch/arm/mach-virt/virt.c
index 061f283f579e..b184e57d1854 100644
--- a/arch/arm/mach-virt/virt.c
+++ b/arch/arm/mach-virt/virt.c
@@ -18,7 +18,6 @@
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/irqchip.h>
22#include <linux/of_irq.h> 21#include <linux/of_irq.h>
23#include <linux/of_platform.h> 22#include <linux/of_platform.h>
24#include <linux/smp.h> 23#include <linux/smp.h>
@@ -36,11 +35,7 @@ static const char *virt_dt_match[] = {
36 NULL 35 NULL
37}; 36};
38 37
39extern struct smp_operations virt_smp_ops;
40
41DT_MACHINE_START(VIRT, "Dummy Virtual Machine") 38DT_MACHINE_START(VIRT, "Dummy Virtual Machine")
42 .init_irq = irqchip_init,
43 .init_machine = virt_init, 39 .init_machine = virt_init,
44 .smp = smp_ops(virt_smp_ops),
45 .dt_compat = virt_dt_match, 40 .dt_compat = virt_dt_match,
46MACHINE_END 41MACHINE_END
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index f5c33df7a597..f8f2f00856e0 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/clocksource.h> 21#include <linux/clocksource.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irqchip.h>
24#include <linux/pm.h> 23#include <linux/pm.h>
25 24
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -179,7 +178,6 @@ static const char * const vt8500_dt_compat[] = {
179DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)") 178DT_MACHINE_START(WMT_DT, "VIA/Wondermedia SoC (Device Tree Support)")
180 .dt_compat = vt8500_dt_compat, 179 .dt_compat = vt8500_dt_compat,
181 .map_io = vt8500_map_io, 180 .map_io = vt8500_map_io,
182 .init_irq = irqchip_init,
183 .init_machine = vt8500_init, 181 .init_machine = vt8500_init,
184 .init_time = clocksource_of_init, 182 .init_time = clocksource_of_init,
185 .restart = vt8500_restart, 183 .restart = vt8500_restart,
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 5bfe7035b73d..4130e65a0e3f 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -25,7 +25,6 @@
25#include <linux/of_irq.h> 25#include <linux/of_irq.h>
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/of.h> 27#include <linux/of.h>
28#include <linux/irqchip.h>
29 28
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 30#include <asm/mach/map.h>
@@ -98,7 +97,6 @@ static void zynq_system_reset(char mode, const char *cmd)
98} 97}
99 98
100static const char * const zynq_dt_match[] = { 99static const char * const zynq_dt_match[] = {
101 "xlnx,zynq-zc702",
102 "xlnx,zynq-7000", 100 "xlnx,zynq-7000",
103 NULL 101 NULL
104}; 102};
@@ -106,7 +104,6 @@ static const char * const zynq_dt_match[] = {
106MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") 104MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
107 .smp = smp_ops(zynq_smp_ops), 105 .smp = smp_ops(zynq_smp_ops),
108 .map_io = zynq_map_io, 106 .map_io = zynq_map_io,
109 .init_irq = irqchip_init,
110 .init_machine = zynq_init_machine, 107 .init_machine = zynq_init_machine,
111 .init_time = zynq_timer_init, 108 .init_time = zynq_timer_init,
112 .dt_compat = zynq_dt_match, 109 .dt_compat = zynq_dt_match,
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 5fc167e07619..023f225493f2 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -53,34 +53,34 @@ int __cpuinit zynq_cpun_start(u32 address, int cpu)
53 &zynq_secondary_trampoline; 53 &zynq_secondary_trampoline;
54 54
55 zynq_slcr_cpu_stop(cpu); 55 zynq_slcr_cpu_stop(cpu);
56 56 if (address) {
57 if (__pa(PAGE_OFFSET)) { 57 if (__pa(PAGE_OFFSET)) {
58 zero = ioremap(0, trampoline_code_size); 58 zero = ioremap(0, trampoline_code_size);
59 if (!zero) { 59 if (!zero) {
60 pr_warn("BOOTUP jump vectors not accessible\n"); 60 pr_warn("BOOTUP jump vectors not accessible\n");
61 return -1; 61 return -1;
62 }
63 } else {
64 zero = (__force u8 __iomem *)PAGE_OFFSET;
62 } 65 }
63 } else {
64 zero = (__force u8 __iomem *)PAGE_OFFSET;
65 }
66
67 /*
68 * This is elegant way how to jump to any address
69 * 0x0: Load address at 0x8 to r0
70 * 0x4: Jump by mov instruction
71 * 0x8: Jumping address
72 */
73 memcpy((__force void *)zero, &zynq_secondary_trampoline,
74 trampoline_size);
75 writel(address, zero + trampoline_size);
76
77 flush_cache_all();
78 outer_flush_range(0, trampoline_code_size);
79 smp_wmb();
80
81 if (__pa(PAGE_OFFSET))
82 iounmap(zero);
83 66
67 /*
68 * This is elegant way how to jump to any address
69 * 0x0: Load address at 0x8 to r0
70 * 0x4: Jump by mov instruction
71 * 0x8: Jumping address
72 */
73 memcpy((__force void *)zero, &zynq_secondary_trampoline,
74 trampoline_size);
75 writel(address, zero + trampoline_size);
76
77 flush_cache_all();
78 outer_flush_range(0, trampoline_code_size);
79 smp_wmb();
80
81 if (__pa(PAGE_OFFSET))
82 iounmap(zero);
83 }
84 zynq_slcr_cpu_start(cpu); 84 zynq_slcr_cpu_start(cpu);
85 85
86 return 0; 86 return 0;
diff --git a/arch/arm/mach-zynq/slcr.c b/arch/arm/mach-zynq/slcr.c
index c70969b9c258..50d008d8f87f 100644
--- a/arch/arm/mach-zynq/slcr.c
+++ b/arch/arm/mach-zynq/slcr.c
@@ -117,7 +117,7 @@ int __init zynq_slcr_init(void)
117 117
118 pr_info("%s mapped to %p\n", np->name, zynq_slcr_base); 118 pr_info("%s mapped to %p\n", np->name, zynq_slcr_base);
119 119
120 xilinx_zynq_clocks_init(zynq_slcr_base); 120 zynq_clock_init(zynq_slcr_base);
121 121
122 of_node_put(np); 122 of_node_put(np);
123 123
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 35955b54944c..6cacdc8dd654 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -392,11 +392,21 @@ config CPU_V7
392 select CPU_CACHE_V7 392 select CPU_CACHE_V7
393 select CPU_CACHE_VIPT 393 select CPU_CACHE_VIPT
394 select CPU_COPY_V6 if MMU 394 select CPU_COPY_V6 if MMU
395 select CPU_CP15_MMU 395 select CPU_CP15_MMU if MMU
396 select CPU_CP15_MPU if !MMU
396 select CPU_HAS_ASID if MMU 397 select CPU_HAS_ASID if MMU
397 select CPU_PABRT_V7 398 select CPU_PABRT_V7
398 select CPU_TLB_V7 if MMU 399 select CPU_TLB_V7 if MMU
399 400
401# ARMv7M
402config CPU_V7M
403 bool
404 select CPU_32v7M
405 select CPU_ABRT_NOMMU
406 select CPU_CACHE_NOP
407 select CPU_PABRT_LEGACY
408 select CPU_THUMBONLY
409
400config CPU_THUMBONLY 410config CPU_THUMBONLY
401 bool 411 bool
402 # There are no CPUs available with MMU that don't implement an ARM ISA: 412 # There are no CPUs available with MMU that don't implement an ARM ISA:
@@ -441,6 +451,9 @@ config CPU_32v6K
441config CPU_32v7 451config CPU_32v7
442 bool 452 bool
443 453
454config CPU_32v7M
455 bool
456
444# The abort model 457# The abort model
445config CPU_ABRT_NOMMU 458config CPU_ABRT_NOMMU
446 bool 459 bool
@@ -491,6 +504,9 @@ config CPU_CACHE_V6
491config CPU_CACHE_V7 504config CPU_CACHE_V7
492 bool 505 bool
493 506
507config CPU_CACHE_NOP
508 bool
509
494config CPU_CACHE_VIVT 510config CPU_CACHE_VIVT
495 bool 511 bool
496 512
@@ -613,7 +629,11 @@ config ARCH_DMA_ADDR_T_64BIT
613 629
614config ARM_THUMB 630config ARM_THUMB
615 bool "Support Thumb user binaries" if !CPU_THUMBONLY 631 bool "Support Thumb user binaries" if !CPU_THUMBONLY
616 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || CPU_V7 || CPU_FEROCEON 632 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || \
633 CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || \
634 CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \
635 CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || \
636 CPU_V7 || CPU_FEROCEON || CPU_V7M
617 default y 637 default y
618 help 638 help
619 Say Y if you want to include kernel support for running user space 639 Say Y if you want to include kernel support for running user space
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 9e51be96f635..ecfe6e53f6e0 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_MODULES) += proc-syms.o
16 16
17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
18obj-$(CONFIG_HIGHMEM) += highmem.o 18obj-$(CONFIG_HIGHMEM) += highmem.o
19obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
19 20
20obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o 21obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o
21obj-$(CONFIG_CPU_ABRT_EV4) += abort-ev4.o 22obj-$(CONFIG_CPU_ABRT_EV4) += abort-ev4.o
@@ -39,6 +40,7 @@ obj-$(CONFIG_CPU_CACHE_V4WB) += cache-v4wb.o
39obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o 40obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o
40obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o 41obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o
41obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o 42obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o
43obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o
42 44
43AFLAGS_cache-v6.o :=-Wa,-march=armv6 45AFLAGS_cache-v6.o :=-Wa,-march=armv6
44AFLAGS_cache-v7.o :=-Wa,-march=armv7-a 46AFLAGS_cache-v7.o :=-Wa,-march=armv7-a
@@ -87,6 +89,7 @@ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o
87obj-$(CONFIG_CPU_V6) += proc-v6.o 89obj-$(CONFIG_CPU_V6) += proc-v6.o
88obj-$(CONFIG_CPU_V6K) += proc-v6.o 90obj-$(CONFIG_CPU_V6K) += proc-v6.o
89obj-$(CONFIG_CPU_V7) += proc-v7.o 91obj-$(CONFIG_CPU_V7) += proc-v7.o
92obj-$(CONFIG_CPU_V7M) += proc-v7m.o
90 93
91AFLAGS_proc-v6.o :=-Wa,-march=armv6 94AFLAGS_proc-v6.o :=-Wa,-march=armv6
92AFLAGS_proc-v7.o :=-Wa,-march=armv7-a 95AFLAGS_proc-v7.o :=-Wa,-march=armv7-a
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c465faca51b0..d70e0aba0c9d 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -523,6 +523,147 @@ static void aurora_flush_range(unsigned long start, unsigned long end)
523 } 523 }
524} 524}
525 525
526/*
527 * For certain Broadcom SoCs, depending on the address range, different offsets
528 * need to be added to the address before passing it to L2 for
529 * invalidation/clean/flush
530 *
531 * Section Address Range Offset EMI
532 * 1 0x00000000 - 0x3FFFFFFF 0x80000000 VC
533 * 2 0x40000000 - 0xBFFFFFFF 0x40000000 SYS
534 * 3 0xC0000000 - 0xFFFFFFFF 0x80000000 VC
535 *
536 * When the start and end addresses have crossed two different sections, we
537 * need to break the L2 operation into two, each within its own section.
538 * For example, if we need to invalidate addresses starts at 0xBFFF0000 and
539 * ends at 0xC0001000, we need do invalidate 1) 0xBFFF0000 - 0xBFFFFFFF and 2)
540 * 0xC0000000 - 0xC0001000
541 *
542 * Note 1:
543 * By breaking a single L2 operation into two, we may potentially suffer some
544 * performance hit, but keep in mind the cross section case is very rare
545 *
546 * Note 2:
547 * We do not need to handle the case when the start address is in
548 * Section 1 and the end address is in Section 3, since it is not a valid use
549 * case
550 *
551 * Note 3:
552 * Section 1 in practical terms can no longer be used on rev A2. Because of
553 * that the code does not need to handle section 1 at all.
554 *
555 */
556#define BCM_SYS_EMI_START_ADDR 0x40000000UL
557#define BCM_VC_EMI_SEC3_START_ADDR 0xC0000000UL
558
559#define BCM_SYS_EMI_OFFSET 0x40000000UL
560#define BCM_VC_EMI_OFFSET 0x80000000UL
561
562static inline int bcm_addr_is_sys_emi(unsigned long addr)
563{
564 return (addr >= BCM_SYS_EMI_START_ADDR) &&
565 (addr < BCM_VC_EMI_SEC3_START_ADDR);
566}
567
568static inline unsigned long bcm_l2_phys_addr(unsigned long addr)
569{
570 if (bcm_addr_is_sys_emi(addr))
571 return addr + BCM_SYS_EMI_OFFSET;
572 else
573 return addr + BCM_VC_EMI_OFFSET;
574}
575
576static void bcm_inv_range(unsigned long start, unsigned long end)
577{
578 unsigned long new_start, new_end;
579
580 BUG_ON(start < BCM_SYS_EMI_START_ADDR);
581
582 if (unlikely(end <= start))
583 return;
584
585 new_start = bcm_l2_phys_addr(start);
586 new_end = bcm_l2_phys_addr(end);
587
588 /* normal case, no cross section between start and end */
589 if (likely(bcm_addr_is_sys_emi(end) || !bcm_addr_is_sys_emi(start))) {
590 l2x0_inv_range(new_start, new_end);
591 return;
592 }
593
594 /* They cross sections, so it can only be a cross from section
595 * 2 to section 3
596 */
597 l2x0_inv_range(new_start,
598 bcm_l2_phys_addr(BCM_VC_EMI_SEC3_START_ADDR-1));
599 l2x0_inv_range(bcm_l2_phys_addr(BCM_VC_EMI_SEC3_START_ADDR),
600 new_end);
601}
602
603static void bcm_clean_range(unsigned long start, unsigned long end)
604{
605 unsigned long new_start, new_end;
606
607 BUG_ON(start < BCM_SYS_EMI_START_ADDR);
608
609 if (unlikely(end <= start))
610 return;
611
612 if ((end - start) >= l2x0_size) {
613 l2x0_clean_all();
614 return;
615 }
616
617 new_start = bcm_l2_phys_addr(start);
618 new_end = bcm_l2_phys_addr(end);
619
620 /* normal case, no cross section between start and end */
621 if (likely(bcm_addr_is_sys_emi(end) || !bcm_addr_is_sys_emi(start))) {
622 l2x0_clean_range(new_start, new_end);
623 return;
624 }
625
626 /* They cross sections, so it can only be a cross from section
627 * 2 to section 3
628 */
629 l2x0_clean_range(new_start,
630 bcm_l2_phys_addr(BCM_VC_EMI_SEC3_START_ADDR-1));
631 l2x0_clean_range(bcm_l2_phys_addr(BCM_VC_EMI_SEC3_START_ADDR),
632 new_end);
633}
634
635static void bcm_flush_range(unsigned long start, unsigned long end)
636{
637 unsigned long new_start, new_end;
638
639 BUG_ON(start < BCM_SYS_EMI_START_ADDR);
640
641 if (unlikely(end <= start))
642 return;
643
644 if ((end - start) >= l2x0_size) {
645 l2x0_flush_all();
646 return;
647 }
648
649 new_start = bcm_l2_phys_addr(start);
650 new_end = bcm_l2_phys_addr(end);
651
652 /* normal case, no cross section between start and end */
653 if (likely(bcm_addr_is_sys_emi(end) || !bcm_addr_is_sys_emi(start))) {
654 l2x0_flush_range(new_start, new_end);
655 return;
656 }
657
658 /* They cross sections, so it can only be a cross from section
659 * 2 to section 3
660 */
661 l2x0_flush_range(new_start,
662 bcm_l2_phys_addr(BCM_VC_EMI_SEC3_START_ADDR-1));
663 l2x0_flush_range(bcm_l2_phys_addr(BCM_VC_EMI_SEC3_START_ADDR),
664 new_end);
665}
666
526static void __init l2x0_of_setup(const struct device_node *np, 667static void __init l2x0_of_setup(const struct device_node *np,
527 u32 *aux_val, u32 *aux_mask) 668 u32 *aux_val, u32 *aux_mask)
528{ 669{
@@ -765,6 +906,21 @@ static const struct l2x0_of_data aurora_no_outer_data = {
765 }, 906 },
766}; 907};
767 908
909static const struct l2x0_of_data bcm_l2x0_data = {
910 .setup = pl310_of_setup,
911 .save = pl310_save,
912 .outer_cache = {
913 .resume = pl310_resume,
914 .inv_range = bcm_inv_range,
915 .clean_range = bcm_clean_range,
916 .flush_range = bcm_flush_range,
917 .sync = l2x0_cache_sync,
918 .flush_all = l2x0_flush_all,
919 .inv_all = l2x0_inv_all,
920 .disable = l2x0_disable,
921 },
922};
923
768static const struct of_device_id l2x0_ids[] __initconst = { 924static const struct of_device_id l2x0_ids[] __initconst = {
769 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data }, 925 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
770 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data }, 926 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
@@ -773,6 +929,8 @@ static const struct of_device_id l2x0_ids[] __initconst = {
773 .data = (void *)&aurora_no_outer_data}, 929 .data = (void *)&aurora_no_outer_data},
774 { .compatible = "marvell,aurora-outer-cache", 930 { .compatible = "marvell,aurora-outer-cache",
775 .data = (void *)&aurora_with_outer_data}, 931 .data = (void *)&aurora_with_outer_data},
932 { .compatible = "bcm,bcm11351-a2-pl310-cache",
933 .data = (void *)&bcm_l2x0_data},
776 {} 934 {}
777}; 935};
778 936
diff --git a/arch/arm/mm/cache-nop.S b/arch/arm/mm/cache-nop.S
new file mode 100644
index 000000000000..8e12ddca0031
--- /dev/null
+++ b/arch/arm/mm/cache-nop.S
@@ -0,0 +1,50 @@
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#include <linux/linkage.h>
7#include <linux/init.h>
8
9#include "proc-macros.S"
10
11ENTRY(nop_flush_icache_all)
12 mov pc, lr
13ENDPROC(nop_flush_icache_all)
14
15 .globl nop_flush_kern_cache_all
16 .equ nop_flush_kern_cache_all, nop_flush_icache_all
17
18 .globl nop_flush_kern_cache_louis
19 .equ nop_flush_kern_cache_louis, nop_flush_icache_all
20
21 .globl nop_flush_user_cache_all
22 .equ nop_flush_user_cache_all, nop_flush_icache_all
23
24 .globl nop_flush_user_cache_range
25 .equ nop_flush_user_cache_range, nop_flush_icache_all
26
27 .globl nop_coherent_kern_range
28 .equ nop_coherent_kern_range, nop_flush_icache_all
29
30ENTRY(nop_coherent_user_range)
31 mov r0, 0
32 mov pc, lr
33ENDPROC(nop_coherent_user_range)
34
35 .globl nop_flush_kern_dcache_area
36 .equ nop_flush_kern_dcache_area, nop_flush_icache_all
37
38 .globl nop_dma_flush_range
39 .equ nop_dma_flush_range, nop_flush_icache_all
40
41 .globl nop_dma_map_area
42 .equ nop_dma_map_area, nop_flush_icache_all
43
44 .globl nop_dma_unmap_area
45 .equ nop_dma_unmap_area, nop_flush_icache_all
46
47 __INITDATA
48
49 @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
50 define_cache_functions nop
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 15451ee4acc8..515b00064da8 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -92,6 +92,14 @@ ENTRY(v7_flush_dcache_louis)
92 mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr 92 mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr
93 ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr 93 ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr
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
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
98 ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p?
99 biceq r2, r2, #0x0000000f @ clear minor revision number
100 teqeq r2, r1 @ test for errata affected core and if so...
101 orreqs r3, #(1 << 21) @ fix LoUIS value (and set flags state to 'ne')
102#endif
95 ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 103 ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2
96 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 104 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2
97 moveq pc, lr @ return if level == 0 105 moveq pc, lr @ return if level == 0
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 2ac37372ef52..b55b1015724b 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -20,6 +20,7 @@
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21#include <asm/thread_notify.h> 21#include <asm/thread_notify.h>
22#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/proc-fns.h>
23 24
24/* 25/*
25 * On ARMv6, we have the following structure in the Context ID: 26 * On ARMv6, we have the following structure in the Context ID:
@@ -39,33 +40,51 @@
39 * non 64-bit operations. 40 * non 64-bit operations.
40 */ 41 */
41#define ASID_FIRST_VERSION (1ULL << ASID_BITS) 42#define ASID_FIRST_VERSION (1ULL << ASID_BITS)
42#define NUM_USER_ASIDS (ASID_FIRST_VERSION - 1) 43#define NUM_USER_ASIDS ASID_FIRST_VERSION
43
44#define ASID_TO_IDX(asid) ((asid & ~ASID_MASK) - 1)
45#define IDX_TO_ASID(idx) ((idx + 1) & ~ASID_MASK)
46 44
47static DEFINE_RAW_SPINLOCK(cpu_asid_lock); 45static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
48static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION); 46static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
49static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); 47static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
50 48
51DEFINE_PER_CPU(atomic64_t, active_asids); 49static DEFINE_PER_CPU(atomic64_t, active_asids);
52static DEFINE_PER_CPU(u64, reserved_asids); 50static DEFINE_PER_CPU(u64, reserved_asids);
53static cpumask_t tlb_flush_pending; 51static cpumask_t tlb_flush_pending;
54 52
53#ifdef CONFIG_ARM_ERRATA_798181
54void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
55 cpumask_t *mask)
56{
57 int cpu;
58 unsigned long flags;
59 u64 context_id, asid;
60
61 raw_spin_lock_irqsave(&cpu_asid_lock, flags);
62 context_id = mm->context.id.counter;
63 for_each_online_cpu(cpu) {
64 if (cpu == this_cpu)
65 continue;
66 /*
67 * We only need to send an IPI if the other CPUs are
68 * running the same ASID as the one being invalidated.
69 */
70 asid = per_cpu(active_asids, cpu).counter;
71 if (asid == 0)
72 asid = per_cpu(reserved_asids, cpu);
73 if (context_id == asid)
74 cpumask_set_cpu(cpu, mask);
75 }
76 raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
77}
78#endif
79
55#ifdef CONFIG_ARM_LPAE 80#ifdef CONFIG_ARM_LPAE
56static void cpu_set_reserved_ttbr0(void) 81static void cpu_set_reserved_ttbr0(void)
57{ 82{
58 unsigned long ttbl = __pa(swapper_pg_dir);
59 unsigned long ttbh = 0;
60
61 /* 83 /*
62 * Set TTBR0 to swapper_pg_dir which contains only global entries. The 84 * Set TTBR0 to swapper_pg_dir which contains only global entries. The
63 * ASID is set to 0. 85 * ASID is set to 0.
64 */ 86 */
65 asm volatile( 87 cpu_set_ttbr(0, __pa(swapper_pg_dir));
66 " mcrr p15, 0, %0, %1, c2 @ set TTBR0\n"
67 :
68 : "r" (ttbl), "r" (ttbh));
69 isb(); 88 isb();
70} 89}
71#else 90#else
@@ -128,7 +147,16 @@ static void flush_context(unsigned int cpu)
128 asid = 0; 147 asid = 0;
129 } else { 148 } else {
130 asid = atomic64_xchg(&per_cpu(active_asids, i), 0); 149 asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
131 __set_bit(ASID_TO_IDX(asid), asid_map); 150 /*
151 * If this CPU has already been through a
152 * rollover, but hasn't run another task in
153 * the meantime, we must preserve its reserved
154 * ASID, as this is the only trace we have of
155 * the process it is still running.
156 */
157 if (asid == 0)
158 asid = per_cpu(reserved_asids, i);
159 __set_bit(asid & ~ASID_MASK, asid_map);
132 } 160 }
133 per_cpu(reserved_asids, i) = asid; 161 per_cpu(reserved_asids, i) = asid;
134 } 162 }
@@ -167,17 +195,19 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
167 /* 195 /*
168 * Allocate a free ASID. If we can't find one, take a 196 * Allocate a free ASID. If we can't find one, take a
169 * note of the currently active ASIDs and mark the TLBs 197 * note of the currently active ASIDs and mark the TLBs
170 * as requiring flushes. 198 * as requiring flushes. We always count from ASID #1,
199 * as we reserve ASID #0 to switch via TTBR0 and indicate
200 * rollover events.
171 */ 201 */
172 asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS); 202 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
173 if (asid == NUM_USER_ASIDS) { 203 if (asid == NUM_USER_ASIDS) {
174 generation = atomic64_add_return(ASID_FIRST_VERSION, 204 generation = atomic64_add_return(ASID_FIRST_VERSION,
175 &asid_generation); 205 &asid_generation);
176 flush_context(cpu); 206 flush_context(cpu);
177 asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS); 207 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
178 } 208 }
179 __set_bit(asid, asid_map); 209 __set_bit(asid, asid_map);
180 asid = generation | IDX_TO_ASID(asid); 210 asid |= generation;
181 cpumask_clear(mm_cpumask(mm)); 211 cpumask_clear(mm_cpumask(mm));
182 } 212 }
183 213
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ef3e0f3aac96..7ec02961dfa0 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -250,7 +250,7 @@ static void __dma_free_buffer(struct page *page, size_t size)
250 250
251#ifdef CONFIG_MMU 251#ifdef CONFIG_MMU
252#ifdef CONFIG_HUGETLB_PAGE 252#ifdef CONFIG_HUGETLB_PAGE
253#error ARM Coherent DMA allocator does not (yet) support huge TLB 253#warning ARM Coherent DMA allocator does not (yet) support huge TLB
254#endif 254#endif
255 255
256static void *__alloc_from_contiguous(struct device *dev, size_t size, 256static void *__alloc_from_contiguous(struct device *dev, size_t size,
@@ -880,10 +880,24 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
880 dma_cache_maint_page(page, off, size, dir, dmac_unmap_area); 880 dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
881 881
882 /* 882 /*
883 * Mark the D-cache clean for this page to avoid extra flushing. 883 * Mark the D-cache clean for these pages to avoid extra flushing.
884 */ 884 */
885 if (dir != DMA_TO_DEVICE && off == 0 && size >= PAGE_SIZE) 885 if (dir != DMA_TO_DEVICE && size >= PAGE_SIZE) {
886 set_bit(PG_dcache_clean, &page->flags); 886 unsigned long pfn;
887 size_t left = size;
888
889 pfn = page_to_pfn(page) + off / PAGE_SIZE;
890 off %= PAGE_SIZE;
891 if (off) {
892 pfn++;
893 left -= PAGE_SIZE - off;
894 }
895 while (left >= PAGE_SIZE) {
896 page = pfn_to_page(pfn++);
897 set_bit(PG_dcache_clean, &page->flags);
898 left -= PAGE_SIZE;
899 }
900 }
887} 901}
888 902
889/** 903/**
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 5dbf13f954f6..c97f7940cb95 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -491,12 +491,14 @@ do_translation_fault(unsigned long addr, unsigned int fsr,
491 * Some section permission faults need to be handled gracefully. 491 * Some section permission faults need to be handled gracefully.
492 * They can happen due to a __{get,put}_user during an oops. 492 * They can happen due to a __{get,put}_user during an oops.
493 */ 493 */
494#ifndef CONFIG_ARM_LPAE
494static int 495static int
495do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) 496do_sect_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
496{ 497{
497 do_bad_area(addr, fsr, regs); 498 do_bad_area(addr, fsr, regs);
498 return 0; 499 return 0;
499} 500}
501#endif /* CONFIG_ARM_LPAE */
500 502
501/* 503/*
502 * This abort handler always returns "fault". 504 * This abort handler always returns "fault".
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 0d473cce501c..6d5ba9afb16a 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -17,6 +17,7 @@
17#include <asm/highmem.h> 17#include <asm/highmem.h>
18#include <asm/smp_plat.h> 18#include <asm/smp_plat.h>
19#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
20#include <linux/hugetlb.h>
20 21
21#include "mm.h" 22#include "mm.h"
22 23
@@ -168,19 +169,23 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page)
168 * coherent with the kernels mapping. 169 * coherent with the kernels mapping.
169 */ 170 */
170 if (!PageHighMem(page)) { 171 if (!PageHighMem(page)) {
171 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); 172 size_t page_size = PAGE_SIZE << compound_order(page);
173 __cpuc_flush_dcache_area(page_address(page), page_size);
172 } else { 174 } else {
173 void *addr; 175 unsigned long i;
174
175 if (cache_is_vipt_nonaliasing()) { 176 if (cache_is_vipt_nonaliasing()) {
176 addr = kmap_atomic(page); 177 for (i = 0; i < (1 << compound_order(page)); i++) {
177 __cpuc_flush_dcache_area(addr, PAGE_SIZE); 178 void *addr = kmap_atomic(page);
178 kunmap_atomic(addr);
179 } else {
180 addr = kmap_high_get(page);
181 if (addr) {
182 __cpuc_flush_dcache_area(addr, PAGE_SIZE); 179 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
183 kunmap_high(page); 180 kunmap_atomic(addr);
181 }
182 } else {
183 for (i = 0; i < (1 << compound_order(page)); i++) {
184 void *addr = kmap_high_get(page);
185 if (addr) {
186 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
187 kunmap_high(page);
188 }
184 } 189 }
185 } 190 }
186 } 191 }
@@ -287,7 +292,7 @@ void flush_dcache_page(struct page *page)
287 mapping = page_mapping(page); 292 mapping = page_mapping(page);
288 293
289 if (!cache_ops_need_broadcast() && 294 if (!cache_ops_need_broadcast() &&
290 mapping && !mapping_mapped(mapping)) 295 mapping && !page_mapped(page))
291 clear_bit(PG_dcache_clean, &page->flags); 296 clear_bit(PG_dcache_clean, &page->flags);
292 else { 297 else {
293 __flush_dcache_page(mapping, page); 298 __flush_dcache_page(mapping, page);
@@ -301,6 +306,39 @@ void flush_dcache_page(struct page *page)
301EXPORT_SYMBOL(flush_dcache_page); 306EXPORT_SYMBOL(flush_dcache_page);
302 307
303/* 308/*
309 * Ensure cache coherency for the kernel mapping of this page. We can
310 * assume that the page is pinned via kmap.
311 *
312 * If the page only exists in the page cache and there are no user
313 * space mappings, this is a no-op since the page was already marked
314 * dirty at creation. Otherwise, we need to flush the dirty kernel
315 * cache lines directly.
316 */
317void flush_kernel_dcache_page(struct page *page)
318{
319 if (cache_is_vivt() || cache_is_vipt_aliasing()) {
320 struct address_space *mapping;
321
322 mapping = page_mapping(page);
323
324 if (!mapping || mapping_mapped(mapping)) {
325 void *addr;
326
327 addr = page_address(page);
328 /*
329 * kmap_atomic() doesn't set the page virtual
330 * address for highmem pages, and
331 * kunmap_atomic() takes care of cache
332 * flushing already.
333 */
334 if (!IS_ENABLED(CONFIG_HIGHMEM) || addr)
335 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
336 }
337 }
338}
339EXPORT_SYMBOL(flush_kernel_dcache_page);
340
341/*
304 * Flush an anonymous page so that users of get_user_pages() 342 * Flush an anonymous page so that users of get_user_pages()
305 * can safely access the data. The expected sequence is: 343 * can safely access the data. The expected sequence is:
306 * 344 *
diff --git a/arch/arm/mm/fsr-3level.c b/arch/arm/mm/fsr-3level.c
index 05a4e9431836..ab4409a2307e 100644
--- a/arch/arm/mm/fsr-3level.c
+++ b/arch/arm/mm/fsr-3level.c
@@ -9,11 +9,11 @@ static struct fsr_info fsr_info[] = {
9 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" }, 9 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" },
10 { do_bad, SIGBUS, 0, "reserved access flag fault" }, 10 { do_bad, SIGBUS, 0, "reserved access flag fault" },
11 { do_bad, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" }, 11 { do_bad, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" },
12 { do_bad, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" }, 12 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" },
13 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" }, 13 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" },
14 { do_bad, SIGBUS, 0, "reserved permission fault" }, 14 { do_bad, SIGBUS, 0, "reserved permission fault" },
15 { do_bad, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" }, 15 { do_bad, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" },
16 { do_sect_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" }, 16 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" },
17 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" }, 17 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" },
18 { do_bad, SIGBUS, 0, "synchronous external abort" }, 18 { do_bad, SIGBUS, 0, "synchronous external abort" },
19 { do_bad, SIGBUS, 0, "asynchronous external abort" }, 19 { do_bad, SIGBUS, 0, "asynchronous external abort" },
diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c
new file mode 100644
index 000000000000..3d1e4a205b0b
--- /dev/null
+++ b/arch/arm/mm/hugetlbpage.c
@@ -0,0 +1,101 @@
1/*
2 * arch/arm/mm/hugetlbpage.c
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 *
6 * Based on arch/x86/include/asm/hugetlb.h and Bill Carson's patches
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/init.h>
23#include <linux/fs.h>
24#include <linux/mm.h>
25#include <linux/hugetlb.h>
26#include <linux/pagemap.h>
27#include <linux/err.h>
28#include <linux/sysctl.h>
29#include <asm/mman.h>
30#include <asm/tlb.h>
31#include <asm/tlbflush.h>
32#include <asm/pgalloc.h>
33
34/*
35 * On ARM, huge pages are backed by pmd's rather than pte's, so we do a lot
36 * of type casting from pmd_t * to pte_t *.
37 */
38
39pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
40{
41 pgd_t *pgd;
42 pud_t *pud;
43 pmd_t *pmd = NULL;
44
45 pgd = pgd_offset(mm, addr);
46 if (pgd_present(*pgd)) {
47 pud = pud_offset(pgd, addr);
48 if (pud_present(*pud))
49 pmd = pmd_offset(pud, addr);
50 }
51
52 return (pte_t *)pmd;
53}
54
55struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
56 int write)
57{
58 return ERR_PTR(-EINVAL);
59}
60
61int pud_huge(pud_t pud)
62{
63 return 0;
64}
65
66int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
67{
68 return 0;
69}
70
71pte_t *huge_pte_alloc(struct mm_struct *mm,
72 unsigned long addr, unsigned long sz)
73{
74 pgd_t *pgd;
75 pud_t *pud;
76 pte_t *pte = NULL;
77
78 pgd = pgd_offset(mm, addr);
79 pud = pud_alloc(mm, pgd, addr);
80 if (pud)
81 pte = (pte_t *)pmd_alloc(mm, pud, addr);
82
83 return pte;
84}
85
86struct page *
87follow_huge_pmd(struct mm_struct *mm, unsigned long address,
88 pmd_t *pmd, int write)
89{
90 struct page *page;
91
92 page = pte_page(*(pte_t *)pmd);
93 if (page)
94 page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
95 return page;
96}
97
98int pmd_huge(pmd_t pmd)
99{
100 return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);
101}
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 9a5cdc01fcdf..6833cbead6cc 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -36,12 +36,13 @@
36 36
37#include "mm.h" 37#include "mm.h"
38 38
39static unsigned long phys_initrd_start __initdata = 0; 39static phys_addr_t phys_initrd_start __initdata = 0;
40static unsigned long phys_initrd_size __initdata = 0; 40static unsigned long phys_initrd_size __initdata = 0;
41 41
42static int __init early_initrd(char *p) 42static int __init early_initrd(char *p)
43{ 43{
44 unsigned long start, size; 44 phys_addr_t start;
45 unsigned long size;
45 char *endp; 46 char *endp;
46 47
47 start = memparse(p, &endp); 48 start = memparse(p, &endp);
@@ -350,14 +351,14 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
350#ifdef CONFIG_BLK_DEV_INITRD 351#ifdef CONFIG_BLK_DEV_INITRD
351 if (phys_initrd_size && 352 if (phys_initrd_size &&
352 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 353 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
353 pr_err("INITRD: 0x%08lx+0x%08lx is not a memory region - disabling initrd\n", 354 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
354 phys_initrd_start, phys_initrd_size); 355 (u64)phys_initrd_start, phys_initrd_size);
355 phys_initrd_start = phys_initrd_size = 0; 356 phys_initrd_start = phys_initrd_size = 0;
356 } 357 }
357 if (phys_initrd_size && 358 if (phys_initrd_size &&
358 memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) { 359 memblock_is_region_reserved(phys_initrd_start, phys_initrd_size)) {
359 pr_err("INITRD: 0x%08lx+0x%08lx overlaps in-use memory region - disabling initrd\n", 360 pr_err("INITRD: 0x%08llx+0x%08lx overlaps in-use memory region - disabling initrd\n",
360 phys_initrd_start, phys_initrd_size); 361 (u64)phys_initrd_start, phys_initrd_size);
361 phys_initrd_start = phys_initrd_size = 0; 362 phys_initrd_start = phys_initrd_size = 0;
362 } 363 }
363 if (phys_initrd_size) { 364 if (phys_initrd_size) {
@@ -442,7 +443,7 @@ static inline void
442free_memmap(unsigned long start_pfn, unsigned long end_pfn) 443free_memmap(unsigned long start_pfn, unsigned long end_pfn)
443{ 444{
444 struct page *start_pg, *end_pg; 445 struct page *start_pg, *end_pg;
445 unsigned long pg, pgend; 446 phys_addr_t pg, pgend;
446 447
447 /* 448 /*
448 * Convert start_pfn/end_pfn to a struct page pointer. 449 * Convert start_pfn/end_pfn to a struct page pointer.
@@ -454,8 +455,8 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn)
454 * Convert to physical addresses, and 455 * Convert to physical addresses, and
455 * round start upwards and end downwards. 456 * round start upwards and end downwards.
456 */ 457 */
457 pg = (unsigned long)PAGE_ALIGN(__pa(start_pg)); 458 pg = PAGE_ALIGN(__pa(start_pg));
458 pgend = (unsigned long)__pa(end_pg) & PAGE_MASK; 459 pgend = __pa(end_pg) & PAGE_MASK;
459 460
460 /* 461 /*
461 * If there are free pages between these, 462 * If there are free pages between these,
@@ -582,9 +583,6 @@ static void __init free_highpages(void)
582 */ 583 */
583void __init mem_init(void) 584void __init mem_init(void)
584{ 585{
585 unsigned long reserved_pages, free_pages;
586 struct memblock_region *reg;
587 int i;
588#ifdef CONFIG_HAVE_TCM 586#ifdef CONFIG_HAVE_TCM
589 /* These pointers are filled in on TCM detection */ 587 /* These pointers are filled in on TCM detection */
590 extern u32 dtcm_end; 588 extern u32 dtcm_end;
@@ -595,57 +593,16 @@ void __init mem_init(void)
595 593
596 /* this will put all unused low memory onto the freelists */ 594 /* this will put all unused low memory onto the freelists */
597 free_unused_memmap(&meminfo); 595 free_unused_memmap(&meminfo);
598 596 free_all_bootmem();
599 totalram_pages += free_all_bootmem();
600 597
601#ifdef CONFIG_SA1111 598#ifdef CONFIG_SA1111
602 /* now that our DMA memory is actually so designated, we can free it */ 599 /* now that our DMA memory is actually so designated, we can free it */
603 free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL); 600 free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, -1, NULL);
604#endif 601#endif
605 602
606 free_highpages(); 603 free_highpages();
607 604
608 reserved_pages = free_pages = 0; 605 mem_init_print_info(NULL);
609
610 for_each_bank(i, &meminfo) {
611 struct membank *bank = &meminfo.bank[i];
612 unsigned int pfn1, pfn2;
613 struct page *page, *end;
614
615 pfn1 = bank_pfn_start(bank);
616 pfn2 = bank_pfn_end(bank);
617
618 page = pfn_to_page(pfn1);
619 end = pfn_to_page(pfn2 - 1) + 1;
620
621 do {
622 if (PageReserved(page))
623 reserved_pages++;
624 else if (!page_count(page))
625 free_pages++;
626 page++;
627 } while (page < end);
628 }
629
630 /*
631 * Since our memory may not be contiguous, calculate the
632 * real number of pages we have in this system
633 */
634 printk(KERN_INFO "Memory:");
635 num_physpages = 0;
636 for_each_memblock(memory, reg) {
637 unsigned long pages = memblock_region_memory_end_pfn(reg) -
638 memblock_region_memory_base_pfn(reg);
639 num_physpages += pages;
640 printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
641 }
642 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
643
644 printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
645 nr_free_pages() << (PAGE_SHIFT-10),
646 free_pages << (PAGE_SHIFT-10),
647 reserved_pages << (PAGE_SHIFT-10),
648 totalhigh_pages << (PAGE_SHIFT-10));
649 606
650#define MLK(b, t) b, t, ((t) - (b)) >> 10 607#define MLK(b, t) b, t, ((t) - (b)) >> 10
651#define MLM(b, t) b, t, ((t) - (b)) >> 20 608#define MLM(b, t) b, t, ((t) - (b)) >> 20
@@ -711,7 +668,7 @@ void __init mem_init(void)
711 BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); 668 BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
712#endif 669#endif
713 670
714 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 671 if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
715 extern int sysctl_overcommit_memory; 672 extern int sysctl_overcommit_memory;
716 /* 673 /*
717 * On a machine this small we won't get 674 * On a machine this small we won't get
@@ -728,12 +685,12 @@ void free_initmem(void)
728 extern char __tcm_start, __tcm_end; 685 extern char __tcm_start, __tcm_end;
729 686
730 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start); 687 poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
731 free_reserved_area(&__tcm_start, &__tcm_end, 0, "TCM link"); 688 free_reserved_area(&__tcm_start, &__tcm_end, -1, "TCM link");
732#endif 689#endif
733 690
734 poison_init_mem(__init_begin, __init_end - __init_begin); 691 poison_init_mem(__init_begin, __init_end - __init_begin);
735 if (!machine_is_integrator() && !machine_is_cintegrator()) 692 if (!machine_is_integrator() && !machine_is_cintegrator())
736 free_initmem_default(0); 693 free_initmem_default(-1);
737} 694}
738 695
739#ifdef CONFIG_BLK_DEV_INITRD 696#ifdef CONFIG_BLK_DEV_INITRD
@@ -744,7 +701,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
744{ 701{
745 if (!keep_initrd) { 702 if (!keep_initrd) {
746 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 703 poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
747 free_reserved_area(start, end, 0, "initrd"); 704 free_reserved_area((void *)start, (void *)end, -1, "initrd");
748 } 705 }
749} 706}
750 707
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 04d9006eab1f..f123d6eb074b 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -331,10 +331,10 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
331 return (void __iomem *) (offset + addr); 331 return (void __iomem *) (offset + addr);
332} 332}
333 333
334void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, 334void __iomem *__arm_ioremap_caller(phys_addr_t phys_addr, size_t size,
335 unsigned int mtype, void *caller) 335 unsigned int mtype, void *caller)
336{ 336{
337 unsigned long last_addr; 337 phys_addr_t last_addr;
338 unsigned long offset = phys_addr & ~PAGE_MASK; 338 unsigned long offset = phys_addr & ~PAGE_MASK;
339 unsigned long pfn = __phys_to_pfn(phys_addr); 339 unsigned long pfn = __phys_to_pfn(phys_addr);
340 340
@@ -367,12 +367,12 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
367} 367}
368EXPORT_SYMBOL(__arm_ioremap_pfn); 368EXPORT_SYMBOL(__arm_ioremap_pfn);
369 369
370void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, 370void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
371 unsigned int, void *) = 371 unsigned int, void *) =
372 __arm_ioremap_caller; 372 __arm_ioremap_caller;
373 373
374void __iomem * 374void __iomem *
375__arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) 375__arm_ioremap(phys_addr_t phys_addr, size_t size, unsigned int mtype)
376{ 376{
377 return arch_ioremap_caller(phys_addr, size, mtype, 377 return arch_ioremap_caller(phys_addr, size, mtype,
378 __builtin_return_address(0)); 378 __builtin_return_address(0));
@@ -387,7 +387,7 @@ EXPORT_SYMBOL(__arm_ioremap);
387 * CONFIG_GENERIC_ALLOCATOR for allocating external memory. 387 * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
388 */ 388 */
389void __iomem * 389void __iomem *
390__arm_ioremap_exec(unsigned long phys_addr, size_t size, bool cached) 390__arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached)
391{ 391{
392 unsigned int mtype; 392 unsigned int mtype;
393 393
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e0d8565671a6..d7229d28c7f8 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -616,10 +616,12 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
616 } while (pte++, addr += PAGE_SIZE, addr != end); 616 } while (pte++, addr += PAGE_SIZE, addr != end);
617} 617}
618 618
619static void __init map_init_section(pmd_t *pmd, unsigned long addr, 619static void __init __map_init_section(pmd_t *pmd, unsigned long addr,
620 unsigned long end, phys_addr_t phys, 620 unsigned long end, phys_addr_t phys,
621 const struct mem_type *type) 621 const struct mem_type *type)
622{ 622{
623 pmd_t *p = pmd;
624
623#ifndef CONFIG_ARM_LPAE 625#ifndef CONFIG_ARM_LPAE
624 /* 626 /*
625 * In classic MMU format, puds and pmds are folded in to 627 * In classic MMU format, puds and pmds are folded in to
@@ -638,7 +640,7 @@ static void __init map_init_section(pmd_t *pmd, unsigned long addr,
638 phys += SECTION_SIZE; 640 phys += SECTION_SIZE;
639 } while (pmd++, addr += SECTION_SIZE, addr != end); 641 } while (pmd++, addr += SECTION_SIZE, addr != end);
640 642
641 flush_pmd_entry(pmd); 643 flush_pmd_entry(p);
642} 644}
643 645
644static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, 646static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
@@ -661,7 +663,7 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
661 */ 663 */
662 if (type->prot_sect && 664 if (type->prot_sect &&
663 ((addr | next | phys) & ~SECTION_MASK) == 0) { 665 ((addr | next | phys) & ~SECTION_MASK) == 0) {
664 map_init_section(pmd, addr, next, phys, type); 666 __map_init_section(pmd, addr, next, phys, type);
665 } else { 667 } else {
666 alloc_init_pte(pmd, addr, next, 668 alloc_init_pte(pmd, addr, next,
667 __phys_to_pfn(phys), type); 669 __phys_to_pfn(phys), type);
@@ -673,7 +675,8 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
673} 675}
674 676
675static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, 677static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
676 unsigned long end, unsigned long phys, const struct mem_type *type) 678 unsigned long end, phys_addr_t phys,
679 const struct mem_type *type)
677{ 680{
678 pud_t *pud = pud_offset(pgd, addr); 681 pud_t *pud = pud_offset(pgd, addr);
679 unsigned long next; 682 unsigned long next;
@@ -987,27 +990,28 @@ phys_addr_t arm_lowmem_limit __initdata = 0;
987void __init sanity_check_meminfo(void) 990void __init sanity_check_meminfo(void)
988{ 991{
989 int i, j, highmem = 0; 992 int i, j, highmem = 0;
993 phys_addr_t vmalloc_limit = __pa(vmalloc_min - 1) + 1;
990 994
991 for (i = 0, j = 0; i < meminfo.nr_banks; i++) { 995 for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
992 struct membank *bank = &meminfo.bank[j]; 996 struct membank *bank = &meminfo.bank[j];
997 phys_addr_t size_limit;
998
993 *bank = meminfo.bank[i]; 999 *bank = meminfo.bank[i];
1000 size_limit = bank->size;
994 1001
995 if (bank->start > ULONG_MAX) 1002 if (bank->start >= vmalloc_limit)
996 highmem = 1;
997
998#ifdef CONFIG_HIGHMEM
999 if (__va(bank->start) >= vmalloc_min ||
1000 __va(bank->start) < (void *)PAGE_OFFSET)
1001 highmem = 1; 1003 highmem = 1;
1004 else
1005 size_limit = vmalloc_limit - bank->start;
1002 1006
1003 bank->highmem = highmem; 1007 bank->highmem = highmem;
1004 1008
1009#ifdef CONFIG_HIGHMEM
1005 /* 1010 /*
1006 * Split those memory banks which are partially overlapping 1011 * Split those memory banks which are partially overlapping
1007 * the vmalloc area greatly simplifying things later. 1012 * the vmalloc area greatly simplifying things later.
1008 */ 1013 */
1009 if (!highmem && __va(bank->start) < vmalloc_min && 1014 if (!highmem && bank->size > size_limit) {
1010 bank->size > vmalloc_min - __va(bank->start)) {
1011 if (meminfo.nr_banks >= NR_BANKS) { 1015 if (meminfo.nr_banks >= NR_BANKS) {
1012 printk(KERN_CRIT "NR_BANKS too low, " 1016 printk(KERN_CRIT "NR_BANKS too low, "
1013 "ignoring high memory\n"); 1017 "ignoring high memory\n");
@@ -1016,16 +1020,14 @@ void __init sanity_check_meminfo(void)
1016 (meminfo.nr_banks - i) * sizeof(*bank)); 1020 (meminfo.nr_banks - i) * sizeof(*bank));
1017 meminfo.nr_banks++; 1021 meminfo.nr_banks++;
1018 i++; 1022 i++;
1019 bank[1].size -= vmalloc_min - __va(bank->start); 1023 bank[1].size -= size_limit;
1020 bank[1].start = __pa(vmalloc_min - 1) + 1; 1024 bank[1].start = vmalloc_limit;
1021 bank[1].highmem = highmem = 1; 1025 bank[1].highmem = highmem = 1;
1022 j++; 1026 j++;
1023 } 1027 }
1024 bank->size = vmalloc_min - __va(bank->start); 1028 bank->size = size_limit;
1025 } 1029 }
1026#else 1030#else
1027 bank->highmem = highmem;
1028
1029 /* 1031 /*
1030 * Highmem banks not allowed with !CONFIG_HIGHMEM. 1032 * Highmem banks not allowed with !CONFIG_HIGHMEM.
1031 */ 1033 */
@@ -1038,31 +1040,16 @@ void __init sanity_check_meminfo(void)
1038 } 1040 }
1039 1041
1040 /* 1042 /*
1041 * Check whether this memory bank would entirely overlap
1042 * the vmalloc area.
1043 */
1044 if (__va(bank->start) >= vmalloc_min ||
1045 __va(bank->start) < (void *)PAGE_OFFSET) {
1046 printk(KERN_NOTICE "Ignoring RAM at %.8llx-%.8llx "
1047 "(vmalloc region overlap).\n",
1048 (unsigned long long)bank->start,
1049 (unsigned long long)bank->start + bank->size - 1);
1050 continue;
1051 }
1052
1053 /*
1054 * Check whether this memory bank would partially overlap 1043 * Check whether this memory bank would partially overlap
1055 * the vmalloc area. 1044 * the vmalloc area.
1056 */ 1045 */
1057 if (__va(bank->start + bank->size - 1) >= vmalloc_min || 1046 if (bank->size > size_limit) {
1058 __va(bank->start + bank->size - 1) <= __va(bank->start)) {
1059 unsigned long newsize = vmalloc_min - __va(bank->start);
1060 printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx " 1047 printk(KERN_NOTICE "Truncating RAM at %.8llx-%.8llx "
1061 "to -%.8llx (vmalloc region overlap).\n", 1048 "to -%.8llx (vmalloc region overlap).\n",
1062 (unsigned long long)bank->start, 1049 (unsigned long long)bank->start,
1063 (unsigned long long)bank->start + bank->size - 1, 1050 (unsigned long long)bank->start + bank->size - 1,
1064 (unsigned long long)bank->start + newsize - 1); 1051 (unsigned long long)bank->start + size_limit - 1);
1065 bank->size = newsize; 1052 bank->size = size_limit;
1066 } 1053 }
1067#endif 1054#endif
1068 if (!bank->highmem && bank->start + bank->size > arm_lowmem_limit) 1055 if (!bank->highmem && bank->start + bank->size > arm_lowmem_limit)
@@ -1232,6 +1219,8 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
1232 */ 1219 */
1233 if (mdesc->map_io) 1220 if (mdesc->map_io)
1234 mdesc->map_io(); 1221 mdesc->map_io();
1222 else
1223 debug_ll_io_init();
1235 fill_pmd_gaps(); 1224 fill_pmd_gaps();
1236 1225
1237 /* Reserve fixed i/o space in VMALLOC region */ 1226 /* Reserve fixed i/o space in VMALLOC region */
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index d51225f90ae2..1fa50100ab6a 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -8,6 +8,7 @@
8#include <linux/pagemap.h> 8#include <linux/pagemap.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/memblock.h> 10#include <linux/memblock.h>
11#include <linux/kernel.h>
11 12
12#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
13#include <asm/sections.h> 14#include <asm/sections.h>
@@ -15,22 +16,282 @@
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/traps.h> 17#include <asm/traps.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
19#include <asm/cputype.h>
20#include <asm/mpu.h>
18 21
19#include "mm.h" 22#include "mm.h"
20 23
24#ifdef CONFIG_ARM_MPU
25struct mpu_rgn_info mpu_rgn_info;
26
27/* Region number */
28static void rgnr_write(u32 v)
29{
30 asm("mcr p15, 0, %0, c6, c2, 0" : : "r" (v));
31}
32
33/* Data-side / unified region attributes */
34
35/* Region access control register */
36static void dracr_write(u32 v)
37{
38 asm("mcr p15, 0, %0, c6, c1, 4" : : "r" (v));
39}
40
41/* Region size register */
42static void drsr_write(u32 v)
43{
44 asm("mcr p15, 0, %0, c6, c1, 2" : : "r" (v));
45}
46
47/* Region base address register */
48static void drbar_write(u32 v)
49{
50 asm("mcr p15, 0, %0, c6, c1, 0" : : "r" (v));
51}
52
53static u32 drbar_read(void)
54{
55 u32 v;
56 asm("mrc p15, 0, %0, c6, c1, 0" : "=r" (v));
57 return v;
58}
59/* Optional instruction-side region attributes */
60
61/* I-side Region access control register */
62static void iracr_write(u32 v)
63{
64 asm("mcr p15, 0, %0, c6, c1, 5" : : "r" (v));
65}
66
67/* I-side Region size register */
68static void irsr_write(u32 v)
69{
70 asm("mcr p15, 0, %0, c6, c1, 3" : : "r" (v));
71}
72
73/* I-side Region base address register */
74static void irbar_write(u32 v)
75{
76 asm("mcr p15, 0, %0, c6, c1, 1" : : "r" (v));
77}
78
79static unsigned long irbar_read(void)
80{
81 unsigned long v;
82 asm("mrc p15, 0, %0, c6, c1, 1" : "=r" (v));
83 return v;
84}
85
86/* MPU initialisation functions */
87void __init sanity_check_meminfo_mpu(void)
88{
89 int i;
90 struct membank *bank = meminfo.bank;
91 phys_addr_t phys_offset = PHYS_OFFSET;
92 phys_addr_t aligned_region_size, specified_mem_size, rounded_mem_size;
93
94 /* Initially only use memory continuous from PHYS_OFFSET */
95 if (bank_phys_start(&bank[0]) != phys_offset)
96 panic("First memory bank must be contiguous from PHYS_OFFSET");
97
98 /* Banks have already been sorted by start address */
99 for (i = 1; i < meminfo.nr_banks; i++) {
100 if (bank[i].start <= bank_phys_end(&bank[0]) &&
101 bank_phys_end(&bank[i]) > bank_phys_end(&bank[0])) {
102 bank[0].size = bank_phys_end(&bank[i]) - bank[0].start;
103 } else {
104 pr_notice("Ignoring RAM after 0x%.8lx. "
105 "First non-contiguous (ignored) bank start: 0x%.8lx\n",
106 (unsigned long)bank_phys_end(&bank[0]),
107 (unsigned long)bank_phys_start(&bank[i]));
108 break;
109 }
110 }
111 /* All contiguous banks are now merged in to the first bank */
112 meminfo.nr_banks = 1;
113 specified_mem_size = bank[0].size;
114
115 /*
116 * MPU has curious alignment requirements: Size must be power of 2, and
117 * region start must be aligned to the region size
118 */
119 if (phys_offset != 0)
120 pr_info("PHYS_OFFSET != 0 => MPU Region size constrained by alignment requirements\n");
121
122 /*
123 * Maximum aligned region might overflow phys_addr_t if phys_offset is
124 * 0. Hence we keep everything below 4G until we take the smaller of
125 * the aligned_region_size and rounded_mem_size, one of which is
126 * guaranteed to be smaller than the maximum physical address.
127 */
128 aligned_region_size = (phys_offset - 1) ^ (phys_offset);
129 /* Find the max power-of-two sized region that fits inside our bank */
130 rounded_mem_size = (1 << __fls(bank[0].size)) - 1;
131
132 /* The actual region size is the smaller of the two */
133 aligned_region_size = aligned_region_size < rounded_mem_size
134 ? aligned_region_size + 1
135 : rounded_mem_size + 1;
136
137 if (aligned_region_size != specified_mem_size)
138 pr_warn("Truncating memory from 0x%.8lx to 0x%.8lx (MPU region constraints)",
139 (unsigned long)specified_mem_size,
140 (unsigned long)aligned_region_size);
141
142 meminfo.bank[0].size = aligned_region_size;
143 pr_debug("MPU Region from 0x%.8lx size 0x%.8lx (end 0x%.8lx))\n",
144 (unsigned long)phys_offset,
145 (unsigned long)aligned_region_size,
146 (unsigned long)bank_phys_end(&bank[0]));
147
148}
149
150static int mpu_present(void)
151{
152 return ((read_cpuid_ext(CPUID_EXT_MMFR0) & MMFR0_PMSA) == MMFR0_PMSAv7);
153}
154
155static int mpu_max_regions(void)
156{
157 /*
158 * We don't support a different number of I/D side regions so if we
159 * have separate instruction and data memory maps then return
160 * whichever side has a smaller number of supported regions.
161 */
162 u32 dregions, iregions, mpuir;
163 mpuir = read_cpuid(CPUID_MPUIR);
164
165 dregions = iregions = (mpuir & MPUIR_DREGION_SZMASK) >> MPUIR_DREGION;
166
167 /* Check for separate d-side and i-side memory maps */
168 if (mpuir & MPUIR_nU)
169 iregions = (mpuir & MPUIR_IREGION_SZMASK) >> MPUIR_IREGION;
170
171 /* Use the smallest of the two maxima */
172 return min(dregions, iregions);
173}
174
175static int mpu_iside_independent(void)
176{
177 /* MPUIR.nU specifies whether there is *not* a unified memory map */
178 return read_cpuid(CPUID_MPUIR) & MPUIR_nU;
179}
180
181static int mpu_min_region_order(void)
182{
183 u32 drbar_result, irbar_result;
184 /* We've kept a region free for this probing */
185 rgnr_write(MPU_PROBE_REGION);
186 isb();
187 /*
188 * As per ARM ARM, write 0xFFFFFFFC to DRBAR to find the minimum
189 * region order
190 */
191 drbar_write(0xFFFFFFFC);
192 drbar_result = irbar_result = drbar_read();
193 drbar_write(0x0);
194 /* If the MPU is non-unified, we use the larger of the two minima*/
195 if (mpu_iside_independent()) {
196 irbar_write(0xFFFFFFFC);
197 irbar_result = irbar_read();
198 irbar_write(0x0);
199 }
200 isb(); /* Ensure that MPU region operations have completed */
201 /* Return whichever result is larger */
202 return __ffs(max(drbar_result, irbar_result));
203}
204
205static int mpu_setup_region(unsigned int number, phys_addr_t start,
206 unsigned int size_order, unsigned int properties)
207{
208 u32 size_data;
209
210 /* We kept a region free for probing resolution of MPU regions*/
211 if (number > mpu_max_regions() || number == MPU_PROBE_REGION)
212 return -ENOENT;
213
214 if (size_order > 32)
215 return -ENOMEM;
216
217 if (size_order < mpu_min_region_order())
218 return -ENOMEM;
219
220 /* Writing N to bits 5:1 (RSR_SZ) specifies region size 2^N+1 */
221 size_data = ((size_order - 1) << MPU_RSR_SZ) | 1 << MPU_RSR_EN;
222
223 dsb(); /* Ensure all previous data accesses occur with old mappings */
224 rgnr_write(number);
225 isb();
226 drbar_write(start);
227 dracr_write(properties);
228 isb(); /* Propagate properties before enabling region */
229 drsr_write(size_data);
230
231 /* Check for independent I-side registers */
232 if (mpu_iside_independent()) {
233 irbar_write(start);
234 iracr_write(properties);
235 isb();
236 irsr_write(size_data);
237 }
238 isb();
239
240 /* Store region info (we treat i/d side the same, so only store d) */
241 mpu_rgn_info.rgns[number].dracr = properties;
242 mpu_rgn_info.rgns[number].drbar = start;
243 mpu_rgn_info.rgns[number].drsr = size_data;
244 return 0;
245}
246
247/*
248* Set up default MPU regions, doing nothing if there is no MPU
249*/
250void __init mpu_setup(void)
251{
252 int region_err;
253 if (!mpu_present())
254 return;
255
256 region_err = mpu_setup_region(MPU_RAM_REGION, PHYS_OFFSET,
257 ilog2(meminfo.bank[0].size),
258 MPU_AP_PL1RW_PL0RW | MPU_RGN_NORMAL);
259 if (region_err) {
260 panic("MPU region initialization failure! %d", region_err);
261 } else {
262 pr_info("Using ARMv7 PMSA Compliant MPU. "
263 "Region independence: %s, Max regions: %d\n",
264 mpu_iside_independent() ? "Yes" : "No",
265 mpu_max_regions());
266 }
267}
268#else
269static void sanity_check_meminfo_mpu(void) {}
270static void __init mpu_setup(void) {}
271#endif /* CONFIG_ARM_MPU */
272
21void __init arm_mm_memblock_reserve(void) 273void __init arm_mm_memblock_reserve(void)
22{ 274{
275#ifndef CONFIG_CPU_V7M
23 /* 276 /*
24 * Register the exception vector page. 277 * Register the exception vector page.
25 * some architectures which the DRAM is the exception vector to trap, 278 * some architectures which the DRAM is the exception vector to trap,
26 * alloc_page breaks with error, although it is not NULL, but "0." 279 * alloc_page breaks with error, although it is not NULL, but "0."
27 */ 280 */
28 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE); 281 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
282#else /* ifndef CONFIG_CPU_V7M */
283 /*
284 * There is no dedicated vector page on V7-M. So nothing needs to be
285 * reserved here.
286 */
287#endif
29} 288}
30 289
31void __init sanity_check_meminfo(void) 290void __init sanity_check_meminfo(void)
32{ 291{
33 phys_addr_t end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]); 292 phys_addr_t end;
293 sanity_check_meminfo_mpu();
294 end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]);
34 high_memory = __va(end - 1) + 1; 295 high_memory = __va(end - 1) + 1;
35} 296}
36 297
@@ -41,6 +302,7 @@ void __init sanity_check_meminfo(void)
41void __init paging_init(struct machine_desc *mdesc) 302void __init paging_init(struct machine_desc *mdesc)
42{ 303{
43 early_trap_init((void *)CONFIG_VECTORS_BASE); 304 early_trap_init((void *)CONFIG_VECTORS_BASE);
305 mpu_setup();
44 bootmem_init(); 306 bootmem_init();
45} 307}
46 308
@@ -57,6 +319,12 @@ void flush_dcache_page(struct page *page)
57} 319}
58EXPORT_SYMBOL(flush_dcache_page); 320EXPORT_SYMBOL(flush_dcache_page);
59 321
322void flush_kernel_dcache_page(struct page *page)
323{
324 __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
325}
326EXPORT_SYMBOL(flush_kernel_dcache_page);
327
60void copy_to_user_page(struct vm_area_struct *vma, struct page *page, 328void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
61 unsigned long uaddr, void *dst, const void *src, 329 unsigned long uaddr, void *dst, const void *src,
62 unsigned long len) 330 unsigned long len)
@@ -81,16 +349,16 @@ void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
81 return __arm_ioremap_pfn(pfn, offset, size, mtype); 349 return __arm_ioremap_pfn(pfn, offset, size, mtype);
82} 350}
83 351
84void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size, 352void __iomem *__arm_ioremap(phys_addr_t phys_addr, size_t size,
85 unsigned int mtype) 353 unsigned int mtype)
86{ 354{
87 return (void __iomem *)phys_addr; 355 return (void __iomem *)phys_addr;
88} 356}
89EXPORT_SYMBOL(__arm_ioremap); 357EXPORT_SYMBOL(__arm_ioremap);
90 358
91void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *); 359void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t, unsigned int, void *);
92 360
93void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, 361void __iomem *__arm_ioremap_caller(phys_addr_t phys_addr, size_t size,
94 unsigned int mtype, void *caller) 362 unsigned int mtype, void *caller)
95{ 363{
96 return __arm_ioremap(phys_addr, size, mtype); 364 return __arm_ioremap(phys_addr, size, mtype);
diff --git a/arch/arm/mm/proc-fa526.S b/arch/arm/mm/proc-fa526.S
index d217e9795d74..aaeb6c127c7a 100644
--- a/arch/arm/mm/proc-fa526.S
+++ b/arch/arm/mm/proc-fa526.S
@@ -81,7 +81,6 @@ ENDPROC(cpu_fa526_reset)
81 */ 81 */
82 .align 4 82 .align 4
83ENTRY(cpu_fa526_do_idle) 83ENTRY(cpu_fa526_do_idle)
84 mcr p15, 0, r0, c7, c0, 4 @ Wait for interrupt
85 mov pc, lr 84 mov pc, lr
86 85
87 86
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index f9a0aa725ea9..e3c48a3fe063 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -333,3 +333,8 @@ ENTRY(\name\()_tlb_fns)
333 .endif 333 .endif
334 .size \name\()_tlb_fns, . - \name\()_tlb_fns 334 .size \name\()_tlb_fns, . - \name\()_tlb_fns
335.endm 335.endm
336
337.macro globl_equ x, y
338 .globl \x
339 .equ \x, \y
340.endm
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 919405e20b80..2d1ef87328a1 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -140,8 +140,10 @@ ENTRY(cpu_v6_set_pte_ext)
140ENTRY(cpu_v6_do_suspend) 140ENTRY(cpu_v6_do_suspend)
141 stmfd sp!, {r4 - r9, lr} 141 stmfd sp!, {r4 - r9, lr}
142 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 142 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
143#ifdef CONFIG_MMU
143 mrc p15, 0, r5, c3, c0, 0 @ Domain ID 144 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
144 mrc p15, 0, r6, c2, c0, 1 @ Translation table base 1 145 mrc p15, 0, r6, c2, c0, 1 @ Translation table base 1
146#endif
145 mrc p15, 0, r7, c1, c0, 1 @ auxiliary control register 147 mrc p15, 0, r7, c1, c0, 1 @ auxiliary control register
146 mrc p15, 0, r8, c1, c0, 2 @ co-processor access control 148 mrc p15, 0, r8, c1, c0, 2 @ co-processor access control
147 mrc p15, 0, r9, c1, c0, 0 @ control register 149 mrc p15, 0, r9, c1, c0, 0 @ control register
@@ -158,14 +160,16 @@ ENTRY(cpu_v6_do_resume)
158 mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID 160 mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID
159 ldmia r0, {r4 - r9} 161 ldmia r0, {r4 - r9}
160 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID 162 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
163#ifdef CONFIG_MMU
161 mcr p15, 0, r5, c3, c0, 0 @ Domain ID 164 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
162 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP) 165 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP)
163 ALT_UP(orr r1, r1, #TTB_FLAGS_UP) 166 ALT_UP(orr r1, r1, #TTB_FLAGS_UP)
164 mcr p15, 0, r1, c2, c0, 0 @ Translation table base 0 167 mcr p15, 0, r1, c2, c0, 0 @ Translation table base 0
165 mcr p15, 0, r6, c2, c0, 1 @ Translation table base 1 168 mcr p15, 0, r6, c2, c0, 1 @ Translation table base 1
169 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
170#endif
166 mcr p15, 0, r7, c1, c0, 1 @ auxiliary control register 171 mcr p15, 0, r7, c1, c0, 1 @ auxiliary control register
167 mcr p15, 0, r8, c1, c0, 2 @ co-processor access control 172 mcr p15, 0, r8, c1, c0, 2 @ co-processor access control
168 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
169 mcr p15, 0, ip, c7, c5, 4 @ ISB 173 mcr p15, 0, ip, c7, c5, 4 @ ISB
170 mov r0, r9 @ control register 174 mov r0, r9 @ control register
171 b cpu_resume_mmu 175 b cpu_resume_mmu
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 363027e811d6..5ffe1956c6d9 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -39,6 +39,14 @@
39#define TTB_FLAGS_SMP (TTB_IRGN_WBWA|TTB_S|TTB_RGN_OC_WBWA) 39#define TTB_FLAGS_SMP (TTB_IRGN_WBWA|TTB_S|TTB_RGN_OC_WBWA)
40#define PMD_FLAGS_SMP (PMD_SECT_WBWA|PMD_SECT_S) 40#define PMD_FLAGS_SMP (PMD_SECT_WBWA|PMD_SECT_S)
41 41
42#ifndef __ARMEB__
43# define rpgdl r0
44# define rpgdh r1
45#else
46# define rpgdl r1
47# define rpgdh r0
48#endif
49
42/* 50/*
43 * cpu_v7_switch_mm(pgd_phys, tsk) 51 * cpu_v7_switch_mm(pgd_phys, tsk)
44 * 52 *
@@ -47,10 +55,10 @@
47 */ 55 */
48ENTRY(cpu_v7_switch_mm) 56ENTRY(cpu_v7_switch_mm)
49#ifdef CONFIG_MMU 57#ifdef CONFIG_MMU
50 mmid r1, r1 @ get mm->context.id 58 mmid r2, r2
51 asid r3, r1 59 asid r2, r2
52 mov r3, r3, lsl #(48 - 32) @ ASID 60 orr rpgdh, rpgdh, r2, lsl #(48 - 32) @ upper 32-bits of pgd
53 mcrr p15, 0, r0, r3, c2 @ set TTB 0 61 mcrr p15, 0, rpgdl, rpgdh, c2 @ set TTB 0
54 isb 62 isb
55#endif 63#endif
56 mov pc, lr 64 mov pc, lr
@@ -106,7 +114,8 @@ ENDPROC(cpu_v7_set_pte_ext)
106 */ 114 */
107 .macro v7_ttb_setup, zero, ttbr0, ttbr1, tmp 115 .macro v7_ttb_setup, zero, ttbr0, ttbr1, tmp
108 ldr \tmp, =swapper_pg_dir @ swapper_pg_dir virtual address 116 ldr \tmp, =swapper_pg_dir @ swapper_pg_dir virtual address
109 cmp \ttbr1, \tmp @ PHYS_OFFSET > PAGE_OFFSET? (branch below) 117 mov \tmp, \tmp, lsr #ARCH_PGD_SHIFT
118 cmp \ttbr1, \tmp @ PHYS_OFFSET > PAGE_OFFSET?
110 mrc p15, 0, \tmp, c2, c0, 2 @ TTB control register 119 mrc p15, 0, \tmp, c2, c0, 2 @ TTB control register
111 orr \tmp, \tmp, #TTB_EAE 120 orr \tmp, \tmp, #TTB_EAE
112 ALT_SMP(orr \tmp, \tmp, #TTB_FLAGS_SMP) 121 ALT_SMP(orr \tmp, \tmp, #TTB_FLAGS_SMP)
@@ -114,27 +123,21 @@ ENDPROC(cpu_v7_set_pte_ext)
114 ALT_SMP(orr \tmp, \tmp, #TTB_FLAGS_SMP << 16) 123 ALT_SMP(orr \tmp, \tmp, #TTB_FLAGS_SMP << 16)
115 ALT_UP(orr \tmp, \tmp, #TTB_FLAGS_UP << 16) 124 ALT_UP(orr \tmp, \tmp, #TTB_FLAGS_UP << 16)
116 /* 125 /*
117 * TTBR0/TTBR1 split (PAGE_OFFSET): 126 * Only use split TTBRs if PHYS_OFFSET <= PAGE_OFFSET (cmp above),
118 * 0x40000000: T0SZ = 2, T1SZ = 0 (not used) 127 * otherwise booting secondary CPUs would end up using TTBR1 for the
119 * 0x80000000: T0SZ = 0, T1SZ = 1 128 * identity mapping set up in TTBR0.
120 * 0xc0000000: T0SZ = 0, T1SZ = 2
121 *
122 * Only use this feature if PHYS_OFFSET <= PAGE_OFFSET, otherwise
123 * booting secondary CPUs would end up using TTBR1 for the identity
124 * mapping set up in TTBR0.
125 */ 129 */
126 bhi 9001f @ PHYS_OFFSET > PAGE_OFFSET? 130 orrls \tmp, \tmp, #TTBR1_SIZE @ TTBCR.T1SZ
127 orr \tmp, \tmp, #(((PAGE_OFFSET >> 30) - 1) << 16) @ TTBCR.T1SZ 131 mcr p15, 0, \tmp, c2, c0, 2 @ TTBCR
128#if defined CONFIG_VMSPLIT_2G 132 mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
129 /* PAGE_OFFSET == 0x80000000, T1SZ == 1 */ 133 mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits
130 add \ttbr1, \ttbr1, #1 << 4 @ skip two L1 entries 134 addls \ttbr1, \ttbr1, #TTBR1_OFFSET
131#elif defined CONFIG_VMSPLIT_3G 135 mcrr p15, 1, \ttbr1, \zero, c2 @ load TTBR1
132 /* PAGE_OFFSET == 0xc0000000, T1SZ == 2 */ 136 mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits
133 add \ttbr1, \ttbr1, #4096 * (1 + 3) @ only L2 used, skip pgd+3*pmd 137 mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits
134#endif 138 mcrr p15, 0, \ttbr0, \zero, c2 @ load TTBR0
135 /* CONFIG_VMSPLIT_1G does not need TTBR1 adjustment */ 139 mcrr p15, 1, \ttbr1, \zero, c2 @ load TTBR1
1369001: mcr p15, 0, \tmp, c2, c0, 2 @ TTB control register 140 mcrr p15, 0, \ttbr0, \zero, c2 @ load TTBR0
137 mcrr p15, 1, \ttbr1, \zero, c2 @ load TTBR1
138 .endm 141 .endm
139 142
140 __CPUINIT 143 __CPUINIT
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 2c73a7301ff7..7ef3ad05df39 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -98,9 +98,11 @@ ENTRY(cpu_v7_do_suspend)
98 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 98 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
99 mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID 99 mrc p15, 0, r5, c13, c0, 3 @ User r/o thread ID
100 stmia r0!, {r4 - r5} 100 stmia r0!, {r4 - r5}
101#ifdef CONFIG_MMU
101 mrc p15, 0, r6, c3, c0, 0 @ Domain ID 102 mrc p15, 0, r6, c3, c0, 0 @ Domain ID
102 mrc p15, 0, r7, c2, c0, 1 @ TTB 1 103 mrc p15, 0, r7, c2, c0, 1 @ TTB 1
103 mrc p15, 0, r11, c2, c0, 2 @ TTB control register 104 mrc p15, 0, r11, c2, c0, 2 @ TTB control register
105#endif
104 mrc p15, 0, r8, c1, c0, 0 @ Control register 106 mrc p15, 0, r8, c1, c0, 0 @ Control register
105 mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register 107 mrc p15, 0, r9, c1, c0, 1 @ Auxiliary control register
106 mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control 108 mrc p15, 0, r10, c1, c0, 2 @ Co-processor access control
@@ -110,13 +112,14 @@ ENDPROC(cpu_v7_do_suspend)
110 112
111ENTRY(cpu_v7_do_resume) 113ENTRY(cpu_v7_do_resume)
112 mov ip, #0 114 mov ip, #0
113 mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs
114 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache 115 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
115 mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID 116 mcr p15, 0, ip, c13, c0, 1 @ set reserved context ID
116 ldmia r0!, {r4 - r5} 117 ldmia r0!, {r4 - r5}
117 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID 118 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
118 mcr p15, 0, r5, c13, c0, 3 @ User r/o thread ID 119 mcr p15, 0, r5, c13, c0, 3 @ User r/o thread ID
119 ldmia r0, {r6 - r11} 120 ldmia r0, {r6 - r11}
121#ifdef CONFIG_MMU
122 mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs
120 mcr p15, 0, r6, c3, c0, 0 @ Domain ID 123 mcr p15, 0, r6, c3, c0, 0 @ Domain ID
121#ifndef CONFIG_ARM_LPAE 124#ifndef CONFIG_ARM_LPAE
122 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP) 125 ALT_SMP(orr r1, r1, #TTB_FLAGS_SMP)
@@ -125,14 +128,15 @@ ENTRY(cpu_v7_do_resume)
125 mcr p15, 0, r1, c2, c0, 0 @ TTB 0 128 mcr p15, 0, r1, c2, c0, 0 @ TTB 0
126 mcr p15, 0, r7, c2, c0, 1 @ TTB 1 129 mcr p15, 0, r7, c2, c0, 1 @ TTB 1
127 mcr p15, 0, r11, c2, c0, 2 @ TTB control register 130 mcr p15, 0, r11, c2, c0, 2 @ TTB control register
128 mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register
129 teq r4, r9 @ Is it already set?
130 mcrne p15, 0, r9, c1, c0, 1 @ No, so write it
131 mcr p15, 0, r10, c1, c0, 2 @ Co-processor access control
132 ldr r4, =PRRR @ PRRR 131 ldr r4, =PRRR @ PRRR
133 ldr r5, =NMRR @ NMRR 132 ldr r5, =NMRR @ NMRR
134 mcr p15, 0, r4, c10, c2, 0 @ write PRRR 133 mcr p15, 0, r4, c10, c2, 0 @ write PRRR
135 mcr p15, 0, r5, c10, c2, 1 @ write NMRR 134 mcr p15, 0, r5, c10, c2, 1 @ write NMRR
135#endif /* CONFIG_MMU */
136 mrc p15, 0, r4, c1, c0, 1 @ Read Auxiliary control register
137 teq r4, r9 @ Is it already set?
138 mcrne p15, 0, r9, c1, c0, 1 @ No, so write it
139 mcr p15, 0, r10, c1, c0, 2 @ Co-processor access control
136 isb 140 isb
137 dsb 141 dsb
138 mov r0, r8 @ control register 142 mov r0, r8 @ control register
@@ -140,6 +144,29 @@ ENTRY(cpu_v7_do_resume)
140ENDPROC(cpu_v7_do_resume) 144ENDPROC(cpu_v7_do_resume)
141#endif 145#endif
142 146
147#ifdef CONFIG_CPU_PJ4B
148 globl_equ cpu_pj4b_switch_mm, cpu_v7_switch_mm
149 globl_equ cpu_pj4b_set_pte_ext, cpu_v7_set_pte_ext
150 globl_equ cpu_pj4b_proc_init, cpu_v7_proc_init
151 globl_equ cpu_pj4b_proc_fin, cpu_v7_proc_fin
152 globl_equ cpu_pj4b_reset, cpu_v7_reset
153#ifdef CONFIG_PJ4B_ERRATA_4742
154ENTRY(cpu_pj4b_do_idle)
155 dsb @ WFI may enter a low-power mode
156 wfi
157 dsb @barrier
158 mov pc, lr
159ENDPROC(cpu_pj4b_do_idle)
160#else
161 globl_equ cpu_pj4b_do_idle, cpu_v7_do_idle
162#endif
163 globl_equ cpu_pj4b_dcache_clean_area, cpu_v7_dcache_clean_area
164 globl_equ cpu_pj4b_do_suspend, cpu_v7_do_suspend
165 globl_equ cpu_pj4b_do_resume, cpu_v7_do_resume
166 globl_equ cpu_pj4b_suspend_size, cpu_v7_suspend_size
167
168#endif
169
143 __CPUINIT 170 __CPUINIT
144 171
145/* 172/*
@@ -155,7 +182,8 @@ ENDPROC(cpu_v7_do_resume)
155 */ 182 */
156__v7_ca5mp_setup: 183__v7_ca5mp_setup:
157__v7_ca9mp_setup: 184__v7_ca9mp_setup:
158 mov r10, #(1 << 0) @ TLB ops broadcasting 185__v7_cr7mp_setup:
186 mov r10, #(1 << 0) @ Cache/TLB ops broadcasting
159 b 1f 187 b 1f
160__v7_ca7mp_setup: 188__v7_ca7mp_setup:
161__v7_ca15mp_setup: 189__v7_ca15mp_setup:
@@ -350,6 +378,9 @@ __v7_setup_stack:
350 378
351 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S) 379 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
352 define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1 380 define_processor_functions v7, dabort=v7_early_abort, pabort=v7_pabort, suspend=1
381#ifdef CONFIG_CPU_PJ4B
382 define_processor_functions pj4b, dabort=v7_early_abort, pabort=v7_pabort, suspend=1
383#endif
353 384
354 .section ".rodata" 385 .section ".rodata"
355 386
@@ -362,7 +393,7 @@ __v7_setup_stack:
362 /* 393 /*
363 * Standard v7 proc info content 394 * Standard v7 proc info content
364 */ 395 */
365.macro __v7_proc initfunc, mm_mmuflags = 0, io_mmuflags = 0, hwcaps = 0 396.macro __v7_proc initfunc, mm_mmuflags = 0, io_mmuflags = 0, hwcaps = 0, proc_fns = v7_processor_functions
366 ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | \ 397 ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | \
367 PMD_SECT_AF | PMD_FLAGS_SMP | \mm_mmuflags) 398 PMD_SECT_AF | PMD_FLAGS_SMP | \mm_mmuflags)
368 ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | \ 399 ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | \
@@ -375,7 +406,7 @@ __v7_setup_stack:
375 .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_FAST_MULT | \ 406 .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_FAST_MULT | \
376 HWCAP_EDSP | HWCAP_TLS | \hwcaps 407 HWCAP_EDSP | HWCAP_TLS | \hwcaps
377 .long cpu_v7_name 408 .long cpu_v7_name
378 .long v7_processor_functions 409 .long \proc_fns
379 .long v7wbi_tlb_fns 410 .long v7wbi_tlb_fns
380 .long v6_user_fns 411 .long v6_user_fns
381 .long v7_cache_fns 412 .long v7_cache_fns
@@ -407,12 +438,24 @@ __v7_ca9mp_proc_info:
407 /* 438 /*
408 * Marvell PJ4B processor. 439 * Marvell PJ4B processor.
409 */ 440 */
441#ifdef CONFIG_CPU_PJ4B
410 .type __v7_pj4b_proc_info, #object 442 .type __v7_pj4b_proc_info, #object
411__v7_pj4b_proc_info: 443__v7_pj4b_proc_info:
412 .long 0x562f5840 444 .long 0x560f5800
413 .long 0xfffffff0 445 .long 0xff0fff00
414 __v7_proc __v7_pj4b_setup 446 __v7_proc __v7_pj4b_setup, proc_fns = pj4b_processor_functions
415 .size __v7_pj4b_proc_info, . - __v7_pj4b_proc_info 447 .size __v7_pj4b_proc_info, . - __v7_pj4b_proc_info
448#endif
449
450 /*
451 * ARM Ltd. Cortex R7 processor.
452 */
453 .type __v7_cr7mp_proc_info, #object
454__v7_cr7mp_proc_info:
455 .long 0x410fc170
456 .long 0xff0ffff0
457 __v7_proc __v7_cr7mp_setup
458 .size __v7_cr7mp_proc_info, . - __v7_cr7mp_proc_info
416 459
417 /* 460 /*
418 * ARM Ltd. Cortex A7 processor. 461 * ARM Ltd. Cortex A7 processor.
diff --git a/arch/arm/mm/proc-v7m.S b/arch/arm/mm/proc-v7m.S
new file mode 100644
index 000000000000..0c93588fcb91
--- /dev/null
+++ b/arch/arm/mm/proc-v7m.S
@@ -0,0 +1,157 @@
1/*
2 * linux/arch/arm/mm/proc-v7m.S
3 *
4 * Copyright (C) 2008 ARM Ltd.
5 * Copyright (C) 2001 Deep Blue Solutions Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This is the "shell" of the ARMv7-M processor support.
12 */
13#include <linux/linkage.h>
14#include <asm/assembler.h>
15#include <asm/v7m.h>
16#include "proc-macros.S"
17
18ENTRY(cpu_v7m_proc_init)
19 mov pc, lr
20ENDPROC(cpu_v7m_proc_init)
21
22ENTRY(cpu_v7m_proc_fin)
23 mov pc, lr
24ENDPROC(cpu_v7m_proc_fin)
25
26/*
27 * cpu_v7m_reset(loc)
28 *
29 * Perform a soft reset of the system. Put the CPU into the
30 * same state as it would be if it had been reset, and branch
31 * to what would be the reset vector.
32 *
33 * - loc - location to jump to for soft reset
34 */
35 .align 5
36ENTRY(cpu_v7m_reset)
37 mov pc, r0
38ENDPROC(cpu_v7m_reset)
39
40/*
41 * cpu_v7m_do_idle()
42 *
43 * Idle the processor (eg, wait for interrupt).
44 *
45 * IRQs are already disabled.
46 */
47ENTRY(cpu_v7m_do_idle)
48 wfi
49 mov pc, lr
50ENDPROC(cpu_v7m_do_idle)
51
52ENTRY(cpu_v7m_dcache_clean_area)
53 mov pc, lr
54ENDPROC(cpu_v7m_dcache_clean_area)
55
56/*
57 * There is no MMU, so here is nothing to do.
58 */
59ENTRY(cpu_v7m_switch_mm)
60 mov pc, lr
61ENDPROC(cpu_v7m_switch_mm)
62
63.globl cpu_v7m_suspend_size
64.equ cpu_v7m_suspend_size, 0
65
66#ifdef CONFIG_ARM_CPU_SUSPEND
67ENTRY(cpu_v7m_do_suspend)
68 mov pc, lr
69ENDPROC(cpu_v7m_do_suspend)
70
71ENTRY(cpu_v7m_do_resume)
72 mov pc, lr
73ENDPROC(cpu_v7m_do_resume)
74#endif
75
76 .section ".text.init", #alloc, #execinstr
77
78/*
79 * __v7m_setup
80 *
81 * This should be able to cover all ARMv7-M cores.
82 */
83__v7m_setup:
84 @ Configure the vector table base address
85 ldr r0, =BASEADDR_V7M_SCB
86 ldr r12, =vector_table
87 str r12, [r0, V7M_SCB_VTOR]
88
89 @ enable UsageFault, BusFault and MemManage fault.
90 ldr r5, [r0, #V7M_SCB_SHCSR]
91 orr r5, #(V7M_SCB_SHCSR_USGFAULTENA | V7M_SCB_SHCSR_BUSFAULTENA | V7M_SCB_SHCSR_MEMFAULTENA)
92 str r5, [r0, #V7M_SCB_SHCSR]
93
94 @ Lower the priority of the SVC and PendSV exceptions
95 mov r5, #0x80000000
96 str r5, [r0, V7M_SCB_SHPR2] @ set SVC priority
97 mov r5, #0x00800000
98 str r5, [r0, V7M_SCB_SHPR3] @ set PendSV priority
99
100 @ SVC to run the kernel in this mode
101 adr r1, BSYM(1f)
102 ldr r5, [r12, #11 * 4] @ read the SVC vector entry
103 str r1, [r12, #11 * 4] @ write the temporary SVC vector entry
104 mov r6, lr @ save LR
105 mov r7, sp @ save SP
106 ldr sp, =__v7m_setup_stack_top
107 cpsie i
108 svc #0
1091: cpsid i
110 str r5, [r12, #11 * 4] @ restore the original SVC vector entry
111 mov lr, r6 @ restore LR
112 mov sp, r7 @ restore SP
113
114 @ Special-purpose control register
115 mov r1, #1
116 msr control, r1 @ Thread mode has unpriviledged access
117
118 @ Configure the System Control Register to ensure 8-byte stack alignment
119 @ Note the STKALIGN bit is either RW or RAO.
120 ldr r12, [r0, V7M_SCB_CCR] @ system control register
121 orr r12, #V7M_SCB_CCR_STKALIGN
122 str r12, [r0, V7M_SCB_CCR]
123 mov pc, lr
124ENDPROC(__v7m_setup)
125
126 define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1
127
128 .section ".rodata"
129 string cpu_arch_name, "armv7m"
130 string cpu_elf_name "v7m"
131 string cpu_v7m_name "ARMv7-M"
132
133 .section ".proc.info.init", #alloc, #execinstr
134
135 /*
136 * Match any ARMv7-M processor core.
137 */
138 .type __v7m_proc_info, #object
139__v7m_proc_info:
140 .long 0x000f0000 @ Required ID value
141 .long 0x000f0000 @ Mask for ID
142 .long 0 @ proc_info_list.__cpu_mm_mmu_flags
143 .long 0 @ proc_info_list.__cpu_io_mmu_flags
144 b __v7m_setup @ proc_info_list.__cpu_flush
145 .long cpu_arch_name
146 .long cpu_elf_name
147 .long HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT
148 .long cpu_v7m_name
149 .long v7m_processor_functions @ proc_info_list.proc
150 .long 0 @ proc_info_list.tlb
151 .long 0 @ proc_info_list.user
152 .long nop_cache_fns @ proc_info_list.cache
153 .size __v7m_proc_info, . - __v7m_proc_info
154
155__v7m_setup_stack:
156 .space 4 * 8 @ 8 registers
157__v7m_setup_stack_top:
diff --git a/arch/arm/plat-iop/adma.c b/arch/arm/plat-iop/adma.c
index 1ff6a37e893c..a4d1f8de3b5b 100644
--- a/arch/arm/plat-iop/adma.c
+++ b/arch/arm/plat-iop/adma.c
@@ -192,12 +192,10 @@ static int __init iop3xx_adma_cap_init(void)
192 192
193 #ifdef CONFIG_ARCH_IOP32X /* the 32x AAU does not perform zero sum */ 193 #ifdef CONFIG_ARCH_IOP32X /* the 32x AAU does not perform zero sum */
194 dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); 194 dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask);
195 dma_cap_set(DMA_MEMSET, iop3xx_aau_data.cap_mask);
196 dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); 195 dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask);
197 #else 196 #else
198 dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask); 197 dma_cap_set(DMA_XOR, iop3xx_aau_data.cap_mask);
199 dma_cap_set(DMA_XOR_VAL, iop3xx_aau_data.cap_mask); 198 dma_cap_set(DMA_XOR_VAL, iop3xx_aau_data.cap_mask);
200 dma_cap_set(DMA_MEMSET, iop3xx_aau_data.cap_mask);
201 dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask); 199 dma_cap_set(DMA_INTERRUPT, iop3xx_aau_data.cap_mask);
202 #endif 200 #endif
203 201
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index ce66eb9be481..f82bae2171eb 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -86,22 +86,6 @@ config OMAP_MUX_WARNINGS
86 to change the pin multiplexing setup. When there are no warnings 86 to change the pin multiplexing setup. When there are no warnings
87 printed, it's safe to deselect OMAP_MUX for your product. 87 printed, it's safe to deselect OMAP_MUX for your product.
88 88
89config OMAP_MBOX_FWK
90 tristate "Mailbox framework support"
91 depends on ARCH_OMAP && !ARCH_MULTIPLATFORM
92 help
93 Say Y here if you want to use OMAP Mailbox framework support for
94 DSP, IVA1.0 and IVA2 in OMAP1/2/3.
95
96config OMAP_MBOX_KFIFO_SIZE
97 int "Mailbox kfifo default buffer size (bytes)"
98 depends on OMAP_MBOX_FWK
99 default 256
100 help
101 Specify the default size of mailbox's kfifo buffers (bytes).
102 This can also be changed at runtime (via the mbox_kfifo_size
103 module parameter).
104
105config OMAP_IOMMU_IVA2 89config OMAP_IOMMU_IVA2
106 bool 90 bool
107 91
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 31199417b56a..0b01b68fd033 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -17,6 +17,3 @@ obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
17i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o 17i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
18obj-y += $(i2c-omap-m) $(i2c-omap-y) 18obj-y += $(i2c-omap-m) $(i2c-omap-y)
19 19
20# OMAP mailbox framework
21obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
22
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index e06c34bdc34a..4d463ca6821f 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -701,8 +701,8 @@ int omap_request_dma(int dev_id, const char *dev_name,
701 for (ch = 0; ch < dma_chan_count; ch++) { 701 for (ch = 0; ch < dma_chan_count; ch++) {
702 if (free_ch == -1 && dma_chan[ch].dev_id == -1) { 702 if (free_ch == -1 && dma_chan[ch].dev_id == -1) {
703 free_ch = ch; 703 free_ch = ch;
704 if (dev_id == 0) 704 /* Exit after first free channel found */
705 break; 705 break;
706 } 706 }
707 } 707 }
708 if (free_ch == -1) { 708 if (free_ch == -1) {
@@ -894,11 +894,12 @@ void omap_start_dma(int lch)
894 int next_lch, cur_lch; 894 int next_lch, cur_lch;
895 char dma_chan_link_map[MAX_LOGICAL_DMA_CH_COUNT]; 895 char dma_chan_link_map[MAX_LOGICAL_DMA_CH_COUNT];
896 896
897 dma_chan_link_map[lch] = 1;
898 /* Set the link register of the first channel */ 897 /* Set the link register of the first channel */
899 enable_lnk(lch); 898 enable_lnk(lch);
900 899
901 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map)); 900 memset(dma_chan_link_map, 0, sizeof(dma_chan_link_map));
901 dma_chan_link_map[lch] = 1;
902
902 cur_lch = dma_chan[lch].next_lch; 903 cur_lch = dma_chan[lch].next_lch;
903 do { 904 do {
904 next_lch = dma_chan[cur_lch].next_lch; 905 next_lch = dma_chan[cur_lch].next_lch;
@@ -2110,8 +2111,6 @@ exit_dma_irq_fail:
2110 } 2111 }
2111 2112
2112exit_dma_lch_fail: 2113exit_dma_lch_fail:
2113 kfree(p);
2114 kfree(d);
2115 kfree(dma_chan); 2114 kfree(dma_chan);
2116 return ret; 2115 return ret;
2117} 2116}
@@ -2132,8 +2131,6 @@ static int omap_system_dma_remove(struct platform_device *pdev)
2132 free_irq(dma_irq, (void *)(irq_rel + 1)); 2131 free_irq(dma_irq, (void *)(irq_rel + 1));
2133 } 2132 }
2134 } 2133 }
2135 kfree(p);
2136 kfree(d);
2137 kfree(dma_chan); 2134 kfree(dma_chan);
2138 return 0; 2135 return 0;
2139} 2136}
diff --git a/arch/arm/plat-omap/include/plat/mailbox.h b/arch/arm/plat-omap/include/plat/mailbox.h
deleted file mode 100644
index cc3921e9059c..000000000000
--- a/arch/arm/plat-omap/include/plat/mailbox.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/* mailbox.h */
2
3#ifndef MAILBOX_H
4#define MAILBOX_H
5
6#include <linux/spinlock.h>
7#include <linux/workqueue.h>
8#include <linux/interrupt.h>
9#include <linux/device.h>
10#include <linux/kfifo.h>
11
12typedef u32 mbox_msg_t;
13struct omap_mbox;
14
15typedef int __bitwise omap_mbox_irq_t;
16#define IRQ_TX ((__force omap_mbox_irq_t) 1)
17#define IRQ_RX ((__force omap_mbox_irq_t) 2)
18
19typedef int __bitwise omap_mbox_type_t;
20#define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1)
21#define OMAP_MBOX_TYPE2 ((__force omap_mbox_type_t) 2)
22
23struct omap_mbox_ops {
24 omap_mbox_type_t type;
25 int (*startup)(struct omap_mbox *mbox);
26 void (*shutdown)(struct omap_mbox *mbox);
27 /* fifo */
28 mbox_msg_t (*fifo_read)(struct omap_mbox *mbox);
29 void (*fifo_write)(struct omap_mbox *mbox, mbox_msg_t msg);
30 int (*fifo_empty)(struct omap_mbox *mbox);
31 int (*fifo_full)(struct omap_mbox *mbox);
32 /* irq */
33 void (*enable_irq)(struct omap_mbox *mbox,
34 omap_mbox_irq_t irq);
35 void (*disable_irq)(struct omap_mbox *mbox,
36 omap_mbox_irq_t irq);
37 void (*ack_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
38 int (*is_irq)(struct omap_mbox *mbox, omap_mbox_irq_t irq);
39 /* ctx */
40 void (*save_ctx)(struct omap_mbox *mbox);
41 void (*restore_ctx)(struct omap_mbox *mbox);
42};
43
44struct omap_mbox_queue {
45 spinlock_t lock;
46 struct kfifo fifo;
47 struct work_struct work;
48 struct tasklet_struct tasklet;
49 struct omap_mbox *mbox;
50 bool full;
51};
52
53struct omap_mbox {
54 char *name;
55 unsigned int irq;
56 struct omap_mbox_queue *txq, *rxq;
57 struct omap_mbox_ops *ops;
58 struct device *dev;
59 void *priv;
60 int use_count;
61 struct blocking_notifier_head notifier;
62};
63
64int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
65void omap_mbox_init_seq(struct omap_mbox *);
66
67struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb);
68void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb);
69
70int omap_mbox_register(struct device *parent, struct omap_mbox **);
71int omap_mbox_unregister(void);
72
73static inline void omap_mbox_save_ctx(struct omap_mbox *mbox)
74{
75 if (!mbox->ops->save_ctx) {
76 dev_err(mbox->dev, "%s:\tno save\n", __func__);
77 return;
78 }
79
80 mbox->ops->save_ctx(mbox);
81}
82
83static inline void omap_mbox_restore_ctx(struct omap_mbox *mbox)
84{
85 if (!mbox->ops->restore_ctx) {
86 dev_err(mbox->dev, "%s:\tno restore\n", __func__);
87 return;
88 }
89
90 mbox->ops->restore_ctx(mbox);
91}
92
93static inline void omap_mbox_enable_irq(struct omap_mbox *mbox,
94 omap_mbox_irq_t irq)
95{
96 mbox->ops->enable_irq(mbox, irq);
97}
98
99static inline void omap_mbox_disable_irq(struct omap_mbox *mbox,
100 omap_mbox_irq_t irq)
101{
102 mbox->ops->disable_irq(mbox, irq);
103}
104
105#endif /* MAILBOX_H */
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
deleted file mode 100644
index 42377ef9ea3d..000000000000
--- a/arch/arm/plat-omap/mailbox.c
+++ /dev/null
@@ -1,435 +0,0 @@
1/*
2 * OMAP mailbox driver
3 *
4 * Copyright (C) 2006-2009 Nokia Corporation. All rights reserved.
5 *
6 * Contact: Hiroshi DOYU <Hiroshi.DOYU@nokia.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 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <linux/interrupt.h>
25#include <linux/spinlock.h>
26#include <linux/mutex.h>
27#include <linux/delay.h>
28#include <linux/slab.h>
29#include <linux/kfifo.h>
30#include <linux/err.h>
31#include <linux/notifier.h>
32#include <linux/module.h>
33
34#include <plat/mailbox.h>
35
36static struct omap_mbox **mboxes;
37
38static int mbox_configured;
39static DEFINE_MUTEX(mbox_configured_lock);
40
41static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE;
42module_param(mbox_kfifo_size, uint, S_IRUGO);
43MODULE_PARM_DESC(mbox_kfifo_size, "Size of omap's mailbox kfifo (bytes)");
44
45/* Mailbox FIFO handle functions */
46static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
47{
48 return mbox->ops->fifo_read(mbox);
49}
50static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
51{
52 mbox->ops->fifo_write(mbox, msg);
53}
54static inline int mbox_fifo_empty(struct omap_mbox *mbox)
55{
56 return mbox->ops->fifo_empty(mbox);
57}
58static inline int mbox_fifo_full(struct omap_mbox *mbox)
59{
60 return mbox->ops->fifo_full(mbox);
61}
62
63/* Mailbox IRQ handle functions */
64static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
65{
66 if (mbox->ops->ack_irq)
67 mbox->ops->ack_irq(mbox, irq);
68}
69static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
70{
71 return mbox->ops->is_irq(mbox, irq);
72}
73
74/*
75 * message sender
76 */
77static int __mbox_poll_for_space(struct omap_mbox *mbox)
78{
79 int ret = 0, i = 1000;
80
81 while (mbox_fifo_full(mbox)) {
82 if (mbox->ops->type == OMAP_MBOX_TYPE2)
83 return -1;
84 if (--i == 0)
85 return -1;
86 udelay(1);
87 }
88 return ret;
89}
90
91int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
92{
93 struct omap_mbox_queue *mq = mbox->txq;
94 int ret = 0, len;
95
96 spin_lock_bh(&mq->lock);
97
98 if (kfifo_avail(&mq->fifo) < sizeof(msg)) {
99 ret = -ENOMEM;
100 goto out;
101 }
102
103 if (kfifo_is_empty(&mq->fifo) && !__mbox_poll_for_space(mbox)) {
104 mbox_fifo_write(mbox, msg);
105 goto out;
106 }
107
108 len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
109 WARN_ON(len != sizeof(msg));
110
111 tasklet_schedule(&mbox->txq->tasklet);
112
113out:
114 spin_unlock_bh(&mq->lock);
115 return ret;
116}
117EXPORT_SYMBOL(omap_mbox_msg_send);
118
119static void mbox_tx_tasklet(unsigned long tx_data)
120{
121 struct omap_mbox *mbox = (struct omap_mbox *)tx_data;
122 struct omap_mbox_queue *mq = mbox->txq;
123 mbox_msg_t msg;
124 int ret;
125
126 while (kfifo_len(&mq->fifo)) {
127 if (__mbox_poll_for_space(mbox)) {
128 omap_mbox_enable_irq(mbox, IRQ_TX);
129 break;
130 }
131
132 ret = kfifo_out(&mq->fifo, (unsigned char *)&msg,
133 sizeof(msg));
134 WARN_ON(ret != sizeof(msg));
135
136 mbox_fifo_write(mbox, msg);
137 }
138}
139
140/*
141 * Message receiver(workqueue)
142 */
143static void mbox_rx_work(struct work_struct *work)
144{
145 struct omap_mbox_queue *mq =
146 container_of(work, struct omap_mbox_queue, work);
147 mbox_msg_t msg;
148 int len;
149
150 while (kfifo_len(&mq->fifo) >= sizeof(msg)) {
151 len = kfifo_out(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
152 WARN_ON(len != sizeof(msg));
153
154 blocking_notifier_call_chain(&mq->mbox->notifier, len,
155 (void *)msg);
156 spin_lock_irq(&mq->lock);
157 if (mq->full) {
158 mq->full = false;
159 omap_mbox_enable_irq(mq->mbox, IRQ_RX);
160 }
161 spin_unlock_irq(&mq->lock);
162 }
163}
164
165/*
166 * Mailbox interrupt handler
167 */
168static void __mbox_tx_interrupt(struct omap_mbox *mbox)
169{
170 omap_mbox_disable_irq(mbox, IRQ_TX);
171 ack_mbox_irq(mbox, IRQ_TX);
172 tasklet_schedule(&mbox->txq->tasklet);
173}
174
175static void __mbox_rx_interrupt(struct omap_mbox *mbox)
176{
177 struct omap_mbox_queue *mq = mbox->rxq;
178 mbox_msg_t msg;
179 int len;
180
181 while (!mbox_fifo_empty(mbox)) {
182 if (unlikely(kfifo_avail(&mq->fifo) < sizeof(msg))) {
183 omap_mbox_disable_irq(mbox, IRQ_RX);
184 mq->full = true;
185 goto nomem;
186 }
187
188 msg = mbox_fifo_read(mbox);
189
190 len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
191 WARN_ON(len != sizeof(msg));
192
193 if (mbox->ops->type == OMAP_MBOX_TYPE1)
194 break;
195 }
196
197 /* no more messages in the fifo. clear IRQ source. */
198 ack_mbox_irq(mbox, IRQ_RX);
199nomem:
200 schedule_work(&mbox->rxq->work);
201}
202
203static irqreturn_t mbox_interrupt(int irq, void *p)
204{
205 struct omap_mbox *mbox = p;
206
207 if (is_mbox_irq(mbox, IRQ_TX))
208 __mbox_tx_interrupt(mbox);
209
210 if (is_mbox_irq(mbox, IRQ_RX))
211 __mbox_rx_interrupt(mbox);
212
213 return IRQ_HANDLED;
214}
215
216static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
217 void (*work) (struct work_struct *),
218 void (*tasklet)(unsigned long))
219{
220 struct omap_mbox_queue *mq;
221
222 mq = kzalloc(sizeof(struct omap_mbox_queue), GFP_KERNEL);
223 if (!mq)
224 return NULL;
225
226 spin_lock_init(&mq->lock);
227
228 if (kfifo_alloc(&mq->fifo, mbox_kfifo_size, GFP_KERNEL))
229 goto error;
230
231 if (work)
232 INIT_WORK(&mq->work, work);
233
234 if (tasklet)
235 tasklet_init(&mq->tasklet, tasklet, (unsigned long)mbox);
236 return mq;
237error:
238 kfree(mq);
239 return NULL;
240}
241
242static void mbox_queue_free(struct omap_mbox_queue *q)
243{
244 kfifo_free(&q->fifo);
245 kfree(q);
246}
247
248static int omap_mbox_startup(struct omap_mbox *mbox)
249{
250 int ret = 0;
251 struct omap_mbox_queue *mq;
252
253 mutex_lock(&mbox_configured_lock);
254 if (!mbox_configured++) {
255 if (likely(mbox->ops->startup)) {
256 ret = mbox->ops->startup(mbox);
257 if (unlikely(ret))
258 goto fail_startup;
259 } else
260 goto fail_startup;
261 }
262
263 if (!mbox->use_count++) {
264 ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED,
265 mbox->name, mbox);
266 if (unlikely(ret)) {
267 pr_err("failed to register mailbox interrupt:%d\n",
268 ret);
269 goto fail_request_irq;
270 }
271 mq = mbox_queue_alloc(mbox, NULL, mbox_tx_tasklet);
272 if (!mq) {
273 ret = -ENOMEM;
274 goto fail_alloc_txq;
275 }
276 mbox->txq = mq;
277
278 mq = mbox_queue_alloc(mbox, mbox_rx_work, NULL);
279 if (!mq) {
280 ret = -ENOMEM;
281 goto fail_alloc_rxq;
282 }
283 mbox->rxq = mq;
284 mq->mbox = mbox;
285
286 omap_mbox_enable_irq(mbox, IRQ_RX);
287 }
288 mutex_unlock(&mbox_configured_lock);
289 return 0;
290
291fail_alloc_rxq:
292 mbox_queue_free(mbox->txq);
293fail_alloc_txq:
294 free_irq(mbox->irq, mbox);
295fail_request_irq:
296 if (mbox->ops->shutdown)
297 mbox->ops->shutdown(mbox);
298 mbox->use_count--;
299fail_startup:
300 mbox_configured--;
301 mutex_unlock(&mbox_configured_lock);
302 return ret;
303}
304
305static void omap_mbox_fini(struct omap_mbox *mbox)
306{
307 mutex_lock(&mbox_configured_lock);
308
309 if (!--mbox->use_count) {
310 omap_mbox_disable_irq(mbox, IRQ_RX);
311 free_irq(mbox->irq, mbox);
312 tasklet_kill(&mbox->txq->tasklet);
313 flush_work(&mbox->rxq->work);
314 mbox_queue_free(mbox->txq);
315 mbox_queue_free(mbox->rxq);
316 }
317
318 if (likely(mbox->ops->shutdown)) {
319 if (!--mbox_configured)
320 mbox->ops->shutdown(mbox);
321 }
322
323 mutex_unlock(&mbox_configured_lock);
324}
325
326struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
327{
328 struct omap_mbox *_mbox, *mbox = NULL;
329 int i, ret;
330
331 if (!mboxes)
332 return ERR_PTR(-EINVAL);
333
334 for (i = 0; (_mbox = mboxes[i]); i++) {
335 if (!strcmp(_mbox->name, name)) {
336 mbox = _mbox;
337 break;
338 }
339 }
340
341 if (!mbox)
342 return ERR_PTR(-ENOENT);
343
344 if (nb)
345 blocking_notifier_chain_register(&mbox->notifier, nb);
346
347 ret = omap_mbox_startup(mbox);
348 if (ret) {
349 blocking_notifier_chain_unregister(&mbox->notifier, nb);
350 return ERR_PTR(-ENODEV);
351 }
352
353 return mbox;
354}
355EXPORT_SYMBOL(omap_mbox_get);
356
357void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb)
358{
359 blocking_notifier_chain_unregister(&mbox->notifier, nb);
360 omap_mbox_fini(mbox);
361}
362EXPORT_SYMBOL(omap_mbox_put);
363
364static struct class omap_mbox_class = { .name = "mbox", };
365
366int omap_mbox_register(struct device *parent, struct omap_mbox **list)
367{
368 int ret;
369 int i;
370
371 mboxes = list;
372 if (!mboxes)
373 return -EINVAL;
374
375 for (i = 0; mboxes[i]; i++) {
376 struct omap_mbox *mbox = mboxes[i];
377 mbox->dev = device_create(&omap_mbox_class,
378 parent, 0, mbox, "%s", mbox->name);
379 if (IS_ERR(mbox->dev)) {
380 ret = PTR_ERR(mbox->dev);
381 goto err_out;
382 }
383
384 BLOCKING_INIT_NOTIFIER_HEAD(&mbox->notifier);
385 }
386 return 0;
387
388err_out:
389 while (i--)
390 device_unregister(mboxes[i]->dev);
391 return ret;
392}
393EXPORT_SYMBOL(omap_mbox_register);
394
395int omap_mbox_unregister(void)
396{
397 int i;
398
399 if (!mboxes)
400 return -EINVAL;
401
402 for (i = 0; mboxes[i]; i++)
403 device_unregister(mboxes[i]->dev);
404 mboxes = NULL;
405 return 0;
406}
407EXPORT_SYMBOL(omap_mbox_unregister);
408
409static int __init omap_mbox_init(void)
410{
411 int err;
412
413 err = class_register(&omap_mbox_class);
414 if (err)
415 return err;
416
417 /* kfifo size sanity check: alignment and minimal size */
418 mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(mbox_msg_t));
419 mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size,
420 sizeof(mbox_msg_t));
421
422 return 0;
423}
424subsys_initcall(omap_mbox_init);
425
426static void __exit omap_mbox_exit(void)
427{
428 class_unregister(&omap_mbox_class);
429}
430module_exit(omap_mbox_exit);
431
432MODULE_LICENSE("GPL v2");
433MODULE_DESCRIPTION("omap mailbox: interrupt driven messaging");
434MODULE_AUTHOR("Toshihiro Kobayashi");
435MODULE_AUTHOR("Hiroshi DOYU");
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index c019b7aaf776..c66d163d7a2a 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -666,14 +666,9 @@ void __init orion_xor0_init(unsigned long mapbase_low,
666 orion_xor0_shared_resources[3].start = irq_1; 666 orion_xor0_shared_resources[3].start = irq_1;
667 orion_xor0_shared_resources[3].end = irq_1; 667 orion_xor0_shared_resources[3].end = irq_1;
668 668
669 /*
670 * two engines can't do memset simultaneously, this limitation
671 * satisfied by removing memset support from one of the engines.
672 */
673 dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[0].cap_mask); 669 dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[0].cap_mask);
674 dma_cap_set(DMA_XOR, orion_xor0_channels_data[0].cap_mask); 670 dma_cap_set(DMA_XOR, orion_xor0_channels_data[0].cap_mask);
675 671
676 dma_cap_set(DMA_MEMSET, orion_xor0_channels_data[1].cap_mask);
677 dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[1].cap_mask); 672 dma_cap_set(DMA_MEMCPY, orion_xor0_channels_data[1].cap_mask);
678 dma_cap_set(DMA_XOR, orion_xor0_channels_data[1].cap_mask); 673 dma_cap_set(DMA_XOR, orion_xor0_channels_data[1].cap_mask);
679 674
@@ -732,14 +727,9 @@ void __init orion_xor1_init(unsigned long mapbase_low,
732 orion_xor1_shared_resources[3].start = irq_1; 727 orion_xor1_shared_resources[3].start = irq_1;
733 orion_xor1_shared_resources[3].end = irq_1; 728 orion_xor1_shared_resources[3].end = irq_1;
734 729
735 /*
736 * two engines can't do memset simultaneously, this limitation
737 * satisfied by removing memset support from one of the engines.
738 */
739 dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[0].cap_mask); 730 dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[0].cap_mask);
740 dma_cap_set(DMA_XOR, orion_xor1_channels_data[0].cap_mask); 731 dma_cap_set(DMA_XOR, orion_xor1_channels_data[0].cap_mask);
741 732
742 dma_cap_set(DMA_MEMSET, orion_xor1_channels_data[1].cap_mask);
743 dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[1].cap_mask); 733 dma_cap_set(DMA_MEMCPY, orion_xor1_channels_data[1].cap_mask);
744 dma_cap_set(DMA_XOR, orion_xor1_channels_data[1].cap_mask); 734 dma_cap_set(DMA_XOR, orion_xor1_channels_data[1].cap_mask);
745 735
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c
index 249fe6333e18..6816192a7561 100644
--- a/arch/arm/plat-orion/gpio.c
+++ b/arch/arm/plat-orion/gpio.c
@@ -426,7 +426,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
426 if (!(cause & (1 << i))) 426 if (!(cause & (1 << i)))
427 continue; 427 continue;
428 428
429 type = irqd_get_trigger_type(irq_get_irq_data(irq)); 429 type = irq_get_trigger_type(irq);
430 if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) { 430 if ((type & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
431 /* Swap polarity (race with GPIO line) */ 431 /* Swap polarity (race with GPIO line) */
432 u32 polarity; 432 u32 polarity;
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index f8ed2de0a678..3dc5cbea86cc 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -6,7 +6,7 @@
6 6
7config PLAT_SAMSUNG 7config PLAT_SAMSUNG
8 bool 8 bool
9 depends on PLAT_S3C24XX || ARCH_S3C64XX || PLAT_S5P 9 depends on PLAT_S3C24XX || ARCH_S3C64XX || PLAT_S5P || ARCH_EXYNOS
10 default y 10 default y
11 select GENERIC_IRQ_CHIP 11 select GENERIC_IRQ_CHIP
12 select NO_IOPORT 12 select NO_IOPORT
@@ -15,12 +15,10 @@ config PLAT_SAMSUNG
15 15
16config PLAT_S5P 16config PLAT_S5P
17 bool 17 bool
18 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) 18 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
19 default y 19 default y
20 select ARCH_REQUIRE_GPIOLIB 20 select ARCH_REQUIRE_GPIOLIB
21 select ARM_GIC if ARCH_EXYNOS 21 select ARM_VIC
22 select ARM_VIC if !ARCH_EXYNOS
23 select GIC_NON_BANKED if ARCH_EXYNOS4
24 select NO_IOPORT 22 select NO_IOPORT
25 select PLAT_SAMSUNG 23 select PLAT_SAMSUNG
26 select S3C_GPIO_TRACK 24 select S3C_GPIO_TRACK
@@ -60,6 +58,20 @@ config S3C_LOWLEVEL_UART_PORT
60 this configuration should be between zero and two. The port 58 this configuration should be between zero and two. The port
61 must have been initialised by the boot-loader before use. 59 must have been initialised by the boot-loader before use.
62 60
61config SAMSUNG_ATAGS
62 def_bool n
63 depends on !ARCH_MULTIPLATFORM
64 depends on ATAGS
65 help
66 This option enables ATAGS based boot support code for
67 Samsung platforms, including static platform devices, legacy
68 clock, timer and interrupt initialization, etc.
69
70 Platforms that support only DT based boot need not to select
71 this option.
72
73if SAMSUNG_ATAGS
74
63# timer options 75# timer options
64 76
65config SAMSUNG_HRT 77config SAMSUNG_HRT
@@ -367,11 +379,6 @@ config S5P_DEV_JPEG
367 help 379 help
368 Compile in platform device definitions for JPEG codec 380 Compile in platform device definitions for JPEG codec
369 381
370config S5P_DEV_MFC
371 bool
372 help
373 Compile in setup memory (init) code for MFC
374
375config S5P_DEV_ONENAND 382config S5P_DEV_ONENAND
376 bool 383 bool
377 help 384 help
@@ -412,6 +419,21 @@ config S3C_DMA
412 help 419 help
413 Internal configuration for S3C DMA core 420 Internal configuration for S3C DMA core
414 421
422config S5P_IRQ_PM
423 bool
424 default y if S5P_PM
425 help
426 Legacy IRQ power management for S5P platforms
427
428config SAMSUNG_PM_GPIO
429 bool
430 default y if GPIO_SAMSUNG && PM
431 help
432 Include legacy GPIO power management code for platforms not using
433 pinctrl-samsung driver.
434
435endif
436
415config SAMSUNG_DMADEV 437config SAMSUNG_DMADEV
416 bool 438 bool
417 select ARM_AMBA 439 select ARM_AMBA
@@ -421,6 +443,11 @@ config SAMSUNG_DMADEV
421 help 443 help
422 Use DMA device engine for PL330 DMAC. 444 Use DMA device engine for PL330 DMAC.
423 445
446config S5P_DEV_MFC
447 bool
448 help
449 Compile in setup memory (init) code for MFC
450
424comment "Power management" 451comment "Power management"
425 452
426config SAMSUNG_PM_DEBUG 453config SAMSUNG_PM_DEBUG
@@ -475,6 +502,12 @@ config SAMSUNG_WAKEMASK
475 and above. This code allows a set of interrupt to wakeup-mask 502 and above. This code allows a set of interrupt to wakeup-mask
476 mappings. See <plat/wakeup-mask.h> 503 mappings. See <plat/wakeup-mask.h>
477 504
505config SAMSUNG_WDT_RESET
506 bool
507 help
508 Compile support for system restart by triggering watchdog reset.
509 Used on SoCs that do not provide dedicated reset control.
510
478config S5P_PM 511config S5P_PM
479 bool 512 bool
480 help 513 help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index a23c460299a1..98d07d8fc7a7 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -31,10 +31,10 @@ obj-$(CONFIG_S3C_ADC) += adc.o
31 31
32# devices 32# devices
33 33
34obj-y += platformdata.o 34obj-$(CONFIG_SAMSUNG_ATAGS) += platformdata.o
35 35
36obj-y += devs.o 36obj-$(CONFIG_SAMSUNG_ATAGS) += devs.o
37obj-y += dev-uart.o 37obj-$(CONFIG_SAMSUNG_ATAGS) += dev-uart.o
38obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o 38obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o
39obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o 39obj-$(CONFIG_S5P_DEV_UART) += s5p-dev-uart.o
40 40
@@ -52,10 +52,12 @@ obj-$(CONFIG_SAMSUNG_DMADEV) += dma-ops.o
52# PM support 52# PM support
53 53
54obj-$(CONFIG_PM) += pm.o 54obj-$(CONFIG_PM) += pm.o
55obj-$(CONFIG_PM) += pm-gpio.o 55obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o
56obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o 56obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o
57 57
58obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o 58obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o
59obj-$(CONFIG_SAMSUNG_WDT_RESET) += watchdog-reset.o
59 60
60obj-$(CONFIG_S5P_PM) += s5p-pm.o s5p-irq-pm.o 61obj-$(CONFIG_S5P_PM) += s5p-pm.o
62obj-$(CONFIG_S5P_IRQ_PM) += s5p-irq-pm.o
61obj-$(CONFIG_S5P_SLEEP) += s5p-sleep.o 63obj-$(CONFIG_S5P_SLEEP) += s5p-sleep.o
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
index 95509d8eb140..7231c8e4975e 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq-core.h
@@ -202,7 +202,7 @@ extern int s3c_plltab_register(struct cpufreq_frequency_table *plls,
202extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void); 202extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
203extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void); 203extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
204 204
205#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS 205#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS
206#define s3c_cpufreq_debugfs_call(x) x 206#define s3c_cpufreq_debugfs_call(x) x
207#else 207#else
208#define s3c_cpufreq_debugfs_call(x) NULL 208#define s3c_cpufreq_debugfs_call(x) NULL
@@ -259,17 +259,17 @@ extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
259#define s3c2412_iotiming_set NULL 259#define s3c2412_iotiming_set NULL
260#endif /* CONFIG_S3C2412_IOTIMING */ 260#endif /* CONFIG_S3C2412_IOTIMING */
261 261
262#ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUG 262#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG
263#define s3c_freq_dbg(x...) printk(KERN_INFO x) 263#define s3c_freq_dbg(x...) printk(KERN_INFO x)
264#else 264#else
265#define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0) 265#define s3c_freq_dbg(x...) do { if (0) printk(x); } while (0)
266#endif /* CONFIG_CPU_FREQ_S3C24XX_DEBUG */ 266#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_DEBUG */
267 267
268#ifdef CONFIG_CPU_FREQ_S3C24XX_IODEBUG 268#ifdef CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG
269#define s3c_freq_iodbg(x...) printk(KERN_INFO x) 269#define s3c_freq_iodbg(x...) printk(KERN_INFO x)
270#else 270#else
271#define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0) 271#define s3c_freq_iodbg(x...) do { if (0) printk(x); } while (0)
272#endif /* CONFIG_CPU_FREQ_S3C24XX_IODEBUG */ 272#endif /* CONFIG_ARM_S3C24XX_CPUFREQ_IODEBUG */
273 273
274static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table, 274static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
275 int index, size_t table_size, 275 int index, size_t table_size,
@@ -285,7 +285,7 @@ static inline int s3c_cpufreq_addfreq(struct cpufreq_frequency_table *table,
285 s3c_freq_dbg("%s: { %d = %u kHz }\n", 285 s3c_freq_dbg("%s: { %d = %u kHz }\n",
286 __func__, index, freq); 286 __func__, index, freq);
287 287
288 table[index].index = index; 288 table[index].driver_data = index;
289 table[index].frequency = freq; 289 table[index].frequency = freq;
290 } 290 }
291 291
diff --git a/arch/arm/plat-samsung/include/plat/cpu-freq.h b/arch/arm/plat-samsung/include/plat/cpu-freq.h
index 80c4a809c721..85517ab962ae 100644
--- a/arch/arm/plat-samsung/include/plat/cpu-freq.h
+++ b/arch/arm/plat-samsung/include/plat/cpu-freq.h
@@ -126,7 +126,7 @@ struct s3c_cpufreq_board {
126}; 126};
127 127
128/* Things depending on frequency scaling. */ 128/* Things depending on frequency scaling. */
129#ifdef CONFIG_CPU_FREQ_S3C 129#ifdef CONFIG_ARM_S3C_CPUFREQ
130#define __init_or_cpufreq 130#define __init_or_cpufreq
131#else 131#else
132#define __init_or_cpufreq __init 132#define __init_or_cpufreq __init
@@ -134,7 +134,7 @@ struct s3c_cpufreq_board {
134 134
135/* Board functions */ 135/* Board functions */
136 136
137#ifdef CONFIG_CPU_FREQ_S3C 137#ifdef CONFIG_ARM_S3C_CPUFREQ
138extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board); 138extern int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board);
139#else 139#else
140 140
@@ -142,4 +142,4 @@ static inline int s3c_cpufreq_setboard(struct s3c_cpufreq_board *board)
142{ 142{
143 return 0; 143 return 0;
144} 144}
145#endif /* CONFIG_CPU_FREQ_S3C */ 145#endif /* CONFIG_ARM_S3C_CPUFREQ */
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 989fefe18be6..4fb1f03a10d1 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -46,6 +46,7 @@ extern unsigned long samsung_cpu_id;
46#define EXYNOS4_CPU_MASK 0xFFFE0000 46#define EXYNOS4_CPU_MASK 0xFFFE0000
47 47
48#define EXYNOS5250_SOC_ID 0x43520000 48#define EXYNOS5250_SOC_ID 0x43520000
49#define EXYNOS5420_SOC_ID 0xE5420000
49#define EXYNOS5440_SOC_ID 0xE5440000 50#define EXYNOS5440_SOC_ID 0xE5440000
50#define EXYNOS5_SOC_MASK 0xFFFFF000 51#define EXYNOS5_SOC_MASK 0xFFFFF000
51 52
@@ -67,6 +68,7 @@ IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
67IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) 68IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
68IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) 69IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
69IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK) 70IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
71IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
70IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) 72IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
71 73
72#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 74#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
@@ -142,6 +144,12 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
142# define soc_is_exynos5250() 0 144# define soc_is_exynos5250() 0
143#endif 145#endif
144 146
147#if defined(CONFIG_SOC_EXYNOS5420)
148# define soc_is_exynos5420() is_samsung_exynos5420()
149#else
150# define soc_is_exynos5420() 0
151#endif
152
145#if defined(CONFIG_SOC_EXYNOS5440) 153#if defined(CONFIG_SOC_EXYNOS5440)
146# define soc_is_exynos5440() is_samsung_exynos5440() 154# define soc_is_exynos5440() is_samsung_exynos5440()
147#else 155#else
diff --git a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
index d01576318b2c..bd3a6db14cbb 100644
--- a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
+++ b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h
@@ -28,7 +28,6 @@ struct s3c24xx_dma_map {
28 const char *name; 28 const char *name;
29 29
30 unsigned long channels[S3C_DMA_CHANNELS]; 30 unsigned long channels[S3C_DMA_CHANNELS];
31 unsigned long channels_rx[S3C_DMA_CHANNELS];
32}; 31};
33 32
34struct s3c24xx_dma_selection { 33struct s3c24xx_dma_selection {
@@ -38,10 +37,6 @@ struct s3c24xx_dma_selection {
38 37
39 void (*select)(struct s3c2410_dma_chan *chan, 38 void (*select)(struct s3c2410_dma_chan *chan,
40 struct s3c24xx_dma_map *map); 39 struct s3c24xx_dma_map *map);
41
42 void (*direction)(struct s3c2410_dma_chan *chan,
43 struct s3c24xx_dma_map *map,
44 enum dma_data_direction dir);
45}; 40};
46 41
47extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel); 42extern int s3c24xx_dma_init_map(struct s3c24xx_dma_selection *sel);
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index f6fcadeee969..5d47ca35cabd 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -166,6 +166,7 @@ extern void s3c_pm_check_store(void);
166 */ 166 */
167extern void s3c_pm_configure_extint(void); 167extern void s3c_pm_configure_extint(void);
168 168
169#ifdef CONFIG_GPIO_SAMSUNG
169/** 170/**
170 * samsung_pm_restore_gpios() - restore the state of the gpios after sleep. 171 * samsung_pm_restore_gpios() - restore the state of the gpios after sleep.
171 * 172 *
@@ -181,6 +182,10 @@ extern void samsung_pm_restore_gpios(void);
181 * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios(). 182 * Save the GPIO states for resotration on resume. See samsung_pm_restore_gpios().
182 */ 183 */
183extern void samsung_pm_save_gpios(void); 184extern void samsung_pm_save_gpios(void);
185#else
186static inline void samsung_pm_restore_gpios(void) {}
187static inline void samsung_pm_save_gpios(void) {}
188#endif
184 189
185extern void s3c_pm_save_core(void); 190extern void s3c_pm_save_core(void);
186extern void s3c_pm_restore_core(void); 191extern void s3c_pm_restore_core(void);
diff --git a/arch/arm/plat-samsung/include/plat/regs-watchdog.h b/arch/arm/plat-samsung/include/plat/regs-watchdog.h
deleted file mode 100644
index 4938492470f7..000000000000
--- a/arch/arm/plat-samsung/include/plat/regs-watchdog.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/* arch/arm/mach-s3c2410/include/mach/regs-watchdog.h
2 *
3 * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2410 Watchdog timer control
11*/
12
13
14#ifndef __ASM_ARCH_REGS_WATCHDOG_H
15#define __ASM_ARCH_REGS_WATCHDOG_H
16
17#define S3C_WDOGREG(x) ((x) + S3C_VA_WATCHDOG)
18
19#define S3C2410_WTCON S3C_WDOGREG(0x00)
20#define S3C2410_WTDAT S3C_WDOGREG(0x04)
21#define S3C2410_WTCNT S3C_WDOGREG(0x08)
22
23/* the watchdog can either generate a reset pulse, or an
24 * interrupt.
25 */
26
27#define S3C2410_WTCON_RSTEN (0x01)
28#define S3C2410_WTCON_INTEN (1<<2)
29#define S3C2410_WTCON_ENABLE (1<<5)
30
31#define S3C2410_WTCON_DIV16 (0<<3)
32#define S3C2410_WTCON_DIV32 (1<<3)
33#define S3C2410_WTCON_DIV64 (2<<3)
34#define S3C2410_WTCON_DIV128 (3<<3)
35
36#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
37#define S3C2410_WTCON_PRESCALE_MASK (0xff00)
38
39#endif /* __ASM_ARCH_REGS_WATCHDOG_H */
40
41
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index 02b66d723d1a..4afc32f90b6d 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -21,6 +21,8 @@ typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
21unsigned int fifo_mask; 21unsigned int fifo_mask;
22unsigned int fifo_max; 22unsigned int fifo_max;
23 23
24volatile u8 *uart_base;
25
24/* forward declerations */ 26/* forward declerations */
25 27
26static void arch_detect_cpu(void); 28static void arch_detect_cpu(void);
@@ -28,19 +30,24 @@ static void arch_detect_cpu(void);
28/* defines for UART registers */ 30/* defines for UART registers */
29 31
30#include <plat/regs-serial.h> 32#include <plat/regs-serial.h>
31#include <plat/regs-watchdog.h>
32 33
33/* working in physical space... */ 34/* working in physical space... */
34#undef S3C2410_WDOGREG 35#define S3C_WDOGREG(x) ((S3C_PA_WDT + (x)))
35#define S3C2410_WDOGREG(x) ((S3C24XX_PA_WATCHDOG + (x))) 36
37#define S3C2410_WTCON S3C_WDOGREG(0x00)
38#define S3C2410_WTDAT S3C_WDOGREG(0x04)
39#define S3C2410_WTCNT S3C_WDOGREG(0x08)
40
41#define S3C2410_WTCON_RSTEN (1 << 0)
42#define S3C2410_WTCON_ENABLE (1 << 5)
43
44#define S3C2410_WTCON_DIV128 (3 << 3)
45
46#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
36 47
37/* how many bytes we allow into the FIFO at a time in FIFO mode */ 48/* how many bytes we allow into the FIFO at a time in FIFO mode */
38#define FIFO_MAX (14) 49#define FIFO_MAX (14)
39 50
40#ifdef S3C_PA_UART
41#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT)
42#endif
43
44static __inline__ void 51static __inline__ void
45uart_wr(unsigned int reg, unsigned int val) 52uart_wr(unsigned int reg, unsigned int val)
46{ 53{
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
index bc4db9b04e36..0386b8f76623 100644
--- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
+++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
@@ -10,37 +10,11 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13#include <plat/clock.h> 13#ifndef __PLAT_SAMSUNG_WATCHDOG_RESET_H
14#include <plat/regs-watchdog.h> 14#define __PLAT_SAMSUNG_WATCHDOG_RESET_H
15#include <mach/map.h>
16 15
17#include <linux/clk.h> 16extern void samsung_wdt_reset(void);
18#include <linux/err.h> 17extern void samsung_wdt_reset_of_init(void);
19#include <linux/io.h> 18extern void samsung_wdt_reset_init(void __iomem *base);
20#include <linux/delay.h>
21 19
22static inline void arch_wdt_reset(void) 20#endif /* __PLAT_SAMSUNG_WATCHDOG_RESET_H */
23{
24 printk("arch_reset: attempting watchdog reset\n");
25
26 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
27
28 if (!IS_ERR(s3c2410_wdtclk))
29 clk_enable(s3c2410_wdtclk);
30
31 /* put initial values into count and data */
32 __raw_writel(0x80, S3C2410_WTCNT);
33 __raw_writel(0x80, S3C2410_WTDAT);
34
35 /* set the watchdog to go and reset... */
36 __raw_writel(S3C2410_WTCON_ENABLE|S3C2410_WTCON_DIV16|S3C2410_WTCON_RSTEN |
37 S3C2410_WTCON_PRESCALE(0x20), S3C2410_WTCON);
38
39 /* wait for reset to assert... */
40 mdelay(500);
41
42 printk(KERN_ERR "Watchdog reset failed to assert reset\n");
43
44 /* delay to allow the serial port to show the message */
45 mdelay(50);
46}
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index 79d10fca9090..3e5c4619caa5 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -87,7 +87,7 @@ void __init s3c24xx_init_clocks(int xtal)
87} 87}
88 88
89/* uart management */ 89/* uart management */
90 90#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
91static int nr_uarts __initdata = 0; 91static int nr_uarts __initdata = 0;
92 92
93static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS]; 93static struct s3c2410_uartcfg uart_cfgs[CONFIG_SERIAL_SAMSUNG_UARTS];
@@ -134,11 +134,12 @@ void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no)
134 if (cpu == NULL) 134 if (cpu == NULL)
135 return; 135 return;
136 136
137 if (cpu->init_uarts == NULL) { 137 if (cpu->init_uarts == NULL && IS_ENABLED(CONFIG_SAMSUNG_ATAGS)) {
138 printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n"); 138 printk(KERN_ERR "s3c24xx_init_uarts: cpu has no uart init\n");
139 } else 139 } else
140 (cpu->init_uarts)(cfg, no); 140 (cpu->init_uarts)(cfg, no);
141} 141}
142#endif
142 143
143static int __init s3c_arch_init(void) 144static int __init s3c_arch_init(void)
144{ 145{
@@ -152,8 +153,9 @@ static int __init s3c_arch_init(void)
152 ret = (cpu->init)(); 153 ret = (cpu->init)();
153 if (ret != 0) 154 if (ret != 0)
154 return ret; 155 return ret;
155 156#if IS_ENABLED(CONFIG_SAMSUNG_ATAGS)
156 ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts); 157 ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
158#endif
157 return ret; 159 return ret;
158} 160}
159 161
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index c2ff92c30bdf..a8de3cfe2ee1 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -192,7 +192,8 @@ struct samsung_gpio_pm samsung_gpio_pm_2bit = {
192 .resume = samsung_gpio_pm_2bit_resume, 192 .resume = samsung_gpio_pm_2bit_resume,
193}; 193};
194 194
195#if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P) 195#if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P) \
196 || defined(CONFIG_ARCH_EXYNOS)
196static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip) 197static void samsung_gpio_pm_4bit_save(struct samsung_gpio_chip *chip)
197{ 198{
198 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); 199 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
@@ -302,7 +303,7 @@ struct samsung_gpio_pm samsung_gpio_pm_4bit = {
302 .save = samsung_gpio_pm_4bit_save, 303 .save = samsung_gpio_pm_4bit_save,
303 .resume = samsung_gpio_pm_4bit_resume, 304 .resume = samsung_gpio_pm_4bit_resume,
304}; 305};
305#endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P */ 306#endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P || CONFIG_ARCH_EXYNOS */
306 307
307/** 308/**
308 * samsung_pm_save_gpio() - save gpio chip data for suspend 309 * samsung_pm_save_gpio() - save gpio chip data for suspend
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 53210ec4e8ec..ea3613642451 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -16,18 +16,23 @@
16#include <linux/suspend.h> 16#include <linux/suspend.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/of.h>
19#include <linux/serial_core.h> 20#include <linux/serial_core.h>
20#include <linux/io.h> 21#include <linux/io.h>
21 22
22#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
23#include <asm/suspend.h> 24#include <asm/suspend.h>
24#include <mach/hardware.h>
25#include <mach/map.h>
26 25
27#include <plat/regs-serial.h> 26#include <plat/regs-serial.h>
27
28#ifdef CONFIG_SAMSUNG_ATAGS
29#include <mach/hardware.h>
30#include <mach/map.h>
28#include <mach/regs-clock.h> 31#include <mach/regs-clock.h>
29#include <mach/regs-irq.h> 32#include <mach/regs-irq.h>
30#include <mach/irqs.h> 33#include <mach/irqs.h>
34#endif
35
31#include <asm/irq.h> 36#include <asm/irq.h>
32 37
33#include <plat/pm.h> 38#include <plat/pm.h>
@@ -261,7 +266,8 @@ static int s3c_pm_enter(suspend_state_t state)
261 * require a full power-cycle) 266 * require a full power-cycle)
262 */ 267 */
263 268
264 if (!any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) && 269 if (!of_have_populated_dt() &&
270 !any_allowed(s3c_irqwake_intmask, s3c_irqwake_intallow) &&
265 !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) { 271 !any_allowed(s3c_irqwake_eintmask, s3c_irqwake_eintallow)) {
266 printk(KERN_ERR "%s: No wake-up sources!\n", __func__); 272 printk(KERN_ERR "%s: No wake-up sources!\n", __func__);
267 printk(KERN_ERR "%s: Aborting sleep\n", __func__); 273 printk(KERN_ERR "%s: Aborting sleep\n", __func__);
@@ -270,8 +276,11 @@ static int s3c_pm_enter(suspend_state_t state)
270 276
271 /* save all necessary core registers not covered by the drivers */ 277 /* save all necessary core registers not covered by the drivers */
272 278
273 samsung_pm_save_gpios(); 279 if (!of_have_populated_dt()) {
274 samsung_pm_saved_gpios(); 280 samsung_pm_save_gpios();
281 samsung_pm_saved_gpios();
282 }
283
275 s3c_pm_save_uarts(); 284 s3c_pm_save_uarts();
276 s3c_pm_save_core(); 285 s3c_pm_save_core();
277 286
@@ -310,8 +319,11 @@ static int s3c_pm_enter(suspend_state_t state)
310 319
311 s3c_pm_restore_core(); 320 s3c_pm_restore_core();
312 s3c_pm_restore_uarts(); 321 s3c_pm_restore_uarts();
313 samsung_pm_restore_gpios(); 322
314 s3c_pm_restored_gpios(); 323 if (!of_have_populated_dt()) {
324 samsung_pm_restore_gpios();
325 s3c_pm_restored_gpios();
326 }
315 327
316 s3c_pm_debug_init(); 328 s3c_pm_debug_init();
317 329
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index a93fb6fb6606..ad51f85fbd01 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -17,10 +17,12 @@
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
20#include <mach/map.h> 23#include <mach/map.h>
21#include <mach/irqs.h> 24#include <mach/irqs.h>
22#include <plat/devs.h> 25#include <plat/devs.h>
23#include <plat/mfc.h>
24 26
25static struct resource s5p_mfc_resource[] = { 27static struct resource s5p_mfc_resource[] = {
26 [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K), 28 [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K),
@@ -61,6 +63,10 @@ struct platform_device s5p_device_mfc_r = {
61 .coherent_dma_mask = DMA_BIT_MASK(32), 63 .coherent_dma_mask = DMA_BIT_MASK(32),
62 }, 64 },
63}; 65};
66#else
67static struct platform_device s5p_device_mfc_l;
68static struct platform_device s5p_device_mfc_r;
69#endif
64 70
65struct s5p_mfc_reserved_mem { 71struct s5p_mfc_reserved_mem {
66 phys_addr_t base; 72 phys_addr_t base;
@@ -70,6 +76,7 @@ struct s5p_mfc_reserved_mem {
70 76
71static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata; 77static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata;
72 78
79
73void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, 80void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
74 phys_addr_t lbase, unsigned int lsize) 81 phys_addr_t lbase, unsigned int lsize)
75{ 82{
@@ -93,6 +100,7 @@ void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
93 } 100 }
94} 101}
95 102
103#ifdef CONFIG_SAMSUNG_ATAGS
96static int __init s5p_mfc_memory_init(void) 104static int __init s5p_mfc_memory_init(void)
97{ 105{
98 int i; 106 int i;
@@ -111,6 +119,7 @@ static int __init s5p_mfc_memory_init(void)
111 return 0; 119 return 0;
112} 120}
113device_initcall(s5p_mfc_memory_init); 121device_initcall(s5p_mfc_memory_init);
122#endif
114 123
115#ifdef CONFIG_OF 124#ifdef CONFIG_OF
116int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname, 125int __init s5p_fdt_find_mfc_mem(unsigned long node, const char *uname,
diff --git a/arch/arm/plat-samsung/watchdog-reset.c b/arch/arm/plat-samsung/watchdog-reset.c
new file mode 100644
index 000000000000..2ecb50bea044
--- /dev/null
+++ b/arch/arm/plat-samsung/watchdog-reset.c
@@ -0,0 +1,97 @@
1/* arch/arm/plat-samsung/watchdog-reset.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Coyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
7 *
8 * Watchdog reset support for Samsung SoCs.
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/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18#include <linux/delay.h>
19#include <linux/of.h>
20#include <linux/of_address.h>
21
22#define S3C2410_WTCON 0x00
23#define S3C2410_WTDAT 0x04
24#define S3C2410_WTCNT 0x08
25
26#define S3C2410_WTCON_ENABLE (1 << 5)
27#define S3C2410_WTCON_DIV16 (0 << 3)
28#define S3C2410_WTCON_RSTEN (1 << 0)
29#define S3C2410_WTCON_PRESCALE(x) ((x) << 8)
30
31static void __iomem *wdt_base;
32static struct clk *wdt_clock;
33
34void samsung_wdt_reset(void)
35{
36 if (!wdt_base) {
37 pr_err("%s: wdt reset not initialized\n", __func__);
38 /* delay to allow the serial port to show the message */
39 mdelay(50);
40 return;
41 }
42
43 if (!IS_ERR(wdt_clock))
44 clk_prepare_enable(wdt_clock);
45
46 /* disable watchdog, to be safe */
47 __raw_writel(0, wdt_base + S3C2410_WTCON);
48
49 /* put initial values into count and data */
50 __raw_writel(0x80, wdt_base + S3C2410_WTCNT);
51 __raw_writel(0x80, wdt_base + S3C2410_WTDAT);
52
53 /* set the watchdog to go and reset... */
54 __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV16 |
55 S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x20),
56 wdt_base + S3C2410_WTCON);
57
58 /* wait for reset to assert... */
59 mdelay(500);
60
61 pr_err("Watchdog reset failed to assert reset\n");
62
63 /* delay to allow the serial port to show the message */
64 mdelay(50);
65}
66
67#ifdef CONFIG_OF
68static const struct of_device_id s3c2410_wdt_match[] = {
69 { .compatible = "samsung,s3c2410-wdt" },
70 {},
71};
72
73void __init samsung_wdt_reset_of_init(void)
74{
75 struct device_node *np;
76
77 np = of_find_matching_node(NULL, s3c2410_wdt_match);
78 if (!np) {
79 pr_err("%s: failed to find watchdog node\n", __func__);
80 return;
81 }
82
83 wdt_base = of_iomap(np, 0);
84 if (!wdt_base) {
85 pr_err("%s: failed to map watchdog registers\n", __func__);
86 return;
87 }
88
89 wdt_clock = of_clk_get(np, 0);
90}
91#endif
92
93void __init samsung_wdt_reset_init(void __iomem *base)
94{
95 wdt_base = base;
96 wdt_clock = clk_get(NULL, "watchdog");
97}
diff --git a/arch/arm/plat-versatile/headsmp.S b/arch/arm/plat-versatile/headsmp.S
index b178d44e9eaa..2677bc3762d7 100644
--- a/arch/arm/plat-versatile/headsmp.S
+++ b/arch/arm/plat-versatile/headsmp.S
@@ -11,8 +11,6 @@
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14 __INIT
15
16/* 14/*
17 * Realview/Versatile Express specific entry point for secondary CPUs. 15 * Realview/Versatile Express specific entry point for secondary CPUs.
18 * This provides a "holding pen" into which all secondary cores are held 16 * This provides a "holding pen" into which all secondary cores are held
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 56b3f6d447ae..4143d9b0d87a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -7,6 +7,7 @@ config ARM64
7 select ARM_AMBA 7 select ARM_AMBA
8 select ARM_ARCH_TIMER 8 select ARM_ARCH_TIMER
9 select ARM_GIC 9 select ARM_GIC
10 select BUILDTIME_EXTABLE_SORT
10 select CLONE_BACKWARDS 11 select CLONE_BACKWARDS
11 select COMMON_CLK 12 select COMMON_CLK
12 select GENERIC_CLOCKEVENTS 13 select GENERIC_CLOCKEVENTS
@@ -111,6 +112,11 @@ config ARCH_VEXPRESS
111 This enables support for the ARMv8 software model (Versatile 112 This enables support for the ARMv8 software model (Versatile
112 Express). 113 Express).
113 114
115config ARCH_XGENE
116 bool "AppliedMicro X-Gene SOC Family"
117 help
118 This enables support for AppliedMicro X-Gene SOC Family
119
114endmenu 120endmenu
115 121
116menu "Bus support" 122menu "Bus support"
@@ -148,6 +154,8 @@ config NR_CPUS
148 int "Maximum number of CPUs (2-32)" 154 int "Maximum number of CPUs (2-32)"
149 range 2 32 155 range 2 32
150 depends on SMP 156 depends on SMP
157 # These have to remain sorted largest to smallest
158 default "8" if ARCH_XGENE
151 default "4" 159 default "4"
152 160
153source kernel/Kconfig.preempt 161source kernel/Kconfig.preempt
@@ -180,8 +188,35 @@ config HW_PERF_EVENTS
180 Enable hardware performance counter support for perf events. If 188 Enable hardware performance counter support for perf events. If
181 disabled, perf events will use software events only. 189 disabled, perf events will use software events only.
182 190
191config SYS_SUPPORTS_HUGETLBFS
192 def_bool y
193
194config ARCH_WANT_GENERAL_HUGETLB
195 def_bool y
196
197config ARCH_WANT_HUGE_PMD_SHARE
198 def_bool y if !ARM64_64K_PAGES
199
200config HAVE_ARCH_TRANSPARENT_HUGEPAGE
201 def_bool y
202
183source "mm/Kconfig" 203source "mm/Kconfig"
184 204
205config XEN_DOM0
206 def_bool y
207 depends on XEN
208
209config XEN
210 bool "Xen guest support on ARM64 (EXPERIMENTAL)"
211 depends on ARM64 && OF
212 help
213 Say Y if you want to run Linux in a Virtual Machine on Xen on ARM64.
214
215config FORCE_MAX_ZONEORDER
216 int
217 default "14" if (ARM64_64K_PAGES && TRANSPARENT_HUGEPAGE)
218 default "11"
219
185endmenu 220endmenu
186 221
187menu "Boot options" 222menu "Boot options"
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index c95c5cb212fd..d90cf79f233a 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -37,6 +37,8 @@ TEXT_OFFSET := 0x00080000
37export TEXT_OFFSET GZFLAGS 37export TEXT_OFFSET GZFLAGS
38 38
39core-y += arch/arm64/kernel/ arch/arm64/mm/ 39core-y += arch/arm64/kernel/ arch/arm64/mm/
40core-$(CONFIG_KVM) += arch/arm64/kvm/
41core-$(CONFIG_XEN) += arch/arm64/xen/
40libs-y := arch/arm64/lib/ $(libs-y) 42libs-y := arch/arm64/lib/ $(libs-y)
41libs-y += $(LIBGCC) 43libs-y += $(LIBGCC)
42 44
@@ -60,6 +62,10 @@ zinstall install: vmlinux
60dtbs: scripts 62dtbs: scripts
61 $(Q)$(MAKE) $(build)=$(boot)/dts dtbs 63 $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
62 64
65PHONY += vdso_install
66vdso_install:
67 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
68
63# We use MRPROPER_FILES and CLEAN_FILES now 69# We use MRPROPER_FILES and CLEAN_FILES now
64archclean: 70archclean:
65 $(Q)$(MAKE) $(clean)=$(boot) 71 $(Q)$(MAKE) $(clean)=$(boot)
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 68457e9e0975..c52bdb051f66 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,4 +1,5 @@
1dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb 1dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb foundation-v8.dtb
2dtb-$(CONFIG_ARCH_XGENE) += apm-mustang.dtb
2 3
3targets += dtbs 4targets += dtbs
4targets += $(dtb-y) 5targets += $(dtb-y)
diff --git a/arch/arm64/boot/dts/apm-mustang.dts b/arch/arm64/boot/dts/apm-mustang.dts
new file mode 100644
index 000000000000..1247ca1200b1
--- /dev/null
+++ b/arch/arm64/boot/dts/apm-mustang.dts
@@ -0,0 +1,26 @@
1/*
2 * dts file for AppliedMicro (APM) Mustang Board
3 *
4 * Copyright (C) 2013, Applied Micro Circuits 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; either version 2 of
9 * the License, or (at your option) any later version.
10 */
11
12/dts-v1/;
13
14/include/ "apm-storm.dtsi"
15
16/ {
17 model = "APM X-Gene Mustang board";
18 compatible = "apm,mustang", "apm,xgene-storm";
19
20 chosen { };
21
22 memory {
23 device_type = "memory";
24 reg = < 0x1 0x00000000 0x0 0x80000000 >; /* Updated by bootloader */
25 };
26};
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
new file mode 100644
index 000000000000..bfdc57834929
--- /dev/null
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -0,0 +1,116 @@
1/*
2 * dts file for AppliedMicro (APM) X-Gene Storm SOC
3 *
4 * Copyright (C) 2013, Applied Micro Circuits 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; either version 2 of
9 * the License, or (at your option) any later version.
10 */
11
12/ {
13 compatible = "apm,xgene-storm";
14 interrupt-parent = <&gic>;
15 #address-cells = <2>;
16 #size-cells = <2>;
17
18 cpus {
19 #address-cells = <2>;
20 #size-cells = <0>;
21
22 cpu@000 {
23 device_type = "cpu";
24 compatible = "apm,potenza", "arm,armv8";
25 reg = <0x0 0x000>;
26 enable-method = "spin-table";
27 cpu-release-addr = <0x1 0x0000fff8>;
28 };
29 cpu@001 {
30 device_type = "cpu";
31 compatible = "apm,potenza", "arm,armv8";
32 reg = <0x0 0x001>;
33 enable-method = "spin-table";
34 cpu-release-addr = <0x1 0x0000fff8>;
35 };
36 cpu@100 {
37 device_type = "cpu";
38 compatible = "apm,potenza", "arm,armv8";
39 reg = <0x0 0x100>;
40 enable-method = "spin-table";
41 cpu-release-addr = <0x1 0x0000fff8>;
42 };
43 cpu@101 {
44 device_type = "cpu";
45 compatible = "apm,potenza", "arm,armv8";
46 reg = <0x0 0x101>;
47 enable-method = "spin-table";
48 cpu-release-addr = <0x1 0x0000fff8>;
49 };
50 cpu@200 {
51 device_type = "cpu";
52 compatible = "apm,potenza", "arm,armv8";
53 reg = <0x0 0x200>;
54 enable-method = "spin-table";
55 cpu-release-addr = <0x1 0x0000fff8>;
56 };
57 cpu@201 {
58 device_type = "cpu";
59 compatible = "apm,potenza", "arm,armv8";
60 reg = <0x0 0x201>;
61 enable-method = "spin-table";
62 cpu-release-addr = <0x1 0x0000fff8>;
63 };
64 cpu@300 {
65 device_type = "cpu";
66 compatible = "apm,potenza", "arm,armv8";
67 reg = <0x0 0x300>;
68 enable-method = "spin-table";
69 cpu-release-addr = <0x1 0x0000fff8>;
70 };
71 cpu@301 {
72 device_type = "cpu";
73 compatible = "apm,potenza", "arm,armv8";
74 reg = <0x0 0x301>;
75 enable-method = "spin-table";
76 cpu-release-addr = <0x1 0x0000fff8>;
77 };
78 };
79
80 gic: interrupt-controller@78010000 {
81 compatible = "arm,cortex-a15-gic";
82 #interrupt-cells = <3>;
83 interrupt-controller;
84 reg = <0x0 0x78010000 0x0 0x1000>, /* GIC Dist */
85 <0x0 0x78020000 0x0 0x1000>, /* GIC CPU */
86 <0x0 0x78040000 0x0 0x2000>, /* GIC VCPU Control */
87 <0x0 0x78060000 0x0 0x2000>; /* GIC VCPU */
88 interrupts = <1 9 0xf04>; /* GIC Maintenence IRQ */
89 };
90
91 timer {
92 compatible = "arm,armv8-timer";
93 interrupts = <1 0 0xff01>, /* Secure Phys IRQ */
94 <1 13 0xff01>, /* Non-secure Phys IRQ */
95 <1 14 0xff01>, /* Virt IRQ */
96 <1 15 0xff01>; /* Hyp IRQ */
97 clock-frequency = <50000000>;
98 };
99
100 soc {
101 compatible = "simple-bus";
102 #address-cells = <2>;
103 #size-cells = <2>;
104 ranges;
105
106 serial0: serial@1c020000 {
107 device_type = "serial";
108 compatible = "ns16550";
109 reg = <0 0x1c020000 0x0 0x1000>;
110 reg-shift = <2>;
111 clock-frequency = <10000000>; /* Updated by bootloader */
112 interrupt-parent = <&gic>;
113 interrupts = <0x0 0x4c 0x4>;
114 };
115 };
116};
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 8d9696adb440..5b3e83217b03 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -24,6 +24,7 @@ CONFIG_MODULE_UNLOAD=y
24# CONFIG_BLK_DEV_BSG is not set 24# CONFIG_BLK_DEV_BSG is not set
25# CONFIG_IOSCHED_DEADLINE is not set 25# CONFIG_IOSCHED_DEADLINE is not set
26CONFIG_ARCH_VEXPRESS=y 26CONFIG_ARCH_VEXPRESS=y
27CONFIG_ARCH_XGENE=y
27CONFIG_SMP=y 28CONFIG_SMP=y
28CONFIG_PREEMPT_VOLUNTARY=y 29CONFIG_PREEMPT_VOLUNTARY=y
29CONFIG_CMDLINE="console=ttyAMA0" 30CONFIG_CMDLINE="console=ttyAMA0"
@@ -54,6 +55,9 @@ CONFIG_INPUT_EVDEV=y
54# CONFIG_SERIO_I8042 is not set 55# CONFIG_SERIO_I8042 is not set
55# CONFIG_SERIO_SERPORT is not set 56# CONFIG_SERIO_SERPORT is not set
56CONFIG_LEGACY_PTY_COUNT=16 57CONFIG_LEGACY_PTY_COUNT=16
58CONFIG_SERIAL_8250=y
59CONFIG_SERIAL_8250_CONSOLE=y
60CONFIG_SERIAL_OF_PLATFORM=y
57CONFIG_SERIAL_AMBA_PL011=y 61CONFIG_SERIAL_AMBA_PL011=y
58CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 62CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
59# CONFIG_HW_RANDOM is not set 63# CONFIG_HW_RANDOM is not set
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index bf6ab242f047..d56ed11ba9a3 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -110,16 +110,6 @@ static inline void __cpuinit arch_counter_set_user_access(void)
110 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl)); 110 asm volatile("msr cntkctl_el1, %0" : : "r" (cntkctl));
111} 111}
112 112
113static inline u64 arch_counter_get_cntpct(void)
114{
115 u64 cval;
116
117 isb();
118 asm volatile("mrs %0, cntpct_el0" : "=r" (cval));
119
120 return cval;
121}
122
123static inline u64 arch_counter_get_cntvct(void) 113static inline u64 arch_counter_get_cntvct(void)
124{ 114{
125 u64 cval; 115 u64 cval;
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index 3300cbd18a89..fea9ee327206 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -123,9 +123,6 @@ static inline void __flush_icache_all(void)
123#define flush_dcache_mmap_unlock(mapping) \ 123#define flush_dcache_mmap_unlock(mapping) \
124 spin_unlock_irq(&(mapping)->tree_lock) 124 spin_unlock_irq(&(mapping)->tree_lock)
125 125
126#define flush_icache_user_range(vma,page,addr,len) \
127 flush_dcache_page(page)
128
129/* 126/*
130 * We don't appear to need to do anything here. In fact, if we did, we'd 127 * We don't appear to need to do anything here. In fact, if we did, we'd
131 * duplicate cache flushing elsewhere performed by flush_dcache_page(). 128 * duplicate cache flushing elsewhere performed by flush_dcache_page().
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index cf2749488cd4..5fe138e0b828 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -37,11 +37,14 @@
37}) 37})
38 38
39#define ARM_CPU_IMP_ARM 0x41 39#define ARM_CPU_IMP_ARM 0x41
40#define ARM_CPU_IMP_APM 0x50
40 41
41#define ARM_CPU_PART_AEM_V8 0xD0F0 42#define ARM_CPU_PART_AEM_V8 0xD0F0
42#define ARM_CPU_PART_FOUNDATION 0xD000 43#define ARM_CPU_PART_FOUNDATION 0xD000
43#define ARM_CPU_PART_CORTEX_A57 0xD070 44#define ARM_CPU_PART_CORTEX_A57 0xD070
44 45
46#define APM_CPU_PART_POTENZA 0x0000
47
45#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
46 49
47/* 50/*
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 7eaa0b302493..ef8235c68c09 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -83,6 +83,15 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs)
83} 83}
84#endif 84#endif
85 85
86#ifdef CONFIG_COMPAT
87int aarch32_break_handler(struct pt_regs *regs);
88#else
89static int aarch32_break_handler(struct pt_regs *regs)
90{
91 return -EFAULT;
92}
93#endif
94
86#endif /* __ASSEMBLY */ 95#endif /* __ASSEMBLY */
87#endif /* __KERNEL__ */ 96#endif /* __KERNEL__ */
88#endif /* __ASM_DEBUG_MONITORS_H */ 97#endif /* __ASM_DEBUG_MONITORS_H */
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h
index 0d8453c755a8..cf98b362094b 100644
--- a/arch/arm64/include/asm/device.h
+++ b/arch/arm64/include/asm/device.h
@@ -18,6 +18,9 @@
18 18
19struct dev_archdata { 19struct dev_archdata {
20 struct dma_map_ops *dma_ops; 20 struct dma_map_ops *dma_ops;
21#ifdef CONFIG_IOMMU_API
22 void *iommu; /* private IOMMU data */
23#endif
21}; 24};
22 25
23struct pdev_archdata { 26struct pdev_archdata {
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index 994776894198..8d1810001aef 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -81,8 +81,12 @@ static inline void dma_mark_clean(void *addr, size_t size)
81{ 81{
82} 82}
83 83
84static inline void *dma_alloc_coherent(struct device *dev, size_t size, 84#define dma_alloc_coherent(d, s, h, f) dma_alloc_attrs(d, s, h, f, NULL)
85 dma_addr_t *dma_handle, gfp_t flags) 85#define dma_free_coherent(d, s, h, f) dma_free_attrs(d, s, h, f, NULL)
86
87static inline void *dma_alloc_attrs(struct device *dev, size_t size,
88 dma_addr_t *dma_handle, gfp_t flags,
89 struct dma_attrs *attrs)
86{ 90{
87 struct dma_map_ops *ops = get_dma_ops(dev); 91 struct dma_map_ops *ops = get_dma_ops(dev);
88 void *vaddr; 92 void *vaddr;
@@ -90,13 +94,14 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
90 if (dma_alloc_from_coherent(dev, size, dma_handle, &vaddr)) 94 if (dma_alloc_from_coherent(dev, size, dma_handle, &vaddr))
91 return vaddr; 95 return vaddr;
92 96
93 vaddr = ops->alloc(dev, size, dma_handle, flags, NULL); 97 vaddr = ops->alloc(dev, size, dma_handle, flags, attrs);
94 debug_dma_alloc_coherent(dev, size, *dma_handle, vaddr); 98 debug_dma_alloc_coherent(dev, size, *dma_handle, vaddr);
95 return vaddr; 99 return vaddr;
96} 100}
97 101
98static inline void dma_free_coherent(struct device *dev, size_t size, 102static inline void dma_free_attrs(struct device *dev, size_t size,
99 void *vaddr, dma_addr_t dev_addr) 103 void *vaddr, dma_addr_t dev_addr,
104 struct dma_attrs *attrs)
100{ 105{
101 struct dma_map_ops *ops = get_dma_ops(dev); 106 struct dma_map_ops *ops = get_dma_ops(dev);
102 107
@@ -104,7 +109,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
104 return; 109 return;
105 110
106 debug_dma_free_coherent(dev, size, vaddr, dev_addr); 111 debug_dma_free_coherent(dev, size, vaddr, dev_addr);
107 ops->free(dev, size, vaddr, dev_addr, NULL); 112 ops->free(dev, size, vaddr, dev_addr, attrs);
108} 113}
109 114
110/* 115/*
diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h
new file mode 100644
index 000000000000..5b7ca8ace95f
--- /dev/null
+++ b/arch/arm64/include/asm/hugetlb.h
@@ -0,0 +1,117 @@
1/*
2 * arch/arm64/include/asm/hugetlb.h
3 *
4 * Copyright (C) 2013 Linaro Ltd.
5 *
6 * Based on arch/x86/include/asm/hugetlb.h
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ASM_HUGETLB_H
23#define __ASM_HUGETLB_H
24
25#include <asm-generic/hugetlb.h>
26#include <asm/page.h>
27
28static inline pte_t huge_ptep_get(pte_t *ptep)
29{
30 return *ptep;
31}
32
33static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
34 pte_t *ptep, pte_t pte)
35{
36 set_pte_at(mm, addr, ptep, pte);
37}
38
39static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
40 unsigned long addr, pte_t *ptep)
41{
42 ptep_clear_flush(vma, addr, ptep);
43}
44
45static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
46 unsigned long addr, pte_t *ptep)
47{
48 ptep_set_wrprotect(mm, addr, ptep);
49}
50
51static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
52 unsigned long addr, pte_t *ptep)
53{
54 return ptep_get_and_clear(mm, addr, ptep);
55}
56
57static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
58 unsigned long addr, pte_t *ptep,
59 pte_t pte, int dirty)
60{
61 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
62}
63
64static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
65 unsigned long addr, unsigned long end,
66 unsigned long floor,
67 unsigned long ceiling)
68{
69 free_pgd_range(tlb, addr, end, floor, ceiling);
70}
71
72static inline int is_hugepage_only_range(struct mm_struct *mm,
73 unsigned long addr, unsigned long len)
74{
75 return 0;
76}
77
78static inline int prepare_hugepage_range(struct file *file,
79 unsigned long addr, unsigned long len)
80{
81 struct hstate *h = hstate_file(file);
82 if (len & ~huge_page_mask(h))
83 return -EINVAL;
84 if (addr & ~huge_page_mask(h))
85 return -EINVAL;
86 return 0;
87}
88
89static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
90{
91}
92
93static inline int huge_pte_none(pte_t pte)
94{
95 return pte_none(pte);
96}
97
98static inline pte_t huge_pte_wrprotect(pte_t pte)
99{
100 return pte_wrprotect(pte);
101}
102
103static inline int arch_prepare_hugepage(struct page *page)
104{
105 return 0;
106}
107
108static inline void arch_release_hugepage(struct page *page)
109{
110}
111
112static inline void arch_clear_hugepage_flags(struct page *page)
113{
114 clear_bit(PG_dcache_clean, &page->flags);
115}
116
117#endif /* __ASM_HUGETLB_H */
diff --git a/arch/arm64/include/asm/hypervisor.h b/arch/arm64/include/asm/hypervisor.h
new file mode 100644
index 000000000000..d2c79049ff11
--- /dev/null
+++ b/arch/arm64/include/asm/hypervisor.h
@@ -0,0 +1,6 @@
1#ifndef _ASM_ARM64_HYPERVISOR_H
2#define _ASM_ARM64_HYPERVISOR_H
3
4#include <asm/xen/hypervisor.h>
5
6#endif
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 2e12258aa7e4..1d12f89140ba 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -228,10 +228,12 @@ extern void __iounmap(volatile void __iomem *addr);
228#define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY) 228#define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY)
229#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE)) 229#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
230#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC)) 230#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC))
231#define PROT_NORMAL (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
231 232
232#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE)) 233#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
233#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE)) 234#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
234#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC)) 235#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
236#define ioremap_cached(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL))
235#define iounmap __iounmap 237#define iounmap __iounmap
236 238
237#define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF) 239#define PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF)
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
new file mode 100644
index 000000000000..a5f28e2720c7
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -0,0 +1,245 @@
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#ifndef __ARM64_KVM_ARM_H__
19#define __ARM64_KVM_ARM_H__
20
21#include <asm/types.h>
22
23/* Hyp Configuration Register (HCR) bits */
24#define HCR_ID (UL(1) << 33)
25#define HCR_CD (UL(1) << 32)
26#define HCR_RW_SHIFT 31
27#define HCR_RW (UL(1) << HCR_RW_SHIFT)
28#define HCR_TRVM (UL(1) << 30)
29#define HCR_HCD (UL(1) << 29)
30#define HCR_TDZ (UL(1) << 28)
31#define HCR_TGE (UL(1) << 27)
32#define HCR_TVM (UL(1) << 26)
33#define HCR_TTLB (UL(1) << 25)
34#define HCR_TPU (UL(1) << 24)
35#define HCR_TPC (UL(1) << 23)
36#define HCR_TSW (UL(1) << 22)
37#define HCR_TAC (UL(1) << 21)
38#define HCR_TIDCP (UL(1) << 20)
39#define HCR_TSC (UL(1) << 19)
40#define HCR_TID3 (UL(1) << 18)
41#define HCR_TID2 (UL(1) << 17)
42#define HCR_TID1 (UL(1) << 16)
43#define HCR_TID0 (UL(1) << 15)
44#define HCR_TWE (UL(1) << 14)
45#define HCR_TWI (UL(1) << 13)
46#define HCR_DC (UL(1) << 12)
47#define HCR_BSU (3 << 10)
48#define HCR_BSU_IS (UL(1) << 10)
49#define HCR_FB (UL(1) << 9)
50#define HCR_VA (UL(1) << 8)
51#define HCR_VI (UL(1) << 7)
52#define HCR_VF (UL(1) << 6)
53#define HCR_AMO (UL(1) << 5)
54#define HCR_IMO (UL(1) << 4)
55#define HCR_FMO (UL(1) << 3)
56#define HCR_PTW (UL(1) << 2)
57#define HCR_SWIO (UL(1) << 1)
58#define HCR_VM (UL(1) << 0)
59
60/*
61 * The bits we set in HCR:
62 * RW: 64bit by default, can be overriden for 32bit VMs
63 * TAC: Trap ACTLR
64 * TSC: Trap SMC
65 * TSW: Trap cache operations by set/way
66 * TWI: Trap WFI
67 * TIDCP: Trap L2CTLR/L2ECTLR
68 * BSU_IS: Upgrade barriers to the inner shareable domain
69 * FB: Force broadcast of all maintainance operations
70 * AMO: Override CPSR.A and enable signaling with VA
71 * IMO: Override CPSR.I and enable signaling with VI
72 * FMO: Override CPSR.F and enable signaling with VF
73 * SWIO: Turn set/way invalidates into set/way clean+invalidate
74 */
75#define HCR_GUEST_FLAGS (HCR_TSC | HCR_TSW | HCR_TWI | HCR_VM | HCR_BSU_IS | \
76 HCR_FB | HCR_TAC | HCR_AMO | HCR_IMO | HCR_FMO | \
77 HCR_SWIO | HCR_TIDCP | HCR_RW)
78#define HCR_VIRT_EXCP_MASK (HCR_VA | HCR_VI | HCR_VF)
79
80/* Hyp System Control Register (SCTLR_EL2) bits */
81#define SCTLR_EL2_EE (1 << 25)
82#define SCTLR_EL2_WXN (1 << 19)
83#define SCTLR_EL2_I (1 << 12)
84#define SCTLR_EL2_SA (1 << 3)
85#define SCTLR_EL2_C (1 << 2)
86#define SCTLR_EL2_A (1 << 1)
87#define SCTLR_EL2_M 1
88#define SCTLR_EL2_FLAGS (SCTLR_EL2_M | SCTLR_EL2_A | SCTLR_EL2_C | \
89 SCTLR_EL2_SA | SCTLR_EL2_I)
90
91/* TCR_EL2 Registers bits */
92#define TCR_EL2_TBI (1 << 20)
93#define TCR_EL2_PS (7 << 16)
94#define TCR_EL2_PS_40B (2 << 16)
95#define TCR_EL2_TG0 (1 << 14)
96#define TCR_EL2_SH0 (3 << 12)
97#define TCR_EL2_ORGN0 (3 << 10)
98#define TCR_EL2_IRGN0 (3 << 8)
99#define TCR_EL2_T0SZ 0x3f
100#define TCR_EL2_MASK (TCR_EL2_TG0 | TCR_EL2_SH0 | \
101 TCR_EL2_ORGN0 | TCR_EL2_IRGN0 | TCR_EL2_T0SZ)
102
103#define TCR_EL2_FLAGS (TCR_EL2_PS_40B)
104
105/* VTCR_EL2 Registers bits */
106#define VTCR_EL2_PS_MASK (7 << 16)
107#define VTCR_EL2_PS_40B (2 << 16)
108#define VTCR_EL2_TG0_MASK (1 << 14)
109#define VTCR_EL2_TG0_4K (0 << 14)
110#define VTCR_EL2_TG0_64K (1 << 14)
111#define VTCR_EL2_SH0_MASK (3 << 12)
112#define VTCR_EL2_SH0_INNER (3 << 12)
113#define VTCR_EL2_ORGN0_MASK (3 << 10)
114#define VTCR_EL2_ORGN0_WBWA (1 << 10)
115#define VTCR_EL2_IRGN0_MASK (3 << 8)
116#define VTCR_EL2_IRGN0_WBWA (1 << 8)
117#define VTCR_EL2_SL0_MASK (3 << 6)
118#define VTCR_EL2_SL0_LVL1 (1 << 6)
119#define VTCR_EL2_T0SZ_MASK 0x3f
120#define VTCR_EL2_T0SZ_40B 24
121
122#ifdef CONFIG_ARM64_64K_PAGES
123/*
124 * Stage2 translation configuration:
125 * 40bits output (PS = 2)
126 * 40bits input (T0SZ = 24)
127 * 64kB pages (TG0 = 1)
128 * 2 level page tables (SL = 1)
129 */
130#define VTCR_EL2_FLAGS (VTCR_EL2_PS_40B | VTCR_EL2_TG0_64K | \
131 VTCR_EL2_SH0_INNER | VTCR_EL2_ORGN0_WBWA | \
132 VTCR_EL2_IRGN0_WBWA | VTCR_EL2_SL0_LVL1 | \
133 VTCR_EL2_T0SZ_40B)
134#define VTTBR_X (38 - VTCR_EL2_T0SZ_40B)
135#else
136/*
137 * Stage2 translation configuration:
138 * 40bits output (PS = 2)
139 * 40bits input (T0SZ = 24)
140 * 4kB pages (TG0 = 0)
141 * 3 level page tables (SL = 1)
142 */
143#define VTCR_EL2_FLAGS (VTCR_EL2_PS_40B | VTCR_EL2_TG0_4K | \
144 VTCR_EL2_SH0_INNER | VTCR_EL2_ORGN0_WBWA | \
145 VTCR_EL2_IRGN0_WBWA | VTCR_EL2_SL0_LVL1 | \
146 VTCR_EL2_T0SZ_40B)
147#define VTTBR_X (37 - VTCR_EL2_T0SZ_40B)
148#endif
149
150#define VTTBR_BADDR_SHIFT (VTTBR_X - 1)
151#define VTTBR_BADDR_MASK (((1LLU << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT)
152#define VTTBR_VMID_SHIFT (48LLU)
153#define VTTBR_VMID_MASK (0xffLLU << VTTBR_VMID_SHIFT)
154
155/* Hyp System Trap Register */
156#define HSTR_EL2_TTEE (1 << 16)
157#define HSTR_EL2_T(x) (1 << x)
158
159/* Hyp Coprocessor Trap Register */
160#define CPTR_EL2_TCPAC (1 << 31)
161#define CPTR_EL2_TTA (1 << 20)
162#define CPTR_EL2_TFP (1 << 10)
163
164/* Hyp Debug Configuration Register bits */
165#define MDCR_EL2_TDRA (1 << 11)
166#define MDCR_EL2_TDOSA (1 << 10)
167#define MDCR_EL2_TDA (1 << 9)
168#define MDCR_EL2_TDE (1 << 8)
169#define MDCR_EL2_HPME (1 << 7)
170#define MDCR_EL2_TPM (1 << 6)
171#define MDCR_EL2_TPMCR (1 << 5)
172#define MDCR_EL2_HPMN_MASK (0x1F)
173
174/* Exception Syndrome Register (ESR) bits */
175#define ESR_EL2_EC_SHIFT (26)
176#define ESR_EL2_EC (0x3fU << ESR_EL2_EC_SHIFT)
177#define ESR_EL2_IL (1U << 25)
178#define ESR_EL2_ISS (ESR_EL2_IL - 1)
179#define ESR_EL2_ISV_SHIFT (24)
180#define ESR_EL2_ISV (1U << ESR_EL2_ISV_SHIFT)
181#define ESR_EL2_SAS_SHIFT (22)
182#define ESR_EL2_SAS (3U << ESR_EL2_SAS_SHIFT)
183#define ESR_EL2_SSE (1 << 21)
184#define ESR_EL2_SRT_SHIFT (16)
185#define ESR_EL2_SRT_MASK (0x1f << ESR_EL2_SRT_SHIFT)
186#define ESR_EL2_SF (1 << 15)
187#define ESR_EL2_AR (1 << 14)
188#define ESR_EL2_EA (1 << 9)
189#define ESR_EL2_CM (1 << 8)
190#define ESR_EL2_S1PTW (1 << 7)
191#define ESR_EL2_WNR (1 << 6)
192#define ESR_EL2_FSC (0x3f)
193#define ESR_EL2_FSC_TYPE (0x3c)
194
195#define ESR_EL2_CV_SHIFT (24)
196#define ESR_EL2_CV (1U << ESR_EL2_CV_SHIFT)
197#define ESR_EL2_COND_SHIFT (20)
198#define ESR_EL2_COND (0xfU << ESR_EL2_COND_SHIFT)
199
200
201#define FSC_FAULT (0x04)
202#define FSC_PERM (0x0c)
203
204/* Hyp Prefetch Fault Address Register (HPFAR/HDFAR) */
205#define HPFAR_MASK (~0xFUL)
206
207#define ESR_EL2_EC_UNKNOWN (0x00)
208#define ESR_EL2_EC_WFI (0x01)
209#define ESR_EL2_EC_CP15_32 (0x03)
210#define ESR_EL2_EC_CP15_64 (0x04)
211#define ESR_EL2_EC_CP14_MR (0x05)
212#define ESR_EL2_EC_CP14_LS (0x06)
213#define ESR_EL2_EC_FP_ASIMD (0x07)
214#define ESR_EL2_EC_CP10_ID (0x08)
215#define ESR_EL2_EC_CP14_64 (0x0C)
216#define ESR_EL2_EC_ILL_ISS (0x0E)
217#define ESR_EL2_EC_SVC32 (0x11)
218#define ESR_EL2_EC_HVC32 (0x12)
219#define ESR_EL2_EC_SMC32 (0x13)
220#define ESR_EL2_EC_SVC64 (0x15)
221#define ESR_EL2_EC_HVC64 (0x16)
222#define ESR_EL2_EC_SMC64 (0x17)
223#define ESR_EL2_EC_SYS64 (0x18)
224#define ESR_EL2_EC_IABT (0x20)
225#define ESR_EL2_EC_IABT_HYP (0x21)
226#define ESR_EL2_EC_PC_ALIGN (0x22)
227#define ESR_EL2_EC_DABT (0x24)
228#define ESR_EL2_EC_DABT_HYP (0x25)
229#define ESR_EL2_EC_SP_ALIGN (0x26)
230#define ESR_EL2_EC_FP_EXC32 (0x28)
231#define ESR_EL2_EC_FP_EXC64 (0x2C)
232#define ESR_EL2_EC_SERRROR (0x2F)
233#define ESR_EL2_EC_BREAKPT (0x30)
234#define ESR_EL2_EC_BREAKPT_HYP (0x31)
235#define ESR_EL2_EC_SOFTSTP (0x32)
236#define ESR_EL2_EC_SOFTSTP_HYP (0x33)
237#define ESR_EL2_EC_WATCHPT (0x34)
238#define ESR_EL2_EC_WATCHPT_HYP (0x35)
239#define ESR_EL2_EC_BKPT32 (0x38)
240#define ESR_EL2_EC_VECTOR32 (0x3A)
241#define ESR_EL2_EC_BRK64 (0x3C)
242
243#define ESR_EL2_EC_xABT_xFSR_EXTABT 0x10
244
245#endif /* __ARM64_KVM_ARM_H__ */
diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
new file mode 100644
index 000000000000..c92de4163eba
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -0,0 +1,104 @@
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#ifndef __ARM_KVM_ASM_H__
19#define __ARM_KVM_ASM_H__
20
21/*
22 * 0 is reserved as an invalid value.
23 * Order *must* be kept in sync with the hyp switch code.
24 */
25#define MPIDR_EL1 1 /* MultiProcessor Affinity Register */
26#define CSSELR_EL1 2 /* Cache Size Selection Register */
27#define SCTLR_EL1 3 /* System Control Register */
28#define ACTLR_EL1 4 /* Auxilliary Control Register */
29#define CPACR_EL1 5 /* Coprocessor Access Control */
30#define TTBR0_EL1 6 /* Translation Table Base Register 0 */
31#define TTBR1_EL1 7 /* Translation Table Base Register 1 */
32#define TCR_EL1 8 /* Translation Control Register */
33#define ESR_EL1 9 /* Exception Syndrome Register */
34#define AFSR0_EL1 10 /* Auxilary Fault Status Register 0 */
35#define AFSR1_EL1 11 /* Auxilary Fault Status Register 1 */
36#define FAR_EL1 12 /* Fault Address Register */
37#define MAIR_EL1 13 /* Memory Attribute Indirection Register */
38#define VBAR_EL1 14 /* Vector Base Address Register */
39#define CONTEXTIDR_EL1 15 /* Context ID Register */
40#define TPIDR_EL0 16 /* Thread ID, User R/W */
41#define TPIDRRO_EL0 17 /* Thread ID, User R/O */
42#define TPIDR_EL1 18 /* Thread ID, Privileged */
43#define AMAIR_EL1 19 /* Aux Memory Attribute Indirection Register */
44#define CNTKCTL_EL1 20 /* Timer Control Register (EL1) */
45/* 32bit specific registers. Keep them at the end of the range */
46#define DACR32_EL2 21 /* Domain Access Control Register */
47#define IFSR32_EL2 22 /* Instruction Fault Status Register */
48#define FPEXC32_EL2 23 /* Floating-Point Exception Control Register */
49#define DBGVCR32_EL2 24 /* Debug Vector Catch Register */
50#define TEECR32_EL1 25 /* ThumbEE Configuration Register */
51#define TEEHBR32_EL1 26 /* ThumbEE Handler Base Register */
52#define NR_SYS_REGS 27
53
54/* 32bit mapping */
55#define c0_MPIDR (MPIDR_EL1 * 2) /* MultiProcessor ID Register */
56#define c0_CSSELR (CSSELR_EL1 * 2)/* Cache Size Selection Register */
57#define c1_SCTLR (SCTLR_EL1 * 2) /* System Control Register */
58#define c1_ACTLR (ACTLR_EL1 * 2) /* Auxiliary Control Register */
59#define c1_CPACR (CPACR_EL1 * 2) /* Coprocessor Access Control */
60#define c2_TTBR0 (TTBR0_EL1 * 2) /* Translation Table Base Register 0 */
61#define c2_TTBR0_high (c2_TTBR0 + 1) /* TTBR0 top 32 bits */
62#define c2_TTBR1 (TTBR1_EL1 * 2) /* Translation Table Base Register 1 */
63#define c2_TTBR1_high (c2_TTBR1 + 1) /* TTBR1 top 32 bits */
64#define c2_TTBCR (TCR_EL1 * 2) /* Translation Table Base Control R. */
65#define c3_DACR (DACR32_EL2 * 2)/* Domain Access Control Register */
66#define c5_DFSR (ESR_EL1 * 2) /* Data Fault Status Register */
67#define c5_IFSR (IFSR32_EL2 * 2)/* Instruction Fault Status Register */
68#define c5_ADFSR (AFSR0_EL1 * 2) /* Auxiliary Data Fault Status R */
69#define c5_AIFSR (AFSR1_EL1 * 2) /* Auxiliary Instr Fault Status R */
70#define c6_DFAR (FAR_EL1 * 2) /* Data Fault Address Register */
71#define c6_IFAR (c6_DFAR + 1) /* Instruction Fault Address Register */
72#define c10_PRRR (MAIR_EL1 * 2) /* Primary Region Remap Register */
73#define c10_NMRR (c10_PRRR + 1) /* Normal Memory Remap Register */
74#define c12_VBAR (VBAR_EL1 * 2) /* Vector Base Address Register */
75#define c13_CID (CONTEXTIDR_EL1 * 2) /* Context ID Register */
76#define c13_TID_URW (TPIDR_EL0 * 2) /* Thread ID, User R/W */
77#define c13_TID_URO (TPIDRRO_EL0 * 2)/* Thread ID, User R/O */
78#define c13_TID_PRIV (TPIDR_EL1 * 2) /* Thread ID, Privileged */
79#define c10_AMAIR (AMAIR_EL1 * 2) /* Aux Memory Attr Indirection Reg */
80#define c14_CNTKCTL (CNTKCTL_EL1 * 2) /* Timer Control Register (PL1) */
81#define NR_CP15_REGS (NR_SYS_REGS * 2)
82
83#define ARM_EXCEPTION_IRQ 0
84#define ARM_EXCEPTION_TRAP 1
85
86#ifndef __ASSEMBLY__
87struct kvm;
88struct kvm_vcpu;
89
90extern char __kvm_hyp_init[];
91extern char __kvm_hyp_init_end[];
92
93extern char __kvm_hyp_vector[];
94
95extern char __kvm_hyp_code_start[];
96extern char __kvm_hyp_code_end[];
97
98extern void __kvm_flush_vm_context(void);
99extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
100
101extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
102#endif
103
104#endif /* __ARM_KVM_ASM_H__ */
diff --git a/arch/arm64/include/asm/kvm_coproc.h b/arch/arm64/include/asm/kvm_coproc.h
new file mode 100644
index 000000000000..9a59301cd014
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_coproc.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/include/asm/kvm_coproc.h
6 * Copyright (C) 2012 Rusty Russell IBM Corporation
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __ARM64_KVM_COPROC_H__
22#define __ARM64_KVM_COPROC_H__
23
24#include <linux/kvm_host.h>
25
26void kvm_reset_sys_regs(struct kvm_vcpu *vcpu);
27
28struct kvm_sys_reg_table {
29 const struct sys_reg_desc *table;
30 size_t num;
31};
32
33struct kvm_sys_reg_target_table {
34 struct kvm_sys_reg_table table64;
35 struct kvm_sys_reg_table table32;
36};
37
38void kvm_register_target_sys_reg_table(unsigned int target,
39 struct kvm_sys_reg_target_table *table);
40
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);
43int 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_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run);
46
47#define kvm_coproc_table_init kvm_sys_reg_table_init
48void kvm_sys_reg_table_init(void);
49
50struct kvm_one_reg;
51int kvm_arm_copy_sys_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
52int kvm_arm_sys_reg_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
53int kvm_arm_sys_reg_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
54unsigned long kvm_arm_num_sys_reg_descs(struct kvm_vcpu *vcpu);
55
56#endif /* __ARM64_KVM_COPROC_H__ */
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
new file mode 100644
index 000000000000..eec073875218
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -0,0 +1,180 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/include/kvm_emulate.h
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __ARM64_KVM_EMULATE_H__
23#define __ARM64_KVM_EMULATE_H__
24
25#include <linux/kvm_host.h>
26#include <asm/kvm_asm.h>
27#include <asm/kvm_arm.h>
28#include <asm/kvm_mmio.h>
29#include <asm/ptrace.h>
30
31unsigned long *vcpu_reg32(const struct kvm_vcpu *vcpu, u8 reg_num);
32unsigned long *vcpu_spsr32(const struct kvm_vcpu *vcpu);
33
34bool kvm_condition_valid32(const struct kvm_vcpu *vcpu);
35void kvm_skip_instr32(struct kvm_vcpu *vcpu, bool is_wide_instr);
36
37void kvm_inject_undefined(struct kvm_vcpu *vcpu);
38void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr);
39void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
40
41static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu)
42{
43 return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pc;
44}
45
46static inline unsigned long *vcpu_elr_el1(const struct kvm_vcpu *vcpu)
47{
48 return (unsigned long *)&vcpu_gp_regs(vcpu)->elr_el1;
49}
50
51static inline unsigned long *vcpu_cpsr(const struct kvm_vcpu *vcpu)
52{
53 return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.pstate;
54}
55
56static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu)
57{
58 return !!(*vcpu_cpsr(vcpu) & PSR_MODE32_BIT);
59}
60
61static inline bool kvm_condition_valid(const struct kvm_vcpu *vcpu)
62{
63 if (vcpu_mode_is_32bit(vcpu))
64 return kvm_condition_valid32(vcpu);
65
66 return true;
67}
68
69static inline void kvm_skip_instr(struct kvm_vcpu *vcpu, bool is_wide_instr)
70{
71 if (vcpu_mode_is_32bit(vcpu))
72 kvm_skip_instr32(vcpu, is_wide_instr);
73 else
74 *vcpu_pc(vcpu) += 4;
75}
76
77static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu)
78{
79 *vcpu_cpsr(vcpu) |= COMPAT_PSR_T_BIT;
80}
81
82static inline unsigned long *vcpu_reg(const struct kvm_vcpu *vcpu, u8 reg_num)
83{
84 if (vcpu_mode_is_32bit(vcpu))
85 return vcpu_reg32(vcpu, reg_num);
86
87 return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.regs[reg_num];
88}
89
90/* Get vcpu SPSR for current mode */
91static inline unsigned long *vcpu_spsr(const struct kvm_vcpu *vcpu)
92{
93 if (vcpu_mode_is_32bit(vcpu))
94 return vcpu_spsr32(vcpu);
95
96 return (unsigned long *)&vcpu_gp_regs(vcpu)->spsr[KVM_SPSR_EL1];
97}
98
99static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu)
100{
101 u32 mode = *vcpu_cpsr(vcpu) & PSR_MODE_MASK;
102
103 if (vcpu_mode_is_32bit(vcpu))
104 return mode > COMPAT_PSR_MODE_USR;
105
106 return mode != PSR_MODE_EL0t;
107}
108
109static inline u32 kvm_vcpu_get_hsr(const struct kvm_vcpu *vcpu)
110{
111 return vcpu->arch.fault.esr_el2;
112}
113
114static inline unsigned long kvm_vcpu_get_hfar(const struct kvm_vcpu *vcpu)
115{
116 return vcpu->arch.fault.far_el2;
117}
118
119static inline phys_addr_t kvm_vcpu_get_fault_ipa(const struct kvm_vcpu *vcpu)
120{
121 return ((phys_addr_t)vcpu->arch.fault.hpfar_el2 & HPFAR_MASK) << 8;
122}
123
124static inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu)
125{
126 return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_ISV);
127}
128
129static inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu)
130{
131 return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_WNR);
132}
133
134static inline bool kvm_vcpu_dabt_issext(const struct kvm_vcpu *vcpu)
135{
136 return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_SSE);
137}
138
139static inline int kvm_vcpu_dabt_get_rd(const struct kvm_vcpu *vcpu)
140{
141 return (kvm_vcpu_get_hsr(vcpu) & ESR_EL2_SRT_MASK) >> ESR_EL2_SRT_SHIFT;
142}
143
144static inline bool kvm_vcpu_dabt_isextabt(const struct kvm_vcpu *vcpu)
145{
146 return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_EA);
147}
148
149static inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu)
150{
151 return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_S1PTW);
152}
153
154static inline int kvm_vcpu_dabt_get_as(const struct kvm_vcpu *vcpu)
155{
156 return 1 << ((kvm_vcpu_get_hsr(vcpu) & ESR_EL2_SAS) >> ESR_EL2_SAS_SHIFT);
157}
158
159/* This one is not specific to Data Abort */
160static inline bool kvm_vcpu_trap_il_is32bit(const struct kvm_vcpu *vcpu)
161{
162 return !!(kvm_vcpu_get_hsr(vcpu) & ESR_EL2_IL);
163}
164
165static inline u8 kvm_vcpu_trap_get_class(const struct kvm_vcpu *vcpu)
166{
167 return kvm_vcpu_get_hsr(vcpu) >> ESR_EL2_EC_SHIFT;
168}
169
170static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu)
171{
172 return kvm_vcpu_trap_get_class(vcpu) == ESR_EL2_EC_IABT;
173}
174
175static inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu)
176{
177 return kvm_vcpu_get_hsr(vcpu) & ESR_EL2_FSC_TYPE;
178}
179
180#endif /* __ARM64_KVM_EMULATE_H__ */
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
new file mode 100644
index 000000000000..644d73956864
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -0,0 +1,202 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/include/asm/kvm_host.h:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __ARM64_KVM_HOST_H__
23#define __ARM64_KVM_HOST_H__
24
25#include <asm/kvm.h>
26#include <asm/kvm_asm.h>
27#include <asm/kvm_mmio.h>
28
29#define KVM_MAX_VCPUS 4
30#define KVM_USER_MEM_SLOTS 32
31#define KVM_PRIVATE_MEM_SLOTS 4
32#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
33
34#include <kvm/arm_vgic.h>
35#include <kvm/arm_arch_timer.h>
36
37#define KVM_VCPU_MAX_FEATURES 2
38
39/* We don't currently support large pages. */
40#define KVM_HPAGE_GFN_SHIFT(x) 0
41#define KVM_NR_PAGE_SIZES 1
42#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
43
44struct kvm_vcpu;
45int kvm_target_cpu(void);
46int kvm_reset_vcpu(struct kvm_vcpu *vcpu);
47int kvm_arch_dev_ioctl_check_extension(long ext);
48
49struct kvm_arch {
50 /* The VMID generation used for the virt. memory system */
51 u64 vmid_gen;
52 u32 vmid;
53
54 /* 1-level 2nd stage table and lock */
55 spinlock_t pgd_lock;
56 pgd_t *pgd;
57
58 /* VTTBR value associated with above pgd and vmid */
59 u64 vttbr;
60
61 /* Interrupt controller */
62 struct vgic_dist vgic;
63
64 /* Timer */
65 struct arch_timer_kvm timer;
66};
67
68#define KVM_NR_MEM_OBJS 40
69
70/*
71 * We don't want allocation failures within the mmu code, so we preallocate
72 * enough memory for a single page fault in a cache.
73 */
74struct kvm_mmu_memory_cache {
75 int nobjs;
76 void *objects[KVM_NR_MEM_OBJS];
77};
78
79struct kvm_vcpu_fault_info {
80 u32 esr_el2; /* Hyp Syndrom Register */
81 u64 far_el2; /* Hyp Fault Address Register */
82 u64 hpfar_el2; /* Hyp IPA Fault Address Register */
83};
84
85struct kvm_cpu_context {
86 struct kvm_regs gp_regs;
87 union {
88 u64 sys_regs[NR_SYS_REGS];
89 u32 cp15[NR_CP15_REGS];
90 };
91};
92
93typedef struct kvm_cpu_context kvm_cpu_context_t;
94
95struct kvm_vcpu_arch {
96 struct kvm_cpu_context ctxt;
97
98 /* HYP configuration */
99 u64 hcr_el2;
100
101 /* Exception Information */
102 struct kvm_vcpu_fault_info fault;
103
104 /* Pointer to host CPU context */
105 kvm_cpu_context_t *host_cpu_context;
106
107 /* VGIC state */
108 struct vgic_cpu vgic_cpu;
109 struct arch_timer_cpu timer_cpu;
110
111 /*
112 * Anything that is not used directly from assembly code goes
113 * here.
114 */
115 /* dcache set/way operation pending */
116 int last_pcpu;
117 cpumask_t require_dcache_flush;
118
119 /* Don't run the guest */
120 bool pause;
121
122 /* IO related fields */
123 struct kvm_decode mmio_decode;
124
125 /* Interrupt related fields */
126 u64 irq_lines; /* IRQ and FIQ levels */
127
128 /* Cache some mmu pages needed inside spinlock regions */
129 struct kvm_mmu_memory_cache mmu_page_cache;
130
131 /* Target CPU and feature flags */
132 u32 target;
133 DECLARE_BITMAP(features, KVM_VCPU_MAX_FEATURES);
134
135 /* Detect first run of a vcpu */
136 bool has_run_once;
137};
138
139#define vcpu_gp_regs(v) (&(v)->arch.ctxt.gp_regs)
140#define vcpu_sys_reg(v,r) ((v)->arch.ctxt.sys_regs[(r)])
141#define vcpu_cp15(v,r) ((v)->arch.ctxt.cp15[(r)])
142
143struct kvm_vm_stat {
144 u32 remote_tlb_flush;
145};
146
147struct kvm_vcpu_stat {
148 u32 halt_wakeup;
149};
150
151struct kvm_vcpu_init;
152int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
153 const struct kvm_vcpu_init *init);
154unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu);
155int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices);
156struct kvm_one_reg;
157int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
158int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg);
159
160#define KVM_ARCH_WANT_MMU_NOTIFIER
161struct kvm;
162int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
163int kvm_unmap_hva_range(struct kvm *kvm,
164 unsigned long start, unsigned long end);
165void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
166
167/* We do not have shadow page tables, hence the empty hooks */
168static inline int kvm_age_hva(struct kvm *kvm, unsigned long hva)
169{
170 return 0;
171}
172
173static inline int kvm_test_age_hva(struct kvm *kvm, unsigned long hva)
174{
175 return 0;
176}
177
178struct kvm_vcpu *kvm_arm_get_running_vcpu(void);
179struct kvm_vcpu __percpu **kvm_get_running_vcpus(void);
180
181u64 kvm_call_hyp(void *hypfn, ...);
182
183int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
184 int exception_index);
185
186int kvm_perf_init(void);
187int kvm_perf_teardown(void);
188
189static inline void __cpu_init_hyp_mode(phys_addr_t boot_pgd_ptr,
190 phys_addr_t pgd_ptr,
191 unsigned long hyp_stack_ptr,
192 unsigned long vector_ptr)
193{
194 /*
195 * Call initialization code, and switch to the full blown
196 * HYP code.
197 */
198 kvm_call_hyp((void *)boot_pgd_ptr, pgd_ptr,
199 hyp_stack_ptr, vector_ptr);
200}
201
202#endif /* __ARM64_KVM_HOST_H__ */
diff --git a/arch/arm64/include/asm/kvm_mmio.h b/arch/arm64/include/asm/kvm_mmio.h
new file mode 100644
index 000000000000..fc2f689c0694
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_mmio.h
@@ -0,0 +1,59 @@
1/*
2 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __ARM64_KVM_MMIO_H__
19#define __ARM64_KVM_MMIO_H__
20
21#include <linux/kvm_host.h>
22#include <asm/kvm_asm.h>
23#include <asm/kvm_arm.h>
24
25/*
26 * This is annoying. The mmio code requires this, even if we don't
27 * need any decoding. To be fixed.
28 */
29struct kvm_decode {
30 unsigned long rt;
31 bool sign_extend;
32};
33
34/*
35 * The in-kernel MMIO emulation code wants to use a copy of run->mmio,
36 * which is an anonymous type. Use our own type instead.
37 */
38struct kvm_exit_mmio {
39 phys_addr_t phys_addr;
40 u8 data[8];
41 u32 len;
42 bool is_write;
43};
44
45static inline void kvm_prepare_mmio(struct kvm_run *run,
46 struct kvm_exit_mmio *mmio)
47{
48 run->mmio.phys_addr = mmio->phys_addr;
49 run->mmio.len = mmio->len;
50 run->mmio.is_write = mmio->is_write;
51 memcpy(run->mmio.data, mmio->data, mmio->len);
52 run->exit_reason = KVM_EXIT_MMIO;
53}
54
55int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run);
56int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run,
57 phys_addr_t fault_ipa);
58
59#endif /* __ARM64_KVM_MMIO_H__ */
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
new file mode 100644
index 000000000000..efe609c6a3c9
--- /dev/null
+++ b/arch/arm64/include/asm/kvm_mmu.h
@@ -0,0 +1,135 @@
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#ifndef __ARM64_KVM_MMU_H__
19#define __ARM64_KVM_MMU_H__
20
21#include <asm/page.h>
22#include <asm/memory.h>
23
24/*
25 * As we only have the TTBR0_EL2 register, we cannot express
26 * "negative" addresses. This makes it impossible to directly share
27 * mappings with the kernel.
28 *
29 * Instead, give the HYP mode its own VA region at a fixed offset from
30 * the kernel by just masking the top bits (which are all ones for a
31 * kernel address).
32 */
33#define HYP_PAGE_OFFSET_SHIFT VA_BITS
34#define HYP_PAGE_OFFSET_MASK ((UL(1) << HYP_PAGE_OFFSET_SHIFT) - 1)
35#define HYP_PAGE_OFFSET (PAGE_OFFSET & HYP_PAGE_OFFSET_MASK)
36
37/*
38 * Our virtual mapping for the idmap-ed MMU-enable code. Must be
39 * shared across all the page-tables. Conveniently, we use the last
40 * possible page, where no kernel mapping will ever exist.
41 */
42#define TRAMPOLINE_VA (HYP_PAGE_OFFSET_MASK & PAGE_MASK)
43
44#ifdef __ASSEMBLY__
45
46/*
47 * Convert a kernel VA into a HYP VA.
48 * reg: VA to be converted.
49 */
50.macro kern_hyp_va reg
51 and \reg, \reg, #HYP_PAGE_OFFSET_MASK
52.endm
53
54#else
55
56#include <asm/cachetype.h>
57#include <asm/cacheflush.h>
58
59#define KERN_TO_HYP(kva) ((unsigned long)kva - PAGE_OFFSET + HYP_PAGE_OFFSET)
60
61/*
62 * Align KVM with the kernel's view of physical memory. Should be
63 * 40bit IPA, with PGD being 8kB aligned in the 4KB page configuration.
64 */
65#define KVM_PHYS_SHIFT PHYS_MASK_SHIFT
66#define KVM_PHYS_SIZE (1UL << KVM_PHYS_SHIFT)
67#define KVM_PHYS_MASK (KVM_PHYS_SIZE - 1UL)
68
69/* Make sure we get the right size, and thus the right alignment */
70#define PTRS_PER_S2_PGD (1 << (KVM_PHYS_SHIFT - PGDIR_SHIFT))
71#define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t))
72
73int create_hyp_mappings(void *from, void *to);
74int create_hyp_io_mappings(void *from, void *to, phys_addr_t);
75void free_boot_hyp_pgd(void);
76void free_hyp_pgds(void);
77
78int kvm_alloc_stage2_pgd(struct kvm *kvm);
79void kvm_free_stage2_pgd(struct kvm *kvm);
80int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa,
81 phys_addr_t pa, unsigned long size);
82
83int kvm_handle_guest_abort(struct kvm_vcpu *vcpu, struct kvm_run *run);
84
85void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);
86
87phys_addr_t kvm_mmu_get_httbr(void);
88phys_addr_t kvm_mmu_get_boot_httbr(void);
89phys_addr_t kvm_get_idmap_vector(void);
90int kvm_mmu_init(void);
91void kvm_clear_hyp_idmap(void);
92
93#define kvm_set_pte(ptep, pte) set_pte(ptep, pte)
94
95static inline bool kvm_is_write_fault(unsigned long esr)
96{
97 unsigned long esr_ec = esr >> ESR_EL2_EC_SHIFT;
98
99 if (esr_ec == ESR_EL2_EC_IABT)
100 return false;
101
102 if ((esr & ESR_EL2_ISV) && !(esr & ESR_EL2_WNR))
103 return false;
104
105 return true;
106}
107
108static inline void kvm_clean_dcache_area(void *addr, size_t size) {}
109static inline void kvm_clean_pgd(pgd_t *pgd) {}
110static inline void kvm_clean_pmd_entry(pmd_t *pmd) {}
111static inline void kvm_clean_pte(pte_t *pte) {}
112static inline void kvm_clean_pte_entry(pte_t *pte) {}
113
114static inline void kvm_set_s2pte_writable(pte_t *pte)
115{
116 pte_val(*pte) |= PTE_S2_RDWR;
117}
118
119struct kvm;
120
121static inline void coherent_icache_guest_page(struct kvm *kvm, gfn_t gfn)
122{
123 if (!icache_is_aliasing()) { /* PIPT */
124 unsigned long hva = gfn_to_hva(kvm, gfn);
125 flush_icache_range(hva, hva + PAGE_SIZE);
126 } else if (!icache_is_aivivt()) { /* non ASID-tagged VIVT */
127 /* any kind of VIPT cache */
128 __flush_icache_all();
129 }
130}
131
132#define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l))
133
134#endif /* __ASSEMBLY__ */
135#endif /* __ARM64_KVM_MMU_H__ */
diff --git a/arch/arm/mach-msm/gpiomux-8x60.c b/arch/arm64/include/asm/kvm_psci.h
index 7b380b31bd0e..e301a4816355 100644
--- a/arch/arm/mach-msm/gpiomux-8x60.c
+++ b/arch/arm64/include/asm/kvm_psci.h
@@ -1,8 +1,10 @@
1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved. 1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
2 * 4 *
3 * 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
4 * it under the terms of the GNU General Public License version 2 and 6 * it under the terms of the GNU General Public License version 2 as
5 * only version 2 as published by the Free Software Foundation. 7 * published by the Free Software Foundation.
6 * 8 *
7 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -10,10 +12,12 @@
10 * GNU General Public License for more details. 12 * GNU General Public License for more details.
11 * 13 *
12 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */ 16 */
17#include "gpiomux.h"
18 17
19struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {}; 18#ifndef __ARM64_KVM_PSCI_H__
19#define __ARM64_KVM_PSCI_H__
20
21bool kvm_psci_call(struct kvm_vcpu *vcpu);
22
23#endif /* __ARM64_KVM_PSCI_H__ */
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index 381f556b664e..20925bcf4e2a 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -90,6 +90,12 @@
90#define MT_NORMAL_NC 3 90#define MT_NORMAL_NC 3
91#define MT_NORMAL 4 91#define MT_NORMAL 4
92 92
93/*
94 * Memory types for Stage-2 translation
95 */
96#define MT_S2_NORMAL 0xf
97#define MT_S2_DEVICE_nGnRE 0x1
98
93#ifndef __ASSEMBLY__ 99#ifndef __ASSEMBLY__
94 100
95extern phys_addr_t memstart_addr; 101extern phys_addr_t memstart_addr;
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index e2bc385adb6b..a9eee33dfa62 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -151,12 +151,6 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
151{ 151{
152 unsigned int cpu = smp_processor_id(); 152 unsigned int cpu = smp_processor_id();
153 153
154#ifdef CONFIG_SMP
155 /* check for possible thread migration */
156 if (!cpumask_empty(mm_cpumask(next)) &&
157 !cpumask_test_cpu(cpu, mm_cpumask(next)))
158 __flush_icache_all();
159#endif
160 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) 154 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next)
161 check_and_switch_context(next, tsk); 155 check_and_switch_context(next, tsk);
162} 156}
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index 75fd13d289b9..e182a356c979 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -25,16 +25,27 @@
25/* 25/*
26 * Hardware page table definitions. 26 * Hardware page table definitions.
27 * 27 *
28 * Level 1 descriptor (PUD).
29 */
30
31#define PUD_TABLE_BIT (_AT(pgdval_t, 1) << 1)
32
33/*
28 * Level 2 descriptor (PMD). 34 * Level 2 descriptor (PMD).
29 */ 35 */
30#define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0) 36#define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0)
31#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0) 37#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0)
32#define PMD_TYPE_TABLE (_AT(pmdval_t, 3) << 0) 38#define PMD_TYPE_TABLE (_AT(pmdval_t, 3) << 0)
33#define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0) 39#define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0)
40#define PMD_TABLE_BIT (_AT(pmdval_t, 1) << 1)
34 41
35/* 42/*
36 * Section 43 * Section
37 */ 44 */
45#define PMD_SECT_VALID (_AT(pmdval_t, 1) << 0)
46#define PMD_SECT_PROT_NONE (_AT(pmdval_t, 1) << 2)
47#define PMD_SECT_USER (_AT(pmdval_t, 1) << 6) /* AP[1] */
48#define PMD_SECT_RDONLY (_AT(pmdval_t, 1) << 7) /* AP[2] */
38#define PMD_SECT_S (_AT(pmdval_t, 3) << 8) 49#define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
39#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10) 50#define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
40#define PMD_SECT_NG (_AT(pmdval_t, 1) << 11) 51#define PMD_SECT_NG (_AT(pmdval_t, 1) << 11)
@@ -53,6 +64,7 @@
53#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0) 64#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
54#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0) 65#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0)
55#define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0) 66#define PTE_TYPE_PAGE (_AT(pteval_t, 3) << 0)
67#define PTE_TABLE_BIT (_AT(pteval_t, 1) << 1)
56#define PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ 68#define PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
57#define PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */ 69#define PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
58#define PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */ 70#define PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
@@ -68,6 +80,24 @@
68#define PTE_ATTRINDX_MASK (_AT(pteval_t, 7) << 2) 80#define PTE_ATTRINDX_MASK (_AT(pteval_t, 7) << 2)
69 81
70/* 82/*
83 * 2nd stage PTE definitions
84 */
85#define PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* HAP[2:1] */
86#define PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* HAP[2:1] */
87
88/*
89 * Memory Attribute override for Stage-2 (MemAttr[3:0])
90 */
91#define PTE_S2_MEMATTR(t) (_AT(pteval_t, (t)) << 2)
92#define PTE_S2_MEMATTR_MASK (_AT(pteval_t, 0xf) << 2)
93
94/*
95 * EL2/HYP PTE/PMD definitions
96 */
97#define PMD_HYP PMD_SECT_USER
98#define PTE_HYP PTE_USER
99
100/*
71 * 40-bit physical address supported. 101 * 40-bit physical address supported.
72 */ 102 */
73#define PHYS_MASK_SHIFT (40) 103#define PHYS_MASK_SHIFT (40)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index e333a243bfcc..f0bebc5e22cd 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -25,8 +25,8 @@
25 * Software defined PTE bits definition. 25 * Software defined PTE bits definition.
26 */ 26 */
27#define PTE_VALID (_AT(pteval_t, 1) << 0) 27#define PTE_VALID (_AT(pteval_t, 1) << 0)
28#define PTE_PROT_NONE (_AT(pteval_t, 1) << 1) /* only when !PTE_VALID */ 28#define PTE_PROT_NONE (_AT(pteval_t, 1) << 2) /* only when !PTE_VALID */
29#define PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !pte_present() */ 29#define PTE_FILE (_AT(pteval_t, 1) << 3) /* only when !pte_present() */
30#define PTE_DIRTY (_AT(pteval_t, 1) << 55) 30#define PTE_DIRTY (_AT(pteval_t, 1) << 55)
31#define PTE_SPECIAL (_AT(pteval_t, 1) << 56) 31#define PTE_SPECIAL (_AT(pteval_t, 1) << 56)
32 32
@@ -66,7 +66,7 @@ extern pgprot_t pgprot_default;
66 66
67#define _MOD_PROT(p, b) __pgprot_modify(p, 0, b) 67#define _MOD_PROT(p, b) __pgprot_modify(p, 0, b)
68 68
69#define PAGE_NONE __pgprot_modify(pgprot_default, PTE_TYPE_MASK, PTE_PROT_NONE) 69#define PAGE_NONE __pgprot_modify(pgprot_default, PTE_TYPE_MASK, PTE_PROT_NONE | PTE_RDONLY | PTE_PXN | PTE_UXN)
70#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) 70#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
71#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN) 71#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN)
72#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 72#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
@@ -76,7 +76,13 @@ extern pgprot_t pgprot_default;
76#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY) 76#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY)
77#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY) 77#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY)
78 78
79#define __PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE) 79#define PAGE_HYP _MOD_PROT(pgprot_default, PTE_HYP)
80#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP)
81
82#define PAGE_S2 __pgprot_modify(pgprot_default, PTE_S2_MEMATTR_MASK, PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY)
83#define PAGE_S2_DEVICE __pgprot(PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_DEVICE_nGnRE) | PTE_S2_RDWR | PTE_UXN)
84
85#define __PAGE_NONE __pgprot(((_PAGE_DEFAULT) & ~PTE_TYPE_MASK) | PTE_PROT_NONE | PTE_RDONLY | PTE_PXN | PTE_UXN)
80#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN) 86#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
81#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN) 87#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
82#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY) 88#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
@@ -119,7 +125,7 @@ extern struct page *empty_zero_page;
119#define pte_none(pte) (!pte_val(pte)) 125#define pte_none(pte) (!pte_val(pte))
120#define pte_clear(mm,addr,ptep) set_pte(ptep, __pte(0)) 126#define pte_clear(mm,addr,ptep) set_pte(ptep, __pte(0))
121#define pte_page(pte) (pfn_to_page(pte_pfn(pte))) 127#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
122#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) 128#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + pte_index(addr))
123 129
124#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) 130#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
125#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) 131#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr))
@@ -173,12 +179,76 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
173/* 179/*
174 * Huge pte definitions. 180 * Huge pte definitions.
175 */ 181 */
176#define pte_huge(pte) ((pte_val(pte) & PTE_TYPE_MASK) == PTE_TYPE_HUGEPAGE) 182#define pte_huge(pte) (!(pte_val(pte) & PTE_TABLE_BIT))
177#define pte_mkhuge(pte) (__pte((pte_val(pte) & ~PTE_TYPE_MASK) | PTE_TYPE_HUGEPAGE)) 183#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT))
184
185/*
186 * Hugetlb definitions.
187 */
188#define HUGE_MAX_HSTATE 2
189#define HPAGE_SHIFT PMD_SHIFT
190#define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT)
191#define HPAGE_MASK (~(HPAGE_SIZE - 1))
192#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
178 193
179#define __HAVE_ARCH_PTE_SPECIAL 194#define __HAVE_ARCH_PTE_SPECIAL
180 195
181/* 196/*
197 * Software PMD bits for THP
198 */
199
200#define PMD_SECT_DIRTY (_AT(pmdval_t, 1) << 55)
201#define PMD_SECT_SPLITTING (_AT(pmdval_t, 1) << 57)
202
203/*
204 * THP definitions.
205 */
206#define pmd_young(pmd) (pmd_val(pmd) & PMD_SECT_AF)
207
208#define __HAVE_ARCH_PMD_WRITE
209#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY))
210
211#ifdef CONFIG_TRANSPARENT_HUGEPAGE
212#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
213#define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING)
214#endif
215
216#define PMD_BIT_FUNC(fn,op) \
217static inline pmd_t pmd_##fn(pmd_t pmd) { pmd_val(pmd) op; return pmd; }
218
219PMD_BIT_FUNC(wrprotect, |= PMD_SECT_RDONLY);
220PMD_BIT_FUNC(mkold, &= ~PMD_SECT_AF);
221PMD_BIT_FUNC(mksplitting, |= PMD_SECT_SPLITTING);
222PMD_BIT_FUNC(mkwrite, &= ~PMD_SECT_RDONLY);
223PMD_BIT_FUNC(mkdirty, |= PMD_SECT_DIRTY);
224PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
225PMD_BIT_FUNC(mknotpresent, &= ~PMD_TYPE_MASK);
226
227#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))
228
229#define pmd_pfn(pmd) (((pmd_val(pmd) & PMD_MASK) & PHYS_MASK) >> PAGE_SHIFT)
230#define pfn_pmd(pfn,prot) (__pmd(((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
231#define mk_pmd(page,prot) pfn_pmd(page_to_pfn(page),prot)
232
233#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
234
235static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
236{
237 const pmdval_t mask = PMD_SECT_USER | PMD_SECT_PXN | PMD_SECT_UXN |
238 PMD_SECT_RDONLY | PMD_SECT_PROT_NONE |
239 PMD_SECT_VALID;
240 pmd_val(pmd) = (pmd_val(pmd) & ~mask) | (pgprot_val(newprot) & mask);
241 return pmd;
242}
243
244#define set_pmd_at(mm, addr, pmdp, pmd) set_pmd(pmdp, pmd)
245
246static inline int has_transparent_hugepage(void)
247{
248 return 1;
249}
250
251/*
182 * Mark the prot value as uncacheable and unbufferable. 252 * Mark the prot value as uncacheable and unbufferable.
183 */ 253 */
184#define pgprot_noncached(prot) \ 254#define pgprot_noncached(prot) \
@@ -197,6 +267,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
197 267
198#define pmd_bad(pmd) (!(pmd_val(pmd) & 2)) 268#define pmd_bad(pmd) (!(pmd_val(pmd) & 2))
199 269
270#define pmd_table(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
271 PMD_TYPE_TABLE)
272#define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
273 PMD_TYPE_SECT)
274
275
200static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) 276static inline void set_pmd(pmd_t *pmdp, pmd_t pmd)
201{ 277{
202 *pmdp = pmd; 278 *pmdp = pmd;
@@ -263,7 +339,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr)
263#endif 339#endif
264 340
265/* Find an entry in the third-level page table.. */ 341/* Find an entry in the third-level page table.. */
266#define __pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 342#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
267 343
268static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 344static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
269{ 345{
@@ -281,12 +357,12 @@ extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
281 357
282/* 358/*
283 * Encode and decode a swap entry: 359 * Encode and decode a swap entry:
284 * bits 0-1: present (must be zero) 360 * bits 0, 2: present (must both be zero)
285 * bit 2: PTE_FILE 361 * bit 3: PTE_FILE
286 * bits 3-8: swap type 362 * bits 4-8: swap type
287 * bits 9-63: swap offset 363 * bits 9-63: swap offset
288 */ 364 */
289#define __SWP_TYPE_SHIFT 3 365#define __SWP_TYPE_SHIFT 4
290#define __SWP_TYPE_BITS 6 366#define __SWP_TYPE_BITS 6
291#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) 367#define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1)
292#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) 368#define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT)
@@ -306,27 +382,20 @@ extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
306 382
307/* 383/*
308 * Encode and decode a file entry: 384 * Encode and decode a file entry:
309 * bits 0-1: present (must be zero) 385 * bits 0, 2: present (must both be zero)
310 * bit 2: PTE_FILE 386 * bit 3: PTE_FILE
311 * bits 3-63: file offset / PAGE_SIZE 387 * bits 4-63: file offset / PAGE_SIZE
312 */ 388 */
313#define pte_file(pte) (pte_val(pte) & PTE_FILE) 389#define pte_file(pte) (pte_val(pte) & PTE_FILE)
314#define pte_to_pgoff(x) (pte_val(x) >> 3) 390#define pte_to_pgoff(x) (pte_val(x) >> 4)
315#define pgoff_to_pte(x) __pte(((x) << 3) | PTE_FILE) 391#define pgoff_to_pte(x) __pte(((x) << 4) | PTE_FILE)
316 392
317#define PTE_FILE_MAX_BITS 61 393#define PTE_FILE_MAX_BITS 60
318 394
319extern int kern_addr_valid(unsigned long addr); 395extern int kern_addr_valid(unsigned long addr);
320 396
321#include <asm-generic/pgtable.h> 397#include <asm-generic/pgtable.h>
322 398
323/*
324 * remap a physical page `pfn' of size `size' with page protection `prot'
325 * into virtual address `from'
326 */
327#define io_remap_pfn_range(vma,from,pfn,size,prot) \
328 remap_pfn_range(vma, from, pfn, size, prot)
329
330#define pgtable_cache_init() do { } while (0) 399#define pgtable_cache_init() do { } while (0)
331 400
332#endif /* !__ASSEMBLY__ */ 401#endif /* !__ASSEMBLY__ */
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 41a71ee4c3df..0dacbbf9458b 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -171,7 +171,5 @@ extern unsigned long profile_pc(struct pt_regs *regs);
171#define profile_pc(regs) instruction_pointer(regs) 171#define profile_pc(regs) instruction_pointer(regs)
172#endif 172#endif
173 173
174extern int aarch32_break_trap(struct pt_regs *regs);
175
176#endif /* __ASSEMBLY__ */ 174#endif /* __ASSEMBLY__ */
177#endif 175#endif
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h
index 7065e920149d..0defa0728a9b 100644
--- a/arch/arm64/include/asm/spinlock.h
+++ b/arch/arm64/include/asm/spinlock.h
@@ -59,9 +59,10 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
59 unsigned int tmp; 59 unsigned int tmp;
60 60
61 asm volatile( 61 asm volatile(
62 " ldaxr %w0, %1\n" 62 "2: ldaxr %w0, %1\n"
63 " cbnz %w0, 1f\n" 63 " cbnz %w0, 1f\n"
64 " stxr %w0, %w2, %1\n" 64 " stxr %w0, %w2, %1\n"
65 " cbnz %w0, 2b\n"
65 "1:\n" 66 "1:\n"
66 : "=&r" (tmp), "+Q" (lock->lock) 67 : "=&r" (tmp), "+Q" (lock->lock)
67 : "r" (1) 68 : "r" (1)
diff --git a/arch/arm64/include/asm/sync_bitops.h b/arch/arm64/include/asm/sync_bitops.h
new file mode 100644
index 000000000000..8da0bf4f7659
--- /dev/null
+++ b/arch/arm64/include/asm/sync_bitops.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_SYNC_BITOPS_H__
2#define __ASM_SYNC_BITOPS_H__
3
4#include <asm/bitops.h>
5#include <asm/cmpxchg.h>
6
7/* sync_bitops functions are equivalent to the SMP implementation of the
8 * original functions, independently from CONFIG_SMP being defined.
9 *
10 * We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But
11 * under Xen you might be communicating with a completely external entity
12 * who might be on another CPU (e.g. two uniprocessor guests communicating
13 * via event channels and grant tables). So we need a variant of the bit
14 * ops which are SMP safe even on a UP kernel.
15 */
16
17#define sync_set_bit(nr, p) set_bit(nr, p)
18#define sync_clear_bit(nr, p) clear_bit(nr, p)
19#define sync_change_bit(nr, p) change_bit(nr, p)
20#define sync_test_and_set_bit(nr, p) test_and_set_bit(nr, p)
21#define sync_test_and_clear_bit(nr, p) test_and_clear_bit(nr, p)
22#define sync_test_and_change_bit(nr, p) test_and_change_bit(nr, p)
23#define sync_test_bit(nr, addr) test_bit(nr, addr)
24#define sync_cmpxchg cmpxchg
25
26#endif
diff --git a/arch/arm64/include/asm/timex.h b/arch/arm64/include/asm/timex.h
index b24a31a7e2c9..81a076eb37fa 100644
--- a/arch/arm64/include/asm/timex.h
+++ b/arch/arm64/include/asm/timex.h
@@ -16,14 +16,14 @@
16#ifndef __ASM_TIMEX_H 16#ifndef __ASM_TIMEX_H
17#define __ASM_TIMEX_H 17#define __ASM_TIMEX_H
18 18
19#include <asm/arch_timer.h>
20
19/* 21/*
20 * Use the current timer as a cycle counter since this is what we use for 22 * Use the current timer as a cycle counter since this is what we use for
21 * the delay loop. 23 * the delay loop.
22 */ 24 */
23#define get_cycles() ({ cycles_t c; read_current_timer(&c); c; }) 25#define get_cycles() arch_counter_get_cntvct()
24 26
25#include <asm-generic/timex.h> 27#include <asm-generic/timex.h>
26 28
27#define ARCH_HAS_READ_CURRENT_TIMER
28
29#endif 29#endif
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index 654f0968030b..46b3beb4b773 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -187,4 +187,10 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
187 187
188#define tlb_migrate_finish(mm) do { } while (0) 188#define tlb_migrate_finish(mm) do { } while (0)
189 189
190static inline void
191tlb_remove_pmd_tlb_entry(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
192{
193 tlb_add_flush(tlb, addr);
194}
195
190#endif 196#endif
diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h
index 122d6320f745..8b482035cfc2 100644
--- a/arch/arm64/include/asm/tlbflush.h
+++ b/arch/arm64/include/asm/tlbflush.h
@@ -117,6 +117,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
117 dsb(); 117 dsb();
118} 118}
119 119
120#define update_mmu_cache_pmd(vma, address, pmd) do { } while (0)
121
120#endif 122#endif
121 123
122#endif 124#endif
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index 008f8481da65..edb3d5c73a32 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -166,7 +166,7 @@ do { \
166 166
167#define get_user(x, ptr) \ 167#define get_user(x, ptr) \
168({ \ 168({ \
169 might_sleep(); \ 169 might_fault(); \
170 access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) ? \ 170 access_ok(VERIFY_READ, (ptr), sizeof(*(ptr))) ? \
171 __get_user((x), (ptr)) : \ 171 __get_user((x), (ptr)) : \
172 ((x) = 0, -EFAULT); \ 172 ((x) = 0, -EFAULT); \
@@ -227,7 +227,7 @@ do { \
227 227
228#define put_user(x, ptr) \ 228#define put_user(x, ptr) \
229({ \ 229({ \
230 might_sleep(); \ 230 might_fault(); \
231 access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) ? \ 231 access_ok(VERIFY_WRITE, (ptr), sizeof(*(ptr))) ? \
232 __put_user((x), (ptr)) : \ 232 __put_user((x), (ptr)) : \
233 -EFAULT; \ 233 -EFAULT; \
diff --git a/arch/arm64/include/asm/xen/events.h b/arch/arm64/include/asm/xen/events.h
new file mode 100644
index 000000000000..86553213c132
--- /dev/null
+++ b/arch/arm64/include/asm/xen/events.h
@@ -0,0 +1,21 @@
1#ifndef _ASM_ARM64_XEN_EVENTS_H
2#define _ASM_ARM64_XEN_EVENTS_H
3
4#include <asm/ptrace.h>
5#include <asm/atomic.h>
6
7enum ipi_vector {
8 XEN_PLACEHOLDER_VECTOR,
9
10 /* Xen IPIs go here */
11 XEN_NR_IPIS,
12};
13
14static inline int xen_irqs_disabled(struct pt_regs *regs)
15{
16 return raw_irqs_disabled_flags((unsigned long) regs->pstate);
17}
18
19#define xchg_xen_ulong(ptr, val) xchg((ptr), (val))
20
21#endif /* _ASM_ARM64_XEN_EVENTS_H */
diff --git a/arch/arm64/include/asm/xen/hypercall.h b/arch/arm64/include/asm/xen/hypercall.h
new file mode 100644
index 000000000000..74b0c423ff5b
--- /dev/null
+++ b/arch/arm64/include/asm/xen/hypercall.h
@@ -0,0 +1 @@
#include <../../arm/include/asm/xen/hypercall.h>
diff --git a/arch/arm64/include/asm/xen/hypervisor.h b/arch/arm64/include/asm/xen/hypervisor.h
new file mode 100644
index 000000000000..f263da8e8769
--- /dev/null
+++ b/arch/arm64/include/asm/xen/hypervisor.h
@@ -0,0 +1 @@
#include <../../arm/include/asm/xen/hypervisor.h>
diff --git a/arch/arm64/include/asm/xen/interface.h b/arch/arm64/include/asm/xen/interface.h
new file mode 100644
index 000000000000..44457aebeed4
--- /dev/null
+++ b/arch/arm64/include/asm/xen/interface.h
@@ -0,0 +1 @@
#include <../../arm/include/asm/xen/interface.h>
diff --git a/arch/arm64/include/asm/xen/page.h b/arch/arm64/include/asm/xen/page.h
new file mode 100644
index 000000000000..bed87ec36780
--- /dev/null
+++ b/arch/arm64/include/asm/xen/page.h
@@ -0,0 +1 @@
#include <../../arm/include/asm/xen/page.h>
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
new file mode 100644
index 000000000000..5031f4263937
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -0,0 +1,168 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/include/uapi/asm/kvm.h:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __ARM_KVM_H__
23#define __ARM_KVM_H__
24
25#define KVM_SPSR_EL1 0
26#define KVM_SPSR_SVC KVM_SPSR_EL1
27#define KVM_SPSR_ABT 1
28#define KVM_SPSR_UND 2
29#define KVM_SPSR_IRQ 3
30#define KVM_SPSR_FIQ 4
31#define KVM_NR_SPSR 5
32
33#ifndef __ASSEMBLY__
34#include <asm/types.h>
35#include <asm/ptrace.h>
36
37#define __KVM_HAVE_GUEST_DEBUG
38#define __KVM_HAVE_IRQ_LINE
39
40#define KVM_REG_SIZE(id) \
41 (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
42
43struct kvm_regs {
44 struct user_pt_regs regs; /* sp = sp_el0 */
45
46 __u64 sp_el1;
47 __u64 elr_el1;
48
49 __u64 spsr[KVM_NR_SPSR];
50
51 struct user_fpsimd_state fp_regs;
52};
53
54/* Supported Processor Types */
55#define KVM_ARM_TARGET_AEM_V8 0
56#define KVM_ARM_TARGET_FOUNDATION_V8 1
57#define KVM_ARM_TARGET_CORTEX_A57 2
58
59#define KVM_ARM_NUM_TARGETS 3
60
61/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
62#define KVM_ARM_DEVICE_TYPE_SHIFT 0
63#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
64#define KVM_ARM_DEVICE_ID_SHIFT 16
65#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
66
67/* Supported device IDs */
68#define KVM_ARM_DEVICE_VGIC_V2 0
69
70/* Supported VGIC address types */
71#define KVM_VGIC_V2_ADDR_TYPE_DIST 0
72#define KVM_VGIC_V2_ADDR_TYPE_CPU 1
73
74#define KVM_VGIC_V2_DIST_SIZE 0x1000
75#define KVM_VGIC_V2_CPU_SIZE 0x2000
76
77#define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */
78#define KVM_ARM_VCPU_EL1_32BIT 1 /* CPU running a 32bit VM */
79
80struct kvm_vcpu_init {
81 __u32 target;
82 __u32 features[7];
83};
84
85struct kvm_sregs {
86};
87
88struct kvm_fpu {
89};
90
91struct kvm_guest_debug_arch {
92};
93
94struct kvm_debug_exit_arch {
95};
96
97struct kvm_sync_regs {
98};
99
100struct kvm_arch_memory_slot {
101};
102
103/* If you need to interpret the index values, here is the key: */
104#define KVM_REG_ARM_COPROC_MASK 0x000000000FFF0000
105#define KVM_REG_ARM_COPROC_SHIFT 16
106
107/* Normal registers are mapped as coprocessor 16. */
108#define KVM_REG_ARM_CORE (0x0010 << KVM_REG_ARM_COPROC_SHIFT)
109#define KVM_REG_ARM_CORE_REG(name) (offsetof(struct kvm_regs, name) / sizeof(__u32))
110
111/* Some registers need more space to represent values. */
112#define KVM_REG_ARM_DEMUX (0x0011 << KVM_REG_ARM_COPROC_SHIFT)
113#define KVM_REG_ARM_DEMUX_ID_MASK 0x000000000000FF00
114#define KVM_REG_ARM_DEMUX_ID_SHIFT 8
115#define KVM_REG_ARM_DEMUX_ID_CCSIDR (0x00 << KVM_REG_ARM_DEMUX_ID_SHIFT)
116#define KVM_REG_ARM_DEMUX_VAL_MASK 0x00000000000000FF
117#define KVM_REG_ARM_DEMUX_VAL_SHIFT 0
118
119/* AArch64 system registers */
120#define KVM_REG_ARM64_SYSREG (0x0013 << KVM_REG_ARM_COPROC_SHIFT)
121#define KVM_REG_ARM64_SYSREG_OP0_MASK 0x000000000000c000
122#define KVM_REG_ARM64_SYSREG_OP0_SHIFT 14
123#define KVM_REG_ARM64_SYSREG_OP1_MASK 0x0000000000003800
124#define KVM_REG_ARM64_SYSREG_OP1_SHIFT 11
125#define KVM_REG_ARM64_SYSREG_CRN_MASK 0x0000000000000780
126#define KVM_REG_ARM64_SYSREG_CRN_SHIFT 7
127#define KVM_REG_ARM64_SYSREG_CRM_MASK 0x0000000000000078
128#define KVM_REG_ARM64_SYSREG_CRM_SHIFT 3
129#define KVM_REG_ARM64_SYSREG_OP2_MASK 0x0000000000000007
130#define KVM_REG_ARM64_SYSREG_OP2_SHIFT 0
131
132/* KVM_IRQ_LINE irq field index values */
133#define KVM_ARM_IRQ_TYPE_SHIFT 24
134#define KVM_ARM_IRQ_TYPE_MASK 0xff
135#define KVM_ARM_IRQ_VCPU_SHIFT 16
136#define KVM_ARM_IRQ_VCPU_MASK 0xff
137#define KVM_ARM_IRQ_NUM_SHIFT 0
138#define KVM_ARM_IRQ_NUM_MASK 0xffff
139
140/* irq_type field */
141#define KVM_ARM_IRQ_TYPE_CPU 0
142#define KVM_ARM_IRQ_TYPE_SPI 1
143#define KVM_ARM_IRQ_TYPE_PPI 2
144
145/* out-of-kernel GIC cpu interrupt injection irq_number field */
146#define KVM_ARM_IRQ_CPU_IRQ 0
147#define KVM_ARM_IRQ_CPU_FIQ 1
148
149/* Highest supported SPI, from VGIC_NR_IRQS */
150#define KVM_ARM_IRQ_GIC_MAX 127
151
152/* PSCI interface */
153#define KVM_PSCI_FN_BASE 0x95c1ba5e
154#define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n))
155
156#define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0)
157#define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1)
158#define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2)
159#define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3)
160
161#define KVM_PSCI_RET_SUCCESS 0
162#define KVM_PSCI_RET_NI ((unsigned long)-1)
163#define KVM_PSCI_RET_INVAL ((unsigned long)-2)
164#define KVM_PSCI_RET_DENIED ((unsigned long)-3)
165
166#endif
167
168#endif /* __ARM_KVM_H__ */
diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
index a2a4d810bea3..49c162c03b69 100644
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -104,5 +104,38 @@ int main(void)
104 BLANK(); 104 BLANK();
105 DEFINE(TZ_MINWEST, offsetof(struct timezone, tz_minuteswest)); 105 DEFINE(TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
106 DEFINE(TZ_DSTTIME, offsetof(struct timezone, tz_dsttime)); 106 DEFINE(TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
107 BLANK();
108#ifdef CONFIG_KVM_ARM_HOST
109 DEFINE(VCPU_CONTEXT, offsetof(struct kvm_vcpu, arch.ctxt));
110 DEFINE(CPU_GP_REGS, offsetof(struct kvm_cpu_context, gp_regs));
111 DEFINE(CPU_USER_PT_REGS, offsetof(struct kvm_regs, regs));
112 DEFINE(CPU_FP_REGS, offsetof(struct kvm_regs, fp_regs));
113 DEFINE(CPU_SP_EL1, offsetof(struct kvm_regs, sp_el1));
114 DEFINE(CPU_ELR_EL1, offsetof(struct kvm_regs, elr_el1));
115 DEFINE(CPU_SPSR, offsetof(struct kvm_regs, spsr));
116 DEFINE(CPU_SYSREGS, offsetof(struct kvm_cpu_context, sys_regs));
117 DEFINE(VCPU_ESR_EL2, offsetof(struct kvm_vcpu, arch.fault.esr_el2));
118 DEFINE(VCPU_FAR_EL2, offsetof(struct kvm_vcpu, arch.fault.far_el2));
119 DEFINE(VCPU_HPFAR_EL2, offsetof(struct kvm_vcpu, arch.fault.hpfar_el2));
120 DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2));
121 DEFINE(VCPU_IRQ_LINES, offsetof(struct kvm_vcpu, arch.irq_lines));
122 DEFINE(VCPU_HOST_CONTEXT, offsetof(struct kvm_vcpu, arch.host_cpu_context));
123 DEFINE(VCPU_TIMER_CNTV_CTL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl));
124 DEFINE(VCPU_TIMER_CNTV_CVAL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_cval));
125 DEFINE(KVM_TIMER_CNTVOFF, offsetof(struct kvm, arch.timer.cntvoff));
126 DEFINE(KVM_TIMER_ENABLED, offsetof(struct kvm, arch.timer.enabled));
127 DEFINE(VCPU_KVM, offsetof(struct kvm_vcpu, kvm));
128 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu));
129 DEFINE(VGIC_CPU_HCR, offsetof(struct vgic_cpu, vgic_hcr));
130 DEFINE(VGIC_CPU_VMCR, offsetof(struct vgic_cpu, vgic_vmcr));
131 DEFINE(VGIC_CPU_MISR, offsetof(struct vgic_cpu, vgic_misr));
132 DEFINE(VGIC_CPU_EISR, offsetof(struct vgic_cpu, vgic_eisr));
133 DEFINE(VGIC_CPU_ELRSR, offsetof(struct vgic_cpu, vgic_elrsr));
134 DEFINE(VGIC_CPU_APR, offsetof(struct vgic_cpu, vgic_apr));
135 DEFINE(VGIC_CPU_LR, offsetof(struct vgic_cpu, vgic_lr));
136 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr));
137 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr));
138 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base));
139#endif
107 return 0; 140 return 0;
108} 141}
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index f4726dc054b3..08018e3df580 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/stat.h> 26#include <linux/stat.h>
27#include <linux/uaccess.h>
27 28
28#include <asm/debug-monitors.h> 29#include <asm/debug-monitors.h>
29#include <asm/local.h> 30#include <asm/local.h>
@@ -226,13 +227,74 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
226 return 0; 227 return 0;
227} 228}
228 229
229static int __init single_step_init(void) 230static int brk_handler(unsigned long addr, unsigned int esr,
231 struct pt_regs *regs)
232{
233 siginfo_t info;
234
235 if (!user_mode(regs))
236 return -EFAULT;
237
238 info = (siginfo_t) {
239 .si_signo = SIGTRAP,
240 .si_errno = 0,
241 .si_code = TRAP_BRKPT,
242 .si_addr = (void __user *)instruction_pointer(regs),
243 };
244
245 force_sig_info(SIGTRAP, &info, current);
246 return 0;
247}
248
249int aarch32_break_handler(struct pt_regs *regs)
250{
251 siginfo_t info;
252 unsigned int instr;
253 bool bp = false;
254 void __user *pc = (void __user *)instruction_pointer(regs);
255
256 if (!compat_user_mode(regs))
257 return -EFAULT;
258
259 if (compat_thumb_mode(regs)) {
260 /* get 16-bit Thumb instruction */
261 get_user(instr, (u16 __user *)pc);
262 if (instr == AARCH32_BREAK_THUMB2_LO) {
263 /* get second half of 32-bit Thumb-2 instruction */
264 get_user(instr, (u16 __user *)(pc + 2));
265 bp = instr == AARCH32_BREAK_THUMB2_HI;
266 } else {
267 bp = instr == AARCH32_BREAK_THUMB;
268 }
269 } else {
270 /* 32-bit ARM instruction */
271 get_user(instr, (u32 __user *)pc);
272 bp = (instr & ~0xf0000000) == AARCH32_BREAK_ARM;
273 }
274
275 if (!bp)
276 return -EFAULT;
277
278 info = (siginfo_t) {
279 .si_signo = SIGTRAP,
280 .si_errno = 0,
281 .si_code = TRAP_BRKPT,
282 .si_addr = pc,
283 };
284
285 force_sig_info(SIGTRAP, &info, current);
286 return 0;
287}
288
289static int __init debug_traps_init(void)
230{ 290{
231 hook_debug_fault_code(DBG_ESR_EVT_HWSS, single_step_handler, SIGTRAP, 291 hook_debug_fault_code(DBG_ESR_EVT_HWSS, single_step_handler, SIGTRAP,
232 TRAP_HWBKPT, "single-step handler"); 292 TRAP_HWBKPT, "single-step handler");
293 hook_debug_fault_code(DBG_ESR_EVT_BRK, brk_handler, SIGTRAP,
294 TRAP_BRKPT, "ptrace BRK handler");
233 return 0; 295 return 0;
234} 296}
235arch_initcall(single_step_init); 297arch_initcall(debug_traps_init);
236 298
237/* Re-enable single step for syscall restarting. */ 299/* Re-enable single step for syscall restarting. */
238void user_rewind_single_step(struct task_struct *task) 300void user_rewind_single_step(struct task_struct *task)
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 1e49e5eb81e9..9ba33c40cdf8 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1336,6 +1336,7 @@ void perf_callchain_user(struct perf_callchain_entry *entry,
1336 return; 1336 return;
1337 } 1337 }
1338 1338
1339 perf_callchain_store(entry, regs->pc);
1339 tail = (struct frame_tail __user *)regs->regs[29]; 1340 tail = (struct frame_tail __user *)regs->regs[29];
1340 1341
1341 while (entry->nr < PERF_MAX_STACK_DEPTH && 1342 while (entry->nr < PERF_MAX_STACK_DEPTH &&
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index 6e1e77f1831c..fecdbf7de82e 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -53,28 +53,6 @@ void ptrace_disable(struct task_struct *child)
53{ 53{
54} 54}
55 55
56/*
57 * Handle hitting a breakpoint.
58 */
59static int ptrace_break(struct pt_regs *regs)
60{
61 siginfo_t info = {
62 .si_signo = SIGTRAP,
63 .si_errno = 0,
64 .si_code = TRAP_BRKPT,
65 .si_addr = (void __user *)instruction_pointer(regs),
66 };
67
68 force_sig_info(SIGTRAP, &info, current);
69 return 0;
70}
71
72static int arm64_break_trap(unsigned long addr, unsigned int esr,
73 struct pt_regs *regs)
74{
75 return ptrace_break(regs);
76}
77
78#ifdef CONFIG_HAVE_HW_BREAKPOINT 56#ifdef CONFIG_HAVE_HW_BREAKPOINT
79/* 57/*
80 * Handle hitting a HW-breakpoint. 58 * Handle hitting a HW-breakpoint.
@@ -817,33 +795,6 @@ static const struct user_regset_view user_aarch32_view = {
817 .regsets = aarch32_regsets, .n = ARRAY_SIZE(aarch32_regsets) 795 .regsets = aarch32_regsets, .n = ARRAY_SIZE(aarch32_regsets)
818}; 796};
819 797
820int aarch32_break_trap(struct pt_regs *regs)
821{
822 unsigned int instr;
823 bool bp = false;
824 void __user *pc = (void __user *)instruction_pointer(regs);
825
826 if (compat_thumb_mode(regs)) {
827 /* get 16-bit Thumb instruction */
828 get_user(instr, (u16 __user *)pc);
829 if (instr == AARCH32_BREAK_THUMB2_LO) {
830 /* get second half of 32-bit Thumb-2 instruction */
831 get_user(instr, (u16 __user *)(pc + 2));
832 bp = instr == AARCH32_BREAK_THUMB2_HI;
833 } else {
834 bp = instr == AARCH32_BREAK_THUMB;
835 }
836 } else {
837 /* 32-bit ARM instruction */
838 get_user(instr, (u32 __user *)pc);
839 bp = (instr & ~0xf0000000) == AARCH32_BREAK_ARM;
840 }
841
842 if (bp)
843 return ptrace_break(regs);
844 return 1;
845}
846
847static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off, 798static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off,
848 compat_ulong_t __user *ret) 799 compat_ulong_t __user *ret)
849{ 800{
@@ -1111,16 +1062,6 @@ long arch_ptrace(struct task_struct *child, long request,
1111 return ptrace_request(child, request, addr, data); 1062 return ptrace_request(child, request, addr, data);
1112} 1063}
1113 1064
1114
1115static int __init ptrace_break_init(void)
1116{
1117 hook_debug_fault_code(DBG_ESR_EVT_BRK, arm64_break_trap, SIGTRAP,
1118 TRAP_BRKPT, "ptrace BRK handler");
1119 return 0;
1120}
1121core_initcall(ptrace_break_init);
1122
1123
1124asmlinkage int syscall_trace(int dir, struct pt_regs *regs) 1065asmlinkage int syscall_trace(int dir, struct pt_regs *regs)
1125{ 1066{
1126 unsigned long saved_reg; 1067 unsigned long saved_reg;
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index a551f88ae2c1..03dc3718eb13 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -68,12 +68,6 @@ unsigned long long notrace sched_clock(void)
68 return arch_timer_read_counter() * sched_clock_mult; 68 return arch_timer_read_counter() * sched_clock_mult;
69} 69}
70 70
71int read_current_timer(unsigned long *timer_value)
72{
73 *timer_value = arch_timer_read_counter();
74 return 0;
75}
76
77void __init time_init(void) 71void __init time_init(void)
78{ 72{
79 u32 arch_timer_rate; 73 u32 arch_timer_rate;
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index f30852d28590..7ffadddb645d 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -32,6 +32,7 @@
32#include <linux/syscalls.h> 32#include <linux/syscalls.h>
33 33
34#include <asm/atomic.h> 34#include <asm/atomic.h>
35#include <asm/debug-monitors.h>
35#include <asm/traps.h> 36#include <asm/traps.h>
36#include <asm/stacktrace.h> 37#include <asm/stacktrace.h>
37#include <asm/exception.h> 38#include <asm/exception.h>
@@ -261,11 +262,9 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
261 siginfo_t info; 262 siginfo_t info;
262 void __user *pc = (void __user *)instruction_pointer(regs); 263 void __user *pc = (void __user *)instruction_pointer(regs);
263 264
264#ifdef CONFIG_COMPAT
265 /* check for AArch32 breakpoint instructions */ 265 /* check for AArch32 breakpoint instructions */
266 if (compat_user_mode(regs) && aarch32_break_trap(regs) == 0) 266 if (!aarch32_break_handler(regs))
267 return; 267 return;
268#endif
269 268
270 if (show_unhandled_signals && unhandled_signal(current, SIGILL) && 269 if (show_unhandled_signals && unhandled_signal(current, SIGILL) &&
271 printk_ratelimit()) { 270 printk_ratelimit()) {
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 3fae2be8b016..f5e55747242f 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -17,6 +17,19 @@ ENTRY(stext)
17 17
18jiffies = jiffies_64; 18jiffies = jiffies_64;
19 19
20#define HYPERVISOR_TEXT \
21 /* \
22 * Force the alignment to be compatible with \
23 * the vectors requirements \
24 */ \
25 . = ALIGN(2048); \
26 VMLINUX_SYMBOL(__hyp_idmap_text_start) = .; \
27 *(.hyp.idmap.text) \
28 VMLINUX_SYMBOL(__hyp_idmap_text_end) = .; \
29 VMLINUX_SYMBOL(__hyp_text_start) = .; \
30 *(.hyp.text) \
31 VMLINUX_SYMBOL(__hyp_text_end) = .;
32
20SECTIONS 33SECTIONS
21{ 34{
22 /* 35 /*
@@ -49,6 +62,7 @@ SECTIONS
49 TEXT_TEXT 62 TEXT_TEXT
50 SCHED_TEXT 63 SCHED_TEXT
51 LOCK_TEXT 64 LOCK_TEXT
65 HYPERVISOR_TEXT
52 *(.fixup) 66 *(.fixup)
53 *(.gnu.warning) 67 *(.gnu.warning)
54 . = ALIGN(16); 68 . = ALIGN(16);
@@ -56,7 +70,7 @@ SECTIONS
56 } 70 }
57 71
58 RO_DATA(PAGE_SIZE) 72 RO_DATA(PAGE_SIZE)
59 73 EXCEPTION_TABLE(8)
60 _etext = .; /* End of text and rodata section */ 74 _etext = .; /* End of text and rodata section */
61 75
62 . = ALIGN(PAGE_SIZE); 76 . = ALIGN(PAGE_SIZE);
@@ -99,14 +113,6 @@ SECTIONS
99 READ_MOSTLY_DATA(64) 113 READ_MOSTLY_DATA(64)
100 114
101 /* 115 /*
102 * The exception fixup table (might need resorting at runtime)
103 */
104 . = ALIGN(32);
105 __start___ex_table = .;
106 *(__ex_table)
107 __stop___ex_table = .;
108
109 /*
110 * and the usual data section 116 * and the usual data section
111 */ 117 */
112 DATA_DATA 118 DATA_DATA
@@ -124,3 +130,9 @@ SECTIONS
124 STABS_DEBUG 130 STABS_DEBUG
125 .comment 0 : { *(.comment) } 131 .comment 0 : { *(.comment) }
126} 132}
133
134/*
135 * The HYP init code can't be more than a page long.
136 */
137ASSERT(((__hyp_idmap_text_start + PAGE_SIZE) > __hyp_idmap_text_end),
138 "HYP init code too big")
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
new file mode 100644
index 000000000000..72a9fd583ad3
--- /dev/null
+++ b/arch/arm64/kvm/Makefile
@@ -0,0 +1,23 @@
1#
2# Makefile for Kernel-based Virtual Machine module
3#
4
5ccflags-y += -Ivirt/kvm -Iarch/arm64/kvm
6CFLAGS_arm.o := -I.
7CFLAGS_mmu.o := -I.
8
9KVM=../../../virt/kvm
10ARM=../../../arch/arm/kvm
11
12obj-$(CONFIG_KVM_ARM_HOST) += kvm.o
13
14kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o
15kvm-$(CONFIG_KVM_ARM_HOST) += $(ARM)/arm.o $(ARM)/mmu.o $(ARM)/mmio.o
16kvm-$(CONFIG_KVM_ARM_HOST) += $(ARM)/psci.o $(ARM)/perf.o
17
18kvm-$(CONFIG_KVM_ARM_HOST) += emulate.o inject_fault.o regmap.o
19kvm-$(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
21
22kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o
23kvm-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o
diff --git a/arch/arm64/kvm/emulate.c b/arch/arm64/kvm/emulate.c
new file mode 100644
index 000000000000..124418d17049
--- /dev/null
+++ b/arch/arm64/kvm/emulate.c
@@ -0,0 +1,158 @@
1/*
2 * (not much of an) Emulation layer for 32bit guests.
3 *
4 * Copyright (C) 2012,2013 - ARM Ltd
5 * Author: Marc Zyngier <marc.zyngier@arm.com>
6 *
7 * based on arch/arm/kvm/emulate.c
8 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
9 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#include <linux/kvm_host.h>
25#include <asm/kvm_emulate.h>
26
27/*
28 * stolen from arch/arm/kernel/opcodes.c
29 *
30 * condition code lookup table
31 * index into the table is test code: EQ, NE, ... LT, GT, AL, NV
32 *
33 * bit position in short is condition code: NZCV
34 */
35static const unsigned short cc_map[16] = {
36 0xF0F0, /* EQ == Z set */
37 0x0F0F, /* NE */
38 0xCCCC, /* CS == C set */
39 0x3333, /* CC */
40 0xFF00, /* MI == N set */
41 0x00FF, /* PL */
42 0xAAAA, /* VS == V set */
43 0x5555, /* VC */
44 0x0C0C, /* HI == C set && Z clear */
45 0xF3F3, /* LS == C clear || Z set */
46 0xAA55, /* GE == (N==V) */
47 0x55AA, /* LT == (N!=V) */
48 0x0A05, /* GT == (!Z && (N==V)) */
49 0xF5FA, /* LE == (Z || (N!=V)) */
50 0xFFFF, /* AL always */
51 0 /* NV */
52};
53
54static int kvm_vcpu_get_condition(const struct kvm_vcpu *vcpu)
55{
56 u32 esr = kvm_vcpu_get_hsr(vcpu);
57
58 if (esr & ESR_EL2_CV)
59 return (esr & ESR_EL2_COND) >> ESR_EL2_COND_SHIFT;
60
61 return -1;
62}
63
64/*
65 * Check if a trapped instruction should have been executed or not.
66 */
67bool kvm_condition_valid32(const struct kvm_vcpu *vcpu)
68{
69 unsigned long cpsr;
70 u32 cpsr_cond;
71 int cond;
72
73 /* Top two bits non-zero? Unconditional. */
74 if (kvm_vcpu_get_hsr(vcpu) >> 30)
75 return true;
76
77 /* Is condition field valid? */
78 cond = kvm_vcpu_get_condition(vcpu);
79 if (cond == 0xE)
80 return true;
81
82 cpsr = *vcpu_cpsr(vcpu);
83
84 if (cond < 0) {
85 /* This can happen in Thumb mode: examine IT state. */
86 unsigned long it;
87
88 it = ((cpsr >> 8) & 0xFC) | ((cpsr >> 25) & 0x3);
89
90 /* it == 0 => unconditional. */
91 if (it == 0)
92 return true;
93
94 /* The cond for this insn works out as the top 4 bits. */
95 cond = (it >> 4);
96 }
97
98 cpsr_cond = cpsr >> 28;
99
100 if (!((cc_map[cond] >> cpsr_cond) & 1))
101 return false;
102
103 return true;
104}
105
106/**
107 * adjust_itstate - adjust ITSTATE when emulating instructions in IT-block
108 * @vcpu: The VCPU pointer
109 *
110 * When exceptions occur while instructions are executed in Thumb IF-THEN
111 * blocks, the ITSTATE field of the CPSR is not advanced (updated), so we have
112 * to do this little bit of work manually. The fields map like this:
113 *
114 * IT[7:0] -> CPSR[26:25],CPSR[15:10]
115 */
116static void kvm_adjust_itstate(struct kvm_vcpu *vcpu)
117{
118 unsigned long itbits, cond;
119 unsigned long cpsr = *vcpu_cpsr(vcpu);
120 bool is_arm = !(cpsr & COMPAT_PSR_T_BIT);
121
122 BUG_ON(is_arm && (cpsr & COMPAT_PSR_IT_MASK));
123
124 if (!(cpsr & COMPAT_PSR_IT_MASK))
125 return;
126
127 cond = (cpsr & 0xe000) >> 13;
128 itbits = (cpsr & 0x1c00) >> (10 - 2);
129 itbits |= (cpsr & (0x3 << 25)) >> 25;
130
131 /* Perform ITAdvance (see page A2-52 in ARM DDI 0406C) */
132 if ((itbits & 0x7) == 0)
133 itbits = cond = 0;
134 else
135 itbits = (itbits << 1) & 0x1f;
136
137 cpsr &= ~COMPAT_PSR_IT_MASK;
138 cpsr |= cond << 13;
139 cpsr |= (itbits & 0x1c) << (10 - 2);
140 cpsr |= (itbits & 0x3) << 25;
141 *vcpu_cpsr(vcpu) = cpsr;
142}
143
144/**
145 * kvm_skip_instr - skip a trapped instruction and proceed to the next
146 * @vcpu: The vcpu pointer
147 */
148void kvm_skip_instr32(struct kvm_vcpu *vcpu, bool is_wide_instr)
149{
150 bool is_thumb;
151
152 is_thumb = !!(*vcpu_cpsr(vcpu) & COMPAT_PSR_T_BIT);
153 if (is_thumb && !is_wide_instr)
154 *vcpu_pc(vcpu) += 2;
155 else
156 *vcpu_pc(vcpu) += 4;
157 kvm_adjust_itstate(vcpu);
158}
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
new file mode 100644
index 000000000000..2c3ff67a8ecb
--- /dev/null
+++ b/arch/arm64/kvm/guest.c
@@ -0,0 +1,265 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/kvm/guest.c:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <linux/errno.h>
23#include <linux/err.h>
24#include <linux/kvm_host.h>
25#include <linux/module.h>
26#include <linux/vmalloc.h>
27#include <linux/fs.h>
28#include <asm/cputype.h>
29#include <asm/uaccess.h>
30#include <asm/kvm.h>
31#include <asm/kvm_asm.h>
32#include <asm/kvm_emulate.h>
33#include <asm/kvm_coproc.h>
34
35struct kvm_stats_debugfs_item debugfs_entries[] = {
36 { NULL }
37};
38
39int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
40{
41 vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
42 return 0;
43}
44
45static u64 core_reg_offset_from_id(u64 id)
46{
47 return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
48}
49
50static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
51{
52 /*
53 * Because the kvm_regs structure is a mix of 32, 64 and
54 * 128bit fields, we index it as if it was a 32bit
55 * array. Hence below, nr_regs is the number of entries, and
56 * off the index in the "array".
57 */
58 __u32 __user *uaddr = (__u32 __user *)(unsigned long)reg->addr;
59 struct kvm_regs *regs = vcpu_gp_regs(vcpu);
60 int nr_regs = sizeof(*regs) / sizeof(__u32);
61 u32 off;
62
63 /* Our ID is an index into the kvm_regs struct. */
64 off = core_reg_offset_from_id(reg->id);
65 if (off >= nr_regs ||
66 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
67 return -ENOENT;
68
69 if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))
70 return -EFAULT;
71
72 return 0;
73}
74
75static int set_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
76{
77 __u32 __user *uaddr = (__u32 __user *)(unsigned long)reg->addr;
78 struct kvm_regs *regs = vcpu_gp_regs(vcpu);
79 int nr_regs = sizeof(*regs) / sizeof(__u32);
80 __uint128_t tmp;
81 void *valp = &tmp;
82 u64 off;
83 int err = 0;
84
85 /* Our ID is an index into the kvm_regs struct. */
86 off = core_reg_offset_from_id(reg->id);
87 if (off >= nr_regs ||
88 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
89 return -ENOENT;
90
91 if (KVM_REG_SIZE(reg->id) > sizeof(tmp))
92 return -EINVAL;
93
94 if (copy_from_user(valp, uaddr, KVM_REG_SIZE(reg->id))) {
95 err = -EFAULT;
96 goto out;
97 }
98
99 if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) {
100 u32 mode = (*(u32 *)valp) & COMPAT_PSR_MODE_MASK;
101 switch (mode) {
102 case COMPAT_PSR_MODE_USR:
103 case COMPAT_PSR_MODE_FIQ:
104 case COMPAT_PSR_MODE_IRQ:
105 case COMPAT_PSR_MODE_SVC:
106 case COMPAT_PSR_MODE_ABT:
107 case COMPAT_PSR_MODE_UND:
108 case PSR_MODE_EL0t:
109 case PSR_MODE_EL1t:
110 case PSR_MODE_EL1h:
111 break;
112 default:
113 err = -EINVAL;
114 goto out;
115 }
116 }
117
118 memcpy((u32 *)regs + off, valp, KVM_REG_SIZE(reg->id));
119out:
120 return err;
121}
122
123int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
124{
125 return -EINVAL;
126}
127
128int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
129{
130 return -EINVAL;
131}
132
133static unsigned long num_core_regs(void)
134{
135 return sizeof(struct kvm_regs) / sizeof(__u32);
136}
137
138/**
139 * kvm_arm_num_regs - how many registers do we present via KVM_GET_ONE_REG
140 *
141 * This is for all registers.
142 */
143unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu)
144{
145 return num_core_regs() + kvm_arm_num_sys_reg_descs(vcpu);
146}
147
148/**
149 * kvm_arm_copy_reg_indices - get indices of all registers.
150 *
151 * We do core registers right here, then we apppend system regs.
152 */
153int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
154{
155 unsigned int i;
156 const u64 core_reg = KVM_REG_ARM64 | KVM_REG_SIZE_U64 | KVM_REG_ARM_CORE;
157
158 for (i = 0; i < sizeof(struct kvm_regs) / sizeof(__u32); i++) {
159 if (put_user(core_reg | i, uindices))
160 return -EFAULT;
161 uindices++;
162 }
163
164 return kvm_arm_copy_sys_reg_indices(vcpu, uindices);
165}
166
167int kvm_arm_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
168{
169 /* We currently use nothing arch-specific in upper 32 bits */
170 if ((reg->id & ~KVM_REG_SIZE_MASK) >> 32 != KVM_REG_ARM64 >> 32)
171 return -EINVAL;
172
173 /* Register group 16 means we want a core register. */
174 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
175 return get_core_reg(vcpu, reg);
176
177 return kvm_arm_sys_reg_get_reg(vcpu, reg);
178}
179
180int kvm_arm_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
181{
182 /* We currently use nothing arch-specific in upper 32 bits */
183 if ((reg->id & ~KVM_REG_SIZE_MASK) >> 32 != KVM_REG_ARM64 >> 32)
184 return -EINVAL;
185
186 /* Register group 16 means we set a core register. */
187 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_CORE)
188 return set_core_reg(vcpu, reg);
189
190 return kvm_arm_sys_reg_set_reg(vcpu, reg);
191}
192
193int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
194 struct kvm_sregs *sregs)
195{
196 return -EINVAL;
197}
198
199int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
200 struct kvm_sregs *sregs)
201{
202 return -EINVAL;
203}
204
205int __attribute_const__ kvm_target_cpu(void)
206{
207 unsigned long implementor = read_cpuid_implementor();
208 unsigned long part_number = read_cpuid_part_number();
209
210 if (implementor != ARM_CPU_IMP_ARM)
211 return -EINVAL;
212
213 switch (part_number) {
214 case ARM_CPU_PART_AEM_V8:
215 return KVM_ARM_TARGET_AEM_V8;
216 case ARM_CPU_PART_FOUNDATION:
217 return KVM_ARM_TARGET_FOUNDATION_V8;
218 case ARM_CPU_PART_CORTEX_A57:
219 /* Currently handled by the generic backend */
220 return KVM_ARM_TARGET_CORTEX_A57;
221 default:
222 return -EINVAL;
223 }
224}
225
226int kvm_vcpu_set_target(struct kvm_vcpu *vcpu,
227 const struct kvm_vcpu_init *init)
228{
229 unsigned int i;
230 int phys_target = kvm_target_cpu();
231
232 if (init->target != phys_target)
233 return -EINVAL;
234
235 vcpu->arch.target = phys_target;
236 bitmap_zero(vcpu->arch.features, KVM_VCPU_MAX_FEATURES);
237
238 /* -ENOENT for unknown features, -EINVAL for invalid combinations. */
239 for (i = 0; i < sizeof(init->features) * 8; i++) {
240 if (init->features[i / 32] & (1 << (i % 32))) {
241 if (i >= KVM_VCPU_MAX_FEATURES)
242 return -ENOENT;
243 set_bit(i, vcpu->arch.features);
244 }
245 }
246
247 /* Now we know what it is, we can reset it. */
248 return kvm_reset_vcpu(vcpu);
249}
250
251int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
252{
253 return -EINVAL;
254}
255
256int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
257{
258 return -EINVAL;
259}
260
261int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
262 struct kvm_translation *tr)
263{
264 return -EINVAL;
265}
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
new file mode 100644
index 000000000000..9beaca033437
--- /dev/null
+++ b/arch/arm64/kvm/handle_exit.c
@@ -0,0 +1,124 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/kvm/handle_exit.c:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <linux/kvm.h>
23#include <linux/kvm_host.h>
24#include <asm/kvm_emulate.h>
25#include <asm/kvm_coproc.h>
26#include <asm/kvm_mmu.h>
27#include <asm/kvm_psci.h>
28
29typedef int (*exit_handle_fn)(struct kvm_vcpu *, struct kvm_run *);
30
31static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run)
32{
33 if (kvm_psci_call(vcpu))
34 return 1;
35
36 kvm_inject_undefined(vcpu);
37 return 1;
38}
39
40static int handle_smc(struct kvm_vcpu *vcpu, struct kvm_run *run)
41{
42 if (kvm_psci_call(vcpu))
43 return 1;
44
45 kvm_inject_undefined(vcpu);
46 return 1;
47}
48
49/**
50 * kvm_handle_wfi - handle a wait-for-interrupts instruction executed by a guest
51 * @vcpu: the vcpu pointer
52 *
53 * Simply call kvm_vcpu_block(), which will halt execution of
54 * world-switches and schedule other host processes until there is an
55 * incoming IRQ or FIQ to the VM.
56 */
57static int kvm_handle_wfi(struct kvm_vcpu *vcpu, struct kvm_run *run)
58{
59 kvm_vcpu_block(vcpu);
60 return 1;
61}
62
63static exit_handle_fn arm_exit_handlers[] = {
64 [ESR_EL2_EC_WFI] = kvm_handle_wfi,
65 [ESR_EL2_EC_CP15_32] = kvm_handle_cp15_32,
66 [ESR_EL2_EC_CP15_64] = kvm_handle_cp15_64,
67 [ESR_EL2_EC_CP14_MR] = kvm_handle_cp14_access,
68 [ESR_EL2_EC_CP14_LS] = kvm_handle_cp14_load_store,
69 [ESR_EL2_EC_CP14_64] = kvm_handle_cp14_access,
70 [ESR_EL2_EC_HVC32] = handle_hvc,
71 [ESR_EL2_EC_SMC32] = handle_smc,
72 [ESR_EL2_EC_HVC64] = handle_hvc,
73 [ESR_EL2_EC_SMC64] = handle_smc,
74 [ESR_EL2_EC_SYS64] = kvm_handle_sys_reg,
75 [ESR_EL2_EC_IABT] = kvm_handle_guest_abort,
76 [ESR_EL2_EC_DABT] = kvm_handle_guest_abort,
77};
78
79static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu)
80{
81 u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
82
83 if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
84 !arm_exit_handlers[hsr_ec]) {
85 kvm_err("Unkown exception class: hsr: %#08x\n",
86 (unsigned int)kvm_vcpu_get_hsr(vcpu));
87 BUG();
88 }
89
90 return arm_exit_handlers[hsr_ec];
91}
92
93/*
94 * Return > 0 to return to guest, < 0 on error, 0 (and set exit_reason) on
95 * proper exit to userspace.
96 */
97int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *run,
98 int exception_index)
99{
100 exit_handle_fn exit_handler;
101
102 switch (exception_index) {
103 case ARM_EXCEPTION_IRQ:
104 return 1;
105 case ARM_EXCEPTION_TRAP:
106 /*
107 * See ARM ARM B1.14.1: "Hyp traps on instructions
108 * that fail their condition code check"
109 */
110 if (!kvm_condition_valid(vcpu)) {
111 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
112 return 1;
113 }
114
115 exit_handler = kvm_get_exit_handler(vcpu);
116
117 return exit_handler(vcpu, run);
118 default:
119 kvm_pr_unimpl("Unsupported exception type: %d",
120 exception_index);
121 run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
122 return 0;
123 }
124}
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
new file mode 100644
index 000000000000..ba84e6705e20
--- /dev/null
+++ b/arch/arm64/kvm/hyp-init.S
@@ -0,0 +1,107 @@
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
20#include <asm/assembler.h>
21#include <asm/kvm_arm.h>
22#include <asm/kvm_mmu.h>
23
24 .text
25 .pushsection .hyp.idmap.text, "ax"
26
27 .align 11
28
29ENTRY(__kvm_hyp_init)
30 ventry __invalid // Synchronous EL2t
31 ventry __invalid // IRQ EL2t
32 ventry __invalid // FIQ EL2t
33 ventry __invalid // Error EL2t
34
35 ventry __invalid // Synchronous EL2h
36 ventry __invalid // IRQ EL2h
37 ventry __invalid // FIQ EL2h
38 ventry __invalid // Error EL2h
39
40 ventry __do_hyp_init // Synchronous 64-bit EL1
41 ventry __invalid // IRQ 64-bit EL1
42 ventry __invalid // FIQ 64-bit EL1
43 ventry __invalid // Error 64-bit EL1
44
45 ventry __invalid // Synchronous 32-bit EL1
46 ventry __invalid // IRQ 32-bit EL1
47 ventry __invalid // FIQ 32-bit EL1
48 ventry __invalid // Error 32-bit EL1
49
50__invalid:
51 b .
52
53 /*
54 * x0: HYP boot pgd
55 * x1: HYP pgd
56 * x2: HYP stack
57 * x3: HYP vectors
58 */
59__do_hyp_init:
60
61 msr ttbr0_el2, x0
62
63 mrs x4, tcr_el1
64 ldr x5, =TCR_EL2_MASK
65 and x4, x4, x5
66 ldr x5, =TCR_EL2_FLAGS
67 orr x4, x4, x5
68 msr tcr_el2, x4
69
70 ldr x4, =VTCR_EL2_FLAGS
71 msr vtcr_el2, x4
72
73 mrs x4, mair_el1
74 msr mair_el2, x4
75 isb
76
77 mov x4, #SCTLR_EL2_FLAGS
78 msr sctlr_el2, x4
79 isb
80
81 /* MMU is now enabled. Get ready for the trampoline dance */
82 ldr x4, =TRAMPOLINE_VA
83 adr x5, target
84 bfi x4, x5, #0, #PAGE_SHIFT
85 br x4
86
87target: /* We're now in the trampoline code, switch page tables */
88 msr ttbr0_el2, x1
89 isb
90
91 /* Invalidate the old TLBs */
92 tlbi alle2
93 dsb sy
94
95 /* Set the stack and new vectors */
96 kern_hyp_va x2
97 mov sp, x2
98 kern_hyp_va x3
99 msr vbar_el2, x3
100
101 /* Hello, World! */
102 eret
103ENDPROC(__kvm_hyp_init)
104
105 .ltorg
106
107 .popsection
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
new file mode 100644
index 000000000000..ff985e3d8b72
--- /dev/null
+++ b/arch/arm64/kvm/hyp.S
@@ -0,0 +1,831 @@
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/fpsimdmacros.h>
25#include <asm/kvm.h>
26#include <asm/kvm_asm.h>
27#include <asm/kvm_arm.h>
28#include <asm/kvm_mmu.h>
29
30#define CPU_GP_REG_OFFSET(x) (CPU_GP_REGS + x)
31#define CPU_XREG_OFFSET(x) CPU_GP_REG_OFFSET(CPU_USER_PT_REGS + 8*x)
32#define CPU_SPSR_OFFSET(x) CPU_GP_REG_OFFSET(CPU_SPSR + 8*x)
33#define CPU_SYSREG_OFFSET(x) (CPU_SYSREGS + 8*x)
34
35 .text
36 .pushsection .hyp.text, "ax"
37 .align PAGE_SHIFT
38
39__kvm_hyp_code_start:
40 .globl __kvm_hyp_code_start
41
42.macro save_common_regs
43 // x2: base address for cpu context
44 // x3: tmp register
45
46 add x3, x2, #CPU_XREG_OFFSET(19)
47 stp x19, x20, [x3]
48 stp x21, x22, [x3, #16]
49 stp x23, x24, [x3, #32]
50 stp x25, x26, [x3, #48]
51 stp x27, x28, [x3, #64]
52 stp x29, lr, [x3, #80]
53
54 mrs x19, sp_el0
55 mrs x20, elr_el2 // EL1 PC
56 mrs x21, spsr_el2 // EL1 pstate
57
58 stp x19, x20, [x3, #96]
59 str x21, [x3, #112]
60
61 mrs x22, sp_el1
62 mrs x23, elr_el1
63 mrs x24, spsr_el1
64
65 str x22, [x2, #CPU_GP_REG_OFFSET(CPU_SP_EL1)]
66 str x23, [x2, #CPU_GP_REG_OFFSET(CPU_ELR_EL1)]
67 str x24, [x2, #CPU_SPSR_OFFSET(KVM_SPSR_EL1)]
68.endm
69
70.macro restore_common_regs
71 // x2: base address for cpu context
72 // x3: tmp register
73
74 ldr x22, [x2, #CPU_GP_REG_OFFSET(CPU_SP_EL1)]
75 ldr x23, [x2, #CPU_GP_REG_OFFSET(CPU_ELR_EL1)]
76 ldr x24, [x2, #CPU_SPSR_OFFSET(KVM_SPSR_EL1)]
77
78 msr sp_el1, x22
79 msr elr_el1, x23
80 msr spsr_el1, x24
81
82 add x3, x2, #CPU_XREG_OFFSET(31) // SP_EL0
83 ldp x19, x20, [x3]
84 ldr x21, [x3, #16]
85
86 msr sp_el0, x19
87 msr elr_el2, x20 // EL1 PC
88 msr spsr_el2, x21 // EL1 pstate
89
90 add x3, x2, #CPU_XREG_OFFSET(19)
91 ldp x19, x20, [x3]
92 ldp x21, x22, [x3, #16]
93 ldp x23, x24, [x3, #32]
94 ldp x25, x26, [x3, #48]
95 ldp x27, x28, [x3, #64]
96 ldp x29, lr, [x3, #80]
97.endm
98
99.macro save_host_regs
100 save_common_regs
101.endm
102
103.macro restore_host_regs
104 restore_common_regs
105.endm
106
107.macro save_fpsimd
108 // x2: cpu context address
109 // x3, x4: tmp regs
110 add x3, x2, #CPU_GP_REG_OFFSET(CPU_FP_REGS)
111 fpsimd_save x3, 4
112.endm
113
114.macro restore_fpsimd
115 // x2: cpu context address
116 // x3, x4: tmp regs
117 add x3, x2, #CPU_GP_REG_OFFSET(CPU_FP_REGS)
118 fpsimd_restore x3, 4
119.endm
120
121.macro save_guest_regs
122 // x0 is the vcpu address
123 // x1 is the return code, do not corrupt!
124 // x2 is the cpu context
125 // x3 is a tmp register
126 // Guest's x0-x3 are on the stack
127
128 // Compute base to save registers
129 add x3, x2, #CPU_XREG_OFFSET(4)
130 stp x4, x5, [x3]
131 stp x6, x7, [x3, #16]
132 stp x8, x9, [x3, #32]
133 stp x10, x11, [x3, #48]
134 stp x12, x13, [x3, #64]
135 stp x14, x15, [x3, #80]
136 stp x16, x17, [x3, #96]
137 str x18, [x3, #112]
138
139 pop x6, x7 // x2, x3
140 pop x4, x5 // x0, x1
141
142 add x3, x2, #CPU_XREG_OFFSET(0)
143 stp x4, x5, [x3]
144 stp x6, x7, [x3, #16]
145
146 save_common_regs
147.endm
148
149.macro restore_guest_regs
150 // x0 is the vcpu address.
151 // x2 is the cpu context
152 // x3 is a tmp register
153
154 // Prepare x0-x3 for later restore
155 add x3, x2, #CPU_XREG_OFFSET(0)
156 ldp x4, x5, [x3]
157 ldp x6, x7, [x3, #16]
158 push x4, x5 // Push x0-x3 on the stack
159 push x6, x7
160
161 // x4-x18
162 ldp x4, x5, [x3, #32]
163 ldp x6, x7, [x3, #48]
164 ldp x8, x9, [x3, #64]
165 ldp x10, x11, [x3, #80]
166 ldp x12, x13, [x3, #96]
167 ldp x14, x15, [x3, #112]
168 ldp x16, x17, [x3, #128]
169 ldr x18, [x3, #144]
170
171 // x19-x29, lr, sp*, elr*, spsr*
172 restore_common_regs
173
174 // Last bits of the 64bit state
175 pop x2, x3
176 pop x0, x1
177
178 // Do not touch any register after this!
179.endm
180
181/*
182 * Macros to perform system register save/restore.
183 *
184 * Ordering here is absolutely critical, and must be kept consistent
185 * in {save,restore}_sysregs, {save,restore}_guest_32bit_state,
186 * and in kvm_asm.h.
187 *
188 * In other words, don't touch any of these unless you know what
189 * you are doing.
190 */
191.macro save_sysregs
192 // x2: base address for cpu context
193 // x3: tmp register
194
195 add x3, x2, #CPU_SYSREG_OFFSET(MPIDR_EL1)
196
197 mrs x4, vmpidr_el2
198 mrs x5, csselr_el1
199 mrs x6, sctlr_el1
200 mrs x7, actlr_el1
201 mrs x8, cpacr_el1
202 mrs x9, ttbr0_el1
203 mrs x10, ttbr1_el1
204 mrs x11, tcr_el1
205 mrs x12, esr_el1
206 mrs x13, afsr0_el1
207 mrs x14, afsr1_el1
208 mrs x15, far_el1
209 mrs x16, mair_el1
210 mrs x17, vbar_el1
211 mrs x18, contextidr_el1
212 mrs x19, tpidr_el0
213 mrs x20, tpidrro_el0
214 mrs x21, tpidr_el1
215 mrs x22, amair_el1
216 mrs x23, cntkctl_el1
217
218 stp x4, x5, [x3]
219 stp x6, x7, [x3, #16]
220 stp x8, x9, [x3, #32]
221 stp x10, x11, [x3, #48]
222 stp x12, x13, [x3, #64]
223 stp x14, x15, [x3, #80]
224 stp x16, x17, [x3, #96]
225 stp x18, x19, [x3, #112]
226 stp x20, x21, [x3, #128]
227 stp x22, x23, [x3, #144]
228.endm
229
230.macro restore_sysregs
231 // x2: base address for cpu context
232 // x3: tmp register
233
234 add x3, x2, #CPU_SYSREG_OFFSET(MPIDR_EL1)
235
236 ldp x4, x5, [x3]
237 ldp x6, x7, [x3, #16]
238 ldp x8, x9, [x3, #32]
239 ldp x10, x11, [x3, #48]
240 ldp x12, x13, [x3, #64]
241 ldp x14, x15, [x3, #80]
242 ldp x16, x17, [x3, #96]
243 ldp x18, x19, [x3, #112]
244 ldp x20, x21, [x3, #128]
245 ldp x22, x23, [x3, #144]
246
247 msr vmpidr_el2, x4
248 msr csselr_el1, x5
249 msr sctlr_el1, x6
250 msr actlr_el1, x7
251 msr cpacr_el1, x8
252 msr ttbr0_el1, x9
253 msr ttbr1_el1, x10
254 msr tcr_el1, x11
255 msr esr_el1, x12
256 msr afsr0_el1, x13
257 msr afsr1_el1, x14
258 msr far_el1, x15
259 msr mair_el1, x16
260 msr vbar_el1, x17
261 msr contextidr_el1, x18
262 msr tpidr_el0, x19
263 msr tpidrro_el0, x20
264 msr tpidr_el1, x21
265 msr amair_el1, x22
266 msr cntkctl_el1, x23
267.endm
268
269.macro skip_32bit_state tmp, target
270 // Skip 32bit state if not needed
271 mrs \tmp, hcr_el2
272 tbnz \tmp, #HCR_RW_SHIFT, \target
273.endm
274
275.macro skip_tee_state tmp, target
276 // Skip ThumbEE state if not needed
277 mrs \tmp, id_pfr0_el1
278 tbz \tmp, #12, \target
279.endm
280
281.macro save_guest_32bit_state
282 skip_32bit_state x3, 1f
283
284 add x3, x2, #CPU_SPSR_OFFSET(KVM_SPSR_ABT)
285 mrs x4, spsr_abt
286 mrs x5, spsr_und
287 mrs x6, spsr_irq
288 mrs x7, spsr_fiq
289 stp x4, x5, [x3]
290 stp x6, x7, [x3, #16]
291
292 add x3, x2, #CPU_SYSREG_OFFSET(DACR32_EL2)
293 mrs x4, dacr32_el2
294 mrs x5, ifsr32_el2
295 mrs x6, fpexc32_el2
296 mrs x7, dbgvcr32_el2
297 stp x4, x5, [x3]
298 stp x6, x7, [x3, #16]
299
300 skip_tee_state x8, 1f
301
302 add x3, x2, #CPU_SYSREG_OFFSET(TEECR32_EL1)
303 mrs x4, teecr32_el1
304 mrs x5, teehbr32_el1
305 stp x4, x5, [x3]
3061:
307.endm
308
309.macro restore_guest_32bit_state
310 skip_32bit_state x3, 1f
311
312 add x3, x2, #CPU_SPSR_OFFSET(KVM_SPSR_ABT)
313 ldp x4, x5, [x3]
314 ldp x6, x7, [x3, #16]
315 msr spsr_abt, x4
316 msr spsr_und, x5
317 msr spsr_irq, x6
318 msr spsr_fiq, x7
319
320 add x3, x2, #CPU_SYSREG_OFFSET(DACR32_EL2)
321 ldp x4, x5, [x3]
322 ldp x6, x7, [x3, #16]
323 msr dacr32_el2, x4
324 msr ifsr32_el2, x5
325 msr fpexc32_el2, x6
326 msr dbgvcr32_el2, x7
327
328 skip_tee_state x8, 1f
329
330 add x3, x2, #CPU_SYSREG_OFFSET(TEECR32_EL1)
331 ldp x4, x5, [x3]
332 msr teecr32_el1, x4
333 msr teehbr32_el1, x5
3341:
335.endm
336
337.macro activate_traps
338 ldr x2, [x0, #VCPU_IRQ_LINES]
339 ldr x1, [x0, #VCPU_HCR_EL2]
340 orr x2, x2, x1
341 msr hcr_el2, x2
342
343 ldr x2, =(CPTR_EL2_TTA)
344 msr cptr_el2, x2
345
346 ldr x2, =(1 << 15) // Trap CP15 Cr=15
347 msr hstr_el2, x2
348
349 mrs x2, mdcr_el2
350 and x2, x2, #MDCR_EL2_HPMN_MASK
351 orr x2, x2, #(MDCR_EL2_TPM | MDCR_EL2_TPMCR)
352 msr mdcr_el2, x2
353.endm
354
355.macro deactivate_traps
356 mov x2, #HCR_RW
357 msr hcr_el2, x2
358 msr cptr_el2, xzr
359 msr hstr_el2, xzr
360
361 mrs x2, mdcr_el2
362 and x2, x2, #MDCR_EL2_HPMN_MASK
363 msr mdcr_el2, x2
364.endm
365
366.macro activate_vm
367 ldr x1, [x0, #VCPU_KVM]
368 kern_hyp_va x1
369 ldr x2, [x1, #KVM_VTTBR]
370 msr vttbr_el2, x2
371.endm
372
373.macro deactivate_vm
374 msr vttbr_el2, xzr
375.endm
376
377/*
378 * Save the VGIC CPU state into memory
379 * x0: Register pointing to VCPU struct
380 * Do not corrupt x1!!!
381 */
382.macro save_vgic_state
383 /* Get VGIC VCTRL base into x2 */
384 ldr x2, [x0, #VCPU_KVM]
385 kern_hyp_va x2
386 ldr x2, [x2, #KVM_VGIC_VCTRL]
387 kern_hyp_va x2
388 cbz x2, 2f // disabled
389
390 /* Compute the address of struct vgic_cpu */
391 add x3, x0, #VCPU_VGIC_CPU
392
393 /* Save all interesting registers */
394 ldr w4, [x2, #GICH_HCR]
395 ldr w5, [x2, #GICH_VMCR]
396 ldr w6, [x2, #GICH_MISR]
397 ldr w7, [x2, #GICH_EISR0]
398 ldr w8, [x2, #GICH_EISR1]
399 ldr w9, [x2, #GICH_ELRSR0]
400 ldr w10, [x2, #GICH_ELRSR1]
401 ldr w11, [x2, #GICH_APR]
402
403 str w4, [x3, #VGIC_CPU_HCR]
404 str w5, [x3, #VGIC_CPU_VMCR]
405 str w6, [x3, #VGIC_CPU_MISR]
406 str w7, [x3, #VGIC_CPU_EISR]
407 str w8, [x3, #(VGIC_CPU_EISR + 4)]
408 str w9, [x3, #VGIC_CPU_ELRSR]
409 str w10, [x3, #(VGIC_CPU_ELRSR + 4)]
410 str w11, [x3, #VGIC_CPU_APR]
411
412 /* Clear GICH_HCR */
413 str wzr, [x2, #GICH_HCR]
414
415 /* Save list registers */
416 add x2, x2, #GICH_LR0
417 ldr w4, [x3, #VGIC_CPU_NR_LR]
418 add x3, x3, #VGIC_CPU_LR
4191: ldr w5, [x2], #4
420 str w5, [x3], #4
421 sub w4, w4, #1
422 cbnz w4, 1b
4232:
424.endm
425
426/*
427 * Restore the VGIC CPU state from memory
428 * x0: Register pointing to VCPU struct
429 */
430.macro restore_vgic_state
431 /* Get VGIC VCTRL base into x2 */
432 ldr x2, [x0, #VCPU_KVM]
433 kern_hyp_va x2
434 ldr x2, [x2, #KVM_VGIC_VCTRL]
435 kern_hyp_va x2
436 cbz x2, 2f // disabled
437
438 /* Compute the address of struct vgic_cpu */
439 add x3, x0, #VCPU_VGIC_CPU
440
441 /* We only restore a minimal set of registers */
442 ldr w4, [x3, #VGIC_CPU_HCR]
443 ldr w5, [x3, #VGIC_CPU_VMCR]
444 ldr w6, [x3, #VGIC_CPU_APR]
445
446 str w4, [x2, #GICH_HCR]
447 str w5, [x2, #GICH_VMCR]
448 str w6, [x2, #GICH_APR]
449
450 /* Restore list registers */
451 add x2, x2, #GICH_LR0
452 ldr w4, [x3, #VGIC_CPU_NR_LR]
453 add x3, x3, #VGIC_CPU_LR
4541: ldr w5, [x3], #4
455 str w5, [x2], #4
456 sub w4, w4, #1
457 cbnz w4, 1b
4582:
459.endm
460
461.macro save_timer_state
462 // x0: vcpu pointer
463 ldr x2, [x0, #VCPU_KVM]
464 kern_hyp_va x2
465 ldr w3, [x2, #KVM_TIMER_ENABLED]
466 cbz w3, 1f
467
468 mrs x3, cntv_ctl_el0
469 and x3, x3, #3
470 str w3, [x0, #VCPU_TIMER_CNTV_CTL]
471 bic x3, x3, #1 // Clear Enable
472 msr cntv_ctl_el0, x3
473
474 isb
475
476 mrs x3, cntv_cval_el0
477 str x3, [x0, #VCPU_TIMER_CNTV_CVAL]
478
4791:
480 // Allow physical timer/counter access for the host
481 mrs x2, cnthctl_el2
482 orr x2, x2, #3
483 msr cnthctl_el2, x2
484
485 // Clear cntvoff for the host
486 msr cntvoff_el2, xzr
487.endm
488
489.macro restore_timer_state
490 // x0: vcpu pointer
491 // Disallow physical timer access for the guest
492 // Physical counter access is allowed
493 mrs x2, cnthctl_el2
494 orr x2, x2, #1
495 bic x2, x2, #2
496 msr cnthctl_el2, x2
497
498 ldr x2, [x0, #VCPU_KVM]
499 kern_hyp_va x2
500 ldr w3, [x2, #KVM_TIMER_ENABLED]
501 cbz w3, 1f
502
503 ldr x3, [x2, #KVM_TIMER_CNTVOFF]
504 msr cntvoff_el2, x3
505 ldr x2, [x0, #VCPU_TIMER_CNTV_CVAL]
506 msr cntv_cval_el0, x2
507 isb
508
509 ldr w2, [x0, #VCPU_TIMER_CNTV_CTL]
510 and x2, x2, #3
511 msr cntv_ctl_el0, x2
5121:
513.endm
514
515__save_sysregs:
516 save_sysregs
517 ret
518
519__restore_sysregs:
520 restore_sysregs
521 ret
522
523__save_fpsimd:
524 save_fpsimd
525 ret
526
527__restore_fpsimd:
528 restore_fpsimd
529 ret
530
531/*
532 * u64 __kvm_vcpu_run(struct kvm_vcpu *vcpu);
533 *
534 * This is the world switch. The first half of the function
535 * deals with entering the guest, and anything from __kvm_vcpu_return
536 * to the end of the function deals with reentering the host.
537 * On the enter path, only x0 (vcpu pointer) must be preserved until
538 * the last moment. On the exit path, x0 (vcpu pointer) and x1 (exception
539 * code) must both be preserved until the epilogue.
540 * In both cases, x2 points to the CPU context we're saving/restoring from/to.
541 */
542ENTRY(__kvm_vcpu_run)
543 kern_hyp_va x0
544 msr tpidr_el2, x0 // Save the vcpu register
545
546 // Host context
547 ldr x2, [x0, #VCPU_HOST_CONTEXT]
548 kern_hyp_va x2
549
550 save_host_regs
551 bl __save_fpsimd
552 bl __save_sysregs
553
554 activate_traps
555 activate_vm
556
557 restore_vgic_state
558 restore_timer_state
559
560 // Guest context
561 add x2, x0, #VCPU_CONTEXT
562
563 bl __restore_sysregs
564 bl __restore_fpsimd
565 restore_guest_32bit_state
566 restore_guest_regs
567
568 // That's it, no more messing around.
569 eret
570
571__kvm_vcpu_return:
572 // Assume x0 is the vcpu pointer, x1 the return code
573 // Guest's x0-x3 are on the stack
574
575 // Guest context
576 add x2, x0, #VCPU_CONTEXT
577
578 save_guest_regs
579 bl __save_fpsimd
580 bl __save_sysregs
581 save_guest_32bit_state
582
583 save_timer_state
584 save_vgic_state
585
586 deactivate_traps
587 deactivate_vm
588
589 // Host context
590 ldr x2, [x0, #VCPU_HOST_CONTEXT]
591 kern_hyp_va x2
592
593 bl __restore_sysregs
594 bl __restore_fpsimd
595 restore_host_regs
596
597 mov x0, x1
598 ret
599END(__kvm_vcpu_run)
600
601// void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
602ENTRY(__kvm_tlb_flush_vmid_ipa)
603 kern_hyp_va x0
604 ldr x2, [x0, #KVM_VTTBR]
605 msr vttbr_el2, x2
606 isb
607
608 /*
609 * We could do so much better if we had the VA as well.
610 * Instead, we invalidate Stage-2 for this IPA, and the
611 * whole of Stage-1. Weep...
612 */
613 tlbi ipas2e1is, x1
614 dsb sy
615 tlbi vmalle1is
616 dsb sy
617 isb
618
619 msr vttbr_el2, xzr
620 ret
621ENDPROC(__kvm_tlb_flush_vmid_ipa)
622
623ENTRY(__kvm_flush_vm_context)
624 tlbi alle1is
625 ic ialluis
626 dsb sy
627 ret
628ENDPROC(__kvm_flush_vm_context)
629
630__kvm_hyp_panic:
631 // Guess the context by looking at VTTBR:
632 // If zero, then we're already a host.
633 // Otherwise restore a minimal host context before panicing.
634 mrs x0, vttbr_el2
635 cbz x0, 1f
636
637 mrs x0, tpidr_el2
638
639 deactivate_traps
640 deactivate_vm
641
642 ldr x2, [x0, #VCPU_HOST_CONTEXT]
643 kern_hyp_va x2
644
645 bl __restore_sysregs
646
6471: adr x0, __hyp_panic_str
648 adr x1, 2f
649 ldp x2, x3, [x1]
650 sub x0, x0, x2
651 add x0, x0, x3
652 mrs x1, spsr_el2
653 mrs x2, elr_el2
654 mrs x3, esr_el2
655 mrs x4, far_el2
656 mrs x5, hpfar_el2
657 mrs x6, par_el1
658 mrs x7, tpidr_el2
659
660 mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\
661 PSR_MODE_EL1h)
662 msr spsr_el2, lr
663 ldr lr, =panic
664 msr elr_el2, lr
665 eret
666
667 .align 3
6682: .quad HYP_PAGE_OFFSET
669 .quad PAGE_OFFSET
670ENDPROC(__kvm_hyp_panic)
671
672__hyp_panic_str:
673 .ascii "HYP panic:\nPS:%08x PC:%p ESR:%p\nFAR:%p HPFAR:%p PAR:%p\nVCPU:%p\n\0"
674
675 .align 2
676
677ENTRY(kvm_call_hyp)
678 hvc #0
679 ret
680ENDPROC(kvm_call_hyp)
681
682.macro invalid_vector label, target
683 .align 2
684\label:
685 b \target
686ENDPROC(\label)
687.endm
688
689 /* None of these should ever happen */
690 invalid_vector el2t_sync_invalid, __kvm_hyp_panic
691 invalid_vector el2t_irq_invalid, __kvm_hyp_panic
692 invalid_vector el2t_fiq_invalid, __kvm_hyp_panic
693 invalid_vector el2t_error_invalid, __kvm_hyp_panic
694 invalid_vector el2h_sync_invalid, __kvm_hyp_panic
695 invalid_vector el2h_irq_invalid, __kvm_hyp_panic
696 invalid_vector el2h_fiq_invalid, __kvm_hyp_panic
697 invalid_vector el2h_error_invalid, __kvm_hyp_panic
698 invalid_vector el1_sync_invalid, __kvm_hyp_panic
699 invalid_vector el1_irq_invalid, __kvm_hyp_panic
700 invalid_vector el1_fiq_invalid, __kvm_hyp_panic
701 invalid_vector el1_error_invalid, __kvm_hyp_panic
702
703el1_sync: // Guest trapped into EL2
704 push x0, x1
705 push x2, x3
706
707 mrs x1, esr_el2
708 lsr x2, x1, #ESR_EL2_EC_SHIFT
709
710 cmp x2, #ESR_EL2_EC_HVC64
711 b.ne el1_trap
712
713 mrs x3, vttbr_el2 // If vttbr is valid, the 64bit guest
714 cbnz x3, el1_trap // called HVC
715
716 /* Here, we're pretty sure the host called HVC. */
717 pop x2, x3
718 pop x0, x1
719
720 push lr, xzr
721
722 /*
723 * Compute the function address in EL2, and shuffle the parameters.
724 */
725 kern_hyp_va x0
726 mov lr, x0
727 mov x0, x1
728 mov x1, x2
729 mov x2, x3
730 blr lr
731
732 pop lr, xzr
733 eret
734
735el1_trap:
736 /*
737 * x1: ESR
738 * x2: ESR_EC
739 */
740 cmp x2, #ESR_EL2_EC_DABT
741 mov x0, #ESR_EL2_EC_IABT
742 ccmp x2, x0, #4, ne
743 b.ne 1f // Not an abort we care about
744
745 /* This is an abort. Check for permission fault */
746 and x2, x1, #ESR_EL2_FSC_TYPE
747 cmp x2, #FSC_PERM
748 b.ne 1f // Not a permission fault
749
750 /*
751 * Check for Stage-1 page table walk, which is guaranteed
752 * to give a valid HPFAR_EL2.
753 */
754 tbnz x1, #7, 1f // S1PTW is set
755
756 /*
757 * Permission fault, HPFAR_EL2 is invalid.
758 * Resolve the IPA the hard way using the guest VA.
759 * Stage-1 translation already validated the memory access rights.
760 * As such, we can use the EL1 translation regime, and don't have
761 * to distinguish between EL0 and EL1 access.
762 */
763 mrs x2, far_el2
764 at s1e1r, x2
765 isb
766
767 /* Read result */
768 mrs x3, par_el1
769 tbnz x3, #0, 3f // Bail out if we failed the translation
770 ubfx x3, x3, #12, #36 // Extract IPA
771 lsl x3, x3, #4 // and present it like HPFAR
772 b 2f
773
7741: mrs x3, hpfar_el2
775 mrs x2, far_el2
776
7772: mrs x0, tpidr_el2
778 str x1, [x0, #VCPU_ESR_EL2]
779 str x2, [x0, #VCPU_FAR_EL2]
780 str x3, [x0, #VCPU_HPFAR_EL2]
781
782 mov x1, #ARM_EXCEPTION_TRAP
783 b __kvm_vcpu_return
784
785 /*
786 * Translation failed. Just return to the guest and
787 * let it fault again. Another CPU is probably playing
788 * behind our back.
789 */
7903: pop x2, x3
791 pop x0, x1
792
793 eret
794
795el1_irq:
796 push x0, x1
797 push x2, x3
798 mrs x0, tpidr_el2
799 mov x1, #ARM_EXCEPTION_IRQ
800 b __kvm_vcpu_return
801
802 .ltorg
803
804 .align 11
805
806ENTRY(__kvm_hyp_vector)
807 ventry el2t_sync_invalid // Synchronous EL2t
808 ventry el2t_irq_invalid // IRQ EL2t
809 ventry el2t_fiq_invalid // FIQ EL2t
810 ventry el2t_error_invalid // Error EL2t
811
812 ventry el2h_sync_invalid // Synchronous EL2h
813 ventry el2h_irq_invalid // IRQ EL2h
814 ventry el2h_fiq_invalid // FIQ EL2h
815 ventry el2h_error_invalid // Error EL2h
816
817 ventry el1_sync // Synchronous 64-bit EL1
818 ventry el1_irq // IRQ 64-bit EL1
819 ventry el1_fiq_invalid // FIQ 64-bit EL1
820 ventry el1_error_invalid // Error 64-bit EL1
821
822 ventry el1_sync // Synchronous 32-bit EL1
823 ventry el1_irq // IRQ 32-bit EL1
824 ventry el1_fiq_invalid // FIQ 32-bit EL1
825 ventry el1_error_invalid // Error 32-bit EL1
826ENDPROC(__kvm_hyp_vector)
827
828__kvm_hyp_code_end:
829 .globl __kvm_hyp_code_end
830
831 .popsection
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
new file mode 100644
index 000000000000..81a02a8762b0
--- /dev/null
+++ b/arch/arm64/kvm/inject_fault.c
@@ -0,0 +1,203 @@
1/*
2 * Fault injection for both 32 and 64bit guests.
3 *
4 * Copyright (C) 2012,2013 - ARM Ltd
5 * Author: Marc Zyngier <marc.zyngier@arm.com>
6 *
7 * Based on arch/arm/kvm/emulate.c
8 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
9 * Author: Christoffer Dall <c.dall@virtualopensystems.com>
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#include <linux/kvm_host.h>
25#include <asm/kvm_emulate.h>
26#include <asm/esr.h>
27
28#define PSTATE_FAULT_BITS_64 (PSR_MODE_EL1h | PSR_A_BIT | PSR_F_BIT | \
29 PSR_I_BIT | PSR_D_BIT)
30#define EL1_EXCEPT_SYNC_OFFSET 0x200
31
32static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)
33{
34 unsigned long cpsr;
35 unsigned long new_spsr_value = *vcpu_cpsr(vcpu);
36 bool is_thumb = (new_spsr_value & COMPAT_PSR_T_BIT);
37 u32 return_offset = (is_thumb) ? 4 : 0;
38 u32 sctlr = vcpu_cp15(vcpu, c1_SCTLR);
39
40 cpsr = mode | COMPAT_PSR_I_BIT;
41
42 if (sctlr & (1 << 30))
43 cpsr |= COMPAT_PSR_T_BIT;
44 if (sctlr & (1 << 25))
45 cpsr |= COMPAT_PSR_E_BIT;
46
47 *vcpu_cpsr(vcpu) = cpsr;
48
49 /* Note: These now point to the banked copies */
50 *vcpu_spsr(vcpu) = new_spsr_value;
51 *vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
52
53 /* Branch to exception vector */
54 if (sctlr & (1 << 13))
55 vect_offset += 0xffff0000;
56 else /* always have security exceptions */
57 vect_offset += vcpu_cp15(vcpu, c12_VBAR);
58
59 *vcpu_pc(vcpu) = vect_offset;
60}
61
62static void inject_undef32(struct kvm_vcpu *vcpu)
63{
64 prepare_fault32(vcpu, COMPAT_PSR_MODE_UND, 4);
65}
66
67/*
68 * Modelled after TakeDataAbortException() and TakePrefetchAbortException
69 * pseudocode.
70 */
71static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt,
72 unsigned long addr)
73{
74 u32 vect_offset;
75 u32 *far, *fsr;
76 bool is_lpae;
77
78 if (is_pabt) {
79 vect_offset = 12;
80 far = &vcpu_cp15(vcpu, c6_IFAR);
81 fsr = &vcpu_cp15(vcpu, c5_IFSR);
82 } else { /* !iabt */
83 vect_offset = 16;
84 far = &vcpu_cp15(vcpu, c6_DFAR);
85 fsr = &vcpu_cp15(vcpu, c5_DFSR);
86 }
87
88 prepare_fault32(vcpu, COMPAT_PSR_MODE_ABT | COMPAT_PSR_A_BIT, vect_offset);
89
90 *far = addr;
91
92 /* Give the guest an IMPLEMENTATION DEFINED exception */
93 is_lpae = (vcpu_cp15(vcpu, c2_TTBCR) >> 31);
94 if (is_lpae)
95 *fsr = 1 << 9 | 0x34;
96 else
97 *fsr = 0x14;
98}
99
100static void inject_abt64(struct kvm_vcpu *vcpu, bool is_iabt, unsigned long addr)
101{
102 unsigned long cpsr = *vcpu_cpsr(vcpu);
103 bool is_aarch32;
104 u32 esr = 0;
105
106 is_aarch32 = vcpu_mode_is_32bit(vcpu);
107
108 *vcpu_spsr(vcpu) = cpsr;
109 *vcpu_elr_el1(vcpu) = *vcpu_pc(vcpu);
110
111 *vcpu_cpsr(vcpu) = PSTATE_FAULT_BITS_64;
112 *vcpu_pc(vcpu) = vcpu_sys_reg(vcpu, VBAR_EL1) + EL1_EXCEPT_SYNC_OFFSET;
113
114 vcpu_sys_reg(vcpu, FAR_EL1) = addr;
115
116 /*
117 * Build an {i,d}abort, depending on the level and the
118 * instruction set. Report an external synchronous abort.
119 */
120 if (kvm_vcpu_trap_il_is32bit(vcpu))
121 esr |= ESR_EL1_IL;
122
123 /*
124 * Here, the guest runs in AArch64 mode when in EL1. If we get
125 * an AArch32 fault, it means we managed to trap an EL0 fault.
126 */
127 if (is_aarch32 || (cpsr & PSR_MODE_MASK) == PSR_MODE_EL0t)
128 esr |= (ESR_EL1_EC_IABT_EL0 << ESR_EL1_EC_SHIFT);
129 else
130 esr |= (ESR_EL1_EC_IABT_EL1 << ESR_EL1_EC_SHIFT);
131
132 if (!is_iabt)
133 esr |= ESR_EL1_EC_DABT_EL0;
134
135 vcpu_sys_reg(vcpu, ESR_EL1) = esr | ESR_EL2_EC_xABT_xFSR_EXTABT;
136}
137
138static void inject_undef64(struct kvm_vcpu *vcpu)
139{
140 unsigned long cpsr = *vcpu_cpsr(vcpu);
141 u32 esr = (ESR_EL1_EC_UNKNOWN << ESR_EL1_EC_SHIFT);
142
143 *vcpu_spsr(vcpu) = cpsr;
144 *vcpu_elr_el1(vcpu) = *vcpu_pc(vcpu);
145
146 *vcpu_cpsr(vcpu) = PSTATE_FAULT_BITS_64;
147 *vcpu_pc(vcpu) = vcpu_sys_reg(vcpu, VBAR_EL1) + EL1_EXCEPT_SYNC_OFFSET;
148
149 /*
150 * Build an unknown exception, depending on the instruction
151 * set.
152 */
153 if (kvm_vcpu_trap_il_is32bit(vcpu))
154 esr |= ESR_EL1_IL;
155
156 vcpu_sys_reg(vcpu, ESR_EL1) = esr;
157}
158
159/**
160 * kvm_inject_dabt - inject a data abort into the guest
161 * @vcpu: The VCPU to receive the undefined exception
162 * @addr: The address to report in the DFAR
163 *
164 * It is assumed that this code is called from the VCPU thread and that the
165 * VCPU therefore is not currently executing guest code.
166 */
167void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr)
168{
169 if (!(vcpu->arch.hcr_el2 & HCR_RW))
170 inject_abt32(vcpu, false, addr);
171
172 inject_abt64(vcpu, false, addr);
173}
174
175/**
176 * kvm_inject_pabt - inject a prefetch abort into the guest
177 * @vcpu: The VCPU to receive the undefined exception
178 * @addr: The address to report in the DFAR
179 *
180 * It is assumed that this code is called from the VCPU thread and that the
181 * VCPU therefore is not currently executing guest code.
182 */
183void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr)
184{
185 if (!(vcpu->arch.hcr_el2 & HCR_RW))
186 inject_abt32(vcpu, true, addr);
187
188 inject_abt64(vcpu, true, addr);
189}
190
191/**
192 * kvm_inject_undefined - inject an undefined instruction into the guest
193 *
194 * It is assumed that this code is called from the VCPU thread and that the
195 * VCPU therefore is not currently executing guest code.
196 */
197void kvm_inject_undefined(struct kvm_vcpu *vcpu)
198{
199 if (!(vcpu->arch.hcr_el2 & HCR_RW))
200 inject_undef32(vcpu);
201
202 inject_undef64(vcpu);
203}
diff --git a/arch/arm64/kvm/regmap.c b/arch/arm64/kvm/regmap.c
new file mode 100644
index 000000000000..bbc6ae32e4af
--- /dev/null
+++ b/arch/arm64/kvm/regmap.c
@@ -0,0 +1,168 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/kvm/emulate.c:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <linux/mm.h>
23#include <linux/kvm_host.h>
24#include <asm/kvm_emulate.h>
25#include <asm/ptrace.h>
26
27#define VCPU_NR_MODES 6
28#define REG_OFFSET(_reg) \
29 (offsetof(struct user_pt_regs, _reg) / sizeof(unsigned long))
30
31#define USR_REG_OFFSET(R) REG_OFFSET(compat_usr(R))
32
33static const unsigned long vcpu_reg_offsets[VCPU_NR_MODES][16] = {
34 /* USR Registers */
35 {
36 USR_REG_OFFSET(0), USR_REG_OFFSET(1), USR_REG_OFFSET(2),
37 USR_REG_OFFSET(3), USR_REG_OFFSET(4), USR_REG_OFFSET(5),
38 USR_REG_OFFSET(6), USR_REG_OFFSET(7), USR_REG_OFFSET(8),
39 USR_REG_OFFSET(9), USR_REG_OFFSET(10), USR_REG_OFFSET(11),
40 USR_REG_OFFSET(12), USR_REG_OFFSET(13), USR_REG_OFFSET(14),
41 REG_OFFSET(pc)
42 },
43
44 /* FIQ Registers */
45 {
46 USR_REG_OFFSET(0), USR_REG_OFFSET(1), USR_REG_OFFSET(2),
47 USR_REG_OFFSET(3), USR_REG_OFFSET(4), USR_REG_OFFSET(5),
48 USR_REG_OFFSET(6), USR_REG_OFFSET(7),
49 REG_OFFSET(compat_r8_fiq), /* r8 */
50 REG_OFFSET(compat_r9_fiq), /* r9 */
51 REG_OFFSET(compat_r10_fiq), /* r10 */
52 REG_OFFSET(compat_r11_fiq), /* r11 */
53 REG_OFFSET(compat_r12_fiq), /* r12 */
54 REG_OFFSET(compat_sp_fiq), /* r13 */
55 REG_OFFSET(compat_lr_fiq), /* r14 */
56 REG_OFFSET(pc)
57 },
58
59 /* IRQ Registers */
60 {
61 USR_REG_OFFSET(0), USR_REG_OFFSET(1), USR_REG_OFFSET(2),
62 USR_REG_OFFSET(3), USR_REG_OFFSET(4), USR_REG_OFFSET(5),
63 USR_REG_OFFSET(6), USR_REG_OFFSET(7), USR_REG_OFFSET(8),
64 USR_REG_OFFSET(9), USR_REG_OFFSET(10), USR_REG_OFFSET(11),
65 USR_REG_OFFSET(12),
66 REG_OFFSET(compat_sp_irq), /* r13 */
67 REG_OFFSET(compat_lr_irq), /* r14 */
68 REG_OFFSET(pc)
69 },
70
71 /* SVC Registers */
72 {
73 USR_REG_OFFSET(0), USR_REG_OFFSET(1), USR_REG_OFFSET(2),
74 USR_REG_OFFSET(3), USR_REG_OFFSET(4), USR_REG_OFFSET(5),
75 USR_REG_OFFSET(6), USR_REG_OFFSET(7), USR_REG_OFFSET(8),
76 USR_REG_OFFSET(9), USR_REG_OFFSET(10), USR_REG_OFFSET(11),
77 USR_REG_OFFSET(12),
78 REG_OFFSET(compat_sp_svc), /* r13 */
79 REG_OFFSET(compat_lr_svc), /* r14 */
80 REG_OFFSET(pc)
81 },
82
83 /* ABT Registers */
84 {
85 USR_REG_OFFSET(0), USR_REG_OFFSET(1), USR_REG_OFFSET(2),
86 USR_REG_OFFSET(3), USR_REG_OFFSET(4), USR_REG_OFFSET(5),
87 USR_REG_OFFSET(6), USR_REG_OFFSET(7), USR_REG_OFFSET(8),
88 USR_REG_OFFSET(9), USR_REG_OFFSET(10), USR_REG_OFFSET(11),
89 USR_REG_OFFSET(12),
90 REG_OFFSET(compat_sp_abt), /* r13 */
91 REG_OFFSET(compat_lr_abt), /* r14 */
92 REG_OFFSET(pc)
93 },
94
95 /* UND Registers */
96 {
97 USR_REG_OFFSET(0), USR_REG_OFFSET(1), USR_REG_OFFSET(2),
98 USR_REG_OFFSET(3), USR_REG_OFFSET(4), USR_REG_OFFSET(5),
99 USR_REG_OFFSET(6), USR_REG_OFFSET(7), USR_REG_OFFSET(8),
100 USR_REG_OFFSET(9), USR_REG_OFFSET(10), USR_REG_OFFSET(11),
101 USR_REG_OFFSET(12),
102 REG_OFFSET(compat_sp_und), /* r13 */
103 REG_OFFSET(compat_lr_und), /* r14 */
104 REG_OFFSET(pc)
105 },
106};
107
108/*
109 * Return a pointer to the register number valid in the current mode of
110 * the virtual CPU.
111 */
112unsigned long *vcpu_reg32(const struct kvm_vcpu *vcpu, u8 reg_num)
113{
114 unsigned long *reg_array = (unsigned long *)&vcpu->arch.ctxt.gp_regs.regs;
115 unsigned long mode = *vcpu_cpsr(vcpu) & COMPAT_PSR_MODE_MASK;
116
117 switch (mode) {
118 case COMPAT_PSR_MODE_USR ... COMPAT_PSR_MODE_SVC:
119 mode &= ~PSR_MODE32_BIT; /* 0 ... 3 */
120 break;
121
122 case COMPAT_PSR_MODE_ABT:
123 mode = 4;
124 break;
125
126 case COMPAT_PSR_MODE_UND:
127 mode = 5;
128 break;
129
130 case COMPAT_PSR_MODE_SYS:
131 mode = 0; /* SYS maps to USR */
132 break;
133
134 default:
135 BUG();
136 }
137
138 return reg_array + vcpu_reg_offsets[mode][reg_num];
139}
140
141/*
142 * Return the SPSR for the current mode of the virtual CPU.
143 */
144unsigned long *vcpu_spsr32(const struct kvm_vcpu *vcpu)
145{
146 unsigned long mode = *vcpu_cpsr(vcpu) & COMPAT_PSR_MODE_MASK;
147 switch (mode) {
148 case COMPAT_PSR_MODE_SVC:
149 mode = KVM_SPSR_SVC;
150 break;
151 case COMPAT_PSR_MODE_ABT:
152 mode = KVM_SPSR_ABT;
153 break;
154 case COMPAT_PSR_MODE_UND:
155 mode = KVM_SPSR_UND;
156 break;
157 case COMPAT_PSR_MODE_IRQ:
158 mode = KVM_SPSR_IRQ;
159 break;
160 case COMPAT_PSR_MODE_FIQ:
161 mode = KVM_SPSR_FIQ;
162 break;
163 default:
164 BUG();
165 }
166
167 return (unsigned long *)&vcpu_gp_regs(vcpu)->spsr[mode];
168}
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
new file mode 100644
index 000000000000..70a7816535cd
--- /dev/null
+++ b/arch/arm64/kvm/reset.c
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/kvm/reset.c
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Author: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <linux/errno.h>
23#include <linux/kvm_host.h>
24#include <linux/kvm.h>
25
26#include <kvm/arm_arch_timer.h>
27
28#include <asm/cputype.h>
29#include <asm/ptrace.h>
30#include <asm/kvm_arm.h>
31#include <asm/kvm_coproc.h>
32
33/*
34 * ARMv8 Reset Values
35 */
36static const struct kvm_regs default_regs_reset = {
37 .regs.pstate = (PSR_MODE_EL1h | PSR_A_BIT | PSR_I_BIT |
38 PSR_F_BIT | PSR_D_BIT),
39};
40
41static const struct kvm_regs default_regs_reset32 = {
42 .regs.pstate = (COMPAT_PSR_MODE_SVC | COMPAT_PSR_A_BIT |
43 COMPAT_PSR_I_BIT | COMPAT_PSR_F_BIT),
44};
45
46static const struct kvm_irq_level default_vtimer_irq = {
47 .irq = 27,
48 .level = 1,
49};
50
51static bool cpu_has_32bit_el1(void)
52{
53 u64 pfr0;
54
55 pfr0 = read_cpuid(ID_AA64PFR0_EL1);
56 return !!(pfr0 & 0x20);
57}
58
59int kvm_arch_dev_ioctl_check_extension(long ext)
60{
61 int r;
62
63 switch (ext) {
64 case KVM_CAP_ARM_EL1_32BIT:
65 r = cpu_has_32bit_el1();
66 break;
67 default:
68 r = 0;
69 }
70
71 return r;
72}
73
74/**
75 * kvm_reset_vcpu - sets core registers and sys_regs to reset value
76 * @vcpu: The VCPU pointer
77 *
78 * This function finds the right table above and sets the registers on
79 * the virtual CPU struct to their architectually defined reset
80 * values.
81 */
82int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
83{
84 const struct kvm_irq_level *cpu_vtimer_irq;
85 const struct kvm_regs *cpu_reset;
86
87 switch (vcpu->arch.target) {
88 default:
89 if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) {
90 if (!cpu_has_32bit_el1())
91 return -EINVAL;
92 cpu_reset = &default_regs_reset32;
93 vcpu->arch.hcr_el2 &= ~HCR_RW;
94 } else {
95 cpu_reset = &default_regs_reset;
96 }
97
98 cpu_vtimer_irq = &default_vtimer_irq;
99 break;
100 }
101
102 /* Reset core registers */
103 memcpy(vcpu_gp_regs(vcpu), cpu_reset, sizeof(*cpu_reset));
104
105 /* Reset system registers */
106 kvm_reset_sys_regs(vcpu);
107
108 /* Reset timer */
109 kvm_timer_vcpu_reset(vcpu, cpu_vtimer_irq);
110
111 return 0;
112}
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
new file mode 100644
index 000000000000..94923609753b
--- /dev/null
+++ b/arch/arm64/kvm/sys_regs.c
@@ -0,0 +1,1050 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/kvm/coproc.c:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Authors: Rusty Russell <rusty@rustcorp.com.au>
8 * Christoffer Dall <c.dall@virtualopensystems.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as
12 * published by the Free Software Foundation.
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, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <linux/mm.h>
24#include <linux/kvm_host.h>
25#include <linux/uaccess.h>
26#include <asm/kvm_arm.h>
27#include <asm/kvm_host.h>
28#include <asm/kvm_emulate.h>
29#include <asm/kvm_coproc.h>
30#include <asm/cacheflush.h>
31#include <asm/cputype.h>
32#include <trace/events/kvm.h>
33
34#include "sys_regs.h"
35
36/*
37 * All of this file is extremly similar to the ARM coproc.c, but the
38 * types are different. My gut feeling is that it should be pretty
39 * easy to merge, but that would be an ABI breakage -- again. VFP
40 * would also need to be abstracted.
41 *
42 * For AArch32, we only take care of what is being trapped. Anything
43 * that has to do with init and userspace access has to go via the
44 * 64bit interface.
45 */
46
47/* 3 bits per cache level, as per CLIDR, but non-existent caches always 0 */
48static u32 cache_levels;
49
50/* CSSELR values; used to index KVM_REG_ARM_DEMUX_ID_CCSIDR */
51#define CSSELR_MAX 12
52
53/* Which cache CCSIDR represents depends on CSSELR value. */
54static u32 get_ccsidr(u32 csselr)
55{
56 u32 ccsidr;
57
58 /* Make sure noone else changes CSSELR during this! */
59 local_irq_disable();
60 /* Put value into CSSELR */
61 asm volatile("msr csselr_el1, %x0" : : "r" (csselr));
62 isb();
63 /* Read result out of CCSIDR */
64 asm volatile("mrs %0, ccsidr_el1" : "=r" (ccsidr));
65 local_irq_enable();
66
67 return ccsidr;
68}
69
70static void do_dc_cisw(u32 val)
71{
72 asm volatile("dc cisw, %x0" : : "r" (val));
73 dsb();
74}
75
76static void do_dc_csw(u32 val)
77{
78 asm volatile("dc csw, %x0" : : "r" (val));
79 dsb();
80}
81
82/* See note at ARM ARM B1.14.4 */
83static bool access_dcsw(struct kvm_vcpu *vcpu,
84 const struct sys_reg_params *p,
85 const struct sys_reg_desc *r)
86{
87 unsigned long val;
88 int cpu;
89
90 if (!p->is_write)
91 return read_from_write_only(vcpu, p);
92
93 cpu = get_cpu();
94
95 cpumask_setall(&vcpu->arch.require_dcache_flush);
96 cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush);
97
98 /* If we were already preempted, take the long way around */
99 if (cpu != vcpu->arch.last_pcpu) {
100 flush_cache_all();
101 goto done;
102 }
103
104 val = *vcpu_reg(vcpu, p->Rt);
105
106 switch (p->CRm) {
107 case 6: /* Upgrade DCISW to DCCISW, as per HCR.SWIO */
108 case 14: /* DCCISW */
109 do_dc_cisw(val);
110 break;
111
112 case 10: /* DCCSW */
113 do_dc_csw(val);
114 break;
115 }
116
117done:
118 put_cpu();
119
120 return true;
121}
122
123/*
124 * We could trap ID_DFR0 and tell the guest we don't support performance
125 * monitoring. Unfortunately the patch to make the kernel check ID_DFR0 was
126 * NAKed, so it will read the PMCR anyway.
127 *
128 * Therefore we tell the guest we have 0 counters. Unfortunately, we
129 * must always support PMCCNTR (the cycle counter): we just RAZ/WI for
130 * all PM registers, which doesn't crash the guest kernel at least.
131 */
132static bool pm_fake(struct kvm_vcpu *vcpu,
133 const struct sys_reg_params *p,
134 const struct sys_reg_desc *r)
135{
136 if (p->is_write)
137 return ignore_write(vcpu, p);
138 else
139 return read_zero(vcpu, p);
140}
141
142static void reset_amair_el1(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
143{
144 u64 amair;
145
146 asm volatile("mrs %0, amair_el1\n" : "=r" (amair));
147 vcpu_sys_reg(vcpu, AMAIR_EL1) = amair;
148}
149
150static void reset_mpidr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
151{
152 /*
153 * Simply map the vcpu_id into the Aff0 field of the MPIDR.
154 */
155 vcpu_sys_reg(vcpu, MPIDR_EL1) = (1UL << 31) | (vcpu->vcpu_id & 0xff);
156}
157
158/*
159 * Architected system registers.
160 * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2
161 */
162static const struct sys_reg_desc sys_reg_descs[] = {
163 /* DC ISW */
164 { Op0(0b01), Op1(0b000), CRn(0b0111), CRm(0b0110), Op2(0b010),
165 access_dcsw },
166 /* DC CSW */
167 { Op0(0b01), Op1(0b000), CRn(0b0111), CRm(0b1010), Op2(0b010),
168 access_dcsw },
169 /* DC CISW */
170 { Op0(0b01), Op1(0b000), CRn(0b0111), CRm(0b1110), Op2(0b010),
171 access_dcsw },
172
173 /* TEECR32_EL1 */
174 { Op0(0b10), Op1(0b010), CRn(0b0000), CRm(0b0000), Op2(0b000),
175 NULL, reset_val, TEECR32_EL1, 0 },
176 /* TEEHBR32_EL1 */
177 { Op0(0b10), Op1(0b010), CRn(0b0001), CRm(0b0000), Op2(0b000),
178 NULL, reset_val, TEEHBR32_EL1, 0 },
179 /* DBGVCR32_EL2 */
180 { Op0(0b10), Op1(0b100), CRn(0b0000), CRm(0b0111), Op2(0b000),
181 NULL, reset_val, DBGVCR32_EL2, 0 },
182
183 /* MPIDR_EL1 */
184 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0000), Op2(0b101),
185 NULL, reset_mpidr, MPIDR_EL1 },
186 /* SCTLR_EL1 */
187 { Op0(0b11), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b000),
188 NULL, reset_val, SCTLR_EL1, 0x00C50078 },
189 /* CPACR_EL1 */
190 { Op0(0b11), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b010),
191 NULL, reset_val, CPACR_EL1, 0 },
192 /* TTBR0_EL1 */
193 { Op0(0b11), Op1(0b000), CRn(0b0010), CRm(0b0000), Op2(0b000),
194 NULL, reset_unknown, TTBR0_EL1 },
195 /* TTBR1_EL1 */
196 { Op0(0b11), Op1(0b000), CRn(0b0010), CRm(0b0000), Op2(0b001),
197 NULL, reset_unknown, TTBR1_EL1 },
198 /* TCR_EL1 */
199 { Op0(0b11), Op1(0b000), CRn(0b0010), CRm(0b0000), Op2(0b010),
200 NULL, reset_val, TCR_EL1, 0 },
201
202 /* AFSR0_EL1 */
203 { Op0(0b11), Op1(0b000), CRn(0b0101), CRm(0b0001), Op2(0b000),
204 NULL, reset_unknown, AFSR0_EL1 },
205 /* AFSR1_EL1 */
206 { Op0(0b11), Op1(0b000), CRn(0b0101), CRm(0b0001), Op2(0b001),
207 NULL, reset_unknown, AFSR1_EL1 },
208 /* ESR_EL1 */
209 { Op0(0b11), Op1(0b000), CRn(0b0101), CRm(0b0010), Op2(0b000),
210 NULL, reset_unknown, ESR_EL1 },
211 /* FAR_EL1 */
212 { Op0(0b11), Op1(0b000), CRn(0b0110), CRm(0b0000), Op2(0b000),
213 NULL, reset_unknown, FAR_EL1 },
214
215 /* PMINTENSET_EL1 */
216 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b001),
217 pm_fake },
218 /* PMINTENCLR_EL1 */
219 { Op0(0b11), Op1(0b000), CRn(0b1001), CRm(0b1110), Op2(0b010),
220 pm_fake },
221
222 /* MAIR_EL1 */
223 { Op0(0b11), Op1(0b000), CRn(0b1010), CRm(0b0010), Op2(0b000),
224 NULL, reset_unknown, MAIR_EL1 },
225 /* AMAIR_EL1 */
226 { Op0(0b11), Op1(0b000), CRn(0b1010), CRm(0b0011), Op2(0b000),
227 NULL, reset_amair_el1, AMAIR_EL1 },
228
229 /* VBAR_EL1 */
230 { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000),
231 NULL, reset_val, VBAR_EL1, 0 },
232 /* CONTEXTIDR_EL1 */
233 { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001),
234 NULL, reset_val, CONTEXTIDR_EL1, 0 },
235 /* TPIDR_EL1 */
236 { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b100),
237 NULL, reset_unknown, TPIDR_EL1 },
238
239 /* CNTKCTL_EL1 */
240 { Op0(0b11), Op1(0b000), CRn(0b1110), CRm(0b0001), Op2(0b000),
241 NULL, reset_val, CNTKCTL_EL1, 0},
242
243 /* CSSELR_EL1 */
244 { Op0(0b11), Op1(0b010), CRn(0b0000), CRm(0b0000), Op2(0b000),
245 NULL, reset_unknown, CSSELR_EL1 },
246
247 /* PMCR_EL0 */
248 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b000),
249 pm_fake },
250 /* PMCNTENSET_EL0 */
251 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b001),
252 pm_fake },
253 /* PMCNTENCLR_EL0 */
254 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b010),
255 pm_fake },
256 /* PMOVSCLR_EL0 */
257 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b011),
258 pm_fake },
259 /* PMSWINC_EL0 */
260 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b100),
261 pm_fake },
262 /* PMSELR_EL0 */
263 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b101),
264 pm_fake },
265 /* PMCEID0_EL0 */
266 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b110),
267 pm_fake },
268 /* PMCEID1_EL0 */
269 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1100), Op2(0b111),
270 pm_fake },
271 /* PMCCNTR_EL0 */
272 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b000),
273 pm_fake },
274 /* PMXEVTYPER_EL0 */
275 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b001),
276 pm_fake },
277 /* PMXEVCNTR_EL0 */
278 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1101), Op2(0b010),
279 pm_fake },
280 /* PMUSERENR_EL0 */
281 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b000),
282 pm_fake },
283 /* PMOVSSET_EL0 */
284 { Op0(0b11), Op1(0b011), CRn(0b1001), CRm(0b1110), Op2(0b011),
285 pm_fake },
286
287 /* TPIDR_EL0 */
288 { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b010),
289 NULL, reset_unknown, TPIDR_EL0 },
290 /* TPIDRRO_EL0 */
291 { Op0(0b11), Op1(0b011), CRn(0b1101), CRm(0b0000), Op2(0b011),
292 NULL, reset_unknown, TPIDRRO_EL0 },
293
294 /* DACR32_EL2 */
295 { Op0(0b11), Op1(0b100), CRn(0b0011), CRm(0b0000), Op2(0b000),
296 NULL, reset_unknown, DACR32_EL2 },
297 /* IFSR32_EL2 */
298 { Op0(0b11), Op1(0b100), CRn(0b0101), CRm(0b0000), Op2(0b001),
299 NULL, reset_unknown, IFSR32_EL2 },
300 /* FPEXC32_EL2 */
301 { Op0(0b11), Op1(0b100), CRn(0b0101), CRm(0b0011), Op2(0b000),
302 NULL, reset_val, FPEXC32_EL2, 0x70 },
303};
304
305/* Trapped cp15 registers */
306static const struct sys_reg_desc cp15_regs[] = {
307 /*
308 * DC{C,I,CI}SW operations:
309 */
310 { Op1( 0), CRn( 7), CRm( 6), Op2( 2), access_dcsw },
311 { Op1( 0), CRn( 7), CRm(10), Op2( 2), access_dcsw },
312 { Op1( 0), CRn( 7), CRm(14), Op2( 2), access_dcsw },
313 { Op1( 0), CRn( 9), CRm(12), Op2( 0), pm_fake },
314 { Op1( 0), CRn( 9), CRm(12), Op2( 1), pm_fake },
315 { Op1( 0), CRn( 9), CRm(12), Op2( 2), pm_fake },
316 { Op1( 0), CRn( 9), CRm(12), Op2( 3), pm_fake },
317 { Op1( 0), CRn( 9), CRm(12), Op2( 5), pm_fake },
318 { Op1( 0), CRn( 9), CRm(12), Op2( 6), pm_fake },
319 { Op1( 0), CRn( 9), CRm(12), Op2( 7), pm_fake },
320 { Op1( 0), CRn( 9), CRm(13), Op2( 0), pm_fake },
321 { Op1( 0), CRn( 9), CRm(13), Op2( 1), pm_fake },
322 { Op1( 0), CRn( 9), CRm(13), Op2( 2), pm_fake },
323 { Op1( 0), CRn( 9), CRm(14), Op2( 0), pm_fake },
324 { Op1( 0), CRn( 9), CRm(14), Op2( 1), pm_fake },
325 { Op1( 0), CRn( 9), CRm(14), Op2( 2), pm_fake },
326};
327
328/* Target specific emulation tables */
329static struct kvm_sys_reg_target_table *target_tables[KVM_ARM_NUM_TARGETS];
330
331void kvm_register_target_sys_reg_table(unsigned int target,
332 struct kvm_sys_reg_target_table *table)
333{
334 target_tables[target] = table;
335}
336
337/* Get specific register table for this target. */
338static const struct sys_reg_desc *get_target_table(unsigned target,
339 bool mode_is_64,
340 size_t *num)
341{
342 struct kvm_sys_reg_target_table *table;
343
344 table = target_tables[target];
345 if (mode_is_64) {
346 *num = table->table64.num;
347 return table->table64.table;
348 } else {
349 *num = table->table32.num;
350 return table->table32.table;
351 }
352}
353
354static const struct sys_reg_desc *find_reg(const struct sys_reg_params *params,
355 const struct sys_reg_desc table[],
356 unsigned int num)
357{
358 unsigned int i;
359
360 for (i = 0; i < num; i++) {
361 const struct sys_reg_desc *r = &table[i];
362
363 if (params->Op0 != r->Op0)
364 continue;
365 if (params->Op1 != r->Op1)
366 continue;
367 if (params->CRn != r->CRn)
368 continue;
369 if (params->CRm != r->CRm)
370 continue;
371 if (params->Op2 != r->Op2)
372 continue;
373
374 return r;
375 }
376 return NULL;
377}
378
379int kvm_handle_cp14_load_store(struct kvm_vcpu *vcpu, struct kvm_run *run)
380{
381 kvm_inject_undefined(vcpu);
382 return 1;
383}
384
385int kvm_handle_cp14_access(struct kvm_vcpu *vcpu, struct kvm_run *run)
386{
387 kvm_inject_undefined(vcpu);
388 return 1;
389}
390
391static void emulate_cp15(struct kvm_vcpu *vcpu,
392 const struct sys_reg_params *params)
393{
394 size_t num;
395 const struct sys_reg_desc *table, *r;
396
397 table = get_target_table(vcpu->arch.target, false, &num);
398
399 /* Search target-specific then generic table. */
400 r = find_reg(params, table, num);
401 if (!r)
402 r = find_reg(params, cp15_regs, ARRAY_SIZE(cp15_regs));
403
404 if (likely(r)) {
405 /*
406 * Not having an accessor means that we have
407 * configured a trap that we don't know how to
408 * handle. This certainly qualifies as a gross bug
409 * that should be fixed right away.
410 */
411 BUG_ON(!r->access);
412
413 if (likely(r->access(vcpu, params, r))) {
414 /* Skip instruction, since it was emulated */
415 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
416 return;
417 }
418 /* If access function fails, it should complain. */
419 }
420
421 kvm_err("Unsupported guest CP15 access at: %08lx\n", *vcpu_pc(vcpu));
422 print_sys_reg_instr(params);
423 kvm_inject_undefined(vcpu);
424}
425
426/**
427 * kvm_handle_cp15_64 -- handles a mrrc/mcrr trap on a guest CP15 access
428 * @vcpu: The VCPU pointer
429 * @run: The kvm_run struct
430 */
431int kvm_handle_cp15_64(struct kvm_vcpu *vcpu, struct kvm_run *run)
432{
433 struct sys_reg_params params;
434 u32 hsr = kvm_vcpu_get_hsr(vcpu);
435 int Rt2 = (hsr >> 10) & 0xf;
436
437 params.CRm = (hsr >> 1) & 0xf;
438 params.Rt = (hsr >> 5) & 0xf;
439 params.is_write = ((hsr & 1) == 0);
440
441 params.Op0 = 0;
442 params.Op1 = (hsr >> 16) & 0xf;
443 params.Op2 = 0;
444 params.CRn = 0;
445
446 /*
447 * Massive hack here. Store Rt2 in the top 32bits so we only
448 * have one register to deal with. As we use the same trap
449 * backends between AArch32 and AArch64, we get away with it.
450 */
451 if (params.is_write) {
452 u64 val = *vcpu_reg(vcpu, params.Rt);
453 val &= 0xffffffff;
454 val |= *vcpu_reg(vcpu, Rt2) << 32;
455 *vcpu_reg(vcpu, params.Rt) = val;
456 }
457
458 emulate_cp15(vcpu, &params);
459
460 /* Do the opposite hack for the read side */
461 if (!params.is_write) {
462 u64 val = *vcpu_reg(vcpu, params.Rt);
463 val >>= 32;
464 *vcpu_reg(vcpu, Rt2) = val;
465 }
466
467 return 1;
468}
469
470/**
471 * kvm_handle_cp15_32 -- handles a mrc/mcr trap on a guest CP15 access
472 * @vcpu: The VCPU pointer
473 * @run: The kvm_run struct
474 */
475int kvm_handle_cp15_32(struct kvm_vcpu *vcpu, struct kvm_run *run)
476{
477 struct sys_reg_params params;
478 u32 hsr = kvm_vcpu_get_hsr(vcpu);
479
480 params.CRm = (hsr >> 1) & 0xf;
481 params.Rt = (hsr >> 5) & 0xf;
482 params.is_write = ((hsr & 1) == 0);
483 params.CRn = (hsr >> 10) & 0xf;
484 params.Op0 = 0;
485 params.Op1 = (hsr >> 14) & 0x7;
486 params.Op2 = (hsr >> 17) & 0x7;
487
488 emulate_cp15(vcpu, &params);
489 return 1;
490}
491
492static int emulate_sys_reg(struct kvm_vcpu *vcpu,
493 const struct sys_reg_params *params)
494{
495 size_t num;
496 const struct sys_reg_desc *table, *r;
497
498 table = get_target_table(vcpu->arch.target, true, &num);
499
500 /* Search target-specific then generic table. */
501 r = find_reg(params, table, num);
502 if (!r)
503 r = find_reg(params, sys_reg_descs, ARRAY_SIZE(sys_reg_descs));
504
505 if (likely(r)) {
506 /*
507 * Not having an accessor means that we have
508 * configured a trap that we don't know how to
509 * handle. This certainly qualifies as a gross bug
510 * that should be fixed right away.
511 */
512 BUG_ON(!r->access);
513
514 if (likely(r->access(vcpu, params, r))) {
515 /* Skip instruction, since it was emulated */
516 kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
517 return 1;
518 }
519 /* If access function fails, it should complain. */
520 } else {
521 kvm_err("Unsupported guest sys_reg access at: %lx\n",
522 *vcpu_pc(vcpu));
523 print_sys_reg_instr(params);
524 }
525 kvm_inject_undefined(vcpu);
526 return 1;
527}
528
529static void reset_sys_reg_descs(struct kvm_vcpu *vcpu,
530 const struct sys_reg_desc *table, size_t num)
531{
532 unsigned long i;
533
534 for (i = 0; i < num; i++)
535 if (table[i].reset)
536 table[i].reset(vcpu, &table[i]);
537}
538
539/**
540 * kvm_handle_sys_reg -- handles a mrs/msr trap on a guest sys_reg access
541 * @vcpu: The VCPU pointer
542 * @run: The kvm_run struct
543 */
544int kvm_handle_sys_reg(struct kvm_vcpu *vcpu, struct kvm_run *run)
545{
546 struct sys_reg_params params;
547 unsigned long esr = kvm_vcpu_get_hsr(vcpu);
548
549 params.Op0 = (esr >> 20) & 3;
550 params.Op1 = (esr >> 14) & 0x7;
551 params.CRn = (esr >> 10) & 0xf;
552 params.CRm = (esr >> 1) & 0xf;
553 params.Op2 = (esr >> 17) & 0x7;
554 params.Rt = (esr >> 5) & 0x1f;
555 params.is_write = !(esr & 1);
556
557 return emulate_sys_reg(vcpu, &params);
558}
559
560/******************************************************************************
561 * Userspace API
562 *****************************************************************************/
563
564static bool index_to_params(u64 id, struct sys_reg_params *params)
565{
566 switch (id & KVM_REG_SIZE_MASK) {
567 case KVM_REG_SIZE_U64:
568 /* Any unused index bits means it's not valid. */
569 if (id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK
570 | KVM_REG_ARM_COPROC_MASK
571 | KVM_REG_ARM64_SYSREG_OP0_MASK
572 | KVM_REG_ARM64_SYSREG_OP1_MASK
573 | KVM_REG_ARM64_SYSREG_CRN_MASK
574 | KVM_REG_ARM64_SYSREG_CRM_MASK
575 | KVM_REG_ARM64_SYSREG_OP2_MASK))
576 return false;
577 params->Op0 = ((id & KVM_REG_ARM64_SYSREG_OP0_MASK)
578 >> KVM_REG_ARM64_SYSREG_OP0_SHIFT);
579 params->Op1 = ((id & KVM_REG_ARM64_SYSREG_OP1_MASK)
580 >> KVM_REG_ARM64_SYSREG_OP1_SHIFT);
581 params->CRn = ((id & KVM_REG_ARM64_SYSREG_CRN_MASK)
582 >> KVM_REG_ARM64_SYSREG_CRN_SHIFT);
583 params->CRm = ((id & KVM_REG_ARM64_SYSREG_CRM_MASK)
584 >> KVM_REG_ARM64_SYSREG_CRM_SHIFT);
585 params->Op2 = ((id & KVM_REG_ARM64_SYSREG_OP2_MASK)
586 >> KVM_REG_ARM64_SYSREG_OP2_SHIFT);
587 return true;
588 default:
589 return false;
590 }
591}
592
593/* Decode an index value, and find the sys_reg_desc entry. */
594static const struct sys_reg_desc *index_to_sys_reg_desc(struct kvm_vcpu *vcpu,
595 u64 id)
596{
597 size_t num;
598 const struct sys_reg_desc *table, *r;
599 struct sys_reg_params params;
600
601 /* We only do sys_reg for now. */
602 if ((id & KVM_REG_ARM_COPROC_MASK) != KVM_REG_ARM64_SYSREG)
603 return NULL;
604
605 if (!index_to_params(id, &params))
606 return NULL;
607
608 table = get_target_table(vcpu->arch.target, true, &num);
609 r = find_reg(&params, table, num);
610 if (!r)
611 r = find_reg(&params, sys_reg_descs, ARRAY_SIZE(sys_reg_descs));
612
613 /* Not saved in the sys_reg array? */
614 if (r && !r->reg)
615 r = NULL;
616
617 return r;
618}
619
620/*
621 * These are the invariant sys_reg registers: we let the guest see the
622 * host versions of these, so they're part of the guest state.
623 *
624 * A future CPU may provide a mechanism to present different values to
625 * the guest, or a future kvm may trap them.
626 */
627
628#define FUNCTION_INVARIANT(reg) \
629 static void get_##reg(struct kvm_vcpu *v, \
630 const struct sys_reg_desc *r) \
631 { \
632 u64 val; \
633 \
634 asm volatile("mrs %0, " __stringify(reg) "\n" \
635 : "=r" (val)); \
636 ((struct sys_reg_desc *)r)->val = val; \
637 }
638
639FUNCTION_INVARIANT(midr_el1)
640FUNCTION_INVARIANT(ctr_el0)
641FUNCTION_INVARIANT(revidr_el1)
642FUNCTION_INVARIANT(id_pfr0_el1)
643FUNCTION_INVARIANT(id_pfr1_el1)
644FUNCTION_INVARIANT(id_dfr0_el1)
645FUNCTION_INVARIANT(id_afr0_el1)
646FUNCTION_INVARIANT(id_mmfr0_el1)
647FUNCTION_INVARIANT(id_mmfr1_el1)
648FUNCTION_INVARIANT(id_mmfr2_el1)
649FUNCTION_INVARIANT(id_mmfr3_el1)
650FUNCTION_INVARIANT(id_isar0_el1)
651FUNCTION_INVARIANT(id_isar1_el1)
652FUNCTION_INVARIANT(id_isar2_el1)
653FUNCTION_INVARIANT(id_isar3_el1)
654FUNCTION_INVARIANT(id_isar4_el1)
655FUNCTION_INVARIANT(id_isar5_el1)
656FUNCTION_INVARIANT(clidr_el1)
657FUNCTION_INVARIANT(aidr_el1)
658
659/* ->val is filled in by kvm_sys_reg_table_init() */
660static struct sys_reg_desc invariant_sys_regs[] = {
661 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0000), Op2(0b000),
662 NULL, get_midr_el1 },
663 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0000), Op2(0b110),
664 NULL, get_revidr_el1 },
665 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b000),
666 NULL, get_id_pfr0_el1 },
667 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b001),
668 NULL, get_id_pfr1_el1 },
669 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b010),
670 NULL, get_id_dfr0_el1 },
671 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b011),
672 NULL, get_id_afr0_el1 },
673 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b100),
674 NULL, get_id_mmfr0_el1 },
675 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b101),
676 NULL, get_id_mmfr1_el1 },
677 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b110),
678 NULL, get_id_mmfr2_el1 },
679 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0001), Op2(0b111),
680 NULL, get_id_mmfr3_el1 },
681 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b000),
682 NULL, get_id_isar0_el1 },
683 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b001),
684 NULL, get_id_isar1_el1 },
685 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b010),
686 NULL, get_id_isar2_el1 },
687 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b011),
688 NULL, get_id_isar3_el1 },
689 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b100),
690 NULL, get_id_isar4_el1 },
691 { Op0(0b11), Op1(0b000), CRn(0b0000), CRm(0b0010), Op2(0b101),
692 NULL, get_id_isar5_el1 },
693 { Op0(0b11), Op1(0b001), CRn(0b0000), CRm(0b0000), Op2(0b001),
694 NULL, get_clidr_el1 },
695 { Op0(0b11), Op1(0b001), CRn(0b0000), CRm(0b0000), Op2(0b111),
696 NULL, get_aidr_el1 },
697 { Op0(0b11), Op1(0b011), CRn(0b0000), CRm(0b0000), Op2(0b001),
698 NULL, get_ctr_el0 },
699};
700
701static int reg_from_user(void *val, const void __user *uaddr, u64 id)
702{
703 /* This Just Works because we are little endian. */
704 if (copy_from_user(val, uaddr, KVM_REG_SIZE(id)) != 0)
705 return -EFAULT;
706 return 0;
707}
708
709static int reg_to_user(void __user *uaddr, const void *val, u64 id)
710{
711 /* This Just Works because we are little endian. */
712 if (copy_to_user(uaddr, val, KVM_REG_SIZE(id)) != 0)
713 return -EFAULT;
714 return 0;
715}
716
717static int get_invariant_sys_reg(u64 id, void __user *uaddr)
718{
719 struct sys_reg_params params;
720 const struct sys_reg_desc *r;
721
722 if (!index_to_params(id, &params))
723 return -ENOENT;
724
725 r = find_reg(&params, invariant_sys_regs, ARRAY_SIZE(invariant_sys_regs));
726 if (!r)
727 return -ENOENT;
728
729 return reg_to_user(uaddr, &r->val, id);
730}
731
732static int set_invariant_sys_reg(u64 id, void __user *uaddr)
733{
734 struct sys_reg_params params;
735 const struct sys_reg_desc *r;
736 int err;
737 u64 val = 0; /* Make sure high bits are 0 for 32-bit regs */
738
739 if (!index_to_params(id, &params))
740 return -ENOENT;
741 r = find_reg(&params, invariant_sys_regs, ARRAY_SIZE(invariant_sys_regs));
742 if (!r)
743 return -ENOENT;
744
745 err = reg_from_user(&val, uaddr, id);
746 if (err)
747 return err;
748
749 /* This is what we mean by invariant: you can't change it. */
750 if (r->val != val)
751 return -EINVAL;
752
753 return 0;
754}
755
756static bool is_valid_cache(u32 val)
757{
758 u32 level, ctype;
759
760 if (val >= CSSELR_MAX)
761 return -ENOENT;
762
763 /* Bottom bit is Instruction or Data bit. Next 3 bits are level. */
764 level = (val >> 1);
765 ctype = (cache_levels >> (level * 3)) & 7;
766
767 switch (ctype) {
768 case 0: /* No cache */
769 return false;
770 case 1: /* Instruction cache only */
771 return (val & 1);
772 case 2: /* Data cache only */
773 case 4: /* Unified cache */
774 return !(val & 1);
775 case 3: /* Separate instruction and data caches */
776 return true;
777 default: /* Reserved: we can't know instruction or data. */
778 return false;
779 }
780}
781
782static int demux_c15_get(u64 id, void __user *uaddr)
783{
784 u32 val;
785 u32 __user *uval = uaddr;
786
787 /* Fail if we have unknown bits set. */
788 if (id & ~(KVM_REG_ARCH_MASK|KVM_REG_SIZE_MASK|KVM_REG_ARM_COPROC_MASK
789 | ((1 << KVM_REG_ARM_COPROC_SHIFT)-1)))
790 return -ENOENT;
791
792 switch (id & KVM_REG_ARM_DEMUX_ID_MASK) {
793 case KVM_REG_ARM_DEMUX_ID_CCSIDR:
794 if (KVM_REG_SIZE(id) != 4)
795 return -ENOENT;
796 val = (id & KVM_REG_ARM_DEMUX_VAL_MASK)
797 >> KVM_REG_ARM_DEMUX_VAL_SHIFT;
798 if (!is_valid_cache(val))
799 return -ENOENT;
800
801 return put_user(get_ccsidr(val), uval);
802 default:
803 return -ENOENT;
804 }
805}
806
807static int demux_c15_set(u64 id, void __user *uaddr)
808{
809 u32 val, newval;
810 u32 __user *uval = uaddr;
811
812 /* Fail if we have unknown bits set. */
813 if (id & ~(KVM_REG_ARCH_MASK|KVM_REG_SIZE_MASK|KVM_REG_ARM_COPROC_MASK
814 | ((1 << KVM_REG_ARM_COPROC_SHIFT)-1)))
815 return -ENOENT;
816
817 switch (id & KVM_REG_ARM_DEMUX_ID_MASK) {
818 case KVM_REG_ARM_DEMUX_ID_CCSIDR:
819 if (KVM_REG_SIZE(id) != 4)
820 return -ENOENT;
821 val = (id & KVM_REG_ARM_DEMUX_VAL_MASK)
822 >> KVM_REG_ARM_DEMUX_VAL_SHIFT;
823 if (!is_valid_cache(val))
824 return -ENOENT;
825
826 if (get_user(newval, uval))
827 return -EFAULT;
828
829 /* This is also invariant: you can't change it. */
830 if (newval != get_ccsidr(val))
831 return -EINVAL;
832 return 0;
833 default:
834 return -ENOENT;
835 }
836}
837
838int kvm_arm_sys_reg_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
839{
840 const struct sys_reg_desc *r;
841 void __user *uaddr = (void __user *)(unsigned long)reg->addr;
842
843 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX)
844 return demux_c15_get(reg->id, uaddr);
845
846 if (KVM_REG_SIZE(reg->id) != sizeof(__u64))
847 return -ENOENT;
848
849 r = index_to_sys_reg_desc(vcpu, reg->id);
850 if (!r)
851 return get_invariant_sys_reg(reg->id, uaddr);
852
853 return reg_to_user(uaddr, &vcpu_sys_reg(vcpu, r->reg), reg->id);
854}
855
856int kvm_arm_sys_reg_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
857{
858 const struct sys_reg_desc *r;
859 void __user *uaddr = (void __user *)(unsigned long)reg->addr;
860
861 if ((reg->id & KVM_REG_ARM_COPROC_MASK) == KVM_REG_ARM_DEMUX)
862 return demux_c15_set(reg->id, uaddr);
863
864 if (KVM_REG_SIZE(reg->id) != sizeof(__u64))
865 return -ENOENT;
866
867 r = index_to_sys_reg_desc(vcpu, reg->id);
868 if (!r)
869 return set_invariant_sys_reg(reg->id, uaddr);
870
871 return reg_from_user(&vcpu_sys_reg(vcpu, r->reg), uaddr, reg->id);
872}
873
874static unsigned int num_demux_regs(void)
875{
876 unsigned int i, count = 0;
877
878 for (i = 0; i < CSSELR_MAX; i++)
879 if (is_valid_cache(i))
880 count++;
881
882 return count;
883}
884
885static int write_demux_regids(u64 __user *uindices)
886{
887 u64 val = KVM_REG_ARM | KVM_REG_SIZE_U32 | KVM_REG_ARM_DEMUX;
888 unsigned int i;
889
890 val |= KVM_REG_ARM_DEMUX_ID_CCSIDR;
891 for (i = 0; i < CSSELR_MAX; i++) {
892 if (!is_valid_cache(i))
893 continue;
894 if (put_user(val | i, uindices))
895 return -EFAULT;
896 uindices++;
897 }
898 return 0;
899}
900
901static u64 sys_reg_to_index(const struct sys_reg_desc *reg)
902{
903 return (KVM_REG_ARM64 | KVM_REG_SIZE_U64 |
904 KVM_REG_ARM64_SYSREG |
905 (reg->Op0 << KVM_REG_ARM64_SYSREG_OP0_SHIFT) |
906 (reg->Op1 << KVM_REG_ARM64_SYSREG_OP1_SHIFT) |
907 (reg->CRn << KVM_REG_ARM64_SYSREG_CRN_SHIFT) |
908 (reg->CRm << KVM_REG_ARM64_SYSREG_CRM_SHIFT) |
909 (reg->Op2 << KVM_REG_ARM64_SYSREG_OP2_SHIFT));
910}
911
912static bool copy_reg_to_user(const struct sys_reg_desc *reg, u64 __user **uind)
913{
914 if (!*uind)
915 return true;
916
917 if (put_user(sys_reg_to_index(reg), *uind))
918 return false;
919
920 (*uind)++;
921 return true;
922}
923
924/* Assumed ordered tables, see kvm_sys_reg_table_init. */
925static int walk_sys_regs(struct kvm_vcpu *vcpu, u64 __user *uind)
926{
927 const struct sys_reg_desc *i1, *i2, *end1, *end2;
928 unsigned int total = 0;
929 size_t num;
930
931 /* We check for duplicates here, to allow arch-specific overrides. */
932 i1 = get_target_table(vcpu->arch.target, true, &num);
933 end1 = i1 + num;
934 i2 = sys_reg_descs;
935 end2 = sys_reg_descs + ARRAY_SIZE(sys_reg_descs);
936
937 BUG_ON(i1 == end1 || i2 == end2);
938
939 /* Walk carefully, as both tables may refer to the same register. */
940 while (i1 || i2) {
941 int cmp = cmp_sys_reg(i1, i2);
942 /* target-specific overrides generic entry. */
943 if (cmp <= 0) {
944 /* Ignore registers we trap but don't save. */
945 if (i1->reg) {
946 if (!copy_reg_to_user(i1, &uind))
947 return -EFAULT;
948 total++;
949 }
950 } else {
951 /* Ignore registers we trap but don't save. */
952 if (i2->reg) {
953 if (!copy_reg_to_user(i2, &uind))
954 return -EFAULT;
955 total++;
956 }
957 }
958
959 if (cmp <= 0 && ++i1 == end1)
960 i1 = NULL;
961 if (cmp >= 0 && ++i2 == end2)
962 i2 = NULL;
963 }
964 return total;
965}
966
967unsigned long kvm_arm_num_sys_reg_descs(struct kvm_vcpu *vcpu)
968{
969 return ARRAY_SIZE(invariant_sys_regs)
970 + num_demux_regs()
971 + walk_sys_regs(vcpu, (u64 __user *)NULL);
972}
973
974int kvm_arm_copy_sys_reg_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
975{
976 unsigned int i;
977 int err;
978
979 /* Then give them all the invariant registers' indices. */
980 for (i = 0; i < ARRAY_SIZE(invariant_sys_regs); i++) {
981 if (put_user(sys_reg_to_index(&invariant_sys_regs[i]), uindices))
982 return -EFAULT;
983 uindices++;
984 }
985
986 err = walk_sys_regs(vcpu, uindices);
987 if (err < 0)
988 return err;
989 uindices += err;
990
991 return write_demux_regids(uindices);
992}
993
994void kvm_sys_reg_table_init(void)
995{
996 unsigned int i;
997 struct sys_reg_desc clidr;
998
999 /* Make sure tables are unique and in order. */
1000 for (i = 1; i < ARRAY_SIZE(sys_reg_descs); i++)
1001 BUG_ON(cmp_sys_reg(&sys_reg_descs[i-1], &sys_reg_descs[i]) >= 0);
1002
1003 /* We abuse the reset function to overwrite the table itself. */
1004 for (i = 0; i < ARRAY_SIZE(invariant_sys_regs); i++)
1005 invariant_sys_regs[i].reset(NULL, &invariant_sys_regs[i]);
1006
1007 /*
1008 * CLIDR format is awkward, so clean it up. See ARM B4.1.20:
1009 *
1010 * If software reads the Cache Type fields from Ctype1
1011 * upwards, once it has seen a value of 0b000, no caches
1012 * exist at further-out levels of the hierarchy. So, for
1013 * example, if Ctype3 is the first Cache Type field with a
1014 * value of 0b000, the values of Ctype4 to Ctype7 must be
1015 * ignored.
1016 */
1017 get_clidr_el1(NULL, &clidr); /* Ugly... */
1018 cache_levels = clidr.val;
1019 for (i = 0; i < 7; i++)
1020 if (((cache_levels >> (i*3)) & 7) == 0)
1021 break;
1022 /* Clear all higher bits. */
1023 cache_levels &= (1 << (i*3))-1;
1024}
1025
1026/**
1027 * kvm_reset_sys_regs - sets system registers to reset value
1028 * @vcpu: The VCPU pointer
1029 *
1030 * This function finds the right table above and sets the registers on the
1031 * virtual CPU struct to their architecturally defined reset values.
1032 */
1033void kvm_reset_sys_regs(struct kvm_vcpu *vcpu)
1034{
1035 size_t num;
1036 const struct sys_reg_desc *table;
1037
1038 /* Catch someone adding a register without putting in reset entry. */
1039 memset(&vcpu->arch.ctxt.sys_regs, 0x42, sizeof(vcpu->arch.ctxt.sys_regs));
1040
1041 /* Generic chip reset first (so target could override). */
1042 reset_sys_reg_descs(vcpu, sys_reg_descs, ARRAY_SIZE(sys_reg_descs));
1043
1044 table = get_target_table(vcpu->arch.target, true, &num);
1045 reset_sys_reg_descs(vcpu, table, num);
1046
1047 for (num = 1; num < NR_SYS_REGS; num++)
1048 if (vcpu_sys_reg(vcpu, num) == 0x4242424242424242)
1049 panic("Didn't reset vcpu_sys_reg(%zi)", num);
1050}
diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h
new file mode 100644
index 000000000000..d50d3722998e
--- /dev/null
+++ b/arch/arm64/kvm/sys_regs.h
@@ -0,0 +1,138 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Derived from arch/arm/kvm/coproc.h
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Authors: Christoffer Dall <c.dall@virtualopensystems.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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __ARM64_KVM_SYS_REGS_LOCAL_H__
23#define __ARM64_KVM_SYS_REGS_LOCAL_H__
24
25struct sys_reg_params {
26 u8 Op0;
27 u8 Op1;
28 u8 CRn;
29 u8 CRm;
30 u8 Op2;
31 u8 Rt;
32 bool is_write;
33};
34
35struct sys_reg_desc {
36 /* MRS/MSR instruction which accesses it. */
37 u8 Op0;
38 u8 Op1;
39 u8 CRn;
40 u8 CRm;
41 u8 Op2;
42
43 /* Trapped access from guest, if non-NULL. */
44 bool (*access)(struct kvm_vcpu *,
45 const struct sys_reg_params *,
46 const struct sys_reg_desc *);
47
48 /* Initialization for vcpu. */
49 void (*reset)(struct kvm_vcpu *, const struct sys_reg_desc *);
50
51 /* Index into sys_reg[], or 0 if we don't need to save it. */
52 int reg;
53
54 /* Value (usually reset value) */
55 u64 val;
56};
57
58static inline void print_sys_reg_instr(const struct sys_reg_params *p)
59{
60 /* Look, we even formatted it for you to paste into the table! */
61 kvm_pr_unimpl(" { Op0(%2u), Op1(%2u), CRn(%2u), CRm(%2u), Op2(%2u), func_%s },\n",
62 p->Op0, p->Op1, p->CRn, p->CRm, p->Op2, p->is_write ? "write" : "read");
63}
64
65static inline bool ignore_write(struct kvm_vcpu *vcpu,
66 const struct sys_reg_params *p)
67{
68 return true;
69}
70
71static inline bool read_zero(struct kvm_vcpu *vcpu,
72 const struct sys_reg_params *p)
73{
74 *vcpu_reg(vcpu, p->Rt) = 0;
75 return true;
76}
77
78static inline bool write_to_read_only(struct kvm_vcpu *vcpu,
79 const struct sys_reg_params *params)
80{
81 kvm_debug("sys_reg write to read-only register at: %lx\n",
82 *vcpu_pc(vcpu));
83 print_sys_reg_instr(params);
84 return false;
85}
86
87static inline bool read_from_write_only(struct kvm_vcpu *vcpu,
88 const struct sys_reg_params *params)
89{
90 kvm_debug("sys_reg read to write-only register at: %lx\n",
91 *vcpu_pc(vcpu));
92 print_sys_reg_instr(params);
93 return false;
94}
95
96/* Reset functions */
97static inline void reset_unknown(struct kvm_vcpu *vcpu,
98 const struct sys_reg_desc *r)
99{
100 BUG_ON(!r->reg);
101 BUG_ON(r->reg >= NR_SYS_REGS);
102 vcpu_sys_reg(vcpu, r->reg) = 0x1de7ec7edbadc0deULL;
103}
104
105static inline void reset_val(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
106{
107 BUG_ON(!r->reg);
108 BUG_ON(r->reg >= NR_SYS_REGS);
109 vcpu_sys_reg(vcpu, r->reg) = r->val;
110}
111
112static inline int cmp_sys_reg(const struct sys_reg_desc *i1,
113 const struct sys_reg_desc *i2)
114{
115 BUG_ON(i1 == i2);
116 if (!i1)
117 return 1;
118 else if (!i2)
119 return -1;
120 if (i1->Op0 != i2->Op0)
121 return i1->Op0 - i2->Op0;
122 if (i1->Op1 != i2->Op1)
123 return i1->Op1 - i2->Op1;
124 if (i1->CRn != i2->CRn)
125 return i1->CRn - i2->CRn;
126 if (i1->CRm != i2->CRm)
127 return i1->CRm - i2->CRm;
128 return i1->Op2 - i2->Op2;
129}
130
131
132#define Op0(_x) .Op0 = _x
133#define Op1(_x) .Op1 = _x
134#define CRn(_x) .CRn = _x
135#define CRm(_x) .CRm = _x
136#define Op2(_x) .Op2 = _x
137
138#endif /* __ARM64_KVM_SYS_REGS_LOCAL_H__ */
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c
new file mode 100644
index 000000000000..4268ab9356b1
--- /dev/null
+++ b/arch/arm64/kvm/sys_regs_generic_v8.c
@@ -0,0 +1,95 @@
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * Based on arch/arm/kvm/coproc_a15.c:
6 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7 * Authors: Rusty Russell <rusty@rustcorp.au>
8 * Christoffer Dall <c.dall@virtualopensystems.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as
12 * published by the Free Software Foundation.
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, see <http://www.gnu.org/licenses/>.
21 */
22#include <linux/kvm_host.h>
23#include <asm/cputype.h>
24#include <asm/kvm_arm.h>
25#include <asm/kvm_asm.h>
26#include <asm/kvm_host.h>
27#include <asm/kvm_emulate.h>
28#include <asm/kvm_coproc.h>
29#include <linux/init.h>
30
31#include "sys_regs.h"
32
33static bool access_actlr(struct kvm_vcpu *vcpu,
34 const struct sys_reg_params *p,
35 const struct sys_reg_desc *r)
36{
37 if (p->is_write)
38 return ignore_write(vcpu, p);
39
40 *vcpu_reg(vcpu, p->Rt) = vcpu_sys_reg(vcpu, ACTLR_EL1);
41 return true;
42}
43
44static void reset_actlr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
45{
46 u64 actlr;
47
48 asm volatile("mrs %0, actlr_el1\n" : "=r" (actlr));
49 vcpu_sys_reg(vcpu, ACTLR_EL1) = actlr;
50}
51
52/*
53 * Implementation specific sys-reg registers.
54 * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2
55 */
56static const struct sys_reg_desc genericv8_sys_regs[] = {
57 /* ACTLR_EL1 */
58 { Op0(0b11), Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b001),
59 access_actlr, reset_actlr, ACTLR_EL1 },
60};
61
62static const struct sys_reg_desc genericv8_cp15_regs[] = {
63 /* ACTLR */
64 { Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b001),
65 access_actlr },
66};
67
68static struct kvm_sys_reg_target_table genericv8_target_table = {
69 .table64 = {
70 .table = genericv8_sys_regs,
71 .num = ARRAY_SIZE(genericv8_sys_regs),
72 },
73 .table32 = {
74 .table = genericv8_cp15_regs,
75 .num = ARRAY_SIZE(genericv8_cp15_regs),
76 },
77};
78
79static int __init sys_reg_genericv8_init(void)
80{
81 unsigned int i;
82
83 for (i = 1; i < ARRAY_SIZE(genericv8_sys_regs); i++)
84 BUG_ON(cmp_sys_reg(&genericv8_sys_regs[i-1],
85 &genericv8_sys_regs[i]) >= 0);
86
87 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_AEM_V8,
88 &genericv8_target_table);
89 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_FOUNDATION_V8,
90 &genericv8_target_table);
91 kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57,
92 &genericv8_target_table);
93 return 0;
94}
95late_initcall(sys_reg_genericv8_init);
diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile
index 3140a2abcdc2..b51d36401d83 100644
--- a/arch/arm64/mm/Makefile
+++ b/arch/arm64/mm/Makefile
@@ -2,3 +2,4 @@ obj-y := dma-mapping.o extable.o fault.o init.o \
2 cache.o copypage.o flush.o \ 2 cache.o copypage.o flush.o \
3 ioremap.o mmap.o pgd.o mmu.o \ 3 ioremap.o mmap.o pgd.o mmu.o \
4 context.o tlb.o proc.o 4 context.o tlb.o proc.o
5obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 1426468b77f3..0ecac8980aae 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -365,17 +365,6 @@ static int __kprobes do_translation_fault(unsigned long addr,
365} 365}
366 366
367/* 367/*
368 * Some section permission faults need to be handled gracefully. They can
369 * happen due to a __{get,put}_user during an oops.
370 */
371static int do_sect_fault(unsigned long addr, unsigned int esr,
372 struct pt_regs *regs)
373{
374 do_bad_area(addr, esr, regs);
375 return 0;
376}
377
378/*
379 * This abort handler always returns "fault". 368 * This abort handler always returns "fault".
380 */ 369 */
381static int do_bad(unsigned long addr, unsigned int esr, struct pt_regs *regs) 370static int do_bad(unsigned long addr, unsigned int esr, struct pt_regs *regs)
@@ -398,12 +387,12 @@ static struct fault_info {
398 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" }, 387 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "level 2 translation fault" },
399 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" }, 388 { do_page_fault, SIGSEGV, SEGV_MAPERR, "level 3 translation fault" },
400 { do_bad, SIGBUS, 0, "reserved access flag fault" }, 389 { do_bad, SIGBUS, 0, "reserved access flag fault" },
401 { do_bad, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" }, 390 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 access flag fault" },
402 { do_bad, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" }, 391 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 access flag fault" },
403 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" }, 392 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 access flag fault" },
404 { do_bad, SIGBUS, 0, "reserved permission fault" }, 393 { do_bad, SIGBUS, 0, "reserved permission fault" },
405 { do_bad, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" }, 394 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 1 permission fault" },
406 { do_sect_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" }, 395 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 2 permission fault" },
407 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" }, 396 { do_page_fault, SIGSEGV, SEGV_ACCERR, "level 3 permission fault" },
408 { do_bad, SIGBUS, 0, "synchronous external abort" }, 397 { do_bad, SIGBUS, 0, "synchronous external abort" },
409 { do_bad, SIGBUS, 0, "asynchronous external abort" }, 398 { do_bad, SIGBUS, 0, "asynchronous external abort" },
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c
index 88611c3a421a..e4193e3adc7f 100644
--- a/arch/arm64/mm/flush.c
+++ b/arch/arm64/mm/flush.c
@@ -70,23 +70,16 @@ void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
70#endif 70#endif
71} 71}
72 72
73void __flush_dcache_page(struct page *page)
74{
75 __flush_dcache_area(page_address(page), PAGE_SIZE);
76}
77
78void __sync_icache_dcache(pte_t pte, unsigned long addr) 73void __sync_icache_dcache(pte_t pte, unsigned long addr)
79{ 74{
80 unsigned long pfn; 75 struct page *page = pte_page(pte);
81 struct page *page;
82 76
83 pfn = pte_pfn(pte); 77 /* no flushing needed for anonymous pages */
84 if (!pfn_valid(pfn)) 78 if (!page_mapping(page))
85 return; 79 return;
86 80
87 page = pfn_to_page(pfn);
88 if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { 81 if (!test_and_set_bit(PG_dcache_clean, &page->flags)) {
89 __flush_dcache_page(page); 82 __flush_dcache_area(page_address(page), PAGE_SIZE);
90 __flush_icache_all(); 83 __flush_icache_all();
91 } else if (icache_is_aivivt()) { 84 } else if (icache_is_aivivt()) {
92 __flush_icache_all(); 85 __flush_icache_all();
@@ -94,28 +87,14 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
94} 87}
95 88
96/* 89/*
97 * Ensure cache coherency between kernel mapping and userspace mapping of this 90 * This function is called when a page has been modified by the kernel. Mark
98 * page. 91 * it as dirty for later flushing when mapped in user space (if executable,
92 * see __sync_icache_dcache).
99 */ 93 */
100void flush_dcache_page(struct page *page) 94void flush_dcache_page(struct page *page)
101{ 95{
102 struct address_space *mapping; 96 if (test_bit(PG_dcache_clean, &page->flags))
103
104 /*
105 * The zero page is never written to, so never has any dirty cache
106 * lines, and therefore never needs to be flushed.
107 */
108 if (page == ZERO_PAGE(0))
109 return;
110
111 mapping = page_mapping(page);
112 if (mapping && mapping_mapped(mapping)) {
113 __flush_dcache_page(page);
114 __flush_icache_all();
115 set_bit(PG_dcache_clean, &page->flags);
116 } else {
117 clear_bit(PG_dcache_clean, &page->flags); 97 clear_bit(PG_dcache_clean, &page->flags);
118 }
119} 98}
120EXPORT_SYMBOL(flush_dcache_page); 99EXPORT_SYMBOL(flush_dcache_page);
121 100
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
new file mode 100644
index 000000000000..2fc8258bab2d
--- /dev/null
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -0,0 +1,70 @@
1/*
2 * arch/arm64/mm/hugetlbpage.c
3 *
4 * Copyright (C) 2013 Linaro Ltd.
5 *
6 * Based on arch/x86/mm/hugetlbpage.c.
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/init.h>
23#include <linux/fs.h>
24#include <linux/mm.h>
25#include <linux/hugetlb.h>
26#include <linux/pagemap.h>
27#include <linux/err.h>
28#include <linux/sysctl.h>
29#include <asm/mman.h>
30#include <asm/tlb.h>
31#include <asm/tlbflush.h>
32#include <asm/pgalloc.h>
33
34#ifndef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
35int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
36{
37 return 0;
38}
39#endif
40
41struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
42 int write)
43{
44 return ERR_PTR(-EINVAL);
45}
46
47int pmd_huge(pmd_t pmd)
48{
49 return !(pmd_val(pmd) & PMD_TABLE_BIT);
50}
51
52int pud_huge(pud_t pud)
53{
54 return !(pud_val(pud) & PUD_TABLE_BIT);
55}
56
57static __init int setup_hugepagesz(char *opt)
58{
59 unsigned long ps = memparse(opt, &opt);
60 if (ps == PMD_SIZE) {
61 hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
62 } else if (ps == PUD_SIZE) {
63 hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
64 } else {
65 pr_err("hugepagesz: Unsupported page size %lu M\n", ps >> 20);
66 return 0;
67 }
68 return 1;
69}
70__setup("hugepagesz=", setup_hugepagesz);
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index f497ca77925a..67e8d7ce3fe7 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -197,14 +197,6 @@ void __init bootmem_init(void)
197 max_pfn = max_low_pfn = max; 197 max_pfn = max_low_pfn = max;
198} 198}
199 199
200/*
201 * Poison init memory with an undefined instruction (0x0).
202 */
203static inline void poison_init_mem(void *s, size_t count)
204{
205 memset(s, 0, count);
206}
207
208#ifndef CONFIG_SPARSEMEM_VMEMMAP 200#ifndef CONFIG_SPARSEMEM_VMEMMAP
209static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn) 201static inline void free_memmap(unsigned long start_pfn, unsigned long end_pfn)
210{ 202{
@@ -280,59 +272,17 @@ static void __init free_unused_memmap(void)
280 */ 272 */
281void __init mem_init(void) 273void __init mem_init(void)
282{ 274{
283 unsigned long reserved_pages, free_pages;
284 struct memblock_region *reg;
285
286 arm64_swiotlb_init(); 275 arm64_swiotlb_init();
287 276
288 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 277 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
289 278
290#ifndef CONFIG_SPARSEMEM_VMEMMAP 279#ifndef CONFIG_SPARSEMEM_VMEMMAP
291 /* this will put all unused low memory onto the freelists */
292 free_unused_memmap(); 280 free_unused_memmap();
293#endif 281#endif
282 /* this will put all unused low memory onto the freelists */
283 free_all_bootmem();
294 284
295 totalram_pages += free_all_bootmem(); 285 mem_init_print_info(NULL);
296
297 reserved_pages = free_pages = 0;
298
299 for_each_memblock(memory, reg) {
300 unsigned int pfn1, pfn2;
301 struct page *page, *end;
302
303 pfn1 = __phys_to_pfn(reg->base);
304 pfn2 = pfn1 + __phys_to_pfn(reg->size);
305
306 page = pfn_to_page(pfn1);
307 end = pfn_to_page(pfn2 - 1) + 1;
308
309 do {
310 if (PageReserved(page))
311 reserved_pages++;
312 else if (!page_count(page))
313 free_pages++;
314 page++;
315 } while (page < end);
316 }
317
318 /*
319 * Since our memory may not be contiguous, calculate the real number
320 * of pages we have in this system.
321 */
322 pr_info("Memory:");
323 num_physpages = 0;
324 for_each_memblock(memory, reg) {
325 unsigned long pages = memblock_region_memory_end_pfn(reg) -
326 memblock_region_memory_base_pfn(reg);
327 num_physpages += pages;
328 printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
329 }
330 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
331
332 pr_notice("Memory: %luk/%luk available, %luk reserved\n",
333 nr_free_pages() << (PAGE_SHIFT-10),
334 free_pages << (PAGE_SHIFT-10),
335 reserved_pages << (PAGE_SHIFT-10));
336 286
337#define MLK(b, t) b, t, ((t) - (b)) >> 10 287#define MLK(b, t) b, t, ((t) - (b)) >> 10
338#define MLM(b, t) b, t, ((t) - (b)) >> 20 288#define MLM(b, t) b, t, ((t) - (b)) >> 20
@@ -374,7 +324,7 @@ void __init mem_init(void)
374 BUILD_BUG_ON(TASK_SIZE_64 > MODULES_VADDR); 324 BUILD_BUG_ON(TASK_SIZE_64 > MODULES_VADDR);
375 BUG_ON(TASK_SIZE_64 > MODULES_VADDR); 325 BUG_ON(TASK_SIZE_64 > MODULES_VADDR);
376 326
377 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 327 if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
378 extern int sysctl_overcommit_memory; 328 extern int sysctl_overcommit_memory;
379 /* 329 /*
380 * On a machine this small we won't get anywhere without 330 * On a machine this small we won't get anywhere without
@@ -386,7 +336,6 @@ void __init mem_init(void)
386 336
387void free_initmem(void) 337void free_initmem(void)
388{ 338{
389 poison_init_mem(__init_begin, __init_end - __init_begin);
390 free_initmem_default(0); 339 free_initmem_default(0);
391} 340}
392 341
@@ -396,10 +345,8 @@ static int keep_initrd;
396 345
397void free_initrd_mem(unsigned long start, unsigned long end) 346void free_initrd_mem(unsigned long start, unsigned long end)
398{ 347{
399 if (!keep_initrd) { 348 if (!keep_initrd)
400 poison_init_mem((void *)start, PAGE_ALIGN(end) - start); 349 free_reserved_area((void *)start, (void *)end, 0, "initrd");
401 free_reserved_area(start, end, 0, "initrd");
402 }
403} 350}
404 351
405static int __init keepinitrd_setup(char *__unused) 352static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/arm64/mm/mm.h b/arch/arm64/mm/mm.h
index 916701e6d040..d519f4f50c8c 100644
--- a/arch/arm64/mm/mm.h
+++ b/arch/arm64/mm/mm.h
@@ -1,3 +1,2 @@
1extern void __flush_dcache_page(struct page *page);
2extern void __init bootmem_init(void); 1extern void __init bootmem_init(void);
3extern void __init arm64_swiotlb_init(void); 2extern void __init arm64_swiotlb_init(void);
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index eeecc9c8ed68..a8d1059b91b2 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -297,6 +297,16 @@ static void __init map_mem(void)
297{ 297{
298 struct memblock_region *reg; 298 struct memblock_region *reg;
299 299
300 /*
301 * Temporarily limit the memblock range. We need to do this as
302 * create_mapping requires puds, pmds and ptes to be allocated from
303 * memory addressable from the initial direct kernel mapping.
304 *
305 * The initial direct kernel mapping, located at swapper_pg_dir,
306 * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (aligned).
307 */
308 memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE);
309
300 /* map all the memory banks */ 310 /* map all the memory banks */
301 for_each_memblock(memory, reg) { 311 for_each_memblock(memory, reg) {
302 phys_addr_t start = reg->base; 312 phys_addr_t start = reg->base;
@@ -307,6 +317,9 @@ static void __init map_mem(void)
307 317
308 create_mapping(start, __phys_to_virt(start), end - start); 318 create_mapping(start, __phys_to_virt(start), end - start);
309 } 319 }
320
321 /* Limit no longer required. */
322 memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
310} 323}
311 324
312/* 325/*
@@ -317,12 +330,6 @@ void __init paging_init(void)
317{ 330{
318 void *zero_page; 331 void *zero_page;
319 332
320 /*
321 * Maximum PGDIR_SIZE addressable via the initial direct kernel
322 * mapping in swapper_pg_dir.
323 */
324 memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE);
325
326 init_mem_pgprot(); 333 init_mem_pgprot();
327 map_mem(); 334 map_mem();
328 335
@@ -339,7 +346,6 @@ void __init paging_init(void)
339 bootmem_init(); 346 bootmem_init();
340 347
341 empty_zero_page = virt_to_page(zero_page); 348 empty_zero_page = virt_to_page(zero_page);
342 __flush_dcache_page(empty_zero_page);
343 349
344 /* 350 /*
345 * TTBR0 is only used for the identity mapping at this stage. Make it 351 * TTBR0 is only used for the identity mapping at this stage. Make it
diff --git a/arch/arm64/xen/Makefile b/arch/arm64/xen/Makefile
new file mode 100644
index 000000000000..be240404ba96
--- /dev/null
+++ b/arch/arm64/xen/Makefile
@@ -0,0 +1,2 @@
1xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o)
2obj-y := xen-arm.o hypercall.o
diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S
new file mode 100644
index 000000000000..2816c479cd49
--- /dev/null
+++ b/arch/arm64/xen/hypercall.S
@@ -0,0 +1,92 @@
1/******************************************************************************
2 * hypercall.S
3 *
4 * Xen hypercall wrappers
5 *
6 * Stefano Stabellini <stefano.stabellini@eu.citrix.com>, Citrix, 2012
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 version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33/*
34 * The Xen hypercall calling convention is very similar to the procedure
35 * call standard for the ARM 64-bit architecture: the first parameter is
36 * passed in x0, the second in x1, the third in x2, the fourth in x3 and
37 * the fifth in x4.
38 *
39 * The hypercall number is passed in x16.
40 *
41 * The return value is in x0.
42 *
43 * The hvc ISS is required to be 0xEA1, that is the Xen specific ARM
44 * hypercall tag.
45 *
46 * Parameter structs passed to hypercalls are laid out according to
47 * the ARM 64-bit EABI standard.
48 */
49
50#include <linux/linkage.h>
51#include <asm/assembler.h>
52#include <xen/interface/xen.h>
53
54
55#define XEN_IMM 0xEA1
56
57#define HYPERCALL_SIMPLE(hypercall) \
58ENTRY(HYPERVISOR_##hypercall) \
59 mov x16, #__HYPERVISOR_##hypercall; \
60 hvc XEN_IMM; \
61 ret; \
62ENDPROC(HYPERVISOR_##hypercall)
63
64#define HYPERCALL0 HYPERCALL_SIMPLE
65#define HYPERCALL1 HYPERCALL_SIMPLE
66#define HYPERCALL2 HYPERCALL_SIMPLE
67#define HYPERCALL3 HYPERCALL_SIMPLE
68#define HYPERCALL4 HYPERCALL_SIMPLE
69#define HYPERCALL5 HYPERCALL_SIMPLE
70
71 .text
72
73HYPERCALL2(xen_version);
74HYPERCALL3(console_io);
75HYPERCALL3(grant_table_op);
76HYPERCALL2(sched_op);
77HYPERCALL2(event_channel_op);
78HYPERCALL2(hvm_op);
79HYPERCALL2(memory_op);
80HYPERCALL2(physdev_op);
81HYPERCALL3(vcpu_op);
82
83ENTRY(privcmd_call)
84 mov x16, x0
85 mov x0, x1
86 mov x1, x2
87 mov x2, x3
88 mov x3, x4
89 mov x4, x5
90 hvc XEN_IMM
91 ret
92ENDPROC(privcmd_call);
diff --git a/arch/avr32/include/asm/pgtable.h b/arch/avr32/include/asm/pgtable.h
index 6fbfea61f7bb..4beff97e2033 100644
--- a/arch/avr32/include/asm/pgtable.h
+++ b/arch/avr32/include/asm/pgtable.h
@@ -362,9 +362,6 @@ typedef pte_t *pte_addr_t;
362 362
363#define kern_addr_valid(addr) (1) 363#define kern_addr_valid(addr) (1)
364 364
365#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
366 remap_pfn_range(vma, vaddr, pfn, size, prot)
367
368/* No page table caches to initialize (?) */ 365/* No page table caches to initialize (?) */
369#define pgtable_cache_init() do { } while(0) 366#define pgtable_cache_init() do { } while(0)
370 367
diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c
index e7b61494c312..c2731003edef 100644
--- a/arch/avr32/kernel/process.c
+++ b/arch/avr32/kernel/process.c
@@ -341,7 +341,7 @@ unsigned long get_wchan(struct task_struct *p)
341 * is actually quite ugly. It might be possible to 341 * is actually quite ugly. It might be possible to
342 * determine the frame size automatically at build 342 * determine the frame size automatically at build
343 * time by doing this: 343 * time by doing this:
344 * - compile sched.c 344 * - compile sched/core.c
345 * - disassemble the resulting sched.o 345 * - disassemble the resulting sched.o
346 * - look for 'sub sp,??' shortly after '<schedule>:' 346 * - look for 'sub sp,??' shortly after '<schedule>:'
347 */ 347 */
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index b4247f478065..209ae5ad3495 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -555,7 +555,7 @@ void __init setup_arch (char **cmdline_p)
555{ 555{
556 struct clk *cpu_clk; 556 struct clk *cpu_clk;
557 557
558 init_mm.start_code = (unsigned long)_text; 558 init_mm.start_code = (unsigned long)_stext;
559 init_mm.end_code = (unsigned long)_etext; 559 init_mm.end_code = (unsigned long)_etext;
560 init_mm.end_data = (unsigned long)_edata; 560 init_mm.end_data = (unsigned long)_edata;
561 init_mm.brk = (unsigned long)_end; 561 init_mm.brk = (unsigned long)_end;
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 9cd2bd91d64a..a4589176bed5 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -23,7 +23,7 @@ SECTIONS
23{ 23{
24 . = CONFIG_ENTRY_ADDRESS; 24 . = CONFIG_ENTRY_ADDRESS;
25 .init : AT(ADDR(.init) - LOAD_OFFSET) { 25 .init : AT(ADDR(.init) - LOAD_OFFSET) {
26 _stext = .; 26 _text = .;
27 __init_begin = .; 27 __init_begin = .;
28 _sinittext = .; 28 _sinittext = .;
29 *(.text.reset) 29 *(.text.reset)
@@ -46,7 +46,7 @@ SECTIONS
46 46
47 .text : AT(ADDR(.text) - LOAD_OFFSET) { 47 .text : AT(ADDR(.text) - LOAD_OFFSET) {
48 _evba = .; 48 _evba = .;
49 _text = .; 49 _stext = .;
50 *(.ex.text) 50 *(.ex.text)
51 *(.irq.text) 51 *(.irq.text)
52 KPROBES_TEXT 52 KPROBES_TEXT
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 7c2f6685bf43..7f8759a8a92a 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -1060,7 +1060,9 @@ struct platform_device *__init at32_add_device_usart(unsigned int id)
1060 1060
1061void __init at32_setup_serial_console(unsigned int usart_id) 1061void __init at32_setup_serial_console(unsigned int usart_id)
1062{ 1062{
1063#ifdef CONFIG_SERIAL_ATMEL
1063 atmel_default_console_device = at32_usarts[usart_id]; 1064 atmel_default_console_device = at32_usarts[usart_id];
1065#endif
1064} 1066}
1065 1067
1066/* -------------------------------------------------------------------- 1068/* --------------------------------------------------------------------
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index e66e8406f992..def5391d927a 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -100,60 +100,26 @@ void __init paging_init(void)
100 100
101void __init mem_init(void) 101void __init mem_init(void)
102{ 102{
103 int codesize, reservedpages, datasize, initsize; 103 pg_data_t *pgdat;
104 int nid, i;
105 104
106 reservedpages = 0;
107 high_memory = NULL; 105 high_memory = NULL;
106 for_each_online_pgdat(pgdat)
107 high_memory = max_t(void *, high_memory,
108 __va(pgdat_end_pfn(pgdat) << PAGE_SHIFT));
108 109
109 /* this will put all low memory onto the freelists */ 110 set_max_mapnr(MAP_NR(high_memory));
110 for_each_online_node(nid) { 111 free_all_bootmem();
111 pg_data_t *pgdat = NODE_DATA(nid); 112 mem_init_print_info(NULL);
112 unsigned long node_pages = 0;
113 void *node_high_memory;
114
115 num_physpages += pgdat->node_present_pages;
116
117 if (pgdat->node_spanned_pages != 0)
118 node_pages = free_all_bootmem_node(pgdat);
119
120 totalram_pages += node_pages;
121
122 for (i = 0; i < node_pages; i++)
123 if (PageReserved(pgdat->node_mem_map + i))
124 reservedpages++;
125
126 node_high_memory = (void *)((pgdat->node_start_pfn
127 + pgdat->node_spanned_pages)
128 << PAGE_SHIFT);
129 if (node_high_memory > high_memory)
130 high_memory = node_high_memory;
131 }
132
133 max_mapnr = MAP_NR(high_memory);
134
135 codesize = (unsigned long)_etext - (unsigned long)_text;
136 datasize = (unsigned long)_edata - (unsigned long)_data;
137 initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
138
139 printk ("Memory: %luk/%luk available (%dk kernel code, "
140 "%dk reserved, %dk data, %dk init)\n",
141 nr_free_pages() << (PAGE_SHIFT - 10),
142 totalram_pages << (PAGE_SHIFT - 10),
143 codesize >> 10,
144 reservedpages << (PAGE_SHIFT - 10),
145 datasize >> 10,
146 initsize >> 10);
147} 113}
148 114
149void free_initmem(void) 115void free_initmem(void)
150{ 116{
151 free_initmem_default(0); 117 free_initmem_default(-1);
152} 118}
153 119
154#ifdef CONFIG_BLK_DEV_INITRD 120#ifdef CONFIG_BLK_DEV_INITRD
155void free_initrd_mem(unsigned long start, unsigned long end) 121void free_initrd_mem(unsigned long start, unsigned long end)
156{ 122{
157 free_reserved_area(start, end, 0, "initrd"); 123 free_reserved_area((void *)start, (void *)end, -1, "initrd");
158} 124}
159#endif 125#endif
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index a117652b5fea..08c7ac650405 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -41,6 +41,7 @@ config BLACKFIN
41 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS 41 select ARCH_USES_GETTIMEOFFSET if !GENERIC_CLOCKEVENTS
42 select HAVE_MOD_ARCH_SPECIFIC 42 select HAVE_MOD_ARCH_SPECIFIC
43 select MODULES_USE_ELF_RELA 43 select MODULES_USE_ELF_RELA
44 select HAVE_DEBUG_STACKOVERFLOW
44 45
45config GENERIC_CSUM 46config GENERIC_CSUM
46 def_bool y 47 def_bool y
@@ -253,7 +254,7 @@ config NR_CPUS
253 254
254config HOTPLUG_CPU 255config HOTPLUG_CPU
255 bool "Support for hot-pluggable CPUs" 256 bool "Support for hot-pluggable CPUs"
256 depends on SMP && HOTPLUG 257 depends on SMP
257 default y 258 default y
258 259
259config BF_REV_MIN 260config BF_REV_MIN
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
index 79594694ee90..f3337ee03621 100644
--- a/arch/blackfin/Kconfig.debug
+++ b/arch/blackfin/Kconfig.debug
@@ -2,13 +2,6 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL
8 help
9 This option will cause messages to be printed if free stack space
10 drops below a certain limit.
11
12config DEBUG_VERBOSE 5config DEBUG_VERBOSE
13 bool "Verbose fault messages" 6 bool "Verbose fault messages"
14 default y 7 default y
diff --git a/arch/blackfin/include/asm/pgtable.h b/arch/blackfin/include/asm/pgtable.h
index b8663921d3c1..0b049019eba7 100644
--- a/arch/blackfin/include/asm/pgtable.h
+++ b/arch/blackfin/include/asm/pgtable.h
@@ -88,7 +88,6 @@ extern char empty_zero_page[];
88 * No page table caches to initialise. 88 * No page table caches to initialise.
89 */ 89 */
90#define pgtable_cache_init() do { } while (0) 90#define pgtable_cache_init() do { } while (0)
91#define io_remap_pfn_range remap_pfn_range
92 91
93/* 92/*
94 * All 32bit addresses are effectively valid for vmalloc... 93 * All 32bit addresses are effectively valid for vmalloc...
diff --git a/arch/blackfin/mach-bf527/boards/ad7160eval.c b/arch/blackfin/mach-bf527/boards/ad7160eval.c
index d58f50e5aa4b..1e7be62fccb6 100644
--- a/arch/blackfin/mach-bf527/boards/ad7160eval.c
+++ b/arch/blackfin/mach-bf527/boards/ad7160eval.c
@@ -283,14 +283,6 @@ static struct platform_device bfin_i2s = {
283}; 283};
284#endif 284#endif
285 285
286#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
287static struct platform_device bfin_tdm = {
288 .name = "bfin-tdm",
289 .id = CONFIG_SND_BF5XX_SPORT_NUM,
290 /* TODO: add platform data here */
291};
292#endif
293
294static struct spi_board_info bfin_spi_board_info[] __initdata = { 286static struct spi_board_info bfin_spi_board_info[] __initdata = {
295#if defined(CONFIG_MTD_M25P80) \ 287#if defined(CONFIG_MTD_M25P80) \
296 || defined(CONFIG_MTD_M25P80_MODULE) 288 || defined(CONFIG_MTD_M25P80_MODULE)
@@ -800,10 +792,6 @@ static struct platform_device *stamp_devices[] __initdata = {
800#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) 792#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
801 &bfin_i2s, 793 &bfin_i2s,
802#endif 794#endif
803
804#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
805 &bfin_tdm,
806#endif
807}; 795};
808 796
809static int __init ad7160eval_init(void) 797static int __init ad7160eval_init(void)
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 29f16e5c37b9..d0a0c5e527cd 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -493,8 +493,7 @@ static const struct ad7879_platform_data bfin_ad7879_ts_info = {
493}; 493};
494#endif 494#endif
495 495
496#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ 496#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
497 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
498 497
499static const u16 bfin_snd_pin[][7] = { 498static const u16 bfin_snd_pin[][7] = {
500 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS, 499 {P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
@@ -549,13 +548,6 @@ static struct platform_device bfin_i2s_pcm = {
549}; 548};
550#endif 549#endif
551 550
552#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
553static struct platform_device bfin_tdm_pcm = {
554 .name = "bfin-tdm-pcm-audio",
555 .id = -1,
556};
557#endif
558
559#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 551#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
560static struct platform_device bfin_ac97_pcm = { 552static struct platform_device bfin_ac97_pcm = {
561 .name = "bfin-ac97-pcm-audio", 553 .name = "bfin-ac97-pcm-audio",
@@ -575,22 +567,10 @@ static struct platform_device bfin_i2s = {
575}; 567};
576#endif 568#endif
577 569
578#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
579static struct platform_device bfin_tdm = {
580 .name = "bfin-tdm",
581 .id = CONFIG_SND_BF5XX_SPORT_NUM,
582 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
583 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
584 .dev = {
585 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
586 },
587};
588#endif
589
590#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \ 570#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
591 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) 571 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
592static const char * const ad1836_link[] = { 572static const char * const ad1836_link[] = {
593 "bfin-tdm.0", 573 "bfin-i2s.0",
594 "spi0.4", 574 "spi0.4",
595}; 575};
596static struct platform_device bfin_ad1836_machine = { 576static struct platform_device bfin_ad1836_machine = {
@@ -1269,10 +1249,6 @@ static struct platform_device *stamp_devices[] __initdata = {
1269 &bfin_i2s_pcm, 1249 &bfin_i2s_pcm,
1270#endif 1250#endif
1271 1251
1272#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1273 &bfin_tdm_pcm,
1274#endif
1275
1276#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 1252#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1277 &bfin_ac97_pcm, 1253 &bfin_ac97_pcm,
1278#endif 1254#endif
@@ -1281,10 +1257,6 @@ static struct platform_device *stamp_devices[] __initdata = {
1281 &bfin_i2s, 1257 &bfin_i2s,
1282#endif 1258#endif
1283 1259
1284#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1285 &bfin_tdm,
1286#endif
1287
1288#if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \ 1260#if defined(CONFIG_SND_BF5XX_SOC_AD1836) || \
1289 defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) 1261 defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
1290 &bfin_ad1836_machine, 1262 &bfin_ad1836_machine,
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 07811c209b9d..90fb0d14b147 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -450,14 +450,6 @@ static struct platform_device bfin_i2s = {
450}; 450};
451#endif 451#endif
452 452
453#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
454static struct platform_device bfin_tdm = {
455 .name = "bfin-tdm",
456 .id = CONFIG_SND_BF5XX_SPORT_NUM,
457 /* TODO: add platform data here */
458};
459#endif
460
461#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 453#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
462static struct platform_device bfin_ac97 = { 454static struct platform_device bfin_ac97 = {
463 .name = "bfin-ac97", 455 .name = "bfin-ac97",
@@ -516,10 +508,6 @@ static struct platform_device *ezkit_devices[] __initdata = {
516 &bfin_i2s, 508 &bfin_i2s,
517#endif 509#endif
518 510
519#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
520 &bfin_tdm,
521#endif
522
523#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 511#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
524 &bfin_ac97, 512 &bfin_ac97,
525#endif 513#endif
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 6fca8698bf3b..4a8c2e3fd7e5 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -542,8 +542,7 @@ static struct platform_device bfin_dpmc = {
542}; 542};
543 543
544#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ 544#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
545 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) \ 545 defined(CONFIG_SND_BF5XX_AC97) || \
546 || defined(CONFIG_SND_BF5XX_AC97) || \
547 defined(CONFIG_SND_BF5XX_AC97_MODULE) 546 defined(CONFIG_SND_BF5XX_AC97_MODULE)
548 547
549#include <asm/bfin_sport.h> 548#include <asm/bfin_sport.h>
@@ -603,13 +602,6 @@ static struct platform_device bfin_i2s_pcm = {
603}; 602};
604#endif 603#endif
605 604
606#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
607static struct platform_device bfin_tdm_pcm = {
608 .name = "bfin-tdm-pcm-audio",
609 .id = -1,
610};
611#endif
612
613#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 605#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
614static struct platform_device bfin_ac97_pcm = { 606static struct platform_device bfin_ac97_pcm = {
615 .name = "bfin-ac97-pcm-audio", 607 .name = "bfin-ac97-pcm-audio",
@@ -620,7 +612,7 @@ static struct platform_device bfin_ac97_pcm = {
620#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \ 612#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
621 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) 613 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
622static const char * const ad1836_link[] = { 614static const char * const ad1836_link[] = {
623 "bfin-tdm.0", 615 "bfin-i2s.0",
624 "spi0.4", 616 "spi0.4",
625}; 617};
626static struct platform_device bfin_ad1836_machine = { 618static struct platform_device bfin_ad1836_machine = {
@@ -675,20 +667,6 @@ static struct platform_device bfin_i2s = {
675}; 667};
676#endif 668#endif
677 669
678#if defined(CONFIG_SND_BF5XX_SOC_TDM) || \
679 defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
680static struct platform_device bfin_tdm = {
681 .name = "bfin-tdm",
682 .id = CONFIG_SND_BF5XX_SPORT_NUM,
683 .num_resources =
684 ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
685 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
686 .dev = {
687 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
688 },
689};
690#endif
691
692#if defined(CONFIG_SND_BF5XX_SOC_AC97) || \ 670#if defined(CONFIG_SND_BF5XX_SOC_AC97) || \
693 defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) 671 defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
694static struct platform_device bfin_ac97 = { 672static struct platform_device bfin_ac97 = {
@@ -761,10 +739,6 @@ static struct platform_device *stamp_devices[] __initdata = {
761 &bfin_i2s_pcm, 739 &bfin_i2s_pcm,
762#endif 740#endif
763 741
764#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
765 &bfin_tdm_pcm,
766#endif
767
768#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 742#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
769 &bfin_ac97_pcm, 743 &bfin_ac97_pcm,
770#endif 744#endif
@@ -792,11 +766,6 @@ static struct platform_device *stamp_devices[] __initdata = {
792 &bfin_i2s, 766 &bfin_i2s,
793#endif 767#endif
794 768
795#if defined(CONFIG_SND_BF5XX_SOC_TDM) || \
796 defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
797 &bfin_tdm,
798#endif
799
800#if defined(CONFIG_SND_BF5XX_SOC_AC97) || \ 769#if defined(CONFIG_SND_BF5XX_SOC_AC97) || \
801 defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) 770 defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
802 &bfin_ac97, 771 &bfin_ac97,
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 6a3a14bcd3a1..44fd1d4682ac 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -2570,7 +2570,6 @@ static struct platform_device bfin_dpmc = {
2570}; 2570};
2571 2571
2572#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ 2572#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
2573 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
2574 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 2573 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2575 2574
2576#define SPORT_REQ(x) \ 2575#define SPORT_REQ(x) \
@@ -2628,13 +2627,6 @@ static struct platform_device bfin_i2s_pcm = {
2628}; 2627};
2629#endif 2628#endif
2630 2629
2631#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2632static struct platform_device bfin_tdm_pcm = {
2633 .name = "bfin-tdm-pcm-audio",
2634 .id = -1,
2635};
2636#endif
2637
2638#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 2630#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2639static struct platform_device bfin_ac97_pcm = { 2631static struct platform_device bfin_ac97_pcm = {
2640 .name = "bfin-ac97-pcm-audio", 2632 .name = "bfin-ac97-pcm-audio",
@@ -2645,7 +2637,7 @@ static struct platform_device bfin_ac97_pcm = {
2645#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \ 2637#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
2646 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) 2638 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
2647static const char * const ad1836_link[] = { 2639static const char * const ad1836_link[] = {
2648 "bfin-tdm.0", 2640 "bfin-i2s.0",
2649 "spi0.4", 2641 "spi0.4",
2650}; 2642};
2651static struct platform_device bfin_ad1836_machine = { 2643static struct platform_device bfin_ad1836_machine = {
@@ -2699,18 +2691,6 @@ static struct platform_device bfin_i2s = {
2699}; 2691};
2700#endif 2692#endif
2701 2693
2702#if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
2703static struct platform_device bfin_tdm = {
2704 .name = "bfin-tdm",
2705 .id = CONFIG_SND_BF5XX_SPORT_NUM,
2706 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
2707 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
2708 .dev = {
2709 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
2710 },
2711};
2712#endif
2713
2714#if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) 2694#if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
2715static struct platform_device bfin_ac97 = { 2695static struct platform_device bfin_ac97 = {
2716 .name = "bfin-ac97", 2696 .name = "bfin-ac97",
@@ -2935,10 +2915,6 @@ static struct platform_device *stamp_devices[] __initdata = {
2935 &bfin_i2s_pcm, 2915 &bfin_i2s_pcm,
2936#endif 2916#endif
2937 2917
2938#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
2939 &bfin_tdm_pcm,
2940#endif
2941
2942#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 2918#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
2943 &bfin_ac97_pcm, 2919 &bfin_ac97_pcm,
2944#endif 2920#endif
@@ -2961,10 +2937,6 @@ static struct platform_device *stamp_devices[] __initdata = {
2961 &bfin_i2s, 2937 &bfin_i2s,
2962#endif 2938#endif
2963 2939
2964#if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
2965 &bfin_tdm,
2966#endif
2967
2968#if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) 2940#if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
2969 &bfin_ac97, 2941 &bfin_ac97,
2970#endif 2942#endif
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index c4d07f040947..372eb54944ef 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -1393,7 +1393,6 @@ static struct platform_device bfin_dpmc = {
1393}; 1393};
1394 1394
1395#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \ 1395#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) || \
1396 defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) || \
1397 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 1396 defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1398 1397
1399#define SPORT_REQ(x) \ 1398#define SPORT_REQ(x) \
@@ -1461,13 +1460,6 @@ static struct platform_device bfin_i2s_pcm = {
1461}; 1460};
1462#endif 1461#endif
1463 1462
1464#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1465static struct platform_device bfin_tdm_pcm = {
1466 .name = "bfin-tdm-pcm-audio",
1467 .id = -1,
1468};
1469#endif
1470
1471#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 1463#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1472static struct platform_device bfin_ac97_pcm = { 1464static struct platform_device bfin_ac97_pcm = {
1473 .name = "bfin-ac97-pcm-audio", 1465 .name = "bfin-ac97-pcm-audio",
@@ -1501,18 +1493,6 @@ static struct platform_device bfin_i2s = {
1501}; 1493};
1502#endif 1494#endif
1503 1495
1504#if defined(CONFIG_SND_BF5XX_SOC_TDM) || defined(CONFIG_SND_BF5XX_SOC_TDM_MODULE)
1505static struct platform_device bfin_tdm = {
1506 .name = "bfin-tdm",
1507 .id = CONFIG_SND_BF5XX_SPORT_NUM,
1508 .num_resources = ARRAY_SIZE(bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM]),
1509 .resource = bfin_snd_resources[CONFIG_SND_BF5XX_SPORT_NUM],
1510 .dev = {
1511 .platform_data = &bfin_snd_data[CONFIG_SND_BF5XX_SPORT_NUM],
1512 },
1513};
1514#endif
1515
1516#if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE) 1496#if defined(CONFIG_SND_BF5XX_SOC_AC97) || defined(CONFIG_SND_BF5XX_SOC_AC97_MODULE)
1517static struct platform_device bfin_ac97 = { 1497static struct platform_device bfin_ac97 = {
1518 .name = "bfin-ac97", 1498 .name = "bfin-ac97",
@@ -1646,9 +1626,7 @@ static struct platform_device *ezkit_devices[] __initdata = {
1646#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE) 1626#if defined(CONFIG_SND_BF5XX_I2S) || defined(CONFIG_SND_BF5XX_I2S_MODULE)
1647 &bfin_i2s_pcm, 1627 &bfin_i2s_pcm,
1648#endif 1628#endif
1649#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE) 1629
1650 &bfin_tdm_pcm,
1651#endif
1652#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 1630#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1653 &bfin_ac97_pcm, 1631 &bfin_ac97_pcm,
1654#endif 1632#endif
@@ -1661,10 +1639,6 @@ static struct platform_device *ezkit_devices[] __initdata = {
1661 &bfin_i2s, 1639 &bfin_i2s,
1662#endif 1640#endif
1663 1641
1664#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
1665 &bfin_tdm,
1666#endif
1667
1668#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 1642#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
1669 &bfin_ac97, 1643 &bfin_ac97,
1670#endif 1644#endif
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 551f866172cf..92938e79b9e3 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -523,14 +523,6 @@ static struct platform_device bfin_i2s = {
523}; 523};
524#endif 524#endif
525 525
526#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
527static struct platform_device bfin_tdm = {
528 .name = "bfin-tdm",
529 .id = CONFIG_SND_BF5XX_SPORT_NUM,
530 /* TODO: add platform data here */
531};
532#endif
533
534#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 526#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
535static struct platform_device bfin_ac97 = { 527static struct platform_device bfin_ac97 = {
536 .name = "bfin-ac97", 528 .name = "bfin-ac97",
@@ -542,7 +534,7 @@ static struct platform_device bfin_ac97 = {
542#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \ 534#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
543 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) 535 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
544static const char * const ad1836_link[] = { 536static const char * const ad1836_link[] = {
545 "bfin-tdm.0", 537 "bfin-i2s.0",
546 "spi0.4", 538 "spi0.4",
547}; 539};
548static struct platform_device bfin_ad1836_machine = { 540static struct platform_device bfin_ad1836_machine = {
@@ -611,10 +603,6 @@ static struct platform_device *ezkit_devices[] __initdata = {
611 &bfin_i2s, 603 &bfin_i2s,
612#endif 604#endif
613 605
614#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)
615 &bfin_tdm,
616#endif
617
618#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE) 606#if defined(CONFIG_SND_BF5XX_AC97) || defined(CONFIG_SND_BF5XX_AC97_MODULE)
619 &bfin_ac97, 607 &bfin_ac97,
620#endif 608#endif
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
index 97d701639585..bba40aed4273 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -821,7 +821,7 @@ static struct platform_device bfin_i2s = {
821#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \ 821#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
822 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE) 822 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
823static const char * const ad1836_link[] = { 823static const char * const ad1836_link[] = {
824 "bfin-tdm.0", 824 "bfin-i2s.0",
825 "spi0.76", 825 "spi0.76",
826}; 826};
827static struct platform_device bfin_ad1836_machine = { 827static struct platform_device bfin_ad1836_machine = {
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 82d01a71207f..166842de3dc7 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -90,50 +90,24 @@ asmlinkage void __init init_pda(void)
90 90
91void __init mem_init(void) 91void __init mem_init(void)
92{ 92{
93 unsigned int codek = 0, datak = 0, initk = 0; 93 char buf[64];
94 unsigned int reservedpages = 0, freepages = 0;
95 unsigned long tmp;
96 unsigned long start_mem = memory_start;
97 unsigned long end_mem = memory_end;
98 94
99 end_mem &= PAGE_MASK; 95 high_memory = (void *)(memory_end & PAGE_MASK);
100 high_memory = (void *)end_mem; 96 max_mapnr = MAP_NR(high_memory);
101 97 printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", max_mapnr);
102 start_mem = PAGE_ALIGN(start_mem);
103 max_mapnr = num_physpages = MAP_NR(high_memory);
104 printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages);
105 98
106 /* This will put all low memory onto the freelists. */ 99 /* This will put all low memory onto the freelists. */
107 totalram_pages = free_all_bootmem(); 100 free_all_bootmem();
108
109 reservedpages = 0;
110 for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++)
111 if (PageReserved(pfn_to_page(tmp)))
112 reservedpages++;
113 freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages;
114
115 /* do not count in kernel image between _rambase and _ramstart */
116 reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
117#if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263)
118 reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >> PAGE_SHIFT;
119#endif
120
121 codek = (_etext - _stext) >> 10;
122 initk = (__init_end - __init_begin) >> 10;
123 datak = ((_ramstart - _rambase) >> 10) - codek - initk;
124 101
125 printk(KERN_INFO 102 snprintf(buf, sizeof(buf) - 1, "%uK DMA", DMA_UNCACHED_REGION >> 10);
126 "Memory available: %luk/%luk RAM, " 103 mem_init_print_info(buf);
127 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
128 (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10,
129 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
130} 104}
131 105
132#ifdef CONFIG_BLK_DEV_INITRD 106#ifdef CONFIG_BLK_DEV_INITRD
133void __init free_initrd_mem(unsigned long start, unsigned long end) 107void __init free_initrd_mem(unsigned long start, unsigned long end)
134{ 108{
135#ifndef CONFIG_MPU 109#ifndef CONFIG_MPU
136 free_reserved_area(start, end, 0, "initrd"); 110 free_reserved_area((void *)start, (void *)end, -1, "initrd");
137#endif 111#endif
138} 112}
139#endif 113#endif
@@ -141,7 +115,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
141void __init_refok free_initmem(void) 115void __init_refok free_initmem(void)
142{ 116{
143#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU 117#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
144 free_initmem_default(0); 118 free_initmem_default(-1);
145 if (memory_start == (unsigned long)(&__init_end)) 119 if (memory_start == (unsigned long)(&__init_end))
146 memory_start = (unsigned long)(&__init_begin); 120 memory_start = (unsigned long)(&__init_begin);
147#endif 121#endif
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 4258b088aa93..e49f918531ad 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -55,3 +55,4 @@ generic-y += types.h
55generic-y += ucontext.h 55generic-y += ucontext.h
56generic-y += user.h 56generic-y += user.h
57generic-y += vga.h 57generic-y += vga.h
58generic-y += xor.h
diff --git a/arch/c6x/include/asm/pgtable.h b/arch/c6x/include/asm/pgtable.h
index 38a4312eb2cb..c0eed5b18860 100644
--- a/arch/c6x/include/asm/pgtable.h
+++ b/arch/c6x/include/asm/pgtable.h
@@ -71,7 +71,6 @@ extern unsigned long empty_zero_page;
71 * No page table caches to initialise 71 * No page table caches to initialise
72 */ 72 */
73#define pgtable_cache_init() do { } while (0) 73#define pgtable_cache_init() do { } while (0)
74#define io_remap_pfn_range remap_pfn_range
75 74
76#include <asm-generic/pgtable.h> 75#include <asm-generic/pgtable.h>
77 76
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index 1d81c4c129ec..279d80725128 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -54,16 +54,15 @@ SECTIONS
54 } 54 }
55 55
56 . = ALIGN(PAGE_SIZE); 56 . = ALIGN(PAGE_SIZE);
57 __init_begin = .;
57 .init : 58 .init :
58 { 59 {
59 _stext = .;
60 _sinittext = .; 60 _sinittext = .;
61 HEAD_TEXT 61 HEAD_TEXT
62 INIT_TEXT 62 INIT_TEXT
63 _einittext = .; 63 _einittext = .;
64 } 64 }
65 65
66 __init_begin = _stext;
67 INIT_DATA_SECTION(16) 66 INIT_DATA_SECTION(16)
68 67
69 PERCPU_SECTION(128) 68 PERCPU_SECTION(128)
@@ -74,6 +73,7 @@ SECTIONS
74 .text : 73 .text :
75 { 74 {
76 _text = .; 75 _text = .;
76 _stext = .;
77 TEXT_TEXT 77 TEXT_TEXT
78 SCHED_TEXT 78 SCHED_TEXT
79 LOCK_TEXT 79 LOCK_TEXT
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
index a9fcd89b251b..63f5560d6eb2 100644
--- a/arch/c6x/mm/init.c
+++ b/arch/c6x/mm/init.c
@@ -18,6 +18,7 @@
18#include <linux/initrd.h> 18#include <linux/initrd.h>
19 19
20#include <asm/sections.h> 20#include <asm/sections.h>
21#include <asm/uaccess.h>
21 22
22/* 23/*
23 * ZERO_PAGE is a special page that is used for zero-initialized 24 * ZERO_PAGE is a special page that is used for zero-initialized
@@ -57,31 +58,22 @@ void __init paging_init(void)
57 58
58void __init mem_init(void) 59void __init mem_init(void)
59{ 60{
60 int codek, datak;
61 unsigned long tmp;
62 unsigned long len = memory_end - memory_start;
63
64 high_memory = (void *)(memory_end & PAGE_MASK); 61 high_memory = (void *)(memory_end & PAGE_MASK);
65 62
66 /* this will put all memory onto the freelists */ 63 /* this will put all memory onto the freelists */
67 totalram_pages = free_all_bootmem(); 64 free_all_bootmem();
68
69 codek = (_etext - _stext) >> 10;
70 datak = (_end - _sdata) >> 10;
71 65
72 tmp = nr_free_pages() << PAGE_SHIFT; 66 mem_init_print_info(NULL);
73 printk(KERN_INFO "Memory: %luk/%luk RAM (%dk kernel code, %dk data)\n",
74 tmp >> 10, len >> 10, codek, datak);
75} 67}
76 68
77#ifdef CONFIG_BLK_DEV_INITRD 69#ifdef CONFIG_BLK_DEV_INITRD
78void __init free_initrd_mem(unsigned long start, unsigned long end) 70void __init free_initrd_mem(unsigned long start, unsigned long end)
79{ 71{
80 free_reserved_area(start, end, 0, "initrd"); 72 free_reserved_area((void *)start, (void *)end, -1, "initrd");
81} 73}
82#endif 74#endif
83 75
84void __init free_initmem(void) 76void __init free_initmem(void)
85{ 77{
86 free_initmem_default(0); 78 free_initmem_default(-1);
87} 79}
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 8769a9045a54..3201ddb8da6a 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -134,11 +134,13 @@ config SVINTO_SIM
134 134
135config ETRAXFS 135config ETRAXFS
136 bool "ETRAX-FS-V32" 136 bool "ETRAX-FS-V32"
137 select CPU_FREQ_TABLE if CPU_FREQ
137 help 138 help
138 Support CRIS V32. 139 Support CRIS V32.
139 140
140config CRIS_MACH_ARTPEC3 141config CRIS_MACH_ARTPEC3
141 bool "ARTPEC-3" 142 bool "ARTPEC-3"
143 select CPU_FREQ_TABLE if CPU_FREQ
142 help 144 help
143 Support Axis ARTPEC-3. 145 Support Axis ARTPEC-3.
144 146
@@ -637,40 +639,10 @@ endchoice
637 639
638endmenu 640endmenu
639 641
640source "drivers/base/Kconfig" 642source "drivers/Kconfig"
641
642# standard linux drivers
643source "drivers/mtd/Kconfig"
644
645source "drivers/parport/Kconfig"
646
647source "drivers/pnp/Kconfig"
648
649source "drivers/block/Kconfig"
650
651source "drivers/ide/Kconfig"
652
653source "drivers/net/Kconfig"
654
655source "drivers/i2c/Kconfig"
656
657source "drivers/rtc/Kconfig"
658
659#
660# input before char - char/joystick depends on it. As does USB.
661#
662source "drivers/input/Kconfig"
663
664source "drivers/char/Kconfig"
665 643
666source "fs/Kconfig" 644source "fs/Kconfig"
667 645
668source "drivers/usb/Kconfig"
669
670source "drivers/uwb/Kconfig"
671
672source "drivers/staging/Kconfig"
673
674source "arch/cris/Kconfig.debug" 646source "arch/cris/Kconfig.debug"
675 647
676source "security/Kconfig" 648source "security/Kconfig"
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index 37e6d2c50b76..22d846bfc570 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -230,46 +230,6 @@ struct register_image
230 unsigned int usp; /* 0x66 User mode stack pointer */ 230 unsigned int usp; /* 0x66 User mode stack pointer */
231} registers; 231} registers;
232 232
233/************** Prototypes for local library functions ***********************/
234
235/* Copy of strcpy from libc. */
236static char *gdb_cris_strcpy (char *s1, const char *s2);
237
238/* Copy of strlen from libc. */
239static int gdb_cris_strlen (const char *s);
240
241/* Copy of memchr from libc. */
242static void *gdb_cris_memchr (const void *s, int c, int n);
243
244/* Copy of strtol from libc. Does only support base 16. */
245static int gdb_cris_strtol (const char *s, char **endptr, int base);
246
247/********************** Prototypes for local functions. **********************/
248/* Copy the content of a register image into another. The size n is
249 the size of the register image. Due to struct assignment generation of
250 memcpy in libc. */
251static void copy_registers (registers *dptr, registers *sptr, int n);
252
253/* Copy the stored registers from the stack. Put the register contents
254 of thread thread_id in the struct reg. */
255static void copy_registers_from_stack (int thread_id, registers *reg);
256
257/* Copy the registers to the stack. Put the register contents of thread
258 thread_id from struct reg to the stack. */
259static void copy_registers_to_stack (int thread_id, registers *reg);
260
261/* Write a value to a specified register regno in the register image
262 of the current thread. */
263static int write_register (int regno, char *val);
264
265/* Write a value to a specified register in the stack of a thread other
266 than the current thread. */
267static int write_stack_register(int thread_id, int regno, char *valptr);
268
269/* Read a value from a specified register in the register image. Returns the
270 status of the read operation. The register value is returned in valptr. */
271static int read_register (char regno, unsigned int *valptr);
272
273/* Serial port, reads one character. ETRAX 100 specific. from debugport.c */ 233/* Serial port, reads one character. ETRAX 100 specific. from debugport.c */
274int getDebugChar (void); 234int getDebugChar (void);
275 235
@@ -278,42 +238,6 @@ void putDebugChar (int val);
278 238
279void enableDebugIRQ (void); 239void enableDebugIRQ (void);
280 240
281/* Returns the integer equivalent of a hexadecimal character. */
282static int hex (char ch);
283
284/* Convert the memory, pointed to by mem into hexadecimal representation.
285 Put the result in buf, and return a pointer to the last character
286 in buf (null). */
287static char *mem2hex (char *buf, unsigned char *mem, int count);
288
289/* Convert the array, in hexadecimal representation, pointed to by buf into
290 binary representation. Put the result in mem, and return a pointer to
291 the character after the last byte written. */
292static unsigned char *hex2mem (unsigned char *mem, char *buf, int count);
293
294/* Put the content of the array, in binary representation, pointed to by buf
295 into memory pointed to by mem, and return a pointer to
296 the character after the last byte written. */
297static unsigned char *bin2mem (unsigned char *mem, unsigned char *buf, int count);
298
299/* Await the sequence $<data>#<checksum> and store <data> in the array buffer
300 returned. */
301static void getpacket (char *buffer);
302
303/* Send $<data>#<checksum> from the <data> in the array buffer. */
304static void putpacket (char *buffer);
305
306/* Build and send a response packet in order to inform the host the
307 stub is stopped. */
308static void stub_is_stopped (int sigval);
309
310/* All expected commands are sent from remote.c. Send a response according
311 to the description in remote.c. */
312static void handle_exception (int sigval);
313
314/* Performs a complete re-start from scratch. ETRAX specific. */
315static void kill_restart (void);
316
317/******************** Prototypes for global functions. ***********************/ 241/******************** Prototypes for global functions. ***********************/
318 242
319/* The string str is prepended with the GDB printout token and sent. */ 243/* The string str is prepended with the GDB printout token and sent. */
@@ -336,10 +260,6 @@ extern unsigned char executing_task;
336/* The number of characters used for a 64 bit thread identifier. */ 260/* The number of characters used for a 64 bit thread identifier. */
337#define HEXCHARS_IN_THREAD_ID 16 261#define HEXCHARS_IN_THREAD_ID 16
338 262
339/* Avoid warning as the internal_stack is not used in the C-code. */
340#define USEDVAR(name) { if (name) { ; } }
341#define USEDFUN(name) { void (*pf)(void) = (void *)name; USEDVAR(pf) }
342
343/********************************** Packet I/O ******************************/ 263/********************************** Packet I/O ******************************/
344/* BUFMAX defines the maximum number of characters in 264/* BUFMAX defines the maximum number of characters in
345 inbound/outbound buffers */ 265 inbound/outbound buffers */
@@ -405,7 +325,7 @@ static int register_size[] =
405 325
406/* Contains the register image of the executing thread in the assembler 326/* Contains the register image of the executing thread in the assembler
407 part of the code in order to avoid horrible addressing modes. */ 327 part of the code in order to avoid horrible addressing modes. */
408static registers reg; 328registers cris_reg;
409 329
410/* FIXME: Should this be used? Delete otherwise. */ 330/* FIXME: Should this be used? Delete otherwise. */
411/* Contains the assumed consistency state of the register image. Uses the 331/* Contains the assumed consistency state of the register image. Uses the
@@ -413,7 +333,7 @@ static registers reg;
413static int consistency_status = SUCCESS; 333static int consistency_status = SUCCESS;
414 334
415/********************************** Handle exceptions ************************/ 335/********************************** Handle exceptions ************************/
416/* The variable reg contains the register image associated with the 336/* The variable cris_reg contains the register image associated with the
417 current_thread_c variable. It is a complete register image created at 337 current_thread_c variable. It is a complete register image created at
418 entry. The reg_g contains a register image of a task where the general 338 entry. The reg_g contains a register image of a task where the general
419 registers are taken from the stack and all special registers are taken 339 registers are taken from the stack and all special registers are taken
@@ -421,18 +341,10 @@ static int consistency_status = SUCCESS;
421 in order to provide access mainly for 'g', 'G' and 'P'. 341 in order to provide access mainly for 'g', 'G' and 'P'.
422*/ 342*/
423 343
424/* Need two task id pointers in order to handle Hct and Hgt commands. */
425static int current_thread_c = 0;
426static int current_thread_g = 0;
427
428/* Need two register images in order to handle Hct and Hgt commands. The
429 variable reg_g is in addition to reg above. */
430static registers reg_g;
431
432/********************************** Breakpoint *******************************/ 344/********************************** Breakpoint *******************************/
433/* Use an internal stack in the breakpoint and interrupt response routines */ 345/* Use an internal stack in the breakpoint and interrupt response routines */
434#define INTERNAL_STACK_SIZE 1024 346#define INTERNAL_STACK_SIZE 1024
435static char internal_stack[INTERNAL_STACK_SIZE]; 347char internal_stack[INTERNAL_STACK_SIZE];
436 348
437/* Due to the breakpoint return pointer, a state variable is needed to keep 349/* Due to the breakpoint return pointer, a state variable is needed to keep
438 track of whether it is a static (compiled) or dynamic (gdb-invoked) 350 track of whether it is a static (compiled) or dynamic (gdb-invoked)
@@ -500,164 +412,6 @@ gdb_cris_strtol (const char *s, char **endptr, int base)
500 return x; 412 return x;
501} 413}
502 414
503/********************************* Register image ****************************/
504/* Copy the content of a register image into another. The size n is
505 the size of the register image. Due to struct assignment generation of
506 memcpy in libc. */
507static void
508copy_registers (registers *dptr, registers *sptr, int n)
509{
510 unsigned char *dreg;
511 unsigned char *sreg;
512
513 for (dreg = (unsigned char*)dptr, sreg = (unsigned char*)sptr; n > 0; n--)
514 *dreg++ = *sreg++;
515}
516
517#ifdef PROCESS_SUPPORT
518/* Copy the stored registers from the stack. Put the register contents
519 of thread thread_id in the struct reg. */
520static void
521copy_registers_from_stack (int thread_id, registers *regptr)
522{
523 int j;
524 stack_registers *s = (stack_registers *)stack_list[thread_id];
525 unsigned int *d = (unsigned int *)regptr;
526
527 for (j = 13; j >= 0; j--)
528 *d++ = s->r[j];
529 regptr->sp = (unsigned int)stack_list[thread_id];
530 regptr->pc = s->pc;
531 regptr->dccr = s->dccr;
532 regptr->srp = s->srp;
533}
534
535/* Copy the registers to the stack. Put the register contents of thread
536 thread_id from struct reg to the stack. */
537static void
538copy_registers_to_stack (int thread_id, registers *regptr)
539{
540 int i;
541 stack_registers *d = (stack_registers *)stack_list[thread_id];
542 unsigned int *s = (unsigned int *)regptr;
543
544 for (i = 0; i < 14; i++) {
545 d->r[i] = *s++;
546 }
547 d->pc = regptr->pc;
548 d->dccr = regptr->dccr;
549 d->srp = regptr->srp;
550}
551#endif
552
553/* Write a value to a specified register in the register image of the current
554 thread. Returns status code SUCCESS, E02 or E05. */
555static int
556write_register (int regno, char *val)
557{
558 int status = SUCCESS;
559 registers *current_reg = &reg;
560
561 if (regno >= R0 && regno <= PC) {
562 /* 32-bit register with simple offset. */
563 hex2mem ((unsigned char *)current_reg + regno * sizeof(unsigned int),
564 val, sizeof(unsigned int));
565 }
566 else if (regno == P0 || regno == VR || regno == P4 || regno == P8) {
567 /* Do not support read-only registers. */
568 status = E02;
569 }
570 else if (regno == CCR) {
571 /* 16 bit register with complex offset. (P4 is read-only, P6 is not implemented,
572 and P7 (MOF) is 32 bits in ETRAX 100LX. */
573 hex2mem ((unsigned char *)&(current_reg->ccr) + (regno-CCR) * sizeof(unsigned short),
574 val, sizeof(unsigned short));
575 }
576 else if (regno >= MOF && regno <= USP) {
577 /* 32 bit register with complex offset. (P8 has been taken care of.) */
578 hex2mem ((unsigned char *)&(current_reg->ibr) + (regno-IBR) * sizeof(unsigned int),
579 val, sizeof(unsigned int));
580 }
581 else {
582 /* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
583 status = E05;
584 }
585 return status;
586}
587
588#ifdef PROCESS_SUPPORT
589/* Write a value to a specified register in the stack of a thread other
590 than the current thread. Returns status code SUCCESS or E07. */
591static int
592write_stack_register (int thread_id, int regno, char *valptr)
593{
594 int status = SUCCESS;
595 stack_registers *d = (stack_registers *)stack_list[thread_id];
596 unsigned int val;
597
598 hex2mem ((unsigned char *)&val, valptr, sizeof(unsigned int));
599 if (regno >= R0 && regno < SP) {
600 d->r[regno] = val;
601 }
602 else if (regno == SP) {
603 stack_list[thread_id] = val;
604 }
605 else if (regno == PC) {
606 d->pc = val;
607 }
608 else if (regno == SRP) {
609 d->srp = val;
610 }
611 else if (regno == DCCR) {
612 d->dccr = val;
613 }
614 else {
615 /* Do not support registers in the current thread. */
616 status = E07;
617 }
618 return status;
619}
620#endif
621
622/* Read a value from a specified register in the register image. Returns the
623 value in the register or -1 for non-implemented registers.
624 Should check consistency_status after a call which may be E05 after changes
625 in the implementation. */
626static int
627read_register (char regno, unsigned int *valptr)
628{
629 registers *current_reg = &reg;
630
631 if (regno >= R0 && regno <= PC) {
632 /* 32-bit register with simple offset. */
633 *valptr = *(unsigned int *)((char *)current_reg + regno * sizeof(unsigned int));
634 return SUCCESS;
635 }
636 else if (regno == P0 || regno == VR) {
637 /* 8 bit register with complex offset. */
638 *valptr = (unsigned int)(*(unsigned char *)
639 ((char *)&(current_reg->p0) + (regno-P0) * sizeof(char)));
640 return SUCCESS;
641 }
642 else if (regno == P4 || regno == CCR) {
643 /* 16 bit register with complex offset. */
644 *valptr = (unsigned int)(*(unsigned short *)
645 ((char *)&(current_reg->p4) + (regno-P4) * sizeof(unsigned short)));
646 return SUCCESS;
647 }
648 else if (regno >= MOF && regno <= USP) {
649 /* 32 bit register with complex offset. */
650 *valptr = *(unsigned int *)((char *)&(current_reg->p8)
651 + (regno-P8) * sizeof(unsigned int));
652 return SUCCESS;
653 }
654 else {
655 /* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
656 consistency_status = E05;
657 return E05;
658 }
659}
660
661/********************************** Packet I/O ******************************/ 415/********************************** Packet I/O ******************************/
662/* Returns the integer equivalent of a hexadecimal character. */ 416/* Returns the integer equivalent of a hexadecimal character. */
663static int 417static int
@@ -676,8 +430,6 @@ hex (char ch)
676 Put the result in buf, and return a pointer to the last character 430 Put the result in buf, and return a pointer to the last character
677 in buf (null). */ 431 in buf (null). */
678 432
679static int do_printk = 0;
680
681static char * 433static char *
682mem2hex(char *buf, unsigned char *mem, int count) 434mem2hex(char *buf, unsigned char *mem, int count)
683{ 435{
@@ -761,7 +513,7 @@ getpacket (char *buffer)
761 xmitcsum = -1; 513 xmitcsum = -1;
762 count = 0; 514 count = 0;
763 /* Read until a # or the end of the buffer is reached */ 515 /* Read until a # or the end of the buffer is reached */
764 while (count < BUFMAX) { 516 while (count < BUFMAX - 1) {
765 ch = getDebugChar (); 517 ch = getDebugChar ();
766 if (ch == '#') 518 if (ch == '#')
767 break; 519 break;
@@ -845,6 +597,81 @@ putDebugString (const unsigned char *str, int length)
845 putpacket(remcomOutBuffer); 597 putpacket(remcomOutBuffer);
846} 598}
847 599
600/********************************* Register image ****************************/
601/* Write a value to a specified register in the register image of the current
602 thread. Returns status code SUCCESS, E02 or E05. */
603static int
604write_register (int regno, char *val)
605{
606 int status = SUCCESS;
607 registers *current_reg = &cris_reg;
608
609 if (regno >= R0 && regno <= PC) {
610 /* 32-bit register with simple offset. */
611 hex2mem ((unsigned char *)current_reg + regno * sizeof(unsigned int),
612 val, sizeof(unsigned int));
613 }
614 else if (regno == P0 || regno == VR || regno == P4 || regno == P8) {
615 /* Do not support read-only registers. */
616 status = E02;
617 }
618 else if (regno == CCR) {
619 /* 16 bit register with complex offset. (P4 is read-only, P6 is not implemented,
620 and P7 (MOF) is 32 bits in ETRAX 100LX. */
621 hex2mem ((unsigned char *)&(current_reg->ccr) + (regno-CCR) * sizeof(unsigned short),
622 val, sizeof(unsigned short));
623 }
624 else if (regno >= MOF && regno <= USP) {
625 /* 32 bit register with complex offset. (P8 has been taken care of.) */
626 hex2mem ((unsigned char *)&(current_reg->ibr) + (regno-IBR) * sizeof(unsigned int),
627 val, sizeof(unsigned int));
628 }
629 else {
630 /* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
631 status = E05;
632 }
633 return status;
634}
635
636/* Read a value from a specified register in the register image. Returns the
637 value in the register or -1 for non-implemented registers.
638 Should check consistency_status after a call which may be E05 after changes
639 in the implementation. */
640static int
641read_register (char regno, unsigned int *valptr)
642{
643 registers *current_reg = &cris_reg;
644
645 if (regno >= R0 && regno <= PC) {
646 /* 32-bit register with simple offset. */
647 *valptr = *(unsigned int *)((char *)current_reg + regno * sizeof(unsigned int));
648 return SUCCESS;
649 }
650 else if (regno == P0 || regno == VR) {
651 /* 8 bit register with complex offset. */
652 *valptr = (unsigned int)(*(unsigned char *)
653 ((char *)&(current_reg->p0) + (regno-P0) * sizeof(char)));
654 return SUCCESS;
655 }
656 else if (regno == P4 || regno == CCR) {
657 /* 16 bit register with complex offset. */
658 *valptr = (unsigned int)(*(unsigned short *)
659 ((char *)&(current_reg->p4) + (regno-P4) * sizeof(unsigned short)));
660 return SUCCESS;
661 }
662 else if (regno >= MOF && regno <= USP) {
663 /* 32 bit register with complex offset. */
664 *valptr = *(unsigned int *)((char *)&(current_reg->p8)
665 + (regno-P8) * sizeof(unsigned int));
666 return SUCCESS;
667 }
668 else {
669 /* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
670 consistency_status = E05;
671 return E05;
672 }
673}
674
848/********************************** Handle exceptions ************************/ 675/********************************** Handle exceptions ************************/
849/* Build and send a response packet in order to inform the host the 676/* Build and send a response packet in order to inform the host the
850 stub is stopped. TAAn...:r...;n...:r...;n...:r...; 677 stub is stopped. TAAn...:r...;n...:r...;n...:r...;
@@ -891,26 +718,6 @@ stub_is_stopped(int sigval)
891 718
892 } 719 }
893 720
894#ifdef PROCESS_SUPPORT
895 /* Store the registers of the executing thread. Assume that both step,
896 continue, and register content requests are with respect to this
897 thread. The executing task is from the operating system scheduler. */
898
899 current_thread_c = executing_task;
900 current_thread_g = executing_task;
901
902 /* A struct assignment translates into a libc memcpy call. Avoid
903 all libc functions in order to prevent recursive break points. */
904 copy_registers (&reg_g, &reg, sizeof(registers));
905
906 /* Store thread:r...; with the executing task TID. */
907 gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:");
908 pos += gdb_cris_strlen ("thread:");
909 remcomOutBuffer[pos++] = hex_asc_hi(executing_task);
910 remcomOutBuffer[pos++] = hex_asc_lo(executing_task);
911 gdb_cris_strcpy (&remcomOutBuffer[pos], ";");
912#endif
913
914 /* null-terminate and send it off */ 721 /* null-terminate and send it off */
915 722
916 *ptr = 0; 723 *ptr = 0;
@@ -918,16 +725,18 @@ stub_is_stopped(int sigval)
918 putpacket (remcomOutBuffer); 725 putpacket (remcomOutBuffer);
919} 726}
920 727
728/* Performs a complete re-start from scratch. */
729static void
730kill_restart (void)
731{
732 machine_restart("");
733}
734
921/* All expected commands are sent from remote.c. Send a response according 735/* All expected commands are sent from remote.c. Send a response according
922 to the description in remote.c. */ 736 to the description in remote.c. */
923static void 737void
924handle_exception (int sigval) 738handle_exception (int sigval)
925{ 739{
926 /* Avoid warning of not used. */
927
928 USEDFUN(handle_exception);
929 USEDVAR(internal_stack[0]);
930
931 /* Send response. */ 740 /* Send response. */
932 741
933 stub_is_stopped (sigval); 742 stub_is_stopped (sigval);
@@ -943,19 +752,7 @@ handle_exception (int sigval)
943 in a register are in the same order the machine uses. 752 in a register are in the same order the machine uses.
944 Failure: void. */ 753 Failure: void. */
945 754
946 { 755 mem2hex(remcomOutBuffer, (char *)&cris_reg, sizeof(registers));
947#ifdef PROCESS_SUPPORT
948 /* Use the special register content in the executing thread. */
949 copy_registers (&reg_g, &reg, sizeof(registers));
950 /* Replace the content available on the stack. */
951 if (current_thread_g != executing_task) {
952 copy_registers_from_stack (current_thread_g, &reg_g);
953 }
954 mem2hex ((unsigned char *)remcomOutBuffer, (unsigned char *)&reg_g, sizeof(registers));
955#else
956 mem2hex(remcomOutBuffer, (char *)&reg, sizeof(registers));
957#endif
958 }
959 break; 756 break;
960 757
961 case 'G': 758 case 'G':
@@ -963,17 +760,7 @@ handle_exception (int sigval)
963 Each byte of register data is described by two hex digits. 760 Each byte of register data is described by two hex digits.
964 Success: OK 761 Success: OK
965 Failure: void. */ 762 Failure: void. */
966#ifdef PROCESS_SUPPORT 763 hex2mem((char *)&cris_reg, &remcomInBuffer[1], sizeof(registers));
967 hex2mem ((unsigned char *)&reg_g, &remcomInBuffer[1], sizeof(registers));
968 if (current_thread_g == executing_task) {
969 copy_registers (&reg, &reg_g, sizeof(registers));
970 }
971 else {
972 copy_registers_to_stack(current_thread_g, &reg_g);
973 }
974#else
975 hex2mem((char *)&reg, &remcomInBuffer[1], sizeof(registers));
976#endif
977 gdb_cris_strcpy (remcomOutBuffer, "OK"); 764 gdb_cris_strcpy (remcomOutBuffer, "OK");
978 break; 765 break;
979 766
@@ -989,12 +776,7 @@ handle_exception (int sigval)
989 char *suffix; 776 char *suffix;
990 int regno = gdb_cris_strtol (&remcomInBuffer[1], &suffix, 16); 777 int regno = gdb_cris_strtol (&remcomInBuffer[1], &suffix, 16);
991 int status; 778 int status;
992#ifdef PROCESS_SUPPORT 779 status = write_register (regno, suffix+1);
993 if (current_thread_g != executing_task)
994 status = write_stack_register (current_thread_g, regno, suffix+1);
995 else
996#endif
997 status = write_register (regno, suffix+1);
998 780
999 switch (status) { 781 switch (status) {
1000 case E02: 782 case E02:
@@ -1073,7 +855,7 @@ handle_exception (int sigval)
1073 Success: return to the executing thread. 855 Success: return to the executing thread.
1074 Failure: will never know. */ 856 Failure: will never know. */
1075 if (remcomInBuffer[1] != '\0') { 857 if (remcomInBuffer[1] != '\0') {
1076 reg.pc = gdb_cris_strtol (&remcomInBuffer[1], 0, 16); 858 cris_reg.pc = gdb_cris_strtol (&remcomInBuffer[1], 0, 16);
1077 } 859 }
1078 enableDebugIRQ(); 860 enableDebugIRQ();
1079 return; 861 return;
@@ -1129,119 +911,6 @@ handle_exception (int sigval)
1129 Not supported: E04 */ 911 Not supported: E04 */
1130 gdb_cris_strcpy (remcomOutBuffer, error_message[E04]); 912 gdb_cris_strcpy (remcomOutBuffer, error_message[E04]);
1131 break; 913 break;
1132#ifdef PROCESS_SUPPORT
1133
1134 case 'T':
1135 /* Thread alive. TXX
1136 Is thread XX alive?
1137 Success: OK, thread XX is alive.
1138 Failure: E03, thread XX is dead. */
1139 {
1140 int thread_id = (int)gdb_cris_strtol (&remcomInBuffer[1], 0, 16);
1141 /* Cannot tell whether it is alive or not. */
1142 if (thread_id >= 0 && thread_id < number_of_tasks)
1143 gdb_cris_strcpy (remcomOutBuffer, "OK");
1144 }
1145 break;
1146
1147 case 'H':
1148 /* Set thread for subsequent operations: Hct
1149 c = 'c' for thread used in step and continue;
1150 t can be -1 for all threads.
1151 c = 'g' for thread used in other operations.
1152 t = 0 means pick any thread.
1153 Success: OK
1154 Failure: E01 */
1155 {
1156 int thread_id = gdb_cris_strtol (&remcomInBuffer[2], 0, 16);
1157 if (remcomInBuffer[1] == 'c') {
1158 /* c = 'c' for thread used in step and continue */
1159 /* Do not change current_thread_c here. It would create a mess in
1160 the scheduler. */
1161 gdb_cris_strcpy (remcomOutBuffer, "OK");
1162 }
1163 else if (remcomInBuffer[1] == 'g') {
1164 /* c = 'g' for thread used in other operations.
1165 t = 0 means pick any thread. Impossible since the scheduler does
1166 not allow that. */
1167 if (thread_id >= 0 && thread_id < number_of_tasks) {
1168 current_thread_g = thread_id;
1169 gdb_cris_strcpy (remcomOutBuffer, "OK");
1170 }
1171 else {
1172 /* Not expected - send an error message. */
1173 gdb_cris_strcpy (remcomOutBuffer, error_message[E01]);
1174 }
1175 }
1176 else {
1177 /* Not expected - send an error message. */
1178 gdb_cris_strcpy (remcomOutBuffer, error_message[E01]);
1179 }
1180 }
1181 break;
1182
1183 case 'q':
1184 case 'Q':
1185 /* Query of general interest. qXXXX
1186 Set general value XXXX. QXXXX=yyyy */
1187 {
1188 int pos;
1189 int nextpos;
1190 int thread_id;
1191
1192 switch (remcomInBuffer[1]) {
1193 case 'C':
1194 /* Identify the remote current thread. */
1195 gdb_cris_strcpy (&remcomOutBuffer[0], "QC");
1196 remcomOutBuffer[2] = hex_asc_hi(current_thread_c);
1197 remcomOutBuffer[3] = hex_asc_lo(current_thread_c);
1198 remcomOutBuffer[4] = '\0';
1199 break;
1200 case 'L':
1201 gdb_cris_strcpy (&remcomOutBuffer[0], "QM");
1202 /* Reply with number of threads. */
1203 if (os_is_started()) {
1204 remcomOutBuffer[2] = hex_asc_hi(number_of_tasks);
1205 remcomOutBuffer[3] = hex_asc_lo(number_of_tasks);
1206 }
1207 else {
1208 remcomOutBuffer[2] = hex_asc_hi(0);
1209 remcomOutBuffer[3] = hex_asc_lo(1);
1210 }
1211 /* Done with the reply. */
1212 remcomOutBuffer[4] = hex_asc_lo(1);
1213 pos = 5;
1214 /* Expects the argument thread id. */
1215 for (; pos < (5 + HEXCHARS_IN_THREAD_ID); pos++)
1216 remcomOutBuffer[pos] = remcomInBuffer[pos];
1217 /* Reply with the thread identifiers. */
1218 if (os_is_started()) {
1219 /* Store the thread identifiers of all tasks. */
1220 for (thread_id = 0; thread_id < number_of_tasks; thread_id++) {
1221 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1222 for (; pos < nextpos; pos ++)
1223 remcomOutBuffer[pos] = hex_asc_lo(0);
1224 remcomOutBuffer[pos++] = hex_asc_lo(thread_id);
1225 }
1226 }
1227 else {
1228 /* Store the thread identifier of the boot task. */
1229 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1230 for (; pos < nextpos; pos ++)
1231 remcomOutBuffer[pos] = hex_asc_lo(0);
1232 remcomOutBuffer[pos++] = hex_asc_lo(current_thread_c);
1233 }
1234 remcomOutBuffer[pos] = '\0';
1235 break;
1236 default:
1237 /* Not supported: "" */
1238 /* Request information about section offsets: qOffsets. */
1239 remcomOutBuffer[0] = 0;
1240 break;
1241 }
1242 }
1243 break;
1244#endif /* PROCESS_SUPPORT */
1245 914
1246 default: 915 default:
1247 /* The stub should ignore other request and send an empty 916 /* The stub should ignore other request and send an empty
@@ -1254,13 +923,6 @@ handle_exception (int sigval)
1254 } 923 }
1255} 924}
1256 925
1257/* Performs a complete re-start from scratch. */
1258static void
1259kill_restart ()
1260{
1261 machine_restart("");
1262}
1263
1264/********************************** Breakpoint *******************************/ 926/********************************** Breakpoint *******************************/
1265/* The hook for both a static (compiled) and a dynamic breakpoint set by GDB. 927/* The hook for both a static (compiled) and a dynamic breakpoint set by GDB.
1266 An internal stack is used by the stub. The register image of the caller is 928 An internal stack is used by the stub. The register image of the caller is
@@ -1270,93 +932,93 @@ kill_restart ()
1270 932
1271void kgdb_handle_breakpoint(void); 933void kgdb_handle_breakpoint(void);
1272 934
1273asm (" 935asm ("\n"
1274 .global kgdb_handle_breakpoint 936" .global kgdb_handle_breakpoint\n"
1275kgdb_handle_breakpoint: 937"kgdb_handle_breakpoint:\n"
1276;; 938";;\n"
1277;; Response to the break-instruction 939";; Response to the break-instruction\n"
1278;; 940";;\n"
1279;; Create a register image of the caller 941";; Create a register image of the caller\n"
1280;; 942";;\n"
1281 move $dccr,[reg+0x5E] ; Save the flags in DCCR before disable interrupts 943" move $dccr,[cris_reg+0x5E] ; Save the flags in DCCR before disable interrupts\n"
1282 di ; Disable interrupts 944" di ; Disable interrupts\n"
1283 move.d $r0,[reg] ; Save R0 945" move.d $r0,[cris_reg] ; Save R0\n"
1284 move.d $r1,[reg+0x04] ; Save R1 946" move.d $r1,[cris_reg+0x04] ; Save R1\n"
1285 move.d $r2,[reg+0x08] ; Save R2 947" move.d $r2,[cris_reg+0x08] ; Save R2\n"
1286 move.d $r3,[reg+0x0C] ; Save R3 948" move.d $r3,[cris_reg+0x0C] ; Save R3\n"
1287 move.d $r4,[reg+0x10] ; Save R4 949" move.d $r4,[cris_reg+0x10] ; Save R4\n"
1288 move.d $r5,[reg+0x14] ; Save R5 950" move.d $r5,[cris_reg+0x14] ; Save R5\n"
1289 move.d $r6,[reg+0x18] ; Save R6 951" move.d $r6,[cris_reg+0x18] ; Save R6\n"
1290 move.d $r7,[reg+0x1C] ; Save R7 952" move.d $r7,[cris_reg+0x1C] ; Save R7\n"
1291 move.d $r8,[reg+0x20] ; Save R8 953" move.d $r8,[cris_reg+0x20] ; Save R8\n"
1292 move.d $r9,[reg+0x24] ; Save R9 954" move.d $r9,[cris_reg+0x24] ; Save R9\n"
1293 move.d $r10,[reg+0x28] ; Save R10 955" move.d $r10,[cris_reg+0x28] ; Save R10\n"
1294 move.d $r11,[reg+0x2C] ; Save R11 956" move.d $r11,[cris_reg+0x2C] ; Save R11\n"
1295 move.d $r12,[reg+0x30] ; Save R12 957" move.d $r12,[cris_reg+0x30] ; Save R12\n"
1296 move.d $r13,[reg+0x34] ; Save R13 958" move.d $r13,[cris_reg+0x34] ; Save R13\n"
1297 move.d $sp,[reg+0x38] ; Save SP (R14) 959" move.d $sp,[cris_reg+0x38] ; Save SP (R14)\n"
1298;; Due to the old assembler-versions BRP might not be recognized 960";; Due to the old assembler-versions BRP might not be recognized\n"
1299 .word 0xE670 ; move brp,$r0 961" .word 0xE670 ; move brp,$r0\n"
1300 subq 2,$r0 ; Set to address of previous instruction. 962" subq 2,$r0 ; Set to address of previous instruction.\n"
1301 move.d $r0,[reg+0x3c] ; Save the address in PC (R15) 963" move.d $r0,[cris_reg+0x3c] ; Save the address in PC (R15)\n"
1302 clear.b [reg+0x40] ; Clear P0 964" clear.b [cris_reg+0x40] ; Clear P0\n"
1303 move $vr,[reg+0x41] ; Save special register P1 965" move $vr,[cris_reg+0x41] ; Save special register P1\n"
1304 clear.w [reg+0x42] ; Clear P4 966" clear.w [cris_reg+0x42] ; Clear P4\n"
1305 move $ccr,[reg+0x44] ; Save special register CCR 967" move $ccr,[cris_reg+0x44] ; Save special register CCR\n"
1306 move $mof,[reg+0x46] ; P7 968" move $mof,[cris_reg+0x46] ; P7\n"
1307 clear.d [reg+0x4A] ; Clear P8 969" clear.d [cris_reg+0x4A] ; Clear P8\n"
1308 move $ibr,[reg+0x4E] ; P9, 970" move $ibr,[cris_reg+0x4E] ; P9,\n"
1309 move $irp,[reg+0x52] ; P10, 971" move $irp,[cris_reg+0x52] ; P10,\n"
1310 move $srp,[reg+0x56] ; P11, 972" move $srp,[cris_reg+0x56] ; P11,\n"
1311 move $dtp0,[reg+0x5A] ; P12, register BAR, assembler might not know BAR 973" move $dtp0,[cris_reg+0x5A] ; P12, register BAR, assembler might not know BAR\n"
1312 ; P13, register DCCR already saved 974" ; P13, register DCCR already saved\n"
1313;; Due to the old assembler-versions BRP might not be recognized 975";; Due to the old assembler-versions BRP might not be recognized\n"
1314 .word 0xE670 ; move brp,r0 976" .word 0xE670 ; move brp,r0\n"
1315;; Static (compiled) breakpoints must return to the next instruction in order 977";; Static (compiled) breakpoints must return to the next instruction in order\n"
1316;; to avoid infinite loops. Dynamic (gdb-invoked) must restore the instruction 978";; to avoid infinite loops. Dynamic (gdb-invoked) must restore the instruction\n"
1317;; in order to execute it when execution is continued. 979";; in order to execute it when execution is continued.\n"
1318 test.b [is_dyn_brkp] ; Is this a dynamic breakpoint? 980" test.b [is_dyn_brkp] ; Is this a dynamic breakpoint?\n"
1319 beq is_static ; No, a static breakpoint 981" beq is_static ; No, a static breakpoint\n"
1320 nop 982" nop\n"
1321 subq 2,$r0 ; rerun the instruction the break replaced 983" subq 2,$r0 ; rerun the instruction the break replaced\n"
1322is_static: 984"is_static:\n"
1323 moveq 1,$r1 985" moveq 1,$r1\n"
1324 move.b $r1,[is_dyn_brkp] ; Set the state variable to dynamic breakpoint 986" move.b $r1,[is_dyn_brkp] ; Set the state variable to dynamic breakpoint\n"
1325 move.d $r0,[reg+0x62] ; Save the return address in BRP 987" move.d $r0,[cris_reg+0x62] ; Save the return address in BRP\n"
1326 move $usp,[reg+0x66] ; USP 988" move $usp,[cris_reg+0x66] ; USP\n"
1327;; 989";;\n"
1328;; Handle the communication 990";; Handle the communication\n"
1329;; 991";;\n"
1330 move.d internal_stack+1020,$sp ; Use the internal stack which grows upward 992" move.d internal_stack+1020,$sp ; Use the internal stack which grows upward\n"
1331 moveq 5,$r10 ; SIGTRAP 993" moveq 5,$r10 ; SIGTRAP\n"
1332 jsr handle_exception ; Interactive routine 994" jsr handle_exception ; Interactive routine\n"
1333;; 995";;\n"
1334;; Return to the caller 996";; Return to the caller\n"
1335;; 997";;\n"
1336 move.d [reg],$r0 ; Restore R0 998" move.d [cris_reg],$r0 ; Restore R0\n"
1337 move.d [reg+0x04],$r1 ; Restore R1 999" move.d [cris_reg+0x04],$r1 ; Restore R1\n"
1338 move.d [reg+0x08],$r2 ; Restore R2 1000" move.d [cris_reg+0x08],$r2 ; Restore R2\n"
1339 move.d [reg+0x0C],$r3 ; Restore R3 1001" move.d [cris_reg+0x0C],$r3 ; Restore R3\n"
1340 move.d [reg+0x10],$r4 ; Restore R4 1002" move.d [cris_reg+0x10],$r4 ; Restore R4\n"
1341 move.d [reg+0x14],$r5 ; Restore R5 1003" move.d [cris_reg+0x14],$r5 ; Restore R5\n"
1342 move.d [reg+0x18],$r6 ; Restore R6 1004" move.d [cris_reg+0x18],$r6 ; Restore R6\n"
1343 move.d [reg+0x1C],$r7 ; Restore R7 1005" move.d [cris_reg+0x1C],$r7 ; Restore R7\n"
1344 move.d [reg+0x20],$r8 ; Restore R8 1006" move.d [cris_reg+0x20],$r8 ; Restore R8\n"
1345 move.d [reg+0x24],$r9 ; Restore R9 1007" move.d [cris_reg+0x24],$r9 ; Restore R9\n"
1346 move.d [reg+0x28],$r10 ; Restore R10 1008" move.d [cris_reg+0x28],$r10 ; Restore R10\n"
1347 move.d [reg+0x2C],$r11 ; Restore R11 1009" move.d [cris_reg+0x2C],$r11 ; Restore R11\n"
1348 move.d [reg+0x30],$r12 ; Restore R12 1010" move.d [cris_reg+0x30],$r12 ; Restore R12\n"
1349 move.d [reg+0x34],$r13 ; Restore R13 1011" move.d [cris_reg+0x34],$r13 ; Restore R13\n"
1350;; 1012";;\n"
1351;; FIXME: Which registers should be restored? 1013";; FIXME: Which registers should be restored?\n"
1352;; 1014";;\n"
1353 move.d [reg+0x38],$sp ; Restore SP (R14) 1015" move.d [cris_reg+0x38],$sp ; Restore SP (R14)\n"
1354 move [reg+0x56],$srp ; Restore the subroutine return pointer. 1016" move [cris_reg+0x56],$srp ; Restore the subroutine return pointer.\n"
1355 move [reg+0x5E],$dccr ; Restore DCCR 1017" move [cris_reg+0x5E],$dccr ; Restore DCCR\n"
1356 move [reg+0x66],$usp ; Restore USP 1018" move [cris_reg+0x66],$usp ; Restore USP\n"
1357 jump [reg+0x62] ; A jump to the content in register BRP works. 1019" jump [cris_reg+0x62] ; A jump to the content in register BRP works.\n"
1358 nop ; 1020" nop ;\n"
1359"); 1021"\n");
1360 1022
1361/* The hook for an interrupt generated by GDB. An internal stack is used 1023/* The hook for an interrupt generated by GDB. An internal stack is used
1362 by the stub. The register image of the caller is stored in the structure 1024 by the stub. The register image of the caller is stored in the structure
@@ -1367,94 +1029,94 @@ is_static:
1367 1029
1368void kgdb_handle_serial(void); 1030void kgdb_handle_serial(void);
1369 1031
1370asm (" 1032asm ("\n"
1371 .global kgdb_handle_serial 1033" .global kgdb_handle_serial\n"
1372kgdb_handle_serial: 1034"kgdb_handle_serial:\n"
1373;; 1035";;\n"
1374;; Response to a serial interrupt 1036";; Response to a serial interrupt\n"
1375;; 1037";;\n"
1376 1038"\n"
1377 move $dccr,[reg+0x5E] ; Save the flags in DCCR 1039" move $dccr,[cris_reg+0x5E] ; Save the flags in DCCR\n"
1378 di ; Disable interrupts 1040" di ; Disable interrupts\n"
1379 move.d $r0,[reg] ; Save R0 1041" move.d $r0,[cris_reg] ; Save R0\n"
1380 move.d $r1,[reg+0x04] ; Save R1 1042" move.d $r1,[cris_reg+0x04] ; Save R1\n"
1381 move.d $r2,[reg+0x08] ; Save R2 1043" move.d $r2,[cris_reg+0x08] ; Save R2\n"
1382 move.d $r3,[reg+0x0C] ; Save R3 1044" move.d $r3,[cris_reg+0x0C] ; Save R3\n"
1383 move.d $r4,[reg+0x10] ; Save R4 1045" move.d $r4,[cris_reg+0x10] ; Save R4\n"
1384 move.d $r5,[reg+0x14] ; Save R5 1046" move.d $r5,[cris_reg+0x14] ; Save R5\n"
1385 move.d $r6,[reg+0x18] ; Save R6 1047" move.d $r6,[cris_reg+0x18] ; Save R6\n"
1386 move.d $r7,[reg+0x1C] ; Save R7 1048" move.d $r7,[cris_reg+0x1C] ; Save R7\n"
1387 move.d $r8,[reg+0x20] ; Save R8 1049" move.d $r8,[cris_reg+0x20] ; Save R8\n"
1388 move.d $r9,[reg+0x24] ; Save R9 1050" move.d $r9,[cris_reg+0x24] ; Save R9\n"
1389 move.d $r10,[reg+0x28] ; Save R10 1051" move.d $r10,[cris_reg+0x28] ; Save R10\n"
1390 move.d $r11,[reg+0x2C] ; Save R11 1052" move.d $r11,[cris_reg+0x2C] ; Save R11\n"
1391 move.d $r12,[reg+0x30] ; Save R12 1053" move.d $r12,[cris_reg+0x30] ; Save R12\n"
1392 move.d $r13,[reg+0x34] ; Save R13 1054" move.d $r13,[cris_reg+0x34] ; Save R13\n"
1393 move.d $sp,[reg+0x38] ; Save SP (R14) 1055" move.d $sp,[cris_reg+0x38] ; Save SP (R14)\n"
1394 move $irp,[reg+0x3c] ; Save the address in PC (R15) 1056" move $irp,[cris_reg+0x3c] ; Save the address in PC (R15)\n"
1395 clear.b [reg+0x40] ; Clear P0 1057" clear.b [cris_reg+0x40] ; Clear P0\n"
1396 move $vr,[reg+0x41] ; Save special register P1, 1058" move $vr,[cris_reg+0x41] ; Save special register P1,\n"
1397 clear.w [reg+0x42] ; Clear P4 1059" clear.w [cris_reg+0x42] ; Clear P4\n"
1398 move $ccr,[reg+0x44] ; Save special register CCR 1060" move $ccr,[cris_reg+0x44] ; Save special register CCR\n"
1399 move $mof,[reg+0x46] ; P7 1061" move $mof,[cris_reg+0x46] ; P7\n"
1400 clear.d [reg+0x4A] ; Clear P8 1062" clear.d [cris_reg+0x4A] ; Clear P8\n"
1401 move $ibr,[reg+0x4E] ; P9, 1063" move $ibr,[cris_reg+0x4E] ; P9,\n"
1402 move $irp,[reg+0x52] ; P10, 1064" move $irp,[cris_reg+0x52] ; P10,\n"
1403 move $srp,[reg+0x56] ; P11, 1065" move $srp,[cris_reg+0x56] ; P11,\n"
1404 move $dtp0,[reg+0x5A] ; P12, register BAR, assembler might not know BAR 1066" move $dtp0,[cris_reg+0x5A] ; P12, register BAR, assembler might not know BAR\n"
1405 ; P13, register DCCR already saved 1067" ; P13, register DCCR already saved\n"
1406;; Due to the old assembler-versions BRP might not be recognized 1068";; Due to the old assembler-versions BRP might not be recognized\n"
1407 .word 0xE670 ; move brp,r0 1069" .word 0xE670 ; move brp,r0\n"
1408 move.d $r0,[reg+0x62] ; Save the return address in BRP 1070" move.d $r0,[cris_reg+0x62] ; Save the return address in BRP\n"
1409 move $usp,[reg+0x66] ; USP 1071" move $usp,[cris_reg+0x66] ; USP\n"
1410 1072"\n"
1411;; get the serial character (from debugport.c) and check if it is a ctrl-c 1073";; get the serial character (from debugport.c) and check if it is a ctrl-c\n"
1412 1074"\n"
1413 jsr getDebugChar 1075" jsr getDebugChar\n"
1414 cmp.b 3, $r10 1076" cmp.b 3, $r10\n"
1415 bne goback 1077" bne goback\n"
1416 nop 1078" nop\n"
1417 1079"\n"
1418 move.d [reg+0x5E], $r10 ; Get DCCR 1080" move.d [cris_reg+0x5E], $r10 ; Get DCCR\n"
1419 btstq 8, $r10 ; Test the U-flag. 1081" btstq 8, $r10 ; Test the U-flag.\n"
1420 bmi goback 1082" bmi goback\n"
1421 nop 1083" nop\n"
1422 1084"\n"
1423;; 1085";;\n"
1424;; Handle the communication 1086";; Handle the communication\n"
1425;; 1087";;\n"
1426 move.d internal_stack+1020,$sp ; Use the internal stack 1088" move.d internal_stack+1020,$sp ; Use the internal stack\n"
1427 moveq 2,$r10 ; SIGINT 1089" moveq 2,$r10 ; SIGINT\n"
1428 jsr handle_exception ; Interactive routine 1090" jsr handle_exception ; Interactive routine\n"
1429 1091"\n"
1430goback: 1092"goback:\n"
1431;; 1093";;\n"
1432;; Return to the caller 1094";; Return to the caller\n"
1433;; 1095";;\n"
1434 move.d [reg],$r0 ; Restore R0 1096" move.d [cris_reg],$r0 ; Restore R0\n"
1435 move.d [reg+0x04],$r1 ; Restore R1 1097" move.d [cris_reg+0x04],$r1 ; Restore R1\n"
1436 move.d [reg+0x08],$r2 ; Restore R2 1098" move.d [cris_reg+0x08],$r2 ; Restore R2\n"
1437 move.d [reg+0x0C],$r3 ; Restore R3 1099" move.d [cris_reg+0x0C],$r3 ; Restore R3\n"
1438 move.d [reg+0x10],$r4 ; Restore R4 1100" move.d [cris_reg+0x10],$r4 ; Restore R4\n"
1439 move.d [reg+0x14],$r5 ; Restore R5 1101" move.d [cris_reg+0x14],$r5 ; Restore R5\n"
1440 move.d [reg+0x18],$r6 ; Restore R6 1102" move.d [cris_reg+0x18],$r6 ; Restore R6\n"
1441 move.d [reg+0x1C],$r7 ; Restore R7 1103" move.d [cris_reg+0x1C],$r7 ; Restore R7\n"
1442 move.d [reg+0x20],$r8 ; Restore R8 1104" move.d [cris_reg+0x20],$r8 ; Restore R8\n"
1443 move.d [reg+0x24],$r9 ; Restore R9 1105" move.d [cris_reg+0x24],$r9 ; Restore R9\n"
1444 move.d [reg+0x28],$r10 ; Restore R10 1106" move.d [cris_reg+0x28],$r10 ; Restore R10\n"
1445 move.d [reg+0x2C],$r11 ; Restore R11 1107" move.d [cris_reg+0x2C],$r11 ; Restore R11\n"
1446 move.d [reg+0x30],$r12 ; Restore R12 1108" move.d [cris_reg+0x30],$r12 ; Restore R12\n"
1447 move.d [reg+0x34],$r13 ; Restore R13 1109" move.d [cris_reg+0x34],$r13 ; Restore R13\n"
1448;; 1110";;\n"
1449;; FIXME: Which registers should be restored? 1111";; FIXME: Which registers should be restored?\n"
1450;; 1112";;\n"
1451 move.d [reg+0x38],$sp ; Restore SP (R14) 1113" move.d [cris_reg+0x38],$sp ; Restore SP (R14)\n"
1452 move [reg+0x56],$srp ; Restore the subroutine return pointer. 1114" move [cris_reg+0x56],$srp ; Restore the subroutine return pointer.\n"
1453 move [reg+0x5E],$dccr ; Restore DCCR 1115" move [cris_reg+0x5E],$dccr ; Restore DCCR\n"
1454 move [reg+0x66],$usp ; Restore USP 1116" move [cris_reg+0x66],$usp ; Restore USP\n"
1455 reti ; Return from the interrupt routine 1117" reti ; Return from the interrupt routine\n"
1456 nop 1118" nop\n"
1457"); 1119"\n");
1458 1120
1459/* Use this static breakpoint in the start-up only. */ 1121/* Use this static breakpoint in the start-up only. */
1460 1122
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index c55971a40c34..acff3df8c43f 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -617,7 +617,6 @@ config ETRAX_PV_CHANGEABLE_BITS
617config ETRAX_CARDBUS 617config ETRAX_CARDBUS
618 bool "Cardbus support" 618 bool "Cardbus support"
619 depends on ETRAX_ARCH_V32 619 depends on ETRAX_ARCH_V32
620 select HOTPLUG
621 help 620 help
622 Enabled the ETRAX Cardbus driver. 621 Enabled the ETRAX Cardbus driver.
623 622
@@ -641,8 +640,6 @@ config ETRAX_STREAMCOPROC
641 This option enables a driver for the stream co-processor 640 This option enables a driver for the stream co-processor
642 for cryptographic operations. 641 for cryptographic operations.
643 642
644source drivers/mmc/Kconfig
645
646config ETRAX_MMC_IOP 643config ETRAX_MMC_IOP
647 tristate "MMC/SD host driver using IO-processor" 644 tristate "MMC/SD host driver using IO-processor"
648 depends on ETRAX_ARCH_V32 && MMC 645 depends on ETRAX_ARCH_V32 && MMC
@@ -834,9 +831,4 @@ config ETRAX_SPI_MMC_WP_GPIO_PIN
834 The pin to use for the SD/MMC write-protect signal for a memory 831 The pin to use for the SD/MMC write-protect signal for a memory
835 card. If defined as " " (space), the card is considered writable. 832 card. If defined as " " (space), the card is considered writable.
836 833
837# Avoid choices causing non-working configs by conditionalizing the inclusion.
838if ETRAX_SPI_MMC
839source drivers/spi/Kconfig
840endif
841
842endif 834endif
diff --git a/arch/cris/include/arch-v10/arch/bitops.h b/arch/cris/include/arch-v10/arch/bitops.h
index be85f6de25d3..03d9cfd92c8a 100644
--- a/arch/cris/include/arch-v10/arch/bitops.h
+++ b/arch/cris/include/arch-v10/arch/bitops.h
@@ -17,7 +17,7 @@ static inline unsigned long cris_swapnwbrlz(unsigned long w)
17 in another register: 17 in another register:
18 ! __asm__ ("swapnwbr %2\n\tlz %2,%0" 18 ! __asm__ ("swapnwbr %2\n\tlz %2,%0"
19 ! : "=r,r" (res), "=r,X" (dummy) : "1,0" (w)); 19 ! : "=r,r" (res), "=r,X" (dummy) : "1,0" (w));
20 confuses gcc (sched.c, gcc from cris-dist-1.14). */ 20 confuses gcc (core.c, gcc from cris-dist-1.14). */
21 21
22 unsigned long res; 22 unsigned long res;
23 __asm__ ("swapnwbr %0 \n\t" 23 __asm__ ("swapnwbr %0 \n\t"
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index f1e79edc9dd2..c8325455520e 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -5,5 +5,9 @@ header-y += arch-v32/
5 5
6generic-y += clkdev.h 6generic-y += clkdev.h
7generic-y += exec.h 7generic-y += exec.h
8generic-y += kvm_para.h
9generic-y += linkage.h
8generic-y += module.h 10generic-y += module.h
9generic-y += trace_clock.h 11generic-y += trace_clock.h
12generic-y += vga.h
13generic-y += xor.h
diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h
index ac12ae2b9286..5d3047e5563b 100644
--- a/arch/cris/include/asm/io.h
+++ b/arch/cris/include/asm/io.h
@@ -167,6 +167,9 @@ static inline void outsl(unsigned int port, const void *addr,
167 cris_iops->write_io(port, (void *)addr, 4, count); 167 cris_iops->write_io(port, (void *)addr, 4, count);
168} 168}
169 169
170#define inb_p(port) inb(port)
171#define outb_p(val, port) outb((val), (port))
172
170/* 173/*
171 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 174 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
172 * access 175 * access
diff --git a/arch/cris/include/asm/linkage.h b/arch/cris/include/asm/linkage.h
deleted file mode 100644
index 291c2d01c44f..000000000000
--- a/arch/cris/include/asm/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif
diff --git a/arch/cris/include/asm/page.h b/arch/cris/include/asm/page.h
index be45ee366be9..dfc53f9b88ec 100644
--- a/arch/cris/include/asm/page.h
+++ b/arch/cris/include/asm/page.h
@@ -51,7 +51,6 @@ typedef struct page *pgtable_t;
51 */ 51 */
52 52
53#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT)) 53#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT))
54#define VALID_PAGE(page) (((page) - mem_map) < max_mapnr)
55#define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT) 54#define virt_addr_valid(kaddr) pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT)
56 55
57/* convert a page (based on mem_map and forward) to a physical address 56/* convert a page (based on mem_map and forward) to a physical address
diff --git a/arch/cris/include/asm/pgtable.h b/arch/cris/include/asm/pgtable.h
index 7df430138355..8b8c86793225 100644
--- a/arch/cris/include/asm/pgtable.h
+++ b/arch/cris/include/asm/pgtable.h
@@ -258,9 +258,6 @@ static inline pgd_t * pgd_offset(const struct mm_struct *mm, unsigned long addre
258#define pgd_ERROR(e) \ 258#define pgd_ERROR(e) \
259 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e)) 259 printk("%s:%d: bad pgd %p(%08lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
260 260
261#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
262 remap_pfn_range(vma, vaddr, pfn, size, prot)
263
264 261
265extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */ 262extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */
266 263
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 9ac80946dada..c81af5bd9167 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -19,9 +19,6 @@ unsigned long empty_zero_page;
19void __init 19void __init
20mem_init(void) 20mem_init(void)
21{ 21{
22 int codesize, reservedpages, datasize, initsize;
23 unsigned long tmp;
24
25 BUG_ON(!mem_map); 22 BUG_ON(!mem_map);
26 23
27 /* max/min_low_pfn was set by setup.c 24 /* max/min_low_pfn was set by setup.c
@@ -29,35 +26,9 @@ mem_init(void)
29 * 26 *
30 * high_memory was also set in setup.c 27 * high_memory was also set in setup.c
31 */ 28 */
32 29 max_mapnr = max_low_pfn - min_low_pfn;
33 max_mapnr = num_physpages = max_low_pfn - min_low_pfn; 30 free_all_bootmem();
34 31 mem_init_print_info(NULL);
35 /* this will put all memory onto the freelists */
36 totalram_pages = free_all_bootmem();
37
38 reservedpages = 0;
39 for (tmp = 0; tmp < max_mapnr; tmp++) {
40 /*
41 * Only count reserved RAM pages
42 */
43 if (PageReserved(mem_map + tmp))
44 reservedpages++;
45 }
46
47 codesize = (unsigned long) &_etext - (unsigned long) &_stext;
48 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
49 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
50
51 printk(KERN_INFO
52 "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
53 "%dk init)\n" ,
54 nr_free_pages() << (PAGE_SHIFT-10),
55 max_mapnr << (PAGE_SHIFT-10),
56 codesize >> 10,
57 reservedpages << (PAGE_SHIFT-10),
58 datasize >> 10,
59 initsize >> 10
60 );
61} 32}
62 33
63/* free the pages occupied by initialization code */ 34/* free the pages occupied by initialization code */
@@ -65,5 +36,5 @@ mem_init(void)
65void 36void
66free_initmem(void) 37free_initmem(void)
67{ 38{
68 free_initmem_default(0); 39 free_initmem_default(-1);
69} 40}
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 2ce731f9aa4d..4b6628ea381e 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -14,6 +14,7 @@ config FRV
14 select ARCH_WANT_IPC_PARSE_VERSION 14 select ARCH_WANT_IPC_PARSE_VERSION
15 select OLD_SIGSUSPEND3 15 select OLD_SIGSUSPEND3
16 select OLD_SIGACTION 16 select OLD_SIGACTION
17 select HAVE_DEBUG_STACKOVERFLOW
17 18
18config ZONE_DMA 19config ZONE_DMA
19 bool 20 bool
diff --git a/arch/frv/Kconfig.debug b/arch/frv/Kconfig.debug
index 211f01bc4caa..98c99a3ed2be 100644
--- a/arch/frv/Kconfig.debug
+++ b/arch/frv/Kconfig.debug
@@ -2,10 +2,6 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL
8
9config GDBSTUB 5config GDBSTUB
10 bool "Remote GDB kernel debugging" 6 bool "Remote GDB kernel debugging"
11 depends on DEBUG_KERNEL 7 depends on DEBUG_KERNEL
diff --git a/arch/frv/include/asm/pgtable.h b/arch/frv/include/asm/pgtable.h
index 6bc241e4b4f8..eb0110acd19b 100644
--- a/arch/frv/include/asm/pgtable.h
+++ b/arch/frv/include/asm/pgtable.h
@@ -488,9 +488,6 @@ static inline int pte_file(pte_t pte)
488#define PageSkip(page) (0) 488#define PageSkip(page) (0)
489#define kern_addr_valid(addr) (1) 489#define kern_addr_valid(addr) (1)
490 490
491#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
492 remap_pfn_range(vma, vaddr, pfn, size, prot)
493
494#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 491#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
495#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 492#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
496#define __HAVE_ARCH_PTEP_SET_WRPROTECT 493#define __HAVE_ARCH_PTEP_SET_WRPROTECT
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h
index 0b67ec5b4414..3ac9a59d65d4 100644
--- a/arch/frv/include/asm/uaccess.h
+++ b/arch/frv/include/asm/uaccess.h
@@ -280,14 +280,14 @@ extern long __memcpy_user(void *dst, const void *src, unsigned long count);
280static inline unsigned long __must_check 280static inline unsigned long __must_check
281__copy_to_user(void __user *to, const void *from, unsigned long n) 281__copy_to_user(void __user *to, const void *from, unsigned long n)
282{ 282{
283 might_sleep(); 283 might_fault();
284 return __copy_to_user_inatomic(to, from, n); 284 return __copy_to_user_inatomic(to, from, n);
285} 285}
286 286
287static inline unsigned long 287static inline unsigned long
288__copy_from_user(void *to, const void __user *from, unsigned long n) 288__copy_from_user(void *to, const void __user *from, unsigned long n)
289{ 289{
290 might_sleep(); 290 might_fault();
291 return __copy_from_user_inatomic(to, from, n); 291 return __copy_from_user_inatomic(to, from, n);
292} 292}
293 293
diff --git a/arch/frv/kernel/head.S b/arch/frv/kernel/head.S
index e9a8cc63ac94..a7d0bea9c036 100644
--- a/arch/frv/kernel/head.S
+++ b/arch/frv/kernel/head.S
@@ -479,11 +479,6 @@ __head_mmu_enabled:
479 479
480 LEDS 0x000c 480 LEDS 0x000c
481 481
482 # initialise the processor and the peripherals
483 #call SYMBOL_NAME(processor_init)
484 #call SYMBOL_NAME(unit_init)
485 #LEDS 0x0aff
486
487 sethi.p #0xe5e5,gr3 482 sethi.p #0xe5e5,gr3
488 setlo #0xe5e5,gr3 483 setlo #0xe5e5,gr3
489 or.p gr3,gr0,gr4 484 or.p gr3,gr0,gr4
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 0b579927439d..ac767d94a880 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -150,7 +150,7 @@ static int user_atoi(char __user *ubuf, size_t len)
150/* 150/*
151 * Send us to sleep. 151 * Send us to sleep.
152 */ 152 */
153static int sysctl_pm_do_suspend(ctl_table *ctl, int write, 153static int sysctl_pm_do_suspend(struct ctl_table *ctl, int write,
154 void __user *buffer, size_t *lenp, loff_t *fpos) 154 void __user *buffer, size_t *lenp, loff_t *fpos)
155{ 155{
156 int mode; 156 int mode;
@@ -197,7 +197,7 @@ static int try_set_cmode(int new_cmode)
197} 197}
198 198
199 199
200static int cmode_procctl(ctl_table *ctl, int write, 200static int cmode_procctl(struct ctl_table *ctl, int write,
201 void __user *buffer, size_t *lenp, loff_t *fpos) 201 void __user *buffer, size_t *lenp, loff_t *fpos)
202{ 202{
203 int new_cmode; 203 int new_cmode;
@@ -269,7 +269,7 @@ static int try_set_cm(int new_cm)
269 return 0; 269 return 0;
270} 270}
271 271
272static int p0_procctl(ctl_table *ctl, int write, 272static int p0_procctl(struct ctl_table *ctl, int write,
273 void __user *buffer, size_t *lenp, loff_t *fpos) 273 void __user *buffer, size_t *lenp, loff_t *fpos)
274{ 274{
275 int new_p0; 275 int new_p0;
@@ -282,7 +282,7 @@ static int p0_procctl(ctl_table *ctl, int write,
282 return try_set_p0(new_p0)?:*lenp; 282 return try_set_p0(new_p0)?:*lenp;
283} 283}
284 284
285static int cm_procctl(ctl_table *ctl, int write, 285static int cm_procctl(struct ctl_table *ctl, int write,
286 void __user *buffer, size_t *lenp, loff_t *fpos) 286 void __user *buffer, size_t *lenp, loff_t *fpos)
287{ 287{
288 int new_cm; 288 int new_cm;
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index a5136474c6fd..ae3a6706419b 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -735,7 +735,7 @@ static void __init parse_cmdline_early(char *cmdline)
735 /* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked 735 /* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked
736 * out from the SDRAM controller mask register 736 * out from the SDRAM controller mask register
737 */ 737 */
738 if (!memcmp(cmdline, "mem=", 4)) { 738 if (!strncmp(cmdline, "mem=", 4)) {
739 unsigned long long mem_size; 739 unsigned long long mem_size;
740 740
741 mem_size = memparse(cmdline + 4, &cmdline); 741 mem_size = memparse(cmdline + 4, &cmdline);
@@ -876,6 +876,7 @@ late_initcall(setup_arch_serial);
876static void __init setup_linux_memory(void) 876static void __init setup_linux_memory(void)
877{ 877{
878 unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem; 878 unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem;
879 unsigned long physpages;
879 880
880 kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET; 881 kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET;
881 kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET; 882 kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET;
@@ -893,19 +894,19 @@ static void __init setup_linux_memory(void)
893 ); 894 );
894 895
895 /* pass the memory that the kernel can immediately use over to the bootmem allocator */ 896 /* pass the memory that the kernel can immediately use over to the bootmem allocator */
896 max_mapnr = num_physpages = (memory_end - memory_start) >> PAGE_SHIFT; 897 max_mapnr = physpages = (memory_end - memory_start) >> PAGE_SHIFT;
897 low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT; 898 low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT;
898 high_mem = 0; 899 high_mem = 0;
899 900
900 if (num_physpages > low_top_pfn) { 901 if (physpages > low_top_pfn) {
901#ifdef CONFIG_HIGHMEM 902#ifdef CONFIG_HIGHMEM
902 high_mem = num_physpages - low_top_pfn; 903 high_mem = physpages - low_top_pfn;
903#else 904#else
904 max_mapnr = num_physpages = low_top_pfn; 905 max_mapnr = physpages = low_top_pfn;
905#endif 906#endif
906 } 907 }
907 else { 908 else {
908 low_top_pfn = num_physpages; 909 low_top_pfn = physpages;
909 } 910 }
910 911
911 min_low_pfn = memory_start >> PAGE_SHIFT; 912 min_low_pfn = memory_start >> PAGE_SHIFT;
@@ -979,7 +980,7 @@ static void __init setup_uclinux_memory(void)
979 free_bootmem(memory_start, memory_end - memory_start); 980 free_bootmem(memory_start, memory_end - memory_start);
980 981
981 high_memory = (void *) (memory_end & PAGE_MASK); 982 high_memory = (void *) (memory_end & PAGE_MASK);
982 max_mapnr = num_physpages = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT; 983 max_mapnr = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
983 984
984 min_low_pfn = memory_start >> PAGE_SHIFT; 985 min_low_pfn = memory_start >> PAGE_SHIFT;
985 max_low_pfn = memory_end >> PAGE_SHIFT; 986 max_low_pfn = memory_end >> PAGE_SHIFT;
diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c
index 6c155d69da29..f4dfae2c75ad 100644
--- a/arch/frv/kernel/sysctl.c
+++ b/arch/frv/kernel/sysctl.c
@@ -46,7 +46,7 @@ static void frv_change_dcache_mode(unsigned long newmode)
46/* 46/*
47 * handle requests to dynamically switch the write caching mode delivered by /proc 47 * handle requests to dynamically switch the write caching mode delivered by /proc
48 */ 48 */
49static int procctl_frv_cachemode(ctl_table *table, int write, 49static int procctl_frv_cachemode(struct ctl_table *table, int write,
50 void __user *buffer, size_t *lenp, 50 void __user *buffer, size_t *lenp,
51 loff_t *ppos) 51 loff_t *ppos)
52{ 52{
@@ -121,7 +121,7 @@ static int procctl_frv_cachemode(ctl_table *table, int write,
121 * permit the mm_struct the nominated process is using have its MMU context ID pinned 121 * permit the mm_struct the nominated process is using have its MMU context ID pinned
122 */ 122 */
123#ifdef CONFIG_MMU 123#ifdef CONFIG_MMU
124static int procctl_frv_pin_cxnr(ctl_table *table, int write, 124static int procctl_frv_pin_cxnr(struct ctl_table *table, int write,
125 void __user *buffer, size_t *lenp, 125 void __user *buffer, size_t *lenp,
126 loff_t *ppos) 126 loff_t *ppos)
127{ 127{
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 4bff48c19d29..a6d105d61b26 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -523,7 +523,7 @@ void die_if_kernel(const char *str, ...)
523 return; 523 return;
524 524
525 va_start(va, str); 525 va_start(va, str);
526 vsprintf(buffer, str, va); 526 vsnprintf(buffer, sizeof(buffer), str, va);
527 va_end(va); 527 va_end(va);
528 528
529 console_verbose(); 529 console_verbose();
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index dee354fa6b64..88a159743528 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -78,7 +78,7 @@ void __init paging_init(void)
78 memset((void *) empty_zero_page, 0, PAGE_SIZE); 78 memset((void *) empty_zero_page, 0, PAGE_SIZE);
79 79
80#ifdef CONFIG_HIGHMEM 80#ifdef CONFIG_HIGHMEM
81 if (num_physpages - num_mappedpages) { 81 if (get_num_physpages() - num_mappedpages) {
82 pgd_t *pge; 82 pgd_t *pge;
83 pud_t *pue; 83 pud_t *pue;
84 pmd_t *pme; 84 pmd_t *pme;
@@ -96,7 +96,7 @@ void __init paging_init(void)
96 */ 96 */
97 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; 97 zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
98#ifdef CONFIG_HIGHMEM 98#ifdef CONFIG_HIGHMEM
99 zones_size[ZONE_HIGHMEM] = num_physpages - num_mappedpages; 99 zones_size[ZONE_HIGHMEM] = get_num_physpages() - num_mappedpages;
100#endif 100#endif
101 101
102 free_area_init(zones_size); 102 free_area_init(zones_size);
@@ -114,45 +114,24 @@ void __init paging_init(void)
114 */ 114 */
115void __init mem_init(void) 115void __init mem_init(void)
116{ 116{
117 unsigned long npages = (memory_end - memory_start) >> PAGE_SHIFT; 117 unsigned long code_size = _etext - _stext;
118 unsigned long tmp;
119#ifdef CONFIG_MMU
120 unsigned long loop, pfn;
121 int datapages = 0;
122#endif
123 int codek = 0, datak = 0;
124 118
125 /* this will put all low memory onto the freelists */ 119 /* this will put all low memory onto the freelists */
126 totalram_pages = free_all_bootmem(); 120 free_all_bootmem();
127 121#if defined(CONFIG_MMU) && defined(CONFIG_HIGHMEM)
128#ifdef CONFIG_MMU 122 {
129 for (loop = 0 ; loop < npages ; loop++) 123 unsigned long pfn;
130 if (PageReserved(&mem_map[loop])) 124
131 datapages++; 125 for (pfn = get_num_physpages() - 1;
132 126 pfn >= num_mappedpages; pfn--)
133#ifdef CONFIG_HIGHMEM 127 free_highmem_page(&mem_map[pfn]);
134 for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) 128 }
135 free_highmem_page(&mem_map[pfn]);
136#endif
137
138 codek = ((unsigned long) &_etext - (unsigned long) &_stext) >> 10;
139 datak = datapages << (PAGE_SHIFT - 10);
140
141#else
142 codek = (_etext - _stext) >> 10;
143 datak = 0; //(__bss_stop - _sdata) >> 10;
144#endif 129#endif
145 130
146 tmp = nr_free_pages() << PAGE_SHIFT; 131 mem_init_print_info(NULL);
147 printk("Memory available: %luKiB/%luKiB RAM, %luKiB/%luKiB ROM (%dKiB kernel code, %dKiB data)\n", 132 if (rom_length > 0 && rom_length >= code_size)
148 tmp >> 10, 133 printk("Memory available: %luKiB/%luKiB ROM\n",
149 npages << (PAGE_SHIFT - 10), 134 (rom_length - code_size) >> 10, rom_length >> 10);
150 (rom_length > 0) ? ((rom_length >> 10) - codek) : 0,
151 rom_length >> 10,
152 codek,
153 datak
154 );
155
156} /* end mem_init() */ 135} /* end mem_init() */
157 136
158/*****************************************************************************/ 137/*****************************************************************************/
@@ -162,7 +141,7 @@ void __init mem_init(void)
162void free_initmem(void) 141void free_initmem(void)
163{ 142{
164#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) 143#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
165 free_initmem_default(0); 144 free_initmem_default(-1);
166#endif 145#endif
167} /* end free_initmem() */ 146} /* end free_initmem() */
168 147
@@ -173,6 +152,6 @@ void free_initmem(void)
173#ifdef CONFIG_BLK_DEV_INITRD 152#ifdef CONFIG_BLK_DEV_INITRD
174void __init free_initrd_mem(unsigned long start, unsigned long end) 153void __init free_initrd_mem(unsigned long start, unsigned long end)
175{ 154{
176 free_reserved_area(start, end, 0, "initrd"); 155 free_reserved_area((void *)start, (void *)end, -1, "initrd");
177} /* end free_initrd_mem() */ 156} /* end free_initrd_mem() */
178#endif 157#endif
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 303e4f9a79d1..3d6759ee382f 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -94,126 +94,10 @@ endmenu
94 94
95source "net/Kconfig" 95source "net/Kconfig"
96 96
97source "drivers/base/Kconfig" 97source "drivers/Kconfig"
98
99source "drivers/mtd/Kconfig"
100
101source "drivers/block/Kconfig"
102
103source "drivers/ide/Kconfig"
104 98
105source "arch/h8300/Kconfig.ide" 99source "arch/h8300/Kconfig.ide"
106 100
107source "drivers/net/Kconfig"
108
109#
110# input - input/joystick depends on it. As does USB.
111#
112source "drivers/input/Kconfig"
113
114menu "Character devices"
115
116config VT
117 bool "Virtual terminal"
118 ---help---
119 If you say Y here, you will get support for terminal devices with
120 display and keyboard devices. These are called "virtual" because you
121 can run several virtual terminals (also called virtual consoles) on
122 one physical terminal. This is rather useful, for example one
123 virtual terminal can collect system messages and warnings, another
124 one can be used for a text-mode user session, and a third could run
125 an X session, all in parallel. Switching between virtual terminals
126 is done with certain key combinations, usually Alt-<function key>.
127
128 The setterm command ("man setterm") can be used to change the
129 properties (such as colors or beeping) of a virtual terminal. The
130 man page console_codes(4) ("man console_codes") contains the special
131 character sequences that can be used to change those properties
132 directly. The fonts used on virtual terminals can be changed with
133 the setfont ("man setfont") command and the key bindings are defined
134 with the loadkeys ("man loadkeys") command.
135
136 You need at least one virtual terminal device in order to make use
137 of your keyboard and monitor. Therefore, only people configuring an
138 embedded system would want to say N here in order to save some
139 memory; the only way to log into such a system is then via a serial
140 or network connection.
141
142 If unsure, say Y, or else you won't be able to do much with your new
143 shiny Linux system :-)
144
145config VT_CONSOLE
146 bool "Support for console on virtual terminal"
147 depends on VT
148 ---help---
149 The system console is the device which receives all kernel messages
150 and warnings and which allows logins in single user mode. If you
151 answer Y here, a virtual terminal (the device used to interact with
152 a physical terminal) can be used as system console. This is the most
153 common mode of operations, so you should say Y here unless you want
154 the kernel messages be output only to a serial port (in which case
155 you should say Y to "Console on serial port", below).
156
157 If you do say Y here, by default the currently visible virtual
158 terminal (/dev/tty0) will be used as system console. You can change
159 that with a kernel command line option such as "console=tty3" which
160 would use the third virtual terminal as system console. (Try "man
161 bootparam" or see the documentation of your boot loader (lilo or
162 loadlin) about how to pass options to the kernel at boot time.)
163
164 If unsure, say Y.
165
166config HW_CONSOLE
167 bool
168 depends on VT
169 default y
170
171comment "Unix98 PTY support"
172
173config UNIX98_PTYS
174 bool "Unix98 PTY support"
175 ---help---
176 A pseudo terminal (PTY) is a software device consisting of two
177 halves: a master and a slave. The slave device behaves identical to
178 a physical terminal; the master device is used by a process to
179 read data from and write data to the slave, thereby emulating a
180 terminal. Typical programs for the master side are telnet servers
181 and xterms.
182
183 Linux has traditionally used the BSD-like names /dev/ptyxx for
184 masters and /dev/ttyxx for slaves of pseudo terminals. This scheme
185 has a number of problems. The GNU C library glibc 2.1 and later,
186 however, supports the Unix98 naming standard: in order to acquire a
187 pseudo terminal, a process opens /dev/ptmx; the number of the pseudo
188 terminal is then made available to the process and the pseudo
189 terminal slave can be accessed as /dev/pts/<number>. What was
190 traditionally /dev/ttyp2 will then be /dev/pts/2, for example.
191
192 The entries in /dev/pts/ are created on the fly by a virtual
193 file system; therefore, if you say Y here you should say Y to
194 "/dev/pts file system for Unix98 PTYs" as well.
195
196 If you want to say Y here, you need to have the C library glibc 2.1
197 or later (equal to libc-6.1, check with "ls -l /lib/libc.so.*").
198 Read the instructions in <file:Documentation/Changes> pertaining to
199 pseudo terminals. It's safe to say N.
200
201source "drivers/char/pcmcia/Kconfig"
202
203source "drivers/tty/serial/Kconfig"
204
205source "drivers/i2c/Kconfig"
206
207source "drivers/hwmon/Kconfig"
208
209source "drivers/usb/Kconfig"
210
211source "drivers/uwb/Kconfig"
212
213endmenu
214
215source "drivers/staging/Kconfig"
216
217source "fs/Kconfig" 101source "fs/Kconfig"
218 102
219source "arch/h8300/Kconfig.debug" 103source "arch/h8300/Kconfig.debug"
diff --git a/arch/h8300/Kconfig.cpu b/arch/h8300/Kconfig.cpu
index 321f3922728b..cdee771460ed 100644
--- a/arch/h8300/Kconfig.cpu
+++ b/arch/h8300/Kconfig.cpu
@@ -64,6 +64,7 @@ choice
64 64
65config H83002 65config H83002
66 bool "H8/3001,3002,3003" 66 bool "H8/3001,3002,3003"
67 depends on BROKEN
67 select CPU_H8300H 68 select CPU_H8300H
68 69
69config H83007 70config H83007
@@ -72,6 +73,7 @@ config H83007
72 73
73config H83048 74config H83048
74 bool "H8/3044,3045,3046,3047,3048,3052" 75 bool "H8/3044,3045,3046,3047,3048,3052"
76 depends on BROKEN
75 select CPU_H8300H 77 select CPU_H8300H
76 78
77config H83068 79config H83068
@@ -155,10 +157,12 @@ config H8300_TIMER16_CH
155config H8300_ITU_CH 157config H8300_ITU_CH
156 int "ITU channel" 158 int "ITU channel"
157 depends on H8300_ITU 159 depends on H8300_ITU
160 range 0 4
158 161
159config H8300_TPU_CH 162config H8300_TPU_CH
160 int "TPU channel" 163 int "TPU channel"
161 depends on H8300_TPU 164 depends on H8300_TPU
165 range 0 4
162 166
163source "kernel/Kconfig.preempt" 167source "kernel/Kconfig.preempt"
164 168
diff --git a/arch/h8300/boot/compressed/Makefile b/arch/h8300/boot/compressed/Makefile
index 6745cb1ffb4f..a6c98fe3bbc3 100644
--- a/arch/h8300/boot/compressed/Makefile
+++ b/arch/h8300/boot/compressed/Makefile
@@ -16,7 +16,7 @@ OBJECTS = $(obj)/head.o $(obj)/misc.o
16# 16#
17CONFIG_MEMORY_START ?= 0x00400000 17CONFIG_MEMORY_START ?= 0x00400000
18CONFIG_BOOT_LINK_OFFSET ?= 0x00140000 18CONFIG_BOOT_LINK_OFFSET ?= 0x00140000
19IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET)]) 19IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET))))
20 20
21LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup $(obj)/vmlinux.lds 21LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup $(obj)/vmlinux.lds
22 22
diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c
index 51ab6cbd030f..4a1e3dd43948 100644
--- a/arch/h8300/boot/compressed/misc.c
+++ b/arch/h8300/boot/compressed/misc.c
@@ -79,7 +79,6 @@ static void error(char *m);
79 79
80int puts(const char *); 80int puts(const char *);
81 81
82extern int _text; /* Defined in vmlinux.lds.S */
83extern int _end; 82extern int _end;
84static unsigned long free_mem_ptr; 83static unsigned long free_mem_ptr;
85static unsigned long free_mem_end_ptr; 84static unsigned long free_mem_end_ptr;
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 995eb47e01bb..8ada3cf0c98d 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -1,6 +1,8 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += linkage.h
4generic-y += mmu.h 5generic-y += mmu.h
5generic-y += module.h 6generic-y += module.h
6generic-y += trace_clock.h 7generic-y += trace_clock.h
8generic-y += xor.h
diff --git a/arch/h8300/include/asm/barrier.h b/arch/h8300/include/asm/barrier.h
index c7283c343c55..9e0aa9fc195d 100644
--- a/arch/h8300/include/asm/barrier.h
+++ b/arch/h8300/include/asm/barrier.h
@@ -12,6 +12,8 @@
12#define wmb() asm volatile ("" : : :"memory") 12#define wmb() asm volatile ("" : : :"memory")
13#define set_mb(var, value) do { xchg(&var, value); } while (0) 13#define set_mb(var, value) do { xchg(&var, value); } while (0)
14 14
15#define read_barrier_depends() do { } while (0)
16
15#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
16#define smp_mb() mb() 18#define smp_mb() mb()
17#define smp_rmb() rmb() 19#define smp_rmb() rmb()
diff --git a/arch/h8300/include/asm/linkage.h b/arch/h8300/include/asm/linkage.h
deleted file mode 100644
index 1d81604fb0ad..000000000000
--- a/arch/h8300/include/asm/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _H8300_LINKAGE_H
2#define _H8300_LINKAGE_H
3
4#undef SYMBOL_NAME_LABEL
5#define SYMBOL_NAME_LABEL(_name_) _##_name_##:
6#endif
diff --git a/arch/h8300/include/asm/pgtable.h b/arch/h8300/include/asm/pgtable.h
index 62ef17676b40..7ca20f894dd7 100644
--- a/arch/h8300/include/asm/pgtable.h
+++ b/arch/h8300/include/asm/pgtable.h
@@ -52,9 +52,6 @@ extern int is_in_rom(unsigned long);
52 */ 52 */
53#define pgtable_cache_init() do { } while (0) 53#define pgtable_cache_init() do { } while (0)
54 54
55#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
56 remap_pfn_range(vma, vaddr, pfn, size, prot)
57
58/* 55/*
59 * All 32bit addresses are effectively valid for vmalloc... 56 * All 32bit addresses are effectively valid for vmalloc...
60 * Sort of meaningless for non-VM targets. 57 * Sort of meaningless for non-VM targets.
diff --git a/arch/h8300/include/asm/tlb.h b/arch/h8300/include/asm/tlb.h
index 3dea80ad9e6f..7f0743051ad5 100644
--- a/arch/h8300/include/asm/tlb.h
+++ b/arch/h8300/include/asm/tlb.h
@@ -1,16 +1,3 @@
1/*
2 include/asm-h8300/tlb.h
3*/
4
5#ifndef __H8300_TLB_H__
6#define __H8300_TLB_H__
7
8#define tlb_flush(tlb) do { } while(0)
9
10/*
11 include/asm-h8300/tlb.h
12*/
13
14#ifndef __H8300_TLB_H__ 1#ifndef __H8300_TLB_H__
15#define __H8300_TLB_H__ 2#define __H8300_TLB_H__
16 3
@@ -19,5 +6,3 @@
19#include <asm-generic/tlb.h> 6#include <asm-generic/tlb.h>
20 7
21#endif 8#endif
22
23#endif
diff --git a/arch/h8300/kernel/entry.S b/arch/h8300/kernel/entry.S
index 617a6878787f..94bd30f11df6 100644
--- a/arch/h8300/kernel/entry.S
+++ b/arch/h8300/kernel/entry.S
@@ -87,13 +87,13 @@ INTERRUPTS = 128
87 bne 5f 87 bne 5f
88 88
89 /* user mode */ 89 /* user mode */
90 mov.l sp,@SYMBOL_NAME(sw_usp) 90 mov.l sp,@_sw_usp
91 mov.l @sp,er0 /* restore saved er0 */ 91 mov.l @sp,er0 /* restore saved er0 */
92 orc #0x10,ccr /* switch kernel stack */ 92 orc #0x10,ccr /* switch kernel stack */
93 mov.l @SYMBOL_NAME(sw_ksp),sp 93 mov.l @_sw_ksp,sp
94 sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ 94 sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */
95 SAVEREGS 95 SAVEREGS
96 mov.l @SYMBOL_NAME(sw_usp),er0 96 mov.l @_sw_usp,er0
97 mov.l @(USERRET:16,er0),er1 /* copy the RET addr */ 97 mov.l @(USERRET:16,er0),er1 /* copy the RET addr */
98 mov.l er1,@(LRET-LER3:16,sp) 98 mov.l er1,@(LRET-LER3:16,sp)
99 SAVEEXR 99 SAVEEXR
@@ -128,7 +128,7 @@ INTERRUPTS = 128
128 bne 7f 128 bne 7f
129 129
130 orc #0x80,ccr 130 orc #0x80,ccr
131 mov.l @SYMBOL_NAME(sw_usp),er0 131 mov.l @_sw_usp,er0
132 mov.l @(LER0-LER1:16,sp),er1 /* restore ER0 */ 132 mov.l @(LER0-LER1:16,sp),er1 /* restore ER0 */
133 mov.l er1,@er0 133 mov.l er1,@er0
134 RESTOREEXR 134 RESTOREEXR
@@ -141,7 +141,7 @@ INTERRUPTS = 128
141 141
142 mov.l @sp+,er1 142 mov.l @sp+,er1
143 add.l #(LRET-LER1),sp /* remove LORIG - LRET */ 143 add.l #(LRET-LER1),sp /* remove LORIG - LRET */
144 mov.l sp,@SYMBOL_NAME(sw_ksp) 144 mov.l sp,@_sw_ksp
145 andc #0xef,ccr /* switch to user mode */ 145 andc #0xef,ccr /* switch to user mode */
146 mov.l er0,sp 146 mov.l er0,sp
147 bra 8f 147 bra 8f
@@ -155,20 +155,20 @@ INTERRUPTS = 128
155 rte 155 rte
156 .endm 156 .endm
157 157
158.globl SYMBOL_NAME(system_call) 158.globl _system_call
159.globl SYMBOL_NAME(ret_from_exception) 159.globl _ret_from_exception
160.globl SYMBOL_NAME(ret_from_fork) 160.globl _ret_from_fork
161.globl SYMBOL_NAME(ret_from_kernel_thread) 161.globl _ret_from_kernel_thread
162.globl SYMBOL_NAME(ret_from_interrupt) 162.globl _ret_from_interrupt
163.globl SYMBOL_NAME(interrupt_redirect_table) 163.globl _interrupt_redirect_table
164.globl SYMBOL_NAME(sw_ksp),SYMBOL_NAME(sw_usp) 164.globl _sw_ksp,_sw_usp
165.globl SYMBOL_NAME(resume) 165.globl _resume
166.globl SYMBOL_NAME(interrupt_entry) 166.globl _interrupt_entry
167.globl SYMBOL_NAME(trace_break) 167.globl _trace_break
168 168
169#if defined(CONFIG_ROMKERNEL) 169#if defined(CONFIG_ROMKERNEL)
170 .section .int_redirect,"ax" 170 .section .int_redirect,"ax"
171SYMBOL_NAME_LABEL(interrupt_redirect_table) 171_interrupt_redirect_table:
172#if defined(CONFIG_CPU_H8300H) 172#if defined(CONFIG_CPU_H8300H)
173 .rept 7 173 .rept 7
174 .long 0 174 .long 0
@@ -178,54 +178,54 @@ SYMBOL_NAME_LABEL(interrupt_redirect_table)
178 .rept 5 178 .rept 5
179 .long 0 179 .long 0
180 .endr 180 .endr
181 jmp @SYMBOL_NAME(trace_break) 181 jmp @_trace_break
182 .long 0 182 .long 0
183#endif 183#endif
184 184
185 jsr @SYMBOL_NAME(interrupt_entry) /* NMI */ 185 jsr @_interrupt_entry /* NMI */
186 jmp @SYMBOL_NAME(system_call) /* TRAPA #0 (System call) */ 186 jmp @_system_call /* TRAPA #0 (System call) */
187 .long 0 187 .long 0
188 .long 0 188 .long 0
189 jmp @SYMBOL_NAME(trace_break) /* TRAPA #3 (breakpoint) */ 189 jmp @_trace_break /* TRAPA #3 (breakpoint) */
190 .rept INTERRUPTS-12 190 .rept INTERRUPTS-12
191 jsr @SYMBOL_NAME(interrupt_entry) 191 jsr @_interrupt_entry
192 .endr 192 .endr
193#endif 193#endif
194#if defined(CONFIG_RAMKERNEL) 194#if defined(CONFIG_RAMKERNEL)
195.globl SYMBOL_NAME(interrupt_redirect_table) 195.globl _interrupt_redirect_table
196 .section .bss 196 .section .bss
197SYMBOL_NAME_LABEL(interrupt_redirect_table) 197_interrupt_redirect_table:
198 .space 4 198 .space 4
199#endif 199#endif
200 200
201 .section .text 201 .section .text
202 .align 2 202 .align 2
203SYMBOL_NAME_LABEL(interrupt_entry) 203_interrupt_entry:
204 SAVE_ALL 204 SAVE_ALL
205 mov.l sp,er0 205 mov.l sp,er0
206 add.l #LVEC,er0 206 add.l #LVEC,er0
207 btst #4,r1l 207 btst #4,r1l
208 bne 1f 208 bne 1f
209 /* user LVEC */ 209 /* user LVEC */
210 mov.l @SYMBOL_NAME(sw_usp),er0 210 mov.l @_sw_usp,er0
211 adds #4,er0 211 adds #4,er0
2121: 2121:
213 mov.l @er0,er0 /* LVEC address */ 213 mov.l @er0,er0 /* LVEC address */
214#if defined(CONFIG_ROMKERNEL) 214#if defined(CONFIG_ROMKERNEL)
215 sub.l #SYMBOL_NAME(interrupt_redirect_table),er0 215 sub.l #_interrupt_redirect_table,er0
216#endif 216#endif
217#if defined(CONFIG_RAMKERNEL) 217#if defined(CONFIG_RAMKERNEL)
218 mov.l @SYMBOL_NAME(interrupt_redirect_table),er1 218 mov.l @_interrupt_redirect_table,er1
219 sub.l er1,er0 219 sub.l er1,er0
220#endif 220#endif
221 SHLR2 er0 221 SHLR2 er0
222 dec.l #1,er0 222 dec.l #1,er0
223 mov.l sp,er1 223 mov.l sp,er1
224 subs #4,er1 /* adjust ret_pc */ 224 subs #4,er1 /* adjust ret_pc */
225 jsr @SYMBOL_NAME(do_IRQ) 225 jsr @_do_IRQ
226 jmp @SYMBOL_NAME(ret_from_interrupt) 226 jmp @_ret_from_interrupt
227 227
228SYMBOL_NAME_LABEL(system_call) 228_system_call:
229 subs #4,sp /* dummy LVEC */ 229 subs #4,sp /* dummy LVEC */
230 SAVE_ALL 230 SAVE_ALL
231 andc #0x7f,ccr 231 andc #0x7f,ccr
@@ -233,21 +233,21 @@ SYMBOL_NAME_LABEL(system_call)
233 233
234 /* save top of frame */ 234 /* save top of frame */
235 mov.l sp,er0 235 mov.l sp,er0
236 jsr @SYMBOL_NAME(set_esp0) 236 jsr @_set_esp0
237 mov.l sp,er2 237 mov.l sp,er2
238 and.w #0xe000,r2 238 and.w #0xe000,r2
239 mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l 239 mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l
240 btst #(TIF_SYSCALL_TRACE & 7),r2l 240 btst #(TIF_SYSCALL_TRACE & 7),r2l
241 beq 1f 241 beq 1f
242 jsr @SYMBOL_NAME(do_syscall_trace) 242 jsr @_do_syscall_trace
2431: 2431:
244 cmp.l #NR_syscalls,er4 244 cmp.l #NR_syscalls,er4
245 bcc badsys 245 bcc badsys
246 SHLL2 er4 246 SHLL2 er4
247 mov.l #SYMBOL_NAME(sys_call_table),er0 247 mov.l #_sys_call_table,er0
248 add.l er4,er0 248 add.l er4,er0
249 mov.l @er0,er4 249 mov.l @er0,er4
250 beq SYMBOL_NAME(ret_from_exception):16 250 beq _ret_from_exception:16
251 mov.l @(LER1:16,sp),er0 251 mov.l @(LER1:16,sp),er0
252 mov.l @(LER2:16,sp),er1 252 mov.l @(LER2:16,sp),er1
253 mov.l @(LER3:16,sp),er2 253 mov.l @(LER3:16,sp),er2
@@ -258,10 +258,10 @@ SYMBOL_NAME_LABEL(system_call)
258 mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l 258 mov.b @((TI_FLAGS+3-(TIF_SYSCALL_TRACE >> 3)):16,er2),r2l
259 btst #(TIF_SYSCALL_TRACE & 7),r2l 259 btst #(TIF_SYSCALL_TRACE & 7),r2l
260 beq 2f 260 beq 2f
261 jsr @SYMBOL_NAME(do_syscall_trace) 261 jsr @_do_syscall_trace
2622: 2622:
263#if defined(CONFIG_SYSCALL_PRINT) 263#if defined(CONFIG_SYSCALL_PRINT)
264 jsr @SYMBOL_NAME(syscall_print) 264 jsr @_syscall_print
265#endif 265#endif
266 orc #0x80,ccr 266 orc #0x80,ccr
267 bra resume_userspace 267 bra resume_userspace
@@ -275,11 +275,11 @@ badsys:
275#define resume_kernel restore_all 275#define resume_kernel restore_all
276#endif 276#endif
277 277
278SYMBOL_NAME_LABEL(ret_from_exception) 278_ret_from_exception:
279#if defined(CONFIG_PREEMPT) 279#if defined(CONFIG_PREEMPT)
280 orc #0x80,ccr 280 orc #0x80,ccr
281#endif 281#endif
282SYMBOL_NAME_LABEL(ret_from_interrupt) 282_ret_from_interrupt:
283 mov.b @(LCCR+1:16,sp),r0l 283 mov.b @(LCCR+1:16,sp),r0l
284 btst #4,r0l 284 btst #4,r0l
285 bne resume_kernel:8 /* return from kernel */ 285 bne resume_kernel:8 /* return from kernel */
@@ -296,12 +296,12 @@ work_pending:
296 /* work notifysig */ 296 /* work notifysig */
297 mov.l sp,er0 297 mov.l sp,er0
298 subs #4,er0 /* er0: pt_regs */ 298 subs #4,er0 /* er0: pt_regs */
299 jsr @SYMBOL_NAME(do_notify_resume) 299 jsr @_do_notify_resume
300 bra restore_all:8 300 bra restore_all:8
301work_resched: 301work_resched:
302 mov.l sp,er0 302 mov.l sp,er0
303 jsr @SYMBOL_NAME(set_esp0) 303 jsr @_set_esp0
304 jsr @SYMBOL_NAME(schedule) 304 jsr @_schedule
305 bra resume_userspace:8 305 bra resume_userspace:8
306restore_all: 306restore_all:
307 RESTORE_ALL /* Does RTE */ 307 RESTORE_ALL /* Does RTE */
@@ -320,26 +320,26 @@ need_resched:
320 mov.l er0,@(TI_PRE_COUNT:16,er4) 320 mov.l er0,@(TI_PRE_COUNT:16,er4)
321 andc #0x7f,ccr 321 andc #0x7f,ccr
322 mov.l sp,er0 322 mov.l sp,er0
323 jsr @SYMBOL_NAME(set_esp0) 323 jsr @_set_esp0
324 jsr @SYMBOL_NAME(schedule) 324 jsr @_schedule
325 orc #0x80,ccr 325 orc #0x80,ccr
326 bra need_resched:8 326 bra need_resched:8
327#endif 327#endif
328 328
329SYMBOL_NAME_LABEL(ret_from_fork) 329_ret_from_fork:
330 mov.l er2,er0 330 mov.l er2,er0
331 jsr @SYMBOL_NAME(schedule_tail) 331 jsr @_schedule_tail
332 jmp @SYMBOL_NAME(ret_from_exception) 332 jmp @_ret_from_exception
333 333
334SYMBOL_NAME_LABEL(ret_from_kernel_thread) 334_ret_from_kernel_thread:
335 mov.l er2,er0 335 mov.l er2,er0
336 jsr @SYMBOL_NAME(schedule_tail) 336 jsr @_schedule_tail
337 mov.l @(LER4:16,sp),er0 337 mov.l @(LER4:16,sp),er0
338 mov.l @(LER5:16,sp),er1 338 mov.l @(LER5:16,sp),er1
339 jsr @er1 339 jsr @er1
340 jmp @SYMBOL_NAME(ret_from_exception) 340 jmp @_ret_from_exception
341 341
342SYMBOL_NAME_LABEL(resume) 342_resume:
343 /* 343 /*
344 * Beware - when entering resume, offset of tss is in d1, 344 * Beware - when entering resume, offset of tss is in d1,
345 * prev (the current task) is in a0, next (the new task) 345 * prev (the current task) is in a0, next (the new task)
@@ -355,7 +355,7 @@ SYMBOL_NAME_LABEL(resume)
355 355
356 /* disable interrupts */ 356 /* disable interrupts */
357 orc #0x80,ccr 357 orc #0x80,ccr
358 mov.l @SYMBOL_NAME(sw_usp),er3 358 mov.l @_sw_usp,er3
359 mov.l er3,@(THREAD_USP:16,er0) 359 mov.l er3,@(THREAD_USP:16,er0)
360 mov.l sp,@(THREAD_KSP:16,er0) 360 mov.l sp,@(THREAD_KSP:16,er0)
361 361
@@ -363,7 +363,7 @@ SYMBOL_NAME_LABEL(resume)
363 /* FIXME: what did we hack out of here, this does nothing! */ 363 /* FIXME: what did we hack out of here, this does nothing! */
364 364
365 mov.l @(THREAD_USP:16,er1),er0 365 mov.l @(THREAD_USP:16,er1),er0
366 mov.l er0,@SYMBOL_NAME(sw_usp) 366 mov.l er0,@_sw_usp
367 mov.l @(THREAD_KSP:16,er1),sp 367 mov.l @(THREAD_KSP:16,er1),sp
368 368
369 /* restore status register */ 369 /* restore status register */
@@ -372,15 +372,15 @@ SYMBOL_NAME_LABEL(resume)
372 ldc r3l,ccr 372 ldc r3l,ccr
373 rts 373 rts
374 374
375SYMBOL_NAME_LABEL(trace_break) 375_trace_break:
376 subs #4,sp 376 subs #4,sp
377 SAVE_ALL 377 SAVE_ALL
378 sub.l er1,er1 378 sub.l er1,er1
379 dec.l #1,er1 379 dec.l #1,er1
380 mov.l er1,@(LORIG,sp) 380 mov.l er1,@(LORIG,sp)
381 mov.l sp,er0 381 mov.l sp,er0
382 jsr @SYMBOL_NAME(set_esp0) 382 jsr @_set_esp0
383 mov.l @SYMBOL_NAME(sw_usp),er0 383 mov.l @_sw_usp,er0
384 mov.l @er0,er1 384 mov.l @er0,er1
385 mov.w @(-2:16,er1),r2 385 mov.w @(-2:16,er1),r2
386 cmp.w #0x5730,r2 386 cmp.w #0x5730,r2
@@ -390,13 +390,13 @@ SYMBOL_NAME_LABEL(trace_break)
3901: 3901:
391 and.w #0xff,e1 391 and.w #0xff,e1
392 mov.l er1,er0 392 mov.l er1,er0
393 jsr @SYMBOL_NAME(trace_trap) 393 jsr @_trace_trap
394 jmp @SYMBOL_NAME(ret_from_exception) 394 jmp @_ret_from_exception
395 395
396 .section .bss 396 .section .bss
397SYMBOL_NAME_LABEL(sw_ksp) 397_sw_ksp:
398 .space 4 398 .space 4
399SYMBOL_NAME_LABEL(sw_usp) 399_sw_usp:
400 .space 4 400 .space 4
401 401
402 .end 402 .end
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index 5c2168fb9b9e..c55e0ed270d5 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -2,8 +2,10 @@
2#include <linux/sys.h> 2#include <linux/sys.h>
3#include <asm/linkage.h> 3#include <asm/linkage.h>
4#include <asm/unistd.h> 4#include <asm/unistd.h>
5 5
6.globl SYMBOL_NAME(sys_call_table) 6#define CALL(x) .long _ ## x
7
8.globl _sys_call_table
7 9
8#if defined(CONFIG_CPU_H8300H) 10#if defined(CONFIG_CPU_H8300H)
9 .h8300h 11 .h8300h
@@ -13,324 +15,324 @@
13#endif 15#endif
14 .section .text 16 .section .text
15 .align 2 17 .align 2
16SYMBOL_NAME_LABEL(sys_call_table) 18_sys_call_table:
17 .long SYMBOL_NAME(sys_ni_syscall) /* 0 - old "setup()" system call*/ 19 CALL(sys_ni_syscall) /* 0 - old "setup()" system call*/
18 .long SYMBOL_NAME(sys_exit) 20 CALL(sys_exit)
19 .long SYMBOL_NAME(sys_fork) 21 CALL(sys_fork)
20 .long SYMBOL_NAME(sys_read) 22 CALL(sys_read)
21 .long SYMBOL_NAME(sys_write) 23 CALL(sys_write)
22 .long SYMBOL_NAME(sys_open) /* 5 */ 24 CALL(sys_open) /* 5 */
23 .long SYMBOL_NAME(sys_close) 25 CALL(sys_close)
24 .long SYMBOL_NAME(sys_waitpid) 26 CALL(sys_waitpid)
25 .long SYMBOL_NAME(sys_creat) 27 CALL(sys_creat)
26 .long SYMBOL_NAME(sys_link) 28 CALL(sys_link)
27 .long SYMBOL_NAME(sys_unlink) /* 10 */ 29 CALL(sys_unlink) /* 10 */
28 .long SYMBOL_NAME(sys_execve) 30 CALL(sys_execve)
29 .long SYMBOL_NAME(sys_chdir) 31 CALL(sys_chdir)
30 .long SYMBOL_NAME(sys_time) 32 CALL(sys_time)
31 .long SYMBOL_NAME(sys_mknod) 33 CALL(sys_mknod)
32 .long SYMBOL_NAME(sys_chmod) /* 15 */ 34 CALL(sys_chmod) /* 15 */
33 .long SYMBOL_NAME(sys_chown16) 35 CALL(sys_chown16)
34 .long SYMBOL_NAME(sys_ni_syscall) /* old break syscall holder */ 36 CALL(sys_ni_syscall) /* old break syscall holder */
35 .long SYMBOL_NAME(sys_stat) 37 CALL(sys_stat)
36 .long SYMBOL_NAME(sys_lseek) 38 CALL(sys_lseek)
37 .long SYMBOL_NAME(sys_getpid) /* 20 */ 39 CALL(sys_getpid) /* 20 */
38 .long SYMBOL_NAME(sys_mount) 40 CALL(sys_mount)
39 .long SYMBOL_NAME(sys_oldumount) 41 CALL(sys_oldumount)
40 .long SYMBOL_NAME(sys_setuid16) 42 CALL(sys_setuid16)
41 .long SYMBOL_NAME(sys_getuid16) 43 CALL(sys_getuid16)
42 .long SYMBOL_NAME(sys_stime) /* 25 */ 44 CALL(sys_stime) /* 25 */
43 .long SYMBOL_NAME(sys_ptrace) 45 CALL(sys_ptrace)
44 .long SYMBOL_NAME(sys_alarm) 46 CALL(sys_alarm)
45 .long SYMBOL_NAME(sys_fstat) 47 CALL(sys_fstat)
46 .long SYMBOL_NAME(sys_pause) 48 CALL(sys_pause)
47 .long SYMBOL_NAME(sys_utime) /* 30 */ 49 CALL(sys_utime) /* 30 */
48 .long SYMBOL_NAME(sys_ni_syscall) /* old stty syscall holder */ 50 CALL(sys_ni_syscall) /* old stty syscall holder */
49 .long SYMBOL_NAME(sys_ni_syscall) /* old gtty syscall holder */ 51 CALL(sys_ni_syscall) /* old gtty syscall holder */
50 .long SYMBOL_NAME(sys_access) 52 CALL(sys_access)
51 .long SYMBOL_NAME(sys_nice) 53 CALL(sys_nice)
52 .long SYMBOL_NAME(sys_ni_syscall) /* 35 old ftime syscall holder */ 54 CALL(sys_ni_syscall) /* 35 old ftime syscall holder */
53 .long SYMBOL_NAME(sys_sync) 55 CALL(sys_sync)
54 .long SYMBOL_NAME(sys_kill) 56 CALL(sys_kill)
55 .long SYMBOL_NAME(sys_rename) 57 CALL(sys_rename)
56 .long SYMBOL_NAME(sys_mkdir) 58 CALL(sys_mkdir)
57 .long SYMBOL_NAME(sys_rmdir) /* 40 */ 59 CALL(sys_rmdir) /* 40 */
58 .long SYMBOL_NAME(sys_dup) 60 CALL(sys_dup)
59 .long SYMBOL_NAME(sys_pipe) 61 CALL(sys_pipe)
60 .long SYMBOL_NAME(sys_times) 62 CALL(sys_times)
61 .long SYMBOL_NAME(sys_ni_syscall) /* old prof syscall holder */ 63 CALL(sys_ni_syscall) /* old prof syscall holder */
62 .long SYMBOL_NAME(sys_brk) /* 45 */ 64 CALL(sys_brk) /* 45 */
63 .long SYMBOL_NAME(sys_setgid16) 65 CALL(sys_setgid16)
64 .long SYMBOL_NAME(sys_getgid16) 66 CALL(sys_getgid16)
65 .long SYMBOL_NAME(sys_signal) 67 CALL(sys_signal)
66 .long SYMBOL_NAME(sys_geteuid16) 68 CALL(sys_geteuid16)
67 .long SYMBOL_NAME(sys_getegid16) /* 50 */ 69 CALL(sys_getegid16) /* 50 */
68 .long SYMBOL_NAME(sys_acct) 70 CALL(sys_acct)
69 .long SYMBOL_NAME(sys_umount) /* recycled never used phys() */ 71 CALL(sys_umount) /* recycled never used phys() */
70 .long SYMBOL_NAME(sys_ni_syscall) /* old lock syscall holder */ 72 CALL(sys_ni_syscall) /* old lock syscall holder */
71 .long SYMBOL_NAME(sys_ioctl) 73 CALL(sys_ioctl)
72 .long SYMBOL_NAME(sys_fcntl) /* 55 */ 74 CALL(sys_fcntl) /* 55 */
73 .long SYMBOL_NAME(sys_ni_syscall) /* old mpx syscall holder */ 75 CALL(sys_ni_syscall) /* old mpx syscall holder */
74 .long SYMBOL_NAME(sys_setpgid) 76 CALL(sys_setpgid)
75 .long SYMBOL_NAME(sys_ni_syscall) /* old ulimit syscall holder */ 77 CALL(sys_ni_syscall) /* old ulimit syscall holder */
76 .long SYMBOL_NAME(sys_ni_syscall) 78 CALL(sys_ni_syscall)
77 .long SYMBOL_NAME(sys_umask) /* 60 */ 79 CALL(sys_umask) /* 60 */
78 .long SYMBOL_NAME(sys_chroot) 80 CALL(sys_chroot)
79 .long SYMBOL_NAME(sys_ustat) 81 CALL(sys_ustat)
80 .long SYMBOL_NAME(sys_dup2) 82 CALL(sys_dup2)
81 .long SYMBOL_NAME(sys_getppid) 83 CALL(sys_getppid)
82 .long SYMBOL_NAME(sys_getpgrp) /* 65 */ 84 CALL(sys_getpgrp) /* 65 */
83 .long SYMBOL_NAME(sys_setsid) 85 CALL(sys_setsid)
84 .long SYMBOL_NAME(sys_sigaction) 86 CALL(sys_sigaction)
85 .long SYMBOL_NAME(sys_sgetmask) 87 CALL(sys_sgetmask)
86 .long SYMBOL_NAME(sys_ssetmask) 88 CALL(sys_ssetmask)
87 .long SYMBOL_NAME(sys_setreuid16) /* 70 */ 89 CALL(sys_setreuid16) /* 70 */
88 .long SYMBOL_NAME(sys_setregid16) 90 CALL(sys_setregid16)
89 .long SYMBOL_NAME(sys_sigsuspend) 91 CALL(sys_sigsuspend)
90 .long SYMBOL_NAME(sys_sigpending) 92 CALL(sys_sigpending)
91 .long SYMBOL_NAME(sys_sethostname) 93 CALL(sys_sethostname)
92 .long SYMBOL_NAME(sys_setrlimit) /* 75 */ 94 CALL(sys_setrlimit) /* 75 */
93 .long SYMBOL_NAME(sys_old_getrlimit) 95 CALL(sys_old_getrlimit)
94 .long SYMBOL_NAME(sys_getrusage) 96 CALL(sys_getrusage)
95 .long SYMBOL_NAME(sys_gettimeofday) 97 CALL(sys_gettimeofday)
96 .long SYMBOL_NAME(sys_settimeofday) 98 CALL(sys_settimeofday)
97 .long SYMBOL_NAME(sys_getgroups16) /* 80 */ 99 CALL(sys_getgroups16) /* 80 */
98 .long SYMBOL_NAME(sys_setgroups16) 100 CALL(sys_setgroups16)
99 .long SYMBOL_NAME(sys_old_select) 101 CALL(sys_old_select)
100 .long SYMBOL_NAME(sys_symlink) 102 CALL(sys_symlink)
101 .long SYMBOL_NAME(sys_lstat) 103 CALL(sys_lstat)
102 .long SYMBOL_NAME(sys_readlink) /* 85 */ 104 CALL(sys_readlink) /* 85 */
103 .long SYMBOL_NAME(sys_uselib) 105 CALL(sys_uselib)
104 .long SYMBOL_NAME(sys_swapon) 106 CALL(sys_swapon)
105 .long SYMBOL_NAME(sys_reboot) 107 CALL(sys_reboot)
106 .long SYMBOL_NAME(sys_old_readdir) 108 CALL(sys_old_readdir)
107 .long SYMBOL_NAME(sys_old_mmap) /* 90 */ 109 CALL(sys_old_mmap) /* 90 */
108 .long SYMBOL_NAME(sys_munmap) 110 CALL(sys_munmap)
109 .long SYMBOL_NAME(sys_truncate) 111 CALL(sys_truncate)
110 .long SYMBOL_NAME(sys_ftruncate) 112 CALL(sys_ftruncate)
111 .long SYMBOL_NAME(sys_fchmod) 113 CALL(sys_fchmod)
112 .long SYMBOL_NAME(sys_fchown16) /* 95 */ 114 CALL(sys_fchown16) /* 95 */
113 .long SYMBOL_NAME(sys_getpriority) 115 CALL(sys_getpriority)
114 .long SYMBOL_NAME(sys_setpriority) 116 CALL(sys_setpriority)
115 .long SYMBOL_NAME(sys_ni_syscall) /* old profil syscall holder */ 117 CALL(sys_ni_syscall) /* old profil syscall holder */
116 .long SYMBOL_NAME(sys_statfs) 118 CALL(sys_statfs)
117 .long SYMBOL_NAME(sys_fstatfs) /* 100 */ 119 CALL(sys_fstatfs) /* 100 */
118 .long SYMBOL_NAME(sys_ni_syscall) /* ioperm for i386 */ 120 CALL(sys_ni_syscall) /* ioperm for i386 */
119 .long SYMBOL_NAME(sys_socketcall) 121 CALL(sys_socketcall)
120 .long SYMBOL_NAME(sys_syslog) 122 CALL(sys_syslog)
121 .long SYMBOL_NAME(sys_setitimer) 123 CALL(sys_setitimer)
122 .long SYMBOL_NAME(sys_getitimer) /* 105 */ 124 CALL(sys_getitimer) /* 105 */
123 .long SYMBOL_NAME(sys_newstat) 125 CALL(sys_newstat)
124 .long SYMBOL_NAME(sys_newlstat) 126 CALL(sys_newlstat)
125 .long SYMBOL_NAME(sys_newfstat) 127 CALL(sys_newfstat)
126 .long SYMBOL_NAME(sys_ni_syscall) 128 CALL(sys_ni_syscall)
127 .long SYMBOL_NAME(sys_ni_syscall) /* iopl for i386 */ /* 110 */ 129 CALL(sys_ni_syscall) /* iopl for i386 */ /* 110 */
128 .long SYMBOL_NAME(sys_vhangup) 130 CALL(sys_vhangup)
129 .long SYMBOL_NAME(sys_ni_syscall) /* obsolete idle() syscall */ 131 CALL(sys_ni_syscall) /* obsolete idle() syscall */
130 .long SYMBOL_NAME(sys_ni_syscall) /* vm86old for i386 */ 132 CALL(sys_ni_syscall) /* vm86old for i386 */
131 .long SYMBOL_NAME(sys_wait4) 133 CALL(sys_wait4)
132 .long SYMBOL_NAME(sys_swapoff) /* 115 */ 134 CALL(sys_swapoff) /* 115 */
133 .long SYMBOL_NAME(sys_sysinfo) 135 CALL(sys_sysinfo)
134 .long SYMBOL_NAME(sys_ipc) 136 CALL(sys_ipc)
135 .long SYMBOL_NAME(sys_fsync) 137 CALL(sys_fsync)
136 .long SYMBOL_NAME(sys_sigreturn) 138 CALL(sys_sigreturn)
137 .long SYMBOL_NAME(sys_clone) /* 120 */ 139 CALL(sys_clone) /* 120 */
138 .long SYMBOL_NAME(sys_setdomainname) 140 CALL(sys_setdomainname)
139 .long SYMBOL_NAME(sys_newuname) 141 CALL(sys_newuname)
140 .long SYMBOL_NAME(sys_cacheflush) /* modify_ldt for i386 */ 142 CALL(sys_cacheflush) /* modify_ldt for i386 */
141 .long SYMBOL_NAME(sys_adjtimex) 143 CALL(sys_adjtimex)
142 .long SYMBOL_NAME(sys_ni_syscall) /* 125 sys_mprotect */ 144 CALL(sys_ni_syscall) /* 125 sys_mprotect */
143 .long SYMBOL_NAME(sys_sigprocmask) 145 CALL(sys_sigprocmask)
144 .long SYMBOL_NAME(sys_ni_syscall) /* sys_create_module */ 146 CALL(sys_ni_syscall) /* sys_create_module */
145 .long SYMBOL_NAME(sys_init_module) 147 CALL(sys_init_module)
146 .long SYMBOL_NAME(sys_delete_module) 148 CALL(sys_delete_module)
147 .long SYMBOL_NAME(sys_ni_syscall) /* 130 sys_get_kernel_syms */ 149 CALL(sys_ni_syscall) /* 130 sys_get_kernel_syms */
148 .long SYMBOL_NAME(sys_quotactl) 150 CALL(sys_quotactl)
149 .long SYMBOL_NAME(sys_getpgid) 151 CALL(sys_getpgid)
150 .long SYMBOL_NAME(sys_fchdir) 152 CALL(sys_fchdir)
151 .long SYMBOL_NAME(sys_bdflush) 153 CALL(sys_bdflush)
152 .long SYMBOL_NAME(sys_sysfs) /* 135 */ 154 CALL(sys_sysfs) /* 135 */
153 .long SYMBOL_NAME(sys_personality) 155 CALL(sys_personality)
154 .long SYMBOL_NAME(sys_ni_syscall) /* for afs_syscall */ 156 CALL(sys_ni_syscall) /* for afs_syscall */
155 .long SYMBOL_NAME(sys_setfsuid16) 157 CALL(sys_setfsuid16)
156 .long SYMBOL_NAME(sys_setfsgid16) 158 CALL(sys_setfsgid16)
157 .long SYMBOL_NAME(sys_llseek) /* 140 */ 159 CALL(sys_llseek) /* 140 */
158 .long SYMBOL_NAME(sys_getdents) 160 CALL(sys_getdents)
159 .long SYMBOL_NAME(sys_select) 161 CALL(sys_select)
160 .long SYMBOL_NAME(sys_flock) 162 CALL(sys_flock)
161 .long SYMBOL_NAME(sys_ni_syscall) /* sys_msync */ 163 CALL(sys_ni_syscall) /* sys_msync */
162 .long SYMBOL_NAME(sys_readv) /* 145 */ 164 CALL(sys_readv) /* 145 */
163 .long SYMBOL_NAME(sys_writev) 165 CALL(sys_writev)
164 .long SYMBOL_NAME(sys_getsid) 166 CALL(sys_getsid)
165 .long SYMBOL_NAME(sys_fdatasync) 167 CALL(sys_fdatasync)
166 .long SYMBOL_NAME(sys_sysctl) 168 CALL(sys_sysctl)
167 .long SYMBOL_NAME(sys_ni_syscall) /* 150 sys_mlock */ 169 CALL(sys_ni_syscall) /* 150 sys_mlock */
168 .long SYMBOL_NAME(sys_ni_syscall) /* sys_munlock */ 170 CALL(sys_ni_syscall) /* sys_munlock */
169 .long SYMBOL_NAME(sys_ni_syscall) /* sys_mlockall */ 171 CALL(sys_ni_syscall) /* sys_mlockall */
170 .long SYMBOL_NAME(sys_ni_syscall) /* sys_munlockall */ 172 CALL(sys_ni_syscall) /* sys_munlockall */
171 .long SYMBOL_NAME(sys_sched_setparam) 173 CALL(sys_sched_setparam)
172 .long SYMBOL_NAME(sys_sched_getparam) /* 155 */ 174 CALL(sys_sched_getparam) /* 155 */
173 .long SYMBOL_NAME(sys_sched_setscheduler) 175 CALL(sys_sched_setscheduler)
174 .long SYMBOL_NAME(sys_sched_getscheduler) 176 CALL(sys_sched_getscheduler)
175 .long SYMBOL_NAME(sys_sched_yield) 177 CALL(sys_sched_yield)
176 .long SYMBOL_NAME(sys_sched_get_priority_max) 178 CALL(sys_sched_get_priority_max)
177 .long SYMBOL_NAME(sys_sched_get_priority_min) /* 160 */ 179 CALL(sys_sched_get_priority_min) /* 160 */
178 .long SYMBOL_NAME(sys_sched_rr_get_interval) 180 CALL(sys_sched_rr_get_interval)
179 .long SYMBOL_NAME(sys_nanosleep) 181 CALL(sys_nanosleep)
180 .long SYMBOL_NAME(sys_ni_syscall) /* sys_mremap */ 182 CALL(sys_ni_syscall) /* sys_mremap */
181 .long SYMBOL_NAME(sys_setresuid16) 183 CALL(sys_setresuid16)
182 .long SYMBOL_NAME(sys_getresuid16) /* 165 */ 184 CALL(sys_getresuid16) /* 165 */
183 .long SYMBOL_NAME(sys_ni_syscall) /* for vm86 */ 185 CALL(sys_ni_syscall) /* for vm86 */
184 .long SYMBOL_NAME(sys_ni_syscall) /* sys_query_module */ 186 CALL(sys_ni_syscall) /* sys_query_module */
185 .long SYMBOL_NAME(sys_poll) 187 CALL(sys_poll)
186 .long SYMBOL_NAME(sys_ni_syscall) /* old nfsservctl */ 188 CALL(sys_ni_syscall) /* old nfsservctl */
187 .long SYMBOL_NAME(sys_setresgid16) /* 170 */ 189 CALL(sys_setresgid16) /* 170 */
188 .long SYMBOL_NAME(sys_getresgid16) 190 CALL(sys_getresgid16)
189 .long SYMBOL_NAME(sys_prctl) 191 CALL(sys_prctl)
190 .long SYMBOL_NAME(sys_rt_sigreturn) 192 CALL(sys_rt_sigreturn)
191 .long SYMBOL_NAME(sys_rt_sigaction) 193 CALL(sys_rt_sigaction)
192 .long SYMBOL_NAME(sys_rt_sigprocmask) /* 175 */ 194 CALL(sys_rt_sigprocmask) /* 175 */
193 .long SYMBOL_NAME(sys_rt_sigpending) 195 CALL(sys_rt_sigpending)
194 .long SYMBOL_NAME(sys_rt_sigtimedwait) 196 CALL(sys_rt_sigtimedwait)
195 .long SYMBOL_NAME(sys_rt_sigqueueinfo) 197 CALL(sys_rt_sigqueueinfo)
196 .long SYMBOL_NAME(sys_rt_sigsuspend) 198 CALL(sys_rt_sigsuspend)
197 .long SYMBOL_NAME(sys_pread64) /* 180 */ 199 CALL(sys_pread64) /* 180 */
198 .long SYMBOL_NAME(sys_pwrite64) 200 CALL(sys_pwrite64)
199 .long SYMBOL_NAME(sys_lchown16); 201 CALL(sys_lchown16);
200 .long SYMBOL_NAME(sys_getcwd) 202 CALL(sys_getcwd)
201 .long SYMBOL_NAME(sys_capget) 203 CALL(sys_capget)
202 .long SYMBOL_NAME(sys_capset) /* 185 */ 204 CALL(sys_capset) /* 185 */
203 .long SYMBOL_NAME(sys_sigaltstack) 205 CALL(sys_sigaltstack)
204 .long SYMBOL_NAME(sys_sendfile) 206 CALL(sys_sendfile)
205 .long SYMBOL_NAME(sys_ni_syscall) /* streams1 */ 207 CALL(sys_ni_syscall) /* streams1 */
206 .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */ 208 CALL(sys_ni_syscall) /* streams2 */
207 .long SYMBOL_NAME(sys_vfork) /* 190 */ 209 CALL(sys_vfork) /* 190 */
208 .long SYMBOL_NAME(sys_getrlimit) 210 CALL(sys_getrlimit)
209 .long SYMBOL_NAME(sys_mmap_pgoff) 211 CALL(sys_mmap_pgoff)
210 .long SYMBOL_NAME(sys_truncate64) 212 CALL(sys_truncate64)
211 .long SYMBOL_NAME(sys_ftruncate64) 213 CALL(sys_ftruncate64)
212 .long SYMBOL_NAME(sys_stat64) /* 195 */ 214 CALL(sys_stat64) /* 195 */
213 .long SYMBOL_NAME(sys_lstat64) 215 CALL(sys_lstat64)
214 .long SYMBOL_NAME(sys_fstat64) 216 CALL(sys_fstat64)
215 .long SYMBOL_NAME(sys_chown) 217 CALL(sys_chown)
216 .long SYMBOL_NAME(sys_getuid) 218 CALL(sys_getuid)
217 .long SYMBOL_NAME(sys_getgid) /* 200 */ 219 CALL(sys_getgid) /* 200 */
218 .long SYMBOL_NAME(sys_geteuid) 220 CALL(sys_geteuid)
219 .long SYMBOL_NAME(sys_getegid) 221 CALL(sys_getegid)
220 .long SYMBOL_NAME(sys_setreuid) 222 CALL(sys_setreuid)
221 .long SYMBOL_NAME(sys_setregid) 223 CALL(sys_setregid)
222 .long SYMBOL_NAME(sys_getgroups) /* 205 */ 224 CALL(sys_getgroups) /* 205 */
223 .long SYMBOL_NAME(sys_setgroups) 225 CALL(sys_setgroups)
224 .long SYMBOL_NAME(sys_fchown) 226 CALL(sys_fchown)
225 .long SYMBOL_NAME(sys_setresuid) 227 CALL(sys_setresuid)
226 .long SYMBOL_NAME(sys_getresuid) 228 CALL(sys_getresuid)
227 .long SYMBOL_NAME(sys_setresgid) /* 210 */ 229 CALL(sys_setresgid) /* 210 */
228 .long SYMBOL_NAME(sys_getresgid) 230 CALL(sys_getresgid)
229 .long SYMBOL_NAME(sys_lchown) 231 CALL(sys_lchown)
230 .long SYMBOL_NAME(sys_setuid) 232 CALL(sys_setuid)
231 .long SYMBOL_NAME(sys_setgid) 233 CALL(sys_setgid)
232 .long SYMBOL_NAME(sys_setfsuid) /* 215 */ 234 CALL(sys_setfsuid) /* 215 */
233 .long SYMBOL_NAME(sys_setfsgid) 235 CALL(sys_setfsgid)
234 .long SYMBOL_NAME(sys_pivot_root) 236 CALL(sys_pivot_root)
235 .long SYMBOL_NAME(sys_ni_syscall) 237 CALL(sys_ni_syscall)
236 .long SYMBOL_NAME(sys_ni_syscall) 238 CALL(sys_ni_syscall)
237 .long SYMBOL_NAME(sys_getdents64) /* 220 */ 239 CALL(sys_getdents64) /* 220 */
238 .long SYMBOL_NAME(sys_fcntl64) 240 CALL(sys_fcntl64)
239 .long SYMBOL_NAME(sys_ni_syscall) /* reserved TUX */ 241 CALL(sys_ni_syscall) /* reserved TUX */
240 .long SYMBOL_NAME(sys_ni_syscall) /* reserved Security */ 242 CALL(sys_ni_syscall) /* reserved Security */
241 .long SYMBOL_NAME(sys_gettid) 243 CALL(sys_gettid)
242 .long SYMBOL_NAME(sys_readahead) /* 225 */ 244 CALL(sys_readahead) /* 225 */
243 .long SYMBOL_NAME(sys_setxattr) 245 CALL(sys_setxattr)
244 .long SYMBOL_NAME(sys_lsetxattr) 246 CALL(sys_lsetxattr)
245 .long SYMBOL_NAME(sys_fsetxattr) 247 CALL(sys_fsetxattr)
246 .long SYMBOL_NAME(sys_getxattr) 248 CALL(sys_getxattr)
247 .long SYMBOL_NAME(sys_lgetxattr) /* 230 */ 249 CALL(sys_lgetxattr) /* 230 */
248 .long SYMBOL_NAME(sys_fgetxattr) 250 CALL(sys_fgetxattr)
249 .long SYMBOL_NAME(sys_listxattr) 251 CALL(sys_listxattr)
250 .long SYMBOL_NAME(sys_llistxattr) 252 CALL(sys_llistxattr)
251 .long SYMBOL_NAME(sys_flistxattr) 253 CALL(sys_flistxattr)
252 .long SYMBOL_NAME(sys_removexattr) /* 235 */ 254 CALL(sys_removexattr) /* 235 */
253 .long SYMBOL_NAME(sys_lremovexattr) 255 CALL(sys_lremovexattr)
254 .long SYMBOL_NAME(sys_fremovexattr) 256 CALL(sys_fremovexattr)
255 .long SYMBOL_NAME(sys_tkill) 257 CALL(sys_tkill)
256 .long SYMBOL_NAME(sys_sendfile64) 258 CALL(sys_sendfile64)
257 .long SYMBOL_NAME(sys_futex) /* 240 */ 259 CALL(sys_futex) /* 240 */
258 .long SYMBOL_NAME(sys_sched_setaffinity) 260 CALL(sys_sched_setaffinity)
259 .long SYMBOL_NAME(sys_sched_getaffinity) 261 CALL(sys_sched_getaffinity)
260 .long SYMBOL_NAME(sys_ni_syscall) 262 CALL(sys_ni_syscall)
261 .long SYMBOL_NAME(sys_ni_syscall) 263 CALL(sys_ni_syscall)
262 .long SYMBOL_NAME(sys_io_setup) /* 245 */ 264 CALL(sys_io_setup) /* 245 */
263 .long SYMBOL_NAME(sys_io_destroy) 265 CALL(sys_io_destroy)
264 .long SYMBOL_NAME(sys_io_getevents) 266 CALL(sys_io_getevents)
265 .long SYMBOL_NAME(sys_io_submit) 267 CALL(sys_io_submit)
266 .long SYMBOL_NAME(sys_io_cancel) 268 CALL(sys_io_cancel)
267 .long SYMBOL_NAME(sys_fadvise64) /* 250 */ 269 CALL(sys_fadvise64) /* 250 */
268 .long SYMBOL_NAME(sys_ni_syscall) 270 CALL(sys_ni_syscall)
269 .long SYMBOL_NAME(sys_exit_group) 271 CALL(sys_exit_group)
270 .long SYMBOL_NAME(sys_lookup_dcookie) 272 CALL(sys_lookup_dcookie)
271 .long SYMBOL_NAME(sys_epoll_create) 273 CALL(sys_epoll_create)
272 .long SYMBOL_NAME(sys_epoll_ctl) /* 255 */ 274 CALL(sys_epoll_ctl) /* 255 */
273 .long SYMBOL_NAME(sys_epoll_wait) 275 CALL(sys_epoll_wait)
274 .long SYMBOL_NAME(sys_ni_syscall) /* sys_remap_file_pages */ 276 CALL(sys_ni_syscall) /* sys_remap_file_pages */
275 .long SYMBOL_NAME(sys_set_tid_address) 277 CALL(sys_set_tid_address)
276 .long SYMBOL_NAME(sys_timer_create) 278 CALL(sys_timer_create)
277 .long SYMBOL_NAME(sys_timer_settime) /* 260 */ 279 CALL(sys_timer_settime) /* 260 */
278 .long SYMBOL_NAME(sys_timer_gettime) 280 CALL(sys_timer_gettime)
279 .long SYMBOL_NAME(sys_timer_getoverrun) 281 CALL(sys_timer_getoverrun)
280 .long SYMBOL_NAME(sys_timer_delete) 282 CALL(sys_timer_delete)
281 .long SYMBOL_NAME(sys_clock_settime) 283 CALL(sys_clock_settime)
282 .long SYMBOL_NAME(sys_clock_gettime) /* 265 */ 284 CALL(sys_clock_gettime) /* 265 */
283 .long SYMBOL_NAME(sys_clock_getres) 285 CALL(sys_clock_getres)
284 .long SYMBOL_NAME(sys_clock_nanosleep) 286 CALL(sys_clock_nanosleep)
285 .long SYMBOL_NAME(sys_statfs64) 287 CALL(sys_statfs64)
286 .long SYMBOL_NAME(sys_fstatfs64) 288 CALL(sys_fstatfs64)
287 .long SYMBOL_NAME(sys_tgkill) /* 270 */ 289 CALL(sys_tgkill) /* 270 */
288 .long SYMBOL_NAME(sys_utimes) 290 CALL(sys_utimes)
289 .long SYMBOL_NAME(sys_fadvise64_64) 291 CALL(sys_fadvise64_64)
290 .long SYMBOL_NAME(sys_ni_syscall) /* sys_vserver */ 292 CALL(sys_ni_syscall) /* sys_vserver */
291 .long SYMBOL_NAME(sys_ni_syscall) 293 CALL(sys_ni_syscall)
292 .long SYMBOL_NAME(sys_get_mempolicy) /* 275 */ 294 CALL(sys_get_mempolicy) /* 275 */
293 .long SYMBOL_NAME(sys_set_mempolicy) 295 CALL(sys_set_mempolicy)
294 .long SYMBOL_NAME(sys_mq_open) 296 CALL(sys_mq_open)
295 .long SYMBOL_NAME(sys_mq_unlink) 297 CALL(sys_mq_unlink)
296 .long SYMBOL_NAME(sys_mq_timedsend) 298 CALL(sys_mq_timedsend)
297 .long SYMBOL_NAME(sys_mq_timedreceive) /* 280 */ 299 CALL(sys_mq_timedreceive) /* 280 */
298 .long SYMBOL_NAME(sys_mq_notify) 300 CALL(sys_mq_notify)
299 .long SYMBOL_NAME(sys_mq_getsetattr) 301 CALL(sys_mq_getsetattr)
300 .long SYMBOL_NAME(sys_waitid) 302 CALL(sys_waitid)
301 .long SYMBOL_NAME(sys_ni_syscall) /* sys_kexec_load */ 303 CALL(sys_ni_syscall) /* sys_kexec_load */
302 .long SYMBOL_NAME(sys_add_key) /* 285 */ 304 CALL(sys_add_key) /* 285 */
303 .long SYMBOL_NAME(sys_request_key) 305 CALL(sys_request_key)
304 .long SYMBOL_NAME(sys_keyctl) 306 CALL(sys_keyctl)
305 .long SYMBOL_NAME(sys_ioprio_set) 307 CALL(sys_ioprio_set)
306 .long SYMBOL_NAME(sys_ioprio_get) /* 290 */ 308 CALL(sys_ioprio_get) /* 290 */
307 .long SYMBOL_NAME(sys_inotify_init) 309 CALL(sys_inotify_init)
308 .long SYMBOL_NAME(sys_inotify_add_watch) 310 CALL(sys_inotify_add_watch)
309 .long SYMBOL_NAME(sys_inotify_rm_watch) 311 CALL(sys_inotify_rm_watch)
310 .long SYMBOL_NAME(sys_migrate_pages) 312 CALL(sys_migrate_pages)
311 .long SYMBOL_NAME(sys_openat) /* 295 */ 313 CALL(sys_openat) /* 295 */
312 .long SYMBOL_NAME(sys_mkdirat) 314 CALL(sys_mkdirat)
313 .long SYMBOL_NAME(sys_mknodat) 315 CALL(sys_mknodat)
314 .long SYMBOL_NAME(sys_fchownat) 316 CALL(sys_fchownat)
315 .long SYMBOL_NAME(sys_futimesat) 317 CALL(sys_futimesat)
316 .long SYMBOL_NAME(sys_fstatat64) /* 300 */ 318 CALL(sys_fstatat64) /* 300 */
317 .long SYMBOL_NAME(sys_unlinkat) 319 CALL(sys_unlinkat)
318 .long SYMBOL_NAME(sys_renameat) 320 CALL(sys_renameat)
319 .long SYMBOL_NAME(sys_linkat) 321 CALL(sys_linkat)
320 .long SYMBOL_NAME(sys_symlinkat) 322 CALL(sys_symlinkat)
321 .long SYMBOL_NAME(sys_readlinkat) /* 305 */ 323 CALL(sys_readlinkat) /* 305 */
322 .long SYMBOL_NAME(sys_fchmodat) 324 CALL(sys_fchmodat)
323 .long SYMBOL_NAME(sys_faccessat) 325 CALL(sys_faccessat)
324 .long SYMBOL_NAME(sys_ni_syscall) /* sys_pselect6 */ 326 CALL(sys_ni_syscall) /* sys_pselect6 */
325 .long SYMBOL_NAME(sys_ni_syscall) /* sys_ppoll */ 327 CALL(sys_ni_syscall) /* sys_ppoll */
326 .long SYMBOL_NAME(sys_unshare) /* 310 */ 328 CALL(sys_unshare) /* 310 */
327 .long SYMBOL_NAME(sys_set_robust_list) 329 CALL(sys_set_robust_list)
328 .long SYMBOL_NAME(sys_get_robust_list) 330 CALL(sys_get_robust_list)
329 .long SYMBOL_NAME(sys_splice) 331 CALL(sys_splice)
330 .long SYMBOL_NAME(sys_sync_file_range) 332 CALL(sys_sync_file_range)
331 .long SYMBOL_NAME(sys_tee) /* 315 */ 333 CALL(sys_tee) /* 315 */
332 .long SYMBOL_NAME(sys_vmsplice) 334 CALL(sys_vmsplice)
333 .long SYMBOL_NAME(sys_ni_syscall) /* sys_move_pages */ 335 CALL(sys_ni_syscall) /* sys_move_pages */
334 .long SYMBOL_NAME(sys_getcpu) 336 CALL(sys_getcpu)
335 .long SYMBOL_NAME(sys_ni_syscall) /* sys_epoll_pwait */ 337 CALL(sys_ni_syscall) /* sys_epoll_pwait */
336 .long SYMBOL_NAME(sys_setns) /* 320 */ 338 CALL(sys_setns) /* 320 */
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 03d356d96e5d..3253fed42ac1 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -132,10 +132,12 @@ SECTIONS
132 { 132 {
133 . = ALIGN(0x4) ; 133 . = ALIGN(0x4) ;
134 __sbss = . ; 134 __sbss = . ;
135 ___bss_start = . ;
135 *(.bss*) 136 *(.bss*)
136 . = ALIGN(0x4) ; 137 . = ALIGN(0x4) ;
137 *(COMMON) 138 *(COMMON)
138 . = ALIGN(0x4) ; 139 . = ALIGN(0x4) ;
140 ___bss_stop = . ;
139 __ebss = . ; 141 __ebss = . ;
140 __end = . ; 142 __end = . ;
141 __ramstart = .; 143 __ramstart = .;
diff --git a/arch/h8300/lib/abs.S b/arch/h8300/lib/abs.S
index cabdd46b41db..ddd1fb3d01ad 100644
--- a/arch/h8300/lib/abs.S
+++ b/arch/h8300/lib/abs.S
@@ -9,10 +9,10 @@
9 .h8300s 9 .h8300s
10#endif 10#endif
11 .text 11 .text
12.global SYMBOL_NAME(abs) 12.global _abs
13 13
14;;; int abs(int n) 14;;; int abs(int n)
15SYMBOL_NAME_LABEL(abs) 15_abs:
16 mov.l er0,er0 16 mov.l er0,er0
17 bpl 1f 17 bpl 1f
18 neg.l er0 18 neg.l er0
diff --git a/arch/h8300/lib/memcpy.S b/arch/h8300/lib/memcpy.S
index fdcbc1ee673c..cad325e2c0e8 100644
--- a/arch/h8300/lib/memcpy.S
+++ b/arch/h8300/lib/memcpy.S
@@ -10,10 +10,10 @@
10#endif 10#endif
11 11
12 .text 12 .text
13.global SYMBOL_NAME(memcpy) 13.global _memcpy
14 14
15;;; void *memcpy(void *to, void *from, size_t n) 15;;; void *memcpy(void *to, void *from, size_t n)
16SYMBOL_NAME_LABEL(memcpy) 16_memcpy:
17 mov.l er2,er2 17 mov.l er2,er2
18 bne 1f 18 bne 1f
19 rts 19 rts
diff --git a/arch/h8300/lib/memset.S b/arch/h8300/lib/memset.S
index 59abdf9485a5..4549a64c5b79 100644
--- a/arch/h8300/lib/memset.S
+++ b/arch/h8300/lib/memset.S
@@ -10,13 +10,13 @@
10#endif 10#endif
11 .text 11 .text
12 12
13.global SYMBOL_NAME(memset) 13.global _memset
14 14
15;;void *memset(*ptr, int c, size_t count) 15;;void *memset(*ptr, int c, size_t count)
16;; ptr = er0 16;; ptr = er0
17;; c = er1(r1l) 17;; c = er1(r1l)
18;; count = er2 18;; count = er2
19SYMBOL_NAME_LABEL(memset) 19_memset:
20 btst #0,r0l 20 btst #0,r0l
21 beq 2f 21 beq 2f
22 22
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index ff349d70a29b..6c1251e491af 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -121,47 +121,27 @@ void __init paging_init(void)
121 121
122void __init mem_init(void) 122void __init mem_init(void)
123{ 123{
124 int codek = 0, datak = 0, initk = 0; 124 unsigned long codesize = _etext - _stext;
125 /* DAVIDM look at setup memory map generically with reserved area */
126 unsigned long tmp;
127 extern unsigned long _ramend, _ramstart;
128 unsigned long len = &_ramend - &_ramstart;
129 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
130 unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */
131 125
132#ifdef DEBUG 126 pr_devel("Mem_init: start=%lx, end=%lx\n", memory_start, memory_end);
133 printk(KERN_DEBUG "Mem_init: start=%lx, end=%lx\n", start_mem, end_mem);
134#endif
135 127
136 end_mem &= PAGE_MASK; 128 high_memory = (void *) (memory_end & PAGE_MASK);
137 high_memory = (void *) end_mem; 129 max_mapnr = MAP_NR(high_memory);
138
139 start_mem = PAGE_ALIGN(start_mem);
140 max_mapnr = num_physpages = MAP_NR(high_memory);
141 130
142 /* this will put all low memory onto the freelists */ 131 /* this will put all low memory onto the freelists */
143 totalram_pages = free_all_bootmem(); 132 free_all_bootmem();
144 133
145 codek = (_etext - _stext) >> 10; 134 mem_init_print_info(NULL);
146 datak = (__bss_stop - _sdata) >> 10; 135 if (rom_length > 0 && rom_length > codesize)
147 initk = (__init_begin - __init_end) >> 10; 136 pr_info("Memory available: %luK/%luK ROM\n",
148 137 (rom_length - codesize) >> 10, rom_length >> 10);
149 tmp = nr_free_pages() << PAGE_SHIFT;
150 printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n",
151 tmp >> 10,
152 len >> 10,
153 (rom_length > 0) ? ((rom_length >> 10) - codek) : 0,
154 rom_length >> 10,
155 codek,
156 datak
157 );
158} 138}
159 139
160 140
161#ifdef CONFIG_BLK_DEV_INITRD 141#ifdef CONFIG_BLK_DEV_INITRD
162void free_initrd_mem(unsigned long start, unsigned long end) 142void free_initrd_mem(unsigned long start, unsigned long end)
163{ 143{
164 free_reserved_area(start, end, 0, "initrd"); 144 free_reserved_area((void *)start, (void *)end, -1, "initrd");
165} 145}
166#endif 146#endif
167 147
@@ -169,7 +149,7 @@ void
169free_initmem(void) 149free_initmem(void)
170{ 150{
171#ifdef CONFIG_RAMKERNEL 151#ifdef CONFIG_RAMKERNEL
172 free_initmem_default(0); 152 free_initmem_default(-1);
173#endif 153#endif
174} 154}
175 155
diff --git a/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S b/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
index ecaeb31ae9a4..b2ad0f2d0417 100644
--- a/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
+++ b/arch/h8300/platform/h8300h/aki3068net/crt0_ram.S
@@ -22,10 +22,10 @@
22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS 22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
23#endif 23#endif
24 24
25 .global SYMBOL_NAME(_start) 25 .global __start
26 .global SYMBOL_NAME(command_line) 26 .global _command_line
27 .global SYMBOL_NAME(_platform_gpio_table) 27 .global __platform_gpio_table
28 .global SYMBOL_NAME(_target_name) 28 .global __target_name
29 29
30 .h8300h 30 .h8300h
31 31
@@ -33,7 +33,7 @@
33 .file "crt0_ram.S" 33 .file "crt0_ram.S"
34 34
35 /* CPU Reset entry */ 35 /* CPU Reset entry */
36SYMBOL_NAME_LABEL(_start) 36__start:
37 mov.l #RAMEND,sp 37 mov.l #RAMEND,sp
38 ldc #0x80,ccr 38 ldc #0x80,ccr
39 39
@@ -59,13 +59,13 @@ SYMBOL_NAME_LABEL(_start)
59 59
60 /* copy kernel commandline */ 60 /* copy kernel commandline */
61 mov.l #COMMAND_START,er5 61 mov.l #COMMAND_START,er5
62 mov.l #SYMBOL_NAME(command_line),er6 62 mov.l #_command_line,er6
63 mov.w #512,r4 63 mov.w #512,r4
64 eepmov.w 64 eepmov.w
65 65
66 /* uClinux kernel start */ 66 /* uClinux kernel start */
67 ldc #0x90,ccr /* running kernel */ 67 ldc #0x90,ccr /* running kernel */
68 mov.l #SYMBOL_NAME(init_thread_union),sp 68 mov.l #_init_thread_union,sp
69 add.l #0x2000,sp 69 add.l #0x2000,sp
70 jsr @_start_kernel 70 jsr @_start_kernel
71_exit: 71_exit:
@@ -107,4 +107,4 @@ __target_name:
107 .asciz "AE-3068" 107 .asciz "AE-3068"
108 108
109 .section .bootvec,"ax" 109 .section .bootvec,"ax"
110 jmp @SYMBOL_NAME(_start) 110 jmp @__start
diff --git a/arch/h8300/platform/h8300h/generic/crt0_ram.S b/arch/h8300/platform/h8300h/generic/crt0_ram.S
index 80d0e16a4499..5ab7d9c12910 100644
--- a/arch/h8300/platform/h8300h/generic/crt0_ram.S
+++ b/arch/h8300/platform/h8300h/generic/crt0_ram.S
@@ -22,10 +22,10 @@
22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS 22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
23#endif 23#endif
24 24
25 .global SYMBOL_NAME(_start) 25 .global __start
26 .global SYMBOL_NAME(command_line) 26 .global _command_line
27 .global SYMBOL_NAME(_platform_gpio_table) 27 .global __platform_gpio_table
28 .global SYMBOL_NAME(_target_name) 28 .global __target_name
29 29
30 .h8300h 30 .h8300h
31 31
@@ -33,7 +33,7 @@
33 .file "crt0_ram.S" 33 .file "crt0_ram.S"
34 34
35 /* CPU Reset entry */ 35 /* CPU Reset entry */
36SYMBOL_NAME_LABEL(_start) 36__start:
37 mov.l #RAMEND,sp 37 mov.l #RAMEND,sp
38 ldc #0x80,ccr 38 ldc #0x80,ccr
39 39
@@ -59,13 +59,13 @@ SYMBOL_NAME_LABEL(_start)
59 59
60 /* copy kernel commandline */ 60 /* copy kernel commandline */
61 mov.l #COMMAND_START,er5 61 mov.l #COMMAND_START,er5
62 mov.l #SYMBOL_NAME(command_line),er6 62 mov.l #_command_line,er6
63 mov.w #512,r4 63 mov.w #512,r4
64 eepmov.w 64 eepmov.w
65 65
66 /* uClinux kernel start */ 66 /* uClinux kernel start */
67 ldc #0x90,ccr /* running kernel */ 67 ldc #0x90,ccr /* running kernel */
68 mov.l #SYMBOL_NAME(init_thread_union),sp 68 mov.l #_init_thread_union,sp
69 add.l #0x2000,sp 69 add.l #0x2000,sp
70 jsr @_start_kernel 70 jsr @_start_kernel
71_exit: 71_exit:
diff --git a/arch/h8300/platform/h8300h/generic/crt0_rom.S b/arch/h8300/platform/h8300h/generic/crt0_rom.S
index 120add7ca832..dda1dfa15a5e 100644
--- a/arch/h8300/platform/h8300h/generic/crt0_rom.S
+++ b/arch/h8300/platform/h8300h/generic/crt0_rom.S
@@ -12,17 +12,17 @@
12 12
13#include <asm/linkage.h> 13#include <asm/linkage.h>
14 14
15 .global SYMBOL_NAME(_start) 15 .global __start
16 .global SYMBOL_NAME(_command_line) 16 .global __command_line
17 .global SYMBOL_NAME(_platform_gpio_table) 17 .global __platform_gpio_table
18 .global SYMBOL_NAME(_target_name) 18 .global __target_name
19 19
20 .h8300h 20 .h8300h
21 .section .text 21 .section .text
22 .file "crt0_rom.S" 22 .file "crt0_rom.S"
23 23
24 /* CPU Reset entry */ 24 /* CPU Reset entry */
25SYMBOL_NAME_LABEL(_start) 25__start:
26 mov.l #__ramend,sp 26 mov.l #__ramend,sp
27 ldc #0x80,ccr 27 ldc #0x80,ccr
28 28
@@ -60,13 +60,13 @@ SYMBOL_NAME_LABEL(_start)
60 60
61 /* copy kernel commandline */ 61 /* copy kernel commandline */
62 mov.l #COMMAND_START,er5 62 mov.l #COMMAND_START,er5
63 mov.l #SYMBOL_NAME(_command_line),er6 63 mov.l #__command_line,er6
64 mov.w #512,r4 64 mov.w #512,r4
65 eepmov.w 65 eepmov.w
66 66
67 /* linux kernel start */ 67 /* linux kernel start */
68 ldc #0x90,ccr /* running kernel */ 68 ldc #0x90,ccr /* running kernel */
69 mov.l #SYMBOL_NAME(init_thread_union),sp 69 mov.l #_init_thread_union,sp
70 add.l #0x2000,sp 70 add.l #0x2000,sp
71 jsr @_start_kernel 71 jsr @_start_kernel
72_exit: 72_exit:
diff --git a/arch/h8300/platform/h8300h/h8max/crt0_ram.S b/arch/h8300/platform/h8300h/h8max/crt0_ram.S
index efcbefb91b67..6a0d4e2d9ec6 100644
--- a/arch/h8300/platform/h8300h/h8max/crt0_ram.S
+++ b/arch/h8300/platform/h8300h/h8max/crt0_ram.S
@@ -22,10 +22,10 @@
22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS 22#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
23#endif 23#endif
24 24
25 .global SYMBOL_NAME(_start) 25 .global __start
26 .global SYMBOL_NAME(command_line) 26 .global _command_line
27 .global SYMBOL_NAME(_platform_gpio_table) 27 .global __platform_gpio_table
28 .global SYMBOL_NAME(_target_name) 28 .global __target_name
29 29
30 .h8300h 30 .h8300h
31 31
@@ -33,7 +33,7 @@
33 .file "crt0_ram.S" 33 .file "crt0_ram.S"
34 34
35 /* CPU Reset entry */ 35 /* CPU Reset entry */
36SYMBOL_NAME_LABEL(_start) 36__start:
37 mov.l #RAMEND,sp 37 mov.l #RAMEND,sp
38 ldc #0x80,ccr 38 ldc #0x80,ccr
39 39
@@ -59,13 +59,13 @@ SYMBOL_NAME_LABEL(_start)
59 59
60 /* copy kernel commandline */ 60 /* copy kernel commandline */
61 mov.l #COMMAND_START,er5 61 mov.l #COMMAND_START,er5
62 mov.l #SYMBOL_NAME(command_line),er6 62 mov.l #_command_line,er6
63 mov.w #512,r4 63 mov.w #512,r4
64 eepmov.w 64 eepmov.w
65 65
66 /* uClinux kernel start */ 66 /* uClinux kernel start */
67 ldc #0x90,ccr /* running kernel */ 67 ldc #0x90,ccr /* running kernel */
68 mov.l #SYMBOL_NAME(init_thread_union),sp 68 mov.l #_init_thread_union,sp
69 add.l #0x2000,sp 69 add.l #0x2000,sp
70 jsr @_start_kernel 70 jsr @_start_kernel
71_exit: 71_exit:
@@ -107,4 +107,4 @@ __target_name:
107 .asciz "H8MAX" 107 .asciz "H8MAX"
108 108
109 .section .bootvec,"ax" 109 .section .bootvec,"ax"
110 jmp @SYMBOL_NAME(_start) 110 jmp @__start
diff --git a/arch/h8300/platform/h8s/edosk2674/crt0_ram.S b/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
index d12b0debe478..5ed191b37cde 100644
--- a/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
+++ b/arch/h8300/platform/h8s/edosk2674/crt0_ram.S
@@ -23,10 +23,10 @@
23#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS 23#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
24#endif 24#endif
25 25
26 .global SYMBOL_NAME(_start) 26 .global __start
27 .global SYMBOL_NAME(_command_line) 27 .global __command_line
28 .global SYMBOL_NAME(_platform_gpio_table) 28 .global __platform_gpio_table
29 .global SYMBOL_NAME(_target_name) 29 .global __target_name
30 30
31 .h8300s 31 .h8300s
32 32
@@ -34,7 +34,7 @@
34 .file "crt0_ram.S" 34 .file "crt0_ram.S"
35 35
36 /* CPU Reset entry */ 36 /* CPU Reset entry */
37SYMBOL_NAME_LABEL(_start) 37__start:
38 mov.l #RAMEND,sp 38 mov.l #RAMEND,sp
39 ldc #0x80,ccr 39 ldc #0x80,ccr
40 ldc #0x00,exr 40 ldc #0x00,exr
@@ -66,13 +66,13 @@ SYMBOL_NAME_LABEL(_start)
66 66
67 /* copy kernel commandline */ 67 /* copy kernel commandline */
68 mov.l #COMMAND_START,er5 68 mov.l #COMMAND_START,er5
69 mov.l #SYMBOL_NAME(command_line),er6 69 mov.l #_command_line,er6
70 mov.w #512,r4 70 mov.w #512,r4
71 eepmov.w 71 eepmov.w
72 72
73 /* uClinux kernel start */ 73 /* uClinux kernel start */
74 ldc #0x90,ccr /* running kernel */ 74 ldc #0x90,ccr /* running kernel */
75 mov.l #SYMBOL_NAME(init_thread_union),sp 75 mov.l #_init_thread_union,sp
76 add.l #0x2000,sp 76 add.l #0x2000,sp
77 jsr @_start_kernel 77 jsr @_start_kernel
78_exit: 78_exit:
@@ -127,4 +127,4 @@ __target_name:
127 .asciz "EDOSK-2674" 127 .asciz "EDOSK-2674"
128 128
129 .section .bootvec,"ax" 129 .section .bootvec,"ax"
130 jmp @SYMBOL_NAME(_start) 130 jmp @__start
diff --git a/arch/h8300/platform/h8s/edosk2674/crt0_rom.S b/arch/h8300/platform/h8s/edosk2674/crt0_rom.S
index c03d23c6fe12..06d1d7f324ca 100644
--- a/arch/h8300/platform/h8s/edosk2674/crt0_rom.S
+++ b/arch/h8300/platform/h8s/edosk2674/crt0_rom.S
@@ -13,17 +13,17 @@
13#include <asm/linkage.h> 13#include <asm/linkage.h>
14#include <asm/regs267x.h> 14#include <asm/regs267x.h>
15 15
16 .global SYMBOL_NAME(_start) 16 .global __start
17 .global SYMBOL_NAME(_command_line) 17 .global __command_line
18 .global SYMBOL_NAME(_platform_gpio_table) 18 .global __platform_gpio_table
19 .global SYMBOL_NAME(_target_name) 19 .global __target_name
20 20
21 .h8300s 21 .h8300s
22 .section .text 22 .section .text
23 .file "crt0_rom.S" 23 .file "crt0_rom.S"
24 24
25 /* CPU Reset entry */ 25 /* CPU Reset entry */
26SYMBOL_NAME_LABEL(_start) 26__start:
27 mov.l #__ramend,sp 27 mov.l #__ramend,sp
28 ldc #0x80,ccr 28 ldc #0x80,ccr
29 ldc #0,exr 29 ldc #0,exr
@@ -82,13 +82,13 @@ SYMBOL_NAME_LABEL(_start)
82 82
83 /* copy kernel commandline */ 83 /* copy kernel commandline */
84 mov.l #COMMAND_START,er5 84 mov.l #COMMAND_START,er5
85 mov.l #SYMBOL_NAME(_command_line),er6 85 mov.l #__command_line,er6
86 mov.w #512,r4 86 mov.w #512,r4
87 eepmov.w 87 eepmov.w
88 88
89 /* linux kernel start */ 89 /* linux kernel start */
90 ldc #0x90,ccr /* running kernel */ 90 ldc #0x90,ccr /* running kernel */
91 mov.l #SYMBOL_NAME(init_thread_union),sp 91 mov.l #_init_thread_union,sp
92 add.l #0x2000,sp 92 add.l #0x2000,sp
93 jsr @_start_kernel 93 jsr @_start_kernel
94_exit: 94_exit:
diff --git a/arch/h8300/platform/h8s/generic/crt0_ram.S b/arch/h8300/platform/h8s/generic/crt0_ram.S
index b04541069976..7018915de74f 100644
--- a/arch/h8300/platform/h8s/generic/crt0_ram.S
+++ b/arch/h8300/platform/h8s/generic/crt0_ram.S
@@ -23,10 +23,10 @@
23#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS 23#define RAMEND CONFIG_BLKDEV_RESERVE_ADDRESS
24#endif 24#endif
25 25
26 .global SYMBOL_NAME(_start) 26 .global __start
27 .global SYMBOL_NAME(_command_line) 27 .global __command_line
28 .global SYMBOL_NAME(_platform_gpio_table) 28 .global __platform_gpio_table
29 .global SYMBOL_NAME(_target_name) 29 .global __target_name
30 30
31 .h8300s 31 .h8300s
32 32
@@ -34,7 +34,7 @@
34 .file "crt0_ram.S" 34 .file "crt0_ram.S"
35 35
36 /* CPU Reset entry */ 36 /* CPU Reset entry */
37SYMBOL_NAME_LABEL(_start) 37__start:
38 mov.l #RAMEND,sp 38 mov.l #RAMEND,sp
39 ldc #0x80,ccr 39 ldc #0x80,ccr
40 ldc #0x00,exr 40 ldc #0x00,exr
@@ -63,13 +63,13 @@ SYMBOL_NAME_LABEL(_start)
63 63
64 /* copy kernel commandline */ 64 /* copy kernel commandline */
65 mov.l #COMMAND_START,er5 65 mov.l #COMMAND_START,er5
66 mov.l #SYMBOL_NAME(command_line),er6 66 mov.l #_command_line,er6
67 mov.w #512,r4 67 mov.w #512,r4
68 eepmov.w 68 eepmov.w
69 69
70 /* uClinux kernel start */ 70 /* uClinux kernel start */
71 ldc #0x90,ccr /* running kernel */ 71 ldc #0x90,ccr /* running kernel */
72 mov.l #SYMBOL_NAME(init_thread_union),sp 72 mov.l #_init_thread_union,sp
73 add.l #0x2000,sp 73 add.l #0x2000,sp
74 jsr @_start_kernel 74 jsr @_start_kernel
75_exit: 75_exit:
@@ -124,4 +124,4 @@ __target_name:
124 .asciz "generic" 124 .asciz "generic"
125 125
126 .section .bootvec,"ax" 126 .section .bootvec,"ax"
127 jmp @SYMBOL_NAME(_start) 127 jmp @__start
diff --git a/arch/h8300/platform/h8s/generic/crt0_rom.S b/arch/h8300/platform/h8s/generic/crt0_rom.S
index 95b6f2898f52..623ba7828193 100644
--- a/arch/h8300/platform/h8s/generic/crt0_rom.S
+++ b/arch/h8300/platform/h8s/generic/crt0_rom.S
@@ -13,17 +13,17 @@
13#include <asm/linkage.h> 13#include <asm/linkage.h>
14#include <asm/regs267x.h> 14#include <asm/regs267x.h>
15 15
16 .global SYMBOL_NAME(_start) 16 .global __start
17 .global SYMBOL_NAME(_command_line) 17 .global __command_line
18 .global SYMBOL_NAME(_platform_gpio_table) 18 .global __platform_gpio_table
19 .global SYMBOL_NAME(_target_name) 19 .global __target_name
20 20
21 .h8300s 21 .h8300s
22 .section .text 22 .section .text
23 .file "crt0_rom.S" 23 .file "crt0_rom.S"
24 24
25 /* CPU Reset entry */ 25 /* CPU Reset entry */
26SYMBOL_NAME_LABEL(_start) 26__start:
27 mov.l #__ramend,sp 27 mov.l #__ramend,sp
28 ldc #0x80,ccr 28 ldc #0x80,ccr
29 ldc #0,exr 29 ldc #0,exr
@@ -61,7 +61,7 @@ SYMBOL_NAME_LABEL(_start)
61 61
62 /* linux kernel start */ 62 /* linux kernel start */
63 ldc #0x90,ccr /* running kernel */ 63 ldc #0x90,ccr /* running kernel */
64 mov.l #SYMBOL_NAME(init_thread_union),sp 64 mov.l #_init_thread_union,sp
65 add.l #0x2000,sp 65 add.l #0x2000,sp
66 jsr @_start_kernel 66 jsr @_start_kernel
67_exit: 67_exit:
diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h
index 20d55f69fe55..d8bd54fa431e 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -452,10 +452,6 @@ static inline int pte_exec(pte_t pte)
452 452
453#define __pte_offset(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 453#define __pte_offset(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
454 454
455/* Nothing special about IO remapping at this point */
456#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
457 remap_pfn_range(vma, vaddr, pfn, size, prot)
458
459/* I think this is in case we have page table caches; needed by init/main.c */ 455/* I think this is in case we have page table caches; needed by init/main.c */
460#define pgtable_cache_init() do { } while (0) 456#define pgtable_cache_init() do { } while (0)
461 457
diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c
index 2561d259a296..88977e42af0a 100644
--- a/arch/hexagon/mm/init.c
+++ b/arch/hexagon/mm/init.c
@@ -70,10 +70,8 @@ unsigned long long kmap_generation;
70void __init mem_init(void) 70void __init mem_init(void)
71{ 71{
72 /* No idea where this is actually declared. Seems to evade LXR. */ 72 /* No idea where this is actually declared. Seems to evade LXR. */
73 totalram_pages += free_all_bootmem(); 73 free_all_bootmem();
74 num_physpages = bootmem_lastpg-ARCH_PFN_OFFSET; 74 mem_init_print_info(NULL);
75
76 printk(KERN_INFO "totalram_pages = %ld\n", totalram_pages);
77 75
78 /* 76 /*
79 * To-Do: someone somewhere should wipe out the bootmem map 77 * To-Do: someone somewhere should wipe out the bootmem map
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 1a2b7749b047..5a768ad8e893 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -376,7 +376,6 @@ config NR_CPUS
376config HOTPLUG_CPU 376config HOTPLUG_CPU
377 bool "Support for hot-pluggable CPUs" 377 bool "Support for hot-pluggable CPUs"
378 depends on SMP 378 depends on SMP
379 select HOTPLUG
380 default n 379 default n
381 ---help--- 380 ---help---
382 Say Y here to experiment with turning CPUs off and on. CPUs 381 Say Y here to experiment with turning CPUs off and on. CPUs
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index bcda5b2d121a..d43daf192b21 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -2042,7 +2042,8 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2042#endif 2042#endif
2043 2043
2044static int __init 2044static int __init
2045acpi_sba_ioc_add(struct acpi_device *device) 2045acpi_sba_ioc_add(struct acpi_device *device,
2046 const struct acpi_device_id *not_used)
2046{ 2047{
2047 struct ioc *ioc; 2048 struct ioc *ioc;
2048 acpi_status status; 2049 acpi_status status;
@@ -2090,14 +2091,18 @@ static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
2090 {"HWP0004", 0}, 2091 {"HWP0004", 0},
2091 {"", 0}, 2092 {"", 0},
2092}; 2093};
2093static struct acpi_driver acpi_sba_ioc_driver = { 2094static struct acpi_scan_handler acpi_sba_ioc_handler = {
2094 .name = "IOC IOMMU Driver", 2095 .ids = hp_ioc_iommu_device_ids,
2095 .ids = hp_ioc_iommu_device_ids, 2096 .attach = acpi_sba_ioc_add,
2096 .ops = {
2097 .add = acpi_sba_ioc_add,
2098 },
2099}; 2097};
2100 2098
2099static int __init acpi_sba_ioc_init_acpi(void)
2100{
2101 return acpi_scan_add_handler(&acpi_sba_ioc_handler);
2102}
2103/* This has to run before acpi_scan_init(). */
2104arch_initcall(acpi_sba_ioc_init_acpi);
2105
2101extern struct dma_map_ops swiotlb_dma_ops; 2106extern struct dma_map_ops swiotlb_dma_ops;
2102 2107
2103static int __init 2108static int __init
@@ -2122,7 +2127,10 @@ sba_init(void)
2122 } 2127 }
2123#endif 2128#endif
2124 2129
2125 acpi_bus_register_driver(&acpi_sba_ioc_driver); 2130 /*
2131 * ioc_list should be populated by the acpi_sba_ioc_handler's .attach()
2132 * routine, but that only happens if acpi_scan_init() has already run.
2133 */
2126 if (!ioc_list) { 2134 if (!ioc_list) {
2127#ifdef CONFIG_IA64_GENERIC 2135#ifdef CONFIG_IA64_GENERIC
2128 /* 2136 /*
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index 331de723c676..3a428f19a001 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -88,8 +88,8 @@ simscsi_setup (char *s)
88 if (strlen(s) > MAX_ROOT_LEN) { 88 if (strlen(s) > MAX_ROOT_LEN) {
89 printk(KERN_ERR "simscsi_setup: prefix too long---using default %s\n", 89 printk(KERN_ERR "simscsi_setup: prefix too long---using default %s\n",
90 simscsi_root); 90 simscsi_root);
91 } 91 } else
92 simscsi_root = s; 92 simscsi_root = s;
93 return 1; 93 return 1;
94} 94}
95 95
diff --git a/arch/ia64/include/asm/irqflags.h b/arch/ia64/include/asm/irqflags.h
index 1bf2cf2f4ab4..cec6c06b52c0 100644
--- a/arch/ia64/include/asm/irqflags.h
+++ b/arch/ia64/include/asm/irqflags.h
@@ -11,6 +11,7 @@
11#define _ASM_IA64_IRQFLAGS_H 11#define _ASM_IA64_IRQFLAGS_H
12 12
13#include <asm/pal.h> 13#include <asm/pal.h>
14#include <asm/kregs.h>
14 15
15#ifdef CONFIG_IA64_DEBUG_IRQ 16#ifdef CONFIG_IA64_DEBUG_IRQ
16extern unsigned long last_cli_ip; 17extern unsigned long last_cli_ip;
diff --git a/arch/ia64/include/asm/mutex.h b/arch/ia64/include/asm/mutex.h
index bed73a643a56..f41e66d65e31 100644
--- a/arch/ia64/include/asm/mutex.h
+++ b/arch/ia64/include/asm/mutex.h
@@ -29,17 +29,15 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
29 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 29 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
30 * from 1 to a 0 value 30 * from 1 to a 0 value
31 * @count: pointer of type atomic_t 31 * @count: pointer of type atomic_t
32 * @fail_fn: function to call if the original value was not 1
33 * 32 *
34 * Change the count from 1 to a value lower than 1, and call <fail_fn> if 33 * Change the count from 1 to a value lower than 1. This function returns 0
35 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds, 34 * if the fastpath succeeds, or -1 otherwise.
36 * or anything the slow path function returns.
37 */ 35 */
38static inline int 36static inline int
39__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 37__mutex_fastpath_lock_retval(atomic_t *count)
40{ 38{
41 if (unlikely(ia64_fetchadd4_acq(count, -1) != 1)) 39 if (unlikely(ia64_fetchadd4_acq(count, -1) != 1))
42 return fail_fn(count); 40 return -1;
43 return 0; 41 return 0;
44} 42}
45 43
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 5e04b591e423..80775f55f03f 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -89,9 +89,9 @@ extern int pci_mmap_legacy_page_range(struct pci_bus *bus,
89#define pci_legacy_read platform_pci_legacy_read 89#define pci_legacy_read platform_pci_legacy_read
90#define pci_legacy_write platform_pci_legacy_write 90#define pci_legacy_write platform_pci_legacy_write
91 91
92struct pci_window { 92struct iospace_resource {
93 struct resource resource; 93 struct list_head list;
94 u64 offset; 94 struct resource res;
95}; 95};
96 96
97struct pci_controller { 97struct pci_controller {
@@ -100,12 +100,10 @@ struct pci_controller {
100 int segment; 100 int segment;
101 int node; /* nearest node with memory or -1 for global allocation */ 101 int node; /* nearest node with memory or -1 for global allocation */
102 102
103 unsigned int windows;
104 struct pci_window *window;
105
106 void *platform_data; 103 void *platform_data;
107}; 104};
108 105
106
109#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata) 107#define PCI_CONTROLLER(busdev) ((struct pci_controller *) busdev->sysdata)
110#define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment) 108#define pci_domain_nr(busdev) (PCI_CONTROLLER(busdev)->segment)
111 109
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index 815810cbbedc..7935115398a6 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -493,9 +493,6 @@ extern void paging_init (void);
493#define pte_to_pgoff(pte) ((pte_val(pte) << 1) >> 3) 493#define pte_to_pgoff(pte) ((pte_val(pte) << 1) >> 3)
494#define pgoff_to_pte(off) ((pte_t) { ((off) << 2) | _PAGE_FILE }) 494#define pgoff_to_pte(off) ((pte_t) { ((off) << 2) | _PAGE_FILE })
495 495
496#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
497 remap_pfn_range(vma, vaddr, pfn, size, prot)
498
499/* 496/*
500 * ZERO_PAGE is a global shared page that is always zero: used 497 * ZERO_PAGE is a global shared page that is always zero: used
501 * for zero-mapped memory areas etc.. 498 * for zero-mapped memory areas etc..
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 335eb07480fe..5eb71d22c3d5 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -807,7 +807,7 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
807 * ACPI based hotplug CPU support 807 * ACPI based hotplug CPU support
808 */ 808 */
809#ifdef CONFIG_ACPI_HOTPLUG_CPU 809#ifdef CONFIG_ACPI_HOTPLUG_CPU
810static __cpuinit 810static
811int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) 811int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
812{ 812{
813#ifdef CONFIG_ACPI_NUMA 813#ifdef CONFIG_ACPI_NUMA
@@ -882,7 +882,7 @@ __init void prefill_possible_map(void)
882 set_cpu_possible(i, true); 882 set_cpu_possible(i, true);
883} 883}
884 884
885static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) 885static int _acpi_map_lsapic(acpi_handle handle, int *pcpu)
886{ 886{
887 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 887 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
888 union acpi_object *obj; 888 union acpi_object *obj;
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f034563aeae5..51bce594eb83 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1116,11 +1116,6 @@ efi_memmap_init(u64 *s, u64 *e)
1116 if (!is_memory_available(md)) 1116 if (!is_memory_available(md))
1117 continue; 1117 continue;
1118 1118
1119#ifdef CONFIG_CRASH_DUMP
1120 /* saved_max_pfn should ignore max_addr= command line arg */
1121 if (saved_max_pfn < (efi_md_end(md) >> PAGE_SHIFT))
1122 saved_max_pfn = (efi_md_end(md) >> PAGE_SHIFT);
1123#endif
1124 /* 1119 /*
1125 * Round ends inward to granule boundaries 1120 * Round ends inward to granule boundaries
1126 * Give trimmings to uncached allocator 1121 * Give trimmings to uncached allocator
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 2d67317a1ec2..f59c0b844e88 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -225,17 +225,17 @@ static struct attribute_group err_inject_attr_group = {
225 .name = "err_inject" 225 .name = "err_inject"
226}; 226};
227/* Add/Remove err_inject interface for CPU device */ 227/* Add/Remove err_inject interface for CPU device */
228static int __cpuinit err_inject_add_dev(struct device * sys_dev) 228static int err_inject_add_dev(struct device *sys_dev)
229{ 229{
230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); 230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);
231} 231}
232 232
233static int __cpuinit err_inject_remove_dev(struct device * sys_dev) 233static int err_inject_remove_dev(struct device *sys_dev)
234{ 234{
235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
236 return 0; 236 return 0;
237} 237}
238static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb, 238static int err_inject_cpu_callback(struct notifier_block *nfb,
239 unsigned long action, void *hcpu) 239 unsigned long action, void *hcpu)
240{ 240{
241 unsigned int cpu = (unsigned long)hcpu; 241 unsigned int cpu = (unsigned long)hcpu;
@@ -256,7 +256,7 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,
256 return NOTIFY_OK; 256 return NOTIFY_OK;
257} 257}
258 258
259static struct notifier_block __cpuinitdata err_inject_cpu_notifier = 259static struct notifier_block err_inject_cpu_notifier =
260{ 260{
261 .notifier_call = err_inject_cpu_callback, 261 .notifier_call = err_inject_cpu_callback,
262}; 262};
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 9be4e497f3d3..991ca336b8a2 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1035,7 +1035,7 @@ END(ia64_delay_loop)
1035 * Return a CPU-local timestamp in nano-seconds. This timestamp is 1035 * Return a CPU-local timestamp in nano-seconds. This timestamp is
1036 * NOT synchronized across CPUs its return value must never be 1036 * NOT synchronized across CPUs its return value must never be
1037 * compared against the values returned on another CPU. The usage in 1037 * compared against the values returned on another CPU. The usage in
1038 * kernel/sched.c ensures that. 1038 * kernel/sched/core.c ensures that.
1039 * 1039 *
1040 * The return-value of sched_clock() is NOT supposed to wrap-around. 1040 * The return-value of sched_clock() is NOT supposed to wrap-around.
1041 * If it did, it would cause some scheduling hiccups (at the worst). 1041 * If it did, it would cause some scheduling hiccups (at the worst).
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index d7396dbb07bb..b8edfa75a83f 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -631,7 +631,7 @@ ia64_mca_register_cpev (int cpev)
631 * Outputs 631 * Outputs
632 * None 632 * None
633 */ 633 */
634void __cpuinit 634void
635ia64_mca_cmc_vector_setup (void) 635ia64_mca_cmc_vector_setup (void)
636{ 636{
637 cmcv_reg_t cmcv; 637 cmcv_reg_t cmcv;
@@ -1814,7 +1814,7 @@ static struct irqaction mca_cpep_irqaction = {
1814 * format most of the fields. 1814 * format most of the fields.
1815 */ 1815 */
1816 1816
1817static void __cpuinit 1817static void
1818format_mca_init_stack(void *mca_data, unsigned long offset, 1818format_mca_init_stack(void *mca_data, unsigned long offset,
1819 const char *type, int cpu) 1819 const char *type, int cpu)
1820{ 1820{
@@ -1844,7 +1844,7 @@ static void * __init_refok mca_bootmem(void)
1844} 1844}
1845 1845
1846/* Do per-CPU MCA-related initialization. */ 1846/* Do per-CPU MCA-related initialization. */
1847void __cpuinit 1847void
1848ia64_mca_cpu_init(void *cpu_data) 1848ia64_mca_cpu_init(void *cpu_data)
1849{ 1849{
1850 void *pal_vaddr; 1850 void *pal_vaddr;
@@ -1896,7 +1896,7 @@ ia64_mca_cpu_init(void *cpu_data)
1896 PAGE_KERNEL)); 1896 PAGE_KERNEL));
1897} 1897}
1898 1898
1899static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy) 1899static void ia64_mca_cmc_vector_adjust(void *dummy)
1900{ 1900{
1901 unsigned long flags; 1901 unsigned long flags;
1902 1902
@@ -1906,7 +1906,7 @@ static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy)
1906 local_irq_restore(flags); 1906 local_irq_restore(flags);
1907} 1907}
1908 1908
1909static int __cpuinit mca_cpu_callback(struct notifier_block *nfb, 1909static int mca_cpu_callback(struct notifier_block *nfb,
1910 unsigned long action, 1910 unsigned long action,
1911 void *hcpu) 1911 void *hcpu)
1912{ 1912{
@@ -1922,7 +1922,7 @@ static int __cpuinit mca_cpu_callback(struct notifier_block *nfb,
1922 return NOTIFY_OK; 1922 return NOTIFY_OK;
1923} 1923}
1924 1924
1925static struct notifier_block mca_cpu_notifier __cpuinitdata = { 1925static struct notifier_block mca_cpu_notifier = {
1926 .notifier_call = mca_cpu_callback 1926 .notifier_call = mca_cpu_callback
1927}; 1927};
1928 1928
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index c93420c97409..d288cde93606 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -30,7 +30,7 @@ EXPORT_SYMBOL(cpu_to_node_map);
30cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; 30cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
31EXPORT_SYMBOL(node_to_cpu_mask); 31EXPORT_SYMBOL(node_to_cpu_mask);
32 32
33void __cpuinit map_cpu_to_node(int cpu, int nid) 33void map_cpu_to_node(int cpu, int nid)
34{ 34{
35 int oldnid; 35 int oldnid;
36 if (nid < 0) { /* just initialize by zero */ 36 if (nid < 0) { /* just initialize by zero */
@@ -51,7 +51,7 @@ void __cpuinit map_cpu_to_node(int cpu, int nid)
51 return; 51 return;
52} 52}
53 53
54void __cpuinit unmap_cpu_from_node(int cpu, int nid) 54void unmap_cpu_from_node(int cpu, int nid)
55{ 55{
56 WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid])); 56 WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid]));
57 WARN_ON(cpu_to_node_map[cpu] != nid); 57 WARN_ON(cpu_to_node_map[cpu] != nid);
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 2b3c2d79256f..ab333284f4b2 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -932,7 +932,7 @@ static const struct file_operations proc_palinfo_fops = {
932 .release = single_release, 932 .release = single_release,
933}; 933};
934 934
935static void __cpuinit 935static void
936create_palinfo_proc_entries(unsigned int cpu) 936create_palinfo_proc_entries(unsigned int cpu)
937{ 937{
938 pal_func_cpu_u_t f; 938 pal_func_cpu_u_t f;
@@ -962,7 +962,7 @@ remove_palinfo_proc_entries(unsigned int hcpu)
962 remove_proc_subtree(cpustr, palinfo_dir); 962 remove_proc_subtree(cpustr, palinfo_dir);
963} 963}
964 964
965static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb, 965static int palinfo_cpu_callback(struct notifier_block *nfb,
966 unsigned long action, void *hcpu) 966 unsigned long action, void *hcpu)
967{ 967{
968 unsigned int hotcpu = (unsigned long)hcpu; 968 unsigned int hotcpu = (unsigned long)hcpu;
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 1ddcfe5ef353..992c1098c522 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -33,15 +33,6 @@ int force_iommu __read_mostly;
33 33
34int iommu_pass_through; 34int iommu_pass_through;
35 35
36/* Dummy device used for NULL arguments (normally ISA). Better would
37 be probably a smaller DMA mask, but this is bug-to-bug compatible
38 to i386. */
39struct device fallback_dev = {
40 .init_name = "fallback device",
41 .coherent_dma_mask = DMA_BIT_MASK(32),
42 .dma_mask = &fallback_dev.coherent_dma_mask,
43};
44
45extern struct dma_map_ops intel_dma_ops; 36extern struct dma_map_ops intel_dma_ops;
46 37
47static int __init pci_iommu_init(void) 38static int __init pci_iommu_init(void)
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 9ea25fce06d5..5a9ff1c3c3e9 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -5647,24 +5647,8 @@ pfm_proc_show_header(struct seq_file *m)
5647 5647
5648 list_for_each(pos, &pfm_buffer_fmt_list) { 5648 list_for_each(pos, &pfm_buffer_fmt_list) {
5649 entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list); 5649 entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list);
5650 seq_printf(m, "format : %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x %s\n", 5650 seq_printf(m, "format : %16phD %s\n",
5651 entry->fmt_uuid[0], 5651 entry->fmt_uuid, entry->fmt_name);
5652 entry->fmt_uuid[1],
5653 entry->fmt_uuid[2],
5654 entry->fmt_uuid[3],
5655 entry->fmt_uuid[4],
5656 entry->fmt_uuid[5],
5657 entry->fmt_uuid[6],
5658 entry->fmt_uuid[7],
5659 entry->fmt_uuid[8],
5660 entry->fmt_uuid[9],
5661 entry->fmt_uuid[10],
5662 entry->fmt_uuid[11],
5663 entry->fmt_uuid[12],
5664 entry->fmt_uuid[13],
5665 entry->fmt_uuid[14],
5666 entry->fmt_uuid[15],
5667 entry->fmt_name);
5668 } 5652 }
5669 spin_unlock(&pfm_buffer_fmt_lock); 5653 spin_unlock(&pfm_buffer_fmt_lock);
5670 5654
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 4bc580af67b3..960a396f5929 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -568,7 +568,7 @@ static const struct file_operations salinfo_data_fops = {
568 .llseek = default_llseek, 568 .llseek = default_llseek,
569}; 569};
570 570
571static int __cpuinit 571static int
572salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) 572salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
573{ 573{
574 unsigned int i, cpu = (unsigned long)hcpu; 574 unsigned int i, cpu = (unsigned long)hcpu;
@@ -609,7 +609,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
609 return NOTIFY_OK; 609 return NOTIFY_OK;
610} 610}
611 611
612static struct notifier_block salinfo_cpu_notifier __cpuinitdata = 612static struct notifier_block salinfo_cpu_notifier =
613{ 613{
614 .notifier_call = salinfo_cpu_callback, 614 .notifier_call = salinfo_cpu_callback,
615 .priority = 0, 615 .priority = 0,
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 13bfdd22afc8..4fc2e9569bb2 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -748,7 +748,7 @@ const struct seq_operations cpuinfo_op = {
748#define MAX_BRANDS 8 748#define MAX_BRANDS 8
749static char brandname[MAX_BRANDS][128]; 749static char brandname[MAX_BRANDS][128];
750 750
751static char * __cpuinit 751static char *
752get_model_name(__u8 family, __u8 model) 752get_model_name(__u8 family, __u8 model)
753{ 753{
754 static int overflow; 754 static int overflow;
@@ -778,7 +778,7 @@ get_model_name(__u8 family, __u8 model)
778 return "Unknown"; 778 return "Unknown";
779} 779}
780 780
781static void __cpuinit 781static void
782identify_cpu (struct cpuinfo_ia64 *c) 782identify_cpu (struct cpuinfo_ia64 *c)
783{ 783{
784 union { 784 union {
@@ -850,7 +850,7 @@ identify_cpu (struct cpuinfo_ia64 *c)
850 * 2. the minimum of the i-cache stride sizes for "flush_icache_range()". 850 * 2. the minimum of the i-cache stride sizes for "flush_icache_range()".
851 * 3. the minimum of the cache stride sizes for "clflush_cache_range()". 851 * 3. the minimum of the cache stride sizes for "clflush_cache_range()".
852 */ 852 */
853static void __cpuinit 853static void
854get_cache_info(void) 854get_cache_info(void)
855{ 855{
856 unsigned long line_size, max = 1; 856 unsigned long line_size, max = 1;
@@ -915,10 +915,10 @@ get_cache_info(void)
915 * cpu_init() initializes state that is per-CPU. This function acts 915 * cpu_init() initializes state that is per-CPU. This function acts
916 * as a 'CPU state barrier', nothing should get across. 916 * as a 'CPU state barrier', nothing should get across.
917 */ 917 */
918void __cpuinit 918void
919cpu_init (void) 919cpu_init (void)
920{ 920{
921 extern void __cpuinit ia64_mmu_init (void *); 921 extern void ia64_mmu_init(void *);
922 static unsigned long max_num_phys_stacked = IA64_NUM_PHYS_STACK_REG; 922 static unsigned long max_num_phys_stacked = IA64_NUM_PHYS_STACK_REG;
923 unsigned long num_phys_stacked; 923 unsigned long num_phys_stacked;
924 pal_vm_info_2_u_t vmi; 924 pal_vm_info_2_u_t vmi;
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 8d87168d218d..547a48d78bd7 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -351,7 +351,7 @@ static inline void smp_setup_percpu_timer(void)
351{ 351{
352} 352}
353 353
354static void __cpuinit 354static void
355smp_callin (void) 355smp_callin (void)
356{ 356{
357 int cpuid, phys_id, itc_master; 357 int cpuid, phys_id, itc_master;
@@ -442,7 +442,7 @@ smp_callin (void)
442/* 442/*
443 * Activate a secondary processor. head.S calls this. 443 * Activate a secondary processor. head.S calls this.
444 */ 444 */
445int __cpuinit 445int
446start_secondary (void *unused) 446start_secondary (void *unused)
447{ 447{
448 /* Early console may use I/O ports */ 448 /* Early console may use I/O ports */
@@ -459,7 +459,7 @@ start_secondary (void *unused)
459 return 0; 459 return 0;
460} 460}
461 461
462static int __cpuinit 462static int
463do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) 463do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)
464{ 464{
465 int timeout; 465 int timeout;
@@ -728,7 +728,7 @@ static inline void set_cpu_sibling_map(int cpu)
728 } 728 }
729} 729}
730 730
731int __cpuinit 731int
732__cpu_up(unsigned int cpu, struct task_struct *tidle) 732__cpu_up(unsigned int cpu, struct task_struct *tidle)
733{ 733{
734 int ret; 734 int ret;
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index dc00b2c1b42a..ca69a5a96dcc 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -135,11 +135,11 @@ struct cpu_cache_info {
135 struct kobject kobj; 135 struct kobject kobj;
136}; 136};
137 137
138static struct cpu_cache_info all_cpu_cache_info[NR_CPUS] __cpuinitdata; 138static struct cpu_cache_info all_cpu_cache_info[NR_CPUS];
139#define LEAF_KOBJECT_PTR(x,y) (&all_cpu_cache_info[x].cache_leaves[y]) 139#define LEAF_KOBJECT_PTR(x,y) (&all_cpu_cache_info[x].cache_leaves[y])
140 140
141#ifdef CONFIG_SMP 141#ifdef CONFIG_SMP
142static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu, 142static void cache_shared_cpu_map_setup(unsigned int cpu,
143 struct cache_info * this_leaf) 143 struct cache_info * this_leaf)
144{ 144{
145 pal_cache_shared_info_t csi; 145 pal_cache_shared_info_t csi;
@@ -174,7 +174,7 @@ static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,
174 &csi) == PAL_STATUS_SUCCESS); 174 &csi) == PAL_STATUS_SUCCESS);
175} 175}
176#else 176#else
177static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, 177static void cache_shared_cpu_map_setup(unsigned int cpu,
178 struct cache_info * this_leaf) 178 struct cache_info * this_leaf)
179{ 179{
180 cpu_set(cpu, this_leaf->shared_cpu_map); 180 cpu_set(cpu, this_leaf->shared_cpu_map);
@@ -298,7 +298,7 @@ static struct kobj_type cache_ktype_percpu_entry = {
298 .sysfs_ops = &cache_sysfs_ops, 298 .sysfs_ops = &cache_sysfs_ops,
299}; 299};
300 300
301static void __cpuinit cpu_cache_sysfs_exit(unsigned int cpu) 301static void cpu_cache_sysfs_exit(unsigned int cpu)
302{ 302{
303 kfree(all_cpu_cache_info[cpu].cache_leaves); 303 kfree(all_cpu_cache_info[cpu].cache_leaves);
304 all_cpu_cache_info[cpu].cache_leaves = NULL; 304 all_cpu_cache_info[cpu].cache_leaves = NULL;
@@ -307,7 +307,7 @@ static void __cpuinit cpu_cache_sysfs_exit(unsigned int cpu)
307 return; 307 return;
308} 308}
309 309
310static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu) 310static int cpu_cache_sysfs_init(unsigned int cpu)
311{ 311{
312 unsigned long i, levels, unique_caches; 312 unsigned long i, levels, unique_caches;
313 pal_cache_config_info_t cci; 313 pal_cache_config_info_t cci;
@@ -351,7 +351,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu)
351} 351}
352 352
353/* Add cache interface for CPU device */ 353/* Add cache interface for CPU device */
354static int __cpuinit cache_add_dev(struct device * sys_dev) 354static int cache_add_dev(struct device *sys_dev)
355{ 355{
356 unsigned int cpu = sys_dev->id; 356 unsigned int cpu = sys_dev->id;
357 unsigned long i, j; 357 unsigned long i, j;
@@ -401,7 +401,7 @@ static int __cpuinit cache_add_dev(struct device * sys_dev)
401} 401}
402 402
403/* Remove cache interface for CPU device */ 403/* Remove cache interface for CPU device */
404static int __cpuinit cache_remove_dev(struct device * sys_dev) 404static int cache_remove_dev(struct device *sys_dev)
405{ 405{
406 unsigned int cpu = sys_dev->id; 406 unsigned int cpu = sys_dev->id;
407 unsigned long i; 407 unsigned long i;
@@ -425,7 +425,7 @@ static int __cpuinit cache_remove_dev(struct device * sys_dev)
425 * When a cpu is hot-plugged, do a check and initiate 425 * When a cpu is hot-plugged, do a check and initiate
426 * cache kobject if necessary 426 * cache kobject if necessary
427 */ 427 */
428static int __cpuinit cache_cpu_callback(struct notifier_block *nfb, 428static int cache_cpu_callback(struct notifier_block *nfb,
429 unsigned long action, void *hcpu) 429 unsigned long action, void *hcpu)
430{ 430{
431 unsigned int cpu = (unsigned long)hcpu; 431 unsigned int cpu = (unsigned long)hcpu;
@@ -445,7 +445,7 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
445 return NOTIFY_OK; 445 return NOTIFY_OK;
446} 446}
447 447
448static struct notifier_block __cpuinitdata cache_cpu_notifier = 448static struct notifier_block cache_cpu_notifier =
449{ 449{
450 .notifier_call = cache_cpu_callback 450 .notifier_call = cache_cpu_callback
451}; 451};
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index f7f9f9c6caf0..d3636e67a98e 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -630,7 +630,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
630 printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n", 630 printk(KERN_ERR " iip - 0x%lx, ifa - 0x%lx, isr - 0x%lx\n",
631 iip, ifa, isr); 631 iip, ifa, isr);
632 force_sig(SIGSEGV, current); 632 force_sig(SIGSEGV, current);
633 break; 633 return;
634 634
635 case 46: 635 case 46:
636 printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n"); 636 printk(KERN_ERR "Unexpected IA-32 intercept trap (Trap 46)\n");
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile
index 1a4053789d01..18e45ec49bbf 100644
--- a/arch/ia64/kvm/Makefile
+++ b/arch/ia64/kvm/Makefile
@@ -47,12 +47,13 @@ FORCE : $(obj)/$(offsets-file)
47 47
48ccflags-y := -Ivirt/kvm -Iarch/ia64/kvm/ 48ccflags-y := -Ivirt/kvm -Iarch/ia64/kvm/
49asflags-y := -Ivirt/kvm -Iarch/ia64/kvm/ 49asflags-y := -Ivirt/kvm -Iarch/ia64/kvm/
50KVM := ../../../virt/kvm
50 51
51common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 52common-objs = $(KVM)/kvm_main.o $(KVM)/ioapic.o \
52 coalesced_mmio.o irq_comm.o) 53 $(KVM)/coalesced_mmio.o $(KVM)/irq_comm.o
53 54
54ifeq ($(CONFIG_KVM_DEVICE_ASSIGNMENT),y) 55ifeq ($(CONFIG_KVM_DEVICE_ASSIGNMENT),y)
55common-objs += $(addprefix ../../../virt/kvm/, assigned-dev.o iommu.o) 56common-objs += $(KVM)/assigned-dev.o $(KVM)/iommu.o
56endif 57endif
57 58
58kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o 59kvm-objs := $(common-objs) kvm-ia64.o kvm_fw.o
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 67c59ebec899..da5237d636d6 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -156,8 +156,7 @@ static void *cpu_data;
156 * 156 *
157 * Allocate and setup per-cpu data areas. 157 * Allocate and setup per-cpu data areas.
158 */ 158 */
159void * __cpuinit 159void *per_cpu_init(void)
160per_cpu_init (void)
161{ 160{
162 static bool first_time = true; 161 static bool first_time = true;
163 void *cpu0_data = __cpu0_per_cpu; 162 void *cpu0_data = __cpu0_per_cpu;
@@ -295,14 +294,6 @@ find_memory (void)
295 alloc_per_cpu_data(); 294 alloc_per_cpu_data();
296} 295}
297 296
298static int count_pages(u64 start, u64 end, void *arg)
299{
300 unsigned long *count = arg;
301
302 *count += (end - start) >> PAGE_SHIFT;
303 return 0;
304}
305
306/* 297/*
307 * Set up the page tables. 298 * Set up the page tables.
308 */ 299 */
@@ -313,9 +304,6 @@ paging_init (void)
313 unsigned long max_dma; 304 unsigned long max_dma;
314 unsigned long max_zone_pfns[MAX_NR_ZONES]; 305 unsigned long max_zone_pfns[MAX_NR_ZONES];
315 306
316 num_physpages = 0;
317 efi_memmap_walk(count_pages, &num_physpages);
318
319 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 307 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
320#ifdef CONFIG_ZONE_DMA 308#ifdef CONFIG_ZONE_DMA
321 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; 309 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index ae4db4bd6d97..2de08f4d9930 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -37,7 +37,6 @@ struct early_node_data {
37 struct ia64_node_data *node_data; 37 struct ia64_node_data *node_data;
38 unsigned long pernode_addr; 38 unsigned long pernode_addr;
39 unsigned long pernode_size; 39 unsigned long pernode_size;
40 unsigned long num_physpages;
41#ifdef CONFIG_ZONE_DMA 40#ifdef CONFIG_ZONE_DMA
42 unsigned long num_dma_physpages; 41 unsigned long num_dma_physpages;
43#endif 42#endif
@@ -593,7 +592,7 @@ void __init find_memory(void)
593 * find_pernode_space() does most of this already, we just need to set 592 * find_pernode_space() does most of this already, we just need to set
594 * local_per_cpu_offset 593 * local_per_cpu_offset
595 */ 594 */
596void __cpuinit *per_cpu_init(void) 595void *per_cpu_init(void)
597{ 596{
598 int cpu; 597 int cpu;
599 static int first_time = 1; 598 static int first_time = 1;
@@ -732,7 +731,6 @@ static __init int count_node_pages(unsigned long start, unsigned long len, int n
732{ 731{
733 unsigned long end = start + len; 732 unsigned long end = start + len;
734 733
735 mem_data[node].num_physpages += len >> PAGE_SHIFT;
736#ifdef CONFIG_ZONE_DMA 734#ifdef CONFIG_ZONE_DMA
737 if (start <= __pa(MAX_DMA_ADDRESS)) 735 if (start <= __pa(MAX_DMA_ADDRESS))
738 mem_data[node].num_dma_physpages += 736 mem_data[node].num_dma_physpages +=
@@ -778,7 +776,6 @@ void __init paging_init(void)
778#endif 776#endif
779 777
780 for_each_online_node(node) { 778 for_each_online_node(node) {
781 num_physpages += mem_data[node].num_physpages;
782 pfn_offset = mem_data[node].min_pfn; 779 pfn_offset = mem_data[node].min_pfn;
783 780
784#ifdef CONFIG_VIRTUAL_MEM_MAP 781#ifdef CONFIG_VIRTUAL_MEM_MAP
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index d1fe4b402601..b6f7f43424ec 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -154,9 +154,8 @@ ia64_init_addr_space (void)
154void 154void
155free_initmem (void) 155free_initmem (void)
156{ 156{
157 free_reserved_area((unsigned long)ia64_imva(__init_begin), 157 free_reserved_area(ia64_imva(__init_begin), ia64_imva(__init_end),
158 (unsigned long)ia64_imva(__init_end), 158 -1, "unused kernel");
159 0, "unused kernel");
160} 159}
161 160
162void __init 161void __init
@@ -546,19 +545,6 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
546 return 0; 545 return 0;
547} 546}
548 547
549static int __init
550count_reserved_pages(u64 start, u64 end, void *arg)
551{
552 unsigned long num_reserved = 0;
553 unsigned long *count = arg;
554
555 for (; start < end; start += PAGE_SIZE)
556 if (PageReserved(virt_to_page(start)))
557 ++num_reserved;
558 *count += num_reserved;
559 return 0;
560}
561
562int 548int
563find_max_min_low_pfn (u64 start, u64 end, void *arg) 549find_max_min_low_pfn (u64 start, u64 end, void *arg)
564{ 550{
@@ -597,8 +583,6 @@ __setup("nolwsys", nolwsys_setup);
597void __init 583void __init
598mem_init (void) 584mem_init (void)
599{ 585{
600 long reserved_pages, codesize, datasize, initsize;
601 pg_data_t *pgdat;
602 int i; 586 int i;
603 587
604 BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE); 588 BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE);
@@ -616,27 +600,12 @@ mem_init (void)
616 600
617#ifdef CONFIG_FLATMEM 601#ifdef CONFIG_FLATMEM
618 BUG_ON(!mem_map); 602 BUG_ON(!mem_map);
619 max_mapnr = max_low_pfn;
620#endif 603#endif
621 604
605 set_max_mapnr(max_low_pfn);
622 high_memory = __va(max_low_pfn * PAGE_SIZE); 606 high_memory = __va(max_low_pfn * PAGE_SIZE);
623 607 free_all_bootmem();
624 for_each_online_pgdat(pgdat) 608 mem_init_print_info(NULL);
625 if (pgdat->bdata->node_bootmem_map)
626 totalram_pages += free_all_bootmem_node(pgdat);
627
628 reserved_pages = 0;
629 efi_memmap_walk(count_reserved_pages, &reserved_pages);
630
631 codesize = (unsigned long) _etext - (unsigned long) _stext;
632 datasize = (unsigned long) _edata - (unsigned long) _etext;
633 initsize = (unsigned long) __init_end - (unsigned long) __init_begin;
634
635 printk(KERN_INFO "Memory: %luk/%luk available (%luk code, %luk reserved, "
636 "%luk data, %luk init)\n", nr_free_pages() << (PAGE_SHIFT - 10),
637 num_physpages << (PAGE_SHIFT - 10), codesize >> 10,
638 reserved_pages << (PAGE_SHIFT - 10), datasize >> 10, initsize >> 10);
639
640 609
641 /* 610 /*
642 * For fsyscall entrpoints with no light-weight handler, use the ordinary 611 * For fsyscall entrpoints with no light-weight handler, use the ordinary
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 4248492b9321..ea21d4cad540 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -86,7 +86,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn)
86 return -1; 86 return -1;
87} 87}
88 88
89void __cpuinit numa_clear_node(int cpu) 89void numa_clear_node(int cpu)
90{ 90{
91 unmap_cpu_from_node(cpu, NUMA_NO_NODE); 91 unmap_cpu_from_node(cpu, NUMA_NO_NODE);
92} 92}
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index de1474ff0bc5..2326790b7d8b 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -134,6 +134,10 @@ struct pci_root_info {
134 struct acpi_device *bridge; 134 struct acpi_device *bridge;
135 struct pci_controller *controller; 135 struct pci_controller *controller;
136 struct list_head resources; 136 struct list_head resources;
137 struct resource *res;
138 resource_size_t *res_offset;
139 unsigned int res_num;
140 struct list_head io_resources;
137 char *name; 141 char *name;
138}; 142};
139 143
@@ -153,7 +157,7 @@ new_space (u64 phys_base, int sparse)
153 return i; 157 return i;
154 158
155 if (num_io_spaces == MAX_IO_SPACES) { 159 if (num_io_spaces == MAX_IO_SPACES) {
156 printk(KERN_ERR "PCI: Too many IO port spaces " 160 pr_err("PCI: Too many IO port spaces "
157 "(MAX_IO_SPACES=%lu)\n", MAX_IO_SPACES); 161 "(MAX_IO_SPACES=%lu)\n", MAX_IO_SPACES);
158 return ~0; 162 return ~0;
159 } 163 }
@@ -168,25 +172,22 @@ new_space (u64 phys_base, int sparse)
168static u64 add_io_space(struct pci_root_info *info, 172static u64 add_io_space(struct pci_root_info *info,
169 struct acpi_resource_address64 *addr) 173 struct acpi_resource_address64 *addr)
170{ 174{
175 struct iospace_resource *iospace;
171 struct resource *resource; 176 struct resource *resource;
172 char *name; 177 char *name;
173 unsigned long base, min, max, base_port; 178 unsigned long base, min, max, base_port;
174 unsigned int sparse = 0, space_nr, len; 179 unsigned int sparse = 0, space_nr, len;
175 180
176 resource = kzalloc(sizeof(*resource), GFP_KERNEL); 181 len = strlen(info->name) + 32;
177 if (!resource) { 182 iospace = kzalloc(sizeof(*iospace) + len, GFP_KERNEL);
178 printk(KERN_ERR "PCI: No memory for %s I/O port space\n", 183 if (!iospace) {
179 info->name); 184 dev_err(&info->bridge->dev,
185 "PCI: No memory for %s I/O port space\n",
186 info->name);
180 goto out; 187 goto out;
181 } 188 }
182 189
183 len = strlen(info->name) + 32; 190 name = (char *)(iospace + 1);
184 name = kzalloc(len, GFP_KERNEL);
185 if (!name) {
186 printk(KERN_ERR "PCI: No memory for %s I/O port space name\n",
187 info->name);
188 goto free_resource;
189 }
190 191
191 min = addr->minimum; 192 min = addr->minimum;
192 max = min + addr->address_length - 1; 193 max = min + addr->address_length - 1;
@@ -195,7 +196,7 @@ static u64 add_io_space(struct pci_root_info *info,
195 196
196 space_nr = new_space(addr->translation_offset, sparse); 197 space_nr = new_space(addr->translation_offset, sparse);
197 if (space_nr == ~0) 198 if (space_nr == ~0)
198 goto free_name; 199 goto free_resource;
199 200
200 base = __pa(io_space[space_nr].mmio_base); 201 base = __pa(io_space[space_nr].mmio_base);
201 base_port = IO_SPACE_BASE(space_nr); 202 base_port = IO_SPACE_BASE(space_nr);
@@ -210,18 +211,23 @@ static u64 add_io_space(struct pci_root_info *info,
210 if (space_nr == 0) 211 if (space_nr == 0)
211 sparse = 1; 212 sparse = 1;
212 213
214 resource = &iospace->res;
213 resource->name = name; 215 resource->name = name;
214 resource->flags = IORESOURCE_MEM; 216 resource->flags = IORESOURCE_MEM;
215 resource->start = base + (sparse ? IO_SPACE_SPARSE_ENCODING(min) : min); 217 resource->start = base + (sparse ? IO_SPACE_SPARSE_ENCODING(min) : min);
216 resource->end = base + (sparse ? IO_SPACE_SPARSE_ENCODING(max) : max); 218 resource->end = base + (sparse ? IO_SPACE_SPARSE_ENCODING(max) : max);
217 insert_resource(&iomem_resource, resource); 219 if (insert_resource(&iomem_resource, resource)) {
220 dev_err(&info->bridge->dev,
221 "can't allocate host bridge io space resource %pR\n",
222 resource);
223 goto free_resource;
224 }
218 225
226 list_add_tail(&iospace->list, &info->io_resources);
219 return base_port; 227 return base_port;
220 228
221free_name:
222 kfree(name);
223free_resource: 229free_resource:
224 kfree(resource); 230 kfree(iospace);
225out: 231out:
226 return ~0; 232 return ~0;
227} 233}
@@ -265,7 +271,7 @@ static acpi_status count_window(struct acpi_resource *resource, void *data)
265static acpi_status add_window(struct acpi_resource *res, void *data) 271static acpi_status add_window(struct acpi_resource *res, void *data)
266{ 272{
267 struct pci_root_info *info = data; 273 struct pci_root_info *info = data;
268 struct pci_window *window; 274 struct resource *resource;
269 struct acpi_resource_address64 addr; 275 struct acpi_resource_address64 addr;
270 acpi_status status; 276 acpi_status status;
271 unsigned long flags, offset = 0; 277 unsigned long flags, offset = 0;
@@ -289,55 +295,146 @@ static acpi_status add_window(struct acpi_resource *res, void *data)
289 } else 295 } else
290 return AE_OK; 296 return AE_OK;
291 297
292 window = &info->controller->window[info->controller->windows++]; 298 resource = &info->res[info->res_num];
293 window->resource.name = info->name; 299 resource->name = info->name;
294 window->resource.flags = flags; 300 resource->flags = flags;
295 window->resource.start = addr.minimum + offset; 301 resource->start = addr.minimum + offset;
296 window->resource.end = window->resource.start + addr.address_length - 1; 302 resource->end = resource->start + addr.address_length - 1;
297 window->offset = offset; 303 info->res_offset[info->res_num] = offset;
298 304
299 if (insert_resource(root, &window->resource)) { 305 if (insert_resource(root, resource)) {
300 dev_err(&info->bridge->dev, 306 dev_err(&info->bridge->dev,
301 "can't allocate host bridge window %pR\n", 307 "can't allocate host bridge window %pR\n",
302 &window->resource); 308 resource);
303 } else { 309 } else {
304 if (offset) 310 if (offset)
305 dev_info(&info->bridge->dev, "host bridge window %pR " 311 dev_info(&info->bridge->dev, "host bridge window %pR "
306 "(PCI address [%#llx-%#llx])\n", 312 "(PCI address [%#llx-%#llx])\n",
307 &window->resource, 313 resource,
308 window->resource.start - offset, 314 resource->start - offset,
309 window->resource.end - offset); 315 resource->end - offset);
310 else 316 else
311 dev_info(&info->bridge->dev, 317 dev_info(&info->bridge->dev,
312 "host bridge window %pR\n", 318 "host bridge window %pR\n", resource);
313 &window->resource);
314 } 319 }
315
316 /* HP's firmware has a hack to work around a Windows bug. 320 /* HP's firmware has a hack to work around a Windows bug.
317 * Ignore these tiny memory ranges */ 321 * Ignore these tiny memory ranges */
318 if (!((window->resource.flags & IORESOURCE_MEM) && 322 if (!((resource->flags & IORESOURCE_MEM) &&
319 (window->resource.end - window->resource.start < 16))) 323 (resource->end - resource->start < 16)))
320 pci_add_resource_offset(&info->resources, &window->resource, 324 pci_add_resource_offset(&info->resources, resource,
321 window->offset); 325 info->res_offset[info->res_num]);
322 326
327 info->res_num++;
323 return AE_OK; 328 return AE_OK;
324} 329}
325 330
331static void free_pci_root_info_res(struct pci_root_info *info)
332{
333 struct iospace_resource *iospace, *tmp;
334
335 list_for_each_entry_safe(iospace, tmp, &info->io_resources, list)
336 kfree(iospace);
337
338 kfree(info->name);
339 kfree(info->res);
340 info->res = NULL;
341 kfree(info->res_offset);
342 info->res_offset = NULL;
343 info->res_num = 0;
344 kfree(info->controller);
345 info->controller = NULL;
346}
347
348static void __release_pci_root_info(struct pci_root_info *info)
349{
350 int i;
351 struct resource *res;
352 struct iospace_resource *iospace;
353
354 list_for_each_entry(iospace, &info->io_resources, list)
355 release_resource(&iospace->res);
356
357 for (i = 0; i < info->res_num; i++) {
358 res = &info->res[i];
359
360 if (!res->parent)
361 continue;
362
363 if (!(res->flags & (IORESOURCE_MEM | IORESOURCE_IO)))
364 continue;
365
366 release_resource(res);
367 }
368
369 free_pci_root_info_res(info);
370 kfree(info);
371}
372
373static void release_pci_root_info(struct pci_host_bridge *bridge)
374{
375 struct pci_root_info *info = bridge->release_data;
376
377 __release_pci_root_info(info);
378}
379
380static int
381probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
382 int busnum, int domain)
383{
384 char *name;
385
386 name = kmalloc(16, GFP_KERNEL);
387 if (!name)
388 return -ENOMEM;
389
390 sprintf(name, "PCI Bus %04x:%02x", domain, busnum);
391 info->bridge = device;
392 info->name = name;
393
394 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
395 &info->res_num);
396 if (info->res_num) {
397 info->res =
398 kzalloc_node(sizeof(*info->res) * info->res_num,
399 GFP_KERNEL, info->controller->node);
400 if (!info->res) {
401 kfree(name);
402 return -ENOMEM;
403 }
404
405 info->res_offset =
406 kzalloc_node(sizeof(*info->res_offset) * info->res_num,
407 GFP_KERNEL, info->controller->node);
408 if (!info->res_offset) {
409 kfree(name);
410 kfree(info->res);
411 info->res = NULL;
412 return -ENOMEM;
413 }
414
415 info->res_num = 0;
416 acpi_walk_resources(device->handle, METHOD_NAME__CRS,
417 add_window, info);
418 } else
419 kfree(name);
420
421 return 0;
422}
423
326struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) 424struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
327{ 425{
328 struct acpi_device *device = root->device; 426 struct acpi_device *device = root->device;
329 int domain = root->segment; 427 int domain = root->segment;
330 int bus = root->secondary.start; 428 int bus = root->secondary.start;
331 struct pci_controller *controller; 429 struct pci_controller *controller;
332 unsigned int windows = 0; 430 struct pci_root_info *info = NULL;
333 struct pci_root_info info; 431 int busnum = root->secondary.start;
334 struct pci_bus *pbus; 432 struct pci_bus *pbus;
335 char *name; 433 int pxm, ret;
336 int pxm;
337 434
338 controller = alloc_pci_controller(domain); 435 controller = alloc_pci_controller(domain);
339 if (!controller) 436 if (!controller)
340 goto out1; 437 return NULL;
341 438
342 controller->acpi_handle = device->handle; 439 controller->acpi_handle = device->handle;
343 440
@@ -347,29 +444,27 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
347 controller->node = pxm_to_node(pxm); 444 controller->node = pxm_to_node(pxm);
348#endif 445#endif
349 446
350 INIT_LIST_HEAD(&info.resources); 447 info = kzalloc(sizeof(*info), GFP_KERNEL);
351 /* insert busn resource at first */ 448 if (!info) {
352 pci_add_resource(&info.resources, &root->secondary); 449 dev_err(&device->dev,
353 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, 450 "pci_bus %04x:%02x: ignored (out of memory)\n",
354 &windows); 451 domain, busnum);
355 if (windows) { 452 kfree(controller);
356 controller->window = 453 return NULL;
357 kzalloc_node(sizeof(*controller->window) * windows,
358 GFP_KERNEL, controller->node);
359 if (!controller->window)
360 goto out2;
361
362 name = kmalloc(16, GFP_KERNEL);
363 if (!name)
364 goto out3;
365
366 sprintf(name, "PCI Bus %04x:%02x", domain, bus);
367 info.bridge = device;
368 info.controller = controller;
369 info.name = name;
370 acpi_walk_resources(device->handle, METHOD_NAME__CRS,
371 add_window, &info);
372 } 454 }
455
456 info->controller = controller;
457 INIT_LIST_HEAD(&info->io_resources);
458 INIT_LIST_HEAD(&info->resources);
459
460 ret = probe_pci_root_info(info, device, busnum, domain);
461 if (ret) {
462 kfree(info->controller);
463 kfree(info);
464 return NULL;
465 }
466 /* insert busn resource at first */
467 pci_add_resource(&info->resources, &root->secondary);
373 /* 468 /*
374 * See arch/x86/pci/acpi.c. 469 * See arch/x86/pci/acpi.c.
375 * The desired pci bus might already be scanned in a quirk. We 470 * The desired pci bus might already be scanned in a quirk. We
@@ -377,21 +472,17 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
377 * such quirk. So we just ignore the case now. 472 * such quirk. So we just ignore the case now.
378 */ 473 */
379 pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller, 474 pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller,
380 &info.resources); 475 &info->resources);
381 if (!pbus) { 476 if (!pbus) {
382 pci_free_resource_list(&info.resources); 477 pci_free_resource_list(&info->resources);
478 __release_pci_root_info(info);
383 return NULL; 479 return NULL;
384 } 480 }
385 481
482 pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge),
483 release_pci_root_info, info);
386 pci_scan_child_bus(pbus); 484 pci_scan_child_bus(pbus);
387 return pbus; 485 return pbus;
388
389out3:
390 kfree(controller->window);
391out2:
392 kfree(controller);
393out1:
394 return NULL;
395} 486}
396 487
397int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) 488int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
@@ -691,7 +782,7 @@ static void __init set_pci_dfl_cacheline_size(void)
691 782
692 status = ia64_pal_cache_summary(&levels, &unique_caches); 783 status = ia64_pal_cache_summary(&levels, &unique_caches);
693 if (status != 0) { 784 if (status != 0) {
694 printk(KERN_ERR "%s: ia64_pal_cache_summary() failed " 785 pr_err("%s: ia64_pal_cache_summary() failed "
695 "(status=%ld)\n", __func__, status); 786 "(status=%ld)\n", __func__, status);
696 return; 787 return;
697 } 788 }
@@ -699,7 +790,7 @@ static void __init set_pci_dfl_cacheline_size(void)
699 status = ia64_pal_cache_config_info(levels - 1, 790 status = ia64_pal_cache_config_info(levels - 1,
700 /* cache_type (data_or_unified)= */ 2, &cci); 791 /* cache_type (data_or_unified)= */ 2, &cci);
701 if (status != 0) { 792 if (status != 0) {
702 printk(KERN_ERR "%s: ia64_pal_cache_config_info() failed " 793 pr_err("%s: ia64_pal_cache_config_info() failed "
703 "(status=%ld)\n", __func__, status); 794 "(status=%ld)\n", __func__, status);
704 return; 795 return;
705 } 796 }
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 238e2c511d94..0b5ce82d203d 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -118,76 +118,26 @@ static void __init sn_fixup_ionodes(void)
118} 118}
119 119
120/* 120/*
121 * sn_pci_legacy_window_fixup - Create PCI controller windows for 121 * sn_pci_legacy_window_fixup - Setup PCI resources for
122 * legacy IO and MEM space. This needs to 122 * legacy IO and MEM space. This needs to
123 * be done here, as the PROM does not have 123 * be done here, as the PROM does not have
124 * ACPI support defining the root buses 124 * ACPI support defining the root buses
125 * and their resources (_CRS), 125 * and their resources (_CRS),
126 */ 126 */
127static void 127static void
128sn_legacy_pci_window_fixup(struct pci_controller *controller, 128sn_legacy_pci_window_fixup(struct resource *res,
129 u64 legacy_io, u64 legacy_mem) 129 u64 legacy_io, u64 legacy_mem)
130{ 130{
131 controller->window = kcalloc(2, sizeof(struct pci_window), 131 res[0].name = "legacy_io";
132 GFP_KERNEL); 132 res[0].flags = IORESOURCE_IO;
133 BUG_ON(controller->window == NULL); 133 res[0].start = legacy_io;
134 controller->window[0].offset = legacy_io; 134 res[0].end = res[0].start + 0xffff;
135 controller->window[0].resource.name = "legacy_io"; 135 res[0].parent = &ioport_resource;
136 controller->window[0].resource.flags = IORESOURCE_IO; 136 res[1].name = "legacy_mem";
137 controller->window[0].resource.start = legacy_io; 137 res[1].flags = IORESOURCE_MEM;
138 controller->window[0].resource.end = 138 res[1].start = legacy_mem;
139 controller->window[0].resource.start + 0xffff; 139 res[1].end = res[1].start + (1024 * 1024) - 1;
140 controller->window[0].resource.parent = &ioport_resource; 140 res[1].parent = &iomem_resource;
141 controller->window[1].offset = legacy_mem;
142 controller->window[1].resource.name = "legacy_mem";
143 controller->window[1].resource.flags = IORESOURCE_MEM;
144 controller->window[1].resource.start = legacy_mem;
145 controller->window[1].resource.end =
146 controller->window[1].resource.start + (1024 * 1024) - 1;
147 controller->window[1].resource.parent = &iomem_resource;
148 controller->windows = 2;
149}
150
151/*
152 * sn_pci_window_fixup() - Create a pci_window for each device resource.
153 * It will setup pci_windows for use by
154 * pcibios_bus_to_resource(), pcibios_resource_to_bus(),
155 * etc.
156 */
157static void
158sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
159 s64 * pci_addrs)
160{
161 struct pci_controller *controller = PCI_CONTROLLER(dev->bus);
162 unsigned int i;
163 unsigned int idx;
164 unsigned int new_count;
165 struct pci_window *new_window;
166
167 if (count == 0)
168 return;
169 idx = controller->windows;
170 new_count = controller->windows + count;
171 new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL);
172 BUG_ON(new_window == NULL);
173 if (controller->window) {
174 memcpy(new_window, controller->window,
175 sizeof(struct pci_window) * controller->windows);
176 kfree(controller->window);
177 }
178
179 /* Setup a pci_window for each device resource. */
180 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
181 if (pci_addrs[i] == -1)
182 continue;
183
184 new_window[idx].offset = dev->resource[i].start - pci_addrs[i];
185 new_window[idx].resource = dev->resource[i];
186 idx++;
187 }
188
189 controller->windows = new_count;
190 controller->window = new_window;
191} 141}
192 142
193/* 143/*
@@ -199,9 +149,7 @@ sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
199void 149void
200sn_io_slot_fixup(struct pci_dev *dev) 150sn_io_slot_fixup(struct pci_dev *dev)
201{ 151{
202 unsigned int count = 0;
203 int idx; 152 int idx;
204 s64 pci_addrs[PCI_ROM_RESOURCE + 1];
205 unsigned long addr, end, size, start; 153 unsigned long addr, end, size, start;
206 struct pcidev_info *pcidev_info; 154 struct pcidev_info *pcidev_info;
207 struct sn_irq_info *sn_irq_info; 155 struct sn_irq_info *sn_irq_info;
@@ -229,7 +177,6 @@ sn_io_slot_fixup(struct pci_dev *dev)
229 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { 177 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
230 178
231 if (!pcidev_info->pdi_pio_mapped_addr[idx]) { 179 if (!pcidev_info->pdi_pio_mapped_addr[idx]) {
232 pci_addrs[idx] = -1;
233 continue; 180 continue;
234 } 181 }
235 182
@@ -237,11 +184,8 @@ sn_io_slot_fixup(struct pci_dev *dev)
237 end = dev->resource[idx].end; 184 end = dev->resource[idx].end;
238 size = end - start; 185 size = end - start;
239 if (size == 0) { 186 if (size == 0) {
240 pci_addrs[idx] = -1;
241 continue; 187 continue;
242 } 188 }
243 pci_addrs[idx] = start;
244 count++;
245 addr = pcidev_info->pdi_pio_mapped_addr[idx]; 189 addr = pcidev_info->pdi_pio_mapped_addr[idx];
246 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; 190 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
247 dev->resource[idx].start = addr; 191 dev->resource[idx].start = addr;
@@ -276,11 +220,6 @@ sn_io_slot_fixup(struct pci_dev *dev)
276 IORESOURCE_ROM_BIOS_COPY; 220 IORESOURCE_ROM_BIOS_COPY;
277 } 221 }
278 } 222 }
279 /* Create a pci_window in the pci_controller struct for
280 * each device resource.
281 */
282 if (count > 0)
283 sn_pci_window_fixup(dev, count, pci_addrs);
284 223
285 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info); 224 sn_pci_fixup_slot(dev, pcidev_info, sn_irq_info);
286} 225}
@@ -297,8 +236,8 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
297 s64 status = 0; 236 s64 status = 0;
298 struct pci_controller *controller; 237 struct pci_controller *controller;
299 struct pcibus_bussoft *prom_bussoft_ptr; 238 struct pcibus_bussoft *prom_bussoft_ptr;
239 struct resource *res;
300 LIST_HEAD(resources); 240 LIST_HEAD(resources);
301 int i;
302 241
303 status = sal_get_pcibus_info((u64) segment, (u64) busnum, 242 status = sal_get_pcibus_info((u64) segment, (u64) busnum,
304 (u64) ia64_tpa(&prom_bussoft_ptr)); 243 (u64) ia64_tpa(&prom_bussoft_ptr));
@@ -310,32 +249,29 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
310 BUG_ON(!controller); 249 BUG_ON(!controller);
311 controller->segment = segment; 250 controller->segment = segment;
312 251
252 res = kcalloc(2, sizeof(struct resource), GFP_KERNEL);
253 BUG_ON(!res);
254
313 /* 255 /*
314 * Temporarily save the prom_bussoft_ptr for use by sn_bus_fixup(). 256 * Temporarily save the prom_bussoft_ptr for use by sn_bus_fixup().
315 * (platform_data will be overwritten later in sn_common_bus_fixup()) 257 * (platform_data will be overwritten later in sn_common_bus_fixup())
316 */ 258 */
317 controller->platform_data = prom_bussoft_ptr; 259 controller->platform_data = prom_bussoft_ptr;
318 260
319 sn_legacy_pci_window_fixup(controller, 261 sn_legacy_pci_window_fixup(res,
320 prom_bussoft_ptr->bs_legacy_io, 262 prom_bussoft_ptr->bs_legacy_io,
321 prom_bussoft_ptr->bs_legacy_mem); 263 prom_bussoft_ptr->bs_legacy_mem);
322 for (i = 0; i < controller->windows; i++) 264 pci_add_resource_offset(&resources, &res[0],
323 pci_add_resource_offset(&resources, 265 prom_bussoft_ptr->bs_legacy_io);
324 &controller->window[i].resource, 266 pci_add_resource_offset(&resources, &res[1],
325 controller->window[i].offset); 267 prom_bussoft_ptr->bs_legacy_mem);
268
326 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller, 269 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
327 &resources); 270 &resources);
328 if (bus == NULL) 271 if (bus == NULL) {
329 goto error_return; /* error, or bus already scanned */ 272 kfree(res);
330 273 kfree(controller);
331 bus->sysdata = controller; 274 }
332
333 return;
334
335error_return:
336
337 kfree(controller);
338 return;
339} 275}
340 276
341/* 277/*
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index f82e7b462b7b..53b01b8e2f19 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -192,7 +192,7 @@ void __init early_sn_setup(void)
192} 192}
193 193
194extern int platform_intr_list[]; 194extern int platform_intr_list[];
195static int __cpuinitdata shub_1_1_found; 195static int shub_1_1_found;
196 196
197/* 197/*
198 * sn_check_for_wars 198 * sn_check_for_wars
@@ -200,7 +200,7 @@ static int __cpuinitdata shub_1_1_found;
200 * Set flag for enabling shub specific wars 200 * Set flag for enabling shub specific wars
201 */ 201 */
202 202
203static inline int __cpuinit is_shub_1_1(int nasid) 203static inline int is_shub_1_1(int nasid)
204{ 204{
205 unsigned long id; 205 unsigned long id;
206 int rev; 206 int rev;
@@ -212,7 +212,7 @@ static inline int __cpuinit is_shub_1_1(int nasid)
212 return rev <= 2; 212 return rev <= 2;
213} 213}
214 214
215static void __cpuinit sn_check_for_wars(void) 215static void sn_check_for_wars(void)
216{ 216{
217 int cnode; 217 int cnode;
218 218
@@ -558,7 +558,7 @@ static void __init sn_init_pdas(char **cmdline_p)
558 * Also sets up a few fields in the nodepda. Also known as 558 * Also sets up a few fields in the nodepda. Also known as
559 * platform_cpu_init() by the ia64 machvec code. 559 * platform_cpu_init() by the ia64 machvec code.
560 */ 560 */
561void __cpuinit sn_cpu_init(void) 561void sn_cpu_init(void)
562{ 562{
563 int cpuid; 563 int cpuid;
564 int cpuphyid; 564 int cpuphyid;
diff --git a/arch/ia64/xen/hypervisor.c b/arch/ia64/xen/hypervisor.c
index 52172eee8591..fab62528a80b 100644
--- a/arch/ia64/xen/hypervisor.c
+++ b/arch/ia64/xen/hypervisor.c
@@ -74,7 +74,7 @@ void __init xen_setup_vcpu_info_placement(void)
74 xen_vcpu_setup(cpu); 74 xen_vcpu_setup(cpu);
75} 75}
76 76
77void __cpuinit 77void
78xen_cpu_init(void) 78xen_cpu_init(void)
79{ 79{
80 xen_smp_intr_init(); 80 xen_smp_intr_init();
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index bcd17b206571..29a7ef4e448b 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -16,6 +16,7 @@ config M32R
16 select GENERIC_ATOMIC64 16 select GENERIC_ATOMIC64
17 select ARCH_USES_GETTIMEOFFSET 17 select ARCH_USES_GETTIMEOFFSET
18 select MODULES_USE_ELF_RELA 18 select MODULES_USE_ELF_RELA
19 select HAVE_DEBUG_STACKOVERFLOW
19 20
20config SBUS 21config SBUS
21 bool 22 bool
diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug
index bb1afc1a31cc..6c612b7691b0 100644
--- a/arch/m32r/Kconfig.debug
+++ b/arch/m32r/Kconfig.debug
@@ -2,13 +2,6 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL
8 help
9 This option will cause messages to be printed if free stack space
10 drops below a certain limit.
11
12config DEBUG_PAGEALLOC 5config DEBUG_PAGEALLOC
13 bool "Debug page memory allocations" 6 bool "Debug page memory allocations"
14 depends on DEBUG_KERNEL && BROKEN 7 depends on DEBUG_KERNEL && BROKEN
diff --git a/arch/m32r/include/asm/pgtable.h b/arch/m32r/include/asm/pgtable.h
index 8a28cfea2729..103ce6710f07 100644
--- a/arch/m32r/include/asm/pgtable.h
+++ b/arch/m32r/include/asm/pgtable.h
@@ -347,9 +347,6 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
347/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ 347/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
348#define kern_addr_valid(addr) (1) 348#define kern_addr_valid(addr) (1)
349 349
350#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
351 remap_pfn_range(vma, vaddr, pfn, size, prot)
352
353#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 350#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
354#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 351#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
355#define __HAVE_ARCH_PTEP_SET_WRPROTECT 352#define __HAVE_ARCH_PTEP_SET_WRPROTECT
diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h
index 1c7047bea200..84fe7ba53035 100644
--- a/arch/m32r/include/asm/uaccess.h
+++ b/arch/m32r/include/asm/uaccess.h
@@ -216,7 +216,7 @@ extern int fixup_exception(struct pt_regs *regs);
216({ \ 216({ \
217 long __gu_err = 0; \ 217 long __gu_err = 0; \
218 unsigned long __gu_val; \ 218 unsigned long __gu_val; \
219 might_sleep(); \ 219 might_fault(); \
220 __get_user_size(__gu_val,(ptr),(size),__gu_err); \ 220 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
221 (x) = (__typeof__(*(ptr)))__gu_val; \ 221 (x) = (__typeof__(*(ptr)))__gu_val; \
222 __gu_err; \ 222 __gu_err; \
@@ -227,7 +227,7 @@ extern int fixup_exception(struct pt_regs *regs);
227 long __gu_err = -EFAULT; \ 227 long __gu_err = -EFAULT; \
228 unsigned long __gu_val = 0; \ 228 unsigned long __gu_val = 0; \
229 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ 229 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
230 might_sleep(); \ 230 might_fault(); \
231 if (access_ok(VERIFY_READ,__gu_addr,size)) \ 231 if (access_ok(VERIFY_READ,__gu_addr,size)) \
232 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \ 232 __get_user_size(__gu_val,__gu_addr,(size),__gu_err); \
233 (x) = (__typeof__(*(ptr)))__gu_val; \ 233 (x) = (__typeof__(*(ptr)))__gu_val; \
@@ -295,7 +295,7 @@ do { \
295#define __put_user_nocheck(x,ptr,size) \ 295#define __put_user_nocheck(x,ptr,size) \
296({ \ 296({ \
297 long __pu_err; \ 297 long __pu_err; \
298 might_sleep(); \ 298 might_fault(); \
299 __put_user_size((x),(ptr),(size),__pu_err); \ 299 __put_user_size((x),(ptr),(size),__pu_err); \
300 __pu_err; \ 300 __pu_err; \
301}) 301})
@@ -305,7 +305,7 @@ do { \
305({ \ 305({ \
306 long __pu_err = -EFAULT; \ 306 long __pu_err = -EFAULT; \
307 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ 307 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
308 might_sleep(); \ 308 might_fault(); \
309 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \ 309 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
310 __put_user_size((x),__pu_addr,(size),__pu_err); \ 310 __put_user_size((x),__pu_addr,(size),__pu_err); \
311 __pu_err; \ 311 __pu_err; \
@@ -597,7 +597,7 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
597 */ 597 */
598#define copy_to_user(to,from,n) \ 598#define copy_to_user(to,from,n) \
599({ \ 599({ \
600 might_sleep(); \ 600 might_fault(); \
601 __generic_copy_to_user((to),(from),(n)); \ 601 __generic_copy_to_user((to),(from),(n)); \
602}) 602})
603 603
@@ -638,7 +638,7 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
638 */ 638 */
639#define copy_from_user(to,from,n) \ 639#define copy_from_user(to,from,n) \
640({ \ 640({ \
641 might_sleep(); \ 641 might_fault(); \
642 __generic_copy_from_user((to),(from),(n)); \ 642 __generic_copy_from_user((to),(from),(n)); \
643}) 643})
644 644
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index 2c468e8b5853..27196303ce36 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -129,11 +129,10 @@ unsigned long __init setup_memory(void)
129#define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn) 129#define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn)
130#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) 130#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn)
131 131
132unsigned long __init zone_sizes_init(void) 132void __init zone_sizes_init(void)
133{ 133{
134 unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES]; 134 unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES];
135 unsigned long low, start_pfn; 135 unsigned long low, start_pfn;
136 unsigned long holes = 0;
137 int nid, i; 136 int nid, i;
138 mem_prof_t *mp; 137 mem_prof_t *mp;
139 138
@@ -147,7 +146,6 @@ unsigned long __init zone_sizes_init(void)
147 low = MAX_LOW_PFN(nid); 146 low = MAX_LOW_PFN(nid);
148 zones_size[ZONE_DMA] = low - start_pfn; 147 zones_size[ZONE_DMA] = low - start_pfn;
149 zholes_size[ZONE_DMA] = mp->holes; 148 zholes_size[ZONE_DMA] = mp->holes;
150 holes += zholes_size[ZONE_DMA];
151 149
152 node_set_state(nid, N_NORMAL_MEMORY); 150 node_set_state(nid, N_NORMAL_MEMORY);
153 free_area_init_node(nid, zones_size, start_pfn, zholes_size); 151 free_area_init_node(nid, zones_size, start_pfn, zholes_size);
@@ -161,6 +159,4 @@ unsigned long __init zone_sizes_init(void)
161 NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0; 159 NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0;
162 NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0; 160 NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0;
163 NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0; 161 NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0;
164
165 return holes;
166} 162}
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index ab4cbce91a9b..0d4146f644dc 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -40,7 +40,6 @@ unsigned long mmu_context_cache_dat;
40#else 40#else
41unsigned long mmu_context_cache_dat[NR_CPUS]; 41unsigned long mmu_context_cache_dat[NR_CPUS];
42#endif 42#endif
43static unsigned long hole_pages;
44 43
45/* 44/*
46 * function prototype 45 * function prototype
@@ -57,7 +56,7 @@ void free_initrd_mem(unsigned long, unsigned long);
57#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) 56#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn)
58 57
59#ifndef CONFIG_DISCONTIGMEM 58#ifndef CONFIG_DISCONTIGMEM
60unsigned long __init zone_sizes_init(void) 59void __init zone_sizes_init(void)
61{ 60{
62 unsigned long zones_size[MAX_NR_ZONES] = {0, }; 61 unsigned long zones_size[MAX_NR_ZONES] = {0, };
63 unsigned long max_dma; 62 unsigned long max_dma;
@@ -83,11 +82,9 @@ unsigned long __init zone_sizes_init(void)
83#endif /* CONFIG_MMU */ 82#endif /* CONFIG_MMU */
84 83
85 free_area_init_node(0, zones_size, start_pfn, 0); 84 free_area_init_node(0, zones_size, start_pfn, 0);
86
87 return 0;
88} 85}
89#else /* CONFIG_DISCONTIGMEM */ 86#else /* CONFIG_DISCONTIGMEM */
90extern unsigned long zone_sizes_init(void); 87extern void zone_sizes_init(void);
91#endif /* CONFIG_DISCONTIGMEM */ 88#endif /* CONFIG_DISCONTIGMEM */
92 89
93/*======================================================================* 90/*======================================================================*
@@ -105,24 +102,7 @@ void __init paging_init(void)
105 for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) 102 for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++)
106 pgd_val(pg_dir[i]) = 0; 103 pgd_val(pg_dir[i]) = 0;
107#endif /* CONFIG_MMU */ 104#endif /* CONFIG_MMU */
108 hole_pages = zone_sizes_init(); 105 zone_sizes_init();
109}
110
111int __init reservedpages_count(void)
112{
113 int reservedpages, nid, i;
114
115 reservedpages = 0;
116 for_each_online_node(nid) {
117 unsigned long flags;
118 pgdat_resize_lock(NODE_DATA(nid), &flags);
119 for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++)
120 if (PageReserved(nid_page_nr(nid, i)))
121 reservedpages++;
122 pgdat_resize_unlock(NODE_DATA(nid), &flags);
123 }
124
125 return reservedpages;
126} 106}
127 107
128/*======================================================================* 108/*======================================================================*
@@ -131,48 +111,20 @@ int __init reservedpages_count(void)
131 *======================================================================*/ 111 *======================================================================*/
132void __init mem_init(void) 112void __init mem_init(void)
133{ 113{
134 int codesize, reservedpages, datasize, initsize;
135 int nid;
136#ifndef CONFIG_MMU 114#ifndef CONFIG_MMU
137 extern unsigned long memory_end; 115 extern unsigned long memory_end;
138#endif
139
140 num_physpages = 0;
141 for_each_online_node(nid)
142 num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1;
143
144 num_physpages -= hole_pages;
145 116
146#ifndef CONFIG_DISCONTIGMEM
147 max_mapnr = num_physpages;
148#endif /* CONFIG_DISCONTIGMEM */
149
150#ifdef CONFIG_MMU
151 high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0)));
152#else
153 high_memory = (void *)(memory_end & PAGE_MASK); 117 high_memory = (void *)(memory_end & PAGE_MASK);
118#else
119 high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0)));
154#endif /* CONFIG_MMU */ 120#endif /* CONFIG_MMU */
155 121
156 /* clear the zero-page */ 122 /* clear the zero-page */
157 memset(empty_zero_page, 0, PAGE_SIZE); 123 memset(empty_zero_page, 0, PAGE_SIZE);
158 124
159 /* this will put all low memory onto the freelists */ 125 set_max_mapnr(get_num_physpages());
160 for_each_online_node(nid) 126 free_all_bootmem();
161 totalram_pages += free_all_bootmem_node(NODE_DATA(nid)); 127 mem_init_print_info(NULL);
162
163 reservedpages = reservedpages_count() - hole_pages;
164 codesize = (unsigned long) &_etext - (unsigned long)&_text;
165 datasize = (unsigned long) &_edata - (unsigned long)&_etext;
166 initsize = (unsigned long) &__init_end - (unsigned long)&__init_begin;
167
168 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
169 "%dk reserved, %dk data, %dk init)\n",
170 nr_free_pages() << (PAGE_SHIFT-10),
171 num_physpages << (PAGE_SHIFT-10),
172 codesize >> 10,
173 reservedpages << (PAGE_SHIFT-10),
174 datasize >> 10,
175 initsize >> 10);
176} 128}
177 129
178/*======================================================================* 130/*======================================================================*
@@ -181,7 +133,7 @@ void __init mem_init(void)
181 *======================================================================*/ 133 *======================================================================*/
182void free_initmem(void) 134void free_initmem(void)
183{ 135{
184 free_initmem_default(0); 136 free_initmem_default(-1);
185} 137}
186 138
187#ifdef CONFIG_BLK_DEV_INITRD 139#ifdef CONFIG_BLK_DEV_INITRD
@@ -191,6 +143,6 @@ void free_initmem(void)
191 *======================================================================*/ 143 *======================================================================*/
192void free_initrd_mem(unsigned long start, unsigned long end) 144void free_initrd_mem(unsigned long start, unsigned long end)
193{ 145{
194 free_reserved_area(start, end, 0, "initrd"); 146 free_reserved_area((void *)start, (void *)end, -1, "initrd");
195} 147}
196#endif 148#endif
diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug
index fa12283d58fc..229682721240 100644
--- a/arch/m68k/Kconfig.debug
+++ b/arch/m68k/Kconfig.debug
@@ -11,9 +11,8 @@ config BOOTPARAM_STRING
11 depends on BOOTPARAM 11 depends on BOOTPARAM
12 12
13config EARLY_PRINTK 13config EARLY_PRINTK
14 bool "Early printk" if EMBEDDED 14 bool "Early printk"
15 depends on MVME16x || MAC 15 depends on MVME16x || MAC
16 default y
17 help 16 help
18 Write kernel log output directly to a serial port. 17 Write kernel log output directly to a serial port.
19 18
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index 0f795d8e65fa..b17a8837f0e1 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -214,6 +214,7 @@ CONFIG_DEVTMPFS=y
214# CONFIG_FW_LOADER_USER_HELPER is not set 214# CONFIG_FW_LOADER_USER_HELPER is not set
215CONFIG_CONNECTOR=m 215CONFIG_CONNECTOR=m
216CONFIG_PARPORT=m 216CONFIG_PARPORT=m
217CONFIG_PARPORT_PC=m
217CONFIG_PARPORT_AMIGA=m 218CONFIG_PARPORT_AMIGA=m
218CONFIG_PARPORT_MFC3=m 219CONFIG_PARPORT_MFC3=m
219CONFIG_PARPORT_ATARI=m 220CONFIG_PARPORT_ATARI=m
@@ -325,6 +326,7 @@ CONFIG_ZORRO8390=y
325# CONFIG_NET_VENDOR_SEEQ is not set 326# CONFIG_NET_VENDOR_SEEQ is not set
326# CONFIG_NET_VENDOR_STMICRO is not set 327# CONFIG_NET_VENDOR_STMICRO is not set
327# CONFIG_NET_VENDOR_WIZNET is not set 328# CONFIG_NET_VENDOR_WIZNET is not set
329CONFIG_PLIP=m
328CONFIG_PPP=m 330CONFIG_PPP=m
329CONFIG_PPP_BSDCOMP=m 331CONFIG_PPP_BSDCOMP=m
330CONFIG_PPP_DEFLATE=m 332CONFIG_PPP_DEFLATE=m
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index 8982370e8b42..be1496ed9b66 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_defconfig
@@ -199,6 +199,9 @@ CONFIG_DEVTMPFS=y
199# CONFIG_FIRMWARE_IN_KERNEL is not set 199# CONFIG_FIRMWARE_IN_KERNEL is not set
200# CONFIG_FW_LOADER_USER_HELPER is not set 200# CONFIG_FW_LOADER_USER_HELPER is not set
201CONFIG_CONNECTOR=m 201CONFIG_CONNECTOR=m
202CONFIG_PARPORT=m
203CONFIG_PARPORT_PC=m
204CONFIG_PARPORT_1284=y
202CONFIG_BLK_DEV_LOOP=y 205CONFIG_BLK_DEV_LOOP=y
203CONFIG_BLK_DEV_CRYPTOLOOP=m 206CONFIG_BLK_DEV_CRYPTOLOOP=m
204CONFIG_BLK_DEV_DRBD=m 207CONFIG_BLK_DEV_DRBD=m
@@ -267,6 +270,7 @@ CONFIG_NE2000=m
267# CONFIG_NET_VENDOR_SMSC is not set 270# CONFIG_NET_VENDOR_SMSC is not set
268# CONFIG_NET_VENDOR_STMICRO is not set 271# CONFIG_NET_VENDOR_STMICRO is not set
269# CONFIG_NET_VENDOR_WIZNET is not set 272# CONFIG_NET_VENDOR_WIZNET is not set
273CONFIG_PLIP=m
270CONFIG_PPP=m 274CONFIG_PPP=m
271CONFIG_PPP_BSDCOMP=m 275CONFIG_PPP_BSDCOMP=m
272CONFIG_PPP_DEFLATE=m 276CONFIG_PPP_DEFLATE=m
@@ -292,9 +296,11 @@ CONFIG_SERIO_Q40KBD=y
292CONFIG_VT_HW_CONSOLE_BINDING=y 296CONFIG_VT_HW_CONSOLE_BINDING=y
293# CONFIG_LEGACY_PTYS is not set 297# CONFIG_LEGACY_PTYS is not set
294# CONFIG_DEVKMEM is not set 298# CONFIG_DEVKMEM is not set
299CONFIG_PRINTER=m
295# CONFIG_HW_RANDOM is not set 300# CONFIG_HW_RANDOM is not set
296CONFIG_NTP_PPS=y 301CONFIG_NTP_PPS=y
297CONFIG_PPS_CLIENT_LDISC=m 302CONFIG_PPS_CLIENT_LDISC=m
303CONFIG_PPS_CLIENT_PARPORT=m
298CONFIG_PTP_1588_CLOCK=m 304CONFIG_PTP_1588_CLOCK=m
299# CONFIG_HWMON is not set 305# CONFIG_HWMON is not set
300CONFIG_FB=y 306CONFIG_FB=y
diff --git a/arch/m68k/include/asm/parport.h b/arch/m68k/include/asm/parport.h
index 5ea75e6a7399..c85cece778e8 100644
--- a/arch/m68k/include/asm/parport.h
+++ b/arch/m68k/include/asm/parport.h
@@ -11,6 +11,8 @@
11#ifndef _ASM_M68K_PARPORT_H 11#ifndef _ASM_M68K_PARPORT_H
12#define _ASM_M68K_PARPORT_H 1 12#define _ASM_M68K_PARPORT_H 1
13 13
14#undef insl
15#undef outsl
14#define insl(port,buf,len) isa_insb(port,buf,(len)<<2) 16#define insl(port,buf,len) isa_insb(port,buf,(len)<<2)
15#define outsl(port,buf,len) isa_outsb(port,buf,(len)<<2) 17#define outsl(port,buf,len) isa_outsb(port,buf,(len)<<2)
16 18
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
index dc35e0e106e4..9f5abbda1ea7 100644
--- a/arch/m68k/include/asm/pgtable_mm.h
+++ b/arch/m68k/include/asm/pgtable_mm.h
@@ -135,9 +135,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
135 135
136#define kern_addr_valid(addr) (1) 136#define kern_addr_valid(addr) (1)
137 137
138#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
139 remap_pfn_range(vma, vaddr, pfn, size, prot)
140
141/* MMU-specific headers */ 138/* MMU-specific headers */
142 139
143#ifdef CONFIG_SUN3 140#ifdef CONFIG_SUN3
diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h
index 037028f4ab70..c527fc2ecf82 100644
--- a/arch/m68k/include/asm/pgtable_no.h
+++ b/arch/m68k/include/asm/pgtable_no.h
@@ -55,9 +55,6 @@ extern unsigned int kobjsize(const void *objp);
55 */ 55 */
56#define pgtable_cache_init() do { } while (0) 56#define pgtable_cache_init() do { } while (0)
57 57
58#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
59 remap_pfn_range(vma, vaddr, pfn, size, prot)
60
61/* 58/*
62 * All 32bit addresses are effectively valid for vmalloc... 59 * All 32bit addresses are effectively valid for vmalloc...
63 * Sort of meaningless for non-VM targets. 60 * Sort of meaningless for non-VM targets.
diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
index 9aea9f11fa25..c30c03d98581 100644
--- a/arch/m68k/include/asm/string.h
+++ b/arch/m68k/include/asm/string.h
@@ -4,20 +4,6 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7static inline char *__kernel_strcpy(char *dest, const char *src)
8{
9 char *xdest = dest;
10
11 asm volatile ("\n"
12 "1: move.b (%1)+,(%0)+\n"
13 " jne 1b"
14 : "+a" (dest), "+a" (src)
15 : : "memory");
16 return xdest;
17}
18
19#ifndef __IN_STRING_C
20
21#define __HAVE_ARCH_STRNLEN 7#define __HAVE_ARCH_STRNLEN
22static inline size_t strnlen(const char *s, size_t count) 8static inline size_t strnlen(const char *s, size_t count)
23{ 9{
@@ -34,16 +20,6 @@ static inline size_t strnlen(const char *s, size_t count)
34 return sc - s; 20 return sc - s;
35} 21}
36 22
37#define __HAVE_ARCH_STRCPY
38#if __GNUC__ >= 4
39#define strcpy(d, s) (__builtin_constant_p(s) && \
40 __builtin_strlen(s) <= 32 ? \
41 __builtin_strcpy(d, s) : \
42 __kernel_strcpy(d, s))
43#else
44#define strcpy(d, s) __kernel_strcpy(d, s)
45#endif
46
47#define __HAVE_ARCH_STRNCPY 23#define __HAVE_ARCH_STRNCPY
48static inline char *strncpy(char *dest, const char *src, size_t n) 24static inline char *strncpy(char *dest, const char *src, size_t n)
49{ 25{
@@ -61,12 +37,6 @@ static inline char *strncpy(char *dest, const char *src, size_t n)
61 return xdest; 37 return xdest;
62} 38}
63 39
64#define __HAVE_ARCH_STRCAT
65#define strcat(d, s) ({ \
66 char *__d = (d); \
67 strcpy(__d + strlen(__d), (s)); \
68})
69
70#ifndef CONFIG_COLDFIRE 40#ifndef CONFIG_COLDFIRE
71#define __HAVE_ARCH_STRCMP 41#define __HAVE_ARCH_STRCMP
72static inline int strcmp(const char *cs, const char *ct) 42static inline int strcmp(const char *cs, const char *ct)
@@ -100,6 +70,4 @@ extern void *memset(void *, int, __kernel_size_t);
100extern void *memcpy(void *, const void *, __kernel_size_t); 70extern void *memcpy(void *, const void *, __kernel_size_t);
101#define memcpy(d, s, n) __builtin_memcpy(d, s, n) 71#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
102 72
103#endif
104
105#endif /* _M68K_STRING_H_ */ 73#endif /* _M68K_STRING_H_ */
diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h
index 472c891a4aee..15901db435b9 100644
--- a/arch/m68k/include/asm/uaccess_mm.h
+++ b/arch/m68k/include/asm/uaccess_mm.h
@@ -90,7 +90,7 @@ asm volatile ("\n" \
90 __put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \ 90 __put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \
91 break; \ 91 break; \
92 case 2: \ 92 case 2: \
93 __put_user_asm(__pu_err, __pu_val, ptr, w, d, -EFAULT); \ 93 __put_user_asm(__pu_err, __pu_val, ptr, w, r, -EFAULT); \
94 break; \ 94 break; \
95 case 4: \ 95 case 4: \
96 __put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \ 96 __put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \
@@ -158,7 +158,7 @@ asm volatile ("\n" \
158 __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \ 158 __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \
159 break; \ 159 break; \
160 case 2: \ 160 case 2: \
161 __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \ 161 __get_user_asm(__gu_err, x, ptr, u16, w, r, -EFAULT); \
162 break; \ 162 break; \
163 case 4: \ 163 case 4: \
164 __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \ 164 __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \
@@ -245,7 +245,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
245 __get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1); 245 __get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1);
246 break; 246 break;
247 case 2: 247 case 2:
248 __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, d, 2); 248 __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, r, 2);
249 break; 249 break;
250 case 3: 250 case 3:
251 __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,); 251 __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,);
@@ -326,7 +326,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n)
326 __put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1); 326 __put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1);
327 break; 327 break;
328 case 2: 328 case 2:
329 __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, d, 2); 329 __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, r, 2);
330 break; 330 break;
331 case 3: 331 case 3:
332 __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,); 332 __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,);
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c
index a972b00cd77d..8b7b22846366 100644
--- a/arch/m68k/kernel/asm-offsets.c
+++ b/arch/m68k/kernel/asm-offsets.c
@@ -77,7 +77,7 @@ int main(void)
77 DEFINE(BIR_SIZE, offsetof(struct bi_record, size)); 77 DEFINE(BIR_SIZE, offsetof(struct bi_record, size));
78 DEFINE(BIR_DATA, offsetof(struct bi_record, data)); 78 DEFINE(BIR_DATA, offsetof(struct bi_record, data));
79 79
80 /* offsets into font_desc (drivers/video/console/font.h) */ 80 /* offsets into the font_desc struct */
81 DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx)); 81 DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx));
82 DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name)); 82 DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name));
83 DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width)); 83 DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width));
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 6b32b64bac35..4d7da384eea0 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -101,7 +101,7 @@ void __init m68k_setup_user_interrupt(unsigned int vec, unsigned int cnt)
101 BUG_ON(IRQ_USER + cnt > NR_IRQS); 101 BUG_ON(IRQ_USER + cnt > NR_IRQS);
102 m68k_first_user_vec = vec; 102 m68k_first_user_vec = vec;
103 for (i = 0; i < cnt; i++) 103 for (i = 0; i < cnt; i++)
104 irq_set_chip(IRQ_USER + i, &user_irq_chip); 104 irq_set_chip_and_handler(i, &user_irq_chip, handle_simple_irq);
105 *user_irqvec_fixup = vec - IRQ_USER; 105 *user_irqvec_fixup = vec - IRQ_USER;
106 flush_icache(); 106 flush_icache();
107} 107}
diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile
index a9d782d34276..fcd8eb1d7c7d 100644
--- a/arch/m68k/lib/Makefile
+++ b/arch/m68k/lib/Makefile
@@ -6,7 +6,7 @@
6lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 6lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
7 memcpy.o memset.o memmove.o 7 memcpy.o memset.o memmove.o
8 8
9lib-$(CONFIG_MMU) += string.o uaccess.o 9lib-$(CONFIG_MMU) += uaccess.o
10lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += mulsi3.o divsi3.o udivsi3.o 10lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += mulsi3.o divsi3.o udivsi3.o
11lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += modsi3.o umodsi3.o 11lib-$(CONFIG_CPU_HAS_NO_MULDIV64) += modsi3.o umodsi3.o
12 12
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
deleted file mode 100644
index 4d61fa8a112c..000000000000
--- a/arch/m68k/lib/string.c
+++ /dev/null
@@ -1,22 +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
7#define __IN_STRING_C
8
9#include <linux/module.h>
10#include <linux/string.h>
11
12char *strcpy(char *dest, const char *src)
13{
14 return __kernel_strcpy(dest, src);
15}
16EXPORT_SYMBOL(strcpy);
17
18char *strcat(char *dest, const char *src)
19{
20 return __kernel_strcpy(dest + strlen(dest), src);
21}
22EXPORT_SYMBOL(strcat);
diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c
index 5e97f2ee7c11..35d1442dee89 100644
--- a/arch/m68k/lib/uaccess.c
+++ b/arch/m68k/lib/uaccess.c
@@ -52,7 +52,7 @@ unsigned long __generic_copy_from_user(void *to, const void __user *from,
52 " .long 3b,30b\n" 52 " .long 3b,30b\n"
53 " .long 5b,50b\n" 53 " .long 5b,50b\n"
54 " .previous" 54 " .previous"
55 : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) 55 : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
56 : "0" (n / 4), "d" (n & 3)); 56 : "0" (n / 4), "d" (n & 3));
57 57
58 return res; 58 return res;
@@ -96,7 +96,7 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from,
96 " .long 7b,50b\n" 96 " .long 7b,50b\n"
97 " .long 8b,50b\n" 97 " .long 8b,50b\n"
98 " .previous" 98 " .previous"
99 : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) 99 : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp)
100 : "0" (n / 4), "d" (n & 3)); 100 : "0" (n / 4), "d" (n & 3));
101 101
102 return res; 102 return res;
@@ -141,7 +141,7 @@ unsigned long __clear_user(void __user *to, unsigned long n)
141 " .long 7b,40b\n" 141 " .long 7b,40b\n"
142 " .previous" 142 " .previous"
143 : "=d" (res), "+a" (to) 143 : "=d" (res), "+a" (to)
144 : "r" (0), "0" (n / 4), "d" (n & 3)); 144 : "d" (0), "0" (n / 4), "d" (n & 3));
145 145
146 return res; 146 return res;
147} 147}
diff --git a/arch/m68k/math-emu/fp_arith.c b/arch/m68k/math-emu/fp_arith.c
index 08f286db3c5a..239eb1990184 100644
--- a/arch/m68k/math-emu/fp_arith.c
+++ b/arch/m68k/math-emu/fp_arith.c
@@ -519,7 +519,7 @@ static void fp_roundint(struct fp_ext *dest, int mode)
519 return; 519 return;
520 break; 520 break;
521 case 0x401e: 521 case 0x401e:
522 if (!(oldmant.m32[1] >= 0)) 522 if (oldmant.m32[1] & 0x80000000)
523 return; 523 return;
524 if (oldmant.m32[0] & 1) 524 if (oldmant.m32[0] & 1)
525 break; 525 break;
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 1af2ca3411f6..6b4baa6e4d31 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -110,7 +110,7 @@ void __init paging_init(void)
110void free_initmem(void) 110void free_initmem(void)
111{ 111{
112#ifndef CONFIG_MMU_SUN3 112#ifndef CONFIG_MMU_SUN3
113 free_initmem_default(0); 113 free_initmem_default(-1);
114#endif /* CONFIG_MMU_SUN3 */ 114#endif /* CONFIG_MMU_SUN3 */
115} 115}
116 116
@@ -146,38 +146,11 @@ void __init print_memmap(void)
146 MLK_ROUNDUP(__bss_start, __bss_stop)); 146 MLK_ROUNDUP(__bss_start, __bss_stop));
147} 147}
148 148
149void __init mem_init(void) 149static inline void init_pointer_tables(void)
150{ 150{
151 pg_data_t *pgdat; 151#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
152 int codepages = 0;
153 int datapages = 0;
154 int initpages = 0;
155 int i; 152 int i;
156 153
157 /* this will put all memory onto the freelists */
158 totalram_pages = num_physpages = 0;
159 for_each_online_pgdat(pgdat) {
160 num_physpages += pgdat->node_present_pages;
161
162 totalram_pages += free_all_bootmem_node(pgdat);
163 for (i = 0; i < pgdat->node_spanned_pages; i++) {
164 struct page *page = pgdat->node_mem_map + i;
165 char *addr = page_to_virt(page);
166
167 if (!PageReserved(page))
168 continue;
169 if (addr >= _text &&
170 addr < _etext)
171 codepages++;
172 else if (addr >= __init_begin &&
173 addr < __init_end)
174 initpages++;
175 else
176 datapages++;
177 }
178 }
179
180#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
181 /* insert pointer tables allocated so far into the tablelist */ 154 /* insert pointer tables allocated so far into the tablelist */
182 init_pointer_table((unsigned long)kernel_pg_dir); 155 init_pointer_table((unsigned long)kernel_pg_dir);
183 for (i = 0; i < PTRS_PER_PGD; i++) { 156 for (i = 0; i < PTRS_PER_PGD; i++) {
@@ -189,19 +162,20 @@ void __init mem_init(void)
189 if (zero_pgtable) 162 if (zero_pgtable)
190 init_pointer_table((unsigned long)zero_pgtable); 163 init_pointer_table((unsigned long)zero_pgtable);
191#endif 164#endif
165}
192 166
193 pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", 167void __init mem_init(void)
194 nr_free_pages() << (PAGE_SHIFT-10), 168{
195 totalram_pages << (PAGE_SHIFT-10), 169 /* this will put all memory onto the freelists */
196 codepages << (PAGE_SHIFT-10), 170 free_all_bootmem();
197 datapages << (PAGE_SHIFT-10), 171 init_pointer_tables();
198 initpages << (PAGE_SHIFT-10)); 172 mem_init_print_info(NULL);
199 print_memmap(); 173 print_memmap();
200} 174}
201 175
202#ifdef CONFIG_BLK_DEV_INITRD 176#ifdef CONFIG_BLK_DEV_INITRD
203void free_initrd_mem(unsigned long start, unsigned long end) 177void free_initrd_mem(unsigned long start, unsigned long end)
204{ 178{
205 free_reserved_area(start, end, 0, "initrd"); 179 free_reserved_area((void *)start, (void *)end, -1, "initrd");
206} 180}
207#endif 181#endif
diff --git a/arch/m68k/platform/coldfire/pci.c b/arch/m68k/platform/coldfire/pci.c
index 8572246db84d..b33f97a13e6d 100644
--- a/arch/m68k/platform/coldfire/pci.c
+++ b/arch/m68k/platform/coldfire/pci.c
@@ -320,7 +320,6 @@ static int __init mcf_pci_init(void)
320 pci_bus_size_bridges(rootbus); 320 pci_bus_size_bridges(rootbus);
321 pci_bus_assign_resources(rootbus); 321 pci_bus_assign_resources(rootbus);
322 pci_enable_bridges(rootbus); 322 pci_enable_bridges(rootbus);
323 pci_bus_add_devices(rootbus);
324 return 0; 323 return 0;
325} 324}
326 325
diff --git a/arch/m68k/sun3/sun3dvma.c b/arch/m68k/sun3/sun3dvma.c
index ca0966cac72a..cab54482ca34 100644
--- a/arch/m68k/sun3/sun3dvma.c
+++ b/arch/m68k/sun3/sun3dvma.c
@@ -275,7 +275,7 @@ void dvma_init(void)
275 275
276} 276}
277 277
278inline unsigned long dvma_map_align(unsigned long kaddr, int len, int align) 278unsigned long dvma_map_align(unsigned long kaddr, int len, int align)
279{ 279{
280 280
281 unsigned long baddr; 281 unsigned long baddr;
diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig
index dcd94406030e..cfd831c29824 100644
--- a/arch/metag/Kconfig
+++ b/arch/metag/Kconfig
@@ -30,6 +30,7 @@ config METAG
30 select OF 30 select OF
31 select OF_EARLY_FLATTREE 31 select OF_EARLY_FLATTREE
32 select SPARSE_IRQ 32 select SPARSE_IRQ
33 select HAVE_DEBUG_STACKOVERFLOW
33 34
34config STACKTRACE_SUPPORT 35config STACKTRACE_SUPPORT
35 def_bool y 36 def_bool y
diff --git a/arch/metag/Kconfig.debug b/arch/metag/Kconfig.debug
index e45bbf6a7a5d..cb5c92860540 100644
--- a/arch/metag/Kconfig.debug
+++ b/arch/metag/Kconfig.debug
@@ -6,13 +6,6 @@ config TRACE_IRQFLAGS_SUPPORT
6 6
7source "lib/Kconfig.debug" 7source "lib/Kconfig.debug"
8 8
9config DEBUG_STACKOVERFLOW
10 bool "Check for stack overflows"
11 depends on DEBUG_KERNEL
12 help
13 This option will cause messages to be printed if free stack space
14 drops below a certain limit.
15
16config 4KSTACKS 9config 4KSTACKS
17 bool "Use 4Kb for kernel stacks instead of 8Kb" 10 bool "Use 4Kb for kernel stacks instead of 8Kb"
18 depends on DEBUG_KERNEL 11 depends on DEBUG_KERNEL
diff --git a/arch/metag/include/asm/hugetlb.h b/arch/metag/include/asm/hugetlb.h
index f545477e61f3..471f481e67f3 100644
--- a/arch/metag/include/asm/hugetlb.h
+++ b/arch/metag/include/asm/hugetlb.h
@@ -2,6 +2,7 @@
2#define _ASM_METAG_HUGETLB_H 2#define _ASM_METAG_HUGETLB_H
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <asm-generic/hugetlb.h>
5 6
6 7
7static inline int is_hugepage_only_range(struct mm_struct *mm, 8static inline int is_hugepage_only_range(struct mm_struct *mm,
diff --git a/arch/metag/include/asm/pgtable.h b/arch/metag/include/asm/pgtable.h
index 1cd13d595198..0d9dc5487296 100644
--- a/arch/metag/include/asm/pgtable.h
+++ b/arch/metag/include/asm/pgtable.h
@@ -333,9 +333,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
333 333
334#define kern_addr_valid(addr) (1) 334#define kern_addr_valid(addr) (1)
335 335
336#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
337 remap_pfn_range(vma, vaddr, pfn, size, prot)
338
339/* 336/*
340 * No page table caches to initialise 337 * No page table caches to initialise
341 */ 338 */
diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index 366569425c52..5b18888ee364 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -882,7 +882,7 @@ static int __init init_hw_perf_events(void)
882 } 882 }
883 883
884 register_cpu_notifier(&metag_pmu_notifier); 884 register_cpu_notifier(&metag_pmu_notifier);
885 ret = perf_pmu_register(&pmu, (char *)metag_pmu->name, PERF_TYPE_RAW); 885 ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW);
886out: 886out:
887 return ret; 887 return ret;
888} 888}
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index d05b8455c44c..28813f164730 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -376,34 +376,21 @@ void __init paging_init(unsigned long mem_end)
376 376
377void __init mem_init(void) 377void __init mem_init(void)
378{ 378{
379 int nid;
380
381#ifdef CONFIG_HIGHMEM 379#ifdef CONFIG_HIGHMEM
382 unsigned long tmp; 380 unsigned long tmp;
381
382 /*
383 * Explicitly reset zone->managed_pages because highmem pages are
384 * freed before calling free_all_bootmem();
385 */
386 reset_all_zones_managed_pages();
383 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) 387 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++)
384 free_highmem_page(pfn_to_page(tmp)); 388 free_highmem_page(pfn_to_page(tmp));
385 num_physpages += totalhigh_pages;
386#endif /* CONFIG_HIGHMEM */ 389#endif /* CONFIG_HIGHMEM */
387 390
388 for_each_online_node(nid) { 391 free_all_bootmem();
389 pg_data_t *pgdat = NODE_DATA(nid); 392 mem_init_print_info(NULL);
390 unsigned long node_pages = 0;
391
392 num_physpages += pgdat->node_present_pages;
393
394 if (pgdat->node_spanned_pages)
395 node_pages = free_all_bootmem_node(pgdat);
396
397 totalram_pages += node_pages;
398 }
399
400 pr_info("Memory: %luk/%luk available\n",
401 (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10),
402 num_physpages << (PAGE_SHIFT - 10));
403
404 show_mem(0); 393 show_mem(0);
405
406 return;
407} 394}
408 395
409void free_initmem(void) 396void free_initmem(void)
@@ -414,7 +401,8 @@ void free_initmem(void)
414#ifdef CONFIG_BLK_DEV_INITRD 401#ifdef CONFIG_BLK_DEV_INITRD
415void free_initrd_mem(unsigned long start, unsigned long end) 402void free_initrd_mem(unsigned long start, unsigned long end)
416{ 403{
417 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 404 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
405 "initrd");
418} 406}
419#endif 407#endif
420 408
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 85a5ae8e9bd0..fd850879854d 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -168,7 +168,6 @@ extern int page_is_ram(unsigned long pfn);
168# else /* CONFIG_MMU */ 168# else /* CONFIG_MMU */
169# define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT) 169# define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT)
170# define pfn_valid(pfn) ((pfn) < (max_mapnr + ARCH_PFN_OFFSET)) 170# define pfn_valid(pfn) ((pfn) < (max_mapnr + ARCH_PFN_OFFSET))
171# define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
172# endif /* CONFIG_MMU */ 171# endif /* CONFIG_MMU */
173 172
174# endif /* __ASSEMBLY__ */ 173# endif /* __ASSEMBLY__ */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index a7311cd9dee0..95cef0b5f836 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -13,9 +13,6 @@
13 13
14#include <asm/setup.h> 14#include <asm/setup.h>
15 15
16#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
17 remap_pfn_range(vma, vaddr, pfn, size, prot)
18
19#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
20extern int mem_init_done; 17extern int mem_init_done;
21#endif 18#endif
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 04e49553bdf9..0aa005703a0b 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -145,7 +145,7 @@ static inline unsigned long __must_check __clear_user(void __user *to,
145static inline unsigned long __must_check clear_user(void __user *to, 145static inline unsigned long __must_check clear_user(void __user *to,
146 unsigned long n) 146 unsigned long n)
147{ 147{
148 might_sleep(); 148 might_fault();
149 if (unlikely(!access_ok(VERIFY_WRITE, to, n))) 149 if (unlikely(!access_ok(VERIFY_WRITE, to, n)))
150 return n; 150 return n;
151 151
@@ -371,7 +371,7 @@ extern long __user_bad(void);
371static inline long copy_from_user(void *to, 371static inline long copy_from_user(void *to,
372 const void __user *from, unsigned long n) 372 const void __user *from, unsigned long n)
373{ 373{
374 might_sleep(); 374 might_fault();
375 if (access_ok(VERIFY_READ, from, n)) 375 if (access_ok(VERIFY_READ, from, n))
376 return __copy_from_user(to, from, n); 376 return __copy_from_user(to, from, n);
377 return n; 377 return n;
@@ -385,7 +385,7 @@ static inline long copy_from_user(void *to,
385static inline long copy_to_user(void __user *to, 385static inline long copy_to_user(void __user *to,
386 const void *from, unsigned long n) 386 const void *from, unsigned long n)
387{ 387{
388 might_sleep(); 388 might_fault();
389 if (access_ok(VERIFY_WRITE, to, n)) 389 if (access_ok(VERIFY_WRITE, to, n))
390 return __copy_to_user(to, from, n); 390 return __copy_to_user(to, from, n);
391 return n; 391 return n;
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index b38ae3acfeb4..74c7bcc1e82d 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -71,24 +71,17 @@ static void __init highmem_init(void)
71 kmap_prot = PAGE_KERNEL; 71 kmap_prot = PAGE_KERNEL;
72} 72}
73 73
74static unsigned long highmem_setup(void) 74static void highmem_setup(void)
75{ 75{
76 unsigned long pfn; 76 unsigned long pfn;
77 unsigned long reservedpages = 0;
78 77
79 for (pfn = max_low_pfn; pfn < max_pfn; ++pfn) { 78 for (pfn = max_low_pfn; pfn < max_pfn; ++pfn) {
80 struct page *page = pfn_to_page(pfn); 79 struct page *page = pfn_to_page(pfn);
81 80
82 /* FIXME not sure about */ 81 /* FIXME not sure about */
83 if (memblock_is_reserved(pfn << PAGE_SHIFT)) 82 if (!memblock_is_reserved(pfn << PAGE_SHIFT))
84 continue; 83 free_highmem_page(page);
85 free_highmem_page(page);
86 reservedpages++;
87 } 84 }
88 pr_info("High memory: %luk\n",
89 totalhigh_pages << (PAGE_SHIFT-10));
90
91 return reservedpages;
92} 85}
93#endif /* CONFIG_HIGHMEM */ 86#endif /* CONFIG_HIGHMEM */
94 87
@@ -167,13 +160,12 @@ void __init setup_memory(void)
167 * min_low_pfn - the first page (mm/bootmem.c - node_boot_start) 160 * min_low_pfn - the first page (mm/bootmem.c - node_boot_start)
168 * max_low_pfn 161 * max_low_pfn
169 * max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn) 162 * max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn)
170 * num_physpages - number of all pages
171 */ 163 */
172 164
173 /* memory start is from the kernel end (aligned) to higher addr */ 165 /* memory start is from the kernel end (aligned) to higher addr */
174 min_low_pfn = memory_start >> PAGE_SHIFT; /* minimum for allocation */ 166 min_low_pfn = memory_start >> PAGE_SHIFT; /* minimum for allocation */
175 /* RAM is assumed contiguous */ 167 /* RAM is assumed contiguous */
176 num_physpages = max_mapnr = memory_size >> PAGE_SHIFT; 168 max_mapnr = memory_size >> PAGE_SHIFT;
177 max_low_pfn = ((u64)memory_start + (u64)lowmem_size) >> PAGE_SHIFT; 169 max_low_pfn = ((u64)memory_start + (u64)lowmem_size) >> PAGE_SHIFT;
178 max_pfn = ((u64)memory_start + (u64)memory_size) >> PAGE_SHIFT; 170 max_pfn = ((u64)memory_start + (u64)memory_size) >> PAGE_SHIFT;
179 171
@@ -235,57 +227,26 @@ void __init setup_memory(void)
235#ifdef CONFIG_BLK_DEV_INITRD 227#ifdef CONFIG_BLK_DEV_INITRD
236void free_initrd_mem(unsigned long start, unsigned long end) 228void free_initrd_mem(unsigned long start, unsigned long end)
237{ 229{
238 free_reserved_area(start, end, 0, "initrd"); 230 free_reserved_area((void *)start, (void *)end, -1, "initrd");
239} 231}
240#endif 232#endif
241 233
242void free_initmem(void) 234void free_initmem(void)
243{ 235{
244 free_initmem_default(0); 236 free_initmem_default(-1);
245} 237}
246 238
247void __init mem_init(void) 239void __init mem_init(void)
248{ 240{
249 pg_data_t *pgdat;
250 unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
251
252 high_memory = (void *)__va(memory_start + lowmem_size - 1); 241 high_memory = (void *)__va(memory_start + lowmem_size - 1);
253 242
254 /* this will put all memory onto the freelists */ 243 /* this will put all memory onto the freelists */
255 totalram_pages += free_all_bootmem(); 244 free_all_bootmem();
256
257 for_each_online_pgdat(pgdat) {
258 unsigned long i;
259 struct page *page;
260
261 for (i = 0; i < pgdat->node_spanned_pages; i++) {
262 if (!pfn_valid(pgdat->node_start_pfn + i))
263 continue;
264 page = pgdat_page_nr(pgdat, i);
265 if (PageReserved(page))
266 reservedpages++;
267 }
268 }
269
270#ifdef CONFIG_HIGHMEM 245#ifdef CONFIG_HIGHMEM
271 reservedpages -= highmem_setup(); 246 highmem_setup();
272#endif 247#endif
273 248
274 codesize = (unsigned long)&_sdata - (unsigned long)&_stext; 249 mem_init_print_info(NULL);
275 datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
276 initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
277 bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
278
279 pr_info("Memory: %luk/%luk available (%luk kernel code, ",
280 nr_free_pages() << (PAGE_SHIFT-10),
281 num_physpages << (PAGE_SHIFT-10),
282 codesize >> 10);
283 pr_cont("%luk reserved, %luk data, %luk bss, %luk init)\n",
284 reservedpages << (PAGE_SHIFT-10),
285 datasize >> 10,
286 bsssize >> 10,
287 initsize >> 10);
288
289#ifdef CONFIG_MMU 250#ifdef CONFIG_MMU
290 pr_info("Kernel virtual memory layout:\n"); 251 pr_info("Kernel virtual memory layout:\n");
291 pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); 252 pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 7a58ab933b20..beeff436b22f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -42,6 +42,7 @@ config MIPS
42 select MODULES_USE_ELF_REL if MODULES 42 select MODULES_USE_ELF_REL if MODULES
43 select MODULES_USE_ELF_RELA if MODULES && 64BIT 43 select MODULES_USE_ELF_RELA if MODULES && 64BIT
44 select CLONE_BACKWARDS 44 select CLONE_BACKWARDS
45 select HAVE_DEBUG_STACKOVERFLOW
45 46
46menu "Machine selection" 47menu "Machine selection"
47 48
@@ -962,7 +963,7 @@ config SYS_HAS_EARLY_PRINTK
962 963
963config HOTPLUG_CPU 964config HOTPLUG_CPU
964 bool "Support for hot-pluggable CPUs" 965 bool "Support for hot-pluggable CPUs"
965 depends on SMP && HOTPLUG && SYS_SUPPORTS_HOTPLUG_CPU 966 depends on SMP && SYS_SUPPORTS_HOTPLUG_CPU
966 help 967 help
967 Say Y here to allow turning CPUs off and on. CPUs can be 968 Say Y here to allow turning CPUs off and on. CPUs can be
968 controlled through /sys/devices/system/cpu. 969 controlled through /sys/devices/system/cpu.
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 5a43aa0798ca..37871f0de15e 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -67,15 +67,6 @@ config CMDLINE_OVERRIDE
67 67
68 Normally, you will choose 'N' here. 68 Normally, you will choose 'N' here.
69 69
70config DEBUG_STACKOVERFLOW
71 bool "Check for stack overflows"
72 depends on DEBUG_KERNEL
73 help
74 This option will cause messages to be printed if free stack space
75 drops below a certain limit(2GB on MIPS). The debugging option
76 provides another way to check stack overflow happened on kernel mode
77 stack usually caused by nested interruption.
78
79config SMTC_IDLE_HOOK_DEBUG 70config SMTC_IDLE_HOOK_DEBUG
80 bool "Enable additional debug checks before going into CPU idle loop" 71 bool "Enable additional debug checks before going into CPU idle loop"
81 depends on DEBUG_KERNEL && MIPS_MT_SMTC 72 depends on DEBUG_KERNEL && MIPS_MT_SMTC
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index a22f06a6f7ca..7181def6037a 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -607,7 +607,7 @@ static void octeon_irq_ciu_gpio_ack(struct irq_data *data)
607 607
608static void octeon_irq_handle_gpio(unsigned int irq, struct irq_desc *desc) 608static void octeon_irq_handle_gpio(unsigned int irq, struct irq_desc *desc)
609{ 609{
610 if (irqd_get_trigger_type(irq_desc_get_irq_data(desc)) & IRQ_TYPE_EDGE_BOTH) 610 if (irq_get_trigger_type(irq) & IRQ_TYPE_EDGE_BOTH)
611 handle_edge_irq(irq, desc); 611 handle_edge_irq(irq, desc);
612 else 612 else
613 handle_level_irq(irq, desc); 613 handle_level_irq(irq, desc);
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 820116067c10..516e6e9a5594 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -117,7 +117,7 @@ get_new_mmu_context(struct mm_struct *mm, unsigned long cpu)
117 if (! ((asid += ASID_INC) & ASID_MASK) ) { 117 if (! ((asid += ASID_INC) & ASID_MASK) ) {
118 if (cpu_has_vtag_icache) 118 if (cpu_has_vtag_icache)
119 flush_icache_all(); 119 flush_icache_all();
120#ifdef CONFIG_VIRTUALIZATION 120#ifdef CONFIG_KVM
121 kvm_local_flush_tlb_all(); /* start new asid cycle */ 121 kvm_local_flush_tlb_all(); /* start new asid cycle */
122#else 122#else
123 local_flush_tlb_all(); /* start new asid cycle */ 123 local_flush_tlb_all(); /* start new asid cycle */
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h
index 8b8f6b393363..008324d1c261 100644
--- a/arch/mips/include/asm/pgtable.h
+++ b/arch/mips/include/asm/pgtable.h
@@ -394,9 +394,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
394 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size); 394 phys_t phys_addr_high = fixup_bigphys_addr(pfn << PAGE_SHIFT, size);
395 return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot); 395 return remap_pfn_range(vma, vaddr, phys_addr_high >> PAGE_SHIFT, size, prot);
396} 396}
397#else 397#define io_remap_pfn_range io_remap_pfn_range
398#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
399 remap_pfn_range(vma, vaddr, pfn, size, prot)
400#endif 398#endif
401 399
402#ifdef CONFIG_TRANSPARENT_HUGEPAGE 400#ifdef CONFIG_TRANSPARENT_HUGEPAGE
diff --git a/arch/mips/include/uapi/asm/kvm.h b/arch/mips/include/uapi/asm/kvm.h
index 3f424f5217da..f09ff5ae2059 100644
--- a/arch/mips/include/uapi/asm/kvm.h
+++ b/arch/mips/include/uapi/asm/kvm.h
@@ -58,56 +58,53 @@ struct kvm_fpu {
58 * bits[2..0] - Register 'sel' index. 58 * bits[2..0] - Register 'sel' index.
59 * bits[7..3] - Register 'rd' index. 59 * bits[7..3] - Register 'rd' index.
60 * bits[15..8] - Must be zero. 60 * bits[15..8] - Must be zero.
61 * bits[63..16] - 1 -> CP0 registers. 61 * bits[31..16] - 1 -> CP0 registers.
62 * bits[51..32] - Must be zero.
63 * bits[63..52] - As per linux/kvm.h
62 * 64 *
63 * Other sets registers may be added in the future. Each set would 65 * Other sets registers may be added in the future. Each set would
64 * have its own identifier in bits[63..16]. 66 * have its own identifier in bits[31..16].
65 *
66 * The addr field of struct kvm_one_reg must point to an aligned
67 * 64-bit wide location. For registers that are narrower than
68 * 64-bits, the value is stored in the low order bits of the location,
69 * and sign extended to 64-bits.
70 * 67 *
71 * The registers defined in struct kvm_regs are also accessible, the 68 * The registers defined in struct kvm_regs are also accessible, the
72 * id values for these are below. 69 * id values for these are below.
73 */ 70 */
74 71
75#define KVM_REG_MIPS_R0 0 72#define KVM_REG_MIPS_R0 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0)
76#define KVM_REG_MIPS_R1 1 73#define KVM_REG_MIPS_R1 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 1)
77#define KVM_REG_MIPS_R2 2 74#define KVM_REG_MIPS_R2 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 2)
78#define KVM_REG_MIPS_R3 3 75#define KVM_REG_MIPS_R3 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 3)
79#define KVM_REG_MIPS_R4 4 76#define KVM_REG_MIPS_R4 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 4)
80#define KVM_REG_MIPS_R5 5 77#define KVM_REG_MIPS_R5 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 5)
81#define KVM_REG_MIPS_R6 6 78#define KVM_REG_MIPS_R6 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 6)
82#define KVM_REG_MIPS_R7 7 79#define KVM_REG_MIPS_R7 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 7)
83#define KVM_REG_MIPS_R8 8 80#define KVM_REG_MIPS_R8 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 8)
84#define KVM_REG_MIPS_R9 9 81#define KVM_REG_MIPS_R9 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 9)
85#define KVM_REG_MIPS_R10 10 82#define KVM_REG_MIPS_R10 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 10)
86#define KVM_REG_MIPS_R11 11 83#define KVM_REG_MIPS_R11 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 11)
87#define KVM_REG_MIPS_R12 12 84#define KVM_REG_MIPS_R12 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 12)
88#define KVM_REG_MIPS_R13 13 85#define KVM_REG_MIPS_R13 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 13)
89#define KVM_REG_MIPS_R14 14 86#define KVM_REG_MIPS_R14 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 14)
90#define KVM_REG_MIPS_R15 15 87#define KVM_REG_MIPS_R15 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 15)
91#define KVM_REG_MIPS_R16 16 88#define KVM_REG_MIPS_R16 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 16)
92#define KVM_REG_MIPS_R17 17 89#define KVM_REG_MIPS_R17 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 17)
93#define KVM_REG_MIPS_R18 18 90#define KVM_REG_MIPS_R18 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 18)
94#define KVM_REG_MIPS_R19 19 91#define KVM_REG_MIPS_R19 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 19)
95#define KVM_REG_MIPS_R20 20 92#define KVM_REG_MIPS_R20 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 20)
96#define KVM_REG_MIPS_R21 21 93#define KVM_REG_MIPS_R21 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 21)
97#define KVM_REG_MIPS_R22 22 94#define KVM_REG_MIPS_R22 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 22)
98#define KVM_REG_MIPS_R23 23 95#define KVM_REG_MIPS_R23 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 23)
99#define KVM_REG_MIPS_R24 24 96#define KVM_REG_MIPS_R24 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 24)
100#define KVM_REG_MIPS_R25 25 97#define KVM_REG_MIPS_R25 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 25)
101#define KVM_REG_MIPS_R26 26 98#define KVM_REG_MIPS_R26 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 26)
102#define KVM_REG_MIPS_R27 27 99#define KVM_REG_MIPS_R27 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 27)
103#define KVM_REG_MIPS_R28 28 100#define KVM_REG_MIPS_R28 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 28)
104#define KVM_REG_MIPS_R29 29 101#define KVM_REG_MIPS_R29 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 29)
105#define KVM_REG_MIPS_R30 30 102#define KVM_REG_MIPS_R30 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 30)
106#define KVM_REG_MIPS_R31 31 103#define KVM_REG_MIPS_R31 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 31)
107 104
108#define KVM_REG_MIPS_HI 32 105#define KVM_REG_MIPS_HI (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 32)
109#define KVM_REG_MIPS_LO 33 106#define KVM_REG_MIPS_LO (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 33)
110#define KVM_REG_MIPS_PC 34 107#define KVM_REG_MIPS_PC (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 34)
111 108
112/* 109/*
113 * KVM MIPS specific structures and definitions 110 * KVM MIPS specific structures and definitions
diff --git a/arch/mips/kernel/crash_dump.c b/arch/mips/kernel/crash_dump.c
index 3be9e7bb30ff..f291cf99b03a 100644
--- a/arch/mips/kernel/crash_dump.c
+++ b/arch/mips/kernel/crash_dump.c
@@ -4,16 +4,6 @@
4#include <asm/uaccess.h> 4#include <asm/uaccess.h>
5#include <linux/slab.h> 5#include <linux/slab.h>
6 6
7static int __init parse_savemaxmem(char *p)
8{
9 if (p)
10 saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
11
12 return 1;
13}
14__setup("savemaxmem=", parse_savemaxmem);
15
16
17static void *kdump_buf_page; 7static void *kdump_buf_page;
18 8
19/** 9/**
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index cf5509f13dd5..dba90ec0dc38 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -25,12 +25,16 @@
25#define MCOUNT_OFFSET_INSNS 4 25#define MCOUNT_OFFSET_INSNS 4
26#endif 26#endif
27 27
28#ifdef CONFIG_DYNAMIC_FTRACE
29
28/* Arch override because MIPS doesn't need to run this from stop_machine() */ 30/* Arch override because MIPS doesn't need to run this from stop_machine() */
29void arch_ftrace_update_code(int command) 31void arch_ftrace_update_code(int command)
30{ 32{
31 ftrace_modify_all_code(command); 33 ftrace_modify_all_code(command);
32} 34}
33 35
36#endif
37
34/* 38/*
35 * Check if the address is in kernel space 39 * Check if the address is in kernel space
36 * 40 *
diff --git a/arch/mips/kernel/idle.c b/arch/mips/kernel/idle.c
index 3b09b888afa9..0c655deeea4a 100644
--- a/arch/mips/kernel/idle.c
+++ b/arch/mips/kernel/idle.c
@@ -93,26 +93,27 @@ static void rm7k_wait_irqoff(void)
93} 93}
94 94
95/* 95/*
96 * The Au1xxx wait is available only if using 32khz counter or 96 * Au1 'wait' is only useful when the 32kHz counter is used as timer,
97 * external timer source, but specifically not CP0 Counter. 97 * since coreclock (and the cp0 counter) stops upon executing it. Only an
98 * alchemy/common/time.c may override cpu_wait! 98 * interrupt can wake it, so they must be enabled before entering idle modes.
99 */ 99 */
100static void au1k_wait(void) 100static void au1k_wait(void)
101{ 101{
102 unsigned long c0status = read_c0_status() | 1; /* irqs on */
103
102 __asm__( 104 __asm__(
103 " .set mips3 \n" 105 " .set mips3 \n"
104 " cache 0x14, 0(%0) \n" 106 " cache 0x14, 0(%0) \n"
105 " cache 0x14, 32(%0) \n" 107 " cache 0x14, 32(%0) \n"
106 " sync \n" 108 " sync \n"
107 " nop \n" 109 " mtc0 %1, $12 \n" /* wr c0status */
108 " wait \n" 110 " wait \n"
109 " nop \n" 111 " nop \n"
110 " nop \n" 112 " nop \n"
111 " nop \n" 113 " nop \n"
112 " nop \n" 114 " nop \n"
113 " .set mips0 \n" 115 " .set mips0 \n"
114 : : "r" (au1k_wait)); 116 : : "r" (au1k_wait), "r" (c0status));
115 local_irq_enable();
116} 117}
117 118
118static int __initdata nowait; 119static int __initdata nowait;
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index fd814e08c945..cb098628aee8 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -27,12 +27,12 @@ unsigned long mt_fpemul_threshold;
27 * FPU affinity with the user's requested processor affinity. 27 * FPU affinity with the user's requested processor affinity.
28 * This code is 98% identical with the sys_sched_setaffinity() 28 * This code is 98% identical with the sys_sched_setaffinity()
29 * and sys_sched_getaffinity() system calls, and should be 29 * and sys_sched_getaffinity() system calls, and should be
30 * updated when kernel/sched.c changes. 30 * updated when kernel/sched/core.c changes.
31 */ 31 */
32 32
33/* 33/*
34 * find_process_by_pid - find a process with a matching PID value. 34 * find_process_by_pid - find a process with a matching PID value.
35 * used in sys_sched_set/getaffinity() in kernel/sched.c, so 35 * used in sys_sched_set/getaffinity() in kernel/sched/core.c, so
36 * cloned here. 36 * cloned here.
37 */ 37 */
38static inline struct task_struct *find_process_by_pid(pid_t pid) 38static inline struct task_struct *find_process_by_pid(pid_t pid)
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 9b36424b03c5..e9127ec612ef 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -476,8 +476,9 @@ einval: li v0, -ENOSYS
476 /* 476 /*
477 * For FPU affinity scheduling on MIPS MT processors, we need to 477 * For FPU affinity scheduling on MIPS MT processors, we need to
478 * intercept sys_sched_xxxaffinity() calls until we get a proper hook 478 * intercept sys_sched_xxxaffinity() calls until we get a proper hook
479 * in kernel/sched.c. Considered only temporary we only support these 479 * in kernel/sched/core.c. Considered only temporary we only support
480 * hooks for the 32-bit kernel - there is no MIPS64 MT processor atm. 480 * these hooks for the 32-bit kernel - there is no MIPS64 MT processor
481 * atm.
481 */ 482 */
482 sys mipsmt_sys_sched_setaffinity 3 483 sys mipsmt_sys_sched_setaffinity 3
483 sys mipsmt_sys_sched_getaffinity 3 484 sys mipsmt_sys_sched_getaffinity 3
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index d934b017f479..dd203e59e6fd 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -485,29 +485,35 @@ kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
485 return -ENOIOCTLCMD; 485 return -ENOIOCTLCMD;
486} 486}
487 487
488#define KVM_REG_MIPS_CP0_INDEX (0x10000 + 8 * 0 + 0) 488#define MIPS_CP0_32(_R, _S) \
489#define KVM_REG_MIPS_CP0_ENTRYLO0 (0x10000 + 8 * 2 + 0) 489 (KVM_REG_MIPS | KVM_REG_SIZE_U32 | 0x10000 | (8 * (_R) + (_S)))
490#define KVM_REG_MIPS_CP0_ENTRYLO1 (0x10000 + 8 * 3 + 0) 490
491#define KVM_REG_MIPS_CP0_CONTEXT (0x10000 + 8 * 4 + 0) 491#define MIPS_CP0_64(_R, _S) \
492#define KVM_REG_MIPS_CP0_USERLOCAL (0x10000 + 8 * 4 + 2) 492 (KVM_REG_MIPS | KVM_REG_SIZE_U64 | 0x10000 | (8 * (_R) + (_S)))
493#define KVM_REG_MIPS_CP0_PAGEMASK (0x10000 + 8 * 5 + 0) 493
494#define KVM_REG_MIPS_CP0_PAGEGRAIN (0x10000 + 8 * 5 + 1) 494#define KVM_REG_MIPS_CP0_INDEX MIPS_CP0_32(0, 0)
495#define KVM_REG_MIPS_CP0_WIRED (0x10000 + 8 * 6 + 0) 495#define KVM_REG_MIPS_CP0_ENTRYLO0 MIPS_CP0_64(2, 0)
496#define KVM_REG_MIPS_CP0_HWRENA (0x10000 + 8 * 7 + 0) 496#define KVM_REG_MIPS_CP0_ENTRYLO1 MIPS_CP0_64(3, 0)
497#define KVM_REG_MIPS_CP0_BADVADDR (0x10000 + 8 * 8 + 0) 497#define KVM_REG_MIPS_CP0_CONTEXT MIPS_CP0_64(4, 0)
498#define KVM_REG_MIPS_CP0_COUNT (0x10000 + 8 * 9 + 0) 498#define KVM_REG_MIPS_CP0_USERLOCAL MIPS_CP0_64(4, 2)
499#define KVM_REG_MIPS_CP0_ENTRYHI (0x10000 + 8 * 10 + 0) 499#define KVM_REG_MIPS_CP0_PAGEMASK MIPS_CP0_32(5, 0)
500#define KVM_REG_MIPS_CP0_COMPARE (0x10000 + 8 * 11 + 0) 500#define KVM_REG_MIPS_CP0_PAGEGRAIN MIPS_CP0_32(5, 1)
501#define KVM_REG_MIPS_CP0_STATUS (0x10000 + 8 * 12 + 0) 501#define KVM_REG_MIPS_CP0_WIRED MIPS_CP0_32(6, 0)
502#define KVM_REG_MIPS_CP0_CAUSE (0x10000 + 8 * 13 + 0) 502#define KVM_REG_MIPS_CP0_HWRENA MIPS_CP0_32(7, 0)
503#define KVM_REG_MIPS_CP0_EBASE (0x10000 + 8 * 15 + 1) 503#define KVM_REG_MIPS_CP0_BADVADDR MIPS_CP0_64(8, 0)
504#define KVM_REG_MIPS_CP0_CONFIG (0x10000 + 8 * 16 + 0) 504#define KVM_REG_MIPS_CP0_COUNT MIPS_CP0_32(9, 0)
505#define KVM_REG_MIPS_CP0_CONFIG1 (0x10000 + 8 * 16 + 1) 505#define KVM_REG_MIPS_CP0_ENTRYHI MIPS_CP0_64(10, 0)
506#define KVM_REG_MIPS_CP0_CONFIG2 (0x10000 + 8 * 16 + 2) 506#define KVM_REG_MIPS_CP0_COMPARE MIPS_CP0_32(11, 0)
507#define KVM_REG_MIPS_CP0_CONFIG3 (0x10000 + 8 * 16 + 3) 507#define KVM_REG_MIPS_CP0_STATUS MIPS_CP0_32(12, 0)
508#define KVM_REG_MIPS_CP0_CONFIG7 (0x10000 + 8 * 16 + 7) 508#define KVM_REG_MIPS_CP0_CAUSE MIPS_CP0_32(13, 0)
509#define KVM_REG_MIPS_CP0_XCONTEXT (0x10000 + 8 * 20 + 0) 509#define KVM_REG_MIPS_CP0_EBASE MIPS_CP0_64(15, 1)
510#define KVM_REG_MIPS_CP0_ERROREPC (0x10000 + 8 * 30 + 0) 510#define KVM_REG_MIPS_CP0_CONFIG MIPS_CP0_32(16, 0)
511#define KVM_REG_MIPS_CP0_CONFIG1 MIPS_CP0_32(16, 1)
512#define KVM_REG_MIPS_CP0_CONFIG2 MIPS_CP0_32(16, 2)
513#define KVM_REG_MIPS_CP0_CONFIG3 MIPS_CP0_32(16, 3)
514#define KVM_REG_MIPS_CP0_CONFIG7 MIPS_CP0_32(16, 7)
515#define KVM_REG_MIPS_CP0_XCONTEXT MIPS_CP0_64(20, 0)
516#define KVM_REG_MIPS_CP0_ERROREPC MIPS_CP0_64(30, 0)
511 517
512static u64 kvm_mips_get_one_regs[] = { 518static u64 kvm_mips_get_one_regs[] = {
513 KVM_REG_MIPS_R0, 519 KVM_REG_MIPS_R0,
@@ -567,8 +573,6 @@ static u64 kvm_mips_get_one_regs[] = {
567static int kvm_mips_get_reg(struct kvm_vcpu *vcpu, 573static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
568 const struct kvm_one_reg *reg) 574 const struct kvm_one_reg *reg)
569{ 575{
570 u64 __user *uaddr = (u64 __user *)(long)reg->addr;
571
572 struct mips_coproc *cop0 = vcpu->arch.cop0; 576 struct mips_coproc *cop0 = vcpu->arch.cop0;
573 s64 v; 577 s64 v;
574 578
@@ -631,18 +635,39 @@ static int kvm_mips_get_reg(struct kvm_vcpu *vcpu,
631 default: 635 default:
632 return -EINVAL; 636 return -EINVAL;
633 } 637 }
634 return put_user(v, uaddr); 638 if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64) {
639 u64 __user *uaddr64 = (u64 __user *)(long)reg->addr;
640 return put_user(v, uaddr64);
641 } else if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32) {
642 u32 __user *uaddr32 = (u32 __user *)(long)reg->addr;
643 u32 v32 = (u32)v;
644 return put_user(v32, uaddr32);
645 } else {
646 return -EINVAL;
647 }
635} 648}
636 649
637static int kvm_mips_set_reg(struct kvm_vcpu *vcpu, 650static int kvm_mips_set_reg(struct kvm_vcpu *vcpu,
638 const struct kvm_one_reg *reg) 651 const struct kvm_one_reg *reg)
639{ 652{
640 u64 __user *uaddr = (u64 __user *)(long)reg->addr;
641 struct mips_coproc *cop0 = vcpu->arch.cop0; 653 struct mips_coproc *cop0 = vcpu->arch.cop0;
642 u64 v; 654 u64 v;
643 655
644 if (get_user(v, uaddr) != 0) 656 if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U64) {
645 return -EFAULT; 657 u64 __user *uaddr64 = (u64 __user *)(long)reg->addr;
658
659 if (get_user(v, uaddr64) != 0)
660 return -EFAULT;
661 } else if ((reg->id & KVM_REG_SIZE_MASK) == KVM_REG_SIZE_U32) {
662 u32 __user *uaddr32 = (u32 __user *)(long)reg->addr;
663 s32 v32;
664
665 if (get_user(v32, uaddr32) != 0)
666 return -EFAULT;
667 v = (s64)v32;
668 } else {
669 return -EINVAL;
670 }
646 671
647 switch (reg->id) { 672 switch (reg->id) {
648 case KVM_REG_MIPS_R0: 673 case KVM_REG_MIPS_R0:
diff --git a/arch/mips/loongson/lemote-2f/clock.c b/arch/mips/loongson/lemote-2f/clock.c
index bc739d4bab2e..4dc2f5fa3f67 100644
--- a/arch/mips/loongson/lemote-2f/clock.c
+++ b/arch/mips/loongson/lemote-2f/clock.c
@@ -121,7 +121,8 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
121 clk->rate = rate; 121 clk->rate = rate;
122 122
123 regval = LOONGSON_CHIPCFG0; 123 regval = LOONGSON_CHIPCFG0;
124 regval = (regval & ~0x7) | (loongson2_clockmod_table[i].index - 1); 124 regval = (regval & ~0x7) |
125 (loongson2_clockmod_table[i].driver_data - 1);
125 LOONGSON_CHIPCFG0 = regval; 126 LOONGSON_CHIPCFG0 = regval;
126 127
127 return ret; 128 return ret;
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 9b973e0af9cb..4e73f10a7519 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -359,11 +359,24 @@ void __init paging_init(void)
359static struct kcore_list kcore_kseg0; 359static struct kcore_list kcore_kseg0;
360#endif 360#endif
361 361
362void __init mem_init(void) 362static inline void mem_init_free_highmem(void)
363{ 363{
364 unsigned long codesize, reservedpages, datasize, initsize; 364#ifdef CONFIG_HIGHMEM
365 unsigned long tmp, ram; 365 unsigned long tmp;
366 366
367 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
368 struct page *page = pfn_to_page(tmp);
369
370 if (!page_is_ram(tmp))
371 SetPageReserved(page);
372 else
373 free_highmem_page(page);
374 }
375#endif
376}
377
378void __init mem_init(void)
379{
367#ifdef CONFIG_HIGHMEM 380#ifdef CONFIG_HIGHMEM
368#ifdef CONFIG_DISCONTIGMEM 381#ifdef CONFIG_DISCONTIGMEM
369#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet" 382#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
@@ -374,34 +387,10 @@ void __init mem_init(void)
374#endif 387#endif
375 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 388 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
376 389
377 totalram_pages += free_all_bootmem(); 390 free_all_bootmem();
378 setup_zero_pages(); /* Setup zeroed pages. */ 391 setup_zero_pages(); /* Setup zeroed pages. */
379 392 mem_init_free_highmem();
380 reservedpages = ram = 0; 393 mem_init_print_info(NULL);
381 for (tmp = 0; tmp < max_low_pfn; tmp++)
382 if (page_is_ram(tmp) && pfn_valid(tmp)) {
383 ram++;
384 if (PageReserved(pfn_to_page(tmp)))
385 reservedpages++;
386 }
387 num_physpages = ram;
388
389#ifdef CONFIG_HIGHMEM
390 for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
391 struct page *page = pfn_to_page(tmp);
392
393 if (!page_is_ram(tmp)) {
394 SetPageReserved(page);
395 continue;
396 }
397 free_highmem_page(page);
398 }
399 num_physpages += totalhigh_pages;
400#endif
401
402 codesize = (unsigned long) &_etext - (unsigned long) &_text;
403 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
404 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
405 394
406#ifdef CONFIG_64BIT 395#ifdef CONFIG_64BIT
407 if ((unsigned long) &_text > (unsigned long) CKSEG0) 396 if ((unsigned long) &_text > (unsigned long) CKSEG0)
@@ -410,16 +399,6 @@ void __init mem_init(void)
410 kclist_add(&kcore_kseg0, (void *) CKSEG0, 399 kclist_add(&kcore_kseg0, (void *) CKSEG0,
411 0x80000000 - 4, KCORE_TEXT); 400 0x80000000 - 4, KCORE_TEXT);
412#endif 401#endif
413
414 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
415 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
416 nr_free_pages() << (PAGE_SHIFT-10),
417 ram << (PAGE_SHIFT-10),
418 codesize >> 10,
419 reservedpages << (PAGE_SHIFT-10),
420 datasize >> 10,
421 initsize >> 10,
422 totalhigh_pages << (PAGE_SHIFT-10));
423} 402}
424#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 403#endif /* !CONFIG_NEED_MULTIPLE_NODES */
425 404
@@ -440,7 +419,8 @@ void free_init_pages(const char *what, unsigned long begin, unsigned long end)
440#ifdef CONFIG_BLK_DEV_INITRD 419#ifdef CONFIG_BLK_DEV_INITRD
441void free_initrd_mem(unsigned long start, unsigned long end) 420void free_initrd_mem(unsigned long start, unsigned long end)
442{ 421{
443 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 422 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
423 "initrd");
444} 424}
445#endif 425#endif
446 426
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index e2e69e1e9fe1..44dd5aa2e36f 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -257,7 +257,9 @@ static int __init bcm1480_pcibios_init(void)
257 register_pci_controller(&bcm1480_controller); 257 register_pci_controller(&bcm1480_controller);
258 258
259#ifdef CONFIG_VGA_CONSOLE 259#ifdef CONFIG_VGA_CONSOLE
260 take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1); 260 console_lock();
261 do_take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1);
262 console_unlock();
261#endif 263#endif
262 return 0; 264 return 0;
263} 265}
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 879077b01155..cb1ef9984069 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -89,7 +89,7 @@ static inline u32 ltq_calc_bar11mask(void)
89 u32 mem, bar11mask; 89 u32 mem, bar11mask;
90 90
91 /* BAR11MASK value depends on available memory on system. */ 91 /* BAR11MASK value depends on available memory on system. */
92 mem = num_physpages * PAGE_SIZE; 92 mem = get_num_physpages() * PAGE_SIZE;
93 bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8; 93 bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8;
94 94
95 return bar11mask; 95 return bar11mask;
diff --git a/arch/mips/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c
index cdefcc4cb8d4..fc634aeda4a5 100644
--- a/arch/mips/pci/pci-sb1250.c
+++ b/arch/mips/pci/pci-sb1250.c
@@ -283,7 +283,9 @@ static int __init sb1250_pcibios_init(void)
283 register_pci_controller(&sb1250_controller); 283 register_pci_controller(&sb1250_controller);
284 284
285#ifdef CONFIG_VGA_CONSOLE 285#ifdef CONFIG_VGA_CONSOLE
286 take_over_console(&vga_con, 0, MAX_NR_CONSOLES - 1, 1); 286 console_lock();
287 do_take_over_console(&vga_con, 0, MAX_NR_CONSOLES - 1, 1);
288 console_unlock();
287#endif 289#endif
288 return 0; 290 return 0;
289} 291}
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index 1230f56429d7..a95c00f5fb96 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -357,8 +357,6 @@ static void __init szmem(void)
357 int slot; 357 int slot;
358 cnodeid_t node; 358 cnodeid_t node;
359 359
360 num_physpages = 0;
361
362 for_each_online_node(node) { 360 for_each_online_node(node) {
363 nodebytes = 0; 361 nodebytes = 0;
364 for (slot = 0; slot < MAX_MEM_SLOTS; slot++) { 362 for (slot = 0; slot < MAX_MEM_SLOTS; slot++) {
@@ -381,7 +379,6 @@ static void __init szmem(void)
381 slot = MAX_MEM_SLOTS; 379 slot = MAX_MEM_SLOTS;
382 continue; 380 continue;
383 } 381 }
384 num_physpages += slot_psize;
385 memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)), 382 memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)),
386 PFN_PHYS(slot_psize), node); 383 PFN_PHYS(slot_psize), node);
387 } 384 }
@@ -480,32 +477,8 @@ void __init paging_init(void)
480 477
481void __init mem_init(void) 478void __init mem_init(void)
482{ 479{
483 unsigned long codesize, datasize, initsize, tmp; 480 high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
484 unsigned node; 481 free_all_bootmem();
485
486 high_memory = (void *) __va(num_physpages << PAGE_SHIFT);
487
488 for_each_online_node(node) {
489 /*
490 * This will free up the bootmem, ie, slot 0 memory.
491 */
492 totalram_pages += free_all_bootmem_node(NODE_DATA(node));
493 }
494
495 setup_zero_pages(); /* This comes from node 0 */ 482 setup_zero_pages(); /* This comes from node 0 */
496 483 mem_init_print_info(NULL);
497 codesize = (unsigned long) &_etext - (unsigned long) &_text;
498 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
499 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
500
501 tmp = nr_free_pages();
502 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
503 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
504 tmp << (PAGE_SHIFT-10),
505 num_physpages << (PAGE_SHIFT-10),
506 codesize >> 10,
507 (num_physpages - tmp) << (PAGE_SHIFT-10),
508 datasize >> 10,
509 initsize >> 10,
510 totalhigh_pages << (PAGE_SHIFT-10));
511} 484}
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 428da175d073..70e4f663ebd2 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -13,6 +13,7 @@ config MN10300
13 select MODULES_USE_ELF_RELA 13 select MODULES_USE_ELF_RELA
14 select OLD_SIGSUSPEND3 14 select OLD_SIGSUSPEND3
15 select OLD_SIGACTION 15 select OLD_SIGACTION
16 select HAVE_DEBUG_STACKOVERFLOW
16 17
17config AM33_2 18config AM33_2
18 def_bool n 19 def_bool n
diff --git a/arch/mn10300/Kconfig.debug b/arch/mn10300/Kconfig.debug
index bdbfd444a9ff..94efb3ed223f 100644
--- a/arch/mn10300/Kconfig.debug
+++ b/arch/mn10300/Kconfig.debug
@@ -2,10 +2,6 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL
8
9config DEBUG_DECOMPRESS_KERNEL 5config DEBUG_DECOMPRESS_KERNEL
10 bool "Using serial port during decompressing kernel" 6 bool "Using serial port during decompressing kernel"
11 depends on DEBUG_KERNEL 7 depends on DEBUG_KERNEL
diff --git a/arch/mn10300/include/asm/irqflags.h b/arch/mn10300/include/asm/irqflags.h
index 678f68d5f37b..8730c0a3c37d 100644
--- a/arch/mn10300/include/asm/irqflags.h
+++ b/arch/mn10300/include/asm/irqflags.h
@@ -13,9 +13,8 @@
13#define _ASM_IRQFLAGS_H 13#define _ASM_IRQFLAGS_H
14 14
15#include <asm/cpu-regs.h> 15#include <asm/cpu-regs.h>
16#ifndef __ASSEMBLY__ 16/* linux/smp.h <- linux/irqflags.h needs asm/smp.h first */
17#include <linux/smp.h> 17#include <asm/smp.h>
18#endif
19 18
20/* 19/*
21 * interrupt control 20 * interrupt control
diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h
index a1e894b5f65b..2ddaa67e7983 100644
--- a/arch/mn10300/include/asm/pgtable.h
+++ b/arch/mn10300/include/asm/pgtable.h
@@ -486,9 +486,6 @@ extern void update_mmu_cache(struct vm_area_struct *vma,
486 486
487#define kern_addr_valid(addr) (1) 487#define kern_addr_valid(addr) (1)
488 488
489#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
490 remap_pfn_range((vma), (vaddr), (pfn), (size), (prot))
491
492#define MK_IOSPACE_PFN(space, pfn) (pfn) 489#define MK_IOSPACE_PFN(space, pfn) (pfn)
493#define GET_IOSPACE(pfn) 0 490#define GET_IOSPACE(pfn) 0
494#define GET_PFN(pfn) (pfn) 491#define GET_PFN(pfn) (pfn)
diff --git a/arch/mn10300/include/asm/smp.h b/arch/mn10300/include/asm/smp.h
index 6745dbe64944..56c42417d428 100644
--- a/arch/mn10300/include/asm/smp.h
+++ b/arch/mn10300/include/asm/smp.h
@@ -24,6 +24,7 @@
24#ifndef __ASSEMBLY__ 24#ifndef __ASSEMBLY__
25#include <linux/threads.h> 25#include <linux/threads.h>
26#include <linux/cpumask.h> 26#include <linux/cpumask.h>
27#include <linux/thread_info.h>
27#endif 28#endif
28 29
29#ifdef CONFIG_SMP 30#ifdef CONFIG_SMP
@@ -85,7 +86,7 @@ extern cpumask_t cpu_boot_map;
85extern void smp_init_cpus(void); 86extern void smp_init_cpus(void);
86extern void smp_cache_interrupt(void); 87extern void smp_cache_interrupt(void);
87extern void send_IPI_allbutself(int irq); 88extern void send_IPI_allbutself(int irq);
88extern int smp_nmi_call_function(smp_call_func_t func, void *info, int wait); 89extern int smp_nmi_call_function(void (*func)(void *), void *info, int wait);
89 90
90extern void arch_send_call_function_single_ipi(int cpu); 91extern void arch_send_call_function_single_ipi(int cpu);
91extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 92extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
@@ -100,6 +101,7 @@ extern void __cpu_die(unsigned int cpu);
100#ifndef __ASSEMBLY__ 101#ifndef __ASSEMBLY__
101 102
102static inline void smp_init_cpus(void) {} 103static inline void smp_init_cpus(void) {}
104#define raw_smp_processor_id() 0
103 105
104#endif /* __ASSEMBLY__ */ 106#endif /* __ASSEMBLY__ */
105#endif /* CONFIG_SMP */ 107#endif /* CONFIG_SMP */
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h
index 780560b330d9..537278746a15 100644
--- a/arch/mn10300/include/asm/uaccess.h
+++ b/arch/mn10300/include/asm/uaccess.h
@@ -161,7 +161,7 @@ struct __large_struct { unsigned long buf[100]; };
161 161
162#define __get_user_check(x, ptr, size) \ 162#define __get_user_check(x, ptr, size) \
163({ \ 163({ \
164 const __typeof__(ptr) __guc_ptr = (ptr); \ 164 const __typeof__(*(ptr))* __guc_ptr = (ptr); \
165 int _e; \ 165 int _e; \
166 if (likely(__access_ok((unsigned long) __guc_ptr, (size)))) \ 166 if (likely(__access_ok((unsigned long) __guc_ptr, (size)))) \
167 _e = __get_user_nocheck((x), __guc_ptr, (size)); \ 167 _e = __get_user_nocheck((x), __guc_ptr, (size)); \
@@ -471,13 +471,13 @@ extern unsigned long __generic_copy_from_user(void *, const void __user *,
471 471
472#define __copy_to_user(to, from, n) \ 472#define __copy_to_user(to, from, n) \
473({ \ 473({ \
474 might_sleep(); \ 474 might_fault(); \
475 __copy_to_user_inatomic((to), (from), (n)); \ 475 __copy_to_user_inatomic((to), (from), (n)); \
476}) 476})
477 477
478#define __copy_from_user(to, from, n) \ 478#define __copy_from_user(to, from, n) \
479({ \ 479({ \
480 might_sleep(); \ 480 might_fault(); \
481 __copy_from_user_inatomic((to), (from), (n)); \ 481 __copy_from_user_inatomic((to), (from), (n)); \
482}) 482})
483 483
diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index 33c3bd1e5c6d..ebac9c11f796 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -38,6 +38,7 @@ struct mn10300_cpuinfo boot_cpu_data;
38/* For PCI or other memory-mapped resources */ 38/* For PCI or other memory-mapped resources */
39unsigned long pci_mem_start = 0x18000000; 39unsigned long pci_mem_start = 0x18000000;
40 40
41static char __initdata cmd_line[COMMAND_LINE_SIZE];
41char redboot_command_line[COMMAND_LINE_SIZE] = 42char redboot_command_line[COMMAND_LINE_SIZE] =
42 "console=ttyS0,115200 root=/dev/mtdblock3 rw"; 43 "console=ttyS0,115200 root=/dev/mtdblock3 rw";
43 44
@@ -74,45 +75,19 @@ static const char *const mn10300_cputypes[] = {
74}; 75};
75 76
76/* 77/*
77 * 78 * Pick out the memory size. We look for mem=size,
79 * where size is "size[KkMm]"
78 */ 80 */
79static void __init parse_mem_cmdline(char **cmdline_p) 81static int __init early_mem(char *p)
80{ 82{
81 char *from, *to, c; 83 memory_size = memparse(p, &p);
82
83 /* save unparsed command line copy for /proc/cmdline */
84 strcpy(boot_command_line, redboot_command_line);
85
86 /* see if there's an explicit memory size option */
87 from = redboot_command_line;
88 to = redboot_command_line;
89 c = ' ';
90
91 for (;;) {
92 if (c == ' ' && !memcmp(from, "mem=", 4)) {
93 if (to != redboot_command_line)
94 to--;
95 memory_size = memparse(from + 4, &from);
96 }
97
98 c = *(from++);
99 if (!c)
100 break;
101
102 *(to++) = c;
103 }
104
105 *to = '\0';
106 *cmdline_p = redboot_command_line;
107 84
108 if (memory_size == 0) 85 if (memory_size == 0)
109 panic("Memory size not known\n"); 86 panic("Memory size not known\n");
110 87
111 memory_end = (unsigned long) CONFIG_KERNEL_RAM_BASE_ADDRESS + 88 return 0;
112 memory_size;
113 if (memory_end > phys_memory_end)
114 memory_end = phys_memory_end;
115} 89}
90early_param("mem", early_mem);
116 91
117/* 92/*
118 * architecture specific setup 93 * architecture specific setup
@@ -125,7 +100,20 @@ void __init setup_arch(char **cmdline_p)
125 cpu_init(); 100 cpu_init();
126 unit_setup(); 101 unit_setup();
127 smp_init_cpus(); 102 smp_init_cpus();
128 parse_mem_cmdline(cmdline_p); 103
104 /* save unparsed command line copy for /proc/cmdline */
105 strlcpy(boot_command_line, redboot_command_line, COMMAND_LINE_SIZE);
106
107 /* populate cmd_line too for later use, preserving boot_command_line */
108 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
109 *cmdline_p = cmd_line;
110
111 parse_early_param();
112
113 memory_end = (unsigned long) CONFIG_KERNEL_RAM_BASE_ADDRESS +
114 memory_size;
115 if (memory_end > phys_memory_end)
116 memory_end = phys_memory_end;
129 117
130 init_mm.start_code = (unsigned long)&_text; 118 init_mm.start_code = (unsigned long)&_text;
131 init_mm.end_code = (unsigned long) &_etext; 119 init_mm.end_code = (unsigned long) &_etext;
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index 5a8ace63a6b4..97a1ec0beeec 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -99,43 +99,21 @@ void __init paging_init(void)
99 */ 99 */
100void __init mem_init(void) 100void __init mem_init(void)
101{ 101{
102 int codesize, reservedpages, datasize, initsize;
103 int tmp;
104
105 BUG_ON(!mem_map); 102 BUG_ON(!mem_map);
106 103
107#define START_PFN (contig_page_data.bdata->node_min_pfn) 104#define START_PFN (contig_page_data.bdata->node_min_pfn)
108#define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn) 105#define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn)
109 106
110 max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN; 107 max_mapnr = MAX_LOW_PFN - START_PFN;
111 high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE); 108 high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE);
112 109
113 /* clear the zero-page */ 110 /* clear the zero-page */
114 memset(empty_zero_page, 0, PAGE_SIZE); 111 memset(empty_zero_page, 0, PAGE_SIZE);
115 112
116 /* this will put all low memory onto the freelists */ 113 /* this will put all low memory onto the freelists */
117 totalram_pages += free_all_bootmem(); 114 free_all_bootmem();
118 115
119 reservedpages = 0; 116 mem_init_print_info(NULL);
120 for (tmp = 0; tmp < num_physpages; tmp++)
121 if (PageReserved(&mem_map[tmp]))
122 reservedpages++;
123
124 codesize = (unsigned long) &_etext - (unsigned long) &_stext;
125 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
126 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
127
128 printk(KERN_INFO
129 "Memory: %luk/%luk available"
130 " (%dk kernel code, %dk reserved, %dk data, %dk init,"
131 " %ldk highmem)\n",
132 nr_free_pages() << (PAGE_SHIFT - 10),
133 max_mapnr << (PAGE_SHIFT - 10),
134 codesize >> 10,
135 reservedpages << (PAGE_SHIFT - 10),
136 datasize >> 10,
137 initsize >> 10,
138 totalhigh_pages << (PAGE_SHIFT - 10));
139} 117}
140 118
141/* 119/*
@@ -152,6 +130,7 @@ void free_initmem(void)
152#ifdef CONFIG_BLK_DEV_INITRD 130#ifdef CONFIG_BLK_DEV_INITRD
153void free_initrd_mem(unsigned long start, unsigned long end) 131void free_initrd_mem(unsigned long start, unsigned long end)
154{ 132{
155 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 133 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
134 "initrd");
156} 135}
157#endif 136#endif
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index c4e2e79281e8..febb9cd83177 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -221,7 +221,7 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
221 /* Leave vm_pgoff as-is, the PCI space address is the physical 221 /* Leave vm_pgoff as-is, the PCI space address is the physical
222 * address on this platform. 222 * address on this platform.
223 */ 223 */
224 vma->vm_flags |= VM_LOCKED | VM_IO; 224 vma->vm_flags |= VM_LOCKED;
225 225
226 prot = pgprot_val(vma->vm_page_prot); 226 prot = pgprot_val(vma->vm_page_prot);
227 prot &= ~_PAGE_CACHE; 227 prot &= ~_PAGE_CACHE;
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 1072bfd18c50..99dbab1c59ac 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -22,6 +22,7 @@ config OPENRISC
22 select GENERIC_STRNCPY_FROM_USER 22 select GENERIC_STRNCPY_FROM_USER
23 select GENERIC_STRNLEN_USER 23 select GENERIC_STRNLEN_USER
24 select MODULES_USE_ELF_RELA 24 select MODULES_USE_ELF_RELA
25 select HAVE_DEBUG_STACKOVERFLOW
25 26
26config MMU 27config MMU
27 def_bool y 28 def_bool y
@@ -128,16 +129,6 @@ config CMDLINE
128 129
129menu "Debugging options" 130menu "Debugging options"
130 131
131config DEBUG_STACKOVERFLOW
132 bool "Check for kernel stack overflow"
133 default y
134 help
135 Make extra checks for space available on stack in some
136 critical functions. This will cause kernel to run a bit slower,
137 but will catch most of kernel stack overruns and exit gracefully.
138
139 Say Y if you are unsure.
140
141config JUMP_UPON_UNHANDLED_EXCEPTION 132config JUMP_UPON_UNHANDLED_EXCEPTION
142 bool "Try to die gracefully" 133 bool "Try to die gracefully"
143 default y 134 default y
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f20d01d9aaf9..195653e851da 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -66,3 +66,4 @@ generic-y += types.h
66generic-y += ucontext.h 66generic-y += ucontext.h
67generic-y += user.h 67generic-y += user.h
68generic-y += word-at-a-time.h 68generic-y += word-at-a-time.h
69generic-y += xor.h
diff --git a/arch/openrisc/include/asm/pgtable.h b/arch/openrisc/include/asm/pgtable.h
index 14c900cfd30a..37bf6a3ef8f4 100644
--- a/arch/openrisc/include/asm/pgtable.h
+++ b/arch/openrisc/include/asm/pgtable.h
@@ -446,9 +446,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
446 446
447#define kern_addr_valid(addr) (1) 447#define kern_addr_valid(addr) (1)
448 448
449#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
450 remap_pfn_range(vma, vaddr, pfn, size, prot)
451
452#include <asm-generic/pgtable.h> 449#include <asm-generic/pgtable.h>
453 450
454/* 451/*
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index b3cbc6703837..7f94652311d7 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -202,56 +202,20 @@ void __init paging_init(void)
202 202
203/* References to section boundaries */ 203/* References to section boundaries */
204 204
205static int __init free_pages_init(void)
206{
207 int reservedpages, pfn;
208
209 /* this will put all low memory onto the freelists */
210 totalram_pages = free_all_bootmem();
211
212 reservedpages = 0;
213 for (pfn = 0; pfn < max_low_pfn; pfn++) {
214 /*
215 * Only count reserved RAM pages
216 */
217 if (PageReserved(mem_map + pfn))
218 reservedpages++;
219 }
220
221 return reservedpages;
222}
223
224static void __init set_max_mapnr_init(void)
225{
226 max_mapnr = num_physpages = max_low_pfn;
227}
228
229void __init mem_init(void) 205void __init mem_init(void)
230{ 206{
231 int codesize, reservedpages, datasize, initsize;
232
233 BUG_ON(!mem_map); 207 BUG_ON(!mem_map);
234 208
235 set_max_mapnr_init(); 209 max_mapnr = max_low_pfn;
236
237 high_memory = (void *)__va(max_low_pfn * PAGE_SIZE); 210 high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
238 211
239 /* clear the zero-page */ 212 /* clear the zero-page */
240 memset((void *)empty_zero_page, 0, PAGE_SIZE); 213 memset((void *)empty_zero_page, 0, PAGE_SIZE);
241 214
242 reservedpages = free_pages_init(); 215 /* this will put all low memory onto the freelists */
243 216 free_all_bootmem();
244 codesize = (unsigned long)&_etext - (unsigned long)&_stext;
245 datasize = (unsigned long)&_edata - (unsigned long)&_etext;
246 initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
247 217
248 printk(KERN_INFO 218 mem_init_print_info(NULL);
249 "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
250 (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10),
251 max_mapnr << (PAGE_SHIFT - 10), codesize >> 10,
252 reservedpages << (PAGE_SHIFT - 10), datasize >> 10,
253 initsize >> 10, (unsigned long)(0 << (PAGE_SHIFT - 10))
254 );
255 219
256 printk("mem_init_done ...........................................\n"); 220 printk("mem_init_done ...........................................\n");
257 mem_init_done = 1; 221 mem_init_done = 1;
@@ -261,11 +225,11 @@ void __init mem_init(void)
261#ifdef CONFIG_BLK_DEV_INITRD 225#ifdef CONFIG_BLK_DEV_INITRD
262void free_initrd_mem(unsigned long start, unsigned long end) 226void free_initrd_mem(unsigned long start, unsigned long end)
263{ 227{
264 free_reserved_area(start, end, 0, "initrd"); 228 free_reserved_area((void *)start, (void *)end, -1, "initrd");
265} 229}
266#endif 230#endif
267 231
268void free_initmem(void) 232void free_initmem(void)
269{ 233{
270 free_initmem_default(0); 234 free_initmem_default(-1);
271} 235}
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 6507dabdd5dd..aa399a5259b6 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -27,6 +27,7 @@ config PARISC
27 select MODULES_USE_ELF_RELA 27 select MODULES_USE_ELF_RELA
28 select CLONE_BACKWARDS 28 select CLONE_BACKWARDS
29 select TTY # Needed for pdc_cons.c 29 select TTY # Needed for pdc_cons.c
30 select HAVE_DEBUG_STACKOVERFLOW
30 31
31 help 32 help
32 The PA-RISC microprocessor is designed by Hewlett-Packard and used 33 The PA-RISC microprocessor is designed by Hewlett-Packard and used
@@ -254,7 +255,6 @@ config IRQSTACKS
254config HOTPLUG_CPU 255config HOTPLUG_CPU
255 bool 256 bool
256 default y if SMP 257 default y if SMP
257 select HOTPLUG
258 258
259config ARCH_SELECT_MEMORY_MODEL 259config ARCH_SELECT_MEMORY_MODEL
260 def_bool y 260 def_bool y
diff --git a/arch/parisc/Kconfig.debug b/arch/parisc/Kconfig.debug
index 08a332f6ee87..bc989e522a04 100644
--- a/arch/parisc/Kconfig.debug
+++ b/arch/parisc/Kconfig.debug
@@ -13,14 +13,3 @@ config DEBUG_RODATA
13 If in doubt, say "N". 13 If in doubt, say "N".
14 14
15endmenu 15endmenu
16
17config DEBUG_STACKOVERFLOW
18 bool "Check for stack overflows"
19 default y
20 depends on DEBUG_KERNEL
21 ---help---
22 Say Y here if you want to check the overflows of kernel, IRQ
23 and exception stacks. This option will cause messages of the
24 stacks in detail when free stack space drops below a certain
25 limit.
26 If in doubt, say "N".
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 838b479a42c4..88d0962de65a 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -60,6 +60,7 @@ struct hpux_dirent {
60}; 60};
61 61
62struct getdents_callback { 62struct getdents_callback {
63 struct dir_context ctx;
63 struct hpux_dirent __user *current_dir; 64 struct hpux_dirent __user *current_dir;
64 struct hpux_dirent __user *previous; 65 struct hpux_dirent __user *previous;
65 int count; 66 int count;
@@ -110,24 +111,23 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i
110{ 111{
111 struct fd arg; 112 struct fd arg;
112 struct hpux_dirent __user * lastdirent; 113 struct hpux_dirent __user * lastdirent;
113 struct getdents_callback buf; 114 struct getdents_callback buf = {
115 .ctx.actor = filldir,
116 .current_dir = dirent,
117 .count = count
118 };
114 int error; 119 int error;
115 120
116 arg = fdget(fd); 121 arg = fdget(fd);
117 if (!arg.file) 122 if (!arg.file)
118 return -EBADF; 123 return -EBADF;
119 124
120 buf.current_dir = dirent; 125 error = iterate_dir(arg.file, &buf.ctx);
121 buf.previous = NULL;
122 buf.count = count;
123 buf.error = 0;
124
125 error = vfs_readdir(arg.file, filldir, &buf);
126 if (error >= 0) 126 if (error >= 0)
127 error = buf.error; 127 error = buf.error;
128 lastdirent = buf.previous; 128 lastdirent = buf.previous;
129 if (lastdirent) { 129 if (lastdirent) {
130 if (put_user(arg.file->f_pos, &lastdirent->d_off)) 130 if (put_user(buf.ctx.pos, &lastdirent->d_off))
131 error = -EFAULT; 131 error = -EFAULT;
132 else 132 else
133 error = count - buf.count; 133 error = count - buf.count;
diff --git a/arch/parisc/include/asm/mmzone.h b/arch/parisc/include/asm/mmzone.h
index cc50d33b7b88..b6b34a0987e7 100644
--- a/arch/parisc/include/asm/mmzone.h
+++ b/arch/parisc/include/asm/mmzone.h
@@ -27,7 +27,7 @@ extern struct node_map_data node_data[];
27 27
28#define PFNNID_SHIFT (30 - PAGE_SHIFT) 28#define PFNNID_SHIFT (30 - PAGE_SHIFT)
29#define PFNNID_MAP_MAX 512 /* support 512GB */ 29#define PFNNID_MAP_MAX 512 /* support 512GB */
30extern unsigned char pfnnid_map[PFNNID_MAP_MAX]; 30extern signed char pfnnid_map[PFNNID_MAP_MAX];
31 31
32#ifndef CONFIG_64BIT 32#ifndef CONFIG_64BIT
33#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT)) 33#define pfn_is_io(pfn) ((pfn & (0xf0000000UL >> PAGE_SHIFT)) == (0xf0000000UL >> PAGE_SHIFT))
@@ -46,7 +46,7 @@ static inline int pfn_to_nid(unsigned long pfn)
46 i = pfn >> PFNNID_SHIFT; 46 i = pfn >> PFNNID_SHIFT;
47 BUG_ON(i >= ARRAY_SIZE(pfnnid_map)); 47 BUG_ON(i >= ARRAY_SIZE(pfnnid_map));
48 48
49 return (int)pfnnid_map[i]; 49 return pfnnid_map[i];
50} 50}
51 51
52static inline int pfn_valid(int pfn) 52static inline int pfn_valid(int pfn)
diff --git a/arch/parisc/include/asm/pci.h b/arch/parisc/include/asm/pci.h
index 3234f492d575..465154076d23 100644
--- a/arch/parisc/include/asm/pci.h
+++ b/arch/parisc/include/asm/pci.h
@@ -225,4 +225,9 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
225 return channel ? 15 : 14; 225 return channel ? 15 : 14;
226} 226}
227 227
228#define HAVE_PCI_MMAP
229
230extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
231 enum pci_mmap_state mmap_state, int write_combine);
232
228#endif /* __ASM_PARISC_PCI_H */ 233#endif /* __ASM_PARISC_PCI_H */
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 1e40d7f86be3..34899b5d959a 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -506,9 +506,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
506#endif 506#endif
507 507
508 508
509#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
510 remap_pfn_range(vma, vaddr, pfn, size, prot)
511
512#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) | _PAGE_NO_CACHE) 509#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) | _PAGE_NO_CACHE)
513 510
514/* We provide our own get_unmapped_area to provide cache coherency */ 511/* We provide our own get_unmapped_area to provide cache coherency */
diff --git a/arch/parisc/include/uapi/asm/fcntl.h b/arch/parisc/include/uapi/asm/fcntl.h
index 0304b92ccfea..cc61c475f277 100644
--- a/arch/parisc/include/uapi/asm/fcntl.h
+++ b/arch/parisc/include/uapi/asm/fcntl.h
@@ -20,6 +20,7 @@
20#define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */ 20#define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */
21 21
22#define O_PATH 020000000 22#define O_PATH 020000000
23#define O_TMPFILE 040000000
23 24
24#define F_GETLK64 8 25#define F_GETLK64 8
25#define F_SETLK64 9 26#define F_SETLK64 9
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
index 9e2d2e408529..872275659d98 100644
--- a/arch/parisc/kernel/hardware.c
+++ b/arch/parisc/kernel/hardware.c
@@ -1205,6 +1205,7 @@ static struct hp_hardware hp_hardware_list[] = {
1205 {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"}, 1205 {HPHW_FIO, 0x004, 0x00320, 0x0, "Metheus Frame Buffer"},
1206 {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"}, 1206 {HPHW_FIO, 0x004, 0x00340, 0x0, "BARCO CX4500 VME Grphx Cnsl"},
1207 {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"}, 1207 {HPHW_FIO, 0x004, 0x00360, 0x0, "Hughes TOG VME FDDI"},
1208 {HPHW_FIO, 0x076, 0x000AD, 0x00, "Crestone Peak RS-232"},
1208 {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"}, 1209 {HPHW_IOA, 0x185, 0x0000B, 0x00, "Java BC Summit Port"},
1209 {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"}, 1210 {HPHW_IOA, 0x1FF, 0x0000B, 0x00, "Hitachi Ghostview Summit Port"},
1210 {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"}, 1211 {HPHW_IOA, 0x580, 0x0000B, 0x10, "U2-IOA BC Runway Port"},
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index 36d7f402e48e..b743a80eaba0 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -860,7 +860,7 @@ ENTRY(flush_dcache_page_asm)
860#endif 860#endif
861 861
862 ldil L%dcache_stride, %r1 862 ldil L%dcache_stride, %r1
863 ldw R%dcache_stride(%r1), %r1 863 ldw R%dcache_stride(%r1), r31
864 864
865#ifdef CONFIG_64BIT 865#ifdef CONFIG_64BIT
866 depdi,z 1, 63-PAGE_SHIFT,1, %r25 866 depdi,z 1, 63-PAGE_SHIFT,1, %r25
@@ -868,26 +868,26 @@ ENTRY(flush_dcache_page_asm)
868 depwi,z 1, 31-PAGE_SHIFT,1, %r25 868 depwi,z 1, 31-PAGE_SHIFT,1, %r25
869#endif 869#endif
870 add %r28, %r25, %r25 870 add %r28, %r25, %r25
871 sub %r25, %r1, %r25 871 sub %r25, r31, %r25
872 872
873 873
8741: fdc,m %r1(%r28) 8741: fdc,m r31(%r28)
875 fdc,m %r1(%r28) 875 fdc,m r31(%r28)
876 fdc,m %r1(%r28) 876 fdc,m r31(%r28)
877 fdc,m %r1(%r28) 877 fdc,m r31(%r28)
878 fdc,m %r1(%r28) 878 fdc,m r31(%r28)
879 fdc,m %r1(%r28) 879 fdc,m r31(%r28)
880 fdc,m %r1(%r28) 880 fdc,m r31(%r28)
881 fdc,m %r1(%r28) 881 fdc,m r31(%r28)
882 fdc,m %r1(%r28) 882 fdc,m r31(%r28)
883 fdc,m %r1(%r28) 883 fdc,m r31(%r28)
884 fdc,m %r1(%r28) 884 fdc,m r31(%r28)
885 fdc,m %r1(%r28) 885 fdc,m r31(%r28)
886 fdc,m %r1(%r28) 886 fdc,m r31(%r28)
887 fdc,m %r1(%r28) 887 fdc,m r31(%r28)
888 fdc,m %r1(%r28) 888 fdc,m r31(%r28)
889 cmpb,COND(<<) %r28, %r25,1b 889 cmpb,COND(<<) %r28, %r25,1b
890 fdc,m %r1(%r28) 890 fdc,m r31(%r28)
891 891
892 sync 892 sync
893 893
@@ -936,7 +936,7 @@ ENTRY(flush_icache_page_asm)
936#endif 936#endif
937 937
938 ldil L%icache_stride, %r1 938 ldil L%icache_stride, %r1
939 ldw R%icache_stride(%r1), %r1 939 ldw R%icache_stride(%r1), %r31
940 940
941#ifdef CONFIG_64BIT 941#ifdef CONFIG_64BIT
942 depdi,z 1, 63-PAGE_SHIFT,1, %r25 942 depdi,z 1, 63-PAGE_SHIFT,1, %r25
@@ -944,28 +944,28 @@ ENTRY(flush_icache_page_asm)
944 depwi,z 1, 31-PAGE_SHIFT,1, %r25 944 depwi,z 1, 31-PAGE_SHIFT,1, %r25
945#endif 945#endif
946 add %r28, %r25, %r25 946 add %r28, %r25, %r25
947 sub %r25, %r1, %r25 947 sub %r25, %r31, %r25
948 948
949 949
950 /* fic only has the type 26 form on PA1.1, requiring an 950 /* fic only has the type 26 form on PA1.1, requiring an
951 * explicit space specification, so use %sr4 */ 951 * explicit space specification, so use %sr4 */
9521: fic,m %r1(%sr4,%r28) 9521: fic,m %r31(%sr4,%r28)
953 fic,m %r1(%sr4,%r28) 953 fic,m %r31(%sr4,%r28)
954 fic,m %r1(%sr4,%r28) 954 fic,m %r31(%sr4,%r28)
955 fic,m %r1(%sr4,%r28) 955 fic,m %r31(%sr4,%r28)
956 fic,m %r1(%sr4,%r28) 956 fic,m %r31(%sr4,%r28)
957 fic,m %r1(%sr4,%r28) 957 fic,m %r31(%sr4,%r28)
958 fic,m %r1(%sr4,%r28) 958 fic,m %r31(%sr4,%r28)
959 fic,m %r1(%sr4,%r28) 959 fic,m %r31(%sr4,%r28)
960 fic,m %r1(%sr4,%r28) 960 fic,m %r31(%sr4,%r28)
961 fic,m %r1(%sr4,%r28) 961 fic,m %r31(%sr4,%r28)
962 fic,m %r1(%sr4,%r28) 962 fic,m %r31(%sr4,%r28)
963 fic,m %r1(%sr4,%r28) 963 fic,m %r31(%sr4,%r28)
964 fic,m %r1(%sr4,%r28) 964 fic,m %r31(%sr4,%r28)
965 fic,m %r1(%sr4,%r28) 965 fic,m %r31(%sr4,%r28)
966 fic,m %r1(%sr4,%r28) 966 fic,m %r31(%sr4,%r28)
967 cmpb,COND(<<) %r28, %r25,1b 967 cmpb,COND(<<) %r28, %r25,1b
968 fic,m %r1(%sr4,%r28) 968 fic,m %r31(%sr4,%r28)
969 969
970 sync 970 sync
971 971
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 60309051875e..64f2764a8cef 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -220,6 +220,33 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
220} 220}
221 221
222 222
223int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
224 enum pci_mmap_state mmap_state, int write_combine)
225{
226 unsigned long prot;
227
228 /*
229 * I/O space can be accessed via normal processor loads and stores on
230 * this platform but for now we elect not to do this and portable
231 * drivers should not do this anyway.
232 */
233 if (mmap_state == pci_mmap_io)
234 return -EINVAL;
235
236 if (write_combine)
237 return -EINVAL;
238
239 /*
240 * Ignore write-combine; for now only return uncached mappings.
241 */
242 prot = pgprot_val(vma->vm_page_prot);
243 prot |= _PAGE_NO_CACHE;
244 vma->vm_page_prot = __pgprot(prot);
245
246 return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
247 vma->vm_end - vma->vm_start, vma->vm_page_prot);
248}
249
223/* 250/*
224 * A driver is enabling the device. We make sure that all the appropriate 251 * A driver is enabling the device. We make sure that all the appropriate
225 * bits are set to allow the device to operate as the driver is expecting. 252 * bits are set to allow the device to operate as the driver is expecting.
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 1e95b2000ce8..7349a3fedfc7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -156,7 +156,7 @@ void __init setup_arch(char **cmdline_p)
156#endif 156#endif
157 157
158#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 158#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
159 conswitchp = &dummy_con; /* we use take_over_console() later ! */ 159 conswitchp = &dummy_con; /* we use do_take_over_console() later ! */
160#endif 160#endif
161 161
162} 162}
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 1c965642068b..b0f96c0e6316 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -47,7 +47,7 @@ pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pt
47 47
48#ifdef CONFIG_DISCONTIGMEM 48#ifdef CONFIG_DISCONTIGMEM
49struct node_map_data node_data[MAX_NUMNODES] __read_mostly; 49struct node_map_data node_data[MAX_NUMNODES] __read_mostly;
50unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; 50signed char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;
51#endif 51#endif
52 52
53static struct resource data_resource = { 53static struct resource data_resource = {
@@ -214,7 +214,6 @@ static void __init setup_bootmem(void)
214 mem_limit_func(); /* check for "mem=" argument */ 214 mem_limit_func(); /* check for "mem=" argument */
215 215
216 mem_max = 0; 216 mem_max = 0;
217 num_physpages = 0;
218 for (i = 0; i < npmem_ranges; i++) { 217 for (i = 0; i < npmem_ranges; i++) {
219 unsigned long rsize; 218 unsigned long rsize;
220 219
@@ -229,10 +228,8 @@ static void __init setup_bootmem(void)
229 npmem_ranges = i + 1; 228 npmem_ranges = i + 1;
230 mem_max = mem_limit; 229 mem_max = mem_limit;
231 } 230 }
232 num_physpages += pmem_ranges[i].pages;
233 break; 231 break;
234 } 232 }
235 num_physpages += pmem_ranges[i].pages;
236 mem_max += rsize; 233 mem_max += rsize;
237 } 234 }
238 235
@@ -532,7 +529,7 @@ void free_initmem(void)
532 * pages are no-longer executable */ 529 * pages are no-longer executable */
533 flush_icache_range(init_begin, init_end); 530 flush_icache_range(init_begin, init_end);
534 531
535 num_physpages += free_initmem_default(0); 532 free_initmem_default(-1);
536 533
537 /* set up a new led state on systems shipped LED State panel */ 534 /* set up a new led state on systems shipped LED State panel */
538 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE); 535 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);
@@ -580,8 +577,6 @@ unsigned long pcxl_dma_start __read_mostly;
580 577
581void __init mem_init(void) 578void __init mem_init(void)
582{ 579{
583 int codesize, reservedpages, datasize, initsize;
584
585 /* Do sanity checks on page table constants */ 580 /* Do sanity checks on page table constants */
586 BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t)); 581 BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t));
587 BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t)); 582 BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t));
@@ -590,45 +585,8 @@ void __init mem_init(void)
590 > BITS_PER_LONG); 585 > BITS_PER_LONG);
591 586
592 high_memory = __va((max_pfn << PAGE_SHIFT)); 587 high_memory = __va((max_pfn << PAGE_SHIFT));
593 588 set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
594#ifndef CONFIG_DISCONTIGMEM 589 free_all_bootmem();
595 max_mapnr = page_to_pfn(virt_to_page(high_memory - 1)) + 1;
596 totalram_pages += free_all_bootmem();
597#else
598 {
599 int i;
600
601 for (i = 0; i < npmem_ranges; i++)
602 totalram_pages += free_all_bootmem_node(NODE_DATA(i));
603 }
604#endif
605
606 codesize = (unsigned long)_etext - (unsigned long)_text;
607 datasize = (unsigned long)_edata - (unsigned long)_etext;
608 initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
609
610 reservedpages = 0;
611{
612 unsigned long pfn;
613#ifdef CONFIG_DISCONTIGMEM
614 int i;
615
616 for (i = 0; i < npmem_ranges; i++) {
617 for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
618 if (PageReserved(pfn_to_page(pfn)))
619 reservedpages++;
620 }
621 }
622#else /* !CONFIG_DISCONTIGMEM */
623 for (pfn = 0; pfn < max_pfn; pfn++) {
624 /*
625 * Only count reserved RAM pages
626 */
627 if (PageReserved(pfn_to_page(pfn)))
628 reservedpages++;
629 }
630#endif
631}
632 590
633#ifdef CONFIG_PA11 591#ifdef CONFIG_PA11
634 if (hppa_dma_ops == &pcxl_dma_ops) { 592 if (hppa_dma_ops == &pcxl_dma_ops) {
@@ -643,15 +601,7 @@ void __init mem_init(void)
643 parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START); 601 parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
644#endif 602#endif
645 603
646 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", 604 mem_init_print_info(NULL);
647 nr_free_pages() << (PAGE_SHIFT-10),
648 num_physpages << (PAGE_SHIFT-10),
649 codesize >> 10,
650 reservedpages << (PAGE_SHIFT-10),
651 datasize >> 10,
652 initsize >> 10
653 );
654
655#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ 605#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
656 printk("virtual kernel memory layout:\n" 606 printk("virtual kernel memory layout:\n"
657 " vmalloc : 0x%p - 0x%p (%4ld MB)\n" 607 " vmalloc : 0x%p - 0x%p (%4ld MB)\n"
@@ -1101,6 +1051,6 @@ void flush_tlb_all(void)
1101#ifdef CONFIG_BLK_DEV_INITRD 1051#ifdef CONFIG_BLK_DEV_INITRD
1102void free_initrd_mem(unsigned long start, unsigned long end) 1052void free_initrd_mem(unsigned long start, unsigned long end)
1103{ 1053{
1104 num_physpages += free_reserved_area(start, end, 0, "initrd"); 1054 free_reserved_area((void *)start, (void *)end, -1, "initrd");
1105} 1055}
1106#endif 1056#endif
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c33e3ad2c8fd..bc3a0ebf16a7 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -138,6 +138,7 @@ config PPC
138 select ARCH_USE_BUILTIN_BSWAP 138 select ARCH_USE_BUILTIN_BSWAP
139 select OLD_SIGSUSPEND 139 select OLD_SIGSUSPEND
140 select OLD_SIGACTION if PPC32 140 select OLD_SIGACTION if PPC32
141 select HAVE_DEBUG_STACKOVERFLOW
141 142
142config EARLY_PRINTK 143config EARLY_PRINTK
143 bool 144 bool
@@ -298,7 +299,7 @@ config HUGETLB_PAGE_SIZE_VARIABLE
298 299
299config MATH_EMULATION 300config MATH_EMULATION
300 bool "Math emulation" 301 bool "Math emulation"
301 depends on 4xx || 8xx || E200 || PPC_MPC832x || E500 302 depends on 4xx || 8xx || PPC_MPC832x || BOOKE
302 ---help--- 303 ---help---
303 Some PowerPC chips designed for embedded applications do not have 304 Some PowerPC chips designed for embedded applications do not have
304 a floating-point unit and therefore do not implement the 305 a floating-point unit and therefore do not implement the
@@ -307,6 +308,10 @@ config MATH_EMULATION
307 unit, which will allow programs that use floating-point 308 unit, which will allow programs that use floating-point
308 instructions to run. 309 instructions to run.
309 310
311 This is also useful to emulate missing (optional) instructions
312 such as fsqrt on cores that do have an FPU but do not implement
313 them (such as Freescale BookE).
314
310config PPC_TRANSACTIONAL_MEM 315config PPC_TRANSACTIONAL_MEM
311 bool "Transactional Memory support for POWERPC" 316 bool "Transactional Memory support for POWERPC"
312 depends on PPC_BOOK3S_64 317 depends on PPC_BOOK3S_64
@@ -315,17 +320,6 @@ config PPC_TRANSACTIONAL_MEM
315 ---help--- 320 ---help---
316 Support user-mode Transactional Memory on POWERPC. 321 Support user-mode Transactional Memory on POWERPC.
317 322
318config 8XX_MINIMAL_FPEMU
319 bool "Minimal math emulation for 8xx"
320 depends on 8xx && !MATH_EMULATION
321 help
322 Older arch/ppc kernels still emulated a few floating point
323 instructions such as load and store, even when full math
324 emulation is disabled. Say "Y" here if you want to preserve
325 this behavior.
326
327 It is recommended that you build a soft-float userspace instead.
328
329config IOMMU_HELPER 323config IOMMU_HELPER
330 def_bool PPC64 324 def_bool PPC64
331 325
@@ -341,7 +335,7 @@ config SWIOTLB
341 335
342config HOTPLUG_CPU 336config HOTPLUG_CPU
343 bool "Support for enabling/disabling CPUs" 337 bool "Support for enabling/disabling CPUs"
344 depends on SMP && HOTPLUG && (PPC_PSERIES || \ 338 depends on SMP && (PPC_PSERIES || \
345 PPC_PMAC || PPC_POWERNV || (PPC_85xx && !PPC_E500MC)) 339 PPC_PMAC || PPC_POWERNV || (PPC_85xx && !PPC_E500MC))
346 ---help--- 340 ---help---
347 Say Y here to be able to disable and re-enable individual 341 Say Y here to be able to disable and re-enable individual
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 863d877e0b5f..21c9f304e96c 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -28,13 +28,6 @@ config PRINT_STACK_DEPTH
28 too small and stack traces cause important information to 28 too small and stack traces cause important information to
29 scroll off the screen. 29 scroll off the screen.
30 30
31config DEBUG_STACKOVERFLOW
32 bool "Check for stack overflows"
33 depends on DEBUG_KERNEL
34 help
35 This option will cause messages to be printed if free stack space
36 drops below a certain limit.
37
38config HCALL_STATS 31config HCALL_STATS
39 bool "Hypervisor call instrumentation" 32 bool "Hypervisor call instrumentation"
40 depends on PPC_PSERIES && DEBUG_FS && TRACEPOINTS 33 depends on PPC_PSERIES && DEBUG_FS && TRACEPOINTS
@@ -147,6 +140,13 @@ choice
147 enable debugging for the wrong type of machine your kernel 140 enable debugging for the wrong type of machine your kernel
148 _will not boot_. 141 _will not boot_.
149 142
143config PPC_EARLY_DEBUG_BOOTX
144 bool "BootX or OpenFirmware"
145 depends on BOOTX_TEXT
146 help
147 Select this to enable early debugging for a machine using BootX
148 or OpenFirmware.
149
150config PPC_EARLY_DEBUG_LPAR 150config PPC_EARLY_DEBUG_LPAR
151 bool "LPAR HV Console" 151 bool "LPAR HV Console"
152 depends on PPC_PSERIES 152 depends on PPC_PSERIES
diff --git a/arch/powerpc/boot/dts/currituck.dts b/arch/powerpc/boot/dts/currituck.dts
index b801dd06e573..d2c8a872308e 100644
--- a/arch/powerpc/boot/dts/currituck.dts
+++ b/arch/powerpc/boot/dts/currituck.dts
@@ -103,6 +103,11 @@
103 interrupts = <34 2>; 103 interrupts = <34 2>;
104 }; 104 };
105 105
106 FPGA0: fpga@50000000 {
107 compatible = "ibm,currituck-fpga";
108 reg = <0x50000000 0x4>;
109 };
110
106 IIC0: i2c@00000000 { 111 IIC0: i2c@00000000 {
107 compatible = "ibm,iic-currituck", "ibm,iic"; 112 compatible = "ibm,iic-currituck", "ibm,iic";
108 reg = <0x0 0x00000014>; 113 reg = <0x0 0x00000014>;
diff --git a/arch/powerpc/boot/dts/fsl/interlaken-lac-portals.dtsi b/arch/powerpc/boot/dts/fsl/interlaken-lac-portals.dtsi
new file mode 100644
index 000000000000..9cffccf4e07e
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/interlaken-lac-portals.dtsi
@@ -0,0 +1,156 @@
1/* T4240 Interlaken LAC Portal device tree stub with 24 portals.
2 *
3 * Copyright 2012 Freescale Semiconductor Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of Freescale Semiconductor nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 *
17 * ALTERNATIVELY, this software may be distributed under the terms of the
18 * GNU General Public License ("GPL") as published by the Free Software
19 * Foundation, either version 2 of that License or (at your option) any
20 * later version.
21 *
22 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
23 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
26 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#address-cells = <0x1>;
35#size-cells = <0x1>;
36compatible = "fsl,interlaken-lac-portals";
37
38lportal0: lac-portal@0 {
39 compatible = "fsl,interlaken-lac-portal-v1.0";
40 reg = <0x0 0x1000>;
41};
42
43lportal1: lac-portal@1000 {
44 compatible = "fsl,interlaken-lac-portal-v1.0";
45 reg = <0x1000 0x1000>;
46};
47
48lportal2: lac-portal@2000 {
49 compatible = "fsl,interlaken-lac-portal-v1.0";
50 reg = <0x2000 0x1000>;
51};
52
53lportal3: lac-portal@3000 {
54 compatible = "fsl,interlaken-lac-portal-v1.0";
55 reg = <0x3000 0x1000>;
56};
57
58lportal4: lac-portal@4000 {
59 compatible = "fsl,interlaken-lac-portal-v1.0";
60 reg = <0x4000 0x1000>;
61};
62
63lportal5: lac-portal@5000 {
64 compatible = "fsl,interlaken-lac-portal-v1.0";
65 reg = <0x5000 0x1000>;
66};
67
68lportal6: lac-portal@6000 {
69 compatible = "fsl,interlaken-lac-portal-v1.0";
70 reg = <0x6000 0x1000>;
71};
72
73lportal7: lac-portal@7000 {
74 compatible = "fsl,interlaken-lac-portal-v1.0";
75 reg = <0x7000 0x1000>;
76};
77
78lportal8: lac-portal@8000 {
79 compatible = "fsl,interlaken-lac-portal-v1.0";
80 reg = <0x8000 0x1000>;
81};
82
83lportal9: lac-portal@9000 {
84 compatible = "fsl,interlaken-lac-portal-v1.0";
85 reg = <0x9000 0x1000>;
86};
87
88lportal10: lac-portal@A000 {
89 compatible = "fsl,interlaken-lac-portal-v1.0";
90 reg = <0xA000 0x1000>;
91};
92
93lportal11: lac-portal@B000 {
94 compatible = "fsl,interlaken-lac-portal-v1.0";
95 reg = <0xB000 0x1000>;
96};
97
98lportal12: lac-portal@C000 {
99 compatible = "fsl,interlaken-lac-portal-v1.0";
100 reg = <0xC000 0x1000>;
101};
102
103lportal13: lac-portal@D000 {
104 compatible = "fsl,interlaken-lac-portal-v1.0";
105 reg = <0xD000 0x1000>;
106};
107
108lportal14: lac-portal@E000 {
109 compatible = "fsl,interlaken-lac-portal-v1.0";
110 reg = <0xE000 0x1000>;
111};
112
113lportal15: lac-portal@F000 {
114 compatible = "fsl,interlaken-lac-portal-v1.0";
115 reg = <0xF000 0x1000>;
116};
117
118lportal16: lac-portal@10000 {
119 compatible = "fsl,interlaken-lac-portal-v1.0";
120 reg = <0x10000 0x1000>;
121};
122
123lportal17: lac-portal@11000 {
124 compatible = "fsl,interlaken-lac-portal-v1.0";
125 reg = <0x11000 0x1000>;
126};
127
128lportal18: lac-portal@1200 {
129 compatible = "fsl,interlaken-lac-portal-v1.0";
130 reg = <0x12000 0x1000>;
131};
132
133lportal19: lac-portal@13000 {
134 compatible = "fsl,interlaken-lac-portal-v1.0";
135 reg = <0x13000 0x1000>;
136};
137
138lportal20: lac-portal@14000 {
139 compatible = "fsl,interlaken-lac-portal-v1.0";
140 reg = <0x14000 0x1000>;
141};
142
143lportal21: lac-portal@15000 {
144 compatible = "fsl,interlaken-lac-portal-v1.0";
145 reg = <0x15000 0x1000>;
146};
147
148lportal22: lac-portal@16000 {
149 compatible = "fsl,interlaken-lac-portal-v1.0";
150 reg = <0x16000 0x1000>;
151};
152
153lportal23: lac-portal@17000 {
154 compatible = "fsl,interlaken-lac-portal-v1.0";
155 reg = <0x17000 0x1000>;
156};
diff --git a/arch/powerpc/boot/dts/fsl/interlaken-lac.dtsi b/arch/powerpc/boot/dts/fsl/interlaken-lac.dtsi
new file mode 100644
index 000000000000..e8208720ac0e
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/interlaken-lac.dtsi
@@ -0,0 +1,45 @@
1/*
2 * T4 Interlaken Look-aside Controller (LAC) device tree stub
3 *
4 * Copyright 2012 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35lac: lac@229000 {
36 compatible = "fsl,interlaken-lac";
37 reg = <0x229000 0x1000>;
38 interrupts = <16 2 1 18>;
39};
40
41lac-hv@228000 {
42 compatible = "fsl,interlaken-lac-hv";
43 reg = <0x228000 0x1000>;
44 fsl,non-hv-node = <&lac>;
45};
diff --git a/arch/powerpc/configs/c2k_defconfig b/arch/powerpc/configs/c2k_defconfig
index 2a84fd7f631c..671a8f960afa 100644
--- a/arch/powerpc/configs/c2k_defconfig
+++ b/arch/powerpc/configs/c2k_defconfig
@@ -423,6 +423,8 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
423CONFIG_DEBUG_STACKOVERFLOW=y 423CONFIG_DEBUG_STACKOVERFLOW=y
424CONFIG_DEBUG_STACK_USAGE=y 424CONFIG_DEBUG_STACK_USAGE=y
425CONFIG_BOOTX_TEXT=y 425CONFIG_BOOTX_TEXT=y
426CONFIG_PPC_EARLY_DEBUG=y
427CONFIG_PPC_EARLY_DEBUG_BOOTX=y
426CONFIG_KEYS=y 428CONFIG_KEYS=y
427CONFIG_KEYS_DEBUG_PROC_KEYS=y 429CONFIG_KEYS_DEBUG_PROC_KEYS=y
428CONFIG_SECURITY=y 430CONFIG_SECURITY=y
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index 07b7f2af2dca..1ea22fc24ea8 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_defconfig
@@ -284,6 +284,8 @@ CONFIG_DEBUG_MUTEXES=y
284CONFIG_LATENCYTOP=y 284CONFIG_LATENCYTOP=y
285CONFIG_SYSCTL_SYSCALL_CHECK=y 285CONFIG_SYSCTL_SYSCALL_CHECK=y
286CONFIG_BOOTX_TEXT=y 286CONFIG_BOOTX_TEXT=y
287CONFIG_PPC_EARLY_DEBUG=y
288CONFIG_PPC_EARLY_DEBUG_BOOTX=y
287CONFIG_CRYPTO_NULL=m 289CONFIG_CRYPTO_NULL=m
288CONFIG_CRYPTO_TEST=m 290CONFIG_CRYPTO_TEST=m
289CONFIG_CRYPTO_ECB=m 291CONFIG_CRYPTO_ECB=m
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig
index 02ac96b679b8..2a5afac29861 100644
--- a/arch/powerpc/configs/maple_defconfig
+++ b/arch/powerpc/configs/maple_defconfig
@@ -138,6 +138,8 @@ CONFIG_DEBUG_STACK_USAGE=y
138CONFIG_XMON=y 138CONFIG_XMON=y
139CONFIG_XMON_DEFAULT=y 139CONFIG_XMON_DEFAULT=y
140CONFIG_BOOTX_TEXT=y 140CONFIG_BOOTX_TEXT=y
141CONFIG_PPC_EARLY_DEBUG=y
142CONFIG_PPC_EARLY_DEBUG_BOOTX=y
141CONFIG_CRYPTO_ECB=m 143CONFIG_CRYPTO_ECB=m
142CONFIG_CRYPTO_PCBC=m 144CONFIG_CRYPTO_PCBC=m
143# CONFIG_CRYPTO_ANSI_CPRNG is not set 145# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/powerpc/configs/mpc512x_defconfig b/arch/powerpc/configs/mpc512x_defconfig
index 0d0d981442fd..ee853a1b1b2c 100644
--- a/arch/powerpc/configs/mpc512x_defconfig
+++ b/arch/powerpc/configs/mpc512x_defconfig
@@ -1,7 +1,6 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_SPARSE_IRQ=y 3CONFIG_NO_HZ=y
5CONFIG_LOG_BUF_SHIFT=16 4CONFIG_LOG_BUF_SHIFT=16
6CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
7# CONFIG_COMPAT_BRK is not set 6# CONFIG_COMPAT_BRK is not set
@@ -9,6 +8,7 @@ CONFIG_SLAB=y
9CONFIG_MODULES=y 8CONFIG_MODULES=y
10CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
11# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_PARTITION_ADVANCED=y
12# CONFIG_IOSCHED_CFQ is not set 12# CONFIG_IOSCHED_CFQ is not set
13# CONFIG_PPC_CHRP is not set 13# CONFIG_PPC_CHRP is not set
14CONFIG_PPC_MPC512x=y 14CONFIG_PPC_MPC512x=y
@@ -16,9 +16,7 @@ CONFIG_MPC5121_ADS=y
16CONFIG_MPC512x_GENERIC=y 16CONFIG_MPC512x_GENERIC=y
17CONFIG_PDM360NG=y 17CONFIG_PDM360NG=y
18# CONFIG_PPC_PMAC is not set 18# CONFIG_PPC_PMAC is not set
19CONFIG_NO_HZ=y
20CONFIG_HZ_1000=y 19CONFIG_HZ_1000=y
21# CONFIG_MIGRATION is not set
22# CONFIG_SECCOMP is not set 20# CONFIG_SECCOMP is not set
23# CONFIG_PCI is not set 21# CONFIG_PCI is not set
24CONFIG_NET=y 22CONFIG_NET=y
@@ -33,8 +31,6 @@ CONFIG_IP_PNP=y
33# CONFIG_INET_DIAG is not set 31# CONFIG_INET_DIAG is not set
34# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
35CONFIG_CAN=y 33CONFIG_CAN=y
36CONFIG_CAN_RAW=y
37CONFIG_CAN_BCM=y
38CONFIG_CAN_VCAN=y 34CONFIG_CAN_VCAN=y
39CONFIG_CAN_MSCAN=y 35CONFIG_CAN_MSCAN=y
40CONFIG_CAN_DEBUG_DEVICES=y 36CONFIG_CAN_DEBUG_DEVICES=y
@@ -46,7 +42,6 @@ CONFIG_DEVTMPFS_MOUNT=y
46# CONFIG_FIRMWARE_IN_KERNEL is not set 42# CONFIG_FIRMWARE_IN_KERNEL is not set
47CONFIG_MTD=y 43CONFIG_MTD=y
48CONFIG_MTD_CMDLINE_PARTS=y 44CONFIG_MTD_CMDLINE_PARTS=y
49CONFIG_MTD_CHAR=y
50CONFIG_MTD_BLOCK=y 45CONFIG_MTD_BLOCK=y
51CONFIG_MTD_CFI=y 46CONFIG_MTD_CFI=y
52CONFIG_MTD_CFI_AMDSTD=y 47CONFIG_MTD_CFI_AMDSTD=y
@@ -60,7 +55,6 @@ CONFIG_BLK_DEV_RAM=y
60CONFIG_BLK_DEV_RAM_COUNT=1 55CONFIG_BLK_DEV_RAM_COUNT=1
61CONFIG_BLK_DEV_RAM_SIZE=8192 56CONFIG_BLK_DEV_RAM_SIZE=8192
62CONFIG_BLK_DEV_XIP=y 57CONFIG_BLK_DEV_XIP=y
63CONFIG_MISC_DEVICES=y
64CONFIG_EEPROM_AT24=y 58CONFIG_EEPROM_AT24=y
65CONFIG_EEPROM_AT25=y 59CONFIG_EEPROM_AT25=y
66CONFIG_SCSI=y 60CONFIG_SCSI=y
@@ -68,6 +62,7 @@ CONFIG_SCSI=y
68CONFIG_BLK_DEV_SD=y 62CONFIG_BLK_DEV_SD=y
69CONFIG_CHR_DEV_SG=y 63CONFIG_CHR_DEV_SG=y
70CONFIG_NETDEVICES=y 64CONFIG_NETDEVICES=y
65CONFIG_FS_ENET=y
71CONFIG_MARVELL_PHY=y 66CONFIG_MARVELL_PHY=y
72CONFIG_DAVICOM_PHY=y 67CONFIG_DAVICOM_PHY=y
73CONFIG_QSEMI_PHY=y 68CONFIG_QSEMI_PHY=y
@@ -83,10 +78,6 @@ CONFIG_STE10XP=y
83CONFIG_LSI_ET1011C_PHY=y 78CONFIG_LSI_ET1011C_PHY=y
84CONFIG_FIXED_PHY=y 79CONFIG_FIXED_PHY=y
85CONFIG_MDIO_BITBANG=y 80CONFIG_MDIO_BITBANG=y
86CONFIG_NET_ETHERNET=y
87CONFIG_FS_ENET=y
88# CONFIG_NETDEV_1000 is not set
89# CONFIG_NETDEV_10000 is not set
90# CONFIG_WLAN is not set 81# CONFIG_WLAN is not set
91# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 82# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
92CONFIG_INPUT_EVDEV=y 83CONFIG_INPUT_EVDEV=y
@@ -106,14 +97,18 @@ CONFIG_GPIO_SYSFS=y
106CONFIG_GPIO_MPC8XXX=y 97CONFIG_GPIO_MPC8XXX=y
107# CONFIG_HWMON is not set 98# CONFIG_HWMON is not set
108CONFIG_MEDIA_SUPPORT=y 99CONFIG_MEDIA_SUPPORT=y
109CONFIG_VIDEO_DEV=y
110CONFIG_VIDEO_ADV_DEBUG=y 100CONFIG_VIDEO_ADV_DEBUG=y
111# CONFIG_VIDEO_HELPER_CHIPS_AUTO is not set
112CONFIG_VIDEO_SAA711X=y
113CONFIG_FB=y 101CONFIG_FB=y
114CONFIG_FB_FSL_DIU=y 102CONFIG_FB_FSL_DIU=y
115# CONFIG_VGA_CONSOLE is not set 103# CONFIG_VGA_CONSOLE is not set
116CONFIG_FRAMEBUFFER_CONSOLE=y 104CONFIG_FRAMEBUFFER_CONSOLE=y
105CONFIG_USB=y
106CONFIG_USB_EHCI_HCD=y
107CONFIG_USB_EHCI_FSL=y
108# CONFIG_USB_EHCI_HCD_PPC_OF is not set
109CONFIG_USB_STORAGE=y
110CONFIG_USB_GADGET=y
111CONFIG_USB_FSL_USB2=y
117CONFIG_RTC_CLASS=y 112CONFIG_RTC_CLASS=y
118CONFIG_RTC_DRV_M41T80=y 113CONFIG_RTC_DRV_M41T80=y
119CONFIG_RTC_DRV_MPC5121=y 114CONFIG_RTC_DRV_MPC5121=y
@@ -129,9 +124,7 @@ CONFIG_TMPFS=y
129CONFIG_JFFS2_FS=y 124CONFIG_JFFS2_FS=y
130CONFIG_UBIFS_FS=y 125CONFIG_UBIFS_FS=y
131CONFIG_NFS_FS=y 126CONFIG_NFS_FS=y
132CONFIG_NFS_V3=y
133CONFIG_ROOT_NFS=y 127CONFIG_ROOT_NFS=y
134CONFIG_PARTITION_ADVANCED=y
135CONFIG_NLS_CODEPAGE_437=y 128CONFIG_NLS_CODEPAGE_437=y
136CONFIG_NLS_ISO8859_1=y 129CONFIG_NLS_ISO8859_1=y
137# CONFIG_ENABLE_WARN_DEPRECATED is not set 130# CONFIG_ENABLE_WARN_DEPRECATED is not set
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 165e6b32baef..152fa05b15e4 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -131,6 +131,7 @@ CONFIG_DUMMY=y
131CONFIG_FS_ENET=y 131CONFIG_FS_ENET=y
132CONFIG_UCC_GETH=y 132CONFIG_UCC_GETH=y
133CONFIG_GIANFAR=y 133CONFIG_GIANFAR=y
134CONFIG_E1000E=y
134CONFIG_MARVELL_PHY=y 135CONFIG_MARVELL_PHY=y
135CONFIG_DAVICOM_PHY=y 136CONFIG_DAVICOM_PHY=y
136CONFIG_CICADA_PHY=y 137CONFIG_CICADA_PHY=y
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index 29767a8dfea5..a73626b09051 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -350,6 +350,8 @@ CONFIG_SYSCTL_SYSCALL_CHECK=y
350CONFIG_XMON=y 350CONFIG_XMON=y
351CONFIG_XMON_DEFAULT=y 351CONFIG_XMON_DEFAULT=y
352CONFIG_BOOTX_TEXT=y 352CONFIG_BOOTX_TEXT=y
353CONFIG_PPC_EARLY_DEBUG=y
354CONFIG_PPC_EARLY_DEBUG_BOOTX=y
353CONFIG_CRYPTO_NULL=m 355CONFIG_CRYPTO_NULL=m
354CONFIG_CRYPTO_PCBC=m 356CONFIG_CRYPTO_PCBC=m
355CONFIG_CRYPTO_MD4=m 357CONFIG_CRYPTO_MD4=m
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index aef3f71de5ad..c86fcb92358e 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -398,6 +398,8 @@ CONFIG_FTR_FIXUP_SELFTEST=y
398CONFIG_MSI_BITMAP_SELFTEST=y 398CONFIG_MSI_BITMAP_SELFTEST=y
399CONFIG_XMON=y 399CONFIG_XMON=y
400CONFIG_BOOTX_TEXT=y 400CONFIG_BOOTX_TEXT=y
401CONFIG_PPC_EARLY_DEBUG=y
402CONFIG_PPC_EARLY_DEBUG_BOOTX=y
401CONFIG_CRYPTO_NULL=m 403CONFIG_CRYPTO_NULL=m
402CONFIG_CRYPTO_TEST=m 404CONFIG_CRYPTO_TEST=m
403CONFIG_CRYPTO_PCBC=m 405CONFIG_CRYPTO_PCBC=m
diff --git a/arch/powerpc/configs/ppc6xx_defconfig b/arch/powerpc/configs/ppc6xx_defconfig
index be1cb6ea3a36..20ebfaf7234b 100644
--- a/arch/powerpc/configs/ppc6xx_defconfig
+++ b/arch/powerpc/configs/ppc6xx_defconfig
@@ -1264,6 +1264,8 @@ CONFIG_DEBUG_STACKOVERFLOW=y
1264CONFIG_DEBUG_STACK_USAGE=y 1264CONFIG_DEBUG_STACK_USAGE=y
1265CONFIG_XMON=y 1265CONFIG_XMON=y
1266CONFIG_BOOTX_TEXT=y 1266CONFIG_BOOTX_TEXT=y
1267CONFIG_PPC_EARLY_DEBUG=y
1268CONFIG_PPC_EARLY_DEBUG_BOOTX=y
1267CONFIG_KEYS=y 1269CONFIG_KEYS=y
1268CONFIG_KEYS_DEBUG_PROC_KEYS=y 1270CONFIG_KEYS_DEBUG_PROC_KEYS=y
1269CONFIG_SECURITY=y 1271CONFIG_SECURITY=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index c4dfbaf8b192..bea8587c3af5 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -296,6 +296,7 @@ CONFIG_SQUASHFS=m
296CONFIG_SQUASHFS_XATTR=y 296CONFIG_SQUASHFS_XATTR=y
297CONFIG_SQUASHFS_LZO=y 297CONFIG_SQUASHFS_LZO=y
298CONFIG_SQUASHFS_XZ=y 298CONFIG_SQUASHFS_XZ=y
299CONFIG_PSTORE=y
299CONFIG_NFS_FS=y 300CONFIG_NFS_FS=y
300CONFIG_NFS_V3_ACL=y 301CONFIG_NFS_V3_ACL=y
301CONFIG_NFS_V4=y 302CONFIG_NFS_V4=y
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 26807e5aff51..6f3887d884d2 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -176,6 +176,7 @@ extern const char *powerpc_base_platform;
176#define CPU_FTR_CFAR LONG_ASM_CONST(0x0100000000000000) 176#define CPU_FTR_CFAR LONG_ASM_CONST(0x0100000000000000)
177#define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0200000000000000) 177#define CPU_FTR_HAS_PPR LONG_ASM_CONST(0x0200000000000000)
178#define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000) 178#define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000)
179#define CPU_FTR_DABRX LONG_ASM_CONST(0x0800000000000000)
179 180
180#ifndef __ASSEMBLY__ 181#ifndef __ASSEMBLY__
181 182
@@ -394,19 +395,20 @@ extern const char *powerpc_base_platform;
394 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_201 | \ 395 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_201 | \
395 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \ 396 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA | \
396 CPU_FTR_CP_USE_DCBTZ | CPU_FTR_STCX_CHECKS_ADDRESS | \ 397 CPU_FTR_CP_USE_DCBTZ | CPU_FTR_STCX_CHECKS_ADDRESS | \
397 CPU_FTR_HVMODE) 398 CPU_FTR_HVMODE | CPU_FTR_DABRX)
398#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 399#define CPU_FTRS_POWER5 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
399 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 400 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
400 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 401 CPU_FTR_MMCRA | CPU_FTR_SMT | \
401 CPU_FTR_COHERENT_ICACHE | CPU_FTR_PURR | \ 402 CPU_FTR_COHERENT_ICACHE | CPU_FTR_PURR | \
402 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB) 403 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_DABRX)
403#define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 404#define CPU_FTRS_POWER6 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
404 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 405 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
405 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 406 CPU_FTR_MMCRA | CPU_FTR_SMT | \
406 CPU_FTR_COHERENT_ICACHE | \ 407 CPU_FTR_COHERENT_ICACHE | \
407 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ 408 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
408 CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD | \ 409 CPU_FTR_DSCR | CPU_FTR_UNALIGNED_LD_STD | \
409 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_CFAR) 410 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_CFAR | \
411 CPU_FTR_DABRX)
410#define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 412#define CPU_FTRS_POWER7 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
411 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ 413 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
412 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 414 CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -415,7 +417,7 @@ extern const char *powerpc_base_platform;
415 CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \ 417 CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT | \
416 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \ 418 CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
417 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | \ 419 CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | \
418 CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR) 420 CPU_FTR_VMX_COPY | CPU_FTR_HAS_PPR | CPU_FTR_DABRX)
419#define CPU_FTRS_POWER8 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 421#define CPU_FTRS_POWER8 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
420 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\ 422 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | CPU_FTR_ARCH_206 |\
421 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 423 CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -430,14 +432,15 @@ extern const char *powerpc_base_platform;
430 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 432 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
431 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 433 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
432 CPU_FTR_PAUSE_ZERO | CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ | \ 434 CPU_FTR_PAUSE_ZERO | CPU_FTR_CELL_TB_BUG | CPU_FTR_CP_USE_DCBTZ | \
433 CPU_FTR_UNALIGNED_LD_STD) 435 CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_DABRX)
434#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 436#define CPU_FTRS_PA6T (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
435 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | \ 437 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | \
436 CPU_FTR_PURR | CPU_FTR_REAL_LE) 438 CPU_FTR_PURR | CPU_FTR_REAL_LE | CPU_FTR_DABRX)
437#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2) 439#define CPU_FTRS_COMPATIBLE (CPU_FTR_USE_TB | CPU_FTR_PPCAS_ARCH_V2)
438 440
439#define CPU_FTRS_A2 (CPU_FTR_USE_TB | CPU_FTR_SMT | CPU_FTR_DBELL | \ 441#define CPU_FTRS_A2 (CPU_FTR_USE_TB | CPU_FTR_SMT | CPU_FTR_DBELL | \
440 CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | CPU_FTR_ICSWX) 442 CPU_FTR_NOEXECUTE | CPU_FTR_NODSISRALIGN | \
443 CPU_FTR_ICSWX | CPU_FTR_DABRX )
441 444
442#ifdef __powerpc64__ 445#ifdef __powerpc64__
443#ifdef CONFIG_PPC_BOOK3E 446#ifdef CONFIG_PPC_BOOK3E
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index a80e32b46c11..09a8743143f3 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
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 28
28struct pci_dev; 29struct pci_dev;
29struct pci_bus; 30struct pci_bus;
@@ -52,6 +53,7 @@ struct device_node;
52 53
53#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */ 54#define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */
54#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */ 55#define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */
56#define EEH_PE_PHB_DEAD (1 << 2) /* Dead PHB */
55 57
56struct eeh_pe { 58struct eeh_pe {
57 int type; /* PE type: PHB/Bus/Device */ 59 int type; /* PE type: PHB/Bus/Device */
@@ -59,8 +61,10 @@ struct eeh_pe {
59 int config_addr; /* Traditional PCI address */ 61 int config_addr; /* Traditional PCI address */
60 int addr; /* PE configuration address */ 62 int addr; /* PE configuration address */
61 struct pci_controller *phb; /* Associated PHB */ 63 struct pci_controller *phb; /* Associated PHB */
64 struct pci_bus *bus; /* Top PCI bus for bus PE */
62 int check_count; /* Times of ignored error */ 65 int check_count; /* Times of ignored error */
63 int freeze_count; /* Times of froze up */ 66 int freeze_count; /* Times of froze up */
67 struct timeval tstamp; /* Time on first-time freeze */
64 int false_positives; /* Times of reported #ff's */ 68 int false_positives; /* Times of reported #ff's */
65 struct eeh_pe *parent; /* Parent PE */ 69 struct eeh_pe *parent; /* Parent PE */
66 struct list_head child_list; /* Link PE to the child list */ 70 struct list_head child_list; /* Link PE to the child list */
@@ -95,12 +99,12 @@ struct eeh_dev {
95 99
96static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev) 100static inline struct device_node *eeh_dev_to_of_node(struct eeh_dev *edev)
97{ 101{
98 return edev->dn; 102 return edev ? edev->dn : NULL;
99} 103}
100 104
101static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev) 105static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
102{ 106{
103 return edev->pdev; 107 return edev ? edev->pdev : NULL;
104} 108}
105 109
106/* 110/*
@@ -130,8 +134,9 @@ static inline struct pci_dev *eeh_dev_to_pci_dev(struct eeh_dev *edev)
130struct eeh_ops { 134struct eeh_ops {
131 char *name; 135 char *name;
132 int (*init)(void); 136 int (*init)(void);
137 int (*post_init)(void);
133 void* (*of_probe)(struct device_node *dn, void *flag); 138 void* (*of_probe)(struct device_node *dn, void *flag);
134 void* (*dev_probe)(struct pci_dev *dev, void *flag); 139 int (*dev_probe)(struct pci_dev *dev, void *flag);
135 int (*set_option)(struct eeh_pe *pe, int option); 140 int (*set_option)(struct eeh_pe *pe, int option);
136 int (*get_pe_addr)(struct eeh_pe *pe); 141 int (*get_pe_addr)(struct eeh_pe *pe);
137 int (*get_state)(struct eeh_pe *pe, int *state); 142 int (*get_state)(struct eeh_pe *pe, int *state);
@@ -141,11 +146,12 @@ struct eeh_ops {
141 int (*configure_bridge)(struct eeh_pe *pe); 146 int (*configure_bridge)(struct eeh_pe *pe);
142 int (*read_config)(struct device_node *dn, int where, int size, u32 *val); 147 int (*read_config)(struct device_node *dn, int where, int size, u32 *val);
143 int (*write_config)(struct device_node *dn, int where, int size, u32 val); 148 int (*write_config)(struct device_node *dn, int where, int size, u32 val);
149 int (*next_error)(struct eeh_pe **pe);
144}; 150};
145 151
146extern struct eeh_ops *eeh_ops; 152extern struct eeh_ops *eeh_ops;
147extern int eeh_subsystem_enabled; 153extern int eeh_subsystem_enabled;
148extern struct mutex eeh_mutex; 154extern raw_spinlock_t confirm_error_lock;
149extern int eeh_probe_mode; 155extern int eeh_probe_mode;
150 156
151#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */ 157#define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */
@@ -166,14 +172,14 @@ static inline int eeh_probe_mode_dev(void)
166 return (eeh_probe_mode == EEH_PROBE_MODE_DEV); 172 return (eeh_probe_mode == EEH_PROBE_MODE_DEV);
167} 173}
168 174
169static inline void eeh_lock(void) 175static inline void eeh_serialize_lock(unsigned long *flags)
170{ 176{
171 mutex_lock(&eeh_mutex); 177 raw_spin_lock_irqsave(&confirm_error_lock, *flags);
172} 178}
173 179
174static inline void eeh_unlock(void) 180static inline void eeh_serialize_unlock(unsigned long flags)
175{ 181{
176 mutex_unlock(&eeh_mutex); 182 raw_spin_unlock_irqrestore(&confirm_error_lock, flags);
177} 183}
178 184
179/* 185/*
@@ -184,8 +190,11 @@ static inline void eeh_unlock(void)
184 190
185typedef void *(*eeh_traverse_func)(void *data, void *flag); 191typedef void *(*eeh_traverse_func)(void *data, void *flag);
186int eeh_phb_pe_create(struct pci_controller *phb); 192int eeh_phb_pe_create(struct pci_controller *phb);
193struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb);
194struct eeh_pe *eeh_pe_get(struct eeh_dev *edev);
187int eeh_add_to_parent_pe(struct eeh_dev *edev); 195int eeh_add_to_parent_pe(struct eeh_dev *edev);
188int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe); 196int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe);
197void eeh_pe_update_time_stamp(struct eeh_pe *pe);
189void *eeh_pe_dev_traverse(struct eeh_pe *root, 198void *eeh_pe_dev_traverse(struct eeh_pe *root,
190 eeh_traverse_func fn, void *flag); 199 eeh_traverse_func fn, void *flag);
191void eeh_pe_restore_bars(struct eeh_pe *pe); 200void eeh_pe_restore_bars(struct eeh_pe *pe);
@@ -193,12 +202,13 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
193 202
194void *eeh_dev_init(struct device_node *dn, void *data); 203void *eeh_dev_init(struct device_node *dn, void *data);
195void eeh_dev_phb_init_dynamic(struct pci_controller *phb); 204void eeh_dev_phb_init_dynamic(struct pci_controller *phb);
205int eeh_init(void);
196int __init eeh_ops_register(struct eeh_ops *ops); 206int __init eeh_ops_register(struct eeh_ops *ops);
197int __exit eeh_ops_unregister(const char *name); 207int __exit eeh_ops_unregister(const char *name);
198unsigned long eeh_check_failure(const volatile void __iomem *token, 208unsigned long eeh_check_failure(const volatile void __iomem *token,
199 unsigned long val); 209 unsigned long val);
200int eeh_dev_check_failure(struct eeh_dev *edev); 210int eeh_dev_check_failure(struct eeh_dev *edev);
201void __init eeh_addr_cache_build(void); 211void eeh_addr_cache_build(void);
202void eeh_add_device_tree_early(struct device_node *); 212void eeh_add_device_tree_early(struct device_node *);
203void eeh_add_device_tree_late(struct pci_bus *); 213void eeh_add_device_tree_late(struct pci_bus *);
204void eeh_add_sysfs_files(struct pci_bus *); 214void eeh_add_sysfs_files(struct pci_bus *);
@@ -221,6 +231,11 @@ void eeh_remove_bus_device(struct pci_dev *, int);
221 231
222#else /* !CONFIG_EEH */ 232#else /* !CONFIG_EEH */
223 233
234static inline int eeh_init(void)
235{
236 return 0;
237}
238
224static inline void *eeh_dev_init(struct device_node *dn, void *data) 239static inline void *eeh_dev_init(struct device_node *dn, void *data)
225{ 240{
226 return NULL; 241 return NULL;
@@ -245,9 +260,6 @@ static inline void eeh_add_sysfs_files(struct pci_bus *bus) { }
245 260
246static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } 261static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
247 262
248static inline void eeh_lock(void) { }
249static inline void eeh_unlock(void) { }
250
251#define EEH_POSSIBLE_ERROR(val, type) (0) 263#define EEH_POSSIBLE_ERROR(val, type) (0)
252#define EEH_IO_ERROR_VALUE(size) (-1UL) 264#define EEH_IO_ERROR_VALUE(size) (-1UL)
253#endif /* CONFIG_EEH */ 265#endif /* CONFIG_EEH */
diff --git a/arch/powerpc/include/asm/eeh_event.h b/arch/powerpc/include/asm/eeh_event.h
index de67d830151b..89d5670b2eeb 100644
--- a/arch/powerpc/include/asm/eeh_event.h
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -31,7 +31,9 @@ struct eeh_event {
31 struct eeh_pe *pe; /* EEH PE */ 31 struct eeh_pe *pe; /* EEH PE */
32}; 32};
33 33
34int eeh_event_init(void);
34int eeh_send_failure_event(struct eeh_pe *pe); 35int eeh_send_failure_event(struct eeh_pe *pe);
36void eeh_remove_event(struct eeh_pe *pe);
35void eeh_handle_event(struct eeh_pe *pe); 37void eeh_handle_event(struct eeh_pe *pe);
36 38
37#endif /* __KERNEL__ */ 39#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 8e5fae8beaf6..07ca627e52c0 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -358,12 +358,12 @@ label##_relon_pSeries: \
358 /* No guest interrupts come through here */ \ 358 /* No guest interrupts come through here */ \
359 SET_SCRATCH0(r13); /* save r13 */ \ 359 SET_SCRATCH0(r13); /* save r13 */ \
360 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 360 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
361 EXC_STD, KVMTEST_PR, vec) 361 EXC_STD, NOTEST, vec)
362 362
363#define STD_RELON_EXCEPTION_PSERIES_OOL(vec, label) \ 363#define STD_RELON_EXCEPTION_PSERIES_OOL(vec, label) \
364 .globl label##_relon_pSeries; \ 364 .globl label##_relon_pSeries; \
365label##_relon_pSeries: \ 365label##_relon_pSeries: \
366 EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_PR, vec); \ 366 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, vec); \
367 EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, EXC_STD) 367 EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, EXC_STD)
368 368
369#define STD_RELON_EXCEPTION_HV(loc, vec, label) \ 369#define STD_RELON_EXCEPTION_HV(loc, vec, label) \
@@ -374,12 +374,12 @@ label##_relon_hv: \
374 /* No guest interrupts come through here */ \ 374 /* No guest interrupts come through here */ \
375 SET_SCRATCH0(r13); /* save r13 */ \ 375 SET_SCRATCH0(r13); /* save r13 */ \
376 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \ 376 EXCEPTION_RELON_PROLOG_PSERIES(PACA_EXGEN, label##_common, \
377 EXC_HV, KVMTEST, vec) 377 EXC_HV, NOTEST, vec)
378 378
379#define STD_RELON_EXCEPTION_HV_OOL(vec, label) \ 379#define STD_RELON_EXCEPTION_HV_OOL(vec, label) \
380 .globl label##_relon_hv; \ 380 .globl label##_relon_hv; \
381label##_relon_hv: \ 381label##_relon_hv: \
382 EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST, vec); \ 382 EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, vec); \
383 EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, EXC_HV) 383 EXCEPTION_RELON_PROLOG_PSERIES_1(label##_common, EXC_HV)
384 384
385/* This associate vector numbers with bits in paca->irq_happened */ 385/* This associate vector numbers with bits in paca->irq_happened */
@@ -513,7 +513,7 @@ label##_common: \
513 */ 513 */
514#define STD_EXCEPTION_COMMON_ASYNC(trap, label, hdlr) \ 514#define STD_EXCEPTION_COMMON_ASYNC(trap, label, hdlr) \
515 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except_lite, \ 515 EXCEPTION_COMMON(trap, label, hdlr, ret_from_except_lite, \
516 FINISH_NAP;RUNLATCH_ON;DISABLE_INTS) 516 FINISH_NAP;DISABLE_INTS;RUNLATCH_ON)
517 517
518/* 518/*
519 * When the idle code in power4_idle puts the CPU into NAP mode, 519 * When the idle code in power4_idle puts the CPU into NAP mode,
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index f2498c8e595d..d750336b171d 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -191,8 +191,14 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma,
191 unsigned long vmaddr) 191 unsigned long vmaddr)
192{ 192{
193} 193}
194#endif /* CONFIG_HUGETLB_PAGE */
195 194
195#define hugepd_shift(x) 0
196static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
197 unsigned pdshift)
198{
199 return 0;
200}
201#endif /* CONFIG_HUGETLB_PAGE */
196 202
197/* 203/*
198 * FSL Book3E platforms require special gpage handling - the gpages 204 * FSL Book3E platforms require special gpage handling - the gpages
diff --git a/arch/powerpc/include/asm/ibmebus.h b/arch/powerpc/include/asm/ibmebus.h
index 1a9d9aea21fa..088f95b2e14f 100644
--- a/arch/powerpc/include/asm/ibmebus.h
+++ b/arch/powerpc/include/asm/ibmebus.h
@@ -48,8 +48,8 @@
48 48
49extern struct bus_type ibmebus_bus_type; 49extern struct bus_type ibmebus_bus_type;
50 50
51int ibmebus_register_driver(struct of_platform_driver *drv); 51int ibmebus_register_driver(struct platform_driver *drv);
52void ibmebus_unregister_driver(struct of_platform_driver *drv); 52void ibmebus_unregister_driver(struct platform_driver *drv);
53 53
54int ibmebus_request_irq(u32 ist, irq_handler_t handler, 54int ibmebus_request_irq(u32 ist, irq_handler_t handler,
55 unsigned long irq_flags, const char *devname, 55 unsigned long irq_flags, const char *devname,
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index cbfe678e3dbe..c34656a8925e 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -76,6 +76,9 @@ struct iommu_table {
76 struct iommu_pool large_pool; 76 struct iommu_pool large_pool;
77 struct iommu_pool pools[IOMMU_NR_POOLS]; 77 struct iommu_pool pools[IOMMU_NR_POOLS];
78 unsigned long *it_map; /* A simple allocation bitmap for now */ 78 unsigned long *it_map; /* A simple allocation bitmap for now */
79#ifdef CONFIG_IOMMU_API
80 struct iommu_group *it_group;
81#endif
79}; 82};
80 83
81struct scatterlist; 84struct scatterlist;
@@ -98,6 +101,8 @@ extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
98 */ 101 */
99extern struct iommu_table *iommu_init_table(struct iommu_table * tbl, 102extern struct iommu_table *iommu_init_table(struct iommu_table * tbl,
100 int nid); 103 int nid);
104extern void iommu_register_group(struct iommu_table *tbl,
105 int pci_domain_number, unsigned long pe_num);
101 106
102extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 107extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
103 struct scatterlist *sglist, int nelems, 108 struct scatterlist *sglist, int nelems,
@@ -125,13 +130,6 @@ extern void iommu_init_early_pSeries(void);
125extern void iommu_init_early_dart(void); 130extern void iommu_init_early_dart(void);
126extern void iommu_init_early_pasemi(void); 131extern void iommu_init_early_pasemi(void);
127 132
128#ifdef CONFIG_PCI
129extern void pci_iommu_init(void);
130extern void pci_direct_iommu_init(void);
131#else
132static inline void pci_iommu_init(void) { }
133#endif
134
135extern void alloc_dart_table(void); 133extern void alloc_dart_table(void);
136#if defined(CONFIG_PPC64) && defined(CONFIG_PM) 134#if defined(CONFIG_PPC64) && defined(CONFIG_PM)
137static inline void iommu_save(void) 135static inline void iommu_save(void)
@@ -147,5 +145,26 @@ static inline void iommu_restore(void)
147} 145}
148#endif 146#endif
149 147
148/* The API to support IOMMU operations for VFIO */
149extern int iommu_tce_clear_param_check(struct iommu_table *tbl,
150 unsigned long ioba, unsigned long tce_value,
151 unsigned long npages);
152extern int iommu_tce_put_param_check(struct iommu_table *tbl,
153 unsigned long ioba, unsigned long tce);
154extern int iommu_tce_build(struct iommu_table *tbl, unsigned long entry,
155 unsigned long hwaddr, enum dma_data_direction direction);
156extern unsigned long iommu_clear_tce(struct iommu_table *tbl,
157 unsigned long entry);
158extern int iommu_clear_tces_and_put_pages(struct iommu_table *tbl,
159 unsigned long entry, unsigned long pages);
160extern int iommu_put_tce_user_mode(struct iommu_table *tbl,
161 unsigned long entry, unsigned long tce);
162
163extern void iommu_flush_tce(struct iommu_table *tbl);
164extern int iommu_take_ownership(struct iommu_table *tbl);
165extern void iommu_release_ownership(struct iommu_table *tbl);
166
167extern enum dma_data_direction iommu_tce_direction(unsigned long tce);
168
150#endif /* __KERNEL__ */ 169#endif /* __KERNEL__ */
151#endif /* _ASM_IOMMU_H */ 170#endif /* _ASM_IOMMU_H */
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index b9dd382cb349..851bac7afa4b 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -54,8 +54,16 @@
54#define BOOKE_INTERRUPT_DEBUG 15 54#define BOOKE_INTERRUPT_DEBUG 15
55 55
56/* E500 */ 56/* E500 */
57#define BOOKE_INTERRUPT_SPE_UNAVAIL 32 57#define BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL 32
58#define BOOKE_INTERRUPT_SPE_FP_DATA 33 58#define BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST 33
59/*
60 * TODO: Unify 32-bit and 64-bit kernel exception handlers to use same defines
61 */
62#define BOOKE_INTERRUPT_SPE_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
63#define BOOKE_INTERRUPT_SPE_FP_DATA BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
64#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL BOOKE_INTERRUPT_SPE_ALTIVEC_UNAVAIL
65#define BOOKE_INTERRUPT_ALTIVEC_ASSIST \
66 BOOKE_INTERRUPT_SPE_FP_DATA_ALTIVEC_ASSIST
59#define BOOKE_INTERRUPT_SPE_FP_ROUND 34 67#define BOOKE_INTERRUPT_SPE_FP_ROUND 34
60#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 68#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
61#define BOOKE_INTERRUPT_DOORBELL 36 69#define BOOKE_INTERRUPT_DOORBELL 36
@@ -67,10 +75,6 @@
67#define BOOKE_INTERRUPT_HV_SYSCALL 40 75#define BOOKE_INTERRUPT_HV_SYSCALL 40
68#define BOOKE_INTERRUPT_HV_PRIV 41 76#define BOOKE_INTERRUPT_HV_PRIV 41
69 77
70/* altivec */
71#define BOOKE_INTERRUPT_ALTIVEC_UNAVAIL 42
72#define BOOKE_INTERRUPT_ALTIVEC_ASSIST 43
73
74/* book3s */ 78/* book3s */
75 79
76#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100 80#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 349ed85c7d61..08891d07aeb6 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -107,8 +107,9 @@ struct kvmppc_vcpu_book3s {
107#define CONTEXT_GUEST 1 107#define CONTEXT_GUEST 1
108#define CONTEXT_GUEST_END 2 108#define CONTEXT_GUEST_END 2
109 109
110#define VSID_REAL 0x1fffffffffc00000ULL 110#define VSID_REAL 0x0fffffffffc00000ULL
111#define VSID_BAT 0x1fffffffffb00000ULL 111#define VSID_BAT 0x0fffffffffb00000ULL
112#define VSID_1T 0x1000000000000000ULL
112#define VSID_REAL_DR 0x2000000000000000ULL 113#define VSID_REAL_DR 0x2000000000000000ULL
113#define VSID_REAL_IR 0x4000000000000000ULL 114#define VSID_REAL_IR 0x4000000000000000ULL
114#define VSID_PR 0x8000000000000000ULL 115#define VSID_PR 0x8000000000000000ULL
@@ -123,6 +124,7 @@ extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu);
123extern void kvmppc_mmu_book3s_hv_init(struct kvm_vcpu *vcpu); 124extern void kvmppc_mmu_book3s_hv_init(struct kvm_vcpu *vcpu);
124extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); 125extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte);
125extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); 126extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr);
127extern void kvmppc_mmu_flush_segment(struct kvm_vcpu *vcpu, ulong eaddr, ulong seg_size);
126extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); 128extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu);
127extern int kvmppc_book3s_hv_page_fault(struct kvm_run *run, 129extern int kvmppc_book3s_hv_page_fault(struct kvm_run *run,
128 struct kvm_vcpu *vcpu, unsigned long addr, 130 struct kvm_vcpu *vcpu, unsigned long addr,
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h
index 9c1ff330c805..a1ecb14e4442 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64.h
@@ -159,36 +159,46 @@ static inline int hpte_cache_flags_ok(unsigned long ptel, unsigned long io_type)
159} 159}
160 160
161/* 161/*
162 * Lock and read a linux PTE. If it's present and writable, atomically 162 * If it's present and writable, atomically set dirty and referenced bits and
163 * set dirty and referenced bits and return the PTE, otherwise return 0. 163 * return the PTE, otherwise return 0. If we find a transparent hugepage
164 * and if it is marked splitting we return 0;
164 */ 165 */
165static inline pte_t kvmppc_read_update_linux_pte(pte_t *p, int writing) 166static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing,
167 unsigned int hugepage)
166{ 168{
167 pte_t pte, tmp; 169 pte_t old_pte, new_pte = __pte(0);
168 170
169 /* wait until _PAGE_BUSY is clear then set it atomically */ 171 while (1) {
170 __asm__ __volatile__ ( 172 old_pte = pte_val(*ptep);
171 "1: ldarx %0,0,%3\n" 173 /*
172 " andi. %1,%0,%4\n" 174 * wait until _PAGE_BUSY is clear then set it atomically
173 " bne- 1b\n" 175 */
174 " ori %1,%0,%4\n" 176 if (unlikely(old_pte & _PAGE_BUSY)) {
175 " stdcx. %1,0,%3\n" 177 cpu_relax();
176 " bne- 1b" 178 continue;
177 : "=&r" (pte), "=&r" (tmp), "=m" (*p) 179 }
178 : "r" (p), "i" (_PAGE_BUSY) 180#ifdef CONFIG_TRANSPARENT_HUGEPAGE
179 : "cc"); 181 /* If hugepage and is trans splitting return None */
180 182 if (unlikely(hugepage &&
181 if (pte_present(pte)) { 183 pmd_trans_splitting(pte_pmd(old_pte))))
182 pte = pte_mkyoung(pte); 184 return __pte(0);
183 if (writing && pte_write(pte)) 185#endif
184 pte = pte_mkdirty(pte); 186 /* If pte is not present return None */
185 } 187 if (unlikely(!(old_pte & _PAGE_PRESENT)))
188 return __pte(0);
186 189
187 *p = pte; /* clears _PAGE_BUSY */ 190 new_pte = pte_mkyoung(old_pte);
191 if (writing && pte_write(old_pte))
192 new_pte = pte_mkdirty(new_pte);
188 193
189 return pte; 194 if (old_pte == __cmpxchg_u64((unsigned long *)ptep, old_pte,
195 new_pte))
196 break;
197 }
198 return new_pte;
190} 199}
191 200
201
192/* Return HPTE cache control bits corresponding to Linux pte bits */ 202/* Return HPTE cache control bits corresponding to Linux pte bits */
193static inline unsigned long hpte_cache_bits(unsigned long pte_val) 203static inline unsigned long hpte_cache_bits(unsigned long pte_val)
194{ 204{
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index b1e7f2af1016..9b12f88d4adb 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -66,7 +66,8 @@ struct lppaca {
66 66
67 u8 reserved6[48]; 67 u8 reserved6[48];
68 u8 cede_latency_hint; 68 u8 cede_latency_hint;
69 u8 reserved7[7]; 69 u8 ebb_regs_in_use;
70 u8 reserved7[6];
70 u8 dtl_enable_mask; /* Dispatch Trace Log mask */ 71 u8 dtl_enable_mask; /* Dispatch Trace Log mask */
71 u8 donate_dedicated_cpu; /* Donate dedicated CPU cycles */ 72 u8 donate_dedicated_cpu; /* Donate dedicated CPU cycles */
72 u8 fpregs_in_use; 73 u8 fpregs_in_use;
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 92386fc4e82a..8b480901165a 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -36,13 +36,13 @@ struct machdep_calls {
36#ifdef CONFIG_PPC64 36#ifdef CONFIG_PPC64
37 void (*hpte_invalidate)(unsigned long slot, 37 void (*hpte_invalidate)(unsigned long slot,
38 unsigned long vpn, 38 unsigned long vpn,
39 int psize, int ssize, 39 int bpsize, int apsize,
40 int local); 40 int ssize, int local);
41 long (*hpte_updatepp)(unsigned long slot, 41 long (*hpte_updatepp)(unsigned long slot,
42 unsigned long newpp, 42 unsigned long newpp,
43 unsigned long vpn, 43 unsigned long vpn,
44 int psize, int ssize, 44 int bpsize, int apsize,
45 int local); 45 int ssize, int local);
46 void (*hpte_updateboltedpp)(unsigned long newpp, 46 void (*hpte_updateboltedpp)(unsigned long newpp,
47 unsigned long ea, 47 unsigned long ea,
48 int psize, int ssize); 48 int psize, int ssize);
@@ -57,6 +57,9 @@ 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,
61 unsigned char *hpte_slot_array,
62 unsigned long addr, int psize);
60 63
61 /* 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
62 * destroyed as well */ 65 * destroyed as well */
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index 2accc9611248..c4cf01197273 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -340,6 +340,20 @@ extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
340int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, 340int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
341 pte_t *ptep, unsigned long trap, int local, int ssize, 341 pte_t *ptep, unsigned long trap, int local, int ssize,
342 unsigned int shift, unsigned int mmu_psize); 342 unsigned int shift, unsigned int mmu_psize);
343#ifdef CONFIG_TRANSPARENT_HUGEPAGE
344extern int __hash_page_thp(unsigned long ea, unsigned long access,
345 unsigned long vsid, pmd_t *pmdp, unsigned long trap,
346 int local, int ssize, unsigned int psize);
347#else
348static inline int __hash_page_thp(unsigned long ea, unsigned long access,
349 unsigned long vsid, pmd_t *pmdp,
350 unsigned long trap, int local,
351 int ssize, unsigned int psize)
352{
353 BUG();
354 return -1;
355}
356#endif
343extern void hash_failure_debug(unsigned long ea, unsigned long access, 357extern void hash_failure_debug(unsigned long ea, unsigned long access,
344 unsigned long vsid, unsigned long trap, 358 unsigned long vsid, unsigned long trap,
345 int ssize, int psize, int lpsize, 359 int ssize, int psize, int lpsize,
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index a73668a5f30d..b467530e2485 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -38,7 +38,7 @@ extern void drop_cop(unsigned long acop, struct mm_struct *mm);
38 38
39/* 39/*
40 * switch_mm is the entry point called from the architecture independent 40 * switch_mm is the entry point called from the architecture independent
41 * code in kernel/sched.c 41 * code in kernel/sched/core.c
42 */ 42 */
43static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 43static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
44 struct task_struct *tsk) 44 struct task_struct *tsk)
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
index 885c040d6194..8ae133eaf9fa 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -68,6 +68,5 @@ struct mpc512x_lpc {
68}; 68};
69 69
70int mpc512x_cs_config(unsigned int cs, u32 val); 70int mpc512x_cs_config(unsigned int cs, u32 val);
71int __init mpc5121_clk_init(void);
72 71
73#endif /* __ASM_POWERPC_MPC5121_H__ */ 72#endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/include/asm/mpc52xx_psc.h b/arch/powerpc/include/asm/mpc52xx_psc.h
index 2966df604221..d0ece257d310 100644
--- a/arch/powerpc/include/asm/mpc52xx_psc.h
+++ b/arch/powerpc/include/asm/mpc52xx_psc.h
@@ -299,4 +299,53 @@ struct mpc512x_psc_fifo {
299#define rxdata_32 rxdata.rxdata_32 299#define rxdata_32 rxdata.rxdata_32
300}; 300};
301 301
302struct mpc5125_psc {
303 u8 mr1; /* PSC + 0x00 */
304 u8 reserved0[3];
305 u8 mr2; /* PSC + 0x04 */
306 u8 reserved1[3];
307 struct {
308 u16 status; /* PSC + 0x08 */
309 u8 reserved2[2];
310 u8 clock_select; /* PSC + 0x0c */
311 u8 reserved3[3];
312 } sr_csr;
313 u8 command; /* PSC + 0x10 */
314 u8 reserved4[3];
315 union { /* PSC + 0x14 */
316 u8 buffer_8;
317 u16 buffer_16;
318 u32 buffer_32;
319 } buffer;
320 struct {
321 u8 ipcr; /* PSC + 0x18 */
322 u8 reserved5[3];
323 u8 acr; /* PSC + 0x1c */
324 u8 reserved6[3];
325 } ipcr_acr;
326 struct {
327 u16 isr; /* PSC + 0x20 */
328 u8 reserved7[2];
329 u16 imr; /* PSC + 0x24 */
330 u8 reserved8[2];
331 } isr_imr;
332 u8 ctur; /* PSC + 0x28 */
333 u8 reserved9[3];
334 u8 ctlr; /* PSC + 0x2c */
335 u8 reserved10[3];
336 u32 ccr; /* PSC + 0x30 */
337 u32 ac97slots; /* PSC + 0x34 */
338 u32 ac97cmd; /* PSC + 0x38 */
339 u32 ac97data; /* PSC + 0x3c */
340 u8 reserved11[4];
341 u8 ip; /* PSC + 0x44 */
342 u8 reserved12[3];
343 u8 op1; /* PSC + 0x48 */
344 u8 reserved13[3];
345 u8 op0; /* PSC + 0x4c */
346 u8 reserved14[3];
347 u32 sicr; /* PSC + 0x50 */
348 u8 reserved15[4]; /* make eq. sizeof(mpc52xx_psc) */
349};
350
302#endif /* __ASM_MPC52xx_PSC_H__ */ 351#endif /* __ASM_MPC52xx_PSC_H__ */
diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h
index c0f9ef90f0b8..4a1ac9fbf186 100644
--- a/arch/powerpc/include/asm/mpic.h
+++ b/arch/powerpc/include/asm/mpic.h
@@ -339,6 +339,8 @@ struct mpic
339#endif 339#endif
340}; 340};
341 341
342extern struct bus_type mpic_subsys;
343
342/* 344/*
343 * MPIC flags (passed to mpic_alloc) 345 * MPIC flags (passed to mpic_alloc)
344 * 346 *
@@ -393,6 +395,9 @@ struct mpic
393#define MPIC_REGSET_STANDARD MPIC_REGSET(0) /* Original MPIC */ 395#define MPIC_REGSET_STANDARD MPIC_REGSET(0) /* Original MPIC */
394#define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */ 396#define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */
395 397
398/* Get the version of primary MPIC */
399extern u32 fsl_mpic_primary_get_version(void);
400
396/* Allocate the controller structure and setup the linux irq descs 401/* Allocate the controller structure and setup the linux irq descs
397 * for the range if interrupts passed in. No HW initialization is 402 * for the range if interrupts passed in. No HW initialization is
398 * actually performed. 403 * actually performed.
diff --git a/arch/powerpc/include/asm/mpic_timer.h b/arch/powerpc/include/asm/mpic_timer.h
new file mode 100644
index 000000000000..0e23cd4ac8aa
--- /dev/null
+++ b/arch/powerpc/include/asm/mpic_timer.h
@@ -0,0 +1,46 @@
1/*
2 * arch/powerpc/include/asm/mpic_timer.h
3 *
4 * Header file for Mpic Global Timer
5 *
6 * Copyright 2013 Freescale Semiconductor, Inc.
7 *
8 * Author: Wang Dongsheng <Dongsheng.Wang@freescale.com>
9 * Li Yang <leoli@freescale.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
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17#ifndef __MPIC_TIMER__
18#define __MPIC_TIMER__
19
20#include <linux/interrupt.h>
21#include <linux/time.h>
22
23struct mpic_timer {
24 void *dev;
25 struct cascade_priv *cascade_handle;
26 unsigned int num;
27 unsigned int irq;
28};
29
30#ifdef CONFIG_MPIC_TIMER
31struct mpic_timer *mpic_request_timer(irq_handler_t fn, void *dev,
32 const struct timeval *time);
33void mpic_start_timer(struct mpic_timer *handle);
34void mpic_stop_timer(struct mpic_timer *handle);
35void mpic_get_remain_time(struct mpic_timer *handle, struct timeval *time);
36void mpic_free_timer(struct mpic_timer *handle);
37#else
38struct mpic_timer *mpic_request_timer(irq_handler_t fn, void *dev,
39 const struct timeval *time) { return NULL; }
40void mpic_start_timer(struct mpic_timer *handle) { }
41void mpic_stop_timer(struct mpic_timer *handle) { }
42void mpic_get_remain_time(struct mpic_timer *handle, struct timeval *time) { }
43void mpic_free_timer(struct mpic_timer *handle) { }
44#endif
45
46#endif
diff --git a/arch/powerpc/include/asm/mutex.h b/arch/powerpc/include/asm/mutex.h
index 5399f7e18102..127ab23e1f6c 100644
--- a/arch/powerpc/include/asm/mutex.h
+++ b/arch/powerpc/include/asm/mutex.h
@@ -82,17 +82,15 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
82 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 82 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
83 * from 1 to a 0 value 83 * from 1 to a 0 value
84 * @count: pointer of type atomic_t 84 * @count: pointer of type atomic_t
85 * @fail_fn: function to call if the original value was not 1
86 * 85 *
87 * Change the count from 1 to a value lower than 1, and call <fail_fn> if 86 * Change the count from 1 to a value lower than 1. This function returns 0
88 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds, 87 * if the fastpath succeeds, or -1 otherwise.
89 * or anything the slow path function returns.
90 */ 88 */
91static inline int 89static inline int
92__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 90__mutex_fastpath_lock_retval(atomic_t *count)
93{ 91{
94 if (unlikely(__mutex_dec_return_lock(count) < 0)) 92 if (unlikely(__mutex_dec_return_lock(count) < 0))
95 return fail_fn(count); 93 return -1;
96 return 0; 94 return 0;
97} 95}
98 96
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index cbb9305ab15a..029fe85722aa 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -117,7 +117,13 @@ extern int opal_enter_rtas(struct rtas_args *args,
117#define OPAL_SET_SLOT_LED_STATUS 55 117#define OPAL_SET_SLOT_LED_STATUS 55
118#define OPAL_GET_EPOW_STATUS 56 118#define OPAL_GET_EPOW_STATUS 56
119#define OPAL_SET_SYSTEM_ATTENTION_LED 57 119#define OPAL_SET_SYSTEM_ATTENTION_LED 57
120#define OPAL_RESERVED1 58
121#define OPAL_RESERVED2 59
122#define OPAL_PCI_NEXT_ERROR 60
123#define OPAL_PCI_EEH_FREEZE_STATUS2 61
124#define OPAL_PCI_POLL 62
120#define OPAL_PCI_MSI_EOI 63 125#define OPAL_PCI_MSI_EOI 63
126#define OPAL_PCI_GET_PHB_DIAG_DATA2 64
121 127
122#ifndef __ASSEMBLY__ 128#ifndef __ASSEMBLY__
123 129
@@ -125,6 +131,7 @@ extern int opal_enter_rtas(struct rtas_args *args,
125enum OpalVendorApiTokens { 131enum OpalVendorApiTokens {
126 OPAL_START_VENDOR_API_RANGE = 1000, OPAL_END_VENDOR_API_RANGE = 1999 132 OPAL_START_VENDOR_API_RANGE = 1000, OPAL_END_VENDOR_API_RANGE = 1999
127}; 133};
134
128enum OpalFreezeState { 135enum OpalFreezeState {
129 OPAL_EEH_STOPPED_NOT_FROZEN = 0, 136 OPAL_EEH_STOPPED_NOT_FROZEN = 0,
130 OPAL_EEH_STOPPED_MMIO_FREEZE = 1, 137 OPAL_EEH_STOPPED_MMIO_FREEZE = 1,
@@ -134,55 +141,69 @@ enum OpalFreezeState {
134 OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5, 141 OPAL_EEH_STOPPED_TEMP_UNAVAIL = 5,
135 OPAL_EEH_STOPPED_PERM_UNAVAIL = 6 142 OPAL_EEH_STOPPED_PERM_UNAVAIL = 6
136}; 143};
144
137enum OpalEehFreezeActionToken { 145enum OpalEehFreezeActionToken {
138 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1, 146 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO = 1,
139 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2, 147 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA = 2,
140 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3 148 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL = 3
141}; 149};
150
142enum OpalPciStatusToken { 151enum OpalPciStatusToken {
143 OPAL_EEH_PHB_NO_ERROR = 0, 152 OPAL_EEH_NO_ERROR = 0,
144 OPAL_EEH_PHB_FATAL = 1, 153 OPAL_EEH_IOC_ERROR = 1,
145 OPAL_EEH_PHB_RECOVERABLE = 2, 154 OPAL_EEH_PHB_ERROR = 2,
146 OPAL_EEH_PHB_BUS_ERROR = 3, 155 OPAL_EEH_PE_ERROR = 3,
147 OPAL_EEH_PCI_NO_DEVSEL = 4, 156 OPAL_EEH_PE_MMIO_ERROR = 4,
148 OPAL_EEH_PCI_TA = 5, 157 OPAL_EEH_PE_DMA_ERROR = 5
149 OPAL_EEH_PCIEX_UR = 6,
150 OPAL_EEH_PCIEX_CA = 7,
151 OPAL_EEH_PCI_MMIO_ERROR = 8,
152 OPAL_EEH_PCI_DMA_ERROR = 9
153}; 158};
159
160enum OpalPciErrorSeverity {
161 OPAL_EEH_SEV_NO_ERROR = 0,
162 OPAL_EEH_SEV_IOC_DEAD = 1,
163 OPAL_EEH_SEV_PHB_DEAD = 2,
164 OPAL_EEH_SEV_PHB_FENCED = 3,
165 OPAL_EEH_SEV_PE_ER = 4,
166 OPAL_EEH_SEV_INF = 5
167};
168
154enum OpalShpcAction { 169enum OpalShpcAction {
155 OPAL_SHPC_GET_LINK_STATE = 0, 170 OPAL_SHPC_GET_LINK_STATE = 0,
156 OPAL_SHPC_GET_SLOT_STATE = 1 171 OPAL_SHPC_GET_SLOT_STATE = 1
157}; 172};
173
158enum OpalShpcLinkState { 174enum OpalShpcLinkState {
159 OPAL_SHPC_LINK_DOWN = 0, 175 OPAL_SHPC_LINK_DOWN = 0,
160 OPAL_SHPC_LINK_UP = 1 176 OPAL_SHPC_LINK_UP = 1
161}; 177};
178
162enum OpalMmioWindowType { 179enum OpalMmioWindowType {
163 OPAL_M32_WINDOW_TYPE = 1, 180 OPAL_M32_WINDOW_TYPE = 1,
164 OPAL_M64_WINDOW_TYPE = 2, 181 OPAL_M64_WINDOW_TYPE = 2,
165 OPAL_IO_WINDOW_TYPE = 3 182 OPAL_IO_WINDOW_TYPE = 3
166}; 183};
184
167enum OpalShpcSlotState { 185enum OpalShpcSlotState {
168 OPAL_SHPC_DEV_NOT_PRESENT = 0, 186 OPAL_SHPC_DEV_NOT_PRESENT = 0,
169 OPAL_SHPC_DEV_PRESENT = 1 187 OPAL_SHPC_DEV_PRESENT = 1
170}; 188};
189
171enum OpalExceptionHandler { 190enum OpalExceptionHandler {
172 OPAL_MACHINE_CHECK_HANDLER = 1, 191 OPAL_MACHINE_CHECK_HANDLER = 1,
173 OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2, 192 OPAL_HYPERVISOR_MAINTENANCE_HANDLER = 2,
174 OPAL_SOFTPATCH_HANDLER = 3 193 OPAL_SOFTPATCH_HANDLER = 3
175}; 194};
195
176enum OpalPendingState { 196enum OpalPendingState {
177 OPAL_EVENT_OPAL_INTERNAL = 0x1, 197 OPAL_EVENT_OPAL_INTERNAL = 0x1,
178 OPAL_EVENT_NVRAM = 0x2, 198 OPAL_EVENT_NVRAM = 0x2,
179 OPAL_EVENT_RTC = 0x4, 199 OPAL_EVENT_RTC = 0x4,
180 OPAL_EVENT_CONSOLE_OUTPUT = 0x8, 200 OPAL_EVENT_CONSOLE_OUTPUT = 0x8,
181 OPAL_EVENT_CONSOLE_INPUT = 0x10, 201 OPAL_EVENT_CONSOLE_INPUT = 0x10,
182 OPAL_EVENT_ERROR_LOG_AVAIL = 0x20, 202 OPAL_EVENT_ERROR_LOG_AVAIL = 0x20,
183 OPAL_EVENT_ERROR_LOG = 0x40, 203 OPAL_EVENT_ERROR_LOG = 0x40,
184 OPAL_EVENT_EPOW = 0x80, 204 OPAL_EVENT_EPOW = 0x80,
185 OPAL_EVENT_LED_STATUS = 0x100 205 OPAL_EVENT_LED_STATUS = 0x100,
206 OPAL_EVENT_PCI_ERROR = 0x200
186}; 207};
187 208
188/* Machine check related definitions */ 209/* Machine check related definitions */
@@ -364,15 +385,80 @@ struct opal_machine_check_event {
364 } u; 385 } u;
365}; 386};
366 387
388enum {
389 OPAL_P7IOC_DIAG_TYPE_NONE = 0,
390 OPAL_P7IOC_DIAG_TYPE_RGC = 1,
391 OPAL_P7IOC_DIAG_TYPE_BI = 2,
392 OPAL_P7IOC_DIAG_TYPE_CI = 3,
393 OPAL_P7IOC_DIAG_TYPE_MISC = 4,
394 OPAL_P7IOC_DIAG_TYPE_I2C = 5,
395 OPAL_P7IOC_DIAG_TYPE_LAST = 6
396};
397
398struct OpalIoP7IOCErrorData {
399 uint16_t type;
400
401 /* GEM */
402 uint64_t gemXfir;
403 uint64_t gemRfir;
404 uint64_t gemRirqfir;
405 uint64_t gemMask;
406 uint64_t gemRwof;
407
408 /* LEM */
409 uint64_t lemFir;
410 uint64_t lemErrMask;
411 uint64_t lemAction0;
412 uint64_t lemAction1;
413 uint64_t lemWof;
414
415 union {
416 struct OpalIoP7IOCRgcErrorData {
417 uint64_t rgcStatus; /* 3E1C10 */
418 uint64_t rgcLdcp; /* 3E1C18 */
419 }rgc;
420 struct OpalIoP7IOCBiErrorData {
421 uint64_t biLdcp0; /* 3C0100, 3C0118 */
422 uint64_t biLdcp1; /* 3C0108, 3C0120 */
423 uint64_t biLdcp2; /* 3C0110, 3C0128 */
424 uint64_t biFenceStatus; /* 3C0130, 3C0130 */
425
426 uint8_t biDownbound; /* BI Downbound or Upbound */
427 }bi;
428 struct OpalIoP7IOCCiErrorData {
429 uint64_t ciPortStatus; /* 3Dn008 */
430 uint64_t ciPortLdcp; /* 3Dn010 */
431
432 uint8_t ciPort; /* Index of CI port: 0/1 */
433 }ci;
434 };
435};
436
367/** 437/**
368 * This structure defines the overlay which will be used to store PHB error 438 * This structure defines the overlay which will be used to store PHB error
369 * data upon request. 439 * data upon request.
370 */ 440 */
371enum { 441enum {
442 OPAL_PHB_ERROR_DATA_VERSION_1 = 1,
443};
444
445enum {
446 OPAL_PHB_ERROR_DATA_TYPE_P7IOC = 1,
447};
448
449enum {
372 OPAL_P7IOC_NUM_PEST_REGS = 128, 450 OPAL_P7IOC_NUM_PEST_REGS = 128,
373}; 451};
374 452
453struct OpalIoPhbErrorCommon {
454 uint32_t version;
455 uint32_t ioType;
456 uint32_t len;
457};
458
375struct OpalIoP7IOCPhbErrorData { 459struct OpalIoP7IOCPhbErrorData {
460 struct OpalIoPhbErrorCommon common;
461
376 uint32_t brdgCtl; 462 uint32_t brdgCtl;
377 463
378 // P7IOC utl regs 464 // P7IOC utl regs
@@ -530,14 +616,21 @@ int64_t opal_pci_map_pe_dma_window_real(uint64_t phb_id, uint16_t pe_number,
530 uint64_t pci_mem_size); 616 uint64_t pci_mem_size);
531int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state); 617int64_t opal_pci_reset(uint64_t phb_id, uint8_t reset_scope, uint8_t assert_state);
532 618
533int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer, uint64_t diag_buffer_len); 619int64_t opal_pci_get_hub_diag_data(uint64_t hub_id, void *diag_buffer,
534int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer, uint64_t diag_buffer_len); 620 uint64_t diag_buffer_len);
621int64_t opal_pci_get_phb_diag_data(uint64_t phb_id, void *diag_buffer,
622 uint64_t diag_buffer_len);
623int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer,
624 uint64_t diag_buffer_len);
535int64_t opal_pci_fence_phb(uint64_t phb_id); 625int64_t opal_pci_fence_phb(uint64_t phb_id);
536int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope); 626int64_t opal_pci_reinit(uint64_t phb_id, uint8_t reinit_scope);
537int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 627int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
538int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 628int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
539int64_t opal_get_epow_status(uint64_t *status); 629int64_t opal_get_epow_status(uint64_t *status);
540int64_t opal_set_system_attention_led(uint8_t led_action); 630int64_t opal_set_system_attention_led(uint8_t led_action);
631int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
632 uint16_t *pci_error_type, uint16_t *severity);
633int64_t opal_pci_poll(uint64_t phb_id);
541 634
542/* Internal functions */ 635/* Internal functions */
543extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data); 636extern int early_init_dt_scan_opal(unsigned long node, const char *uname, int depth, void *data);
@@ -551,6 +644,11 @@ extern void hvc_opal_init_early(void);
551extern int early_init_dt_scan_opal(unsigned long node, const char *uname, 644extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
552 int depth, void *data); 645 int depth, void *data);
553 646
647extern int opal_notifier_register(struct notifier_block *nb);
648extern void opal_notifier_enable(void);
649extern void opal_notifier_disable(void);
650extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val);
651
554extern int opal_get_chars(uint32_t vtermno, char *buf, int count); 652extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
555extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len); 653extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);
556 654
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index f265049dd7d6..2dd7bfc459be 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -60,6 +60,7 @@ struct power_pmu {
60#define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */ 60#define PPMU_HAS_SSLOT 0x00000020 /* Has sampled slot in MMCRA */
61#define PPMU_HAS_SIER 0x00000040 /* Has SIER */ 61#define PPMU_HAS_SIER 0x00000040 /* Has SIER */
62#define PPMU_BHRB 0x00000080 /* has BHRB feature enabled */ 62#define PPMU_BHRB 0x00000080 /* has BHRB feature enabled */
63#define PPMU_EBB 0x00000100 /* supports event based branch */
63 64
64/* 65/*
65 * Values for flags to get_alternatives() 66 * Values for flags to get_alternatives()
@@ -68,6 +69,11 @@ struct power_pmu {
68#define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */ 69#define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */
69#define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */ 70#define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */
70 71
72/*
73 * We use the event config bit 63 as a flag to request EBB.
74 */
75#define EVENT_CONFIG_EBB_SHIFT 63
76
71extern int register_power_pmu(struct power_pmu *); 77extern int register_power_pmu(struct power_pmu *);
72 78
73struct pt_regs; 79struct pt_regs;
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index b66ae722a8e9..f65e27b09bd3 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -221,17 +221,17 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
221 221
222static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 222static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
223{ 223{
224 return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE), 224 return kmem_cache_alloc(PGT_CACHE(PMD_CACHE_INDEX),
225 GFP_KERNEL|__GFP_REPEAT); 225 GFP_KERNEL|__GFP_REPEAT);
226} 226}
227 227
228static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 228static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
229{ 229{
230 kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd); 230 kmem_cache_free(PGT_CACHE(PMD_CACHE_INDEX), pmd);
231} 231}
232 232
233#define __pmd_free_tlb(tlb, pmd, addr) \ 233#define __pmd_free_tlb(tlb, pmd, addr) \
234 pgtable_free_tlb(tlb, pmd, PMD_INDEX_SIZE) 234 pgtable_free_tlb(tlb, pmd, PMD_CACHE_INDEX)
235#ifndef CONFIG_PPC_64K_PAGES 235#ifndef CONFIG_PPC_64K_PAGES
236#define __pud_free_tlb(tlb, pud, addr) \ 236#define __pud_free_tlb(tlb, pud, addr) \
237 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE) 237 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
diff --git a/arch/powerpc/include/asm/pgtable-ppc64-64k.h b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
index 45142d640720..a56b82fb0609 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64-64k.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64-64k.h
@@ -33,7 +33,8 @@
33#define PGDIR_MASK (~(PGDIR_SIZE-1)) 33#define PGDIR_MASK (~(PGDIR_SIZE-1))
34 34
35/* Bits to mask out from a PMD to get to the PTE page */ 35/* Bits to mask out from a PMD to get to the PTE page */
36#define PMD_MASKED_BITS 0x1ff 36/* PMDs point to PTE table fragments which are 4K aligned. */
37#define PMD_MASKED_BITS 0xfff
37/* Bits to mask out from a PGD/PUD to get to the PMD page */ 38/* Bits to mask out from a PGD/PUD to get to the PMD page */
38#define PUD_MASKED_BITS 0x1ff 39#define PUD_MASKED_BITS 0x1ff
39 40
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index e3d55f6f24fe..46db09414a10 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -10,6 +10,7 @@
10#else 10#else
11#include <asm/pgtable-ppc64-4k.h> 11#include <asm/pgtable-ppc64-4k.h>
12#endif 12#endif
13#include <asm/barrier.h>
13 14
14#define FIRST_USER_ADDRESS 0 15#define FIRST_USER_ADDRESS 0
15 16
@@ -20,7 +21,11 @@
20 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) 21 PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT)
21#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) 22#define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE)
22 23
23 24#ifdef CONFIG_TRANSPARENT_HUGEPAGE
25#define PMD_CACHE_INDEX (PMD_INDEX_SIZE + 1)
26#else
27#define PMD_CACHE_INDEX PMD_INDEX_SIZE
28#endif
24/* 29/*
25 * Define the address range of the kernel non-linear virtual area 30 * Define the address range of the kernel non-linear virtual area
26 */ 31 */
@@ -150,7 +155,7 @@
150#define pmd_present(pmd) (pmd_val(pmd) != 0) 155#define pmd_present(pmd) (pmd_val(pmd) != 0)
151#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) 156#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
152#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) 157#define pmd_page_vaddr(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
153#define pmd_page(pmd) virt_to_page(pmd_page_vaddr(pmd)) 158extern struct page *pmd_page(pmd_t pmd);
154 159
155#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) 160#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval))
156#define pud_none(pud) (!pud_val(pud)) 161#define pud_none(pud) (!pud_val(pud))
@@ -339,43 +344,217 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
339 344
340void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); 345void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
341void pgtable_cache_init(void); 346void pgtable_cache_init(void);
347#endif /* __ASSEMBLY__ */
348
349/*
350 * THP pages can't be special. So use the _PAGE_SPECIAL
351 */
352#define _PAGE_SPLITTING _PAGE_SPECIAL
353
354/*
355 * We need to differentiate between explicit huge page and THP huge
356 * page, since THP huge page also need to track real subpage details
357 */
358#define _PAGE_THP_HUGE _PAGE_4K_PFN
342 359
343/* 360/*
344 * find_linux_pte returns the address of a linux pte for a given 361 * set of bits not changed in pmd_modify.
345 * effective address and directory. If not found, it returns zero.
346 */ 362 */
347static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea) 363#define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | \
364 _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_SPLITTING | \
365 _PAGE_THP_HUGE)
366
367#ifndef __ASSEMBLY__
368/*
369 * The linux hugepage PMD now include the pmd entries followed by the address
370 * to the stashed pgtable_t. The stashed pgtable_t contains the hpte bits.
371 * [ 1 bit secondary | 3 bit hidx | 1 bit valid | 000]. We use one byte per
372 * each HPTE entry. With 16MB hugepage and 64K HPTE we need 256 entries and
373 * with 4K HPTE we need 4096 entries. Both will fit in a 4K pgtable_t.
374 *
375 * The last three bits are intentionally left to zero. This memory location
376 * are also used as normal page PTE pointers. So if we have any pointers
377 * left around while we collapse a hugepage, we need to make sure
378 * _PAGE_PRESENT and _PAGE_FILE bits of that are zero when we look at them
379 */
380static inline unsigned int hpte_valid(unsigned char *hpte_slot_array, int index)
348{ 381{
349 pgd_t *pg; 382 return (hpte_slot_array[index] >> 3) & 0x1;
350 pud_t *pu;
351 pmd_t *pm;
352 pte_t *pt = NULL;
353
354 pg = pgdir + pgd_index(ea);
355 if (!pgd_none(*pg)) {
356 pu = pud_offset(pg, ea);
357 if (!pud_none(*pu)) {
358 pm = pmd_offset(pu, ea);
359 if (pmd_present(*pm))
360 pt = pte_offset_kernel(pm, ea);
361 }
362 }
363 return pt;
364} 383}
365 384
366#ifdef CONFIG_HUGETLB_PAGE 385static inline unsigned int hpte_hash_index(unsigned char *hpte_slot_array,
367pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, 386 int index)
368 unsigned *shift);
369#else
370static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
371 unsigned *shift)
372{ 387{
373 if (shift) 388 return hpte_slot_array[index] >> 4;
374 *shift = 0;
375 return find_linux_pte(pgdir, ea);
376} 389}
377#endif /* !CONFIG_HUGETLB_PAGE */
378 390
379#endif /* __ASSEMBLY__ */ 391static inline void mark_hpte_slot_valid(unsigned char *hpte_slot_array,
392 unsigned int index, unsigned int hidx)
393{
394 hpte_slot_array[index] = hidx << 4 | 0x1 << 3;
395}
380 396
397static inline char *get_hpte_slot_array(pmd_t *pmdp)
398{
399 /*
400 * The hpte hindex is stored in the pgtable whose address is in the
401 * second half of the PMD
402 *
403 * Order this load with the test for pmd_trans_huge in the caller
404 */
405 smp_rmb();
406 return *(char **)(pmdp + PTRS_PER_PMD);
407
408
409}
410
411extern void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
412 pmd_t *pmdp);
413#ifdef CONFIG_TRANSPARENT_HUGEPAGE
414extern pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot);
415extern pmd_t mk_pmd(struct page *page, pgprot_t pgprot);
416extern pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot);
417extern void set_pmd_at(struct mm_struct *mm, unsigned long addr,
418 pmd_t *pmdp, pmd_t pmd);
419extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
420 pmd_t *pmd);
421
422static inline int pmd_trans_huge(pmd_t pmd)
423{
424 /*
425 * leaf pte for huge page, bottom two bits != 00
426 */
427 return (pmd_val(pmd) & 0x3) && (pmd_val(pmd) & _PAGE_THP_HUGE);
428}
429
430static inline int pmd_large(pmd_t pmd)
431{
432 /*
433 * leaf pte for huge page, bottom two bits != 00
434 */
435 if (pmd_trans_huge(pmd))
436 return pmd_val(pmd) & _PAGE_PRESENT;
437 return 0;
438}
439
440static inline int pmd_trans_splitting(pmd_t pmd)
441{
442 if (pmd_trans_huge(pmd))
443 return pmd_val(pmd) & _PAGE_SPLITTING;
444 return 0;
445}
446
447extern int has_transparent_hugepage(void);
448#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
449
450static inline pte_t pmd_pte(pmd_t pmd)
451{
452 return __pte(pmd_val(pmd));
453}
454
455static inline pmd_t pte_pmd(pte_t pte)
456{
457 return __pmd(pte_val(pte));
458}
459
460static inline pte_t *pmdp_ptep(pmd_t *pmd)
461{
462 return (pte_t *)pmd;
463}
464
465#define pmd_pfn(pmd) pte_pfn(pmd_pte(pmd))
466#define pmd_young(pmd) pte_young(pmd_pte(pmd))
467#define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd)))
468#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
469#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
470#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
471#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
472
473#define __HAVE_ARCH_PMD_WRITE
474#define pmd_write(pmd) pte_write(pmd_pte(pmd))
475
476static inline pmd_t pmd_mkhuge(pmd_t pmd)
477{
478 /* Do nothing, mk_pmd() does this part. */
479 return pmd;
480}
481
482static inline pmd_t pmd_mknotpresent(pmd_t pmd)
483{
484 pmd_val(pmd) &= ~_PAGE_PRESENT;
485 return pmd;
486}
487
488static inline pmd_t pmd_mksplitting(pmd_t pmd)
489{
490 pmd_val(pmd) |= _PAGE_SPLITTING;
491 return pmd;
492}
493
494#define __HAVE_ARCH_PMD_SAME
495static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
496{
497 return (((pmd_val(pmd_a) ^ pmd_val(pmd_b)) & ~_PAGE_HPTEFLAGS) == 0);
498}
499
500#define __HAVE_ARCH_PMDP_SET_ACCESS_FLAGS
501extern int pmdp_set_access_flags(struct vm_area_struct *vma,
502 unsigned long address, pmd_t *pmdp,
503 pmd_t entry, int dirty);
504
505extern unsigned long pmd_hugepage_update(struct mm_struct *mm,
506 unsigned long addr,
507 pmd_t *pmdp, unsigned long clr);
508
509static inline int __pmdp_test_and_clear_young(struct mm_struct *mm,
510 unsigned long addr, pmd_t *pmdp)
511{
512 unsigned long old;
513
514 if ((pmd_val(*pmdp) & (_PAGE_ACCESSED | _PAGE_HASHPTE)) == 0)
515 return 0;
516 old = pmd_hugepage_update(mm, addr, pmdp, _PAGE_ACCESSED);
517 return ((old & _PAGE_ACCESSED) != 0);
518}
519
520#define __HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG
521extern int pmdp_test_and_clear_young(struct vm_area_struct *vma,
522 unsigned long address, pmd_t *pmdp);
523#define __HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH
524extern int pmdp_clear_flush_young(struct vm_area_struct *vma,
525 unsigned long address, pmd_t *pmdp);
526
527#define __HAVE_ARCH_PMDP_GET_AND_CLEAR
528extern pmd_t pmdp_get_and_clear(struct mm_struct *mm,
529 unsigned long addr, pmd_t *pmdp);
530
531#define __HAVE_ARCH_PMDP_CLEAR_FLUSH
532extern pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
533 pmd_t *pmdp);
534
535#define __HAVE_ARCH_PMDP_SET_WRPROTECT
536static inline void pmdp_set_wrprotect(struct mm_struct *mm, unsigned long addr,
537 pmd_t *pmdp)
538{
539
540 if ((pmd_val(*pmdp) & _PAGE_RW) == 0)
541 return;
542
543 pmd_hugepage_update(mm, addr, pmdp, _PAGE_RW);
544}
545
546#define __HAVE_ARCH_PMDP_SPLITTING_FLUSH
547extern void pmdp_splitting_flush(struct vm_area_struct *vma,
548 unsigned long address, pmd_t *pmdp);
549
550#define __HAVE_ARCH_PGTABLE_DEPOSIT
551extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
552 pgtable_t pgtable);
553#define __HAVE_ARCH_PGTABLE_WITHDRAW
554extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
555
556#define __HAVE_ARCH_PMDP_INVALIDATE
557extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
558 pmd_t *pmdp);
559#endif /* __ASSEMBLY__ */
381#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ 560#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 7aeb9555f6ea..7d6eacf249cf 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -198,9 +198,6 @@ extern void paging_init(void);
198 */ 198 */
199#define kern_addr_valid(addr) (1) 199#define kern_addr_valid(addr) (1)
200 200
201#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
202 remap_pfn_range(vma, vaddr, pfn, size, prot)
203
204#include <asm-generic/pgtable.h> 201#include <asm-generic/pgtable.h>
205 202
206 203
@@ -220,6 +217,12 @@ extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
220 217
221extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, 218extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
222 unsigned long end, int write, struct page **pages, int *nr); 219 unsigned long end, int write, struct page **pages, int *nr);
220#ifndef CONFIG_TRANSPARENT_HUGEPAGE
221#define pmd_large(pmd) 0
222#define has_transparent_hugepage() 0
223#endif
224pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
225 unsigned *shift);
223#endif /* __ASSEMBLY__ */ 226#endif /* __ASSEMBLY__ */
224 227
225#endif /* __KERNEL__ */ 228#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/probes.h b/arch/powerpc/include/asm/probes.h
index 5f1e15b68704..3421637cfd7b 100644
--- a/arch/powerpc/include/asm/probes.h
+++ b/arch/powerpc/include/asm/probes.h
@@ -38,5 +38,30 @@ typedef u32 ppc_opcode_t;
38#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) 38#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
39#endif /* CONFIG_PPC64 */ 39#endif /* CONFIG_PPC64 */
40 40
41#ifdef CONFIG_PPC_ADV_DEBUG_REGS
42#define MSR_SINGLESTEP (MSR_DE)
43#else
44#define MSR_SINGLESTEP (MSR_SE)
45#endif
46
47/* Enable single stepping for the current task */
48static inline void enable_single_step(struct pt_regs *regs)
49{
50 regs->msr |= MSR_SINGLESTEP;
51#ifdef CONFIG_PPC_ADV_DEBUG_REGS
52 /*
53 * We turn off Critical Input Exception(CE) to ensure that the single
54 * step will be for the instruction we have the probe on; if we don't,
55 * it is possible we'd get the single step reported for CE.
56 */
57 regs->msr &= ~MSR_CE;
58 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
59#ifdef CONFIG_PPC_47x
60 isync();
61#endif
62#endif
63}
64
65
41#endif /* __KERNEL__ */ 66#endif /* __KERNEL__ */
42#endif /* _ASM_POWERPC_PROBES_H */ 67#endif /* _ASM_POWERPC_PROBES_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 14a658363698..47a35b08b963 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -168,10 +168,10 @@ struct thread_struct {
168 * The following help to manage the use of Debug Control Registers 168 * The following help to manage the use of Debug Control Registers
169 * om the BookE platforms. 169 * om the BookE platforms.
170 */ 170 */
171 unsigned long dbcr0; 171 uint32_t dbcr0;
172 unsigned long dbcr1; 172 uint32_t dbcr1;
173#ifdef CONFIG_BOOKE 173#ifdef CONFIG_BOOKE
174 unsigned long dbcr2; 174 uint32_t dbcr2;
175#endif 175#endif
176 /* 176 /*
177 * The stored value of the DBSR register will be the value at the 177 * The stored value of the DBSR register will be the value at the
@@ -179,7 +179,7 @@ struct thread_struct {
179 * user (will never be written to) and has value while helping to 179 * user (will never be written to) and has value while helping to
180 * describe the reason for the last debug trap. Torez 180 * describe the reason for the last debug trap. Torez
181 */ 181 */
182 unsigned long dbsr; 182 uint32_t dbsr;
183 /* 183 /*
184 * The following will contain addresses used by debug applications 184 * The following will contain addresses used by debug applications
185 * to help trace and trap on particular address locations. 185 * to help trace and trap on particular address locations.
@@ -200,7 +200,7 @@ struct thread_struct {
200#endif 200#endif
201#endif 201#endif
202 /* FP and VSX 0-31 register set */ 202 /* FP and VSX 0-31 register set */
203 double fpr[32][TS_FPRWIDTH]; 203 double fpr[32][TS_FPRWIDTH] __attribute__((aligned(16)));
204 struct { 204 struct {
205 205
206 unsigned int pad; 206 unsigned int pad;
@@ -287,9 +287,9 @@ struct thread_struct {
287 unsigned long siar; 287 unsigned long siar;
288 unsigned long sdar; 288 unsigned long sdar;
289 unsigned long sier; 289 unsigned long sier;
290 unsigned long mmcr0;
291 unsigned long mmcr2; 290 unsigned long mmcr2;
292 unsigned long mmcra; 291 unsigned mmcr0;
292 unsigned used_ebb;
293#endif 293#endif
294}; 294};
295 295
@@ -404,9 +404,7 @@ static inline void prefetchw(const void *x)
404 404
405#define spin_lock_prefetch(x) prefetchw(x) 405#define spin_lock_prefetch(x) prefetchw(x)
406 406
407#ifdef CONFIG_PPC64
408#define HAVE_ARCH_PICK_MMAP_LAYOUT 407#define HAVE_ARCH_PICK_MMAP_LAYOUT
409#endif
410 408
411#ifdef CONFIG_PPC64 409#ifdef CONFIG_PPC64
412static inline unsigned long get_clean_sp(unsigned long sp, int is_32) 410static inline unsigned long get_clean_sp(unsigned long sp, int is_32)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 4a9e408644fe..5d7d9c2a5473 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -621,11 +621,15 @@
621#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */ 621#define MMCR0_PMXE 0x04000000UL /* performance monitor exception enable */
622#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */ 622#define MMCR0_FCECE 0x02000000UL /* freeze ctrs on enabled cond or event */
623#define MMCR0_TBEE 0x00400000UL /* time base exception enable */ 623#define MMCR0_TBEE 0x00400000UL /* time base exception enable */
624#define MMCR0_EBE 0x00100000UL /* Event based branch enable */
625#define MMCR0_PMCC 0x000c0000UL /* PMC control */
626#define MMCR0_PMCC_U6 0x00080000UL /* PMC1-6 are R/W by user (PR) */
624#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/ 627#define MMCR0_PMC1CE 0x00008000UL /* PMC1 count enable*/
625#define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/ 628#define MMCR0_PMCjCE 0x00004000UL /* PMCj count enable*/
626#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */ 629#define MMCR0_TRIGGER 0x00002000UL /* TRIGGER enable */
627#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */ 630#define MMCR0_PMAO 0x00000080UL /* performance monitor alert has occurred, set to 0 after handling exception */
628#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */ 631#define MMCR0_SHRFC 0x00000040UL /* SHRre freeze conditions between threads */
632#define MMCR0_FC56 0x00000010UL /* freeze counters 5 and 6 */
629#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */ 633#define MMCR0_FCTI 0x00000008UL /* freeze counters in tags inactive mode */
630#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */ 634#define MMCR0_FCTA 0x00000004UL /* freeze counters in tags active mode */
631#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */ 635#define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */
@@ -673,6 +677,11 @@
673#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */ 677#define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */
674#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */ 678#define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */
675 679
680/* When EBB is enabled, some of MMCR0/MMCR2/SIER are user accessible */
681#define MMCR0_USER_MASK (MMCR0_FC | MMCR0_PMXE | MMCR0_PMAO)
682#define MMCR2_USER_MASK 0x4020100804020000UL /* (FC1P|FC2P|FC3P|FC4P|FC5P|FC6P) */
683#define SIER_USER_MASK 0x7fffffUL
684
676#define SPRN_PA6T_MMCR0 795 685#define SPRN_PA6T_MMCR0 795
677#define PA6T_MMCR0_EN0 0x0000000000000001UL 686#define PA6T_MMCR0_EN0 0x0000000000000001UL
678#define PA6T_MMCR0_EN1 0x0000000000000002UL 687#define PA6T_MMCR0_EN1 0x0000000000000002UL
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 34fd70488d83..c7a8bfc9f6f5 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -350,8 +350,8 @@ static inline u32 rtas_config_addr(int busno, int devfn, int reg)
350 (devfn << 8) | (reg & 0xff); 350 (devfn << 8) | (reg & 0xff);
351} 351}
352 352
353extern void __cpuinit rtas_give_timebase(void); 353extern void rtas_give_timebase(void);
354extern void __cpuinit rtas_take_timebase(void); 354extern void rtas_take_timebase(void);
355 355
356#ifdef CONFIG_PPC_RTAS 356#ifdef CONFIG_PPC_RTAS
357static inline int page_is_rtas_user_buf(unsigned long pfn) 357static inline int page_is_rtas_user_buf(unsigned long pfn)
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 200d763a0a67..49a13e0ef234 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -67,4 +67,18 @@ static inline void flush_spe_to_thread(struct task_struct *t)
67} 67}
68#endif 68#endif
69 69
70static inline void clear_task_ebb(struct task_struct *t)
71{
72#ifdef CONFIG_PPC_BOOK3S_64
73 /* EBB perf events are not inherited, so clear all EBB state. */
74 t->thread.bescr = 0;
75 t->thread.mmcr2 = 0;
76 t->thread.mmcr0 = 0;
77 t->thread.siar = 0;
78 t->thread.sdar = 0;
79 t->thread.sier = 0;
80 t->thread.used_ebb = 0;
81#endif
82}
83
70#endif /* _ASM_POWERPC_SWITCH_TO_H */ 84#endif /* _ASM_POWERPC_SWITCH_TO_H */
diff --git a/arch/powerpc/include/asm/tlbflush.h b/arch/powerpc/include/asm/tlbflush.h
index 61a59271665b..2def01ed0cb2 100644
--- a/arch/powerpc/include/asm/tlbflush.h
+++ b/arch/powerpc/include/asm/tlbflush.h
@@ -165,7 +165,8 @@ static inline void flush_tlb_kernel_range(unsigned long start,
165/* Private function for use by PCI IO mapping code */ 165/* Private function for use by PCI IO mapping code */
166extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, 166extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
167 unsigned long end); 167 unsigned long end);
168 168extern void flush_tlb_pmd_range(struct mm_struct *mm, pmd_t *pmd,
169 unsigned long addr);
169#else 170#else
170#error Unsupported MMU type 171#error Unsupported MMU type
171#endif 172#endif
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 4db49590acf5..9485b43a7c00 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -178,7 +178,7 @@ do { \
178 long __pu_err; \ 178 long __pu_err; \
179 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ 179 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
180 if (!is_kernel_addr((unsigned long)__pu_addr)) \ 180 if (!is_kernel_addr((unsigned long)__pu_addr)) \
181 might_sleep(); \ 181 might_fault(); \
182 __chk_user_ptr(ptr); \ 182 __chk_user_ptr(ptr); \
183 __put_user_size((x), __pu_addr, (size), __pu_err); \ 183 __put_user_size((x), __pu_addr, (size), __pu_err); \
184 __pu_err; \ 184 __pu_err; \
@@ -188,7 +188,7 @@ do { \
188({ \ 188({ \
189 long __pu_err = -EFAULT; \ 189 long __pu_err = -EFAULT; \
190 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ 190 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
191 might_sleep(); \ 191 might_fault(); \
192 if (access_ok(VERIFY_WRITE, __pu_addr, size)) \ 192 if (access_ok(VERIFY_WRITE, __pu_addr, size)) \
193 __put_user_size((x), __pu_addr, (size), __pu_err); \ 193 __put_user_size((x), __pu_addr, (size), __pu_err); \
194 __pu_err; \ 194 __pu_err; \
@@ -268,7 +268,7 @@ do { \
268 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ 268 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
269 __chk_user_ptr(ptr); \ 269 __chk_user_ptr(ptr); \
270 if (!is_kernel_addr((unsigned long)__gu_addr)) \ 270 if (!is_kernel_addr((unsigned long)__gu_addr)) \
271 might_sleep(); \ 271 might_fault(); \
272 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ 272 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
273 (x) = (__typeof__(*(ptr)))__gu_val; \ 273 (x) = (__typeof__(*(ptr)))__gu_val; \
274 __gu_err; \ 274 __gu_err; \
@@ -282,7 +282,7 @@ do { \
282 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ 282 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
283 __chk_user_ptr(ptr); \ 283 __chk_user_ptr(ptr); \
284 if (!is_kernel_addr((unsigned long)__gu_addr)) \ 284 if (!is_kernel_addr((unsigned long)__gu_addr)) \
285 might_sleep(); \ 285 might_fault(); \
286 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ 286 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
287 (x) = (__typeof__(*(ptr)))__gu_val; \ 287 (x) = (__typeof__(*(ptr)))__gu_val; \
288 __gu_err; \ 288 __gu_err; \
@@ -294,7 +294,7 @@ do { \
294 long __gu_err = -EFAULT; \ 294 long __gu_err = -EFAULT; \
295 unsigned long __gu_val = 0; \ 295 unsigned long __gu_val = 0; \
296 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ 296 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
297 might_sleep(); \ 297 might_fault(); \
298 if (access_ok(VERIFY_READ, __gu_addr, (size))) \ 298 if (access_ok(VERIFY_READ, __gu_addr, (size))) \
299 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ 299 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
300 (x) = (__typeof__(*(ptr)))__gu_val; \ 300 (x) = (__typeof__(*(ptr)))__gu_val; \
@@ -419,14 +419,14 @@ static inline unsigned long __copy_to_user_inatomic(void __user *to,
419static inline unsigned long __copy_from_user(void *to, 419static inline unsigned long __copy_from_user(void *to,
420 const void __user *from, unsigned long size) 420 const void __user *from, unsigned long size)
421{ 421{
422 might_sleep(); 422 might_fault();
423 return __copy_from_user_inatomic(to, from, size); 423 return __copy_from_user_inatomic(to, from, size);
424} 424}
425 425
426static inline unsigned long __copy_to_user(void __user *to, 426static inline unsigned long __copy_to_user(void __user *to,
427 const void *from, unsigned long size) 427 const void *from, unsigned long size)
428{ 428{
429 might_sleep(); 429 might_fault();
430 return __copy_to_user_inatomic(to, from, size); 430 return __copy_to_user_inatomic(to, from, size);
431} 431}
432 432
@@ -434,7 +434,7 @@ extern unsigned long __clear_user(void __user *addr, unsigned long size);
434 434
435static inline unsigned long clear_user(void __user *addr, unsigned long size) 435static inline unsigned long clear_user(void __user *addr, unsigned long size)
436{ 436{
437 might_sleep(); 437 might_fault();
438 if (likely(access_ok(VERIFY_WRITE, addr, size))) 438 if (likely(access_ok(VERIFY_WRITE, addr, size)))
439 return __clear_user(addr, size); 439 return __clear_user(addr, size);
440 if ((unsigned long)addr < TASK_SIZE) { 440 if ((unsigned long)addr < TASK_SIZE) {
diff --git a/arch/powerpc/include/asm/vdso.h b/arch/powerpc/include/asm/vdso.h
index 50f261bc3e95..0d9cecddf8a4 100644
--- a/arch/powerpc/include/asm/vdso.h
+++ b/arch/powerpc/include/asm/vdso.h
@@ -22,7 +22,7 @@ extern unsigned long vdso64_rt_sigtramp;
22extern unsigned long vdso32_sigtramp; 22extern unsigned long vdso32_sigtramp;
23extern unsigned long vdso32_rt_sigtramp; 23extern unsigned long vdso32_rt_sigtramp;
24 24
25int __cpuinit vdso_getcpu_init(void); 25int vdso_getcpu_init(void);
26 26
27#else /* __ASSEMBLY__ */ 27#else /* __ASSEMBLY__ */
28 28
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index f960a7944553..a8619bfe879e 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -58,6 +58,8 @@ obj-$(CONFIG_RTAS_PROC) += rtas-proc.o
58obj-$(CONFIG_LPARCFG) += lparcfg.o 58obj-$(CONFIG_LPARCFG) += lparcfg.o
59obj-$(CONFIG_IBMVIO) += vio.o 59obj-$(CONFIG_IBMVIO) += vio.o
60obj-$(CONFIG_IBMEBUS) += ibmebus.o 60obj-$(CONFIG_IBMEBUS) += ibmebus.o
61obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \
62 eeh_driver.o eeh_event.o eeh_sysfs.o
61obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o 63obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o
62obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 64obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
63obj-$(CONFIG_FA_DUMP) += fadump.o 65obj-$(CONFIG_FA_DUMP) += fadump.o
@@ -100,7 +102,7 @@ obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
100obj-$(CONFIG_STACKTRACE) += stacktrace.o 102obj-$(CONFIG_STACKTRACE) += stacktrace.o
101obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o 103obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o
102 104
103pci64-$(CONFIG_PPC64) += pci_dn.o isa-bridge.o 105pci64-$(CONFIG_PPC64) += pci_dn.o pci-hotplug.o isa-bridge.o
104obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \ 106obj-$(CONFIG_PCI) += pci_$(CONFIG_WORD_SIZE).o $(pci64-y) \
105 pci-common.o pci_of_scan.o 107 pci-common.o pci_of_scan.o
106obj-$(CONFIG_PCI_MSI) += msi.o 108obj-$(CONFIG_PCI_MSI) += msi.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 6f16ffafa6f0..c7e8afc2ead0 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -105,9 +105,6 @@ int main(void)
105 DEFINE(KSP_VSID, offsetof(struct thread_struct, ksp_vsid)); 105 DEFINE(KSP_VSID, offsetof(struct thread_struct, ksp_vsid));
106#else /* CONFIG_PPC64 */ 106#else /* CONFIG_PPC64 */
107 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir)); 107 DEFINE(PGDIR, offsetof(struct thread_struct, pgdir));
108#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
109 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
110#endif
111#ifdef CONFIG_SPE 108#ifdef CONFIG_SPE
112 DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0])); 109 DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0]));
113 DEFINE(THREAD_ACC, offsetof(struct thread_struct, acc)); 110 DEFINE(THREAD_ACC, offsetof(struct thread_struct, acc));
@@ -115,6 +112,9 @@ int main(void)
115 DEFINE(THREAD_USED_SPE, offsetof(struct thread_struct, used_spe)); 112 DEFINE(THREAD_USED_SPE, offsetof(struct thread_struct, used_spe));
116#endif /* CONFIG_SPE */ 113#endif /* CONFIG_SPE */
117#endif /* CONFIG_PPC64 */ 114#endif /* CONFIG_PPC64 */
115#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
116 DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0));
117#endif
118#ifdef CONFIG_KVM_BOOK3S_32_HANDLER 118#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
119 DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct, kvm_shadow_vcpu)); 119 DEFINE(THREAD_KVM_SVCPU, offsetof(struct thread_struct, kvm_shadow_vcpu));
120#endif 120#endif
@@ -132,7 +132,6 @@ int main(void)
132 DEFINE(THREAD_SIER, offsetof(struct thread_struct, sier)); 132 DEFINE(THREAD_SIER, offsetof(struct thread_struct, sier));
133 DEFINE(THREAD_MMCR0, offsetof(struct thread_struct, mmcr0)); 133 DEFINE(THREAD_MMCR0, offsetof(struct thread_struct, mmcr0));
134 DEFINE(THREAD_MMCR2, offsetof(struct thread_struct, mmcr2)); 134 DEFINE(THREAD_MMCR2, offsetof(struct thread_struct, mmcr2));
135 DEFINE(THREAD_MMCRA, offsetof(struct thread_struct, mmcra));
136#endif 135#endif
137#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 136#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
138 DEFINE(PACATMSCRATCH, offsetof(struct paca_struct, tm_scratch)); 137 DEFINE(PACATMSCRATCH, offsetof(struct paca_struct, tm_scratch));
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index 92c6b008dd2b..9262cf2bec4b 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -131,7 +131,8 @@ static const char *cache_type_string(const struct cache *cache)
131 return cache_type_info[cache->type].name; 131 return cache_type_info[cache->type].name;
132} 132}
133 133
134static void __cpuinit cache_init(struct cache *cache, int type, int level, struct device_node *ofnode) 134static void cache_init(struct cache *cache, int type, int level,
135 struct device_node *ofnode)
135{ 136{
136 cache->type = type; 137 cache->type = type;
137 cache->level = level; 138 cache->level = level;
@@ -140,7 +141,7 @@ static void __cpuinit cache_init(struct cache *cache, int type, int level, struc
140 list_add(&cache->list, &cache_list); 141 list_add(&cache->list, &cache_list);
141} 142}
142 143
143static struct cache *__cpuinit new_cache(int type, int level, struct device_node *ofnode) 144static struct cache *new_cache(int type, int level, struct device_node *ofnode)
144{ 145{
145 struct cache *cache; 146 struct cache *cache;
146 147
@@ -324,7 +325,8 @@ static bool cache_node_is_unified(const struct device_node *np)
324 return of_get_property(np, "cache-unified", NULL); 325 return of_get_property(np, "cache-unified", NULL);
325} 326}
326 327
327static struct cache *__cpuinit cache_do_one_devnode_unified(struct device_node *node, int level) 328static struct cache *cache_do_one_devnode_unified(struct device_node *node,
329 int level)
328{ 330{
329 struct cache *cache; 331 struct cache *cache;
330 332
@@ -335,7 +337,8 @@ static struct cache *__cpuinit cache_do_one_devnode_unified(struct device_node *
335 return cache; 337 return cache;
336} 338}
337 339
338static struct cache *__cpuinit cache_do_one_devnode_split(struct device_node *node, int level) 340static struct cache *cache_do_one_devnode_split(struct device_node *node,
341 int level)
339{ 342{
340 struct cache *dcache, *icache; 343 struct cache *dcache, *icache;
341 344
@@ -357,7 +360,7 @@ err:
357 return NULL; 360 return NULL;
358} 361}
359 362
360static struct cache *__cpuinit cache_do_one_devnode(struct device_node *node, int level) 363static struct cache *cache_do_one_devnode(struct device_node *node, int level)
361{ 364{
362 struct cache *cache; 365 struct cache *cache;
363 366
@@ -369,7 +372,8 @@ static struct cache *__cpuinit cache_do_one_devnode(struct device_node *node, in
369 return cache; 372 return cache;
370} 373}
371 374
372static struct cache *__cpuinit cache_lookup_or_instantiate(struct device_node *node, int level) 375static struct cache *cache_lookup_or_instantiate(struct device_node *node,
376 int level)
373{ 377{
374 struct cache *cache; 378 struct cache *cache;
375 379
@@ -385,7 +389,7 @@ static struct cache *__cpuinit cache_lookup_or_instantiate(struct device_node *n
385 return cache; 389 return cache;
386} 390}
387 391
388static void __cpuinit link_cache_lists(struct cache *smaller, struct cache *bigger) 392static void link_cache_lists(struct cache *smaller, struct cache *bigger)
389{ 393{
390 while (smaller->next_local) { 394 while (smaller->next_local) {
391 if (smaller->next_local == bigger) 395 if (smaller->next_local == bigger)
@@ -396,13 +400,13 @@ static void __cpuinit link_cache_lists(struct cache *smaller, struct cache *bigg
396 smaller->next_local = bigger; 400 smaller->next_local = bigger;
397} 401}
398 402
399static void __cpuinit do_subsidiary_caches_debugcheck(struct cache *cache) 403static void do_subsidiary_caches_debugcheck(struct cache *cache)
400{ 404{
401 WARN_ON_ONCE(cache->level != 1); 405 WARN_ON_ONCE(cache->level != 1);
402 WARN_ON_ONCE(strcmp(cache->ofnode->type, "cpu")); 406 WARN_ON_ONCE(strcmp(cache->ofnode->type, "cpu"));
403} 407}
404 408
405static void __cpuinit do_subsidiary_caches(struct cache *cache) 409static void do_subsidiary_caches(struct cache *cache)
406{ 410{
407 struct device_node *subcache_node; 411 struct device_node *subcache_node;
408 int level = cache->level; 412 int level = cache->level;
@@ -423,7 +427,7 @@ static void __cpuinit do_subsidiary_caches(struct cache *cache)
423 } 427 }
424} 428}
425 429
426static struct cache *__cpuinit cache_chain_instantiate(unsigned int cpu_id) 430static struct cache *cache_chain_instantiate(unsigned int cpu_id)
427{ 431{
428 struct device_node *cpu_node; 432 struct device_node *cpu_node;
429 struct cache *cpu_cache = NULL; 433 struct cache *cpu_cache = NULL;
@@ -448,7 +452,7 @@ out:
448 return cpu_cache; 452 return cpu_cache;
449} 453}
450 454
451static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) 455static struct cache_dir *cacheinfo_create_cache_dir(unsigned int cpu_id)
452{ 456{
453 struct cache_dir *cache_dir; 457 struct cache_dir *cache_dir;
454 struct device *dev; 458 struct device *dev;
@@ -653,7 +657,7 @@ static struct kobj_type cache_index_type = {
653 .default_attrs = cache_index_default_attrs, 657 .default_attrs = cache_index_default_attrs,
654}; 658};
655 659
656static void __cpuinit cacheinfo_create_index_opt_attrs(struct cache_index_dir *dir) 660static void cacheinfo_create_index_opt_attrs(struct cache_index_dir *dir)
657{ 661{
658 const char *cache_name; 662 const char *cache_name;
659 const char *cache_type; 663 const char *cache_type;
@@ -696,7 +700,8 @@ static void __cpuinit cacheinfo_create_index_opt_attrs(struct cache_index_dir *d
696 kfree(buf); 700 kfree(buf);
697} 701}
698 702
699static void __cpuinit cacheinfo_create_index_dir(struct cache *cache, int index, struct cache_dir *cache_dir) 703static void cacheinfo_create_index_dir(struct cache *cache, int index,
704 struct cache_dir *cache_dir)
700{ 705{
701 struct cache_index_dir *index_dir; 706 struct cache_index_dir *index_dir;
702 int rc; 707 int rc;
@@ -722,7 +727,8 @@ err:
722 kfree(index_dir); 727 kfree(index_dir);
723} 728}
724 729
725static void __cpuinit cacheinfo_sysfs_populate(unsigned int cpu_id, struct cache *cache_list) 730static void cacheinfo_sysfs_populate(unsigned int cpu_id,
731 struct cache *cache_list)
726{ 732{
727 struct cache_dir *cache_dir; 733 struct cache_dir *cache_dir;
728 struct cache *cache; 734 struct cache *cache;
@@ -740,7 +746,7 @@ static void __cpuinit cacheinfo_sysfs_populate(unsigned int cpu_id, struct cache
740 } 746 }
741} 747}
742 748
743void __cpuinit cacheinfo_cpu_online(unsigned int cpu_id) 749void cacheinfo_cpu_online(unsigned int cpu_id)
744{ 750{
745 struct cache *cache; 751 struct cache *cache;
746 752
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1f0937d7d4b5..2a45d0f04385 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -452,8 +452,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
452 .mmu_features = MMU_FTRS_POWER8, 452 .mmu_features = MMU_FTRS_POWER8,
453 .icache_bsize = 128, 453 .icache_bsize = 128,
454 .dcache_bsize = 128, 454 .dcache_bsize = 128,
455 .oprofile_type = PPC_OPROFILE_POWER4, 455 .oprofile_type = PPC_OPROFILE_INVALID,
456 .oprofile_cpu_type = 0, 456 .oprofile_cpu_type = "ppc64/ibm-compat-v1",
457 .cpu_setup = __setup_cpu_power8, 457 .cpu_setup = __setup_cpu_power8,
458 .cpu_restore = __restore_cpu_power8, 458 .cpu_restore = __restore_cpu_power8,
459 .platform = "power8", 459 .platform = "power8",
@@ -506,8 +506,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
506 .dcache_bsize = 128, 506 .dcache_bsize = 128,
507 .num_pmcs = 6, 507 .num_pmcs = 6,
508 .pmc_type = PPC_PMC_IBM, 508 .pmc_type = PPC_PMC_IBM,
509 .oprofile_cpu_type = 0, 509 .oprofile_cpu_type = "ppc64/power8",
510 .oprofile_type = PPC_OPROFILE_POWER4, 510 .oprofile_type = PPC_OPROFILE_INVALID,
511 .cpu_setup = __setup_cpu_power8, 511 .cpu_setup = __setup_cpu_power8,
512 .cpu_restore = __restore_cpu_power8, 512 .cpu_restore = __restore_cpu_power8,
513 .platform = "power8", 513 .platform = "power8",
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 9ec3fe174cba..779a78c26435 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -69,16 +69,6 @@ void __init setup_kdump_trampoline(void)
69} 69}
70#endif /* CONFIG_NONSTATIC_KERNEL */ 70#endif /* CONFIG_NONSTATIC_KERNEL */
71 71
72static int __init parse_savemaxmem(char *p)
73{
74 if (p)
75 saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
76
77 return 1;
78}
79__setup("savemaxmem=", parse_savemaxmem);
80
81
82static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize, 72static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize,
83 unsigned long offset, int userbuf) 73 unsigned long offset, int userbuf)
84{ 74{
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/kernel/eeh.c
index 6b73d6c44f51..39954fe941b8 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -103,11 +103,8 @@ EXPORT_SYMBOL(eeh_subsystem_enabled);
103 */ 103 */
104int eeh_probe_mode; 104int eeh_probe_mode;
105 105
106/* Global EEH mutex */
107DEFINE_MUTEX(eeh_mutex);
108
109/* Lock to avoid races due to multiple reports of an error */ 106/* Lock to avoid races due to multiple reports of an error */
110static DEFINE_RAW_SPINLOCK(confirm_error_lock); 107DEFINE_RAW_SPINLOCK(confirm_error_lock);
111 108
112/* Buffer for reporting pci register dumps. Its here in BSS, and 109/* Buffer for reporting pci register dumps. Its here in BSS, and
113 * not dynamically alloced, so that it ends up in RMO where RTAS 110 * not dynamically alloced, so that it ends up in RMO where RTAS
@@ -235,16 +232,30 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
235{ 232{
236 size_t loglen = 0; 233 size_t loglen = 0;
237 struct eeh_dev *edev; 234 struct eeh_dev *edev;
235 bool valid_cfg_log = true;
238 236
239 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 237 /*
240 eeh_ops->configure_bridge(pe); 238 * When the PHB is fenced or dead, it's pointless to collect
241 eeh_pe_restore_bars(pe); 239 * the data from PCI config space because it should return
242 240 * 0xFF's. For ER, we still retrieve the data from the PCI
243 pci_regs_buf[0] = 0; 241 * config space.
244 eeh_pe_for_each_dev(pe, edev) { 242 */
245 loglen += eeh_gather_pci_data(edev, pci_regs_buf, 243 if (eeh_probe_mode_dev() &&
246 EEH_PCI_REGS_LOG_LEN); 244 (pe->type & EEH_PE_PHB) &&
247 } 245 (pe->state & (EEH_PE_ISOLATED | EEH_PE_PHB_DEAD)))
246 valid_cfg_log = false;
247
248 if (valid_cfg_log) {
249 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
250 eeh_ops->configure_bridge(pe);
251 eeh_pe_restore_bars(pe);
252
253 pci_regs_buf[0] = 0;
254 eeh_pe_for_each_dev(pe, edev) {
255 loglen += eeh_gather_pci_data(edev, pci_regs_buf + loglen,
256 EEH_PCI_REGS_LOG_LEN - loglen);
257 }
258 }
248 259
249 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); 260 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen);
250} 261}
@@ -260,15 +271,74 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
260{ 271{
261 pte_t *ptep; 272 pte_t *ptep;
262 unsigned long pa; 273 unsigned long pa;
274 int hugepage_shift;
263 275
264 ptep = find_linux_pte(init_mm.pgd, token); 276 /*
277 * We won't find hugepages here, iomem
278 */
279 ptep = find_linux_pte_or_hugepte(init_mm.pgd, token, &hugepage_shift);
265 if (!ptep) 280 if (!ptep)
266 return token; 281 return token;
282 WARN_ON(hugepage_shift);
267 pa = pte_pfn(*ptep) << PAGE_SHIFT; 283 pa = pte_pfn(*ptep) << PAGE_SHIFT;
268 284
269 return pa | (token & (PAGE_SIZE-1)); 285 return pa | (token & (PAGE_SIZE-1));
270} 286}
271 287
288/*
289 * On PowerNV platform, we might already have fenced PHB there.
290 * For that case, it's meaningless to recover frozen PE. Intead,
291 * We have to handle fenced PHB firstly.
292 */
293static int eeh_phb_check_failure(struct eeh_pe *pe)
294{
295 struct eeh_pe *phb_pe;
296 unsigned long flags;
297 int ret;
298
299 if (!eeh_probe_mode_dev())
300 return -EPERM;
301
302 /* Find the PHB PE */
303 phb_pe = eeh_phb_pe_get(pe->phb);
304 if (!phb_pe) {
305 pr_warning("%s Can't find PE for PHB#%d\n",
306 __func__, pe->phb->global_number);
307 return -EEXIST;
308 }
309
310 /* If the PHB has been in problematic state */
311 eeh_serialize_lock(&flags);
312 if (phb_pe->state & (EEH_PE_ISOLATED | EEH_PE_PHB_DEAD)) {
313 ret = 0;
314 goto out;
315 }
316
317 /* Check PHB state */
318 ret = eeh_ops->get_state(phb_pe, NULL);
319 if ((ret < 0) ||
320 (ret == EEH_STATE_NOT_SUPPORT) ||
321 (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) ==
322 (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) {
323 ret = 0;
324 goto out;
325 }
326
327 /* Isolate the PHB and send event */
328 eeh_pe_state_mark(phb_pe, EEH_PE_ISOLATED);
329 eeh_serialize_unlock(flags);
330 eeh_send_failure_event(phb_pe);
331
332 pr_err("EEH: PHB#%x failure detected\n",
333 phb_pe->phb->global_number);
334 dump_stack();
335
336 return 1;
337out:
338 eeh_serialize_unlock(flags);
339 return ret;
340}
341
272/** 342/**
273 * eeh_dev_check_failure - Check if all 1's data is due to EEH slot freeze 343 * eeh_dev_check_failure - Check if all 1's data is due to EEH slot freeze
274 * @edev: eeh device 344 * @edev: eeh device
@@ -319,13 +389,21 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
319 return 0; 389 return 0;
320 } 390 }
321 391
392 /*
393 * On PowerNV platform, we might already have fenced PHB
394 * there and we need take care of that firstly.
395 */
396 ret = eeh_phb_check_failure(pe);
397 if (ret > 0)
398 return ret;
399
322 /* If we already have a pending isolation event for this 400 /* If we already have a pending isolation event for this
323 * slot, we know it's bad already, we don't need to check. 401 * slot, we know it's bad already, we don't need to check.
324 * Do this checking under a lock; as multiple PCI devices 402 * Do this checking under a lock; as multiple PCI devices
325 * in one slot might report errors simultaneously, and we 403 * in one slot might report errors simultaneously, and we
326 * only want one error recovery routine running. 404 * only want one error recovery routine running.
327 */ 405 */
328 raw_spin_lock_irqsave(&confirm_error_lock, flags); 406 eeh_serialize_lock(&flags);
329 rc = 1; 407 rc = 1;
330 if (pe->state & EEH_PE_ISOLATED) { 408 if (pe->state & EEH_PE_ISOLATED) {
331 pe->check_count++; 409 pe->check_count++;
@@ -368,13 +446,13 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
368 } 446 }
369 447
370 eeh_stats.slot_resets++; 448 eeh_stats.slot_resets++;
371 449
372 /* Avoid repeated reports of this failure, including problems 450 /* Avoid repeated reports of this failure, including problems
373 * with other functions on this device, and functions under 451 * with other functions on this device, and functions under
374 * bridges. 452 * bridges.
375 */ 453 */
376 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 454 eeh_pe_state_mark(pe, EEH_PE_ISOLATED);
377 raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 455 eeh_serialize_unlock(flags);
378 456
379 eeh_send_failure_event(pe); 457 eeh_send_failure_event(pe);
380 458
@@ -382,11 +460,14 @@ int eeh_dev_check_failure(struct eeh_dev *edev)
382 * a stack trace will help the device-driver authors figure 460 * a stack trace will help the device-driver authors figure
383 * out what happened. So print that out. 461 * out what happened. So print that out.
384 */ 462 */
385 WARN(1, "EEH: failure detected\n"); 463 pr_err("EEH: Frozen PE#%x detected on PHB#%x\n",
464 pe->addr, pe->phb->global_number);
465 dump_stack();
466
386 return 1; 467 return 1;
387 468
388dn_unlock: 469dn_unlock:
389 raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 470 eeh_serialize_unlock(flags);
390 return rc; 471 return rc;
391} 472}
392 473
@@ -525,7 +606,7 @@ static void eeh_reset_pe_once(struct eeh_pe *pe)
525 * or a fundamental reset (3). 606 * or a fundamental reset (3).
526 * A fundamental reset required by any device under 607 * A fundamental reset required by any device under
527 * Partitionable Endpoint trumps hot-reset. 608 * Partitionable Endpoint trumps hot-reset.
528 */ 609 */
529 eeh_pe_dev_traverse(pe, eeh_set_dev_freset, &freset); 610 eeh_pe_dev_traverse(pe, eeh_set_dev_freset, &freset);
530 611
531 if (freset) 612 if (freset)
@@ -538,8 +619,8 @@ static void eeh_reset_pe_once(struct eeh_pe *pe)
538 */ 619 */
539#define PCI_BUS_RST_HOLD_TIME_MSEC 250 620#define PCI_BUS_RST_HOLD_TIME_MSEC 250
540 msleep(PCI_BUS_RST_HOLD_TIME_MSEC); 621 msleep(PCI_BUS_RST_HOLD_TIME_MSEC);
541 622
542 /* We might get hit with another EEH freeze as soon as the 623 /* We might get hit with another EEH freeze as soon as the
543 * pci slot reset line is dropped. Make sure we don't miss 624 * pci slot reset line is dropped. Make sure we don't miss
544 * these, and clear the flag now. 625 * these, and clear the flag now.
545 */ 626 */
@@ -565,6 +646,7 @@ static void eeh_reset_pe_once(struct eeh_pe *pe)
565 */ 646 */
566int eeh_reset_pe(struct eeh_pe *pe) 647int eeh_reset_pe(struct eeh_pe *pe)
567{ 648{
649 int flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);
568 int i, rc; 650 int i, rc;
569 651
570 /* Take three shots at resetting the bus */ 652 /* Take three shots at resetting the bus */
@@ -572,7 +654,7 @@ int eeh_reset_pe(struct eeh_pe *pe)
572 eeh_reset_pe_once(pe); 654 eeh_reset_pe_once(pe);
573 655
574 rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC); 656 rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC);
575 if (rc == (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) 657 if ((rc & flags) == flags)
576 return 0; 658 return 0;
577 659
578 if (rc < 0) { 660 if (rc < 0) {
@@ -604,7 +686,7 @@ void eeh_save_bars(struct eeh_dev *edev)
604 if (!edev) 686 if (!edev)
605 return; 687 return;
606 dn = eeh_dev_to_of_node(edev); 688 dn = eeh_dev_to_of_node(edev);
607 689
608 for (i = 0; i < 16; i++) 690 for (i = 0; i < 16; i++)
609 eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]); 691 eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]);
610} 692}
@@ -674,11 +756,21 @@ int __exit eeh_ops_unregister(const char *name)
674 * Even if force-off is set, the EEH hardware is still enabled, so that 756 * Even if force-off is set, the EEH hardware is still enabled, so that
675 * newer systems can boot. 757 * newer systems can boot.
676 */ 758 */
677static int __init eeh_init(void) 759int eeh_init(void)
678{ 760{
679 struct pci_controller *hose, *tmp; 761 struct pci_controller *hose, *tmp;
680 struct device_node *phb; 762 struct device_node *phb;
681 int ret; 763 static int cnt = 0;
764 int ret = 0;
765
766 /*
767 * We have to delay the initialization on PowerNV after
768 * the PCI hierarchy tree has been built because the PEs
769 * are figured out based on PCI devices instead of device
770 * tree nodes
771 */
772 if (machine_is(powernv) && cnt++ <= 0)
773 return ret;
682 774
683 /* call platform initialization function */ 775 /* call platform initialization function */
684 if (!eeh_ops) { 776 if (!eeh_ops) {
@@ -691,7 +783,10 @@ static int __init eeh_init(void)
691 return ret; 783 return ret;
692 } 784 }
693 785
694 raw_spin_lock_init(&confirm_error_lock); 786 /* Initialize EEH event */
787 ret = eeh_event_init();
788 if (ret)
789 return ret;
695 790
696 /* Enable EEH for all adapters */ 791 /* Enable EEH for all adapters */
697 if (eeh_probe_mode_devtree()) { 792 if (eeh_probe_mode_devtree()) {
@@ -700,6 +795,25 @@ static int __init eeh_init(void)
700 phb = hose->dn; 795 phb = hose->dn;
701 traverse_pci_devices(phb, eeh_ops->of_probe, NULL); 796 traverse_pci_devices(phb, eeh_ops->of_probe, NULL);
702 } 797 }
798 } else if (eeh_probe_mode_dev()) {
799 list_for_each_entry_safe(hose, tmp,
800 &hose_list, list_node)
801 pci_walk_bus(hose->bus, eeh_ops->dev_probe, NULL);
802 } else {
803 pr_warning("%s: Invalid probe mode %d\n",
804 __func__, eeh_probe_mode);
805 return -EINVAL;
806 }
807
808 /*
809 * Call platform post-initialization. Actually, It's good chance
810 * to inform platform that EEH is ready to supply service if the
811 * I/O cache stuff has been built up.
812 */
813 if (eeh_ops->post_init) {
814 ret = eeh_ops->post_init();
815 if (ret)
816 return ret;
703 } 817 }
704 818
705 if (eeh_subsystem_enabled) 819 if (eeh_subsystem_enabled)
@@ -728,6 +842,14 @@ static void eeh_add_device_early(struct device_node *dn)
728{ 842{
729 struct pci_controller *phb; 843 struct pci_controller *phb;
730 844
845 /*
846 * If we're doing EEH probe based on PCI device, we
847 * would delay the probe until late stage because
848 * the PCI device isn't available this moment.
849 */
850 if (!eeh_probe_mode_devtree())
851 return;
852
731 if (!of_node_to_eeh_dev(dn)) 853 if (!of_node_to_eeh_dev(dn))
732 return; 854 return;
733 phb = of_node_to_eeh_dev(dn)->phb; 855 phb = of_node_to_eeh_dev(dn)->phb;
@@ -736,7 +858,6 @@ static void eeh_add_device_early(struct device_node *dn)
736 if (NULL == phb || 0 == phb->buid) 858 if (NULL == phb || 0 == phb->buid)
737 return; 859 return;
738 860
739 /* FIXME: hotplug support on POWERNV */
740 eeh_ops->of_probe(dn, NULL); 861 eeh_ops->of_probe(dn, NULL);
741} 862}
742 863
@@ -787,6 +908,13 @@ static void eeh_add_device_late(struct pci_dev *dev)
787 edev->pdev = dev; 908 edev->pdev = dev;
788 dev->dev.archdata.edev = edev; 909 dev->dev.archdata.edev = edev;
789 910
911 /*
912 * We have to do the EEH probe here because the PCI device
913 * hasn't been created yet in the early stage.
914 */
915 if (eeh_probe_mode_dev())
916 eeh_ops->dev_probe(dev, NULL);
917
790 eeh_addr_cache_insert_dev(dev); 918 eeh_addr_cache_insert_dev(dev);
791} 919}
792 920
@@ -803,12 +931,12 @@ void eeh_add_device_tree_late(struct pci_bus *bus)
803 struct pci_dev *dev; 931 struct pci_dev *dev;
804 932
805 list_for_each_entry(dev, &bus->devices, bus_list) { 933 list_for_each_entry(dev, &bus->devices, bus_list) {
806 eeh_add_device_late(dev); 934 eeh_add_device_late(dev);
807 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { 935 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
808 struct pci_bus *subbus = dev->subordinate; 936 struct pci_bus *subbus = dev->subordinate;
809 if (subbus) 937 if (subbus)
810 eeh_add_device_tree_late(subbus); 938 eeh_add_device_tree_late(subbus);
811 } 939 }
812 } 940 }
813} 941}
814EXPORT_SYMBOL_GPL(eeh_add_device_tree_late); 942EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c
index 5a4c87903057..f9ac1232a746 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/kernel/eeh_cache.c
@@ -194,7 +194,7 @@ static void __eeh_addr_cache_insert_dev(struct pci_dev *dev)
194 } 194 }
195 195
196 /* Skip any devices for which EEH is not enabled. */ 196 /* Skip any devices for which EEH is not enabled. */
197 if (!edev->pe) { 197 if (!eeh_probe_mode_dev() && !edev->pe) {
198#ifdef DEBUG 198#ifdef DEBUG
199 pr_info("PCI: skip building address cache for=%s - %s\n", 199 pr_info("PCI: skip building address cache for=%s - %s\n",
200 pci_name(dev), dn->full_name); 200 pci_name(dev), dn->full_name);
@@ -285,7 +285,7 @@ void eeh_addr_cache_rmv_dev(struct pci_dev *dev)
285 * Must be run late in boot process, after the pci controllers 285 * Must be run late in boot process, after the pci controllers
286 * have been scanned for devices (after all device resources are known). 286 * have been scanned for devices (after all device resources are known).
287 */ 287 */
288void __init eeh_addr_cache_build(void) 288void eeh_addr_cache_build(void)
289{ 289{
290 struct device_node *dn; 290 struct device_node *dn;
291 struct eeh_dev *edev; 291 struct eeh_dev *edev;
@@ -294,8 +294,6 @@ void __init eeh_addr_cache_build(void)
294 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 294 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
295 295
296 for_each_pci_dev(dev) { 296 for_each_pci_dev(dev) {
297 eeh_addr_cache_insert_dev(dev);
298
299 dn = pci_device_to_OF_node(dev); 297 dn = pci_device_to_OF_node(dev);
300 if (!dn) 298 if (!dn)
301 continue; 299 continue;
@@ -308,6 +306,8 @@ void __init eeh_addr_cache_build(void)
308 dev->dev.archdata.edev = edev; 306 dev->dev.archdata.edev = edev;
309 edev->pdev = dev; 307 edev->pdev = dev;
310 308
309 eeh_addr_cache_insert_dev(dev);
310
311 eeh_sysfs_add_device(dev); 311 eeh_sysfs_add_device(dev);
312 } 312 }
313 313
@@ -316,4 +316,3 @@ void __init eeh_addr_cache_build(void)
316 eeh_addr_cache_print(&pci_io_addr_cache_root); 316 eeh_addr_cache_print(&pci_io_addr_cache_root);
317#endif 317#endif
318} 318}
319
diff --git a/arch/powerpc/platforms/pseries/eeh_dev.c b/arch/powerpc/kernel/eeh_dev.c
index 1efa28f5fc54..1efa28f5fc54 100644
--- a/arch/powerpc/platforms/pseries/eeh_dev.c
+++ b/arch/powerpc/kernel/eeh_dev.c
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index a3fefb61097c..2b1ce17cae50 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -154,9 +154,9 @@ static void eeh_enable_irq(struct pci_dev *dev)
154 * eeh_report_error - Report pci error to each device driver 154 * eeh_report_error - Report pci error to each device driver
155 * @data: eeh device 155 * @data: eeh device
156 * @userdata: return value 156 * @userdata: return value
157 * 157 *
158 * Report an EEH error to each device driver, collect up and 158 * Report an EEH error to each device driver, collect up and
159 * merge the device driver responses. Cumulative response 159 * merge the device driver responses. Cumulative response
160 * passed back in "userdata". 160 * passed back in "userdata".
161 */ 161 */
162static void *eeh_report_error(void *data, void *userdata) 162static void *eeh_report_error(void *data, void *userdata)
@@ -349,10 +349,12 @@ static void *eeh_report_failure(void *data, void *userdata)
349 */ 349 */
350static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) 350static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
351{ 351{
352 struct timeval tstamp;
352 int cnt, rc; 353 int cnt, rc;
353 354
354 /* pcibios will clear the counter; save the value */ 355 /* pcibios will clear the counter; save the value */
355 cnt = pe->freeze_count; 356 cnt = pe->freeze_count;
357 tstamp = pe->tstamp;
356 358
357 /* 359 /*
358 * We don't remove the corresponding PE instances because 360 * We don't remove the corresponding PE instances because
@@ -376,15 +378,17 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
376 eeh_pe_restore_bars(pe); 378 eeh_pe_restore_bars(pe);
377 379
378 /* Give the system 5 seconds to finish running the user-space 380 /* Give the system 5 seconds to finish running the user-space
379 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, 381 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes,
380 * this is a hack, but if we don't do this, and try to bring 382 * this is a hack, but if we don't do this, and try to bring
381 * the device up before the scripts have taken it down, 383 * the device up before the scripts have taken it down,
382 * potentially weird things happen. 384 * potentially weird things happen.
383 */ 385 */
384 if (bus) { 386 if (bus) {
385 ssleep(5); 387 ssleep(5);
386 pcibios_add_pci_devices(bus); 388 pcibios_add_pci_devices(bus);
387 } 389 }
390
391 pe->tstamp = tstamp;
388 pe->freeze_count = cnt; 392 pe->freeze_count = cnt;
389 393
390 return 0; 394 return 0;
@@ -395,24 +399,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
395 */ 399 */
396#define MAX_WAIT_FOR_RECOVERY 150 400#define MAX_WAIT_FOR_RECOVERY 150
397 401
398/** 402static void eeh_handle_normal_event(struct eeh_pe *pe)
399 * eeh_handle_event - Reset a PCI device after hard lockup.
400 * @pe: EEH PE
401 *
402 * While PHB detects address or data parity errors on particular PCI
403 * slot, the associated PE will be frozen. Besides, DMA's occurring
404 * to wild addresses (which usually happen due to bugs in device
405 * drivers or in PCI adapter firmware) can cause EEH error. #SERR,
406 * #PERR or other misc PCI-related errors also can trigger EEH errors.
407 *
408 * Recovery process consists of unplugging the device driver (which
409 * generated hotplug events to userspace), then issuing a PCI #RST to
410 * the device, then reconfiguring the PCI config space for all bridges
411 * & devices under this slot, and then finally restarting the device
412 * drivers (which cause a second set of hotplug events to go out to
413 * userspace).
414 */
415void eeh_handle_event(struct eeh_pe *pe)
416{ 403{
417 struct pci_bus *frozen_bus; 404 struct pci_bus *frozen_bus;
418 int rc = 0; 405 int rc = 0;
@@ -425,6 +412,7 @@ void eeh_handle_event(struct eeh_pe *pe)
425 return; 412 return;
426 } 413 }
427 414
415 eeh_pe_update_time_stamp(pe);
428 pe->freeze_count++; 416 pe->freeze_count++;
429 if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES) 417 if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES)
430 goto excess_failures; 418 goto excess_failures;
@@ -437,6 +425,7 @@ void eeh_handle_event(struct eeh_pe *pe)
437 * status ... if any child can't handle the reset, then the entire 425 * status ... if any child can't handle the reset, then the entire
438 * slot is dlpar removed and added. 426 * slot is dlpar removed and added.
439 */ 427 */
428 pr_info("EEH: Notify device drivers to shutdown\n");
440 eeh_pe_dev_traverse(pe, eeh_report_error, &result); 429 eeh_pe_dev_traverse(pe, eeh_report_error, &result);
441 430
442 /* Get the current PCI slot state. This can take a long time, 431 /* Get the current PCI slot state. This can take a long time,
@@ -444,7 +433,7 @@ void eeh_handle_event(struct eeh_pe *pe)
444 */ 433 */
445 rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000); 434 rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000);
446 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) { 435 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) {
447 printk(KERN_WARNING "EEH: Permanent failure\n"); 436 pr_warning("EEH: Permanent failure\n");
448 goto hard_fail; 437 goto hard_fail;
449 } 438 }
450 439
@@ -452,6 +441,7 @@ void eeh_handle_event(struct eeh_pe *pe)
452 * don't post the error log until after all dev drivers 441 * don't post the error log until after all dev drivers
453 * have been informed. 442 * have been informed.
454 */ 443 */
444 pr_info("EEH: Collect temporary log\n");
455 eeh_slot_error_detail(pe, EEH_LOG_TEMP); 445 eeh_slot_error_detail(pe, EEH_LOG_TEMP);
456 446
457 /* If all device drivers were EEH-unaware, then shut 447 /* If all device drivers were EEH-unaware, then shut
@@ -459,15 +449,18 @@ void eeh_handle_event(struct eeh_pe *pe)
459 * go down willingly, without panicing the system. 449 * go down willingly, without panicing the system.
460 */ 450 */
461 if (result == PCI_ERS_RESULT_NONE) { 451 if (result == PCI_ERS_RESULT_NONE) {
452 pr_info("EEH: Reset with hotplug activity\n");
462 rc = eeh_reset_device(pe, frozen_bus); 453 rc = eeh_reset_device(pe, frozen_bus);
463 if (rc) { 454 if (rc) {
464 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc); 455 pr_warning("%s: Unable to reset, err=%d\n",
456 __func__, rc);
465 goto hard_fail; 457 goto hard_fail;
466 } 458 }
467 } 459 }
468 460
469 /* If all devices reported they can proceed, then re-enable MMIO */ 461 /* If all devices reported they can proceed, then re-enable MMIO */
470 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 462 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
463 pr_info("EEH: Enable I/O for affected devices\n");
471 rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 464 rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
472 465
473 if (rc < 0) 466 if (rc < 0)
@@ -475,6 +468,7 @@ void eeh_handle_event(struct eeh_pe *pe)
475 if (rc) { 468 if (rc) {
476 result = PCI_ERS_RESULT_NEED_RESET; 469 result = PCI_ERS_RESULT_NEED_RESET;
477 } else { 470 } else {
471 pr_info("EEH: Notify device drivers to resume I/O\n");
478 result = PCI_ERS_RESULT_NONE; 472 result = PCI_ERS_RESULT_NONE;
479 eeh_pe_dev_traverse(pe, eeh_report_mmio_enabled, &result); 473 eeh_pe_dev_traverse(pe, eeh_report_mmio_enabled, &result);
480 } 474 }
@@ -482,6 +476,7 @@ void eeh_handle_event(struct eeh_pe *pe)
482 476
483 /* If all devices reported they can proceed, then re-enable DMA */ 477 /* If all devices reported they can proceed, then re-enable DMA */
484 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 478 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
479 pr_info("EEH: Enabled DMA for affected devices\n");
485 rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA); 480 rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA);
486 481
487 if (rc < 0) 482 if (rc < 0)
@@ -494,17 +489,22 @@ void eeh_handle_event(struct eeh_pe *pe)
494 489
495 /* If any device has a hard failure, then shut off everything. */ 490 /* If any device has a hard failure, then shut off everything. */
496 if (result == PCI_ERS_RESULT_DISCONNECT) { 491 if (result == PCI_ERS_RESULT_DISCONNECT) {
497 printk(KERN_WARNING "EEH: Device driver gave up\n"); 492 pr_warning("EEH: Device driver gave up\n");
498 goto hard_fail; 493 goto hard_fail;
499 } 494 }
500 495
501 /* If any device called out for a reset, then reset the slot */ 496 /* If any device called out for a reset, then reset the slot */
502 if (result == PCI_ERS_RESULT_NEED_RESET) { 497 if (result == PCI_ERS_RESULT_NEED_RESET) {
498 pr_info("EEH: Reset without hotplug activity\n");
503 rc = eeh_reset_device(pe, NULL); 499 rc = eeh_reset_device(pe, NULL);
504 if (rc) { 500 if (rc) {
505 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc); 501 pr_warning("%s: Cannot reset, err=%d\n",
502 __func__, rc);
506 goto hard_fail; 503 goto hard_fail;
507 } 504 }
505
506 pr_info("EEH: Notify device drivers "
507 "the completion of reset\n");
508 result = PCI_ERS_RESULT_NONE; 508 result = PCI_ERS_RESULT_NONE;
509 eeh_pe_dev_traverse(pe, eeh_report_reset, &result); 509 eeh_pe_dev_traverse(pe, eeh_report_reset, &result);
510 } 510 }
@@ -512,15 +512,16 @@ void eeh_handle_event(struct eeh_pe *pe)
512 /* All devices should claim they have recovered by now. */ 512 /* All devices should claim they have recovered by now. */
513 if ((result != PCI_ERS_RESULT_RECOVERED) && 513 if ((result != PCI_ERS_RESULT_RECOVERED) &&
514 (result != PCI_ERS_RESULT_NONE)) { 514 (result != PCI_ERS_RESULT_NONE)) {
515 printk(KERN_WARNING "EEH: Not recovered\n"); 515 pr_warning("EEH: Not recovered\n");
516 goto hard_fail; 516 goto hard_fail;
517 } 517 }
518 518
519 /* Tell all device drivers that they can resume operations */ 519 /* Tell all device drivers that they can resume operations */
520 pr_info("EEH: Notify device driver to resume\n");
520 eeh_pe_dev_traverse(pe, eeh_report_resume, NULL); 521 eeh_pe_dev_traverse(pe, eeh_report_resume, NULL);
521 522
522 return; 523 return;
523 524
524excess_failures: 525excess_failures:
525 /* 526 /*
526 * About 90% of all real-life EEH failures in the field 527 * About 90% of all real-life EEH failures in the field
@@ -550,3 +551,111 @@ perm_error:
550 pcibios_remove_pci_devices(frozen_bus); 551 pcibios_remove_pci_devices(frozen_bus);
551} 552}
552 553
554static void eeh_handle_special_event(void)
555{
556 struct eeh_pe *pe, *phb_pe;
557 struct pci_bus *bus;
558 struct pci_controller *hose, *tmp;
559 unsigned long flags;
560 int rc = 0;
561
562 /*
563 * The return value from next_error() has been classified as follows.
564 * It might be good to enumerate them. However, next_error() is only
565 * supported by PowerNV platform for now. So it would be fine to use
566 * integer directly:
567 *
568 * 4 - Dead IOC 3 - Dead PHB
569 * 2 - Fenced PHB 1 - Frozen PE
570 * 0 - No error found
571 *
572 */
573 rc = eeh_ops->next_error(&pe);
574 if (rc <= 0)
575 return;
576
577 switch (rc) {
578 case 4:
579 /* Mark all PHBs in dead state */
580 eeh_serialize_lock(&flags);
581 list_for_each_entry_safe(hose, tmp,
582 &hose_list, list_node) {
583 phb_pe = eeh_phb_pe_get(hose);
584 if (!phb_pe) continue;
585
586 eeh_pe_state_mark(phb_pe,
587 EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
588 }
589 eeh_serialize_unlock(flags);
590
591 /* Purge all events */
592 eeh_remove_event(NULL);
593 break;
594 case 3:
595 case 2:
596 case 1:
597 /* Mark the PE in fenced state */
598 eeh_serialize_lock(&flags);
599 if (rc == 3)
600 eeh_pe_state_mark(pe,
601 EEH_PE_ISOLATED | EEH_PE_PHB_DEAD);
602 else
603 eeh_pe_state_mark(pe,
604 EEH_PE_ISOLATED | EEH_PE_RECOVERING);
605 eeh_serialize_unlock(flags);
606
607 /* Purge all events of the PHB */
608 eeh_remove_event(pe);
609 break;
610 default:
611 pr_err("%s: Invalid value %d from next_error()\n",
612 __func__, rc);
613 return;
614 }
615
616 /*
617 * For fenced PHB and frozen PE, it's handled as normal
618 * event. We have to remove the affected PHBs for dead
619 * PHB and IOC
620 */
621 if (rc == 2 || rc == 1)
622 eeh_handle_normal_event(pe);
623 else {
624 list_for_each_entry_safe(hose, tmp,
625 &hose_list, list_node) {
626 phb_pe = eeh_phb_pe_get(hose);
627 if (!phb_pe || !(phb_pe->state & EEH_PE_PHB_DEAD))
628 continue;
629
630 bus = eeh_pe_bus_get(phb_pe);
631 /* Notify all devices that they're about to go down. */
632 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
633 pcibios_remove_pci_devices(bus);
634 }
635 }
636}
637
638/**
639 * eeh_handle_event - Reset a PCI device after hard lockup.
640 * @pe: EEH PE
641 *
642 * While PHB detects address or data parity errors on particular PCI
643 * slot, the associated PE will be frozen. Besides, DMA's occurring
644 * to wild addresses (which usually happen due to bugs in device
645 * drivers or in PCI adapter firmware) can cause EEH error. #SERR,
646 * #PERR or other misc PCI-related errors also can trigger EEH errors.
647 *
648 * Recovery process consists of unplugging the device driver (which
649 * generated hotplug events to userspace), then issuing a PCI #RST to
650 * the device, then reconfiguring the PCI config space for all bridges
651 * & devices under this slot, and then finally restarting the device
652 * drivers (which cause a second set of hotplug events to go out to
653 * userspace).
654 */
655void eeh_handle_event(struct eeh_pe *pe)
656{
657 if (pe)
658 eeh_handle_normal_event(pe);
659 else
660 eeh_handle_special_event();
661}
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/kernel/eeh_event.c
index 185bedd926df..d27c5afc90ae 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/kernel/eeh_event.c
@@ -18,11 +18,10 @@
18 18
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/mutex.h>
22#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/semaphore.h>
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/workqueue.h>
26#include <linux/kthread.h> 25#include <linux/kthread.h>
27#include <asm/eeh_event.h> 26#include <asm/eeh_event.h>
28#include <asm/ppc-pci.h> 27#include <asm/ppc-pci.h>
@@ -35,14 +34,9 @@
35 * work-queue, where a worker thread can drive recovery. 34 * work-queue, where a worker thread can drive recovery.
36 */ 35 */
37 36
38/* EEH event workqueue setup. */
39static DEFINE_SPINLOCK(eeh_eventlist_lock); 37static DEFINE_SPINLOCK(eeh_eventlist_lock);
38static struct semaphore eeh_eventlist_sem;
40LIST_HEAD(eeh_eventlist); 39LIST_HEAD(eeh_eventlist);
41static void eeh_thread_launcher(struct work_struct *);
42DECLARE_WORK(eeh_event_wq, eeh_thread_launcher);
43
44/* Serialize reset sequences for a given pci device */
45DEFINE_MUTEX(eeh_event_mutex);
46 40
47/** 41/**
48 * eeh_event_handler - Dispatch EEH events. 42 * eeh_event_handler - Dispatch EEH events.
@@ -60,55 +54,63 @@ static int eeh_event_handler(void * dummy)
60 struct eeh_event *event; 54 struct eeh_event *event;
61 struct eeh_pe *pe; 55 struct eeh_pe *pe;
62 56
63 spin_lock_irqsave(&eeh_eventlist_lock, flags); 57 while (!kthread_should_stop()) {
64 event = NULL; 58 if (down_interruptible(&eeh_eventlist_sem))
65 59 break;
66 /* Unqueue the event, get ready to process. */ 60
67 if (!list_empty(&eeh_eventlist)) { 61 /* Fetch EEH event from the queue */
68 event = list_entry(eeh_eventlist.next, struct eeh_event, list); 62 spin_lock_irqsave(&eeh_eventlist_lock, flags);
69 list_del(&event->list); 63 event = NULL;
70 } 64 if (!list_empty(&eeh_eventlist)) {
71 spin_unlock_irqrestore(&eeh_eventlist_lock, flags); 65 event = list_entry(eeh_eventlist.next,
72 66 struct eeh_event, list);
73 if (event == NULL) 67 list_del(&event->list);
74 return 0; 68 }
75 69 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
76 /* Serialize processing of EEH events */ 70 if (!event)
77 mutex_lock(&eeh_event_mutex); 71 continue;
78 pe = event->pe; 72
79 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); 73 /* We might have event without binding PE */
80 pr_info("EEH: Detected PCI bus error on PHB#%d-PE#%x\n", 74 pe = event->pe;
81 pe->phb->global_number, pe->addr); 75 if (pe) {
82 76 eeh_pe_state_mark(pe, EEH_PE_RECOVERING);
83 set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */ 77 pr_info("EEH: Detected PCI bus error on PHB#%d-PE#%x\n",
84 eeh_handle_event(pe); 78 pe->phb->global_number, pe->addr);
85 eeh_pe_state_clear(pe, EEH_PE_RECOVERING); 79 eeh_handle_event(pe);
86 80 eeh_pe_state_clear(pe, EEH_PE_RECOVERING);
87 kfree(event); 81 } else {
88 mutex_unlock(&eeh_event_mutex); 82 eeh_handle_event(NULL);
89 83 }
90 /* If there are no new errors after an hour, clear the counter. */ 84
91 if (pe && pe->freeze_count > 0) { 85 kfree(event);
92 msleep_interruptible(3600*1000);
93 if (pe->freeze_count > 0)
94 pe->freeze_count--;
95
96 } 86 }
97 87
98 return 0; 88 return 0;
99} 89}
100 90
101/** 91/**
102 * eeh_thread_launcher - Start kernel thread to handle EEH events 92 * eeh_event_init - Start kernel thread to handle EEH events
103 * @dummy - unused
104 * 93 *
105 * This routine is called to start the kernel thread for processing 94 * This routine is called to start the kernel thread for processing
106 * EEH event. 95 * EEH event.
107 */ 96 */
108static void eeh_thread_launcher(struct work_struct *dummy) 97int eeh_event_init(void)
109{ 98{
110 if (IS_ERR(kthread_run(eeh_event_handler, NULL, "eehd"))) 99 struct task_struct *t;
111 printk(KERN_ERR "Failed to start EEH daemon\n"); 100 int ret = 0;
101
102 /* Initialize semaphore */
103 sema_init(&eeh_eventlist_sem, 0);
104
105 t = kthread_run(eeh_event_handler, NULL, "eehd");
106 if (IS_ERR(t)) {
107 ret = PTR_ERR(t);
108 pr_err("%s: Failed to start EEH daemon (%d)\n",
109 __func__, ret);
110 return ret;
111 }
112
113 return 0;
112} 114}
113 115
114/** 116/**
@@ -136,7 +138,45 @@ int eeh_send_failure_event(struct eeh_pe *pe)
136 list_add(&event->list, &eeh_eventlist); 138 list_add(&event->list, &eeh_eventlist);
137 spin_unlock_irqrestore(&eeh_eventlist_lock, flags); 139 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
138 140
139 schedule_work(&eeh_event_wq); 141 /* For EEH deamon to knick in */
142 up(&eeh_eventlist_sem);
140 143
141 return 0; 144 return 0;
142} 145}
146
147/**
148 * eeh_remove_event - Remove EEH event from the queue
149 * @pe: Event binding to the PE
150 *
151 * On PowerNV platform, we might have subsequent coming events
152 * is part of the former one. For that case, those subsequent
153 * coming events are totally duplicated and unnecessary, thus
154 * they should be removed.
155 */
156void eeh_remove_event(struct eeh_pe *pe)
157{
158 unsigned long flags;
159 struct eeh_event *event, *tmp;
160
161 spin_lock_irqsave(&eeh_eventlist_lock, flags);
162 list_for_each_entry_safe(event, tmp, &eeh_eventlist, list) {
163 /*
164 * If we don't have valid PE passed in, that means
165 * we already have event corresponding to dead IOC
166 * and all events should be purged.
167 */
168 if (!pe) {
169 list_del(&event->list);
170 kfree(event);
171 } else if (pe->type & EEH_PE_PHB) {
172 if (event->pe && event->pe->phb == pe->phb) {
173 list_del(&event->list);
174 kfree(event);
175 }
176 } else if (event->pe == pe) {
177 list_del(&event->list);
178 kfree(event);
179 }
180 }
181 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
182}
diff --git a/arch/powerpc/platforms/pseries/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index fe43d1aa2cf1..016588a6f5ed 100644
--- a/arch/powerpc/platforms/pseries/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -22,6 +22,7 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include <linux/delay.h>
25#include <linux/export.h> 26#include <linux/export.h>
26#include <linux/gfp.h> 27#include <linux/gfp.h>
27#include <linux/init.h> 28#include <linux/init.h>
@@ -78,9 +79,7 @@ int eeh_phb_pe_create(struct pci_controller *phb)
78 } 79 }
79 80
80 /* Put it into the list */ 81 /* Put it into the list */
81 eeh_lock();
82 list_add_tail(&pe->child, &eeh_phb_pe); 82 list_add_tail(&pe->child, &eeh_phb_pe);
83 eeh_unlock();
84 83
85 pr_debug("EEH: Add PE for PHB#%d\n", phb->global_number); 84 pr_debug("EEH: Add PE for PHB#%d\n", phb->global_number);
86 85
@@ -95,7 +94,7 @@ int eeh_phb_pe_create(struct pci_controller *phb)
95 * hierarchy tree is composed of PHB PEs. The function is used 94 * hierarchy tree is composed of PHB PEs. The function is used
96 * to retrieve the corresponding PHB PE according to the given PHB. 95 * to retrieve the corresponding PHB PE according to the given PHB.
97 */ 96 */
98static struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb) 97struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb)
99{ 98{
100 struct eeh_pe *pe; 99 struct eeh_pe *pe;
101 100
@@ -185,21 +184,15 @@ void *eeh_pe_dev_traverse(struct eeh_pe *root,
185 return NULL; 184 return NULL;
186 } 185 }
187 186
188 eeh_lock();
189
190 /* Traverse root PE */ 187 /* Traverse root PE */
191 for (pe = root; pe; pe = eeh_pe_next(pe, root)) { 188 for (pe = root; pe; pe = eeh_pe_next(pe, root)) {
192 eeh_pe_for_each_dev(pe, edev) { 189 eeh_pe_for_each_dev(pe, edev) {
193 ret = fn(edev, flag); 190 ret = fn(edev, flag);
194 if (ret) { 191 if (ret)
195 eeh_unlock();
196 return ret; 192 return ret;
197 }
198 } 193 }
199 } 194 }
200 195
201 eeh_unlock();
202
203 return NULL; 196 return NULL;
204} 197}
205 198
@@ -228,7 +221,7 @@ static void *__eeh_pe_get(void *data, void *flag)
228 return pe; 221 return pe;
229 222
230 /* Try BDF address */ 223 /* Try BDF address */
231 if (edev->pe_config_addr && 224 if (edev->config_addr &&
232 (edev->config_addr == pe->config_addr)) 225 (edev->config_addr == pe->config_addr))
233 return pe; 226 return pe;
234 227
@@ -246,7 +239,7 @@ static void *__eeh_pe_get(void *data, void *flag)
246 * which is composed of PCI bus/device/function number, or unified 239 * which is composed of PCI bus/device/function number, or unified
247 * PE address. 240 * PE address.
248 */ 241 */
249static struct eeh_pe *eeh_pe_get(struct eeh_dev *edev) 242struct eeh_pe *eeh_pe_get(struct eeh_dev *edev)
250{ 243{
251 struct eeh_pe *root = eeh_phb_pe_get(edev->phb); 244 struct eeh_pe *root = eeh_phb_pe_get(edev->phb);
252 struct eeh_pe *pe; 245 struct eeh_pe *pe;
@@ -305,8 +298,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
305{ 298{
306 struct eeh_pe *pe, *parent; 299 struct eeh_pe *pe, *parent;
307 300
308 eeh_lock();
309
310 /* 301 /*
311 * Search the PE has been existing or not according 302 * Search the PE has been existing or not according
312 * to the PE address. If that has been existing, the 303 * to the PE address. If that has been existing, the
@@ -316,7 +307,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
316 pe = eeh_pe_get(edev); 307 pe = eeh_pe_get(edev);
317 if (pe && !(pe->type & EEH_PE_INVALID)) { 308 if (pe && !(pe->type & EEH_PE_INVALID)) {
318 if (!edev->pe_config_addr) { 309 if (!edev->pe_config_addr) {
319 eeh_unlock();
320 pr_err("%s: PE with addr 0x%x already exists\n", 310 pr_err("%s: PE with addr 0x%x already exists\n",
321 __func__, edev->config_addr); 311 __func__, edev->config_addr);
322 return -EEXIST; 312 return -EEXIST;
@@ -328,7 +318,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
328 318
329 /* Put the edev to PE */ 319 /* Put the edev to PE */
330 list_add_tail(&edev->list, &pe->edevs); 320 list_add_tail(&edev->list, &pe->edevs);
331 eeh_unlock();
332 pr_debug("EEH: Add %s to Bus PE#%x\n", 321 pr_debug("EEH: Add %s to Bus PE#%x\n",
333 edev->dn->full_name, pe->addr); 322 edev->dn->full_name, pe->addr);
334 323
@@ -347,7 +336,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
347 parent->type &= ~EEH_PE_INVALID; 336 parent->type &= ~EEH_PE_INVALID;
348 parent = parent->parent; 337 parent = parent->parent;
349 } 338 }
350 eeh_unlock();
351 pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", 339 pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n",
352 edev->dn->full_name, pe->addr, pe->parent->addr); 340 edev->dn->full_name, pe->addr, pe->parent->addr);
353 341
@@ -357,7 +345,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
357 /* Create a new EEH PE */ 345 /* Create a new EEH PE */
358 pe = eeh_pe_alloc(edev->phb, EEH_PE_DEVICE); 346 pe = eeh_pe_alloc(edev->phb, EEH_PE_DEVICE);
359 if (!pe) { 347 if (!pe) {
360 eeh_unlock();
361 pr_err("%s: out of memory!\n", __func__); 348 pr_err("%s: out of memory!\n", __func__);
362 return -ENOMEM; 349 return -ENOMEM;
363 } 350 }
@@ -365,6 +352,17 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
365 pe->config_addr = edev->config_addr; 352 pe->config_addr = edev->config_addr;
366 353
367 /* 354 /*
355 * While doing PE reset, we probably hot-reset the
356 * upstream bridge. However, the PCI devices including
357 * the associated EEH devices might be removed when EEH
358 * core is doing recovery. So that won't safe to retrieve
359 * the bridge through downstream EEH device. We have to
360 * trace the parent PCI bus, then the upstream bridge.
361 */
362 if (eeh_probe_mode_dev())
363 pe->bus = eeh_dev_to_pci_dev(edev)->bus;
364
365 /*
368 * Put the new EEH PE into hierarchy tree. If the parent 366 * Put the new EEH PE into hierarchy tree. If the parent
369 * can't be found, the newly created PE will be attached 367 * can't be found, the newly created PE will be attached
370 * to PHB directly. Otherwise, we have to associate the 368 * to PHB directly. Otherwise, we have to associate the
@@ -374,7 +372,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
374 if (!parent) { 372 if (!parent) {
375 parent = eeh_phb_pe_get(edev->phb); 373 parent = eeh_phb_pe_get(edev->phb);
376 if (!parent) { 374 if (!parent) {
377 eeh_unlock();
378 pr_err("%s: No PHB PE is found (PHB Domain=%d)\n", 375 pr_err("%s: No PHB PE is found (PHB Domain=%d)\n",
379 __func__, edev->phb->global_number); 376 __func__, edev->phb->global_number);
380 edev->pe = NULL; 377 edev->pe = NULL;
@@ -391,7 +388,6 @@ int eeh_add_to_parent_pe(struct eeh_dev *edev)
391 list_add_tail(&pe->child, &parent->child_list); 388 list_add_tail(&pe->child, &parent->child_list);
392 list_add_tail(&edev->list, &pe->edevs); 389 list_add_tail(&edev->list, &pe->edevs);
393 edev->pe = pe; 390 edev->pe = pe;
394 eeh_unlock();
395 pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", 391 pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n",
396 edev->dn->full_name, pe->addr, pe->parent->addr); 392 edev->dn->full_name, pe->addr, pe->parent->addr);
397 393
@@ -419,8 +415,6 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
419 return -EEXIST; 415 return -EEXIST;
420 } 416 }
421 417
422 eeh_lock();
423
424 /* Remove the EEH device */ 418 /* Remove the EEH device */
425 pe = edev->pe; 419 pe = edev->pe;
426 edev->pe = NULL; 420 edev->pe = NULL;
@@ -465,12 +459,37 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe)
465 pe = parent; 459 pe = parent;
466 } 460 }
467 461
468 eeh_unlock();
469
470 return 0; 462 return 0;
471} 463}
472 464
473/** 465/**
466 * eeh_pe_update_time_stamp - Update PE's frozen time stamp
467 * @pe: EEH PE
468 *
469 * We have time stamp for each PE to trace its time of getting
470 * frozen in last hour. The function should be called to update
471 * the time stamp on first error of the specific PE. On the other
472 * handle, we needn't account for errors happened in last hour.
473 */
474void eeh_pe_update_time_stamp(struct eeh_pe *pe)
475{
476 struct timeval tstamp;
477
478 if (!pe) return;
479
480 if (pe->freeze_count <= 0) {
481 pe->freeze_count = 0;
482 do_gettimeofday(&pe->tstamp);
483 } else {
484 do_gettimeofday(&tstamp);
485 if (tstamp.tv_sec - pe->tstamp.tv_sec > 3600) {
486 pe->tstamp = tstamp;
487 pe->freeze_count = 0;
488 }
489 }
490}
491
492/**
474 * __eeh_pe_state_mark - Mark the state for the PE 493 * __eeh_pe_state_mark - Mark the state for the PE
475 * @data: EEH PE 494 * @data: EEH PE
476 * @flag: state 495 * @flag: state
@@ -512,9 +531,7 @@ static void *__eeh_pe_state_mark(void *data, void *flag)
512 */ 531 */
513void eeh_pe_state_mark(struct eeh_pe *pe, int state) 532void eeh_pe_state_mark(struct eeh_pe *pe, int state)
514{ 533{
515 eeh_lock();
516 eeh_pe_traverse(pe, __eeh_pe_state_mark, &state); 534 eeh_pe_traverse(pe, __eeh_pe_state_mark, &state);
517 eeh_unlock();
518} 535}
519 536
520/** 537/**
@@ -548,35 +565,135 @@ static void *__eeh_pe_state_clear(void *data, void *flag)
548 */ 565 */
549void eeh_pe_state_clear(struct eeh_pe *pe, int state) 566void eeh_pe_state_clear(struct eeh_pe *pe, int state)
550{ 567{
551 eeh_lock();
552 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state); 568 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
553 eeh_unlock();
554} 569}
555 570
556/** 571/*
557 * eeh_restore_one_device_bars - Restore the Base Address Registers for one device 572 * Some PCI bridges (e.g. PLX bridges) have primary/secondary
558 * @data: EEH device 573 * buses assigned explicitly by firmware, and we probably have
559 * @flag: Unused 574 * lost that after reset. So we have to delay the check until
575 * the PCI-CFG registers have been restored for the parent
576 * bridge.
560 * 577 *
561 * Loads the PCI configuration space base address registers, 578 * Don't use normal PCI-CFG accessors, which probably has been
562 * the expansion ROM base address, the latency timer, and etc. 579 * blocked on normal path during the stage. So we need utilize
563 * from the saved values in the device node. 580 * eeh operations, which is always permitted.
564 */ 581 */
565static void *eeh_restore_one_device_bars(void *data, void *flag) 582static void eeh_bridge_check_link(struct pci_dev *pdev,
583 struct device_node *dn)
584{
585 int cap;
586 uint32_t val;
587 int timeout = 0;
588
589 /*
590 * We only check root port and downstream ports of
591 * PCIe switches
592 */
593 if (!pci_is_pcie(pdev) ||
594 (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT &&
595 pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM))
596 return;
597
598 pr_debug("%s: Check PCIe link for %s ...\n",
599 __func__, pci_name(pdev));
600
601 /* Check slot status */
602 cap = pdev->pcie_cap;
603 eeh_ops->read_config(dn, cap + PCI_EXP_SLTSTA, 2, &val);
604 if (!(val & PCI_EXP_SLTSTA_PDS)) {
605 pr_debug(" No card in the slot (0x%04x) !\n", val);
606 return;
607 }
608
609 /* Check power status if we have the capability */
610 eeh_ops->read_config(dn, cap + PCI_EXP_SLTCAP, 2, &val);
611 if (val & PCI_EXP_SLTCAP_PCP) {
612 eeh_ops->read_config(dn, cap + PCI_EXP_SLTCTL, 2, &val);
613 if (val & PCI_EXP_SLTCTL_PCC) {
614 pr_debug(" In power-off state, power it on ...\n");
615 val &= ~(PCI_EXP_SLTCTL_PCC | PCI_EXP_SLTCTL_PIC);
616 val |= (0x0100 & PCI_EXP_SLTCTL_PIC);
617 eeh_ops->write_config(dn, cap + PCI_EXP_SLTCTL, 2, val);
618 msleep(2 * 1000);
619 }
620 }
621
622 /* Enable link */
623 eeh_ops->read_config(dn, cap + PCI_EXP_LNKCTL, 2, &val);
624 val &= ~PCI_EXP_LNKCTL_LD;
625 eeh_ops->write_config(dn, cap + PCI_EXP_LNKCTL, 2, val);
626
627 /* Check link */
628 eeh_ops->read_config(dn, cap + PCI_EXP_LNKCAP, 4, &val);
629 if (!(val & PCI_EXP_LNKCAP_DLLLARC)) {
630 pr_debug(" No link reporting capability (0x%08x) \n", val);
631 msleep(1000);
632 return;
633 }
634
635 /* Wait the link is up until timeout (5s) */
636 timeout = 0;
637 while (timeout < 5000) {
638 msleep(20);
639 timeout += 20;
640
641 eeh_ops->read_config(dn, cap + PCI_EXP_LNKSTA, 2, &val);
642 if (val & PCI_EXP_LNKSTA_DLLLA)
643 break;
644 }
645
646 if (val & PCI_EXP_LNKSTA_DLLLA)
647 pr_debug(" Link up (%s)\n",
648 (val & PCI_EXP_LNKSTA_CLS_2_5GB) ? "2.5GB" : "5GB");
649 else
650 pr_debug(" Link not ready (0x%04x)\n", val);
651}
652
653#define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF))
654#define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)])
655
656static void eeh_restore_bridge_bars(struct pci_dev *pdev,
657 struct eeh_dev *edev,
658 struct device_node *dn)
659{
660 int i;
661
662 /*
663 * Device BARs: 0x10 - 0x18
664 * Bus numbers and windows: 0x18 - 0x30
665 */
666 for (i = 4; i < 13; i++)
667 eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]);
668 /* Rom: 0x38 */
669 eeh_ops->write_config(dn, 14*4, 4, edev->config_space[14]);
670
671 /* Cache line & Latency timer: 0xC 0xD */
672 eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1,
673 SAVED_BYTE(PCI_CACHE_LINE_SIZE));
674 eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1,
675 SAVED_BYTE(PCI_LATENCY_TIMER));
676 /* Max latency, min grant, interrupt ping and line: 0x3C */
677 eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]);
678
679 /* PCI Command: 0x4 */
680 eeh_ops->write_config(dn, PCI_COMMAND, 4, edev->config_space[1]);
681
682 /* Check the PCIe link is ready */
683 eeh_bridge_check_link(pdev, dn);
684}
685
686static void eeh_restore_device_bars(struct eeh_dev *edev,
687 struct device_node *dn)
566{ 688{
567 int i; 689 int i;
568 u32 cmd; 690 u32 cmd;
569 struct eeh_dev *edev = (struct eeh_dev *)data;
570 struct device_node *dn = eeh_dev_to_of_node(edev);
571 691
572 for (i = 4; i < 10; i++) 692 for (i = 4; i < 10; i++)
573 eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]); 693 eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]);
574 /* 12 == Expansion ROM Address */ 694 /* 12 == Expansion ROM Address */
575 eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]); 695 eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]);
576 696
577#define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF))
578#define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)])
579
580 eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1, 697 eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1,
581 SAVED_BYTE(PCI_CACHE_LINE_SIZE)); 698 SAVED_BYTE(PCI_CACHE_LINE_SIZE));
582 eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1, 699 eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1,
@@ -599,6 +716,34 @@ static void *eeh_restore_one_device_bars(void *data, void *flag)
599 else 716 else
600 cmd &= ~PCI_COMMAND_SERR; 717 cmd &= ~PCI_COMMAND_SERR;
601 eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd); 718 eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd);
719}
720
721/**
722 * eeh_restore_one_device_bars - Restore the Base Address Registers for one device
723 * @data: EEH device
724 * @flag: Unused
725 *
726 * Loads the PCI configuration space base address registers,
727 * the expansion ROM base address, the latency timer, and etc.
728 * from the saved values in the device node.
729 */
730static void *eeh_restore_one_device_bars(void *data, void *flag)
731{
732 struct pci_dev *pdev = NULL;
733 struct eeh_dev *edev = (struct eeh_dev *)data;
734 struct device_node *dn = eeh_dev_to_of_node(edev);
735
736 /* Trace the PCI bridge */
737 if (eeh_probe_mode_dev()) {
738 pdev = eeh_dev_to_pci_dev(edev);
739 if (pdev->hdr_type != PCI_HEADER_TYPE_BRIDGE)
740 pdev = NULL;
741 }
742
743 if (pdev)
744 eeh_restore_bridge_bars(pdev, edev, dn);
745 else
746 eeh_restore_device_bars(edev, dn);
602 747
603 return NULL; 748 return NULL;
604} 749}
@@ -635,18 +780,21 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
635 struct eeh_dev *edev; 780 struct eeh_dev *edev;
636 struct pci_dev *pdev; 781 struct pci_dev *pdev;
637 782
638 eeh_lock();
639
640 if (pe->type & EEH_PE_PHB) { 783 if (pe->type & EEH_PE_PHB) {
641 bus = pe->phb->bus; 784 bus = pe->phb->bus;
642 } else if (pe->type & EEH_PE_BUS) { 785 } else if (pe->type & EEH_PE_BUS ||
786 pe->type & EEH_PE_DEVICE) {
787 if (pe->bus) {
788 bus = pe->bus;
789 goto out;
790 }
791
643 edev = list_first_entry(&pe->edevs, struct eeh_dev, list); 792 edev = list_first_entry(&pe->edevs, struct eeh_dev, list);
644 pdev = eeh_dev_to_pci_dev(edev); 793 pdev = eeh_dev_to_pci_dev(edev);
645 if (pdev) 794 if (pdev)
646 bus = pdev->bus; 795 bus = pdev->bus;
647 } 796 }
648 797
649 eeh_unlock(); 798out:
650
651 return bus; 799 return bus;
652} 800}
diff --git a/arch/powerpc/platforms/pseries/eeh_sysfs.c b/arch/powerpc/kernel/eeh_sysfs.c
index d37708360f2e..e7ae3484918c 100644
--- a/arch/powerpc/platforms/pseries/eeh_sysfs.c
+++ b/arch/powerpc/kernel/eeh_sysfs.c
@@ -72,4 +72,3 @@ void eeh_sysfs_remove_device(struct pci_dev *pdev)
72 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); 72 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr);
73 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 73 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr);
74} 74}
75
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 246b11c4fe7e..ab15b8d057ad 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -465,20 +465,6 @@ BEGIN_FTR_SECTION
465 std r0, THREAD_EBBHR(r3) 465 std r0, THREAD_EBBHR(r3)
466 mfspr r0, SPRN_EBBRR 466 mfspr r0, SPRN_EBBRR
467 std r0, THREAD_EBBRR(r3) 467 std r0, THREAD_EBBRR(r3)
468
469 /* PMU registers made user read/(write) by EBB */
470 mfspr r0, SPRN_SIAR
471 std r0, THREAD_SIAR(r3)
472 mfspr r0, SPRN_SDAR
473 std r0, THREAD_SDAR(r3)
474 mfspr r0, SPRN_SIER
475 std r0, THREAD_SIER(r3)
476 mfspr r0, SPRN_MMCR0
477 std r0, THREAD_MMCR0(r3)
478 mfspr r0, SPRN_MMCR2
479 std r0, THREAD_MMCR2(r3)
480 mfspr r0, SPRN_MMCRA
481 std r0, THREAD_MMCRA(r3)
482END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) 468END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
483#endif 469#endif
484 470
@@ -581,20 +567,6 @@ BEGIN_FTR_SECTION
581 ld r0, THREAD_EBBRR(r4) 567 ld r0, THREAD_EBBRR(r4)
582 mtspr SPRN_EBBRR, r0 568 mtspr SPRN_EBBRR, r0
583 569
584 /* PMU registers made user read/(write) by EBB */
585 ld r0, THREAD_SIAR(r4)
586 mtspr SPRN_SIAR, r0
587 ld r0, THREAD_SDAR(r4)
588 mtspr SPRN_SDAR, r0
589 ld r0, THREAD_SIER(r4)
590 mtspr SPRN_SIER, r0
591 ld r0, THREAD_MMCR0(r4)
592 mtspr SPRN_MMCR0, r0
593 ld r0, THREAD_MMCR2(r4)
594 mtspr SPRN_MMCR2, r0
595 ld r0, THREAD_MMCRA(r4)
596 mtspr SPRN_MMCRA, r0
597
598 ld r0,THREAD_TAR(r4) 570 ld r0,THREAD_TAR(r4)
599 mtspr SPRN_TAR,r0 571 mtspr SPRN_TAR,r0
600END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) 572END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
@@ -657,21 +629,43 @@ _GLOBAL(ret_from_except_lite)
657 629
658 CURRENT_THREAD_INFO(r9, r1) 630 CURRENT_THREAD_INFO(r9, r1)
659 ld r3,_MSR(r1) 631 ld r3,_MSR(r1)
632#ifdef CONFIG_PPC_BOOK3E
633 ld r10,PACACURRENT(r13)
634#endif /* CONFIG_PPC_BOOK3E */
660 ld r4,TI_FLAGS(r9) 635 ld r4,TI_FLAGS(r9)
661 andi. r3,r3,MSR_PR 636 andi. r3,r3,MSR_PR
662 beq resume_kernel 637 beq resume_kernel
638#ifdef CONFIG_PPC_BOOK3E
639 lwz r3,(THREAD+THREAD_DBCR0)(r10)
640#endif /* CONFIG_PPC_BOOK3E */
663 641
664 /* Check current_thread_info()->flags */ 642 /* Check current_thread_info()->flags */
665 andi. r0,r4,_TIF_USER_WORK_MASK 643 andi. r0,r4,_TIF_USER_WORK_MASK
644#ifdef CONFIG_PPC_BOOK3E
645 bne 1f
646 /*
647 * Check to see if the dbcr0 register is set up to debug.
648 * Use the internal debug mode bit to do this.
649 */
650 andis. r0,r3,DBCR0_IDM@h
666 beq restore 651 beq restore
667 652 mfmsr r0
668 andi. r0,r4,_TIF_NEED_RESCHED 653 rlwinm r0,r0,0,~MSR_DE /* Clear MSR.DE */
669 beq 1f 654 mtmsr r0
655 mtspr SPRN_DBCR0,r3
656 li r10, -1
657 mtspr SPRN_DBSR,r10
658 b restore
659#else
660 beq restore
661#endif
6621: andi. r0,r4,_TIF_NEED_RESCHED
663 beq 2f
670 bl .restore_interrupts 664 bl .restore_interrupts
671 SCHEDULE_USER 665 SCHEDULE_USER
672 b .ret_from_except_lite 666 b .ret_from_except_lite
673 667
6741: bl .save_nvgprs 6682: bl .save_nvgprs
675 bl .restore_interrupts 669 bl .restore_interrupts
676 addi r3,r1,STACK_FRAME_OVERHEAD 670 addi r3,r1,STACK_FRAME_OVERHEAD
677 bl .do_notify_resume 671 bl .do_notify_resume
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index e6eba1bf61ad..4e00d223b2e3 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -341,10 +341,17 @@ vsx_unavailable_pSeries_1:
341 EXCEPTION_PROLOG_0(PACA_EXGEN) 341 EXCEPTION_PROLOG_0(PACA_EXGEN)
342 b vsx_unavailable_pSeries 342 b vsx_unavailable_pSeries
343 343
344facility_unavailable_trampoline:
344 . = 0xf60 345 . = 0xf60
345 SET_SCRATCH0(r13) 346 SET_SCRATCH0(r13)
346 EXCEPTION_PROLOG_0(PACA_EXGEN) 347 EXCEPTION_PROLOG_0(PACA_EXGEN)
347 b tm_unavailable_pSeries 348 b facility_unavailable_pSeries
349
350hv_facility_unavailable_trampoline:
351 . = 0xf80
352 SET_SCRATCH0(r13)
353 EXCEPTION_PROLOG_0(PACA_EXGEN)
354 b facility_unavailable_hv
348 355
349#ifdef CONFIG_CBE_RAS 356#ifdef CONFIG_CBE_RAS
350 STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error) 357 STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error)
@@ -454,38 +461,14 @@ BEGIN_FTR_SECTION
454 xori r10,r10,(MSR_FE0|MSR_FE1) 461 xori r10,r10,(MSR_FE0|MSR_FE1)
455 mtmsrd r10 462 mtmsrd r10
456 sync 463 sync
457 fmr 0,0 464
458 fmr 1,1 465#define FMR2(n) fmr (n), (n) ; fmr n+1, n+1
459 fmr 2,2 466#define FMR4(n) FMR2(n) ; FMR2(n+2)
460 fmr 3,3 467#define FMR8(n) FMR4(n) ; FMR4(n+4)
461 fmr 4,4 468#define FMR16(n) FMR8(n) ; FMR8(n+8)
462 fmr 5,5 469#define FMR32(n) FMR16(n) ; FMR16(n+16)
463 fmr 6,6 470 FMR32(0)
464 fmr 7,7 471
465 fmr 8,8
466 fmr 9,9
467 fmr 10,10
468 fmr 11,11
469 fmr 12,12
470 fmr 13,13
471 fmr 14,14
472 fmr 15,15
473 fmr 16,16
474 fmr 17,17
475 fmr 18,18
476 fmr 19,19
477 fmr 20,20
478 fmr 21,21
479 fmr 22,22
480 fmr 23,23
481 fmr 24,24
482 fmr 25,25
483 fmr 26,26
484 fmr 27,27
485 fmr 28,28
486 fmr 29,29
487 fmr 30,30
488 fmr 31,31
489FTR_SECTION_ELSE 472FTR_SECTION_ELSE
490/* 473/*
491 * To denormalise we need to move a copy of the register to itself. 474 * To denormalise we need to move a copy of the register to itself.
@@ -495,39 +478,25 @@ FTR_SECTION_ELSE
495 oris r10,r10,MSR_VSX@h 478 oris r10,r10,MSR_VSX@h
496 mtmsrd r10 479 mtmsrd r10
497 sync 480 sync
498 XVCPSGNDP(0,0,0) 481
499 XVCPSGNDP(1,1,1) 482#define XVCPSGNDP2(n) XVCPSGNDP(n,n,n) ; XVCPSGNDP(n+1,n+1,n+1)
500 XVCPSGNDP(2,2,2) 483#define XVCPSGNDP4(n) XVCPSGNDP2(n) ; XVCPSGNDP2(n+2)
501 XVCPSGNDP(3,3,3) 484#define XVCPSGNDP8(n) XVCPSGNDP4(n) ; XVCPSGNDP4(n+4)
502 XVCPSGNDP(4,4,4) 485#define XVCPSGNDP16(n) XVCPSGNDP8(n) ; XVCPSGNDP8(n+8)
503 XVCPSGNDP(5,5,5) 486#define XVCPSGNDP32(n) XVCPSGNDP16(n) ; XVCPSGNDP16(n+16)
504 XVCPSGNDP(6,6,6) 487 XVCPSGNDP32(0)
505 XVCPSGNDP(7,7,7) 488
506 XVCPSGNDP(8,8,8)
507 XVCPSGNDP(9,9,9)
508 XVCPSGNDP(10,10,10)
509 XVCPSGNDP(11,11,11)
510 XVCPSGNDP(12,12,12)
511 XVCPSGNDP(13,13,13)
512 XVCPSGNDP(14,14,14)
513 XVCPSGNDP(15,15,15)
514 XVCPSGNDP(16,16,16)
515 XVCPSGNDP(17,17,17)
516 XVCPSGNDP(18,18,18)
517 XVCPSGNDP(19,19,19)
518 XVCPSGNDP(20,20,20)
519 XVCPSGNDP(21,21,21)
520 XVCPSGNDP(22,22,22)
521 XVCPSGNDP(23,23,23)
522 XVCPSGNDP(24,24,24)
523 XVCPSGNDP(25,25,25)
524 XVCPSGNDP(26,26,26)
525 XVCPSGNDP(27,27,27)
526 XVCPSGNDP(28,28,28)
527 XVCPSGNDP(29,29,29)
528 XVCPSGNDP(30,30,30)
529 XVCPSGNDP(31,31,31)
530ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206) 489ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206)
490
491BEGIN_FTR_SECTION
492 b denorm_done
493END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
494/*
495 * To denormalise we need to move a copy of the register to itself.
496 * For POWER8 we need to do that for all 64 VSX registers
497 */
498 XVCPSGNDP32(32)
499denorm_done:
531 mtspr SPRN_HSRR0,r11 500 mtspr SPRN_HSRR0,r11
532 mtcrf 0x80,r9 501 mtcrf 0x80,r9
533 ld r9,PACA_EXGEN+EX_R9(r13) 502 ld r9,PACA_EXGEN+EX_R9(r13)
@@ -560,8 +529,10 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206)
560 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20) 529 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20)
561 STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) 530 STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
562 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40) 531 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40)
563 STD_EXCEPTION_PSERIES_OOL(0xf60, tm_unavailable) 532 STD_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
564 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf60) 533 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf60)
534 STD_EXCEPTION_HV_OOL(0xf82, facility_unavailable)
535 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xf82)
565 536
566/* 537/*
567 * An interrupt came in while soft-disabled. We set paca->irq_happened, then: 538 * An interrupt came in while soft-disabled. We set paca->irq_happened, then:
@@ -721,7 +692,7 @@ machine_check_common:
721 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception) 692 STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
722 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception) 693 STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
723 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception) 694 STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
724 STD_EXCEPTION_COMMON(0xe40, emulation_assist, .program_check_exception) 695 STD_EXCEPTION_COMMON(0xe40, emulation_assist, .emulation_assist_interrupt)
725 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception) 696 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
726#ifdef CONFIG_PPC_DOORBELL 697#ifdef CONFIG_PPC_DOORBELL
727 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, .doorbell_exception) 698 STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, .doorbell_exception)
@@ -831,14 +802,10 @@ system_call_relon_pSeries:
831 STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step) 802 STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step)
832 803
833 . = 0x4e00 804 . = 0x4e00
834 SET_SCRATCH0(r13) 805 b . /* Can't happen, see v2.07 Book III-S section 6.5 */
835 EXCEPTION_PROLOG_0(PACA_EXGEN)
836 b h_data_storage_relon_hv
837 806
838 . = 0x4e20 807 . = 0x4e20
839 SET_SCRATCH0(r13) 808 b . /* Can't happen, see v2.07 Book III-S section 6.5 */
840 EXCEPTION_PROLOG_0(PACA_EXGEN)
841 b h_instr_storage_relon_hv
842 809
843 . = 0x4e40 810 . = 0x4e40
844 SET_SCRATCH0(r13) 811 SET_SCRATCH0(r13)
@@ -846,9 +813,7 @@ system_call_relon_pSeries:
846 b emulation_assist_relon_hv 813 b emulation_assist_relon_hv
847 814
848 . = 0x4e60 815 . = 0x4e60
849 SET_SCRATCH0(r13) 816 b . /* Can't happen, see v2.07 Book III-S section 6.5 */
850 EXCEPTION_PROLOG_0(PACA_EXGEN)
851 b hmi_exception_relon_hv
852 817
853 . = 0x4e80 818 . = 0x4e80
854 SET_SCRATCH0(r13) 819 SET_SCRATCH0(r13)
@@ -873,11 +838,17 @@ vsx_unavailable_relon_pSeries_1:
873 EXCEPTION_PROLOG_0(PACA_EXGEN) 838 EXCEPTION_PROLOG_0(PACA_EXGEN)
874 b vsx_unavailable_relon_pSeries 839 b vsx_unavailable_relon_pSeries
875 840
876tm_unavailable_relon_pSeries_1: 841facility_unavailable_relon_trampoline:
877 . = 0x4f60 842 . = 0x4f60
878 SET_SCRATCH0(r13) 843 SET_SCRATCH0(r13)
879 EXCEPTION_PROLOG_0(PACA_EXGEN) 844 EXCEPTION_PROLOG_0(PACA_EXGEN)
880 b tm_unavailable_relon_pSeries 845 b facility_unavailable_relon_pSeries
846
847hv_facility_unavailable_relon_trampoline:
848 . = 0x4f80
849 SET_SCRATCH0(r13)
850 EXCEPTION_PROLOG_0(PACA_EXGEN)
851 b facility_unavailable_relon_hv
881 852
882 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint) 853 STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
883#ifdef CONFIG_PPC_DENORMALISATION 854#ifdef CONFIG_PPC_DENORMALISATION
@@ -1203,36 +1174,21 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1203 bl .vsx_unavailable_exception 1174 bl .vsx_unavailable_exception
1204 b .ret_from_except 1175 b .ret_from_except
1205 1176
1206 .align 7 1177 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
1207 .globl tm_unavailable_common
1208tm_unavailable_common:
1209 EXCEPTION_PROLOG_COMMON(0xf60, PACA_EXGEN)
1210 bl .save_nvgprs
1211 DISABLE_INTS
1212 addi r3,r1,STACK_FRAME_OVERHEAD
1213 bl .tm_unavailable_exception
1214 b .ret_from_except
1215 1178
1216 .align 7 1179 .align 7
1217 .globl __end_handlers 1180 .globl __end_handlers
1218__end_handlers: 1181__end_handlers:
1219 1182
1220 /* Equivalents to the above handlers for relocation-on interrupt vectors */ 1183 /* Equivalents to the above handlers for relocation-on interrupt vectors */
1221 STD_RELON_EXCEPTION_HV_OOL(0xe00, h_data_storage)
1222 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe00)
1223 STD_RELON_EXCEPTION_HV_OOL(0xe20, h_instr_storage)
1224 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe20)
1225 STD_RELON_EXCEPTION_HV_OOL(0xe40, emulation_assist) 1184 STD_RELON_EXCEPTION_HV_OOL(0xe40, emulation_assist)
1226 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe40)
1227 STD_RELON_EXCEPTION_HV_OOL(0xe60, hmi_exception)
1228 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe60)
1229 MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell) 1185 MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell)
1230 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe80)
1231 1186
1232 STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor) 1187 STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
1233 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable) 1188 STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
1234 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable) 1189 STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
1235 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, tm_unavailable) 1190 STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
1191 STD_RELON_EXCEPTION_HV_OOL(0xf80, facility_unavailable)
1236 1192
1237#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) 1193#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
1238/* 1194/*
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index a949bdfc9623..f0b47d1a6b0e 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -176,7 +176,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
176 length_max = 512 ; /* 64 doublewords */ 176 length_max = 512 ; /* 64 doublewords */
177 /* DAWR region can't cross 512 boundary */ 177 /* DAWR region can't cross 512 boundary */
178 if ((bp->attr.bp_addr >> 10) != 178 if ((bp->attr.bp_addr >> 10) !=
179 ((bp->attr.bp_addr + bp->attr.bp_len) >> 10)) 179 ((bp->attr.bp_addr + bp->attr.bp_len - 1) >> 10))
180 return -EINVAL; 180 return -EINVAL;
181 } 181 }
182 if (info->len > 182 if (info->len >
@@ -250,6 +250,7 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
250 * we still need to single-step the instruction, but we don't 250 * we still need to single-step the instruction, but we don't
251 * generate an event. 251 * generate an event.
252 */ 252 */
253 info->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ;
253 if (!((bp->attr.bp_addr <= dar) && 254 if (!((bp->attr.bp_addr <= dar) &&
254 (dar - bp->attr.bp_addr < bp->attr.bp_len))) 255 (dar - bp->attr.bp_addr < bp->attr.bp_len)))
255 info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ; 256 info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ;
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 8220baa46faf..16a7c2326d48 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -205,7 +205,7 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
205 return ret; 205 return ret;
206} 206}
207 207
208int ibmebus_register_driver(struct of_platform_driver *drv) 208int ibmebus_register_driver(struct platform_driver *drv)
209{ 209{
210 /* If the driver uses devices that ibmebus doesn't know, add them */ 210 /* If the driver uses devices that ibmebus doesn't know, add them */
211 ibmebus_create_devices(drv->driver.of_match_table); 211 ibmebus_create_devices(drv->driver.of_match_table);
@@ -215,7 +215,7 @@ int ibmebus_register_driver(struct of_platform_driver *drv)
215} 215}
216EXPORT_SYMBOL(ibmebus_register_driver); 216EXPORT_SYMBOL(ibmebus_register_driver);
217 217
218void ibmebus_unregister_driver(struct of_platform_driver *drv) 218void ibmebus_unregister_driver(struct platform_driver *drv)
219{ 219{
220 driver_unregister(&drv->driver); 220 driver_unregister(&drv->driver);
221} 221}
@@ -338,11 +338,10 @@ static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
338static int ibmebus_bus_device_probe(struct device *dev) 338static int ibmebus_bus_device_probe(struct device *dev)
339{ 339{
340 int error = -ENODEV; 340 int error = -ENODEV;
341 struct of_platform_driver *drv; 341 struct platform_driver *drv;
342 struct platform_device *of_dev; 342 struct platform_device *of_dev;
343 const struct of_device_id *match;
344 343
345 drv = to_of_platform_driver(dev->driver); 344 drv = to_platform_driver(dev->driver);
346 of_dev = to_platform_device(dev); 345 of_dev = to_platform_device(dev);
347 346
348 if (!drv->probe) 347 if (!drv->probe)
@@ -350,9 +349,8 @@ static int ibmebus_bus_device_probe(struct device *dev)
350 349
351 of_dev_get(of_dev); 350 of_dev_get(of_dev);
352 351
353 match = of_match_device(drv->driver.of_match_table, dev); 352 if (of_driver_match_device(dev, dev->driver))
354 if (match) 353 error = drv->probe(of_dev);
355 error = drv->probe(of_dev, match);
356 if (error) 354 if (error)
357 of_dev_put(of_dev); 355 of_dev_put(of_dev);
358 356
@@ -362,7 +360,7 @@ static int ibmebus_bus_device_probe(struct device *dev)
362static int ibmebus_bus_device_remove(struct device *dev) 360static int ibmebus_bus_device_remove(struct device *dev)
363{ 361{
364 struct platform_device *of_dev = to_platform_device(dev); 362 struct platform_device *of_dev = to_platform_device(dev);
365 struct of_platform_driver *drv = to_of_platform_driver(dev->driver); 363 struct platform_driver *drv = to_platform_driver(dev->driver);
366 364
367 if (dev->driver && drv->remove) 365 if (dev->driver && drv->remove)
368 drv->remove(of_dev); 366 drv->remove(of_dev);
@@ -372,7 +370,7 @@ static int ibmebus_bus_device_remove(struct device *dev)
372static void ibmebus_bus_device_shutdown(struct device *dev) 370static void ibmebus_bus_device_shutdown(struct device *dev)
373{ 371{
374 struct platform_device *of_dev = to_platform_device(dev); 372 struct platform_device *of_dev = to_platform_device(dev);
375 struct of_platform_driver *drv = to_of_platform_driver(dev->driver); 373 struct platform_driver *drv = to_platform_driver(dev->driver);
376 374
377 if (dev->driver && drv->shutdown) 375 if (dev->driver && drv->shutdown)
378 drv->shutdown(of_dev); 376 drv->shutdown(of_dev);
@@ -419,7 +417,7 @@ struct device_attribute ibmebus_bus_device_attrs[] = {
419static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg) 417static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
420{ 418{
421 struct platform_device *of_dev = to_platform_device(dev); 419 struct platform_device *of_dev = to_platform_device(dev);
422 struct of_platform_driver *drv = to_of_platform_driver(dev->driver); 420 struct platform_driver *drv = to_platform_driver(dev->driver);
423 int ret = 0; 421 int ret = 0;
424 422
425 if (dev->driver && drv->suspend) 423 if (dev->driver && drv->suspend)
@@ -430,7 +428,7 @@ static int ibmebus_bus_legacy_suspend(struct device *dev, pm_message_t mesg)
430static int ibmebus_bus_legacy_resume(struct device *dev) 428static int ibmebus_bus_legacy_resume(struct device *dev)
431{ 429{
432 struct platform_device *of_dev = to_platform_device(dev); 430 struct platform_device *of_dev = to_platform_device(dev);
433 struct of_platform_driver *drv = to_of_platform_driver(dev->driver); 431 struct platform_driver *drv = to_platform_driver(dev->driver);
434 int ret = 0; 432 int ret = 0;
435 433
436 if (dev->driver && drv->resume) 434 if (dev->driver && drv->resume)
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 939ea7ef0dc8..d7216c9abda1 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -85,7 +85,7 @@ int powersave_nap;
85/* 85/*
86 * Register the sysctl to set/clear powersave_nap. 86 * Register the sysctl to set/clear powersave_nap.
87 */ 87 */
88static ctl_table powersave_nap_ctl_table[]={ 88static struct ctl_table powersave_nap_ctl_table[] = {
89 { 89 {
90 .procname = "powersave-nap", 90 .procname = "powersave-nap",
91 .data = &powersave_nap, 91 .data = &powersave_nap,
@@ -95,7 +95,7 @@ static ctl_table powersave_nap_ctl_table[]={
95 }, 95 },
96 {} 96 {}
97}; 97};
98static ctl_table powersave_nap_sysctl_root[] = { 98static struct ctl_table powersave_nap_sysctl_root[] = {
99 { 99 {
100 .procname = "kernel", 100 .procname = "kernel",
101 .mode = 0555, 101 .mode = 0555,
diff --git a/arch/powerpc/kernel/io-workarounds.c b/arch/powerpc/kernel/io-workarounds.c
index 50e90b7e7139..fa0b54b2a362 100644
--- a/arch/powerpc/kernel/io-workarounds.c
+++ b/arch/powerpc/kernel/io-workarounds.c
@@ -55,6 +55,7 @@ static struct iowa_bus *iowa_pci_find(unsigned long vaddr, unsigned long paddr)
55 55
56struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) 56struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
57{ 57{
58 unsigned hugepage_shift;
58 struct iowa_bus *bus; 59 struct iowa_bus *bus;
59 int token; 60 int token;
60 61
@@ -70,11 +71,17 @@ struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
70 if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END) 71 if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END)
71 return NULL; 72 return NULL;
72 73
73 ptep = find_linux_pte(init_mm.pgd, vaddr); 74 ptep = find_linux_pte_or_hugepte(init_mm.pgd, vaddr,
75 &hugepage_shift);
74 if (ptep == NULL) 76 if (ptep == NULL)
75 paddr = 0; 77 paddr = 0;
76 else 78 else {
79 /*
80 * we don't have hugepages backing iomem
81 */
82 WARN_ON(hugepage_shift);
77 paddr = pte_pfn(*ptep) << PAGE_SHIFT; 83 paddr = pte_pfn(*ptep) << PAGE_SHIFT;
84 }
78 bus = iowa_pci_find(vaddr, paddr); 85 bus = iowa_pci_find(vaddr, paddr);
79 86
80 if (bus == NULL) 87 if (bus == NULL)
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index c0d0dbddfba1..b20ff173a671 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -36,6 +36,8 @@
36#include <linux/hash.h> 36#include <linux/hash.h>
37#include <linux/fault-inject.h> 37#include <linux/fault-inject.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/iommu.h>
40#include <linux/sched.h>
39#include <asm/io.h> 41#include <asm/io.h>
40#include <asm/prom.h> 42#include <asm/prom.h>
41#include <asm/iommu.h> 43#include <asm/iommu.h>
@@ -44,6 +46,7 @@
44#include <asm/kdump.h> 46#include <asm/kdump.h>
45#include <asm/fadump.h> 47#include <asm/fadump.h>
46#include <asm/vio.h> 48#include <asm/vio.h>
49#include <asm/tce.h>
47 50
48#define DBG(...) 51#define DBG(...)
49 52
@@ -724,6 +727,13 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
724 if (tbl->it_offset == 0) 727 if (tbl->it_offset == 0)
725 clear_bit(0, tbl->it_map); 728 clear_bit(0, tbl->it_map);
726 729
730#ifdef CONFIG_IOMMU_API
731 if (tbl->it_group) {
732 iommu_group_put(tbl->it_group);
733 BUG_ON(tbl->it_group);
734 }
735#endif
736
727 /* verify that table contains no entries */ 737 /* verify that table contains no entries */
728 if (!bitmap_empty(tbl->it_map, tbl->it_size)) 738 if (!bitmap_empty(tbl->it_map, tbl->it_size))
729 pr_warn("%s: Unexpected TCEs for %s\n", __func__, node_name); 739 pr_warn("%s: Unexpected TCEs for %s\n", __func__, node_name);
@@ -860,3 +870,316 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size,
860 free_pages((unsigned long)vaddr, get_order(size)); 870 free_pages((unsigned long)vaddr, get_order(size));
861 } 871 }
862} 872}
873
874#ifdef CONFIG_IOMMU_API
875/*
876 * SPAPR TCE API
877 */
878static void group_release(void *iommu_data)
879{
880 struct iommu_table *tbl = iommu_data;
881 tbl->it_group = NULL;
882}
883
884void iommu_register_group(struct iommu_table *tbl,
885 int pci_domain_number, unsigned long pe_num)
886{
887 struct iommu_group *grp;
888 char *name;
889
890 grp = iommu_group_alloc();
891 if (IS_ERR(grp)) {
892 pr_warn("powerpc iommu api: cannot create new group, err=%ld\n",
893 PTR_ERR(grp));
894 return;
895 }
896 tbl->it_group = grp;
897 iommu_group_set_iommudata(grp, tbl, group_release);
898 name = kasprintf(GFP_KERNEL, "domain%d-pe%lx",
899 pci_domain_number, pe_num);
900 if (!name)
901 return;
902 iommu_group_set_name(grp, name);
903 kfree(name);
904}
905
906enum dma_data_direction iommu_tce_direction(unsigned long tce)
907{
908 if ((tce & TCE_PCI_READ) && (tce & TCE_PCI_WRITE))
909 return DMA_BIDIRECTIONAL;
910 else if (tce & TCE_PCI_READ)
911 return DMA_TO_DEVICE;
912 else if (tce & TCE_PCI_WRITE)
913 return DMA_FROM_DEVICE;
914 else
915 return DMA_NONE;
916}
917EXPORT_SYMBOL_GPL(iommu_tce_direction);
918
919void iommu_flush_tce(struct iommu_table *tbl)
920{
921 /* Flush/invalidate TLB caches if necessary */
922 if (ppc_md.tce_flush)
923 ppc_md.tce_flush(tbl);
924
925 /* Make sure updates are seen by hardware */
926 mb();
927}
928EXPORT_SYMBOL_GPL(iommu_flush_tce);
929
930int iommu_tce_clear_param_check(struct iommu_table *tbl,
931 unsigned long ioba, unsigned long tce_value,
932 unsigned long npages)
933{
934 /* ppc_md.tce_free() does not support any value but 0 */
935 if (tce_value)
936 return -EINVAL;
937
938 if (ioba & ~IOMMU_PAGE_MASK)
939 return -EINVAL;
940
941 ioba >>= IOMMU_PAGE_SHIFT;
942 if (ioba < tbl->it_offset)
943 return -EINVAL;
944
945 if ((ioba + npages) > (tbl->it_offset + tbl->it_size))
946 return -EINVAL;
947
948 return 0;
949}
950EXPORT_SYMBOL_GPL(iommu_tce_clear_param_check);
951
952int iommu_tce_put_param_check(struct iommu_table *tbl,
953 unsigned long ioba, unsigned long tce)
954{
955 if (!(tce & (TCE_PCI_WRITE | TCE_PCI_READ)))
956 return -EINVAL;
957
958 if (tce & ~(IOMMU_PAGE_MASK | TCE_PCI_WRITE | TCE_PCI_READ))
959 return -EINVAL;
960
961 if (ioba & ~IOMMU_PAGE_MASK)
962 return -EINVAL;
963
964 ioba >>= IOMMU_PAGE_SHIFT;
965 if (ioba < tbl->it_offset)
966 return -EINVAL;
967
968 if ((ioba + 1) > (tbl->it_offset + tbl->it_size))
969 return -EINVAL;
970
971 return 0;
972}
973EXPORT_SYMBOL_GPL(iommu_tce_put_param_check);
974
975unsigned long iommu_clear_tce(struct iommu_table *tbl, unsigned long entry)
976{
977 unsigned long oldtce;
978 struct iommu_pool *pool = get_pool(tbl, entry);
979
980 spin_lock(&(pool->lock));
981
982 oldtce = ppc_md.tce_get(tbl, entry);
983 if (oldtce & (TCE_PCI_WRITE | TCE_PCI_READ))
984 ppc_md.tce_free(tbl, entry, 1);
985 else
986 oldtce = 0;
987
988 spin_unlock(&(pool->lock));
989
990 return oldtce;
991}
992EXPORT_SYMBOL_GPL(iommu_clear_tce);
993
994int iommu_clear_tces_and_put_pages(struct iommu_table *tbl,
995 unsigned long entry, unsigned long pages)
996{
997 unsigned long oldtce;
998 struct page *page;
999
1000 for ( ; pages; --pages, ++entry) {
1001 oldtce = iommu_clear_tce(tbl, entry);
1002 if (!oldtce)
1003 continue;
1004
1005 page = pfn_to_page(oldtce >> PAGE_SHIFT);
1006 WARN_ON(!page);
1007 if (page) {
1008 if (oldtce & TCE_PCI_WRITE)
1009 SetPageDirty(page);
1010 put_page(page);
1011 }
1012 }
1013
1014 return 0;
1015}
1016EXPORT_SYMBOL_GPL(iommu_clear_tces_and_put_pages);
1017
1018/*
1019 * hwaddr is a kernel virtual address here (0xc... bazillion),
1020 * tce_build converts it to a physical address.
1021 */
1022int iommu_tce_build(struct iommu_table *tbl, unsigned long entry,
1023 unsigned long hwaddr, enum dma_data_direction direction)
1024{
1025 int ret = -EBUSY;
1026 unsigned long oldtce;
1027 struct iommu_pool *pool = get_pool(tbl, entry);
1028
1029 spin_lock(&(pool->lock));
1030
1031 oldtce = ppc_md.tce_get(tbl, entry);
1032 /* Add new entry if it is not busy */
1033 if (!(oldtce & (TCE_PCI_WRITE | TCE_PCI_READ)))
1034 ret = ppc_md.tce_build(tbl, entry, 1, hwaddr, direction, NULL);
1035
1036 spin_unlock(&(pool->lock));
1037
1038 /* if (unlikely(ret))
1039 pr_err("iommu_tce: %s failed on hwaddr=%lx ioba=%lx kva=%lx ret=%d\n",
1040 __func__, hwaddr, entry << IOMMU_PAGE_SHIFT,
1041 hwaddr, ret); */
1042
1043 return ret;
1044}
1045EXPORT_SYMBOL_GPL(iommu_tce_build);
1046
1047int iommu_put_tce_user_mode(struct iommu_table *tbl, unsigned long entry,
1048 unsigned long tce)
1049{
1050 int ret;
1051 struct page *page = NULL;
1052 unsigned long hwaddr, offset = tce & IOMMU_PAGE_MASK & ~PAGE_MASK;
1053 enum dma_data_direction direction = iommu_tce_direction(tce);
1054
1055 ret = get_user_pages_fast(tce & PAGE_MASK, 1,
1056 direction != DMA_TO_DEVICE, &page);
1057 if (unlikely(ret != 1)) {
1058 /* pr_err("iommu_tce: get_user_pages_fast failed tce=%lx ioba=%lx ret=%d\n",
1059 tce, entry << IOMMU_PAGE_SHIFT, ret); */
1060 return -EFAULT;
1061 }
1062 hwaddr = (unsigned long) page_address(page) + offset;
1063
1064 ret = iommu_tce_build(tbl, entry, hwaddr, direction);
1065 if (ret)
1066 put_page(page);
1067
1068 if (ret < 0)
1069 pr_err("iommu_tce: %s failed ioba=%lx, tce=%lx, ret=%d\n",
1070 __func__, entry << IOMMU_PAGE_SHIFT, tce, ret);
1071
1072 return ret;
1073}
1074EXPORT_SYMBOL_GPL(iommu_put_tce_user_mode);
1075
1076int iommu_take_ownership(struct iommu_table *tbl)
1077{
1078 unsigned long sz = (tbl->it_size + 7) >> 3;
1079
1080 if (tbl->it_offset == 0)
1081 clear_bit(0, tbl->it_map);
1082
1083 if (!bitmap_empty(tbl->it_map, tbl->it_size)) {
1084 pr_err("iommu_tce: it_map is not empty");
1085 return -EBUSY;
1086 }
1087
1088 memset(tbl->it_map, 0xff, sz);
1089 iommu_clear_tces_and_put_pages(tbl, tbl->it_offset, tbl->it_size);
1090
1091 return 0;
1092}
1093EXPORT_SYMBOL_GPL(iommu_take_ownership);
1094
1095void iommu_release_ownership(struct iommu_table *tbl)
1096{
1097 unsigned long sz = (tbl->it_size + 7) >> 3;
1098
1099 iommu_clear_tces_and_put_pages(tbl, tbl->it_offset, tbl->it_size);
1100 memset(tbl->it_map, 0, sz);
1101
1102 /* Restore bit#0 set by iommu_init_table() */
1103 if (tbl->it_offset == 0)
1104 set_bit(0, tbl->it_map);
1105}
1106EXPORT_SYMBOL_GPL(iommu_release_ownership);
1107
1108static int iommu_add_device(struct device *dev)
1109{
1110 struct iommu_table *tbl;
1111 int ret = 0;
1112
1113 if (WARN_ON(dev->iommu_group)) {
1114 pr_warn("iommu_tce: device %s is already in iommu group %d, skipping\n",
1115 dev_name(dev),
1116 iommu_group_id(dev->iommu_group));
1117 return -EBUSY;
1118 }
1119
1120 tbl = get_iommu_table_base(dev);
1121 if (!tbl || !tbl->it_group) {
1122 pr_debug("iommu_tce: skipping device %s with no tbl\n",
1123 dev_name(dev));
1124 return 0;
1125 }
1126
1127 pr_debug("iommu_tce: adding %s to iommu group %d\n",
1128 dev_name(dev), iommu_group_id(tbl->it_group));
1129
1130 ret = iommu_group_add_device(tbl->it_group, dev);
1131 if (ret < 0)
1132 pr_err("iommu_tce: %s has not been added, ret=%d\n",
1133 dev_name(dev), ret);
1134
1135 return ret;
1136}
1137
1138static void iommu_del_device(struct device *dev)
1139{
1140 iommu_group_remove_device(dev);
1141}
1142
1143static int iommu_bus_notifier(struct notifier_block *nb,
1144 unsigned long action, void *data)
1145{
1146 struct device *dev = data;
1147
1148 switch (action) {
1149 case BUS_NOTIFY_ADD_DEVICE:
1150 return iommu_add_device(dev);
1151 case BUS_NOTIFY_DEL_DEVICE:
1152 iommu_del_device(dev);
1153 return 0;
1154 default:
1155 return 0;
1156 }
1157}
1158
1159static struct notifier_block tce_iommu_bus_nb = {
1160 .notifier_call = iommu_bus_notifier,
1161};
1162
1163static int __init tce_iommu_init(void)
1164{
1165 struct pci_dev *pdev = NULL;
1166
1167 BUILD_BUG_ON(PAGE_SIZE < IOMMU_PAGE_SIZE);
1168
1169 for_each_pci_dev(pdev)
1170 iommu_add_device(&pdev->dev);
1171
1172 bus_register_notifier(&pci_bus_type, &tce_iommu_bus_nb);
1173 return 0;
1174}
1175
1176subsys_initcall_sync(tce_iommu_init);
1177
1178#else
1179
1180void iommu_register_group(struct iommu_table *tbl,
1181 int pci_domain_number, unsigned long pe_num)
1182{
1183}
1184
1185#endif /* CONFIG_IOMMU_API */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5cbcf4d5a808..2e51cde616d2 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -116,8 +116,6 @@ static inline notrace int decrementer_check_overflow(void)
116 u64 now = get_tb_or_rtc(); 116 u64 now = get_tb_or_rtc();
117 u64 *next_tb = &__get_cpu_var(decrementers_next_tb); 117 u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
118 118
119 if (now >= *next_tb)
120 set_dec(1);
121 return now >= *next_tb; 119 return now >= *next_tb;
122} 120}
123 121
@@ -162,7 +160,7 @@ notrace unsigned int __check_irq_replay(void)
162 * in case we also had a rollover while hard disabled 160 * in case we also had a rollover while hard disabled
163 */ 161 */
164 local_paca->irq_happened &= ~PACA_IRQ_DEC; 162 local_paca->irq_happened &= ~PACA_IRQ_DEC;
165 if (decrementer_check_overflow()) 163 if ((happened & PACA_IRQ_DEC) || decrementer_check_overflow())
166 return 0x900; 164 return 0x900;
167 165
168 /* Finally check if an external interrupt happened */ 166 /* Finally check if an external interrupt happened */
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 11f5b03a0b06..2156ea90eb54 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -36,12 +36,6 @@
36#include <asm/sstep.h> 36#include <asm/sstep.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38 38
39#ifdef CONFIG_PPC_ADV_DEBUG_REGS
40#define MSR_SINGLESTEP (MSR_DE)
41#else
42#define MSR_SINGLESTEP (MSR_SE)
43#endif
44
45DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 39DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
46DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 40DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
47 41
@@ -104,19 +98,7 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
104 98
105static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 99static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
106{ 100{
107 /* We turn off async exceptions to ensure that the single step will 101 enable_single_step(regs);
108 * be for the instruction we have the kprobe on, if we dont its
109 * possible we'd get the single step reported for an exception handler
110 * like Decrementer or External Interrupt */
111 regs->msr &= ~MSR_EE;
112 regs->msr |= MSR_SINGLESTEP;
113#ifdef CONFIG_PPC_ADV_DEBUG_REGS
114 regs->msr &= ~MSR_CE;
115 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
116#ifdef CONFIG_PPC_47x
117 isync();
118#endif
119#endif
120 102
121 /* 103 /*
122 * On powerpc we should single step on the original 104 * On powerpc we should single step on the original
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 6782221d49bd..db28032e320e 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -750,13 +750,8 @@ EXPORT_SYMBOL_GPL(kvm_hypercall);
750 750
751static __init void kvm_free_tmp(void) 751static __init void kvm_free_tmp(void)
752{ 752{
753 unsigned long start, end; 753 free_reserved_area(&kvm_tmp[kvm_tmp_index],
754 754 &kvm_tmp[ARRAY_SIZE(kvm_tmp)], -1, NULL);
755 start = (ulong)&kvm_tmp[kvm_tmp_index + (PAGE_SIZE - 1)] & PAGE_MASK;
756 end = (ulong)&kvm_tmp[ARRAY_SIZE(kvm_tmp)] & PAGE_MASK;
757
758 /* Free the tmp space we don't need */
759 free_reserved_area(start, end, 0, NULL);
760} 755}
761 756
762static int __init kvm_guest_init(void) 757static int __init kvm_guest_init(void)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 48fbc2b97e95..8213ee1eb05a 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -84,22 +84,30 @@ static ssize_t dev_nvram_read(struct file *file, char __user *buf,
84 char *tmp = NULL; 84 char *tmp = NULL;
85 ssize_t size; 85 ssize_t size;
86 86
87 ret = -ENODEV; 87 if (!ppc_md.nvram_size) {
88 if (!ppc_md.nvram_size) 88 ret = -ENODEV;
89 goto out; 89 goto out;
90 }
90 91
91 ret = 0;
92 size = ppc_md.nvram_size(); 92 size = ppc_md.nvram_size();
93 if (*ppos >= size || size < 0) 93 if (size < 0) {
94 ret = size;
95 goto out;
96 }
97
98 if (*ppos >= size) {
99 ret = 0;
94 goto out; 100 goto out;
101 }
95 102
96 count = min_t(size_t, count, size - *ppos); 103 count = min_t(size_t, count, size - *ppos);
97 count = min(count, PAGE_SIZE); 104 count = min(count, PAGE_SIZE);
98 105
99 ret = -ENOMEM;
100 tmp = kmalloc(count, GFP_KERNEL); 106 tmp = kmalloc(count, GFP_KERNEL);
101 if (!tmp) 107 if (!tmp) {
108 ret = -ENOMEM;
102 goto out; 109 goto out;
110 }
103 111
104 ret = ppc_md.nvram_read(tmp, count, ppos); 112 ret = ppc_md.nvram_read(tmp, count, ppos);
105 if (ret <= 0) 113 if (ret <= 0)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 7f2273cc3c7d..f46914a0f33e 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -827,6 +827,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
827 } 827 }
828 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 828 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
829 struct resource *res = dev->resource + i; 829 struct resource *res = dev->resource + i;
830 struct pci_bus_region reg;
830 if (!res->flags) 831 if (!res->flags)
831 continue; 832 continue;
832 833
@@ -835,8 +836,9 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set 836 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set
836 * since in that case, we don't want to re-assign anything 837 * since in that case, we don't want to re-assign anything
837 */ 838 */
839 pcibios_resource_to_bus(dev, &reg, res);
838 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || 840 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) ||
839 (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { 841 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
840 /* Only print message if not re-assigning */ 842 /* Only print message if not re-assigning */
841 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) 843 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC))
842 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " 844 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] "
@@ -992,7 +994,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus)
992 ppc_md.pci_dma_bus_setup(bus); 994 ppc_md.pci_dma_bus_setup(bus);
993} 995}
994 996
995void pcibios_setup_device(struct pci_dev *dev) 997static void pcibios_setup_device(struct pci_dev *dev)
996{ 998{
997 /* Fixup NUMA node as it may not be setup yet by the generic 999 /* Fixup NUMA node as it may not be setup yet by the generic
998 * code and is needed by the DMA init 1000 * code and is needed by the DMA init
@@ -1013,6 +1015,17 @@ void pcibios_setup_device(struct pci_dev *dev)
1013 ppc_md.pci_irq_fixup(dev); 1015 ppc_md.pci_irq_fixup(dev);
1014} 1016}
1015 1017
1018int pcibios_add_device(struct pci_dev *dev)
1019{
1020 /*
1021 * We can only call pcibios_setup_device() after bus setup is complete,
1022 * since some of the platform specific DMA setup code depends on it.
1023 */
1024 if (dev->bus->is_added)
1025 pcibios_setup_device(dev);
1026 return 0;
1027}
1028
1016void pcibios_setup_bus_devices(struct pci_bus *bus) 1029void pcibios_setup_bus_devices(struct pci_bus *bus)
1017{ 1030{
1018 struct pci_dev *dev; 1031 struct pci_dev *dev;
@@ -1467,10 +1480,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1467 if (ppc_md.pcibios_enable_device_hook(dev)) 1480 if (ppc_md.pcibios_enable_device_hook(dev))
1468 return -EINVAL; 1481 return -EINVAL;
1469 1482
1470 /* avoid pcie irq fix up impact on cardbus */
1471 if (dev->hdr_type != PCI_HEADER_TYPE_CARDBUS)
1472 pcibios_setup_device(dev);
1473
1474 return pci_enable_resources(dev, mask); 1483 return pci_enable_resources(dev, mask);
1475} 1484}
1476 1485
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
new file mode 100644
index 000000000000..3f608800c06b
--- /dev/null
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -0,0 +1,111 @@
1/*
2 * Derived from "arch/powerpc/platforms/pseries/pci_dlpar.c"
3 *
4 * Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
5 * Copyright (C) 2005 International Business Machines
6 *
7 * Updates, 2005, John Rose <johnrose@austin.ibm.com>
8 * Updates, 2005, Linas Vepstas <linas@austin.ibm.com>
9 * Updates, 2013, Gavin Shan <shangw@linux.vnet.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 */
16
17#include <linux/pci.h>
18#include <linux/export.h>
19#include <asm/pci-bridge.h>
20#include <asm/ppc-pci.h>
21#include <asm/firmware.h>
22#include <asm/eeh.h>
23
24/**
25 * __pcibios_remove_pci_devices - remove all devices under this bus
26 * @bus: the indicated PCI bus
27 * @purge_pe: destroy the PE on removal of PCI devices
28 *
29 * Remove all of the PCI devices under this bus both from the
30 * linux pci device tree, and from the powerpc EEH address cache.
31 * By default, the corresponding PE will be destroied during the
32 * normal PCI hotplug path. For PCI hotplug during EEH recovery,
33 * the corresponding PE won't be destroied and deallocated.
34 */
35void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe)
36{
37 struct pci_dev *dev, *tmp;
38 struct pci_bus *child_bus;
39
40 /* First go down child busses */
41 list_for_each_entry(child_bus, &bus->children, node)
42 __pcibios_remove_pci_devices(child_bus, purge_pe);
43
44 pr_debug("PCI: Removing devices on bus %04x:%02x\n",
45 pci_domain_nr(bus), bus->number);
46 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
47 pr_debug(" * Removing %s...\n", pci_name(dev));
48 eeh_remove_bus_device(dev, purge_pe);
49 pci_stop_and_remove_bus_device(dev);
50 }
51}
52
53/**
54 * pcibios_remove_pci_devices - remove all devices under this bus
55 * @bus: the indicated PCI bus
56 *
57 * Remove all of the PCI devices under this bus both from the
58 * linux pci device tree, and from the powerpc EEH address cache.
59 */
60void pcibios_remove_pci_devices(struct pci_bus *bus)
61{
62 __pcibios_remove_pci_devices(bus, 1);
63}
64EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
65
66/**
67 * pcibios_add_pci_devices - adds new pci devices to bus
68 * @bus: the indicated PCI bus
69 *
70 * This routine will find and fixup new pci devices under
71 * the indicated bus. This routine presumes that there
72 * might already be some devices under this bridge, so
73 * it carefully tries to add only new devices. (And that
74 * is how this routine differs from other, similar pcibios
75 * routines.)
76 */
77void pcibios_add_pci_devices(struct pci_bus * bus)
78{
79 int slotno, num, mode, pass, max;
80 struct pci_dev *dev;
81 struct device_node *dn = pci_bus_to_OF_node(bus);
82
83 eeh_add_device_tree_early(dn);
84
85 mode = PCI_PROBE_NORMAL;
86 if (ppc_md.pci_probe_mode)
87 mode = ppc_md.pci_probe_mode(bus);
88
89 if (mode == PCI_PROBE_DEVTREE) {
90 /* use ofdt-based probe */
91 of_rescan_bus(dn, bus);
92 } else if (mode == PCI_PROBE_NORMAL) {
93 /* use legacy probe */
94 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
95 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
96 if (!num)
97 return;
98 pcibios_setup_bus_devices(bus);
99 max = bus->busn_res.start;
100 for (pass = 0; pass < 2; pass++) {
101 list_for_each_entry(dev, &bus->devices, bus_list) {
102 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
103 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
104 max = pci_scan_bridge(bus, dev,
105 max, pass);
106 }
107 }
108 }
109 pcibios_finish_adding_to_bus(bus);
110}
111EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 2a67e9baa59f..6b0ba5854d99 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -128,7 +128,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
128 const char *type; 128 const char *type;
129 struct pci_slot *slot; 129 struct pci_slot *slot;
130 130
131 dev = alloc_pci_dev(); 131 dev = pci_alloc_dev(bus);
132 if (!dev) 132 if (!dev)
133 return NULL; 133 return NULL;
134 type = of_get_property(node, "device_type", NULL); 134 type = of_get_property(node, "device_type", NULL);
@@ -137,7 +137,6 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
137 137
138 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type); 138 pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
139 139
140 dev->bus = bus;
141 dev->dev.of_node = of_node_get(node); 140 dev->dev.of_node = of_node_get(node);
142 dev->dev.parent = bus->bridge; 141 dev->dev.parent = bus->bridge;
143 dev->dev.bus = &pci_bus_type; 142 dev->dev.bus = &pci_bus_type;
@@ -165,7 +164,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
165 pr_debug(" class: 0x%x\n", dev->class); 164 pr_debug(" class: 0x%x\n", dev->class);
166 pr_debug(" revision: 0x%x\n", dev->revision); 165 pr_debug(" revision: 0x%x\n", dev->revision);
167 166
168 dev->current_state = 4; /* unknown power state */ 167 dev->current_state = PCI_UNKNOWN; /* unknown power state */
169 dev->error_state = pci_channel_io_normal; 168 dev->error_state = pci_channel_io_normal;
170 dev->dma_mask = 0xffffffff; 169 dev->dma_mask = 0xffffffff;
171 170
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
index feb8580fdc84..c30612aad68e 100644
--- a/arch/powerpc/kernel/proc_powerpc.c
+++ b/arch/powerpc/kernel/proc_powerpc.c
@@ -29,25 +29,9 @@
29 29
30#ifdef CONFIG_PPC64 30#ifdef CONFIG_PPC64
31 31
32static loff_t page_map_seek( struct file *file, loff_t off, int whence) 32static loff_t page_map_seek(struct file *file, loff_t off, int whence)
33{ 33{
34 loff_t new; 34 return fixed_size_llseek(file, off, whence, PAGE_SIZE);
35 switch(whence) {
36 case 0:
37 new = off;
38 break;
39 case 1:
40 new = file->f_pos + off;
41 break;
42 case 2:
43 new = PAGE_SIZE + off;
44 break;
45 default:
46 return -EINVAL;
47 }
48 if ( new < 0 || new > PAGE_SIZE )
49 return -EINVAL;
50 return (file->f_pos = new);
51} 35}
52 36
53static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, 37static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index a902723fdc69..c517dbe705fd 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -399,7 +399,8 @@ static inline int __set_dabr(unsigned long dabr, unsigned long dabrx)
399static inline int __set_dabr(unsigned long dabr, unsigned long dabrx) 399static inline int __set_dabr(unsigned long dabr, unsigned long dabrx)
400{ 400{
401 mtspr(SPRN_DABR, dabr); 401 mtspr(SPRN_DABR, dabr);
402 mtspr(SPRN_DABRX, dabrx); 402 if (cpu_has_feature(CPU_FTR_DABRX))
403 mtspr(SPRN_DABRX, dabrx);
403 return 0; 404 return 0;
404} 405}
405#else 406#else
@@ -915,7 +916,11 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
915 flush_altivec_to_thread(src); 916 flush_altivec_to_thread(src);
916 flush_vsx_to_thread(src); 917 flush_vsx_to_thread(src);
917 flush_spe_to_thread(src); 918 flush_spe_to_thread(src);
919
918 *dst = *src; 920 *dst = *src;
921
922 clear_task_ebb(dst);
923
919 return 0; 924 return 0;
920} 925}
921 926
@@ -1368,7 +1373,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1368 1373
1369#ifdef CONFIG_PPC64 1374#ifdef CONFIG_PPC64
1370/* Called with hard IRQs off */ 1375/* Called with hard IRQs off */
1371void __ppc64_runlatch_on(void) 1376void notrace __ppc64_runlatch_on(void)
1372{ 1377{
1373 struct thread_info *ti = current_thread_info(); 1378 struct thread_info *ti = current_thread_info();
1374 unsigned long ctrl; 1379 unsigned long ctrl;
@@ -1381,7 +1386,7 @@ void __ppc64_runlatch_on(void)
1381} 1386}
1382 1387
1383/* Called with hard IRQs off */ 1388/* Called with hard IRQs off */
1384void __ppc64_runlatch_off(void) 1389void notrace __ppc64_runlatch_off(void)
1385{ 1390{
1386 struct thread_info *ti = current_thread_info(); 1391 struct thread_info *ti = current_thread_info();
1387 unsigned long ctrl; 1392 unsigned long ctrl;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8b6f7a99cce2..eb23ac92abb9 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -559,6 +559,35 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start,
559} 559}
560#endif 560#endif
561 561
562static void __init early_reserve_mem_dt(void)
563{
564 unsigned long i, len, dt_root;
565 const __be32 *prop;
566
567 dt_root = of_get_flat_dt_root();
568
569 prop = of_get_flat_dt_prop(dt_root, "reserved-ranges", &len);
570
571 if (!prop)
572 return;
573
574 DBG("Found new-style reserved-ranges\n");
575
576 /* Each reserved range is an (address,size) pair, 2 cells each,
577 * totalling 4 cells per range. */
578 for (i = 0; i < len / (sizeof(*prop) * 4); i++) {
579 u64 base, size;
580
581 base = of_read_number(prop + (i * 4) + 0, 2);
582 size = of_read_number(prop + (i * 4) + 2, 2);
583
584 if (size) {
585 DBG("reserving: %llx -> %llx\n", base, size);
586 memblock_reserve(base, size);
587 }
588 }
589}
590
562static void __init early_reserve_mem(void) 591static void __init early_reserve_mem(void)
563{ 592{
564 u64 base, size; 593 u64 base, size;
@@ -574,12 +603,16 @@ static void __init early_reserve_mem(void)
574 self_size = initial_boot_params->totalsize; 603 self_size = initial_boot_params->totalsize;
575 memblock_reserve(self_base, self_size); 604 memblock_reserve(self_base, self_size);
576 605
606 /* Look for the new "reserved-regions" property in the DT */
607 early_reserve_mem_dt();
608
577#ifdef CONFIG_BLK_DEV_INITRD 609#ifdef CONFIG_BLK_DEV_INITRD
578 /* then reserve the initrd, if any */ 610 /* Then reserve the initrd, if any */
579 if (initrd_start && (initrd_end > initrd_start)) 611 if (initrd_start && (initrd_end > initrd_start)) {
580 memblock_reserve(_ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE), 612 memblock_reserve(_ALIGN_DOWN(__pa(initrd_start), PAGE_SIZE),
581 _ALIGN_UP(initrd_end, PAGE_SIZE) - 613 _ALIGN_UP(initrd_end, PAGE_SIZE) -
582 _ALIGN_DOWN(initrd_start, PAGE_SIZE)); 614 _ALIGN_DOWN(initrd_start, PAGE_SIZE));
615 }
583#endif /* CONFIG_BLK_DEV_INITRD */ 616#endif /* CONFIG_BLK_DEV_INITRD */
584 617
585#ifdef CONFIG_PPC32 618#ifdef CONFIG_PPC32
@@ -591,6 +624,8 @@ static void __init early_reserve_mem(void)
591 u32 base_32, size_32; 624 u32 base_32, size_32;
592 u32 *reserve_map_32 = (u32 *)reserve_map; 625 u32 *reserve_map_32 = (u32 *)reserve_map;
593 626
627 DBG("Found old 32-bit reserve map\n");
628
594 while (1) { 629 while (1) {
595 base_32 = *(reserve_map_32++); 630 base_32 = *(reserve_map_32++);
596 size_32 = *(reserve_map_32++); 631 size_32 = *(reserve_map_32++);
@@ -605,6 +640,9 @@ static void __init early_reserve_mem(void)
605 return; 640 return;
606 } 641 }
607#endif 642#endif
643 DBG("Processing reserve map\n");
644
645 /* Handle the reserve map in the fdt blob if it exists */
608 while (1) { 646 while (1) {
609 base = *(reserve_map++); 647 base = *(reserve_map++);
610 size = *(reserve_map++); 648 size = *(reserve_map++);
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 98c2fc198712..64f7bd5b1b0f 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1449,7 +1449,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
1449 */ 1449 */
1450 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) { 1450 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
1451 len = bp_info->addr2 - bp_info->addr; 1451 len = bp_info->addr2 - bp_info->addr;
1452 } else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) { 1452 } else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
1453 len = 1;
1454 else {
1453 ptrace_put_breakpoints(child); 1455 ptrace_put_breakpoints(child);
1454 return -EINVAL; 1456 return -EINVAL;
1455 } 1457 }
diff --git a/arch/powerpc/kernel/reloc_32.S b/arch/powerpc/kernel/reloc_32.S
index ef46ba6e094f..f366fedb0872 100644
--- a/arch/powerpc/kernel/reloc_32.S
+++ b/arch/powerpc/kernel/reloc_32.S
@@ -166,7 +166,7 @@ ha16:
166 /* R_PPC_ADDR16_LO */ 166 /* R_PPC_ADDR16_LO */
167lo16: 167lo16:
168 cmpwi r4, R_PPC_ADDR16_LO 168 cmpwi r4, R_PPC_ADDR16_LO
169 bne nxtrela 169 bne unknown_type
170 lwz r4, 0(r9) /* r_offset */ 170 lwz r4, 0(r9) /* r_offset */
171 lwz r0, 8(r9) /* r_addend */ 171 lwz r0, 8(r9) /* r_addend */
172 add r0, r0, r3 172 add r0, r0, r3
@@ -191,6 +191,7 @@ nxtrela:
191 dcbst r4,r7 191 dcbst r4,r7
192 sync /* Ensure the data is flushed before icbi */ 192 sync /* Ensure the data is flushed before icbi */
193 icbi r4,r7 193 icbi r4,r7
194unknown_type:
194 cmpwi r8, 0 /* relasz = 0 ? */ 195 cmpwi r8, 0 /* relasz = 0 ? */
195 ble done 196 ble done
196 add r9, r9, r6 /* move to next entry in the .rela table */ 197 add r9, r9, r6 /* move to next entry in the .rela table */
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 52add6f3e201..80b5ef403f68 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1172,7 +1172,7 @@ int __init early_init_dt_scan_rtas(unsigned long node,
1172static arch_spinlock_t timebase_lock; 1172static arch_spinlock_t timebase_lock;
1173static u64 timebase = 0; 1173static u64 timebase = 0;
1174 1174
1175void __cpuinit rtas_give_timebase(void) 1175void rtas_give_timebase(void)
1176{ 1176{
1177 unsigned long flags; 1177 unsigned long flags;
1178 1178
@@ -1189,7 +1189,7 @@ void __cpuinit rtas_give_timebase(void)
1189 local_irq_restore(flags); 1189 local_irq_restore(flags);
1190} 1190}
1191 1191
1192void __cpuinit rtas_take_timebase(void) 1192void rtas_take_timebase(void)
1193{ 1193{
1194 while (!timebase) 1194 while (!timebase)
1195 barrier(); 1195 barrier();
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index e379d3fd1694..389fb8077cc9 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -76,7 +76,7 @@
76#endif 76#endif
77 77
78int boot_cpuid = 0; 78int boot_cpuid = 0;
79int __initdata spinning_secondaries; 79int spinning_secondaries;
80u64 ppc64_pft_size; 80u64 ppc64_pft_size;
81 81
82/* Pick defaults since we might want to patch instructions 82/* Pick defaults since we might want to patch instructions
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 201385c3a1ae..0f83122e6676 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -407,7 +407,8 @@ inline unsigned long copy_transact_fpr_from_user(struct task_struct *task,
407 * altivec/spe instructions at some point. 407 * altivec/spe instructions at some point.
408 */ 408 */
409static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, 409static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
410 int sigret, int ctx_has_vsx_region) 410 struct mcontext __user *tm_frame, int sigret,
411 int ctx_has_vsx_region)
411{ 412{
412 unsigned long msr = regs->msr; 413 unsigned long msr = regs->msr;
413 414
@@ -475,6 +476,12 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
475 476
476 if (__put_user(msr, &frame->mc_gregs[PT_MSR])) 477 if (__put_user(msr, &frame->mc_gregs[PT_MSR]))
477 return 1; 478 return 1;
479 /* We need to write 0 the MSR top 32 bits in the tm frame so that we
480 * can check it on the restore to see if TM is active
481 */
482 if (tm_frame && __put_user(0, &tm_frame->mc_gregs[PT_MSR]))
483 return 1;
484
478 if (sigret) { 485 if (sigret) {
479 /* Set up the sigreturn trampoline: li r0,sigret; sc */ 486 /* Set up the sigreturn trampoline: li r0,sigret; sc */
480 if (__put_user(0x38000000UL + sigret, &frame->tramp[0]) 487 if (__put_user(0x38000000UL + sigret, &frame->tramp[0])
@@ -747,7 +754,7 @@ static long restore_tm_user_regs(struct pt_regs *regs,
747 struct mcontext __user *tm_sr) 754 struct mcontext __user *tm_sr)
748{ 755{
749 long err; 756 long err;
750 unsigned long msr; 757 unsigned long msr, msr_hi;
751#ifdef CONFIG_VSX 758#ifdef CONFIG_VSX
752 int i; 759 int i;
753#endif 760#endif
@@ -852,8 +859,11 @@ static long restore_tm_user_regs(struct pt_regs *regs,
852 tm_enable(); 859 tm_enable();
853 /* This loads the checkpointed FP/VEC state, if used */ 860 /* This loads the checkpointed FP/VEC state, if used */
854 tm_recheckpoint(&current->thread, msr); 861 tm_recheckpoint(&current->thread, msr);
855 /* The task has moved into TM state S, so ensure MSR reflects this */ 862 /* Get the top half of the MSR */
856 regs->msr = (regs->msr & ~MSR_TS_MASK) | MSR_TS_S; 863 if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
864 return 1;
865 /* Pull in MSR TM from user context */
866 regs->msr = (regs->msr & ~MSR_TS_MASK) | ((msr_hi<<32) & MSR_TS_MASK);
857 867
858 /* This loads the speculative FP/VEC state, if used */ 868 /* This loads the speculative FP/VEC state, if used */
859 if (msr & MSR_FP) { 869 if (msr & MSR_FP) {
@@ -952,6 +962,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
952{ 962{
953 struct rt_sigframe __user *rt_sf; 963 struct rt_sigframe __user *rt_sf;
954 struct mcontext __user *frame; 964 struct mcontext __user *frame;
965 struct mcontext __user *tm_frame = NULL;
955 void __user *addr; 966 void __user *addr;
956 unsigned long newsp = 0; 967 unsigned long newsp = 0;
957 int sigret; 968 int sigret;
@@ -985,23 +996,24 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
985 } 996 }
986 997
987#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 998#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
999 tm_frame = &rt_sf->uc_transact.uc_mcontext;
988 if (MSR_TM_ACTIVE(regs->msr)) { 1000 if (MSR_TM_ACTIVE(regs->msr)) {
989 if (save_tm_user_regs(regs, &rt_sf->uc.uc_mcontext, 1001 if (save_tm_user_regs(regs, frame, tm_frame, sigret))
990 &rt_sf->uc_transact.uc_mcontext, sigret))
991 goto badframe; 1002 goto badframe;
992 } 1003 }
993 else 1004 else
994#endif 1005#endif
995 if (save_user_regs(regs, frame, sigret, 1)) 1006 {
1007 if (save_user_regs(regs, frame, tm_frame, sigret, 1))
996 goto badframe; 1008 goto badframe;
1009 }
997 regs->link = tramp; 1010 regs->link = tramp;
998 1011
999#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1012#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1000 if (MSR_TM_ACTIVE(regs->msr)) { 1013 if (MSR_TM_ACTIVE(regs->msr)) {
1001 if (__put_user((unsigned long)&rt_sf->uc_transact, 1014 if (__put_user((unsigned long)&rt_sf->uc_transact,
1002 &rt_sf->uc.uc_link) 1015 &rt_sf->uc.uc_link)
1003 || __put_user(to_user_ptr(&rt_sf->uc_transact.uc_mcontext), 1016 || __put_user((unsigned long)tm_frame, &rt_sf->uc_transact.uc_regs))
1004 &rt_sf->uc_transact.uc_regs))
1005 goto badframe; 1017 goto badframe;
1006 } 1018 }
1007 else 1019 else
@@ -1170,7 +1182,7 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
1170 mctx = (struct mcontext __user *) 1182 mctx = (struct mcontext __user *)
1171 ((unsigned long) &old_ctx->uc_mcontext & ~0xfUL); 1183 ((unsigned long) &old_ctx->uc_mcontext & ~0xfUL);
1172 if (!access_ok(VERIFY_WRITE, old_ctx, ctx_size) 1184 if (!access_ok(VERIFY_WRITE, old_ctx, ctx_size)
1173 || save_user_regs(regs, mctx, 0, ctx_has_vsx_region) 1185 || save_user_regs(regs, mctx, NULL, 0, ctx_has_vsx_region)
1174 || put_sigset_t(&old_ctx->uc_sigmask, &current->blocked) 1186 || put_sigset_t(&old_ctx->uc_sigmask, &current->blocked)
1175 || __put_user(to_user_ptr(mctx), &old_ctx->uc_regs)) 1187 || __put_user(to_user_ptr(mctx), &old_ctx->uc_regs))
1176 return -EFAULT; 1188 return -EFAULT;
@@ -1233,7 +1245,7 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1233 if (__get_user(msr_hi, &mcp->mc_gregs[PT_MSR])) 1245 if (__get_user(msr_hi, &mcp->mc_gregs[PT_MSR]))
1234 goto bad; 1246 goto bad;
1235 1247
1236 if (MSR_TM_SUSPENDED(msr_hi<<32)) { 1248 if (MSR_TM_ACTIVE(msr_hi<<32)) {
1237 /* We only recheckpoint on return if we're 1249 /* We only recheckpoint on return if we're
1238 * transaction. 1250 * transaction.
1239 */ 1251 */
@@ -1392,6 +1404,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1392{ 1404{
1393 struct sigcontext __user *sc; 1405 struct sigcontext __user *sc;
1394 struct sigframe __user *frame; 1406 struct sigframe __user *frame;
1407 struct mcontext __user *tm_mctx = NULL;
1395 unsigned long newsp = 0; 1408 unsigned long newsp = 0;
1396 int sigret; 1409 int sigret;
1397 unsigned long tramp; 1410 unsigned long tramp;
@@ -1425,6 +1438,7 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1425 } 1438 }
1426 1439
1427#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1440#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1441 tm_mctx = &frame->mctx_transact;
1428 if (MSR_TM_ACTIVE(regs->msr)) { 1442 if (MSR_TM_ACTIVE(regs->msr)) {
1429 if (save_tm_user_regs(regs, &frame->mctx, &frame->mctx_transact, 1443 if (save_tm_user_regs(regs, &frame->mctx, &frame->mctx_transact,
1430 sigret)) 1444 sigret))
@@ -1432,8 +1446,10 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka,
1432 } 1446 }
1433 else 1447 else
1434#endif 1448#endif
1435 if (save_user_regs(regs, &frame->mctx, sigret, 1)) 1449 {
1450 if (save_user_regs(regs, &frame->mctx, tm_mctx, sigret, 1))
1436 goto badframe; 1451 goto badframe;
1452 }
1437 1453
1438 regs->link = tramp; 1454 regs->link = tramp;
1439 1455
@@ -1481,16 +1497,22 @@ badframe:
1481long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8, 1497long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1482 struct pt_regs *regs) 1498 struct pt_regs *regs)
1483{ 1499{
1500 struct sigframe __user *sf;
1484 struct sigcontext __user *sc; 1501 struct sigcontext __user *sc;
1485 struct sigcontext sigctx; 1502 struct sigcontext sigctx;
1486 struct mcontext __user *sr; 1503 struct mcontext __user *sr;
1487 void __user *addr; 1504 void __user *addr;
1488 sigset_t set; 1505 sigset_t set;
1506#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1507 struct mcontext __user *mcp, *tm_mcp;
1508 unsigned long msr_hi;
1509#endif
1489 1510
1490 /* Always make any pending restarted system calls return -EINTR */ 1511 /* Always make any pending restarted system calls return -EINTR */
1491 current_thread_info()->restart_block.fn = do_no_restart_syscall; 1512 current_thread_info()->restart_block.fn = do_no_restart_syscall;
1492 1513
1493 sc = (struct sigcontext __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE); 1514 sf = (struct sigframe __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
1515 sc = &sf->sctx;
1494 addr = sc; 1516 addr = sc;
1495 if (copy_from_user(&sigctx, sc, sizeof(sigctx))) 1517 if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
1496 goto badframe; 1518 goto badframe;
@@ -1507,11 +1529,25 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1507#endif 1529#endif
1508 set_current_blocked(&set); 1530 set_current_blocked(&set);
1509 1531
1510 sr = (struct mcontext __user *)from_user_ptr(sigctx.regs); 1532#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1511 addr = sr; 1533 mcp = (struct mcontext __user *)&sf->mctx;
1512 if (!access_ok(VERIFY_READ, sr, sizeof(*sr)) 1534 tm_mcp = (struct mcontext __user *)&sf->mctx_transact;
1513 || restore_user_regs(regs, sr, 1)) 1535 if (__get_user(msr_hi, &tm_mcp->mc_gregs[PT_MSR]))
1514 goto badframe; 1536 goto badframe;
1537 if (MSR_TM_ACTIVE(msr_hi<<32)) {
1538 if (!cpu_has_feature(CPU_FTR_TM))
1539 goto badframe;
1540 if (restore_tm_user_regs(regs, mcp, tm_mcp))
1541 goto badframe;
1542 } else
1543#endif
1544 {
1545 sr = (struct mcontext __user *)from_user_ptr(sigctx.regs);
1546 addr = sr;
1547 if (!access_ok(VERIFY_READ, sr, sizeof(*sr))
1548 || restore_user_regs(regs, sr, 1))
1549 goto badframe;
1550 }
1515 1551
1516 set_thread_flag(TIF_RESTOREALL); 1552 set_thread_flag(TIF_RESTOREALL);
1517 return 0; 1553 return 0;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 345947367ec0..887e99d85bc2 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -410,6 +410,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
410 410
411 /* get MSR separately, transfer the LE bit if doing signal return */ 411 /* get MSR separately, transfer the LE bit if doing signal return */
412 err |= __get_user(msr, &sc->gp_regs[PT_MSR]); 412 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
413 /* pull in MSR TM from user context */
414 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
415
416 /* pull in MSR LE from user context */
413 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE); 417 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
414 418
415 /* The following non-GPR non-FPR non-VR state is also checkpointed: */ 419 /* The following non-GPR non-FPR non-VR state is also checkpointed: */
@@ -505,8 +509,6 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
505 tm_enable(); 509 tm_enable();
506 /* This loads the checkpointed FP/VEC state, if used */ 510 /* This loads the checkpointed FP/VEC state, if used */
507 tm_recheckpoint(&current->thread, msr); 511 tm_recheckpoint(&current->thread, msr);
508 /* The task has moved into TM state S, so ensure MSR reflects this: */
509 regs->msr = (regs->msr & ~MSR_TS_MASK) | __MASK(33);
510 512
511 /* This loads the speculative FP/VEC state, if used */ 513 /* This loads the speculative FP/VEC state, if used */
512 if (msr & MSR_FP) { 514 if (msr & MSR_FP) {
@@ -654,7 +656,7 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
654#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 656#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
655 if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR])) 657 if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR]))
656 goto badframe; 658 goto badframe;
657 if (MSR_TM_SUSPENDED(msr)) { 659 if (MSR_TM_ACTIVE(msr)) {
658 /* We recheckpoint on return. */ 660 /* We recheckpoint on return. */
659 struct ucontext __user *uc_transact; 661 struct ucontext __user *uc_transact;
660 if (__get_user(uc_transact, &uc->uc_link)) 662 if (__get_user(uc_transact, &uc->uc_link))
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index ee7ac5e6e28a..38b0ba65a735 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -480,7 +480,7 @@ static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle)
480 secondary_ti = current_set[cpu] = ti; 480 secondary_ti = current_set[cpu] = ti;
481} 481}
482 482
483int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 483int __cpu_up(unsigned int cpu, struct task_struct *tidle)
484{ 484{
485 int rc, c; 485 int rc, c;
486 486
@@ -610,7 +610,7 @@ static struct device_node *cpu_to_l2cache(int cpu)
610} 610}
611 611
612/* Activate a secondary processor. */ 612/* Activate a secondary processor. */
613__cpuinit void start_secondary(void *unused) 613void start_secondary(void *unused)
614{ 614{
615 unsigned int cpu = smp_processor_id(); 615 unsigned int cpu = smp_processor_id();
616 struct device_node *l2_cache; 616 struct device_node *l2_cache;
@@ -637,12 +637,10 @@ __cpuinit void start_secondary(void *unused)
637 637
638 vdso_getcpu_init(); 638 vdso_getcpu_init();
639#endif 639#endif
640 notify_cpu_starting(cpu);
641 set_cpu_online(cpu, true);
642 /* Update sibling maps */ 640 /* Update sibling maps */
643 base = cpu_first_thread_sibling(cpu); 641 base = cpu_first_thread_sibling(cpu);
644 for (i = 0; i < threads_per_core; i++) { 642 for (i = 0; i < threads_per_core; i++) {
645 if (cpu_is_offline(base + i)) 643 if (cpu_is_offline(base + i) && (cpu != base + i))
646 continue; 644 continue;
647 cpumask_set_cpu(cpu, cpu_sibling_mask(base + i)); 645 cpumask_set_cpu(cpu, cpu_sibling_mask(base + i));
648 cpumask_set_cpu(base + i, cpu_sibling_mask(cpu)); 646 cpumask_set_cpu(base + i, cpu_sibling_mask(cpu));
@@ -667,6 +665,10 @@ __cpuinit void start_secondary(void *unused)
667 } 665 }
668 of_node_put(l2_cache); 666 of_node_put(l2_cache);
669 667
668 smp_wmb();
669 notify_cpu_starting(cpu);
670 set_cpu_online(cpu, true);
671
670 local_irq_enable(); 672 local_irq_enable();
671 673
672 cpu_startup_entry(CPUHP_ONLINE); 674 cpu_startup_entry(CPUHP_ONLINE);
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index e68a84568b8b..27a90b99ef67 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -341,7 +341,7 @@ static struct device_attribute pa6t_attrs[] = {
341#endif /* HAS_PPC_PMC_PA6T */ 341#endif /* HAS_PPC_PMC_PA6T */
342#endif /* HAS_PPC_PMC_CLASSIC */ 342#endif /* HAS_PPC_PMC_CLASSIC */
343 343
344static void __cpuinit register_cpu_online(unsigned int cpu) 344static void register_cpu_online(unsigned int cpu)
345{ 345{
346 struct cpu *c = &per_cpu(cpu_devices, cpu); 346 struct cpu *c = &per_cpu(cpu_devices, cpu);
347 struct device *s = &c->dev; 347 struct device *s = &c->dev;
@@ -502,7 +502,7 @@ ssize_t arch_cpu_release(const char *buf, size_t count)
502 502
503#endif /* CONFIG_HOTPLUG_CPU */ 503#endif /* CONFIG_HOTPLUG_CPU */
504 504
505static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, 505static int sysfs_cpu_notify(struct notifier_block *self,
506 unsigned long action, void *hcpu) 506 unsigned long action, void *hcpu)
507{ 507{
508 unsigned int cpu = (unsigned int)(long)hcpu; 508 unsigned int cpu = (unsigned int)(long)hcpu;
@@ -522,7 +522,7 @@ static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
522 return NOTIFY_OK; 522 return NOTIFY_OK;
523} 523}
524 524
525static struct notifier_block __cpuinitdata sysfs_cpu_nb = { 525static struct notifier_block sysfs_cpu_nb = {
526 .notifier_call = sysfs_cpu_notify, 526 .notifier_call = sysfs_cpu_notify,
527}; 527};
528 528
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 5fc29ad7e26f..65ab9e909377 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -631,7 +631,6 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
631 return found; 631 return found;
632} 632}
633 633
634/* should become __cpuinit when secondary_cpu_time_init also is */
635void start_cpu_decrementer(void) 634void start_cpu_decrementer(void)
636{ 635{
637#if defined(CONFIG_BOOKE) || defined(CONFIG_40x) 636#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
diff --git a/arch/powerpc/kernel/tm.S b/arch/powerpc/kernel/tm.S
index 2da67e7a16d5..51be8fb24803 100644
--- a/arch/powerpc/kernel/tm.S
+++ b/arch/powerpc/kernel/tm.S
@@ -112,9 +112,18 @@ _GLOBAL(tm_reclaim)
112 std r3, STACK_PARAM(0)(r1) 112 std r3, STACK_PARAM(0)(r1)
113 SAVE_NVGPRS(r1) 113 SAVE_NVGPRS(r1)
114 114
115 /* We need to setup MSR for VSX register save instructions. Here we
116 * also clear the MSR RI since when we do the treclaim, we won't have a
117 * valid kernel pointer for a while. We clear RI here as it avoids
118 * adding another mtmsr closer to the treclaim. This makes the region
119 * maked as non-recoverable wider than it needs to be but it saves on
120 * inserting another mtmsrd later.
121 */
115 mfmsr r14 122 mfmsr r14
116 mr r15, r14 123 mr r15, r14
117 ori r15, r15, MSR_FP 124 ori r15, r15, MSR_FP
125 li r16, MSR_RI
126 andc r15, r15, r16
118 oris r15, r15, MSR_VEC@h 127 oris r15, r15, MSR_VEC@h
119#ifdef CONFIG_VSX 128#ifdef CONFIG_VSX
120 BEGIN_FTR_SECTION 129 BEGIN_FTR_SECTION
@@ -349,9 +358,10 @@ restore_gprs:
349 mtcr r5 358 mtcr r5
350 mtxer r6 359 mtxer r6
351 360
352 /* MSR and flags: We don't change CRs, and we don't need to alter 361 /* Clear the MSR RI since we are about to change R1. EE is already off
353 * MSR.
354 */ 362 */
363 li r4, 0
364 mtmsrd r4, 1
355 365
356 REST_4GPRS(0, r7) /* GPR0-3 */ 366 REST_4GPRS(0, r7) /* GPR0-3 */
357 REST_GPR(4, r7) /* GPR4-6 */ 367 REST_GPR(4, r7) /* GPR4-6 */
@@ -377,6 +387,10 @@ restore_gprs:
377 GET_PACA(r13) 387 GET_PACA(r13)
378 GET_SCRATCH0(r1) 388 GET_SCRATCH0(r1)
379 389
390 /* R1 is restored, so we are recoverable again. EE is still off */
391 li r4, MSR_RI
392 mtmsrd r4, 1
393
380 REST_NVGPRS(r1) 394 REST_NVGPRS(r1)
381 395
382 addi r1, r1, TM_FRAME_SIZE 396 addi r1, r1, TM_FRAME_SIZE
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index f18c79c324ef..bf33c22e38a4 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -866,6 +866,10 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword)
866 u8 val; 866 u8 val;
867 u32 shift = 8 * (3 - (pos & 0x3)); 867 u32 shift = 8 * (3 - (pos & 0x3));
868 868
869 /* if process is 32-bit, clear upper 32 bits of EA */
870 if ((regs->msr & MSR_64BIT) == 0)
871 EA &= 0xFFFFFFFF;
872
869 switch ((instword & PPC_INST_STRING_MASK)) { 873 switch ((instword & PPC_INST_STRING_MASK)) {
870 case PPC_INST_LSWX: 874 case PPC_INST_LSWX:
871 case PPC_INST_LSWI: 875 case PPC_INST_LSWI:
@@ -1125,7 +1129,17 @@ void __kprobes program_check_exception(struct pt_regs *regs)
1125 * ESR_DST (!?) or 0. In the process of chasing this with the 1129 * ESR_DST (!?) or 0. In the process of chasing this with the
1126 * hardware people - not sure if it can happen on any illegal 1130 * hardware people - not sure if it can happen on any illegal
1127 * instruction or only on FP instructions, whether there is a 1131 * instruction or only on FP instructions, whether there is a
1128 * pattern to occurrences etc. -dgibson 31/Mar/2003 */ 1132 * pattern to occurrences etc. -dgibson 31/Mar/2003
1133 */
1134
1135 /*
1136 * If we support a HW FPU, we need to ensure the FP state
1137 * if flushed into the thread_struct before attempting
1138 * emulation
1139 */
1140#ifdef CONFIG_PPC_FPU
1141 flush_fp_to_thread(current);
1142#endif
1129 switch (do_mathemu(regs)) { 1143 switch (do_mathemu(regs)) {
1130 case 0: 1144 case 0:
1131 emulate_single_step(regs); 1145 emulate_single_step(regs);
@@ -1165,6 +1179,16 @@ bail:
1165 exception_exit(prev_state); 1179 exception_exit(prev_state);
1166} 1180}
1167 1181
1182/*
1183 * This occurs when running in hypervisor mode on POWER6 or later
1184 * and an illegal instruction is encountered.
1185 */
1186void __kprobes emulation_assist_interrupt(struct pt_regs *regs)
1187{
1188 regs->msr |= REASON_ILLEGAL;
1189 program_check_exception(regs);
1190}
1191
1168void alignment_exception(struct pt_regs *regs) 1192void alignment_exception(struct pt_regs *regs)
1169{ 1193{
1170 enum ctx_state prev_state = exception_enter(); 1194 enum ctx_state prev_state = exception_enter();
@@ -1272,25 +1296,50 @@ void vsx_unavailable_exception(struct pt_regs *regs)
1272 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT); 1296 die("Unrecoverable VSX Unavailable Exception", regs, SIGABRT);
1273} 1297}
1274 1298
1275void tm_unavailable_exception(struct pt_regs *regs) 1299void facility_unavailable_exception(struct pt_regs *regs)
1276{ 1300{
1301 static char *facility_strings[] = {
1302 "FPU",
1303 "VMX/VSX",
1304 "DSCR",
1305 "PMU SPRs",
1306 "BHRB",
1307 "TM",
1308 "AT",
1309 "EBB",
1310 "TAR",
1311 };
1312 char *facility, *prefix;
1313 u64 value;
1314
1315 if (regs->trap == 0xf60) {
1316 value = mfspr(SPRN_FSCR);
1317 prefix = "";
1318 } else {
1319 value = mfspr(SPRN_HFSCR);
1320 prefix = "Hypervisor ";
1321 }
1322
1323 value = value >> 56;
1324
1277 /* We restore the interrupt state now */ 1325 /* We restore the interrupt state now */
1278 if (!arch_irq_disabled_regs(regs)) 1326 if (!arch_irq_disabled_regs(regs))
1279 local_irq_enable(); 1327 local_irq_enable();
1280 1328
1281 /* Currently we never expect a TMU exception. Catch 1329 if (value < ARRAY_SIZE(facility_strings))
1282 * this and kill the process! 1330 facility = facility_strings[value];
1283 */ 1331 else
1284 printk(KERN_EMERG "Unexpected TM unavailable exception at %lx " 1332 facility = "unknown";
1285 "(msr %lx)\n", 1333
1286 regs->nip, regs->msr); 1334 pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",
1335 prefix, facility, regs->nip, regs->msr);
1287 1336
1288 if (user_mode(regs)) { 1337 if (user_mode(regs)) {
1289 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 1338 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
1290 return; 1339 return;
1291 } 1340 }
1292 1341
1293 die("Unexpected TM unavailable exception", regs, SIGABRT); 1342 die("Unexpected facility unavailable exception", regs, SIGABRT);
1294} 1343}
1295 1344
1296#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1345#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -1386,8 +1435,7 @@ void performance_monitor_exception(struct pt_regs *regs)
1386void SoftwareEmulation(struct pt_regs *regs) 1435void SoftwareEmulation(struct pt_regs *regs)
1387{ 1436{
1388 extern int do_mathemu(struct pt_regs *); 1437 extern int do_mathemu(struct pt_regs *);
1389 extern int Soft_emulate_8xx(struct pt_regs *); 1438#if defined(CONFIG_MATH_EMULATION)
1390#if defined(CONFIG_MATH_EMULATION) || defined(CONFIG_8XX_MINIMAL_FPEMU)
1391 int errcode; 1439 int errcode;
1392#endif 1440#endif
1393 1441
@@ -1420,23 +1468,6 @@ void SoftwareEmulation(struct pt_regs *regs)
1420 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 1468 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
1421 return; 1469 return;
1422 } 1470 }
1423
1424#elif defined(CONFIG_8XX_MINIMAL_FPEMU)
1425 errcode = Soft_emulate_8xx(regs);
1426 if (errcode >= 0)
1427 PPC_WARN_EMULATED(8xx, regs);
1428
1429 switch (errcode) {
1430 case 0:
1431 emulate_single_step(regs);
1432 return;
1433 case 1:
1434 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
1435 return;
1436 case -EFAULT:
1437 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
1438 return;
1439 }
1440#else 1471#else
1441 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); 1472 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
1442#endif 1473#endif
@@ -1786,8 +1817,6 @@ struct ppc_emulated ppc_emulated = {
1786 WARN_EMULATED_SETUP(unaligned), 1817 WARN_EMULATED_SETUP(unaligned),
1787#ifdef CONFIG_MATH_EMULATION 1818#ifdef CONFIG_MATH_EMULATION
1788 WARN_EMULATED_SETUP(math), 1819 WARN_EMULATED_SETUP(math),
1789#elif defined(CONFIG_8XX_MINIMAL_FPEMU)
1790 WARN_EMULATED_SETUP(8xx),
1791#endif 1820#endif
1792#ifdef CONFIG_VSX 1821#ifdef CONFIG_VSX
1793 WARN_EMULATED_SETUP(vsx), 1822 WARN_EMULATED_SETUP(vsx),
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 9d3fdcd66290..a15837519dca 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -50,7 +50,7 @@ void __init udbg_early_init(void)
50 udbg_init_debug_beat(); 50 udbg_init_debug_beat();
51#elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE) 51#elif defined(CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE)
52 udbg_init_pas_realmode(); 52 udbg_init_pas_realmode();
53#elif defined(CONFIG_BOOTX_TEXT) 53#elif defined(CONFIG_PPC_EARLY_DEBUG_BOOTX)
54 udbg_init_btext(); 54 udbg_init_btext();
55#elif defined(CONFIG_PPC_EARLY_DEBUG_44x) 55#elif defined(CONFIG_PPC_EARLY_DEBUG_44x)
56 /* PPC44x debug */ 56 /* PPC44x debug */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index d4f463ac65b1..1d9c92621b36 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -711,7 +711,7 @@ static void __init vdso_setup_syscall_map(void)
711} 711}
712 712
713#ifdef CONFIG_PPC64 713#ifdef CONFIG_PPC64
714int __cpuinit vdso_getcpu_init(void) 714int vdso_getcpu_init(void)
715{ 715{
716 unsigned long cpu, node, val; 716 unsigned long cpu, node, val;
717 717
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index 5dd3ab469976..ed0385448148 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -441,6 +441,7 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
441 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu); 441 struct kvmppc_vcpu_44x *vcpu_44x = to_44x(vcpu);
442 struct kvmppc_44x_tlbe *tlbe; 442 struct kvmppc_44x_tlbe *tlbe;
443 unsigned int gtlb_index; 443 unsigned int gtlb_index;
444 int idx;
444 445
445 gtlb_index = kvmppc_get_gpr(vcpu, ra); 446 gtlb_index = kvmppc_get_gpr(vcpu, ra);
446 if (gtlb_index >= KVM44x_GUEST_TLB_SIZE) { 447 if (gtlb_index >= KVM44x_GUEST_TLB_SIZE) {
@@ -473,6 +474,8 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
473 return EMULATE_FAIL; 474 return EMULATE_FAIL;
474 } 475 }
475 476
477 idx = srcu_read_lock(&vcpu->kvm->srcu);
478
476 if (tlbe_is_host_safe(vcpu, tlbe)) { 479 if (tlbe_is_host_safe(vcpu, tlbe)) {
477 gva_t eaddr; 480 gva_t eaddr;
478 gpa_t gpaddr; 481 gpa_t gpaddr;
@@ -489,6 +492,8 @@ int kvmppc_44x_emul_tlbwe(struct kvm_vcpu *vcpu, u8 ra, u8 rs, u8 ws)
489 kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index); 492 kvmppc_mmu_map(vcpu, eaddr, gpaddr, gtlb_index);
490 } 493 }
491 494
495 srcu_read_unlock(&vcpu->kvm->srcu, idx);
496
492 trace_kvm_gtlb_write(gtlb_index, tlbe->tid, tlbe->word0, tlbe->word1, 497 trace_kvm_gtlb_write(gtlb_index, tlbe->tid, tlbe->word0, tlbe->word1,
493 tlbe->word2); 498 tlbe->word2);
494 499
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index 422de3f4d46c..008cd856c5b5 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -5,9 +5,10 @@
5subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror 5subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
6 6
7ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm 7ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm
8KVM := ../../../virt/kvm
8 9
9common-objs-y = $(addprefix ../../../virt/kvm/, kvm_main.o coalesced_mmio.o \ 10common-objs-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
10 eventfd.o) 11 $(KVM)/eventfd.o
11 12
12CFLAGS_44x_tlb.o := -I. 13CFLAGS_44x_tlb.o := -I.
13CFLAGS_e500_mmu.o := -I. 14CFLAGS_e500_mmu.o := -I.
@@ -53,7 +54,7 @@ kvm-e500mc-objs := \
53kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs) 54kvm-objs-$(CONFIG_KVM_E500MC) := $(kvm-e500mc-objs)
54 55
55kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_PR) := \ 56kvm-book3s_64-objs-$(CONFIG_KVM_BOOK3S_64_PR) := \
56 ../../../virt/kvm/coalesced_mmio.o \ 57 $(KVM)/coalesced_mmio.o \
57 fpu.o \ 58 fpu.o \
58 book3s_paired_singles.o \ 59 book3s_paired_singles.o \
59 book3s_pr.o \ 60 book3s_pr.o \
@@ -86,8 +87,8 @@ kvm-book3s_64-objs-$(CONFIG_KVM_XICS) += \
86 book3s_xics.o 87 book3s_xics.o
87 88
88kvm-book3s_64-module-objs := \ 89kvm-book3s_64-module-objs := \
89 ../../../virt/kvm/kvm_main.o \ 90 $(KVM)/kvm_main.o \
90 ../../../virt/kvm/eventfd.o \ 91 $(KVM)/eventfd.o \
91 powerpc.o \ 92 powerpc.o \
92 emulate.o \ 93 emulate.o \
93 book3s.o \ 94 book3s.o \
@@ -111,7 +112,7 @@ kvm-book3s_32-objs := \
111kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs) 112kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs)
112 113
113kvm-objs-$(CONFIG_KVM_MPIC) += mpic.o 114kvm-objs-$(CONFIG_KVM_MPIC) += mpic.o
114kvm-objs-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(addprefix ../../../virt/kvm/, irqchip.o) 115kvm-objs-$(CONFIG_HAVE_KVM_IRQ_ROUTING) += $(KVM)/irqchip.o
115 116
116kvm-objs := $(kvm-objs-m) $(kvm-objs-y) 117kvm-objs := $(kvm-objs-m) $(kvm-objs-y)
117 118
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
index b871721c0050..739bfbadb85e 100644
--- a/arch/powerpc/kvm/book3s_64_mmu.c
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -26,6 +26,7 @@
26#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
27#include <asm/kvm_ppc.h> 27#include <asm/kvm_ppc.h>
28#include <asm/kvm_book3s.h> 28#include <asm/kvm_book3s.h>
29#include <asm/mmu-hash64.h>
29 30
30/* #define DEBUG_MMU */ 31/* #define DEBUG_MMU */
31 32
@@ -76,6 +77,24 @@ static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(
76 return NULL; 77 return NULL;
77} 78}
78 79
80static int kvmppc_slb_sid_shift(struct kvmppc_slb *slbe)
81{
82 return slbe->tb ? SID_SHIFT_1T : SID_SHIFT;
83}
84
85static u64 kvmppc_slb_offset_mask(struct kvmppc_slb *slbe)
86{
87 return (1ul << kvmppc_slb_sid_shift(slbe)) - 1;
88}
89
90static u64 kvmppc_slb_calc_vpn(struct kvmppc_slb *slb, gva_t eaddr)
91{
92 eaddr &= kvmppc_slb_offset_mask(slb);
93
94 return (eaddr >> VPN_SHIFT) |
95 ((slb->vsid) << (kvmppc_slb_sid_shift(slb) - VPN_SHIFT));
96}
97
79static u64 kvmppc_mmu_book3s_64_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr, 98static u64 kvmppc_mmu_book3s_64_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr,
80 bool data) 99 bool data)
81{ 100{
@@ -85,11 +104,7 @@ static u64 kvmppc_mmu_book3s_64_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr,
85 if (!slb) 104 if (!slb)
86 return 0; 105 return 0;
87 106
88 if (slb->tb) 107 return kvmppc_slb_calc_vpn(slb, eaddr);
89 return (((u64)eaddr >> 12) & 0xfffffff) |
90 (((u64)slb->vsid) << 28);
91
92 return (((u64)eaddr >> 12) & 0xffff) | (((u64)slb->vsid) << 16);
93} 108}
94 109
95static int kvmppc_mmu_book3s_64_get_pagesize(struct kvmppc_slb *slbe) 110static int kvmppc_mmu_book3s_64_get_pagesize(struct kvmppc_slb *slbe)
@@ -100,7 +115,8 @@ static int kvmppc_mmu_book3s_64_get_pagesize(struct kvmppc_slb *slbe)
100static u32 kvmppc_mmu_book3s_64_get_page(struct kvmppc_slb *slbe, gva_t eaddr) 115static u32 kvmppc_mmu_book3s_64_get_page(struct kvmppc_slb *slbe, gva_t eaddr)
101{ 116{
102 int p = kvmppc_mmu_book3s_64_get_pagesize(slbe); 117 int p = kvmppc_mmu_book3s_64_get_pagesize(slbe);
103 return ((eaddr & 0xfffffff) >> p); 118
119 return ((eaddr & kvmppc_slb_offset_mask(slbe)) >> p);
104} 120}
105 121
106static hva_t kvmppc_mmu_book3s_64_get_pteg( 122static hva_t kvmppc_mmu_book3s_64_get_pteg(
@@ -109,13 +125,15 @@ static hva_t kvmppc_mmu_book3s_64_get_pteg(
109 bool second) 125 bool second)
110{ 126{
111 u64 hash, pteg, htabsize; 127 u64 hash, pteg, htabsize;
112 u32 page; 128 u32 ssize;
113 hva_t r; 129 hva_t r;
130 u64 vpn;
114 131
115 page = kvmppc_mmu_book3s_64_get_page(slbe, eaddr);
116 htabsize = ((1 << ((vcpu_book3s->sdr1 & 0x1f) + 11)) - 1); 132 htabsize = ((1 << ((vcpu_book3s->sdr1 & 0x1f) + 11)) - 1);
117 133
118 hash = slbe->vsid ^ page; 134 vpn = kvmppc_slb_calc_vpn(slbe, eaddr);
135 ssize = slbe->tb ? MMU_SEGSIZE_1T : MMU_SEGSIZE_256M;
136 hash = hpt_hash(vpn, kvmppc_mmu_book3s_64_get_pagesize(slbe), ssize);
119 if (second) 137 if (second)
120 hash = ~hash; 138 hash = ~hash;
121 hash &= ((1ULL << 39ULL) - 1ULL); 139 hash &= ((1ULL << 39ULL) - 1ULL);
@@ -146,7 +164,7 @@ static u64 kvmppc_mmu_book3s_64_get_avpn(struct kvmppc_slb *slbe, gva_t eaddr)
146 u64 avpn; 164 u64 avpn;
147 165
148 avpn = kvmppc_mmu_book3s_64_get_page(slbe, eaddr); 166 avpn = kvmppc_mmu_book3s_64_get_page(slbe, eaddr);
149 avpn |= slbe->vsid << (28 - p); 167 avpn |= slbe->vsid << (kvmppc_slb_sid_shift(slbe) - p);
150 168
151 if (p < 24) 169 if (p < 24)
152 avpn >>= ((80 - p) - 56) - 8; 170 avpn >>= ((80 - p) - 56) - 8;
@@ -167,7 +185,6 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
167 int i; 185 int i;
168 u8 key = 0; 186 u8 key = 0;
169 bool found = false; 187 bool found = false;
170 bool perm_err = false;
171 int second = 0; 188 int second = 0;
172 ulong mp_ea = vcpu->arch.magic_page_ea; 189 ulong mp_ea = vcpu->arch.magic_page_ea;
173 190
@@ -190,13 +207,15 @@ static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
190 if (!slbe) 207 if (!slbe)
191 goto no_seg_found; 208 goto no_seg_found;
192 209
210 avpn = kvmppc_mmu_book3s_64_get_avpn(slbe, eaddr);
211 if (slbe->tb)
212 avpn |= SLB_VSID_B_1T;
213
193do_second: 214do_second:
194 ptegp = kvmppc_mmu_book3s_64_get_pteg(vcpu_book3s, slbe, eaddr, second); 215 ptegp = kvmppc_mmu_book3s_64_get_pteg(vcpu_book3s, slbe, eaddr, second);
195 if (kvm_is_error_hva(ptegp)) 216 if (kvm_is_error_hva(ptegp))
196 goto no_page_found; 217 goto no_page_found;
197 218
198 avpn = kvmppc_mmu_book3s_64_get_avpn(slbe, eaddr);
199
200 if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) { 219 if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) {
201 printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp); 220 printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp);
202 goto no_page_found; 221 goto no_page_found;
@@ -219,7 +238,7 @@ do_second:
219 continue; 238 continue;
220 239
221 /* AVPN compare */ 240 /* AVPN compare */
222 if (HPTE_V_AVPN_VAL(avpn) == HPTE_V_AVPN_VAL(v)) { 241 if (HPTE_V_COMPARE(avpn, v)) {
223 u8 pp = (r & HPTE_R_PP) | key; 242 u8 pp = (r & HPTE_R_PP) | key;
224 int eaddr_mask = 0xFFF; 243 int eaddr_mask = 0xFFF;
225 244
@@ -248,11 +267,6 @@ do_second:
248 break; 267 break;
249 } 268 }
250 269
251 if (!gpte->may_read) {
252 perm_err = true;
253 continue;
254 }
255
256 dprintk("KVM MMU: Translated 0x%lx [0x%llx] -> 0x%llx " 270 dprintk("KVM MMU: Translated 0x%lx [0x%llx] -> 0x%llx "
257 "-> 0x%lx\n", 271 "-> 0x%lx\n",
258 eaddr, avpn, gpte->vpage, gpte->raddr); 272 eaddr, avpn, gpte->vpage, gpte->raddr);
@@ -281,6 +295,8 @@ do_second:
281 if (pteg[i+1] != oldr) 295 if (pteg[i+1] != oldr)
282 copy_to_user((void __user *)ptegp, pteg, sizeof(pteg)); 296 copy_to_user((void __user *)ptegp, pteg, sizeof(pteg));
283 297
298 if (!gpte->may_read)
299 return -EPERM;
284 return 0; 300 return 0;
285 } else { 301 } else {
286 dprintk("KVM MMU: No PTE found (ea=0x%lx sdr1=0x%llx " 302 dprintk("KVM MMU: No PTE found (ea=0x%lx sdr1=0x%llx "
@@ -296,13 +312,7 @@ do_second:
296 } 312 }
297 } 313 }
298 314
299
300no_page_found: 315no_page_found:
301
302
303 if (perm_err)
304 return -EPERM;
305
306 return -ENOENT; 316 return -ENOENT;
307 317
308no_seg_found: 318no_seg_found:
@@ -334,7 +344,7 @@ static void kvmppc_mmu_book3s_64_slbmte(struct kvm_vcpu *vcpu, u64 rs, u64 rb)
334 slbe->large = (rs & SLB_VSID_L) ? 1 : 0; 344 slbe->large = (rs & SLB_VSID_L) ? 1 : 0;
335 slbe->tb = (rs & SLB_VSID_B_1T) ? 1 : 0; 345 slbe->tb = (rs & SLB_VSID_B_1T) ? 1 : 0;
336 slbe->esid = slbe->tb ? esid_1t : esid; 346 slbe->esid = slbe->tb ? esid_1t : esid;
337 slbe->vsid = rs >> 12; 347 slbe->vsid = (rs & ~SLB_VSID_B) >> (kvmppc_slb_sid_shift(slbe) - 16);
338 slbe->valid = (rb & SLB_ESID_V) ? 1 : 0; 348 slbe->valid = (rb & SLB_ESID_V) ? 1 : 0;
339 slbe->Ks = (rs & SLB_VSID_KS) ? 1 : 0; 349 slbe->Ks = (rs & SLB_VSID_KS) ? 1 : 0;
340 slbe->Kp = (rs & SLB_VSID_KP) ? 1 : 0; 350 slbe->Kp = (rs & SLB_VSID_KP) ? 1 : 0;
@@ -375,6 +385,7 @@ static u64 kvmppc_mmu_book3s_64_slbmfev(struct kvm_vcpu *vcpu, u64 slb_nr)
375static void kvmppc_mmu_book3s_64_slbie(struct kvm_vcpu *vcpu, u64 ea) 385static void kvmppc_mmu_book3s_64_slbie(struct kvm_vcpu *vcpu, u64 ea)
376{ 386{
377 struct kvmppc_slb *slbe; 387 struct kvmppc_slb *slbe;
388 u64 seg_size;
378 389
379 dprintk("KVM MMU: slbie(0x%llx)\n", ea); 390 dprintk("KVM MMU: slbie(0x%llx)\n", ea);
380 391
@@ -386,8 +397,11 @@ static void kvmppc_mmu_book3s_64_slbie(struct kvm_vcpu *vcpu, u64 ea)
386 dprintk("KVM MMU: slbie(0x%llx, 0x%llx)\n", ea, slbe->esid); 397 dprintk("KVM MMU: slbie(0x%llx, 0x%llx)\n", ea, slbe->esid);
387 398
388 slbe->valid = false; 399 slbe->valid = false;
400 slbe->orige = 0;
401 slbe->origv = 0;
389 402
390 kvmppc_mmu_map_segment(vcpu, ea); 403 seg_size = 1ull << kvmppc_slb_sid_shift(slbe);
404 kvmppc_mmu_flush_segment(vcpu, ea & ~(seg_size - 1), seg_size);
391} 405}
392 406
393static void kvmppc_mmu_book3s_64_slbia(struct kvm_vcpu *vcpu) 407static void kvmppc_mmu_book3s_64_slbia(struct kvm_vcpu *vcpu)
@@ -396,8 +410,11 @@ static void kvmppc_mmu_book3s_64_slbia(struct kvm_vcpu *vcpu)
396 410
397 dprintk("KVM MMU: slbia()\n"); 411 dprintk("KVM MMU: slbia()\n");
398 412
399 for (i = 1; i < vcpu->arch.slb_nr; i++) 413 for (i = 1; i < vcpu->arch.slb_nr; i++) {
400 vcpu->arch.slb[i].valid = false; 414 vcpu->arch.slb[i].valid = false;
415 vcpu->arch.slb[i].orige = 0;
416 vcpu->arch.slb[i].origv = 0;
417 }
401 418
402 if (vcpu->arch.shared->msr & MSR_IR) { 419 if (vcpu->arch.shared->msr & MSR_IR) {
403 kvmppc_mmu_flush_segments(vcpu); 420 kvmppc_mmu_flush_segments(vcpu);
@@ -467,8 +484,14 @@ static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
467 484
468 if (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) { 485 if (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) {
469 slb = kvmppc_mmu_book3s_64_find_slbe(vcpu, ea); 486 slb = kvmppc_mmu_book3s_64_find_slbe(vcpu, ea);
470 if (slb) 487 if (slb) {
471 gvsid = slb->vsid; 488 gvsid = slb->vsid;
489 if (slb->tb) {
490 gvsid <<= SID_SHIFT_1T - SID_SHIFT;
491 gvsid |= esid & ((1ul << (SID_SHIFT_1T - SID_SHIFT)) - 1);
492 gvsid |= VSID_1T;
493 }
494 }
472 } 495 }
473 496
474 switch (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) { 497 switch (vcpu->arch.shared->msr & (MSR_DR|MSR_IR)) {
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index 3a9a1aceb14f..e5240524bf6c 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -34,7 +34,7 @@
34void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) 34void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
35{ 35{
36 ppc_md.hpte_invalidate(pte->slot, pte->host_vpn, 36 ppc_md.hpte_invalidate(pte->slot, pte->host_vpn,
37 MMU_PAGE_4K, MMU_SEGSIZE_256M, 37 MMU_PAGE_4K, MMU_PAGE_4K, MMU_SEGSIZE_256M,
38 false); 38 false);
39} 39}
40 40
@@ -301,6 +301,23 @@ out:
301 return r; 301 return r;
302} 302}
303 303
304void kvmppc_mmu_flush_segment(struct kvm_vcpu *vcpu, ulong ea, ulong seg_size)
305{
306 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
307 ulong seg_mask = -seg_size;
308 int i;
309
310 for (i = 1; i < svcpu->slb_max; i++) {
311 if ((svcpu->slb[i].esid & SLB_ESID_V) &&
312 (svcpu->slb[i].esid & seg_mask) == ea) {
313 /* Invalidate this entry */
314 svcpu->slb[i].esid = 0;
315 }
316 }
317
318 svcpu_put(svcpu);
319}
320
304void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu) 321void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu)
305{ 322{
306 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 323 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
@@ -325,9 +342,9 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
325 return -1; 342 return -1;
326 vcpu3s->context_id[0] = err; 343 vcpu3s->context_id[0] = err;
327 344
328 vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1) 345 vcpu3s->proto_vsid_max = ((u64)(vcpu3s->context_id[0] + 1)
329 << ESID_BITS) - 1; 346 << ESID_BITS) - 1;
330 vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << ESID_BITS; 347 vcpu3s->proto_vsid_first = (u64)vcpu3s->context_id[0] << ESID_BITS;
331 vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first; 348 vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first;
332 349
333 kvmppc_mmu_hpte_init(vcpu); 350 kvmppc_mmu_hpte_init(vcpu);
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 5880dfb31074..710d31317d81 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -675,6 +675,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
675 } 675 }
676 /* if the guest wants write access, see if that is OK */ 676 /* if the guest wants write access, see if that is OK */
677 if (!writing && hpte_is_writable(r)) { 677 if (!writing && hpte_is_writable(r)) {
678 unsigned int hugepage_shift;
678 pte_t *ptep, pte; 679 pte_t *ptep, pte;
679 680
680 /* 681 /*
@@ -683,9 +684,10 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
683 */ 684 */
684 rcu_read_lock_sched(); 685 rcu_read_lock_sched();
685 ptep = find_linux_pte_or_hugepte(current->mm->pgd, 686 ptep = find_linux_pte_or_hugepte(current->mm->pgd,
686 hva, NULL); 687 hva, &hugepage_shift);
687 if (ptep && pte_present(*ptep)) { 688 if (ptep) {
688 pte = kvmppc_read_update_linux_pte(ptep, 1); 689 pte = kvmppc_read_update_linux_pte(ptep, 1,
690 hugepage_shift);
689 if (pte_write(pte)) 691 if (pte_write(pte))
690 write_ok = 1; 692 write_ok = 1;
691 } 693 }
diff --git a/arch/powerpc/kvm/book3s_64_slb.S b/arch/powerpc/kvm/book3s_64_slb.S
index 56b983e7b738..4f0caecc0f9d 100644
--- a/arch/powerpc/kvm/book3s_64_slb.S
+++ b/arch/powerpc/kvm/book3s_64_slb.S
@@ -66,10 +66,6 @@ slb_exit_skip_ ## num:
66 66
67 ld r12, PACA_SLBSHADOWPTR(r13) 67 ld r12, PACA_SLBSHADOWPTR(r13)
68 68
69 /* Save off the first entry so we can slbie it later */
70 ld r10, SHADOW_SLB_ESID(0)(r12)
71 ld r11, SHADOW_SLB_VSID(0)(r12)
72
73 /* Remove bolted entries */ 69 /* Remove bolted entries */
74 UNBOLT_SLB_ENTRY(0) 70 UNBOLT_SLB_ENTRY(0)
75 UNBOLT_SLB_ENTRY(1) 71 UNBOLT_SLB_ENTRY(1)
@@ -81,15 +77,10 @@ slb_exit_skip_ ## num:
81 77
82 /* Flush SLB */ 78 /* Flush SLB */
83 79
80 li r10, 0
81 slbmte r10, r10
84 slbia 82 slbia
85 83
86 /* r0 = esid & ESID_MASK */
87 rldicr r10, r10, 0, 35
88 /* r0 |= CLASS_BIT(VSID) */
89 rldic r12, r11, 56 - 36, 36
90 or r10, r10, r12
91 slbie r10
92
93 /* Fill SLB with our shadow */ 84 /* Fill SLB with our shadow */
94 85
95 lbz r12, SVCPU_SLB_MAX(r3) 86 lbz r12, SVCPU_SLB_MAX(r3)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 550f5928b394..2efa9dde741a 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -1864,7 +1864,7 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu)
1864 1864
1865 up_out: 1865 up_out:
1866 up_read(&current->mm->mmap_sem); 1866 up_read(&current->mm->mmap_sem);
1867 goto out; 1867 goto out_srcu;
1868} 1868}
1869 1869
1870int kvmppc_core_init_vm(struct kvm *kvm) 1870int kvmppc_core_init_vm(struct kvm *kvm)
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 6dcbb49105a4..fc25689a9f35 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -27,7 +27,7 @@ static void *real_vmalloc_addr(void *x)
27 unsigned long addr = (unsigned long) x; 27 unsigned long addr = (unsigned long) x;
28 pte_t *p; 28 pte_t *p;
29 29
30 p = find_linux_pte(swapper_pg_dir, addr); 30 p = find_linux_pte_or_hugepte(swapper_pg_dir, addr, NULL);
31 if (!p || !pte_present(*p)) 31 if (!p || !pte_present(*p))
32 return NULL; 32 return NULL;
33 /* assume we don't have huge pages in vmalloc space... */ 33 /* assume we don't have huge pages in vmalloc space... */
@@ -139,20 +139,18 @@ static pte_t lookup_linux_pte(pgd_t *pgdir, unsigned long hva,
139{ 139{
140 pte_t *ptep; 140 pte_t *ptep;
141 unsigned long ps = *pte_sizep; 141 unsigned long ps = *pte_sizep;
142 unsigned int shift; 142 unsigned int hugepage_shift;
143 143
144 ptep = find_linux_pte_or_hugepte(pgdir, hva, &shift); 144 ptep = find_linux_pte_or_hugepte(pgdir, hva, &hugepage_shift);
145 if (!ptep) 145 if (!ptep)
146 return __pte(0); 146 return __pte(0);
147 if (shift) 147 if (hugepage_shift)
148 *pte_sizep = 1ul << shift; 148 *pte_sizep = 1ul << hugepage_shift;
149 else 149 else
150 *pte_sizep = PAGE_SIZE; 150 *pte_sizep = PAGE_SIZE;
151 if (ps > *pte_sizep) 151 if (ps > *pte_sizep)
152 return __pte(0); 152 return __pte(0);
153 if (!pte_present(*ptep)) 153 return kvmppc_read_update_linux_pte(ptep, writing, hugepage_shift);
154 return __pte(0);
155 return kvmppc_read_update_linux_pte(ptep, writing);
156} 154}
157 155
158static inline void unlock_hpte(unsigned long *hpte, unsigned long hpte_v) 156static inline void unlock_hpte(unsigned long *hpte, unsigned long hpte_v)
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index bdc40b8e77d9..19498a567a81 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1239,8 +1239,7 @@ out:
1239#ifdef CONFIG_PPC64 1239#ifdef CONFIG_PPC64
1240int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, struct kvm_ppc_smmu_info *info) 1240int kvm_vm_ioctl_get_smmu_info(struct kvm *kvm, struct kvm_ppc_smmu_info *info)
1241{ 1241{
1242 /* No flags */ 1242 info->flags = KVM_PPC_1T_SEGMENTS;
1243 info->flags = 0;
1244 1243
1245 /* SLB is always 64 entries */ 1244 /* SLB is always 64 entries */
1246 info->slb_size = 64; 1245 info->slb_size = 64;
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 1020119226db..dcc94f016007 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
673 ret = s; 673 ret = s;
674 goto out; 674 goto out;
675 } 675 }
676 kvmppc_lazy_ee_enable();
677 676
678 kvm_guest_enter(); 677 kvm_guest_enter();
679 678
@@ -699,6 +698,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
699 kvmppc_load_guest_fp(vcpu); 698 kvmppc_load_guest_fp(vcpu);
700#endif 699#endif
701 700
701 kvmppc_lazy_ee_enable();
702
702 ret = __kvmppc_vcpu_run(kvm_run, vcpu); 703 ret = __kvmppc_vcpu_run(kvm_run, vcpu);
703 704
704 /* No need for kvm_guest_exit. It's done in handle_exit. 705 /* No need for kvm_guest_exit. It's done in handle_exit.
@@ -795,7 +796,7 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
795 kvmppc_fill_pt_regs(&regs); 796 kvmppc_fill_pt_regs(&regs);
796 timer_interrupt(&regs); 797 timer_interrupt(&regs);
797 break; 798 break;
798#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3E_64) 799#if defined(CONFIG_PPC_DOORBELL)
799 case BOOKE_INTERRUPT_DOORBELL: 800 case BOOKE_INTERRUPT_DOORBELL:
800 kvmppc_fill_pt_regs(&regs); 801 kvmppc_fill_pt_regs(&regs);
801 doorbell_exception(&regs); 802 doorbell_exception(&regs);
@@ -832,6 +833,18 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
832{ 833{
833 int r = RESUME_HOST; 834 int r = RESUME_HOST;
834 int s; 835 int s;
836 int idx;
837
838#ifdef CONFIG_PPC64
839 WARN_ON(local_paca->irq_happened != 0);
840#endif
841
842 /*
843 * We enter with interrupts disabled in hardware, but
844 * we need to call hard_irq_disable anyway to ensure that
845 * the software state is kept in sync.
846 */
847 hard_irq_disable();
835 848
836 /* update before a new last_exit_type is rewritten */ 849 /* update before a new last_exit_type is rewritten */
837 kvmppc_update_timing_stats(vcpu); 850 kvmppc_update_timing_stats(vcpu);
@@ -1053,6 +1066,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1053 break; 1066 break;
1054 } 1067 }
1055 1068
1069 idx = srcu_read_lock(&vcpu->kvm->srcu);
1070
1056 gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr); 1071 gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr);
1057 gfn = gpaddr >> PAGE_SHIFT; 1072 gfn = gpaddr >> PAGE_SHIFT;
1058 1073
@@ -1075,6 +1090,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1075 kvmppc_account_exit(vcpu, MMIO_EXITS); 1090 kvmppc_account_exit(vcpu, MMIO_EXITS);
1076 } 1091 }
1077 1092
1093 srcu_read_unlock(&vcpu->kvm->srcu, idx);
1078 break; 1094 break;
1079 } 1095 }
1080 1096
@@ -1098,6 +1114,8 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1098 1114
1099 kvmppc_account_exit(vcpu, ITLB_VIRT_MISS_EXITS); 1115 kvmppc_account_exit(vcpu, ITLB_VIRT_MISS_EXITS);
1100 1116
1117 idx = srcu_read_lock(&vcpu->kvm->srcu);
1118
1101 gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr); 1119 gpaddr = kvmppc_mmu_xlate(vcpu, gtlb_index, eaddr);
1102 gfn = gpaddr >> PAGE_SHIFT; 1120 gfn = gpaddr >> PAGE_SHIFT;
1103 1121
@@ -1114,6 +1132,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
1114 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK); 1132 kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK);
1115 } 1133 }
1116 1134
1135 srcu_read_unlock(&vcpu->kvm->srcu, idx);
1117 break; 1136 break;
1118 } 1137 }
1119 1138
diff --git a/arch/powerpc/kvm/e500_mmu.c b/arch/powerpc/kvm/e500_mmu.c
index c41a5a96b558..6d6f153b6c1d 100644
--- a/arch/powerpc/kvm/e500_mmu.c
+++ b/arch/powerpc/kvm/e500_mmu.c
@@ -396,6 +396,7 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
396 struct kvm_book3e_206_tlb_entry *gtlbe; 396 struct kvm_book3e_206_tlb_entry *gtlbe;
397 int tlbsel, esel; 397 int tlbsel, esel;
398 int recal = 0; 398 int recal = 0;
399 int idx;
399 400
400 tlbsel = get_tlb_tlbsel(vcpu); 401 tlbsel = get_tlb_tlbsel(vcpu);
401 esel = get_tlb_esel(vcpu, tlbsel); 402 esel = get_tlb_esel(vcpu, tlbsel);
@@ -430,6 +431,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
430 kvmppc_set_tlb1map_range(vcpu, gtlbe); 431 kvmppc_set_tlb1map_range(vcpu, gtlbe);
431 } 432 }
432 433
434 idx = srcu_read_lock(&vcpu->kvm->srcu);
435
433 /* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */ 436 /* Invalidate shadow mappings for the about-to-be-clobbered TLBE. */
434 if (tlbe_is_host_safe(vcpu, gtlbe)) { 437 if (tlbe_is_host_safe(vcpu, gtlbe)) {
435 u64 eaddr = get_tlb_eaddr(gtlbe); 438 u64 eaddr = get_tlb_eaddr(gtlbe);
@@ -444,6 +447,8 @@ int kvmppc_e500_emul_tlbwe(struct kvm_vcpu *vcpu)
444 kvmppc_mmu_map(vcpu, eaddr, raddr, index_of(tlbsel, esel)); 447 kvmppc_mmu_map(vcpu, eaddr, raddr, index_of(tlbsel, esel));
445 } 448 }
446 449
450 srcu_read_unlock(&vcpu->kvm->srcu, idx);
451
447 kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS); 452 kvmppc_set_exit_type(vcpu, EMULATED_TLBWE_EXITS);
448 return EMULATE_DONE; 453 return EMULATE_DONE;
449} 454}
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index 753cc99eff2b..19c8379575f7 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -177,8 +177,6 @@ int kvmppc_core_check_processor_compat(void)
177 r = 0; 177 r = 0;
178 else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0) 178 else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0)
179 r = 0; 179 r = 0;
180 else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0)
181 r = 0;
182 else 180 else
183 r = -ENOTSUPP; 181 r = -ENOTSUPP;
184 182
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 631a2650e4e4..2c52ada30775 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -169,6 +169,9 @@ static int kvmppc_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
169 vcpu->arch.shared->sprg3 = spr_val; 169 vcpu->arch.shared->sprg3 = spr_val;
170 break; 170 break;
171 171
172 /* PIR can legally be written, but we ignore it */
173 case SPRN_PIR: break;
174
172 default: 175 default:
173 emulated = kvmppc_core_emulate_mtspr(vcpu, sprn, 176 emulated = kvmppc_core_emulate_mtspr(vcpu, sprn,
174 spr_val); 177 spr_val);
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index e15c521846ca..99c7fc16dc0d 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -580,7 +580,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
580 if (instr & 1) 580 if (instr & 1)
581 regs->link = regs->nip; 581 regs->link = regs->nip;
582 if (branch_taken(instr, regs)) 582 if (branch_taken(instr, regs))
583 regs->nip = imm; 583 regs->nip = truncate_if_32bit(regs->msr, imm);
584 return 1; 584 return 1;
585#ifdef CONFIG_PPC64 585#ifdef CONFIG_PPC64
586 case 17: /* sc */ 586 case 17: /* sc */
diff --git a/arch/powerpc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 7d1dba0d57f9..8d035d2d42a6 100644
--- a/arch/powerpc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
@@ -4,7 +4,8 @@ obj-$(CONFIG_MATH_EMULATION) += fabs.o fadd.o fadds.o fcmpo.o fcmpu.o \
4 fmadd.o fmadds.o fmsub.o fmsubs.o \ 4 fmadd.o fmadds.o fmsub.o fmsubs.o \
5 fmul.o fmuls.o fnabs.o fneg.o \ 5 fmul.o fmuls.o fnabs.o fneg.o \
6 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \ 6 fnmadd.o fnmadds.o fnmsub.o fnmsubs.o \
7 fres.o frsp.o frsqrte.o fsel.o lfs.o \ 7 fres.o fre.o frsp.o fsel.o lfs.o \
8 frsqrte.o frsqrtes.o \
8 fsqrt.o fsqrts.o fsub.o fsubs.o \ 9 fsqrt.o fsqrts.o fsub.o fsubs.o \
9 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \ 10 mcrfs.o mffs.o mtfsb0.o mtfsb1.o \
10 mtfsf.o mtfsfi.o stfiwx.o stfs.o \ 11 mtfsf.o mtfsfi.o stfiwx.o stfs.o \
diff --git a/arch/powerpc/math-emu/fre.c b/arch/powerpc/math-emu/fre.c
new file mode 100644
index 000000000000..49ccf2cc6a5a
--- /dev/null
+++ b/arch/powerpc/math-emu/fre.c
@@ -0,0 +1,11 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int fre(void *frD, void *frB)
6{
7#ifdef DEBUG
8 printk("%s: %p %p\n", __func__, frD, frB);
9#endif
10 return -ENOSYS;
11}
diff --git a/arch/powerpc/math-emu/frsqrtes.c b/arch/powerpc/math-emu/frsqrtes.c
new file mode 100644
index 000000000000..7e838e380314
--- /dev/null
+++ b/arch/powerpc/math-emu/frsqrtes.c
@@ -0,0 +1,11 @@
1#include <linux/types.h>
2#include <linux/errno.h>
3#include <asm/uaccess.h>
4
5int frsqrtes(void *frD, void *frB)
6{
7#ifdef DEBUG
8 printk("%s: %p %p\n", __func__, frD, frB);
9#endif
10 return 0;
11}
diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index 164d55935bd8..0328e66e0799 100644
--- a/arch/powerpc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
@@ -58,8 +58,10 @@ FLOATFUNC(fnabs);
58FLOATFUNC(fneg); 58FLOATFUNC(fneg);
59 59
60/* Optional */ 60/* Optional */
61FLOATFUNC(fre);
61FLOATFUNC(fres); 62FLOATFUNC(fres);
62FLOATFUNC(frsqrte); 63FLOATFUNC(frsqrte);
64FLOATFUNC(frsqrtes);
63FLOATFUNC(fsel); 65FLOATFUNC(fsel);
64FLOATFUNC(fsqrt); 66FLOATFUNC(fsqrt);
65FLOATFUNC(fsqrts); 67FLOATFUNC(fsqrts);
@@ -97,6 +99,7 @@ FLOATFUNC(fsqrts);
97#define FSQRTS 0x016 /* 22 */ 99#define FSQRTS 0x016 /* 22 */
98#define FRES 0x018 /* 24 */ 100#define FRES 0x018 /* 24 */
99#define FMULS 0x019 /* 25 */ 101#define FMULS 0x019 /* 25 */
102#define FRSQRTES 0x01a /* 26 */
100#define FMSUBS 0x01c /* 28 */ 103#define FMSUBS 0x01c /* 28 */
101#define FMADDS 0x01d /* 29 */ 104#define FMADDS 0x01d /* 29 */
102#define FNMSUBS 0x01e /* 30 */ 105#define FNMSUBS 0x01e /* 30 */
@@ -109,6 +112,7 @@ FLOATFUNC(fsqrts);
109#define FADD 0x015 /* 21 */ 112#define FADD 0x015 /* 21 */
110#define FSQRT 0x016 /* 22 */ 113#define FSQRT 0x016 /* 22 */
111#define FSEL 0x017 /* 23 */ 114#define FSEL 0x017 /* 23 */
115#define FRE 0x018 /* 24 */
112#define FMUL 0x019 /* 25 */ 116#define FMUL 0x019 /* 25 */
113#define FRSQRTE 0x01a /* 26 */ 117#define FRSQRTE 0x01a /* 26 */
114#define FMSUB 0x01c /* 28 */ 118#define FMSUB 0x01c /* 28 */
@@ -299,9 +303,10 @@ do_mathemu(struct pt_regs *regs)
299 case FDIVS: func = fdivs; type = AB; break; 303 case FDIVS: func = fdivs; type = AB; break;
300 case FSUBS: func = fsubs; type = AB; break; 304 case FSUBS: func = fsubs; type = AB; break;
301 case FADDS: func = fadds; type = AB; break; 305 case FADDS: func = fadds; type = AB; break;
302 case FSQRTS: func = fsqrts; type = AB; break; 306 case FSQRTS: func = fsqrts; type = XB; break;
303 case FRES: func = fres; type = AB; break; 307 case FRES: func = fres; type = XB; break;
304 case FMULS: func = fmuls; type = AC; break; 308 case FMULS: func = fmuls; type = AC; break;
309 case FRSQRTES: func = frsqrtes;type = XB; break;
305 case FMSUBS: func = fmsubs; type = ABC; break; 310 case FMSUBS: func = fmsubs; type = ABC; break;
306 case FMADDS: func = fmadds; type = ABC; break; 311 case FMADDS: func = fmadds; type = ABC; break;
307 case FNMSUBS: func = fnmsubs; type = ABC; break; 312 case FNMSUBS: func = fnmsubs; type = ABC; break;
@@ -317,10 +322,11 @@ do_mathemu(struct pt_regs *regs)
317 case FDIV: func = fdiv; type = AB; break; 322 case FDIV: func = fdiv; type = AB; break;
318 case FSUB: func = fsub; type = AB; break; 323 case FSUB: func = fsub; type = AB; break;
319 case FADD: func = fadd; type = AB; break; 324 case FADD: func = fadd; type = AB; break;
320 case FSQRT: func = fsqrt; type = AB; break; 325 case FSQRT: func = fsqrt; type = XB; break;
326 case FRE: func = fre; type = XB; break;
321 case FSEL: func = fsel; type = ABC; break; 327 case FSEL: func = fsel; type = ABC; break;
322 case FMUL: func = fmul; type = AC; break; 328 case FMUL: func = fmul; type = AC; break;
323 case FRSQRTE: func = frsqrte; type = AB; break; 329 case FRSQRTE: func = frsqrte; type = XB; break;
324 case FMSUB: func = fmsub; type = ABC; break; 330 case FMSUB: func = fmsub; type = ABC; break;
325 case FMADD: func = fmadd; type = ABC; break; 331 case FMADD: func = fmadd; type = ABC; break;
326 case FNMSUB: func = fnmsub; type = ABC; break; 332 case FNMSUB: func = fnmsub; type = ABC; break;
diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index 2c9441ee6bb8..82b1ff759e26 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -41,7 +41,7 @@ int icache_44x_need_flush;
41 41
42unsigned long tlb_47x_boltmap[1024/8]; 42unsigned long tlb_47x_boltmap[1024/8];
43 43
44static void __cpuinit ppc44x_update_tlb_hwater(void) 44static void ppc44x_update_tlb_hwater(void)
45{ 45{
46 extern unsigned int tlb_44x_patch_hwater_D[]; 46 extern unsigned int tlb_44x_patch_hwater_D[];
47 extern unsigned int tlb_44x_patch_hwater_I[]; 47 extern unsigned int tlb_44x_patch_hwater_I[];
@@ -134,7 +134,7 @@ static void __init ppc47x_update_boltmap(void)
134/* 134/*
135 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem for 47x type MMU 135 * "Pins" a 256MB TLB entry in AS0 for kernel lowmem for 47x type MMU
136 */ 136 */
137static void __cpuinit ppc47x_pin_tlb(unsigned int virt, unsigned int phys) 137static void ppc47x_pin_tlb(unsigned int virt, unsigned int phys)
138{ 138{
139 unsigned int rA; 139 unsigned int rA;
140 int bolted; 140 int bolted;
@@ -229,7 +229,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
229} 229}
230 230
231#ifdef CONFIG_SMP 231#ifdef CONFIG_SMP
232void __cpuinit mmu_init_secondary(int cpu) 232void mmu_init_secondary(int cpu)
233{ 233{
234 unsigned long addr; 234 unsigned long addr;
235 unsigned long memstart = memstart_addr & ~(PPC_PIN_SIZE - 1); 235 unsigned long memstart = memstart_addr & ~(PPC_PIN_SIZE - 1);
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index cf16b5733eaa..51230ee6a407 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -6,17 +6,16 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
6 6
7ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) 7ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
8 8
9obj-y := fault.o mem.o pgtable.o gup.o \ 9obj-y := fault.o mem.o pgtable.o gup.o mmap.o \
10 init_$(CONFIG_WORD_SIZE).o \ 10 init_$(CONFIG_WORD_SIZE).o \
11 pgtable_$(CONFIG_WORD_SIZE).o 11 pgtable_$(CONFIG_WORD_SIZE).o
12obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ 12obj-$(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
15obj-$(CONFIG_PPC64) += mmap_64.o
16hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o 15hash64-$(CONFIG_PPC_NATIVE) := hash_native_64.o
17obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o \ 16obj-$(CONFIG_PPC_STD_MMU_64) += hash_utils_64.o \
18 slb_low.o slb.o stab.o \ 17 slb_low.o slb.o stab.o \
19 mmap_64.o $(hash64-y) 18 $(hash64-y)
20obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o 19obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o
21obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ 20obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \
22 tlb_hash$(CONFIG_WORD_SIZE).o \ 21 tlb_hash$(CONFIG_WORD_SIZE).o \
@@ -28,11 +27,12 @@ obj-$(CONFIG_44x) += 44x_mmu.o
28obj-$(CONFIG_PPC_FSL_BOOK3E) += fsl_booke_mmu.o 27obj-$(CONFIG_PPC_FSL_BOOK3E) += fsl_booke_mmu.o
29obj-$(CONFIG_NEED_MULTIPLE_NODES) += numa.o 28obj-$(CONFIG_NEED_MULTIPLE_NODES) += numa.o
30obj-$(CONFIG_PPC_MM_SLICES) += slice.o 29obj-$(CONFIG_PPC_MM_SLICES) += slice.o
31ifeq ($(CONFIG_HUGETLB_PAGE),y)
32obj-y += hugetlbpage.o 30obj-y += hugetlbpage.o
31ifeq ($(CONFIG_HUGETLB_PAGE),y)
33obj-$(CONFIG_PPC_STD_MMU_64) += hugetlbpage-hash64.o 32obj-$(CONFIG_PPC_STD_MMU_64) += hugetlbpage-hash64.o
34obj-$(CONFIG_PPC_BOOK3E_MMU) += hugetlbpage-book3e.o 33obj-$(CONFIG_PPC_BOOK3E_MMU) += hugetlbpage-book3e.o
35endif 34endif
35obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += hugepage-hash64.o
36obj-$(CONFIG_PPC_SUBPAGE_PROT) += subpage-prot.o 36obj-$(CONFIG_PPC_SUBPAGE_PROT) += subpage-prot.o
37obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o 37obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
38obj-$(CONFIG_HIGHMEM) += highmem.o 38obj-$(CONFIG_HIGHMEM) += highmem.o
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index 4b921affa495..49822d90ea96 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -34,7 +34,7 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
34 34
35 ptep = pte_offset_kernel(&pmd, addr); 35 ptep = pte_offset_kernel(&pmd, addr);
36 do { 36 do {
37 pte_t pte = *ptep; 37 pte_t pte = ACCESS_ONCE(*ptep);
38 struct page *page; 38 struct page *page;
39 39
40 if ((pte_val(pte) & mask) != result) 40 if ((pte_val(pte) & mask) != result)
@@ -63,12 +63,18 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
63 63
64 pmdp = pmd_offset(&pud, addr); 64 pmdp = pmd_offset(&pud, addr);
65 do { 65 do {
66 pmd_t pmd = *pmdp; 66 pmd_t pmd = ACCESS_ONCE(*pmdp);
67 67
68 next = pmd_addr_end(addr, end); 68 next = pmd_addr_end(addr, end);
69 if (pmd_none(pmd)) 69 /*
70 * If we find a splitting transparent hugepage we
71 * return zero. That will result in taking the slow
72 * path which will call wait_split_huge_page()
73 * if the pmd is still in splitting state
74 */
75 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
70 return 0; 76 return 0;
71 if (pmd_huge(pmd)) { 77 if (pmd_huge(pmd) || pmd_large(pmd)) {
72 if (!gup_hugepte((pte_t *)pmdp, PMD_SIZE, addr, next, 78 if (!gup_hugepte((pte_t *)pmdp, PMD_SIZE, addr, next,
73 write, pages, nr)) 79 write, pages, nr))
74 return 0; 80 return 0;
@@ -91,7 +97,7 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
91 97
92 pudp = pud_offset(&pgd, addr); 98 pudp = pud_offset(&pgd, addr);
93 do { 99 do {
94 pud_t pud = *pudp; 100 pud_t pud = ACCESS_ONCE(*pudp);
95 101
96 next = pud_addr_end(addr, end); 102 next = pud_addr_end(addr, end);
97 if (pud_none(pud)) 103 if (pud_none(pud))
@@ -154,7 +160,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
154 160
155 pgdp = pgd_offset(mm, addr); 161 pgdp = pgd_offset(mm, addr);
156 do { 162 do {
157 pgd_t pgd = *pgdp; 163 pgd_t pgd = ACCESS_ONCE(*pgdp);
158 164
159 pr_devel(" %016lx: normal pgd %p\n", addr, 165 pr_devel(" %016lx: normal pgd %p\n", addr,
160 (void *)pgd_val(pgd)); 166 (void *)pgd_val(pgd));
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 0e980acae67c..d3cbda62857b 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -289,9 +289,10 @@ htab_modify_pte:
289 289
290 /* Call ppc_md.hpte_updatepp */ 290 /* Call ppc_md.hpte_updatepp */
291 mr r5,r29 /* vpn */ 291 mr r5,r29 /* vpn */
292 li r6,MMU_PAGE_4K /* page size */ 292 li r6,MMU_PAGE_4K /* base page size */
293 ld r7,STK_PARAM(R9)(r1) /* segment size */ 293 li r7,MMU_PAGE_4K /* actual page size */
294 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ 294 ld r8,STK_PARAM(R9)(r1) /* segment size */
295 ld r9,STK_PARAM(R8)(r1) /* get "local" param */
295_GLOBAL(htab_call_hpte_updatepp) 296_GLOBAL(htab_call_hpte_updatepp)
296 bl . /* Patched by htab_finish_init() */ 297 bl . /* Patched by htab_finish_init() */
297 298
@@ -649,9 +650,10 @@ htab_modify_pte:
649 650
650 /* Call ppc_md.hpte_updatepp */ 651 /* Call ppc_md.hpte_updatepp */
651 mr r5,r29 /* vpn */ 652 mr r5,r29 /* vpn */
652 li r6,MMU_PAGE_4K /* page size */ 653 li r6,MMU_PAGE_4K /* base page size */
653 ld r7,STK_PARAM(R9)(r1) /* segment size */ 654 li r7,MMU_PAGE_4K /* actual page size */
654 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ 655 ld r8,STK_PARAM(R9)(r1) /* segment size */
656 ld r9,STK_PARAM(R8)(r1) /* get "local" param */
655_GLOBAL(htab_call_hpte_updatepp) 657_GLOBAL(htab_call_hpte_updatepp)
656 bl . /* patched by htab_finish_init() */ 658 bl . /* patched by htab_finish_init() */
657 659
@@ -937,9 +939,10 @@ ht64_modify_pte:
937 939
938 /* Call ppc_md.hpte_updatepp */ 940 /* Call ppc_md.hpte_updatepp */
939 mr r5,r29 /* vpn */ 941 mr r5,r29 /* vpn */
940 li r6,MMU_PAGE_64K 942 li r6,MMU_PAGE_64K /* base page size */
941 ld r7,STK_PARAM(R9)(r1) /* segment size */ 943 li r7,MMU_PAGE_64K /* actual page size */
942 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ 944 ld r8,STK_PARAM(R9)(r1) /* segment size */
945 ld r9,STK_PARAM(R8)(r1) /* get "local" param */
943_GLOBAL(ht64_call_hpte_updatepp) 946_GLOBAL(ht64_call_hpte_updatepp)
944 bl . /* patched by htab_finish_init() */ 947 bl . /* patched by htab_finish_init() */
945 948
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 4c122c3f1623..3f0c30ae4791 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -273,61 +273,15 @@ static long native_hpte_remove(unsigned long hpte_group)
273 return i; 273 return i;
274} 274}
275 275
276static inline int __hpte_actual_psize(unsigned int lp, int psize)
277{
278 int i, shift;
279 unsigned int mask;
280
281 /* start from 1 ignoring MMU_PAGE_4K */
282 for (i = 1; i < MMU_PAGE_COUNT; i++) {
283
284 /* invalid penc */
285 if (mmu_psize_defs[psize].penc[i] == -1)
286 continue;
287 /*
288 * encoding bits per actual page size
289 * PTE LP actual page size
290 * rrrr rrrz >=8KB
291 * rrrr rrzz >=16KB
292 * rrrr rzzz >=32KB
293 * rrrr zzzz >=64KB
294 * .......
295 */
296 shift = mmu_psize_defs[i].shift - LP_SHIFT;
297 if (shift > LP_BITS)
298 shift = LP_BITS;
299 mask = (1 << shift) - 1;
300 if ((lp & mask) == mmu_psize_defs[psize].penc[i])
301 return i;
302 }
303 return -1;
304}
305
306static inline int hpte_actual_psize(struct hash_pte *hptep, int psize)
307{
308 /* Look at the 8 bit LP value */
309 unsigned int lp = (hptep->r >> LP_SHIFT) & ((1 << LP_BITS) - 1);
310
311 if (!(hptep->v & HPTE_V_VALID))
312 return -1;
313
314 /* First check if it is large page */
315 if (!(hptep->v & HPTE_V_LARGE))
316 return MMU_PAGE_4K;
317
318 return __hpte_actual_psize(lp, psize);
319}
320
321static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, 276static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
322 unsigned long vpn, int psize, int ssize, 277 unsigned long vpn, int bpsize,
323 int local) 278 int apsize, int ssize, int local)
324{ 279{
325 struct hash_pte *hptep = htab_address + slot; 280 struct hash_pte *hptep = htab_address + slot;
326 unsigned long hpte_v, want_v; 281 unsigned long hpte_v, want_v;
327 int ret = 0; 282 int ret = 0;
328 int actual_psize;
329 283
330 want_v = hpte_encode_avpn(vpn, psize, ssize); 284 want_v = hpte_encode_avpn(vpn, bpsize, ssize);
331 285
332 DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)", 286 DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)",
333 vpn, want_v & HPTE_V_AVPN, slot, newpp); 287 vpn, want_v & HPTE_V_AVPN, slot, newpp);
@@ -335,7 +289,6 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
335 native_lock_hpte(hptep); 289 native_lock_hpte(hptep);
336 290
337 hpte_v = hptep->v; 291 hpte_v = hptep->v;
338 actual_psize = hpte_actual_psize(hptep, psize);
339 /* 292 /*
340 * We need to invalidate the TLB always because hpte_remove doesn't do 293 * We need to invalidate the TLB always because hpte_remove doesn't do
341 * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less 294 * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less
@@ -343,12 +296,7 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
343 * (hpte_remove) because we assume the old translation is still 296 * (hpte_remove) because we assume the old translation is still
344 * technically "valid". 297 * technically "valid".
345 */ 298 */
346 if (actual_psize < 0) { 299 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) {
347 actual_psize = psize;
348 ret = -1;
349 goto err_out;
350 }
351 if (!HPTE_V_COMPARE(hpte_v, want_v)) {
352 DBG_LOW(" -> miss\n"); 300 DBG_LOW(" -> miss\n");
353 ret = -1; 301 ret = -1;
354 } else { 302 } else {
@@ -357,11 +305,10 @@ static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
357 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) | 305 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) |
358 (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_C)); 306 (newpp & (HPTE_R_PP | HPTE_R_N | HPTE_R_C));
359 } 307 }
360err_out:
361 native_unlock_hpte(hptep); 308 native_unlock_hpte(hptep);
362 309
363 /* Ensure it is out of the tlb too. */ 310 /* Ensure it is out of the tlb too. */
364 tlbie(vpn, psize, actual_psize, ssize, local); 311 tlbie(vpn, bpsize, apsize, ssize, local);
365 312
366 return ret; 313 return ret;
367} 314}
@@ -402,7 +349,6 @@ static long native_hpte_find(unsigned long vpn, int psize, int ssize)
402static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, 349static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
403 int psize, int ssize) 350 int psize, int ssize)
404{ 351{
405 int actual_psize;
406 unsigned long vpn; 352 unsigned long vpn;
407 unsigned long vsid; 353 unsigned long vsid;
408 long slot; 354 long slot;
@@ -415,36 +361,33 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
415 if (slot == -1) 361 if (slot == -1)
416 panic("could not find page to bolt\n"); 362 panic("could not find page to bolt\n");
417 hptep = htab_address + slot; 363 hptep = htab_address + slot;
418 actual_psize = hpte_actual_psize(hptep, psize);
419 if (actual_psize < 0)
420 actual_psize = psize;
421 364
422 /* Update the HPTE */ 365 /* Update the HPTE */
423 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) | 366 hptep->r = (hptep->r & ~(HPTE_R_PP | HPTE_R_N)) |
424 (newpp & (HPTE_R_PP | HPTE_R_N)); 367 (newpp & (HPTE_R_PP | HPTE_R_N));
425 368 /*
426 /* Ensure it is out of the tlb too. */ 369 * Ensure it is out of the tlb too. Bolted entries base and
427 tlbie(vpn, psize, actual_psize, ssize, 0); 370 * actual page size will be same.
371 */
372 tlbie(vpn, psize, psize, ssize, 0);
428} 373}
429 374
430static void native_hpte_invalidate(unsigned long slot, unsigned long vpn, 375static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
431 int psize, int ssize, int local) 376 int bpsize, int apsize, int ssize, int local)
432{ 377{
433 struct hash_pte *hptep = htab_address + slot; 378 struct hash_pte *hptep = htab_address + slot;
434 unsigned long hpte_v; 379 unsigned long hpte_v;
435 unsigned long want_v; 380 unsigned long want_v;
436 unsigned long flags; 381 unsigned long flags;
437 int actual_psize;
438 382
439 local_irq_save(flags); 383 local_irq_save(flags);
440 384
441 DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot); 385 DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot);
442 386
443 want_v = hpte_encode_avpn(vpn, psize, ssize); 387 want_v = hpte_encode_avpn(vpn, bpsize, ssize);
444 native_lock_hpte(hptep); 388 native_lock_hpte(hptep);
445 hpte_v = hptep->v; 389 hpte_v = hptep->v;
446 390
447 actual_psize = hpte_actual_psize(hptep, psize);
448 /* 391 /*
449 * We need to invalidate the TLB always because hpte_remove doesn't do 392 * We need to invalidate the TLB always because hpte_remove doesn't do
450 * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less 393 * a tlb invalidate. If a hash bucket gets full, we "evict" a more/less
@@ -452,23 +395,120 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
452 * (hpte_remove) because we assume the old translation is still 395 * (hpte_remove) because we assume the old translation is still
453 * technically "valid". 396 * technically "valid".
454 */ 397 */
455 if (actual_psize < 0) { 398 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
456 actual_psize = psize;
457 native_unlock_hpte(hptep);
458 goto err_out;
459 }
460 if (!HPTE_V_COMPARE(hpte_v, want_v))
461 native_unlock_hpte(hptep); 399 native_unlock_hpte(hptep);
462 else 400 else
463 /* Invalidate the hpte. NOTE: this also unlocks it */ 401 /* Invalidate the hpte. NOTE: this also unlocks it */
464 hptep->v = 0; 402 hptep->v = 0;
465 403
466err_out:
467 /* Invalidate the TLB */ 404 /* Invalidate the TLB */
468 tlbie(vpn, psize, actual_psize, ssize, local); 405 tlbie(vpn, bpsize, apsize, ssize, local);
406
407 local_irq_restore(flags);
408}
409
410static void native_hugepage_invalidate(struct mm_struct *mm,
411 unsigned char *hpte_slot_array,
412 unsigned long addr, int psize)
413{
414 int ssize = 0, i;
415 int lock_tlbie;
416 struct hash_pte *hptep;
417 int actual_psize = MMU_PAGE_16M;
418 unsigned int max_hpte_count, valid;
419 unsigned long flags, s_addr = addr;
420 unsigned long hpte_v, want_v, shift;
421 unsigned long hidx, vpn = 0, vsid, hash, slot;
422
423 shift = mmu_psize_defs[psize].shift;
424 max_hpte_count = 1U << (PMD_SHIFT - shift);
425
426 local_irq_save(flags);
427 for (i = 0; i < max_hpte_count; i++) {
428 valid = hpte_valid(hpte_slot_array, i);
429 if (!valid)
430 continue;
431 hidx = hpte_hash_index(hpte_slot_array, i);
432
433 /* get the vpn */
434 addr = s_addr + (i * (1ul << shift));
435 if (!is_kernel_addr(addr)) {
436 ssize = user_segment_size(addr);
437 vsid = get_vsid(mm->context.id, addr, ssize);
438 WARN_ON(vsid == 0);
439 } else {
440 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
441 ssize = mmu_kernel_ssize;
442 }
443
444 vpn = hpt_vpn(addr, vsid, ssize);
445 hash = hpt_hash(vpn, shift, ssize);
446 if (hidx & _PTEIDX_SECONDARY)
447 hash = ~hash;
448
449 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
450 slot += hidx & _PTEIDX_GROUP_IX;
451
452 hptep = htab_address + slot;
453 want_v = hpte_encode_avpn(vpn, psize, ssize);
454 native_lock_hpte(hptep);
455 hpte_v = hptep->v;
456
457 /* Even if we miss, we need to invalidate the TLB */
458 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID))
459 native_unlock_hpte(hptep);
460 else
461 /* Invalidate the hpte. NOTE: this also unlocks it */
462 hptep->v = 0;
463 }
464 /*
465 * Since this is a hugepage, we just need a single tlbie.
466 * use the last vpn.
467 */
468 lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
469 if (lock_tlbie)
470 raw_spin_lock(&native_tlbie_lock);
471
472 asm volatile("ptesync":::"memory");
473 __tlbie(vpn, psize, actual_psize, ssize);
474 asm volatile("eieio; tlbsync; ptesync":::"memory");
475
476 if (lock_tlbie)
477 raw_spin_unlock(&native_tlbie_lock);
478
469 local_irq_restore(flags); 479 local_irq_restore(flags);
470} 480}
471 481
482static inline int __hpte_actual_psize(unsigned int lp, int psize)
483{
484 int i, shift;
485 unsigned int mask;
486
487 /* start from 1 ignoring MMU_PAGE_4K */
488 for (i = 1; i < MMU_PAGE_COUNT; i++) {
489
490 /* invalid penc */
491 if (mmu_psize_defs[psize].penc[i] == -1)
492 continue;
493 /*
494 * encoding bits per actual page size
495 * PTE LP actual page size
496 * rrrr rrrz >=8KB
497 * rrrr rrzz >=16KB
498 * rrrr rzzz >=32KB
499 * rrrr zzzz >=64KB
500 * .......
501 */
502 shift = mmu_psize_defs[i].shift - LP_SHIFT;
503 if (shift > LP_BITS)
504 shift = LP_BITS;
505 mask = (1 << shift) - 1;
506 if ((lp & mask) == mmu_psize_defs[psize].penc[i])
507 return i;
508 }
509 return -1;
510}
511
472static void hpte_decode(struct hash_pte *hpte, unsigned long slot, 512static void hpte_decode(struct hash_pte *hpte, unsigned long slot,
473 int *psize, int *apsize, int *ssize, unsigned long *vpn) 513 int *psize, int *apsize, int *ssize, unsigned long *vpn)
474{ 514{
@@ -672,4 +712,5 @@ void __init hpte_init_native(void)
672 ppc_md.hpte_remove = native_hpte_remove; 712 ppc_md.hpte_remove = native_hpte_remove;
673 ppc_md.hpte_clear_all = native_hpte_clear; 713 ppc_md.hpte_clear_all = native_hpte_clear;
674 ppc_md.flush_hash_range = native_flush_hash_range; 714 ppc_md.flush_hash_range = native_flush_hash_range;
715 ppc_md.hugepage_invalidate = native_hugepage_invalidate;
675} 716}
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index e303a6d74e3a..6ecc38bd5b24 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -807,7 +807,7 @@ void __init early_init_mmu(void)
807} 807}
808 808
809#ifdef CONFIG_SMP 809#ifdef CONFIG_SMP
810void __cpuinit early_init_mmu_secondary(void) 810void early_init_mmu_secondary(void)
811{ 811{
812 /* Initialize hash table for that CPU */ 812 /* Initialize hash table for that CPU */
813 if (!firmware_has_feature(FW_FEATURE_LPAR)) 813 if (!firmware_has_feature(FW_FEATURE_LPAR))
@@ -1050,13 +1050,26 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
1050 goto bail; 1050 goto bail;
1051 } 1051 }
1052 1052
1053#ifdef CONFIG_HUGETLB_PAGE
1054 if (hugeshift) { 1053 if (hugeshift) {
1055 rc = __hash_page_huge(ea, access, vsid, ptep, trap, local, 1054 if (pmd_trans_huge(*(pmd_t *)ptep))
1056 ssize, hugeshift, psize); 1055 rc = __hash_page_thp(ea, access, vsid, (pmd_t *)ptep,
1056 trap, local, ssize, psize);
1057#ifdef CONFIG_HUGETLB_PAGE
1058 else
1059 rc = __hash_page_huge(ea, access, vsid, ptep, trap,
1060 local, ssize, hugeshift, psize);
1061#else
1062 else {
1063 /*
1064 * if we have hugeshift, and is not transhuge with
1065 * hugetlb disabled, something is really wrong.
1066 */
1067 rc = 1;
1068 WARN_ON(1);
1069 }
1070#endif
1057 goto bail; 1071 goto bail;
1058 } 1072 }
1059#endif /* CONFIG_HUGETLB_PAGE */
1060 1073
1061#ifndef CONFIG_PPC_64K_PAGES 1074#ifndef CONFIG_PPC_64K_PAGES
1062 DBG_LOW(" i-pte: %016lx\n", pte_val(*ptep)); 1075 DBG_LOW(" i-pte: %016lx\n", pte_val(*ptep));
@@ -1145,6 +1158,7 @@ EXPORT_SYMBOL_GPL(hash_page);
1145void hash_preload(struct mm_struct *mm, unsigned long ea, 1158void hash_preload(struct mm_struct *mm, unsigned long ea,
1146 unsigned long access, unsigned long trap) 1159 unsigned long access, unsigned long trap)
1147{ 1160{
1161 int hugepage_shift;
1148 unsigned long vsid; 1162 unsigned long vsid;
1149 pgd_t *pgdir; 1163 pgd_t *pgdir;
1150 pte_t *ptep; 1164 pte_t *ptep;
@@ -1166,10 +1180,27 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1166 pgdir = mm->pgd; 1180 pgdir = mm->pgd;
1167 if (pgdir == NULL) 1181 if (pgdir == NULL)
1168 return; 1182 return;
1169 ptep = find_linux_pte(pgdir, ea); 1183
1170 if (!ptep) 1184 /* Get VSID */
1185 ssize = user_segment_size(ea);
1186 vsid = get_vsid(mm->context.id, ea, ssize);
1187 if (!vsid)
1171 return; 1188 return;
1189 /*
1190 * Hash doesn't like irqs. Walking linux page table with irq disabled
1191 * saves us from holding multiple locks.
1192 */
1193 local_irq_save(flags);
1194
1195 /*
1196 * THP pages use update_mmu_cache_pmd. We don't do
1197 * hash preload there. Hence can ignore THP here
1198 */
1199 ptep = find_linux_pte_or_hugepte(pgdir, ea, &hugepage_shift);
1200 if (!ptep)
1201 goto out_exit;
1172 1202
1203 WARN_ON(hugepage_shift);
1173#ifdef CONFIG_PPC_64K_PAGES 1204#ifdef CONFIG_PPC_64K_PAGES
1174 /* If either _PAGE_4K_PFN or _PAGE_NO_CACHE is set (and we are on 1205 /* If either _PAGE_4K_PFN or _PAGE_NO_CACHE is set (and we are on
1175 * a 64K kernel), then we don't preload, hash_page() will take 1206 * a 64K kernel), then we don't preload, hash_page() will take
@@ -1178,18 +1209,9 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1178 * page size demotion here 1209 * page size demotion here
1179 */ 1210 */
1180 if (pte_val(*ptep) & (_PAGE_4K_PFN | _PAGE_NO_CACHE)) 1211 if (pte_val(*ptep) & (_PAGE_4K_PFN | _PAGE_NO_CACHE))
1181 return; 1212 goto out_exit;
1182#endif /* CONFIG_PPC_64K_PAGES */ 1213#endif /* CONFIG_PPC_64K_PAGES */
1183 1214
1184 /* Get VSID */
1185 ssize = user_segment_size(ea);
1186 vsid = get_vsid(mm->context.id, ea, ssize);
1187 if (!vsid)
1188 return;
1189
1190 /* Hash doesn't like irqs */
1191 local_irq_save(flags);
1192
1193 /* Is that local to this CPU ? */ 1215 /* Is that local to this CPU ? */
1194 if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id()))) 1216 if (cpumask_equal(mm_cpumask(mm), cpumask_of(smp_processor_id())))
1195 local = 1; 1217 local = 1;
@@ -1211,7 +1233,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1211 mm->context.user_psize, 1233 mm->context.user_psize,
1212 mm->context.user_psize, 1234 mm->context.user_psize,
1213 pte_val(*ptep)); 1235 pte_val(*ptep));
1214 1236out_exit:
1215 local_irq_restore(flags); 1237 local_irq_restore(flags);
1216} 1238}
1217 1239
@@ -1232,7 +1254,11 @@ void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
1232 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1254 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
1233 slot += hidx & _PTEIDX_GROUP_IX; 1255 slot += hidx & _PTEIDX_GROUP_IX;
1234 DBG_LOW(" sub %ld: hash=%lx, hidx=%lx\n", index, slot, hidx); 1256 DBG_LOW(" sub %ld: hash=%lx, hidx=%lx\n", index, slot, hidx);
1235 ppc_md.hpte_invalidate(slot, vpn, psize, ssize, local); 1257 /*
1258 * We use same base page size and actual psize, because we don't
1259 * use these functions for hugepage
1260 */
1261 ppc_md.hpte_invalidate(slot, vpn, psize, psize, ssize, local);
1236 } pte_iterate_hashed_end(); 1262 } pte_iterate_hashed_end();
1237 1263
1238#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 1264#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -1365,7 +1391,8 @@ static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
1365 hash = ~hash; 1391 hash = ~hash;
1366 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1392 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
1367 slot += hidx & _PTEIDX_GROUP_IX; 1393 slot += hidx & _PTEIDX_GROUP_IX;
1368 ppc_md.hpte_invalidate(slot, vpn, mmu_linear_psize, mmu_kernel_ssize, 0); 1394 ppc_md.hpte_invalidate(slot, vpn, mmu_linear_psize, mmu_linear_psize,
1395 mmu_kernel_ssize, 0);
1369} 1396}
1370 1397
1371void kernel_map_pages(struct page *page, int numpages, int enable) 1398void kernel_map_pages(struct page *page, int numpages, int enable)
diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c
new file mode 100644
index 000000000000..34de9e0cdc34
--- /dev/null
+++ b/arch/powerpc/mm/hugepage-hash64.c
@@ -0,0 +1,175 @@
1/*
2 * Copyright IBM Corporation, 2013
3 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2.1 of the GNU Lesser General Public License
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 *
13 */
14
15/*
16 * PPC64 THP Support for hash based MMUs
17 */
18#include <linux/mm.h>
19#include <asm/machdep.h>
20
21int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
22 pmd_t *pmdp, unsigned long trap, int local, int ssize,
23 unsigned int psize)
24{
25 unsigned int index, valid;
26 unsigned char *hpte_slot_array;
27 unsigned long rflags, pa, hidx;
28 unsigned long old_pmd, new_pmd;
29 int ret, lpsize = MMU_PAGE_16M;
30 unsigned long vpn, hash, shift, slot;
31
32 /*
33 * atomically mark the linux large page PMD busy and dirty
34 */
35 do {
36 old_pmd = pmd_val(*pmdp);
37 /* If PMD busy, retry the access */
38 if (unlikely(old_pmd & _PAGE_BUSY))
39 return 0;
40 /* If PMD is trans splitting retry the access */
41 if (unlikely(old_pmd & _PAGE_SPLITTING))
42 return 0;
43 /* If PMD permissions don't match, take page fault */
44 if (unlikely(access & ~old_pmd))
45 return 1;
46 /*
47 * Try to lock the PTE, add ACCESSED and DIRTY if it was
48 * a write access
49 */
50 new_pmd = old_pmd | _PAGE_BUSY | _PAGE_ACCESSED;
51 if (access & _PAGE_RW)
52 new_pmd |= _PAGE_DIRTY;
53 } while (old_pmd != __cmpxchg_u64((unsigned long *)pmdp,
54 old_pmd, new_pmd));
55 /*
56 * PP bits. _PAGE_USER is already PP bit 0x2, so we only
57 * need to add in 0x1 if it's a read-only user page
58 */
59 rflags = new_pmd & _PAGE_USER;
60 if ((new_pmd & _PAGE_USER) && !((new_pmd & _PAGE_RW) &&
61 (new_pmd & _PAGE_DIRTY)))
62 rflags |= 0x1;
63 /*
64 * _PAGE_EXEC -> HW_NO_EXEC since it's inverted
65 */
66 rflags |= ((new_pmd & _PAGE_EXEC) ? 0 : HPTE_R_N);
67
68#if 0
69 if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
70
71 /*
72 * No CPU has hugepages but lacks no execute, so we
73 * don't need to worry about that case
74 */
75 rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
76 }
77#endif
78 /*
79 * Find the slot index details for this ea, using base page size.
80 */
81 shift = mmu_psize_defs[psize].shift;
82 index = (ea & ~HPAGE_PMD_MASK) >> shift;
83 BUG_ON(index >= 4096);
84
85 vpn = hpt_vpn(ea, vsid, ssize);
86 hash = hpt_hash(vpn, shift, ssize);
87 hpte_slot_array = get_hpte_slot_array(pmdp);
88
89 valid = hpte_valid(hpte_slot_array, index);
90 if (valid) {
91 /* update the hpte bits */
92 hidx = hpte_hash_index(hpte_slot_array, index);
93 if (hidx & _PTEIDX_SECONDARY)
94 hash = ~hash;
95 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
96 slot += hidx & _PTEIDX_GROUP_IX;
97
98 ret = ppc_md.hpte_updatepp(slot, rflags, vpn,
99 psize, lpsize, ssize, local);
100 /*
101 * We failed to update, try to insert a new entry.
102 */
103 if (ret == -1) {
104 /*
105 * large pte is marked busy, so we can be sure
106 * nobody is looking at hpte_slot_array. hence we can
107 * safely update this here.
108 */
109 valid = 0;
110 new_pmd &= ~_PAGE_HPTEFLAGS;
111 hpte_slot_array[index] = 0;
112 } else
113 /* clear the busy bits and set the hash pte bits */
114 new_pmd = (new_pmd & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE;
115 }
116
117 if (!valid) {
118 unsigned long hpte_group;
119
120 /* insert new entry */
121 pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT;
122repeat:
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
128 /* Add in WIMG bits */
129 rflags |= (new_pmd & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
130 _PAGE_COHERENT | _PAGE_GUARDED));
131
132 /* Insert into the hash table, primary slot */
133 slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
134 psize, lpsize, ssize);
135 /*
136 * Primary is full, try the secondary
137 */
138 if (unlikely(slot == -1)) {
139 hpte_group = ((~hash & htab_hash_mask) *
140 HPTES_PER_GROUP) & ~0x7UL;
141 slot = ppc_md.hpte_insert(hpte_group, vpn, pa,
142 rflags, HPTE_V_SECONDARY,
143 psize, lpsize, ssize);
144 if (slot == -1) {
145 if (mftb() & 0x1)
146 hpte_group = ((hash & htab_hash_mask) *
147 HPTES_PER_GROUP) & ~0x7UL;
148
149 ppc_md.hpte_remove(hpte_group);
150 goto repeat;
151 }
152 }
153 /*
154 * Hypervisor failure. Restore old pmd and return -1
155 * similar to __hash_page_*
156 */
157 if (unlikely(slot == -2)) {
158 *pmdp = __pmd(old_pmd);
159 hash_failure_debug(ea, access, vsid, trap, ssize,
160 psize, lpsize, old_pmd);
161 return -1;
162 }
163 /*
164 * large pte is marked busy, so we can be sure
165 * nobody is looking at hpte_slot_array. hence we can
166 * safely update this here.
167 */
168 mark_hpte_slot_valid(hpte_slot_array, index, slot);
169 }
170 /*
171 * No need to use ldarx/stdcx here
172 */
173 *pmdp = __pmd(new_pmd & ~_PAGE_BUSY);
174 return 0;
175}
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index 0f1d94a1fb82..0b7fb6761015 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -81,7 +81,7 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
81 slot += (old_pte & _PAGE_F_GIX) >> 12; 81 slot += (old_pte & _PAGE_F_GIX) >> 12;
82 82
83 if (ppc_md.hpte_updatepp(slot, rflags, vpn, mmu_psize, 83 if (ppc_md.hpte_updatepp(slot, rflags, vpn, mmu_psize,
84 ssize, local) == -1) 84 mmu_psize, ssize, local) == -1)
85 old_pte &= ~_PAGE_HPTEFLAGS; 85 old_pte &= ~_PAGE_HPTEFLAGS;
86 } 86 }
87 87
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 237c8e5f2640..834ca8eb38f2 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -21,6 +21,9 @@
21#include <asm/pgalloc.h> 21#include <asm/pgalloc.h>
22#include <asm/tlb.h> 22#include <asm/tlb.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/hugetlb.h>
25
26#ifdef CONFIG_HUGETLB_PAGE
24 27
25#define PAGE_SHIFT_64K 16 28#define PAGE_SHIFT_64K 16
26#define PAGE_SHIFT_16M 24 29#define PAGE_SHIFT_16M 24
@@ -100,68 +103,9 @@ int pgd_huge(pgd_t pgd)
100} 103}
101#endif 104#endif
102 105
103/*
104 * We have 4 cases for pgds and pmds:
105 * (1) invalid (all zeroes)
106 * (2) pointer to next table, as normal; bottom 6 bits == 0
107 * (3) leaf pte for huge page, bottom two bits != 00
108 * (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size of table
109 */
110pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift)
111{
112 pgd_t *pg;
113 pud_t *pu;
114 pmd_t *pm;
115 pte_t *ret_pte;
116 hugepd_t *hpdp = NULL;
117 unsigned pdshift = PGDIR_SHIFT;
118
119 if (shift)
120 *shift = 0;
121
122 pg = pgdir + pgd_index(ea);
123
124 if (pgd_huge(*pg)) {
125 ret_pte = (pte_t *) pg;
126 goto out;
127 } else if (is_hugepd(pg))
128 hpdp = (hugepd_t *)pg;
129 else if (!pgd_none(*pg)) {
130 pdshift = PUD_SHIFT;
131 pu = pud_offset(pg, ea);
132
133 if (pud_huge(*pu)) {
134 ret_pte = (pte_t *) pu;
135 goto out;
136 } else if (is_hugepd(pu))
137 hpdp = (hugepd_t *)pu;
138 else if (!pud_none(*pu)) {
139 pdshift = PMD_SHIFT;
140 pm = pmd_offset(pu, ea);
141
142 if (pmd_huge(*pm)) {
143 ret_pte = (pte_t *) pm;
144 goto out;
145 } else if (is_hugepd(pm))
146 hpdp = (hugepd_t *)pm;
147 else if (!pmd_none(*pm))
148 return pte_offset_kernel(pm, ea);
149 }
150 }
151 if (!hpdp)
152 return NULL;
153
154 ret_pte = hugepte_offset(hpdp, ea, pdshift);
155 pdshift = hugepd_shift(*hpdp);
156out:
157 if (shift)
158 *shift = pdshift;
159 return ret_pte;
160}
161EXPORT_SYMBOL_GPL(find_linux_pte_or_hugepte);
162
163pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 106pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
164{ 107{
108 /* Only called for hugetlbfs pages, hence can ignore THP */
165 return find_linux_pte_or_hugepte(mm->pgd, addr, NULL); 109 return find_linux_pte_or_hugepte(mm->pgd, addr, NULL);
166} 110}
167 111
@@ -357,7 +301,7 @@ void add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages)
357int alloc_bootmem_huge_page(struct hstate *hstate) 301int alloc_bootmem_huge_page(struct hstate *hstate)
358{ 302{
359 struct huge_bootmem_page *m; 303 struct huge_bootmem_page *m;
360 int idx = shift_to_mmu_psize(hstate->order + PAGE_SHIFT); 304 int idx = shift_to_mmu_psize(huge_page_shift(hstate));
361 int nr_gpages = gpage_freearray[idx].nr_gpages; 305 int nr_gpages = gpage_freearray[idx].nr_gpages;
362 306
363 if (nr_gpages == 0) 307 if (nr_gpages == 0)
@@ -592,8 +536,14 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
592 do { 536 do {
593 pmd = pmd_offset(pud, addr); 537 pmd = pmd_offset(pud, addr);
594 next = pmd_addr_end(addr, end); 538 next = pmd_addr_end(addr, end);
595 if (pmd_none_or_clear_bad(pmd)) 539 if (!is_hugepd(pmd)) {
540 /*
541 * if it is not hugepd pointer, we should already find
542 * it cleared.
543 */
544 WARN_ON(!pmd_none_or_clear_bad(pmd));
596 continue; 545 continue;
546 }
597#ifdef CONFIG_PPC_FSL_BOOK3E 547#ifdef CONFIG_PPC_FSL_BOOK3E
598 /* 548 /*
599 * Increment next by the size of the huge mapping since 549 * Increment next by the size of the huge mapping since
@@ -730,11 +680,14 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
730 struct page *page; 680 struct page *page;
731 unsigned shift; 681 unsigned shift;
732 unsigned long mask; 682 unsigned long mask;
733 683 /*
684 * Transparent hugepages are handled by generic code. We can skip them
685 * here.
686 */
734 ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift); 687 ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift);
735 688
736 /* Verify it is a huge page else bail. */ 689 /* Verify it is a huge page else bail. */
737 if (!ptep || !shift) 690 if (!ptep || !shift || pmd_trans_huge(*(pmd_t *)ptep))
738 return ERR_PTR(-EINVAL); 691 return ERR_PTR(-EINVAL);
739 692
740 mask = (1UL << shift) - 1; 693 mask = (1UL << shift) - 1;
@@ -753,69 +706,6 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
753 return NULL; 706 return NULL;
754} 707}
755 708
756int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
757 unsigned long end, int write, struct page **pages, int *nr)
758{
759 unsigned long mask;
760 unsigned long pte_end;
761 struct page *head, *page, *tail;
762 pte_t pte;
763 int refs;
764
765 pte_end = (addr + sz) & ~(sz-1);
766 if (pte_end < end)
767 end = pte_end;
768
769 pte = *ptep;
770 mask = _PAGE_PRESENT | _PAGE_USER;
771 if (write)
772 mask |= _PAGE_RW;
773
774 if ((pte_val(pte) & mask) != mask)
775 return 0;
776
777 /* hugepages are never "special" */
778 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
779
780 refs = 0;
781 head = pte_page(pte);
782
783 page = head + ((addr & (sz-1)) >> PAGE_SHIFT);
784 tail = page;
785 do {
786 VM_BUG_ON(compound_head(page) != head);
787 pages[*nr] = page;
788 (*nr)++;
789 page++;
790 refs++;
791 } while (addr += PAGE_SIZE, addr != end);
792
793 if (!page_cache_add_speculative(head, refs)) {
794 *nr -= refs;
795 return 0;
796 }
797
798 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
799 /* Could be optimized better */
800 *nr -= refs;
801 while (refs--)
802 put_page(head);
803 return 0;
804 }
805
806 /*
807 * Any tail page need their mapcount reference taken before we
808 * return.
809 */
810 while (refs--) {
811 if (PageTail(tail))
812 get_huge_page_tail(tail);
813 tail++;
814 }
815
816 return 1;
817}
818
819static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end, 709static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
820 unsigned long sz) 710 unsigned long sz)
821{ 711{
@@ -1032,3 +922,168 @@ void flush_dcache_icache_hugepage(struct page *page)
1032 } 922 }
1033 } 923 }
1034} 924}
925
926#endif /* CONFIG_HUGETLB_PAGE */
927
928/*
929 * We have 4 cases for pgds and pmds:
930 * (1) invalid (all zeroes)
931 * (2) pointer to next table, as normal; bottom 6 bits == 0
932 * (3) leaf pte for huge page, bottom two bits != 00
933 * (4) hugepd pointer, bottom two bits == 00, next 4 bits indicate size of table
934 *
935 * So long as we atomically load page table pointers we are safe against teardown,
936 * we can follow the address down to the the page and take a ref on it.
937 */
938
939pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift)
940{
941 pgd_t pgd, *pgdp;
942 pud_t pud, *pudp;
943 pmd_t pmd, *pmdp;
944 pte_t *ret_pte;
945 hugepd_t *hpdp = NULL;
946 unsigned pdshift = PGDIR_SHIFT;
947
948 if (shift)
949 *shift = 0;
950
951 pgdp = pgdir + pgd_index(ea);
952 pgd = ACCESS_ONCE(*pgdp);
953 /*
954 * Always operate on the local stack value. This make sure the
955 * value don't get updated by a parallel THP split/collapse,
956 * page fault or a page unmap. The return pte_t * is still not
957 * stable. So should be checked there for above conditions.
958 */
959 if (pgd_none(pgd))
960 return NULL;
961 else if (pgd_huge(pgd)) {
962 ret_pte = (pte_t *) pgdp;
963 goto out;
964 } else if (is_hugepd(&pgd))
965 hpdp = (hugepd_t *)&pgd;
966 else {
967 /*
968 * Even if we end up with an unmap, the pgtable will not
969 * be freed, because we do an rcu free and here we are
970 * irq disabled
971 */
972 pdshift = PUD_SHIFT;
973 pudp = pud_offset(&pgd, ea);
974 pud = ACCESS_ONCE(*pudp);
975
976 if (pud_none(pud))
977 return NULL;
978 else if (pud_huge(pud)) {
979 ret_pte = (pte_t *) pudp;
980 goto out;
981 } else if (is_hugepd(&pud))
982 hpdp = (hugepd_t *)&pud;
983 else {
984 pdshift = PMD_SHIFT;
985 pmdp = pmd_offset(&pud, ea);
986 pmd = ACCESS_ONCE(*pmdp);
987 /*
988 * A hugepage collapse is captured by pmd_none, because
989 * it mark the pmd none and do a hpte invalidate.
990 *
991 * A hugepage split is captured by pmd_trans_splitting
992 * because we mark the pmd trans splitting and do a
993 * hpte invalidate
994 *
995 */
996 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
997 return NULL;
998
999 if (pmd_huge(pmd) || pmd_large(pmd)) {
1000 ret_pte = (pte_t *) pmdp;
1001 goto out;
1002 } else if (is_hugepd(&pmd))
1003 hpdp = (hugepd_t *)&pmd;
1004 else
1005 return pte_offset_kernel(&pmd, ea);
1006 }
1007 }
1008 if (!hpdp)
1009 return NULL;
1010
1011 ret_pte = hugepte_offset(hpdp, ea, pdshift);
1012 pdshift = hugepd_shift(*hpdp);
1013out:
1014 if (shift)
1015 *shift = pdshift;
1016 return ret_pte;
1017}
1018EXPORT_SYMBOL_GPL(find_linux_pte_or_hugepte);
1019
1020int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
1021 unsigned long end, int write, struct page **pages, int *nr)
1022{
1023 unsigned long mask;
1024 unsigned long pte_end;
1025 struct page *head, *page, *tail;
1026 pte_t pte;
1027 int refs;
1028
1029 pte_end = (addr + sz) & ~(sz-1);
1030 if (pte_end < end)
1031 end = pte_end;
1032
1033 pte = ACCESS_ONCE(*ptep);
1034 mask = _PAGE_PRESENT | _PAGE_USER;
1035 if (write)
1036 mask |= _PAGE_RW;
1037
1038 if ((pte_val(pte) & mask) != mask)
1039 return 0;
1040
1041#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1042 /*
1043 * check for splitting here
1044 */
1045 if (pmd_trans_splitting(pte_pmd(pte)))
1046 return 0;
1047#endif
1048
1049 /* hugepages are never "special" */
1050 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
1051
1052 refs = 0;
1053 head = pte_page(pte);
1054
1055 page = head + ((addr & (sz-1)) >> PAGE_SHIFT);
1056 tail = page;
1057 do {
1058 VM_BUG_ON(compound_head(page) != head);
1059 pages[*nr] = page;
1060 (*nr)++;
1061 page++;
1062 refs++;
1063 } while (addr += PAGE_SIZE, addr != end);
1064
1065 if (!page_cache_add_speculative(head, refs)) {
1066 *nr -= refs;
1067 return 0;
1068 }
1069
1070 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
1071 /* Could be optimized better */
1072 *nr -= refs;
1073 while (refs--)
1074 put_page(head);
1075 return 0;
1076 }
1077
1078 /*
1079 * Any tail page need their mapcount reference taken before we
1080 * return.
1081 */
1082 while (refs--) {
1083 if (PageTail(tail))
1084 get_huge_page_tail(tail);
1085 tail++;
1086 }
1087
1088 return 1;
1089}
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index a90b9c458990..d0cd9e4c6837 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -88,7 +88,11 @@ static void pgd_ctor(void *addr)
88 88
89static void pmd_ctor(void *addr) 89static void pmd_ctor(void *addr)
90{ 90{
91#ifdef CONFIG_TRANSPARENT_HUGEPAGE
92 memset(addr, 0, PMD_TABLE_SIZE * 2);
93#else
91 memset(addr, 0, PMD_TABLE_SIZE); 94 memset(addr, 0, PMD_TABLE_SIZE);
95#endif
92} 96}
93 97
94struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE]; 98struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE];
@@ -137,10 +141,9 @@ void pgtable_cache_add(unsigned shift, void (*ctor)(void *))
137void pgtable_cache_init(void) 141void pgtable_cache_init(void)
138{ 142{
139 pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor); 143 pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor);
140 pgtable_cache_add(PMD_INDEX_SIZE, pmd_ctor); 144 pgtable_cache_add(PMD_CACHE_INDEX, pmd_ctor);
141 if (!PGT_CACHE(PGD_INDEX_SIZE) || !PGT_CACHE(PMD_INDEX_SIZE)) 145 if (!PGT_CACHE(PGD_INDEX_SIZE) || !PGT_CACHE(PMD_CACHE_INDEX))
142 panic("Couldn't allocate pgtable caches"); 146 panic("Couldn't allocate pgtable caches");
143
144 /* In all current configs, when the PUD index exists it's the 147 /* In all current configs, when the PUD index exists it's the
145 * same size as either the pgd or pmd index. Verify that the 148 * same size as either the pgd or pmd index. Verify that the
146 * initialization above has also created a PUD cache. This 149 * initialization above has also created a PUD cache. This
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 0988a26e0413..7f4bea162026 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -299,47 +299,13 @@ void __init paging_init(void)
299 299
300void __init mem_init(void) 300void __init mem_init(void)
301{ 301{
302#ifdef CONFIG_NEED_MULTIPLE_NODES
303 int nid;
304#endif
305 pg_data_t *pgdat;
306 unsigned long i;
307 struct page *page;
308 unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
309
310#ifdef CONFIG_SWIOTLB 302#ifdef CONFIG_SWIOTLB
311 swiotlb_init(0); 303 swiotlb_init(0);
312#endif 304#endif
313 305
314 num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
315 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); 306 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
316 307 set_max_mapnr(max_pfn);
317#ifdef CONFIG_NEED_MULTIPLE_NODES 308 free_all_bootmem();
318 for_each_online_node(nid) {
319 if (NODE_DATA(nid)->node_spanned_pages != 0) {
320 printk("freeing bootmem node %d\n", nid);
321 totalram_pages +=
322 free_all_bootmem_node(NODE_DATA(nid));
323 }
324 }
325#else
326 max_mapnr = max_pfn;
327 totalram_pages += free_all_bootmem();
328#endif
329 for_each_online_pgdat(pgdat) {
330 for (i = 0; i < pgdat->node_spanned_pages; i++) {
331 if (!pfn_valid(pgdat->node_start_pfn + i))
332 continue;
333 page = pgdat_page_nr(pgdat, i);
334 if (PageReserved(page))
335 reservedpages++;
336 }
337 }
338
339 codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
340 datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
341 initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
342 bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
343 309
344#ifdef CONFIG_HIGHMEM 310#ifdef CONFIG_HIGHMEM
345 { 311 {
@@ -349,13 +315,9 @@ void __init mem_init(void)
349 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { 315 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
350 phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT; 316 phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT;
351 struct page *page = pfn_to_page(pfn); 317 struct page *page = pfn_to_page(pfn);
352 if (memblock_is_reserved(paddr)) 318 if (!memblock_is_reserved(paddr))
353 continue; 319 free_highmem_page(page);
354 free_highmem_page(page);
355 reservedpages--;
356 } 320 }
357 printk(KERN_DEBUG "High memory: %luk\n",
358 totalhigh_pages << (PAGE_SHIFT-10));
359 } 321 }
360#endif /* CONFIG_HIGHMEM */ 322#endif /* CONFIG_HIGHMEM */
361 323
@@ -368,16 +330,7 @@ void __init mem_init(void)
368 (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1; 330 (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1;
369#endif 331#endif
370 332
371 printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, " 333 mem_init_print_info(NULL);
372 "%luk reserved, %luk data, %luk bss, %luk init)\n",
373 nr_free_pages() << (PAGE_SHIFT-10),
374 num_physpages << (PAGE_SHIFT-10),
375 codesize >> 10,
376 reservedpages << (PAGE_SHIFT-10),
377 datasize >> 10,
378 bsssize >> 10,
379 initsize >> 10);
380
381#ifdef CONFIG_PPC32 334#ifdef CONFIG_PPC32
382 pr_info("Kernel virtual memory layout:\n"); 335 pr_info("Kernel virtual memory layout:\n");
383 pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP); 336 pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
@@ -407,7 +360,7 @@ void free_initmem(void)
407#ifdef CONFIG_BLK_DEV_INITRD 360#ifdef CONFIG_BLK_DEV_INITRD
408void __init free_initrd_mem(unsigned long start, unsigned long end) 361void __init free_initrd_mem(unsigned long start, unsigned long end)
409{ 362{
410 free_reserved_area(start, end, 0, "initrd"); 363 free_reserved_area((void *)start, (void *)end, -1, "initrd");
411} 364}
412#endif 365#endif
413 366
@@ -508,6 +461,10 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
508 pte_t *ptep) 461 pte_t *ptep)
509{ 462{
510#ifdef CONFIG_PPC_STD_MMU 463#ifdef CONFIG_PPC_STD_MMU
464 /*
465 * We don't need to worry about _PAGE_PRESENT here because we are
466 * called with either mm->page_table_lock held or ptl lock held
467 */
511 unsigned long access = 0, trap; 468 unsigned long access = 0, trap;
512 469
513 /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */ 470 /* We only want HPTEs for linux PTEs that have _PAGE_ACCESSED set */
diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap.c
index 67a42ed0d2fc..67a42ed0d2fc 100644
--- a/arch/powerpc/mm/mmap_64.c
+++ b/arch/powerpc/mm/mmap.c
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index e779642c25e5..af3d78e19302 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -112,8 +112,10 @@ static unsigned int steal_context_smp(unsigned int id)
112 */ 112 */
113 for_each_cpu(cpu, mm_cpumask(mm)) { 113 for_each_cpu(cpu, mm_cpumask(mm)) {
114 for (i = cpu_first_thread_sibling(cpu); 114 for (i = cpu_first_thread_sibling(cpu);
115 i <= cpu_last_thread_sibling(cpu); i++) 115 i <= cpu_last_thread_sibling(cpu); i++) {
116 __set_bit(id, stale_map[i]); 116 if (stale_map[i])
117 __set_bit(id, stale_map[i]);
118 }
117 cpu = i - 1; 119 cpu = i - 1;
118 } 120 }
119 return id; 121 return id;
@@ -272,7 +274,8 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
272 /* XXX This clear should ultimately be part of local_flush_tlb_mm */ 274 /* XXX This clear should ultimately be part of local_flush_tlb_mm */
273 for (i = cpu_first_thread_sibling(cpu); 275 for (i = cpu_first_thread_sibling(cpu);
274 i <= cpu_last_thread_sibling(cpu); i++) { 276 i <= cpu_last_thread_sibling(cpu); i++) {
275 __clear_bit(id, stale_map[i]); 277 if (stale_map[i])
278 __clear_bit(id, stale_map[i]);
276 } 279 }
277 } 280 }
278 281
@@ -329,8 +332,8 @@ void destroy_context(struct mm_struct *mm)
329 332
330#ifdef CONFIG_SMP 333#ifdef CONFIG_SMP
331 334
332static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self, 335static int mmu_context_cpu_notify(struct notifier_block *self,
333 unsigned long action, void *hcpu) 336 unsigned long action, void *hcpu)
334{ 337{
335 unsigned int cpu = (unsigned int)(long)hcpu; 338 unsigned int cpu = (unsigned int)(long)hcpu;
336 339
@@ -363,7 +366,7 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self,
363 return NOTIFY_OK; 366 return NOTIFY_OK;
364} 367}
365 368
366static struct notifier_block __cpuinitdata mmu_context_cpu_nb = { 369static struct notifier_block mmu_context_cpu_nb = {
367 .notifier_call = mmu_context_cpu_notify, 370 .notifier_call = mmu_context_cpu_notify,
368}; 371};
369 372
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 88c0425dc0a8..08397217e8ac 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -516,7 +516,7 @@ static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
516 * Figure out to which domain a cpu belongs and stick it there. 516 * Figure out to which domain a cpu belongs and stick it there.
517 * Return the id of the domain used. 517 * Return the id of the domain used.
518 */ 518 */
519static int __cpuinit numa_setup_cpu(unsigned long lcpu) 519static int numa_setup_cpu(unsigned long lcpu)
520{ 520{
521 int nid = 0; 521 int nid = 0;
522 struct device_node *cpu = of_get_cpu_node(lcpu, NULL); 522 struct device_node *cpu = of_get_cpu_node(lcpu, NULL);
@@ -538,8 +538,7 @@ out:
538 return nid; 538 return nid;
539} 539}
540 540
541static int __cpuinit cpu_numa_callback(struct notifier_block *nfb, 541static int cpu_numa_callback(struct notifier_block *nfb, unsigned long action,
542 unsigned long action,
543 void *hcpu) 542 void *hcpu)
544{ 543{
545 unsigned long lcpu = (unsigned long)hcpu; 544 unsigned long lcpu = (unsigned long)hcpu;
@@ -919,7 +918,7 @@ static void __init *careful_zallocation(int nid, unsigned long size,
919 return ret; 918 return ret;
920} 919}
921 920
922static struct notifier_block __cpuinitdata ppc64_numa_nb = { 921static struct notifier_block ppc64_numa_nb = {
923 .notifier_call = cpu_numa_callback, 922 .notifier_call = cpu_numa_callback,
924 .priority = 1 /* Must run before sched domains notifier. */ 923 .priority = 1 /* Must run before sched domains notifier. */
925}; 924};
@@ -1433,11 +1432,9 @@ static int update_cpu_topology(void *data)
1433 if (cpu != update->cpu) 1432 if (cpu != update->cpu)
1434 continue; 1433 continue;
1435 1434
1436 unregister_cpu_under_node(update->cpu, update->old_nid);
1437 unmap_cpu_from_node(update->cpu); 1435 unmap_cpu_from_node(update->cpu);
1438 map_cpu_to_node(update->cpu, update->new_nid); 1436 map_cpu_to_node(update->cpu, update->new_nid);
1439 vdso_getcpu_init(); 1437 vdso_getcpu_init();
1440 register_cpu_under_node(update->cpu, update->new_nid);
1441 } 1438 }
1442 1439
1443 return 0; 1440 return 0;
@@ -1485,6 +1482,9 @@ int arch_update_cpu_topology(void)
1485 stop_machine(update_cpu_topology, &updates[0], &updated_cpus); 1482 stop_machine(update_cpu_topology, &updates[0], &updated_cpus);
1486 1483
1487 for (ud = &updates[0]; ud; ud = ud->next) { 1484 for (ud = &updates[0]; ud; ud = ud->next) {
1485 unregister_cpu_under_node(ud->cpu, ud->old_nid);
1486 register_cpu_under_node(ud->cpu, ud->new_nid);
1487
1488 dev = get_cpu_device(ud->cpu); 1488 dev = get_cpu_device(ud->cpu);
1489 if (dev) 1489 if (dev)
1490 kobject_uevent(&dev->kobj, KOBJ_CHANGE); 1490 kobject_uevent(&dev->kobj, KOBJ_CHANGE);
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 214130a4edc6..edda589795c3 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -235,6 +235,14 @@ void assert_pte_locked(struct mm_struct *mm, unsigned long addr)
235 pud = pud_offset(pgd, addr); 235 pud = pud_offset(pgd, addr);
236 BUG_ON(pud_none(*pud)); 236 BUG_ON(pud_none(*pud));
237 pmd = pmd_offset(pud, addr); 237 pmd = pmd_offset(pud, addr);
238 /*
239 * khugepaged to collapse normal pages to hugepage, first set
240 * pmd to none to force page fault/gup to take mmap_sem. After
241 * pmd is set to none, we do a pte_clear which does this assertion
242 * so if we find pmd none, return.
243 */
244 if (pmd_none(*pmd))
245 return;
238 BUG_ON(!pmd_present(*pmd)); 246 BUG_ON(!pmd_present(*pmd));
239 assert_spin_locked(pte_lockptr(mm, pmd)); 247 assert_spin_locked(pte_lockptr(mm, pmd));
240} 248}
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index a854096e1023..536eec72c0f7 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -338,6 +338,19 @@ EXPORT_SYMBOL(iounmap);
338EXPORT_SYMBOL(__iounmap); 338EXPORT_SYMBOL(__iounmap);
339EXPORT_SYMBOL(__iounmap_at); 339EXPORT_SYMBOL(__iounmap_at);
340 340
341/*
342 * For hugepage we have pfn in the pmd, we use PTE_RPN_SHIFT bits for flags
343 * For PTE page, we have a PTE_FRAG_SIZE (4K) aligned virtual address.
344 */
345struct page *pmd_page(pmd_t pmd)
346{
347#ifdef CONFIG_TRANSPARENT_HUGEPAGE
348 if (pmd_trans_huge(pmd))
349 return pfn_to_page(pmd_pfn(pmd));
350#endif
351 return virt_to_page(pmd_page_vaddr(pmd));
352}
353
341#ifdef CONFIG_PPC_64K_PAGES 354#ifdef CONFIG_PPC_64K_PAGES
342static pte_t *get_from_cache(struct mm_struct *mm) 355static pte_t *get_from_cache(struct mm_struct *mm)
343{ 356{
@@ -455,3 +468,404 @@ void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
455} 468}
456#endif 469#endif
457#endif /* CONFIG_PPC_64K_PAGES */ 470#endif /* CONFIG_PPC_64K_PAGES */
471
472#ifdef CONFIG_TRANSPARENT_HUGEPAGE
473
474/*
475 * This is called when relaxing access to a hugepage. It's also called in the page
476 * fault path when we don't hit any of the major fault cases, ie, a minor
477 * update of _PAGE_ACCESSED, _PAGE_DIRTY, etc... The generic code will have
478 * handled those two for us, we additionally deal with missing execute
479 * permission here on some processors
480 */
481int pmdp_set_access_flags(struct vm_area_struct *vma, unsigned long address,
482 pmd_t *pmdp, pmd_t entry, int dirty)
483{
484 int changed;
485#ifdef CONFIG_DEBUG_VM
486 WARN_ON(!pmd_trans_huge(*pmdp));
487 assert_spin_locked(&vma->vm_mm->page_table_lock);
488#endif
489 changed = !pmd_same(*(pmdp), entry);
490 if (changed) {
491 __ptep_set_access_flags(pmdp_ptep(pmdp), pmd_pte(entry));
492 /*
493 * Since we are not supporting SW TLB systems, we don't
494 * have any thing similar to flush_tlb_page_nohash()
495 */
496 }
497 return changed;
498}
499
500unsigned long pmd_hugepage_update(struct mm_struct *mm, unsigned long addr,
501 pmd_t *pmdp, unsigned long clr)
502{
503
504 unsigned long old, tmp;
505
506#ifdef CONFIG_DEBUG_VM
507 WARN_ON(!pmd_trans_huge(*pmdp));
508 assert_spin_locked(&mm->page_table_lock);
509#endif
510
511#ifdef PTE_ATOMIC_UPDATES
512 __asm__ __volatile__(
513 "1: ldarx %0,0,%3\n\
514 andi. %1,%0,%6\n\
515 bne- 1b \n\
516 andc %1,%0,%4 \n\
517 stdcx. %1,0,%3 \n\
518 bne- 1b"
519 : "=&r" (old), "=&r" (tmp), "=m" (*pmdp)
520 : "r" (pmdp), "r" (clr), "m" (*pmdp), "i" (_PAGE_BUSY)
521 : "cc" );
522#else
523 old = pmd_val(*pmdp);
524 *pmdp = __pmd(old & ~clr);
525#endif
526 if (old & _PAGE_HASHPTE)
527 hpte_do_hugepage_flush(mm, addr, pmdp);
528 return old;
529}
530
531pmd_t pmdp_clear_flush(struct vm_area_struct *vma, unsigned long address,
532 pmd_t *pmdp)
533{
534 pmd_t pmd;
535
536 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
537 if (pmd_trans_huge(*pmdp)) {
538 pmd = pmdp_get_and_clear(vma->vm_mm, address, pmdp);
539 } else {
540 /*
541 * khugepaged calls this for normal pmd
542 */
543 pmd = *pmdp;
544 pmd_clear(pmdp);
545 /*
546 * Wait for all pending hash_page to finish. This is needed
547 * in case of subpage collapse. When we collapse normal pages
548 * to hugepage, we first clear the pmd, then invalidate all
549 * the PTE entries. The assumption here is that any low level
550 * page fault will see a none pmd and take the slow path that
551 * will wait on mmap_sem. But we could very well be in a
552 * hash_page with local ptep pointer value. Such a hash page
553 * can result in adding new HPTE entries for normal subpages.
554 * That means we could be modifying the page content as we
555 * copy them to a huge page. So wait for parallel hash_page
556 * to finish before invalidating HPTE entries. We can do this
557 * by sending an IPI to all the cpus and executing a dummy
558 * function there.
559 */
560 kick_all_cpus_sync();
561 /*
562 * Now invalidate the hpte entries in the range
563 * covered by pmd. This make sure we take a
564 * fault and will find the pmd as none, which will
565 * result in a major fault which takes mmap_sem and
566 * hence wait for collapse to complete. Without this
567 * the __collapse_huge_page_copy can result in copying
568 * the old content.
569 */
570 flush_tlb_pmd_range(vma->vm_mm, &pmd, address);
571 }
572 return pmd;
573}
574
575int pmdp_test_and_clear_young(struct vm_area_struct *vma,
576 unsigned long address, pmd_t *pmdp)
577{
578 return __pmdp_test_and_clear_young(vma->vm_mm, address, pmdp);
579}
580
581/*
582 * We currently remove entries from the hashtable regardless of whether
583 * the entry was young or dirty. The generic routines only flush if the
584 * entry was young or dirty which is not good enough.
585 *
586 * We should be more intelligent about this but for the moment we override
587 * these functions and force a tlb flush unconditionally
588 */
589int pmdp_clear_flush_young(struct vm_area_struct *vma,
590 unsigned long address, pmd_t *pmdp)
591{
592 return __pmdp_test_and_clear_young(vma->vm_mm, address, pmdp);
593}
594
595/*
596 * We mark the pmd splitting and invalidate all the hpte
597 * entries for this hugepage.
598 */
599void pmdp_splitting_flush(struct vm_area_struct *vma,
600 unsigned long address, pmd_t *pmdp)
601{
602 unsigned long old, tmp;
603
604 VM_BUG_ON(address & ~HPAGE_PMD_MASK);
605
606#ifdef CONFIG_DEBUG_VM
607 WARN_ON(!pmd_trans_huge(*pmdp));
608 assert_spin_locked(&vma->vm_mm->page_table_lock);
609#endif
610
611#ifdef PTE_ATOMIC_UPDATES
612
613 __asm__ __volatile__(
614 "1: ldarx %0,0,%3\n\
615 andi. %1,%0,%6\n\
616 bne- 1b \n\
617 ori %1,%0,%4 \n\
618 stdcx. %1,0,%3 \n\
619 bne- 1b"
620 : "=&r" (old), "=&r" (tmp), "=m" (*pmdp)
621 : "r" (pmdp), "i" (_PAGE_SPLITTING), "m" (*pmdp), "i" (_PAGE_BUSY)
622 : "cc" );
623#else
624 old = pmd_val(*pmdp);
625 *pmdp = __pmd(old | _PAGE_SPLITTING);
626#endif
627 /*
628 * If we didn't had the splitting flag set, go and flush the
629 * HPTE entries.
630 */
631 if (!(old & _PAGE_SPLITTING)) {
632 /* We need to flush the hpte */
633 if (old & _PAGE_HASHPTE)
634 hpte_do_hugepage_flush(vma->vm_mm, address, pmdp);
635 }
636}
637
638/*
639 * We want to put the pgtable in pmd and use pgtable for tracking
640 * the base page size hptes
641 */
642void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
643 pgtable_t pgtable)
644{
645 pgtable_t *pgtable_slot;
646 assert_spin_locked(&mm->page_table_lock);
647 /*
648 * we store the pgtable in the second half of PMD
649 */
650 pgtable_slot = (pgtable_t *)pmdp + PTRS_PER_PMD;
651 *pgtable_slot = pgtable;
652 /*
653 * expose the deposited pgtable to other cpus.
654 * before we set the hugepage PTE at pmd level
655 * hash fault code looks at the deposted pgtable
656 * to store hash index values.
657 */
658 smp_wmb();
659}
660
661pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
662{
663 pgtable_t pgtable;
664 pgtable_t *pgtable_slot;
665
666 assert_spin_locked(&mm->page_table_lock);
667 pgtable_slot = (pgtable_t *)pmdp + PTRS_PER_PMD;
668 pgtable = *pgtable_slot;
669 /*
670 * Once we withdraw, mark the entry NULL.
671 */
672 *pgtable_slot = NULL;
673 /*
674 * We store HPTE information in the deposited PTE fragment.
675 * zero out the content on withdraw.
676 */
677 memset(pgtable, 0, PTE_FRAG_SIZE);
678 return pgtable;
679}
680
681/*
682 * set a new huge pmd. We should not be called for updating
683 * an existing pmd entry. That should go via pmd_hugepage_update.
684 */
685void set_pmd_at(struct mm_struct *mm, unsigned long addr,
686 pmd_t *pmdp, pmd_t pmd)
687{
688#ifdef CONFIG_DEBUG_VM
689 WARN_ON(!pmd_none(*pmdp));
690 assert_spin_locked(&mm->page_table_lock);
691 WARN_ON(!pmd_trans_huge(pmd));
692#endif
693 return set_pte_at(mm, addr, pmdp_ptep(pmdp), pmd_pte(pmd));
694}
695
696void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
697 pmd_t *pmdp)
698{
699 pmd_hugepage_update(vma->vm_mm, address, pmdp, _PAGE_PRESENT);
700}
701
702/*
703 * A linux hugepage PMD was changed and the corresponding hash table entries
704 * neesd to be flushed.
705 */
706void hpte_do_hugepage_flush(struct mm_struct *mm, unsigned long addr,
707 pmd_t *pmdp)
708{
709 int ssize, i;
710 unsigned long s_addr;
711 int max_hpte_count;
712 unsigned int psize, valid;
713 unsigned char *hpte_slot_array;
714 unsigned long hidx, vpn, vsid, hash, shift, slot;
715
716 /*
717 * Flush all the hptes mapping this hugepage
718 */
719 s_addr = addr & HPAGE_PMD_MASK;
720 hpte_slot_array = get_hpte_slot_array(pmdp);
721 /*
722 * IF we try to do a HUGE PTE update after a withdraw is done.
723 * we will find the below NULL. This happens when we do
724 * split_huge_page_pmd
725 */
726 if (!hpte_slot_array)
727 return;
728
729 /* get the base page size */
730 psize = get_slice_psize(mm, s_addr);
731
732 if (ppc_md.hugepage_invalidate)
733 return ppc_md.hugepage_invalidate(mm, hpte_slot_array,
734 s_addr, psize);
735 /*
736 * No bluk hpte removal support, invalidate each entry
737 */
738 shift = mmu_psize_defs[psize].shift;
739 max_hpte_count = HPAGE_PMD_SIZE >> shift;
740 for (i = 0; i < max_hpte_count; i++) {
741 /*
742 * 8 bits per each hpte entries
743 * 000| [ secondary group (one bit) | hidx (3 bits) | valid bit]
744 */
745 valid = hpte_valid(hpte_slot_array, i);
746 if (!valid)
747 continue;
748 hidx = hpte_hash_index(hpte_slot_array, i);
749
750 /* get the vpn */
751 addr = s_addr + (i * (1ul << shift));
752 if (!is_kernel_addr(addr)) {
753 ssize = user_segment_size(addr);
754 vsid = get_vsid(mm->context.id, addr, ssize);
755 WARN_ON(vsid == 0);
756 } else {
757 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
758 ssize = mmu_kernel_ssize;
759 }
760
761 vpn = hpt_vpn(addr, vsid, ssize);
762 hash = hpt_hash(vpn, shift, ssize);
763 if (hidx & _PTEIDX_SECONDARY)
764 hash = ~hash;
765
766 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
767 slot += hidx & _PTEIDX_GROUP_IX;
768 ppc_md.hpte_invalidate(slot, vpn, psize,
769 MMU_PAGE_16M, ssize, 0);
770 }
771}
772
773static pmd_t pmd_set_protbits(pmd_t pmd, pgprot_t pgprot)
774{
775 pmd_val(pmd) |= pgprot_val(pgprot);
776 return pmd;
777}
778
779pmd_t pfn_pmd(unsigned long pfn, pgprot_t pgprot)
780{
781 pmd_t pmd;
782 /*
783 * For a valid pte, we would have _PAGE_PRESENT or _PAGE_FILE always
784 * set. We use this to check THP page at pmd level.
785 * leaf pte for huge page, bottom two bits != 00
786 */
787 pmd_val(pmd) = pfn << PTE_RPN_SHIFT;
788 pmd_val(pmd) |= _PAGE_THP_HUGE;
789 pmd = pmd_set_protbits(pmd, pgprot);
790 return pmd;
791}
792
793pmd_t mk_pmd(struct page *page, pgprot_t pgprot)
794{
795 return pfn_pmd(page_to_pfn(page), pgprot);
796}
797
798pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
799{
800
801 pmd_val(pmd) &= _HPAGE_CHG_MASK;
802 pmd = pmd_set_protbits(pmd, newprot);
803 return pmd;
804}
805
806/*
807 * This is called at the end of handling a user page fault, when the
808 * fault has been handled by updating a HUGE PMD entry in the linux page tables.
809 * We use it to preload an HPTE into the hash table corresponding to
810 * the updated linux HUGE PMD entry.
811 */
812void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
813 pmd_t *pmd)
814{
815 return;
816}
817
818pmd_t pmdp_get_and_clear(struct mm_struct *mm,
819 unsigned long addr, pmd_t *pmdp)
820{
821 pmd_t old_pmd;
822 pgtable_t pgtable;
823 unsigned long old;
824 pgtable_t *pgtable_slot;
825
826 old = pmd_hugepage_update(mm, addr, pmdp, ~0UL);
827 old_pmd = __pmd(old);
828 /*
829 * We have pmd == none and we are holding page_table_lock.
830 * So we can safely go and clear the pgtable hash
831 * index info.
832 */
833 pgtable_slot = (pgtable_t *)pmdp + PTRS_PER_PMD;
834 pgtable = *pgtable_slot;
835 /*
836 * Let's zero out old valid and hash index details
837 * hash fault look at them.
838 */
839 memset(pgtable, 0, PTE_FRAG_SIZE);
840 return old_pmd;
841}
842
843int has_transparent_hugepage(void)
844{
845 if (!mmu_has_feature(MMU_FTR_16M_PAGE))
846 return 0;
847 /*
848 * We support THP only if PMD_SIZE is 16MB.
849 */
850 if (mmu_psize_defs[MMU_PAGE_16M].shift != PMD_SHIFT)
851 return 0;
852 /*
853 * We need to make sure that we support 16MB hugepage in a segement
854 * with base page size 64K or 4K. We only enable THP with a PAGE_SIZE
855 * of 64K.
856 */
857 /*
858 * If we have 64K HPTE, we will be using that by default
859 */
860 if (mmu_psize_defs[MMU_PAGE_64K].shift &&
861 (mmu_psize_defs[MMU_PAGE_64K].penc[MMU_PAGE_16M] == -1))
862 return 0;
863 /*
864 * Ok we only have 4K HPTE
865 */
866 if (mmu_psize_defs[MMU_PAGE_4K].penc[MMU_PAGE_16M] == -1)
867 return 0;
868
869 return 1;
870}
871#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index 7c415ddde948..aa74acb0fdfc 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -130,6 +130,53 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len)
130 up_write(&mm->mmap_sem); 130 up_write(&mm->mmap_sem);
131} 131}
132 132
133#ifdef CONFIG_TRANSPARENT_HUGEPAGE
134static int subpage_walk_pmd_entry(pmd_t *pmd, unsigned long addr,
135 unsigned long end, struct mm_walk *walk)
136{
137 struct vm_area_struct *vma = walk->private;
138 split_huge_page_pmd(vma, addr, pmd);
139 return 0;
140}
141
142static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr,
143 unsigned long len)
144{
145 struct vm_area_struct *vma;
146 struct mm_walk subpage_proto_walk = {
147 .mm = mm,
148 .pmd_entry = subpage_walk_pmd_entry,
149 };
150
151 /*
152 * We don't try too hard, we just mark all the vma in that range
153 * VM_NOHUGEPAGE and split them.
154 */
155 vma = find_vma(mm, addr);
156 /*
157 * If the range is in unmapped range, just return
158 */
159 if (vma && ((addr + len) <= vma->vm_start))
160 return;
161
162 while (vma) {
163 if (vma->vm_start >= (addr + len))
164 break;
165 vma->vm_flags |= VM_NOHUGEPAGE;
166 subpage_proto_walk.private = vma;
167 walk_page_range(vma->vm_start, vma->vm_end,
168 &subpage_proto_walk);
169 vma = vma->vm_next;
170 }
171}
172#else
173static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr,
174 unsigned long len)
175{
176 return;
177}
178#endif
179
133/* 180/*
134 * Copy in a subpage protection map for an address range. 181 * Copy in a subpage protection map for an address range.
135 * The map has 2 bits per 4k subpage, so 32 bits per 64k page. 182 * The map has 2 bits per 4k subpage, so 32 bits per 64k page.
@@ -168,6 +215,7 @@ long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
168 return -EFAULT; 215 return -EFAULT;
169 216
170 down_write(&mm->mmap_sem); 217 down_write(&mm->mmap_sem);
218 subpage_mark_vma_nohuge(mm, addr, len);
171 for (limit = addr + len; addr < limit; addr = next) { 219 for (limit = addr + len; addr < limit; addr = next) {
172 next = pmd_addr_end(addr, limit); 220 next = pmd_addr_end(addr, limit);
173 err = -ENOMEM; 221 err = -ENOMEM;
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 023ec8a13f38..36e44b4260eb 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -183,12 +183,13 @@ void tlb_flush(struct mmu_gather *tlb)
183 * since 64K pages may overlap with other bridges when using 64K pages 183 * since 64K pages may overlap with other bridges when using 64K pages
184 * with 4K HW pages on IO space. 184 * with 4K HW pages on IO space.
185 * 185 *
186 * Because of that usage pattern, it's only available with CONFIG_HOTPLUG 186 * Because of that usage pattern, it is implemented for small size rather
187 * and is implemented for small size rather than speed. 187 * than speed.
188 */ 188 */
189void __flush_hash_table_range(struct mm_struct *mm, unsigned long start, 189void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
190 unsigned long end) 190 unsigned long end)
191{ 191{
192 int hugepage_shift;
192 unsigned long flags; 193 unsigned long flags;
193 194
194 start = _ALIGN_DOWN(start, PAGE_SIZE); 195 start = _ALIGN_DOWN(start, PAGE_SIZE);
@@ -206,7 +207,8 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
206 local_irq_save(flags); 207 local_irq_save(flags);
207 arch_enter_lazy_mmu_mode(); 208 arch_enter_lazy_mmu_mode();
208 for (; start < end; start += PAGE_SIZE) { 209 for (; start < end; start += PAGE_SIZE) {
209 pte_t *ptep = find_linux_pte(mm->pgd, start); 210 pte_t *ptep = find_linux_pte_or_hugepte(mm->pgd, start,
211 &hugepage_shift);
210 unsigned long pte; 212 unsigned long pte;
211 213
212 if (ptep == NULL) 214 if (ptep == NULL)
@@ -214,7 +216,37 @@ void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
214 pte = pte_val(*ptep); 216 pte = pte_val(*ptep);
215 if (!(pte & _PAGE_HASHPTE)) 217 if (!(pte & _PAGE_HASHPTE))
216 continue; 218 continue;
217 hpte_need_flush(mm, start, ptep, pte, 0); 219 if (unlikely(hugepage_shift && pmd_trans_huge(*(pmd_t *)pte)))
220 hpte_do_hugepage_flush(mm, start, (pmd_t *)pte);
221 else
222 hpte_need_flush(mm, start, ptep, pte, 0);
223 }
224 arch_leave_lazy_mmu_mode();
225 local_irq_restore(flags);
226}
227
228void flush_tlb_pmd_range(struct mm_struct *mm, pmd_t *pmd, unsigned long addr)
229{
230 pte_t *pte;
231 pte_t *start_pte;
232 unsigned long flags;
233
234 addr = _ALIGN_DOWN(addr, PMD_SIZE);
235 /* Note: Normally, we should only ever use a batch within a
236 * PTE locked section. This violates the rule, but will work
237 * since we don't actually modify the PTEs, we just flush the
238 * hash while leaving the PTEs intact (including their reference
239 * to being hashed). This is not the most performance oriented
240 * way to do things but is fine for our needs here.
241 */
242 local_irq_save(flags);
243 arch_enter_lazy_mmu_mode();
244 start_pte = pte_offset_map(pmd, addr);
245 for (pte = start_pte; pte < start_pte + PTRS_PER_PTE; pte++) {
246 unsigned long pteval = pte_val(*pte);
247 if (pteval & _PAGE_HASHPTE)
248 hpte_need_flush(mm, addr, pte, pteval, 0);
249 addr += PAGE_SIZE;
218 } 250 }
219 arch_leave_lazy_mmu_mode(); 251 arch_leave_lazy_mmu_mode();
220 local_irq_restore(flags); 252 local_irq_restore(flags);
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 6888cad5103d..41cd68dee681 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -648,7 +648,7 @@ void __init early_init_mmu(void)
648 __early_init_mmu(1); 648 __early_init_mmu(1);
649} 649}
650 650
651void __cpuinit early_init_mmu_secondary(void) 651void early_init_mmu_secondary(void)
652{ 652{
653 __early_init_mmu(0); 653 __early_init_mmu(0);
654} 654}
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 845c867444e6..a3985aee77fe 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -75,6 +75,11 @@ static unsigned int freeze_events_kernel = MMCR0_FCS;
75 75
76#define MMCR0_FCHV 0 76#define MMCR0_FCHV 0
77#define MMCR0_PMCjCE MMCR0_PMCnCE 77#define MMCR0_PMCjCE MMCR0_PMCnCE
78#define MMCR0_FC56 0
79#define MMCR0_PMAO 0
80#define MMCR0_EBE 0
81#define MMCR0_PMCC 0
82#define MMCR0_PMCC_U6 0
78 83
79#define SPRN_MMCRA SPRN_MMCR2 84#define SPRN_MMCRA SPRN_MMCR2
80#define MMCRA_SAMPLE_ENABLE 0 85#define MMCRA_SAMPLE_ENABLE 0
@@ -102,6 +107,15 @@ static inline int siar_valid(struct pt_regs *regs)
102 return 1; 107 return 1;
103} 108}
104 109
110static bool is_ebb_event(struct perf_event *event) { return false; }
111static int ebb_event_check(struct perf_event *event) { return 0; }
112static void ebb_event_add(struct perf_event *event) { }
113static void ebb_switch_out(unsigned long mmcr0) { }
114static unsigned long ebb_switch_in(bool ebb, unsigned long mmcr0)
115{
116 return mmcr0;
117}
118
105static inline void power_pmu_bhrb_enable(struct perf_event *event) {} 119static inline void power_pmu_bhrb_enable(struct perf_event *event) {}
106static inline void power_pmu_bhrb_disable(struct perf_event *event) {} 120static inline void power_pmu_bhrb_disable(struct perf_event *event) {}
107void power_pmu_flush_branch_stack(void) {} 121void power_pmu_flush_branch_stack(void) {}
@@ -462,6 +476,89 @@ void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw)
462 return; 476 return;
463} 477}
464 478
479static bool is_ebb_event(struct perf_event *event)
480{
481 /*
482 * This could be a per-PMU callback, but we'd rather avoid the cost. We
483 * check that the PMU supports EBB, meaning those that don't can still
484 * use bit 63 of the event code for something else if they wish.
485 */
486 return (ppmu->flags & PPMU_EBB) &&
487 ((event->attr.config >> EVENT_CONFIG_EBB_SHIFT) & 1);
488}
489
490static int ebb_event_check(struct perf_event *event)
491{
492 struct perf_event *leader = event->group_leader;
493
494 /* Event and group leader must agree on EBB */
495 if (is_ebb_event(leader) != is_ebb_event(event))
496 return -EINVAL;
497
498 if (is_ebb_event(event)) {
499 if (!(event->attach_state & PERF_ATTACH_TASK))
500 return -EINVAL;
501
502 if (!leader->attr.pinned || !leader->attr.exclusive)
503 return -EINVAL;
504
505 if (event->attr.inherit || event->attr.sample_period ||
506 event->attr.enable_on_exec || event->attr.freq)
507 return -EINVAL;
508 }
509
510 return 0;
511}
512
513static void ebb_event_add(struct perf_event *event)
514{
515 if (!is_ebb_event(event) || current->thread.used_ebb)
516 return;
517
518 /*
519 * IFF this is the first time we've added an EBB event, set
520 * PMXE in the user MMCR0 so we can detect when it's cleared by
521 * userspace. We need this so that we can context switch while
522 * userspace is in the EBB handler (where PMXE is 0).
523 */
524 current->thread.used_ebb = 1;
525 current->thread.mmcr0 |= MMCR0_PMXE;
526}
527
528static void ebb_switch_out(unsigned long mmcr0)
529{
530 if (!(mmcr0 & MMCR0_EBE))
531 return;
532
533 current->thread.siar = mfspr(SPRN_SIAR);
534 current->thread.sier = mfspr(SPRN_SIER);
535 current->thread.sdar = mfspr(SPRN_SDAR);
536 current->thread.mmcr0 = mmcr0 & MMCR0_USER_MASK;
537 current->thread.mmcr2 = mfspr(SPRN_MMCR2) & MMCR2_USER_MASK;
538}
539
540static unsigned long ebb_switch_in(bool ebb, unsigned long mmcr0)
541{
542 if (!ebb)
543 goto out;
544
545 /* Enable EBB and read/write to all 6 PMCs for userspace */
546 mmcr0 |= MMCR0_EBE | MMCR0_PMCC_U6;
547
548 /* Add any bits from the user reg, FC or PMAO */
549 mmcr0 |= current->thread.mmcr0;
550
551 /* Be careful not to set PMXE if userspace had it cleared */
552 if (!(current->thread.mmcr0 & MMCR0_PMXE))
553 mmcr0 &= ~MMCR0_PMXE;
554
555 mtspr(SPRN_SIAR, current->thread.siar);
556 mtspr(SPRN_SIER, current->thread.sier);
557 mtspr(SPRN_SDAR, current->thread.sdar);
558 mtspr(SPRN_MMCR2, current->thread.mmcr2);
559out:
560 return mmcr0;
561}
465#endif /* CONFIG_PPC64 */ 562#endif /* CONFIG_PPC64 */
466 563
467static void perf_event_interrupt(struct pt_regs *regs); 564static void perf_event_interrupt(struct pt_regs *regs);
@@ -732,6 +829,13 @@ static void power_pmu_read(struct perf_event *event)
732 829
733 if (!event->hw.idx) 830 if (!event->hw.idx)
734 return; 831 return;
832
833 if (is_ebb_event(event)) {
834 val = read_pmc(event->hw.idx);
835 local64_set(&event->hw.prev_count, val);
836 return;
837 }
838
735 /* 839 /*
736 * Performance monitor interrupts come even when interrupts 840 * Performance monitor interrupts come even when interrupts
737 * are soft-disabled, as long as interrupts are hard-enabled. 841 * are soft-disabled, as long as interrupts are hard-enabled.
@@ -852,7 +956,7 @@ static void write_mmcr0(struct cpu_hw_events *cpuhw, unsigned long mmcr0)
852static void power_pmu_disable(struct pmu *pmu) 956static void power_pmu_disable(struct pmu *pmu)
853{ 957{
854 struct cpu_hw_events *cpuhw; 958 struct cpu_hw_events *cpuhw;
855 unsigned long flags; 959 unsigned long flags, mmcr0, val;
856 960
857 if (!ppmu) 961 if (!ppmu)
858 return; 962 return;
@@ -860,9 +964,6 @@ static void power_pmu_disable(struct pmu *pmu)
860 cpuhw = &__get_cpu_var(cpu_hw_events); 964 cpuhw = &__get_cpu_var(cpu_hw_events);
861 965
862 if (!cpuhw->disabled) { 966 if (!cpuhw->disabled) {
863 cpuhw->disabled = 1;
864 cpuhw->n_added = 0;
865
866 /* 967 /*
867 * Check if we ever enabled the PMU on this cpu. 968 * Check if we ever enabled the PMU on this cpu.
868 */ 969 */
@@ -872,6 +973,21 @@ static void power_pmu_disable(struct pmu *pmu)
872 } 973 }
873 974
874 /* 975 /*
976 * Set the 'freeze counters' bit, clear EBE/PMCC/PMAO/FC56.
977 */
978 val = mmcr0 = mfspr(SPRN_MMCR0);
979 val |= MMCR0_FC;
980 val &= ~(MMCR0_EBE | MMCR0_PMCC | MMCR0_PMAO | MMCR0_FC56);
981
982 /*
983 * The barrier is to make sure the mtspr has been
984 * executed and the PMU has frozen the events etc.
985 * before we return.
986 */
987 write_mmcr0(cpuhw, val);
988 mb();
989
990 /*
875 * Disable instruction sampling if it was enabled 991 * Disable instruction sampling if it was enabled
876 */ 992 */
877 if (cpuhw->mmcr[2] & MMCRA_SAMPLE_ENABLE) { 993 if (cpuhw->mmcr[2] & MMCRA_SAMPLE_ENABLE) {
@@ -880,15 +996,12 @@ static void power_pmu_disable(struct pmu *pmu)
880 mb(); 996 mb();
881 } 997 }
882 998
883 /* 999 cpuhw->disabled = 1;
884 * Set the 'freeze counters' bit. 1000 cpuhw->n_added = 0;
885 * The barrier is to make sure the mtspr has been 1001
886 * executed and the PMU has frozen the events 1002 ebb_switch_out(mmcr0);
887 * before we return.
888 */
889 write_mmcr0(cpuhw, mfspr(SPRN_MMCR0) | MMCR0_FC);
890 mb();
891 } 1003 }
1004
892 local_irq_restore(flags); 1005 local_irq_restore(flags);
893} 1006}
894 1007
@@ -903,23 +1016,36 @@ static void power_pmu_enable(struct pmu *pmu)
903 struct cpu_hw_events *cpuhw; 1016 struct cpu_hw_events *cpuhw;
904 unsigned long flags; 1017 unsigned long flags;
905 long i; 1018 long i;
906 unsigned long val; 1019 unsigned long val, mmcr0;
907 s64 left; 1020 s64 left;
908 unsigned int hwc_index[MAX_HWEVENTS]; 1021 unsigned int hwc_index[MAX_HWEVENTS];
909 int n_lim; 1022 int n_lim;
910 int idx; 1023 int idx;
1024 bool ebb;
911 1025
912 if (!ppmu) 1026 if (!ppmu)
913 return; 1027 return;
914 local_irq_save(flags); 1028 local_irq_save(flags);
1029
915 cpuhw = &__get_cpu_var(cpu_hw_events); 1030 cpuhw = &__get_cpu_var(cpu_hw_events);
916 if (!cpuhw->disabled) { 1031 if (!cpuhw->disabled)
917 local_irq_restore(flags); 1032 goto out;
918 return; 1033
1034 if (cpuhw->n_events == 0) {
1035 ppc_set_pmu_inuse(0);
1036 goto out;
919 } 1037 }
1038
920 cpuhw->disabled = 0; 1039 cpuhw->disabled = 0;
921 1040
922 /* 1041 /*
1042 * EBB requires an exclusive group and all events must have the EBB
1043 * flag set, or not set, so we can just check a single event. Also we
1044 * know we have at least one event.
1045 */
1046 ebb = is_ebb_event(cpuhw->event[0]);
1047
1048 /*
923 * If we didn't change anything, or only removed events, 1049 * If we didn't change anything, or only removed events,
924 * no need to recalculate MMCR* settings and reset the PMCs. 1050 * no need to recalculate MMCR* settings and reset the PMCs.
925 * Just reenable the PMU with the current MMCR* settings 1051 * Just reenable the PMU with the current MMCR* settings
@@ -928,8 +1054,6 @@ static void power_pmu_enable(struct pmu *pmu)
928 if (!cpuhw->n_added) { 1054 if (!cpuhw->n_added) {
929 mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE); 1055 mtspr(SPRN_MMCRA, cpuhw->mmcr[2] & ~MMCRA_SAMPLE_ENABLE);
930 mtspr(SPRN_MMCR1, cpuhw->mmcr[1]); 1056 mtspr(SPRN_MMCR1, cpuhw->mmcr[1]);
931 if (cpuhw->n_events == 0)
932 ppc_set_pmu_inuse(0);
933 goto out_enable; 1057 goto out_enable;
934 } 1058 }
935 1059
@@ -996,25 +1120,34 @@ static void power_pmu_enable(struct pmu *pmu)
996 ++n_lim; 1120 ++n_lim;
997 continue; 1121 continue;
998 } 1122 }
999 val = 0; 1123
1000 if (event->hw.sample_period) { 1124 if (ebb)
1001 left = local64_read(&event->hw.period_left); 1125 val = local64_read(&event->hw.prev_count);
1002 if (left < 0x80000000L) 1126 else {
1003 val = 0x80000000L - left; 1127 val = 0;
1128 if (event->hw.sample_period) {
1129 left = local64_read(&event->hw.period_left);
1130 if (left < 0x80000000L)
1131 val = 0x80000000L - left;
1132 }
1133 local64_set(&event->hw.prev_count, val);
1004 } 1134 }
1005 local64_set(&event->hw.prev_count, val); 1135
1006 event->hw.idx = idx; 1136 event->hw.idx = idx;
1007 if (event->hw.state & PERF_HES_STOPPED) 1137 if (event->hw.state & PERF_HES_STOPPED)
1008 val = 0; 1138 val = 0;
1009 write_pmc(idx, val); 1139 write_pmc(idx, val);
1140
1010 perf_event_update_userpage(event); 1141 perf_event_update_userpage(event);
1011 } 1142 }
1012 cpuhw->n_limited = n_lim; 1143 cpuhw->n_limited = n_lim;
1013 cpuhw->mmcr[0] |= MMCR0_PMXE | MMCR0_FCECE; 1144 cpuhw->mmcr[0] |= MMCR0_PMXE | MMCR0_FCECE;
1014 1145
1015 out_enable: 1146 out_enable:
1147 mmcr0 = ebb_switch_in(ebb, cpuhw->mmcr[0]);
1148
1016 mb(); 1149 mb();
1017 write_mmcr0(cpuhw, cpuhw->mmcr[0]); 1150 write_mmcr0(cpuhw, mmcr0);
1018 1151
1019 /* 1152 /*
1020 * Enable instruction sampling if necessary 1153 * Enable instruction sampling if necessary
@@ -1112,6 +1245,8 @@ static int power_pmu_add(struct perf_event *event, int ef_flags)
1112 event->hw.config = cpuhw->events[n0]; 1245 event->hw.config = cpuhw->events[n0];
1113 1246
1114nocheck: 1247nocheck:
1248 ebb_event_add(event);
1249
1115 ++cpuhw->n_events; 1250 ++cpuhw->n_events;
1116 ++cpuhw->n_added; 1251 ++cpuhw->n_added;
1117 1252
@@ -1472,6 +1607,11 @@ static int power_pmu_event_init(struct perf_event *event)
1472 } 1607 }
1473 } 1608 }
1474 1609
1610 /* Extra checks for EBB */
1611 err = ebb_event_check(event);
1612 if (err)
1613 return err;
1614
1475 /* 1615 /*
1476 * If this is in a group, check if it can go on with all the 1616 * If this is in a group, check if it can go on with all the
1477 * other hardware events in the group. We assume the event 1617 * other hardware events in the group. We assume the event
@@ -1511,6 +1651,13 @@ static int power_pmu_event_init(struct perf_event *event)
1511 local64_set(&event->hw.period_left, event->hw.last_period); 1651 local64_set(&event->hw.period_left, event->hw.last_period);
1512 1652
1513 /* 1653 /*
1654 * For EBB events we just context switch the PMC value, we don't do any
1655 * of the sample_period logic. We use hw.prev_count for this.
1656 */
1657 if (is_ebb_event(event))
1658 local64_set(&event->hw.prev_count, 0);
1659
1660 /*
1514 * See if we need to reserve the PMU. 1661 * See if we need to reserve the PMU.
1515 * If no events are currently in use, then we have to take a 1662 * If no events are currently in use, then we have to take a
1516 * mutex to ensure that we don't race with another task doing 1663 * mutex to ensure that we don't race with another task doing
@@ -1758,7 +1905,7 @@ static void perf_event_interrupt(struct pt_regs *regs)
1758 } 1905 }
1759 } 1906 }
1760 } 1907 }
1761 if ((!found) && printk_ratelimit()) 1908 if (!found && !nmi && printk_ratelimit())
1762 printk(KERN_WARNING "Can't find PMC that caused IRQ\n"); 1909 printk(KERN_WARNING "Can't find PMC that caused IRQ\n");
1763 1910
1764 /* 1911 /*
@@ -1786,7 +1933,7 @@ static void power_pmu_setup(int cpu)
1786 cpuhw->mmcr[0] = MMCR0_FC; 1933 cpuhw->mmcr[0] = MMCR0_FC;
1787} 1934}
1788 1935
1789static int __cpuinit 1936static int
1790power_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 1937power_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1791{ 1938{
1792 unsigned int cpu = (long)hcpu; 1939 unsigned int cpu = (long)hcpu;
@@ -1803,7 +1950,7 @@ power_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu
1803 return NOTIFY_OK; 1950 return NOTIFY_OK;
1804} 1951}
1805 1952
1806int __cpuinit register_power_pmu(struct power_pmu *pmu) 1953int register_power_pmu(struct power_pmu *pmu)
1807{ 1954{
1808 if (ppmu) 1955 if (ppmu)
1809 return -EBUSY; /* something's already registered */ 1956 return -EBUSY; /* something's already registered */
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 3c475d6267c7..13c3f0e547a2 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -62,6 +62,29 @@
62#define PME_PM_BRU_FIN 0x10068 62#define PME_PM_BRU_FIN 0x10068
63#define PME_PM_BRU_MPRED 0x400f6 63#define PME_PM_BRU_MPRED 0x400f6
64 64
65#define PME_PM_CMPLU_STALL_FXU 0x20014
66#define PME_PM_CMPLU_STALL_DIV 0x40014
67#define PME_PM_CMPLU_STALL_SCALAR 0x40012
68#define PME_PM_CMPLU_STALL_SCALAR_LONG 0x20018
69#define PME_PM_CMPLU_STALL_VECTOR 0x2001c
70#define PME_PM_CMPLU_STALL_VECTOR_LONG 0x4004a
71#define PME_PM_CMPLU_STALL_LSU 0x20012
72#define PME_PM_CMPLU_STALL_REJECT 0x40016
73#define PME_PM_CMPLU_STALL_ERAT_MISS 0x40018
74#define PME_PM_CMPLU_STALL_DCACHE_MISS 0x20016
75#define PME_PM_CMPLU_STALL_STORE 0x2004a
76#define PME_PM_CMPLU_STALL_THRD 0x1001c
77#define PME_PM_CMPLU_STALL_IFU 0x4004c
78#define PME_PM_CMPLU_STALL_BRU 0x4004e
79#define PME_PM_GCT_NOSLOT_IC_MISS 0x2001a
80#define PME_PM_GCT_NOSLOT_BR_MPRED 0x4001a
81#define PME_PM_GCT_NOSLOT_BR_MPRED_IC_MISS 0x4001c
82#define PME_PM_GRP_CMPL 0x30004
83#define PME_PM_1PLUS_PPC_CMPL 0x100f2
84#define PME_PM_CMPLU_STALL_DFU 0x2003c
85#define PME_PM_RUN_CYC 0x200f4
86#define PME_PM_RUN_INST_CMPL 0x400fa
87
65/* 88/*
66 * Layout of constraint bits: 89 * Layout of constraint bits:
67 * 6666555555555544444444443333333333222222222211111111110000000000 90 * 6666555555555544444444443333333333222222222211111111110000000000
@@ -393,6 +416,31 @@ POWER_EVENT_ATTR(LD_MISS_L1, LD_MISS_L1);
393POWER_EVENT_ATTR(BRU_FIN, BRU_FIN) 416POWER_EVENT_ATTR(BRU_FIN, BRU_FIN)
394POWER_EVENT_ATTR(BRU_MPRED, BRU_MPRED); 417POWER_EVENT_ATTR(BRU_MPRED, BRU_MPRED);
395 418
419POWER_EVENT_ATTR(CMPLU_STALL_FXU, CMPLU_STALL_FXU);
420POWER_EVENT_ATTR(CMPLU_STALL_DIV, CMPLU_STALL_DIV);
421POWER_EVENT_ATTR(CMPLU_STALL_SCALAR, CMPLU_STALL_SCALAR);
422POWER_EVENT_ATTR(CMPLU_STALL_SCALAR_LONG, CMPLU_STALL_SCALAR_LONG);
423POWER_EVENT_ATTR(CMPLU_STALL_VECTOR, CMPLU_STALL_VECTOR);
424POWER_EVENT_ATTR(CMPLU_STALL_VECTOR_LONG, CMPLU_STALL_VECTOR_LONG);
425POWER_EVENT_ATTR(CMPLU_STALL_LSU, CMPLU_STALL_LSU);
426POWER_EVENT_ATTR(CMPLU_STALL_REJECT, CMPLU_STALL_REJECT);
427
428POWER_EVENT_ATTR(CMPLU_STALL_ERAT_MISS, CMPLU_STALL_ERAT_MISS);
429POWER_EVENT_ATTR(CMPLU_STALL_DCACHE_MISS, CMPLU_STALL_DCACHE_MISS);
430POWER_EVENT_ATTR(CMPLU_STALL_STORE, CMPLU_STALL_STORE);
431POWER_EVENT_ATTR(CMPLU_STALL_THRD, CMPLU_STALL_THRD);
432POWER_EVENT_ATTR(CMPLU_STALL_IFU, CMPLU_STALL_IFU);
433POWER_EVENT_ATTR(CMPLU_STALL_BRU, CMPLU_STALL_BRU);
434POWER_EVENT_ATTR(GCT_NOSLOT_IC_MISS, GCT_NOSLOT_IC_MISS);
435
436POWER_EVENT_ATTR(GCT_NOSLOT_BR_MPRED, GCT_NOSLOT_BR_MPRED);
437POWER_EVENT_ATTR(GCT_NOSLOT_BR_MPRED_IC_MISS, GCT_NOSLOT_BR_MPRED_IC_MISS);
438POWER_EVENT_ATTR(GRP_CMPL, GRP_CMPL);
439POWER_EVENT_ATTR(1PLUS_PPC_CMPL, 1PLUS_PPC_CMPL);
440POWER_EVENT_ATTR(CMPLU_STALL_DFU, CMPLU_STALL_DFU);
441POWER_EVENT_ATTR(RUN_CYC, RUN_CYC);
442POWER_EVENT_ATTR(RUN_INST_CMPL, RUN_INST_CMPL);
443
396static struct attribute *power7_events_attr[] = { 444static struct attribute *power7_events_attr[] = {
397 GENERIC_EVENT_PTR(CYC), 445 GENERIC_EVENT_PTR(CYC),
398 GENERIC_EVENT_PTR(GCT_NOSLOT_CYC), 446 GENERIC_EVENT_PTR(GCT_NOSLOT_CYC),
@@ -411,6 +459,31 @@ static struct attribute *power7_events_attr[] = {
411 POWER_EVENT_PTR(LD_MISS_L1), 459 POWER_EVENT_PTR(LD_MISS_L1),
412 POWER_EVENT_PTR(BRU_FIN), 460 POWER_EVENT_PTR(BRU_FIN),
413 POWER_EVENT_PTR(BRU_MPRED), 461 POWER_EVENT_PTR(BRU_MPRED),
462
463 POWER_EVENT_PTR(CMPLU_STALL_FXU),
464 POWER_EVENT_PTR(CMPLU_STALL_DIV),
465 POWER_EVENT_PTR(CMPLU_STALL_SCALAR),
466 POWER_EVENT_PTR(CMPLU_STALL_SCALAR_LONG),
467 POWER_EVENT_PTR(CMPLU_STALL_VECTOR),
468 POWER_EVENT_PTR(CMPLU_STALL_VECTOR_LONG),
469 POWER_EVENT_PTR(CMPLU_STALL_LSU),
470 POWER_EVENT_PTR(CMPLU_STALL_REJECT),
471
472 POWER_EVENT_PTR(CMPLU_STALL_ERAT_MISS),
473 POWER_EVENT_PTR(CMPLU_STALL_DCACHE_MISS),
474 POWER_EVENT_PTR(CMPLU_STALL_STORE),
475 POWER_EVENT_PTR(CMPLU_STALL_THRD),
476 POWER_EVENT_PTR(CMPLU_STALL_IFU),
477 POWER_EVENT_PTR(CMPLU_STALL_BRU),
478 POWER_EVENT_PTR(GCT_NOSLOT_IC_MISS),
479 POWER_EVENT_PTR(GCT_NOSLOT_BR_MPRED),
480
481 POWER_EVENT_PTR(GCT_NOSLOT_BR_MPRED_IC_MISS),
482 POWER_EVENT_PTR(GRP_CMPL),
483 POWER_EVENT_PTR(1PLUS_PPC_CMPL),
484 POWER_EVENT_PTR(CMPLU_STALL_DFU),
485 POWER_EVENT_PTR(RUN_CYC),
486 POWER_EVENT_PTR(RUN_INST_CMPL),
414 NULL 487 NULL
415}; 488};
416 489
diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c
index f7d1c4fff303..96a64d6a8bdf 100644
--- a/arch/powerpc/perf/power8-pmu.c
+++ b/arch/powerpc/perf/power8-pmu.c
@@ -31,9 +31,9 @@
31 * 31 *
32 * 60 56 52 48 44 40 36 32 32 * 60 56 52 48 44 40 36 32
33 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | 33 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
34 * [ thresh_cmp ] [ thresh_ctl ] 34 * | [ thresh_cmp ] [ thresh_ctl ]
35 * | 35 * | |
36 * thresh start/stop OR FAB match -* 36 * *- EBB (Linux) thresh start/stop OR FAB match -*
37 * 37 *
38 * 28 24 20 16 12 8 4 0 38 * 28 24 20 16 12 8 4 0
39 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | 39 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
@@ -85,6 +85,7 @@
85 * 85 *
86 */ 86 */
87 87
88#define EVENT_EBB_MASK 1ull
88#define EVENT_THR_CMP_SHIFT 40 /* Threshold CMP value */ 89#define EVENT_THR_CMP_SHIFT 40 /* Threshold CMP value */
89#define EVENT_THR_CMP_MASK 0x3ff 90#define EVENT_THR_CMP_MASK 0x3ff
90#define EVENT_THR_CTL_SHIFT 32 /* Threshold control value (start/stop) */ 91#define EVENT_THR_CTL_SHIFT 32 /* Threshold control value (start/stop) */
@@ -109,6 +110,17 @@
109#define EVENT_IS_MARKED (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) 110#define EVENT_IS_MARKED (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT)
110#define EVENT_PSEL_MASK 0xff /* PMCxSEL value */ 111#define EVENT_PSEL_MASK 0xff /* PMCxSEL value */
111 112
113#define EVENT_VALID_MASK \
114 ((EVENT_THRESH_MASK << EVENT_THRESH_SHIFT) | \
115 (EVENT_SAMPLE_MASK << EVENT_SAMPLE_SHIFT) | \
116 (EVENT_CACHE_SEL_MASK << EVENT_CACHE_SEL_SHIFT) | \
117 (EVENT_PMC_MASK << EVENT_PMC_SHIFT) | \
118 (EVENT_UNIT_MASK << EVENT_UNIT_SHIFT) | \
119 (EVENT_COMBINE_MASK << EVENT_COMBINE_SHIFT) | \
120 (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \
121 (EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT) | \
122 EVENT_PSEL_MASK)
123
112/* MMCRA IFM bits - POWER8 */ 124/* MMCRA IFM bits - POWER8 */
113#define POWER8_MMCRA_IFM1 0x0000000040000000UL 125#define POWER8_MMCRA_IFM1 0x0000000040000000UL
114#define POWER8_MMCRA_IFM2 0x0000000080000000UL 126#define POWER8_MMCRA_IFM2 0x0000000080000000UL
@@ -130,10 +142,10 @@
130 * 142 *
131 * 28 24 20 16 12 8 4 0 143 * 28 24 20 16 12 8 4 0
132 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | 144 * | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - | - - - - |
133 * [ ] [ sample ] [ ] [6] [5] [4] [3] [2] [1] 145 * | [ ] [ sample ] [ ] [6] [5] [4] [3] [2] [1]
134 * | | 146 * EBB -* | |
135 * L1 I/D qualifier -* | Count of events for each PMC. 147 * | | Count of events for each PMC.
136 * | p1, p2, p3, p4, p5, p6. 148 * L1 I/D qualifier -* | p1, p2, p3, p4, p5, p6.
137 * nc - number of counters -* 149 * nc - number of counters -*
138 * 150 *
139 * The PMC fields P1..P6, and NC, are adder fields. As we accumulate constraints 151 * The PMC fields P1..P6, and NC, are adder fields. As we accumulate constraints
@@ -149,6 +161,9 @@
149#define CNST_THRESH_VAL(v) (((v) & EVENT_THRESH_MASK) << 32) 161#define CNST_THRESH_VAL(v) (((v) & EVENT_THRESH_MASK) << 32)
150#define CNST_THRESH_MASK CNST_THRESH_VAL(EVENT_THRESH_MASK) 162#define CNST_THRESH_MASK CNST_THRESH_VAL(EVENT_THRESH_MASK)
151 163
164#define CNST_EBB_VAL(v) (((v) & EVENT_EBB_MASK) << 24)
165#define CNST_EBB_MASK CNST_EBB_VAL(EVENT_EBB_MASK)
166
152#define CNST_L1_QUAL_VAL(v) (((v) & 3) << 22) 167#define CNST_L1_QUAL_VAL(v) (((v) & 3) << 22)
153#define CNST_L1_QUAL_MASK CNST_L1_QUAL_VAL(3) 168#define CNST_L1_QUAL_MASK CNST_L1_QUAL_VAL(3)
154 169
@@ -207,14 +222,21 @@ static inline bool event_is_fab_match(u64 event)
207 222
208static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp) 223static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)
209{ 224{
210 unsigned int unit, pmc, cache; 225 unsigned int unit, pmc, cache, ebb;
211 unsigned long mask, value; 226 unsigned long mask, value;
212 227
213 mask = value = 0; 228 mask = value = 0;
214 229
215 pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; 230 if (event & ~EVENT_VALID_MASK)
216 unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK; 231 return -1;
217 cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK; 232
233 pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK;
234 unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK;
235 cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK;
236 ebb = (event >> EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK;
237
238 /* Clear the EBB bit in the event, so event checks work below */
239 event &= ~(EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT);
218 240
219 if (pmc) { 241 if (pmc) {
220 if (pmc > 6) 242 if (pmc > 6)
@@ -284,6 +306,18 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long
284 value |= CNST_THRESH_VAL(event >> EVENT_THRESH_SHIFT); 306 value |= CNST_THRESH_VAL(event >> EVENT_THRESH_SHIFT);
285 } 307 }
286 308
309 if (!pmc && ebb)
310 /* EBB events must specify the PMC */
311 return -1;
312
313 /*
314 * All events must agree on EBB, either all request it or none.
315 * EBB events are pinned & exclusive, so this should never actually
316 * hit, but we leave it as a fallback in case.
317 */
318 mask |= CNST_EBB_VAL(ebb);
319 value |= CNST_EBB_MASK;
320
287 *maskp = mask; 321 *maskp = mask;
288 *valp = value; 322 *valp = value;
289 323
@@ -378,6 +412,10 @@ static int power8_compute_mmcr(u64 event[], int n_ev,
378 if (pmc_inuse & 0x7c) 412 if (pmc_inuse & 0x7c)
379 mmcr[0] |= MMCR0_PMCjCE; 413 mmcr[0] |= MMCR0_PMCjCE;
380 414
415 /* If we're not using PMC 5 or 6, freeze them */
416 if (!(pmc_inuse & 0x60))
417 mmcr[0] |= MMCR0_FC56;
418
381 mmcr[1] = mmcr1; 419 mmcr[1] = mmcr1;
382 mmcr[2] = mmcra; 420 mmcr[2] = mmcra;
383 421
@@ -574,7 +612,7 @@ static struct power_pmu power8_pmu = {
574 .get_constraint = power8_get_constraint, 612 .get_constraint = power8_get_constraint,
575 .get_alternatives = power8_get_alternatives, 613 .get_alternatives = power8_get_alternatives,
576 .disable_pmc = power8_disable_pmc, 614 .disable_pmc = power8_disable_pmc,
577 .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB, 615 .flags = PPMU_HAS_SSLOT | PPMU_HAS_SIER | PPMU_BHRB | PPMU_EBB,
578 .n_generic = ARRAY_SIZE(power8_generic_events), 616 .n_generic = ARRAY_SIZE(power8_generic_events),
579 .generic_events = power8_generic_events, 617 .generic_events = power8_generic_events,
580 .attr_groups = power8_pmu_attr_groups, 618 .attr_groups = power8_pmu_attr_groups,
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index ecd3890c40d7..7f1b71a01c6a 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -91,12 +91,12 @@ static void __init ppc47x_init_irq(void)
91} 91}
92 92
93#ifdef CONFIG_SMP 93#ifdef CONFIG_SMP
94static void __cpuinit smp_ppc47x_setup_cpu(int cpu) 94static void smp_ppc47x_setup_cpu(int cpu)
95{ 95{
96 mpic_setup_this_cpu(); 96 mpic_setup_this_cpu();
97} 97}
98 98
99static int __cpuinit smp_ppc47x_kick_cpu(int cpu) 99static int smp_ppc47x_kick_cpu(int cpu)
100{ 100{
101 struct device_node *cpunode = of_get_cpu_node(cpu, NULL); 101 struct device_node *cpunode = of_get_cpu_node(cpu, NULL);
102 const u64 *spin_table_addr_prop; 102 const u64 *spin_table_addr_prop;
@@ -176,13 +176,48 @@ static int __init ppc47x_probe(void)
176 return 1; 176 return 1;
177} 177}
178 178
179static int board_rev = -1;
180static int __init ppc47x_get_board_rev(void)
181{
182 u8 fpga_reg0;
183 void *fpga;
184 struct device_node *np;
185
186 np = of_find_compatible_node(NULL, NULL, "ibm,currituck-fpga");
187 if (!np)
188 goto fail;
189
190 fpga = of_iomap(np, 0);
191 of_node_put(np);
192 if (!fpga)
193 goto fail;
194
195 fpga_reg0 = ioread8(fpga);
196 board_rev = fpga_reg0 & 0x03;
197 pr_info("%s: Found board revision %d\n", __func__, board_rev);
198 iounmap(fpga);
199 return 0;
200
201fail:
202 pr_info("%s: Unable to find board revision\n", __func__);
203 return 0;
204}
205machine_arch_initcall(ppc47x, ppc47x_get_board_rev);
206
179/* Use USB controller should have been hardware swizzled but it wasn't :( */ 207/* Use USB controller should have been hardware swizzled but it wasn't :( */
180static void ppc47x_pci_irq_fixup(struct pci_dev *dev) 208static void ppc47x_pci_irq_fixup(struct pci_dev *dev)
181{ 209{
182 if (dev->vendor == 0x1033 && (dev->device == 0x0035 || 210 if (dev->vendor == 0x1033 && (dev->device == 0x0035 ||
183 dev->device == 0x00e0)) { 211 dev->device == 0x00e0)) {
184 dev->irq = irq_create_mapping(NULL, 47); 212 if (board_rev == 0) {
185 pr_info("%s: Mapping irq 47 %d\n", __func__, dev->irq); 213 dev->irq = irq_create_mapping(NULL, 47);
214 pr_info("%s: Mapping irq %d\n", __func__, dev->irq);
215 } else if (board_rev == 2) {
216 dev->irq = irq_create_mapping(NULL, 49);
217 pr_info("%s: Mapping irq %d\n", __func__, dev->irq);
218 } else {
219 pr_alert("%s: Unknown board revision\n", __func__);
220 }
186 } 221 }
187} 222}
188 223
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c
index a28a8629727e..4241bc825800 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -81,12 +81,12 @@ static void __init iss4xx_init_irq(void)
81} 81}
82 82
83#ifdef CONFIG_SMP 83#ifdef CONFIG_SMP
84static void __cpuinit smp_iss4xx_setup_cpu(int cpu) 84static void smp_iss4xx_setup_cpu(int cpu)
85{ 85{
86 mpic_setup_this_cpu(); 86 mpic_setup_this_cpu();
87} 87}
88 88
89static int __cpuinit smp_iss4xx_kick_cpu(int cpu) 89static int smp_iss4xx_kick_cpu(int cpu)
90{ 90{
91 struct device_node *cpunode = of_get_cpu_node(cpu, NULL); 91 struct device_node *cpunode = of_get_cpu_node(cpu, NULL);
92 const u64 *spin_table_addr_prop; 92 const u64 *spin_table_addr_prop;
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index 0a134e0469ef..3e90ece10ae9 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -43,9 +43,7 @@ static void __init mpc5121_ads_setup_arch(void)
43 mpc83xx_add_bridge(np); 43 mpc83xx_add_bridge(np);
44#endif 44#endif
45 45
46#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 46 mpc512x_setup_arch();
47 mpc512x_setup_diu();
48#endif
49} 47}
50 48
51static void __init mpc5121_ads_init_IRQ(void) 49static void __init mpc5121_ads_init_IRQ(void)
@@ -69,7 +67,7 @@ define_machine(mpc5121_ads) {
69 .probe = mpc5121_ads_probe, 67 .probe = mpc5121_ads_probe,
70 .setup_arch = mpc5121_ads_setup_arch, 68 .setup_arch = mpc5121_ads_setup_arch,
71 .init = mpc512x_init, 69 .init = mpc512x_init,
72 .init_early = mpc512x_init_diu, 70 .init_early = mpc512x_init_early,
73 .init_IRQ = mpc5121_ads_init_IRQ, 71 .init_IRQ = mpc5121_ads_init_IRQ,
74 .get_irq = ipic_get_irq, 72 .get_irq = ipic_get_irq,
75 .calibrate_decr = generic_calibrate_decr, 73 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index 0a8e60023944..cc97f022d028 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -12,18 +12,12 @@
12#ifndef __MPC512X_H__ 12#ifndef __MPC512X_H__
13#define __MPC512X_H__ 13#define __MPC512X_H__
14extern void __init mpc512x_init_IRQ(void); 14extern void __init mpc512x_init_IRQ(void);
15extern void __init mpc512x_init_early(void);
15extern void __init mpc512x_init(void); 16extern void __init mpc512x_init(void);
17extern void __init mpc512x_setup_arch(void);
16extern int __init mpc5121_clk_init(void); 18extern int __init mpc5121_clk_init(void);
17void __init mpc512x_declare_of_platform_devices(void);
18extern const char *mpc512x_select_psc_compat(void); 19extern const char *mpc512x_select_psc_compat(void);
20extern const char *mpc512x_select_reset_compat(void);
19extern void mpc512x_restart(char *cmd); 21extern void mpc512x_restart(char *cmd);
20 22
21#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
22void mpc512x_init_diu(void);
23void mpc512x_setup_diu(void);
24#else
25#define mpc512x_init_diu NULL
26#define mpc512x_setup_diu NULL
27#endif
28
29#endif /* __MPC512X_H__ */ 23#endif /* __MPC512X_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_generic.c b/arch/powerpc/platforms/512x/mpc512x_generic.c
index 5fb919b30924..ce71408781a0 100644
--- a/arch/powerpc/platforms/512x/mpc512x_generic.c
+++ b/arch/powerpc/platforms/512x/mpc512x_generic.c
@@ -45,8 +45,8 @@ define_machine(mpc512x_generic) {
45 .name = "MPC512x generic", 45 .name = "MPC512x generic",
46 .probe = mpc512x_generic_probe, 46 .probe = mpc512x_generic_probe,
47 .init = mpc512x_init, 47 .init = mpc512x_init,
48 .init_early = mpc512x_init_diu, 48 .init_early = mpc512x_init_early,
49 .setup_arch = mpc512x_setup_diu, 49 .setup_arch = mpc512x_setup_arch,
50 .init_IRQ = mpc512x_init_IRQ, 50 .init_IRQ = mpc512x_init_IRQ,
51 .get_irq = ipic_get_irq, 51 .get_irq = ipic_get_irq,
52 .calibrate_decr = generic_calibrate_decr, 52 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 6eb94ab99d39..a82a41b4fd91 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -35,8 +35,10 @@ static struct mpc512x_reset_module __iomem *reset_module_base;
35static void __init mpc512x_restart_init(void) 35static void __init mpc512x_restart_init(void)
36{ 36{
37 struct device_node *np; 37 struct device_node *np;
38 const char *reset_compat;
38 39
39 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-reset"); 40 reset_compat = mpc512x_select_reset_compat();
41 np = of_find_compatible_node(NULL, NULL, reset_compat);
40 if (!np) 42 if (!np)
41 return; 43 return;
42 44
@@ -58,7 +60,7 @@ void mpc512x_restart(char *cmd)
58 ; 60 ;
59} 61}
60 62
61#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 63#if IS_ENABLED(CONFIG_FB_FSL_DIU)
62 64
63struct fsl_diu_shared_fb { 65struct fsl_diu_shared_fb {
64 u8 gamma[0x300]; /* 32-bit aligned! */ 66 u8 gamma[0x300]; /* 32-bit aligned! */
@@ -355,6 +357,17 @@ const char *mpc512x_select_psc_compat(void)
355 return NULL; 357 return NULL;
356} 358}
357 359
360const char *mpc512x_select_reset_compat(void)
361{
362 if (of_machine_is_compatible("fsl,mpc5121"))
363 return "fsl,mpc5121-reset";
364
365 if (of_machine_is_compatible("fsl,mpc5125"))
366 return "fsl,mpc5125-reset";
367
368 return NULL;
369}
370
358static unsigned int __init get_fifo_size(struct device_node *np, 371static unsigned int __init get_fifo_size(struct device_node *np,
359 char *prop_name) 372 char *prop_name)
360{ 373{
@@ -436,14 +449,26 @@ void __init mpc512x_psc_fifo_init(void)
436 } 449 }
437} 450}
438 451
452void __init mpc512x_init_early(void)
453{
454 mpc512x_restart_init();
455 if (IS_ENABLED(CONFIG_FB_FSL_DIU))
456 mpc512x_init_diu();
457}
458
439void __init mpc512x_init(void) 459void __init mpc512x_init(void)
440{ 460{
441 mpc5121_clk_init(); 461 mpc5121_clk_init();
442 mpc512x_declare_of_platform_devices(); 462 mpc512x_declare_of_platform_devices();
443 mpc512x_restart_init();
444 mpc512x_psc_fifo_init(); 463 mpc512x_psc_fifo_init();
445} 464}
446 465
466void __init mpc512x_setup_arch(void)
467{
468 if (IS_ENABLED(CONFIG_FB_FSL_DIU))
469 mpc512x_setup_diu();
470}
471
447/** 472/**
448 * mpc512x_cs_config - Setup chip select configuration 473 * mpc512x_cs_config - Setup chip select configuration
449 * @cs: chip select number 474 * @cs: chip select number
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
index 0575e858291c..24b314d7bd5f 100644
--- a/arch/powerpc/platforms/512x/pdm360ng.c
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -119,9 +119,9 @@ static int __init pdm360ng_probe(void)
119define_machine(pdm360ng) { 119define_machine(pdm360ng) {
120 .name = "PDM360NG", 120 .name = "PDM360NG",
121 .probe = pdm360ng_probe, 121 .probe = pdm360ng_probe,
122 .setup_arch = mpc512x_setup_diu, 122 .setup_arch = mpc512x_setup_arch,
123 .init = pdm360ng_init, 123 .init = pdm360ng_init,
124 .init_early = mpc512x_init_diu, 124 .init_early = mpc512x_init_early,
125 .init_IRQ = mpc512x_init_IRQ, 125 .init_IRQ = mpc512x_init_IRQ,
126 .get_irq = ipic_get_irq, 126 .get_irq = ipic_get_irq,
127 .calibrate_decr = generic_calibrate_decr, 127 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 624cb51d19c9..7bc315822935 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -231,17 +231,7 @@ static struct i2c_driver mcu_driver = {
231 .id_table = mcu_ids, 231 .id_table = mcu_ids,
232}; 232};
233 233
234static int __init mcu_init(void) 234module_i2c_driver(mcu_driver);
235{
236 return i2c_add_driver(&mcu_driver);
237}
238module_init(mcu_init);
239
240static void __exit mcu_exit(void)
241{
242 i2c_del_driver(&mcu_driver);
243}
244module_exit(mcu_exit);
245 235
246MODULE_DESCRIPTION("Power Management and GPIO expander driver for " 236MODULE_DESCRIPTION("Power Management and GPIO expander driver for "
247 "MPC8349E-mITX-compatible MCU"); 237 "MPC8349E-mITX-compatible MCU");
diff --git a/arch/powerpc/platforms/85xx/p5020_ds.c b/arch/powerpc/platforms/85xx/p5020_ds.c
index 753a42c29d4d..39cfa4044e6c 100644
--- a/arch/powerpc/platforms/85xx/p5020_ds.c
+++ b/arch/powerpc/platforms/85xx/p5020_ds.c
@@ -75,12 +75,7 @@ define_machine(p5020_ds) {
75#ifdef CONFIG_PCI 75#ifdef CONFIG_PCI
76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
77#endif 77#endif
78/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
79#ifdef CONFIG_PPC64
80 .get_irq = mpic_get_irq,
81#else
82 .get_irq = mpic_get_coreint_irq, 78 .get_irq = mpic_get_coreint_irq,
83#endif
84 .restart = fsl_rstcr_restart, 79 .restart = fsl_rstcr_restart,
85 .calibrate_decr = generic_calibrate_decr, 80 .calibrate_decr = generic_calibrate_decr,
86 .progress = udbg_progress, 81 .progress = udbg_progress,
diff --git a/arch/powerpc/platforms/85xx/p5040_ds.c b/arch/powerpc/platforms/85xx/p5040_ds.c
index 11381851828e..f70e74cddf97 100644
--- a/arch/powerpc/platforms/85xx/p5040_ds.c
+++ b/arch/powerpc/platforms/85xx/p5040_ds.c
@@ -66,12 +66,7 @@ define_machine(p5040_ds) {
66#ifdef CONFIG_PCI 66#ifdef CONFIG_PCI
67 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 67 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
68#endif 68#endif
69/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
70#ifdef CONFIG_PPC64
71 .get_irq = mpic_get_irq,
72#else
73 .get_irq = mpic_get_coreint_irq, 69 .get_irq = mpic_get_coreint_irq,
74#endif
75 .restart = fsl_rstcr_restart, 70 .restart = fsl_rstcr_restart,
76 .calibrate_decr = generic_calibrate_decr, 71 .calibrate_decr = generic_calibrate_decr,
77 .progress = udbg_progress, 72 .progress = udbg_progress,
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 6a1759939c6b..5ced4f5bb2b2 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -99,7 +99,7 @@ static void mpc85xx_take_timebase(void)
99} 99}
100 100
101#ifdef CONFIG_HOTPLUG_CPU 101#ifdef CONFIG_HOTPLUG_CPU
102static void __cpuinit smp_85xx_mach_cpu_die(void) 102static void smp_85xx_mach_cpu_die(void)
103{ 103{
104 unsigned int cpu = smp_processor_id(); 104 unsigned int cpu = smp_processor_id();
105 u32 tmp; 105 u32 tmp;
@@ -141,7 +141,7 @@ static inline u32 read_spin_table_addr_l(void *spin_table)
141 return in_be32(&((struct epapr_spin_table *)spin_table)->addr_l); 141 return in_be32(&((struct epapr_spin_table *)spin_table)->addr_l);
142} 142}
143 143
144static int __cpuinit smp_85xx_kick_cpu(int nr) 144static int smp_85xx_kick_cpu(int nr)
145{ 145{
146 unsigned long flags; 146 unsigned long flags;
147 const u64 *cpu_rel_addr; 147 const u64 *cpu_rel_addr;
@@ -362,7 +362,7 @@ static void mpc85xx_smp_machine_kexec(struct kimage *image)
362} 362}
363#endif /* CONFIG_KEXEC */ 363#endif /* CONFIG_KEXEC */
364 364
365static void __cpuinit smp_85xx_setup_cpu(int cpu_nr) 365static void smp_85xx_setup_cpu(int cpu_nr)
366{ 366{
367 if (smp_85xx_ops.probe == smp_mpic_probe) 367 if (smp_85xx_ops.probe == smp_mpic_probe)
368 mpic_setup_this_cpu(); 368 mpic_setup_this_cpu();
diff --git a/arch/powerpc/platforms/85xx/t4240_qds.c b/arch/powerpc/platforms/85xx/t4240_qds.c
index 5998e9f33304..91ead6b1b8af 100644
--- a/arch/powerpc/platforms/85xx/t4240_qds.c
+++ b/arch/powerpc/platforms/85xx/t4240_qds.c
@@ -75,12 +75,7 @@ define_machine(t4240_qds) {
75#ifdef CONFIG_PCI 75#ifdef CONFIG_PCI
76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 76 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
77#endif 77#endif
78/* coreint doesn't play nice with lazy EE, use legacy mpic for now */
79#ifdef CONFIG_PPC64
80 .get_irq = mpic_get_irq,
81#else
82 .get_irq = mpic_get_coreint_irq, 78 .get_irq = mpic_get_coreint_irq,
83#endif
84 .restart = fsl_rstcr_restart, 79 .restart = fsl_rstcr_restart,
85 .calibrate_decr = generic_calibrate_decr, 80 .calibrate_decr = generic_calibrate_decr,
86 .progress = udbg_progress, 81 .progress = udbg_progress,
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
index 1e121088826f..587a2828b06c 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -43,6 +43,7 @@ static irqreturn_t timebase_interrupt(int irq, void *dev)
43 43
44static struct irqaction tbint_irqaction = { 44static struct irqaction tbint_irqaction = {
45 .handler = timebase_interrupt, 45 .handler = timebase_interrupt,
46 .flags = IRQF_NO_THREAD,
46 .name = "tbint", 47 .name = "tbint",
47}; 48};
48 49
@@ -218,19 +219,12 @@ void mpc8xx_restart(char *cmd)
218 219
219static void cpm_cascade(unsigned int irq, struct irq_desc *desc) 220static void cpm_cascade(unsigned int irq, struct irq_desc *desc)
220{ 221{
221 struct irq_chip *chip; 222 struct irq_chip *chip = irq_desc_get_chip(desc);
222 int cascade_irq; 223 int cascade_irq = cpm_get_irq();
223
224 if ((cascade_irq = cpm_get_irq()) >= 0) {
225 struct irq_desc *cdesc = irq_to_desc(cascade_irq);
226 224
225 if (cascade_irq >= 0)
227 generic_handle_irq(cascade_irq); 226 generic_handle_irq(cascade_irq);
228 227
229 chip = irq_desc_get_chip(cdesc);
230 chip->irq_eoi(&cdesc->irq_data);
231 }
232
233 chip = irq_desc_get_chip(desc);
234 chip->irq_eoi(&desc->irq_data); 228 chip->irq_eoi(&desc->irq_data);
235} 229}
236 230
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index b62aab3e22ec..d703775bda30 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -86,6 +86,27 @@ config MPIC
86 bool 86 bool
87 default n 87 default n
88 88
89config MPIC_TIMER
90 bool "MPIC Global Timer"
91 depends on MPIC && FSL_SOC
92 default n
93 help
94 The MPIC global timer is a hardware timer inside the
95 Freescale PIC complying with OpenPIC standard. When the
96 specified interval times out, the hardware timer generates
97 an interrupt. The driver currently is only tested on fsl
98 chip, but it can potentially support other global timers
99 complying with the OpenPIC standard.
100
101config FSL_MPIC_TIMER_WAKEUP
102 tristate "Freescale MPIC global timer wakeup driver"
103 depends on FSL_SOC && MPIC_TIMER && PM
104 default n
105 help
106 The driver provides a way to wake up the system by MPIC
107 timer.
108 e.g. "echo 5 > /sys/devices/system/mpic/timer_wakeup"
109
89config PPC_EPAPR_HV_PIC 110config PPC_EPAPR_HV_PIC
90 bool 111 bool
91 default n 112 default n
@@ -164,6 +185,11 @@ config IBMEBUS
164 help 185 help
165 Bus device driver for GX bus based adapters. 186 Bus device driver for GX bus based adapters.
166 187
188config EEH
189 bool
190 depends on (PPC_POWERNV || PPC_PSERIES) && PCI
191 default y
192
167config PPC_MPC106 193config PPC_MPC106
168 bool 194 bool
169 default n 195 default n
@@ -193,37 +219,6 @@ config PPC_IO_WORKAROUNDS
193 219
194source "drivers/cpufreq/Kconfig" 220source "drivers/cpufreq/Kconfig"
195 221
196menu "CPU Frequency drivers"
197 depends on CPU_FREQ
198
199config CPU_FREQ_PMAC
200 bool "Support for Apple PowerBooks"
201 depends on ADB_PMU && PPC32
202 select CPU_FREQ_TABLE
203 help
204 This adds support for frequency switching on Apple PowerBooks,
205 this currently includes some models of iBook & Titanium
206 PowerBook.
207
208config CPU_FREQ_PMAC64
209 bool "Support for some Apple G5s"
210 depends on PPC_PMAC && PPC64
211 select CPU_FREQ_TABLE
212 help
213 This adds support for frequency switching on Apple iMac G5,
214 and some of the more recent desktop G5 machines as well.
215
216config PPC_PASEMI_CPUFREQ
217 bool "Support for PA Semi PWRficient"
218 depends on PPC_PASEMI
219 default y
220 select CPU_FREQ_TABLE
221 help
222 This adds the support for frequency switching on PA Semi
223 PWRficient processors.
224
225endmenu
226
227menu "CPUIdle driver" 222menu "CPUIdle driver"
228 223
229source "drivers/cpuidle/Kconfig" 224source "drivers/cpuidle/Kconfig"
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 54f3936001aa..47d9a03dd415 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -71,6 +71,7 @@ config PPC_BOOK3S_64
71 select PPC_FPU 71 select PPC_FPU
72 select PPC_HAVE_PMU_SUPPORT 72 select PPC_HAVE_PMU_SUPPORT
73 select SYS_SUPPORTS_HUGETLBFS 73 select SYS_SUPPORTS_HUGETLBFS
74 select HAVE_ARCH_TRANSPARENT_HUGEPAGE if PPC_64K_PAGES
74 75
75config PPC_BOOK3E_64 76config PPC_BOOK3E_64
76 bool "Embedded processors" 77 bool "Embedded processors"
@@ -158,6 +159,7 @@ config E500
158config PPC_E500MC 159config PPC_E500MC
159 bool "e500mc Support" 160 bool "e500mc Support"
160 select PPC_FPU 161 select PPC_FPU
162 select COMMON_CLK
161 depends on E500 163 depends on E500
162 help 164 help
163 This must be enabled for running on e500mc (and derivatives 165 This must be enabled for running on e500mc (and derivatives
diff --git a/arch/powerpc/platforms/cell/beat_htab.c b/arch/powerpc/platforms/cell/beat_htab.c
index 246e1d8b3af3..c34ee4e60873 100644
--- a/arch/powerpc/platforms/cell/beat_htab.c
+++ b/arch/powerpc/platforms/cell/beat_htab.c
@@ -185,7 +185,8 @@ static void beat_lpar_hptab_clear(void)
185static long beat_lpar_hpte_updatepp(unsigned long slot, 185static long beat_lpar_hpte_updatepp(unsigned long slot,
186 unsigned long newpp, 186 unsigned long newpp,
187 unsigned long vpn, 187 unsigned long vpn,
188 int psize, int ssize, int local) 188 int psize, int apsize,
189 int ssize, int local)
189{ 190{
190 unsigned long lpar_rc; 191 unsigned long lpar_rc;
191 u64 dummy0, dummy1; 192 u64 dummy0, dummy1;
@@ -274,7 +275,8 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp,
274} 275}
275 276
276static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn, 277static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,
277 int psize, int ssize, int local) 278 int psize, int apsize,
279 int ssize, int local)
278{ 280{
279 unsigned long want_v; 281 unsigned long want_v;
280 unsigned long lpar_rc; 282 unsigned long lpar_rc;
@@ -364,9 +366,10 @@ static long beat_lpar_hpte_insert_v3(unsigned long hpte_group,
364 * already zero. For now I am paranoid. 366 * already zero. For now I am paranoid.
365 */ 367 */
366static long beat_lpar_hpte_updatepp_v3(unsigned long slot, 368static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
367 unsigned long newpp, 369 unsigned long newpp,
368 unsigned long vpn, 370 unsigned long vpn,
369 int psize, int ssize, int local) 371 int psize, int apsize,
372 int ssize, int local)
370{ 373{
371 unsigned long lpar_rc; 374 unsigned long lpar_rc;
372 unsigned long want_v; 375 unsigned long want_v;
@@ -394,7 +397,8 @@ static long beat_lpar_hpte_updatepp_v3(unsigned long slot,
394} 397}
395 398
396static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn, 399static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn,
397 int psize, int ssize, int local) 400 int psize, int apsize,
401 int ssize, int local)
398{ 402{
399 unsigned long want_v; 403 unsigned long want_v;
400 unsigned long lpar_rc; 404 unsigned long lpar_rc;
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index d35dbbc8ec79..f75f6fcac729 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -142,7 +142,7 @@ static int smp_cell_cpu_bootable(unsigned int nr)
142 * during boot if the user requests it. Odd-numbered 142 * during boot if the user requests it. Odd-numbered
143 * cpus are assumed to be secondary threads. 143 * cpus are assumed to be secondary threads.
144 */ 144 */
145 if (system_state < SYSTEM_RUNNING && 145 if (system_state == SYSTEM_BOOTING &&
146 cpu_has_feature(CPU_FTR_SMT) && 146 cpu_has_feature(CPU_FTR_SMT) &&
147 !smt_enabled_at_boot && cpu_thread_in_core(nr) != 0) 147 !smt_enabled_at_boot && cpu_thread_in_core(nr) != 0)
148 return 0; 148 return 0;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 35f77a42bedf..f3900427ffab 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -238,7 +238,7 @@ const struct file_operations spufs_context_fops = {
238 .release = spufs_dir_close, 238 .release = spufs_dir_close,
239 .llseek = dcache_dir_lseek, 239 .llseek = dcache_dir_lseek,
240 .read = generic_read_dir, 240 .read = generic_read_dir,
241 .readdir = dcache_readdir, 241 .iterate = dcache_readdir,
242 .fsync = noop_fsync, 242 .fsync = noop_fsync,
243}; 243};
244EXPORT_SYMBOL_GPL(spufs_context_fops); 244EXPORT_SYMBOL_GPL(spufs_context_fops);
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile
index ce6d789e0741..8e8d4cae5ebe 100644
--- a/arch/powerpc/platforms/pasemi/Makefile
+++ b/arch/powerpc/platforms/pasemi/Makefile
@@ -1,3 +1,2 @@
1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o dma_lib.o misc.o 1obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o dma_lib.o misc.o
2obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o 2obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o
3obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c
deleted file mode 100644
index be1e7958909e..000000000000
--- a/arch/powerpc/platforms/pasemi/cpufreq.c
+++ /dev/null
@@ -1,330 +0,0 @@
1/*
2 * Copyright (C) 2007 PA Semi, Inc
3 *
4 * Authors: Egor Martovetsky <egor@pasemi.com>
5 * Olof Johansson <olof@lixom.net>
6 *
7 * Maintained by: Olof Johansson <olof@lixom.net>
8 *
9 * Based on arch/powerpc/platforms/cell/cbe_cpufreq.c:
10 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 */
27
28#include <linux/cpufreq.h>
29#include <linux/timer.h>
30#include <linux/module.h>
31
32#include <asm/hw_irq.h>
33#include <asm/io.h>
34#include <asm/prom.h>
35#include <asm/time.h>
36#include <asm/smp.h>
37
38#define SDCASR_REG 0x0100
39#define SDCASR_REG_STRIDE 0x1000
40#define SDCPWR_CFGA0_REG 0x0100
41#define SDCPWR_PWST0_REG 0x0000
42#define SDCPWR_GIZTIME_REG 0x0440
43
44/* SDCPWR_GIZTIME_REG fields */
45#define SDCPWR_GIZTIME_GR 0x80000000
46#define SDCPWR_GIZTIME_LONGLOCK 0x000000ff
47
48/* Offset of ASR registers from SDC base */
49#define SDCASR_OFFSET 0x120000
50
51static void __iomem *sdcpwr_mapbase;
52static void __iomem *sdcasr_mapbase;
53
54static DEFINE_MUTEX(pas_switch_mutex);
55
56/* Current astate, is used when waking up from power savings on
57 * one core, in case the other core has switched states during
58 * the idle time.
59 */
60static int current_astate;
61
62/* We support 5(A0-A4) power states excluding turbo(A5-A6) modes */
63static struct cpufreq_frequency_table pas_freqs[] = {
64 {0, 0},
65 {1, 0},
66 {2, 0},
67 {3, 0},
68 {4, 0},
69 {0, CPUFREQ_TABLE_END},
70};
71
72static struct freq_attr *pas_cpu_freqs_attr[] = {
73 &cpufreq_freq_attr_scaling_available_freqs,
74 NULL,
75};
76
77/*
78 * hardware specific functions
79 */
80
81static int get_astate_freq(int astate)
82{
83 u32 ret;
84 ret = in_le32(sdcpwr_mapbase + SDCPWR_CFGA0_REG + (astate * 0x10));
85
86 return ret & 0x3f;
87}
88
89static int get_cur_astate(int cpu)
90{
91 u32 ret;
92
93 ret = in_le32(sdcpwr_mapbase + SDCPWR_PWST0_REG);
94 ret = (ret >> (cpu * 4)) & 0x7;
95
96 return ret;
97}
98
99static int get_gizmo_latency(void)
100{
101 u32 giztime, ret;
102
103 giztime = in_le32(sdcpwr_mapbase + SDCPWR_GIZTIME_REG);
104
105 /* just provide the upper bound */
106 if (giztime & SDCPWR_GIZTIME_GR)
107 ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 128000;
108 else
109 ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 1000;
110
111 return ret;
112}
113
114static void set_astate(int cpu, unsigned int astate)
115{
116 unsigned long flags;
117
118 /* Return if called before init has run */
119 if (unlikely(!sdcasr_mapbase))
120 return;
121
122 local_irq_save(flags);
123
124 out_le32(sdcasr_mapbase + SDCASR_REG + SDCASR_REG_STRIDE*cpu, astate);
125
126 local_irq_restore(flags);
127}
128
129int check_astate(void)
130{
131 return get_cur_astate(hard_smp_processor_id());
132}
133
134void restore_astate(int cpu)
135{
136 set_astate(cpu, current_astate);
137}
138
139/*
140 * cpufreq functions
141 */
142
143static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
144{
145 const u32 *max_freqp;
146 u32 max_freq;
147 int i, cur_astate;
148 struct resource res;
149 struct device_node *cpu, *dn;
150 int err = -ENODEV;
151
152 cpu = of_get_cpu_node(policy->cpu, NULL);
153
154 if (!cpu)
155 goto out;
156
157 dn = of_find_compatible_node(NULL, NULL, "1682m-sdc");
158 if (!dn)
159 dn = of_find_compatible_node(NULL, NULL,
160 "pasemi,pwrficient-sdc");
161 if (!dn)
162 goto out;
163 err = of_address_to_resource(dn, 0, &res);
164 of_node_put(dn);
165 if (err)
166 goto out;
167 sdcasr_mapbase = ioremap(res.start + SDCASR_OFFSET, 0x2000);
168 if (!sdcasr_mapbase) {
169 err = -EINVAL;
170 goto out;
171 }
172
173 dn = of_find_compatible_node(NULL, NULL, "1682m-gizmo");
174 if (!dn)
175 dn = of_find_compatible_node(NULL, NULL,
176 "pasemi,pwrficient-gizmo");
177 if (!dn) {
178 err = -ENODEV;
179 goto out_unmap_sdcasr;
180 }
181 err = of_address_to_resource(dn, 0, &res);
182 of_node_put(dn);
183 if (err)
184 goto out_unmap_sdcasr;
185 sdcpwr_mapbase = ioremap(res.start, 0x1000);
186 if (!sdcpwr_mapbase) {
187 err = -EINVAL;
188 goto out_unmap_sdcasr;
189 }
190
191 pr_debug("init cpufreq on CPU %d\n", policy->cpu);
192
193 max_freqp = of_get_property(cpu, "clock-frequency", NULL);
194 if (!max_freqp) {
195 err = -EINVAL;
196 goto out_unmap_sdcpwr;
197 }
198
199 /* we need the freq in kHz */
200 max_freq = *max_freqp / 1000;
201
202 pr_debug("max clock-frequency is at %u kHz\n", max_freq);
203 pr_debug("initializing frequency table\n");
204
205 /* initialize frequency table */
206 for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
207 pas_freqs[i].frequency = get_astate_freq(pas_freqs[i].index) * 100000;
208 pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
209 }
210
211 policy->cpuinfo.transition_latency = get_gizmo_latency();
212
213 cur_astate = get_cur_astate(policy->cpu);
214 pr_debug("current astate is at %d\n",cur_astate);
215
216 policy->cur = pas_freqs[cur_astate].frequency;
217 cpumask_copy(policy->cpus, cpu_online_mask);
218
219 ppc_proc_freq = policy->cur * 1000ul;
220
221 cpufreq_frequency_table_get_attr(pas_freqs, policy->cpu);
222
223 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max
224 * are set correctly
225 */
226 return cpufreq_frequency_table_cpuinfo(policy, pas_freqs);
227
228out_unmap_sdcpwr:
229 iounmap(sdcpwr_mapbase);
230
231out_unmap_sdcasr:
232 iounmap(sdcasr_mapbase);
233out:
234 return err;
235}
236
237static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy)
238{
239 /*
240 * We don't support CPU hotplug. Don't unmap after the system
241 * has already made it to a running state.
242 */
243 if (system_state != SYSTEM_BOOTING)
244 return 0;
245
246 if (sdcasr_mapbase)
247 iounmap(sdcasr_mapbase);
248 if (sdcpwr_mapbase)
249 iounmap(sdcpwr_mapbase);
250
251 cpufreq_frequency_table_put_attr(policy->cpu);
252 return 0;
253}
254
255static int pas_cpufreq_verify(struct cpufreq_policy *policy)
256{
257 return cpufreq_frequency_table_verify(policy, pas_freqs);
258}
259
260static int pas_cpufreq_target(struct cpufreq_policy *policy,
261 unsigned int target_freq,
262 unsigned int relation)
263{
264 struct cpufreq_freqs freqs;
265 int pas_astate_new;
266 int i;
267
268 cpufreq_frequency_table_target(policy,
269 pas_freqs,
270 target_freq,
271 relation,
272 &pas_astate_new);
273
274 freqs.old = policy->cur;
275 freqs.new = pas_freqs[pas_astate_new].frequency;
276
277 mutex_lock(&pas_switch_mutex);
278 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
279
280 pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
281 policy->cpu,
282 pas_freqs[pas_astate_new].frequency,
283 pas_freqs[pas_astate_new].index);
284
285 current_astate = pas_astate_new;
286
287 for_each_online_cpu(i)
288 set_astate(i, pas_astate_new);
289
290 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
291 mutex_unlock(&pas_switch_mutex);
292
293 ppc_proc_freq = freqs.new * 1000ul;
294 return 0;
295}
296
297static struct cpufreq_driver pas_cpufreq_driver = {
298 .name = "pas-cpufreq",
299 .owner = THIS_MODULE,
300 .flags = CPUFREQ_CONST_LOOPS,
301 .init = pas_cpufreq_cpu_init,
302 .exit = pas_cpufreq_cpu_exit,
303 .verify = pas_cpufreq_verify,
304 .target = pas_cpufreq_target,
305 .attr = pas_cpu_freqs_attr,
306};
307
308/*
309 * module init and destoy
310 */
311
312static int __init pas_cpufreq_init(void)
313{
314 if (!of_machine_is_compatible("PA6T-1682M") &&
315 !of_machine_is_compatible("pasemi,pwrficient"))
316 return -ENODEV;
317
318 return cpufreq_register_driver(&pas_cpufreq_driver);
319}
320
321static void __exit pas_cpufreq_exit(void)
322{
323 cpufreq_unregister_driver(&pas_cpufreq_driver);
324}
325
326module_init(pas_cpufreq_init);
327module_exit(pas_cpufreq_exit);
328
329MODULE_LICENSE("GPL");
330MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>, Olof Johansson <olof@lixom.net>");
diff --git a/arch/powerpc/platforms/powermac/Makefile b/arch/powerpc/platforms/powermac/Makefile
index ea47df66fee5..52c6ce1cc985 100644
--- a/arch/powerpc/platforms/powermac/Makefile
+++ b/arch/powerpc/platforms/powermac/Makefile
@@ -9,8 +9,6 @@ obj-y += pic.o setup.o time.o feature.o pci.o \
9 sleep.o low_i2c.o cache.o pfunc_core.o \ 9 sleep.o low_i2c.o cache.o pfunc_core.o \
10 pfunc_base.o udbg_scc.o udbg_adb.o 10 pfunc_base.o udbg_scc.o udbg_adb.o
11obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o 11obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o
12obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_32.o
13obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o
14# CONFIG_NVRAM is an arch. independent tristate symbol, for pmac32 we really 12# CONFIG_NVRAM is an arch. independent tristate symbol, for pmac32 we really
15# need this to be a bool. Cheat here and pretend CONFIG_NVRAM=m is really 13# need this to be a bool. Cheat here and pretend CONFIG_NVRAM=m is really
16# CONFIG_NVRAM=y 14# CONFIG_NVRAM=y
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
deleted file mode 100644
index 3104fad82480..000000000000
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ /dev/null
@@ -1,721 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
3 * Copyright (C) 2004 John Steele Scott <toojays@toojays.net>
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 * TODO: Need a big cleanup here. Basically, we need to have different
10 * cpufreq_driver structures for the different type of HW instead of the
11 * current mess. We also need to better deal with the detection of the
12 * type of machine.
13 *
14 */
15
16#include <linux/module.h>
17#include <linux/types.h>
18#include <linux/errno.h>
19#include <linux/kernel.h>
20#include <linux/delay.h>
21#include <linux/sched.h>
22#include <linux/adb.h>
23#include <linux/pmu.h>
24#include <linux/cpufreq.h>
25#include <linux/init.h>
26#include <linux/device.h>
27#include <linux/hardirq.h>
28#include <asm/prom.h>
29#include <asm/machdep.h>
30#include <asm/irq.h>
31#include <asm/pmac_feature.h>
32#include <asm/mmu_context.h>
33#include <asm/sections.h>
34#include <asm/cputable.h>
35#include <asm/time.h>
36#include <asm/mpic.h>
37#include <asm/keylargo.h>
38#include <asm/switch_to.h>
39
40/* WARNING !!! This will cause calibrate_delay() to be called,
41 * but this is an __init function ! So you MUST go edit
42 * init/main.c to make it non-init before enabling DEBUG_FREQ
43 */
44#undef DEBUG_FREQ
45
46extern void low_choose_7447a_dfs(int dfs);
47extern void low_choose_750fx_pll(int pll);
48extern void low_sleep_handler(void);
49
50/*
51 * Currently, PowerMac cpufreq supports only high & low frequencies
52 * that are set by the firmware
53 */
54static unsigned int low_freq;
55static unsigned int hi_freq;
56static unsigned int cur_freq;
57static unsigned int sleep_freq;
58static unsigned long transition_latency;
59
60/*
61 * Different models uses different mechanisms to switch the frequency
62 */
63static int (*set_speed_proc)(int low_speed);
64static unsigned int (*get_speed_proc)(void);
65
66/*
67 * Some definitions used by the various speedprocs
68 */
69static u32 voltage_gpio;
70static u32 frequency_gpio;
71static u32 slew_done_gpio;
72static int no_schedule;
73static int has_cpu_l2lve;
74static int is_pmu_based;
75
76/* There are only two frequency states for each processor. Values
77 * are in kHz for the time being.
78 */
79#define CPUFREQ_HIGH 0
80#define CPUFREQ_LOW 1
81
82static struct cpufreq_frequency_table pmac_cpu_freqs[] = {
83 {CPUFREQ_HIGH, 0},
84 {CPUFREQ_LOW, 0},
85 {0, CPUFREQ_TABLE_END},
86};
87
88static struct freq_attr* pmac_cpu_freqs_attr[] = {
89 &cpufreq_freq_attr_scaling_available_freqs,
90 NULL,
91};
92
93static inline void local_delay(unsigned long ms)
94{
95 if (no_schedule)
96 mdelay(ms);
97 else
98 msleep(ms);
99}
100
101#ifdef DEBUG_FREQ
102static inline void debug_calc_bogomips(void)
103{
104 /* This will cause a recalc of bogomips and display the
105 * result. We backup/restore the value to avoid affecting the
106 * core cpufreq framework's own calculation.
107 */
108 unsigned long save_lpj = loops_per_jiffy;
109 calibrate_delay();
110 loops_per_jiffy = save_lpj;
111}
112#endif /* DEBUG_FREQ */
113
114/* Switch CPU speed under 750FX CPU control
115 */
116static int cpu_750fx_cpu_speed(int low_speed)
117{
118 u32 hid2;
119
120 if (low_speed == 0) {
121 /* ramping up, set voltage first */
122 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
123 /* Make sure we sleep for at least 1ms */
124 local_delay(10);
125
126 /* tweak L2 for high voltage */
127 if (has_cpu_l2lve) {
128 hid2 = mfspr(SPRN_HID2);
129 hid2 &= ~0x2000;
130 mtspr(SPRN_HID2, hid2);
131 }
132 }
133#ifdef CONFIG_6xx
134 low_choose_750fx_pll(low_speed);
135#endif
136 if (low_speed == 1) {
137 /* tweak L2 for low voltage */
138 if (has_cpu_l2lve) {
139 hid2 = mfspr(SPRN_HID2);
140 hid2 |= 0x2000;
141 mtspr(SPRN_HID2, hid2);
142 }
143
144 /* ramping down, set voltage last */
145 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
146 local_delay(10);
147 }
148
149 return 0;
150}
151
152static unsigned int cpu_750fx_get_cpu_speed(void)
153{
154 if (mfspr(SPRN_HID1) & HID1_PS)
155 return low_freq;
156 else
157 return hi_freq;
158}
159
160/* Switch CPU speed using DFS */
161static int dfs_set_cpu_speed(int low_speed)
162{
163 if (low_speed == 0) {
164 /* ramping up, set voltage first */
165 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
166 /* Make sure we sleep for at least 1ms */
167 local_delay(1);
168 }
169
170 /* set frequency */
171#ifdef CONFIG_6xx
172 low_choose_7447a_dfs(low_speed);
173#endif
174 udelay(100);
175
176 if (low_speed == 1) {
177 /* ramping down, set voltage last */
178 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
179 local_delay(1);
180 }
181
182 return 0;
183}
184
185static unsigned int dfs_get_cpu_speed(void)
186{
187 if (mfspr(SPRN_HID1) & HID1_DFS)
188 return low_freq;
189 else
190 return hi_freq;
191}
192
193
194/* Switch CPU speed using slewing GPIOs
195 */
196static int gpios_set_cpu_speed(int low_speed)
197{
198 int gpio, timeout = 0;
199
200 /* If ramping up, set voltage first */
201 if (low_speed == 0) {
202 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
203 /* Delay is way too big but it's ok, we schedule */
204 local_delay(10);
205 }
206
207 /* Set frequency */
208 gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0);
209 if (low_speed == ((gpio & 0x01) == 0))
210 goto skip;
211
212 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, frequency_gpio,
213 low_speed ? 0x04 : 0x05);
214 udelay(200);
215 do {
216 if (++timeout > 100)
217 break;
218 local_delay(1);
219 gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, slew_done_gpio, 0);
220 } while((gpio & 0x02) == 0);
221 skip:
222 /* If ramping down, set voltage last */
223 if (low_speed == 1) {
224 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
225 /* Delay is way too big but it's ok, we schedule */
226 local_delay(10);
227 }
228
229#ifdef DEBUG_FREQ
230 debug_calc_bogomips();
231#endif
232
233 return 0;
234}
235
236/* Switch CPU speed under PMU control
237 */
238static int pmu_set_cpu_speed(int low_speed)
239{
240 struct adb_request req;
241 unsigned long save_l2cr;
242 unsigned long save_l3cr;
243 unsigned int pic_prio;
244 unsigned long flags;
245
246 preempt_disable();
247
248#ifdef DEBUG_FREQ
249 printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1));
250#endif
251 pmu_suspend();
252
253 /* Disable all interrupt sources on openpic */
254 pic_prio = mpic_cpu_get_priority();
255 mpic_cpu_set_priority(0xf);
256
257 /* Make sure the decrementer won't interrupt us */
258 asm volatile("mtdec %0" : : "r" (0x7fffffff));
259 /* Make sure any pending DEC interrupt occurring while we did
260 * the above didn't re-enable the DEC */
261 mb();
262 asm volatile("mtdec %0" : : "r" (0x7fffffff));
263
264 /* We can now disable MSR_EE */
265 local_irq_save(flags);
266
267 /* Giveup the FPU & vec */
268 enable_kernel_fp();
269
270#ifdef CONFIG_ALTIVEC
271 if (cpu_has_feature(CPU_FTR_ALTIVEC))
272 enable_kernel_altivec();
273#endif /* CONFIG_ALTIVEC */
274
275 /* Save & disable L2 and L3 caches */
276 save_l3cr = _get_L3CR(); /* (returns -1 if not available) */
277 save_l2cr = _get_L2CR(); /* (returns -1 if not available) */
278
279 /* Send the new speed command. My assumption is that this command
280 * will cause PLL_CFG[0..3] to be changed next time CPU goes to sleep
281 */
282 pmu_request(&req, NULL, 6, PMU_CPU_SPEED, 'W', 'O', 'O', 'F', low_speed);
283 while (!req.complete)
284 pmu_poll();
285
286 /* Prepare the northbridge for the speed transition */
287 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
288
289 /* Call low level code to backup CPU state and recover from
290 * hardware reset
291 */
292 low_sleep_handler();
293
294 /* Restore the northbridge */
295 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,0);
296
297 /* Restore L2 cache */
298 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
299 _set_L2CR(save_l2cr);
300 /* Restore L3 cache */
301 if (save_l3cr != 0xffffffff && (save_l3cr & L3CR_L3E) != 0)
302 _set_L3CR(save_l3cr);
303
304 /* Restore userland MMU context */
305 switch_mmu_context(NULL, current->active_mm);
306
307#ifdef DEBUG_FREQ
308 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
309#endif
310
311 /* Restore low level PMU operations */
312 pmu_unlock();
313
314 /*
315 * Restore decrementer; we'll take a decrementer interrupt
316 * as soon as interrupts are re-enabled and the generic
317 * clockevents code will reprogram it with the right value.
318 */
319 set_dec(1);
320
321 /* Restore interrupts */
322 mpic_cpu_set_priority(pic_prio);
323
324 /* Let interrupts flow again ... */
325 local_irq_restore(flags);
326
327#ifdef DEBUG_FREQ
328 debug_calc_bogomips();
329#endif
330
331 pmu_resume();
332
333 preempt_enable();
334
335 return 0;
336}
337
338static int do_set_cpu_speed(struct cpufreq_policy *policy, int speed_mode,
339 int notify)
340{
341 struct cpufreq_freqs freqs;
342 unsigned long l3cr;
343 static unsigned long prev_l3cr;
344
345 freqs.old = cur_freq;
346 freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
347
348 if (freqs.old == freqs.new)
349 return 0;
350
351 if (notify)
352 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
353 if (speed_mode == CPUFREQ_LOW &&
354 cpu_has_feature(CPU_FTR_L3CR)) {
355 l3cr = _get_L3CR();
356 if (l3cr & L3CR_L3E) {
357 prev_l3cr = l3cr;
358 _set_L3CR(0);
359 }
360 }
361 set_speed_proc(speed_mode == CPUFREQ_LOW);
362 if (speed_mode == CPUFREQ_HIGH &&
363 cpu_has_feature(CPU_FTR_L3CR)) {
364 l3cr = _get_L3CR();
365 if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr)
366 _set_L3CR(prev_l3cr);
367 }
368 if (notify)
369 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
370 cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
371
372 return 0;
373}
374
375static unsigned int pmac_cpufreq_get_speed(unsigned int cpu)
376{
377 return cur_freq;
378}
379
380static int pmac_cpufreq_verify(struct cpufreq_policy *policy)
381{
382 return cpufreq_frequency_table_verify(policy, pmac_cpu_freqs);
383}
384
385static int pmac_cpufreq_target( struct cpufreq_policy *policy,
386 unsigned int target_freq,
387 unsigned int relation)
388{
389 unsigned int newstate = 0;
390 int rc;
391
392 if (cpufreq_frequency_table_target(policy, pmac_cpu_freqs,
393 target_freq, relation, &newstate))
394 return -EINVAL;
395
396 rc = do_set_cpu_speed(policy, newstate, 1);
397
398 ppc_proc_freq = cur_freq * 1000ul;
399 return rc;
400}
401
402static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
403{
404 if (policy->cpu != 0)
405 return -ENODEV;
406
407 policy->cpuinfo.transition_latency = transition_latency;
408 policy->cur = cur_freq;
409
410 cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu);
411 return cpufreq_frequency_table_cpuinfo(policy, pmac_cpu_freqs);
412}
413
414static u32 read_gpio(struct device_node *np)
415{
416 const u32 *reg = of_get_property(np, "reg", NULL);
417 u32 offset;
418
419 if (reg == NULL)
420 return 0;
421 /* That works for all keylargos but shall be fixed properly
422 * some day... The problem is that it seems we can't rely
423 * on the "reg" property of the GPIO nodes, they are either
424 * relative to the base of KeyLargo or to the base of the
425 * GPIO space, and the device-tree doesn't help.
426 */
427 offset = *reg;
428 if (offset < KEYLARGO_GPIO_LEVELS0)
429 offset += KEYLARGO_GPIO_LEVELS0;
430 return offset;
431}
432
433static int pmac_cpufreq_suspend(struct cpufreq_policy *policy)
434{
435 /* Ok, this could be made a bit smarter, but let's be robust for now. We
436 * always force a speed change to high speed before sleep, to make sure
437 * we have appropriate voltage and/or bus speed for the wakeup process,
438 * and to make sure our loops_per_jiffies are "good enough", that is will
439 * not cause too short delays if we sleep in low speed and wake in high
440 * speed..
441 */
442 no_schedule = 1;
443 sleep_freq = cur_freq;
444 if (cur_freq == low_freq && !is_pmu_based)
445 do_set_cpu_speed(policy, CPUFREQ_HIGH, 0);
446 return 0;
447}
448
449static int pmac_cpufreq_resume(struct cpufreq_policy *policy)
450{
451 /* If we resume, first check if we have a get() function */
452 if (get_speed_proc)
453 cur_freq = get_speed_proc();
454 else
455 cur_freq = 0;
456
457 /* We don't, hrm... we don't really know our speed here, best
458 * is that we force a switch to whatever it was, which is
459 * probably high speed due to our suspend() routine
460 */
461 do_set_cpu_speed(policy, sleep_freq == low_freq ?
462 CPUFREQ_LOW : CPUFREQ_HIGH, 0);
463
464 ppc_proc_freq = cur_freq * 1000ul;
465
466 no_schedule = 0;
467 return 0;
468}
469
470static struct cpufreq_driver pmac_cpufreq_driver = {
471 .verify = pmac_cpufreq_verify,
472 .target = pmac_cpufreq_target,
473 .get = pmac_cpufreq_get_speed,
474 .init = pmac_cpufreq_cpu_init,
475 .suspend = pmac_cpufreq_suspend,
476 .resume = pmac_cpufreq_resume,
477 .flags = CPUFREQ_PM_NO_WARN,
478 .attr = pmac_cpu_freqs_attr,
479 .name = "powermac",
480 .owner = THIS_MODULE,
481};
482
483
484static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
485{
486 struct device_node *volt_gpio_np = of_find_node_by_name(NULL,
487 "voltage-gpio");
488 struct device_node *freq_gpio_np = of_find_node_by_name(NULL,
489 "frequency-gpio");
490 struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
491 "slewing-done");
492 const u32 *value;
493
494 /*
495 * Check to see if it's GPIO driven or PMU only
496 *
497 * The way we extract the GPIO address is slightly hackish, but it
498 * works well enough for now. We need to abstract the whole GPIO
499 * stuff sooner or later anyway
500 */
501
502 if (volt_gpio_np)
503 voltage_gpio = read_gpio(volt_gpio_np);
504 if (freq_gpio_np)
505 frequency_gpio = read_gpio(freq_gpio_np);
506 if (slew_done_gpio_np)
507 slew_done_gpio = read_gpio(slew_done_gpio_np);
508
509 /* If we use the frequency GPIOs, calculate the min/max speeds based
510 * on the bus frequencies
511 */
512 if (frequency_gpio && slew_done_gpio) {
513 int lenp, rc;
514 const u32 *freqs, *ratio;
515
516 freqs = of_get_property(cpunode, "bus-frequencies", &lenp);
517 lenp /= sizeof(u32);
518 if (freqs == NULL || lenp != 2) {
519 printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
520 return 1;
521 }
522 ratio = of_get_property(cpunode, "processor-to-bus-ratio*2",
523 NULL);
524 if (ratio == NULL) {
525 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
526 return 1;
527 }
528
529 /* Get the min/max bus frequencies */
530 low_freq = min(freqs[0], freqs[1]);
531 hi_freq = max(freqs[0], freqs[1]);
532
533 /* Grrrr.. It _seems_ that the device-tree is lying on the low bus
534 * frequency, it claims it to be around 84Mhz on some models while
535 * it appears to be approx. 101Mhz on all. Let's hack around here...
536 * fortunately, we don't need to be too precise
537 */
538 if (low_freq < 98000000)
539 low_freq = 101000000;
540
541 /* Convert those to CPU core clocks */
542 low_freq = (low_freq * (*ratio)) / 2000;
543 hi_freq = (hi_freq * (*ratio)) / 2000;
544
545 /* Now we get the frequencies, we read the GPIO to see what is out current
546 * speed
547 */
548 rc = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0);
549 cur_freq = (rc & 0x01) ? hi_freq : low_freq;
550
551 set_speed_proc = gpios_set_cpu_speed;
552 return 1;
553 }
554
555 /* If we use the PMU, look for the min & max frequencies in the
556 * device-tree
557 */
558 value = of_get_property(cpunode, "min-clock-frequency", NULL);
559 if (!value)
560 return 1;
561 low_freq = (*value) / 1000;
562 /* The PowerBook G4 12" (PowerBook6,1) has an error in the device-tree
563 * here */
564 if (low_freq < 100000)
565 low_freq *= 10;
566
567 value = of_get_property(cpunode, "max-clock-frequency", NULL);
568 if (!value)
569 return 1;
570 hi_freq = (*value) / 1000;
571 set_speed_proc = pmu_set_cpu_speed;
572 is_pmu_based = 1;
573
574 return 0;
575}
576
577static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
578{
579 struct device_node *volt_gpio_np;
580
581 if (of_get_property(cpunode, "dynamic-power-step", NULL) == NULL)
582 return 1;
583
584 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
585 if (volt_gpio_np)
586 voltage_gpio = read_gpio(volt_gpio_np);
587 if (!voltage_gpio){
588 printk(KERN_ERR "cpufreq: missing cpu-vcore-select gpio\n");
589 return 1;
590 }
591
592 /* OF only reports the high frequency */
593 hi_freq = cur_freq;
594 low_freq = cur_freq/2;
595
596 /* Read actual frequency from CPU */
597 cur_freq = dfs_get_cpu_speed();
598 set_speed_proc = dfs_set_cpu_speed;
599 get_speed_proc = dfs_get_cpu_speed;
600
601 return 0;
602}
603
604static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
605{
606 struct device_node *volt_gpio_np;
607 u32 pvr;
608 const u32 *value;
609
610 if (of_get_property(cpunode, "dynamic-power-step", NULL) == NULL)
611 return 1;
612
613 hi_freq = cur_freq;
614 value = of_get_property(cpunode, "reduced-clock-frequency", NULL);
615 if (!value)
616 return 1;
617 low_freq = (*value) / 1000;
618
619 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
620 if (volt_gpio_np)
621 voltage_gpio = read_gpio(volt_gpio_np);
622
623 pvr = mfspr(SPRN_PVR);
624 has_cpu_l2lve = !((pvr & 0xf00) == 0x100);
625
626 set_speed_proc = cpu_750fx_cpu_speed;
627 get_speed_proc = cpu_750fx_get_cpu_speed;
628 cur_freq = cpu_750fx_get_cpu_speed();
629
630 return 0;
631}
632
633/* Currently, we support the following machines:
634 *
635 * - Titanium PowerBook 1Ghz (PMU based, 667Mhz & 1Ghz)
636 * - Titanium PowerBook 800 (PMU based, 667Mhz & 800Mhz)
637 * - Titanium PowerBook 400 (PMU based, 300Mhz & 400Mhz)
638 * - Titanium PowerBook 500 (PMU based, 300Mhz & 500Mhz)
639 * - iBook2 500/600 (PMU based, 400Mhz & 500/600Mhz)
640 * - iBook2 700 (CPU based, 400Mhz & 700Mhz, support low voltage)
641 * - Recent MacRISC3 laptops
642 * - All new machines with 7447A CPUs
643 */
644static int __init pmac_cpufreq_setup(void)
645{
646 struct device_node *cpunode;
647 const u32 *value;
648
649 if (strstr(cmd_line, "nocpufreq"))
650 return 0;
651
652 /* Assume only one CPU */
653 cpunode = of_find_node_by_type(NULL, "cpu");
654 if (!cpunode)
655 goto out;
656
657 /* Get current cpu clock freq */
658 value = of_get_property(cpunode, "clock-frequency", NULL);
659 if (!value)
660 goto out;
661 cur_freq = (*value) / 1000;
662 transition_latency = CPUFREQ_ETERNAL;
663
664 /* Check for 7447A based MacRISC3 */
665 if (of_machine_is_compatible("MacRISC3") &&
666 of_get_property(cpunode, "dynamic-power-step", NULL) &&
667 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
668 pmac_cpufreq_init_7447A(cpunode);
669 transition_latency = 8000000;
670 /* Check for other MacRISC3 machines */
671 } else if (of_machine_is_compatible("PowerBook3,4") ||
672 of_machine_is_compatible("PowerBook3,5") ||
673 of_machine_is_compatible("MacRISC3")) {
674 pmac_cpufreq_init_MacRISC3(cpunode);
675 /* Else check for iBook2 500/600 */
676 } else if (of_machine_is_compatible("PowerBook4,1")) {
677 hi_freq = cur_freq;
678 low_freq = 400000;
679 set_speed_proc = pmu_set_cpu_speed;
680 is_pmu_based = 1;
681 }
682 /* Else check for TiPb 550 */
683 else if (of_machine_is_compatible("PowerBook3,3") && cur_freq == 550000) {
684 hi_freq = cur_freq;
685 low_freq = 500000;
686 set_speed_proc = pmu_set_cpu_speed;
687 is_pmu_based = 1;
688 }
689 /* Else check for TiPb 400 & 500 */
690 else if (of_machine_is_compatible("PowerBook3,2")) {
691 /* We only know about the 400 MHz and the 500Mhz model
692 * they both have 300 MHz as low frequency
693 */
694 if (cur_freq < 350000 || cur_freq > 550000)
695 goto out;
696 hi_freq = cur_freq;
697 low_freq = 300000;
698 set_speed_proc = pmu_set_cpu_speed;
699 is_pmu_based = 1;
700 }
701 /* Else check for 750FX */
702 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000)
703 pmac_cpufreq_init_750FX(cpunode);
704out:
705 of_node_put(cpunode);
706 if (set_speed_proc == NULL)
707 return -ENODEV;
708
709 pmac_cpu_freqs[CPUFREQ_LOW].frequency = low_freq;
710 pmac_cpu_freqs[CPUFREQ_HIGH].frequency = hi_freq;
711 ppc_proc_freq = cur_freq * 1000ul;
712
713 printk(KERN_INFO "Registering PowerMac CPU frequency driver\n");
714 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Boot: %d Mhz\n",
715 low_freq/1000, hi_freq/1000, cur_freq/1000);
716
717 return cpufreq_register_driver(&pmac_cpufreq_driver);
718}
719
720module_init(pmac_cpufreq_setup);
721
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
deleted file mode 100644
index 7ba423431cfe..000000000000
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ /dev/null
@@ -1,746 +0,0 @@
1/*
2 * Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
3 * and Markus Demleitner <msdemlei@cl.uni-heidelberg.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This driver adds basic cpufreq support for SMU & 970FX based G5 Macs,
10 * that is iMac G5 and latest single CPU desktop.
11 */
12
13#undef DEBUG
14
15#include <linux/module.h>
16#include <linux/types.h>
17#include <linux/errno.h>
18#include <linux/kernel.h>
19#include <linux/delay.h>
20#include <linux/sched.h>
21#include <linux/cpufreq.h>
22#include <linux/init.h>
23#include <linux/completion.h>
24#include <linux/mutex.h>
25#include <asm/prom.h>
26#include <asm/machdep.h>
27#include <asm/irq.h>
28#include <asm/sections.h>
29#include <asm/cputable.h>
30#include <asm/time.h>
31#include <asm/smu.h>
32#include <asm/pmac_pfunc.h>
33
34#define DBG(fmt...) pr_debug(fmt)
35
36/* see 970FX user manual */
37
38#define SCOM_PCR 0x0aa001 /* PCR scom addr */
39
40#define PCR_HILO_SELECT 0x80000000U /* 1 = PCR, 0 = PCRH */
41#define PCR_SPEED_FULL 0x00000000U /* 1:1 speed value */
42#define PCR_SPEED_HALF 0x00020000U /* 1:2 speed value */
43#define PCR_SPEED_QUARTER 0x00040000U /* 1:4 speed value */
44#define PCR_SPEED_MASK 0x000e0000U /* speed mask */
45#define PCR_SPEED_SHIFT 17
46#define PCR_FREQ_REQ_VALID 0x00010000U /* freq request valid */
47#define PCR_VOLT_REQ_VALID 0x00008000U /* volt request valid */
48#define PCR_TARGET_TIME_MASK 0x00006000U /* target time */
49#define PCR_STATLAT_MASK 0x00001f00U /* STATLAT value */
50#define PCR_SNOOPLAT_MASK 0x000000f0U /* SNOOPLAT value */
51#define PCR_SNOOPACC_MASK 0x0000000fU /* SNOOPACC value */
52
53#define SCOM_PSR 0x408001 /* PSR scom addr */
54/* warning: PSR is a 64 bits register */
55#define PSR_CMD_RECEIVED 0x2000000000000000U /* command received */
56#define PSR_CMD_COMPLETED 0x1000000000000000U /* command completed */
57#define PSR_CUR_SPEED_MASK 0x0300000000000000U /* current speed */
58#define PSR_CUR_SPEED_SHIFT (56)
59
60/*
61 * The G5 only supports two frequencies (Quarter speed is not supported)
62 */
63#define CPUFREQ_HIGH 0
64#define CPUFREQ_LOW 1
65
66static struct cpufreq_frequency_table g5_cpu_freqs[] = {
67 {CPUFREQ_HIGH, 0},
68 {CPUFREQ_LOW, 0},
69 {0, CPUFREQ_TABLE_END},
70};
71
72static struct freq_attr* g5_cpu_freqs_attr[] = {
73 &cpufreq_freq_attr_scaling_available_freqs,
74 NULL,
75};
76
77/* Power mode data is an array of the 32 bits PCR values to use for
78 * the various frequencies, retrieved from the device-tree
79 */
80static int g5_pmode_cur;
81
82static void (*g5_switch_volt)(int speed_mode);
83static int (*g5_switch_freq)(int speed_mode);
84static int (*g5_query_freq)(void);
85
86static DEFINE_MUTEX(g5_switch_mutex);
87
88static unsigned long transition_latency;
89
90#ifdef CONFIG_PMAC_SMU
91
92static const u32 *g5_pmode_data;
93static int g5_pmode_max;
94
95static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */
96static int g5_fvt_count; /* number of op. points */
97static int g5_fvt_cur; /* current op. point */
98
99/*
100 * SMU based voltage switching for Neo2 platforms
101 */
102
103static void g5_smu_switch_volt(int speed_mode)
104{
105 struct smu_simple_cmd cmd;
106
107 DECLARE_COMPLETION_ONSTACK(comp);
108 smu_queue_simple(&cmd, SMU_CMD_POWER_COMMAND, 8, smu_done_complete,
109 &comp, 'V', 'S', 'L', 'E', 'W',
110 0xff, g5_fvt_cur+1, speed_mode);
111 wait_for_completion(&comp);
112}
113
114/*
115 * Platform function based voltage/vdnap switching for Neo2
116 */
117
118static struct pmf_function *pfunc_set_vdnap0;
119static struct pmf_function *pfunc_vdnap0_complete;
120
121static void g5_vdnap_switch_volt(int speed_mode)
122{
123 struct pmf_args args;
124 u32 slew, done = 0;
125 unsigned long timeout;
126
127 slew = (speed_mode == CPUFREQ_LOW) ? 1 : 0;
128 args.count = 1;
129 args.u[0].p = &slew;
130
131 pmf_call_one(pfunc_set_vdnap0, &args);
132
133 /* It's an irq GPIO so we should be able to just block here,
134 * I'll do that later after I've properly tested the IRQ code for
135 * platform functions
136 */
137 timeout = jiffies + HZ/10;
138 while(!time_after(jiffies, timeout)) {
139 args.count = 1;
140 args.u[0].p = &done;
141 pmf_call_one(pfunc_vdnap0_complete, &args);
142 if (done)
143 break;
144 msleep(1);
145 }
146 if (done == 0)
147 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
148}
149
150
151/*
152 * SCOM based frequency switching for 970FX rev3
153 */
154static int g5_scom_switch_freq(int speed_mode)
155{
156 unsigned long flags;
157 int to;
158
159 /* If frequency is going up, first ramp up the voltage */
160 if (speed_mode < g5_pmode_cur)
161 g5_switch_volt(speed_mode);
162
163 local_irq_save(flags);
164
165 /* Clear PCR high */
166 scom970_write(SCOM_PCR, 0);
167 /* Clear PCR low */
168 scom970_write(SCOM_PCR, PCR_HILO_SELECT | 0);
169 /* Set PCR low */
170 scom970_write(SCOM_PCR, PCR_HILO_SELECT |
171 g5_pmode_data[speed_mode]);
172
173 /* Wait for completion */
174 for (to = 0; to < 10; to++) {
175 unsigned long psr = scom970_read(SCOM_PSR);
176
177 if ((psr & PSR_CMD_RECEIVED) == 0 &&
178 (((psr >> PSR_CUR_SPEED_SHIFT) ^
179 (g5_pmode_data[speed_mode] >> PCR_SPEED_SHIFT)) & 0x3)
180 == 0)
181 break;
182 if (psr & PSR_CMD_COMPLETED)
183 break;
184 udelay(100);
185 }
186
187 local_irq_restore(flags);
188
189 /* If frequency is going down, last ramp the voltage */
190 if (speed_mode > g5_pmode_cur)
191 g5_switch_volt(speed_mode);
192
193 g5_pmode_cur = speed_mode;
194 ppc_proc_freq = g5_cpu_freqs[speed_mode].frequency * 1000ul;
195
196 return 0;
197}
198
199static int g5_scom_query_freq(void)
200{
201 unsigned long psr = scom970_read(SCOM_PSR);
202 int i;
203
204 for (i = 0; i <= g5_pmode_max; i++)
205 if ((((psr >> PSR_CUR_SPEED_SHIFT) ^
206 (g5_pmode_data[i] >> PCR_SPEED_SHIFT)) & 0x3) == 0)
207 break;
208 return i;
209}
210
211/*
212 * Fake voltage switching for platforms with missing support
213 */
214
215static void g5_dummy_switch_volt(int speed_mode)
216{
217}
218
219#endif /* CONFIG_PMAC_SMU */
220
221/*
222 * Platform function based voltage switching for PowerMac7,2 & 7,3
223 */
224
225static struct pmf_function *pfunc_cpu0_volt_high;
226static struct pmf_function *pfunc_cpu0_volt_low;
227static struct pmf_function *pfunc_cpu1_volt_high;
228static struct pmf_function *pfunc_cpu1_volt_low;
229
230static void g5_pfunc_switch_volt(int speed_mode)
231{
232 if (speed_mode == CPUFREQ_HIGH) {
233 if (pfunc_cpu0_volt_high)
234 pmf_call_one(pfunc_cpu0_volt_high, NULL);
235 if (pfunc_cpu1_volt_high)
236 pmf_call_one(pfunc_cpu1_volt_high, NULL);
237 } else {
238 if (pfunc_cpu0_volt_low)
239 pmf_call_one(pfunc_cpu0_volt_low, NULL);
240 if (pfunc_cpu1_volt_low)
241 pmf_call_one(pfunc_cpu1_volt_low, NULL);
242 }
243 msleep(10); /* should be faster , to fix */
244}
245
246/*
247 * Platform function based frequency switching for PowerMac7,2 & 7,3
248 */
249
250static struct pmf_function *pfunc_cpu_setfreq_high;
251static struct pmf_function *pfunc_cpu_setfreq_low;
252static struct pmf_function *pfunc_cpu_getfreq;
253static struct pmf_function *pfunc_slewing_done;
254
255static int g5_pfunc_switch_freq(int speed_mode)
256{
257 struct pmf_args args;
258 u32 done = 0;
259 unsigned long timeout;
260 int rc;
261
262 DBG("g5_pfunc_switch_freq(%d)\n", speed_mode);
263
264 /* If frequency is going up, first ramp up the voltage */
265 if (speed_mode < g5_pmode_cur)
266 g5_switch_volt(speed_mode);
267
268 /* Do it */
269 if (speed_mode == CPUFREQ_HIGH)
270 rc = pmf_call_one(pfunc_cpu_setfreq_high, NULL);
271 else
272 rc = pmf_call_one(pfunc_cpu_setfreq_low, NULL);
273
274 if (rc)
275 printk(KERN_WARNING "cpufreq: pfunc switch error %d\n", rc);
276
277 /* It's an irq GPIO so we should be able to just block here,
278 * I'll do that later after I've properly tested the IRQ code for
279 * platform functions
280 */
281 timeout = jiffies + HZ/10;
282 while(!time_after(jiffies, timeout)) {
283 args.count = 1;
284 args.u[0].p = &done;
285 pmf_call_one(pfunc_slewing_done, &args);
286 if (done)
287 break;
288 msleep(1);
289 }
290 if (done == 0)
291 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
292
293 /* If frequency is going down, last ramp the voltage */
294 if (speed_mode > g5_pmode_cur)
295 g5_switch_volt(speed_mode);
296
297 g5_pmode_cur = speed_mode;
298 ppc_proc_freq = g5_cpu_freqs[speed_mode].frequency * 1000ul;
299
300 return 0;
301}
302
303static int g5_pfunc_query_freq(void)
304{
305 struct pmf_args args;
306 u32 val = 0;
307
308 args.count = 1;
309 args.u[0].p = &val;
310 pmf_call_one(pfunc_cpu_getfreq, &args);
311 return val ? CPUFREQ_HIGH : CPUFREQ_LOW;
312}
313
314
315/*
316 * Common interface to the cpufreq core
317 */
318
319static int g5_cpufreq_verify(struct cpufreq_policy *policy)
320{
321 return cpufreq_frequency_table_verify(policy, g5_cpu_freqs);
322}
323
324static int g5_cpufreq_target(struct cpufreq_policy *policy,
325 unsigned int target_freq, unsigned int relation)
326{
327 unsigned int newstate = 0;
328 struct cpufreq_freqs freqs;
329 int rc;
330
331 if (cpufreq_frequency_table_target(policy, g5_cpu_freqs,
332 target_freq, relation, &newstate))
333 return -EINVAL;
334
335 if (g5_pmode_cur == newstate)
336 return 0;
337
338 mutex_lock(&g5_switch_mutex);
339
340 freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency;
341 freqs.new = g5_cpu_freqs[newstate].frequency;
342
343 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
344 rc = g5_switch_freq(newstate);
345 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
346
347 mutex_unlock(&g5_switch_mutex);
348
349 return rc;
350}
351
352static unsigned int g5_cpufreq_get_speed(unsigned int cpu)
353{
354 return g5_cpu_freqs[g5_pmode_cur].frequency;
355}
356
357static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)
358{
359 policy->cpuinfo.transition_latency = transition_latency;
360 policy->cur = g5_cpu_freqs[g5_query_freq()].frequency;
361 /* secondary CPUs are tied to the primary one by the
362 * cpufreq core if in the secondary policy we tell it that
363 * it actually must be one policy together with all others. */
364 cpumask_copy(policy->cpus, cpu_online_mask);
365 cpufreq_frequency_table_get_attr(g5_cpu_freqs, policy->cpu);
366
367 return cpufreq_frequency_table_cpuinfo(policy,
368 g5_cpu_freqs);
369}
370
371
372static struct cpufreq_driver g5_cpufreq_driver = {
373 .name = "powermac",
374 .owner = THIS_MODULE,
375 .flags = CPUFREQ_CONST_LOOPS,
376 .init = g5_cpufreq_cpu_init,
377 .verify = g5_cpufreq_verify,
378 .target = g5_cpufreq_target,
379 .get = g5_cpufreq_get_speed,
380 .attr = g5_cpu_freqs_attr,
381};
382
383
384#ifdef CONFIG_PMAC_SMU
385
386static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
387{
388 struct device_node *cpunode;
389 unsigned int psize, ssize;
390 unsigned long max_freq;
391 char *freq_method, *volt_method;
392 const u32 *valp;
393 u32 pvr_hi;
394 int use_volts_vdnap = 0;
395 int use_volts_smu = 0;
396 int rc = -ENODEV;
397
398 /* Check supported platforms */
399 if (of_machine_is_compatible("PowerMac8,1") ||
400 of_machine_is_compatible("PowerMac8,2") ||
401 of_machine_is_compatible("PowerMac9,1"))
402 use_volts_smu = 1;
403 else if (of_machine_is_compatible("PowerMac11,2"))
404 use_volts_vdnap = 1;
405 else
406 return -ENODEV;
407
408 /* Get first CPU node */
409 for (cpunode = NULL;
410 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
411 const u32 *reg = of_get_property(cpunode, "reg", NULL);
412 if (reg == NULL || (*reg) != 0)
413 continue;
414 if (!strcmp(cpunode->type, "cpu"))
415 break;
416 }
417 if (cpunode == NULL) {
418 printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n");
419 return -ENODEV;
420 }
421
422 /* Check 970FX for now */
423 valp = of_get_property(cpunode, "cpu-version", NULL);
424 if (!valp) {
425 DBG("No cpu-version property !\n");
426 goto bail_noprops;
427 }
428 pvr_hi = (*valp) >> 16;
429 if (pvr_hi != 0x3c && pvr_hi != 0x44) {
430 printk(KERN_ERR "cpufreq: Unsupported CPU version\n");
431 goto bail_noprops;
432 }
433
434 /* Look for the powertune data in the device-tree */
435 g5_pmode_data = of_get_property(cpunode, "power-mode-data",&psize);
436 if (!g5_pmode_data) {
437 DBG("No power-mode-data !\n");
438 goto bail_noprops;
439 }
440 g5_pmode_max = psize / sizeof(u32) - 1;
441
442 if (use_volts_smu) {
443 const struct smu_sdbp_header *shdr;
444
445 /* Look for the FVT table */
446 shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL);
447 if (!shdr)
448 goto bail_noprops;
449 g5_fvt_table = (struct smu_sdbp_fvt *)&shdr[1];
450 ssize = (shdr->len * sizeof(u32)) -
451 sizeof(struct smu_sdbp_header);
452 g5_fvt_count = ssize / sizeof(struct smu_sdbp_fvt);
453 g5_fvt_cur = 0;
454
455 /* Sanity checking */
456 if (g5_fvt_count < 1 || g5_pmode_max < 1)
457 goto bail_noprops;
458
459 g5_switch_volt = g5_smu_switch_volt;
460 volt_method = "SMU";
461 } else if (use_volts_vdnap) {
462 struct device_node *root;
463
464 root = of_find_node_by_path("/");
465 if (root == NULL) {
466 printk(KERN_ERR "cpufreq: Can't find root of "
467 "device tree\n");
468 goto bail_noprops;
469 }
470 pfunc_set_vdnap0 = pmf_find_function(root, "set-vdnap0");
471 pfunc_vdnap0_complete =
472 pmf_find_function(root, "slewing-done");
473 if (pfunc_set_vdnap0 == NULL ||
474 pfunc_vdnap0_complete == NULL) {
475 printk(KERN_ERR "cpufreq: Can't find required "
476 "platform function\n");
477 goto bail_noprops;
478 }
479
480 g5_switch_volt = g5_vdnap_switch_volt;
481 volt_method = "GPIO";
482 } else {
483 g5_switch_volt = g5_dummy_switch_volt;
484 volt_method = "none";
485 }
486
487 /*
488 * From what I see, clock-frequency is always the maximal frequency.
489 * The current driver can not slew sysclk yet, so we really only deal
490 * with powertune steps for now. We also only implement full freq and
491 * half freq in this version. So far, I haven't yet seen a machine
492 * supporting anything else.
493 */
494 valp = of_get_property(cpunode, "clock-frequency", NULL);
495 if (!valp)
496 return -ENODEV;
497 max_freq = (*valp)/1000;
498 g5_cpu_freqs[0].frequency = max_freq;
499 g5_cpu_freqs[1].frequency = max_freq/2;
500
501 /* Set callbacks */
502 transition_latency = 12000;
503 g5_switch_freq = g5_scom_switch_freq;
504 g5_query_freq = g5_scom_query_freq;
505 freq_method = "SCOM";
506
507 /* Force apply current frequency to make sure everything is in
508 * sync (voltage is right for example). Firmware may leave us with
509 * a strange setting ...
510 */
511 g5_switch_volt(CPUFREQ_HIGH);
512 msleep(10);
513 g5_pmode_cur = -1;
514 g5_switch_freq(g5_query_freq());
515
516 printk(KERN_INFO "Registering G5 CPU frequency driver\n");
517 printk(KERN_INFO "Frequency method: %s, Voltage method: %s\n",
518 freq_method, volt_method);
519 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Cur: %d MHz\n",
520 g5_cpu_freqs[1].frequency/1000,
521 g5_cpu_freqs[0].frequency/1000,
522 g5_cpu_freqs[g5_pmode_cur].frequency/1000);
523
524 rc = cpufreq_register_driver(&g5_cpufreq_driver);
525
526 /* We keep the CPU node on hold... hopefully, Apple G5 don't have
527 * hotplug CPU with a dynamic device-tree ...
528 */
529 return rc;
530
531 bail_noprops:
532 of_node_put(cpunode);
533
534 return rc;
535}
536
537#endif /* CONFIG_PMAC_SMU */
538
539
540static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
541{
542 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
543 const u8 *eeprom = NULL;
544 const u32 *valp;
545 u64 max_freq, min_freq, ih, il;
546 int has_volt = 1, rc = 0;
547
548 DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and"
549 " RackMac3,1...\n");
550
551 /* Get first CPU node */
552 for (cpunode = NULL;
553 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
554 if (!strcmp(cpunode->type, "cpu"))
555 break;
556 }
557 if (cpunode == NULL) {
558 printk(KERN_ERR "cpufreq: Can't find any CPU node\n");
559 return -ENODEV;
560 }
561
562 /* Lookup the cpuid eeprom node */
563 cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
564 if (cpuid != NULL)
565 eeprom = of_get_property(cpuid, "cpuid", NULL);
566 if (eeprom == NULL) {
567 printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n");
568 rc = -ENODEV;
569 goto bail;
570 }
571
572 /* Lookup the i2c hwclock */
573 for (hwclock = NULL;
574 (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
575 const char *loc = of_get_property(hwclock,
576 "hwctrl-location", NULL);
577 if (loc == NULL)
578 continue;
579 if (strcmp(loc, "CPU CLOCK"))
580 continue;
581 if (!of_get_property(hwclock, "platform-get-frequency", NULL))
582 continue;
583 break;
584 }
585 if (hwclock == NULL) {
586 printk(KERN_ERR "cpufreq: Can't find i2c clock chip !\n");
587 rc = -ENODEV;
588 goto bail;
589 }
590
591 DBG("cpufreq: i2c clock chip found: %s\n", hwclock->full_name);
592
593 /* Now get all the platform functions */
594 pfunc_cpu_getfreq =
595 pmf_find_function(hwclock, "get-frequency");
596 pfunc_cpu_setfreq_high =
597 pmf_find_function(hwclock, "set-frequency-high");
598 pfunc_cpu_setfreq_low =
599 pmf_find_function(hwclock, "set-frequency-low");
600 pfunc_slewing_done =
601 pmf_find_function(hwclock, "slewing-done");
602 pfunc_cpu0_volt_high =
603 pmf_find_function(hwclock, "set-voltage-high-0");
604 pfunc_cpu0_volt_low =
605 pmf_find_function(hwclock, "set-voltage-low-0");
606 pfunc_cpu1_volt_high =
607 pmf_find_function(hwclock, "set-voltage-high-1");
608 pfunc_cpu1_volt_low =
609 pmf_find_function(hwclock, "set-voltage-low-1");
610
611 /* Check we have minimum requirements */
612 if (pfunc_cpu_getfreq == NULL || pfunc_cpu_setfreq_high == NULL ||
613 pfunc_cpu_setfreq_low == NULL || pfunc_slewing_done == NULL) {
614 printk(KERN_ERR "cpufreq: Can't find platform functions !\n");
615 rc = -ENODEV;
616 goto bail;
617 }
618
619 /* Check that we have complete sets */
620 if (pfunc_cpu0_volt_high == NULL || pfunc_cpu0_volt_low == NULL) {
621 pmf_put_function(pfunc_cpu0_volt_high);
622 pmf_put_function(pfunc_cpu0_volt_low);
623 pfunc_cpu0_volt_high = pfunc_cpu0_volt_low = NULL;
624 has_volt = 0;
625 }
626 if (!has_volt ||
627 pfunc_cpu1_volt_high == NULL || pfunc_cpu1_volt_low == NULL) {
628 pmf_put_function(pfunc_cpu1_volt_high);
629 pmf_put_function(pfunc_cpu1_volt_low);
630 pfunc_cpu1_volt_high = pfunc_cpu1_volt_low = NULL;
631 }
632
633 /* Note: The device tree also contains a "platform-set-values"
634 * function for which I haven't quite figured out the usage. It
635 * might have to be called on init and/or wakeup, I'm not too sure
636 * but things seem to work fine without it so far ...
637 */
638
639 /* Get max frequency from device-tree */
640 valp = of_get_property(cpunode, "clock-frequency", NULL);
641 if (!valp) {
642 printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n");
643 rc = -ENODEV;
644 goto bail;
645 }
646
647 max_freq = (*valp)/1000;
648
649 /* Now calculate reduced frequency by using the cpuid input freq
650 * ratio. This requires 64 bits math unless we are willing to lose
651 * some precision
652 */
653 ih = *((u32 *)(eeprom + 0x10));
654 il = *((u32 *)(eeprom + 0x20));
655
656 /* Check for machines with no useful settings */
657 if (il == ih) {
658 printk(KERN_WARNING "cpufreq: No low frequency mode available"
659 " on this model !\n");
660 rc = -ENODEV;
661 goto bail;
662 }
663
664 min_freq = 0;
665 if (ih != 0 && il != 0)
666 min_freq = (max_freq * il) / ih;
667
668 /* Sanity check */
669 if (min_freq >= max_freq || min_freq < 1000) {
670 printk(KERN_ERR "cpufreq: Can't calculate low frequency !\n");
671 rc = -ENXIO;
672 goto bail;
673 }
674 g5_cpu_freqs[0].frequency = max_freq;
675 g5_cpu_freqs[1].frequency = min_freq;
676
677 /* Set callbacks */
678 transition_latency = CPUFREQ_ETERNAL;
679 g5_switch_volt = g5_pfunc_switch_volt;
680 g5_switch_freq = g5_pfunc_switch_freq;
681 g5_query_freq = g5_pfunc_query_freq;
682
683 /* Force apply current frequency to make sure everything is in
684 * sync (voltage is right for example). Firmware may leave us with
685 * a strange setting ...
686 */
687 g5_switch_volt(CPUFREQ_HIGH);
688 msleep(10);
689 g5_pmode_cur = -1;
690 g5_switch_freq(g5_query_freq());
691
692 printk(KERN_INFO "Registering G5 CPU frequency driver\n");
693 printk(KERN_INFO "Frequency method: i2c/pfunc, "
694 "Voltage method: %s\n", has_volt ? "i2c/pfunc" : "none");
695 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Cur: %d MHz\n",
696 g5_cpu_freqs[1].frequency/1000,
697 g5_cpu_freqs[0].frequency/1000,
698 g5_cpu_freqs[g5_pmode_cur].frequency/1000);
699
700 rc = cpufreq_register_driver(&g5_cpufreq_driver);
701 bail:
702 if (rc != 0) {
703 pmf_put_function(pfunc_cpu_getfreq);
704 pmf_put_function(pfunc_cpu_setfreq_high);
705 pmf_put_function(pfunc_cpu_setfreq_low);
706 pmf_put_function(pfunc_slewing_done);
707 pmf_put_function(pfunc_cpu0_volt_high);
708 pmf_put_function(pfunc_cpu0_volt_low);
709 pmf_put_function(pfunc_cpu1_volt_high);
710 pmf_put_function(pfunc_cpu1_volt_low);
711 }
712 of_node_put(hwclock);
713 of_node_put(cpuid);
714 of_node_put(cpunode);
715
716 return rc;
717}
718
719static int __init g5_cpufreq_init(void)
720{
721 struct device_node *cpus;
722 int rc = 0;
723
724 cpus = of_find_node_by_path("/cpus");
725 if (cpus == NULL) {
726 DBG("No /cpus node !\n");
727 return -ENODEV;
728 }
729
730 if (of_machine_is_compatible("PowerMac7,2") ||
731 of_machine_is_compatible("PowerMac7,3") ||
732 of_machine_is_compatible("RackMac3,1"))
733 rc = g5_pm72_cpufreq_init(cpus);
734#ifdef CONFIG_PMAC_SMU
735 else
736 rc = g5_neo2_cpufreq_init(cpus);
737#endif /* CONFIG_PMAC_SMU */
738
739 of_node_put(cpus);
740 return rc;
741}
742
743module_init(g5_cpufreq_init);
744
745
746MODULE_LICENSE("GPL");
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index f921067d924d..5cbd4d67d5c4 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -885,7 +885,7 @@ static int smp_core99_cpu_notify(struct notifier_block *self,
885 return NOTIFY_OK; 885 return NOTIFY_OK;
886} 886}
887 887
888static struct notifier_block __cpuinitdata smp_core99_cpu_nb = { 888static struct notifier_block smp_core99_cpu_nb = {
889 .notifier_call = smp_core99_cpu_notify, 889 .notifier_call = smp_core99_cpu_notify,
890}; 890};
891#endif /* CONFIG_HOTPLUG_CPU */ 891#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index bcc3cb48a44e..7fe595152478 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -3,3 +3,4 @@ obj-y += opal-rtc.o opal-nvram.o
3 3
4obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o 5obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o
6obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
new file mode 100644
index 000000000000..0cd1c4a71755
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -0,0 +1,916 @@
1/*
2 * The file intends to implement the functions needed by EEH, which is
3 * built on IODA compliant chip. Actually, lots of functions related
4 * to EEH would be built based on the OPAL APIs.
5 *
6 * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2013.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/bootmem.h>
15#include <linux/debugfs.h>
16#include <linux/delay.h>
17#include <linux/init.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20#include <linux/kernel.h>
21#include <linux/msi.h>
22#include <linux/notifier.h>
23#include <linux/pci.h>
24#include <linux/string.h>
25
26#include <asm/eeh.h>
27#include <asm/eeh_event.h>
28#include <asm/io.h>
29#include <asm/iommu.h>
30#include <asm/msi_bitmap.h>
31#include <asm/opal.h>
32#include <asm/pci-bridge.h>
33#include <asm/ppc-pci.h>
34#include <asm/tce.h>
35
36#include "powernv.h"
37#include "pci.h"
38
39/* Debugging option */
40#ifdef IODA_EEH_DBG_ON
41#define IODA_EEH_DBG(args...) pr_info(args)
42#else
43#define IODA_EEH_DBG(args...)
44#endif
45
46static char *hub_diag = NULL;
47static int ioda_eeh_nb_init = 0;
48
49static int ioda_eeh_event(struct notifier_block *nb,
50 unsigned long events, void *change)
51{
52 uint64_t changed_evts = (uint64_t)change;
53
54 /* We simply send special EEH event */
55 if ((changed_evts & OPAL_EVENT_PCI_ERROR) &&
56 (events & OPAL_EVENT_PCI_ERROR))
57 eeh_send_failure_event(NULL);
58
59 return 0;
60}
61
62static struct notifier_block ioda_eeh_nb = {
63 .notifier_call = ioda_eeh_event,
64 .next = NULL,
65 .priority = 0
66};
67
68#ifdef CONFIG_DEBUG_FS
69static int ioda_eeh_dbgfs_set(void *data, u64 val)
70{
71 struct pci_controller *hose = data;
72 struct pnv_phb *phb = hose->private_data;
73
74 out_be64(phb->regs + 0xD10, val);
75 return 0;
76}
77
78static int ioda_eeh_dbgfs_get(void *data, u64 *val)
79{
80 struct pci_controller *hose = data;
81 struct pnv_phb *phb = hose->private_data;
82
83 *val = in_be64(phb->regs + 0xD10);
84 return 0;
85}
86
87DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_dbgfs_ops, ioda_eeh_dbgfs_get,
88 ioda_eeh_dbgfs_set, "0x%llx\n");
89#endif /* CONFIG_DEBUG_FS */
90
91/**
92 * ioda_eeh_post_init - Chip dependent post initialization
93 * @hose: PCI controller
94 *
95 * The function will be called after eeh PEs and devices
96 * have been built. That means the EEH is ready to supply
97 * service with I/O cache.
98 */
99static int ioda_eeh_post_init(struct pci_controller *hose)
100{
101 struct pnv_phb *phb = hose->private_data;
102 int ret;
103
104 /* Register OPAL event notifier */
105 if (!ioda_eeh_nb_init) {
106 ret = opal_notifier_register(&ioda_eeh_nb);
107 if (ret) {
108 pr_err("%s: Can't register OPAL event notifier (%d)\n",
109 __func__, ret);
110 return ret;
111 }
112
113 ioda_eeh_nb_init = 1;
114 }
115
116 /* FIXME: Enable it for PHB3 later */
117 if (phb->type == PNV_PHB_IODA1) {
118 if (!hub_diag) {
119 hub_diag = (char *)__get_free_page(GFP_KERNEL |
120 __GFP_ZERO);
121 if (!hub_diag) {
122 pr_err("%s: Out of memory !\n",
123 __func__);
124 return -ENOMEM;
125 }
126 }
127
128#ifdef CONFIG_DEBUG_FS
129 if (phb->dbgfs)
130 debugfs_create_file("err_injct", 0600,
131 phb->dbgfs, hose,
132 &ioda_eeh_dbgfs_ops);
133#endif
134
135 phb->eeh_state |= PNV_EEH_STATE_ENABLED;
136 }
137
138 return 0;
139}
140
141/**
142 * ioda_eeh_set_option - Set EEH operation or I/O setting
143 * @pe: EEH PE
144 * @option: options
145 *
146 * Enable or disable EEH option for the indicated PE. The
147 * function also can be used to enable I/O or DMA for the
148 * PE.
149 */
150static int ioda_eeh_set_option(struct eeh_pe *pe, int option)
151{
152 s64 ret;
153 u32 pe_no;
154 struct pci_controller *hose = pe->phb;
155 struct pnv_phb *phb = hose->private_data;
156
157 /* Check on PE number */
158 if (pe->addr < 0 || pe->addr >= phb->ioda.total_pe) {
159 pr_err("%s: PE address %x out of range [0, %x] "
160 "on PHB#%x\n",
161 __func__, pe->addr, phb->ioda.total_pe,
162 hose->global_number);
163 return -EINVAL;
164 }
165
166 pe_no = pe->addr;
167 switch (option) {
168 case EEH_OPT_DISABLE:
169 ret = -EEXIST;
170 break;
171 case EEH_OPT_ENABLE:
172 ret = 0;
173 break;
174 case EEH_OPT_THAW_MMIO:
175 ret = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no,
176 OPAL_EEH_ACTION_CLEAR_FREEZE_MMIO);
177 if (ret) {
178 pr_warning("%s: Failed to enable MMIO for "
179 "PHB#%x-PE#%x, err=%lld\n",
180 __func__, hose->global_number, pe_no, ret);
181 return -EIO;
182 }
183
184 break;
185 case EEH_OPT_THAW_DMA:
186 ret = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no,
187 OPAL_EEH_ACTION_CLEAR_FREEZE_DMA);
188 if (ret) {
189 pr_warning("%s: Failed to enable DMA for "
190 "PHB#%x-PE#%x, err=%lld\n",
191 __func__, hose->global_number, pe_no, ret);
192 return -EIO;
193 }
194
195 break;
196 default:
197 pr_warning("%s: Invalid option %d\n", __func__, option);
198 return -EINVAL;
199 }
200
201 return ret;
202}
203
204/**
205 * ioda_eeh_get_state - Retrieve the state of PE
206 * @pe: EEH PE
207 *
208 * The PE's state should be retrieved from the PEEV, PEST
209 * IODA tables. Since the OPAL has exported the function
210 * to do it, it'd better to use that.
211 */
212static int ioda_eeh_get_state(struct eeh_pe *pe)
213{
214 s64 ret = 0;
215 u8 fstate;
216 u16 pcierr;
217 u32 pe_no;
218 int result;
219 struct pci_controller *hose = pe->phb;
220 struct pnv_phb *phb = hose->private_data;
221
222 /*
223 * Sanity check on PE address. The PHB PE address should
224 * be zero.
225 */
226 if (pe->addr < 0 || pe->addr >= phb->ioda.total_pe) {
227 pr_err("%s: PE address %x out of range [0, %x] "
228 "on PHB#%x\n",
229 __func__, pe->addr, phb->ioda.total_pe,
230 hose->global_number);
231 return EEH_STATE_NOT_SUPPORT;
232 }
233
234 /* Retrieve PE status through OPAL */
235 pe_no = pe->addr;
236 ret = opal_pci_eeh_freeze_status(phb->opal_id, pe_no,
237 &fstate, &pcierr, NULL);
238 if (ret) {
239 pr_err("%s: Failed to get EEH status on "
240 "PHB#%x-PE#%x\n, err=%lld\n",
241 __func__, hose->global_number, pe_no, ret);
242 return EEH_STATE_NOT_SUPPORT;
243 }
244
245 /* Check PHB status */
246 if (pe->type & EEH_PE_PHB) {
247 result = 0;
248 result &= ~EEH_STATE_RESET_ACTIVE;
249
250 if (pcierr != OPAL_EEH_PHB_ERROR) {
251 result |= EEH_STATE_MMIO_ACTIVE;
252 result |= EEH_STATE_DMA_ACTIVE;
253 result |= EEH_STATE_MMIO_ENABLED;
254 result |= EEH_STATE_DMA_ENABLED;
255 }
256
257 return result;
258 }
259
260 /* Parse result out */
261 result = 0;
262 switch (fstate) {
263 case OPAL_EEH_STOPPED_NOT_FROZEN:
264 result &= ~EEH_STATE_RESET_ACTIVE;
265 result |= EEH_STATE_MMIO_ACTIVE;
266 result |= EEH_STATE_DMA_ACTIVE;
267 result |= EEH_STATE_MMIO_ENABLED;
268 result |= EEH_STATE_DMA_ENABLED;
269 break;
270 case OPAL_EEH_STOPPED_MMIO_FREEZE:
271 result &= ~EEH_STATE_RESET_ACTIVE;
272 result |= EEH_STATE_DMA_ACTIVE;
273 result |= EEH_STATE_DMA_ENABLED;
274 break;
275 case OPAL_EEH_STOPPED_DMA_FREEZE:
276 result &= ~EEH_STATE_RESET_ACTIVE;
277 result |= EEH_STATE_MMIO_ACTIVE;
278 result |= EEH_STATE_MMIO_ENABLED;
279 break;
280 case OPAL_EEH_STOPPED_MMIO_DMA_FREEZE:
281 result &= ~EEH_STATE_RESET_ACTIVE;
282 break;
283 case OPAL_EEH_STOPPED_RESET:
284 result |= EEH_STATE_RESET_ACTIVE;
285 break;
286 case OPAL_EEH_STOPPED_TEMP_UNAVAIL:
287 result |= EEH_STATE_UNAVAILABLE;
288 break;
289 case OPAL_EEH_STOPPED_PERM_UNAVAIL:
290 result |= EEH_STATE_NOT_SUPPORT;
291 break;
292 default:
293 pr_warning("%s: Unexpected EEH status 0x%x "
294 "on PHB#%x-PE#%x\n",
295 __func__, fstate, hose->global_number, pe_no);
296 }
297
298 return result;
299}
300
301static int ioda_eeh_pe_clear(struct eeh_pe *pe)
302{
303 struct pci_controller *hose;
304 struct pnv_phb *phb;
305 u32 pe_no;
306 u8 fstate;
307 u16 pcierr;
308 s64 ret;
309
310 pe_no = pe->addr;
311 hose = pe->phb;
312 phb = pe->phb->private_data;
313
314 /* Clear the EEH error on the PE */
315 ret = opal_pci_eeh_freeze_clear(phb->opal_id,
316 pe_no, OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
317 if (ret) {
318 pr_err("%s: Failed to clear EEH error for "
319 "PHB#%x-PE#%x, err=%lld\n",
320 __func__, hose->global_number, pe_no, ret);
321 return -EIO;
322 }
323
324 /*
325 * Read the PE state back and verify that the frozen
326 * state has been removed.
327 */
328 ret = opal_pci_eeh_freeze_status(phb->opal_id, pe_no,
329 &fstate, &pcierr, NULL);
330 if (ret) {
331 pr_err("%s: Failed to get EEH status on "
332 "PHB#%x-PE#%x\n, err=%lld\n",
333 __func__, hose->global_number, pe_no, ret);
334 return -EIO;
335 }
336
337 if (fstate != OPAL_EEH_STOPPED_NOT_FROZEN) {
338 pr_err("%s: Frozen state not cleared on "
339 "PHB#%x-PE#%x, sts=%x\n",
340 __func__, hose->global_number, pe_no, fstate);
341 return -EIO;
342 }
343
344 return 0;
345}
346
347static s64 ioda_eeh_phb_poll(struct pnv_phb *phb)
348{
349 s64 rc = OPAL_HARDWARE;
350
351 while (1) {
352 rc = opal_pci_poll(phb->opal_id);
353 if (rc <= 0)
354 break;
355
356 msleep(rc);
357 }
358
359 return rc;
360}
361
362static int ioda_eeh_phb_reset(struct pci_controller *hose, int option)
363{
364 struct pnv_phb *phb = hose->private_data;
365 s64 rc = OPAL_HARDWARE;
366
367 pr_debug("%s: Reset PHB#%x, option=%d\n",
368 __func__, hose->global_number, option);
369
370 /* Issue PHB complete reset request */
371 if (option == EEH_RESET_FUNDAMENTAL ||
372 option == EEH_RESET_HOT)
373 rc = opal_pci_reset(phb->opal_id,
374 OPAL_PHB_COMPLETE,
375 OPAL_ASSERT_RESET);
376 else if (option == EEH_RESET_DEACTIVATE)
377 rc = opal_pci_reset(phb->opal_id,
378 OPAL_PHB_COMPLETE,
379 OPAL_DEASSERT_RESET);
380 if (rc < 0)
381 goto out;
382
383 /*
384 * Poll state of the PHB until the request is done
385 * successfully.
386 */
387 rc = ioda_eeh_phb_poll(phb);
388out:
389 if (rc != OPAL_SUCCESS)
390 return -EIO;
391
392 return 0;
393}
394
395static int ioda_eeh_root_reset(struct pci_controller *hose, int option)
396{
397 struct pnv_phb *phb = hose->private_data;
398 s64 rc = OPAL_SUCCESS;
399
400 pr_debug("%s: Reset PHB#%x, option=%d\n",
401 __func__, hose->global_number, option);
402
403 /*
404 * During the reset deassert time, we needn't care
405 * the reset scope because the firmware does nothing
406 * for fundamental or hot reset during deassert phase.
407 */
408 if (option == EEH_RESET_FUNDAMENTAL)
409 rc = opal_pci_reset(phb->opal_id,
410 OPAL_PCI_FUNDAMENTAL_RESET,
411 OPAL_ASSERT_RESET);
412 else if (option == EEH_RESET_HOT)
413 rc = opal_pci_reset(phb->opal_id,
414 OPAL_PCI_HOT_RESET,
415 OPAL_ASSERT_RESET);
416 else if (option == EEH_RESET_DEACTIVATE)
417 rc = opal_pci_reset(phb->opal_id,
418 OPAL_PCI_HOT_RESET,
419 OPAL_DEASSERT_RESET);
420 if (rc < 0)
421 goto out;
422
423 /* Poll state of the PHB until the request is done */
424 rc = ioda_eeh_phb_poll(phb);
425out:
426 if (rc != OPAL_SUCCESS)
427 return -EIO;
428
429 return 0;
430}
431
432static int ioda_eeh_bridge_reset(struct pci_controller *hose,
433 struct pci_dev *dev, int option)
434{
435 u16 ctrl;
436
437 pr_debug("%s: Reset device %04x:%02x:%02x.%01x with option %d\n",
438 __func__, hose->global_number, dev->bus->number,
439 PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), option);
440
441 switch (option) {
442 case EEH_RESET_FUNDAMENTAL:
443 case EEH_RESET_HOT:
444 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &ctrl);
445 ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
446 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
447 break;
448 case EEH_RESET_DEACTIVATE:
449 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &ctrl);
450 ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
451 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
452 break;
453 }
454
455 return 0;
456}
457
458/**
459 * ioda_eeh_reset - Reset the indicated PE
460 * @pe: EEH PE
461 * @option: reset option
462 *
463 * Do reset on the indicated PE. For PCI bus sensitive PE,
464 * we need to reset the parent p2p bridge. The PHB has to
465 * be reinitialized if the p2p bridge is root bridge. For
466 * PCI device sensitive PE, we will try to reset the device
467 * through FLR. For now, we don't have OPAL APIs to do HARD
468 * reset yet, so all reset would be SOFT (HOT) reset.
469 */
470static int ioda_eeh_reset(struct eeh_pe *pe, int option)
471{
472 struct pci_controller *hose = pe->phb;
473 struct eeh_dev *edev;
474 struct pci_dev *dev;
475 int ret;
476
477 /*
478 * Anyway, we have to clear the problematic state for the
479 * corresponding PE. However, we needn't do it if the PE
480 * is PHB associated. That means the PHB is having fatal
481 * errors and it needs reset. Further more, the AIB interface
482 * isn't reliable any more.
483 */
484 if (!(pe->type & EEH_PE_PHB) &&
485 (option == EEH_RESET_HOT ||
486 option == EEH_RESET_FUNDAMENTAL)) {
487 ret = ioda_eeh_pe_clear(pe);
488 if (ret)
489 return -EIO;
490 }
491
492 /*
493 * The rules applied to reset, either fundamental or hot reset:
494 *
495 * We always reset the direct upstream bridge of the PE. If the
496 * direct upstream bridge isn't root bridge, we always take hot
497 * reset no matter what option (fundamental or hot) is. Otherwise,
498 * we should do the reset according to the required option.
499 */
500 if (pe->type & EEH_PE_PHB) {
501 ret = ioda_eeh_phb_reset(hose, option);
502 } else {
503 if (pe->type & EEH_PE_DEVICE) {
504 /*
505 * If it's device PE, we didn't refer to the parent
506 * PCI bus yet. So we have to figure it out indirectly.
507 */
508 edev = list_first_entry(&pe->edevs,
509 struct eeh_dev, list);
510 dev = eeh_dev_to_pci_dev(edev);
511 dev = dev->bus->self;
512 } else {
513 /*
514 * If it's bus PE, the parent PCI bus is already there
515 * and just pick it up.
516 */
517 dev = pe->bus->self;
518 }
519
520 /*
521 * Do reset based on the fact that the direct upstream bridge
522 * is root bridge (port) or not.
523 */
524 if (dev->bus->number == 0)
525 ret = ioda_eeh_root_reset(hose, option);
526 else
527 ret = ioda_eeh_bridge_reset(hose, dev, option);
528 }
529
530 return ret;
531}
532
533/**
534 * ioda_eeh_get_log - Retrieve error log
535 * @pe: EEH PE
536 * @severity: Severity level of the log
537 * @drv_log: buffer to store the log
538 * @len: space of the log buffer
539 *
540 * The function is used to retrieve error log from P7IOC.
541 */
542static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
543 char *drv_log, unsigned long len)
544{
545 s64 ret;
546 unsigned long flags;
547 struct pci_controller *hose = pe->phb;
548 struct pnv_phb *phb = hose->private_data;
549
550 spin_lock_irqsave(&phb->lock, flags);
551
552 ret = opal_pci_get_phb_diag_data2(phb->opal_id,
553 phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE);
554 if (ret) {
555 spin_unlock_irqrestore(&phb->lock, flags);
556 pr_warning("%s: Failed to get log for PHB#%x-PE#%x\n",
557 __func__, hose->global_number, pe->addr);
558 return -EIO;
559 }
560
561 /*
562 * FIXME: We probably need log the error in somewhere.
563 * Lets make it up in future.
564 */
565 /* pr_info("%s", phb->diag.blob); */
566
567 spin_unlock_irqrestore(&phb->lock, flags);
568
569 return 0;
570}
571
572/**
573 * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE
574 * @pe: EEH PE
575 *
576 * For particular PE, it might have included PCI bridges. In order
577 * to make the PE work properly, those PCI bridges should be configured
578 * correctly. However, we need do nothing on P7IOC since the reset
579 * function will do everything that should be covered by the function.
580 */
581static int ioda_eeh_configure_bridge(struct eeh_pe *pe)
582{
583 return 0;
584}
585
586static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
587{
588 /* GEM */
589 pr_info(" GEM XFIR: %016llx\n", data->gemXfir);
590 pr_info(" GEM RFIR: %016llx\n", data->gemRfir);
591 pr_info(" GEM RIRQFIR: %016llx\n", data->gemRirqfir);
592 pr_info(" GEM Mask: %016llx\n", data->gemMask);
593 pr_info(" GEM RWOF: %016llx\n", data->gemRwof);
594
595 /* LEM */
596 pr_info(" LEM FIR: %016llx\n", data->lemFir);
597 pr_info(" LEM Error Mask: %016llx\n", data->lemErrMask);
598 pr_info(" LEM Action 0: %016llx\n", data->lemAction0);
599 pr_info(" LEM Action 1: %016llx\n", data->lemAction1);
600 pr_info(" LEM WOF: %016llx\n", data->lemWof);
601}
602
603static void ioda_eeh_hub_diag(struct pci_controller *hose)
604{
605 struct pnv_phb *phb = hose->private_data;
606 struct OpalIoP7IOCErrorData *data;
607 long rc;
608
609 data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag;
610 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
611 if (rc != OPAL_SUCCESS) {
612 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
613 __func__, phb->hub_id, rc);
614 return;
615 }
616
617 switch (data->type) {
618 case OPAL_P7IOC_DIAG_TYPE_RGC:
619 pr_info("P7IOC diag-data for RGC\n\n");
620 ioda_eeh_hub_diag_common(data);
621 pr_info(" RGC Status: %016llx\n", data->rgc.rgcStatus);
622 pr_info(" RGC LDCP: %016llx\n", data->rgc.rgcLdcp);
623 break;
624 case OPAL_P7IOC_DIAG_TYPE_BI:
625 pr_info("P7IOC diag-data for BI %s\n\n",
626 data->bi.biDownbound ? "Downbound" : "Upbound");
627 ioda_eeh_hub_diag_common(data);
628 pr_info(" BI LDCP 0: %016llx\n", data->bi.biLdcp0);
629 pr_info(" BI LDCP 1: %016llx\n", data->bi.biLdcp1);
630 pr_info(" BI LDCP 2: %016llx\n", data->bi.biLdcp2);
631 pr_info(" BI Fence Status: %016llx\n", data->bi.biFenceStatus);
632 break;
633 case OPAL_P7IOC_DIAG_TYPE_CI:
634 pr_info("P7IOC diag-data for CI Port %d\\nn",
635 data->ci.ciPort);
636 ioda_eeh_hub_diag_common(data);
637 pr_info(" CI Port Status: %016llx\n", data->ci.ciPortStatus);
638 pr_info(" CI Port LDCP: %016llx\n", data->ci.ciPortLdcp);
639 break;
640 case OPAL_P7IOC_DIAG_TYPE_MISC:
641 pr_info("P7IOC diag-data for MISC\n\n");
642 ioda_eeh_hub_diag_common(data);
643 break;
644 case OPAL_P7IOC_DIAG_TYPE_I2C:
645 pr_info("P7IOC diag-data for I2C\n\n");
646 ioda_eeh_hub_diag_common(data);
647 break;
648 default:
649 pr_warning("%s: Invalid type of HUB#%llx diag-data (%d)\n",
650 __func__, phb->hub_id, data->type);
651 }
652}
653
654static void ioda_eeh_p7ioc_phb_diag(struct pci_controller *hose,
655 struct OpalIoPhbErrorCommon *common)
656{
657 struct OpalIoP7IOCPhbErrorData *data;
658 int i;
659
660 data = (struct OpalIoP7IOCPhbErrorData *)common;
661
662 pr_info("P7IOC PHB#%x Diag-data (Version: %d)\n\n",
663 hose->global_number, common->version);
664
665 pr_info(" brdgCtl: %08x\n", data->brdgCtl);
666
667 pr_info(" portStatusReg: %08x\n", data->portStatusReg);
668 pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus);
669 pr_info(" busAgentStatus: %08x\n", data->busAgentStatus);
670
671 pr_info(" deviceStatus: %08x\n", data->deviceStatus);
672 pr_info(" slotStatus: %08x\n", data->slotStatus);
673 pr_info(" linkStatus: %08x\n", data->linkStatus);
674 pr_info(" devCmdStatus: %08x\n", data->devCmdStatus);
675 pr_info(" devSecStatus: %08x\n", data->devSecStatus);
676
677 pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus);
678 pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus);
679 pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus);
680 pr_info(" tlpHdr1: %08x\n", data->tlpHdr1);
681 pr_info(" tlpHdr2: %08x\n", data->tlpHdr2);
682 pr_info(" tlpHdr3: %08x\n", data->tlpHdr3);
683 pr_info(" tlpHdr4: %08x\n", data->tlpHdr4);
684 pr_info(" sourceId: %08x\n", data->sourceId);
685
686 pr_info(" errorClass: %016llx\n", data->errorClass);
687 pr_info(" correlator: %016llx\n", data->correlator);
688 pr_info(" p7iocPlssr: %016llx\n", data->p7iocPlssr);
689 pr_info(" p7iocCsr: %016llx\n", data->p7iocCsr);
690 pr_info(" lemFir: %016llx\n", data->lemFir);
691 pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask);
692 pr_info(" lemWOF: %016llx\n", data->lemWOF);
693 pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus);
694 pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus);
695 pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0);
696 pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1);
697 pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus);
698 pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus);
699 pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0);
700 pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1);
701 pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus);
702 pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus);
703 pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0);
704 pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1);
705 pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus);
706 pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus);
707 pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0);
708 pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1);
709
710 for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) {
711 if ((data->pestA[i] >> 63) == 0 &&
712 (data->pestB[i] >> 63) == 0)
713 continue;
714
715 pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]);
716 pr_info(" PESTB: %016llx\n", data->pestB[i]);
717 }
718}
719
720static void ioda_eeh_phb_diag(struct pci_controller *hose)
721{
722 struct pnv_phb *phb = hose->private_data;
723 struct OpalIoPhbErrorCommon *common;
724 long rc;
725
726 common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
727 rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE);
728 if (rc != OPAL_SUCCESS) {
729 pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",
730 __func__, hose->global_number, rc);
731 return;
732 }
733
734 switch (common->ioType) {
735 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
736 ioda_eeh_p7ioc_phb_diag(hose, common);
737 break;
738 default:
739 pr_warning("%s: Unrecognized I/O chip %d\n",
740 __func__, common->ioType);
741 }
742}
743
744static int ioda_eeh_get_phb_pe(struct pci_controller *hose,
745 struct eeh_pe **pe)
746{
747 struct eeh_pe *phb_pe;
748
749 phb_pe = eeh_phb_pe_get(hose);
750 if (!phb_pe) {
751 pr_warning("%s Can't find PE for PHB#%d\n",
752 __func__, hose->global_number);
753 return -EEXIST;
754 }
755
756 *pe = phb_pe;
757 return 0;
758}
759
760static int ioda_eeh_get_pe(struct pci_controller *hose,
761 u16 pe_no, struct eeh_pe **pe)
762{
763 struct eeh_pe *phb_pe, *dev_pe;
764 struct eeh_dev dev;
765
766 /* Find the PHB PE */
767 if (ioda_eeh_get_phb_pe(hose, &phb_pe))
768 return -EEXIST;
769
770 /* Find the PE according to PE# */
771 memset(&dev, 0, sizeof(struct eeh_dev));
772 dev.phb = hose;
773 dev.pe_config_addr = pe_no;
774 dev_pe = eeh_pe_get(&dev);
775 if (!dev_pe) {
776 pr_warning("%s: Can't find PE for PHB#%x - PE#%x\n",
777 __func__, hose->global_number, pe_no);
778 return -EEXIST;
779 }
780
781 *pe = dev_pe;
782 return 0;
783}
784
785/**
786 * ioda_eeh_next_error - Retrieve next error for EEH core to handle
787 * @pe: The affected PE
788 *
789 * The function is expected to be called by EEH core while it gets
790 * special EEH event (without binding PE). The function calls to
791 * OPAL APIs for next error to handle. The informational error is
792 * handled internally by platform. However, the dead IOC, dead PHB,
793 * fenced PHB and frozen PE should be handled by EEH core eventually.
794 */
795static int ioda_eeh_next_error(struct eeh_pe **pe)
796{
797 struct pci_controller *hose, *tmp;
798 struct pnv_phb *phb;
799 u64 frozen_pe_no;
800 u16 err_type, severity;
801 long rc;
802 int ret = 1;
803
804 /*
805 * While running here, it's safe to purge the event queue.
806 * And we should keep the cached OPAL notifier event sychronized
807 * between the kernel and firmware.
808 */
809 eeh_remove_event(NULL);
810 opal_notifier_update_evt(OPAL_EVENT_PCI_ERROR, 0x0ul);
811
812 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
813 /*
814 * If the subordinate PCI buses of the PHB has been
815 * removed, we needn't take care of it any more.
816 */
817 phb = hose->private_data;
818 if (phb->eeh_state & PNV_EEH_STATE_REMOVED)
819 continue;
820
821 rc = opal_pci_next_error(phb->opal_id,
822 &frozen_pe_no, &err_type, &severity);
823
824 /* If OPAL API returns error, we needn't proceed */
825 if (rc != OPAL_SUCCESS) {
826 IODA_EEH_DBG("%s: Invalid return value on "
827 "PHB#%x (0x%lx) from opal_pci_next_error",
828 __func__, hose->global_number, rc);
829 continue;
830 }
831
832 /* If the PHB doesn't have error, stop processing */
833 if (err_type == OPAL_EEH_NO_ERROR ||
834 severity == OPAL_EEH_SEV_NO_ERROR) {
835 IODA_EEH_DBG("%s: No error found on PHB#%x\n",
836 __func__, hose->global_number);
837 continue;
838 }
839
840 /*
841 * Processing the error. We're expecting the error with
842 * highest priority reported upon multiple errors on the
843 * specific PHB.
844 */
845 IODA_EEH_DBG("%s: Error (%d, %d, %d) on PHB#%x\n",
846 err_type, severity, pe_no, hose->global_number);
847 switch (err_type) {
848 case OPAL_EEH_IOC_ERROR:
849 if (severity == OPAL_EEH_SEV_IOC_DEAD) {
850 list_for_each_entry_safe(hose, tmp,
851 &hose_list, list_node) {
852 phb = hose->private_data;
853 phb->eeh_state |= PNV_EEH_STATE_REMOVED;
854 }
855
856 pr_err("EEH: dead IOC detected\n");
857 ret = 4;
858 goto out;
859 } else if (severity == OPAL_EEH_SEV_INF) {
860 pr_info("EEH: IOC informative error "
861 "detected\n");
862 ioda_eeh_hub_diag(hose);
863 }
864
865 break;
866 case OPAL_EEH_PHB_ERROR:
867 if (severity == OPAL_EEH_SEV_PHB_DEAD) {
868 if (ioda_eeh_get_phb_pe(hose, pe))
869 break;
870
871 pr_err("EEH: dead PHB#%x detected\n",
872 hose->global_number);
873 phb->eeh_state |= PNV_EEH_STATE_REMOVED;
874 ret = 3;
875 goto out;
876 } else if (severity == OPAL_EEH_SEV_PHB_FENCED) {
877 if (ioda_eeh_get_phb_pe(hose, pe))
878 break;
879
880 pr_err("EEH: fenced PHB#%x detected\n",
881 hose->global_number);
882 ret = 2;
883 goto out;
884 } else if (severity == OPAL_EEH_SEV_INF) {
885 pr_info("EEH: PHB#%x informative error "
886 "detected\n",
887 hose->global_number);
888 ioda_eeh_phb_diag(hose);
889 }
890
891 break;
892 case OPAL_EEH_PE_ERROR:
893 if (ioda_eeh_get_pe(hose, frozen_pe_no, pe))
894 break;
895
896 pr_err("EEH: Frozen PE#%x on PHB#%x detected\n",
897 (*pe)->addr, (*pe)->phb->global_number);
898 ret = 1;
899 goto out;
900 }
901 }
902
903 ret = 0;
904out:
905 return ret;
906}
907
908struct pnv_eeh_ops ioda_eeh_ops = {
909 .post_init = ioda_eeh_post_init,
910 .set_option = ioda_eeh_set_option,
911 .get_state = ioda_eeh_get_state,
912 .reset = ioda_eeh_reset,
913 .get_log = ioda_eeh_get_log,
914 .configure_bridge = ioda_eeh_configure_bridge,
915 .next_error = ioda_eeh_next_error
916};
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
new file mode 100644
index 000000000000..969cce73055a
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -0,0 +1,379 @@
1/*
2 * The file intends to implement the platform dependent EEH operations on
3 * powernv platform. Actually, the powernv was created in order to fully
4 * hypervisor support.
5 *
6 * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2013.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/atomic.h>
15#include <linux/delay.h>
16#include <linux/export.h>
17#include <linux/init.h>
18#include <linux/list.h>
19#include <linux/msi.h>
20#include <linux/of.h>
21#include <linux/pci.h>
22#include <linux/proc_fs.h>
23#include <linux/rbtree.h>
24#include <linux/sched.h>
25#include <linux/seq_file.h>
26#include <linux/spinlock.h>
27
28#include <asm/eeh.h>
29#include <asm/eeh_event.h>
30#include <asm/firmware.h>
31#include <asm/io.h>
32#include <asm/iommu.h>
33#include <asm/machdep.h>
34#include <asm/msi_bitmap.h>
35#include <asm/opal.h>
36#include <asm/ppc-pci.h>
37
38#include "powernv.h"
39#include "pci.h"
40
41/**
42 * powernv_eeh_init - EEH platform dependent initialization
43 *
44 * EEH platform dependent initialization on powernv
45 */
46static int powernv_eeh_init(void)
47{
48 /* We require OPALv3 */
49 if (!firmware_has_feature(FW_FEATURE_OPALv3)) {
50 pr_warning("%s: OPALv3 is required !\n", __func__);
51 return -EINVAL;
52 }
53
54 /* Set EEH probe mode */
55 eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
56
57 return 0;
58}
59
60/**
61 * powernv_eeh_post_init - EEH platform dependent post initialization
62 *
63 * EEH platform dependent post initialization on powernv. When
64 * the function is called, the EEH PEs and devices should have
65 * been built. If the I/O cache staff has been built, EEH is
66 * ready to supply service.
67 */
68static int powernv_eeh_post_init(void)
69{
70 struct pci_controller *hose;
71 struct pnv_phb *phb;
72 int ret = 0;
73
74 list_for_each_entry(hose, &hose_list, list_node) {
75 phb = hose->private_data;
76
77 if (phb->eeh_ops && phb->eeh_ops->post_init) {
78 ret = phb->eeh_ops->post_init(hose);
79 if (ret)
80 break;
81 }
82 }
83
84 return ret;
85}
86
87/**
88 * powernv_eeh_dev_probe - Do probe on PCI device
89 * @dev: PCI device
90 * @flag: unused
91 *
92 * When EEH module is installed during system boot, all PCI devices
93 * are checked one by one to see if it supports EEH. The function
94 * is introduced for the purpose. By default, EEH has been enabled
95 * on all PCI devices. That's to say, we only need do necessary
96 * initialization on the corresponding eeh device and create PE
97 * accordingly.
98 *
99 * It's notable that's unsafe to retrieve the EEH device through
100 * the corresponding PCI device. During the PCI device hotplug, which
101 * was possiblly triggered by EEH core, the binding between EEH device
102 * and the PCI device isn't built yet.
103 */
104static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
105{
106 struct pci_controller *hose = pci_bus_to_host(dev->bus);
107 struct pnv_phb *phb = hose->private_data;
108 struct device_node *dn = pci_device_to_OF_node(dev);
109 struct eeh_dev *edev = of_node_to_eeh_dev(dn);
110
111 /*
112 * When probing the root bridge, which doesn't have any
113 * subordinate PCI devices. We don't have OF node for
114 * the root bridge. So it's not reasonable to continue
115 * the probing.
116 */
117 if (!dn || !edev)
118 return 0;
119
120 /* Skip for PCI-ISA bridge */
121 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
122 return 0;
123
124 /* Initialize eeh device */
125 edev->class_code = dev->class;
126 edev->mode = 0;
127 edev->config_addr = ((dev->bus->number << 8) | dev->devfn);
128 edev->pe_config_addr = phb->bdfn_to_pe(phb, dev->bus, dev->devfn & 0xff);
129
130 /* Create PE */
131 eeh_add_to_parent_pe(edev);
132
133 /*
134 * Enable EEH explicitly so that we will do EEH check
135 * while accessing I/O stuff
136 *
137 * FIXME: Enable that for PHB3 later
138 */
139 if (phb->type == PNV_PHB_IODA1)
140 eeh_subsystem_enabled = 1;
141
142 /* Save memory bars */
143 eeh_save_bars(edev);
144
145 return 0;
146}
147
148/**
149 * powernv_eeh_set_option - Initialize EEH or MMIO/DMA reenable
150 * @pe: EEH PE
151 * @option: operation to be issued
152 *
153 * The function is used to control the EEH functionality globally.
154 * Currently, following options are support according to PAPR:
155 * Enable EEH, Disable EEH, Enable MMIO and Enable DMA
156 */
157static int powernv_eeh_set_option(struct eeh_pe *pe, int option)
158{
159 struct pci_controller *hose = pe->phb;
160 struct pnv_phb *phb = hose->private_data;
161 int ret = -EEXIST;
162
163 /*
164 * What we need do is pass it down for hardware
165 * implementation to handle it.
166 */
167 if (phb->eeh_ops && phb->eeh_ops->set_option)
168 ret = phb->eeh_ops->set_option(pe, option);
169
170 return ret;
171}
172
173/**
174 * powernv_eeh_get_pe_addr - Retrieve PE address
175 * @pe: EEH PE
176 *
177 * Retrieve the PE address according to the given tranditional
178 * PCI BDF (Bus/Device/Function) address.
179 */
180static int powernv_eeh_get_pe_addr(struct eeh_pe *pe)
181{
182 return pe->addr;
183}
184
185/**
186 * powernv_eeh_get_state - Retrieve PE state
187 * @pe: EEH PE
188 * @delay: delay while PE state is temporarily unavailable
189 *
190 * Retrieve the state of the specified PE. For IODA-compitable
191 * platform, it should be retrieved from IODA table. Therefore,
192 * we prefer passing down to hardware implementation to handle
193 * it.
194 */
195static int powernv_eeh_get_state(struct eeh_pe *pe, int *delay)
196{
197 struct pci_controller *hose = pe->phb;
198 struct pnv_phb *phb = hose->private_data;
199 int ret = EEH_STATE_NOT_SUPPORT;
200
201 if (phb->eeh_ops && phb->eeh_ops->get_state) {
202 ret = phb->eeh_ops->get_state(pe);
203
204 /*
205 * If the PE state is temporarily unavailable,
206 * to inform the EEH core delay for default
207 * period (1 second)
208 */
209 if (delay) {
210 *delay = 0;
211 if (ret & EEH_STATE_UNAVAILABLE)
212 *delay = 1000;
213 }
214 }
215
216 return ret;
217}
218
219/**
220 * powernv_eeh_reset - Reset the specified PE
221 * @pe: EEH PE
222 * @option: reset option
223 *
224 * Reset the specified PE
225 */
226static int powernv_eeh_reset(struct eeh_pe *pe, int option)
227{
228 struct pci_controller *hose = pe->phb;
229 struct pnv_phb *phb = hose->private_data;
230 int ret = -EEXIST;
231
232 if (phb->eeh_ops && phb->eeh_ops->reset)
233 ret = phb->eeh_ops->reset(pe, option);
234
235 return ret;
236}
237
238/**
239 * powernv_eeh_wait_state - Wait for PE state
240 * @pe: EEH PE
241 * @max_wait: maximal period in microsecond
242 *
243 * Wait for the state of associated PE. It might take some time
244 * to retrieve the PE's state.
245 */
246static int powernv_eeh_wait_state(struct eeh_pe *pe, int max_wait)
247{
248 int ret;
249 int mwait;
250
251 while (1) {
252 ret = powernv_eeh_get_state(pe, &mwait);
253
254 /*
255 * If the PE's state is temporarily unavailable,
256 * we have to wait for the specified time. Otherwise,
257 * the PE's state will be returned immediately.
258 */
259 if (ret != EEH_STATE_UNAVAILABLE)
260 return ret;
261
262 max_wait -= mwait;
263 if (max_wait <= 0) {
264 pr_warning("%s: Timeout getting PE#%x's state (%d)\n",
265 __func__, pe->addr, max_wait);
266 return EEH_STATE_NOT_SUPPORT;
267 }
268
269 msleep(mwait);
270 }
271
272 return EEH_STATE_NOT_SUPPORT;
273}
274
275/**
276 * powernv_eeh_get_log - Retrieve error log
277 * @pe: EEH PE
278 * @severity: temporary or permanent error log
279 * @drv_log: driver log to be combined with retrieved error log
280 * @len: length of driver log
281 *
282 * Retrieve the temporary or permanent error from the PE.
283 */
284static int powernv_eeh_get_log(struct eeh_pe *pe, int severity,
285 char *drv_log, unsigned long len)
286{
287 struct pci_controller *hose = pe->phb;
288 struct pnv_phb *phb = hose->private_data;
289 int ret = -EEXIST;
290
291 if (phb->eeh_ops && phb->eeh_ops->get_log)
292 ret = phb->eeh_ops->get_log(pe, severity, drv_log, len);
293
294 return ret;
295}
296
297/**
298 * powernv_eeh_configure_bridge - Configure PCI bridges in the indicated PE
299 * @pe: EEH PE
300 *
301 * The function will be called to reconfigure the bridges included
302 * in the specified PE so that the mulfunctional PE would be recovered
303 * again.
304 */
305static int powernv_eeh_configure_bridge(struct eeh_pe *pe)
306{
307 struct pci_controller *hose = pe->phb;
308 struct pnv_phb *phb = hose->private_data;
309 int ret = 0;
310
311 if (phb->eeh_ops && phb->eeh_ops->configure_bridge)
312 ret = phb->eeh_ops->configure_bridge(pe);
313
314 return ret;
315}
316
317/**
318 * powernv_eeh_next_error - Retrieve next EEH error to handle
319 * @pe: Affected PE
320 *
321 * Using OPAL API, to retrieve next EEH error for EEH core to handle
322 */
323static int powernv_eeh_next_error(struct eeh_pe **pe)
324{
325 struct pci_controller *hose;
326 struct pnv_phb *phb = NULL;
327
328 list_for_each_entry(hose, &hose_list, list_node) {
329 phb = hose->private_data;
330 break;
331 }
332
333 if (phb && phb->eeh_ops->next_error)
334 return phb->eeh_ops->next_error(pe);
335
336 return -EEXIST;
337}
338
339static struct eeh_ops powernv_eeh_ops = {
340 .name = "powernv",
341 .init = powernv_eeh_init,
342 .post_init = powernv_eeh_post_init,
343 .of_probe = NULL,
344 .dev_probe = powernv_eeh_dev_probe,
345 .set_option = powernv_eeh_set_option,
346 .get_pe_addr = powernv_eeh_get_pe_addr,
347 .get_state = powernv_eeh_get_state,
348 .reset = powernv_eeh_reset,
349 .wait_state = powernv_eeh_wait_state,
350 .get_log = powernv_eeh_get_log,
351 .configure_bridge = powernv_eeh_configure_bridge,
352 .read_config = pnv_pci_cfg_read,
353 .write_config = pnv_pci_cfg_write,
354 .next_error = powernv_eeh_next_error
355};
356
357/**
358 * eeh_powernv_init - Register platform dependent EEH operations
359 *
360 * EEH initialization on powernv platform. This function should be
361 * called before any EEH related functions.
362 */
363static int __init eeh_powernv_init(void)
364{
365 int ret = -EINVAL;
366
367 if (!machine_is(powernv))
368 return ret;
369
370 ret = eeh_ops_register(&powernv_eeh_ops);
371 if (!ret)
372 pr_info("EEH: PowerNV platform initialized\n");
373 else
374 pr_info("EEH: Failed to initialize PowerNV platform (%d)\n", ret);
375
376 return ret;
377}
378
379early_initcall(eeh_powernv_init);
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 6fabe92eafb6..e88863ffb135 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -107,4 +107,7 @@ OPAL_CALL(opal_pci_mask_pe_error, OPAL_PCI_MASK_PE_ERROR);
107OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS); 107OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS);
108OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS); 108OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS);
109OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED); 109OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED);
110OPAL_CALL(opal_pci_next_error, OPAL_PCI_NEXT_ERROR);
111OPAL_CALL(opal_pci_poll, OPAL_PCI_POLL);
110OPAL_CALL(opal_pci_msi_eoi, OPAL_PCI_MSI_EOI); 112OPAL_CALL(opal_pci_msi_eoi, OPAL_PCI_MSI_EOI);
113OPAL_CALL(opal_pci_get_phb_diag_data2, OPAL_PCI_GET_PHB_DIAG_DATA2);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 628c564ceadb..106301fd2fa5 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -15,6 +15,7 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_platform.h> 16#include <linux/of_platform.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/notifier.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <asm/opal.h> 20#include <asm/opal.h>
20#include <asm/firmware.h> 21#include <asm/firmware.h>
@@ -31,6 +32,10 @@ static DEFINE_SPINLOCK(opal_write_lock);
31extern u64 opal_mc_secondary_handler[]; 32extern u64 opal_mc_secondary_handler[];
32static unsigned int *opal_irqs; 33static unsigned int *opal_irqs;
33static unsigned int opal_irq_count; 34static unsigned int opal_irq_count;
35static ATOMIC_NOTIFIER_HEAD(opal_notifier_head);
36static DEFINE_SPINLOCK(opal_notifier_lock);
37static uint64_t last_notified_mask = 0x0ul;
38static atomic_t opal_notifier_hold = ATOMIC_INIT(0);
34 39
35int __init early_init_dt_scan_opal(unsigned long node, 40int __init early_init_dt_scan_opal(unsigned long node,
36 const char *uname, int depth, void *data) 41 const char *uname, int depth, void *data)
@@ -95,6 +100,68 @@ static int __init opal_register_exception_handlers(void)
95 100
96early_initcall(opal_register_exception_handlers); 101early_initcall(opal_register_exception_handlers);
97 102
103int opal_notifier_register(struct notifier_block *nb)
104{
105 if (!nb) {
106 pr_warning("%s: Invalid argument (%p)\n",
107 __func__, nb);
108 return -EINVAL;
109 }
110
111 atomic_notifier_chain_register(&opal_notifier_head, nb);
112 return 0;
113}
114
115static void opal_do_notifier(uint64_t events)
116{
117 unsigned long flags;
118 uint64_t changed_mask;
119
120 if (atomic_read(&opal_notifier_hold))
121 return;
122
123 spin_lock_irqsave(&opal_notifier_lock, flags);
124 changed_mask = last_notified_mask ^ events;
125 last_notified_mask = events;
126 spin_unlock_irqrestore(&opal_notifier_lock, flags);
127
128 /*
129 * We feed with the event bits and changed bits for
130 * enough information to the callback.
131 */
132 atomic_notifier_call_chain(&opal_notifier_head,
133 events, (void *)changed_mask);
134}
135
136void opal_notifier_update_evt(uint64_t evt_mask,
137 uint64_t evt_val)
138{
139 unsigned long flags;
140
141 spin_lock_irqsave(&opal_notifier_lock, flags);
142 last_notified_mask &= ~evt_mask;
143 last_notified_mask |= evt_val;
144 spin_unlock_irqrestore(&opal_notifier_lock, flags);
145}
146
147void opal_notifier_enable(void)
148{
149 int64_t rc;
150 uint64_t evt = 0;
151
152 atomic_set(&opal_notifier_hold, 0);
153
154 /* Process pending events */
155 rc = opal_poll_events(&evt);
156 if (rc == OPAL_SUCCESS && evt)
157 opal_do_notifier(evt);
158}
159
160void opal_notifier_disable(void)
161{
162 atomic_set(&opal_notifier_hold, 1);
163}
164
98int opal_get_chars(uint32_t vtermno, char *buf, int count) 165int opal_get_chars(uint32_t vtermno, char *buf, int count)
99{ 166{
100 s64 len, rc; 167 s64 len, rc;
@@ -297,7 +364,7 @@ static irqreturn_t opal_interrupt(int irq, void *data)
297 364
298 opal_handle_interrupt(virq_to_hw(irq), &events); 365 opal_handle_interrupt(virq_to_hw(irq), &events);
299 366
300 /* XXX TODO: Do something with the events */ 367 opal_do_notifier(events);
301 368
302 return IRQ_HANDLED; 369 return IRQ_HANDLED;
303} 370}
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 9c9d15e4cdf2..49b57b9f835d 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/debugfs.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/string.h> 18#include <linux/string.h>
18#include <linux/init.h> 19#include <linux/init.h>
@@ -32,6 +33,7 @@
32#include <asm/iommu.h> 33#include <asm/iommu.h>
33#include <asm/tce.h> 34#include <asm/tce.h>
34#include <asm/xics.h> 35#include <asm/xics.h>
36#include <asm/debug.h>
35 37
36#include "powernv.h" 38#include "powernv.h"
37#include "pci.h" 39#include "pci.h"
@@ -441,6 +443,17 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
441 set_iommu_table_base(&pdev->dev, &pe->tce32_table); 443 set_iommu_table_base(&pdev->dev, &pe->tce32_table);
442} 444}
443 445
446static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, struct pci_bus *bus)
447{
448 struct pci_dev *dev;
449
450 list_for_each_entry(dev, &bus->devices, bus_list) {
451 set_iommu_table_base(&dev->dev, &pe->tce32_table);
452 if (dev->subordinate)
453 pnv_ioda_setup_bus_dma(pe, dev->subordinate);
454 }
455}
456
444static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl, 457static void pnv_pci_ioda1_tce_invalidate(struct iommu_table *tbl,
445 u64 *startp, u64 *endp) 458 u64 *startp, u64 *endp)
446{ 459{
@@ -595,6 +608,12 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb,
595 TCE_PCI_SWINV_PAIR; 608 TCE_PCI_SWINV_PAIR;
596 } 609 }
597 iommu_init_table(tbl, phb->hose->node); 610 iommu_init_table(tbl, phb->hose->node);
611 iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
612
613 if (pe->pdev)
614 set_iommu_table_base(&pe->pdev->dev, tbl);
615 else
616 pnv_ioda_setup_bus_dma(pe, pe->pbus);
598 617
599 return; 618 return;
600 fail: 619 fail:
@@ -667,6 +686,11 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
667 } 686 }
668 iommu_init_table(tbl, phb->hose->node); 687 iommu_init_table(tbl, phb->hose->node);
669 688
689 if (pe->pdev)
690 set_iommu_table_base(&pe->pdev->dev, tbl);
691 else
692 pnv_ioda_setup_bus_dma(pe, pe->pbus);
693
670 return; 694 return;
671fail: 695fail:
672 if (pe->tce32_seg >= 0) 696 if (pe->tce32_seg >= 0)
@@ -968,11 +992,38 @@ static void pnv_pci_ioda_setup_DMA(void)
968 } 992 }
969} 993}
970 994
995static void pnv_pci_ioda_create_dbgfs(void)
996{
997#ifdef CONFIG_DEBUG_FS
998 struct pci_controller *hose, *tmp;
999 struct pnv_phb *phb;
1000 char name[16];
1001
1002 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
1003 phb = hose->private_data;
1004
1005 sprintf(name, "PCI%04x", hose->global_number);
1006 phb->dbgfs = debugfs_create_dir(name, powerpc_debugfs_root);
1007 if (!phb->dbgfs)
1008 pr_warning("%s: Error on creating debugfs on PHB#%x\n",
1009 __func__, hose->global_number);
1010 }
1011#endif /* CONFIG_DEBUG_FS */
1012}
1013
971static void pnv_pci_ioda_fixup(void) 1014static void pnv_pci_ioda_fixup(void)
972{ 1015{
973 pnv_pci_ioda_setup_PEs(); 1016 pnv_pci_ioda_setup_PEs();
974 pnv_pci_ioda_setup_seg(); 1017 pnv_pci_ioda_setup_seg();
975 pnv_pci_ioda_setup_DMA(); 1018 pnv_pci_ioda_setup_DMA();
1019
1020 pnv_pci_ioda_create_dbgfs();
1021
1022#ifdef CONFIG_EEH
1023 eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
1024 eeh_addr_cache_build();
1025 eeh_init();
1026#endif
976} 1027}
977 1028
978/* 1029/*
@@ -1049,7 +1100,8 @@ static void pnv_pci_ioda_shutdown(struct pnv_phb *phb)
1049 OPAL_ASSERT_RESET); 1100 OPAL_ASSERT_RESET);
1050} 1101}
1051 1102
1052void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type) 1103void __init pnv_pci_init_ioda_phb(struct device_node *np,
1104 u64 hub_id, int ioda_type)
1053{ 1105{
1054 struct pci_controller *hose; 1106 struct pci_controller *hose;
1055 static int primary = 1; 1107 static int primary = 1;
@@ -1087,6 +1139,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
1087 hose->first_busno = 0; 1139 hose->first_busno = 0;
1088 hose->last_busno = 0xff; 1140 hose->last_busno = 0xff;
1089 hose->private_data = phb; 1141 hose->private_data = phb;
1142 phb->hub_id = hub_id;
1090 phb->opal_id = phb_id; 1143 phb->opal_id = phb_id;
1091 phb->type = ioda_type; 1144 phb->type = ioda_type;
1092 1145
@@ -1172,6 +1225,9 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
1172 phb->ioda.io_size, phb->ioda.io_segsize); 1225 phb->ioda.io_size, phb->ioda.io_segsize);
1173 1226
1174 phb->hose->ops = &pnv_pci_ops; 1227 phb->hose->ops = &pnv_pci_ops;
1228#ifdef CONFIG_EEH
1229 phb->eeh_ops = &ioda_eeh_ops;
1230#endif
1175 1231
1176 /* Setup RID -> PE mapping function */ 1232 /* Setup RID -> PE mapping function */
1177 phb->bdfn_to_pe = pnv_ioda_bdfn_to_pe; 1233 phb->bdfn_to_pe = pnv_ioda_bdfn_to_pe;
@@ -1212,7 +1268,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np, int ioda_type)
1212 1268
1213void pnv_pci_init_ioda2_phb(struct device_node *np) 1269void pnv_pci_init_ioda2_phb(struct device_node *np)
1214{ 1270{
1215 pnv_pci_init_ioda_phb(np, PNV_PHB_IODA2); 1271 pnv_pci_init_ioda_phb(np, 0, PNV_PHB_IODA2);
1216} 1272}
1217 1273
1218void __init pnv_pci_init_ioda_hub(struct device_node *np) 1274void __init pnv_pci_init_ioda_hub(struct device_node *np)
@@ -1235,6 +1291,6 @@ void __init pnv_pci_init_ioda_hub(struct device_node *np)
1235 for_each_child_of_node(np, phbn) { 1291 for_each_child_of_node(np, phbn) {
1236 /* Look for IODA1 PHBs */ 1292 /* Look for IODA1 PHBs */
1237 if (of_device_is_compatible(phbn, "ibm,ioda-phb")) 1293 if (of_device_is_compatible(phbn, "ibm,ioda-phb"))
1238 pnv_pci_init_ioda_phb(phbn, PNV_PHB_IODA1); 1294 pnv_pci_init_ioda_phb(phbn, hub_id, PNV_PHB_IODA1);
1239 } 1295 }
1240} 1296}
diff --git a/arch/powerpc/platforms/powernv/pci-p5ioc2.c b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
index 92b37a0186c9..b68db6325c1b 100644
--- a/arch/powerpc/platforms/powernv/pci-p5ioc2.c
+++ b/arch/powerpc/platforms/powernv/pci-p5ioc2.c
@@ -86,13 +86,16 @@ static void pnv_pci_init_p5ioc2_msis(struct pnv_phb *phb) { }
86static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb, 86static void pnv_pci_p5ioc2_dma_dev_setup(struct pnv_phb *phb,
87 struct pci_dev *pdev) 87 struct pci_dev *pdev)
88{ 88{
89 if (phb->p5ioc2.iommu_table.it_map == NULL) 89 if (phb->p5ioc2.iommu_table.it_map == NULL) {
90 iommu_init_table(&phb->p5ioc2.iommu_table, phb->hose->node); 90 iommu_init_table(&phb->p5ioc2.iommu_table, phb->hose->node);
91 iommu_register_group(&phb->p5ioc2.iommu_table,
92 pci_domain_nr(phb->hose->bus), phb->opal_id);
93 }
91 94
92 set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table); 95 set_iommu_table_base(&pdev->dev, &phb->p5ioc2.iommu_table);
93} 96}
94 97
95static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, 98static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np, u64 hub_id,
96 void *tce_mem, u64 tce_size) 99 void *tce_mem, u64 tce_size)
97{ 100{
98 struct pnv_phb *phb; 101 struct pnv_phb *phb;
@@ -133,6 +136,7 @@ static void __init pnv_pci_init_p5ioc2_phb(struct device_node *np,
133 phb->hose->first_busno = 0; 136 phb->hose->first_busno = 0;
134 phb->hose->last_busno = 0xff; 137 phb->hose->last_busno = 0xff;
135 phb->hose->private_data = phb; 138 phb->hose->private_data = phb;
139 phb->hub_id = hub_id;
136 phb->opal_id = phb_id; 140 phb->opal_id = phb_id;
137 phb->type = PNV_PHB_P5IOC2; 141 phb->type = PNV_PHB_P5IOC2;
138 phb->model = PNV_PHB_MODEL_P5IOC2; 142 phb->model = PNV_PHB_MODEL_P5IOC2;
@@ -226,7 +230,8 @@ void __init pnv_pci_init_p5ioc2_hub(struct device_node *np)
226 for_each_child_of_node(np, phbn) { 230 for_each_child_of_node(np, phbn) {
227 if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") || 231 if (of_device_is_compatible(phbn, "ibm,p5ioc2-pcix") ||
228 of_device_is_compatible(phbn, "ibm,p5ioc2-pciex")) { 232 of_device_is_compatible(phbn, "ibm,p5ioc2-pciex")) {
229 pnv_pci_init_p5ioc2_phb(phbn, tce_mem, tce_per_phb); 233 pnv_pci_init_p5ioc2_phb(phbn, hub_id,
234 tce_mem, tce_per_phb);
230 tce_mem += tce_per_phb; 235 tce_mem += tce_per_phb;
231 } 236 }
232 } 237 }
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 277343cc6a3d..a28d3b5e6393 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -20,6 +20,7 @@
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/msi.h> 22#include <linux/msi.h>
23#include <linux/iommu.h>
23 24
24#include <asm/sections.h> 25#include <asm/sections.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -32,6 +33,8 @@
32#include <asm/iommu.h> 33#include <asm/iommu.h>
33#include <asm/tce.h> 34#include <asm/tce.h>
34#include <asm/firmware.h> 35#include <asm/firmware.h>
36#include <asm/eeh_event.h>
37#include <asm/eeh.h>
35 38
36#include "powernv.h" 39#include "powernv.h"
37#include "pci.h" 40#include "pci.h"
@@ -202,7 +205,8 @@ static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)
202 205
203 spin_lock_irqsave(&phb->lock, flags); 206 spin_lock_irqsave(&phb->lock, flags);
204 207
205 rc = opal_pci_get_phb_diag_data(phb->opal_id, phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE); 208 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
209 PNV_PCI_DIAG_BUF_SIZE);
206 has_diag = (rc == OPAL_SUCCESS); 210 has_diag = (rc == OPAL_SUCCESS);
207 211
208 rc = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no, 212 rc = opal_pci_eeh_freeze_clear(phb->opal_id, pe_no,
@@ -227,43 +231,50 @@ static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)
227 spin_unlock_irqrestore(&phb->lock, flags); 231 spin_unlock_irqrestore(&phb->lock, flags);
228} 232}
229 233
230static void pnv_pci_config_check_eeh(struct pnv_phb *phb, struct pci_bus *bus, 234static void pnv_pci_config_check_eeh(struct pnv_phb *phb,
231 u32 bdfn) 235 struct device_node *dn)
232{ 236{
233 s64 rc; 237 s64 rc;
234 u8 fstate; 238 u8 fstate;
235 u16 pcierr; 239 u16 pcierr;
236 u32 pe_no; 240 u32 pe_no;
237 241
238 /* Get PE# if we support IODA */ 242 /*
239 pe_no = phb->bdfn_to_pe ? phb->bdfn_to_pe(phb, bus, bdfn & 0xff) : 0; 243 * Get the PE#. During the PCI probe stage, we might not
244 * setup that yet. So all ER errors should be mapped to
245 * PE#0
246 */
247 pe_no = PCI_DN(dn)->pe_number;
248 if (pe_no == IODA_INVALID_PE)
249 pe_no = 0;
240 250
241 /* Read freeze status */ 251 /* Read freeze status */
242 rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr, 252 rc = opal_pci_eeh_freeze_status(phb->opal_id, pe_no, &fstate, &pcierr,
243 NULL); 253 NULL);
244 if (rc) { 254 if (rc) {
245 pr_warning("PCI %d: Failed to read EEH status for PE#%d," 255 pr_warning("%s: Can't read EEH status (PE#%d) for "
246 " err %lld\n", phb->hose->global_number, pe_no, rc); 256 "%s, err %lld\n",
257 __func__, pe_no, dn->full_name, rc);
247 return; 258 return;
248 } 259 }
249 cfg_dbg(" -> EEH check, bdfn=%04x PE%d fstate=%x\n", 260 cfg_dbg(" -> EEH check, bdfn=%04x PE#%d fstate=%x\n",
250 bdfn, pe_no, fstate); 261 (PCI_DN(dn)->busno << 8) | (PCI_DN(dn)->devfn),
262 pe_no, fstate);
251 if (fstate != 0) 263 if (fstate != 0)
252 pnv_pci_handle_eeh_config(phb, pe_no); 264 pnv_pci_handle_eeh_config(phb, pe_no);
253} 265}
254 266
255static int pnv_pci_read_config(struct pci_bus *bus, 267int pnv_pci_cfg_read(struct device_node *dn,
256 unsigned int devfn, 268 int where, int size, u32 *val)
257 int where, int size, u32 *val)
258{ 269{
259 struct pci_controller *hose = pci_bus_to_host(bus); 270 struct pci_dn *pdn = PCI_DN(dn);
260 struct pnv_phb *phb = hose->private_data; 271 struct pnv_phb *phb = pdn->phb->private_data;
261 u32 bdfn = (((uint64_t)bus->number) << 8) | devfn; 272 u32 bdfn = (pdn->busno << 8) | pdn->devfn;
273#ifdef CONFIG_EEH
274 struct eeh_pe *phb_pe = NULL;
275#endif
262 s64 rc; 276 s64 rc;
263 277
264 if (hose == NULL)
265 return PCIBIOS_DEVICE_NOT_FOUND;
266
267 switch (size) { 278 switch (size) {
268 case 1: { 279 case 1: {
269 u8 v8; 280 u8 v8;
@@ -287,28 +298,43 @@ static int pnv_pci_read_config(struct pci_bus *bus,
287 default: 298 default:
288 return PCIBIOS_FUNC_NOT_SUPPORTED; 299 return PCIBIOS_FUNC_NOT_SUPPORTED;
289 } 300 }
290 cfg_dbg("pnv_pci_read_config bus: %x devfn: %x +%x/%x -> %08x\n", 301 cfg_dbg("%s: bus: %x devfn: %x +%x/%x -> %08x\n",
291 bus->number, devfn, where, size, *val); 302 __func__, pdn->busno, pdn->devfn, where, size, *val);
292 303
293 /* Check if the PHB got frozen due to an error (no response) */ 304 /*
294 pnv_pci_config_check_eeh(phb, bus, bdfn); 305 * Check if the specified PE has been put into frozen
306 * state. On the other hand, we needn't do that while
307 * the PHB has been put into frozen state because of
308 * PHB-fatal errors.
309 */
310#ifdef CONFIG_EEH
311 phb_pe = eeh_phb_pe_get(pdn->phb);
312 if (phb_pe && (phb_pe->state & EEH_PE_ISOLATED))
313 return PCIBIOS_SUCCESSFUL;
314
315 if (phb->eeh_state & PNV_EEH_STATE_ENABLED) {
316 if (*val == EEH_IO_ERROR_VALUE(size) &&
317 eeh_dev_check_failure(of_node_to_eeh_dev(dn)))
318 return PCIBIOS_DEVICE_NOT_FOUND;
319 } else {
320 pnv_pci_config_check_eeh(phb, dn);
321 }
322#else
323 pnv_pci_config_check_eeh(phb, dn);
324#endif
295 325
296 return PCIBIOS_SUCCESSFUL; 326 return PCIBIOS_SUCCESSFUL;
297} 327}
298 328
299static int pnv_pci_write_config(struct pci_bus *bus, 329int pnv_pci_cfg_write(struct device_node *dn,
300 unsigned int devfn, 330 int where, int size, u32 val)
301 int where, int size, u32 val)
302{ 331{
303 struct pci_controller *hose = pci_bus_to_host(bus); 332 struct pci_dn *pdn = PCI_DN(dn);
304 struct pnv_phb *phb = hose->private_data; 333 struct pnv_phb *phb = pdn->phb->private_data;
305 u32 bdfn = (((uint64_t)bus->number) << 8) | devfn; 334 u32 bdfn = (pdn->busno << 8) | pdn->devfn;
306
307 if (hose == NULL)
308 return PCIBIOS_DEVICE_NOT_FOUND;
309 335
310 cfg_dbg("pnv_pci_write_config bus: %x devfn: %x +%x/%x -> %08x\n", 336 cfg_dbg("%s: bus: %x devfn: %x +%x/%x -> %08x\n",
311 bus->number, devfn, where, size, val); 337 pdn->busno, pdn->devfn, where, size, val);
312 switch (size) { 338 switch (size) {
313 case 1: 339 case 1:
314 opal_pci_config_write_byte(phb->opal_id, bdfn, where, val); 340 opal_pci_config_write_byte(phb->opal_id, bdfn, where, val);
@@ -322,14 +348,54 @@ static int pnv_pci_write_config(struct pci_bus *bus,
322 default: 348 default:
323 return PCIBIOS_FUNC_NOT_SUPPORTED; 349 return PCIBIOS_FUNC_NOT_SUPPORTED;
324 } 350 }
351
325 /* Check if the PHB got frozen due to an error (no response) */ 352 /* Check if the PHB got frozen due to an error (no response) */
326 pnv_pci_config_check_eeh(phb, bus, bdfn); 353#ifdef CONFIG_EEH
354 if (!(phb->eeh_state & PNV_EEH_STATE_ENABLED))
355 pnv_pci_config_check_eeh(phb, dn);
356#else
357 pnv_pci_config_check_eeh(phb, dn);
358#endif
327 359
328 return PCIBIOS_SUCCESSFUL; 360 return PCIBIOS_SUCCESSFUL;
329} 361}
330 362
363static int pnv_pci_read_config(struct pci_bus *bus,
364 unsigned int devfn,
365 int where, int size, u32 *val)
366{
367 struct device_node *dn, *busdn = pci_bus_to_OF_node(bus);
368 struct pci_dn *pdn;
369
370 for (dn = busdn->child; dn; dn = dn->sibling) {
371 pdn = PCI_DN(dn);
372 if (pdn && pdn->devfn == devfn)
373 return pnv_pci_cfg_read(dn, where, size, val);
374 }
375
376 *val = 0xFFFFFFFF;
377 return PCIBIOS_DEVICE_NOT_FOUND;
378
379}
380
381static int pnv_pci_write_config(struct pci_bus *bus,
382 unsigned int devfn,
383 int where, int size, u32 val)
384{
385 struct device_node *dn, *busdn = pci_bus_to_OF_node(bus);
386 struct pci_dn *pdn;
387
388 for (dn = busdn->child; dn; dn = dn->sibling) {
389 pdn = PCI_DN(dn);
390 if (pdn && pdn->devfn == devfn)
391 return pnv_pci_cfg_write(dn, where, size, val);
392 }
393
394 return PCIBIOS_DEVICE_NOT_FOUND;
395}
396
331struct pci_ops pnv_pci_ops = { 397struct pci_ops pnv_pci_ops = {
332 .read = pnv_pci_read_config, 398 .read = pnv_pci_read_config,
333 .write = pnv_pci_write_config, 399 .write = pnv_pci_write_config,
334}; 400};
335 401
@@ -412,6 +478,7 @@ static struct iommu_table *pnv_pci_setup_bml_iommu(struct pci_controller *hose)
412 pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)), 478 pnv_pci_setup_iommu_table(tbl, __va(be64_to_cpup(basep)),
413 be32_to_cpup(sizep), 0); 479 be32_to_cpup(sizep), 0);
414 iommu_init_table(tbl, hose->node); 480 iommu_init_table(tbl, hose->node);
481 iommu_register_group(tbl, pci_domain_nr(hose->bus), 0);
415 482
416 /* Deal with SW invalidated TCEs when needed (BML way) */ 483 /* Deal with SW invalidated TCEs when needed (BML way) */
417 swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info", 484 swinvp = of_get_property(hose->dn, "linux,tce-sw-invalidate-info",
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 25d76c4df50b..d633c64e05a1 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -66,15 +66,43 @@ struct pnv_ioda_pe {
66 struct list_head list; 66 struct list_head list;
67}; 67};
68 68
69/* IOC dependent EEH operations */
70#ifdef CONFIG_EEH
71struct pnv_eeh_ops {
72 int (*post_init)(struct pci_controller *hose);
73 int (*set_option)(struct eeh_pe *pe, int option);
74 int (*get_state)(struct eeh_pe *pe);
75 int (*reset)(struct eeh_pe *pe, int option);
76 int (*get_log)(struct eeh_pe *pe, int severity,
77 char *drv_log, unsigned long len);
78 int (*configure_bridge)(struct eeh_pe *pe);
79 int (*next_error)(struct eeh_pe **pe);
80};
81
82#define PNV_EEH_STATE_ENABLED (1 << 0) /* EEH enabled */
83#define PNV_EEH_STATE_REMOVED (1 << 1) /* PHB removed */
84
85#endif /* CONFIG_EEH */
86
69struct pnv_phb { 87struct pnv_phb {
70 struct pci_controller *hose; 88 struct pci_controller *hose;
71 enum pnv_phb_type type; 89 enum pnv_phb_type type;
72 enum pnv_phb_model model; 90 enum pnv_phb_model model;
91 u64 hub_id;
73 u64 opal_id; 92 u64 opal_id;
74 void __iomem *regs; 93 void __iomem *regs;
75 int initialized; 94 int initialized;
76 spinlock_t lock; 95 spinlock_t lock;
77 96
97#ifdef CONFIG_EEH
98 struct pnv_eeh_ops *eeh_ops;
99 int eeh_state;
100#endif
101
102#ifdef CONFIG_DEBUG_FS
103 struct dentry *dbgfs;
104#endif
105
78#ifdef CONFIG_PCI_MSI 106#ifdef CONFIG_PCI_MSI
79 unsigned int msi_base; 107 unsigned int msi_base;
80 unsigned int msi32_support; 108 unsigned int msi32_support;
@@ -150,7 +178,14 @@ struct pnv_phb {
150}; 178};
151 179
152extern struct pci_ops pnv_pci_ops; 180extern struct pci_ops pnv_pci_ops;
181#ifdef CONFIG_EEH
182extern struct pnv_eeh_ops ioda_eeh_ops;
183#endif
153 184
185int pnv_pci_cfg_read(struct device_node *dn,
186 int where, int size, u32 *val);
187int pnv_pci_cfg_write(struct device_node *dn,
188 int where, int size, u32 val);
154extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 189extern void pnv_pci_setup_iommu_table(struct iommu_table *tbl,
155 void *tce_mem, u64 tce_size, 190 void *tce_mem, u64 tce_size,
156 u64 dma_offset); 191 u64 dma_offset);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index d4459bfc92f7..84438af96c05 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -93,6 +93,8 @@ static void __noreturn pnv_restart(char *cmd)
93{ 93{
94 long rc = OPAL_BUSY; 94 long rc = OPAL_BUSY;
95 95
96 opal_notifier_disable();
97
96 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 98 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
97 rc = opal_cec_reboot(); 99 rc = opal_cec_reboot();
98 if (rc == OPAL_BUSY_EVENT) 100 if (rc == OPAL_BUSY_EVENT)
@@ -108,6 +110,8 @@ static void __noreturn pnv_power_off(void)
108{ 110{
109 long rc = OPAL_BUSY; 111 long rc = OPAL_BUSY;
110 112
113 opal_notifier_disable();
114
111 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 115 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
112 rc = opal_cec_power_down(0); 116 rc = opal_cec_power_down(0);
113 if (rc == OPAL_BUSY_EVENT) 117 if (rc == OPAL_BUSY_EVENT)
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 88c9459c3e07..89e3857af4e0 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -40,7 +40,7 @@
40#define DBG(fmt...) 40#define DBG(fmt...)
41#endif 41#endif
42 42
43static void __cpuinit pnv_smp_setup_cpu(int cpu) 43static void pnv_smp_setup_cpu(int cpu)
44{ 44{
45 if (cpu != boot_cpuid) 45 if (cpu != boot_cpuid)
46 xics_setup_cpu(); 46 xics_setup_cpu();
@@ -51,7 +51,7 @@ static int pnv_smp_cpu_bootable(unsigned int nr)
51 /* Special case - we inhibit secondary thread startup 51 /* Special case - we inhibit secondary thread startup
52 * during boot if the user requests it. 52 * during boot if the user requests it.
53 */ 53 */
54 if (system_state < SYSTEM_RUNNING && cpu_has_feature(CPU_FTR_SMT)) { 54 if (system_state == SYSTEM_BOOTING && cpu_has_feature(CPU_FTR_SMT)) {
55 if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0) 55 if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0)
56 return 0; 56 return 0;
57 if (smt_enabled_at_boot 57 if (smt_enabled_at_boot
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 177a2f70700c..3e270e3412ae 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -109,7 +109,8 @@ static long ps3_hpte_remove(unsigned long hpte_group)
109} 109}
110 110
111static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, 111static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
112 unsigned long vpn, int psize, int ssize, int local) 112 unsigned long vpn, int psize, int apsize,
113 int ssize, int local)
113{ 114{
114 int result; 115 int result;
115 u64 hpte_v, want_v, hpte_rs; 116 u64 hpte_v, want_v, hpte_rs;
@@ -162,7 +163,7 @@ static void ps3_hpte_updateboltedpp(unsigned long newpp, unsigned long ea,
162} 163}
163 164
164static void ps3_hpte_invalidate(unsigned long slot, unsigned long vpn, 165static void ps3_hpte_invalidate(unsigned long slot, unsigned long vpn,
165 int psize, int ssize, int local) 166 int psize, int apsize, int ssize, int local)
166{ 167{
167 unsigned long flags; 168 unsigned long flags;
168 int result; 169 int result;
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 4459eff7a75a..1bd3399146ed 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -33,11 +33,6 @@ config PPC_SPLPAR
33 processors, that is, which share physical processors between 33 processors, that is, which share physical processors between
34 two or more partitions. 34 two or more partitions.
35 35
36config EEH
37 bool
38 depends on PPC_PSERIES && PCI
39 default y
40
41config PSERIES_MSI 36config PSERIES_MSI
42 bool 37 bool
43 depends on PCI_MSI && EEH 38 depends on PCI_MSI && EEH
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 53866e537a92..8ae010381316 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -6,9 +6,7 @@ obj-y := lpar.o hvCall.o nvram.o reconfig.o \
6 firmware.o power.o dlpar.o mobility.o 6 firmware.o power.o dlpar.o mobility.o
7obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_SCANLOG) += scanlog.o 8obj-$(CONFIG_SCANLOG) += scanlog.o
9obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \ 9obj-$(CONFIG_EEH) += eeh_pseries.o
10 eeh_driver.o eeh_event.o eeh_sysfs.o \
11 eeh_pseries.o
12obj-$(CONFIG_KEXEC) += kexec.o 10obj-$(CONFIG_KEXEC) += kexec.o
13obj-$(CONFIG_PCI) += pci.o pci_dlpar.o 11obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
14obj-$(CONFIG_PSERIES_MSI) += msi.o 12obj-$(CONFIG_PSERIES_MSI) += msi.o
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 19506f935737..b456b157d33d 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -83,7 +83,11 @@ static int pseries_eeh_init(void)
83 ibm_configure_pe = rtas_token("ibm,configure-pe"); 83 ibm_configure_pe = rtas_token("ibm,configure-pe");
84 ibm_configure_bridge = rtas_token("ibm,configure-bridge"); 84 ibm_configure_bridge = rtas_token("ibm,configure-bridge");
85 85
86 /* necessary sanity check */ 86 /*
87 * Necessary sanity check. We needn't check "get-config-addr-info"
88 * and its variant since the old firmware probably support address
89 * of domain/bus/slot/function for EEH RTAS operations.
90 */
87 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) { 91 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) {
88 pr_warning("%s: RTAS service <ibm,set-eeh-option> invalid\n", 92 pr_warning("%s: RTAS service <ibm,set-eeh-option> invalid\n",
89 __func__); 93 __func__);
@@ -102,12 +106,6 @@ static int pseries_eeh_init(void)
102 pr_warning("%s: RTAS service <ibm,slot-error-detail> invalid\n", 106 pr_warning("%s: RTAS service <ibm,slot-error-detail> invalid\n",
103 __func__); 107 __func__);
104 return -EINVAL; 108 return -EINVAL;
105 } else if (ibm_get_config_addr_info2 == RTAS_UNKNOWN_SERVICE &&
106 ibm_get_config_addr_info == RTAS_UNKNOWN_SERVICE) {
107 pr_warning("%s: RTAS service <ibm,get-config-addr-info2> and "
108 "<ibm,get-config-addr-info> invalid\n",
109 __func__);
110 return -EINVAL;
111 } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE && 109 } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
112 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) { 110 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) {
113 pr_warning("%s: RTAS service <ibm,configure-pe> and " 111 pr_warning("%s: RTAS service <ibm,configure-pe> and "
diff --git a/arch/powerpc/platforms/pseries/io_event_irq.c b/arch/powerpc/platforms/pseries/io_event_irq.c
index ef9d9d84c7d5..5ea88d1541f7 100644
--- a/arch/powerpc/platforms/pseries/io_event_irq.c
+++ b/arch/powerpc/platforms/pseries/io_event_irq.c
@@ -115,7 +115,7 @@ static struct pseries_io_event * ioei_find_event(struct rtas_error_log *elog)
115 * by scope or event type alone. For example, Torrent ISR route change 115 * by scope or event type alone. For example, Torrent ISR route change
116 * event is reported with scope 0x00 (Not Applicatable) rather than 116 * event is reported with scope 0x00 (Not Applicatable) rather than
117 * 0x3B (Torrent-hub). It is better to let the clients to identify 117 * 0x3B (Torrent-hub). It is better to let the clients to identify
118 * who owns the the event. 118 * who owns the event.
119 */ 119 */
120 120
121static irqreturn_t ioei_interrupt(int irq, void *dev_id) 121static irqreturn_t ioei_interrupt(int irq, void *dev_id)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 86ae364900d6..23fc1dcf4434 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -614,6 +614,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
614 614
615 iommu_table_setparms(pci->phb, dn, tbl); 615 iommu_table_setparms(pci->phb, dn, tbl);
616 pci->iommu_table = iommu_init_table(tbl, pci->phb->node); 616 pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
617 iommu_register_group(tbl, pci_domain_nr(bus), 0);
617 618
618 /* Divide the rest (1.75GB) among the children */ 619 /* Divide the rest (1.75GB) among the children */
619 pci->phb->dma_window_size = 0x80000000ul; 620 pci->phb->dma_window_size = 0x80000000ul;
@@ -658,6 +659,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
658 ppci->phb->node); 659 ppci->phb->node);
659 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window); 660 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
660 ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node); 661 ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
662 iommu_register_group(tbl, pci_domain_nr(bus), 0);
661 pr_debug(" created table: %p\n", ppci->iommu_table); 663 pr_debug(" created table: %p\n", ppci->iommu_table);
662 } 664 }
663} 665}
@@ -684,6 +686,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
684 phb->node); 686 phb->node);
685 iommu_table_setparms(phb, dn, tbl); 687 iommu_table_setparms(phb, dn, tbl);
686 PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node); 688 PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node);
689 iommu_register_group(tbl, pci_domain_nr(phb->bus), 0);
687 set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table); 690 set_iommu_table_base(&dev->dev, PCI_DN(dn)->iommu_table);
688 return; 691 return;
689 } 692 }
@@ -1184,6 +1187,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
1184 pci->phb->node); 1187 pci->phb->node);
1185 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window); 1188 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
1186 pci->iommu_table = iommu_init_table(tbl, pci->phb->node); 1189 pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
1190 iommu_register_group(tbl, pci_domain_nr(pci->phb->bus), 0);
1187 pr_debug(" created table: %p\n", pci->iommu_table); 1191 pr_debug(" created table: %p\n", pci->iommu_table);
1188 } else { 1192 } else {
1189 pr_debug(" found DMA window, table: %p\n", pci->iommu_table); 1193 pr_debug(" found DMA window, table: %p\n", pci->iommu_table);
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 6d62072a7d5a..02d6e21619bb 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -45,6 +45,13 @@
45#include "plpar_wrappers.h" 45#include "plpar_wrappers.h"
46#include "pseries.h" 46#include "pseries.h"
47 47
48/* Flag bits for H_BULK_REMOVE */
49#define HBR_REQUEST 0x4000000000000000UL
50#define HBR_RESPONSE 0x8000000000000000UL
51#define HBR_END 0xc000000000000000UL
52#define HBR_AVPN 0x0200000000000000UL
53#define HBR_ANDCOND 0x0100000000000000UL
54
48 55
49/* in hvCall.S */ 56/* in hvCall.S */
50EXPORT_SYMBOL(plpar_hcall); 57EXPORT_SYMBOL(plpar_hcall);
@@ -64,6 +71,9 @@ void vpa_init(int cpu)
64 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 71 if (cpu_has_feature(CPU_FTR_ALTIVEC))
65 lppaca_of(cpu).vmxregs_in_use = 1; 72 lppaca_of(cpu).vmxregs_in_use = 1;
66 73
74 if (cpu_has_feature(CPU_FTR_ARCH_207S))
75 lppaca_of(cpu).ebb_regs_in_use = 1;
76
67 addr = __pa(&lppaca_of(cpu)); 77 addr = __pa(&lppaca_of(cpu));
68 ret = register_vpa(hwcpu, addr); 78 ret = register_vpa(hwcpu, addr);
69 79
@@ -240,7 +250,8 @@ static void pSeries_lpar_hptab_clear(void)
240static long pSeries_lpar_hpte_updatepp(unsigned long slot, 250static long pSeries_lpar_hpte_updatepp(unsigned long slot,
241 unsigned long newpp, 251 unsigned long newpp,
242 unsigned long vpn, 252 unsigned long vpn,
243 int psize, int ssize, int local) 253 int psize, int apsize,
254 int ssize, int local)
244{ 255{
245 unsigned long lpar_rc; 256 unsigned long lpar_rc;
246 unsigned long flags = (newpp & 7) | H_AVPN; 257 unsigned long flags = (newpp & 7) | H_AVPN;
@@ -328,7 +339,8 @@ static void pSeries_lpar_hpte_updateboltedpp(unsigned long newpp,
328} 339}
329 340
330static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn, 341static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,
331 int psize, int ssize, int local) 342 int psize, int apsize,
343 int ssize, int local)
332{ 344{
333 unsigned long want_v; 345 unsigned long want_v;
334 unsigned long lpar_rc; 346 unsigned long lpar_rc;
@@ -345,6 +357,113 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn,
345 BUG_ON(lpar_rc != H_SUCCESS); 357 BUG_ON(lpar_rc != H_SUCCESS);
346} 358}
347 359
360/*
361 * Limit iterations holding pSeries_lpar_tlbie_lock to 3. We also need
362 * to make sure that we avoid bouncing the hypervisor tlbie lock.
363 */
364#define PPC64_HUGE_HPTE_BATCH 12
365
366static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot,
367 unsigned long *vpn, int count,
368 int psize, int ssize)
369{
370 unsigned long param[8];
371 int i = 0, pix = 0, rc;
372 unsigned long flags = 0;
373 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE);
374
375 if (lock_tlbie)
376 spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
377
378 for (i = 0; i < count; i++) {
379
380 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
381 pSeries_lpar_hpte_invalidate(slot[i], vpn[i], psize, 0,
382 ssize, 0);
383 } else {
384 param[pix] = HBR_REQUEST | HBR_AVPN | slot[i];
385 param[pix+1] = hpte_encode_avpn(vpn[i], psize, ssize);
386 pix += 2;
387 if (pix == 8) {
388 rc = plpar_hcall9(H_BULK_REMOVE, param,
389 param[0], param[1], param[2],
390 param[3], param[4], param[5],
391 param[6], param[7]);
392 BUG_ON(rc != H_SUCCESS);
393 pix = 0;
394 }
395 }
396 }
397 if (pix) {
398 param[pix] = HBR_END;
399 rc = plpar_hcall9(H_BULK_REMOVE, param, param[0], param[1],
400 param[2], param[3], param[4], param[5],
401 param[6], param[7]);
402 BUG_ON(rc != H_SUCCESS);
403 }
404
405 if (lock_tlbie)
406 spin_unlock_irqrestore(&pSeries_lpar_tlbie_lock, flags);
407}
408
409static void pSeries_lpar_hugepage_invalidate(struct mm_struct *mm,
410 unsigned char *hpte_slot_array,
411 unsigned long addr, int psize)
412{
413 int ssize = 0, i, index = 0;
414 unsigned long s_addr = addr;
415 unsigned int max_hpte_count, valid;
416 unsigned long vpn_array[PPC64_HUGE_HPTE_BATCH];
417 unsigned long slot_array[PPC64_HUGE_HPTE_BATCH];
418 unsigned long shift, hidx, vpn = 0, vsid, hash, slot;
419
420 shift = mmu_psize_defs[psize].shift;
421 max_hpte_count = 1U << (PMD_SHIFT - shift);
422
423 for (i = 0; i < max_hpte_count; i++) {
424 valid = hpte_valid(hpte_slot_array, i);
425 if (!valid)
426 continue;
427 hidx = hpte_hash_index(hpte_slot_array, i);
428
429 /* get the vpn */
430 addr = s_addr + (i * (1ul << shift));
431 if (!is_kernel_addr(addr)) {
432 ssize = user_segment_size(addr);
433 vsid = get_vsid(mm->context.id, addr, ssize);
434 WARN_ON(vsid == 0);
435 } else {
436 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
437 ssize = mmu_kernel_ssize;
438 }
439
440 vpn = hpt_vpn(addr, vsid, ssize);
441 hash = hpt_hash(vpn, shift, ssize);
442 if (hidx & _PTEIDX_SECONDARY)
443 hash = ~hash;
444
445 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
446 slot += hidx & _PTEIDX_GROUP_IX;
447
448 slot_array[index] = slot;
449 vpn_array[index] = vpn;
450 if (index == PPC64_HUGE_HPTE_BATCH - 1) {
451 /*
452 * Now do a bluk invalidate
453 */
454 __pSeries_lpar_hugepage_invalidate(slot_array,
455 vpn_array,
456 PPC64_HUGE_HPTE_BATCH,
457 psize, ssize);
458 index = 0;
459 } else
460 index++;
461 }
462 if (index)
463 __pSeries_lpar_hugepage_invalidate(slot_array, vpn_array,
464 index, psize, ssize);
465}
466
348static void pSeries_lpar_hpte_removebolted(unsigned long ea, 467static void pSeries_lpar_hpte_removebolted(unsigned long ea,
349 int psize, int ssize) 468 int psize, int ssize)
350{ 469{
@@ -356,17 +475,12 @@ static void pSeries_lpar_hpte_removebolted(unsigned long ea,
356 475
357 slot = pSeries_lpar_hpte_find(vpn, psize, ssize); 476 slot = pSeries_lpar_hpte_find(vpn, psize, ssize);
358 BUG_ON(slot == -1); 477 BUG_ON(slot == -1);
359 478 /*
360 pSeries_lpar_hpte_invalidate(slot, vpn, psize, ssize, 0); 479 * lpar doesn't use the passed actual page size
480 */
481 pSeries_lpar_hpte_invalidate(slot, vpn, psize, 0, ssize, 0);
361} 482}
362 483
363/* Flag bits for H_BULK_REMOVE */
364#define HBR_REQUEST 0x4000000000000000UL
365#define HBR_RESPONSE 0x8000000000000000UL
366#define HBR_END 0xc000000000000000UL
367#define HBR_AVPN 0x0200000000000000UL
368#define HBR_ANDCOND 0x0100000000000000UL
369
370/* 484/*
371 * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie 485 * Take a spinlock around flushes to avoid bouncing the hypervisor tlbie
372 * lock. 486 * lock.
@@ -400,8 +514,11 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
400 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 514 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
401 slot += hidx & _PTEIDX_GROUP_IX; 515 slot += hidx & _PTEIDX_GROUP_IX;
402 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) { 516 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
517 /*
518 * lpar doesn't use the passed actual page size
519 */
403 pSeries_lpar_hpte_invalidate(slot, vpn, psize, 520 pSeries_lpar_hpte_invalidate(slot, vpn, psize,
404 ssize, local); 521 0, ssize, local);
405 } else { 522 } else {
406 param[pix] = HBR_REQUEST | HBR_AVPN | slot; 523 param[pix] = HBR_REQUEST | HBR_AVPN | slot;
407 param[pix+1] = hpte_encode_avpn(vpn, psize, 524 param[pix+1] = hpte_encode_avpn(vpn, psize,
@@ -452,6 +569,7 @@ void __init hpte_init_lpar(void)
452 ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted; 569 ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted;
453 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; 570 ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range;
454 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; 571 ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear;
572 ppc_md.hugepage_invalidate = pSeries_lpar_hugepage_invalidate;
455} 573}
456 574
457#ifdef CONFIG_PPC_SMLPAR 575#ifdef CONFIG_PPC_SMLPAR
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 8733a86ad52e..9f8671a44551 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -18,6 +18,7 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/kmsg_dump.h> 20#include <linux/kmsg_dump.h>
21#include <linux/pstore.h>
21#include <linux/ctype.h> 22#include <linux/ctype.h>
22#include <linux/zlib.h> 23#include <linux/zlib.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
@@ -29,6 +30,13 @@
29/* Max bytes to read/write in one go */ 30/* Max bytes to read/write in one go */
30#define NVRW_CNT 0x20 31#define NVRW_CNT 0x20
31 32
33/*
34 * Set oops header version to distingush between old and new format header.
35 * lnx,oops-log partition max size is 4000, header version > 4000 will
36 * help in identifying new header.
37 */
38#define OOPS_HDR_VERSION 5000
39
32static unsigned int nvram_size; 40static unsigned int nvram_size;
33static int nvram_fetch, nvram_store; 41static int nvram_fetch, nvram_store;
34static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */ 42static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */
@@ -45,20 +53,23 @@ struct nvram_os_partition {
45 int min_size; /* minimum acceptable size (0 means req_size) */ 53 int min_size; /* minimum acceptable size (0 means req_size) */
46 long size; /* size of data portion (excluding err_log_info) */ 54 long size; /* size of data portion (excluding err_log_info) */
47 long index; /* offset of data portion of partition */ 55 long index; /* offset of data portion of partition */
56 bool os_partition; /* partition initialized by OS, not FW */
48}; 57};
49 58
50static struct nvram_os_partition rtas_log_partition = { 59static struct nvram_os_partition rtas_log_partition = {
51 .name = "ibm,rtas-log", 60 .name = "ibm,rtas-log",
52 .req_size = 2079, 61 .req_size = 2079,
53 .min_size = 1055, 62 .min_size = 1055,
54 .index = -1 63 .index = -1,
64 .os_partition = true
55}; 65};
56 66
57static struct nvram_os_partition oops_log_partition = { 67static struct nvram_os_partition oops_log_partition = {
58 .name = "lnx,oops-log", 68 .name = "lnx,oops-log",
59 .req_size = 4000, 69 .req_size = 4000,
60 .min_size = 2000, 70 .min_size = 2000,
61 .index = -1 71 .index = -1,
72 .os_partition = true
62}; 73};
63 74
64static const char *pseries_nvram_os_partitions[] = { 75static const char *pseries_nvram_os_partitions[] = {
@@ -67,6 +78,12 @@ static const char *pseries_nvram_os_partitions[] = {
67 NULL 78 NULL
68}; 79};
69 80
81struct oops_log_info {
82 u16 version;
83 u16 report_length;
84 u64 timestamp;
85} __attribute__((packed));
86
70static void oops_to_nvram(struct kmsg_dumper *dumper, 87static void oops_to_nvram(struct kmsg_dumper *dumper,
71 enum kmsg_dump_reason reason); 88 enum kmsg_dump_reason reason);
72 89
@@ -83,28 +100,28 @@ static unsigned long last_unread_rtas_event; /* timestamp */
83 100
84 * big_oops_buf[] holds the uncompressed text we're capturing. 101 * big_oops_buf[] holds the uncompressed text we're capturing.
85 * 102 *
86 * oops_buf[] holds the compressed text, preceded by a prefix. 103 * oops_buf[] holds the compressed text, preceded by a oops header.
87 * The prefix is just a u16 holding the length of the compressed* text. 104 * oops header has u16 holding the version of oops header (to differentiate
88 * (*Or uncompressed, if compression fails.) oops_buf[] gets written 105 * between old and new format header) followed by u16 holding the length of
89 * to NVRAM. 106 * the compressed* text (*Or uncompressed, if compression fails.) and u64
107 * holding the timestamp. oops_buf[] gets written to NVRAM.
90 * 108 *
91 * oops_len points to the prefix. oops_data points to the compressed text. 109 * oops_log_info points to the header. oops_data points to the compressed text.
92 * 110 *
93 * +- oops_buf 111 * +- oops_buf
94 * | +- oops_data 112 * | +- oops_data
95 * v v 113 * v v
96 * +------------+-----------------------------------------------+ 114 * +-----------+-----------+-----------+------------------------+
97 * | length | text | 115 * | version | length | timestamp | text |
98 * | (2 bytes) | (oops_data_sz bytes) | 116 * | (2 bytes) | (2 bytes) | (8 bytes) | (oops_data_sz bytes) |
99 * +------------+-----------------------------------------------+ 117 * +-----------+-----------+-----------+------------------------+
100 * ^ 118 * ^
101 * +- oops_len 119 * +- oops_log_info
102 * 120 *
103 * We preallocate these buffers during init to avoid kmalloc during oops/panic. 121 * We preallocate these buffers during init to avoid kmalloc during oops/panic.
104 */ 122 */
105static size_t big_oops_buf_sz; 123static size_t big_oops_buf_sz;
106static char *big_oops_buf, *oops_buf; 124static char *big_oops_buf, *oops_buf;
107static u16 *oops_len;
108static char *oops_data; 125static char *oops_data;
109static size_t oops_data_sz; 126static size_t oops_data_sz;
110 127
@@ -114,6 +131,30 @@ static size_t oops_data_sz;
114#define MEM_LEVEL 4 131#define MEM_LEVEL 4
115static struct z_stream_s stream; 132static struct z_stream_s stream;
116 133
134#ifdef CONFIG_PSTORE
135static struct nvram_os_partition of_config_partition = {
136 .name = "of-config",
137 .index = -1,
138 .os_partition = false
139};
140
141static struct nvram_os_partition common_partition = {
142 .name = "common",
143 .index = -1,
144 .os_partition = false
145};
146
147static enum pstore_type_id nvram_type_ids[] = {
148 PSTORE_TYPE_DMESG,
149 PSTORE_TYPE_PPC_RTAS,
150 PSTORE_TYPE_PPC_OF,
151 PSTORE_TYPE_PPC_COMMON,
152 -1
153};
154static int read_type;
155static unsigned long last_rtas_event;
156#endif
157
117static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index) 158static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
118{ 159{
119 unsigned int i; 160 unsigned int i;
@@ -275,48 +316,72 @@ int nvram_write_error_log(char * buff, int length,
275{ 316{
276 int rc = nvram_write_os_partition(&rtas_log_partition, buff, length, 317 int rc = nvram_write_os_partition(&rtas_log_partition, buff, length,
277 err_type, error_log_cnt); 318 err_type, error_log_cnt);
278 if (!rc) 319 if (!rc) {
279 last_unread_rtas_event = get_seconds(); 320 last_unread_rtas_event = get_seconds();
321#ifdef CONFIG_PSTORE
322 last_rtas_event = get_seconds();
323#endif
324 }
325
280 return rc; 326 return rc;
281} 327}
282 328
283/* nvram_read_error_log 329/* nvram_read_partition
284 * 330 *
285 * Reads nvram for error log for at most 'length' 331 * Reads nvram partition for at most 'length'
286 */ 332 */
287int nvram_read_error_log(char * buff, int length, 333int nvram_read_partition(struct nvram_os_partition *part, char *buff,
288 unsigned int * err_type, unsigned int * error_log_cnt) 334 int length, unsigned int *err_type,
335 unsigned int *error_log_cnt)
289{ 336{
290 int rc; 337 int rc;
291 loff_t tmp_index; 338 loff_t tmp_index;
292 struct err_log_info info; 339 struct err_log_info info;
293 340
294 if (rtas_log_partition.index == -1) 341 if (part->index == -1)
295 return -1; 342 return -1;
296 343
297 if (length > rtas_log_partition.size) 344 if (length > part->size)
298 length = rtas_log_partition.size; 345 length = part->size;
299 346
300 tmp_index = rtas_log_partition.index; 347 tmp_index = part->index;
301 348
302 rc = ppc_md.nvram_read((char *)&info, sizeof(struct err_log_info), &tmp_index); 349 if (part->os_partition) {
303 if (rc <= 0) { 350 rc = ppc_md.nvram_read((char *)&info,
304 printk(KERN_ERR "nvram_read_error_log: Failed nvram_read (%d)\n", rc); 351 sizeof(struct err_log_info),
305 return rc; 352 &tmp_index);
353 if (rc <= 0) {
354 pr_err("%s: Failed nvram_read (%d)\n", __FUNCTION__,
355 rc);
356 return rc;
357 }
306 } 358 }
307 359
308 rc = ppc_md.nvram_read(buff, length, &tmp_index); 360 rc = ppc_md.nvram_read(buff, length, &tmp_index);
309 if (rc <= 0) { 361 if (rc <= 0) {
310 printk(KERN_ERR "nvram_read_error_log: Failed nvram_read (%d)\n", rc); 362 pr_err("%s: Failed nvram_read (%d)\n", __FUNCTION__, rc);
311 return rc; 363 return rc;
312 } 364 }
313 365
314 *error_log_cnt = info.seq_num; 366 if (part->os_partition) {
315 *err_type = info.error_type; 367 *error_log_cnt = info.seq_num;
368 *err_type = info.error_type;
369 }
316 370
317 return 0; 371 return 0;
318} 372}
319 373
374/* nvram_read_error_log
375 *
376 * Reads nvram for error log for at most 'length'
377 */
378int nvram_read_error_log(char *buff, int length,
379 unsigned int *err_type, unsigned int *error_log_cnt)
380{
381 return nvram_read_partition(&rtas_log_partition, buff, length,
382 err_type, error_log_cnt);
383}
384
320/* This doesn't actually zero anything, but it sets the event_logged 385/* This doesn't actually zero anything, but it sets the event_logged
321 * word to tell that this event is safely in syslog. 386 * word to tell that this event is safely in syslog.
322 */ 387 */
@@ -405,6 +470,349 @@ static int __init pseries_nvram_init_os_partition(struct nvram_os_partition
405 return 0; 470 return 0;
406} 471}
407 472
473/*
474 * Are we using the ibm,rtas-log for oops/panic reports? And if so,
475 * would logging this oops/panic overwrite an RTAS event that rtas_errd
476 * hasn't had a chance to read and process? Return 1 if so, else 0.
477 *
478 * We assume that if rtas_errd hasn't read the RTAS event in
479 * NVRAM_RTAS_READ_TIMEOUT seconds, it's probably not going to.
480 */
481static int clobbering_unread_rtas_event(void)
482{
483 return (oops_log_partition.index == rtas_log_partition.index
484 && last_unread_rtas_event
485 && get_seconds() - last_unread_rtas_event <=
486 NVRAM_RTAS_READ_TIMEOUT);
487}
488
489/* Derived from logfs_compress() */
490static int nvram_compress(const void *in, void *out, size_t inlen,
491 size_t outlen)
492{
493 int err, ret;
494
495 ret = -EIO;
496 err = zlib_deflateInit2(&stream, COMPR_LEVEL, Z_DEFLATED, WINDOW_BITS,
497 MEM_LEVEL, Z_DEFAULT_STRATEGY);
498 if (err != Z_OK)
499 goto error;
500
501 stream.next_in = in;
502 stream.avail_in = inlen;
503 stream.total_in = 0;
504 stream.next_out = out;
505 stream.avail_out = outlen;
506 stream.total_out = 0;
507
508 err = zlib_deflate(&stream, Z_FINISH);
509 if (err != Z_STREAM_END)
510 goto error;
511
512 err = zlib_deflateEnd(&stream);
513 if (err != Z_OK)
514 goto error;
515
516 if (stream.total_out >= stream.total_in)
517 goto error;
518
519 ret = stream.total_out;
520error:
521 return ret;
522}
523
524/* Compress the text from big_oops_buf into oops_buf. */
525static int zip_oops(size_t text_len)
526{
527 struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
528 int zipped_len = nvram_compress(big_oops_buf, oops_data, text_len,
529 oops_data_sz);
530 if (zipped_len < 0) {
531 pr_err("nvram: compression failed; returned %d\n", zipped_len);
532 pr_err("nvram: logging uncompressed oops/panic report\n");
533 return -1;
534 }
535 oops_hdr->version = OOPS_HDR_VERSION;
536 oops_hdr->report_length = (u16) zipped_len;
537 oops_hdr->timestamp = get_seconds();
538 return 0;
539}
540
541#ifdef CONFIG_PSTORE
542/* Derived from logfs_uncompress */
543int nvram_decompress(void *in, void *out, size_t inlen, size_t outlen)
544{
545 int err, ret;
546
547 ret = -EIO;
548 err = zlib_inflateInit(&stream);
549 if (err != Z_OK)
550 goto error;
551
552 stream.next_in = in;
553 stream.avail_in = inlen;
554 stream.total_in = 0;
555 stream.next_out = out;
556 stream.avail_out = outlen;
557 stream.total_out = 0;
558
559 err = zlib_inflate(&stream, Z_FINISH);
560 if (err != Z_STREAM_END)
561 goto error;
562
563 err = zlib_inflateEnd(&stream);
564 if (err != Z_OK)
565 goto error;
566
567 ret = stream.total_out;
568error:
569 return ret;
570}
571
572static int unzip_oops(char *oops_buf, char *big_buf)
573{
574 struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
575 u64 timestamp = oops_hdr->timestamp;
576 char *big_oops_data = NULL;
577 char *oops_data_buf = NULL;
578 size_t big_oops_data_sz;
579 int unzipped_len;
580
581 big_oops_data = big_buf + sizeof(struct oops_log_info);
582 big_oops_data_sz = big_oops_buf_sz - sizeof(struct oops_log_info);
583 oops_data_buf = oops_buf + sizeof(struct oops_log_info);
584
585 unzipped_len = nvram_decompress(oops_data_buf, big_oops_data,
586 oops_hdr->report_length,
587 big_oops_data_sz);
588
589 if (unzipped_len < 0) {
590 pr_err("nvram: decompression failed; returned %d\n",
591 unzipped_len);
592 return -1;
593 }
594 oops_hdr = (struct oops_log_info *)big_buf;
595 oops_hdr->version = OOPS_HDR_VERSION;
596 oops_hdr->report_length = (u16) unzipped_len;
597 oops_hdr->timestamp = timestamp;
598 return 0;
599}
600
601static int nvram_pstore_open(struct pstore_info *psi)
602{
603 /* Reset the iterator to start reading partitions again */
604 read_type = -1;
605 return 0;
606}
607
608/**
609 * nvram_pstore_write - pstore write callback for nvram
610 * @type: Type of message logged
611 * @reason: reason behind dump (oops/panic)
612 * @id: identifier to indicate the write performed
613 * @part: pstore writes data to registered buffer in parts,
614 * part number will indicate the same.
615 * @count: Indicates oops count
616 * @hsize: Size of header added by pstore
617 * @size: number of bytes written to the registered buffer
618 * @psi: registered pstore_info structure
619 *
620 * Called by pstore_dump() when an oops or panic report is logged in the
621 * printk buffer.
622 * Returns 0 on successful write.
623 */
624static int nvram_pstore_write(enum pstore_type_id type,
625 enum kmsg_dump_reason reason,
626 u64 *id, unsigned int part, int count,
627 size_t hsize, size_t size,
628 struct pstore_info *psi)
629{
630 int rc;
631 unsigned int err_type = ERR_TYPE_KERNEL_PANIC;
632 struct oops_log_info *oops_hdr = (struct oops_log_info *) oops_buf;
633
634 /* part 1 has the recent messages from printk buffer */
635 if (part > 1 || type != PSTORE_TYPE_DMESG ||
636 clobbering_unread_rtas_event())
637 return -1;
638
639 oops_hdr->version = OOPS_HDR_VERSION;
640 oops_hdr->report_length = (u16) size;
641 oops_hdr->timestamp = get_seconds();
642
643 if (big_oops_buf) {
644 rc = zip_oops(size);
645 /*
646 * If compression fails copy recent log messages from
647 * big_oops_buf to oops_data.
648 */
649 if (rc != 0) {
650 size_t diff = size - oops_data_sz + hsize;
651
652 if (size > oops_data_sz) {
653 memcpy(oops_data, big_oops_buf, hsize);
654 memcpy(oops_data + hsize, big_oops_buf + diff,
655 oops_data_sz - hsize);
656
657 oops_hdr->report_length = (u16) oops_data_sz;
658 } else
659 memcpy(oops_data, big_oops_buf, size);
660 } else
661 err_type = ERR_TYPE_KERNEL_PANIC_GZ;
662 }
663
664 rc = nvram_write_os_partition(&oops_log_partition, oops_buf,
665 (int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type,
666 count);
667
668 if (rc != 0)
669 return rc;
670
671 *id = part;
672 return 0;
673}
674
675/*
676 * Reads the oops/panic report, rtas, of-config and common partition.
677 * Returns the length of the data we read from each partition.
678 * Returns 0 if we've been called before.
679 */
680static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
681 int *count, struct timespec *time, char **buf,
682 struct pstore_info *psi)
683{
684 struct oops_log_info *oops_hdr;
685 unsigned int err_type, id_no, size = 0;
686 struct nvram_os_partition *part = NULL;
687 char *buff = NULL, *big_buff = NULL;
688 int rc, sig = 0;
689 loff_t p;
690
691read_partition:
692 read_type++;
693
694 switch (nvram_type_ids[read_type]) {
695 case PSTORE_TYPE_DMESG:
696 part = &oops_log_partition;
697 *type = PSTORE_TYPE_DMESG;
698 break;
699 case PSTORE_TYPE_PPC_RTAS:
700 part = &rtas_log_partition;
701 *type = PSTORE_TYPE_PPC_RTAS;
702 time->tv_sec = last_rtas_event;
703 time->tv_nsec = 0;
704 break;
705 case PSTORE_TYPE_PPC_OF:
706 sig = NVRAM_SIG_OF;
707 part = &of_config_partition;
708 *type = PSTORE_TYPE_PPC_OF;
709 *id = PSTORE_TYPE_PPC_OF;
710 time->tv_sec = 0;
711 time->tv_nsec = 0;
712 break;
713 case PSTORE_TYPE_PPC_COMMON:
714 sig = NVRAM_SIG_SYS;
715 part = &common_partition;
716 *type = PSTORE_TYPE_PPC_COMMON;
717 *id = PSTORE_TYPE_PPC_COMMON;
718 time->tv_sec = 0;
719 time->tv_nsec = 0;
720 break;
721 default:
722 return 0;
723 }
724
725 if (!part->os_partition) {
726 p = nvram_find_partition(part->name, sig, &size);
727 if (p <= 0) {
728 pr_err("nvram: Failed to find partition %s, "
729 "err %d\n", part->name, (int)p);
730 return 0;
731 }
732 part->index = p;
733 part->size = size;
734 }
735
736 buff = kmalloc(part->size, GFP_KERNEL);
737
738 if (!buff)
739 return -ENOMEM;
740
741 if (nvram_read_partition(part, buff, part->size, &err_type, &id_no)) {
742 kfree(buff);
743 return 0;
744 }
745
746 *count = 0;
747
748 if (part->os_partition)
749 *id = id_no;
750
751 if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) {
752 oops_hdr = (struct oops_log_info *)buff;
753 *buf = buff + sizeof(*oops_hdr);
754
755 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) {
756 big_buff = kmalloc(big_oops_buf_sz, GFP_KERNEL);
757 if (!big_buff)
758 return -ENOMEM;
759
760 rc = unzip_oops(buff, big_buff);
761
762 if (rc != 0) {
763 kfree(buff);
764 kfree(big_buff);
765 goto read_partition;
766 }
767
768 oops_hdr = (struct oops_log_info *)big_buff;
769 *buf = big_buff + sizeof(*oops_hdr);
770 kfree(buff);
771 }
772
773 time->tv_sec = oops_hdr->timestamp;
774 time->tv_nsec = 0;
775 return oops_hdr->report_length;
776 }
777
778 *buf = buff;
779 return part->size;
780}
781
782static struct pstore_info nvram_pstore_info = {
783 .owner = THIS_MODULE,
784 .name = "nvram",
785 .open = nvram_pstore_open,
786 .read = nvram_pstore_read,
787 .write = nvram_pstore_write,
788};
789
790static int nvram_pstore_init(void)
791{
792 int rc = 0;
793
794 if (big_oops_buf) {
795 nvram_pstore_info.buf = big_oops_buf;
796 nvram_pstore_info.bufsize = big_oops_buf_sz;
797 } else {
798 nvram_pstore_info.buf = oops_data;
799 nvram_pstore_info.bufsize = oops_data_sz;
800 }
801
802 rc = pstore_register(&nvram_pstore_info);
803 if (rc != 0)
804 pr_err("nvram: pstore_register() failed, defaults to "
805 "kmsg_dump; returned %d\n", rc);
806
807 return rc;
808}
809#else
810static int nvram_pstore_init(void)
811{
812 return -1;
813}
814#endif
815
408static void __init nvram_init_oops_partition(int rtas_partition_exists) 816static void __init nvram_init_oops_partition(int rtas_partition_exists)
409{ 817{
410 int rc; 818 int rc;
@@ -425,9 +833,8 @@ static void __init nvram_init_oops_partition(int rtas_partition_exists)
425 oops_log_partition.name); 833 oops_log_partition.name);
426 return; 834 return;
427 } 835 }
428 oops_len = (u16*) oops_buf; 836 oops_data = oops_buf + sizeof(struct oops_log_info);
429 oops_data = oops_buf + sizeof(u16); 837 oops_data_sz = oops_log_partition.size - sizeof(struct oops_log_info);
430 oops_data_sz = oops_log_partition.size - sizeof(u16);
431 838
432 /* 839 /*
433 * Figure compression (preceded by elimination of each line's <n> 840 * Figure compression (preceded by elimination of each line's <n>
@@ -452,6 +859,11 @@ static void __init nvram_init_oops_partition(int rtas_partition_exists)
452 stream.workspace = NULL; 859 stream.workspace = NULL;
453 } 860 }
454 861
862 rc = nvram_pstore_init();
863
864 if (!rc)
865 return;
866
455 rc = kmsg_dump_register(&nvram_kmsg_dumper); 867 rc = kmsg_dump_register(&nvram_kmsg_dumper);
456 if (rc != 0) { 868 if (rc != 0) {
457 pr_err("nvram: kmsg_dump_register() failed; returned %d\n", rc); 869 pr_err("nvram: kmsg_dump_register() failed; returned %d\n", rc);
@@ -501,70 +913,6 @@ int __init pSeries_nvram_init(void)
501 return 0; 913 return 0;
502} 914}
503 915
504/*
505 * Are we using the ibm,rtas-log for oops/panic reports? And if so,
506 * would logging this oops/panic overwrite an RTAS event that rtas_errd
507 * hasn't had a chance to read and process? Return 1 if so, else 0.
508 *
509 * We assume that if rtas_errd hasn't read the RTAS event in
510 * NVRAM_RTAS_READ_TIMEOUT seconds, it's probably not going to.
511 */
512static int clobbering_unread_rtas_event(void)
513{
514 return (oops_log_partition.index == rtas_log_partition.index
515 && last_unread_rtas_event
516 && get_seconds() - last_unread_rtas_event <=
517 NVRAM_RTAS_READ_TIMEOUT);
518}
519
520/* Derived from logfs_compress() */
521static int nvram_compress(const void *in, void *out, size_t inlen,
522 size_t outlen)
523{
524 int err, ret;
525
526 ret = -EIO;
527 err = zlib_deflateInit2(&stream, COMPR_LEVEL, Z_DEFLATED, WINDOW_BITS,
528 MEM_LEVEL, Z_DEFAULT_STRATEGY);
529 if (err != Z_OK)
530 goto error;
531
532 stream.next_in = in;
533 stream.avail_in = inlen;
534 stream.total_in = 0;
535 stream.next_out = out;
536 stream.avail_out = outlen;
537 stream.total_out = 0;
538
539 err = zlib_deflate(&stream, Z_FINISH);
540 if (err != Z_STREAM_END)
541 goto error;
542
543 err = zlib_deflateEnd(&stream);
544 if (err != Z_OK)
545 goto error;
546
547 if (stream.total_out >= stream.total_in)
548 goto error;
549
550 ret = stream.total_out;
551error:
552 return ret;
553}
554
555/* Compress the text from big_oops_buf into oops_buf. */
556static int zip_oops(size_t text_len)
557{
558 int zipped_len = nvram_compress(big_oops_buf, oops_data, text_len,
559 oops_data_sz);
560 if (zipped_len < 0) {
561 pr_err("nvram: compression failed; returned %d\n", zipped_len);
562 pr_err("nvram: logging uncompressed oops/panic report\n");
563 return -1;
564 }
565 *oops_len = (u16) zipped_len;
566 return 0;
567}
568 916
569/* 917/*
570 * This is our kmsg_dump callback, called after an oops or panic report 918 * This is our kmsg_dump callback, called after an oops or panic report
@@ -576,6 +924,7 @@ static int zip_oops(size_t text_len)
576static void oops_to_nvram(struct kmsg_dumper *dumper, 924static void oops_to_nvram(struct kmsg_dumper *dumper,
577 enum kmsg_dump_reason reason) 925 enum kmsg_dump_reason reason)
578{ 926{
927 struct oops_log_info *oops_hdr = (struct oops_log_info *)oops_buf;
579 static unsigned int oops_count = 0; 928 static unsigned int oops_count = 0;
580 static bool panicking = false; 929 static bool panicking = false;
581 static DEFINE_SPINLOCK(lock); 930 static DEFINE_SPINLOCK(lock);
@@ -619,14 +968,17 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
619 } 968 }
620 if (rc != 0) { 969 if (rc != 0) {
621 kmsg_dump_rewind(dumper); 970 kmsg_dump_rewind(dumper);
622 kmsg_dump_get_buffer(dumper, true, 971 kmsg_dump_get_buffer(dumper, false,
623 oops_data, oops_data_sz, &text_len); 972 oops_data, oops_data_sz, &text_len);
624 err_type = ERR_TYPE_KERNEL_PANIC; 973 err_type = ERR_TYPE_KERNEL_PANIC;
625 *oops_len = (u16) text_len; 974 oops_hdr->version = OOPS_HDR_VERSION;
975 oops_hdr->report_length = (u16) text_len;
976 oops_hdr->timestamp = get_seconds();
626 } 977 }
627 978
628 (void) nvram_write_os_partition(&oops_log_partition, oops_buf, 979 (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
629 (int) (sizeof(*oops_len) + *oops_len), err_type, ++oops_count); 980 (int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type,
981 ++oops_count);
630 982
631 spin_unlock_irqrestore(&lock, flags); 983 spin_unlock_irqrestore(&lock, flags);
632} 984}
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index c91b22be9288..efe61374f6ea 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -64,91 +64,6 @@ pcibios_find_pci_bus(struct device_node *dn)
64} 64}
65EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); 65EXPORT_SYMBOL_GPL(pcibios_find_pci_bus);
66 66
67/**
68 * __pcibios_remove_pci_devices - remove all devices under this bus
69 * @bus: the indicated PCI bus
70 * @purge_pe: destroy the PE on removal of PCI devices
71 *
72 * Remove all of the PCI devices under this bus both from the
73 * linux pci device tree, and from the powerpc EEH address cache.
74 * By default, the corresponding PE will be destroied during the
75 * normal PCI hotplug path. For PCI hotplug during EEH recovery,
76 * the corresponding PE won't be destroied and deallocated.
77 */
78void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe)
79{
80 struct pci_dev *dev, *tmp;
81 struct pci_bus *child_bus;
82
83 /* First go down child busses */
84 list_for_each_entry(child_bus, &bus->children, node)
85 __pcibios_remove_pci_devices(child_bus, purge_pe);
86
87 pr_debug("PCI: Removing devices on bus %04x:%02x\n",
88 pci_domain_nr(bus), bus->number);
89 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
90 pr_debug(" * Removing %s...\n", pci_name(dev));
91 eeh_remove_bus_device(dev, purge_pe);
92 pci_stop_and_remove_bus_device(dev);
93 }
94}
95
96/**
97 * pcibios_remove_pci_devices - remove all devices under this bus
98 *
99 * Remove all of the PCI devices under this bus both from the
100 * linux pci device tree, and from the powerpc EEH address cache.
101 */
102void pcibios_remove_pci_devices(struct pci_bus *bus)
103{
104 __pcibios_remove_pci_devices(bus, 1);
105}
106EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices);
107
108/**
109 * pcibios_add_pci_devices - adds new pci devices to bus
110 *
111 * This routine will find and fixup new pci devices under
112 * the indicated bus. This routine presumes that there
113 * might already be some devices under this bridge, so
114 * it carefully tries to add only new devices. (And that
115 * is how this routine differs from other, similar pcibios
116 * routines.)
117 */
118void pcibios_add_pci_devices(struct pci_bus * bus)
119{
120 int slotno, num, mode, pass, max;
121 struct pci_dev *dev;
122 struct device_node *dn = pci_bus_to_OF_node(bus);
123
124 eeh_add_device_tree_early(dn);
125
126 mode = PCI_PROBE_NORMAL;
127 if (ppc_md.pci_probe_mode)
128 mode = ppc_md.pci_probe_mode(bus);
129
130 if (mode == PCI_PROBE_DEVTREE) {
131 /* use ofdt-based probe */
132 of_rescan_bus(dn, bus);
133 } else if (mode == PCI_PROBE_NORMAL) {
134 /* use legacy probe */
135 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
136 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
137 if (!num)
138 return;
139 pcibios_setup_bus_devices(bus);
140 max = bus->busn_res.start;
141 for (pass=0; pass < 2; pass++)
142 list_for_each_entry(dev, &bus->devices, bus_list) {
143 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
144 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
145 max = pci_scan_bridge(bus, dev, max, pass);
146 }
147 }
148 pcibios_finish_adding_to_bus(bus);
149}
150EXPORT_SYMBOL_GPL(pcibios_add_pci_devices);
151
152struct pci_controller *init_phb_dynamic(struct device_node *dn) 67struct pci_controller *init_phb_dynamic(struct device_node *dn)
153{ 68{
154 struct pci_controller *phb; 69 struct pci_controller *phb;
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index c4dfccd3a3d9..7b3cbde8c783 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -83,7 +83,7 @@ static void handle_system_shutdown(char event_modifier)
83 switch (event_modifier) { 83 switch (event_modifier) {
84 case EPOW_SHUTDOWN_NORMAL: 84 case EPOW_SHUTDOWN_NORMAL:
85 pr_emerg("Firmware initiated power off"); 85 pr_emerg("Firmware initiated power off");
86 orderly_poweroff(1); 86 orderly_poweroff(true);
87 break; 87 break;
88 88
89 case EPOW_SHUTDOWN_ON_UPS: 89 case EPOW_SHUTDOWN_ON_UPS:
@@ -95,13 +95,13 @@ static void handle_system_shutdown(char event_modifier)
95 pr_emerg("Loss of system critical functions reported by " 95 pr_emerg("Loss of system critical functions reported by "
96 "firmware"); 96 "firmware");
97 pr_emerg("Check RTAS error log for details"); 97 pr_emerg("Check RTAS error log for details");
98 orderly_poweroff(1); 98 orderly_poweroff(true);
99 break; 99 break;
100 100
101 case EPOW_SHUTDOWN_AMBIENT_TEMPERATURE_TOO_HIGH: 101 case EPOW_SHUTDOWN_AMBIENT_TEMPERATURE_TOO_HIGH:
102 pr_emerg("Ambient temperature too high reported by firmware"); 102 pr_emerg("Ambient temperature too high reported by firmware");
103 pr_emerg("Check RTAS error log for details"); 103 pr_emerg("Check RTAS error log for details");
104 orderly_poweroff(1); 104 orderly_poweroff(true);
105 break; 105 break;
106 106
107 default: 107 default:
@@ -162,7 +162,7 @@ void rtas_parse_epow_errlog(struct rtas_error_log *log)
162 162
163 case EPOW_SYSTEM_HALT: 163 case EPOW_SYSTEM_HALT:
164 pr_emerg("Firmware initiated power off"); 164 pr_emerg("Firmware initiated power off");
165 orderly_poweroff(1); 165 orderly_poweroff(true);
166 break; 166 break;
167 167
168 case EPOW_MAIN_ENCLOSURE: 168 case EPOW_MAIN_ENCLOSURE:
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 12bc8c3663ad..306643cc9dbc 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -192,7 +192,7 @@ static int smp_pSeries_cpu_bootable(unsigned int nr)
192 /* Special case - we inhibit secondary thread startup 192 /* Special case - we inhibit secondary thread startup
193 * during boot if the user requests it. 193 * during boot if the user requests it.
194 */ 194 */
195 if (system_state < SYSTEM_RUNNING && cpu_has_feature(CPU_FTR_SMT)) { 195 if (system_state == SYSTEM_BOOTING && cpu_has_feature(CPU_FTR_SMT)) {
196 if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0) 196 if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0)
197 return 0; 197 return 0;
198 if (smt_enabled_at_boot 198 if (smt_enabled_at_boot
diff --git a/arch/powerpc/relocs_check.pl b/arch/powerpc/relocs_check.pl
index 7f5b83808862..3f46e8b9c56d 100755
--- a/arch/powerpc/relocs_check.pl
+++ b/arch/powerpc/relocs_check.pl
@@ -7,7 +7,7 @@
7# as published by the Free Software Foundation; either version 7# as published by the Free Software Foundation; either version
8# 2 of the License, or (at your option) any later version. 8# 2 of the License, or (at your option) any later version.
9 9
10# This script checks the relcoations of a vmlinux for "suspicious" 10# This script checks the relocations of a vmlinux for "suspicious"
11# relocations. 11# relocations.
12 12
13use strict; 13use strict;
@@ -28,7 +28,7 @@ open(FD, "$objdump -R $vmlinux|") or die;
28while (<FD>) { 28while (<FD>) {
29 study $_; 29 study $_;
30 30
31 # Only look at relcoation lines. 31 # Only look at relocation lines.
32 next if (!/\s+R_/); 32 next if (!/\s+R_/);
33 33
34 # These relocations are okay 34 # These relocations are okay
@@ -45,7 +45,7 @@ while (<FD>) {
45 /\bR_PPC_ADDR16_HA\b/ or /\bR_PPC_RELATIVE\b/ or 45 /\bR_PPC_ADDR16_HA\b/ or /\bR_PPC_RELATIVE\b/ or
46 /\bR_PPC_NONE\b/); 46 /\bR_PPC_NONE\b/);
47 47
48 # If we see this type of relcoation it's an idication that 48 # If we see this type of relocation it's an idication that
49 # we /may/ be using an old version of binutils. 49 # we /may/ be using an old version of binutils.
50 if (/R_PPC64_UADDR64/) { 50 if (/R_PPC64_UADDR64/) {
51 $old_binutils++; 51 $old_binutils++;
@@ -61,6 +61,6 @@ if ($bad_relocs_count) {
61} 61}
62 62
63if ($old_binutils) { 63if ($old_binutils) {
64 print "WARNING: You need at binutils >= 2.19 to build a ". 64 print "WARNING: You need at least binutils >= 2.19 to build a ".
65 "CONFIG_RELCOATABLE kernel\n"; 65 "CONFIG_RELOCATABLE kernel\n";
66} 66}
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 99464a7bdb3b..f67ac900d870 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -4,6 +4,8 @@ ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC)
4 4
5mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o 5mpic-msi-obj-$(CONFIG_PCI_MSI) += mpic_msi.o mpic_u3msi.o mpic_pasemi_msi.o
6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) 6obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y)
7obj-$(CONFIG_MPIC_TIMER) += mpic_timer.o
8obj-$(CONFIG_FSL_MPIC_TIMER_WAKEUP) += fsl_mpic_timer_wakeup.o
7mpic-msgr-obj-$(CONFIG_MPIC_MSGR) += mpic_msgr.o 9mpic-msgr-obj-$(CONFIG_MPIC_MSGR) += mpic_msgr.o
8obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) $(mpic-msgr-obj-y) 10obj-$(CONFIG_MPIC) += mpic.o $(mpic-msi-obj-y) $(mpic-msgr-obj-y)
9obj-$(CONFIG_PPC_EPAPR_HV_PIC) += ehv_pic.o 11obj-$(CONFIG_PPC_EPAPR_HV_PIC) += ehv_pic.o
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index d4fa03f2b6ac..5e6ff38ea69f 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -120,6 +120,7 @@ static irqreturn_t cpm_error_interrupt(int irq, void *dev)
120 120
121static struct irqaction cpm_error_irqaction = { 121static struct irqaction cpm_error_irqaction = {
122 .handler = cpm_error_interrupt, 122 .handler = cpm_error_interrupt,
123 .flags = IRQF_NO_THREAD,
123 .name = "error", 124 .name = "error",
124}; 125};
125 126
diff --git a/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
new file mode 100644
index 000000000000..1707bf04dec6
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_mpic_timer_wakeup.c
@@ -0,0 +1,161 @@
1/*
2 * MPIC timer wakeup driver
3 *
4 * Copyright 2013 Freescale Semiconductor, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/slab.h>
14#include <linux/errno.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/device.h>
18
19#include <asm/mpic_timer.h>
20#include <asm/mpic.h>
21
22struct fsl_mpic_timer_wakeup {
23 struct mpic_timer *timer;
24 struct work_struct free_work;
25};
26
27static struct fsl_mpic_timer_wakeup *fsl_wakeup;
28static DEFINE_MUTEX(sysfs_lock);
29
30static void fsl_free_resource(struct work_struct *ws)
31{
32 struct fsl_mpic_timer_wakeup *wakeup =
33 container_of(ws, struct fsl_mpic_timer_wakeup, free_work);
34
35 mutex_lock(&sysfs_lock);
36
37 if (wakeup->timer) {
38 disable_irq_wake(wakeup->timer->irq);
39 mpic_free_timer(wakeup->timer);
40 }
41
42 wakeup->timer = NULL;
43 mutex_unlock(&sysfs_lock);
44}
45
46static irqreturn_t fsl_mpic_timer_irq(int irq, void *dev_id)
47{
48 struct fsl_mpic_timer_wakeup *wakeup = dev_id;
49
50 schedule_work(&wakeup->free_work);
51
52 return wakeup->timer ? IRQ_HANDLED : IRQ_NONE;
53}
54
55static ssize_t fsl_timer_wakeup_show(struct device *dev,
56 struct device_attribute *attr,
57 char *buf)
58{
59 struct timeval interval;
60 int val = 0;
61
62 mutex_lock(&sysfs_lock);
63 if (fsl_wakeup->timer) {
64 mpic_get_remain_time(fsl_wakeup->timer, &interval);
65 val = interval.tv_sec + 1;
66 }
67 mutex_unlock(&sysfs_lock);
68
69 return sprintf(buf, "%d\n", val);
70}
71
72static ssize_t fsl_timer_wakeup_store(struct device *dev,
73 struct device_attribute *attr,
74 const char *buf,
75 size_t count)
76{
77 struct timeval interval;
78 int ret;
79
80 interval.tv_usec = 0;
81 if (kstrtol(buf, 0, &interval.tv_sec))
82 return -EINVAL;
83
84 mutex_lock(&sysfs_lock);
85
86 if (fsl_wakeup->timer) {
87 disable_irq_wake(fsl_wakeup->timer->irq);
88 mpic_free_timer(fsl_wakeup->timer);
89 fsl_wakeup->timer = NULL;
90 }
91
92 if (!interval.tv_sec) {
93 mutex_unlock(&sysfs_lock);
94 return count;
95 }
96
97 fsl_wakeup->timer = mpic_request_timer(fsl_mpic_timer_irq,
98 fsl_wakeup, &interval);
99 if (!fsl_wakeup->timer) {
100 mutex_unlock(&sysfs_lock);
101 return -EINVAL;
102 }
103
104 ret = enable_irq_wake(fsl_wakeup->timer->irq);
105 if (ret) {
106 mpic_free_timer(fsl_wakeup->timer);
107 fsl_wakeup->timer = NULL;
108 mutex_unlock(&sysfs_lock);
109
110 return ret;
111 }
112
113 mpic_start_timer(fsl_wakeup->timer);
114
115 mutex_unlock(&sysfs_lock);
116
117 return count;
118}
119
120static struct device_attribute mpic_attributes = __ATTR(timer_wakeup, 0644,
121 fsl_timer_wakeup_show, fsl_timer_wakeup_store);
122
123static int __init fsl_wakeup_sys_init(void)
124{
125 int ret;
126
127 fsl_wakeup = kzalloc(sizeof(struct fsl_mpic_timer_wakeup), GFP_KERNEL);
128 if (!fsl_wakeup)
129 return -ENOMEM;
130
131 INIT_WORK(&fsl_wakeup->free_work, fsl_free_resource);
132
133 ret = device_create_file(mpic_subsys.dev_root, &mpic_attributes);
134 if (ret)
135 kfree(fsl_wakeup);
136
137 return ret;
138}
139
140static void __exit fsl_wakeup_sys_exit(void)
141{
142 device_remove_file(mpic_subsys.dev_root, &mpic_attributes);
143
144 mutex_lock(&sysfs_lock);
145
146 if (fsl_wakeup->timer) {
147 disable_irq_wake(fsl_wakeup->timer->irq);
148 mpic_free_timer(fsl_wakeup->timer);
149 }
150
151 kfree(fsl_wakeup);
152
153 mutex_unlock(&sysfs_lock);
154}
155
156module_init(fsl_wakeup_sys_init);
157module_exit(fsl_wakeup_sys_exit);
158
159MODULE_DESCRIPTION("Freescale MPIC global timer wakeup driver");
160MODULE_LICENSE("GPL v2");
161MODULE_AUTHOR("Wang Dongsheng <dongsheng.wang@freescale.com>");
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 028ac1f71b51..46ac1ddea683 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -97,22 +97,14 @@ static int fsl_indirect_read_config(struct pci_bus *bus, unsigned int devfn,
97 return indirect_read_config(bus, devfn, offset, len, val); 97 return indirect_read_config(bus, devfn, offset, len, val);
98} 98}
99 99
100static struct pci_ops fsl_indirect_pci_ops = 100#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
101
102static struct pci_ops fsl_indirect_pcie_ops =
101{ 103{
102 .read = fsl_indirect_read_config, 104 .read = fsl_indirect_read_config,
103 .write = indirect_write_config, 105 .write = indirect_write_config,
104}; 106};
105 107
106static void __init fsl_setup_indirect_pci(struct pci_controller* hose,
107 resource_size_t cfg_addr,
108 resource_size_t cfg_data, u32 flags)
109{
110 setup_indirect_pci(hose, cfg_addr, cfg_data, flags);
111 hose->ops = &fsl_indirect_pci_ops;
112}
113
114#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
115
116#define MAX_PHYS_ADDR_BITS 40 108#define MAX_PHYS_ADDR_BITS 40
117static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS; 109static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS;
118 110
@@ -504,13 +496,15 @@ int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
504 if (!hose->private_data) 496 if (!hose->private_data)
505 goto no_bridge; 497 goto no_bridge;
506 498
507 fsl_setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4, 499 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4,
508 PPC_INDIRECT_TYPE_BIG_ENDIAN); 500 PPC_INDIRECT_TYPE_BIG_ENDIAN);
509 501
510 if (in_be32(&pci->block_rev1) < PCIE_IP_REV_3_0) 502 if (in_be32(&pci->block_rev1) < PCIE_IP_REV_3_0)
511 hose->indirect_type |= PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK; 503 hose->indirect_type |= PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK;
512 504
513 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 505 if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
506 /* use fsl_indirect_read_config for PCIe */
507 hose->ops = &fsl_indirect_pcie_ops;
514 /* For PCIE read HEADER_TYPE to identify controler mode */ 508 /* For PCIE read HEADER_TYPE to identify controler mode */
515 early_read_config_byte(hose, 0, 0, PCI_HEADER_TYPE, &hdr_type); 509 early_read_config_byte(hose, 0, 0, PCI_HEADER_TYPE, &hdr_type);
516 if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE) 510 if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE)
@@ -814,8 +808,8 @@ int __init mpc83xx_add_bridge(struct device_node *dev)
814 if (ret) 808 if (ret)
815 goto err0; 809 goto err0;
816 } else { 810 } else {
817 fsl_setup_indirect_pci(hose, rsrc_cfg.start, 811 setup_indirect_pci(hose, rsrc_cfg.start,
818 rsrc_cfg.start + 4, 0); 812 rsrc_cfg.start + 4, 0);
819 } 813 }
820 814
821 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. " 815 printk(KERN_INFO "Found FSL PCI host bridge at 0x%016llx. "
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 3cc2f9159ab1..1be54faf60dd 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -48,6 +48,12 @@
48#define DBG(fmt...) 48#define DBG(fmt...)
49#endif 49#endif
50 50
51struct bus_type mpic_subsys = {
52 .name = "mpic",
53 .dev_name = "mpic",
54};
55EXPORT_SYMBOL_GPL(mpic_subsys);
56
51static struct mpic *mpics; 57static struct mpic *mpics;
52static struct mpic *mpic_primary; 58static struct mpic *mpic_primary;
53static DEFINE_RAW_SPINLOCK(mpic_lock); 59static DEFINE_RAW_SPINLOCK(mpic_lock);
@@ -920,6 +926,22 @@ int mpic_set_irq_type(struct irq_data *d, unsigned int flow_type)
920 return IRQ_SET_MASK_OK_NOCOPY; 926 return IRQ_SET_MASK_OK_NOCOPY;
921} 927}
922 928
929static int mpic_irq_set_wake(struct irq_data *d, unsigned int on)
930{
931 struct irq_desc *desc = container_of(d, struct irq_desc, irq_data);
932 struct mpic *mpic = mpic_from_irq_data(d);
933
934 if (!(mpic->flags & MPIC_FSL))
935 return -ENXIO;
936
937 if (on)
938 desc->action->flags |= IRQF_NO_SUSPEND;
939 else
940 desc->action->flags &= ~IRQF_NO_SUSPEND;
941
942 return 0;
943}
944
923void mpic_set_vector(unsigned int virq, unsigned int vector) 945void mpic_set_vector(unsigned int virq, unsigned int vector)
924{ 946{
925 struct mpic *mpic = mpic_from_irq(virq); 947 struct mpic *mpic = mpic_from_irq(virq);
@@ -957,6 +979,7 @@ static struct irq_chip mpic_irq_chip = {
957 .irq_unmask = mpic_unmask_irq, 979 .irq_unmask = mpic_unmask_irq,
958 .irq_eoi = mpic_end_irq, 980 .irq_eoi = mpic_end_irq,
959 .irq_set_type = mpic_set_irq_type, 981 .irq_set_type = mpic_set_irq_type,
982 .irq_set_wake = mpic_irq_set_wake,
960}; 983};
961 984
962#ifdef CONFIG_SMP 985#ifdef CONFIG_SMP
@@ -971,6 +994,7 @@ static struct irq_chip mpic_tm_chip = {
971 .irq_mask = mpic_mask_tm, 994 .irq_mask = mpic_mask_tm,
972 .irq_unmask = mpic_unmask_tm, 995 .irq_unmask = mpic_unmask_tm,
973 .irq_eoi = mpic_end_irq, 996 .irq_eoi = mpic_end_irq,
997 .irq_set_wake = mpic_irq_set_wake,
974}; 998};
975 999
976#ifdef CONFIG_MPIC_U3_HT_IRQS 1000#ifdef CONFIG_MPIC_U3_HT_IRQS
@@ -1173,10 +1197,33 @@ static struct irq_domain_ops mpic_host_ops = {
1173 .xlate = mpic_host_xlate, 1197 .xlate = mpic_host_xlate,
1174}; 1198};
1175 1199
1200static u32 fsl_mpic_get_version(struct mpic *mpic)
1201{
1202 u32 brr1;
1203
1204 if (!(mpic->flags & MPIC_FSL))
1205 return 0;
1206
1207 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs,
1208 MPIC_FSL_BRR1);
1209
1210 return brr1 & MPIC_FSL_BRR1_VER;
1211}
1212
1176/* 1213/*
1177 * Exported functions 1214 * Exported functions
1178 */ 1215 */
1179 1216
1217u32 fsl_mpic_primary_get_version(void)
1218{
1219 struct mpic *mpic = mpic_primary;
1220
1221 if (mpic)
1222 return fsl_mpic_get_version(mpic);
1223
1224 return 0;
1225}
1226
1180struct mpic * __init mpic_alloc(struct device_node *node, 1227struct mpic * __init mpic_alloc(struct device_node *node,
1181 phys_addr_t phys_addr, 1228 phys_addr_t phys_addr,
1182 unsigned int flags, 1229 unsigned int flags,
@@ -1323,7 +1370,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1323 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); 1370 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
1324 1371
1325 if (mpic->flags & MPIC_FSL) { 1372 if (mpic->flags & MPIC_FSL) {
1326 u32 brr1;
1327 int ret; 1373 int ret;
1328 1374
1329 /* 1375 /*
@@ -1334,9 +1380,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1334 mpic_map(mpic, mpic->paddr, &mpic->thiscpuregs, 1380 mpic_map(mpic, mpic->paddr, &mpic->thiscpuregs,
1335 MPIC_CPU_THISBASE, 0x1000); 1381 MPIC_CPU_THISBASE, 0x1000);
1336 1382
1337 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs, 1383 fsl_version = fsl_mpic_get_version(mpic);
1338 MPIC_FSL_BRR1);
1339 fsl_version = brr1 & MPIC_FSL_BRR1_VER;
1340 1384
1341 /* Error interrupt mask register (EIMR) is required for 1385 /* Error interrupt mask register (EIMR) is required for
1342 * handling individual device error interrupts. EIMR 1386 * handling individual device error interrupts. EIMR
@@ -1526,9 +1570,7 @@ void __init mpic_init(struct mpic *mpic)
1526 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf); 1570 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf);
1527 1571
1528 if (mpic->flags & MPIC_FSL) { 1572 if (mpic->flags & MPIC_FSL) {
1529 u32 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs, 1573 u32 version = fsl_mpic_get_version(mpic);
1530 MPIC_FSL_BRR1);
1531 u32 version = brr1 & MPIC_FSL_BRR1_VER;
1532 1574
1533 /* 1575 /*
1534 * Timer group B is present at the latest in MPIC 3.1 (e.g. 1576 * Timer group B is present at the latest in MPIC 3.1 (e.g.
@@ -1999,6 +2041,8 @@ static struct syscore_ops mpic_syscore_ops = {
1999static int mpic_init_sys(void) 2041static int mpic_init_sys(void)
2000{ 2042{
2001 register_syscore_ops(&mpic_syscore_ops); 2043 register_syscore_ops(&mpic_syscore_ops);
2044 subsys_system_register(&mpic_subsys, NULL);
2045
2002 return 0; 2046 return 0;
2003} 2047}
2004 2048
diff --git a/arch/powerpc/sysdev/mpic_timer.c b/arch/powerpc/sysdev/mpic_timer.c
new file mode 100644
index 000000000000..c06db92a4fb1
--- /dev/null
+++ b/arch/powerpc/sysdev/mpic_timer.c
@@ -0,0 +1,593 @@
1/*
2 * MPIC timer driver
3 *
4 * Copyright 2013 Freescale Semiconductor, Inc.
5 * Author: Dongsheng Wang <Dongsheng.Wang@freescale.com>
6 * Li Yang <leoli@freescale.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
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/errno.h>
18#include <linux/mm.h>
19#include <linux/interrupt.h>
20#include <linux/slab.h>
21#include <linux/of.h>
22#include <linux/of_device.h>
23#include <linux/syscore_ops.h>
24#include <sysdev/fsl_soc.h>
25#include <asm/io.h>
26
27#include <asm/mpic_timer.h>
28
29#define FSL_GLOBAL_TIMER 0x1
30
31/* Clock Ratio
32 * Divide by 64 0x00000300
33 * Divide by 32 0x00000200
34 * Divide by 16 0x00000100
35 * Divide by 8 0x00000000 (Hardware default div)
36 */
37#define MPIC_TIMER_TCR_CLKDIV 0x00000300
38
39#define MPIC_TIMER_TCR_ROVR_OFFSET 24
40
41#define TIMER_STOP 0x80000000
42#define TIMERS_PER_GROUP 4
43#define MAX_TICKS (~0U >> 1)
44#define MAX_TICKS_CASCADE (~0U)
45#define TIMER_OFFSET(num) (1 << (TIMERS_PER_GROUP - 1 - num))
46
47/* tv_usec should be less than ONE_SECOND, otherwise use tv_sec */
48#define ONE_SECOND 1000000
49
50struct timer_regs {
51 u32 gtccr;
52 u32 res0[3];
53 u32 gtbcr;
54 u32 res1[3];
55 u32 gtvpr;
56 u32 res2[3];
57 u32 gtdr;
58 u32 res3[3];
59};
60
61struct cascade_priv {
62 u32 tcr_value; /* TCR register: CASC & ROVR value */
63 unsigned int cascade_map; /* cascade map */
64 unsigned int timer_num; /* cascade control timer */
65};
66
67struct timer_group_priv {
68 struct timer_regs __iomem *regs;
69 struct mpic_timer timer[TIMERS_PER_GROUP];
70 struct list_head node;
71 unsigned int timerfreq;
72 unsigned int idle;
73 unsigned int flags;
74 spinlock_t lock;
75 void __iomem *group_tcr;
76};
77
78static struct cascade_priv cascade_timer[] = {
79 /* cascade timer 0 and 1 */
80 {0x1, 0xc, 0x1},
81 /* cascade timer 1 and 2 */
82 {0x2, 0x6, 0x2},
83 /* cascade timer 2 and 3 */
84 {0x4, 0x3, 0x3}
85};
86
87static LIST_HEAD(timer_group_list);
88
89static void convert_ticks_to_time(struct timer_group_priv *priv,
90 const u64 ticks, struct timeval *time)
91{
92 u64 tmp_sec;
93
94 time->tv_sec = (__kernel_time_t)div_u64(ticks, priv->timerfreq);
95 tmp_sec = (u64)time->tv_sec * (u64)priv->timerfreq;
96
97 time->tv_usec = (__kernel_suseconds_t)
98 div_u64((ticks - tmp_sec) * 1000000, priv->timerfreq);
99
100 return;
101}
102
103/* the time set by the user is converted to "ticks" */
104static int convert_time_to_ticks(struct timer_group_priv *priv,
105 const struct timeval *time, u64 *ticks)
106{
107 u64 max_value; /* prevent u64 overflow */
108 u64 tmp = 0;
109
110 u64 tmp_sec;
111 u64 tmp_ms;
112 u64 tmp_us;
113
114 max_value = div_u64(ULLONG_MAX, priv->timerfreq);
115
116 if (time->tv_sec > max_value ||
117 (time->tv_sec == max_value && time->tv_usec > 0))
118 return -EINVAL;
119
120 tmp_sec = (u64)time->tv_sec * (u64)priv->timerfreq;
121 tmp += tmp_sec;
122
123 tmp_ms = time->tv_usec / 1000;
124 tmp_ms = div_u64((u64)tmp_ms * (u64)priv->timerfreq, 1000);
125 tmp += tmp_ms;
126
127 tmp_us = time->tv_usec % 1000;
128 tmp_us = div_u64((u64)tmp_us * (u64)priv->timerfreq, 1000000);
129 tmp += tmp_us;
130
131 *ticks = tmp;
132
133 return 0;
134}
135
136/* detect whether there is a cascade timer available */
137static struct mpic_timer *detect_idle_cascade_timer(
138 struct timer_group_priv *priv)
139{
140 struct cascade_priv *casc_priv;
141 unsigned int map;
142 unsigned int array_size = ARRAY_SIZE(cascade_timer);
143 unsigned int num;
144 unsigned int i;
145 unsigned long flags;
146
147 casc_priv = cascade_timer;
148 for (i = 0; i < array_size; i++) {
149 spin_lock_irqsave(&priv->lock, flags);
150 map = casc_priv->cascade_map & priv->idle;
151 if (map == casc_priv->cascade_map) {
152 num = casc_priv->timer_num;
153 priv->timer[num].cascade_handle = casc_priv;
154
155 /* set timer busy */
156 priv->idle &= ~casc_priv->cascade_map;
157 spin_unlock_irqrestore(&priv->lock, flags);
158 return &priv->timer[num];
159 }
160 spin_unlock_irqrestore(&priv->lock, flags);
161 casc_priv++;
162 }
163
164 return NULL;
165}
166
167static int set_cascade_timer(struct timer_group_priv *priv, u64 ticks,
168 unsigned int num)
169{
170 struct cascade_priv *casc_priv;
171 u32 tcr;
172 u32 tmp_ticks;
173 u32 rem_ticks;
174
175 /* set group tcr reg for cascade */
176 casc_priv = priv->timer[num].cascade_handle;
177 if (!casc_priv)
178 return -EINVAL;
179
180 tcr = casc_priv->tcr_value |
181 (casc_priv->tcr_value << MPIC_TIMER_TCR_ROVR_OFFSET);
182 setbits32(priv->group_tcr, tcr);
183
184 tmp_ticks = div_u64_rem(ticks, MAX_TICKS_CASCADE, &rem_ticks);
185
186 out_be32(&priv->regs[num].gtccr, 0);
187 out_be32(&priv->regs[num].gtbcr, tmp_ticks | TIMER_STOP);
188
189 out_be32(&priv->regs[num - 1].gtccr, 0);
190 out_be32(&priv->regs[num - 1].gtbcr, rem_ticks);
191
192 return 0;
193}
194
195static struct mpic_timer *get_cascade_timer(struct timer_group_priv *priv,
196 u64 ticks)
197{
198 struct mpic_timer *allocated_timer;
199
200 /* Two cascade timers: Support the maximum time */
201 const u64 max_ticks = (u64)MAX_TICKS * (u64)MAX_TICKS_CASCADE;
202 int ret;
203
204 if (ticks > max_ticks)
205 return NULL;
206
207 /* detect idle timer */
208 allocated_timer = detect_idle_cascade_timer(priv);
209 if (!allocated_timer)
210 return NULL;
211
212 /* set ticks to timer */
213 ret = set_cascade_timer(priv, ticks, allocated_timer->num);
214 if (ret < 0)
215 return NULL;
216
217 return allocated_timer;
218}
219
220static struct mpic_timer *get_timer(const struct timeval *time)
221{
222 struct timer_group_priv *priv;
223 struct mpic_timer *timer;
224
225 u64 ticks;
226 unsigned int num;
227 unsigned int i;
228 unsigned long flags;
229 int ret;
230
231 list_for_each_entry(priv, &timer_group_list, node) {
232 ret = convert_time_to_ticks(priv, time, &ticks);
233 if (ret < 0)
234 return NULL;
235
236 if (ticks > MAX_TICKS) {
237 if (!(priv->flags & FSL_GLOBAL_TIMER))
238 return NULL;
239
240 timer = get_cascade_timer(priv, ticks);
241 if (!timer)
242 continue;
243
244 return timer;
245 }
246
247 for (i = 0; i < TIMERS_PER_GROUP; i++) {
248 /* one timer: Reverse allocation */
249 num = TIMERS_PER_GROUP - 1 - i;
250 spin_lock_irqsave(&priv->lock, flags);
251 if (priv->idle & (1 << i)) {
252 /* set timer busy */
253 priv->idle &= ~(1 << i);
254 /* set ticks & stop timer */
255 out_be32(&priv->regs[num].gtbcr,
256 ticks | TIMER_STOP);
257 out_be32(&priv->regs[num].gtccr, 0);
258 priv->timer[num].cascade_handle = NULL;
259 spin_unlock_irqrestore(&priv->lock, flags);
260 return &priv->timer[num];
261 }
262 spin_unlock_irqrestore(&priv->lock, flags);
263 }
264 }
265
266 return NULL;
267}
268
269/**
270 * mpic_start_timer - start hardware timer
271 * @handle: the timer to be started.
272 *
273 * It will do ->fn(->dev) callback from the hardware interrupt at
274 * the ->timeval point in the future.
275 */
276void mpic_start_timer(struct mpic_timer *handle)
277{
278 struct timer_group_priv *priv = container_of(handle,
279 struct timer_group_priv, timer[handle->num]);
280
281 clrbits32(&priv->regs[handle->num].gtbcr, TIMER_STOP);
282}
283EXPORT_SYMBOL(mpic_start_timer);
284
285/**
286 * mpic_stop_timer - stop hardware timer
287 * @handle: the timer to be stoped
288 *
289 * The timer periodically generates an interrupt. Unless user stops the timer.
290 */
291void mpic_stop_timer(struct mpic_timer *handle)
292{
293 struct timer_group_priv *priv = container_of(handle,
294 struct timer_group_priv, timer[handle->num]);
295 struct cascade_priv *casc_priv;
296
297 setbits32(&priv->regs[handle->num].gtbcr, TIMER_STOP);
298
299 casc_priv = priv->timer[handle->num].cascade_handle;
300 if (casc_priv) {
301 out_be32(&priv->regs[handle->num].gtccr, 0);
302 out_be32(&priv->regs[handle->num - 1].gtccr, 0);
303 } else {
304 out_be32(&priv->regs[handle->num].gtccr, 0);
305 }
306}
307EXPORT_SYMBOL(mpic_stop_timer);
308
309/**
310 * mpic_get_remain_time - get timer time
311 * @handle: the timer to be selected.
312 * @time: time for timer
313 *
314 * Query timer remaining time.
315 */
316void mpic_get_remain_time(struct mpic_timer *handle, struct timeval *time)
317{
318 struct timer_group_priv *priv = container_of(handle,
319 struct timer_group_priv, timer[handle->num]);
320 struct cascade_priv *casc_priv;
321
322 u64 ticks;
323 u32 tmp_ticks;
324
325 casc_priv = priv->timer[handle->num].cascade_handle;
326 if (casc_priv) {
327 tmp_ticks = in_be32(&priv->regs[handle->num].gtccr);
328 ticks = ((u64)tmp_ticks & UINT_MAX) * (u64)MAX_TICKS_CASCADE;
329 tmp_ticks = in_be32(&priv->regs[handle->num - 1].gtccr);
330 ticks += tmp_ticks;
331 } else {
332 ticks = in_be32(&priv->regs[handle->num].gtccr);
333 }
334
335 convert_ticks_to_time(priv, ticks, time);
336}
337EXPORT_SYMBOL(mpic_get_remain_time);
338
339/**
340 * mpic_free_timer - free hardware timer
341 * @handle: the timer to be removed.
342 *
343 * Free the timer.
344 *
345 * Note: can not be used in interrupt context.
346 */
347void mpic_free_timer(struct mpic_timer *handle)
348{
349 struct timer_group_priv *priv = container_of(handle,
350 struct timer_group_priv, timer[handle->num]);
351
352 struct cascade_priv *casc_priv;
353 unsigned long flags;
354
355 mpic_stop_timer(handle);
356
357 casc_priv = priv->timer[handle->num].cascade_handle;
358
359 free_irq(priv->timer[handle->num].irq, priv->timer[handle->num].dev);
360
361 spin_lock_irqsave(&priv->lock, flags);
362 if (casc_priv) {
363 u32 tcr;
364 tcr = casc_priv->tcr_value | (casc_priv->tcr_value <<
365 MPIC_TIMER_TCR_ROVR_OFFSET);
366 clrbits32(priv->group_tcr, tcr);
367 priv->idle |= casc_priv->cascade_map;
368 priv->timer[handle->num].cascade_handle = NULL;
369 } else {
370 priv->idle |= TIMER_OFFSET(handle->num);
371 }
372 spin_unlock_irqrestore(&priv->lock, flags);
373}
374EXPORT_SYMBOL(mpic_free_timer);
375
376/**
377 * mpic_request_timer - get a hardware timer
378 * @fn: interrupt handler function
379 * @dev: callback function of the data
380 * @time: time for timer
381 *
382 * This executes the "request_irq", returning NULL
383 * else "handle" on success.
384 */
385struct mpic_timer *mpic_request_timer(irq_handler_t fn, void *dev,
386 const struct timeval *time)
387{
388 struct mpic_timer *allocated_timer;
389 int ret;
390
391 if (list_empty(&timer_group_list))
392 return NULL;
393
394 if (!(time->tv_sec + time->tv_usec) ||
395 time->tv_sec < 0 || time->tv_usec < 0)
396 return NULL;
397
398 if (time->tv_usec > ONE_SECOND)
399 return NULL;
400
401 allocated_timer = get_timer(time);
402 if (!allocated_timer)
403 return NULL;
404
405 ret = request_irq(allocated_timer->irq, fn,
406 IRQF_TRIGGER_LOW, "global-timer", dev);
407 if (ret) {
408 mpic_free_timer(allocated_timer);
409 return NULL;
410 }
411
412 allocated_timer->dev = dev;
413
414 return allocated_timer;
415}
416EXPORT_SYMBOL(mpic_request_timer);
417
418static int timer_group_get_freq(struct device_node *np,
419 struct timer_group_priv *priv)
420{
421 u32 div;
422
423 if (priv->flags & FSL_GLOBAL_TIMER) {
424 struct device_node *dn;
425
426 dn = of_find_compatible_node(NULL, NULL, "fsl,mpic");
427 if (dn) {
428 of_property_read_u32(dn, "clock-frequency",
429 &priv->timerfreq);
430 of_node_put(dn);
431 }
432 }
433
434 if (priv->timerfreq <= 0)
435 return -EINVAL;
436
437 if (priv->flags & FSL_GLOBAL_TIMER) {
438 div = (1 << (MPIC_TIMER_TCR_CLKDIV >> 8)) * 8;
439 priv->timerfreq /= div;
440 }
441
442 return 0;
443}
444
445static int timer_group_get_irq(struct device_node *np,
446 struct timer_group_priv *priv)
447{
448 const u32 all_timer[] = { 0, TIMERS_PER_GROUP };
449 const u32 *p;
450 u32 offset;
451 u32 count;
452
453 unsigned int i;
454 unsigned int j;
455 unsigned int irq_index = 0;
456 unsigned int irq;
457 int len;
458
459 p = of_get_property(np, "fsl,available-ranges", &len);
460 if (p && len % (2 * sizeof(u32)) != 0) {
461 pr_err("%s: malformed available-ranges property.\n",
462 np->full_name);
463 return -EINVAL;
464 }
465
466 if (!p) {
467 p = all_timer;
468 len = sizeof(all_timer);
469 }
470
471 len /= 2 * sizeof(u32);
472
473 for (i = 0; i < len; i++) {
474 offset = p[i * 2];
475 count = p[i * 2 + 1];
476 for (j = 0; j < count; j++) {
477 irq = irq_of_parse_and_map(np, irq_index);
478 if (!irq) {
479 pr_err("%s: irq parse and map failed.\n",
480 np->full_name);
481 return -EINVAL;
482 }
483
484 /* Set timer idle */
485 priv->idle |= TIMER_OFFSET((offset + j));
486 priv->timer[offset + j].irq = irq;
487 priv->timer[offset + j].num = offset + j;
488 irq_index++;
489 }
490 }
491
492 return 0;
493}
494
495static void timer_group_init(struct device_node *np)
496{
497 struct timer_group_priv *priv;
498 unsigned int i = 0;
499 int ret;
500
501 priv = kzalloc(sizeof(struct timer_group_priv), GFP_KERNEL);
502 if (!priv) {
503 pr_err("%s: cannot allocate memory for group.\n",
504 np->full_name);
505 return;
506 }
507
508 if (of_device_is_compatible(np, "fsl,mpic-global-timer"))
509 priv->flags |= FSL_GLOBAL_TIMER;
510
511 priv->regs = of_iomap(np, i++);
512 if (!priv->regs) {
513 pr_err("%s: cannot ioremap timer register address.\n",
514 np->full_name);
515 goto out;
516 }
517
518 if (priv->flags & FSL_GLOBAL_TIMER) {
519 priv->group_tcr = of_iomap(np, i++);
520 if (!priv->group_tcr) {
521 pr_err("%s: cannot ioremap tcr address.\n",
522 np->full_name);
523 goto out;
524 }
525 }
526
527 ret = timer_group_get_freq(np, priv);
528 if (ret < 0) {
529 pr_err("%s: cannot get timer frequency.\n", np->full_name);
530 goto out;
531 }
532
533 ret = timer_group_get_irq(np, priv);
534 if (ret < 0) {
535 pr_err("%s: cannot get timer irqs.\n", np->full_name);
536 goto out;
537 }
538
539 spin_lock_init(&priv->lock);
540
541 /* Init FSL timer hardware */
542 if (priv->flags & FSL_GLOBAL_TIMER)
543 setbits32(priv->group_tcr, MPIC_TIMER_TCR_CLKDIV);
544
545 list_add_tail(&priv->node, &timer_group_list);
546
547 return;
548
549out:
550 if (priv->regs)
551 iounmap(priv->regs);
552
553 if (priv->group_tcr)
554 iounmap(priv->group_tcr);
555
556 kfree(priv);
557}
558
559static void mpic_timer_resume(void)
560{
561 struct timer_group_priv *priv;
562
563 list_for_each_entry(priv, &timer_group_list, node) {
564 /* Init FSL timer hardware */
565 if (priv->flags & FSL_GLOBAL_TIMER)
566 setbits32(priv->group_tcr, MPIC_TIMER_TCR_CLKDIV);
567 }
568}
569
570static const struct of_device_id mpic_timer_ids[] = {
571 { .compatible = "fsl,mpic-global-timer", },
572 {},
573};
574
575static struct syscore_ops mpic_timer_syscore_ops = {
576 .resume = mpic_timer_resume,
577};
578
579static int __init mpic_timer_init(void)
580{
581 struct device_node *np = NULL;
582
583 for_each_matching_node(np, mpic_timer_ids)
584 timer_group_init(np);
585
586 register_syscore_ops(&mpic_timer_syscore_ops);
587
588 if (list_empty(&timer_group_list))
589 return -ENODEV;
590
591 return 0;
592}
593subsys_initcall(mpic_timer_init);
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index da183c5a103c..22f75b504f7f 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -301,7 +301,6 @@ config HOTPLUG_CPU
301 def_bool y 301 def_bool y
302 prompt "Support for hot-pluggable CPUs" 302 prompt "Support for hot-pluggable CPUs"
303 depends on SMP 303 depends on SMP
304 select HOTPLUG
305 help 304 help
306 Say Y here to be able to turn CPUs off and on. CPUs 305 Say Y here to be able to turn CPUs off and on. CPUs
307 can be controlled through /sys/devices/system/cpu/cpu#. 306 can be controlled through /sys/devices/system/cpu/cpu#.
diff --git a/arch/s390/appldata/appldata_mem.c b/arch/s390/appldata/appldata_mem.c
index 7ef60b52d6e0..42be53743133 100644
--- a/arch/s390/appldata/appldata_mem.c
+++ b/arch/s390/appldata/appldata_mem.c
@@ -32,7 +32,7 @@
32 * book: 32 * book:
33 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml 33 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml
34 */ 34 */
35static struct appldata_mem_data { 35struct appldata_mem_data {
36 u64 timestamp; 36 u64 timestamp;
37 u32 sync_count_1; /* after VM collected the record data, */ 37 u32 sync_count_1; /* after VM collected the record data, */
38 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the 38 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the
@@ -63,7 +63,7 @@ static struct appldata_mem_data {
63 u64 pgmajfault; /* page faults (major only) */ 63 u64 pgmajfault; /* page faults (major only) */
64// <-- New in 2.6 64// <-- New in 2.6
65 65
66} __attribute__((packed)) appldata_mem_data; 66} __packed;
67 67
68 68
69/* 69/*
@@ -118,7 +118,6 @@ static struct appldata_ops ops = {
118 .record_nr = APPLDATA_RECORD_MEM_ID, 118 .record_nr = APPLDATA_RECORD_MEM_ID,
119 .size = sizeof(struct appldata_mem_data), 119 .size = sizeof(struct appldata_mem_data),
120 .callback = &appldata_get_mem_data, 120 .callback = &appldata_get_mem_data,
121 .data = &appldata_mem_data,
122 .owner = THIS_MODULE, 121 .owner = THIS_MODULE,
123 .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ 122 .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */
124}; 123};
@@ -131,7 +130,17 @@ static struct appldata_ops ops = {
131 */ 130 */
132static int __init appldata_mem_init(void) 131static int __init appldata_mem_init(void)
133{ 132{
134 return appldata_register_ops(&ops); 133 int ret;
134
135 ops.data = kzalloc(sizeof(struct appldata_mem_data), GFP_KERNEL);
136 if (!ops.data)
137 return -ENOMEM;
138
139 ret = appldata_register_ops(&ops);
140 if (ret)
141 kfree(ops.data);
142
143 return ret;
135} 144}
136 145
137/* 146/*
@@ -142,6 +151,7 @@ static int __init appldata_mem_init(void)
142static void __exit appldata_mem_exit(void) 151static void __exit appldata_mem_exit(void)
143{ 152{
144 appldata_unregister_ops(&ops); 153 appldata_unregister_ops(&ops);
154 kfree(ops.data);
145} 155}
146 156
147 157
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 2d224b945355..66037d2622b4 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -29,7 +29,7 @@
29 * book: 29 * book:
30 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml 30 * http://oss.software.ibm.com/developerworks/opensource/linux390/index.shtml
31 */ 31 */
32static struct appldata_net_sum_data { 32struct appldata_net_sum_data {
33 u64 timestamp; 33 u64 timestamp;
34 u32 sync_count_1; /* after VM collected the record data, */ 34 u32 sync_count_1; /* after VM collected the record data, */
35 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the 35 u32 sync_count_2; /* sync_count_1 and sync_count_2 should be the
@@ -51,7 +51,7 @@ static struct appldata_net_sum_data {
51 u64 rx_dropped; /* no space in linux buffers */ 51 u64 rx_dropped; /* no space in linux buffers */
52 u64 tx_dropped; /* no space available in linux */ 52 u64 tx_dropped; /* no space available in linux */
53 u64 collisions; /* collisions while transmitting */ 53 u64 collisions; /* collisions while transmitting */
54} __attribute__((packed)) appldata_net_sum_data; 54} __packed;
55 55
56 56
57/* 57/*
@@ -121,7 +121,6 @@ static struct appldata_ops ops = {
121 .record_nr = APPLDATA_RECORD_NET_SUM_ID, 121 .record_nr = APPLDATA_RECORD_NET_SUM_ID,
122 .size = sizeof(struct appldata_net_sum_data), 122 .size = sizeof(struct appldata_net_sum_data),
123 .callback = &appldata_get_net_sum_data, 123 .callback = &appldata_get_net_sum_data,
124 .data = &appldata_net_sum_data,
125 .owner = THIS_MODULE, 124 .owner = THIS_MODULE,
126 .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */ 125 .mod_lvl = {0xF0, 0xF0}, /* EBCDIC "00" */
127}; 126};
@@ -134,7 +133,17 @@ static struct appldata_ops ops = {
134 */ 133 */
135static int __init appldata_net_init(void) 134static int __init appldata_net_init(void)
136{ 135{
137 return appldata_register_ops(&ops); 136 int ret;
137
138 ops.data = kzalloc(sizeof(struct appldata_net_sum_data), GFP_KERNEL);
139 if (!ops.data)
140 return -ENOMEM;
141
142 ret = appldata_register_ops(&ops);
143 if (ret)
144 kfree(ops.data);
145
146 return ret;
138} 147}
139 148
140/* 149/*
@@ -145,6 +154,7 @@ static int __init appldata_net_init(void)
145static void __exit appldata_net_exit(void) 154static void __exit appldata_net_exit(void)
146{ 155{
147 appldata_unregister_ops(&ops); 156 appldata_unregister_ops(&ops);
157 kfree(ops.data);
148} 158}
149 159
150 160
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 7fd3690b6760..138893e5f736 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -651,9 +651,7 @@ static int hypfs_create_cpu_files(struct super_block *sb,
651 } 651 }
652 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer); 652 diag224_idx2name(cpu_info__ctidx(diag204_info_type, cpu_info), buffer);
653 rc = hypfs_create_str(sb, cpu_dir, "type", buffer); 653 rc = hypfs_create_str(sb, cpu_dir, "type", buffer);
654 if (IS_ERR(rc)) 654 return PTR_RET(rc);
655 return PTR_ERR(rc);
656 return 0;
657} 655}
658 656
659static void *hypfs_create_lpar_files(struct super_block *sb, 657static void *hypfs_create_lpar_files(struct super_block *sb,
@@ -702,9 +700,7 @@ static int hypfs_create_phys_cpu_files(struct super_block *sb,
702 return PTR_ERR(rc); 700 return PTR_ERR(rc);
703 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer); 701 diag224_idx2name(phys_cpu__ctidx(diag204_info_type, cpu_info), buffer);
704 rc = hypfs_create_str(sb, cpu_dir, "type", buffer); 702 rc = hypfs_create_str(sb, cpu_dir, "type", buffer);
705 if (IS_ERR(rc)) 703 return PTR_RET(rc);
706 return PTR_ERR(rc);
707 return 0;
708} 704}
709 705
710static void *hypfs_create_phys_files(struct super_block *sb, 706static void *hypfs_create_phys_files(struct super_block *sb,
diff --git a/arch/s390/include/asm/airq.h b/arch/s390/include/asm/airq.h
index 9819891ed7a2..4066cee0c2d2 100644
--- a/arch/s390/include/asm/airq.h
+++ b/arch/s390/include/asm/airq.h
@@ -9,9 +9,18 @@
9#ifndef _ASM_S390_AIRQ_H 9#ifndef _ASM_S390_AIRQ_H
10#define _ASM_S390_AIRQ_H 10#define _ASM_S390_AIRQ_H
11 11
12typedef void (*adapter_int_handler_t)(void *, void *); 12struct airq_struct {
13 struct hlist_node list; /* Handler queueing. */
14 void (*handler)(struct airq_struct *); /* Thin-interrupt handler */
15 u8 *lsi_ptr; /* Local-Summary-Indicator pointer */
16 u8 lsi_mask; /* Local-Summary-Indicator mask */
17 u8 isc; /* Interrupt-subclass */
18 u8 flags;
19};
13 20
14void *s390_register_adapter_interrupt(adapter_int_handler_t, void *, u8); 21#define AIRQ_PTR_ALLOCATED 0x01
15void s390_unregister_adapter_interrupt(void *, u8); 22
23int register_adapter_interrupt(struct airq_struct *airq);
24void unregister_adapter_interrupt(struct airq_struct *airq);
16 25
17#endif /* _ASM_S390_AIRQ_H */ 26#endif /* _ASM_S390_AIRQ_H */
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h
index 886ac7d4937a..3fbc67d9e197 100644
--- a/arch/s390/include/asm/dma-mapping.h
+++ b/arch/s390/include/asm/dma-mapping.h
@@ -50,9 +50,10 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
50{ 50{
51 struct dma_map_ops *dma_ops = get_dma_ops(dev); 51 struct dma_map_ops *dma_ops = get_dma_ops(dev);
52 52
53 debug_dma_mapping_error(dev, dma_addr);
53 if (dma_ops->mapping_error) 54 if (dma_ops->mapping_error)
54 return dma_ops->mapping_error(dev, dma_addr); 55 return dma_ops->mapping_error(dev, dma_addr);
55 return (dma_addr == 0UL); 56 return dma_addr == DMA_ERROR_CODE;
56} 57}
57 58
58static inline void *dma_alloc_coherent(struct device *dev, size_t size, 59static inline void *dma_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h
index 2ee66a65f2d4..0aa6a7ed95a3 100644
--- a/arch/s390/include/asm/facility.h
+++ b/arch/s390/include/asm/facility.h
@@ -13,6 +13,16 @@
13 13
14#define MAX_FACILITY_BIT (256*8) /* stfle_fac_list has 256 bytes */ 14#define MAX_FACILITY_BIT (256*8) /* stfle_fac_list has 256 bytes */
15 15
16static inline int __test_facility(unsigned long nr, void *facilities)
17{
18 unsigned char *ptr;
19
20 if (nr >= MAX_FACILITY_BIT)
21 return 0;
22 ptr = (unsigned char *) facilities + (nr >> 3);
23 return (*ptr & (0x80 >> (nr & 7))) != 0;
24}
25
16/* 26/*
17 * The test_facility function uses the bit odering where the MSB is bit 0. 27 * The test_facility function uses the bit odering where the MSB is bit 0.
18 * That makes it easier to query facility bits with the bit number as 28 * That makes it easier to query facility bits with the bit number as
@@ -20,12 +30,7 @@
20 */ 30 */
21static inline int test_facility(unsigned long nr) 31static inline int test_facility(unsigned long nr)
22{ 32{
23 unsigned char *ptr; 33 return __test_facility(nr, &S390_lowcore.stfle_fac_list);
24
25 if (nr >= MAX_FACILITY_BIT)
26 return 0;
27 ptr = (unsigned char *) &S390_lowcore.stfle_fac_list + (nr >> 3);
28 return (*ptr & (0x80 >> (nr & 7))) != 0;
29} 34}
30 35
31/** 36/**
diff --git a/arch/s390/include/asm/io.h b/arch/s390/include/asm/io.h
index fd9be010f9b2..cd6b9ee7b69c 100644
--- a/arch/s390/include/asm/io.h
+++ b/arch/s390/include/asm/io.h
@@ -13,28 +13,6 @@
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pci_io.h> 14#include <asm/pci_io.h>
15 15
16/*
17 * Change virtual addresses to physical addresses and vv.
18 * These are pretty trivial
19 */
20static inline unsigned long virt_to_phys(volatile void * address)
21{
22 unsigned long real_address;
23 asm volatile(
24 " lra %0,0(%1)\n"
25 " jz 0f\n"
26 " la %0,0\n"
27 "0:"
28 : "=a" (real_address) : "a" (address) : "cc");
29 return real_address;
30}
31#define virt_to_phys virt_to_phys
32
33static inline void * phys_to_virt(unsigned long address)
34{
35 return (void *) address;
36}
37
38void *xlate_dev_mem_ptr(unsigned long phys); 16void *xlate_dev_mem_ptr(unsigned long phys);
39#define xlate_dev_mem_ptr xlate_dev_mem_ptr 17#define xlate_dev_mem_ptr xlate_dev_mem_ptr
40void unxlate_dev_mem_ptr(unsigned long phys, void *addr); 18void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 16bd5d169cdb..3238d4004e84 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -62,13 +62,20 @@ struct sca_block {
62#define CPUSTAT_MCDS 0x00000100 62#define CPUSTAT_MCDS 0x00000100
63#define CPUSTAT_SM 0x00000080 63#define CPUSTAT_SM 0x00000080
64#define CPUSTAT_G 0x00000008 64#define CPUSTAT_G 0x00000008
65#define CPUSTAT_GED 0x00000004
65#define CPUSTAT_J 0x00000002 66#define CPUSTAT_J 0x00000002
66#define CPUSTAT_P 0x00000001 67#define CPUSTAT_P 0x00000001
67 68
68struct kvm_s390_sie_block { 69struct kvm_s390_sie_block {
69 atomic_t cpuflags; /* 0x0000 */ 70 atomic_t cpuflags; /* 0x0000 */
70 __u32 prefix; /* 0x0004 */ 71 __u32 prefix; /* 0x0004 */
71 __u8 reserved8[32]; /* 0x0008 */ 72 __u8 reserved08[4]; /* 0x0008 */
73#define PROG_IN_SIE (1<<0)
74 __u32 prog0c; /* 0x000c */
75 __u8 reserved10[16]; /* 0x0010 */
76#define PROG_BLOCK_SIE 0x00000001
77 atomic_t prog20; /* 0x0020 */
78 __u8 reserved24[4]; /* 0x0024 */
72 __u64 cputm; /* 0x0028 */ 79 __u64 cputm; /* 0x0028 */
73 __u64 ckc; /* 0x0030 */ 80 __u64 ckc; /* 0x0030 */
74 __u64 epoch; /* 0x0038 */ 81 __u64 epoch; /* 0x0038 */
@@ -90,7 +97,8 @@ struct kvm_s390_sie_block {
90 __u32 scaoh; /* 0x005c */ 97 __u32 scaoh; /* 0x005c */
91 __u8 reserved60; /* 0x0060 */ 98 __u8 reserved60; /* 0x0060 */
92 __u8 ecb; /* 0x0061 */ 99 __u8 ecb; /* 0x0061 */
93 __u8 reserved62[2]; /* 0x0062 */ 100 __u8 ecb2; /* 0x0062 */
101 __u8 reserved63[1]; /* 0x0063 */
94 __u32 scaol; /* 0x0064 */ 102 __u32 scaol; /* 0x0064 */
95 __u8 reserved68[4]; /* 0x0068 */ 103 __u8 reserved68[4]; /* 0x0068 */
96 __u32 todpr; /* 0x006c */ 104 __u32 todpr; /* 0x006c */
@@ -130,6 +138,7 @@ struct kvm_vcpu_stat {
130 u32 deliver_program_int; 138 u32 deliver_program_int;
131 u32 deliver_io_int; 139 u32 deliver_io_int;
132 u32 exit_wait_state; 140 u32 exit_wait_state;
141 u32 instruction_pfmf;
133 u32 instruction_stidp; 142 u32 instruction_stidp;
134 u32 instruction_spx; 143 u32 instruction_spx;
135 u32 instruction_stpx; 144 u32 instruction_stpx;
@@ -166,7 +175,7 @@ struct kvm_s390_ext_info {
166}; 175};
167 176
168#define PGM_OPERATION 0x01 177#define PGM_OPERATION 0x01
169#define PGM_PRIVILEGED_OPERATION 0x02 178#define PGM_PRIVILEGED_OP 0x02
170#define PGM_EXECUTE 0x03 179#define PGM_EXECUTE 0x03
171#define PGM_PROTECTION 0x04 180#define PGM_PROTECTION 0x04
172#define PGM_ADDRESSING 0x05 181#define PGM_ADDRESSING 0x05
@@ -219,7 +228,7 @@ struct kvm_s390_local_interrupt {
219 atomic_t active; 228 atomic_t active;
220 struct kvm_s390_float_interrupt *float_int; 229 struct kvm_s390_float_interrupt *float_int;
221 int timer_due; /* event indicator for waitqueue below */ 230 int timer_due; /* event indicator for waitqueue below */
222 wait_queue_head_t wq; 231 wait_queue_head_t *wq;
223 atomic_t *cpuflags; 232 atomic_t *cpuflags;
224 unsigned int action_bits; 233 unsigned int action_bits;
225}; 234};
@@ -266,4 +275,5 @@ struct kvm_arch{
266}; 275};
267 276
268extern int sie64a(struct kvm_s390_sie_block *, u64 *); 277extern int sie64a(struct kvm_s390_sie_block *, u64 *);
278extern char sie_exit;
269#endif 279#endif
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 6c1801235db9..6e577ba0e5da 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -120,7 +120,6 @@ struct zpci_dev {
120 120
121 struct dentry *debugfs_dev; 121 struct dentry *debugfs_dev;
122 struct dentry *debugfs_perf; 122 struct dentry *debugfs_perf;
123 struct dentry *debugfs_debug;
124}; 123};
125 124
126struct pci_hp_callback_ops { 125struct pci_hp_callback_ops {
@@ -143,7 +142,6 @@ int zpci_enable_device(struct zpci_dev *);
143int zpci_disable_device(struct zpci_dev *); 142int zpci_disable_device(struct zpci_dev *);
144void zpci_stop_device(struct zpci_dev *); 143void zpci_stop_device(struct zpci_dev *);
145void zpci_free_device(struct zpci_dev *); 144void zpci_free_device(struct zpci_dev *);
146int zpci_scan_device(struct zpci_dev *);
147int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64); 145int zpci_register_ioat(struct zpci_dev *, u8, u64, u64, u64);
148int zpci_unregister_ioat(struct zpci_dev *, u8); 146int zpci_unregister_ioat(struct zpci_dev *, u8);
149 147
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h
index 5f0173a31693..1141fb3e7b21 100644
--- a/arch/s390/include/asm/perf_event.h
+++ b/arch/s390/include/asm/perf_event.h
@@ -14,3 +14,13 @@
14/* Per-CPU flags for PMU states */ 14/* Per-CPU flags for PMU states */
15#define PMU_F_RESERVED 0x1000 15#define PMU_F_RESERVED 0x1000
16#define PMU_F_ENABLED 0x2000 16#define PMU_F_ENABLED 0x2000
17
18#ifdef CONFIG_64BIT
19
20/* Perf callbacks */
21struct pt_regs;
22extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
23extern unsigned long perf_misc_flags(struct pt_regs *regs);
24#define perf_misc_flags(regs) perf_misc_flags(regs)
25
26#endif /* CONFIG_64BIT */
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index 590c3219c634..e1408ddb94f8 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -22,6 +22,9 @@ unsigned long *page_table_alloc(struct mm_struct *, unsigned long);
22void page_table_free(struct mm_struct *, unsigned long *); 22void page_table_free(struct mm_struct *, unsigned long *);
23void page_table_free_rcu(struct mmu_gather *, unsigned long *); 23void page_table_free_rcu(struct mmu_gather *, unsigned long *);
24 24
25int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
26 unsigned long key, bool nq);
27
25static inline void clear_table(unsigned long *s, unsigned long val, size_t n) 28static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
26{ 29{
27 typedef struct { char _[n]; } addrtype; 30 typedef struct { char _[n]; } addrtype;
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index ac01463038f1..75fb726de91f 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -58,9 +58,6 @@ extern unsigned long zero_page_mask;
58#define __HAVE_COLOR_ZERO_PAGE 58#define __HAVE_COLOR_ZERO_PAGE
59 59
60/* TODO: s390 cannot support io_remap_pfn_range... */ 60/* TODO: s390 cannot support io_remap_pfn_range... */
61#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
62 remap_pfn_range(vma, vaddr, pfn, size, prot)
63
64#endif /* !__ASSEMBLY__ */ 61#endif /* !__ASSEMBLY__ */
65 62
66/* 63/*
@@ -299,18 +296,16 @@ extern unsigned long MODULES_END;
299#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV) 296#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
300 297
301/* Page status table bits for virtualization */ 298/* Page status table bits for virtualization */
302#define RCP_ACC_BITS 0xf0000000UL 299#define PGSTE_ACC_BITS 0xf0000000UL
303#define RCP_FP_BIT 0x08000000UL 300#define PGSTE_FP_BIT 0x08000000UL
304#define RCP_PCL_BIT 0x00800000UL 301#define PGSTE_PCL_BIT 0x00800000UL
305#define RCP_HR_BIT 0x00400000UL 302#define PGSTE_HR_BIT 0x00400000UL
306#define RCP_HC_BIT 0x00200000UL 303#define PGSTE_HC_BIT 0x00200000UL
307#define RCP_GR_BIT 0x00040000UL 304#define PGSTE_GR_BIT 0x00040000UL
308#define RCP_GC_BIT 0x00020000UL 305#define PGSTE_GC_BIT 0x00020000UL
309#define RCP_IN_BIT 0x00002000UL /* IPTE notify bit */ 306#define PGSTE_UR_BIT 0x00008000UL
310 307#define PGSTE_UC_BIT 0x00004000UL /* user dirty (migration) */
311/* User dirty / referenced bit for KVM's migration feature */ 308#define PGSTE_IN_BIT 0x00002000UL /* IPTE notify bit */
312#define KVM_UR_BIT 0x00008000UL
313#define KVM_UC_BIT 0x00004000UL
314 309
315#else /* CONFIG_64BIT */ 310#else /* CONFIG_64BIT */
316 311
@@ -367,18 +362,16 @@ extern unsigned long MODULES_END;
367 | _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO) 362 | _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO)
368 363
369/* Page status table bits for virtualization */ 364/* Page status table bits for virtualization */
370#define RCP_ACC_BITS 0xf000000000000000UL 365#define PGSTE_ACC_BITS 0xf000000000000000UL
371#define RCP_FP_BIT 0x0800000000000000UL 366#define PGSTE_FP_BIT 0x0800000000000000UL
372#define RCP_PCL_BIT 0x0080000000000000UL 367#define PGSTE_PCL_BIT 0x0080000000000000UL
373#define RCP_HR_BIT 0x0040000000000000UL 368#define PGSTE_HR_BIT 0x0040000000000000UL
374#define RCP_HC_BIT 0x0020000000000000UL 369#define PGSTE_HC_BIT 0x0020000000000000UL
375#define RCP_GR_BIT 0x0004000000000000UL 370#define PGSTE_GR_BIT 0x0004000000000000UL
376#define RCP_GC_BIT 0x0002000000000000UL 371#define PGSTE_GC_BIT 0x0002000000000000UL
377#define RCP_IN_BIT 0x0000200000000000UL /* IPTE notify bit */ 372#define PGSTE_UR_BIT 0x0000800000000000UL
378 373#define PGSTE_UC_BIT 0x0000400000000000UL /* user dirty (migration) */
379/* User dirty / referenced bit for KVM's migration feature */ 374#define PGSTE_IN_BIT 0x0000200000000000UL /* IPTE notify bit */
380#define KVM_UR_BIT 0x0000800000000000UL
381#define KVM_UC_BIT 0x0000400000000000UL
382 375
383#endif /* CONFIG_64BIT */ 376#endif /* CONFIG_64BIT */
384 377
@@ -618,12 +611,12 @@ static inline pgste_t pgste_get_lock(pte_t *ptep)
618 asm( 611 asm(
619 " lg %0,%2\n" 612 " lg %0,%2\n"
620 "0: lgr %1,%0\n" 613 "0: lgr %1,%0\n"
621 " nihh %0,0xff7f\n" /* clear RCP_PCL_BIT in old */ 614 " nihh %0,0xff7f\n" /* clear PCL bit in old */
622 " oihh %1,0x0080\n" /* set RCP_PCL_BIT in new */ 615 " oihh %1,0x0080\n" /* set PCL bit in new */
623 " csg %0,%1,%2\n" 616 " csg %0,%1,%2\n"
624 " jl 0b\n" 617 " jl 0b\n"
625 : "=&d" (old), "=&d" (new), "=Q" (ptep[PTRS_PER_PTE]) 618 : "=&d" (old), "=&d" (new), "=Q" (ptep[PTRS_PER_PTE])
626 : "Q" (ptep[PTRS_PER_PTE]) : "cc"); 619 : "Q" (ptep[PTRS_PER_PTE]) : "cc", "memory");
627#endif 620#endif
628 return __pgste(new); 621 return __pgste(new);
629} 622}
@@ -632,14 +625,22 @@ static inline void pgste_set_unlock(pte_t *ptep, pgste_t pgste)
632{ 625{
633#ifdef CONFIG_PGSTE 626#ifdef CONFIG_PGSTE
634 asm( 627 asm(
635 " nihh %1,0xff7f\n" /* clear RCP_PCL_BIT */ 628 " nihh %1,0xff7f\n" /* clear PCL bit */
636 " stg %1,%0\n" 629 " stg %1,%0\n"
637 : "=Q" (ptep[PTRS_PER_PTE]) 630 : "=Q" (ptep[PTRS_PER_PTE])
638 : "d" (pgste_val(pgste)), "Q" (ptep[PTRS_PER_PTE]) : "cc"); 631 : "d" (pgste_val(pgste)), "Q" (ptep[PTRS_PER_PTE])
632 : "cc", "memory");
639 preempt_enable(); 633 preempt_enable();
640#endif 634#endif
641} 635}
642 636
637static inline void pgste_set(pte_t *ptep, pgste_t pgste)
638{
639#ifdef CONFIG_PGSTE
640 *(pgste_t *)(ptep + PTRS_PER_PTE) = pgste;
641#endif
642}
643
643static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste) 644static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste)
644{ 645{
645#ifdef CONFIG_PGSTE 646#ifdef CONFIG_PGSTE
@@ -657,14 +658,14 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste)
657 else if (bits) 658 else if (bits)
658 page_reset_referenced(address); 659 page_reset_referenced(address);
659 /* Transfer page changed & referenced bit to guest bits in pgste */ 660 /* Transfer page changed & referenced bit to guest bits in pgste */
660 pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ 661 pgste_val(pgste) |= bits << 48; /* GR bit & GC bit */
661 /* Get host changed & referenced bits from pgste */ 662 /* Get host changed & referenced bits from pgste */
662 bits |= (pgste_val(pgste) & (RCP_HR_BIT | RCP_HC_BIT)) >> 52; 663 bits |= (pgste_val(pgste) & (PGSTE_HR_BIT | PGSTE_HC_BIT)) >> 52;
663 /* Transfer page changed & referenced bit to kvm user bits */ 664 /* Transfer page changed & referenced bit to kvm user bits */
664 pgste_val(pgste) |= bits << 45; /* KVM_UR_BIT & KVM_UC_BIT */ 665 pgste_val(pgste) |= bits << 45; /* PGSTE_UR_BIT & PGSTE_UC_BIT */
665 /* Clear relevant host bits in pgste. */ 666 /* Clear relevant host bits in pgste. */
666 pgste_val(pgste) &= ~(RCP_HR_BIT | RCP_HC_BIT); 667 pgste_val(pgste) &= ~(PGSTE_HR_BIT | PGSTE_HC_BIT);
667 pgste_val(pgste) &= ~(RCP_ACC_BITS | RCP_FP_BIT); 668 pgste_val(pgste) &= ~(PGSTE_ACC_BITS | PGSTE_FP_BIT);
668 /* Copy page access key and fetch protection bit to pgste */ 669 /* Copy page access key and fetch protection bit to pgste */
669 pgste_val(pgste) |= 670 pgste_val(pgste) |=
670 (unsigned long) (skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56; 671 (unsigned long) (skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56;
@@ -685,15 +686,15 @@ static inline pgste_t pgste_update_young(pte_t *ptep, pgste_t pgste)
685 /* Get referenced bit from storage key */ 686 /* Get referenced bit from storage key */
686 young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK); 687 young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK);
687 if (young) 688 if (young)
688 pgste_val(pgste) |= RCP_GR_BIT; 689 pgste_val(pgste) |= PGSTE_GR_BIT;
689 /* Get host referenced bit from pgste */ 690 /* Get host referenced bit from pgste */
690 if (pgste_val(pgste) & RCP_HR_BIT) { 691 if (pgste_val(pgste) & PGSTE_HR_BIT) {
691 pgste_val(pgste) &= ~RCP_HR_BIT; 692 pgste_val(pgste) &= ~PGSTE_HR_BIT;
692 young = 1; 693 young = 1;
693 } 694 }
694 /* Transfer referenced bit to kvm user bits and pte */ 695 /* Transfer referenced bit to kvm user bits and pte */
695 if (young) { 696 if (young) {
696 pgste_val(pgste) |= KVM_UR_BIT; 697 pgste_val(pgste) |= PGSTE_UR_BIT;
697 pte_val(*ptep) |= _PAGE_SWR; 698 pte_val(*ptep) |= _PAGE_SWR;
698 } 699 }
699#endif 700#endif
@@ -704,17 +705,19 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
704{ 705{
705#ifdef CONFIG_PGSTE 706#ifdef CONFIG_PGSTE
706 unsigned long address; 707 unsigned long address;
707 unsigned long okey, nkey; 708 unsigned long nkey;
708 709
709 if (pte_val(entry) & _PAGE_INVALID) 710 if (pte_val(entry) & _PAGE_INVALID)
710 return; 711 return;
712 VM_BUG_ON(!(pte_val(*ptep) & _PAGE_INVALID));
711 address = pte_val(entry) & PAGE_MASK; 713 address = pte_val(entry) & PAGE_MASK;
712 okey = nkey = page_get_storage_key(address); 714 /*
713 nkey &= ~(_PAGE_ACC_BITS | _PAGE_FP_BIT); 715 * Set page access key and fetch protection bit from pgste.
714 /* Set page access key and fetch protection bit from pgste */ 716 * The guest C/R information is still in the PGSTE, set real
715 nkey |= (pgste_val(pgste) & (RCP_ACC_BITS | RCP_FP_BIT)) >> 56; 717 * key C/R to 0.
716 if (okey != nkey) 718 */
717 page_set_storage_key(address, nkey, 0); 719 nkey = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56;
720 page_set_storage_key(address, nkey, 0);
718#endif 721#endif
719} 722}
720 723
@@ -743,6 +746,7 @@ struct gmap {
743 struct mm_struct *mm; 746 struct mm_struct *mm;
744 unsigned long *table; 747 unsigned long *table;
745 unsigned long asce; 748 unsigned long asce;
749 void *private;
746 struct list_head crst_list; 750 struct list_head crst_list;
747}; 751};
748 752
@@ -801,8 +805,8 @@ static inline pgste_t pgste_ipte_notify(struct mm_struct *mm,
801 pte_t *ptep, pgste_t pgste) 805 pte_t *ptep, pgste_t pgste)
802{ 806{
803#ifdef CONFIG_PGSTE 807#ifdef CONFIG_PGSTE
804 if (pgste_val(pgste) & RCP_IN_BIT) { 808 if (pgste_val(pgste) & PGSTE_IN_BIT) {
805 pgste_val(pgste) &= ~RCP_IN_BIT; 809 pgste_val(pgste) &= ~PGSTE_IN_BIT;
806 gmap_do_ipte_notify(mm, addr, ptep); 810 gmap_do_ipte_notify(mm, addr, ptep);
807 } 811 }
808#endif 812#endif
@@ -970,8 +974,8 @@ static inline int ptep_test_and_clear_user_dirty(struct mm_struct *mm,
970 if (mm_has_pgste(mm)) { 974 if (mm_has_pgste(mm)) {
971 pgste = pgste_get_lock(ptep); 975 pgste = pgste_get_lock(ptep);
972 pgste = pgste_update_all(ptep, pgste); 976 pgste = pgste_update_all(ptep, pgste);
973 dirty = !!(pgste_val(pgste) & KVM_UC_BIT); 977 dirty = !!(pgste_val(pgste) & PGSTE_UC_BIT);
974 pgste_val(pgste) &= ~KVM_UC_BIT; 978 pgste_val(pgste) &= ~PGSTE_UC_BIT;
975 pgste_set_unlock(ptep, pgste); 979 pgste_set_unlock(ptep, pgste);
976 return dirty; 980 return dirty;
977 } 981 }
@@ -990,8 +994,8 @@ static inline int ptep_test_and_clear_user_young(struct mm_struct *mm,
990 if (mm_has_pgste(mm)) { 994 if (mm_has_pgste(mm)) {
991 pgste = pgste_get_lock(ptep); 995 pgste = pgste_get_lock(ptep);
992 pgste = pgste_update_young(ptep, pgste); 996 pgste = pgste_update_young(ptep, pgste);
993 young = !!(pgste_val(pgste) & KVM_UR_BIT); 997 young = !!(pgste_val(pgste) & PGSTE_UR_BIT);
994 pgste_val(pgste) &= ~KVM_UR_BIT; 998 pgste_val(pgste) &= ~PGSTE_UR_BIT;
995 pgste_set_unlock(ptep, pgste); 999 pgste_set_unlock(ptep, pgste);
996 } 1000 }
997 return young; 1001 return young;
@@ -1099,8 +1103,10 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm,
1099 if (!mm_exclusive(mm)) 1103 if (!mm_exclusive(mm))
1100 __ptep_ipte(address, ptep); 1104 __ptep_ipte(address, ptep);
1101 1105
1102 if (mm_has_pgste(mm)) 1106 if (mm_has_pgste(mm)) {
1103 pgste = pgste_update_all(&pte, pgste); 1107 pgste = pgste_update_all(&pte, pgste);
1108 pgste_set(ptep, pgste);
1109 }
1104 return pte; 1110 return pte;
1105} 1111}
1106 1112
@@ -1358,10 +1364,11 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
1358#ifdef CONFIG_TRANSPARENT_HUGEPAGE 1364#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1359 1365
1360#define __HAVE_ARCH_PGTABLE_DEPOSIT 1366#define __HAVE_ARCH_PGTABLE_DEPOSIT
1361extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable); 1367extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
1368 pgtable_t pgtable);
1362 1369
1363#define __HAVE_ARCH_PGTABLE_WITHDRAW 1370#define __HAVE_ARCH_PGTABLE_WITHDRAW
1364extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm); 1371extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
1365 1372
1366static inline int pmd_trans_splitting(pmd_t pmd) 1373static inline int pmd_trans_splitting(pmd_t pmd)
1367{ 1374{
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 559512a455da..52b56533c57c 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -24,6 +24,7 @@ struct pt_regs
24 unsigned long gprs[NUM_GPRS]; 24 unsigned long gprs[NUM_GPRS];
25 unsigned long orig_gpr2; 25 unsigned long orig_gpr2;
26 unsigned int int_code; 26 unsigned int int_code;
27 unsigned int int_parm;
27 unsigned long int_parm_long; 28 unsigned long int_parm_long;
28}; 29};
29 30
diff --git a/arch/s390/include/uapi/asm/Kbuild b/arch/s390/include/uapi/asm/Kbuild
index 9ccd1905bdad..6a9a9eb645f5 100644
--- a/arch/s390/include/uapi/asm/Kbuild
+++ b/arch/s390/include/uapi/asm/Kbuild
@@ -35,6 +35,7 @@ header-y += siginfo.h
35header-y += signal.h 35header-y += signal.h
36header-y += socket.h 36header-y += socket.h
37header-y += sockios.h 37header-y += sockios.h
38header-y += sclp_ctl.h
38header-y += stat.h 39header-y += stat.h
39header-y += statfs.h 40header-y += statfs.h
40header-y += swab.h 41header-y += swab.h
diff --git a/arch/s390/include/uapi/asm/chsc.h b/arch/s390/include/uapi/asm/chsc.h
index 1c6a7f85a581..65dc694725a8 100644
--- a/arch/s390/include/uapi/asm/chsc.h
+++ b/arch/s390/include/uapi/asm/chsc.h
@@ -29,6 +29,16 @@ struct chsc_async_area {
29 __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)]; 29 __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)];
30} __attribute__ ((packed)); 30} __attribute__ ((packed));
31 31
32struct chsc_header {
33 __u16 length;
34 __u16 code;
35} __attribute__ ((packed));
36
37struct chsc_sync_area {
38 struct chsc_header header;
39 __u8 data[CHSC_SIZE - sizeof(struct chsc_header)];
40} __attribute__ ((packed));
41
32struct chsc_response_struct { 42struct chsc_response_struct {
33 __u16 length; 43 __u16 length;
34 __u16 code; 44 __u16 code;
@@ -126,5 +136,8 @@ struct chsc_cpd_info {
126#define CHSC_INFO_CCL _IOWR(CHSC_IOCTL_MAGIC, 0x86, struct chsc_comp_list) 136#define CHSC_INFO_CCL _IOWR(CHSC_IOCTL_MAGIC, 0x86, struct chsc_comp_list)
127#define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info) 137#define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info)
128#define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal) 138#define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal)
139#define CHSC_START_SYNC _IOWR(CHSC_IOCTL_MAGIC, 0x89, struct chsc_sync_area)
140#define CHSC_ON_CLOSE_SET _IOWR(CHSC_IOCTL_MAGIC, 0x8a, struct chsc_async_area)
141#define CHSC_ON_CLOSE_REMOVE _IO(CHSC_IOCTL_MAGIC, 0x8b)
129 142
130#endif 143#endif
diff --git a/arch/s390/include/uapi/asm/dasd.h b/arch/s390/include/uapi/asm/dasd.h
index 38eca3ba40e2..5812a3b2df9e 100644
--- a/arch/s390/include/uapi/asm/dasd.h
+++ b/arch/s390/include/uapi/asm/dasd.h
@@ -261,6 +261,10 @@ struct dasd_snid_ioctl_data {
261#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6) 261#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
262/* Resume IO on device */ 262/* Resume IO on device */
263#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7) 263#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
264/* Abort all I/O on a device */
265#define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240)
266/* Allow I/O on a device */
267#define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241)
264 268
265 269
266/* retrieve API version number */ 270/* retrieve API version number */
diff --git a/arch/s390/include/uapi/asm/sclp_ctl.h b/arch/s390/include/uapi/asm/sclp_ctl.h
new file mode 100644
index 000000000000..f2818613ee41
--- /dev/null
+++ b/arch/s390/include/uapi/asm/sclp_ctl.h
@@ -0,0 +1,24 @@
1/*
2 * IOCTL interface for SCLP
3 *
4 * Copyright IBM Corp. 2012
5 *
6 * Author: Michael Holzheu <holzheu@linux.vnet.ibm.com>
7 */
8
9#ifndef _ASM_SCLP_CTL_H
10#define _ASM_SCLP_CTL_H
11
12#include <linux/types.h>
13
14struct sclp_ctl_sccb {
15 __u32 cmdw;
16 __u64 sccb;
17} __attribute__((packed));
18
19#define SCLP_CTL_IOCTL_MAGIC 0x10
20
21#define SCLP_CTL_SCCB \
22 _IOWR(SCLP_CTL_IOCTL_MAGIC, 0x10, struct sclp_ctl_sccb)
23
24#endif
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 7a82f9f70100..2416138ebd3e 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -7,6 +7,7 @@
7#define ASM_OFFSETS_C 7#define ASM_OFFSETS_C
8 8
9#include <linux/kbuild.h> 9#include <linux/kbuild.h>
10#include <linux/kvm_host.h>
10#include <linux/sched.h> 11#include <linux/sched.h>
11#include <asm/cputime.h> 12#include <asm/cputime.h>
12#include <asm/vdso.h> 13#include <asm/vdso.h>
@@ -47,6 +48,7 @@ int main(void)
47 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs)); 48 DEFINE(__PT_GPRS, offsetof(struct pt_regs, gprs));
48 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2)); 49 DEFINE(__PT_ORIG_GPR2, offsetof(struct pt_regs, orig_gpr2));
49 DEFINE(__PT_INT_CODE, offsetof(struct pt_regs, int_code)); 50 DEFINE(__PT_INT_CODE, offsetof(struct pt_regs, int_code));
51 DEFINE(__PT_INT_PARM, offsetof(struct pt_regs, int_parm));
50 DEFINE(__PT_INT_PARM_LONG, offsetof(struct pt_regs, int_parm_long)); 52 DEFINE(__PT_INT_PARM_LONG, offsetof(struct pt_regs, int_parm_long));
51 DEFINE(__PT_SIZE, sizeof(struct pt_regs)); 53 DEFINE(__PT_SIZE, sizeof(struct pt_regs));
52 BLANK(); 54 BLANK();
@@ -161,6 +163,8 @@ int main(void)
161 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb)); 163 DEFINE(__LC_PGM_TDB, offsetof(struct _lowcore, pgm_tdb));
162 DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb)); 164 DEFINE(__THREAD_trap_tdb, offsetof(struct task_struct, thread.trap_tdb));
163 DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce)); 165 DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
166 DEFINE(__SIE_PROG0C, offsetof(struct kvm_s390_sie_block, prog0c));
167 DEFINE(__SIE_PROG20, offsetof(struct kvm_s390_sie_block, prog20));
164#endif /* CONFIG_32BIT */ 168#endif /* CONFIG_32BIT */
165 return 0; 169 return 0;
166} 170}
diff --git a/arch/s390/kernel/dumpstack.c b/arch/s390/kernel/dumpstack.c
index 298297477257..87acc38f73c6 100644
--- a/arch/s390/kernel/dumpstack.c
+++ b/arch/s390/kernel/dumpstack.c
@@ -74,6 +74,8 @@ __show_trace(unsigned long sp, unsigned long low, unsigned long high)
74 74
75static void show_trace(struct task_struct *task, unsigned long *stack) 75static void show_trace(struct task_struct *task, unsigned long *stack)
76{ 76{
77 const unsigned long frame_size =
78 STACK_FRAME_OVERHEAD + sizeof(struct pt_regs);
77 register unsigned long __r15 asm ("15"); 79 register unsigned long __r15 asm ("15");
78 unsigned long sp; 80 unsigned long sp;
79 81
@@ -82,11 +84,13 @@ static void show_trace(struct task_struct *task, unsigned long *stack)
82 sp = task ? task->thread.ksp : __r15; 84 sp = task ? task->thread.ksp : __r15;
83 printk("Call Trace:\n"); 85 printk("Call Trace:\n");
84#ifdef CONFIG_CHECK_STACK 86#ifdef CONFIG_CHECK_STACK
85 sp = __show_trace(sp, S390_lowcore.panic_stack - 4096, 87 sp = __show_trace(sp,
86 S390_lowcore.panic_stack); 88 S390_lowcore.panic_stack + frame_size - 4096,
89 S390_lowcore.panic_stack + frame_size);
87#endif 90#endif
88 sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE, 91 sp = __show_trace(sp,
89 S390_lowcore.async_stack); 92 S390_lowcore.async_stack + frame_size - ASYNC_SIZE,
93 S390_lowcore.async_stack + frame_size);
90 if (task) 94 if (task)
91 __show_trace(sp, (unsigned long) task_stack_page(task), 95 __show_trace(sp, (unsigned long) task_stack_page(task),
92 (unsigned long) task_stack_page(task) + THREAD_SIZE); 96 (unsigned long) task_stack_page(task) + THREAD_SIZE);
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 4d5e6f8a7978..be7a408be7a1 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -429,11 +429,19 @@ io_skip:
429 stm %r0,%r7,__PT_R0(%r11) 429 stm %r0,%r7,__PT_R0(%r11)
430 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC 430 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC
431 stm %r8,%r9,__PT_PSW(%r11) 431 stm %r8,%r9,__PT_PSW(%r11)
432 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
432 TRACE_IRQS_OFF 433 TRACE_IRQS_OFF
433 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) 434 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
435io_loop:
434 l %r1,BASED(.Ldo_IRQ) 436 l %r1,BASED(.Ldo_IRQ)
435 lr %r2,%r11 # pass pointer to pt_regs 437 lr %r2,%r11 # pass pointer to pt_regs
436 basr %r14,%r1 # call do_IRQ 438 basr %r14,%r1 # call do_IRQ
439 tm __LC_MACHINE_FLAGS+2,0x10 # MACHINE_FLAG_LPAR
440 jz io_return
441 tpi 0
442 jz io_return
443 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
444 j io_loop
437io_return: 445io_return:
438 LOCKDEP_SYS_EXIT 446 LOCKDEP_SYS_EXIT
439 TRACE_IRQS_ON 447 TRACE_IRQS_ON
@@ -573,10 +581,10 @@ ext_skip:
573 stm %r0,%r7,__PT_R0(%r11) 581 stm %r0,%r7,__PT_R0(%r11)
574 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC 582 mvc __PT_R8(32,%r11),__LC_SAVE_AREA_ASYNC
575 stm %r8,%r9,__PT_PSW(%r11) 583 stm %r8,%r9,__PT_PSW(%r11)
584 mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR
585 mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS
576 TRACE_IRQS_OFF 586 TRACE_IRQS_OFF
577 lr %r2,%r11 # pass pointer to pt_regs 587 lr %r2,%r11 # pass pointer to pt_regs
578 l %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code
579 l %r4,__LC_EXT_PARAMS # get external parameters
580 l %r1,BASED(.Ldo_extint) 588 l %r1,BASED(.Ldo_extint)
581 basr %r14,%r1 # call do_extint 589 basr %r14,%r1 # call do_extint
582 j io_return 590 j io_return
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index aa0ab02e9595..3ddbc26d246e 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -54,7 +54,7 @@ void handle_signal32(unsigned long sig, struct k_sigaction *ka,
54void do_notify_resume(struct pt_regs *regs); 54void do_notify_resume(struct pt_regs *regs);
55 55
56struct ext_code; 56struct ext_code;
57void do_extint(struct pt_regs *regs, struct ext_code, unsigned int, unsigned long); 57void do_extint(struct pt_regs *regs);
58void do_restart(void); 58void do_restart(void);
59void __init startup_init(void); 59void __init startup_init(void);
60void die(struct pt_regs *regs, const char *str); 60void die(struct pt_regs *regs, const char *str);
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 4c17eece707e..1c039d0c24c7 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -47,7 +47,6 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
47 _TIF_MCCK_PENDING) 47 _TIF_MCCK_PENDING)
48_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ 48_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
49 _TIF_SYSCALL_TRACEPOINT) 49 _TIF_SYSCALL_TRACEPOINT)
50_TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
51 50
52#define BASED(name) name-system_call(%r13) 51#define BASED(name) name-system_call(%r13)
53 52
@@ -81,23 +80,27 @@ _TIF_EXIT_SIE = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_MCCK_PENDING)
81#endif 80#endif
82 .endm 81 .endm
83 82
84 .macro HANDLE_SIE_INTERCEPT scratch,pgmcheck 83 .macro HANDLE_SIE_INTERCEPT scratch,reason
85#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 84#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
86 tmhh %r8,0x0001 # interrupting from user ? 85 tmhh %r8,0x0001 # interrupting from user ?
87 jnz .+42 86 jnz .+62
88 lgr \scratch,%r9 87 lgr \scratch,%r9
89 slg \scratch,BASED(.Lsie_loop) 88 slg \scratch,BASED(.Lsie_critical)
90 clg \scratch,BASED(.Lsie_length) 89 clg \scratch,BASED(.Lsie_critical_length)
91 .if \pgmcheck 90 .if \reason==1
92 # Some program interrupts are suppressing (e.g. protection). 91 # Some program interrupts are suppressing (e.g. protection).
93 # We must also check the instruction after SIE in that case. 92 # We must also check the instruction after SIE in that case.
94 # do_protection_exception will rewind to rewind_pad 93 # do_protection_exception will rewind to rewind_pad
95 jh .+22 94 jh .+42
96 .else 95 .else
97 jhe .+22 96 jhe .+42
98 .endif 97 .endif
99 lg %r9,BASED(.Lsie_loop) 98 lg %r14,__SF_EMPTY(%r15) # get control block pointer
100 LPP BASED(.Lhost_id) # set host id 99 LPP __SF_EMPTY+16(%r15) # set host id
100 ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
101 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
102 larl %r9,sie_exit # skip forward to sie_exit
103 mvi __SF_EMPTY+31(%r15),\reason # set exit reason
101#endif 104#endif
102 .endm 105 .endm
103 106
@@ -450,7 +453,7 @@ ENTRY(io_int_handler)
450 lg %r12,__LC_THREAD_INFO 453 lg %r12,__LC_THREAD_INFO
451 larl %r13,system_call 454 larl %r13,system_call
452 lmg %r8,%r9,__LC_IO_OLD_PSW 455 lmg %r8,%r9,__LC_IO_OLD_PSW
453 HANDLE_SIE_INTERCEPT %r14,0 456 HANDLE_SIE_INTERCEPT %r14,2
454 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT 457 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT
455 tmhh %r8,0x0001 # interrupting from user? 458 tmhh %r8,0x0001 # interrupting from user?
456 jz io_skip 459 jz io_skip
@@ -460,10 +463,18 @@ io_skip:
460 stmg %r0,%r7,__PT_R0(%r11) 463 stmg %r0,%r7,__PT_R0(%r11)
461 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC 464 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
462 stmg %r8,%r9,__PT_PSW(%r11) 465 stmg %r8,%r9,__PT_PSW(%r11)
466 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
463 TRACE_IRQS_OFF 467 TRACE_IRQS_OFF
464 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 468 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
469io_loop:
465 lgr %r2,%r11 # pass pointer to pt_regs 470 lgr %r2,%r11 # pass pointer to pt_regs
466 brasl %r14,do_IRQ 471 brasl %r14,do_IRQ
472 tm __LC_MACHINE_FLAGS+6,0x10 # MACHINE_FLAG_LPAR
473 jz io_return
474 tpi 0
475 jz io_return
476 mvc __PT_INT_CODE(12,%r11),__LC_SUBCHANNEL_ID
477 j io_loop
467io_return: 478io_return:
468 LOCKDEP_SYS_EXIT 479 LOCKDEP_SYS_EXIT
469 TRACE_IRQS_ON 480 TRACE_IRQS_ON
@@ -595,7 +606,7 @@ ENTRY(ext_int_handler)
595 lg %r12,__LC_THREAD_INFO 606 lg %r12,__LC_THREAD_INFO
596 larl %r13,system_call 607 larl %r13,system_call
597 lmg %r8,%r9,__LC_EXT_OLD_PSW 608 lmg %r8,%r9,__LC_EXT_OLD_PSW
598 HANDLE_SIE_INTERCEPT %r14,0 609 HANDLE_SIE_INTERCEPT %r14,3
599 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT 610 SWITCH_ASYNC __LC_SAVE_AREA_ASYNC,__LC_ASYNC_STACK,STACK_SHIFT
600 tmhh %r8,0x0001 # interrupting from user ? 611 tmhh %r8,0x0001 # interrupting from user ?
601 jz ext_skip 612 jz ext_skip
@@ -605,13 +616,13 @@ ext_skip:
605 stmg %r0,%r7,__PT_R0(%r11) 616 stmg %r0,%r7,__PT_R0(%r11)
606 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC 617 mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
607 stmg %r8,%r9,__PT_PSW(%r11) 618 stmg %r8,%r9,__PT_PSW(%r11)
619 lghi %r1,__LC_EXT_PARAMS2
620 mvc __PT_INT_CODE(4,%r11),__LC_EXT_CPU_ADDR
621 mvc __PT_INT_PARM(4,%r11),__LC_EXT_PARAMS
622 mvc __PT_INT_PARM_LONG(8,%r11),0(%r1)
608 TRACE_IRQS_OFF 623 TRACE_IRQS_OFF
609 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) 624 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
610 lghi %r1,4096
611 lgr %r2,%r11 # pass pointer to pt_regs 625 lgr %r2,%r11 # pass pointer to pt_regs
612 llgf %r3,__LC_EXT_CPU_ADDR # get cpu address + interruption code
613 llgf %r4,__LC_EXT_PARAMS # get external parameter
614 lg %r5,__LC_EXT_PARAMS2-4096(%r1) # get 64 bit external parameter
615 brasl %r14,do_extint 626 brasl %r14,do_extint
616 j io_return 627 j io_return
617 628
@@ -643,7 +654,7 @@ ENTRY(mcck_int_handler)
643 lg %r12,__LC_THREAD_INFO 654 lg %r12,__LC_THREAD_INFO
644 larl %r13,system_call 655 larl %r13,system_call
645 lmg %r8,%r9,__LC_MCK_OLD_PSW 656 lmg %r8,%r9,__LC_MCK_OLD_PSW
646 HANDLE_SIE_INTERCEPT %r14,0 657 HANDLE_SIE_INTERCEPT %r14,4
647 tm __LC_MCCK_CODE,0x80 # system damage? 658 tm __LC_MCCK_CODE,0x80 # system damage?
648 jo mcck_panic # yes -> rest of mcck code invalid 659 jo mcck_panic # yes -> rest of mcck code invalid
649 lghi %r14,__LC_CPU_TIMER_SAVE_AREA 660 lghi %r14,__LC_CPU_TIMER_SAVE_AREA
@@ -937,56 +948,50 @@ ENTRY(sie64a)
937 stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers 948 stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers
938 stg %r2,__SF_EMPTY(%r15) # save control block pointer 949 stg %r2,__SF_EMPTY(%r15) # save control block pointer
939 stg %r3,__SF_EMPTY+8(%r15) # save guest register save area 950 stg %r3,__SF_EMPTY+8(%r15) # save guest register save area
940 xc __SF_EMPTY+16(8,%r15),__SF_EMPTY+16(%r15) # host id == 0 951 xc __SF_EMPTY+16(16,%r15),__SF_EMPTY+16(%r15) # host id & reason
941 lmg %r0,%r13,0(%r3) # load guest gprs 0-13 952 lmg %r0,%r13,0(%r3) # load guest gprs 0-13
942# some program checks are suppressing. C code (e.g. do_protection_exception)
943# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other
944# instructions in the sie_loop should not cause program interrupts. So
945# lets use a nop (47 00 00 00) as a landing pad.
946# See also HANDLE_SIE_INTERCEPT
947rewind_pad:
948 nop 0
949sie_loop:
950 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
951 tm __TI_flags+7(%r14),_TIF_EXIT_SIE
952 jnz sie_exit
953 lg %r14,__LC_GMAP # get gmap pointer 953 lg %r14,__LC_GMAP # get gmap pointer
954 ltgr %r14,%r14 954 ltgr %r14,%r14
955 jz sie_gmap 955 jz sie_gmap
956 lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce 956 lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce
957sie_gmap: 957sie_gmap:
958 lg %r14,__SF_EMPTY(%r15) # get control block pointer 958 lg %r14,__SF_EMPTY(%r15) # get control block pointer
959 oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now
960 tm __SIE_PROG20+3(%r14),1 # last exit...
961 jnz sie_done
959 LPP __SF_EMPTY(%r15) # set guest id 962 LPP __SF_EMPTY(%r15) # set guest id
960 sie 0(%r14) 963 sie 0(%r14)
961sie_done: 964sie_done:
962 LPP __SF_EMPTY+16(%r15) # set host id 965 LPP __SF_EMPTY+16(%r15) # set host id
963 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 966 ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE
964sie_exit:
965 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 967 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
968# some program checks are suppressing. C code (e.g. do_protection_exception)
969# will rewind the PSW by the ILC, which is 4 bytes in case of SIE. Other
970# instructions beween sie64a and sie_done should not cause program
971# interrupts. So lets use a nop (47 00 00 00) as a landing pad.
972# See also HANDLE_SIE_INTERCEPT
973rewind_pad:
974 nop 0
975 .globl sie_exit
976sie_exit:
966 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area 977 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
967 stmg %r0,%r13,0(%r14) # save guest gprs 0-13 978 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
968 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers 979 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
969 lghi %r2,0 980 lg %r2,__SF_EMPTY+24(%r15) # return exit reason code
970 br %r14 981 br %r14
971sie_fault: 982sie_fault:
972 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce 983 lghi %r14,-EFAULT
973 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 984 stg %r14,__SF_EMPTY+24(%r15) # set exit reason code
974 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area 985 j sie_exit
975 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
976 lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
977 lghi %r2,-EFAULT
978 br %r14
979 986
980 .align 8 987 .align 8
981.Lsie_loop: 988.Lsie_critical:
982 .quad sie_loop 989 .quad sie_gmap
983.Lsie_length: 990.Lsie_critical_length:
984 .quad sie_done - sie_loop 991 .quad sie_done - sie_gmap
985.Lhost_id:
986 .quad 0
987 992
988 EX_TABLE(rewind_pad,sie_fault) 993 EX_TABLE(rewind_pad,sie_fault)
989 EX_TABLE(sie_loop,sie_fault) 994 EX_TABLE(sie_exit,sie_fault)
990#endif 995#endif
991 996
992 .section .rodata, "a" 997 .section .rodata, "a"
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index d8a6a385d048..feb719d3c851 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -754,9 +754,9 @@ static struct bin_attribute sys_reipl_fcp_scp_data_attr = {
754 .write = reipl_fcp_scpdata_write, 754 .write = reipl_fcp_scpdata_write,
755}; 755};
756 756
757DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%016llx\n", 757DEFINE_IPL_ATTR_RW(reipl_fcp, wwpn, "0x%016llx\n", "%llx\n",
758 reipl_block_fcp->ipl_info.fcp.wwpn); 758 reipl_block_fcp->ipl_info.fcp.wwpn);
759DEFINE_IPL_ATTR_RW(reipl_fcp, lun, "0x%016llx\n", "%016llx\n", 759DEFINE_IPL_ATTR_RW(reipl_fcp, lun, "0x%016llx\n", "%llx\n",
760 reipl_block_fcp->ipl_info.fcp.lun); 760 reipl_block_fcp->ipl_info.fcp.lun);
761DEFINE_IPL_ATTR_RW(reipl_fcp, bootprog, "%lld\n", "%lld\n", 761DEFINE_IPL_ATTR_RW(reipl_fcp, bootprog, "%lld\n", "%lld\n",
762 reipl_block_fcp->ipl_info.fcp.bootprog); 762 reipl_block_fcp->ipl_info.fcp.bootprog);
@@ -1323,9 +1323,9 @@ static struct shutdown_action __refdata reipl_action = {
1323 1323
1324/* FCP dump device attributes */ 1324/* FCP dump device attributes */
1325 1325
1326DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%016llx\n", 1326DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%llx\n",
1327 dump_block_fcp->ipl_info.fcp.wwpn); 1327 dump_block_fcp->ipl_info.fcp.wwpn);
1328DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%016llx\n", 1328DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%llx\n",
1329 dump_block_fcp->ipl_info.fcp.lun); 1329 dump_block_fcp->ipl_info.fcp.lun);
1330DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n", 1330DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n",
1331 dump_block_fcp->ipl_info.fcp.bootprog); 1331 dump_block_fcp->ipl_info.fcp.bootprog);
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index f7fb58903f6a..54b0995514e8 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -234,9 +234,9 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
234} 234}
235EXPORT_SYMBOL(unregister_external_interrupt); 235EXPORT_SYMBOL(unregister_external_interrupt);
236 236
237void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code, 237void __irq_entry do_extint(struct pt_regs *regs)
238 unsigned int param32, unsigned long param64)
239{ 238{
239 struct ext_code ext_code;
240 struct pt_regs *old_regs; 240 struct pt_regs *old_regs;
241 struct ext_int_info *p; 241 struct ext_int_info *p;
242 int index; 242 int index;
@@ -248,6 +248,7 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
248 clock_comparator_work(); 248 clock_comparator_work();
249 } 249 }
250 kstat_incr_irqs_this_cpu(EXTERNAL_INTERRUPT, NULL); 250 kstat_incr_irqs_this_cpu(EXTERNAL_INTERRUPT, NULL);
251 ext_code = *(struct ext_code *) &regs->int_code;
251 if (ext_code.code != 0x1004) 252 if (ext_code.code != 0x1004)
252 __get_cpu_var(s390_idle).nohz_delay = 1; 253 __get_cpu_var(s390_idle).nohz_delay = 1;
253 254
@@ -255,7 +256,8 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
255 rcu_read_lock(); 256 rcu_read_lock();
256 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) 257 list_for_each_entry_rcu(p, &ext_int_hash[index], entry)
257 if (likely(p->code == ext_code.code)) 258 if (likely(p->code == ext_code.code))
258 p->handler(ext_code, param32, param64); 259 p->handler(ext_code, regs->int_parm,
260 regs->int_parm_long);
259 rcu_read_unlock(); 261 rcu_read_unlock();
260 irq_exit(); 262 irq_exit();
261 set_irq_regs(old_regs); 263 set_irq_regs(old_regs);
@@ -311,3 +313,69 @@ void measurement_alert_subclass_unregister(void)
311 spin_unlock(&ma_subclass_lock); 313 spin_unlock(&ma_subclass_lock);
312} 314}
313EXPORT_SYMBOL(measurement_alert_subclass_unregister); 315EXPORT_SYMBOL(measurement_alert_subclass_unregister);
316
317#ifdef CONFIG_SMP
318void synchronize_irq(unsigned int irq)
319{
320 /*
321 * Not needed, the handler is protected by a lock and IRQs that occur
322 * after the handler is deleted are just NOPs.
323 */
324}
325EXPORT_SYMBOL_GPL(synchronize_irq);
326#endif
327
328#ifndef CONFIG_PCI
329
330/* Only PCI devices have dynamically-defined IRQ handlers */
331
332int request_irq(unsigned int irq, irq_handler_t handler,
333 unsigned long irqflags, const char *devname, void *dev_id)
334{
335 return -EINVAL;
336}
337EXPORT_SYMBOL_GPL(request_irq);
338
339void free_irq(unsigned int irq, void *dev_id)
340{
341 WARN_ON(1);
342}
343EXPORT_SYMBOL_GPL(free_irq);
344
345void enable_irq(unsigned int irq)
346{
347 WARN_ON(1);
348}
349EXPORT_SYMBOL_GPL(enable_irq);
350
351void disable_irq(unsigned int irq)
352{
353 WARN_ON(1);
354}
355EXPORT_SYMBOL_GPL(disable_irq);
356
357#endif /* !CONFIG_PCI */
358
359void disable_irq_nosync(unsigned int irq)
360{
361 disable_irq(irq);
362}
363EXPORT_SYMBOL_GPL(disable_irq_nosync);
364
365unsigned long probe_irq_on(void)
366{
367 return 0;
368}
369EXPORT_SYMBOL_GPL(probe_irq_on);
370
371int probe_irq_off(unsigned long val)
372{
373 return 0;
374}
375EXPORT_SYMBOL_GPL(probe_irq_off);
376
377unsigned int probe_irq_mask(unsigned long val)
378{
379 return val;
380}
381EXPORT_SYMBOL_GPL(probe_irq_mask);
diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c
index f58f37f66824..a6fc037671b1 100644
--- a/arch/s390/kernel/perf_event.c
+++ b/arch/s390/kernel/perf_event.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/perf_event.h> 15#include <linux/perf_event.h>
16#include <linux/kvm_host.h>
16#include <linux/percpu.h> 17#include <linux/percpu.h>
17#include <linux/export.h> 18#include <linux/export.h>
18#include <asm/irq.h> 19#include <asm/irq.h>
@@ -39,6 +40,57 @@ int perf_num_counters(void)
39} 40}
40EXPORT_SYMBOL(perf_num_counters); 41EXPORT_SYMBOL(perf_num_counters);
41 42
43static struct kvm_s390_sie_block *sie_block(struct pt_regs *regs)
44{
45 struct stack_frame *stack = (struct stack_frame *) regs->gprs[15];
46
47 if (!stack)
48 return NULL;
49
50 return (struct kvm_s390_sie_block *) stack->empty1[0];
51}
52
53static bool is_in_guest(struct pt_regs *regs)
54{
55 unsigned long ip = instruction_pointer(regs);
56
57 if (user_mode(regs))
58 return false;
59
60 return ip == (unsigned long) &sie_exit;
61}
62
63static unsigned long guest_is_user_mode(struct pt_regs *regs)
64{
65 return sie_block(regs)->gpsw.mask & PSW_MASK_PSTATE;
66}
67
68static unsigned long instruction_pointer_guest(struct pt_regs *regs)
69{
70 return sie_block(regs)->gpsw.addr & PSW_ADDR_INSN;
71}
72
73unsigned long perf_instruction_pointer(struct pt_regs *regs)
74{
75 return is_in_guest(regs) ? instruction_pointer_guest(regs)
76 : instruction_pointer(regs);
77}
78
79static unsigned long perf_misc_guest_flags(struct pt_regs *regs)
80{
81 return guest_is_user_mode(regs) ? PERF_RECORD_MISC_GUEST_USER
82 : PERF_RECORD_MISC_GUEST_KERNEL;
83}
84
85unsigned long perf_misc_flags(struct pt_regs *regs)
86{
87 if (is_in_guest(regs))
88 return perf_misc_guest_flags(regs);
89
90 return user_mode(regs) ? PERF_RECORD_MISC_USER
91 : PERF_RECORD_MISC_KERNEL;
92}
93
42void perf_event_print_debug(void) 94void perf_event_print_debug(void)
43{ 95{
44 struct cpumf_ctr_info cf_info; 96 struct cpumf_ctr_info cf_info;
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index 9bdbcef1da9e..3bac589844a7 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -7,6 +7,7 @@ EXPORT_SYMBOL(_mcount);
7#endif 7#endif
8#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE) 8#if defined(CONFIG_KVM) || defined(CONFIG_KVM_MODULE)
9EXPORT_SYMBOL(sie64a); 9EXPORT_SYMBOL(sie64a);
10EXPORT_SYMBOL(sie_exit);
10#endif 11#endif
11EXPORT_SYMBOL(memcpy); 12EXPORT_SYMBOL(memcpy);
12EXPORT_SYMBOL(memset); 13EXPORT_SYMBOL(memset);
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index b6506ee32a36..29bd7bec4176 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -225,7 +225,7 @@ _sclp_print:
225 ahi %r2,1 225 ahi %r2,1
226 ltr %r0,%r0 # end of string? 226 ltr %r0,%r0 # end of string?
227 jz .LfinalizemtoS4 227 jz .LfinalizemtoS4
228 chi %r0,0x15 # end of line (NL)? 228 chi %r0,0x0a # end of line (NL)?
229 jz .LfinalizemtoS4 229 jz .LfinalizemtoS4
230 stc %r0,0(%r6,%r7) # copy to mto 230 stc %r0,0(%r6,%r7) # copy to mto
231 la %r11,0(%r6,%r7) 231 la %r11,0(%r6,%r7)
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 0a49095104c9..497451ec5e26 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -719,10 +719,6 @@ static void reserve_oldmem(void)
719 } 719 }
720 create_mem_hole(memory_chunk, OLDMEM_BASE, OLDMEM_SIZE); 720 create_mem_hole(memory_chunk, OLDMEM_BASE, OLDMEM_SIZE);
721 create_mem_hole(memory_chunk, OLDMEM_SIZE, real_size - OLDMEM_SIZE); 721 create_mem_hole(memory_chunk, OLDMEM_SIZE, real_size - OLDMEM_SIZE);
722 if (OLDMEM_BASE + OLDMEM_SIZE == real_size)
723 saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1;
724 else
725 saved_max_pfn = PFN_DOWN(real_size) - 1;
726#endif 722#endif
727} 723}
728 724
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 4f977d0d25c2..15a016c10563 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -49,7 +49,6 @@
49 49
50enum { 50enum {
51 ec_schedule = 0, 51 ec_schedule = 0,
52 ec_call_function,
53 ec_call_function_single, 52 ec_call_function_single,
54 ec_stop_cpu, 53 ec_stop_cpu,
55}; 54};
@@ -438,8 +437,6 @@ static void smp_handle_ext_call(void)
438 smp_stop_cpu(); 437 smp_stop_cpu();
439 if (test_bit(ec_schedule, &bits)) 438 if (test_bit(ec_schedule, &bits))
440 scheduler_ipi(); 439 scheduler_ipi();
441 if (test_bit(ec_call_function, &bits))
442 generic_smp_call_function_interrupt();
443 if (test_bit(ec_call_function_single, &bits)) 440 if (test_bit(ec_call_function_single, &bits))
444 generic_smp_call_function_single_interrupt(); 441 generic_smp_call_function_single_interrupt();
445} 442}
@@ -456,7 +453,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
456 int cpu; 453 int cpu;
457 454
458 for_each_cpu(cpu, mask) 455 for_each_cpu(cpu, mask)
459 pcpu_ec_call(pcpu_devices + cpu, ec_call_function); 456 pcpu_ec_call(pcpu_devices + cpu, ec_call_function_single);
460} 457}
461 458
462void arch_send_call_function_single_ipi(int cpu) 459void arch_send_call_function_single_ipi(int cpu)
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index 8fe9d65a4585..40b4c6470f88 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -6,7 +6,8 @@
6# it under the terms of the GNU General Public License (version 2 only) 6# it under the terms of the GNU General Public License (version 2 only)
7# as published by the Free Software Foundation. 7# as published by the Free Software Foundation.
8 8
9common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o eventfd.o) 9KVM := ../../../virt/kvm
10common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o
10 11
11ccflags-y := -Ivirt/kvm -Iarch/s390/kvm 12ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
12 13
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 1c01a9912989..3074475c8ae0 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -132,6 +132,9 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
132{ 132{
133 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; 133 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16;
134 134
135 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
136 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
137
135 trace_kvm_s390_handle_diag(vcpu, code); 138 trace_kvm_s390_handle_diag(vcpu, code);
136 switch (code) { 139 switch (code) {
137 case 0x10: 140 case 0x10:
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index b7d1b2edeeb3..5ee56e5acc23 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -22,87 +22,6 @@
22#include "trace.h" 22#include "trace.h"
23#include "trace-s390.h" 23#include "trace-s390.h"
24 24
25static int handle_lctlg(struct kvm_vcpu *vcpu)
26{
27 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
28 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
29 u64 useraddr;
30 int reg, rc;
31
32 vcpu->stat.instruction_lctlg++;
33
34 useraddr = kvm_s390_get_base_disp_rsy(vcpu);
35
36 if (useraddr & 7)
37 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
38
39 reg = reg1;
40
41 VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x, addr:%llx", reg1, reg3,
42 useraddr);
43 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr);
44
45 do {
46 rc = get_guest(vcpu, vcpu->arch.sie_block->gcr[reg],
47 (u64 __user *) useraddr);
48 if (rc)
49 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
50 useraddr += 8;
51 if (reg == reg3)
52 break;
53 reg = (reg + 1) % 16;
54 } while (1);
55 return 0;
56}
57
58static int handle_lctl(struct kvm_vcpu *vcpu)
59{
60 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
61 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
62 u64 useraddr;
63 u32 val = 0;
64 int reg, rc;
65
66 vcpu->stat.instruction_lctl++;
67
68 useraddr = kvm_s390_get_base_disp_rs(vcpu);
69
70 if (useraddr & 3)
71 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
72
73 VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x, addr:%llx", reg1, reg3,
74 useraddr);
75 trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, useraddr);
76
77 reg = reg1;
78 do {
79 rc = get_guest(vcpu, val, (u32 __user *) useraddr);
80 if (rc)
81 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
82 vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul;
83 vcpu->arch.sie_block->gcr[reg] |= val;
84 useraddr += 4;
85 if (reg == reg3)
86 break;
87 reg = (reg + 1) % 16;
88 } while (1);
89 return 0;
90}
91
92static const intercept_handler_t eb_handlers[256] = {
93 [0x2f] = handle_lctlg,
94 [0x8a] = kvm_s390_handle_priv_eb,
95};
96
97static int handle_eb(struct kvm_vcpu *vcpu)
98{
99 intercept_handler_t handler;
100
101 handler = eb_handlers[vcpu->arch.sie_block->ipb & 0xff];
102 if (handler)
103 return handler(vcpu);
104 return -EOPNOTSUPP;
105}
106 25
107static const intercept_handler_t instruction_handlers[256] = { 26static const intercept_handler_t instruction_handlers[256] = {
108 [0x01] = kvm_s390_handle_01, 27 [0x01] = kvm_s390_handle_01,
@@ -110,10 +29,10 @@ static const intercept_handler_t instruction_handlers[256] = {
110 [0x83] = kvm_s390_handle_diag, 29 [0x83] = kvm_s390_handle_diag,
111 [0xae] = kvm_s390_handle_sigp, 30 [0xae] = kvm_s390_handle_sigp,
112 [0xb2] = kvm_s390_handle_b2, 31 [0xb2] = kvm_s390_handle_b2,
113 [0xb7] = handle_lctl, 32 [0xb7] = kvm_s390_handle_lctl,
114 [0xb9] = kvm_s390_handle_b9, 33 [0xb9] = kvm_s390_handle_b9,
115 [0xe5] = kvm_s390_handle_e5, 34 [0xe5] = kvm_s390_handle_e5,
116 [0xeb] = handle_eb, 35 [0xeb] = kvm_s390_handle_eb,
117}; 36};
118 37
119static int handle_noop(struct kvm_vcpu *vcpu) 38static int handle_noop(struct kvm_vcpu *vcpu)
@@ -174,47 +93,12 @@ static int handle_stop(struct kvm_vcpu *vcpu)
174 93
175static int handle_validity(struct kvm_vcpu *vcpu) 94static int handle_validity(struct kvm_vcpu *vcpu)
176{ 95{
177 unsigned long vmaddr;
178 int viwhy = vcpu->arch.sie_block->ipb >> 16; 96 int viwhy = vcpu->arch.sie_block->ipb >> 16;
179 int rc;
180 97
181 vcpu->stat.exit_validity++; 98 vcpu->stat.exit_validity++;
182 trace_kvm_s390_intercept_validity(vcpu, viwhy); 99 trace_kvm_s390_intercept_validity(vcpu, viwhy);
183 if (viwhy == 0x37) { 100 WARN_ONCE(true, "kvm: unhandled validity intercept 0x%x\n", viwhy);
184 vmaddr = gmap_fault(vcpu->arch.sie_block->prefix, 101 return -EOPNOTSUPP;
185 vcpu->arch.gmap);
186 if (IS_ERR_VALUE(vmaddr)) {
187 rc = -EOPNOTSUPP;
188 goto out;
189 }
190 rc = fault_in_pages_writeable((char __user *) vmaddr,
191 PAGE_SIZE);
192 if (rc) {
193 /* user will receive sigsegv, exit to user */
194 rc = -EOPNOTSUPP;
195 goto out;
196 }
197 vmaddr = gmap_fault(vcpu->arch.sie_block->prefix + PAGE_SIZE,
198 vcpu->arch.gmap);
199 if (IS_ERR_VALUE(vmaddr)) {
200 rc = -EOPNOTSUPP;
201 goto out;
202 }
203 rc = fault_in_pages_writeable((char __user *) vmaddr,
204 PAGE_SIZE);
205 if (rc) {
206 /* user will receive sigsegv, exit to user */
207 rc = -EOPNOTSUPP;
208 goto out;
209 }
210 } else
211 rc = -EOPNOTSUPP;
212
213out:
214 if (rc)
215 VCPU_EVENT(vcpu, 2, "unhandled validity intercept code %d",
216 viwhy);
217 return rc;
218} 102}
219 103
220static int handle_instruction(struct kvm_vcpu *vcpu) 104static int handle_instruction(struct kvm_vcpu *vcpu)
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 5c948177529e..7f35cb33e510 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -438,7 +438,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
438no_timer: 438no_timer:
439 spin_lock(&vcpu->arch.local_int.float_int->lock); 439 spin_lock(&vcpu->arch.local_int.float_int->lock);
440 spin_lock_bh(&vcpu->arch.local_int.lock); 440 spin_lock_bh(&vcpu->arch.local_int.lock);
441 add_wait_queue(&vcpu->arch.local_int.wq, &wait); 441 add_wait_queue(&vcpu->wq, &wait);
442 while (list_empty(&vcpu->arch.local_int.list) && 442 while (list_empty(&vcpu->arch.local_int.list) &&
443 list_empty(&vcpu->arch.local_int.float_int->list) && 443 list_empty(&vcpu->arch.local_int.float_int->list) &&
444 (!vcpu->arch.local_int.timer_due) && 444 (!vcpu->arch.local_int.timer_due) &&
@@ -452,7 +452,7 @@ no_timer:
452 } 452 }
453 __unset_cpu_idle(vcpu); 453 __unset_cpu_idle(vcpu);
454 __set_current_state(TASK_RUNNING); 454 __set_current_state(TASK_RUNNING);
455 remove_wait_queue(&vcpu->arch.local_int.wq, &wait); 455 remove_wait_queue(&vcpu->wq, &wait);
456 spin_unlock_bh(&vcpu->arch.local_int.lock); 456 spin_unlock_bh(&vcpu->arch.local_int.lock);
457 spin_unlock(&vcpu->arch.local_int.float_int->lock); 457 spin_unlock(&vcpu->arch.local_int.float_int->lock);
458 hrtimer_try_to_cancel(&vcpu->arch.ckc_timer); 458 hrtimer_try_to_cancel(&vcpu->arch.ckc_timer);
@@ -465,8 +465,8 @@ void kvm_s390_tasklet(unsigned long parm)
465 465
466 spin_lock(&vcpu->arch.local_int.lock); 466 spin_lock(&vcpu->arch.local_int.lock);
467 vcpu->arch.local_int.timer_due = 1; 467 vcpu->arch.local_int.timer_due = 1;
468 if (waitqueue_active(&vcpu->arch.local_int.wq)) 468 if (waitqueue_active(&vcpu->wq))
469 wake_up_interruptible(&vcpu->arch.local_int.wq); 469 wake_up_interruptible(&vcpu->wq);
470 spin_unlock(&vcpu->arch.local_int.lock); 470 spin_unlock(&vcpu->arch.local_int.lock);
471} 471}
472 472
@@ -613,7 +613,7 @@ int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
613 spin_lock_bh(&li->lock); 613 spin_lock_bh(&li->lock);
614 list_add(&inti->list, &li->list); 614 list_add(&inti->list, &li->list);
615 atomic_set(&li->active, 1); 615 atomic_set(&li->active, 1);
616 BUG_ON(waitqueue_active(&li->wq)); 616 BUG_ON(waitqueue_active(li->wq));
617 spin_unlock_bh(&li->lock); 617 spin_unlock_bh(&li->lock);
618 return 0; 618 return 0;
619} 619}
@@ -746,8 +746,8 @@ int kvm_s390_inject_vm(struct kvm *kvm,
746 li = fi->local_int[sigcpu]; 746 li = fi->local_int[sigcpu];
747 spin_lock_bh(&li->lock); 747 spin_lock_bh(&li->lock);
748 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); 748 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
749 if (waitqueue_active(&li->wq)) 749 if (waitqueue_active(li->wq))
750 wake_up_interruptible(&li->wq); 750 wake_up_interruptible(li->wq);
751 spin_unlock_bh(&li->lock); 751 spin_unlock_bh(&li->lock);
752 spin_unlock(&fi->lock); 752 spin_unlock(&fi->lock);
753 mutex_unlock(&kvm->lock); 753 mutex_unlock(&kvm->lock);
@@ -832,8 +832,8 @@ int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
832 if (inti->type == KVM_S390_SIGP_STOP) 832 if (inti->type == KVM_S390_SIGP_STOP)
833 li->action_bits |= ACTION_STOP_ON_STOP; 833 li->action_bits |= ACTION_STOP_ON_STOP;
834 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); 834 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
835 if (waitqueue_active(&li->wq)) 835 if (waitqueue_active(&vcpu->wq))
836 wake_up_interruptible(&vcpu->arch.local_int.wq); 836 wake_up_interruptible(&vcpu->wq);
837 spin_unlock_bh(&li->lock); 837 spin_unlock_bh(&li->lock);
838 mutex_unlock(&vcpu->kvm->lock); 838 mutex_unlock(&vcpu->kvm->lock);
839 return 0; 839 return 0;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c1c7c683fa26..ba694d2ba51e 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -59,6 +59,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
59 { "deliver_restart_signal", VCPU_STAT(deliver_restart_signal) }, 59 { "deliver_restart_signal", VCPU_STAT(deliver_restart_signal) },
60 { "deliver_program_interruption", VCPU_STAT(deliver_program_int) }, 60 { "deliver_program_interruption", VCPU_STAT(deliver_program_int) },
61 { "exit_wait_state", VCPU_STAT(exit_wait_state) }, 61 { "exit_wait_state", VCPU_STAT(exit_wait_state) },
62 { "instruction_pfmf", VCPU_STAT(instruction_pfmf) },
62 { "instruction_stidp", VCPU_STAT(instruction_stidp) }, 63 { "instruction_stidp", VCPU_STAT(instruction_stidp) },
63 { "instruction_spx", VCPU_STAT(instruction_spx) }, 64 { "instruction_spx", VCPU_STAT(instruction_spx) },
64 { "instruction_stpx", VCPU_STAT(instruction_stpx) }, 65 { "instruction_stpx", VCPU_STAT(instruction_stpx) },
@@ -84,6 +85,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
84}; 85};
85 86
86static unsigned long long *facilities; 87static unsigned long long *facilities;
88static struct gmap_notifier gmap_notifier;
87 89
88/* Section: not file related */ 90/* Section: not file related */
89int kvm_arch_hardware_enable(void *garbage) 91int kvm_arch_hardware_enable(void *garbage)
@@ -96,13 +98,18 @@ void kvm_arch_hardware_disable(void *garbage)
96{ 98{
97} 99}
98 100
101static void kvm_gmap_notifier(struct gmap *gmap, unsigned long address);
102
99int kvm_arch_hardware_setup(void) 103int kvm_arch_hardware_setup(void)
100{ 104{
105 gmap_notifier.notifier_call = kvm_gmap_notifier;
106 gmap_register_ipte_notifier(&gmap_notifier);
101 return 0; 107 return 0;
102} 108}
103 109
104void kvm_arch_hardware_unsetup(void) 110void kvm_arch_hardware_unsetup(void)
105{ 111{
112 gmap_unregister_ipte_notifier(&gmap_notifier);
106} 113}
107 114
108void kvm_arch_check_processor_compat(void *rtn) 115void kvm_arch_check_processor_compat(void *rtn)
@@ -239,6 +246,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
239 kvm->arch.gmap = gmap_alloc(current->mm); 246 kvm->arch.gmap = gmap_alloc(current->mm);
240 if (!kvm->arch.gmap) 247 if (!kvm->arch.gmap)
241 goto out_nogmap; 248 goto out_nogmap;
249 kvm->arch.gmap->private = kvm;
242 } 250 }
243 251
244 kvm->arch.css_support = 0; 252 kvm->arch.css_support = 0;
@@ -270,7 +278,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
270 278
271 free_page((unsigned long)(vcpu->arch.sie_block)); 279 free_page((unsigned long)(vcpu->arch.sie_block));
272 kvm_vcpu_uninit(vcpu); 280 kvm_vcpu_uninit(vcpu);
273 kfree(vcpu); 281 kmem_cache_free(kvm_vcpu_cache, vcpu);
274} 282}
275 283
276static void kvm_free_vcpus(struct kvm *kvm) 284static void kvm_free_vcpus(struct kvm *kvm)
@@ -309,6 +317,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
309 vcpu->arch.gmap = gmap_alloc(current->mm); 317 vcpu->arch.gmap = gmap_alloc(current->mm);
310 if (!vcpu->arch.gmap) 318 if (!vcpu->arch.gmap)
311 return -ENOMEM; 319 return -ENOMEM;
320 vcpu->arch.gmap->private = vcpu->kvm;
312 return 0; 321 return 0;
313 } 322 }
314 323
@@ -373,8 +382,10 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
373{ 382{
374 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | 383 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH |
375 CPUSTAT_SM | 384 CPUSTAT_SM |
376 CPUSTAT_STOPPED); 385 CPUSTAT_STOPPED |
386 CPUSTAT_GED);
377 vcpu->arch.sie_block->ecb = 6; 387 vcpu->arch.sie_block->ecb = 6;
388 vcpu->arch.sie_block->ecb2 = 8;
378 vcpu->arch.sie_block->eca = 0xC1002001U; 389 vcpu->arch.sie_block->eca = 0xC1002001U;
379 vcpu->arch.sie_block->fac = (int) (long) facilities; 390 vcpu->arch.sie_block->fac = (int) (long) facilities;
380 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 391 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
@@ -397,7 +408,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
397 408
398 rc = -ENOMEM; 409 rc = -ENOMEM;
399 410
400 vcpu = kzalloc(sizeof(struct kvm_vcpu), GFP_KERNEL); 411 vcpu = kmem_cache_zalloc(kvm_vcpu_cache, GFP_KERNEL);
401 if (!vcpu) 412 if (!vcpu)
402 goto out; 413 goto out;
403 414
@@ -427,7 +438,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
427 vcpu->arch.local_int.float_int = &kvm->arch.float_int; 438 vcpu->arch.local_int.float_int = &kvm->arch.float_int;
428 spin_lock(&kvm->arch.float_int.lock); 439 spin_lock(&kvm->arch.float_int.lock);
429 kvm->arch.float_int.local_int[id] = &vcpu->arch.local_int; 440 kvm->arch.float_int.local_int[id] = &vcpu->arch.local_int;
430 init_waitqueue_head(&vcpu->arch.local_int.wq); 441 vcpu->arch.local_int.wq = &vcpu->wq;
431 vcpu->arch.local_int.cpuflags = &vcpu->arch.sie_block->cpuflags; 442 vcpu->arch.local_int.cpuflags = &vcpu->arch.sie_block->cpuflags;
432 spin_unlock(&kvm->arch.float_int.lock); 443 spin_unlock(&kvm->arch.float_int.lock);
433 444
@@ -442,7 +453,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
442out_free_sie_block: 453out_free_sie_block:
443 free_page((unsigned long)(vcpu->arch.sie_block)); 454 free_page((unsigned long)(vcpu->arch.sie_block));
444out_free_cpu: 455out_free_cpu:
445 kfree(vcpu); 456 kmem_cache_free(kvm_vcpu_cache, vcpu);
446out: 457out:
447 return ERR_PTR(rc); 458 return ERR_PTR(rc);
448} 459}
@@ -454,6 +465,50 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
454 return 0; 465 return 0;
455} 466}
456 467
468void s390_vcpu_block(struct kvm_vcpu *vcpu)
469{
470 atomic_set_mask(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20);
471}
472
473void s390_vcpu_unblock(struct kvm_vcpu *vcpu)
474{
475 atomic_clear_mask(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20);
476}
477
478/*
479 * Kick a guest cpu out of SIE and wait until SIE is not running.
480 * If the CPU is not running (e.g. waiting as idle) the function will
481 * return immediately. */
482void exit_sie(struct kvm_vcpu *vcpu)
483{
484 atomic_set_mask(CPUSTAT_STOP_INT, &vcpu->arch.sie_block->cpuflags);
485 while (vcpu->arch.sie_block->prog0c & PROG_IN_SIE)
486 cpu_relax();
487}
488
489/* Kick a guest cpu out of SIE and prevent SIE-reentry */
490void exit_sie_sync(struct kvm_vcpu *vcpu)
491{
492 s390_vcpu_block(vcpu);
493 exit_sie(vcpu);
494}
495
496static void kvm_gmap_notifier(struct gmap *gmap, unsigned long address)
497{
498 int i;
499 struct kvm *kvm = gmap->private;
500 struct kvm_vcpu *vcpu;
501
502 kvm_for_each_vcpu(i, vcpu, kvm) {
503 /* match against both prefix pages */
504 if (vcpu->arch.sie_block->prefix == (address & ~0x1000UL)) {
505 VCPU_EVENT(vcpu, 2, "gmap notifier for %lx", address);
506 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
507 exit_sie_sync(vcpu);
508 }
509 }
510}
511
457int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) 512int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
458{ 513{
459 /* kvm common code refers to this, but never calls it */ 514 /* kvm common code refers to this, but never calls it */
@@ -606,6 +661,27 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
606 return -EINVAL; /* not implemented yet */ 661 return -EINVAL; /* not implemented yet */
607} 662}
608 663
664static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
665{
666 /*
667 * We use MMU_RELOAD just to re-arm the ipte notifier for the
668 * guest prefix page. gmap_ipte_notify will wait on the ptl lock.
669 * This ensures that the ipte instruction for this request has
670 * already finished. We might race against a second unmapper that
671 * wants to set the blocking bit. Lets just retry the request loop.
672 */
673 while (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) {
674 int rc;
675 rc = gmap_ipte_notify(vcpu->arch.gmap,
676 vcpu->arch.sie_block->prefix,
677 PAGE_SIZE * 2);
678 if (rc)
679 return rc;
680 s390_vcpu_unblock(vcpu);
681 }
682 return 0;
683}
684
609static int __vcpu_run(struct kvm_vcpu *vcpu) 685static int __vcpu_run(struct kvm_vcpu *vcpu)
610{ 686{
611 int rc; 687 int rc;
@@ -621,6 +697,10 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
621 if (!kvm_is_ucontrol(vcpu->kvm)) 697 if (!kvm_is_ucontrol(vcpu->kvm))
622 kvm_s390_deliver_pending_interrupts(vcpu); 698 kvm_s390_deliver_pending_interrupts(vcpu);
623 699
700 rc = kvm_s390_handle_requests(vcpu);
701 if (rc)
702 return rc;
703
624 vcpu->arch.sie_block->icptcode = 0; 704 vcpu->arch.sie_block->icptcode = 0;
625 preempt_disable(); 705 preempt_disable();
626 kvm_guest_enter(); 706 kvm_guest_enter();
@@ -630,7 +710,9 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
630 trace_kvm_s390_sie_enter(vcpu, 710 trace_kvm_s390_sie_enter(vcpu,
631 atomic_read(&vcpu->arch.sie_block->cpuflags)); 711 atomic_read(&vcpu->arch.sie_block->cpuflags));
632 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs); 712 rc = sie64a(vcpu->arch.sie_block, vcpu->run->s.regs.gprs);
633 if (rc) { 713 if (rc > 0)
714 rc = 0;
715 if (rc < 0) {
634 if (kvm_is_ucontrol(vcpu->kvm)) { 716 if (kvm_is_ucontrol(vcpu->kvm)) {
635 rc = SIE_INTERCEPT_UCONTROL; 717 rc = SIE_INTERCEPT_UCONTROL;
636 } else { 718 } else {
@@ -1046,7 +1128,7 @@ static int __init kvm_s390_init(void)
1046 return -ENOMEM; 1128 return -ENOMEM;
1047 } 1129 }
1048 memcpy(facilities, S390_lowcore.stfle_fac_list, 16); 1130 memcpy(facilities, S390_lowcore.stfle_fac_list, 16);
1049 facilities[0] &= 0xff00fff3f47c0000ULL; 1131 facilities[0] &= 0xff82fff3f47c0000ULL;
1050 facilities[1] &= 0x001c000000000000ULL; 1132 facilities[1] &= 0x001c000000000000ULL;
1051 return 0; 1133 return 0;
1052} 1134}
@@ -1059,3 +1141,12 @@ static void __exit kvm_s390_exit(void)
1059 1141
1060module_init(kvm_s390_init); 1142module_init(kvm_s390_init);
1061module_exit(kvm_s390_exit); 1143module_exit(kvm_s390_exit);
1144
1145/*
1146 * Enable autoloading of the kvm module.
1147 * Note that we add the module alias here instead of virt/kvm/kvm_main.c
1148 * since x86 takes a different approach.
1149 */
1150#include <linux/miscdevice.h>
1151MODULE_ALIAS_MISCDEV(KVM_MINOR);
1152MODULE_ALIAS("devname:kvm");
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index efc14f687265..028ca9fd2158 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -63,6 +63,7 @@ static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix)
63{ 63{
64 vcpu->arch.sie_block->prefix = prefix & 0x7fffe000u; 64 vcpu->arch.sie_block->prefix = prefix & 0x7fffe000u;
65 vcpu->arch.sie_block->ihcpu = 0xffff; 65 vcpu->arch.sie_block->ihcpu = 0xffff;
66 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
66} 67}
67 68
68static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu) 69static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu)
@@ -85,6 +86,12 @@ static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu,
85 *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; 86 *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
86} 87}
87 88
89static inline void kvm_s390_get_regs_rre(struct kvm_vcpu *vcpu, int *r1, int *r2)
90{
91 *r1 = (vcpu->arch.sie_block->ipb & 0x00f00000) >> 20;
92 *r2 = (vcpu->arch.sie_block->ipb & 0x000f0000) >> 16;
93}
94
88static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu) 95static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu)
89{ 96{
90 u32 base2 = vcpu->arch.sie_block->ipb >> 28; 97 u32 base2 = vcpu->arch.sie_block->ipb >> 28;
@@ -125,7 +132,8 @@ int kvm_s390_handle_e5(struct kvm_vcpu *vcpu);
125int kvm_s390_handle_01(struct kvm_vcpu *vcpu); 132int kvm_s390_handle_01(struct kvm_vcpu *vcpu);
126int kvm_s390_handle_b9(struct kvm_vcpu *vcpu); 133int kvm_s390_handle_b9(struct kvm_vcpu *vcpu);
127int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu); 134int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu);
128int kvm_s390_handle_priv_eb(struct kvm_vcpu *vcpu); 135int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu);
136int kvm_s390_handle_eb(struct kvm_vcpu *vcpu);
129 137
130/* implemented in sigp.c */ 138/* implemented in sigp.c */
131int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu); 139int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu);
@@ -133,6 +141,10 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu);
133/* implemented in kvm-s390.c */ 141/* implemented in kvm-s390.c */
134int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, 142int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu,
135 unsigned long addr); 143 unsigned long addr);
144void s390_vcpu_block(struct kvm_vcpu *vcpu);
145void s390_vcpu_unblock(struct kvm_vcpu *vcpu);
146void exit_sie(struct kvm_vcpu *vcpu);
147void exit_sie_sync(struct kvm_vcpu *vcpu);
136/* implemented in diag.c */ 148/* implemented in diag.c */
137int kvm_s390_handle_diag(struct kvm_vcpu *vcpu); 149int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
138 150
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 6bbd7b5a0bbe..0da3e6eb6be6 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * handling privileged instructions 2 * handling privileged instructions
3 * 3 *
4 * Copyright IBM Corp. 2008 4 * Copyright IBM Corp. 2008, 2013
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only) 7 * it under the terms of the GNU General Public License (version 2 only)
@@ -20,6 +20,9 @@
20#include <asm/debug.h> 20#include <asm/debug.h>
21#include <asm/ebcdic.h> 21#include <asm/ebcdic.h>
22#include <asm/sysinfo.h> 22#include <asm/sysinfo.h>
23#include <asm/pgtable.h>
24#include <asm/pgalloc.h>
25#include <asm/io.h>
23#include <asm/ptrace.h> 26#include <asm/ptrace.h>
24#include <asm/compat.h> 27#include <asm/compat.h>
25#include "gaccess.h" 28#include "gaccess.h"
@@ -34,6 +37,9 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu)
34 37
35 vcpu->stat.instruction_spx++; 38 vcpu->stat.instruction_spx++;
36 39
40 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
41 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
42
37 operand2 = kvm_s390_get_base_disp_s(vcpu); 43 operand2 = kvm_s390_get_base_disp_s(vcpu);
38 44
39 /* must be word boundary */ 45 /* must be word boundary */
@@ -65,6 +71,9 @@ static int handle_store_prefix(struct kvm_vcpu *vcpu)
65 71
66 vcpu->stat.instruction_stpx++; 72 vcpu->stat.instruction_stpx++;
67 73
74 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
75 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
76
68 operand2 = kvm_s390_get_base_disp_s(vcpu); 77 operand2 = kvm_s390_get_base_disp_s(vcpu);
69 78
70 /* must be word boundary */ 79 /* must be word boundary */
@@ -89,6 +98,9 @@ static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
89 98
90 vcpu->stat.instruction_stap++; 99 vcpu->stat.instruction_stap++;
91 100
101 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
102 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
103
92 useraddr = kvm_s390_get_base_disp_s(vcpu); 104 useraddr = kvm_s390_get_base_disp_s(vcpu);
93 105
94 if (useraddr & 1) 106 if (useraddr & 1)
@@ -105,7 +117,12 @@ static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
105static int handle_skey(struct kvm_vcpu *vcpu) 117static int handle_skey(struct kvm_vcpu *vcpu)
106{ 118{
107 vcpu->stat.instruction_storage_key++; 119 vcpu->stat.instruction_storage_key++;
108 vcpu->arch.sie_block->gpsw.addr -= 4; 120
121 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
122 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
123
124 vcpu->arch.sie_block->gpsw.addr =
125 __rewind_psw(vcpu->arch.sie_block->gpsw, 4);
109 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); 126 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");
110 return 0; 127 return 0;
111} 128}
@@ -129,9 +146,10 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
129 * Store the two-word I/O interruption code into the 146 * Store the two-word I/O interruption code into the
130 * provided area. 147 * provided area.
131 */ 148 */
132 put_guest(vcpu, inti->io.subchannel_id, (u16 __user *) addr); 149 if (put_guest(vcpu, inti->io.subchannel_id, (u16 __user *)addr)
133 put_guest(vcpu, inti->io.subchannel_nr, (u16 __user *) (addr + 2)); 150 || put_guest(vcpu, inti->io.subchannel_nr, (u16 __user *)(addr + 2))
134 put_guest(vcpu, inti->io.io_int_parm, (u32 __user *) (addr + 4)); 151 || put_guest(vcpu, inti->io.io_int_parm, (u32 __user *)(addr + 4)))
152 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
135 } else { 153 } else {
136 /* 154 /*
137 * Store the three-word I/O interruption code into 155 * Store the three-word I/O interruption code into
@@ -182,6 +200,9 @@ static int handle_io_inst(struct kvm_vcpu *vcpu)
182{ 200{
183 VCPU_EVENT(vcpu, 4, "%s", "I/O instruction"); 201 VCPU_EVENT(vcpu, 4, "%s", "I/O instruction");
184 202
203 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
204 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
205
185 if (vcpu->kvm->arch.css_support) { 206 if (vcpu->kvm->arch.css_support) {
186 /* 207 /*
187 * Most I/O instructions will be handled by userspace. 208 * Most I/O instructions will be handled by userspace.
@@ -210,8 +231,12 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
210 int rc; 231 int rc;
211 232
212 vcpu->stat.instruction_stfl++; 233 vcpu->stat.instruction_stfl++;
234
235 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
236 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
237
213 /* only pass the facility bits, which we can handle */ 238 /* only pass the facility bits, which we can handle */
214 facility_list = S390_lowcore.stfl_fac_list & 0xff00fff3; 239 facility_list = S390_lowcore.stfl_fac_list & 0xff82fff3;
215 240
216 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list), 241 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list),
217 &facility_list, sizeof(facility_list)); 242 &facility_list, sizeof(facility_list));
@@ -255,8 +280,8 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
255 u64 addr; 280 u64 addr;
256 281
257 if (gpsw->mask & PSW_MASK_PSTATE) 282 if (gpsw->mask & PSW_MASK_PSTATE)
258 return kvm_s390_inject_program_int(vcpu, 283 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
259 PGM_PRIVILEGED_OPERATION); 284
260 addr = kvm_s390_get_base_disp_s(vcpu); 285 addr = kvm_s390_get_base_disp_s(vcpu);
261 if (addr & 7) 286 if (addr & 7)
262 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 287 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
@@ -278,6 +303,9 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
278 psw_t new_psw; 303 psw_t new_psw;
279 u64 addr; 304 u64 addr;
280 305
306 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
307 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
308
281 addr = kvm_s390_get_base_disp_s(vcpu); 309 addr = kvm_s390_get_base_disp_s(vcpu);
282 if (addr & 7) 310 if (addr & 7)
283 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 311 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
@@ -296,6 +324,9 @@ static int handle_stidp(struct kvm_vcpu *vcpu)
296 324
297 vcpu->stat.instruction_stidp++; 325 vcpu->stat.instruction_stidp++;
298 326
327 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
328 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
329
299 operand2 = kvm_s390_get_base_disp_s(vcpu); 330 operand2 = kvm_s390_get_base_disp_s(vcpu);
300 331
301 if (operand2 & 7) 332 if (operand2 & 7)
@@ -351,16 +382,30 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
351 vcpu->stat.instruction_stsi++; 382 vcpu->stat.instruction_stsi++;
352 VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2); 383 VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2);
353 384
354 operand2 = kvm_s390_get_base_disp_s(vcpu); 385 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
386 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
387
388 if (fc > 3) {
389 vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; /* cc 3 */
390 return 0;
391 }
355 392
356 if (operand2 & 0xfff && fc > 0) 393 if (vcpu->run->s.regs.gprs[0] & 0x0fffff00
394 || vcpu->run->s.regs.gprs[1] & 0xffff0000)
357 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 395 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
358 396
359 switch (fc) { 397 if (fc == 0) {
360 case 0:
361 vcpu->run->s.regs.gprs[0] = 3 << 28; 398 vcpu->run->s.regs.gprs[0] = 3 << 28;
362 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); 399 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); /* cc 0 */
363 return 0; 400 return 0;
401 }
402
403 operand2 = kvm_s390_get_base_disp_s(vcpu);
404
405 if (operand2 & 0xfff)
406 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
407
408 switch (fc) {
364 case 1: /* same handling for 1 and 2 */ 409 case 1: /* same handling for 1 and 2 */
365 case 2: 410 case 2:
366 mem = get_zeroed_page(GFP_KERNEL); 411 mem = get_zeroed_page(GFP_KERNEL);
@@ -377,8 +422,6 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
377 goto out_no_data; 422 goto out_no_data;
378 handle_stsi_3_2_2(vcpu, (void *) mem); 423 handle_stsi_3_2_2(vcpu, (void *) mem);
379 break; 424 break;
380 default:
381 goto out_no_data;
382 } 425 }
383 426
384 if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) { 427 if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) {
@@ -432,20 +475,14 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu)
432 intercept_handler_t handler; 475 intercept_handler_t handler;
433 476
434 /* 477 /*
435 * a lot of B2 instructions are priviledged. We first check for 478 * A lot of B2 instructions are priviledged. Here we check for
436 * the privileged ones, that we can handle in the kernel. If the 479 * the privileged ones, that we can handle in the kernel.
437 * kernel can handle this instruction, we check for the problem 480 * Anything else goes to userspace.
438 * state bit and (a) handle the instruction or (b) send a code 2 481 */
439 * program check.
440 * Anything else goes to userspace.*/
441 handler = b2_handlers[vcpu->arch.sie_block->ipa & 0x00ff]; 482 handler = b2_handlers[vcpu->arch.sie_block->ipa & 0x00ff];
442 if (handler) { 483 if (handler)
443 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 484 return handler(vcpu);
444 return kvm_s390_inject_program_int(vcpu, 485
445 PGM_PRIVILEGED_OPERATION);
446 else
447 return handler(vcpu);
448 }
449 return -EOPNOTSUPP; 486 return -EOPNOTSUPP;
450} 487}
451 488
@@ -453,8 +490,7 @@ static int handle_epsw(struct kvm_vcpu *vcpu)
453{ 490{
454 int reg1, reg2; 491 int reg1, reg2;
455 492
456 reg1 = (vcpu->arch.sie_block->ipb & 0x00f00000) >> 24; 493 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
457 reg2 = (vcpu->arch.sie_block->ipb & 0x000f0000) >> 16;
458 494
459 /* This basically extracts the mask half of the psw. */ 495 /* This basically extracts the mask half of the psw. */
460 vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000; 496 vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000;
@@ -467,9 +503,88 @@ static int handle_epsw(struct kvm_vcpu *vcpu)
467 return 0; 503 return 0;
468} 504}
469 505
506#define PFMF_RESERVED 0xfffc0101UL
507#define PFMF_SK 0x00020000UL
508#define PFMF_CF 0x00010000UL
509#define PFMF_UI 0x00008000UL
510#define PFMF_FSC 0x00007000UL
511#define PFMF_NQ 0x00000800UL
512#define PFMF_MR 0x00000400UL
513#define PFMF_MC 0x00000200UL
514#define PFMF_KEY 0x000000feUL
515
516static int handle_pfmf(struct kvm_vcpu *vcpu)
517{
518 int reg1, reg2;
519 unsigned long start, end;
520
521 vcpu->stat.instruction_pfmf++;
522
523 kvm_s390_get_regs_rre(vcpu, &reg1, &reg2);
524
525 if (!MACHINE_HAS_PFMF)
526 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
527
528 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
529 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
530
531 if (vcpu->run->s.regs.gprs[reg1] & PFMF_RESERVED)
532 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
533
534 /* Only provide non-quiescing support if the host supports it */
535 if (vcpu->run->s.regs.gprs[reg1] & PFMF_NQ &&
536 S390_lowcore.stfl_fac_list & 0x00020000)
537 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
538
539 /* No support for conditional-SSKE */
540 if (vcpu->run->s.regs.gprs[reg1] & (PFMF_MR | PFMF_MC))
541 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
542
543 start = vcpu->run->s.regs.gprs[reg2] & PAGE_MASK;
544 switch (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC) {
545 case 0x00000000:
546 end = (start + (1UL << 12)) & ~((1UL << 12) - 1);
547 break;
548 case 0x00001000:
549 end = (start + (1UL << 20)) & ~((1UL << 20) - 1);
550 break;
551 /* We dont support EDAT2
552 case 0x00002000:
553 end = (start + (1UL << 31)) & ~((1UL << 31) - 1);
554 break;*/
555 default:
556 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
557 }
558 while (start < end) {
559 unsigned long useraddr;
560
561 useraddr = gmap_translate(start, vcpu->arch.gmap);
562 if (IS_ERR((void *)useraddr))
563 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
564
565 if (vcpu->run->s.regs.gprs[reg1] & PFMF_CF) {
566 if (clear_user((void __user *)useraddr, PAGE_SIZE))
567 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
568 }
569
570 if (vcpu->run->s.regs.gprs[reg1] & PFMF_SK) {
571 if (set_guest_storage_key(current->mm, useraddr,
572 vcpu->run->s.regs.gprs[reg1] & PFMF_KEY,
573 vcpu->run->s.regs.gprs[reg1] & PFMF_NQ))
574 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
575 }
576
577 start += PAGE_SIZE;
578 }
579 if (vcpu->run->s.regs.gprs[reg1] & PFMF_FSC)
580 vcpu->run->s.regs.gprs[reg2] = end;
581 return 0;
582}
583
470static const intercept_handler_t b9_handlers[256] = { 584static const intercept_handler_t b9_handlers[256] = {
471 [0x8d] = handle_epsw, 585 [0x8d] = handle_epsw,
472 [0x9c] = handle_io_inst, 586 [0x9c] = handle_io_inst,
587 [0xaf] = handle_pfmf,
473}; 588};
474 589
475int kvm_s390_handle_b9(struct kvm_vcpu *vcpu) 590int kvm_s390_handle_b9(struct kvm_vcpu *vcpu)
@@ -478,29 +593,96 @@ int kvm_s390_handle_b9(struct kvm_vcpu *vcpu)
478 593
479 /* This is handled just as for the B2 instructions. */ 594 /* This is handled just as for the B2 instructions. */
480 handler = b9_handlers[vcpu->arch.sie_block->ipa & 0x00ff]; 595 handler = b9_handlers[vcpu->arch.sie_block->ipa & 0x00ff];
481 if (handler) { 596 if (handler)
482 if ((handler != handle_epsw) && 597 return handler(vcpu);
483 (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)) 598
484 return kvm_s390_inject_program_int(vcpu,
485 PGM_PRIVILEGED_OPERATION);
486 else
487 return handler(vcpu);
488 }
489 return -EOPNOTSUPP; 599 return -EOPNOTSUPP;
490} 600}
491 601
602int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu)
603{
604 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
605 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
606 u64 useraddr;
607 u32 val = 0;
608 int reg, rc;
609
610 vcpu->stat.instruction_lctl++;
611
612 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
613 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
614
615 useraddr = kvm_s390_get_base_disp_rs(vcpu);
616
617 if (useraddr & 3)
618 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
619
620 VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x, addr:%llx", reg1, reg3,
621 useraddr);
622 trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, useraddr);
623
624 reg = reg1;
625 do {
626 rc = get_guest(vcpu, val, (u32 __user *) useraddr);
627 if (rc)
628 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
629 vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul;
630 vcpu->arch.sie_block->gcr[reg] |= val;
631 useraddr += 4;
632 if (reg == reg3)
633 break;
634 reg = (reg + 1) % 16;
635 } while (1);
636
637 return 0;
638}
639
640static int handle_lctlg(struct kvm_vcpu *vcpu)
641{
642 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
643 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
644 u64 useraddr;
645 int reg, rc;
646
647 vcpu->stat.instruction_lctlg++;
648
649 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
650 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
651
652 useraddr = kvm_s390_get_base_disp_rsy(vcpu);
653
654 if (useraddr & 7)
655 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
656
657 reg = reg1;
658
659 VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x, addr:%llx", reg1, reg3,
660 useraddr);
661 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr);
662
663 do {
664 rc = get_guest(vcpu, vcpu->arch.sie_block->gcr[reg],
665 (u64 __user *) useraddr);
666 if (rc)
667 return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
668 useraddr += 8;
669 if (reg == reg3)
670 break;
671 reg = (reg + 1) % 16;
672 } while (1);
673
674 return 0;
675}
676
492static const intercept_handler_t eb_handlers[256] = { 677static const intercept_handler_t eb_handlers[256] = {
678 [0x2f] = handle_lctlg,
493 [0x8a] = handle_io_inst, 679 [0x8a] = handle_io_inst,
494}; 680};
495 681
496int kvm_s390_handle_priv_eb(struct kvm_vcpu *vcpu) 682int kvm_s390_handle_eb(struct kvm_vcpu *vcpu)
497{ 683{
498 intercept_handler_t handler; 684 intercept_handler_t handler;
499 685
500 /* All eb instructions that end up here are privileged. */
501 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
502 return kvm_s390_inject_program_int(vcpu,
503 PGM_PRIVILEGED_OPERATION);
504 handler = eb_handlers[vcpu->arch.sie_block->ipb & 0xff]; 686 handler = eb_handlers[vcpu->arch.sie_block->ipb & 0xff];
505 if (handler) 687 if (handler)
506 return handler(vcpu); 688 return handler(vcpu);
@@ -515,6 +697,9 @@ static int handle_tprot(struct kvm_vcpu *vcpu)
515 697
516 vcpu->stat.instruction_tprot++; 698 vcpu->stat.instruction_tprot++;
517 699
700 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
701 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
702
518 kvm_s390_get_base_disp_sse(vcpu, &address1, &address2); 703 kvm_s390_get_base_disp_sse(vcpu, &address1, &address2);
519 704
520 /* we only handle the Linux memory detection case: 705 /* we only handle the Linux memory detection case:
@@ -560,8 +745,7 @@ static int handle_sckpf(struct kvm_vcpu *vcpu)
560 u32 value; 745 u32 value;
561 746
562 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 747 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
563 return kvm_s390_inject_program_int(vcpu, 748 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
564 PGM_PRIVILEGED_OPERATION);
565 749
566 if (vcpu->run->s.regs.gprs[0] & 0x00000000ffff0000) 750 if (vcpu->run->s.regs.gprs[0] & 0x00000000ffff0000)
567 return kvm_s390_inject_program_int(vcpu, 751 return kvm_s390_inject_program_int(vcpu,
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index 1c48ab2845e0..bec398c57acf 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -79,8 +79,8 @@ static int __sigp_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr)
79 list_add_tail(&inti->list, &li->list); 79 list_add_tail(&inti->list, &li->list);
80 atomic_set(&li->active, 1); 80 atomic_set(&li->active, 1);
81 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); 81 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
82 if (waitqueue_active(&li->wq)) 82 if (waitqueue_active(li->wq))
83 wake_up_interruptible(&li->wq); 83 wake_up_interruptible(li->wq);
84 spin_unlock_bh(&li->lock); 84 spin_unlock_bh(&li->lock);
85 rc = SIGP_CC_ORDER_CODE_ACCEPTED; 85 rc = SIGP_CC_ORDER_CODE_ACCEPTED;
86 VCPU_EVENT(vcpu, 4, "sent sigp emerg to cpu %x", cpu_addr); 86 VCPU_EVENT(vcpu, 4, "sent sigp emerg to cpu %x", cpu_addr);
@@ -117,8 +117,8 @@ static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr)
117 list_add_tail(&inti->list, &li->list); 117 list_add_tail(&inti->list, &li->list);
118 atomic_set(&li->active, 1); 118 atomic_set(&li->active, 1);
119 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags); 119 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
120 if (waitqueue_active(&li->wq)) 120 if (waitqueue_active(li->wq))
121 wake_up_interruptible(&li->wq); 121 wake_up_interruptible(li->wq);
122 spin_unlock_bh(&li->lock); 122 spin_unlock_bh(&li->lock);
123 rc = SIGP_CC_ORDER_CODE_ACCEPTED; 123 rc = SIGP_CC_ORDER_CODE_ACCEPTED;
124 VCPU_EVENT(vcpu, 4, "sent sigp ext call to cpu %x", cpu_addr); 124 VCPU_EVENT(vcpu, 4, "sent sigp ext call to cpu %x", cpu_addr);
@@ -145,8 +145,8 @@ static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)
145 atomic_set(&li->active, 1); 145 atomic_set(&li->active, 1);
146 atomic_set_mask(CPUSTAT_STOP_INT, li->cpuflags); 146 atomic_set_mask(CPUSTAT_STOP_INT, li->cpuflags);
147 li->action_bits |= action; 147 li->action_bits |= action;
148 if (waitqueue_active(&li->wq)) 148 if (waitqueue_active(li->wq))
149 wake_up_interruptible(&li->wq); 149 wake_up_interruptible(li->wq);
150out: 150out:
151 spin_unlock_bh(&li->lock); 151 spin_unlock_bh(&li->lock);
152 152
@@ -250,8 +250,8 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
250 250
251 list_add_tail(&inti->list, &li->list); 251 list_add_tail(&inti->list, &li->list);
252 atomic_set(&li->active, 1); 252 atomic_set(&li->active, 1);
253 if (waitqueue_active(&li->wq)) 253 if (waitqueue_active(li->wq))
254 wake_up_interruptible(&li->wq); 254 wake_up_interruptible(li->wq);
255 rc = SIGP_CC_ORDER_CODE_ACCEPTED; 255 rc = SIGP_CC_ORDER_CODE_ACCEPTED;
256 256
257 VCPU_EVENT(vcpu, 4, "set prefix of cpu %02x to %x", cpu_addr, address); 257 VCPU_EVENT(vcpu, 4, "set prefix of cpu %02x to %x", cpu_addr, address);
@@ -333,8 +333,7 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
333 333
334 /* sigp in userspace can exit */ 334 /* sigp in userspace can exit */
335 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 335 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
336 return kvm_s390_inject_program_int(vcpu, 336 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
337 PGM_PRIVILEGED_OPERATION);
338 337
339 order_code = kvm_s390_get_base_disp_rs(vcpu); 338 order_code = kvm_s390_get_base_disp_rs(vcpu);
340 339
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 89ebae4008f2..ce36ea80e4f9 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -135,30 +135,17 @@ void __init paging_init(void)
135 135
136void __init mem_init(void) 136void __init mem_init(void)
137{ 137{
138 unsigned long codesize, reservedpages, datasize, initsize; 138 max_mapnr = max_low_pfn;
139
140 max_mapnr = num_physpages = max_low_pfn;
141 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); 139 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
142 140
143 /* Setup guest page hinting */ 141 /* Setup guest page hinting */
144 cmma_init(); 142 cmma_init();
145 143
146 /* this will put all low memory onto the freelists */ 144 /* this will put all low memory onto the freelists */
147 totalram_pages += free_all_bootmem(); 145 free_all_bootmem();
148 setup_zero_pages(); /* Setup zeroed pages. */ 146 setup_zero_pages(); /* Setup zeroed pages. */
149 147
150 reservedpages = 0; 148 mem_init_print_info(NULL);
151
152 codesize = (unsigned long) &_etext - (unsigned long) &_text;
153 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
154 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
155 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n",
156 nr_free_pages() << (PAGE_SHIFT-10),
157 max_mapnr << (PAGE_SHIFT-10),
158 codesize >> 10,
159 reservedpages << (PAGE_SHIFT-10),
160 datasize >>10,
161 initsize >> 10);
162 printk("Write protected kernel read-only data: %#lx - %#lx\n", 149 printk("Write protected kernel read-only data: %#lx - %#lx\n",
163 (unsigned long)&_stext, 150 (unsigned long)&_stext,
164 PFN_ALIGN((unsigned long)&_eshared) - 1); 151 PFN_ALIGN((unsigned long)&_eshared) - 1);
@@ -166,13 +153,14 @@ void __init mem_init(void)
166 153
167void free_initmem(void) 154void free_initmem(void)
168{ 155{
169 free_initmem_default(0); 156 free_initmem_default(POISON_FREE_INITMEM);
170} 157}
171 158
172#ifdef CONFIG_BLK_DEV_INITRD 159#ifdef CONFIG_BLK_DEV_INITRD
173void __init free_initrd_mem(unsigned long start, unsigned long end) 160void __init free_initrd_mem(unsigned long start, unsigned long end)
174{ 161{
175 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 162 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
163 "initrd");
176} 164}
177#endif 165#endif
178 166
diff --git a/arch/s390/mm/mem_detect.c b/arch/s390/mm/mem_detect.c
index 3cbd3b8bf311..cca388253a39 100644
--- a/arch/s390/mm/mem_detect.c
+++ b/arch/s390/mm/mem_detect.c
@@ -123,7 +123,8 @@ void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
123 continue; 123 continue;
124 } else if ((addr <= chunk->addr) && 124 } else if ((addr <= chunk->addr) &&
125 (addr + size >= chunk->addr + chunk->size)) { 125 (addr + size >= chunk->addr + chunk->size)) {
126 memset(chunk, 0 , sizeof(*chunk)); 126 memmove(chunk, chunk + 1, (MEMORY_CHUNKS-i-1) * sizeof(*chunk));
127 memset(&mem_chunk[MEMORY_CHUNKS-1], 0, sizeof(*chunk));
127 } else if (addr + size < chunk->addr + chunk->size) { 128 } else if (addr + size < chunk->addr + chunk->size) {
128 chunk->size = chunk->addr + chunk->size - addr - size; 129 chunk->size = chunk->addr + chunk->size - addr - size;
129 chunk->addr = addr + size; 130 chunk->addr = addr + size;
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index a938b548f07e..a8154a1a2c94 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -689,7 +689,7 @@ int gmap_ipte_notify(struct gmap *gmap, unsigned long start, unsigned long len)
689 entry = *ptep; 689 entry = *ptep;
690 if ((pte_val(entry) & (_PAGE_INVALID | _PAGE_RO)) == 0) { 690 if ((pte_val(entry) & (_PAGE_INVALID | _PAGE_RO)) == 0) {
691 pgste = pgste_get_lock(ptep); 691 pgste = pgste_get_lock(ptep);
692 pgste_val(pgste) |= RCP_IN_BIT; 692 pgste_val(pgste) |= PGSTE_IN_BIT;
693 pgste_set_unlock(ptep, pgste); 693 pgste_set_unlock(ptep, pgste);
694 start += PAGE_SIZE; 694 start += PAGE_SIZE;
695 len -= PAGE_SIZE; 695 len -= PAGE_SIZE;
@@ -771,6 +771,54 @@ static inline void page_table_free_pgste(unsigned long *table)
771 __free_page(page); 771 __free_page(page);
772} 772}
773 773
774int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
775 unsigned long key, bool nq)
776{
777 spinlock_t *ptl;
778 pgste_t old, new;
779 pte_t *ptep;
780
781 down_read(&mm->mmap_sem);
782 ptep = get_locked_pte(current->mm, addr, &ptl);
783 if (unlikely(!ptep)) {
784 up_read(&mm->mmap_sem);
785 return -EFAULT;
786 }
787
788 new = old = pgste_get_lock(ptep);
789 pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT |
790 PGSTE_ACC_BITS | PGSTE_FP_BIT);
791 pgste_val(new) |= (key & (_PAGE_CHANGED | _PAGE_REFERENCED)) << 48;
792 pgste_val(new) |= (key & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56;
793 if (!(pte_val(*ptep) & _PAGE_INVALID)) {
794 unsigned long address, bits;
795 unsigned char skey;
796
797 address = pte_val(*ptep) & PAGE_MASK;
798 skey = page_get_storage_key(address);
799 bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED);
800 /* Set storage key ACC and FP */
801 page_set_storage_key(address,
802 (key & (_PAGE_ACC_BITS | _PAGE_FP_BIT)),
803 !nq);
804
805 /* Merge host changed & referenced into pgste */
806 pgste_val(new) |= bits << 52;
807 /* Transfer skey changed & referenced bit to kvm user bits */
808 pgste_val(new) |= bits << 45; /* PGSTE_UR_BIT & PGSTE_UC_BIT */
809 }
810 /* changing the guest storage key is considered a change of the page */
811 if ((pgste_val(new) ^ pgste_val(old)) &
812 (PGSTE_ACC_BITS | PGSTE_FP_BIT | PGSTE_GR_BIT | PGSTE_GC_BIT))
813 pgste_val(new) |= PGSTE_UC_BIT;
814
815 pgste_set_unlock(ptep, new);
816 pte_unmap_unlock(*ptep, ptl);
817 up_read(&mm->mmap_sem);
818 return 0;
819}
820EXPORT_SYMBOL(set_guest_storage_key);
821
774#else /* CONFIG_PGSTE */ 822#else /* CONFIG_PGSTE */
775 823
776static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm, 824static inline unsigned long *page_table_alloc_pgste(struct mm_struct *mm,
@@ -1117,7 +1165,8 @@ void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
1117 } 1165 }
1118} 1166}
1119 1167
1120void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable) 1168void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
1169 pgtable_t pgtable)
1121{ 1170{
1122 struct list_head *lh = (struct list_head *) pgtable; 1171 struct list_head *lh = (struct list_head *) pgtable;
1123 1172
@@ -1131,7 +1180,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable)
1131 mm->pmd_huge_pte = pgtable; 1180 mm->pmd_huge_pte = pgtable;
1132} 1181}
1133 1182
1134pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm) 1183pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
1135{ 1184{
1136 struct list_head *lh; 1185 struct list_head *lh;
1137 pgtable_t pgtable; 1186 pgtable_t pgtable;
diff --git a/arch/s390/oprofile/hwsampler.h b/arch/s390/oprofile/hwsampler.h
index 1912f3bb190c..0022e1ebfbde 100644
--- a/arch/s390/oprofile/hwsampler.h
+++ b/arch/s390/oprofile/hwsampler.h
@@ -81,8 +81,8 @@ struct hws_data_entry {
81 unsigned int:16; 81 unsigned int:16;
82 unsigned int prim_asn:16; /* primary ASN */ 82 unsigned int prim_asn:16; /* primary ASN */
83 unsigned long long ia; /* Instruction Address */ 83 unsigned long long ia; /* Instruction Address */
84 unsigned long long lpp; /* Logical-Partition Program Param. */ 84 unsigned long long gpp; /* Guest Program Parameter */
85 unsigned long long vpp; /* Virtual-Machine Program Param. */ 85 unsigned long long hpp; /* Host Program Parameter */
86}; 86};
87 87
88struct hws_trailer_entry { 88struct hws_trailer_entry {
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index e6f15b5d8b7d..e2956ad39a4f 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -82,10 +82,13 @@ struct intr_bucket {
82 82
83static struct intr_bucket *bucket; 83static struct intr_bucket *bucket;
84 84
85/* Adapter local summary indicator */ 85/* Adapter interrupt definitions */
86static u8 *zpci_irq_si; 86static void zpci_irq_handler(struct airq_struct *airq);
87 87
88static atomic_t irq_retries = ATOMIC_INIT(0); 88static struct airq_struct zpci_airq = {
89 .handler = zpci_irq_handler,
90 .isc = PCI_ISC,
91};
89 92
90/* I/O Map */ 93/* I/O Map */
91static DEFINE_SPINLOCK(zpci_iomap_lock); 94static DEFINE_SPINLOCK(zpci_iomap_lock);
@@ -302,15 +305,6 @@ static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len)
302 return rc; 305 return rc;
303} 306}
304 307
305void synchronize_irq(unsigned int irq)
306{
307 /*
308 * Not needed, the handler is protected by a lock and IRQs that occur
309 * after the handler is deleted are just NOPs.
310 */
311}
312EXPORT_SYMBOL_GPL(synchronize_irq);
313
314void enable_irq(unsigned int irq) 308void enable_irq(unsigned int irq)
315{ 309{
316 struct msi_desc *msi = irq_get_msi_desc(irq); 310 struct msi_desc *msi = irq_get_msi_desc(irq);
@@ -327,30 +321,6 @@ void disable_irq(unsigned int irq)
327} 321}
328EXPORT_SYMBOL_GPL(disable_irq); 322EXPORT_SYMBOL_GPL(disable_irq);
329 323
330void disable_irq_nosync(unsigned int irq)
331{
332 disable_irq(irq);
333}
334EXPORT_SYMBOL_GPL(disable_irq_nosync);
335
336unsigned long probe_irq_on(void)
337{
338 return 0;
339}
340EXPORT_SYMBOL_GPL(probe_irq_on);
341
342int probe_irq_off(unsigned long val)
343{
344 return 0;
345}
346EXPORT_SYMBOL_GPL(probe_irq_off);
347
348unsigned int probe_irq_mask(unsigned long val)
349{
350 return val;
351}
352EXPORT_SYMBOL_GPL(probe_irq_mask);
353
354void pcibios_fixup_bus(struct pci_bus *bus) 324void pcibios_fixup_bus(struct pci_bus *bus)
355{ 325{
356} 326}
@@ -437,7 +407,7 @@ static struct pci_ops pci_root_ops = {
437/* store the last handled bit to implement fair scheduling of devices */ 407/* store the last handled bit to implement fair scheduling of devices */
438static DEFINE_PER_CPU(unsigned long, next_sbit); 408static DEFINE_PER_CPU(unsigned long, next_sbit);
439 409
440static void zpci_irq_handler(void *dont, void *need) 410static void zpci_irq_handler(struct airq_struct *airq)
441{ 411{
442 unsigned long sbit, mbit, last = 0, start = __get_cpu_var(next_sbit); 412 unsigned long sbit, mbit, last = 0, start = __get_cpu_var(next_sbit);
443 int rescan = 0, max = aisb_max; 413 int rescan = 0, max = aisb_max;
@@ -485,7 +455,6 @@ scan:
485 max = aisb_max; 455 max = aisb_max;
486 sbit = find_first_bit_left(bucket->aisb, max); 456 sbit = find_first_bit_left(bucket->aisb, max);
487 if (sbit != max) { 457 if (sbit != max) {
488 atomic_inc(&irq_retries);
489 rescan++; 458 rescan++;
490 goto scan; 459 goto scan;
491 } 460 }
@@ -598,7 +567,21 @@ static void zpci_map_resources(struct zpci_dev *zdev)
598 pr_debug("BAR%i: -> start: %Lx end: %Lx\n", 567 pr_debug("BAR%i: -> start: %Lx end: %Lx\n",
599 i, pdev->resource[i].start, pdev->resource[i].end); 568 i, pdev->resource[i].start, pdev->resource[i].end);
600 } 569 }
601}; 570}
571
572static void zpci_unmap_resources(struct zpci_dev *zdev)
573{
574 struct pci_dev *pdev = zdev->pdev;
575 resource_size_t len;
576 int i;
577
578 for (i = 0; i < PCI_BAR_COUNT; i++) {
579 len = pci_resource_len(pdev, i);
580 if (!len)
581 continue;
582 pci_iounmap(pdev, (void *) pdev->resource[i].start);
583 }
584}
602 585
603struct zpci_dev *zpci_alloc_device(void) 586struct zpci_dev *zpci_alloc_device(void)
604{ 587{
@@ -734,25 +717,20 @@ static int __init zpci_irq_init(void)
734 goto out_alloc; 717 goto out_alloc;
735 } 718 }
736 719
737 isc_register(PCI_ISC); 720 rc = register_adapter_interrupt(&zpci_airq);
738 zpci_irq_si = s390_register_adapter_interrupt(&zpci_irq_handler, NULL, PCI_ISC); 721 if (rc)
739 if (IS_ERR(zpci_irq_si)) {
740 rc = PTR_ERR(zpci_irq_si);
741 zpci_irq_si = NULL;
742 goto out_ai; 722 goto out_ai;
743 } 723 /* Set summary to 1 to be called every time for the ISC. */
724 *zpci_airq.lsi_ptr = 1;
744 725
745 for_each_online_cpu(cpu) 726 for_each_online_cpu(cpu)
746 per_cpu(next_sbit, cpu) = 0; 727 per_cpu(next_sbit, cpu) = 0;
747 728
748 spin_lock_init(&bucket->lock); 729 spin_lock_init(&bucket->lock);
749 /* set summary to 1 to be called every time for the ISC */
750 *zpci_irq_si = 1;
751 set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC); 730 set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC);
752 return 0; 731 return 0;
753 732
754out_ai: 733out_ai:
755 isc_unregister(PCI_ISC);
756 free_page((unsigned long) bucket->alloc); 734 free_page((unsigned long) bucket->alloc);
757out_alloc: 735out_alloc:
758 free_page((unsigned long) bucket->aisb); 736 free_page((unsigned long) bucket->aisb);
@@ -765,21 +743,10 @@ static void zpci_irq_exit(void)
765{ 743{
766 free_page((unsigned long) bucket->alloc); 744 free_page((unsigned long) bucket->alloc);
767 free_page((unsigned long) bucket->aisb); 745 free_page((unsigned long) bucket->aisb);
768 s390_unregister_adapter_interrupt(zpci_irq_si, PCI_ISC); 746 unregister_adapter_interrupt(&zpci_airq);
769 isc_unregister(PCI_ISC);
770 kfree(bucket); 747 kfree(bucket);
771} 748}
772 749
773void zpci_debug_info(struct zpci_dev *zdev, struct seq_file *m)
774{
775 if (!zdev)
776 return;
777
778 seq_printf(m, "global irq retries: %u\n", atomic_read(&irq_retries));
779 seq_printf(m, "aibv[0]:%016lx aibv[1]:%016lx aisb:%016lx\n",
780 get_imap(0)->aibv, get_imap(1)->aibv, *bucket->aisb);
781}
782
783static struct resource *zpci_alloc_bus_resource(unsigned long start, unsigned long size, 750static struct resource *zpci_alloc_bus_resource(unsigned long start, unsigned long size,
784 unsigned long flags, int domain) 751 unsigned long flags, int domain)
785{ 752{
@@ -843,6 +810,16 @@ int pcibios_add_device(struct pci_dev *pdev)
843 return 0; 810 return 0;
844} 811}
845 812
813void pcibios_release_device(struct pci_dev *pdev)
814{
815 struct zpci_dev *zdev = get_zdev(pdev);
816
817 zpci_unmap_resources(zdev);
818 zpci_fmb_disable_device(zdev);
819 zpci_debug_exit_device(zdev);
820 zdev->pdev = NULL;
821}
822
846static int zpci_scan_bus(struct zpci_dev *zdev) 823static int zpci_scan_bus(struct zpci_dev *zdev)
847{ 824{
848 struct resource *res; 825 struct resource *res;
@@ -983,25 +960,6 @@ void zpci_stop_device(struct zpci_dev *zdev)
983} 960}
984EXPORT_SYMBOL_GPL(zpci_stop_device); 961EXPORT_SYMBOL_GPL(zpci_stop_device);
985 962
986int zpci_scan_device(struct zpci_dev *zdev)
987{
988 zdev->pdev = pci_scan_single_device(zdev->bus, ZPCI_DEVFN);
989 if (!zdev->pdev) {
990 pr_err("pci_scan_single_device failed for fid: 0x%x\n",
991 zdev->fid);
992 goto out;
993 }
994
995 pci_bus_add_devices(zdev->bus);
996
997 return 0;
998out:
999 zpci_dma_exit_device(zdev);
1000 clp_disable_fh(zdev);
1001 return -EIO;
1002}
1003EXPORT_SYMBOL_GPL(zpci_scan_device);
1004
1005static inline int barsize(u8 size) 963static inline int barsize(u8 size)
1006{ 964{
1007 return (size) ? (1 << size) >> 10 : 0; 965 return (size) ? (1 << size) >> 10 : 0;
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
index bd34359d1546..2e9539625d93 100644
--- a/arch/s390/pci/pci_clp.c
+++ b/arch/s390/pci/pci_clp.c
@@ -236,7 +236,6 @@ int clp_disable_fh(struct zpci_dev *zdev)
236 if (!zdev_enabled(zdev)) 236 if (!zdev_enabled(zdev))
237 return 0; 237 return 0;
238 238
239 dev_info(&zdev->pdev->dev, "disabling fn handle: 0x%x\n", fh);
240 rc = clp_set_pci_fn(&fh, 0, CLP_SET_DISABLE_PCI_FN); 239 rc = clp_set_pci_fn(&fh, 0, CLP_SET_DISABLE_PCI_FN);
241 if (!rc) 240 if (!rc)
242 /* Success -> store disabled handle in zdev */ 241 /* Success -> store disabled handle in zdev */
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
index 771b82359af4..75c69b402e05 100644
--- a/arch/s390/pci/pci_debug.c
+++ b/arch/s390/pci/pci_debug.c
@@ -115,27 +115,6 @@ static const struct file_operations debugfs_pci_perf_fops = {
115 .release = single_release, 115 .release = single_release,
116}; 116};
117 117
118static int pci_debug_show(struct seq_file *m, void *v)
119{
120 struct zpci_dev *zdev = m->private;
121
122 zpci_debug_info(zdev, m);
123 return 0;
124}
125
126static int pci_debug_seq_open(struct inode *inode, struct file *filp)
127{
128 return single_open(filp, pci_debug_show,
129 file_inode(filp)->i_private);
130}
131
132static const struct file_operations debugfs_pci_debug_fops = {
133 .open = pci_debug_seq_open,
134 .read = seq_read,
135 .llseek = seq_lseek,
136 .release = single_release,
137};
138
139void zpci_debug_init_device(struct zpci_dev *zdev) 118void zpci_debug_init_device(struct zpci_dev *zdev)
140{ 119{
141 zdev->debugfs_dev = debugfs_create_dir(dev_name(&zdev->pdev->dev), 120 zdev->debugfs_dev = debugfs_create_dir(dev_name(&zdev->pdev->dev),
@@ -149,19 +128,11 @@ void zpci_debug_init_device(struct zpci_dev *zdev)
149 &debugfs_pci_perf_fops); 128 &debugfs_pci_perf_fops);
150 if (IS_ERR(zdev->debugfs_perf)) 129 if (IS_ERR(zdev->debugfs_perf))
151 zdev->debugfs_perf = NULL; 130 zdev->debugfs_perf = NULL;
152
153 zdev->debugfs_debug = debugfs_create_file("debug",
154 S_IFREG | S_IRUGO | S_IWUSR,
155 zdev->debugfs_dev, zdev,
156 &debugfs_pci_debug_fops);
157 if (IS_ERR(zdev->debugfs_debug))
158 zdev->debugfs_debug = NULL;
159} 131}
160 132
161void zpci_debug_exit_device(struct zpci_dev *zdev) 133void zpci_debug_exit_device(struct zpci_dev *zdev)
162{ 134{
163 debugfs_remove(zdev->debugfs_perf); 135 debugfs_remove(zdev->debugfs_perf);
164 debugfs_remove(zdev->debugfs_debug);
165 debugfs_remove(zdev->debugfs_dev); 136 debugfs_remove(zdev->debugfs_dev);
166} 137}
167 138
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index f8e69d5bc0a9..a2343c1f6e04 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -263,7 +263,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
263 enum dma_data_direction direction, 263 enum dma_data_direction direction,
264 struct dma_attrs *attrs) 264 struct dma_attrs *attrs)
265{ 265{
266 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 266 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
267 unsigned long nr_pages, iommu_page_index; 267 unsigned long nr_pages, iommu_page_index;
268 unsigned long pa = page_to_phys(page) + offset; 268 unsigned long pa = page_to_phys(page) + offset;
269 int flags = ZPCI_PTE_VALID; 269 int flags = ZPCI_PTE_VALID;
@@ -304,7 +304,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
304 size_t size, enum dma_data_direction direction, 304 size_t size, enum dma_data_direction direction,
305 struct dma_attrs *attrs) 305 struct dma_attrs *attrs)
306{ 306{
307 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 307 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
308 unsigned long iommu_page_index; 308 unsigned long iommu_page_index;
309 int npages; 309 int npages;
310 310
@@ -323,7 +323,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
323 dma_addr_t *dma_handle, gfp_t flag, 323 dma_addr_t *dma_handle, gfp_t flag,
324 struct dma_attrs *attrs) 324 struct dma_attrs *attrs)
325{ 325{
326 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 326 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
327 struct page *page; 327 struct page *page;
328 unsigned long pa; 328 unsigned long pa;
329 dma_addr_t map; 329 dma_addr_t map;
diff --git a/arch/s390/pci/pci_sysfs.c b/arch/s390/pci/pci_sysfs.c
index a42cce69d0a0..e99a2557f186 100644
--- a/arch/s390/pci/pci_sysfs.c
+++ b/arch/s390/pci/pci_sysfs.c
@@ -15,40 +15,36 @@
15static ssize_t show_fid(struct device *dev, struct device_attribute *attr, 15static ssize_t show_fid(struct device *dev, struct device_attribute *attr,
16 char *buf) 16 char *buf)
17{ 17{
18 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 18 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
19 19
20 sprintf(buf, "0x%08x\n", zdev->fid); 20 return sprintf(buf, "0x%08x\n", zdev->fid);
21 return strlen(buf);
22} 21}
23static DEVICE_ATTR(function_id, S_IRUGO, show_fid, NULL); 22static DEVICE_ATTR(function_id, S_IRUGO, show_fid, NULL);
24 23
25static ssize_t show_fh(struct device *dev, struct device_attribute *attr, 24static ssize_t show_fh(struct device *dev, struct device_attribute *attr,
26 char *buf) 25 char *buf)
27{ 26{
28 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 27 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
29 28
30 sprintf(buf, "0x%08x\n", zdev->fh); 29 return sprintf(buf, "0x%08x\n", zdev->fh);
31 return strlen(buf);
32} 30}
33static DEVICE_ATTR(function_handle, S_IRUGO, show_fh, NULL); 31static DEVICE_ATTR(function_handle, S_IRUGO, show_fh, NULL);
34 32
35static ssize_t show_pchid(struct device *dev, struct device_attribute *attr, 33static ssize_t show_pchid(struct device *dev, struct device_attribute *attr,
36 char *buf) 34 char *buf)
37{ 35{
38 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 36 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
39 37
40 sprintf(buf, "0x%04x\n", zdev->pchid); 38 return sprintf(buf, "0x%04x\n", zdev->pchid);
41 return strlen(buf);
42} 39}
43static DEVICE_ATTR(pchid, S_IRUGO, show_pchid, NULL); 40static DEVICE_ATTR(pchid, S_IRUGO, show_pchid, NULL);
44 41
45static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr, 42static ssize_t show_pfgid(struct device *dev, struct device_attribute *attr,
46 char *buf) 43 char *buf)
47{ 44{
48 struct zpci_dev *zdev = get_zdev(container_of(dev, struct pci_dev, dev)); 45 struct zpci_dev *zdev = get_zdev(to_pci_dev(dev));
49 46
50 sprintf(buf, "0x%02x\n", zdev->pfgid); 47 return sprintf(buf, "0x%02x\n", zdev->pfgid);
51 return strlen(buf);
52} 48}
53static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL); 49static DEVICE_ATTR(pfgid, S_IRUGO, show_pfgid, NULL);
54 50
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index cebaff8069a1..e1c7bb999b06 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -3,3 +3,4 @@ header-y +=
3 3
4generic-y += clkdev.h 4generic-y += clkdev.h
5generic-y += trace_clock.h 5generic-y += trace_clock.h
6generic-y += xor.h
diff --git a/arch/score/include/asm/dma-mapping.h b/arch/score/include/asm/dma-mapping.h
deleted file mode 100644
index f9c0193c7a53..000000000000
--- a/arch/score/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SCORE_DMA_MAPPING_H
2#define _ASM_SCORE_DMA_MAPPING_H
3
4#include <asm-generic/dma-mapping-broken.h>
5
6#endif /* _ASM_SCORE_DMA_MAPPING_H */
diff --git a/arch/score/include/asm/pgtable.h b/arch/score/include/asm/pgtable.h
index 2fd469807683..db96ad9afc03 100644
--- a/arch/score/include/asm/pgtable.h
+++ b/arch/score/include/asm/pgtable.h
@@ -113,9 +113,6 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
113#define pte_clear(mm, addr, xp) \ 113#define pte_clear(mm, addr, xp) \
114 do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 114 do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
115 115
116#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
117 remap_pfn_range(vma, vaddr, pfn, size, prot)
118
119/* 116/*
120 * The "pgd_xxx()" functions here are trivial for a folded two-level 117 * The "pgd_xxx()" functions here are trivial for a folded two-level
121 * setup: the pgd is never bad, and a pmd always exists (as it's folded 118 * setup: the pgd is never bad, and a pmd always exists (as it's folded
diff --git a/arch/score/kernel/vmlinux.lds.S b/arch/score/kernel/vmlinux.lds.S
index eebcbaa4e978..7274b5c4287e 100644
--- a/arch/score/kernel/vmlinux.lds.S
+++ b/arch/score/kernel/vmlinux.lds.S
@@ -49,6 +49,7 @@ SECTIONS
49 } 49 }
50 50
51 . = ALIGN(16); 51 . = ALIGN(16);
52 _sdata = .; /* Start of data section */
52 RODATA 53 RODATA
53 54
54 EXCEPTION_TABLE(16) 55 EXCEPTION_TABLE(16)
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c
index 0940682ab38b..9fbce49ad3bd 100644
--- a/arch/score/mm/init.c
+++ b/arch/score/mm/init.c
@@ -75,40 +75,19 @@ void __init paging_init(void)
75 75
76void __init mem_init(void) 76void __init mem_init(void)
77{ 77{
78 unsigned long codesize, reservedpages, datasize, initsize;
79 unsigned long tmp, ram = 0;
80
81 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 78 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
82 totalram_pages += free_all_bootmem(); 79 free_all_bootmem();
83 setup_zero_page(); /* Setup zeroed pages. */ 80 setup_zero_page(); /* Setup zeroed pages. */
84 reservedpages = 0; 81
85 82 mem_init_print_info(NULL);
86 for (tmp = 0; tmp < max_low_pfn; tmp++)
87 if (page_is_ram(tmp)) {
88 ram++;
89 if (PageReserved(pfn_to_page(tmp)))
90 reservedpages++;
91 }
92
93 num_physpages = ram;
94 codesize = (unsigned long) &_etext - (unsigned long) &_text;
95 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
96 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
97
98 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
99 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
100 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
101 ram << (PAGE_SHIFT-10), codesize >> 10,
102 reservedpages << (PAGE_SHIFT-10), datasize >> 10,
103 initsize >> 10,
104 totalhigh_pages << (PAGE_SHIFT-10));
105} 83}
106#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 84#endif /* !CONFIG_NEED_MULTIPLE_NODES */
107 85
108#ifdef CONFIG_BLK_DEV_INITRD 86#ifdef CONFIG_BLK_DEV_INITRD
109void free_initrd_mem(unsigned long start, unsigned long end) 87void free_initrd_mem(unsigned long start, unsigned long end)
110{ 88{
111 free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd"); 89 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
90 "initrd");
112} 91}
113#endif 92#endif
114 93
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 8c868cf2cf93..1020dd85431a 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -748,7 +748,7 @@ config NR_CPUS
748 748
749config HOTPLUG_CPU 749config HOTPLUG_CPU
750 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" 750 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
751 depends on SMP && HOTPLUG 751 depends on SMP
752 help 752 help
753 Say Y here to experiment with turning CPUs off and on. CPUs 753 Say Y here to experiment with turning CPUs off and on. CPUs
754 can be controlled through /sys/devices/system/cpu. 754 can be controlled through /sys/devices/system/cpu.
diff --git a/arch/sh/include/asm/mutex-llsc.h b/arch/sh/include/asm/mutex-llsc.h
index 090358a7e1bb..dad29b687bd3 100644
--- a/arch/sh/include/asm/mutex-llsc.h
+++ b/arch/sh/include/asm/mutex-llsc.h
@@ -37,7 +37,7 @@ __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
37} 37}
38 38
39static inline int 39static inline int
40__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 40__mutex_fastpath_lock_retval(atomic_t *count)
41{ 41{
42 int __done, __res; 42 int __done, __res;
43 43
@@ -51,7 +51,7 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
51 : "t"); 51 : "t");
52 52
53 if (unlikely(!__done || __res != 0)) 53 if (unlikely(!__done || __res != 0))
54 __res = fail_fn(count); 54 __res = -1;
55 55
56 return __res; 56 return __res;
57} 57}
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h
index 9210e93a92c3..cf434c64408d 100644
--- a/arch/sh/include/asm/pgtable.h
+++ b/arch/sh/include/asm/pgtable.h
@@ -124,9 +124,6 @@ typedef pte_t *pte_addr_t;
124 124
125#define kern_addr_valid(addr) (1) 125#define kern_addr_valid(addr) (1)
126 126
127#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
128 remap_pfn_range(vma, vaddr, pfn, size, prot)
129
130#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) 127#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT)))
131 128
132/* 129/*
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 20f9ead650d3..33890fd267cb 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -407,30 +407,16 @@ unsigned int mem_init_done = 0;
407 407
408void __init mem_init(void) 408void __init mem_init(void)
409{ 409{
410 int codesize, datasize, initsize; 410 pg_data_t *pgdat;
411 int nid;
412 411
413 iommu_init(); 412 iommu_init();
414 413
415 num_physpages = 0;
416 high_memory = NULL; 414 high_memory = NULL;
415 for_each_online_pgdat(pgdat)
416 high_memory = max_t(void *, high_memory,
417 __va(pgdat_end_pfn(pgdat) << PAGE_SHIFT));
417 418
418 for_each_online_node(nid) { 419 free_all_bootmem();
419 pg_data_t *pgdat = NODE_DATA(nid);
420 void *node_high_memory;
421
422 num_physpages += pgdat->node_present_pages;
423
424 if (pgdat->node_spanned_pages)
425 totalram_pages += free_all_bootmem_node(pgdat);
426
427
428 node_high_memory = (void *)__va((pgdat->node_start_pfn +
429 pgdat->node_spanned_pages) <<
430 PAGE_SHIFT);
431 if (node_high_memory > high_memory)
432 high_memory = node_high_memory;
433 }
434 420
435 /* Set this up early, so we can take care of the zero page */ 421 /* Set this up early, so we can take care of the zero page */
436 cpu_cache_init(); 422 cpu_cache_init();
@@ -441,19 +427,8 @@ void __init mem_init(void)
441 427
442 vsyscall_init(); 428 vsyscall_init();
443 429
444 codesize = (unsigned long) &_etext - (unsigned long) &_text; 430 mem_init_print_info(NULL);
445 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 431 pr_info("virtual kernel memory layout:\n"
446 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
447
448 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
449 "%dk data, %dk init)\n",
450 nr_free_pages() << (PAGE_SHIFT-10),
451 num_physpages << (PAGE_SHIFT-10),
452 codesize >> 10,
453 datasize >> 10,
454 initsize >> 10);
455
456 printk(KERN_INFO "virtual kernel memory layout:\n"
457 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 432 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
458#ifdef CONFIG_HIGHMEM 433#ifdef CONFIG_HIGHMEM
459 " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 434 " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
@@ -499,13 +474,13 @@ void __init mem_init(void)
499 474
500void free_initmem(void) 475void free_initmem(void)
501{ 476{
502 free_initmem_default(0); 477 free_initmem_default(-1);
503} 478}
504 479
505#ifdef CONFIG_BLK_DEV_INITRD 480#ifdef CONFIG_BLK_DEV_INITRD
506void free_initrd_mem(unsigned long start, unsigned long end) 481void free_initrd_mem(unsigned long start, unsigned long end)
507{ 482{
508 free_reserved_area(start, end, 0, "initrd"); 483 free_reserved_area((void *)start, (void *)end, -1, "initrd");
509} 484}
510#endif 485#endif
511 486
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 9ac9f1666339..a00cbd356db5 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -243,7 +243,6 @@ config SECCOMP
243config HOTPLUG_CPU 243config HOTPLUG_CPU
244 bool "Support for hot-pluggable CPUs" 244 bool "Support for hot-pluggable CPUs"
245 depends on SPARC64 && SMP 245 depends on SPARC64 && SMP
246 select HOTPLUG
247 help 246 help
248 Say Y here to experiment with turning CPUs off and on. CPUs 247 Say Y here to experiment with turning CPUs off and on. CPUs
249 can be controlled through /sys/devices/system/cpu/cpu#. 248 can be controlled through /sys/devices/system/cpu/cpu#.
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index ff18e3cfb6b1..7e4a97fbded4 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += cputime.h
6generic-y += div64.h 6generic-y += div64.h
7generic-y += emergency-restart.h 7generic-y += emergency-restart.h
8generic-y += exec.h 8generic-y += exec.h
9generic-y += linkage.h
9generic-y += local64.h 10generic-y += local64.h
10generic-y += mutex.h 11generic-y += mutex.h
11generic-y += irq_regs.h 12generic-y += irq_regs.h
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index 15a716934e4d..b836e9297f2a 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -135,7 +135,7 @@ static inline int sparc_leon3_cpuid(void)
135 135
136#ifdef CONFIG_SMP 136#ifdef CONFIG_SMP
137# define LEON3_IRQ_IPI_DEFAULT 13 137# define LEON3_IRQ_IPI_DEFAULT 13
138# define LEON3_IRQ_TICKER (leon3_ticker_irq) 138# define LEON3_IRQ_TICKER (leon3_gptimer_irq)
139# define LEON3_IRQ_CROSS_CALL 15 139# define LEON3_IRQ_CROSS_CALL 15
140#endif 140#endif
141 141
diff --git a/arch/sparc/include/asm/leon_amba.h b/arch/sparc/include/asm/leon_amba.h
index f3034eddf468..24ec48c3ff90 100644
--- a/arch/sparc/include/asm/leon_amba.h
+++ b/arch/sparc/include/asm/leon_amba.h
@@ -47,6 +47,7 @@ struct amba_prom_registers {
47#define LEON3_GPTIMER_LD 4 47#define LEON3_GPTIMER_LD 4
48#define LEON3_GPTIMER_IRQEN 8 48#define LEON3_GPTIMER_IRQEN 8
49#define LEON3_GPTIMER_SEPIRQ 8 49#define LEON3_GPTIMER_SEPIRQ 8
50#define LEON3_GPTIMER_TIMERS 0x7
50 51
51#define LEON23_REG_TIMER_CONTROL_EN 0x00000001 /* 1 = enable counting */ 52#define LEON23_REG_TIMER_CONTROL_EN 0x00000001 /* 1 = enable counting */
52/* 0 = hold scalar and counter */ 53/* 0 = hold scalar and counter */
diff --git a/arch/sparc/include/asm/linkage.h b/arch/sparc/include/asm/linkage.h
deleted file mode 100644
index 291c2d01c44f..000000000000
--- a/arch/sparc/include/asm/linkage.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_LINKAGE_H
2#define __ASM_LINKAGE_H
3
4/* Nothing to see here... */
5
6#endif
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 6fc13483f702..502f632f6cc7 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -443,6 +443,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
443 443
444 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); 444 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot);
445} 445}
446#define io_remap_pfn_range io_remap_pfn_range
446 447
447#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS 448#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
448#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ 449#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index 7619f2f792af..36760317814f 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -853,10 +853,11 @@ extern void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long addr,
853 pmd_t *pmd); 853 pmd_t *pmd);
854 854
855#define __HAVE_ARCH_PGTABLE_DEPOSIT 855#define __HAVE_ARCH_PGTABLE_DEPOSIT
856extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable); 856extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
857 pgtable_t pgtable);
857 858
858#define __HAVE_ARCH_PGTABLE_WITHDRAW 859#define __HAVE_ARCH_PGTABLE_WITHDRAW
859extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm); 860extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);
860#endif 861#endif
861 862
862/* Encode and de-code a swap entry */ 863/* Encode and de-code a swap entry */
@@ -914,6 +915,7 @@ static inline int io_remap_pfn_range(struct vm_area_struct *vma,
914 915
915 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot); 916 return remap_pfn_range(vma, from, phys_base >> PAGE_SHIFT, size, prot);
916} 917}
918#define io_remap_pfn_range io_remap_pfn_range
917 919
918#include <asm/tlbflush.h> 920#include <asm/tlbflush.h>
919#include <asm-generic/pgtable.h> 921#include <asm-generic/pgtable.h>
diff --git a/arch/sparc/include/uapi/asm/fcntl.h b/arch/sparc/include/uapi/asm/fcntl.h
index d0b83f66f356..d73e5e008b0d 100644
--- a/arch/sparc/include/uapi/asm/fcntl.h
+++ b/arch/sparc/include/uapi/asm/fcntl.h
@@ -35,6 +35,7 @@
35#define O_SYNC (__O_SYNC|O_DSYNC) 35#define O_SYNC (__O_SYNC|O_DSYNC)
36 36
37#define O_PATH 0x1000000 37#define O_PATH 0x1000000
38#define O_TMPFILE 0x2000000
38 39
39#define F_GETOWN 5 /* for sockets. */ 40#define F_GETOWN 5 /* for sockets. */
40#define F_SETOWN 6 /* for sockets. */ 41#define F_SETOWN 6 /* for sockets. */
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 75bb608c423e..5ef48dab5636 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -843,7 +843,8 @@ void ldom_reboot(const char *boot_command)
843 unsigned long len; 843 unsigned long len;
844 844
845 strcpy(full_boot_str, "boot "); 845 strcpy(full_boot_str, "boot ");
846 strcpy(full_boot_str + strlen("boot "), boot_command); 846 strlcpy(full_boot_str + strlen("boot "), boot_command,
847 sizeof(full_boot_str + strlen("boot ")));
847 len = strlen(full_boot_str); 848 len = strlen(full_boot_str);
848 849
849 if (reboot_data_supported) { 850 if (reboot_data_supported) {
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 7c0231dabe44..b7c68976cbc7 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -38,7 +38,6 @@ static DEFINE_SPINLOCK(leon_irq_lock);
38 38
39unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ 39unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
40unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ 40unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */
41int leon3_ticker_irq; /* Timer ticker IRQ */
42unsigned int sparc_leon_eirq; 41unsigned int sparc_leon_eirq;
43#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) 42#define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu])
44#define LEON_IACK (&leon3_irqctrl_regs->iclear) 43#define LEON_IACK (&leon3_irqctrl_regs->iclear)
@@ -278,6 +277,9 @@ irqreturn_t leon_percpu_timer_ce_interrupt(int irq, void *unused)
278 277
279 leon_clear_profile_irq(cpu); 278 leon_clear_profile_irq(cpu);
280 279
280 if (cpu == boot_cpu_id)
281 timer_interrupt(irq, NULL);
282
281 ce = &per_cpu(sparc32_clockevent, cpu); 283 ce = &per_cpu(sparc32_clockevent, cpu);
282 284
283 irq_enter(); 285 irq_enter();
@@ -299,6 +301,7 @@ void __init leon_init_timers(void)
299 int icsel; 301 int icsel;
300 int ampopts; 302 int ampopts;
301 int err; 303 int err;
304 u32 config;
302 305
303 sparc_config.get_cycles_offset = leon_cycles_offset; 306 sparc_config.get_cycles_offset = leon_cycles_offset;
304 sparc_config.cs_period = 1000000 / HZ; 307 sparc_config.cs_period = 1000000 / HZ;
@@ -377,23 +380,6 @@ void __init leon_init_timers(void)
377 LEON3_BYPASS_STORE_PA( 380 LEON3_BYPASS_STORE_PA(
378 &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0); 381 &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0);
379 382
380#ifdef CONFIG_SMP
381 leon3_ticker_irq = leon3_gptimer_irq + 1 + leon3_gptimer_idx;
382
383 if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) &
384 (1<<LEON3_GPTIMER_SEPIRQ))) {
385 printk(KERN_ERR "timer not configured with separate irqs\n");
386 BUG();
387 }
388
389 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].val,
390 0);
391 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].rld,
392 (((1000000/HZ) - 1)));
393 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl,
394 0);
395#endif
396
397 /* 383 /*
398 * The IRQ controller may (if implemented) consist of multiple 384 * The IRQ controller may (if implemented) consist of multiple
399 * IRQ controllers, each mapped on a 4Kb boundary. 385 * IRQ controllers, each mapped on a 4Kb boundary.
@@ -416,13 +402,6 @@ void __init leon_init_timers(void)
416 if (eirq != 0) 402 if (eirq != 0)
417 leon_eirq_setup(eirq); 403 leon_eirq_setup(eirq);
418 404
419 irq = _leon_build_device_irq(NULL, leon3_gptimer_irq+leon3_gptimer_idx);
420 err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
421 if (err) {
422 printk(KERN_ERR "unable to attach timer IRQ%d\n", irq);
423 prom_halt();
424 }
425
426#ifdef CONFIG_SMP 405#ifdef CONFIG_SMP
427 { 406 {
428 unsigned long flags; 407 unsigned long flags;
@@ -439,30 +418,31 @@ void __init leon_init_timers(void)
439 } 418 }
440#endif 419#endif
441 420
442 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 421 config = LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config);
443 LEON3_GPTIMER_EN | 422 if (config & (1 << LEON3_GPTIMER_SEPIRQ))
444 LEON3_GPTIMER_RL | 423 leon3_gptimer_irq += leon3_gptimer_idx;
445 LEON3_GPTIMER_LD | 424 else if ((config & LEON3_GPTIMER_TIMERS) > 1)
446 LEON3_GPTIMER_IRQEN); 425 pr_warn("GPTIMER uses shared irqs, using other timers of the same core will fail.\n");
447 426
448#ifdef CONFIG_SMP 427#ifdef CONFIG_SMP
449 /* Install per-cpu IRQ handler for broadcasted ticker */ 428 /* Install per-cpu IRQ handler for broadcasted ticker */
450 irq = leon_build_device_irq(leon3_ticker_irq, handle_percpu_irq, 429 irq = leon_build_device_irq(leon3_gptimer_irq, handle_percpu_irq,
451 "per-cpu", 0); 430 "per-cpu", 0);
452 err = request_irq(irq, leon_percpu_timer_ce_interrupt, 431 err = request_irq(irq, leon_percpu_timer_ce_interrupt,
453 IRQF_PERCPU | IRQF_TIMER, "ticker", 432 IRQF_PERCPU | IRQF_TIMER, "timer", NULL);
454 NULL); 433#else
434 irq = _leon_build_device_irq(NULL, leon3_gptimer_irq);
435 err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
436#endif
455 if (err) { 437 if (err) {
456 printk(KERN_ERR "unable to attach ticker IRQ%d\n", irq); 438 pr_err("Unable to attach timer IRQ%d\n", irq);
457 prom_halt(); 439 prom_halt();
458 } 440 }
459 441 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl,
460 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl,
461 LEON3_GPTIMER_EN | 442 LEON3_GPTIMER_EN |
462 LEON3_GPTIMER_RL | 443 LEON3_GPTIMER_RL |
463 LEON3_GPTIMER_LD | 444 LEON3_GPTIMER_LD |
464 LEON3_GPTIMER_IRQEN); 445 LEON3_GPTIMER_IRQEN);
465#endif
466 return; 446 return;
467bad: 447bad:
468 printk(KERN_ERR "No Timer/irqctrl found\n"); 448 printk(KERN_ERR "No Timer/irqctrl found\n");
diff --git a/arch/sparc/kernel/leon_pci_grpci1.c b/arch/sparc/kernel/leon_pci_grpci1.c
index 7739a54315e2..6df26e37f879 100644
--- a/arch/sparc/kernel/leon_pci_grpci1.c
+++ b/arch/sparc/kernel/leon_pci_grpci1.c
@@ -536,11 +536,9 @@ static int grpci1_of_probe(struct platform_device *ofdev)
536 536
537 /* find device register base address */ 537 /* find device register base address */
538 res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); 538 res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
539 regs = devm_request_and_ioremap(&ofdev->dev, res); 539 regs = devm_ioremap_resource(&ofdev->dev, res);
540 if (!regs) { 540 if (IS_ERR(regs))
541 dev_err(&ofdev->dev, "io-regs mapping failed\n"); 541 return PTR_ERR(regs);
542 return -EADDRNOTAVAIL;
543 }
544 542
545 /* 543 /*
546 * check that we're in Host Slot and that we can act as a Host Bridge 544 * check that we're in Host Slot and that we can act as a Host Bridge
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c
index bdf53d9a8d46..b0b3967a2dd2 100644
--- a/arch/sparc/kernel/leon_pmc.c
+++ b/arch/sparc/kernel/leon_pmc.c
@@ -47,6 +47,10 @@ void pmc_leon_idle_fixup(void)
47 * MMU does not get a TLB miss here by using the MMU BYPASS ASI. 47 * MMU does not get a TLB miss here by using the MMU BYPASS ASI.
48 */ 48 */
49 register unsigned int address = (unsigned int)leon3_irqctrl_regs; 49 register unsigned int address = (unsigned int)leon3_irqctrl_regs;
50
51 /* Interrupts need to be enabled to not hang the CPU */
52 local_irq_enable();
53
50 __asm__ __volatile__ ( 54 __asm__ __volatile__ (
51 "wr %%g0, %%asr19\n" 55 "wr %%g0, %%asr19\n"
52 "lda [%0] %1, %%g0\n" 56 "lda [%0] %1, %%g0\n"
@@ -60,6 +64,9 @@ void pmc_leon_idle_fixup(void)
60 */ 64 */
61void pmc_leon_idle(void) 65void pmc_leon_idle(void)
62{ 66{
67 /* Interrupts need to be enabled to not hang the CPU */
68 local_irq_enable();
69
63 /* For systems without power-down, this will be no-op */ 70 /* For systems without power-down, this will be no-op */
64 __asm__ __volatile__ ("wr %g0, %asr19\n\t"); 71 __asm__ __volatile__ ("wr %g0, %asr19\n\t");
65} 72}
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6cfc1b09ec25..d7aa524b7283 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -254,15 +254,12 @@ void __init leon_smp_done(void)
254 /* Free unneeded trap tables */ 254 /* Free unneeded trap tables */
255 if (!cpu_present(1)) { 255 if (!cpu_present(1)) {
256 free_reserved_page(virt_to_page(&trapbase_cpu1)); 256 free_reserved_page(virt_to_page(&trapbase_cpu1));
257 num_physpages++;
258 } 257 }
259 if (!cpu_present(2)) { 258 if (!cpu_present(2)) {
260 free_reserved_page(virt_to_page(&trapbase_cpu2)); 259 free_reserved_page(virt_to_page(&trapbase_cpu2));
261 num_physpages++;
262 } 260 }
263 if (!cpu_present(3)) { 261 if (!cpu_present(3)) {
264 free_reserved_page(virt_to_page(&trapbase_cpu3)); 262 free_reserved_page(virt_to_page(&trapbase_cpu3));
265 num_physpages++;
266 } 263 }
267 /* Ok, they are spinning and ready to go. */ 264 /* Ok, they are spinning and ready to go. */
268 smp_processors_ready = 1; 265 smp_processors_ready = 1;
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index baf4366e2d6a..bc4d3f5d2e5d 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -254,7 +254,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
254 const char *type; 254 const char *type;
255 u32 class; 255 u32 class;
256 256
257 dev = alloc_pci_dev(); 257 dev = pci_alloc_dev(bus);
258 if (!dev) 258 if (!dev)
259 return NULL; 259 return NULL;
260 260
@@ -281,7 +281,6 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
281 printk(" create device, devfn: %x, type: %s\n", 281 printk(" create device, devfn: %x, type: %s\n",
282 devfn, type); 282 devfn, type);
283 283
284 dev->bus = bus;
285 dev->sysdata = node; 284 dev->sysdata = node;
286 dev->dev.parent = bus->bridge; 285 dev->dev.parent = bus->bridge;
287 dev->dev.bus = &pci_bus_type; 286 dev->dev.bus = &pci_bus_type;
@@ -327,7 +326,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
327 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) 326 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE)
328 pci_set_master(dev); 327 pci_set_master(dev);
329 328
330 dev->current_state = 4; /* unknown power state */ 329 dev->current_state = PCI_UNKNOWN; /* unknown power state */
331 dev->error_state = pci_channel_io_normal; 330 dev->error_state = pci_channel_io_normal;
332 dev->dma_mask = 0xffffffff; 331 dev->dma_mask = 0xffffffff;
333 332
@@ -773,15 +772,6 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev,
773 return 0; 772 return 0;
774} 773}
775 774
776/* Set vm_flags of VMA, as appropriate for this architecture, for a pci device
777 * mapping.
778 */
779static void __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
780 enum pci_mmap_state mmap_state)
781{
782 vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP;
783}
784
785/* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci 775/* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
786 * device mapping. 776 * device mapping.
787 */ 777 */
@@ -809,7 +799,6 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
809 if (ret < 0) 799 if (ret < 0)
810 return ret; 800 return ret;
811 801
812 __pci_mmap_set_flags(dev, vma, mmap_state);
813 __pci_mmap_set_pgprot(dev, vma, mmap_state); 802 __pci_mmap_set_pgprot(dev, vma, mmap_state);
814 803
815 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 804 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 9f20566b0773..79cc0d1a477d 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -54,6 +54,7 @@ EXPORT_SYMBOL(of_set_property_mutex);
54int of_set_property(struct device_node *dp, const char *name, void *val, int len) 54int of_set_property(struct device_node *dp, const char *name, void *val, int len)
55{ 55{
56 struct property **prevp; 56 struct property **prevp;
57 unsigned long flags;
57 void *new_val; 58 void *new_val;
58 int err; 59 int err;
59 60
@@ -64,7 +65,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
64 err = -ENODEV; 65 err = -ENODEV;
65 66
66 mutex_lock(&of_set_property_mutex); 67 mutex_lock(&of_set_property_mutex);
67 raw_spin_lock(&devtree_lock); 68 raw_spin_lock_irqsave(&devtree_lock, flags);
68 prevp = &dp->properties; 69 prevp = &dp->properties;
69 while (*prevp) { 70 while (*prevp) {
70 struct property *prop = *prevp; 71 struct property *prop = *prevp;
@@ -91,7 +92,7 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
91 } 92 }
92 prevp = &(*prevp)->next; 93 prevp = &(*prevp)->next;
93 } 94 }
94 raw_spin_unlock(&devtree_lock); 95 raw_spin_unlock_irqrestore(&devtree_lock, flags);
95 mutex_unlock(&of_set_property_mutex); 96 mutex_unlock(&of_set_property_mutex);
96 97
97 /* XXX Upate procfs if necessary... */ 98 /* XXX Upate procfs if necessary... */
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index 38bf80a22f02..1434526970a6 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -304,7 +304,7 @@ void __init setup_arch(char **cmdline_p)
304 304
305 /* Initialize PROM console and command line. */ 305 /* Initialize PROM console and command line. */
306 *cmdline_p = prom_getbootargs(); 306 *cmdline_p = prom_getbootargs();
307 strcpy(boot_command_line, *cmdline_p); 307 strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
308 parse_early_param(); 308 parse_early_param();
309 309
310 boot_flags_init(*cmdline_p); 310 boot_flags_init(*cmdline_p);
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 88a127b9c69e..13785547e435 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -555,7 +555,7 @@ void __init setup_arch(char **cmdline_p)
555{ 555{
556 /* Initialize PROM console and command line. */ 556 /* Initialize PROM console and command line. */
557 *cmdline_p = prom_getbootargs(); 557 *cmdline_p = prom_getbootargs();
558 strcpy(boot_command_line, *cmdline_p); 558 strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
559 parse_early_param(); 559 parse_early_param();
560 560
561 boot_flags_init(*cmdline_p); 561 boot_flags_init(*cmdline_p);
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index af472cf7c69a..db6987082805 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -288,10 +288,6 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
288 288
289void __init mem_init(void) 289void __init mem_init(void)
290{ 290{
291 int codepages = 0;
292 int datapages = 0;
293 int initpages = 0;
294 int reservedpages = 0;
295 int i; 291 int i;
296 292
297 if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) { 293 if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
@@ -323,15 +319,12 @@ void __init mem_init(void)
323 319
324 max_mapnr = last_valid_pfn - pfn_base; 320 max_mapnr = last_valid_pfn - pfn_base;
325 high_memory = __va(max_low_pfn << PAGE_SHIFT); 321 high_memory = __va(max_low_pfn << PAGE_SHIFT);
326 322 free_all_bootmem();
327 totalram_pages = free_all_bootmem();
328 323
329 for (i = 0; sp_banks[i].num_bytes != 0; i++) { 324 for (i = 0; sp_banks[i].num_bytes != 0; i++) {
330 unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT; 325 unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT;
331 unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT; 326 unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT;
332 327
333 num_physpages += sp_banks[i].num_bytes >> PAGE_SHIFT;
334
335 if (end_pfn <= highstart_pfn) 328 if (end_pfn <= highstart_pfn)
336 continue; 329 continue;
337 330
@@ -341,39 +334,19 @@ void __init mem_init(void)
341 map_high_region(start_pfn, end_pfn); 334 map_high_region(start_pfn, end_pfn);
342 } 335 }
343 336
344 codepages = (((unsigned long) &_etext) - ((unsigned long)&_start)); 337 mem_init_print_info(NULL);
345 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
346 datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
347 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
348 initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin));
349 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
350
351 /* Ignore memory holes for the purpose of counting reserved pages */
352 for (i=0; i < max_low_pfn; i++)
353 if (test_bit(i >> (20 - PAGE_SHIFT), sparc_valid_addr_bitmap)
354 && PageReserved(pfn_to_page(i)))
355 reservedpages++;
356
357 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
358 nr_free_pages() << (PAGE_SHIFT-10),
359 num_physpages << (PAGE_SHIFT - 10),
360 codepages << (PAGE_SHIFT-10),
361 reservedpages << (PAGE_SHIFT - 10),
362 datapages << (PAGE_SHIFT-10),
363 initpages << (PAGE_SHIFT-10),
364 totalhigh_pages << (PAGE_SHIFT-10));
365} 338}
366 339
367void free_initmem (void) 340void free_initmem (void)
368{ 341{
369 num_physpages += free_initmem_default(POISON_FREE_INITMEM); 342 free_initmem_default(POISON_FREE_INITMEM);
370} 343}
371 344
372#ifdef CONFIG_BLK_DEV_INITRD 345#ifdef CONFIG_BLK_DEV_INITRD
373void free_initrd_mem(unsigned long start, unsigned long end) 346void free_initrd_mem(unsigned long start, unsigned long end)
374{ 347{
375 num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, 348 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
376 "initrd"); 349 "initrd");
377} 350}
378#endif 351#endif
379 352
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index a7171997adfd..a9c42a7ffb6a 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1098,7 +1098,14 @@ static int __init grab_mblocks(struct mdesc_handle *md)
1098 m->size = *val; 1098 m->size = *val;
1099 val = mdesc_get_property(md, node, 1099 val = mdesc_get_property(md, node,
1100 "address-congruence-offset", NULL); 1100 "address-congruence-offset", NULL);
1101 m->offset = *val; 1101
1102 /* The address-congruence-offset property is optional.
1103 * Explicity zero it be identifty this.
1104 */
1105 if (val)
1106 m->offset = *val;
1107 else
1108 m->offset = 0UL;
1102 1109
1103 numadbg("MBLOCK[%d]: base[%llx] size[%llx] offset[%llx]\n", 1110 numadbg("MBLOCK[%d]: base[%llx] size[%llx] offset[%llx]\n",
1104 count - 1, m->base, m->size, m->offset); 1111 count - 1, m->base, m->size, m->offset);
@@ -2038,7 +2045,6 @@ static void __init register_page_bootmem_info(void)
2038} 2045}
2039void __init mem_init(void) 2046void __init mem_init(void)
2040{ 2047{
2041 unsigned long codepages, datapages, initpages;
2042 unsigned long addr, last; 2048 unsigned long addr, last;
2043 2049
2044 addr = PAGE_OFFSET + kern_base; 2050 addr = PAGE_OFFSET + kern_base;
@@ -2054,12 +2060,7 @@ void __init mem_init(void)
2054 high_memory = __va(last_valid_pfn << PAGE_SHIFT); 2060 high_memory = __va(last_valid_pfn << PAGE_SHIFT);
2055 2061
2056 register_page_bootmem_info(); 2062 register_page_bootmem_info();
2057 totalram_pages = free_all_bootmem(); 2063 free_all_bootmem();
2058
2059 /* We subtract one to account for the mem_map_zero page
2060 * allocated below.
2061 */
2062 num_physpages = totalram_pages - 1;
2063 2064
2064 /* 2065 /*
2065 * Set up the zero page, mark it reserved, so that page count 2066 * Set up the zero page, mark it reserved, so that page count
@@ -2072,19 +2073,7 @@ void __init mem_init(void)
2072 } 2073 }
2073 mark_page_reserved(mem_map_zero); 2074 mark_page_reserved(mem_map_zero);
2074 2075
2075 codepages = (((unsigned long) _etext) - ((unsigned long) _start)); 2076 mem_init_print_info(NULL);
2076 codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
2077 datapages = (((unsigned long) _edata) - ((unsigned long) _etext));
2078 datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
2079 initpages = (((unsigned long) __init_end) - ((unsigned long) __init_begin));
2080 initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
2081
2082 printk("Memory: %luk available (%ldk kernel code, %ldk data, %ldk init) [%016lx,%016lx]\n",
2083 nr_free_pages() << (PAGE_SHIFT-10),
2084 codepages << (PAGE_SHIFT-10),
2085 datapages << (PAGE_SHIFT-10),
2086 initpages << (PAGE_SHIFT-10),
2087 PAGE_OFFSET, (last_valid_pfn << PAGE_SHIFT));
2088 2077
2089 if (tlb_type == cheetah || tlb_type == cheetah_plus) 2078 if (tlb_type == cheetah || tlb_type == cheetah_plus)
2090 cheetah_ecache_flush_init(); 2079 cheetah_ecache_flush_init();
@@ -2124,8 +2113,8 @@ void free_initmem(void)
2124#ifdef CONFIG_BLK_DEV_INITRD 2113#ifdef CONFIG_BLK_DEV_INITRD
2125void free_initrd_mem(unsigned long start, unsigned long end) 2114void free_initrd_mem(unsigned long start, unsigned long end)
2126{ 2115{
2127 num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM, 2116 free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
2128 "initrd"); 2117 "initrd");
2129} 2118}
2130#endif 2119#endif
2131 2120
diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 83d89bcb44af..7a91f288c708 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -85,8 +85,8 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
85 } 85 }
86 86
87 if (!tb->active) { 87 if (!tb->active) {
88 global_flush_tlb_page(mm, vaddr);
89 flush_tsb_user_page(mm, vaddr); 88 flush_tsb_user_page(mm, vaddr);
89 global_flush_tlb_page(mm, vaddr);
90 goto out; 90 goto out;
91 } 91 }
92 92
@@ -188,7 +188,8 @@ void set_pmd_at(struct mm_struct *mm, unsigned long addr,
188 } 188 }
189} 189}
190 190
191void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable) 191void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
192 pgtable_t pgtable)
192{ 193{
193 struct list_head *lh = (struct list_head *) pgtable; 194 struct list_head *lh = (struct list_head *) pgtable;
194 195
@@ -202,7 +203,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable)
202 mm->pmd_huge_pte = pgtable; 203 mm->pmd_huge_pte = pgtable;
203} 204}
204 205
205pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm) 206pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
206{ 207{
207 struct list_head *lh; 208 struct list_head *lh;
208 pgtable_t pgtable; 209 pgtable_t pgtable;
diff --git a/arch/sparc/prom/bootstr_32.c b/arch/sparc/prom/bootstr_32.c
index f5ec32e0d419..d2b49d2365e7 100644
--- a/arch/sparc/prom/bootstr_32.c
+++ b/arch/sparc/prom/bootstr_32.c
@@ -23,23 +23,25 @@ prom_getbootargs(void)
23 return barg_buf; 23 return barg_buf;
24 } 24 }
25 25
26 switch(prom_vers) { 26 switch (prom_vers) {
27 case PROM_V0: 27 case PROM_V0:
28 cp = barg_buf; 28 cp = barg_buf;
29 /* Start from 1 and go over fd(0,0,0)kernel */ 29 /* Start from 1 and go over fd(0,0,0)kernel */
30 for(iter = 1; iter < 8; iter++) { 30 for (iter = 1; iter < 8; iter++) {
31 arg = (*(romvec->pv_v0bootargs))->argv[iter]; 31 arg = (*(romvec->pv_v0bootargs))->argv[iter];
32 if (arg == NULL) 32 if (arg == NULL)
33 break; 33 break;
34 while(*arg != 0) { 34 while (*arg != 0) {
35 /* Leave place for space and null. */ 35 /* Leave place for space and null. */
36 if(cp >= barg_buf + BARG_LEN-2){ 36 if (cp >= barg_buf + BARG_LEN - 2)
37 /* We might issue a warning here. */ 37 /* We might issue a warning here. */
38 break; 38 break;
39 }
40 *cp++ = *arg++; 39 *cp++ = *arg++;
41 } 40 }
42 *cp++ = ' '; 41 *cp++ = ' ';
42 if (cp >= barg_buf + BARG_LEN - 1)
43 /* We might issue a warning here. */
44 break;
43 } 45 }
44 *cp = 0; 46 *cp = 0;
45 break; 47 break;
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 92204c3800b5..bd1b2a3ac34e 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -39,7 +39,7 @@ inline phandle __prom_getchild(phandle node)
39 return prom_node_to_node("child", node); 39 return prom_node_to_node("child", node);
40} 40}
41 41
42inline phandle prom_getchild(phandle node) 42phandle prom_getchild(phandle node)
43{ 43{
44 phandle cnode; 44 phandle cnode;
45 45
@@ -72,7 +72,7 @@ inline phandle __prom_getsibling(phandle node)
72 return prom_node_to_node(prom_peer_name, node); 72 return prom_node_to_node(prom_peer_name, node);
73} 73}
74 74
75inline phandle prom_getsibling(phandle node) 75phandle prom_getsibling(phandle node)
76{ 76{
77 phandle sibnode; 77 phandle sibnode;
78 78
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(prom_getsibling);
89/* Return the length in bytes of property 'prop' at node 'node'. 89/* Return the length in bytes of property 'prop' at node 'node'.
90 * Return -1 on error. 90 * Return -1 on error.
91 */ 91 */
92inline int prom_getproplen(phandle node, const char *prop) 92int prom_getproplen(phandle node, const char *prop)
93{ 93{
94 unsigned long args[6]; 94 unsigned long args[6];
95 95
@@ -113,8 +113,8 @@ EXPORT_SYMBOL(prom_getproplen);
113 * 'buffer' which has a size of 'bufsize'. If the acquisition 113 * 'buffer' which has a size of 'bufsize'. If the acquisition
114 * was successful the length will be returned, else -1 is returned. 114 * was successful the length will be returned, else -1 is returned.
115 */ 115 */
116inline int prom_getproperty(phandle node, const char *prop, 116int prom_getproperty(phandle node, const char *prop,
117 char *buffer, int bufsize) 117 char *buffer, int bufsize)
118{ 118{
119 unsigned long args[8]; 119 unsigned long args[8];
120 int plen; 120 int plen;
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(prom_getproperty);
141/* Acquire an integer property and return its value. Returns -1 141/* Acquire an integer property and return its value. Returns -1
142 * on failure. 142 * on failure.
143 */ 143 */
144inline int prom_getint(phandle node, const char *prop) 144int prom_getint(phandle node, const char *prop)
145{ 145{
146 int intprop; 146 int intprop;
147 147
@@ -235,7 +235,7 @@ static const char *prom_nextprop_name = "nextprop";
235/* Return the first property type for node 'node'. 235/* Return the first property type for node 'node'.
236 * buffer should be at least 32B in length 236 * buffer should be at least 32B in length
237 */ 237 */
238inline char *prom_firstprop(phandle node, char *buffer) 238char *prom_firstprop(phandle node, char *buffer)
239{ 239{
240 unsigned long args[7]; 240 unsigned long args[7];
241 241
@@ -261,7 +261,7 @@ EXPORT_SYMBOL(prom_firstprop);
261 * at node 'node' . Returns NULL string if no more 261 * at node 'node' . Returns NULL string if no more
262 * property types for this node. 262 * property types for this node.
263 */ 263 */
264inline char *prom_nextprop(phandle node, const char *oprop, char *buffer) 264char *prom_nextprop(phandle node, const char *oprop, char *buffer)
265{ 265{
266 unsigned long args[7]; 266 unsigned long args[7];
267 char buf[32]; 267 char buf[32];
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 3aa37669ff8c..24565a7ffe6d 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -25,6 +25,7 @@ config TILE
25 select HAVE_ARCH_TRACEHOOK 25 select HAVE_ARCH_TRACEHOOK
26 select HAVE_SYSCALL_TRACEPOINTS 26 select HAVE_SYSCALL_TRACEPOINTS
27 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 27 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
28 select HAVE_DEBUG_STACKOVERFLOW
28 29
29# FIXME: investigate whether we need/want these options. 30# FIXME: investigate whether we need/want these options.
30# select HAVE_IOREMAP_PROT 31# select HAVE_IOREMAP_PROT
diff --git a/arch/tile/Kconfig.debug b/arch/tile/Kconfig.debug
index ddbfc3322d7f..9165ea979e85 100644
--- a/arch/tile/Kconfig.debug
+++ b/arch/tile/Kconfig.debug
@@ -14,13 +14,6 @@ config EARLY_PRINTK
14 with klogd/syslogd. You should normally N here, 14 with klogd/syslogd. You should normally N here,
15 unless you want to debug such a crash. 15 unless you want to debug such a crash.
16 16
17config DEBUG_STACKOVERFLOW
18 bool "Check for stack overflows"
19 depends on DEBUG_KERNEL
20 help
21 This option will cause messages to be printed if free stack space
22 drops below a certain limit.
23
24config DEBUG_EXTRA_FLAGS 17config DEBUG_EXTRA_FLAGS
25 string "Additional compiler arguments when building with '-g'" 18 string "Additional compiler arguments when building with '-g'"
26 depends on DEBUG_INFO 19 depends on DEBUG_INFO
diff --git a/arch/tile/include/asm/pgtable.h b/arch/tile/include/asm/pgtable.h
index 73b1a4c9ad03..33587f16c152 100644
--- a/arch/tile/include/asm/pgtable.h
+++ b/arch/tile/include/asm/pgtable.h
@@ -362,9 +362,6 @@ do { \
362#define kern_addr_valid(addr) (1) 362#define kern_addr_valid(addr) (1)
363#endif /* CONFIG_FLATMEM */ 363#endif /* CONFIG_FLATMEM */
364 364
365#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
366 remap_pfn_range(vma, vaddr, pfn, size, prot)
367
368extern void vmalloc_sync_all(void); 365extern void vmalloc_sync_all(void);
369 366
370#endif /* !__ASSEMBLY__ */ 367#endif /* !__ASSEMBLY__ */
diff --git a/arch/tile/include/asm/processor.h b/arch/tile/include/asm/processor.h
index 2b70dfb1442e..b3f104953da2 100644
--- a/arch/tile/include/asm/processor.h
+++ b/arch/tile/include/asm/processor.h
@@ -225,7 +225,7 @@ extern int do_work_pending(struct pt_regs *regs, u32 flags);
225 225
226/* 226/*
227 * Return saved (kernel) PC of a blocked thread. 227 * Return saved (kernel) PC of a blocked thread.
228 * Only used in a printk() in kernel/sched.c, so don't work too hard. 228 * Only used in a printk() in kernel/sched/core.c, so don't work too hard.
229 */ 229 */
230#define thread_saved_pc(t) ((t)->thread.pc) 230#define thread_saved_pc(t) ((t)->thread.pc)
231 231
diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h
index d062d463fca9..7d8a935a9238 100644
--- a/arch/tile/include/asm/sections.h
+++ b/arch/tile/include/asm/sections.h
@@ -34,7 +34,7 @@ extern char __sys_cmpxchg_grab_lock[];
34extern char __start_atomic_asm_code[], __end_atomic_asm_code[]; 34extern char __start_atomic_asm_code[], __end_atomic_asm_code[];
35#endif 35#endif
36 36
37/* Handle the discontiguity between _sdata and _stext. */ 37/* Handle the discontiguity between _sdata and _text. */
38static inline int arch_is_kernel_data(unsigned long addr) 38static inline int arch_is_kernel_data(unsigned long addr)
39{ 39{
40 return addr >= (unsigned long)_sdata && 40 return addr >= (unsigned long)_sdata &&
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h
index 8a082bc6bca5..e4d44bd7df27 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
@@ -442,7 +442,7 @@ extern unsigned long __copy_in_user_inatomic(
442static inline unsigned long __must_check 442static inline unsigned long __must_check
443__copy_in_user(void __user *to, const void __user *from, unsigned long n) 443__copy_in_user(void __user *to, const void __user *from, unsigned long n)
444{ 444{
445 might_sleep(); 445 might_fault();
446 return __copy_in_user_inatomic(to, from, n); 446 return __copy_in_user_inatomic(to, from, n);
447} 447}
448 448
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 7a5aa1a7864e..68b542677f6a 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -307,8 +307,8 @@ static void __cpuinit store_permanent_mappings(void)
307 hv_store_mapping(addr, pages << PAGE_SHIFT, pa); 307 hv_store_mapping(addr, pages << PAGE_SHIFT, pa);
308 } 308 }
309 309
310 hv_store_mapping((HV_VirtAddr)_stext, 310 hv_store_mapping((HV_VirtAddr)_text,
311 (uint32_t)(_einittext - _stext), 0); 311 (uint32_t)(_einittext - _text), 0);
312} 312}
313 313
314/* 314/*
@@ -329,6 +329,7 @@ static void __init setup_memory(void)
329#if defined(CONFIG_HIGHMEM) || defined(__tilegx__) 329#if defined(CONFIG_HIGHMEM) || defined(__tilegx__)
330 long lowmem_pages; 330 long lowmem_pages;
331#endif 331#endif
332 unsigned long physpages = 0;
332 333
333 /* We are using a char to hold the cpu_2_node[] mapping */ 334 /* We are using a char to hold the cpu_2_node[] mapping */
334 BUILD_BUG_ON(MAX_NUMNODES > 127); 335 BUILD_BUG_ON(MAX_NUMNODES > 127);
@@ -388,8 +389,8 @@ static void __init setup_memory(void)
388 continue; 389 continue;
389 } 390 }
390 } 391 }
391 if (num_physpages + PFN_DOWN(range.size) > maxmem_pfn) { 392 if (physpages + PFN_DOWN(range.size) > maxmem_pfn) {
392 int max_size = maxmem_pfn - num_physpages; 393 int max_size = maxmem_pfn - physpages;
393 if (max_size > 0) { 394 if (max_size > 0) {
394 pr_err("Maxmem reduced node %d to %d pages\n", 395 pr_err("Maxmem reduced node %d to %d pages\n",
395 i, max_size); 396 i, max_size);
@@ -446,7 +447,7 @@ static void __init setup_memory(void)
446 node_start_pfn[i] = start; 447 node_start_pfn[i] = start;
447 node_end_pfn[i] = end; 448 node_end_pfn[i] = end;
448 node_controller[i] = range.controller; 449 node_controller[i] = range.controller;
449 num_physpages += size; 450 physpages += size;
450 max_pfn = end; 451 max_pfn = end;
451 452
452 /* Mark node as online */ 453 /* Mark node as online */
@@ -465,7 +466,7 @@ static void __init setup_memory(void)
465 * we're willing to use at 8 million pages (32GB of 4KB pages). 466 * we're willing to use at 8 million pages (32GB of 4KB pages).
466 */ 467 */
467 cap = 8 * 1024 * 1024; /* 8 million pages */ 468 cap = 8 * 1024 * 1024; /* 8 million pages */
468 if (num_physpages > cap) { 469 if (physpages > cap) {
469 int num_nodes = num_online_nodes(); 470 int num_nodes = num_online_nodes();
470 int cap_each = cap / num_nodes; 471 int cap_each = cap / num_nodes;
471 unsigned long dropped_pages = 0; 472 unsigned long dropped_pages = 0;
@@ -476,10 +477,10 @@ static void __init setup_memory(void)
476 node_end_pfn[i] = node_start_pfn[i] + cap_each; 477 node_end_pfn[i] = node_start_pfn[i] + cap_each;
477 } 478 }
478 } 479 }
479 num_physpages -= dropped_pages; 480 physpages -= dropped_pages;
480 pr_warning("Only using %ldMB memory;" 481 pr_warning("Only using %ldMB memory;"
481 " ignoring %ldMB.\n", 482 " ignoring %ldMB.\n",
482 num_physpages >> (20 - PAGE_SHIFT), 483 physpages >> (20 - PAGE_SHIFT),
483 dropped_pages >> (20 - PAGE_SHIFT)); 484 dropped_pages >> (20 - PAGE_SHIFT));
484 pr_warning("Consider using a larger page size.\n"); 485 pr_warning("Consider using a larger page size.\n");
485 } 486 }
@@ -497,7 +498,7 @@ static void __init setup_memory(void)
497 498
498 lowmem_pages = (mappable_physpages > MAXMEM_PFN) ? 499 lowmem_pages = (mappable_physpages > MAXMEM_PFN) ?
499 MAXMEM_PFN : mappable_physpages; 500 MAXMEM_PFN : mappable_physpages;
500 highmem_pages = (long) (num_physpages - lowmem_pages); 501 highmem_pages = (long) (physpages - lowmem_pages);
501 502
502 pr_notice("%ldMB HIGHMEM available.\n", 503 pr_notice("%ldMB HIGHMEM available.\n",
503 pages_to_mb(highmem_pages > 0 ? highmem_pages : 0)); 504 pages_to_mb(highmem_pages > 0 ? highmem_pages : 0));
@@ -514,7 +515,6 @@ static void __init setup_memory(void)
514 pr_warning("Use a HIGHMEM enabled kernel.\n"); 515 pr_warning("Use a HIGHMEM enabled kernel.\n");
515 max_low_pfn = MAXMEM_PFN; 516 max_low_pfn = MAXMEM_PFN;
516 max_pfn = MAXMEM_PFN; 517 max_pfn = MAXMEM_PFN;
517 num_physpages = MAXMEM_PFN;
518 node_end_pfn[0] = MAXMEM_PFN; 518 node_end_pfn[0] = MAXMEM_PFN;
519 } else { 519 } else {
520 pr_notice("%ldMB memory available.\n", 520 pr_notice("%ldMB memory available.\n",
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c
index ed258b8ae320..af8dfc9665f6 100644
--- a/arch/tile/kernel/stack.c
+++ b/arch/tile/kernel/stack.c
@@ -442,7 +442,7 @@ void _KBacktraceIterator_init_current(struct KBacktraceIterator *kbt, ulong pc,
442 regs_to_pt_regs(&regs, pc, lr, sp, r52)); 442 regs_to_pt_regs(&regs, pc, lr, sp, r52));
443} 443}
444 444
445/* This is called only from kernel/sched.c, with esp == NULL */ 445/* This is called only from kernel/sched/core.c, with esp == NULL */
446void show_stack(struct task_struct *task, unsigned long *esp) 446void show_stack(struct task_struct *task, unsigned long *esp)
447{ 447{
448 struct KBacktraceIterator kbt; 448 struct KBacktraceIterator kbt;
diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
index 631f10de12fe..a13ed902afbb 100644
--- a/arch/tile/kernel/vmlinux.lds.S
+++ b/arch/tile/kernel/vmlinux.lds.S
@@ -27,7 +27,6 @@ SECTIONS
27 .intrpt1 (LOAD_OFFSET) : AT ( 0 ) /* put at the start of physical memory */ 27 .intrpt1 (LOAD_OFFSET) : AT ( 0 ) /* put at the start of physical memory */
28 { 28 {
29 _text = .; 29 _text = .;
30 _stext = .;
31 *(.intrpt1) 30 *(.intrpt1)
32 } :intrpt1 =0 31 } :intrpt1 =0
33 32
@@ -36,6 +35,7 @@ SECTIONS
36 35
37 /* Now the real code */ 36 /* Now the real code */
38 . = ALIGN(0x20000); 37 . = ALIGN(0x20000);
38 _stext = .;
39 .text : AT (ADDR(.text) - LOAD_OFFSET) { 39 .text : AT (ADDR(.text) - LOAD_OFFSET) {
40 HEAD_TEXT 40 HEAD_TEXT
41 SCHED_TEXT 41 SCHED_TEXT
@@ -58,11 +58,13 @@ SECTIONS
58 #define LOAD_OFFSET PAGE_OFFSET 58 #define LOAD_OFFSET PAGE_OFFSET
59 59
60 . = ALIGN(PAGE_SIZE); 60 . = ALIGN(PAGE_SIZE);
61 __init_begin = .;
61 VMLINUX_SYMBOL(_sinitdata) = .; 62 VMLINUX_SYMBOL(_sinitdata) = .;
62 INIT_DATA_SECTION(16) :data =0 63 INIT_DATA_SECTION(16) :data =0
63 PERCPU_SECTION(L2_CACHE_BYTES) 64 PERCPU_SECTION(L2_CACHE_BYTES)
64 . = ALIGN(PAGE_SIZE); 65 . = ALIGN(PAGE_SIZE);
65 VMLINUX_SYMBOL(_einitdata) = .; 66 VMLINUX_SYMBOL(_einitdata) = .;
67 __init_end = .;
66 68
67 _sdata = .; /* Start of data section */ 69 _sdata = .; /* Start of data section */
68 70
diff --git a/arch/tile/lib/exports.c b/arch/tile/lib/exports.c
index 4385cb6fa00a..a93b02a25222 100644
--- a/arch/tile/lib/exports.c
+++ b/arch/tile/lib/exports.c
@@ -84,4 +84,6 @@ uint64_t __ashrdi3(uint64_t, unsigned int);
84EXPORT_SYMBOL(__ashrdi3); 84EXPORT_SYMBOL(__ashrdi3);
85uint64_t __ashldi3(uint64_t, unsigned int); 85uint64_t __ashldi3(uint64_t, unsigned int);
86EXPORT_SYMBOL(__ashldi3); 86EXPORT_SYMBOL(__ashldi3);
87int __ffsdi2(uint64_t);
88EXPORT_SYMBOL(__ffsdi2);
87#endif 89#endif
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 2749515a0547..e182958c707d 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -562,7 +562,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
562 prot = ktext_set_nocache(prot); 562 prot = ktext_set_nocache(prot);
563 } 563 }
564 564
565 BUG_ON(address != (unsigned long)_stext); 565 BUG_ON(address != (unsigned long)_text);
566 pte = NULL; 566 pte = NULL;
567 for (; address < (unsigned long)_einittext; 567 for (; address < (unsigned long)_einittext;
568 pfn++, address += PAGE_SIZE) { 568 pfn++, address += PAGE_SIZE) {
@@ -720,7 +720,7 @@ static void __init init_free_pfn_range(unsigned long start, unsigned long end)
720 } 720 }
721 init_page_count(page); 721 init_page_count(page);
722 __free_pages(page, order); 722 __free_pages(page, order);
723 totalram_pages += count; 723 adjust_managed_page_count(page, count);
724 724
725 page += count; 725 page += count;
726 pfn += count; 726 pfn += count;
@@ -821,7 +821,6 @@ static void __init set_max_mapnr_init(void)
821 821
822void __init mem_init(void) 822void __init mem_init(void)
823{ 823{
824 int codesize, datasize, initsize;
825 int i; 824 int i;
826#ifndef __tilegx__ 825#ifndef __tilegx__
827 void *last; 826 void *last;
@@ -846,26 +845,14 @@ void __init mem_init(void)
846 set_max_mapnr_init(); 845 set_max_mapnr_init();
847 846
848 /* this will put all bootmem onto the freelists */ 847 /* this will put all bootmem onto the freelists */
849 totalram_pages += free_all_bootmem(); 848 free_all_bootmem();
850 849
851#ifndef CONFIG_64BIT 850#ifndef CONFIG_64BIT
852 /* count all remaining LOWMEM and give all HIGHMEM to page allocator */ 851 /* count all remaining LOWMEM and give all HIGHMEM to page allocator */
853 set_non_bootmem_pages_init(); 852 set_non_bootmem_pages_init();
854#endif 853#endif
855 854
856 codesize = (unsigned long)&_etext - (unsigned long)&_text; 855 mem_init_print_info(NULL);
857 datasize = (unsigned long)&_end - (unsigned long)&_sdata;
858 initsize = (unsigned long)&_einittext - (unsigned long)&_sinittext;
859 initsize += (unsigned long)&_einitdata - (unsigned long)&_sinitdata;
860
861 pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init, %ldk highmem)\n",
862 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
863 num_physpages << (PAGE_SHIFT-10),
864 codesize >> 10,
865 datasize >> 10,
866 initsize >> 10,
867 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))
868 );
869 856
870 /* 857 /*
871 * In debug mode, dump some interesting memory mappings. 858 * In debug mode, dump some interesting memory mappings.
@@ -1024,16 +1011,13 @@ static void free_init_pages(char *what, unsigned long begin, unsigned long end)
1024 pte_clear(&init_mm, addr, ptep); 1011 pte_clear(&init_mm, addr, ptep);
1025 continue; 1012 continue;
1026 } 1013 }
1027 __ClearPageReserved(page);
1028 init_page_count(page);
1029 if (pte_huge(*ptep)) 1014 if (pte_huge(*ptep))
1030 BUG_ON(!kdata_huge); 1015 BUG_ON(!kdata_huge);
1031 else 1016 else
1032 set_pte_at(&init_mm, addr, ptep, 1017 set_pte_at(&init_mm, addr, ptep,
1033 pfn_pte(pfn, PAGE_KERNEL)); 1018 pfn_pte(pfn, PAGE_KERNEL));
1034 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE); 1019 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
1035 free_page(addr); 1020 free_reserved_page(page);
1036 totalram_pages++;
1037 } 1021 }
1038 pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10); 1022 pr_info("Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
1039} 1023}
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index d7d21851e60c..3df3bd544492 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -147,7 +147,7 @@ void mconsole_proc(struct mc_request *req)
147 } 147 }
148 148
149 do { 149 do {
150 loff_t pos; 150 loff_t pos = file->f_pos;
151 mm_segment_t old_fs = get_fs(); 151 mm_segment_t old_fs = get_fs();
152 set_fs(KERNEL_DS); 152 set_fs(KERNEL_DS);
153 len = vfs_read(file, buf, PAGE_SIZE - 1, &pos); 153 len = vfs_read(file, buf, PAGE_SIZE - 1, &pos);
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
index 4938de5512d2..1dd5bd8a8c59 100644
--- a/arch/um/include/asm/common.lds.S
+++ b/arch/um/include/asm/common.lds.S
@@ -57,7 +57,6 @@
57 *(.uml.initcall.init) 57 *(.uml.initcall.init)
58 __uml_initcall_end = .; 58 __uml_initcall_end = .;
59 } 59 }
60 __init_end = .;
61 60
62 SECURITY_INIT 61 SECURITY_INIT
63 62
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
index ae02909a1875..bf974f712af7 100644
--- a/arch/um/include/asm/pgtable.h
+++ b/arch/um/include/asm/pgtable.h
@@ -69,8 +69,6 @@ extern unsigned long end_iomem;
69#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED) 69#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
70#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) 70#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC)
71 71
72#define io_remap_pfn_range remap_pfn_range
73
74/* 72/*
75 * The i386 can't do page protection for execute, and considers that the same 73 * The i386 can't do page protection for execute, and considers that the same
76 * are read. 74 * are read.
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index fb8fd6fb6563..adde088aeeff 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -14,8 +14,6 @@ SECTIONS
14 __binary_start = .; 14 __binary_start = .;
15 . = ALIGN(4096); /* Init code and data */ 15 . = ALIGN(4096); /* Init code and data */
16 _text = .; 16 _text = .;
17 _stext = .;
18 __init_begin = .;
19 INIT_TEXT_SECTION(PAGE_SIZE) 17 INIT_TEXT_SECTION(PAGE_SIZE)
20 18
21 . = ALIGN(PAGE_SIZE); 19 . = ALIGN(PAGE_SIZE);
@@ -67,6 +65,7 @@ SECTIONS
67 } =0x90909090 65 } =0x90909090
68 .plt : { *(.plt) } 66 .plt : { *(.plt) }
69 .text : { 67 .text : {
68 _stext = .;
70 TEXT_TEXT 69 TEXT_TEXT
71 SCHED_TEXT 70 SCHED_TEXT
72 LOCK_TEXT 71 LOCK_TEXT
@@ -91,7 +90,9 @@ SECTIONS
91 90
92 #include <asm/common.lds.S> 91 #include <asm/common.lds.S>
93 92
93 __init_begin = .;
94 init.data : { INIT_DATA } 94 init.data : { INIT_DATA }
95 __init_end = .;
95 96
96 /* Ensure the __preinit_array_start label is properly aligned. We 97 /* Ensure the __preinit_array_start label is properly aligned. We
97 could instead move the label definition inside the section, but 98 could instead move the label definition inside the section, but
@@ -155,6 +156,7 @@ SECTIONS
155 . = ALIGN(32 / 8); 156 . = ALIGN(32 / 8);
156 . = ALIGN(32 / 8); 157 . = ALIGN(32 / 8);
157 } 158 }
159 __bss_stop = .;
158 _end = .; 160 _end = .;
159 PROVIDE (end = .); 161 PROVIDE (end = .);
160 162
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 9df292b270a8..7ddb64baf327 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -65,15 +65,13 @@ void __init mem_init(void)
65 uml_reserved = brk_end; 65 uml_reserved = brk_end;
66 66
67 /* this will put all low memory onto the freelists */ 67 /* this will put all low memory onto the freelists */
68 totalram_pages = free_all_bootmem(); 68 free_all_bootmem();
69 max_low_pfn = totalram_pages; 69 max_low_pfn = totalram_pages;
70#ifdef CONFIG_HIGHMEM 70#ifdef CONFIG_HIGHMEM
71 setup_highmem(end_iomem, highmem); 71 setup_highmem(end_iomem, highmem);
72#endif 72#endif
73 num_physpages = totalram_pages;
74 max_pfn = totalram_pages; 73 max_pfn = totalram_pages;
75 printk(KERN_INFO "Memory: %luk available\n", 74 mem_init_print_info(NULL);
76 nr_free_pages() << (PAGE_SHIFT-10));
77 kmalloc_ok = 1; 75 kmalloc_ok = 1;
78} 76}
79 77
@@ -244,7 +242,7 @@ void free_initmem(void)
244#ifdef CONFIG_BLK_DEV_INITRD 242#ifdef CONFIG_BLK_DEV_INITRD
245void free_initrd_mem(unsigned long start, unsigned long end) 243void free_initrd_mem(unsigned long start, unsigned long end)
246{ 244{
247 free_reserved_area(start, end, 0, "initrd"); 245 free_reserved_area((void *)start, (void *)end, -1, "initrd");
248} 246}
249#endif 247#endif
250 248
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c
index 7d101a2a1541..0dc4d1c6f98a 100644
--- a/arch/um/kernel/sysrq.c
+++ b/arch/um/kernel/sysrq.c
@@ -39,7 +39,7 @@ void show_trace(struct task_struct *task, unsigned long * stack)
39static const int kstack_depth_to_print = 24; 39static const int kstack_depth_to_print = 24;
40 40
41/* This recently started being used in arch-independent code too, as in 41/* This recently started being used in arch-independent code too, as in
42 * kernel/sched.c.*/ 42 * kernel/sched/core.c.*/
43void show_stack(struct task_struct *task, unsigned long *esp) 43void show_stack(struct task_struct *task, unsigned long *esp)
44{ 44{
45 unsigned long *stack; 45 unsigned long *stack;
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index ff65fb4f1a95..6899195602b7 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -20,13 +20,12 @@ SECTIONS
20 . = START + SIZEOF_HEADERS; 20 . = START + SIZEOF_HEADERS;
21 21
22 _text = .; 22 _text = .;
23 _stext = .;
24 __init_begin = .;
25 INIT_TEXT_SECTION(0) 23 INIT_TEXT_SECTION(0)
26 . = ALIGN(PAGE_SIZE); 24 . = ALIGN(PAGE_SIZE);
27 25
28 .text : 26 .text :
29 { 27 {
28 _stext = .;
30 TEXT_TEXT 29 TEXT_TEXT
31 SCHED_TEXT 30 SCHED_TEXT
32 LOCK_TEXT 31 LOCK_TEXT
@@ -62,7 +61,10 @@ SECTIONS
62 61
63 #include <asm/common.lds.S> 62 #include <asm/common.lds.S>
64 63
64 __init_begin = .;
65 init.data : { INIT_DATA } 65 init.data : { INIT_DATA }
66 __init_end = .;
67
66 .data : 68 .data :
67 { 69 {
68 INIT_TASK_DATA(KERNEL_STACK_SIZE) 70 INIT_TASK_DATA(KERNEL_STACK_SIZE)
@@ -97,6 +99,7 @@ SECTIONS
97 PROVIDE(_bss_start = .); 99 PROVIDE(_bss_start = .);
98 SBSS(0) 100 SBSS(0)
99 BSS(0) 101 BSS(0)
102 __bss_stop = .;
100 _end = .; 103 _end = .;
101 PROVIDE (end = .); 104 PROVIDE (end = .);
102 105
diff --git a/arch/unicore32/boot/compressed/Makefile b/arch/unicore32/boot/compressed/Makefile
index 950a9afa38f8..96494fb646f7 100644
--- a/arch/unicore32/boot/compressed/Makefile
+++ b/arch/unicore32/boot/compressed/Makefile
@@ -17,7 +17,7 @@ OBJS := misc.o
17 17
18# font.c and font.o 18# font.c and font.o
19CFLAGS_font.o := -Dstatic= 19CFLAGS_font.o := -Dstatic=
20$(obj)/font.c: $(srctree)/drivers/video/console/font_8x8.c 20$(obj)/font.c: $(srctree)/lib/fonts/font_8x8.c
21 $(call cmd,shipped) 21 $(call cmd,shipped)
22 22
23# piggy.S and piggy.o 23# piggy.S and piggy.o
diff --git a/arch/unicore32/include/asm/memory.h b/arch/unicore32/include/asm/memory.h
index 5eddb997defe..debafc40200a 100644
--- a/arch/unicore32/include/asm/memory.h
+++ b/arch/unicore32/include/asm/memory.h
@@ -98,12 +98,6 @@
98/* 98/*
99 * Conversion between a struct page and a physical address. 99 * Conversion between a struct page and a physical address.
100 * 100 *
101 * Note: when converting an unknown physical address to a
102 * struct page, the resulting pointer must be validated
103 * using VALID_PAGE(). It must return an invalid struct page
104 * for any physical address not corresponding to a system
105 * RAM address.
106 *
107 * page_to_pfn(page) convert a struct page * to a PFN number 101 * page_to_pfn(page) convert a struct page * to a PFN number
108 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page * 102 * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
109 * 103 *
diff --git a/arch/unicore32/include/asm/pgtable.h b/arch/unicore32/include/asm/pgtable.h
index 68b2f297ac97..233c25880df4 100644
--- a/arch/unicore32/include/asm/pgtable.h
+++ b/arch/unicore32/include/asm/pgtable.h
@@ -303,13 +303,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
303 303
304#include <asm-generic/pgtable.h> 304#include <asm-generic/pgtable.h>
305 305
306/*
307 * remap a physical page `pfn' of size `size' with page protection `prot'
308 * into virtual address `from'
309 */
310#define io_remap_pfn_range(vma, from, pfn, size, prot) \
311 remap_pfn_range(vma, from, pfn, size, prot)
312
313#define pgtable_cache_init() do { } while (0) 306#define pgtable_cache_init() do { } while (0)
314 307
315#endif /* !__ASSEMBLY__ */ 308#endif /* !__ASSEMBLY__ */
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index ef69c0c82825..374a055a8e6b 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -277,11 +277,6 @@ static int __init pci_common_init(void)
277 pci_bus_assign_resources(puv3_bus); 277 pci_bus_assign_resources(puv3_bus);
278 } 278 }
279 279
280 /*
281 * Tell drivers about devices found.
282 */
283 pci_bus_add_devices(puv3_bus);
284
285 return 0; 280 return 0;
286} 281}
287subsys_initcall(pci_common_init); 282subsys_initcall(pci_common_init);
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index 63df12d71ce3..ae6bc036db92 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -383,59 +383,14 @@ static void __init free_unused_memmap(struct meminfo *mi)
383 */ 383 */
384void __init mem_init(void) 384void __init mem_init(void)
385{ 385{
386 unsigned long reserved_pages, free_pages;
387 struct memblock_region *reg;
388 int i;
389
390 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 386 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
391 387
392 free_unused_memmap(&meminfo); 388 free_unused_memmap(&meminfo);
393 389
394 /* this will put all unused low memory onto the freelists */ 390 /* this will put all unused low memory onto the freelists */
395 totalram_pages += free_all_bootmem(); 391 free_all_bootmem();
396
397 reserved_pages = free_pages = 0;
398
399 for_each_bank(i, &meminfo) {
400 struct membank *bank = &meminfo.bank[i];
401 unsigned int pfn1, pfn2;
402 struct page *page, *end;
403
404 pfn1 = bank_pfn_start(bank);
405 pfn2 = bank_pfn_end(bank);
406
407 page = pfn_to_page(pfn1);
408 end = pfn_to_page(pfn2 - 1) + 1;
409
410 do {
411 if (PageReserved(page))
412 reserved_pages++;
413 else if (!page_count(page))
414 free_pages++;
415 page++;
416 } while (page < end);
417 }
418
419 /*
420 * Since our memory may not be contiguous, calculate the
421 * real number of pages we have in this system
422 */
423 printk(KERN_INFO "Memory:");
424 num_physpages = 0;
425 for_each_memblock(memory, reg) {
426 unsigned long pages = memblock_region_memory_end_pfn(reg) -
427 memblock_region_memory_base_pfn(reg);
428 num_physpages += pages;
429 printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
430 }
431 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
432
433 printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
434 nr_free_pages() << (PAGE_SHIFT-10),
435 free_pages << (PAGE_SHIFT-10),
436 reserved_pages << (PAGE_SHIFT-10),
437 totalhigh_pages << (PAGE_SHIFT-10));
438 392
393 mem_init_print_info(NULL);
439 printk(KERN_NOTICE "Virtual kernel memory layout:\n" 394 printk(KERN_NOTICE "Virtual kernel memory layout:\n"
440 " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" 395 " vector : 0x%08lx - 0x%08lx (%4ld kB)\n"
441 " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" 396 " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
@@ -464,7 +419,7 @@ void __init mem_init(void)
464 BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); 419 BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
465 BUG_ON(TASK_SIZE > MODULES_VADDR); 420 BUG_ON(TASK_SIZE > MODULES_VADDR);
466 421
467 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 422 if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
468 /* 423 /*
469 * On a machine this small we won't get 424 * On a machine this small we won't get
470 * anywhere without overcommit, so turn 425 * anywhere without overcommit, so turn
@@ -476,7 +431,7 @@ void __init mem_init(void)
476 431
477void free_initmem(void) 432void free_initmem(void)
478{ 433{
479 free_initmem_default(0); 434 free_initmem_default(-1);
480} 435}
481 436
482#ifdef CONFIG_BLK_DEV_INITRD 437#ifdef CONFIG_BLK_DEV_INITRD
@@ -486,7 +441,7 @@ static int keep_initrd;
486void free_initrd_mem(unsigned long start, unsigned long end) 441void free_initrd_mem(unsigned long start, unsigned long end)
487{ 442{
488 if (!keep_initrd) 443 if (!keep_initrd)
489 free_reserved_area(start, end, 0, "initrd"); 444 free_reserved_area((void *)start, (void *)end, -1, "initrd");
490} 445}
491 446
492static int __init keepinitrd_setup(char *__unused) 447static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 685692c94f05..265c672a2f40 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -102,6 +102,7 @@ config X86
102 select HAVE_ARCH_SECCOMP_FILTER 102 select HAVE_ARCH_SECCOMP_FILTER
103 select BUILDTIME_EXTABLE_SORT 103 select BUILDTIME_EXTABLE_SORT
104 select GENERIC_CMOS_UPDATE 104 select GENERIC_CMOS_UPDATE
105 select HAVE_ARCH_SOFT_DIRTY
105 select CLOCKSOURCE_WATCHDOG 106 select CLOCKSOURCE_WATCHDOG
106 select GENERIC_CLOCKEVENTS 107 select GENERIC_CLOCKEVENTS
107 select ARCH_CLOCKSOURCE_DATA if X86_64 108 select ARCH_CLOCKSOURCE_DATA if X86_64
@@ -121,6 +122,7 @@ config X86
121 select OLD_SIGACTION if X86_32 122 select OLD_SIGACTION if X86_32
122 select COMPAT_OLD_SIGACTION if IA32_EMULATION 123 select COMPAT_OLD_SIGACTION if IA32_EMULATION
123 select RTC_LIB 124 select RTC_LIB
125 select HAVE_DEBUG_STACKOVERFLOW
124 126
125config INSTRUCTION_DECODER 127config INSTRUCTION_DECODER
126 def_bool y 128 def_bool y
@@ -207,6 +209,12 @@ config ARCH_HIBERNATION_POSSIBLE
207config ARCH_SUSPEND_POSSIBLE 209config ARCH_SUSPEND_POSSIBLE
208 def_bool y 210 def_bool y
209 211
212config ARCH_WANT_HUGE_PMD_SHARE
213 def_bool y
214
215config ARCH_WANT_GENERAL_HUGETLB
216 def_bool y
217
210config ZONE_DMA32 218config ZONE_DMA32
211 bool 219 bool
212 default X86_64 220 default X86_64
@@ -336,6 +344,7 @@ config X86_EXTENDED_PLATFORM
336 344
337 If you enable this option then you'll be able to select support 345 If you enable this option then you'll be able to select support
338 for the following (non-PC) 32 bit x86 platforms: 346 for the following (non-PC) 32 bit x86 platforms:
347 Goldfish (Android emulator)
339 AMD Elan 348 AMD Elan
340 NUMAQ (IBM/Sequent) 349 NUMAQ (IBM/Sequent)
341 RDC R-321x SoC 350 RDC R-321x SoC
@@ -410,6 +419,7 @@ config X86_UV
410config X86_GOLDFISH 419config X86_GOLDFISH
411 bool "Goldfish (Virtual Platform)" 420 bool "Goldfish (Virtual Platform)"
412 depends on X86_32 421 depends on X86_32
422 depends on X86_EXTENDED_PLATFORM
413 ---help--- 423 ---help---
414 Enable support for the Goldfish virtual platform used primarily 424 Enable support for the Goldfish virtual platform used primarily
415 for Android development. Unless you are building for the Android 425 for Android development. Unless you are building for the Android
@@ -1058,8 +1068,16 @@ config MICROCODE_INTEL_LIB
1058 depends on MICROCODE_INTEL 1068 depends on MICROCODE_INTEL
1059 1069
1060config MICROCODE_INTEL_EARLY 1070config MICROCODE_INTEL_EARLY
1071 def_bool n
1072
1073config MICROCODE_AMD_EARLY
1074 def_bool n
1075
1076config MICROCODE_EARLY
1061 bool "Early load microcode" 1077 bool "Early load microcode"
1062 depends on MICROCODE_INTEL && BLK_DEV_INITRD 1078 depends on MICROCODE=y && BLK_DEV_INITRD
1079 select MICROCODE_INTEL_EARLY if MICROCODE_INTEL
1080 select MICROCODE_AMD_EARLY if MICROCODE_AMD
1063 default y 1081 default y
1064 help 1082 help
1065 This option provides functionality to read additional microcode data 1083 This option provides functionality to read additional microcode data
@@ -1067,10 +1085,6 @@ config MICROCODE_INTEL_EARLY
1067 microcode to CPU's as early as possible. No functional change if no 1085 microcode to CPU's as early as possible. No functional change if no
1068 microcode data is glued to the initrd, therefore it's safe to say Y. 1086 microcode data is glued to the initrd, therefore it's safe to say Y.
1069 1087
1070config MICROCODE_EARLY
1071 def_bool y
1072 depends on MICROCODE_INTEL_EARLY
1073
1074config X86_MSR 1088config X86_MSR
1075 tristate "/dev/cpu/*/msr - Model-specific register support" 1089 tristate "/dev/cpu/*/msr - Model-specific register support"
1076 ---help--- 1090 ---help---
@@ -1725,7 +1739,7 @@ config PHYSICAL_ALIGN
1725 1739
1726config HOTPLUG_CPU 1740config HOTPLUG_CPU
1727 bool "Support for hot-pluggable CPUs" 1741 bool "Support for hot-pluggable CPUs"
1728 depends on SMP && HOTPLUG 1742 depends on SMP
1729 ---help--- 1743 ---help---
1730 Say Y here to allow turning CPUs off and on. CPUs can be 1744 Say Y here to allow turning CPUs off and on. CPUs can be
1731 controlled through /sys/devices/system/cpu. 1745 controlled through /sys/devices/system/cpu.
@@ -2246,11 +2260,11 @@ source "drivers/pcmcia/Kconfig"
2246source "drivers/pci/hotplug/Kconfig" 2260source "drivers/pci/hotplug/Kconfig"
2247 2261
2248config RAPIDIO 2262config RAPIDIO
2249 bool "RapidIO support" 2263 tristate "RapidIO support"
2250 depends on PCI 2264 depends on PCI
2251 default n 2265 default n
2252 help 2266 help
2253 If you say Y here, the kernel will include drivers and 2267 If enabled this option will include drivers and the core
2254 infrastructure code to support RapidIO interconnect devices. 2268 infrastructure code to support RapidIO interconnect devices.
2255 2269
2256source "drivers/rapidio/Kconfig" 2270source "drivers/rapidio/Kconfig"
@@ -2265,6 +2279,7 @@ source "fs/Kconfig.binfmt"
2265config IA32_EMULATION 2279config IA32_EMULATION
2266 bool "IA32 Emulation" 2280 bool "IA32 Emulation"
2267 depends on X86_64 2281 depends on X86_64
2282 select BINFMT_ELF
2268 select COMPAT_BINFMT_ELF 2283 select COMPAT_BINFMT_ELF
2269 select HAVE_UID16 2284 select HAVE_UID16
2270 ---help--- 2285 ---help---
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index c198b7e13e7b..78d91afb8e50 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -59,16 +59,6 @@ config EARLY_PRINTK_DBGP
59 with klogd/syslogd or the X server. You should normally N here, 59 with klogd/syslogd or the X server. You should normally N here,
60 unless you want to debug such a crash. You need usb debug device. 60 unless you want to debug such a crash. You need usb debug device.
61 61
62config DEBUG_STACKOVERFLOW
63 bool "Check for stack overflows"
64 depends on DEBUG_KERNEL
65 ---help---
66 Say Y here if you want to check the overflows of kernel, IRQ
67 and exception stacks. This option will cause messages of the
68 stacks in detail when free stack space drops below a certain
69 limit.
70 If in doubt, say "N".
71
72config X86_PTDUMP 62config X86_PTDUMP
73 bool "Export kernel pagetable layout to userspace via debugfs" 63 bool "Export kernel pagetable layout to userspace via debugfs"
74 depends on DEBUG_KERNEL 64 depends on DEBUG_KERNEL
@@ -122,7 +112,6 @@ config DEBUG_NX_TEST
122config DOUBLEFAULT 112config DOUBLEFAULT
123 default y 113 default y
124 bool "Enable doublefault exception handler" if EXPERT 114 bool "Enable doublefault exception handler" if EXPERT
125 depends on X86_32
126 ---help--- 115 ---help---
127 This option allows trapping of rare doublefault exceptions that 116 This option allows trapping of rare doublefault exceptions that
128 would otherwise cause a system to silently reboot. Disabling this 117 would otherwise cause a system to silently reboot. Disabling this
@@ -304,4 +293,14 @@ config DEBUG_NMI_SELFTEST
304 293
305 If unsure, say N. 294 If unsure, say N.
306 295
296config X86_DEBUG_STATIC_CPU_HAS
297 bool "Debug alternatives"
298 depends on DEBUG_KERNEL
299 ---help---
300 This option causes additional code to be generated which
301 fails if static_cpu_has() is used before alternatives have
302 run.
303
304 If unsure, say N.
305
307endmenu 306endmenu
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5c477260294f..07639c656fcd 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -220,6 +220,12 @@ archclean:
220 $(Q)$(MAKE) $(clean)=$(boot) 220 $(Q)$(MAKE) $(clean)=$(boot)
221 $(Q)$(MAKE) $(clean)=arch/x86/tools 221 $(Q)$(MAKE) $(clean)=arch/x86/tools
222 222
223PHONY += kvmconfig
224kvmconfig:
225 $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
226 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config arch/x86/configs/kvm_guest.config
227 $(Q)yes "" | $(MAKE) oldconfig
228
223define archhelp 229define archhelp
224 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)' 230 echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
225 echo ' install - Install kernel using' 231 echo ' install - Install kernel using'
@@ -233,4 +239,5 @@ define archhelp
233 echo ' bzdisk/fdimage*/isoimage also accept:' 239 echo ' bzdisk/fdimage*/isoimage also accept:'
234 echo ' FDARGS="..." arguments for the booted kernel' 240 echo ' FDARGS="..." arguments for the booted kernel'
235 echo ' FDINITRD=file initrd for the booted kernel' 241 echo ' FDINITRD=file initrd for the booted kernel'
242 echo ' kvmconfig - Enable additional options for guest kernel support'
236endef 243endef
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 35ee62fccf98..d606463aa6d6 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -251,51 +251,6 @@ static void find_bits(unsigned long mask, u8 *pos, u8 *size)
251 *size = len; 251 *size = len;
252} 252}
253 253
254static efi_status_t setup_efi_vars(struct boot_params *params)
255{
256 struct setup_data *data;
257 struct efi_var_bootdata *efidata;
258 u64 store_size, remaining_size, var_size;
259 efi_status_t status;
260
261 if (sys_table->runtime->hdr.revision < EFI_2_00_SYSTEM_TABLE_REVISION)
262 return EFI_UNSUPPORTED;
263
264 data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
265
266 while (data && data->next)
267 data = (struct setup_data *)(unsigned long)data->next;
268
269 status = efi_call_phys4((void *)sys_table->runtime->query_variable_info,
270 EFI_VARIABLE_NON_VOLATILE |
271 EFI_VARIABLE_BOOTSERVICE_ACCESS |
272 EFI_VARIABLE_RUNTIME_ACCESS, &store_size,
273 &remaining_size, &var_size);
274
275 if (status != EFI_SUCCESS)
276 return status;
277
278 status = efi_call_phys3(sys_table->boottime->allocate_pool,
279 EFI_LOADER_DATA, sizeof(*efidata), &efidata);
280
281 if (status != EFI_SUCCESS)
282 return status;
283
284 efidata->data.type = SETUP_EFI_VARS;
285 efidata->data.len = sizeof(struct efi_var_bootdata) -
286 sizeof(struct setup_data);
287 efidata->data.next = 0;
288 efidata->store_size = store_size;
289 efidata->remaining_size = remaining_size;
290 efidata->max_var_size = var_size;
291
292 if (data)
293 data->next = (unsigned long)efidata;
294 else
295 params->hdr.setup_data = (unsigned long)efidata;
296
297}
298
299static efi_status_t setup_efi_pci(struct boot_params *params) 254static efi_status_t setup_efi_pci(struct boot_params *params)
300{ 255{
301 efi_pci_io_protocol *pci; 256 efi_pci_io_protocol *pci;
@@ -1037,18 +992,20 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
1037 efi_memory_desc_t *mem_map; 992 efi_memory_desc_t *mem_map;
1038 efi_status_t status; 993 efi_status_t status;
1039 __u32 desc_version; 994 __u32 desc_version;
995 bool called_exit = false;
1040 u8 nr_entries; 996 u8 nr_entries;
1041 int i; 997 int i;
1042 998
1043 size = sizeof(*mem_map) * 32; 999 size = sizeof(*mem_map) * 32;
1044 1000
1045again: 1001again:
1046 size += sizeof(*mem_map); 1002 size += sizeof(*mem_map) * 2;
1047 _size = size; 1003 _size = size;
1048 status = low_alloc(size, 1, (unsigned long *)&mem_map); 1004 status = low_alloc(size, 1, (unsigned long *)&mem_map);
1049 if (status != EFI_SUCCESS) 1005 if (status != EFI_SUCCESS)
1050 return status; 1006 return status;
1051 1007
1008get_map:
1052 status = efi_call_phys5(sys_table->boottime->get_memory_map, &size, 1009 status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
1053 mem_map, &key, &desc_size, &desc_version); 1010 mem_map, &key, &desc_size, &desc_version);
1054 if (status == EFI_BUFFER_TOO_SMALL) { 1011 if (status == EFI_BUFFER_TOO_SMALL) {
@@ -1074,8 +1031,20 @@ again:
1074 /* Might as well exit boot services now */ 1031 /* Might as well exit boot services now */
1075 status = efi_call_phys2(sys_table->boottime->exit_boot_services, 1032 status = efi_call_phys2(sys_table->boottime->exit_boot_services,
1076 handle, key); 1033 handle, key);
1077 if (status != EFI_SUCCESS) 1034 if (status != EFI_SUCCESS) {
1078 goto free_mem_map; 1035 /*
1036 * ExitBootServices() will fail if any of the event
1037 * handlers change the memory map. In which case, we
1038 * must be prepared to retry, but only once so that
1039 * we're guaranteed to exit on repeated failures instead
1040 * of spinning forever.
1041 */
1042 if (called_exit)
1043 goto free_mem_map;
1044
1045 called_exit = true;
1046 goto get_map;
1047 }
1079 1048
1080 /* Historic? */ 1049 /* Historic? */
1081 boot_params->alt_mem_k = 32 * 1024; 1050 boot_params->alt_mem_k = 32 * 1024;
@@ -1202,8 +1171,6 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
1202 1171
1203 setup_graphics(boot_params); 1172 setup_graphics(boot_params);
1204 1173
1205 setup_efi_vars(boot_params);
1206
1207 setup_efi_pci(boot_params); 1174 setup_efi_pci(boot_params);
1208 1175
1209 status = efi_call_phys3(sys_table->boottime->allocate_pool, 1176 status = efi_call_phys3(sys_table->boottime->allocate_pool,
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 16f24e6dad79..06e71c2c16bf 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -27,8 +27,6 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/linkage.h> 28#include <linux/linkage.h>
29#include <asm/segment.h> 29#include <asm/segment.h>
30#include <asm/pgtable_types.h>
31#include <asm/page_types.h>
32#include <asm/boot.h> 30#include <asm/boot.h>
33#include <asm/msr.h> 31#include <asm/msr.h>
34#include <asm/processor-flags.h> 32#include <asm/processor-flags.h>
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index 94c544650020..c941d6a8887f 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -243,6 +243,7 @@ static void parse_zoffset(char *fname)
243 c = fread(buf, 1, sizeof(buf) - 1, file); 243 c = fread(buf, 1, sizeof(buf) - 1, file);
244 if (ferror(file)) 244 if (ferror(file))
245 die("read-error on `zoffset.h'"); 245 die("read-error on `zoffset.h'");
246 fclose(file);
246 buf[c] = 0; 247 buf[c] = 0;
247 248
248 p = (char *)buf; 249 p = (char *)buf;
diff --git a/arch/x86/configs/kvm_guest.config b/arch/x86/configs/kvm_guest.config
new file mode 100644
index 000000000000..f9affcc3b9f1
--- /dev/null
+++ b/arch/x86/configs/kvm_guest.config
@@ -0,0 +1,28 @@
1CONFIG_NET=y
2CONFIG_NET_CORE=y
3CONFIG_NETDEVICES=y
4CONFIG_BLOCK=y
5CONFIG_BLK_DEV=y
6CONFIG_NETWORK_FILESYSTEMS=y
7CONFIG_INET=y
8CONFIG_TTY=y
9CONFIG_SERIAL_8250=y
10CONFIG_SERIAL_8250_CONSOLE=y
11CONFIG_IP_PNP=y
12CONFIG_IP_PNP_DHCP=y
13CONFIG_BINFMT_ELF=y
14CONFIG_PCI=y
15CONFIG_PCI_MSI=y
16CONFIG_DEBUG_KERNEL=y
17CONFIG_VIRTUALIZATION=y
18CONFIG_HYPERVISOR_GUEST=y
19CONFIG_PARAVIRT=y
20CONFIG_KVM_GUEST=y
21CONFIG_VIRTIO=y
22CONFIG_VIRTIO_PCI=y
23CONFIG_VIRTIO_BLK=y
24CONFIG_VIRTIO_CONSOLE=y
25CONFIG_VIRTIO_NET=y
26CONFIG_9P_FS=y
27CONFIG_NET_9P=y
28CONFIG_NET_9P_VIRTIO=y
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index a3a0ed80f17c..7d6ba9db1be9 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -3,8 +3,6 @@
3# 3#
4 4
5avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no) 5avx_supported := $(call as-instr,vpxor %xmm0$(comma)%xmm0$(comma)%xmm0,yes,no)
6avx2_supported := $(call as-instr,vpgatherdd %ymm0$(comma)(%eax$(comma)%ymm1\
7 $(comma)4)$(comma)%ymm2,yes,no)
8 6
9obj-$(CONFIG_CRYPTO_ABLK_HELPER_X86) += ablk_helper.o 7obj-$(CONFIG_CRYPTO_ABLK_HELPER_X86) += ablk_helper.o
10obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o 8obj-$(CONFIG_CRYPTO_GLUE_HELPER_X86) += glue_helper.o
@@ -29,6 +27,7 @@ obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
29obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o 27obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
30obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o 28obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
31obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o 29obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
30obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o
32 31
33# These modules require assembler to support AVX. 32# These modules require assembler to support AVX.
34ifeq ($(avx_supported),yes) 33ifeq ($(avx_supported),yes)
@@ -42,10 +41,8 @@ endif
42 41
43# These modules require assembler to support AVX2. 42# These modules require assembler to support AVX2.
44ifeq ($(avx2_supported),yes) 43ifeq ($(avx2_supported),yes)
45 obj-$(CONFIG_CRYPTO_BLOWFISH_AVX2_X86_64) += blowfish-avx2.o
46 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o 44 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o
47 obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o 45 obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o
48 obj-$(CONFIG_CRYPTO_TWOFISH_AVX2_X86_64) += twofish-avx2.o
49endif 46endif
50 47
51aes-i586-y := aes-i586-asm_32.o aes_glue.o 48aes-i586-y := aes-i586-asm_32.o aes_glue.o
@@ -73,10 +70,8 @@ ifeq ($(avx_supported),yes)
73endif 70endif
74 71
75ifeq ($(avx2_supported),yes) 72ifeq ($(avx2_supported),yes)
76 blowfish-avx2-y := blowfish-avx2-asm_64.o blowfish_avx2_glue.o
77 camellia-aesni-avx2-y := camellia-aesni-avx2-asm_64.o camellia_aesni_avx2_glue.o 73 camellia-aesni-avx2-y := camellia-aesni-avx2-asm_64.o camellia_aesni_avx2_glue.o
78 serpent-avx2-y := serpent-avx2-asm_64.o serpent_avx2_glue.o 74 serpent-avx2-y := serpent-avx2-asm_64.o serpent_avx2_glue.o
79 twofish-avx2-y := twofish-avx2-asm_64.o twofish_avx2_glue.o
80endif 75endif
81 76
82aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o 77aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
@@ -87,3 +82,4 @@ crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o
87crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o 82crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o
88sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o 83sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o
89sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o 84sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o
85crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
index 62fe22cd4cba..477e9d75149b 100644
--- a/arch/x86/crypto/aesni-intel_asm.S
+++ b/arch/x86/crypto/aesni-intel_asm.S
@@ -2681,56 +2681,68 @@ ENTRY(aesni_xts_crypt8)
2681 addq %rcx, KEYP 2681 addq %rcx, KEYP
2682 2682
2683 movdqa IV, STATE1 2683 movdqa IV, STATE1
2684 pxor 0x00(INP), STATE1 2684 movdqu 0x00(INP), INC
2685 pxor INC, STATE1
2685 movdqu IV, 0x00(OUTP) 2686 movdqu IV, 0x00(OUTP)
2686 2687
2687 _aesni_gf128mul_x_ble() 2688 _aesni_gf128mul_x_ble()
2688 movdqa IV, STATE2 2689 movdqa IV, STATE2
2689 pxor 0x10(INP), STATE2 2690 movdqu 0x10(INP), INC
2691 pxor INC, STATE2
2690 movdqu IV, 0x10(OUTP) 2692 movdqu IV, 0x10(OUTP)
2691 2693
2692 _aesni_gf128mul_x_ble() 2694 _aesni_gf128mul_x_ble()
2693 movdqa IV, STATE3 2695 movdqa IV, STATE3
2694 pxor 0x20(INP), STATE3 2696 movdqu 0x20(INP), INC
2697 pxor INC, STATE3
2695 movdqu IV, 0x20(OUTP) 2698 movdqu IV, 0x20(OUTP)
2696 2699
2697 _aesni_gf128mul_x_ble() 2700 _aesni_gf128mul_x_ble()
2698 movdqa IV, STATE4 2701 movdqa IV, STATE4
2699 pxor 0x30(INP), STATE4 2702 movdqu 0x30(INP), INC
2703 pxor INC, STATE4
2700 movdqu IV, 0x30(OUTP) 2704 movdqu IV, 0x30(OUTP)
2701 2705
2702 call *%r11 2706 call *%r11
2703 2707
2704 pxor 0x00(OUTP), STATE1 2708 movdqu 0x00(OUTP), INC
2709 pxor INC, STATE1
2705 movdqu STATE1, 0x00(OUTP) 2710 movdqu STATE1, 0x00(OUTP)
2706 2711
2707 _aesni_gf128mul_x_ble() 2712 _aesni_gf128mul_x_ble()
2708 movdqa IV, STATE1 2713 movdqa IV, STATE1
2709 pxor 0x40(INP), STATE1 2714 movdqu 0x40(INP), INC
2715 pxor INC, STATE1
2710 movdqu IV, 0x40(OUTP) 2716 movdqu IV, 0x40(OUTP)
2711 2717
2712 pxor 0x10(OUTP), STATE2 2718 movdqu 0x10(OUTP), INC
2719 pxor INC, STATE2
2713 movdqu STATE2, 0x10(OUTP) 2720 movdqu STATE2, 0x10(OUTP)
2714 2721
2715 _aesni_gf128mul_x_ble() 2722 _aesni_gf128mul_x_ble()
2716 movdqa IV, STATE2 2723 movdqa IV, STATE2
2717 pxor 0x50(INP), STATE2 2724 movdqu 0x50(INP), INC
2725 pxor INC, STATE2
2718 movdqu IV, 0x50(OUTP) 2726 movdqu IV, 0x50(OUTP)
2719 2727
2720 pxor 0x20(OUTP), STATE3 2728 movdqu 0x20(OUTP), INC
2729 pxor INC, STATE3
2721 movdqu STATE3, 0x20(OUTP) 2730 movdqu STATE3, 0x20(OUTP)
2722 2731
2723 _aesni_gf128mul_x_ble() 2732 _aesni_gf128mul_x_ble()
2724 movdqa IV, STATE3 2733 movdqa IV, STATE3
2725 pxor 0x60(INP), STATE3 2734 movdqu 0x60(INP), INC
2735 pxor INC, STATE3
2726 movdqu IV, 0x60(OUTP) 2736 movdqu IV, 0x60(OUTP)
2727 2737
2728 pxor 0x30(OUTP), STATE4 2738 movdqu 0x30(OUTP), INC
2739 pxor INC, STATE4
2729 movdqu STATE4, 0x30(OUTP) 2740 movdqu STATE4, 0x30(OUTP)
2730 2741
2731 _aesni_gf128mul_x_ble() 2742 _aesni_gf128mul_x_ble()
2732 movdqa IV, STATE4 2743 movdqa IV, STATE4
2733 pxor 0x70(INP), STATE4 2744 movdqu 0x70(INP), INC
2745 pxor INC, STATE4
2734 movdqu IV, 0x70(OUTP) 2746 movdqu IV, 0x70(OUTP)
2735 2747
2736 _aesni_gf128mul_x_ble() 2748 _aesni_gf128mul_x_ble()
@@ -2738,16 +2750,20 @@ ENTRY(aesni_xts_crypt8)
2738 2750
2739 call *%r11 2751 call *%r11
2740 2752
2741 pxor 0x40(OUTP), STATE1 2753 movdqu 0x40(OUTP), INC
2754 pxor INC, STATE1
2742 movdqu STATE1, 0x40(OUTP) 2755 movdqu STATE1, 0x40(OUTP)
2743 2756
2744 pxor 0x50(OUTP), STATE2 2757 movdqu 0x50(OUTP), INC
2758 pxor INC, STATE2
2745 movdqu STATE2, 0x50(OUTP) 2759 movdqu STATE2, 0x50(OUTP)
2746 2760
2747 pxor 0x60(OUTP), STATE3 2761 movdqu 0x60(OUTP), INC
2762 pxor INC, STATE3
2748 movdqu STATE3, 0x60(OUTP) 2763 movdqu STATE3, 0x60(OUTP)
2749 2764
2750 pxor 0x70(OUTP), STATE4 2765 movdqu 0x70(OUTP), INC
2766 pxor INC, STATE4
2751 movdqu STATE4, 0x70(OUTP) 2767 movdqu STATE4, 0x70(OUTP)
2752 2768
2753 ret 2769 ret
diff --git a/arch/x86/crypto/blowfish-avx2-asm_64.S b/arch/x86/crypto/blowfish-avx2-asm_64.S
deleted file mode 100644
index 784452e0d05d..000000000000
--- a/arch/x86/crypto/blowfish-avx2-asm_64.S
+++ /dev/null
@@ -1,449 +0,0 @@
1/*
2 * x86_64/AVX2 assembler optimized version of Blowfish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <linux/linkage.h>
14
15.file "blowfish-avx2-asm_64.S"
16
17.data
18.align 32
19
20.Lprefetch_mask:
21.long 0*64
22.long 1*64
23.long 2*64
24.long 3*64
25.long 4*64
26.long 5*64
27.long 6*64
28.long 7*64
29
30.Lbswap32_mask:
31.long 0x00010203
32.long 0x04050607
33.long 0x08090a0b
34.long 0x0c0d0e0f
35
36.Lbswap128_mask:
37 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
38.Lbswap_iv_mask:
39 .byte 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0
40
41.text
42/* structure of crypto context */
43#define p 0
44#define s0 ((16 + 2) * 4)
45#define s1 ((16 + 2 + (1 * 256)) * 4)
46#define s2 ((16 + 2 + (2 * 256)) * 4)
47#define s3 ((16 + 2 + (3 * 256)) * 4)
48
49/* register macros */
50#define CTX %rdi
51#define RIO %rdx
52
53#define RS0 %rax
54#define RS1 %r8
55#define RS2 %r9
56#define RS3 %r10
57
58#define RLOOP %r11
59#define RLOOPd %r11d
60
61#define RXr0 %ymm8
62#define RXr1 %ymm9
63#define RXr2 %ymm10
64#define RXr3 %ymm11
65#define RXl0 %ymm12
66#define RXl1 %ymm13
67#define RXl2 %ymm14
68#define RXl3 %ymm15
69
70/* temp regs */
71#define RT0 %ymm0
72#define RT0x %xmm0
73#define RT1 %ymm1
74#define RT1x %xmm1
75#define RIDX0 %ymm2
76#define RIDX1 %ymm3
77#define RIDX1x %xmm3
78#define RIDX2 %ymm4
79#define RIDX3 %ymm5
80
81/* vpgatherdd mask and '-1' */
82#define RNOT %ymm6
83
84/* byte mask, (-1 >> 24) */
85#define RBYTE %ymm7
86
87/***********************************************************************
88 * 32-way AVX2 blowfish
89 ***********************************************************************/
90#define F(xl, xr) \
91 vpsrld $24, xl, RIDX0; \
92 vpsrld $16, xl, RIDX1; \
93 vpsrld $8, xl, RIDX2; \
94 vpand RBYTE, RIDX1, RIDX1; \
95 vpand RBYTE, RIDX2, RIDX2; \
96 vpand RBYTE, xl, RIDX3; \
97 \
98 vpgatherdd RNOT, (RS0, RIDX0, 4), RT0; \
99 vpcmpeqd RNOT, RNOT, RNOT; \
100 vpcmpeqd RIDX0, RIDX0, RIDX0; \
101 \
102 vpgatherdd RNOT, (RS1, RIDX1, 4), RT1; \
103 vpcmpeqd RIDX1, RIDX1, RIDX1; \
104 vpaddd RT0, RT1, RT0; \
105 \
106 vpgatherdd RIDX0, (RS2, RIDX2, 4), RT1; \
107 vpxor RT0, RT1, RT0; \
108 \
109 vpgatherdd RIDX1, (RS3, RIDX3, 4), RT1; \
110 vpcmpeqd RNOT, RNOT, RNOT; \
111 vpaddd RT0, RT1, RT0; \
112 \
113 vpxor RT0, xr, xr;
114
115#define add_roundkey(xl, nmem) \
116 vpbroadcastd nmem, RT0; \
117 vpxor RT0, xl ## 0, xl ## 0; \
118 vpxor RT0, xl ## 1, xl ## 1; \
119 vpxor RT0, xl ## 2, xl ## 2; \
120 vpxor RT0, xl ## 3, xl ## 3;
121
122#define round_enc() \
123 add_roundkey(RXr, p(CTX,RLOOP,4)); \
124 F(RXl0, RXr0); \
125 F(RXl1, RXr1); \
126 F(RXl2, RXr2); \
127 F(RXl3, RXr3); \
128 \
129 add_roundkey(RXl, p+4(CTX,RLOOP,4)); \
130 F(RXr0, RXl0); \
131 F(RXr1, RXl1); \
132 F(RXr2, RXl2); \
133 F(RXr3, RXl3);
134
135#define round_dec() \
136 add_roundkey(RXr, p+4*2(CTX,RLOOP,4)); \
137 F(RXl0, RXr0); \
138 F(RXl1, RXr1); \
139 F(RXl2, RXr2); \
140 F(RXl3, RXr3); \
141 \
142 add_roundkey(RXl, p+4(CTX,RLOOP,4)); \
143 F(RXr0, RXl0); \
144 F(RXr1, RXl1); \
145 F(RXr2, RXl2); \
146 F(RXr3, RXl3);
147
148#define init_round_constants() \
149 vpcmpeqd RNOT, RNOT, RNOT; \
150 leaq s0(CTX), RS0; \
151 leaq s1(CTX), RS1; \
152 leaq s2(CTX), RS2; \
153 leaq s3(CTX), RS3; \
154 vpsrld $24, RNOT, RBYTE;
155
156#define transpose_2x2(x0, x1, t0) \
157 vpunpckldq x0, x1, t0; \
158 vpunpckhdq x0, x1, x1; \
159 \
160 vpunpcklqdq t0, x1, x0; \
161 vpunpckhqdq t0, x1, x1;
162
163#define read_block(xl, xr) \
164 vbroadcasti128 .Lbswap32_mask, RT1; \
165 \
166 vpshufb RT1, xl ## 0, xl ## 0; \
167 vpshufb RT1, xr ## 0, xr ## 0; \
168 vpshufb RT1, xl ## 1, xl ## 1; \
169 vpshufb RT1, xr ## 1, xr ## 1; \
170 vpshufb RT1, xl ## 2, xl ## 2; \
171 vpshufb RT1, xr ## 2, xr ## 2; \
172 vpshufb RT1, xl ## 3, xl ## 3; \
173 vpshufb RT1, xr ## 3, xr ## 3; \
174 \
175 transpose_2x2(xl ## 0, xr ## 0, RT0); \
176 transpose_2x2(xl ## 1, xr ## 1, RT0); \
177 transpose_2x2(xl ## 2, xr ## 2, RT0); \
178 transpose_2x2(xl ## 3, xr ## 3, RT0);
179
180#define write_block(xl, xr) \
181 vbroadcasti128 .Lbswap32_mask, RT1; \
182 \
183 transpose_2x2(xl ## 0, xr ## 0, RT0); \
184 transpose_2x2(xl ## 1, xr ## 1, RT0); \
185 transpose_2x2(xl ## 2, xr ## 2, RT0); \
186 transpose_2x2(xl ## 3, xr ## 3, RT0); \
187 \
188 vpshufb RT1, xl ## 0, xl ## 0; \
189 vpshufb RT1, xr ## 0, xr ## 0; \
190 vpshufb RT1, xl ## 1, xl ## 1; \
191 vpshufb RT1, xr ## 1, xr ## 1; \
192 vpshufb RT1, xl ## 2, xl ## 2; \
193 vpshufb RT1, xr ## 2, xr ## 2; \
194 vpshufb RT1, xl ## 3, xl ## 3; \
195 vpshufb RT1, xr ## 3, xr ## 3;
196
197.align 8
198__blowfish_enc_blk32:
199 /* input:
200 * %rdi: ctx, CTX
201 * RXl0..4, RXr0..4: plaintext
202 * output:
203 * RXl0..4, RXr0..4: ciphertext (RXl <=> RXr swapped)
204 */
205 init_round_constants();
206
207 read_block(RXl, RXr);
208
209 movl $1, RLOOPd;
210 add_roundkey(RXl, p+4*(0)(CTX));
211
212.align 4
213.L__enc_loop:
214 round_enc();
215
216 leal 2(RLOOPd), RLOOPd;
217 cmpl $17, RLOOPd;
218 jne .L__enc_loop;
219
220 add_roundkey(RXr, p+4*(17)(CTX));
221
222 write_block(RXl, RXr);
223
224 ret;
225ENDPROC(__blowfish_enc_blk32)
226
227.align 8
228__blowfish_dec_blk32:
229 /* input:
230 * %rdi: ctx, CTX
231 * RXl0..4, RXr0..4: ciphertext
232 * output:
233 * RXl0..4, RXr0..4: plaintext (RXl <=> RXr swapped)
234 */
235 init_round_constants();
236
237 read_block(RXl, RXr);
238
239 movl $14, RLOOPd;
240 add_roundkey(RXl, p+4*(17)(CTX));
241
242.align 4
243.L__dec_loop:
244 round_dec();
245
246 addl $-2, RLOOPd;
247 jns .L__dec_loop;
248
249 add_roundkey(RXr, p+4*(0)(CTX));
250
251 write_block(RXl, RXr);
252
253 ret;
254ENDPROC(__blowfish_dec_blk32)
255
256ENTRY(blowfish_ecb_enc_32way)
257 /* input:
258 * %rdi: ctx, CTX
259 * %rsi: dst
260 * %rdx: src
261 */
262
263 vzeroupper;
264
265 vmovdqu 0*32(%rdx), RXl0;
266 vmovdqu 1*32(%rdx), RXr0;
267 vmovdqu 2*32(%rdx), RXl1;
268 vmovdqu 3*32(%rdx), RXr1;
269 vmovdqu 4*32(%rdx), RXl2;
270 vmovdqu 5*32(%rdx), RXr2;
271 vmovdqu 6*32(%rdx), RXl3;
272 vmovdqu 7*32(%rdx), RXr3;
273
274 call __blowfish_enc_blk32;
275
276 vmovdqu RXr0, 0*32(%rsi);
277 vmovdqu RXl0, 1*32(%rsi);
278 vmovdqu RXr1, 2*32(%rsi);
279 vmovdqu RXl1, 3*32(%rsi);
280 vmovdqu RXr2, 4*32(%rsi);
281 vmovdqu RXl2, 5*32(%rsi);
282 vmovdqu RXr3, 6*32(%rsi);
283 vmovdqu RXl3, 7*32(%rsi);
284
285 vzeroupper;
286
287 ret;
288ENDPROC(blowfish_ecb_enc_32way)
289
290ENTRY(blowfish_ecb_dec_32way)
291 /* input:
292 * %rdi: ctx, CTX
293 * %rsi: dst
294 * %rdx: src
295 */
296
297 vzeroupper;
298
299 vmovdqu 0*32(%rdx), RXl0;
300 vmovdqu 1*32(%rdx), RXr0;
301 vmovdqu 2*32(%rdx), RXl1;
302 vmovdqu 3*32(%rdx), RXr1;
303 vmovdqu 4*32(%rdx), RXl2;
304 vmovdqu 5*32(%rdx), RXr2;
305 vmovdqu 6*32(%rdx), RXl3;
306 vmovdqu 7*32(%rdx), RXr3;
307
308 call __blowfish_dec_blk32;
309
310 vmovdqu RXr0, 0*32(%rsi);
311 vmovdqu RXl0, 1*32(%rsi);
312 vmovdqu RXr1, 2*32(%rsi);
313 vmovdqu RXl1, 3*32(%rsi);
314 vmovdqu RXr2, 4*32(%rsi);
315 vmovdqu RXl2, 5*32(%rsi);
316 vmovdqu RXr3, 6*32(%rsi);
317 vmovdqu RXl3, 7*32(%rsi);
318
319 vzeroupper;
320
321 ret;
322ENDPROC(blowfish_ecb_dec_32way)
323
324ENTRY(blowfish_cbc_dec_32way)
325 /* input:
326 * %rdi: ctx, CTX
327 * %rsi: dst
328 * %rdx: src
329 */
330
331 vzeroupper;
332
333 vmovdqu 0*32(%rdx), RXl0;
334 vmovdqu 1*32(%rdx), RXr0;
335 vmovdqu 2*32(%rdx), RXl1;
336 vmovdqu 3*32(%rdx), RXr1;
337 vmovdqu 4*32(%rdx), RXl2;
338 vmovdqu 5*32(%rdx), RXr2;
339 vmovdqu 6*32(%rdx), RXl3;
340 vmovdqu 7*32(%rdx), RXr3;
341
342 call __blowfish_dec_blk32;
343
344 /* xor with src */
345 vmovq (%rdx), RT0x;
346 vpshufd $0x4f, RT0x, RT0x;
347 vinserti128 $1, 8(%rdx), RT0, RT0;
348 vpxor RT0, RXr0, RXr0;
349 vpxor 0*32+24(%rdx), RXl0, RXl0;
350 vpxor 1*32+24(%rdx), RXr1, RXr1;
351 vpxor 2*32+24(%rdx), RXl1, RXl1;
352 vpxor 3*32+24(%rdx), RXr2, RXr2;
353 vpxor 4*32+24(%rdx), RXl2, RXl2;
354 vpxor 5*32+24(%rdx), RXr3, RXr3;
355 vpxor 6*32+24(%rdx), RXl3, RXl3;
356
357 vmovdqu RXr0, (0*32)(%rsi);
358 vmovdqu RXl0, (1*32)(%rsi);
359 vmovdqu RXr1, (2*32)(%rsi);
360 vmovdqu RXl1, (3*32)(%rsi);
361 vmovdqu RXr2, (4*32)(%rsi);
362 vmovdqu RXl2, (5*32)(%rsi);
363 vmovdqu RXr3, (6*32)(%rsi);
364 vmovdqu RXl3, (7*32)(%rsi);
365
366 vzeroupper;
367
368 ret;
369ENDPROC(blowfish_cbc_dec_32way)
370
371ENTRY(blowfish_ctr_32way)
372 /* input:
373 * %rdi: ctx, CTX
374 * %rsi: dst
375 * %rdx: src
376 * %rcx: iv (big endian, 64bit)
377 */
378
379 vzeroupper;
380
381 vpcmpeqd RT0, RT0, RT0;
382 vpsrldq $8, RT0, RT0; /* a: -1, b: 0, c: -1, d: 0 */
383
384 vpcmpeqd RT1x, RT1x, RT1x;
385 vpaddq RT1x, RT1x, RT1x; /* a: -2, b: -2 */
386 vpxor RIDX0, RIDX0, RIDX0;
387 vinserti128 $1, RT1x, RIDX0, RIDX0; /* a: 0, b: 0, c: -2, d: -2 */
388
389 vpaddq RIDX0, RT0, RT0; /* a: -1, b: 0, c: -3, d: -2 */
390
391 vpcmpeqd RT1, RT1, RT1;
392 vpaddq RT1, RT1, RT1; /* a: -2, b: -2, c: -2, d: -2 */
393 vpaddq RT1, RT1, RIDX2; /* a: -4, b: -4, c: -4, d: -4 */
394
395 vbroadcasti128 .Lbswap_iv_mask, RIDX0;
396 vbroadcasti128 .Lbswap128_mask, RIDX1;
397
398 /* load IV and byteswap */
399 vmovq (%rcx), RT1x;
400 vinserti128 $1, RT1x, RT1, RT1; /* a: BE, b: 0, c: BE, d: 0 */
401 vpshufb RIDX0, RT1, RT1; /* a: LE, b: LE, c: LE, d: LE */
402
403 /* construct IVs */
404 vpsubq RT0, RT1, RT1; /* a: le1, b: le0, c: le3, d: le2 */
405 vpshufb RIDX1, RT1, RXl0; /* a: be0, b: be1, c: be2, d: be3 */
406 vpsubq RIDX2, RT1, RT1; /* le5, le4, le7, le6 */
407 vpshufb RIDX1, RT1, RXr0; /* be4, be5, be6, be7 */
408 vpsubq RIDX2, RT1, RT1;
409 vpshufb RIDX1, RT1, RXl1;
410 vpsubq RIDX2, RT1, RT1;
411 vpshufb RIDX1, RT1, RXr1;
412 vpsubq RIDX2, RT1, RT1;
413 vpshufb RIDX1, RT1, RXl2;
414 vpsubq RIDX2, RT1, RT1;
415 vpshufb RIDX1, RT1, RXr2;
416 vpsubq RIDX2, RT1, RT1;
417 vpshufb RIDX1, RT1, RXl3;
418 vpsubq RIDX2, RT1, RT1;
419 vpshufb RIDX1, RT1, RXr3;
420
421 /* store last IV */
422 vpsubq RIDX2, RT1, RT1; /* a: le33, b: le32, ... */
423 vpshufb RIDX1x, RT1x, RT1x; /* a: be32, ... */
424 vmovq RT1x, (%rcx);
425
426 call __blowfish_enc_blk32;
427
428 /* dst = src ^ iv */
429 vpxor 0*32(%rdx), RXr0, RXr0;
430 vpxor 1*32(%rdx), RXl0, RXl0;
431 vpxor 2*32(%rdx), RXr1, RXr1;
432 vpxor 3*32(%rdx), RXl1, RXl1;
433 vpxor 4*32(%rdx), RXr2, RXr2;
434 vpxor 5*32(%rdx), RXl2, RXl2;
435 vpxor 6*32(%rdx), RXr3, RXr3;
436 vpxor 7*32(%rdx), RXl3, RXl3;
437 vmovdqu RXr0, (0*32)(%rsi);
438 vmovdqu RXl0, (1*32)(%rsi);
439 vmovdqu RXr1, (2*32)(%rsi);
440 vmovdqu RXl1, (3*32)(%rsi);
441 vmovdqu RXr2, (4*32)(%rsi);
442 vmovdqu RXl2, (5*32)(%rsi);
443 vmovdqu RXr3, (6*32)(%rsi);
444 vmovdqu RXl3, (7*32)(%rsi);
445
446 vzeroupper;
447
448 ret;
449ENDPROC(blowfish_ctr_32way)
diff --git a/arch/x86/crypto/blowfish_avx2_glue.c b/arch/x86/crypto/blowfish_avx2_glue.c
deleted file mode 100644
index 4417e9aea78d..000000000000
--- a/arch/x86/crypto/blowfish_avx2_glue.c
+++ /dev/null
@@ -1,585 +0,0 @@
1/*
2 * Glue Code for x86_64/AVX2 assembler optimized version of Blowfish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 *
6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by:
7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
8 * CTR part based on code (crypto/ctr.c) by:
9 * (C) Copyright IBM Corp. 2007 - Joy Latten <latten@us.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 */
22
23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/crypto.h>
26#include <linux/err.h>
27#include <crypto/algapi.h>
28#include <crypto/blowfish.h>
29#include <crypto/cryptd.h>
30#include <crypto/ctr.h>
31#include <asm/i387.h>
32#include <asm/xcr.h>
33#include <asm/xsave.h>
34#include <asm/crypto/blowfish.h>
35#include <asm/crypto/ablk_helper.h>
36#include <crypto/scatterwalk.h>
37
38#define BF_AVX2_PARALLEL_BLOCKS 32
39
40/* 32-way AVX2 parallel cipher functions */
41asmlinkage void blowfish_ecb_enc_32way(struct bf_ctx *ctx, u8 *dst,
42 const u8 *src);
43asmlinkage void blowfish_ecb_dec_32way(struct bf_ctx *ctx, u8 *dst,
44 const u8 *src);
45asmlinkage void blowfish_cbc_dec_32way(struct bf_ctx *ctx, u8 *dst,
46 const u8 *src);
47asmlinkage void blowfish_ctr_32way(struct bf_ctx *ctx, u8 *dst, const u8 *src,
48 __be64 *iv);
49
50static inline bool bf_fpu_begin(bool fpu_enabled, unsigned int nbytes)
51{
52 if (fpu_enabled)
53 return true;
54
55 /* FPU is only used when chunk to be processed is large enough, so
56 * do not enable FPU until it is necessary.
57 */
58 if (nbytes < BF_BLOCK_SIZE * BF_AVX2_PARALLEL_BLOCKS)
59 return false;
60
61 kernel_fpu_begin();
62 return true;
63}
64
65static inline void bf_fpu_end(bool fpu_enabled)
66{
67 if (fpu_enabled)
68 kernel_fpu_end();
69}
70
71static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk,
72 bool enc)
73{
74 bool fpu_enabled = false;
75 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
76 const unsigned int bsize = BF_BLOCK_SIZE;
77 unsigned int nbytes;
78 int err;
79
80 err = blkcipher_walk_virt(desc, walk);
81 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
82
83 while ((nbytes = walk->nbytes)) {
84 u8 *wsrc = walk->src.virt.addr;
85 u8 *wdst = walk->dst.virt.addr;
86
87 fpu_enabled = bf_fpu_begin(fpu_enabled, nbytes);
88
89 /* Process multi-block AVX2 batch */
90 if (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS) {
91 do {
92 if (enc)
93 blowfish_ecb_enc_32way(ctx, wdst, wsrc);
94 else
95 blowfish_ecb_dec_32way(ctx, wdst, wsrc);
96
97 wsrc += bsize * BF_AVX2_PARALLEL_BLOCKS;
98 wdst += bsize * BF_AVX2_PARALLEL_BLOCKS;
99 nbytes -= bsize * BF_AVX2_PARALLEL_BLOCKS;
100 } while (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS);
101
102 if (nbytes < bsize)
103 goto done;
104 }
105
106 /* Process multi-block batch */
107 if (nbytes >= bsize * BF_PARALLEL_BLOCKS) {
108 do {
109 if (enc)
110 blowfish_enc_blk_4way(ctx, wdst, wsrc);
111 else
112 blowfish_dec_blk_4way(ctx, wdst, wsrc);
113
114 wsrc += bsize * BF_PARALLEL_BLOCKS;
115 wdst += bsize * BF_PARALLEL_BLOCKS;
116 nbytes -= bsize * BF_PARALLEL_BLOCKS;
117 } while (nbytes >= bsize * BF_PARALLEL_BLOCKS);
118
119 if (nbytes < bsize)
120 goto done;
121 }
122
123 /* Handle leftovers */
124 do {
125 if (enc)
126 blowfish_enc_blk(ctx, wdst, wsrc);
127 else
128 blowfish_dec_blk(ctx, wdst, wsrc);
129
130 wsrc += bsize;
131 wdst += bsize;
132 nbytes -= bsize;
133 } while (nbytes >= bsize);
134
135done:
136 err = blkcipher_walk_done(desc, walk, nbytes);
137 }
138
139 bf_fpu_end(fpu_enabled);
140 return err;
141}
142
143static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
144 struct scatterlist *src, unsigned int nbytes)
145{
146 struct blkcipher_walk walk;
147
148 blkcipher_walk_init(&walk, dst, src, nbytes);
149 return ecb_crypt(desc, &walk, true);
150}
151
152static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
153 struct scatterlist *src, unsigned int nbytes)
154{
155 struct blkcipher_walk walk;
156
157 blkcipher_walk_init(&walk, dst, src, nbytes);
158 return ecb_crypt(desc, &walk, false);
159}
160
161static unsigned int __cbc_encrypt(struct blkcipher_desc *desc,
162 struct blkcipher_walk *walk)
163{
164 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
165 unsigned int bsize = BF_BLOCK_SIZE;
166 unsigned int nbytes = walk->nbytes;
167 u64 *src = (u64 *)walk->src.virt.addr;
168 u64 *dst = (u64 *)walk->dst.virt.addr;
169 u64 *iv = (u64 *)walk->iv;
170
171 do {
172 *dst = *src ^ *iv;
173 blowfish_enc_blk(ctx, (u8 *)dst, (u8 *)dst);
174 iv = dst;
175
176 src += 1;
177 dst += 1;
178 nbytes -= bsize;
179 } while (nbytes >= bsize);
180
181 *(u64 *)walk->iv = *iv;
182 return nbytes;
183}
184
185static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
186 struct scatterlist *src, unsigned int nbytes)
187{
188 struct blkcipher_walk walk;
189 int err;
190
191 blkcipher_walk_init(&walk, dst, src, nbytes);
192 err = blkcipher_walk_virt(desc, &walk);
193
194 while ((nbytes = walk.nbytes)) {
195 nbytes = __cbc_encrypt(desc, &walk);
196 err = blkcipher_walk_done(desc, &walk, nbytes);
197 }
198
199 return err;
200}
201
202static unsigned int __cbc_decrypt(struct blkcipher_desc *desc,
203 struct blkcipher_walk *walk)
204{
205 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
206 const unsigned int bsize = BF_BLOCK_SIZE;
207 unsigned int nbytes = walk->nbytes;
208 u64 *src = (u64 *)walk->src.virt.addr;
209 u64 *dst = (u64 *)walk->dst.virt.addr;
210 u64 last_iv;
211 int i;
212
213 /* Start of the last block. */
214 src += nbytes / bsize - 1;
215 dst += nbytes / bsize - 1;
216
217 last_iv = *src;
218
219 /* Process multi-block AVX2 batch */
220 if (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS) {
221 do {
222 nbytes -= bsize * (BF_AVX2_PARALLEL_BLOCKS - 1);
223 src -= BF_AVX2_PARALLEL_BLOCKS - 1;
224 dst -= BF_AVX2_PARALLEL_BLOCKS - 1;
225
226 blowfish_cbc_dec_32way(ctx, (u8 *)dst, (u8 *)src);
227
228 nbytes -= bsize;
229 if (nbytes < bsize)
230 goto done;
231
232 *dst ^= *(src - 1);
233 src -= 1;
234 dst -= 1;
235 } while (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS);
236
237 if (nbytes < bsize)
238 goto done;
239 }
240
241 /* Process multi-block batch */
242 if (nbytes >= bsize * BF_PARALLEL_BLOCKS) {
243 u64 ivs[BF_PARALLEL_BLOCKS - 1];
244
245 do {
246 nbytes -= bsize * (BF_PARALLEL_BLOCKS - 1);
247 src -= BF_PARALLEL_BLOCKS - 1;
248 dst -= BF_PARALLEL_BLOCKS - 1;
249
250 for (i = 0; i < BF_PARALLEL_BLOCKS - 1; i++)
251 ivs[i] = src[i];
252
253 blowfish_dec_blk_4way(ctx, (u8 *)dst, (u8 *)src);
254
255 for (i = 0; i < BF_PARALLEL_BLOCKS - 1; i++)
256 dst[i + 1] ^= ivs[i];
257
258 nbytes -= bsize;
259 if (nbytes < bsize)
260 goto done;
261
262 *dst ^= *(src - 1);
263 src -= 1;
264 dst -= 1;
265 } while (nbytes >= bsize * BF_PARALLEL_BLOCKS);
266
267 if (nbytes < bsize)
268 goto done;
269 }
270
271 /* Handle leftovers */
272 for (;;) {
273 blowfish_dec_blk(ctx, (u8 *)dst, (u8 *)src);
274
275 nbytes -= bsize;
276 if (nbytes < bsize)
277 break;
278
279 *dst ^= *(src - 1);
280 src -= 1;
281 dst -= 1;
282 }
283
284done:
285 *dst ^= *(u64 *)walk->iv;
286 *(u64 *)walk->iv = last_iv;
287
288 return nbytes;
289}
290
291static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
292 struct scatterlist *src, unsigned int nbytes)
293{
294 bool fpu_enabled = false;
295 struct blkcipher_walk walk;
296 int err;
297
298 blkcipher_walk_init(&walk, dst, src, nbytes);
299 err = blkcipher_walk_virt(desc, &walk);
300 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
301
302 while ((nbytes = walk.nbytes)) {
303 fpu_enabled = bf_fpu_begin(fpu_enabled, nbytes);
304 nbytes = __cbc_decrypt(desc, &walk);
305 err = blkcipher_walk_done(desc, &walk, nbytes);
306 }
307
308 bf_fpu_end(fpu_enabled);
309 return err;
310}
311
312static void ctr_crypt_final(struct blkcipher_desc *desc,
313 struct blkcipher_walk *walk)
314{
315 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
316 u8 *ctrblk = walk->iv;
317 u8 keystream[BF_BLOCK_SIZE];
318 u8 *src = walk->src.virt.addr;
319 u8 *dst = walk->dst.virt.addr;
320 unsigned int nbytes = walk->nbytes;
321
322 blowfish_enc_blk(ctx, keystream, ctrblk);
323 crypto_xor(keystream, src, nbytes);
324 memcpy(dst, keystream, nbytes);
325
326 crypto_inc(ctrblk, BF_BLOCK_SIZE);
327}
328
329static unsigned int __ctr_crypt(struct blkcipher_desc *desc,
330 struct blkcipher_walk *walk)
331{
332 struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
333 unsigned int bsize = BF_BLOCK_SIZE;
334 unsigned int nbytes = walk->nbytes;
335 u64 *src = (u64 *)walk->src.virt.addr;
336 u64 *dst = (u64 *)walk->dst.virt.addr;
337 int i;
338
339 /* Process multi-block AVX2 batch */
340 if (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS) {
341 do {
342 blowfish_ctr_32way(ctx, (u8 *)dst, (u8 *)src,
343 (__be64 *)walk->iv);
344
345 src += BF_AVX2_PARALLEL_BLOCKS;
346 dst += BF_AVX2_PARALLEL_BLOCKS;
347 nbytes -= bsize * BF_AVX2_PARALLEL_BLOCKS;
348 } while (nbytes >= bsize * BF_AVX2_PARALLEL_BLOCKS);
349
350 if (nbytes < bsize)
351 goto done;
352 }
353
354 /* Process four block batch */
355 if (nbytes >= bsize * BF_PARALLEL_BLOCKS) {
356 __be64 ctrblocks[BF_PARALLEL_BLOCKS];
357 u64 ctrblk = be64_to_cpu(*(__be64 *)walk->iv);
358
359 do {
360 /* create ctrblks for parallel encrypt */
361 for (i = 0; i < BF_PARALLEL_BLOCKS; i++) {
362 if (dst != src)
363 dst[i] = src[i];
364
365 ctrblocks[i] = cpu_to_be64(ctrblk++);
366 }
367
368 blowfish_enc_blk_xor_4way(ctx, (u8 *)dst,
369 (u8 *)ctrblocks);
370
371 src += BF_PARALLEL_BLOCKS;
372 dst += BF_PARALLEL_BLOCKS;
373 nbytes -= bsize * BF_PARALLEL_BLOCKS;
374 } while (nbytes >= bsize * BF_PARALLEL_BLOCKS);
375
376 *(__be64 *)walk->iv = cpu_to_be64(ctrblk);
377
378 if (nbytes < bsize)
379 goto done;
380 }
381
382 /* Handle leftovers */
383 do {
384 u64 ctrblk;
385
386 if (dst != src)
387 *dst = *src;
388
389 ctrblk = *(u64 *)walk->iv;
390 be64_add_cpu((__be64 *)walk->iv, 1);
391
392 blowfish_enc_blk_xor(ctx, (u8 *)dst, (u8 *)&ctrblk);
393
394 src += 1;
395 dst += 1;
396 } while ((nbytes -= bsize) >= bsize);
397
398done:
399 return nbytes;
400}
401
402static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
403 struct scatterlist *src, unsigned int nbytes)
404{
405 bool fpu_enabled = false;
406 struct blkcipher_walk walk;
407 int err;
408
409 blkcipher_walk_init(&walk, dst, src, nbytes);
410 err = blkcipher_walk_virt_block(desc, &walk, BF_BLOCK_SIZE);
411 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
412
413 while ((nbytes = walk.nbytes) >= BF_BLOCK_SIZE) {
414 fpu_enabled = bf_fpu_begin(fpu_enabled, nbytes);
415 nbytes = __ctr_crypt(desc, &walk);
416 err = blkcipher_walk_done(desc, &walk, nbytes);
417 }
418
419 bf_fpu_end(fpu_enabled);
420
421 if (walk.nbytes) {
422 ctr_crypt_final(desc, &walk);
423 err = blkcipher_walk_done(desc, &walk, 0);
424 }
425
426 return err;
427}
428
429static struct crypto_alg bf_algs[6] = { {
430 .cra_name = "__ecb-blowfish-avx2",
431 .cra_driver_name = "__driver-ecb-blowfish-avx2",
432 .cra_priority = 0,
433 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
434 .cra_blocksize = BF_BLOCK_SIZE,
435 .cra_ctxsize = sizeof(struct bf_ctx),
436 .cra_alignmask = 0,
437 .cra_type = &crypto_blkcipher_type,
438 .cra_module = THIS_MODULE,
439 .cra_u = {
440 .blkcipher = {
441 .min_keysize = BF_MIN_KEY_SIZE,
442 .max_keysize = BF_MAX_KEY_SIZE,
443 .setkey = blowfish_setkey,
444 .encrypt = ecb_encrypt,
445 .decrypt = ecb_decrypt,
446 },
447 },
448}, {
449 .cra_name = "__cbc-blowfish-avx2",
450 .cra_driver_name = "__driver-cbc-blowfish-avx2",
451 .cra_priority = 0,
452 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
453 .cra_blocksize = BF_BLOCK_SIZE,
454 .cra_ctxsize = sizeof(struct bf_ctx),
455 .cra_alignmask = 0,
456 .cra_type = &crypto_blkcipher_type,
457 .cra_module = THIS_MODULE,
458 .cra_u = {
459 .blkcipher = {
460 .min_keysize = BF_MIN_KEY_SIZE,
461 .max_keysize = BF_MAX_KEY_SIZE,
462 .setkey = blowfish_setkey,
463 .encrypt = cbc_encrypt,
464 .decrypt = cbc_decrypt,
465 },
466 },
467}, {
468 .cra_name = "__ctr-blowfish-avx2",
469 .cra_driver_name = "__driver-ctr-blowfish-avx2",
470 .cra_priority = 0,
471 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
472 .cra_blocksize = 1,
473 .cra_ctxsize = sizeof(struct bf_ctx),
474 .cra_alignmask = 0,
475 .cra_type = &crypto_blkcipher_type,
476 .cra_module = THIS_MODULE,
477 .cra_u = {
478 .blkcipher = {
479 .min_keysize = BF_MIN_KEY_SIZE,
480 .max_keysize = BF_MAX_KEY_SIZE,
481 .ivsize = BF_BLOCK_SIZE,
482 .setkey = blowfish_setkey,
483 .encrypt = ctr_crypt,
484 .decrypt = ctr_crypt,
485 },
486 },
487}, {
488 .cra_name = "ecb(blowfish)",
489 .cra_driver_name = "ecb-blowfish-avx2",
490 .cra_priority = 400,
491 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
492 .cra_blocksize = BF_BLOCK_SIZE,
493 .cra_ctxsize = sizeof(struct async_helper_ctx),
494 .cra_alignmask = 0,
495 .cra_type = &crypto_ablkcipher_type,
496 .cra_module = THIS_MODULE,
497 .cra_init = ablk_init,
498 .cra_exit = ablk_exit,
499 .cra_u = {
500 .ablkcipher = {
501 .min_keysize = BF_MIN_KEY_SIZE,
502 .max_keysize = BF_MAX_KEY_SIZE,
503 .setkey = ablk_set_key,
504 .encrypt = ablk_encrypt,
505 .decrypt = ablk_decrypt,
506 },
507 },
508}, {
509 .cra_name = "cbc(blowfish)",
510 .cra_driver_name = "cbc-blowfish-avx2",
511 .cra_priority = 400,
512 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
513 .cra_blocksize = BF_BLOCK_SIZE,
514 .cra_ctxsize = sizeof(struct async_helper_ctx),
515 .cra_alignmask = 0,
516 .cra_type = &crypto_ablkcipher_type,
517 .cra_module = THIS_MODULE,
518 .cra_init = ablk_init,
519 .cra_exit = ablk_exit,
520 .cra_u = {
521 .ablkcipher = {
522 .min_keysize = BF_MIN_KEY_SIZE,
523 .max_keysize = BF_MAX_KEY_SIZE,
524 .ivsize = BF_BLOCK_SIZE,
525 .setkey = ablk_set_key,
526 .encrypt = __ablk_encrypt,
527 .decrypt = ablk_decrypt,
528 },
529 },
530}, {
531 .cra_name = "ctr(blowfish)",
532 .cra_driver_name = "ctr-blowfish-avx2",
533 .cra_priority = 400,
534 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
535 .cra_blocksize = 1,
536 .cra_ctxsize = sizeof(struct async_helper_ctx),
537 .cra_alignmask = 0,
538 .cra_type = &crypto_ablkcipher_type,
539 .cra_module = THIS_MODULE,
540 .cra_init = ablk_init,
541 .cra_exit = ablk_exit,
542 .cra_u = {
543 .ablkcipher = {
544 .min_keysize = BF_MIN_KEY_SIZE,
545 .max_keysize = BF_MAX_KEY_SIZE,
546 .ivsize = BF_BLOCK_SIZE,
547 .setkey = ablk_set_key,
548 .encrypt = ablk_encrypt,
549 .decrypt = ablk_encrypt,
550 .geniv = "chainiv",
551 },
552 },
553} };
554
555
556static int __init init(void)
557{
558 u64 xcr0;
559
560 if (!cpu_has_avx2 || !cpu_has_osxsave) {
561 pr_info("AVX2 instructions are not detected.\n");
562 return -ENODEV;
563 }
564
565 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
566 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
567 pr_info("AVX detected but unusable.\n");
568 return -ENODEV;
569 }
570
571 return crypto_register_algs(bf_algs, ARRAY_SIZE(bf_algs));
572}
573
574static void __exit fini(void)
575{
576 crypto_unregister_algs(bf_algs, ARRAY_SIZE(bf_algs));
577}
578
579module_init(init);
580module_exit(fini);
581
582MODULE_LICENSE("GPL");
583MODULE_DESCRIPTION("Blowfish Cipher Algorithm, AVX2 optimized");
584MODULE_ALIAS("blowfish");
585MODULE_ALIAS("blowfish-asm");
diff --git a/arch/x86/crypto/blowfish_glue.c b/arch/x86/crypto/blowfish_glue.c
index 3548d76dbaa9..50ec333b70e6 100644
--- a/arch/x86/crypto/blowfish_glue.c
+++ b/arch/x86/crypto/blowfish_glue.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Glue Code for assembler optimized version of Blowfish 2 * Glue Code for assembler optimized version of Blowfish
3 * 3 *
4 * Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi> 4 * Copyright (c) 2011 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 * 5 *
6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by: 6 * CBC & ECB parts based on code (crypto/cbc.c,ecb.c) by:
7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au> 7 * Copyright (c) 2006 Herbert Xu <herbert@gondor.apana.org.au>
@@ -32,24 +32,40 @@
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/types.h> 33#include <linux/types.h>
34#include <crypto/algapi.h> 34#include <crypto/algapi.h>
35#include <asm/crypto/blowfish.h>
36 35
37/* regular block cipher functions */ 36/* regular block cipher functions */
38asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src, 37asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src,
39 bool xor); 38 bool xor);
40EXPORT_SYMBOL_GPL(__blowfish_enc_blk);
41
42asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src); 39asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src);
43EXPORT_SYMBOL_GPL(blowfish_dec_blk);
44 40
45/* 4-way parallel cipher functions */ 41/* 4-way parallel cipher functions */
46asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst, 42asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
47 const u8 *src, bool xor); 43 const u8 *src, bool xor);
48EXPORT_SYMBOL_GPL(__blowfish_enc_blk_4way);
49
50asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst, 44asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst,
51 const u8 *src); 45 const u8 *src);
52EXPORT_SYMBOL_GPL(blowfish_dec_blk_4way); 46
47static inline void blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src)
48{
49 __blowfish_enc_blk(ctx, dst, src, false);
50}
51
52static inline void blowfish_enc_blk_xor(struct bf_ctx *ctx, u8 *dst,
53 const u8 *src)
54{
55 __blowfish_enc_blk(ctx, dst, src, true);
56}
57
58static inline void blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
59 const u8 *src)
60{
61 __blowfish_enc_blk_4way(ctx, dst, src, false);
62}
63
64static inline void blowfish_enc_blk_xor_4way(struct bf_ctx *ctx, u8 *dst,
65 const u8 *src)
66{
67 __blowfish_enc_blk_4way(ctx, dst, src, true);
68}
53 69
54static void blowfish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 70static void blowfish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
55{ 71{
diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
index 91a1878fcc3e..0e0b8863a34b 100644
--- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
+++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
@@ -51,16 +51,6 @@
51#define ymm14_x xmm14 51#define ymm14_x xmm14
52#define ymm15_x xmm15 52#define ymm15_x xmm15
53 53
54/*
55 * AES-NI instructions do not support ymmX registers, so we need splitting and
56 * merging.
57 */
58#define vaesenclast256(zero, yreg, tmp) \
59 vextracti128 $1, yreg, tmp##_x; \
60 vaesenclast zero##_x, yreg##_x, yreg##_x; \
61 vaesenclast zero##_x, tmp##_x, tmp##_x; \
62 vinserti128 $1, tmp##_x, yreg, yreg;
63
64/********************************************************************** 54/**********************************************************************
65 32-way camellia 55 32-way camellia
66 **********************************************************************/ 56 **********************************************************************/
@@ -79,46 +69,70 @@
79 * S-function with AES subbytes \ 69 * S-function with AES subbytes \
80 */ \ 70 */ \
81 vbroadcasti128 .Linv_shift_row, t4; \ 71 vbroadcasti128 .Linv_shift_row, t4; \
82 vpbroadcastb .L0f0f0f0f, t7; \ 72 vpbroadcastd .L0f0f0f0f, t7; \
83 vbroadcasti128 .Lpre_tf_lo_s1, t0; \ 73 vbroadcasti128 .Lpre_tf_lo_s1, t5; \
84 vbroadcasti128 .Lpre_tf_hi_s1, t1; \ 74 vbroadcasti128 .Lpre_tf_hi_s1, t6; \
75 vbroadcasti128 .Lpre_tf_lo_s4, t2; \
76 vbroadcasti128 .Lpre_tf_hi_s4, t3; \
85 \ 77 \
86 /* AES inverse shift rows */ \ 78 /* AES inverse shift rows */ \
87 vpshufb t4, x0, x0; \ 79 vpshufb t4, x0, x0; \
88 vpshufb t4, x7, x7; \ 80 vpshufb t4, x7, x7; \
89 vpshufb t4, x1, x1; \
90 vpshufb t4, x4, x4; \
91 vpshufb t4, x2, x2; \
92 vpshufb t4, x5, x5; \
93 vpshufb t4, x3, x3; \ 81 vpshufb t4, x3, x3; \
94 vpshufb t4, x6, x6; \ 82 vpshufb t4, x6, x6; \
83 vpshufb t4, x2, x2; \
84 vpshufb t4, x5, x5; \
85 vpshufb t4, x1, x1; \
86 vpshufb t4, x4, x4; \
95 \ 87 \
96 /* prefilter sboxes 1, 2 and 3 */ \ 88 /* prefilter sboxes 1, 2 and 3 */ \
97 vbroadcasti128 .Lpre_tf_lo_s4, t2; \
98 vbroadcasti128 .Lpre_tf_hi_s4, t3; \
99 filter_8bit(x0, t0, t1, t7, t6); \
100 filter_8bit(x7, t0, t1, t7, t6); \
101 filter_8bit(x1, t0, t1, t7, t6); \
102 filter_8bit(x4, t0, t1, t7, t6); \
103 filter_8bit(x2, t0, t1, t7, t6); \
104 filter_8bit(x5, t0, t1, t7, t6); \
105 \
106 /* prefilter sbox 4 */ \ 89 /* prefilter sbox 4 */ \
90 filter_8bit(x0, t5, t6, t7, t4); \
91 filter_8bit(x7, t5, t6, t7, t4); \
92 vextracti128 $1, x0, t0##_x; \
93 vextracti128 $1, x7, t1##_x; \
94 filter_8bit(x3, t2, t3, t7, t4); \
95 filter_8bit(x6, t2, t3, t7, t4); \
96 vextracti128 $1, x3, t3##_x; \
97 vextracti128 $1, x6, t2##_x; \
98 filter_8bit(x2, t5, t6, t7, t4); \
99 filter_8bit(x5, t5, t6, t7, t4); \
100 filter_8bit(x1, t5, t6, t7, t4); \
101 filter_8bit(x4, t5, t6, t7, t4); \
102 \
107 vpxor t4##_x, t4##_x, t4##_x; \ 103 vpxor t4##_x, t4##_x, t4##_x; \
108 filter_8bit(x3, t2, t3, t7, t6); \
109 filter_8bit(x6, t2, t3, t7, t6); \
110 \ 104 \
111 /* AES subbytes + AES shift rows */ \ 105 /* AES subbytes + AES shift rows */ \
106 vextracti128 $1, x2, t6##_x; \
107 vextracti128 $1, x5, t5##_x; \
108 vaesenclast t4##_x, x0##_x, x0##_x; \
109 vaesenclast t4##_x, t0##_x, t0##_x; \
110 vinserti128 $1, t0##_x, x0, x0; \
111 vaesenclast t4##_x, x7##_x, x7##_x; \
112 vaesenclast t4##_x, t1##_x, t1##_x; \
113 vinserti128 $1, t1##_x, x7, x7; \
114 vaesenclast t4##_x, x3##_x, x3##_x; \
115 vaesenclast t4##_x, t3##_x, t3##_x; \
116 vinserti128 $1, t3##_x, x3, x3; \
117 vaesenclast t4##_x, x6##_x, x6##_x; \
118 vaesenclast t4##_x, t2##_x, t2##_x; \
119 vinserti128 $1, t2##_x, x6, x6; \
120 vextracti128 $1, x1, t3##_x; \
121 vextracti128 $1, x4, t2##_x; \
112 vbroadcasti128 .Lpost_tf_lo_s1, t0; \ 122 vbroadcasti128 .Lpost_tf_lo_s1, t0; \
113 vbroadcasti128 .Lpost_tf_hi_s1, t1; \ 123 vbroadcasti128 .Lpost_tf_hi_s1, t1; \
114 vaesenclast256(t4, x0, t5); \ 124 vaesenclast t4##_x, x2##_x, x2##_x; \
115 vaesenclast256(t4, x7, t5); \ 125 vaesenclast t4##_x, t6##_x, t6##_x; \
116 vaesenclast256(t4, x1, t5); \ 126 vinserti128 $1, t6##_x, x2, x2; \
117 vaesenclast256(t4, x4, t5); \ 127 vaesenclast t4##_x, x5##_x, x5##_x; \
118 vaesenclast256(t4, x2, t5); \ 128 vaesenclast t4##_x, t5##_x, t5##_x; \
119 vaesenclast256(t4, x5, t5); \ 129 vinserti128 $1, t5##_x, x5, x5; \
120 vaesenclast256(t4, x3, t5); \ 130 vaesenclast t4##_x, x1##_x, x1##_x; \
121 vaesenclast256(t4, x6, t5); \ 131 vaesenclast t4##_x, t3##_x, t3##_x; \
132 vinserti128 $1, t3##_x, x1, x1; \
133 vaesenclast t4##_x, x4##_x, x4##_x; \
134 vaesenclast t4##_x, t2##_x, t2##_x; \
135 vinserti128 $1, t2##_x, x4, x4; \
122 \ 136 \
123 /* postfilter sboxes 1 and 4 */ \ 137 /* postfilter sboxes 1 and 4 */ \
124 vbroadcasti128 .Lpost_tf_lo_s3, t2; \ 138 vbroadcasti128 .Lpost_tf_lo_s3, t2; \
@@ -139,22 +153,12 @@
139 /* postfilter sbox 2 */ \ 153 /* postfilter sbox 2 */ \
140 filter_8bit(x1, t4, t5, t7, t2); \ 154 filter_8bit(x1, t4, t5, t7, t2); \
141 filter_8bit(x4, t4, t5, t7, t2); \ 155 filter_8bit(x4, t4, t5, t7, t2); \
156 vpxor t7, t7, t7; \
142 \ 157 \
143 vpsrldq $1, t0, t1; \ 158 vpsrldq $1, t0, t1; \
144 vpsrldq $2, t0, t2; \ 159 vpsrldq $2, t0, t2; \
160 vpshufb t7, t1, t1; \
145 vpsrldq $3, t0, t3; \ 161 vpsrldq $3, t0, t3; \
146 vpsrldq $4, t0, t4; \
147 vpsrldq $5, t0, t5; \
148 vpsrldq $6, t0, t6; \
149 vpsrldq $7, t0, t7; \
150 vpbroadcastb t0##_x, t0; \
151 vpbroadcastb t1##_x, t1; \
152 vpbroadcastb t2##_x, t2; \
153 vpbroadcastb t3##_x, t3; \
154 vpbroadcastb t4##_x, t4; \
155 vpbroadcastb t6##_x, t6; \
156 vpbroadcastb t5##_x, t5; \
157 vpbroadcastb t7##_x, t7; \
158 \ 162 \
159 /* P-function */ \ 163 /* P-function */ \
160 vpxor x5, x0, x0; \ 164 vpxor x5, x0, x0; \
@@ -162,11 +166,21 @@
162 vpxor x7, x2, x2; \ 166 vpxor x7, x2, x2; \
163 vpxor x4, x3, x3; \ 167 vpxor x4, x3, x3; \
164 \ 168 \
169 vpshufb t7, t2, t2; \
170 vpsrldq $4, t0, t4; \
171 vpshufb t7, t3, t3; \
172 vpsrldq $5, t0, t5; \
173 vpshufb t7, t4, t4; \
174 \
165 vpxor x2, x4, x4; \ 175 vpxor x2, x4, x4; \
166 vpxor x3, x5, x5; \ 176 vpxor x3, x5, x5; \
167 vpxor x0, x6, x6; \ 177 vpxor x0, x6, x6; \
168 vpxor x1, x7, x7; \ 178 vpxor x1, x7, x7; \
169 \ 179 \
180 vpsrldq $6, t0, t6; \
181 vpshufb t7, t5, t5; \
182 vpshufb t7, t6, t6; \
183 \
170 vpxor x7, x0, x0; \ 184 vpxor x7, x0, x0; \
171 vpxor x4, x1, x1; \ 185 vpxor x4, x1, x1; \
172 vpxor x5, x2, x2; \ 186 vpxor x5, x2, x2; \
@@ -179,12 +193,16 @@
179 \ 193 \
180 /* Add key material and result to CD (x becomes new CD) */ \ 194 /* Add key material and result to CD (x becomes new CD) */ \
181 \ 195 \
182 vpxor t7, x0, x0; \
183 vpxor 4 * 32(mem_cd), x0, x0; \
184 \
185 vpxor t6, x1, x1; \ 196 vpxor t6, x1, x1; \
186 vpxor 5 * 32(mem_cd), x1, x1; \ 197 vpxor 5 * 32(mem_cd), x1, x1; \
187 \ 198 \
199 vpsrldq $7, t0, t6; \
200 vpshufb t7, t0, t0; \
201 vpshufb t7, t6, t7; \
202 \
203 vpxor t7, x0, x0; \
204 vpxor 4 * 32(mem_cd), x0, x0; \
205 \
188 vpxor t5, x2, x2; \ 206 vpxor t5, x2, x2; \
189 vpxor 6 * 32(mem_cd), x2, x2; \ 207 vpxor 6 * 32(mem_cd), x2, x2; \
190 \ 208 \
@@ -204,7 +222,7 @@
204 vpxor 3 * 32(mem_cd), x7, x7; 222 vpxor 3 * 32(mem_cd), x7, x7;
205 223
206/* 224/*
207 * Size optimization... with inlined roundsm16 binary would be over 5 times 225 * Size optimization... with inlined roundsm32 binary would be over 5 times
208 * larger and would only marginally faster. 226 * larger and would only marginally faster.
209 */ 227 */
210.align 8 228.align 8
@@ -324,13 +342,13 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
324 */ \ 342 */ \
325 vpbroadcastd kll, t0; /* only lowest 32-bit used */ \ 343 vpbroadcastd kll, t0; /* only lowest 32-bit used */ \
326 vpxor tt0, tt0, tt0; \ 344 vpxor tt0, tt0, tt0; \
327 vpbroadcastb t0##_x, t3; \ 345 vpshufb tt0, t0, t3; \
328 vpsrldq $1, t0, t0; \ 346 vpsrldq $1, t0, t0; \
329 vpbroadcastb t0##_x, t2; \ 347 vpshufb tt0, t0, t2; \
330 vpsrldq $1, t0, t0; \ 348 vpsrldq $1, t0, t0; \
331 vpbroadcastb t0##_x, t1; \ 349 vpshufb tt0, t0, t1; \
332 vpsrldq $1, t0, t0; \ 350 vpsrldq $1, t0, t0; \
333 vpbroadcastb t0##_x, t0; \ 351 vpshufb tt0, t0, t0; \
334 \ 352 \
335 vpand l0, t0, t0; \ 353 vpand l0, t0, t0; \
336 vpand l1, t1, t1; \ 354 vpand l1, t1, t1; \
@@ -340,6 +358,7 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
340 rol32_1_32(t3, t2, t1, t0, tt1, tt2, tt3, tt0); \ 358 rol32_1_32(t3, t2, t1, t0, tt1, tt2, tt3, tt0); \
341 \ 359 \
342 vpxor l4, t0, l4; \ 360 vpxor l4, t0, l4; \
361 vpbroadcastd krr, t0; /* only lowest 32-bit used */ \
343 vmovdqu l4, 4 * 32(l); \ 362 vmovdqu l4, 4 * 32(l); \
344 vpxor l5, t1, l5; \ 363 vpxor l5, t1, l5; \
345 vmovdqu l5, 5 * 32(l); \ 364 vmovdqu l5, 5 * 32(l); \
@@ -354,14 +373,13 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
354 * rl ^= t2; \ 373 * rl ^= t2; \
355 */ \ 374 */ \
356 \ 375 \
357 vpbroadcastd krr, t0; /* only lowest 32-bit used */ \ 376 vpshufb tt0, t0, t3; \
358 vpbroadcastb t0##_x, t3; \
359 vpsrldq $1, t0, t0; \ 377 vpsrldq $1, t0, t0; \
360 vpbroadcastb t0##_x, t2; \ 378 vpshufb tt0, t0, t2; \
361 vpsrldq $1, t0, t0; \ 379 vpsrldq $1, t0, t0; \
362 vpbroadcastb t0##_x, t1; \ 380 vpshufb tt0, t0, t1; \
363 vpsrldq $1, t0, t0; \ 381 vpsrldq $1, t0, t0; \
364 vpbroadcastb t0##_x, t0; \ 382 vpshufb tt0, t0, t0; \
365 \ 383 \
366 vpor 4 * 32(r), t0, t0; \ 384 vpor 4 * 32(r), t0, t0; \
367 vpor 5 * 32(r), t1, t1; \ 385 vpor 5 * 32(r), t1, t1; \
@@ -373,6 +391,7 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
373 vpxor 2 * 32(r), t2, t2; \ 391 vpxor 2 * 32(r), t2, t2; \
374 vpxor 3 * 32(r), t3, t3; \ 392 vpxor 3 * 32(r), t3, t3; \
375 vmovdqu t0, 0 * 32(r); \ 393 vmovdqu t0, 0 * 32(r); \
394 vpbroadcastd krl, t0; /* only lowest 32-bit used */ \
376 vmovdqu t1, 1 * 32(r); \ 395 vmovdqu t1, 1 * 32(r); \
377 vmovdqu t2, 2 * 32(r); \ 396 vmovdqu t2, 2 * 32(r); \
378 vmovdqu t3, 3 * 32(r); \ 397 vmovdqu t3, 3 * 32(r); \
@@ -382,14 +401,13 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
382 * t2 &= rl; \ 401 * t2 &= rl; \
383 * rr ^= rol32(t2, 1); \ 402 * rr ^= rol32(t2, 1); \
384 */ \ 403 */ \
385 vpbroadcastd krl, t0; /* only lowest 32-bit used */ \ 404 vpshufb tt0, t0, t3; \
386 vpbroadcastb t0##_x, t3; \
387 vpsrldq $1, t0, t0; \ 405 vpsrldq $1, t0, t0; \
388 vpbroadcastb t0##_x, t2; \ 406 vpshufb tt0, t0, t2; \
389 vpsrldq $1, t0, t0; \ 407 vpsrldq $1, t0, t0; \
390 vpbroadcastb t0##_x, t1; \ 408 vpshufb tt0, t0, t1; \
391 vpsrldq $1, t0, t0; \ 409 vpsrldq $1, t0, t0; \
392 vpbroadcastb t0##_x, t0; \ 410 vpshufb tt0, t0, t0; \
393 \ 411 \
394 vpand 0 * 32(r), t0, t0; \ 412 vpand 0 * 32(r), t0, t0; \
395 vpand 1 * 32(r), t1, t1; \ 413 vpand 1 * 32(r), t1, t1; \
@@ -403,6 +421,7 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
403 vpxor 6 * 32(r), t2, t2; \ 421 vpxor 6 * 32(r), t2, t2; \
404 vpxor 7 * 32(r), t3, t3; \ 422 vpxor 7 * 32(r), t3, t3; \
405 vmovdqu t0, 4 * 32(r); \ 423 vmovdqu t0, 4 * 32(r); \
424 vpbroadcastd klr, t0; /* only lowest 32-bit used */ \
406 vmovdqu t1, 5 * 32(r); \ 425 vmovdqu t1, 5 * 32(r); \
407 vmovdqu t2, 6 * 32(r); \ 426 vmovdqu t2, 6 * 32(r); \
408 vmovdqu t3, 7 * 32(r); \ 427 vmovdqu t3, 7 * 32(r); \
@@ -413,14 +432,13 @@ ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
413 * ll ^= t0; \ 432 * ll ^= t0; \
414 */ \ 433 */ \
415 \ 434 \
416 vpbroadcastd klr, t0; /* only lowest 32-bit used */ \ 435 vpshufb tt0, t0, t3; \
417 vpbroadcastb t0##_x, t3; \
418 vpsrldq $1, t0, t0; \ 436 vpsrldq $1, t0, t0; \
419 vpbroadcastb t0##_x, t2; \ 437 vpshufb tt0, t0, t2; \
420 vpsrldq $1, t0, t0; \ 438 vpsrldq $1, t0, t0; \
421 vpbroadcastb t0##_x, t1; \ 439 vpshufb tt0, t0, t1; \
422 vpsrldq $1, t0, t0; \ 440 vpsrldq $1, t0, t0; \
423 vpbroadcastb t0##_x, t0; \ 441 vpshufb tt0, t0, t0; \
424 \ 442 \
425 vpor l4, t0, t0; \ 443 vpor l4, t0, t0; \
426 vpor l5, t1, t1; \ 444 vpor l5, t1, t1; \
diff --git a/arch/x86/crypto/crct10dif-pcl-asm_64.S b/arch/x86/crypto/crct10dif-pcl-asm_64.S
new file mode 100644
index 000000000000..35e97569d05f
--- /dev/null
+++ b/arch/x86/crypto/crct10dif-pcl-asm_64.S
@@ -0,0 +1,643 @@
1########################################################################
2# Implement fast CRC-T10DIF computation with SSE and PCLMULQDQ instructions
3#
4# Copyright (c) 2013, Intel Corporation
5#
6# Authors:
7# Erdinc Ozturk <erdinc.ozturk@intel.com>
8# Vinodh Gopal <vinodh.gopal@intel.com>
9# James Guilford <james.guilford@intel.com>
10# Tim Chen <tim.c.chen@linux.intel.com>
11#
12# This software is available to you under a choice of one of two
13# licenses. You may choose to be licensed under the terms of the GNU
14# General Public License (GPL) Version 2, available from the file
15# COPYING in the main directory of this source tree, or the
16# OpenIB.org BSD license below:
17#
18# Redistribution and use in source and binary forms, with or without
19# modification, are permitted provided that the following conditions are
20# met:
21#
22# * Redistributions of source code must retain the above copyright
23# notice, this list of conditions and the following disclaimer.
24#
25# * Redistributions in binary form must reproduce the above copyright
26# notice, this list of conditions and the following disclaimer in the
27# documentation and/or other materials provided with the
28# distribution.
29#
30# * Neither the name of the Intel Corporation nor the names of its
31# contributors may be used to endorse or promote products derived from
32# this software without specific prior written permission.
33#
34#
35# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY
36# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
39# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
40# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
42# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46########################################################################
47# Function API:
48# UINT16 crc_t10dif_pcl(
49# UINT16 init_crc, //initial CRC value, 16 bits
50# const unsigned char *buf, //buffer pointer to calculate CRC on
51# UINT64 len //buffer length in bytes (64-bit data)
52# );
53#
54# Reference paper titled "Fast CRC Computation for Generic
55# Polynomials Using PCLMULQDQ Instruction"
56# URL: http://www.intel.com/content/dam/www/public/us/en/documents
57# /white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
58#
59#
60
61#include <linux/linkage.h>
62
63.text
64
65#define arg1 %rdi
66#define arg2 %rsi
67#define arg3 %rdx
68
69#define arg1_low32 %edi
70
71ENTRY(crc_t10dif_pcl)
72.align 16
73
74 # adjust the 16-bit initial_crc value, scale it to 32 bits
75 shl $16, arg1_low32
76
77 # Allocate Stack Space
78 mov %rsp, %rcx
79 sub $16*2, %rsp
80 # align stack to 16 byte boundary
81 and $~(0x10 - 1), %rsp
82
83 # check if smaller than 256
84 cmp $256, arg3
85
86 # for sizes less than 128, we can't fold 64B at a time...
87 jl _less_than_128
88
89
90 # load the initial crc value
91 movd arg1_low32, %xmm10 # initial crc
92
93 # crc value does not need to be byte-reflected, but it needs
94 # to be moved to the high part of the register.
95 # because data will be byte-reflected and will align with
96 # initial crc at correct place.
97 pslldq $12, %xmm10
98
99 movdqa SHUF_MASK(%rip), %xmm11
100 # receive the initial 64B data, xor the initial crc value
101 movdqu 16*0(arg2), %xmm0
102 movdqu 16*1(arg2), %xmm1
103 movdqu 16*2(arg2), %xmm2
104 movdqu 16*3(arg2), %xmm3
105 movdqu 16*4(arg2), %xmm4
106 movdqu 16*5(arg2), %xmm5
107 movdqu 16*6(arg2), %xmm6
108 movdqu 16*7(arg2), %xmm7
109
110 pshufb %xmm11, %xmm0
111 # XOR the initial_crc value
112 pxor %xmm10, %xmm0
113 pshufb %xmm11, %xmm1
114 pshufb %xmm11, %xmm2
115 pshufb %xmm11, %xmm3
116 pshufb %xmm11, %xmm4
117 pshufb %xmm11, %xmm5
118 pshufb %xmm11, %xmm6
119 pshufb %xmm11, %xmm7
120
121 movdqa rk3(%rip), %xmm10 #xmm10 has rk3 and rk4
122 #imm value of pclmulqdq instruction
123 #will determine which constant to use
124
125 #################################################################
126 # we subtract 256 instead of 128 to save one instruction from the loop
127 sub $256, arg3
128
129 # at this section of the code, there is 64*x+y (0<=y<64) bytes of
130 # buffer. The _fold_64_B_loop will fold 64B at a time
131 # until we have 64+y Bytes of buffer
132
133
134 # fold 64B at a time. This section of the code folds 4 xmm
135 # registers in parallel
136_fold_64_B_loop:
137
138 # update the buffer pointer
139 add $128, arg2 # buf += 64#
140
141 movdqu 16*0(arg2), %xmm9
142 movdqu 16*1(arg2), %xmm12
143 pshufb %xmm11, %xmm9
144 pshufb %xmm11, %xmm12
145 movdqa %xmm0, %xmm8
146 movdqa %xmm1, %xmm13
147 pclmulqdq $0x0 , %xmm10, %xmm0
148 pclmulqdq $0x11, %xmm10, %xmm8
149 pclmulqdq $0x0 , %xmm10, %xmm1
150 pclmulqdq $0x11, %xmm10, %xmm13
151 pxor %xmm9 , %xmm0
152 xorps %xmm8 , %xmm0
153 pxor %xmm12, %xmm1
154 xorps %xmm13, %xmm1
155
156 movdqu 16*2(arg2), %xmm9
157 movdqu 16*3(arg2), %xmm12
158 pshufb %xmm11, %xmm9
159 pshufb %xmm11, %xmm12
160 movdqa %xmm2, %xmm8
161 movdqa %xmm3, %xmm13
162 pclmulqdq $0x0, %xmm10, %xmm2
163 pclmulqdq $0x11, %xmm10, %xmm8
164 pclmulqdq $0x0, %xmm10, %xmm3
165 pclmulqdq $0x11, %xmm10, %xmm13
166 pxor %xmm9 , %xmm2
167 xorps %xmm8 , %xmm2
168 pxor %xmm12, %xmm3
169 xorps %xmm13, %xmm3
170
171 movdqu 16*4(arg2), %xmm9
172 movdqu 16*5(arg2), %xmm12
173 pshufb %xmm11, %xmm9
174 pshufb %xmm11, %xmm12
175 movdqa %xmm4, %xmm8
176 movdqa %xmm5, %xmm13
177 pclmulqdq $0x0, %xmm10, %xmm4
178 pclmulqdq $0x11, %xmm10, %xmm8
179 pclmulqdq $0x0, %xmm10, %xmm5
180 pclmulqdq $0x11, %xmm10, %xmm13
181 pxor %xmm9 , %xmm4
182 xorps %xmm8 , %xmm4
183 pxor %xmm12, %xmm5
184 xorps %xmm13, %xmm5
185
186 movdqu 16*6(arg2), %xmm9
187 movdqu 16*7(arg2), %xmm12
188 pshufb %xmm11, %xmm9
189 pshufb %xmm11, %xmm12
190 movdqa %xmm6 , %xmm8
191 movdqa %xmm7 , %xmm13
192 pclmulqdq $0x0 , %xmm10, %xmm6
193 pclmulqdq $0x11, %xmm10, %xmm8
194 pclmulqdq $0x0 , %xmm10, %xmm7
195 pclmulqdq $0x11, %xmm10, %xmm13
196 pxor %xmm9 , %xmm6
197 xorps %xmm8 , %xmm6
198 pxor %xmm12, %xmm7
199 xorps %xmm13, %xmm7
200
201 sub $128, arg3
202
203 # check if there is another 64B in the buffer to be able to fold
204 jge _fold_64_B_loop
205 ##################################################################
206
207
208 add $128, arg2
209 # at this point, the buffer pointer is pointing at the last y Bytes
210 # of the buffer the 64B of folded data is in 4 of the xmm
211 # registers: xmm0, xmm1, xmm2, xmm3
212
213
214 # fold the 8 xmm registers to 1 xmm register with different constants
215
216 movdqa rk9(%rip), %xmm10
217 movdqa %xmm0, %xmm8
218 pclmulqdq $0x11, %xmm10, %xmm0
219 pclmulqdq $0x0 , %xmm10, %xmm8
220 pxor %xmm8, %xmm7
221 xorps %xmm0, %xmm7
222
223 movdqa rk11(%rip), %xmm10
224 movdqa %xmm1, %xmm8
225 pclmulqdq $0x11, %xmm10, %xmm1
226 pclmulqdq $0x0 , %xmm10, %xmm8
227 pxor %xmm8, %xmm7
228 xorps %xmm1, %xmm7
229
230 movdqa rk13(%rip), %xmm10
231 movdqa %xmm2, %xmm8
232 pclmulqdq $0x11, %xmm10, %xmm2
233 pclmulqdq $0x0 , %xmm10, %xmm8
234 pxor %xmm8, %xmm7
235 pxor %xmm2, %xmm7
236
237 movdqa rk15(%rip), %xmm10
238 movdqa %xmm3, %xmm8
239 pclmulqdq $0x11, %xmm10, %xmm3
240 pclmulqdq $0x0 , %xmm10, %xmm8
241 pxor %xmm8, %xmm7
242 xorps %xmm3, %xmm7
243
244 movdqa rk17(%rip), %xmm10
245 movdqa %xmm4, %xmm8
246 pclmulqdq $0x11, %xmm10, %xmm4
247 pclmulqdq $0x0 , %xmm10, %xmm8
248 pxor %xmm8, %xmm7
249 pxor %xmm4, %xmm7
250
251 movdqa rk19(%rip), %xmm10
252 movdqa %xmm5, %xmm8
253 pclmulqdq $0x11, %xmm10, %xmm5
254 pclmulqdq $0x0 , %xmm10, %xmm8
255 pxor %xmm8, %xmm7
256 xorps %xmm5, %xmm7
257
258 movdqa rk1(%rip), %xmm10 #xmm10 has rk1 and rk2
259 #imm value of pclmulqdq instruction
260 #will determine which constant to use
261 movdqa %xmm6, %xmm8
262 pclmulqdq $0x11, %xmm10, %xmm6
263 pclmulqdq $0x0 , %xmm10, %xmm8
264 pxor %xmm8, %xmm7
265 pxor %xmm6, %xmm7
266
267
268 # instead of 64, we add 48 to the loop counter to save 1 instruction
269 # from the loop instead of a cmp instruction, we use the negative
270 # flag with the jl instruction
271 add $128-16, arg3
272 jl _final_reduction_for_128
273
274 # now we have 16+y bytes left to reduce. 16 Bytes is in register xmm7
275 # and the rest is in memory. We can fold 16 bytes at a time if y>=16
276 # continue folding 16B at a time
277
278_16B_reduction_loop:
279 movdqa %xmm7, %xmm8
280 pclmulqdq $0x11, %xmm10, %xmm7
281 pclmulqdq $0x0 , %xmm10, %xmm8
282 pxor %xmm8, %xmm7
283 movdqu (arg2), %xmm0
284 pshufb %xmm11, %xmm0
285 pxor %xmm0 , %xmm7
286 add $16, arg2
287 sub $16, arg3
288 # instead of a cmp instruction, we utilize the flags with the
289 # jge instruction equivalent of: cmp arg3, 16-16
290 # check if there is any more 16B in the buffer to be able to fold
291 jge _16B_reduction_loop
292
293 #now we have 16+z bytes left to reduce, where 0<= z < 16.
294 #first, we reduce the data in the xmm7 register
295
296
297_final_reduction_for_128:
298 # check if any more data to fold. If not, compute the CRC of
299 # the final 128 bits
300 add $16, arg3
301 je _128_done
302
303 # here we are getting data that is less than 16 bytes.
304 # since we know that there was data before the pointer, we can
305 # offset the input pointer before the actual point, to receive
306 # exactly 16 bytes. after that the registers need to be adjusted.
307_get_last_two_xmms:
308 movdqa %xmm7, %xmm2
309
310 movdqu -16(arg2, arg3), %xmm1
311 pshufb %xmm11, %xmm1
312
313 # get rid of the extra data that was loaded before
314 # load the shift constant
315 lea pshufb_shf_table+16(%rip), %rax
316 sub arg3, %rax
317 movdqu (%rax), %xmm0
318
319 # shift xmm2 to the left by arg3 bytes
320 pshufb %xmm0, %xmm2
321
322 # shift xmm7 to the right by 16-arg3 bytes
323 pxor mask1(%rip), %xmm0
324 pshufb %xmm0, %xmm7
325 pblendvb %xmm2, %xmm1 #xmm0 is implicit
326
327 # fold 16 Bytes
328 movdqa %xmm1, %xmm2
329 movdqa %xmm7, %xmm8
330 pclmulqdq $0x11, %xmm10, %xmm7
331 pclmulqdq $0x0 , %xmm10, %xmm8
332 pxor %xmm8, %xmm7
333 pxor %xmm2, %xmm7
334
335_128_done:
336 # compute crc of a 128-bit value
337 movdqa rk5(%rip), %xmm10 # rk5 and rk6 in xmm10
338 movdqa %xmm7, %xmm0
339
340 #64b fold
341 pclmulqdq $0x1, %xmm10, %xmm7
342 pslldq $8 , %xmm0
343 pxor %xmm0, %xmm7
344
345 #32b fold
346 movdqa %xmm7, %xmm0
347
348 pand mask2(%rip), %xmm0
349
350 psrldq $12, %xmm7
351 pclmulqdq $0x10, %xmm10, %xmm7
352 pxor %xmm0, %xmm7
353
354 #barrett reduction
355_barrett:
356 movdqa rk7(%rip), %xmm10 # rk7 and rk8 in xmm10
357 movdqa %xmm7, %xmm0
358 pclmulqdq $0x01, %xmm10, %xmm7
359 pslldq $4, %xmm7
360 pclmulqdq $0x11, %xmm10, %xmm7
361
362 pslldq $4, %xmm7
363 pxor %xmm0, %xmm7
364 pextrd $1, %xmm7, %eax
365
366_cleanup:
367 # scale the result back to 16 bits
368 shr $16, %eax
369 mov %rcx, %rsp
370 ret
371
372########################################################################
373
374.align 16
375_less_than_128:
376
377 # check if there is enough buffer to be able to fold 16B at a time
378 cmp $32, arg3
379 jl _less_than_32
380 movdqa SHUF_MASK(%rip), %xmm11
381
382 # now if there is, load the constants
383 movdqa rk1(%rip), %xmm10 # rk1 and rk2 in xmm10
384
385 movd arg1_low32, %xmm0 # get the initial crc value
386 pslldq $12, %xmm0 # align it to its correct place
387 movdqu (arg2), %xmm7 # load the plaintext
388 pshufb %xmm11, %xmm7 # byte-reflect the plaintext
389 pxor %xmm0, %xmm7
390
391
392 # update the buffer pointer
393 add $16, arg2
394
395 # update the counter. subtract 32 instead of 16 to save one
396 # instruction from the loop
397 sub $32, arg3
398
399 jmp _16B_reduction_loop
400
401
402.align 16
403_less_than_32:
404 # mov initial crc to the return value. this is necessary for
405 # zero-length buffers.
406 mov arg1_low32, %eax
407 test arg3, arg3
408 je _cleanup
409
410 movdqa SHUF_MASK(%rip), %xmm11
411
412 movd arg1_low32, %xmm0 # get the initial crc value
413 pslldq $12, %xmm0 # align it to its correct place
414
415 cmp $16, arg3
416 je _exact_16_left
417 jl _less_than_16_left
418
419 movdqu (arg2), %xmm7 # load the plaintext
420 pshufb %xmm11, %xmm7 # byte-reflect the plaintext
421 pxor %xmm0 , %xmm7 # xor the initial crc value
422 add $16, arg2
423 sub $16, arg3
424 movdqa rk1(%rip), %xmm10 # rk1 and rk2 in xmm10
425 jmp _get_last_two_xmms
426
427
428.align 16
429_less_than_16_left:
430 # use stack space to load data less than 16 bytes, zero-out
431 # the 16B in memory first.
432
433 pxor %xmm1, %xmm1
434 mov %rsp, %r11
435 movdqa %xmm1, (%r11)
436
437 cmp $4, arg3
438 jl _only_less_than_4
439
440 # backup the counter value
441 mov arg3, %r9
442 cmp $8, arg3
443 jl _less_than_8_left
444
445 # load 8 Bytes
446 mov (arg2), %rax
447 mov %rax, (%r11)
448 add $8, %r11
449 sub $8, arg3
450 add $8, arg2
451_less_than_8_left:
452
453 cmp $4, arg3
454 jl _less_than_4_left
455
456 # load 4 Bytes
457 mov (arg2), %eax
458 mov %eax, (%r11)
459 add $4, %r11
460 sub $4, arg3
461 add $4, arg2
462_less_than_4_left:
463
464 cmp $2, arg3
465 jl _less_than_2_left
466
467 # load 2 Bytes
468 mov (arg2), %ax
469 mov %ax, (%r11)
470 add $2, %r11
471 sub $2, arg3
472 add $2, arg2
473_less_than_2_left:
474 cmp $1, arg3
475 jl _zero_left
476
477 # load 1 Byte
478 mov (arg2), %al
479 mov %al, (%r11)
480_zero_left:
481 movdqa (%rsp), %xmm7
482 pshufb %xmm11, %xmm7
483 pxor %xmm0 , %xmm7 # xor the initial crc value
484
485 # shl r9, 4
486 lea pshufb_shf_table+16(%rip), %rax
487 sub %r9, %rax
488 movdqu (%rax), %xmm0
489 pxor mask1(%rip), %xmm0
490
491 pshufb %xmm0, %xmm7
492 jmp _128_done
493
494.align 16
495_exact_16_left:
496 movdqu (arg2), %xmm7
497 pshufb %xmm11, %xmm7
498 pxor %xmm0 , %xmm7 # xor the initial crc value
499
500 jmp _128_done
501
502_only_less_than_4:
503 cmp $3, arg3
504 jl _only_less_than_3
505
506 # load 3 Bytes
507 mov (arg2), %al
508 mov %al, (%r11)
509
510 mov 1(arg2), %al
511 mov %al, 1(%r11)
512
513 mov 2(arg2), %al
514 mov %al, 2(%r11)
515
516 movdqa (%rsp), %xmm7
517 pshufb %xmm11, %xmm7
518 pxor %xmm0 , %xmm7 # xor the initial crc value
519
520 psrldq $5, %xmm7
521
522 jmp _barrett
523_only_less_than_3:
524 cmp $2, arg3
525 jl _only_less_than_2
526
527 # load 2 Bytes
528 mov (arg2), %al
529 mov %al, (%r11)
530
531 mov 1(arg2), %al
532 mov %al, 1(%r11)
533
534 movdqa (%rsp), %xmm7
535 pshufb %xmm11, %xmm7
536 pxor %xmm0 , %xmm7 # xor the initial crc value
537
538 psrldq $6, %xmm7
539
540 jmp _barrett
541_only_less_than_2:
542
543 # load 1 Byte
544 mov (arg2), %al
545 mov %al, (%r11)
546
547 movdqa (%rsp), %xmm7
548 pshufb %xmm11, %xmm7
549 pxor %xmm0 , %xmm7 # xor the initial crc value
550
551 psrldq $7, %xmm7
552
553 jmp _barrett
554
555ENDPROC(crc_t10dif_pcl)
556
557.data
558
559# precomputed constants
560# these constants are precomputed from the poly:
561# 0x8bb70000 (0x8bb7 scaled to 32 bits)
562.align 16
563# Q = 0x18BB70000
564# rk1 = 2^(32*3) mod Q << 32
565# rk2 = 2^(32*5) mod Q << 32
566# rk3 = 2^(32*15) mod Q << 32
567# rk4 = 2^(32*17) mod Q << 32
568# rk5 = 2^(32*3) mod Q << 32
569# rk6 = 2^(32*2) mod Q << 32
570# rk7 = floor(2^64/Q)
571# rk8 = Q
572rk1:
573.quad 0x2d56000000000000
574rk2:
575.quad 0x06df000000000000
576rk3:
577.quad 0x9d9d000000000000
578rk4:
579.quad 0x7cf5000000000000
580rk5:
581.quad 0x2d56000000000000
582rk6:
583.quad 0x1368000000000000
584rk7:
585.quad 0x00000001f65a57f8
586rk8:
587.quad 0x000000018bb70000
588
589rk9:
590.quad 0xceae000000000000
591rk10:
592.quad 0xbfd6000000000000
593rk11:
594.quad 0x1e16000000000000
595rk12:
596.quad 0x713c000000000000
597rk13:
598.quad 0xf7f9000000000000
599rk14:
600.quad 0x80a6000000000000
601rk15:
602.quad 0x044c000000000000
603rk16:
604.quad 0xe658000000000000
605rk17:
606.quad 0xad18000000000000
607rk18:
608.quad 0xa497000000000000
609rk19:
610.quad 0x6ee3000000000000
611rk20:
612.quad 0xe7b5000000000000
613
614
615
616mask1:
617.octa 0x80808080808080808080808080808080
618mask2:
619.octa 0x00000000FFFFFFFFFFFFFFFFFFFFFFFF
620
621SHUF_MASK:
622.octa 0x000102030405060708090A0B0C0D0E0F
623
624pshufb_shf_table:
625# use these values for shift constants for the pshufb instruction
626# different alignments result in values as shown:
627# DDQ 0x008f8e8d8c8b8a898887868584838281 # shl 15 (16-1) / shr1
628# DDQ 0x01008f8e8d8c8b8a8988878685848382 # shl 14 (16-3) / shr2
629# DDQ 0x0201008f8e8d8c8b8a89888786858483 # shl 13 (16-4) / shr3
630# DDQ 0x030201008f8e8d8c8b8a898887868584 # shl 12 (16-4) / shr4
631# DDQ 0x04030201008f8e8d8c8b8a8988878685 # shl 11 (16-5) / shr5
632# DDQ 0x0504030201008f8e8d8c8b8a89888786 # shl 10 (16-6) / shr6
633# DDQ 0x060504030201008f8e8d8c8b8a898887 # shl 9 (16-7) / shr7
634# DDQ 0x07060504030201008f8e8d8c8b8a8988 # shl 8 (16-8) / shr8
635# DDQ 0x0807060504030201008f8e8d8c8b8a89 # shl 7 (16-9) / shr9
636# DDQ 0x090807060504030201008f8e8d8c8b8a # shl 6 (16-10) / shr10
637# DDQ 0x0a090807060504030201008f8e8d8c8b # shl 5 (16-11) / shr11
638# DDQ 0x0b0a090807060504030201008f8e8d8c # shl 4 (16-12) / shr12
639# DDQ 0x0c0b0a090807060504030201008f8e8d # shl 3 (16-13) / shr13
640# DDQ 0x0d0c0b0a090807060504030201008f8e # shl 2 (16-14) / shr14
641# DDQ 0x0e0d0c0b0a090807060504030201008f # shl 1 (16-15) / shr15
642.octa 0x8f8e8d8c8b8a89888786858483828100
643.octa 0x000e0d0c0b0a09080706050403020100
diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c
new file mode 100644
index 000000000000..7845d7fd54c0
--- /dev/null
+++ b/arch/x86/crypto/crct10dif-pclmul_glue.c
@@ -0,0 +1,151 @@
1/*
2 * Cryptographic API.
3 *
4 * T10 Data Integrity Field CRC16 Crypto Transform using PCLMULQDQ Instructions
5 *
6 * Copyright (C) 2013 Intel Corporation
7 * Author: Tim Chen <tim.c.chen@linux.intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 */
24
25#include <linux/types.h>
26#include <linux/module.h>
27#include <linux/crc-t10dif.h>
28#include <crypto/internal/hash.h>
29#include <linux/init.h>
30#include <linux/string.h>
31#include <linux/kernel.h>
32#include <asm/i387.h>
33#include <asm/cpufeature.h>
34#include <asm/cpu_device_id.h>
35
36asmlinkage __u16 crc_t10dif_pcl(__u16 crc, const unsigned char *buf,
37 size_t len);
38
39struct chksum_desc_ctx {
40 __u16 crc;
41};
42
43/*
44 * Steps through buffer one byte at at time, calculates reflected
45 * crc using table.
46 */
47
48static int chksum_init(struct shash_desc *desc)
49{
50 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
51
52 ctx->crc = 0;
53
54 return 0;
55}
56
57static int chksum_update(struct shash_desc *desc, const u8 *data,
58 unsigned int length)
59{
60 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
61
62 if (irq_fpu_usable()) {
63 kernel_fpu_begin();
64 ctx->crc = crc_t10dif_pcl(ctx->crc, data, length);
65 kernel_fpu_end();
66 } else
67 ctx->crc = crc_t10dif_generic(ctx->crc, data, length);
68 return 0;
69}
70
71static int chksum_final(struct shash_desc *desc, u8 *out)
72{
73 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
74
75 *(__u16 *)out = ctx->crc;
76 return 0;
77}
78
79static int __chksum_finup(__u16 *crcp, const u8 *data, unsigned int len,
80 u8 *out)
81{
82 if (irq_fpu_usable()) {
83 kernel_fpu_begin();
84 *(__u16 *)out = crc_t10dif_pcl(*crcp, data, len);
85 kernel_fpu_end();
86 } else
87 *(__u16 *)out = crc_t10dif_generic(*crcp, data, len);
88 return 0;
89}
90
91static int chksum_finup(struct shash_desc *desc, const u8 *data,
92 unsigned int len, u8 *out)
93{
94 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
95
96 return __chksum_finup(&ctx->crc, data, len, out);
97}
98
99static int chksum_digest(struct shash_desc *desc, const u8 *data,
100 unsigned int length, u8 *out)
101{
102 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
103
104 return __chksum_finup(&ctx->crc, data, length, out);
105}
106
107static struct shash_alg alg = {
108 .digestsize = CRC_T10DIF_DIGEST_SIZE,
109 .init = chksum_init,
110 .update = chksum_update,
111 .final = chksum_final,
112 .finup = chksum_finup,
113 .digest = chksum_digest,
114 .descsize = sizeof(struct chksum_desc_ctx),
115 .base = {
116 .cra_name = "crct10dif",
117 .cra_driver_name = "crct10dif-pclmul",
118 .cra_priority = 200,
119 .cra_blocksize = CRC_T10DIF_BLOCK_SIZE,
120 .cra_module = THIS_MODULE,
121 }
122};
123
124static const struct x86_cpu_id crct10dif_cpu_id[] = {
125 X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ),
126 {}
127};
128MODULE_DEVICE_TABLE(x86cpu, crct10dif_cpu_id);
129
130static int __init crct10dif_intel_mod_init(void)
131{
132 if (!x86_match_cpu(crct10dif_cpu_id))
133 return -ENODEV;
134
135 return crypto_register_shash(&alg);
136}
137
138static void __exit crct10dif_intel_mod_fini(void)
139{
140 crypto_unregister_shash(&alg);
141}
142
143module_init(crct10dif_intel_mod_init);
144module_exit(crct10dif_intel_mod_fini);
145
146MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>");
147MODULE_DESCRIPTION("T10 DIF CRC calculation accelerated with PCLMULQDQ.");
148MODULE_LICENSE("GPL");
149
150MODULE_ALIAS("crct10dif");
151MODULE_ALIAS("crct10dif-pclmul");
diff --git a/arch/x86/crypto/sha256_ssse3_glue.c b/arch/x86/crypto/sha256_ssse3_glue.c
index 597d4da69656..50226c4b86ed 100644
--- a/arch/x86/crypto/sha256_ssse3_glue.c
+++ b/arch/x86/crypto/sha256_ssse3_glue.c
@@ -187,7 +187,36 @@ static int sha256_ssse3_import(struct shash_desc *desc, const void *in)
187 return 0; 187 return 0;
188} 188}
189 189
190static struct shash_alg alg = { 190static int sha224_ssse3_init(struct shash_desc *desc)
191{
192 struct sha256_state *sctx = shash_desc_ctx(desc);
193
194 sctx->state[0] = SHA224_H0;
195 sctx->state[1] = SHA224_H1;
196 sctx->state[2] = SHA224_H2;
197 sctx->state[3] = SHA224_H3;
198 sctx->state[4] = SHA224_H4;
199 sctx->state[5] = SHA224_H5;
200 sctx->state[6] = SHA224_H6;
201 sctx->state[7] = SHA224_H7;
202 sctx->count = 0;
203
204 return 0;
205}
206
207static int sha224_ssse3_final(struct shash_desc *desc, u8 *hash)
208{
209 u8 D[SHA256_DIGEST_SIZE];
210
211 sha256_ssse3_final(desc, D);
212
213 memcpy(hash, D, SHA224_DIGEST_SIZE);
214 memset(D, 0, SHA256_DIGEST_SIZE);
215
216 return 0;
217}
218
219static struct shash_alg algs[] = { {
191 .digestsize = SHA256_DIGEST_SIZE, 220 .digestsize = SHA256_DIGEST_SIZE,
192 .init = sha256_ssse3_init, 221 .init = sha256_ssse3_init,
193 .update = sha256_ssse3_update, 222 .update = sha256_ssse3_update,
@@ -204,7 +233,24 @@ static struct shash_alg alg = {
204 .cra_blocksize = SHA256_BLOCK_SIZE, 233 .cra_blocksize = SHA256_BLOCK_SIZE,
205 .cra_module = THIS_MODULE, 234 .cra_module = THIS_MODULE,
206 } 235 }
207}; 236}, {
237 .digestsize = SHA224_DIGEST_SIZE,
238 .init = sha224_ssse3_init,
239 .update = sha256_ssse3_update,
240 .final = sha224_ssse3_final,
241 .export = sha256_ssse3_export,
242 .import = sha256_ssse3_import,
243 .descsize = sizeof(struct sha256_state),
244 .statesize = sizeof(struct sha256_state),
245 .base = {
246 .cra_name = "sha224",
247 .cra_driver_name = "sha224-ssse3",
248 .cra_priority = 150,
249 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
250 .cra_blocksize = SHA224_BLOCK_SIZE,
251 .cra_module = THIS_MODULE,
252 }
253} };
208 254
209#ifdef CONFIG_AS_AVX 255#ifdef CONFIG_AS_AVX
210static bool __init avx_usable(void) 256static bool __init avx_usable(void)
@@ -227,7 +273,7 @@ static bool __init avx_usable(void)
227 273
228static int __init sha256_ssse3_mod_init(void) 274static int __init sha256_ssse3_mod_init(void)
229{ 275{
230 /* test for SSE3 first */ 276 /* test for SSSE3 first */
231 if (cpu_has_ssse3) 277 if (cpu_has_ssse3)
232 sha256_transform_asm = sha256_transform_ssse3; 278 sha256_transform_asm = sha256_transform_ssse3;
233 279
@@ -254,7 +300,7 @@ static int __init sha256_ssse3_mod_init(void)
254 else 300 else
255#endif 301#endif
256 pr_info("Using SSSE3 optimized SHA-256 implementation\n"); 302 pr_info("Using SSSE3 optimized SHA-256 implementation\n");
257 return crypto_register_shash(&alg); 303 return crypto_register_shashes(algs, ARRAY_SIZE(algs));
258 } 304 }
259 pr_info("Neither AVX nor SSSE3 is available/usable.\n"); 305 pr_info("Neither AVX nor SSSE3 is available/usable.\n");
260 306
@@ -263,7 +309,7 @@ static int __init sha256_ssse3_mod_init(void)
263 309
264static void __exit sha256_ssse3_mod_fini(void) 310static void __exit sha256_ssse3_mod_fini(void)
265{ 311{
266 crypto_unregister_shash(&alg); 312 crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
267} 313}
268 314
269module_init(sha256_ssse3_mod_init); 315module_init(sha256_ssse3_mod_init);
@@ -273,3 +319,4 @@ MODULE_LICENSE("GPL");
273MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated"); 319MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm, Supplemental SSE3 accelerated");
274 320
275MODULE_ALIAS("sha256"); 321MODULE_ALIAS("sha256");
322MODULE_ALIAS("sha384");
diff --git a/arch/x86/crypto/sha512_ssse3_glue.c b/arch/x86/crypto/sha512_ssse3_glue.c
index 6cbd8df348d2..f30cd10293f0 100644
--- a/arch/x86/crypto/sha512_ssse3_glue.c
+++ b/arch/x86/crypto/sha512_ssse3_glue.c
@@ -194,7 +194,37 @@ static int sha512_ssse3_import(struct shash_desc *desc, const void *in)
194 return 0; 194 return 0;
195} 195}
196 196
197static struct shash_alg alg = { 197static int sha384_ssse3_init(struct shash_desc *desc)
198{
199 struct sha512_state *sctx = shash_desc_ctx(desc);
200
201 sctx->state[0] = SHA384_H0;
202 sctx->state[1] = SHA384_H1;
203 sctx->state[2] = SHA384_H2;
204 sctx->state[3] = SHA384_H3;
205 sctx->state[4] = SHA384_H4;
206 sctx->state[5] = SHA384_H5;
207 sctx->state[6] = SHA384_H6;
208 sctx->state[7] = SHA384_H7;
209
210 sctx->count[0] = sctx->count[1] = 0;
211
212 return 0;
213}
214
215static int sha384_ssse3_final(struct shash_desc *desc, u8 *hash)
216{
217 u8 D[SHA512_DIGEST_SIZE];
218
219 sha512_ssse3_final(desc, D);
220
221 memcpy(hash, D, SHA384_DIGEST_SIZE);
222 memset(D, 0, SHA512_DIGEST_SIZE);
223
224 return 0;
225}
226
227static struct shash_alg algs[] = { {
198 .digestsize = SHA512_DIGEST_SIZE, 228 .digestsize = SHA512_DIGEST_SIZE,
199 .init = sha512_ssse3_init, 229 .init = sha512_ssse3_init,
200 .update = sha512_ssse3_update, 230 .update = sha512_ssse3_update,
@@ -211,7 +241,24 @@ static struct shash_alg alg = {
211 .cra_blocksize = SHA512_BLOCK_SIZE, 241 .cra_blocksize = SHA512_BLOCK_SIZE,
212 .cra_module = THIS_MODULE, 242 .cra_module = THIS_MODULE,
213 } 243 }
214}; 244}, {
245 .digestsize = SHA384_DIGEST_SIZE,
246 .init = sha384_ssse3_init,
247 .update = sha512_ssse3_update,
248 .final = sha384_ssse3_final,
249 .export = sha512_ssse3_export,
250 .import = sha512_ssse3_import,
251 .descsize = sizeof(struct sha512_state),
252 .statesize = sizeof(struct sha512_state),
253 .base = {
254 .cra_name = "sha384",
255 .cra_driver_name = "sha384-ssse3",
256 .cra_priority = 150,
257 .cra_flags = CRYPTO_ALG_TYPE_SHASH,
258 .cra_blocksize = SHA384_BLOCK_SIZE,
259 .cra_module = THIS_MODULE,
260 }
261} };
215 262
216#ifdef CONFIG_AS_AVX 263#ifdef CONFIG_AS_AVX
217static bool __init avx_usable(void) 264static bool __init avx_usable(void)
@@ -234,7 +281,7 @@ static bool __init avx_usable(void)
234 281
235static int __init sha512_ssse3_mod_init(void) 282static int __init sha512_ssse3_mod_init(void)
236{ 283{
237 /* test for SSE3 first */ 284 /* test for SSSE3 first */
238 if (cpu_has_ssse3) 285 if (cpu_has_ssse3)
239 sha512_transform_asm = sha512_transform_ssse3; 286 sha512_transform_asm = sha512_transform_ssse3;
240 287
@@ -261,7 +308,7 @@ static int __init sha512_ssse3_mod_init(void)
261 else 308 else
262#endif 309#endif
263 pr_info("Using SSSE3 optimized SHA-512 implementation\n"); 310 pr_info("Using SSSE3 optimized SHA-512 implementation\n");
264 return crypto_register_shash(&alg); 311 return crypto_register_shashes(algs, ARRAY_SIZE(algs));
265 } 312 }
266 pr_info("Neither AVX nor SSSE3 is available/usable.\n"); 313 pr_info("Neither AVX nor SSSE3 is available/usable.\n");
267 314
@@ -270,7 +317,7 @@ static int __init sha512_ssse3_mod_init(void)
270 317
271static void __exit sha512_ssse3_mod_fini(void) 318static void __exit sha512_ssse3_mod_fini(void)
272{ 319{
273 crypto_unregister_shash(&alg); 320 crypto_unregister_shashes(algs, ARRAY_SIZE(algs));
274} 321}
275 322
276module_init(sha512_ssse3_mod_init); 323module_init(sha512_ssse3_mod_init);
@@ -280,3 +327,4 @@ MODULE_LICENSE("GPL");
280MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, Supplemental SSE3 accelerated"); 327MODULE_DESCRIPTION("SHA512 Secure Hash Algorithm, Supplemental SSE3 accelerated");
281 328
282MODULE_ALIAS("sha512"); 329MODULE_ALIAS("sha512");
330MODULE_ALIAS("sha384");
diff --git a/arch/x86/crypto/twofish-avx2-asm_64.S b/arch/x86/crypto/twofish-avx2-asm_64.S
deleted file mode 100644
index e1a83b9cd389..000000000000
--- a/arch/x86/crypto/twofish-avx2-asm_64.S
+++ /dev/null
@@ -1,600 +0,0 @@
1/*
2 * x86_64/AVX2 assembler optimized version of Twofish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <linux/linkage.h>
14#include "glue_helper-asm-avx2.S"
15
16.file "twofish-avx2-asm_64.S"
17
18.data
19.align 16
20
21.Lvpshufb_mask0:
22.long 0x80808000
23.long 0x80808004
24.long 0x80808008
25.long 0x8080800c
26
27.Lbswap128_mask:
28 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
29.Lxts_gf128mul_and_shl1_mask_0:
30 .byte 0x87, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0
31.Lxts_gf128mul_and_shl1_mask_1:
32 .byte 0x0e, 1, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0
33
34.text
35
36/* structure of crypto context */
37#define s0 0
38#define s1 1024
39#define s2 2048
40#define s3 3072
41#define w 4096
42#define k 4128
43
44/* register macros */
45#define CTX %rdi
46
47#define RS0 CTX
48#define RS1 %r8
49#define RS2 %r9
50#define RS3 %r10
51#define RK %r11
52#define RW %rax
53#define RROUND %r12
54#define RROUNDd %r12d
55
56#define RA0 %ymm8
57#define RB0 %ymm9
58#define RC0 %ymm10
59#define RD0 %ymm11
60#define RA1 %ymm12
61#define RB1 %ymm13
62#define RC1 %ymm14
63#define RD1 %ymm15
64
65/* temp regs */
66#define RX0 %ymm0
67#define RY0 %ymm1
68#define RX1 %ymm2
69#define RY1 %ymm3
70#define RT0 %ymm4
71#define RIDX %ymm5
72
73#define RX0x %xmm0
74#define RY0x %xmm1
75#define RX1x %xmm2
76#define RY1x %xmm3
77#define RT0x %xmm4
78
79/* vpgatherdd mask and '-1' */
80#define RNOT %ymm6
81
82/* byte mask, (-1 >> 24) */
83#define RBYTE %ymm7
84
85/**********************************************************************
86 16-way AVX2 twofish
87 **********************************************************************/
88#define init_round_constants() \
89 vpcmpeqd RNOT, RNOT, RNOT; \
90 vpsrld $24, RNOT, RBYTE; \
91 leaq k(CTX), RK; \
92 leaq w(CTX), RW; \
93 leaq s1(CTX), RS1; \
94 leaq s2(CTX), RS2; \
95 leaq s3(CTX), RS3; \
96
97#define g16(ab, rs0, rs1, rs2, rs3, xy) \
98 vpand RBYTE, ab ## 0, RIDX; \
99 vpgatherdd RNOT, (rs0, RIDX, 4), xy ## 0; \
100 vpcmpeqd RNOT, RNOT, RNOT; \
101 \
102 vpand RBYTE, ab ## 1, RIDX; \
103 vpgatherdd RNOT, (rs0, RIDX, 4), xy ## 1; \
104 vpcmpeqd RNOT, RNOT, RNOT; \
105 \
106 vpsrld $8, ab ## 0, RIDX; \
107 vpand RBYTE, RIDX, RIDX; \
108 vpgatherdd RNOT, (rs1, RIDX, 4), RT0; \
109 vpcmpeqd RNOT, RNOT, RNOT; \
110 vpxor RT0, xy ## 0, xy ## 0; \
111 \
112 vpsrld $8, ab ## 1, RIDX; \
113 vpand RBYTE, RIDX, RIDX; \
114 vpgatherdd RNOT, (rs1, RIDX, 4), RT0; \
115 vpcmpeqd RNOT, RNOT, RNOT; \
116 vpxor RT0, xy ## 1, xy ## 1; \
117 \
118 vpsrld $16, ab ## 0, RIDX; \
119 vpand RBYTE, RIDX, RIDX; \
120 vpgatherdd RNOT, (rs2, RIDX, 4), RT0; \
121 vpcmpeqd RNOT, RNOT, RNOT; \
122 vpxor RT0, xy ## 0, xy ## 0; \
123 \
124 vpsrld $16, ab ## 1, RIDX; \
125 vpand RBYTE, RIDX, RIDX; \
126 vpgatherdd RNOT, (rs2, RIDX, 4), RT0; \
127 vpcmpeqd RNOT, RNOT, RNOT; \
128 vpxor RT0, xy ## 1, xy ## 1; \
129 \
130 vpsrld $24, ab ## 0, RIDX; \
131 vpgatherdd RNOT, (rs3, RIDX, 4), RT0; \
132 vpcmpeqd RNOT, RNOT, RNOT; \
133 vpxor RT0, xy ## 0, xy ## 0; \
134 \
135 vpsrld $24, ab ## 1, RIDX; \
136 vpgatherdd RNOT, (rs3, RIDX, 4), RT0; \
137 vpcmpeqd RNOT, RNOT, RNOT; \
138 vpxor RT0, xy ## 1, xy ## 1;
139
140#define g1_16(a, x) \
141 g16(a, RS0, RS1, RS2, RS3, x);
142
143#define g2_16(b, y) \
144 g16(b, RS1, RS2, RS3, RS0, y);
145
146#define encrypt_round_end16(a, b, c, d, nk) \
147 vpaddd RY0, RX0, RX0; \
148 vpaddd RX0, RY0, RY0; \
149 vpbroadcastd nk(RK,RROUND,8), RT0; \
150 vpaddd RT0, RX0, RX0; \
151 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
152 vpaddd RT0, RY0, RY0; \
153 \
154 vpxor RY0, d ## 0, d ## 0; \
155 \
156 vpxor RX0, c ## 0, c ## 0; \
157 vpsrld $1, c ## 0, RT0; \
158 vpslld $31, c ## 0, c ## 0; \
159 vpor RT0, c ## 0, c ## 0; \
160 \
161 vpaddd RY1, RX1, RX1; \
162 vpaddd RX1, RY1, RY1; \
163 vpbroadcastd nk(RK,RROUND,8), RT0; \
164 vpaddd RT0, RX1, RX1; \
165 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
166 vpaddd RT0, RY1, RY1; \
167 \
168 vpxor RY1, d ## 1, d ## 1; \
169 \
170 vpxor RX1, c ## 1, c ## 1; \
171 vpsrld $1, c ## 1, RT0; \
172 vpslld $31, c ## 1, c ## 1; \
173 vpor RT0, c ## 1, c ## 1; \
174
175#define encrypt_round16(a, b, c, d, nk) \
176 g2_16(b, RY); \
177 \
178 vpslld $1, b ## 0, RT0; \
179 vpsrld $31, b ## 0, b ## 0; \
180 vpor RT0, b ## 0, b ## 0; \
181 \
182 vpslld $1, b ## 1, RT0; \
183 vpsrld $31, b ## 1, b ## 1; \
184 vpor RT0, b ## 1, b ## 1; \
185 \
186 g1_16(a, RX); \
187 \
188 encrypt_round_end16(a, b, c, d, nk);
189
190#define encrypt_round_first16(a, b, c, d, nk) \
191 vpslld $1, d ## 0, RT0; \
192 vpsrld $31, d ## 0, d ## 0; \
193 vpor RT0, d ## 0, d ## 0; \
194 \
195 vpslld $1, d ## 1, RT0; \
196 vpsrld $31, d ## 1, d ## 1; \
197 vpor RT0, d ## 1, d ## 1; \
198 \
199 encrypt_round16(a, b, c, d, nk);
200
201#define encrypt_round_last16(a, b, c, d, nk) \
202 g2_16(b, RY); \
203 \
204 g1_16(a, RX); \
205 \
206 encrypt_round_end16(a, b, c, d, nk);
207
208#define decrypt_round_end16(a, b, c, d, nk) \
209 vpaddd RY0, RX0, RX0; \
210 vpaddd RX0, RY0, RY0; \
211 vpbroadcastd nk(RK,RROUND,8), RT0; \
212 vpaddd RT0, RX0, RX0; \
213 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
214 vpaddd RT0, RY0, RY0; \
215 \
216 vpxor RX0, c ## 0, c ## 0; \
217 \
218 vpxor RY0, d ## 0, d ## 0; \
219 vpsrld $1, d ## 0, RT0; \
220 vpslld $31, d ## 0, d ## 0; \
221 vpor RT0, d ## 0, d ## 0; \
222 \
223 vpaddd RY1, RX1, RX1; \
224 vpaddd RX1, RY1, RY1; \
225 vpbroadcastd nk(RK,RROUND,8), RT0; \
226 vpaddd RT0, RX1, RX1; \
227 vpbroadcastd 4+nk(RK,RROUND,8), RT0; \
228 vpaddd RT0, RY1, RY1; \
229 \
230 vpxor RX1, c ## 1, c ## 1; \
231 \
232 vpxor RY1, d ## 1, d ## 1; \
233 vpsrld $1, d ## 1, RT0; \
234 vpslld $31, d ## 1, d ## 1; \
235 vpor RT0, d ## 1, d ## 1;
236
237#define decrypt_round16(a, b, c, d, nk) \
238 g1_16(a, RX); \
239 \
240 vpslld $1, a ## 0, RT0; \
241 vpsrld $31, a ## 0, a ## 0; \
242 vpor RT0, a ## 0, a ## 0; \
243 \
244 vpslld $1, a ## 1, RT0; \
245 vpsrld $31, a ## 1, a ## 1; \
246 vpor RT0, a ## 1, a ## 1; \
247 \
248 g2_16(b, RY); \
249 \
250 decrypt_round_end16(a, b, c, d, nk);
251
252#define decrypt_round_first16(a, b, c, d, nk) \
253 vpslld $1, c ## 0, RT0; \
254 vpsrld $31, c ## 0, c ## 0; \
255 vpor RT0, c ## 0, c ## 0; \
256 \
257 vpslld $1, c ## 1, RT0; \
258 vpsrld $31, c ## 1, c ## 1; \
259 vpor RT0, c ## 1, c ## 1; \
260 \
261 decrypt_round16(a, b, c, d, nk)
262
263#define decrypt_round_last16(a, b, c, d, nk) \
264 g1_16(a, RX); \
265 \
266 g2_16(b, RY); \
267 \
268 decrypt_round_end16(a, b, c, d, nk);
269
270#define encrypt_cycle16() \
271 encrypt_round16(RA, RB, RC, RD, 0); \
272 encrypt_round16(RC, RD, RA, RB, 8);
273
274#define encrypt_cycle_first16() \
275 encrypt_round_first16(RA, RB, RC, RD, 0); \
276 encrypt_round16(RC, RD, RA, RB, 8);
277
278#define encrypt_cycle_last16() \
279 encrypt_round16(RA, RB, RC, RD, 0); \
280 encrypt_round_last16(RC, RD, RA, RB, 8);
281
282#define decrypt_cycle16(n) \
283 decrypt_round16(RC, RD, RA, RB, 8); \
284 decrypt_round16(RA, RB, RC, RD, 0);
285
286#define decrypt_cycle_first16(n) \
287 decrypt_round_first16(RC, RD, RA, RB, 8); \
288 decrypt_round16(RA, RB, RC, RD, 0);
289
290#define decrypt_cycle_last16(n) \
291 decrypt_round16(RC, RD, RA, RB, 8); \
292 decrypt_round_last16(RA, RB, RC, RD, 0);
293
294#define transpose_4x4(x0,x1,x2,x3,t1,t2) \
295 vpunpckhdq x1, x0, t2; \
296 vpunpckldq x1, x0, x0; \
297 \
298 vpunpckldq x3, x2, t1; \
299 vpunpckhdq x3, x2, x2; \
300 \
301 vpunpckhqdq t1, x0, x1; \
302 vpunpcklqdq t1, x0, x0; \
303 \
304 vpunpckhqdq x2, t2, x3; \
305 vpunpcklqdq x2, t2, x2;
306
307#define read_blocks8(offs,a,b,c,d) \
308 transpose_4x4(a, b, c, d, RX0, RY0);
309
310#define write_blocks8(offs,a,b,c,d) \
311 transpose_4x4(a, b, c, d, RX0, RY0);
312
313#define inpack_enc8(a,b,c,d) \
314 vpbroadcastd 4*0(RW), RT0; \
315 vpxor RT0, a, a; \
316 \
317 vpbroadcastd 4*1(RW), RT0; \
318 vpxor RT0, b, b; \
319 \
320 vpbroadcastd 4*2(RW), RT0; \
321 vpxor RT0, c, c; \
322 \
323 vpbroadcastd 4*3(RW), RT0; \
324 vpxor RT0, d, d;
325
326#define outunpack_enc8(a,b,c,d) \
327 vpbroadcastd 4*4(RW), RX0; \
328 vpbroadcastd 4*5(RW), RY0; \
329 vpxor RX0, c, RX0; \
330 vpxor RY0, d, RY0; \
331 \
332 vpbroadcastd 4*6(RW), RT0; \
333 vpxor RT0, a, c; \
334 vpbroadcastd 4*7(RW), RT0; \
335 vpxor RT0, b, d; \
336 \
337 vmovdqa RX0, a; \
338 vmovdqa RY0, b;
339
340#define inpack_dec8(a,b,c,d) \
341 vpbroadcastd 4*4(RW), RX0; \
342 vpbroadcastd 4*5(RW), RY0; \
343 vpxor RX0, a, RX0; \
344 vpxor RY0, b, RY0; \
345 \
346 vpbroadcastd 4*6(RW), RT0; \
347 vpxor RT0, c, a; \
348 vpbroadcastd 4*7(RW), RT0; \
349 vpxor RT0, d, b; \
350 \
351 vmovdqa RX0, c; \
352 vmovdqa RY0, d;
353
354#define outunpack_dec8(a,b,c,d) \
355 vpbroadcastd 4*0(RW), RT0; \
356 vpxor RT0, a, a; \
357 \
358 vpbroadcastd 4*1(RW), RT0; \
359 vpxor RT0, b, b; \
360 \
361 vpbroadcastd 4*2(RW), RT0; \
362 vpxor RT0, c, c; \
363 \
364 vpbroadcastd 4*3(RW), RT0; \
365 vpxor RT0, d, d;
366
367#define read_blocks16(a,b,c,d) \
368 read_blocks8(0, a ## 0, b ## 0, c ## 0, d ## 0); \
369 read_blocks8(8, a ## 1, b ## 1, c ## 1, d ## 1);
370
371#define write_blocks16(a,b,c,d) \
372 write_blocks8(0, a ## 0, b ## 0, c ## 0, d ## 0); \
373 write_blocks8(8, a ## 1, b ## 1, c ## 1, d ## 1);
374
375#define xor_blocks16(a,b,c,d) \
376 xor_blocks8(0, a ## 0, b ## 0, c ## 0, d ## 0); \
377 xor_blocks8(8, a ## 1, b ## 1, c ## 1, d ## 1);
378
379#define inpack_enc16(a,b,c,d) \
380 inpack_enc8(a ## 0, b ## 0, c ## 0, d ## 0); \
381 inpack_enc8(a ## 1, b ## 1, c ## 1, d ## 1);
382
383#define outunpack_enc16(a,b,c,d) \
384 outunpack_enc8(a ## 0, b ## 0, c ## 0, d ## 0); \
385 outunpack_enc8(a ## 1, b ## 1, c ## 1, d ## 1);
386
387#define inpack_dec16(a,b,c,d) \
388 inpack_dec8(a ## 0, b ## 0, c ## 0, d ## 0); \
389 inpack_dec8(a ## 1, b ## 1, c ## 1, d ## 1);
390
391#define outunpack_dec16(a,b,c,d) \
392 outunpack_dec8(a ## 0, b ## 0, c ## 0, d ## 0); \
393 outunpack_dec8(a ## 1, b ## 1, c ## 1, d ## 1);
394
395.align 8
396__twofish_enc_blk16:
397 /* input:
398 * %rdi: ctx, CTX
399 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: plaintext
400 * output:
401 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: ciphertext
402 */
403 init_round_constants();
404
405 read_blocks16(RA, RB, RC, RD);
406 inpack_enc16(RA, RB, RC, RD);
407
408 xorl RROUNDd, RROUNDd;
409 encrypt_cycle_first16();
410 movl $2, RROUNDd;
411
412.align 4
413.L__enc_loop:
414 encrypt_cycle16();
415
416 addl $2, RROUNDd;
417 cmpl $14, RROUNDd;
418 jne .L__enc_loop;
419
420 encrypt_cycle_last16();
421
422 outunpack_enc16(RA, RB, RC, RD);
423 write_blocks16(RA, RB, RC, RD);
424
425 ret;
426ENDPROC(__twofish_enc_blk16)
427
428.align 8
429__twofish_dec_blk16:
430 /* input:
431 * %rdi: ctx, CTX
432 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: ciphertext
433 * output:
434 * RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1: plaintext
435 */
436 init_round_constants();
437
438 read_blocks16(RA, RB, RC, RD);
439 inpack_dec16(RA, RB, RC, RD);
440
441 movl $14, RROUNDd;
442 decrypt_cycle_first16();
443 movl $12, RROUNDd;
444
445.align 4
446.L__dec_loop:
447 decrypt_cycle16();
448
449 addl $-2, RROUNDd;
450 jnz .L__dec_loop;
451
452 decrypt_cycle_last16();
453
454 outunpack_dec16(RA, RB, RC, RD);
455 write_blocks16(RA, RB, RC, RD);
456
457 ret;
458ENDPROC(__twofish_dec_blk16)
459
460ENTRY(twofish_ecb_enc_16way)
461 /* input:
462 * %rdi: ctx, CTX
463 * %rsi: dst
464 * %rdx: src
465 */
466
467 vzeroupper;
468 pushq %r12;
469
470 load_16way(%rdx, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
471
472 call __twofish_enc_blk16;
473
474 store_16way(%rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
475
476 popq %r12;
477 vzeroupper;
478
479 ret;
480ENDPROC(twofish_ecb_enc_16way)
481
482ENTRY(twofish_ecb_dec_16way)
483 /* input:
484 * %rdi: ctx, CTX
485 * %rsi: dst
486 * %rdx: src
487 */
488
489 vzeroupper;
490 pushq %r12;
491
492 load_16way(%rdx, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
493
494 call __twofish_dec_blk16;
495
496 store_16way(%rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
497
498 popq %r12;
499 vzeroupper;
500
501 ret;
502ENDPROC(twofish_ecb_dec_16way)
503
504ENTRY(twofish_cbc_dec_16way)
505 /* input:
506 * %rdi: ctx, CTX
507 * %rsi: dst
508 * %rdx: src
509 */
510
511 vzeroupper;
512 pushq %r12;
513
514 load_16way(%rdx, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
515
516 call __twofish_dec_blk16;
517
518 store_cbc_16way(%rdx, %rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1,
519 RX0);
520
521 popq %r12;
522 vzeroupper;
523
524 ret;
525ENDPROC(twofish_cbc_dec_16way)
526
527ENTRY(twofish_ctr_16way)
528 /* input:
529 * %rdi: ctx, CTX
530 * %rsi: dst (16 blocks)
531 * %rdx: src (16 blocks)
532 * %rcx: iv (little endian, 128bit)
533 */
534
535 vzeroupper;
536 pushq %r12;
537
538 load_ctr_16way(%rcx, .Lbswap128_mask, RA0, RB0, RC0, RD0, RA1, RB1, RC1,
539 RD1, RX0, RX0x, RX1, RX1x, RY0, RY0x, RY1, RY1x, RNOT,
540 RBYTE);
541
542 call __twofish_enc_blk16;
543
544 store_ctr_16way(%rdx, %rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
545
546 popq %r12;
547 vzeroupper;
548
549 ret;
550ENDPROC(twofish_ctr_16way)
551
552.align 8
553twofish_xts_crypt_16way:
554 /* input:
555 * %rdi: ctx, CTX
556 * %rsi: dst (16 blocks)
557 * %rdx: src (16 blocks)
558 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
559 * %r8: pointer to __twofish_enc_blk16 or __twofish_dec_blk16
560 */
561
562 vzeroupper;
563 pushq %r12;
564
565 load_xts_16way(%rcx, %rdx, %rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1,
566 RD1, RX0, RX0x, RX1, RX1x, RY0, RY0x, RY1, RY1x, RNOT,
567 .Lxts_gf128mul_and_shl1_mask_0,
568 .Lxts_gf128mul_and_shl1_mask_1);
569
570 call *%r8;
571
572 store_xts_16way(%rsi, RA0, RB0, RC0, RD0, RA1, RB1, RC1, RD1);
573
574 popq %r12;
575 vzeroupper;
576
577 ret;
578ENDPROC(twofish_xts_crypt_16way)
579
580ENTRY(twofish_xts_enc_16way)
581 /* input:
582 * %rdi: ctx, CTX
583 * %rsi: dst (16 blocks)
584 * %rdx: src (16 blocks)
585 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
586 */
587 leaq __twofish_enc_blk16, %r8;
588 jmp twofish_xts_crypt_16way;
589ENDPROC(twofish_xts_enc_16way)
590
591ENTRY(twofish_xts_dec_16way)
592 /* input:
593 * %rdi: ctx, CTX
594 * %rsi: dst (16 blocks)
595 * %rdx: src (16 blocks)
596 * %rcx: iv (t ⊕ αⁿ ∈ GF(2¹²⁸))
597 */
598 leaq __twofish_dec_blk16, %r8;
599 jmp twofish_xts_crypt_16way;
600ENDPROC(twofish_xts_dec_16way)
diff --git a/arch/x86/crypto/twofish_avx2_glue.c b/arch/x86/crypto/twofish_avx2_glue.c
deleted file mode 100644
index ce33b5be64ee..000000000000
--- a/arch/x86/crypto/twofish_avx2_glue.c
+++ /dev/null
@@ -1,584 +0,0 @@
1/*
2 * Glue Code for x86_64/AVX2 assembler optimized version of Twofish
3 *
4 * Copyright © 2012-2013 Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/crypto.h>
16#include <linux/err.h>
17#include <crypto/algapi.h>
18#include <crypto/ctr.h>
19#include <crypto/twofish.h>
20#include <crypto/lrw.h>
21#include <crypto/xts.h>
22#include <asm/xcr.h>
23#include <asm/xsave.h>
24#include <asm/crypto/twofish.h>
25#include <asm/crypto/ablk_helper.h>
26#include <asm/crypto/glue_helper.h>
27#include <crypto/scatterwalk.h>
28
29#define TF_AVX2_PARALLEL_BLOCKS 16
30
31/* 16-way AVX2 parallel cipher functions */
32asmlinkage void twofish_ecb_enc_16way(struct twofish_ctx *ctx, u8 *dst,
33 const u8 *src);
34asmlinkage void twofish_ecb_dec_16way(struct twofish_ctx *ctx, u8 *dst,
35 const u8 *src);
36asmlinkage void twofish_cbc_dec_16way(void *ctx, u128 *dst, const u128 *src);
37
38asmlinkage void twofish_ctr_16way(void *ctx, u128 *dst, const u128 *src,
39 le128 *iv);
40
41asmlinkage void twofish_xts_enc_16way(struct twofish_ctx *ctx, u8 *dst,
42 const u8 *src, le128 *iv);
43asmlinkage void twofish_xts_dec_16way(struct twofish_ctx *ctx, u8 *dst,
44 const u8 *src, le128 *iv);
45
46static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
47 const u8 *src)
48{
49 __twofish_enc_blk_3way(ctx, dst, src, false);
50}
51
52static const struct common_glue_ctx twofish_enc = {
53 .num_funcs = 4,
54 .fpu_blocks_limit = 8,
55
56 .funcs = { {
57 .num_blocks = 16,
58 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_enc_16way) }
59 }, {
60 .num_blocks = 8,
61 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_enc_8way) }
62 }, {
63 .num_blocks = 3,
64 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_enc_blk_3way) }
65 }, {
66 .num_blocks = 1,
67 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_enc_blk) }
68 } }
69};
70
71static const struct common_glue_ctx twofish_ctr = {
72 .num_funcs = 4,
73 .fpu_blocks_limit = 8,
74
75 .funcs = { {
76 .num_blocks = 16,
77 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_ctr_16way) }
78 }, {
79 .num_blocks = 8,
80 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_ctr_8way) }
81 }, {
82 .num_blocks = 3,
83 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_enc_blk_ctr_3way) }
84 }, {
85 .num_blocks = 1,
86 .fn_u = { .ctr = GLUE_CTR_FUNC_CAST(twofish_enc_blk_ctr) }
87 } }
88};
89
90static const struct common_glue_ctx twofish_enc_xts = {
91 .num_funcs = 3,
92 .fpu_blocks_limit = 8,
93
94 .funcs = { {
95 .num_blocks = 16,
96 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc_16way) }
97 }, {
98 .num_blocks = 8,
99 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc_8way) }
100 }, {
101 .num_blocks = 1,
102 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_enc) }
103 } }
104};
105
106static const struct common_glue_ctx twofish_dec = {
107 .num_funcs = 4,
108 .fpu_blocks_limit = 8,
109
110 .funcs = { {
111 .num_blocks = 16,
112 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_dec_16way) }
113 }, {
114 .num_blocks = 8,
115 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_ecb_dec_8way) }
116 }, {
117 .num_blocks = 3,
118 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_dec_blk_3way) }
119 }, {
120 .num_blocks = 1,
121 .fn_u = { .ecb = GLUE_FUNC_CAST(twofish_dec_blk) }
122 } }
123};
124
125static const struct common_glue_ctx twofish_dec_cbc = {
126 .num_funcs = 4,
127 .fpu_blocks_limit = 8,
128
129 .funcs = { {
130 .num_blocks = 16,
131 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_cbc_dec_16way) }
132 }, {
133 .num_blocks = 8,
134 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_cbc_dec_8way) }
135 }, {
136 .num_blocks = 3,
137 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_dec_blk_cbc_3way) }
138 }, {
139 .num_blocks = 1,
140 .fn_u = { .cbc = GLUE_CBC_FUNC_CAST(twofish_dec_blk) }
141 } }
142};
143
144static const struct common_glue_ctx twofish_dec_xts = {
145 .num_funcs = 3,
146 .fpu_blocks_limit = 8,
147
148 .funcs = { {
149 .num_blocks = 16,
150 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec_16way) }
151 }, {
152 .num_blocks = 8,
153 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec_8way) }
154 }, {
155 .num_blocks = 1,
156 .fn_u = { .xts = GLUE_XTS_FUNC_CAST(twofish_xts_dec) }
157 } }
158};
159
160static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
161 struct scatterlist *src, unsigned int nbytes)
162{
163 return glue_ecb_crypt_128bit(&twofish_enc, desc, dst, src, nbytes);
164}
165
166static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
167 struct scatterlist *src, unsigned int nbytes)
168{
169 return glue_ecb_crypt_128bit(&twofish_dec, desc, dst, src, nbytes);
170}
171
172static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
173 struct scatterlist *src, unsigned int nbytes)
174{
175 return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(twofish_enc_blk), desc,
176 dst, src, nbytes);
177}
178
179static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
180 struct scatterlist *src, unsigned int nbytes)
181{
182 return glue_cbc_decrypt_128bit(&twofish_dec_cbc, desc, dst, src,
183 nbytes);
184}
185
186static int ctr_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
187 struct scatterlist *src, unsigned int nbytes)
188{
189 return glue_ctr_crypt_128bit(&twofish_ctr, desc, dst, src, nbytes);
190}
191
192static inline bool twofish_fpu_begin(bool fpu_enabled, unsigned int nbytes)
193{
194 /* since reusing AVX functions, starts using FPU at 8 parallel blocks */
195 return glue_fpu_begin(TF_BLOCK_SIZE, 8, NULL, fpu_enabled, nbytes);
196}
197
198static inline void twofish_fpu_end(bool fpu_enabled)
199{
200 glue_fpu_end(fpu_enabled);
201}
202
203struct crypt_priv {
204 struct twofish_ctx *ctx;
205 bool fpu_enabled;
206};
207
208static void encrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
209{
210 const unsigned int bsize = TF_BLOCK_SIZE;
211 struct crypt_priv *ctx = priv;
212 int i;
213
214 ctx->fpu_enabled = twofish_fpu_begin(ctx->fpu_enabled, nbytes);
215
216 while (nbytes >= TF_AVX2_PARALLEL_BLOCKS * bsize) {
217 twofish_ecb_enc_16way(ctx->ctx, srcdst, srcdst);
218 srcdst += bsize * TF_AVX2_PARALLEL_BLOCKS;
219 nbytes -= bsize * TF_AVX2_PARALLEL_BLOCKS;
220 }
221
222 while (nbytes >= 8 * bsize) {
223 twofish_ecb_enc_8way(ctx->ctx, srcdst, srcdst);
224 srcdst += bsize * 8;
225 nbytes -= bsize * 8;
226 }
227
228 while (nbytes >= 3 * bsize) {
229 twofish_enc_blk_3way(ctx->ctx, srcdst, srcdst);
230 srcdst += bsize * 3;
231 nbytes -= bsize * 3;
232 }
233
234 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
235 twofish_enc_blk(ctx->ctx, srcdst, srcdst);
236}
237
238static void decrypt_callback(void *priv, u8 *srcdst, unsigned int nbytes)
239{
240 const unsigned int bsize = TF_BLOCK_SIZE;
241 struct crypt_priv *ctx = priv;
242 int i;
243
244 ctx->fpu_enabled = twofish_fpu_begin(ctx->fpu_enabled, nbytes);
245
246 while (nbytes >= TF_AVX2_PARALLEL_BLOCKS * bsize) {
247 twofish_ecb_dec_16way(ctx->ctx, srcdst, srcdst);
248 srcdst += bsize * TF_AVX2_PARALLEL_BLOCKS;
249 nbytes -= bsize * TF_AVX2_PARALLEL_BLOCKS;
250 }
251
252 while (nbytes >= 8 * bsize) {
253 twofish_ecb_dec_8way(ctx->ctx, srcdst, srcdst);
254 srcdst += bsize * 8;
255 nbytes -= bsize * 8;
256 }
257
258 while (nbytes >= 3 * bsize) {
259 twofish_dec_blk_3way(ctx->ctx, srcdst, srcdst);
260 srcdst += bsize * 3;
261 nbytes -= bsize * 3;
262 }
263
264 for (i = 0; i < nbytes / bsize; i++, srcdst += bsize)
265 twofish_dec_blk(ctx->ctx, srcdst, srcdst);
266}
267
268static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
269 struct scatterlist *src, unsigned int nbytes)
270{
271 struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
272 be128 buf[TF_AVX2_PARALLEL_BLOCKS];
273 struct crypt_priv crypt_ctx = {
274 .ctx = &ctx->twofish_ctx,
275 .fpu_enabled = false,
276 };
277 struct lrw_crypt_req req = {
278 .tbuf = buf,
279 .tbuflen = sizeof(buf),
280
281 .table_ctx = &ctx->lrw_table,
282 .crypt_ctx = &crypt_ctx,
283 .crypt_fn = encrypt_callback,
284 };
285 int ret;
286
287 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
288 ret = lrw_crypt(desc, dst, src, nbytes, &req);
289 twofish_fpu_end(crypt_ctx.fpu_enabled);
290
291 return ret;
292}
293
294static int lrw_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
295 struct scatterlist *src, unsigned int nbytes)
296{
297 struct twofish_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
298 be128 buf[TF_AVX2_PARALLEL_BLOCKS];
299 struct crypt_priv crypt_ctx = {
300 .ctx = &ctx->twofish_ctx,
301 .fpu_enabled = false,
302 };
303 struct lrw_crypt_req req = {
304 .tbuf = buf,
305 .tbuflen = sizeof(buf),
306
307 .table_ctx = &ctx->lrw_table,
308 .crypt_ctx = &crypt_ctx,
309 .crypt_fn = decrypt_callback,
310 };
311 int ret;
312
313 desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
314 ret = lrw_crypt(desc, dst, src, nbytes, &req);
315 twofish_fpu_end(crypt_ctx.fpu_enabled);
316
317 return ret;
318}
319
320static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
321 struct scatterlist *src, unsigned int nbytes)
322{
323 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
324
325 return glue_xts_crypt_128bit(&twofish_enc_xts, desc, dst, src, nbytes,
326 XTS_TWEAK_CAST(twofish_enc_blk),
327 &ctx->tweak_ctx, &ctx->crypt_ctx);
328}
329
330static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
331 struct scatterlist *src, unsigned int nbytes)
332{
333 struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
334
335 return glue_xts_crypt_128bit(&twofish_dec_xts, desc, dst, src, nbytes,
336 XTS_TWEAK_CAST(twofish_enc_blk),
337 &ctx->tweak_ctx, &ctx->crypt_ctx);
338}
339
340static struct crypto_alg tf_algs[10] = { {
341 .cra_name = "__ecb-twofish-avx2",
342 .cra_driver_name = "__driver-ecb-twofish-avx2",
343 .cra_priority = 0,
344 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
345 .cra_blocksize = TF_BLOCK_SIZE,
346 .cra_ctxsize = sizeof(struct twofish_ctx),
347 .cra_alignmask = 0,
348 .cra_type = &crypto_blkcipher_type,
349 .cra_module = THIS_MODULE,
350 .cra_u = {
351 .blkcipher = {
352 .min_keysize = TF_MIN_KEY_SIZE,
353 .max_keysize = TF_MAX_KEY_SIZE,
354 .setkey = twofish_setkey,
355 .encrypt = ecb_encrypt,
356 .decrypt = ecb_decrypt,
357 },
358 },
359}, {
360 .cra_name = "__cbc-twofish-avx2",
361 .cra_driver_name = "__driver-cbc-twofish-avx2",
362 .cra_priority = 0,
363 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
364 .cra_blocksize = TF_BLOCK_SIZE,
365 .cra_ctxsize = sizeof(struct twofish_ctx),
366 .cra_alignmask = 0,
367 .cra_type = &crypto_blkcipher_type,
368 .cra_module = THIS_MODULE,
369 .cra_u = {
370 .blkcipher = {
371 .min_keysize = TF_MIN_KEY_SIZE,
372 .max_keysize = TF_MAX_KEY_SIZE,
373 .setkey = twofish_setkey,
374 .encrypt = cbc_encrypt,
375 .decrypt = cbc_decrypt,
376 },
377 },
378}, {
379 .cra_name = "__ctr-twofish-avx2",
380 .cra_driver_name = "__driver-ctr-twofish-avx2",
381 .cra_priority = 0,
382 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
383 .cra_blocksize = 1,
384 .cra_ctxsize = sizeof(struct twofish_ctx),
385 .cra_alignmask = 0,
386 .cra_type = &crypto_blkcipher_type,
387 .cra_module = THIS_MODULE,
388 .cra_u = {
389 .blkcipher = {
390 .min_keysize = TF_MIN_KEY_SIZE,
391 .max_keysize = TF_MAX_KEY_SIZE,
392 .ivsize = TF_BLOCK_SIZE,
393 .setkey = twofish_setkey,
394 .encrypt = ctr_crypt,
395 .decrypt = ctr_crypt,
396 },
397 },
398}, {
399 .cra_name = "__lrw-twofish-avx2",
400 .cra_driver_name = "__driver-lrw-twofish-avx2",
401 .cra_priority = 0,
402 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
403 .cra_blocksize = TF_BLOCK_SIZE,
404 .cra_ctxsize = sizeof(struct twofish_lrw_ctx),
405 .cra_alignmask = 0,
406 .cra_type = &crypto_blkcipher_type,
407 .cra_module = THIS_MODULE,
408 .cra_exit = lrw_twofish_exit_tfm,
409 .cra_u = {
410 .blkcipher = {
411 .min_keysize = TF_MIN_KEY_SIZE +
412 TF_BLOCK_SIZE,
413 .max_keysize = TF_MAX_KEY_SIZE +
414 TF_BLOCK_SIZE,
415 .ivsize = TF_BLOCK_SIZE,
416 .setkey = lrw_twofish_setkey,
417 .encrypt = lrw_encrypt,
418 .decrypt = lrw_decrypt,
419 },
420 },
421}, {
422 .cra_name = "__xts-twofish-avx2",
423 .cra_driver_name = "__driver-xts-twofish-avx2",
424 .cra_priority = 0,
425 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
426 .cra_blocksize = TF_BLOCK_SIZE,
427 .cra_ctxsize = sizeof(struct twofish_xts_ctx),
428 .cra_alignmask = 0,
429 .cra_type = &crypto_blkcipher_type,
430 .cra_module = THIS_MODULE,
431 .cra_u = {
432 .blkcipher = {
433 .min_keysize = TF_MIN_KEY_SIZE * 2,
434 .max_keysize = TF_MAX_KEY_SIZE * 2,
435 .ivsize = TF_BLOCK_SIZE,
436 .setkey = xts_twofish_setkey,
437 .encrypt = xts_encrypt,
438 .decrypt = xts_decrypt,
439 },
440 },
441}, {
442 .cra_name = "ecb(twofish)",
443 .cra_driver_name = "ecb-twofish-avx2",
444 .cra_priority = 500,
445 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
446 .cra_blocksize = TF_BLOCK_SIZE,
447 .cra_ctxsize = sizeof(struct async_helper_ctx),
448 .cra_alignmask = 0,
449 .cra_type = &crypto_ablkcipher_type,
450 .cra_module = THIS_MODULE,
451 .cra_init = ablk_init,
452 .cra_exit = ablk_exit,
453 .cra_u = {
454 .ablkcipher = {
455 .min_keysize = TF_MIN_KEY_SIZE,
456 .max_keysize = TF_MAX_KEY_SIZE,
457 .setkey = ablk_set_key,
458 .encrypt = ablk_encrypt,
459 .decrypt = ablk_decrypt,
460 },
461 },
462}, {
463 .cra_name = "cbc(twofish)",
464 .cra_driver_name = "cbc-twofish-avx2",
465 .cra_priority = 500,
466 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
467 .cra_blocksize = TF_BLOCK_SIZE,
468 .cra_ctxsize = sizeof(struct async_helper_ctx),
469 .cra_alignmask = 0,
470 .cra_type = &crypto_ablkcipher_type,
471 .cra_module = THIS_MODULE,
472 .cra_init = ablk_init,
473 .cra_exit = ablk_exit,
474 .cra_u = {
475 .ablkcipher = {
476 .min_keysize = TF_MIN_KEY_SIZE,
477 .max_keysize = TF_MAX_KEY_SIZE,
478 .ivsize = TF_BLOCK_SIZE,
479 .setkey = ablk_set_key,
480 .encrypt = __ablk_encrypt,
481 .decrypt = ablk_decrypt,
482 },
483 },
484}, {
485 .cra_name = "ctr(twofish)",
486 .cra_driver_name = "ctr-twofish-avx2",
487 .cra_priority = 500,
488 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
489 .cra_blocksize = 1,
490 .cra_ctxsize = sizeof(struct async_helper_ctx),
491 .cra_alignmask = 0,
492 .cra_type = &crypto_ablkcipher_type,
493 .cra_module = THIS_MODULE,
494 .cra_init = ablk_init,
495 .cra_exit = ablk_exit,
496 .cra_u = {
497 .ablkcipher = {
498 .min_keysize = TF_MIN_KEY_SIZE,
499 .max_keysize = TF_MAX_KEY_SIZE,
500 .ivsize = TF_BLOCK_SIZE,
501 .setkey = ablk_set_key,
502 .encrypt = ablk_encrypt,
503 .decrypt = ablk_encrypt,
504 .geniv = "chainiv",
505 },
506 },
507}, {
508 .cra_name = "lrw(twofish)",
509 .cra_driver_name = "lrw-twofish-avx2",
510 .cra_priority = 500,
511 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
512 .cra_blocksize = TF_BLOCK_SIZE,
513 .cra_ctxsize = sizeof(struct async_helper_ctx),
514 .cra_alignmask = 0,
515 .cra_type = &crypto_ablkcipher_type,
516 .cra_module = THIS_MODULE,
517 .cra_init = ablk_init,
518 .cra_exit = ablk_exit,
519 .cra_u = {
520 .ablkcipher = {
521 .min_keysize = TF_MIN_KEY_SIZE +
522 TF_BLOCK_SIZE,
523 .max_keysize = TF_MAX_KEY_SIZE +
524 TF_BLOCK_SIZE,
525 .ivsize = TF_BLOCK_SIZE,
526 .setkey = ablk_set_key,
527 .encrypt = ablk_encrypt,
528 .decrypt = ablk_decrypt,
529 },
530 },
531}, {
532 .cra_name = "xts(twofish)",
533 .cra_driver_name = "xts-twofish-avx2",
534 .cra_priority = 500,
535 .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC,
536 .cra_blocksize = TF_BLOCK_SIZE,
537 .cra_ctxsize = sizeof(struct async_helper_ctx),
538 .cra_alignmask = 0,
539 .cra_type = &crypto_ablkcipher_type,
540 .cra_module = THIS_MODULE,
541 .cra_init = ablk_init,
542 .cra_exit = ablk_exit,
543 .cra_u = {
544 .ablkcipher = {
545 .min_keysize = TF_MIN_KEY_SIZE * 2,
546 .max_keysize = TF_MAX_KEY_SIZE * 2,
547 .ivsize = TF_BLOCK_SIZE,
548 .setkey = ablk_set_key,
549 .encrypt = ablk_encrypt,
550 .decrypt = ablk_decrypt,
551 },
552 },
553} };
554
555static int __init init(void)
556{
557 u64 xcr0;
558
559 if (!cpu_has_avx2 || !cpu_has_osxsave) {
560 pr_info("AVX2 instructions are not detected.\n");
561 return -ENODEV;
562 }
563
564 xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
565 if ((xcr0 & (XSTATE_SSE | XSTATE_YMM)) != (XSTATE_SSE | XSTATE_YMM)) {
566 pr_info("AVX2 detected but unusable.\n");
567 return -ENODEV;
568 }
569
570 return crypto_register_algs(tf_algs, ARRAY_SIZE(tf_algs));
571}
572
573static void __exit fini(void)
574{
575 crypto_unregister_algs(tf_algs, ARRAY_SIZE(tf_algs));
576}
577
578module_init(init);
579module_exit(fini);
580
581MODULE_LICENSE("GPL");
582MODULE_DESCRIPTION("Twofish Cipher Algorithm, AVX2 optimized");
583MODULE_ALIAS("twofish");
584MODULE_ALIAS("twofish-asm");
diff --git a/arch/x86/crypto/twofish_avx_glue.c b/arch/x86/crypto/twofish_avx_glue.c
index 2047a562f6b3..a62ba541884e 100644
--- a/arch/x86/crypto/twofish_avx_glue.c
+++ b/arch/x86/crypto/twofish_avx_glue.c
@@ -50,26 +50,18 @@
50/* 8-way parallel cipher functions */ 50/* 8-way parallel cipher functions */
51asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst, 51asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst,
52 const u8 *src); 52 const u8 *src);
53EXPORT_SYMBOL_GPL(twofish_ecb_enc_8way);
54
55asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst, 53asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst,
56 const u8 *src); 54 const u8 *src);
57EXPORT_SYMBOL_GPL(twofish_ecb_dec_8way);
58 55
59asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst, 56asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst,
60 const u8 *src); 57 const u8 *src);
61EXPORT_SYMBOL_GPL(twofish_cbc_dec_8way);
62
63asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst, 58asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst,
64 const u8 *src, le128 *iv); 59 const u8 *src, le128 *iv);
65EXPORT_SYMBOL_GPL(twofish_ctr_8way);
66 60
67asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst, 61asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst,
68 const u8 *src, le128 *iv); 62 const u8 *src, le128 *iv);
69EXPORT_SYMBOL_GPL(twofish_xts_enc_8way);
70asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst, 63asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst,
71 const u8 *src, le128 *iv); 64 const u8 *src, le128 *iv);
72EXPORT_SYMBOL_GPL(twofish_xts_dec_8way);
73 65
74static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst, 66static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
75 const u8 *src) 67 const u8 *src)
@@ -77,19 +69,17 @@ static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
77 __twofish_enc_blk_3way(ctx, dst, src, false); 69 __twofish_enc_blk_3way(ctx, dst, src, false);
78} 70}
79 71
80void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv) 72static void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv)
81{ 73{
82 glue_xts_crypt_128bit_one(ctx, dst, src, iv, 74 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
83 GLUE_FUNC_CAST(twofish_enc_blk)); 75 GLUE_FUNC_CAST(twofish_enc_blk));
84} 76}
85EXPORT_SYMBOL_GPL(twofish_xts_enc);
86 77
87void twofish_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv) 78static void twofish_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv)
88{ 79{
89 glue_xts_crypt_128bit_one(ctx, dst, src, iv, 80 glue_xts_crypt_128bit_one(ctx, dst, src, iv,
90 GLUE_FUNC_CAST(twofish_dec_blk)); 81 GLUE_FUNC_CAST(twofish_dec_blk));
91} 82}
92EXPORT_SYMBOL_GPL(twofish_xts_dec);
93 83
94 84
95static const struct common_glue_ctx twofish_enc = { 85static const struct common_glue_ctx twofish_enc = {
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 805078e08013..52ff81cce008 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -192,7 +192,7 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
192 /* struct user */ 192 /* struct user */
193 DUMP_WRITE(&dump, sizeof(dump)); 193 DUMP_WRITE(&dump, sizeof(dump));
194 /* Now dump all of the user data. Include malloced stuff as well */ 194 /* Now dump all of the user data. Include malloced stuff as well */
195 DUMP_SEEK(PAGE_SIZE); 195 DUMP_SEEK(PAGE_SIZE - sizeof(dump));
196 /* now we start writing out the user space info */ 196 /* now we start writing out the user space info */
197 set_fs(USER_DS); 197 set_fs(USER_DS);
198 /* Dump the data area */ 198 /* Dump the data area */
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index cf1a471a18a2..bccfca68430e 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -34,8 +34,6 @@
34#include <asm/sys_ia32.h> 34#include <asm/sys_ia32.h>
35#include <asm/smap.h> 35#include <asm/smap.h>
36 36
37#define FIX_EFLAGS __FIX_EFLAGS
38
39int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 37int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
40{ 38{
41 int err = 0; 39 int err = 0;
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index b31bf97775fc..2dfac58f3b11 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -111,7 +111,7 @@ static inline void acpi_disable_pci(void)
111} 111}
112 112
113/* Low-level suspend routine. */ 113/* Low-level suspend routine. */
114extern int acpi_suspend_lowlevel(void); 114extern int (*acpi_suspend_lowlevel)(void);
115 115
116/* Physical address to resume after wakeup */ 116/* Physical address to resume after wakeup */
117#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start)) 117#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 338803422239..f8119b582c3c 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -12,6 +12,7 @@
12#include <asm/fixmap.h> 12#include <asm/fixmap.h>
13#include <asm/mpspec.h> 13#include <asm/mpspec.h>
14#include <asm/msr.h> 14#include <asm/msr.h>
15#include <asm/idle.h>
15 16
16#define ARCH_APICTIMER_STOPS_ON_C3 1 17#define ARCH_APICTIMER_STOPS_ON_C3 1
17 18
@@ -687,5 +688,31 @@ extern int default_check_phys_apicid_present(int phys_apicid);
687#endif 688#endif
688 689
689#endif /* CONFIG_X86_LOCAL_APIC */ 690#endif /* CONFIG_X86_LOCAL_APIC */
691extern void irq_enter(void);
692extern void irq_exit(void);
693
694static inline void entering_irq(void)
695{
696 irq_enter();
697 exit_idle();
698}
699
700static inline void entering_ack_irq(void)
701{
702 ack_APIC_irq();
703 entering_irq();
704}
705
706static inline void exiting_irq(void)
707{
708 irq_exit();
709}
710
711static inline void exiting_ack_irq(void)
712{
713 irq_exit();
714 /* Ack only at the end to avoid potential reentry */
715 ack_APIC_irq();
716}
690 717
691#endif /* _ASM_X86_APIC_H */ 718#endif /* _ASM_X86_APIC_H */
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index e99ac27f95b2..47538a61c91b 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -92,7 +92,7 @@
92#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */ 92#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */
93#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */ 93#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */
94#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */ 94#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
95 /* 21 available, was AMD_C1E */ 95#define X86_FEATURE_ALWAYS (3*32+21) /* "" Always-present feature */
96#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */ 96#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */
97#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */ 97#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
98#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */ 98#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
@@ -356,15 +356,36 @@ extern const char * const x86_power_flags[32];
356#endif /* CONFIG_X86_64 */ 356#endif /* CONFIG_X86_64 */
357 357
358#if __GNUC__ >= 4 358#if __GNUC__ >= 4
359extern void warn_pre_alternatives(void);
360extern bool __static_cpu_has_safe(u16 bit);
361
359/* 362/*
360 * Static testing of CPU features. Used the same as boot_cpu_has(). 363 * Static testing of CPU features. Used the same as boot_cpu_has().
361 * These are only valid after alternatives have run, but will statically 364 * These are only valid after alternatives have run, but will statically
362 * patch the target code for additional performance. 365 * patch the target code for additional performance.
363 *
364 */ 366 */
365static __always_inline __pure bool __static_cpu_has(u16 bit) 367static __always_inline __pure bool __static_cpu_has(u16 bit)
366{ 368{
367#if __GNUC__ > 4 || __GNUC_MINOR__ >= 5 369#if __GNUC__ > 4 || __GNUC_MINOR__ >= 5
370
371#ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS
372 /*
373 * Catch too early usage of this before alternatives
374 * have run.
375 */
376 asm goto("1: jmp %l[t_warn]\n"
377 "2:\n"
378 ".section .altinstructions,\"a\"\n"
379 " .long 1b - .\n"
380 " .long 0\n" /* no replacement */
381 " .word %P0\n" /* 1: do replace */
382 " .byte 2b - 1b\n" /* source len */
383 " .byte 0\n" /* replacement len */
384 ".previous\n"
385 /* skipping size check since replacement size = 0 */
386 : : "i" (X86_FEATURE_ALWAYS) : : t_warn);
387#endif
388
368 asm goto("1: jmp %l[t_no]\n" 389 asm goto("1: jmp %l[t_no]\n"
369 "2:\n" 390 "2:\n"
370 ".section .altinstructions,\"a\"\n" 391 ".section .altinstructions,\"a\"\n"
@@ -379,7 +400,13 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
379 return true; 400 return true;
380 t_no: 401 t_no:
381 return false; 402 return false;
382#else 403
404#ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS
405 t_warn:
406 warn_pre_alternatives();
407 return false;
408#endif
409#else /* GCC_VERSION >= 40500 */
383 u8 flag; 410 u8 flag;
384 /* Open-coded due to __stringify() in ALTERNATIVE() */ 411 /* Open-coded due to __stringify() in ALTERNATIVE() */
385 asm volatile("1: movb $0,%0\n" 412 asm volatile("1: movb $0,%0\n"
@@ -411,11 +438,94 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
411 __static_cpu_has(bit) : \ 438 __static_cpu_has(bit) : \
412 boot_cpu_has(bit) \ 439 boot_cpu_has(bit) \
413) 440)
441
442static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
443{
444#if __GNUC__ > 4 || __GNUC_MINOR__ >= 5
445/*
446 * We need to spell the jumps to the compiler because, depending on the offset,
447 * the replacement jump can be bigger than the original jump, and this we cannot
448 * have. Thus, we force the jump to the widest, 4-byte, signed relative
449 * offset even though the last would often fit in less bytes.
450 */
451 asm goto("1: .byte 0xe9\n .long %l[t_dynamic] - 2f\n"
452 "2:\n"
453 ".section .altinstructions,\"a\"\n"
454 " .long 1b - .\n" /* src offset */
455 " .long 3f - .\n" /* repl offset */
456 " .word %P1\n" /* always replace */
457 " .byte 2b - 1b\n" /* src len */
458 " .byte 4f - 3f\n" /* repl len */
459 ".previous\n"
460 ".section .altinstr_replacement,\"ax\"\n"
461 "3: .byte 0xe9\n .long %l[t_no] - 2b\n"
462 "4:\n"
463 ".previous\n"
464 ".section .altinstructions,\"a\"\n"
465 " .long 1b - .\n" /* src offset */
466 " .long 0\n" /* no replacement */
467 " .word %P0\n" /* feature bit */
468 " .byte 2b - 1b\n" /* src len */
469 " .byte 0\n" /* repl len */
470 ".previous\n"
471 : : "i" (bit), "i" (X86_FEATURE_ALWAYS)
472 : : t_dynamic, t_no);
473 return true;
474 t_no:
475 return false;
476 t_dynamic:
477 return __static_cpu_has_safe(bit);
478#else /* GCC_VERSION >= 40500 */
479 u8 flag;
480 /* Open-coded due to __stringify() in ALTERNATIVE() */
481 asm volatile("1: movb $2,%0\n"
482 "2:\n"
483 ".section .altinstructions,\"a\"\n"
484 " .long 1b - .\n" /* src offset */
485 " .long 3f - .\n" /* repl offset */
486 " .word %P2\n" /* always replace */
487 " .byte 2b - 1b\n" /* source len */
488 " .byte 4f - 3f\n" /* replacement len */
489 ".previous\n"
490 ".section .discard,\"aw\",@progbits\n"
491 " .byte 0xff + (4f-3f) - (2b-1b)\n" /* size check */
492 ".previous\n"
493 ".section .altinstr_replacement,\"ax\"\n"
494 "3: movb $0,%0\n"
495 "4:\n"
496 ".previous\n"
497 ".section .altinstructions,\"a\"\n"
498 " .long 1b - .\n" /* src offset */
499 " .long 5f - .\n" /* repl offset */
500 " .word %P1\n" /* feature bit */
501 " .byte 4b - 3b\n" /* src len */
502 " .byte 6f - 5f\n" /* repl len */
503 ".previous\n"
504 ".section .discard,\"aw\",@progbits\n"
505 " .byte 0xff + (6f-5f) - (4b-3b)\n" /* size check */
506 ".previous\n"
507 ".section .altinstr_replacement,\"ax\"\n"
508 "5: movb $1,%0\n"
509 "6:\n"
510 ".previous\n"
511 : "=qm" (flag)
512 : "i" (bit), "i" (X86_FEATURE_ALWAYS));
513 return (flag == 2 ? __static_cpu_has_safe(bit) : flag);
514#endif
515}
516
517#define static_cpu_has_safe(bit) \
518( \
519 __builtin_constant_p(boot_cpu_has(bit)) ? \
520 boot_cpu_has(bit) : \
521 _static_cpu_has_safe(bit) \
522)
414#else 523#else
415/* 524/*
416 * gcc 3.x is too stupid to do the static test; fall back to dynamic. 525 * gcc 3.x is too stupid to do the static test; fall back to dynamic.
417 */ 526 */
418#define static_cpu_has(bit) boot_cpu_has(bit) 527#define static_cpu_has(bit) boot_cpu_has(bit)
528#define static_cpu_has_safe(bit) boot_cpu_has(bit)
419#endif 529#endif
420 530
421#define cpu_has_bug(c, bit) cpu_has(c, (bit)) 531#define cpu_has_bug(c, bit) cpu_has(c, (bit))
diff --git a/arch/x86/include/asm/crypto/blowfish.h b/arch/x86/include/asm/crypto/blowfish.h
deleted file mode 100644
index f097b2face10..000000000000
--- a/arch/x86/include/asm/crypto/blowfish.h
+++ /dev/null
@@ -1,43 +0,0 @@
1#ifndef ASM_X86_BLOWFISH_H
2#define ASM_X86_BLOWFISH_H
3
4#include <linux/crypto.h>
5#include <crypto/blowfish.h>
6
7#define BF_PARALLEL_BLOCKS 4
8
9/* regular block cipher functions */
10asmlinkage void __blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src,
11 bool xor);
12asmlinkage void blowfish_dec_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src);
13
14/* 4-way parallel cipher functions */
15asmlinkage void __blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
16 const u8 *src, bool xor);
17asmlinkage void blowfish_dec_blk_4way(struct bf_ctx *ctx, u8 *dst,
18 const u8 *src);
19
20static inline void blowfish_enc_blk(struct bf_ctx *ctx, u8 *dst, const u8 *src)
21{
22 __blowfish_enc_blk(ctx, dst, src, false);
23}
24
25static inline void blowfish_enc_blk_xor(struct bf_ctx *ctx, u8 *dst,
26 const u8 *src)
27{
28 __blowfish_enc_blk(ctx, dst, src, true);
29}
30
31static inline void blowfish_enc_blk_4way(struct bf_ctx *ctx, u8 *dst,
32 const u8 *src)
33{
34 __blowfish_enc_blk_4way(ctx, dst, src, false);
35}
36
37static inline void blowfish_enc_blk_xor_4way(struct bf_ctx *ctx, u8 *dst,
38 const u8 *src)
39{
40 __blowfish_enc_blk_4way(ctx, dst, src, true);
41}
42
43#endif
diff --git a/arch/x86/include/asm/crypto/twofish.h b/arch/x86/include/asm/crypto/twofish.h
index e655c6029b45..878c51ceebb5 100644
--- a/arch/x86/include/asm/crypto/twofish.h
+++ b/arch/x86/include/asm/crypto/twofish.h
@@ -28,20 +28,6 @@ asmlinkage void __twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst,
28asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst, 28asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst,
29 const u8 *src); 29 const u8 *src);
30 30
31/* 8-way parallel cipher functions */
32asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst,
33 const u8 *src);
34asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst,
35 const u8 *src);
36asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst,
37 const u8 *src);
38asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst,
39 const u8 *src, le128 *iv);
40asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst,
41 const u8 *src, le128 *iv);
42asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst,
43 const u8 *src, le128 *iv);
44
45/* helpers from twofish_x86_64-3way module */ 31/* helpers from twofish_x86_64-3way module */
46extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src); 32extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src);
47extern void twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src, 33extern void twofish_enc_blk_ctr(void *ctx, u128 *dst, const u128 *src,
@@ -57,8 +43,4 @@ extern void lrw_twofish_exit_tfm(struct crypto_tfm *tfm);
57extern int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key, 43extern int xts_twofish_setkey(struct crypto_tfm *tfm, const u8 *key,
58 unsigned int keylen); 44 unsigned int keylen);
59 45
60/* helpers from twofish-avx module */
61extern void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv);
62extern void twofish_xts_dec(void *ctx, u128 *dst, const u128 *src, le128 *iv);
63
64#endif /* ASM_X86_TWOFISH_H */ 46#endif /* ASM_X86_TWOFISH_H */
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 8bf1c06070d5..b90e5dfeee46 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -36,8 +36,8 @@ static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *in
36 36
37extern struct desc_ptr idt_descr; 37extern struct desc_ptr idt_descr;
38extern gate_desc idt_table[]; 38extern gate_desc idt_table[];
39extern struct desc_ptr nmi_idt_descr; 39extern struct desc_ptr debug_idt_descr;
40extern gate_desc nmi_idt_table[]; 40extern gate_desc debug_idt_table[];
41 41
42struct gdt_page { 42struct gdt_page {
43 struct desc_struct gdt[GDT_ENTRIES]; 43 struct desc_struct gdt[GDT_ENTRIES];
@@ -316,7 +316,20 @@ static inline void set_nmi_gate(int gate, void *addr)
316 gate_desc s; 316 gate_desc s;
317 317
318 pack_gate(&s, GATE_INTERRUPT, (unsigned long)addr, 0, 0, __KERNEL_CS); 318 pack_gate(&s, GATE_INTERRUPT, (unsigned long)addr, 0, 0, __KERNEL_CS);
319 write_idt_entry(nmi_idt_table, gate, &s); 319 write_idt_entry(debug_idt_table, gate, &s);
320}
321#endif
322
323#ifdef CONFIG_TRACING
324extern struct desc_ptr trace_idt_descr;
325extern gate_desc trace_idt_table[];
326static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
327{
328 write_idt_entry(trace_idt_table, entry, gate);
329}
330#else
331static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
332{
320} 333}
321#endif 334#endif
322 335
@@ -331,6 +344,7 @@ static inline void _set_gate(int gate, unsigned type, void *addr,
331 * setup time 344 * setup time
332 */ 345 */
333 write_idt_entry(idt_table, gate, &s); 346 write_idt_entry(idt_table, gate, &s);
347 write_trace_idt_entry(gate, &s);
334} 348}
335 349
336/* 350/*
@@ -360,12 +374,39 @@ static inline void alloc_system_vector(int vector)
360 } 374 }
361} 375}
362 376
363static inline void alloc_intr_gate(unsigned int n, void *addr) 377#ifdef CONFIG_TRACING
378static inline void trace_set_intr_gate(unsigned int gate, void *addr)
379{
380 gate_desc s;
381
382 pack_gate(&s, GATE_INTERRUPT, (unsigned long)addr, 0, 0, __KERNEL_CS);
383 write_idt_entry(trace_idt_table, gate, &s);
384}
385
386static inline void __trace_alloc_intr_gate(unsigned int n, void *addr)
387{
388 trace_set_intr_gate(n, addr);
389}
390#else
391static inline void trace_set_intr_gate(unsigned int gate, void *addr)
392{
393}
394
395#define __trace_alloc_intr_gate(n, addr)
396#endif
397
398static inline void __alloc_intr_gate(unsigned int n, void *addr)
364{ 399{
365 alloc_system_vector(n);
366 set_intr_gate(n, addr); 400 set_intr_gate(n, addr);
367} 401}
368 402
403#define alloc_intr_gate(n, addr) \
404 do { \
405 alloc_system_vector(n); \
406 __alloc_intr_gate(n, addr); \
407 __trace_alloc_intr_gate(n, trace_##addr); \
408 } while (0)
409
369/* 410/*
370 * This routine sets up an interrupt gate at directory privilege level 3. 411 * This routine sets up an interrupt gate at directory privilege level 3.
371 */ 412 */
@@ -405,4 +446,70 @@ static inline void set_system_intr_gate_ist(int n, void *addr, unsigned ist)
405 _set_gate(n, GATE_INTERRUPT, addr, 0x3, ist, __KERNEL_CS); 446 _set_gate(n, GATE_INTERRUPT, addr, 0x3, ist, __KERNEL_CS);
406} 447}
407 448
449#ifdef CONFIG_X86_64
450DECLARE_PER_CPU(u32, debug_idt_ctr);
451static inline bool is_debug_idt_enabled(void)
452{
453 if (this_cpu_read(debug_idt_ctr))
454 return true;
455
456 return false;
457}
458
459static inline void load_debug_idt(void)
460{
461 load_idt((const struct desc_ptr *)&debug_idt_descr);
462}
463#else
464static inline bool is_debug_idt_enabled(void)
465{
466 return false;
467}
468
469static inline void load_debug_idt(void)
470{
471}
472#endif
473
474#ifdef CONFIG_TRACING
475extern atomic_t trace_idt_ctr;
476static inline bool is_trace_idt_enabled(void)
477{
478 if (atomic_read(&trace_idt_ctr))
479 return true;
480
481 return false;
482}
483
484static inline void load_trace_idt(void)
485{
486 load_idt((const struct desc_ptr *)&trace_idt_descr);
487}
488#else
489static inline bool is_trace_idt_enabled(void)
490{
491 return false;
492}
493
494static inline void load_trace_idt(void)
495{
496}
497#endif
498
499/*
500 * The load_current_idt() must be called with interrupts disabled
501 * to avoid races. That way the IDT will always be set back to the expected
502 * descriptor. It's also called when a CPU is being initialized, and
503 * that doesn't need to disable interrupts, as nothing should be
504 * bothering the CPU then.
505 */
506static inline void load_current_idt(void)
507{
508 if (is_debug_idt_enabled())
509 load_debug_idt();
510 else if (is_trace_idt_enabled())
511 load_trace_idt();
512 else
513 load_idt((const struct desc_ptr *)&idt_descr);
514}
408#endif /* _ASM_X86_DESC_H */ 515#endif /* _ASM_X86_DESC_H */
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 2fb5d5884e23..0062a0125041 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -52,40 +52,40 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
52 u64 arg4, u64 arg5, u64 arg6); 52 u64 arg4, u64 arg5, u64 arg6);
53 53
54#define efi_call_phys0(f) \ 54#define efi_call_phys0(f) \
55 efi_call0((void *)(f)) 55 efi_call0((f))
56#define efi_call_phys1(f, a1) \ 56#define efi_call_phys1(f, a1) \
57 efi_call1((void *)(f), (u64)(a1)) 57 efi_call1((f), (u64)(a1))
58#define efi_call_phys2(f, a1, a2) \ 58#define efi_call_phys2(f, a1, a2) \
59 efi_call2((void *)(f), (u64)(a1), (u64)(a2)) 59 efi_call2((f), (u64)(a1), (u64)(a2))
60#define efi_call_phys3(f, a1, a2, a3) \ 60#define efi_call_phys3(f, a1, a2, a3) \
61 efi_call3((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3)) 61 efi_call3((f), (u64)(a1), (u64)(a2), (u64)(a3))
62#define efi_call_phys4(f, a1, a2, a3, a4) \ 62#define efi_call_phys4(f, a1, a2, a3, a4) \
63 efi_call4((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ 63 efi_call4((f), (u64)(a1), (u64)(a2), (u64)(a3), \
64 (u64)(a4)) 64 (u64)(a4))
65#define efi_call_phys5(f, a1, a2, a3, a4, a5) \ 65#define efi_call_phys5(f, a1, a2, a3, a4, a5) \
66 efi_call5((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ 66 efi_call5((f), (u64)(a1), (u64)(a2), (u64)(a3), \
67 (u64)(a4), (u64)(a5)) 67 (u64)(a4), (u64)(a5))
68#define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \ 68#define efi_call_phys6(f, a1, a2, a3, a4, a5, a6) \
69 efi_call6((void *)(f), (u64)(a1), (u64)(a2), (u64)(a3), \ 69 efi_call6((f), (u64)(a1), (u64)(a2), (u64)(a3), \
70 (u64)(a4), (u64)(a5), (u64)(a6)) 70 (u64)(a4), (u64)(a5), (u64)(a6))
71 71
72#define efi_call_virt0(f) \ 72#define efi_call_virt0(f) \
73 efi_call0((void *)(efi.systab->runtime->f)) 73 efi_call0((efi.systab->runtime->f))
74#define efi_call_virt1(f, a1) \ 74#define efi_call_virt1(f, a1) \
75 efi_call1((void *)(efi.systab->runtime->f), (u64)(a1)) 75 efi_call1((efi.systab->runtime->f), (u64)(a1))
76#define efi_call_virt2(f, a1, a2) \ 76#define efi_call_virt2(f, a1, a2) \
77 efi_call2((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2)) 77 efi_call2((efi.systab->runtime->f), (u64)(a1), (u64)(a2))
78#define efi_call_virt3(f, a1, a2, a3) \ 78#define efi_call_virt3(f, a1, a2, a3) \
79 efi_call3((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 79 efi_call3((efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
80 (u64)(a3)) 80 (u64)(a3))
81#define efi_call_virt4(f, a1, a2, a3, a4) \ 81#define efi_call_virt4(f, a1, a2, a3, a4) \
82 efi_call4((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 82 efi_call4((efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
83 (u64)(a3), (u64)(a4)) 83 (u64)(a3), (u64)(a4))
84#define efi_call_virt5(f, a1, a2, a3, a4, a5) \ 84#define efi_call_virt5(f, a1, a2, a3, a4, a5) \
85 efi_call5((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 85 efi_call5((efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
86 (u64)(a3), (u64)(a4), (u64)(a5)) 86 (u64)(a3), (u64)(a4), (u64)(a5))
87#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ 87#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
88 efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ 88 efi_call6((efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
89 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) 89 (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
90 90
91extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, 91extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
@@ -102,13 +102,6 @@ extern void efi_call_phys_epilog(void);
102extern void efi_unmap_memmap(void); 102extern void efi_unmap_memmap(void);
103extern void efi_memory_uc(u64 addr, unsigned long size); 103extern void efi_memory_uc(u64 addr, unsigned long size);
104 104
105struct efi_var_bootdata {
106 struct setup_data data;
107 u64 store_size;
108 u64 remaining_size;
109 u64 max_var_size;
110};
111
112#ifdef CONFIG_EFI 105#ifdef CONFIG_EFI
113 106
114static inline bool efi_is_native(void) 107static inline bool efi_is_native(void)
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index 9bd4ecac72be..dc5fa661465f 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -13,14 +13,16 @@
13BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR) 13BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
14BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR) 14BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
15BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) 15BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
16BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) 16BUILD_INTERRUPT3(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR,
17BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR) 17 smp_irq_move_cleanup_interrupt)
18BUILD_INTERRUPT3(reboot_interrupt, REBOOT_VECTOR, smp_reboot_interrupt)
18#endif 19#endif
19 20
20BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR) 21BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR)
21 22
22#ifdef CONFIG_HAVE_KVM 23#ifdef CONFIG_HAVE_KVM
23BUILD_INTERRUPT(kvm_posted_intr_ipi, POSTED_INTR_VECTOR) 24BUILD_INTERRUPT3(kvm_posted_intr_ipi, POSTED_INTR_VECTOR,
25 smp_kvm_posted_intr_ipi)
24#endif 26#endif
25 27
26/* 28/*
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index 0dc7d9e21c34..e846225265ed 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -81,11 +81,11 @@ enum fixed_addresses {
81 + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1, 81 + ((VSYSCALL_END-VSYSCALL_START) >> PAGE_SHIFT) - 1,
82 VVAR_PAGE, 82 VVAR_PAGE,
83 VSYSCALL_HPET, 83 VSYSCALL_HPET,
84#endif
85#ifdef CONFIG_PARAVIRT_CLOCK 84#ifdef CONFIG_PARAVIRT_CLOCK
86 PVCLOCK_FIXMAP_BEGIN, 85 PVCLOCK_FIXMAP_BEGIN,
87 PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1, 86 PVCLOCK_FIXMAP_END = PVCLOCK_FIXMAP_BEGIN+PVCLOCK_VSYSCALL_NR_PAGES-1,
88#endif 87#endif
88#endif
89 FIX_DBGP_BASE, 89 FIX_DBGP_BASE,
90 FIX_EARLYCON_MEM_BASE, 90 FIX_EARLYCON_MEM_BASE,
91#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT 91#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
index e25cc33ec54d..4d0bda7b11e3 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
@@ -62,10 +62,8 @@ extern user_regset_set_fn fpregs_set, xfpregs_set, fpregs_soft_set,
62#define xstateregs_active fpregs_active 62#define xstateregs_active fpregs_active
63 63
64#ifdef CONFIG_MATH_EMULATION 64#ifdef CONFIG_MATH_EMULATION
65# define HAVE_HWFP (boot_cpu_data.hard_math)
66extern void finit_soft_fpu(struct i387_soft_struct *soft); 65extern void finit_soft_fpu(struct i387_soft_struct *soft);
67#else 66#else
68# define HAVE_HWFP 1
69static inline void finit_soft_fpu(struct i387_soft_struct *soft) {} 67static inline void finit_soft_fpu(struct i387_soft_struct *soft) {}
70#endif 68#endif
71 69
@@ -345,7 +343,7 @@ static inline void __thread_fpu_end(struct task_struct *tsk)
345 343
346static inline void __thread_fpu_begin(struct task_struct *tsk) 344static inline void __thread_fpu_begin(struct task_struct *tsk)
347{ 345{
348 if (!use_eager_fpu()) 346 if (!static_cpu_has_safe(X86_FEATURE_EAGER_FPU))
349 clts(); 347 clts();
350 __thread_set_has_fpu(tsk); 348 __thread_set_has_fpu(tsk);
351} 349}
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 1da97efad08a..e4ac559c4a24 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -77,6 +77,23 @@ extern void threshold_interrupt(void);
77extern void call_function_interrupt(void); 77extern void call_function_interrupt(void);
78extern void call_function_single_interrupt(void); 78extern void call_function_single_interrupt(void);
79 79
80#ifdef CONFIG_TRACING
81/* Interrupt handlers registered during init_IRQ */
82extern void trace_apic_timer_interrupt(void);
83extern void trace_x86_platform_ipi(void);
84extern void trace_error_interrupt(void);
85extern void trace_irq_work_interrupt(void);
86extern void trace_spurious_interrupt(void);
87extern void trace_thermal_interrupt(void);
88extern void trace_reschedule_interrupt(void);
89extern void trace_threshold_interrupt(void);
90extern void trace_call_function_interrupt(void);
91extern void trace_call_function_single_interrupt(void);
92#define trace_irq_move_cleanup_interrupt irq_move_cleanup_interrupt
93#define trace_reboot_interrupt reboot_interrupt
94#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
95#endif /* CONFIG_TRACING */
96
80/* IOAPIC */ 97/* IOAPIC */
81#define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs)) 98#define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs))
82extern unsigned long io_apic_irqs; 99extern unsigned long io_apic_irqs;
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index ba870bb6dd8e..57873beb3292 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -41,4 +41,9 @@ extern int vector_used_by_percpu_irq(unsigned int vector);
41 41
42extern void init_ISA_irqs(void); 42extern void init_ISA_irqs(void);
43 43
44#ifdef CONFIG_X86_LOCAL_APIC
45void arch_trigger_all_cpu_backtrace(void);
46#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
47#endif
48
44#endif /* _ASM_X86_IRQ_H */ 49#endif /* _ASM_X86_IRQ_H */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 3741c653767c..f87f7fcefa0a 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -59,7 +59,7 @@
59 (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\ 59 (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\
60 | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ 60 | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \
61 | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \ 61 | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \
62 | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_RDWRGSFS \ 62 | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \
63 | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) 63 | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE))
64 64
65#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) 65#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
@@ -222,14 +222,22 @@ struct kvm_mmu_page {
222 int root_count; /* Currently serving as active root */ 222 int root_count; /* Currently serving as active root */
223 unsigned int unsync_children; 223 unsigned int unsync_children;
224 unsigned long parent_ptes; /* Reverse mapping for parent_pte */ 224 unsigned long parent_ptes; /* Reverse mapping for parent_pte */
225
226 /* The page is obsolete if mmu_valid_gen != kvm->arch.mmu_valid_gen. */
227 unsigned long mmu_valid_gen;
228
225 DECLARE_BITMAP(unsync_child_bitmap, 512); 229 DECLARE_BITMAP(unsync_child_bitmap, 512);
226 230
227#ifdef CONFIG_X86_32 231#ifdef CONFIG_X86_32
232 /*
233 * Used out of the mmu-lock to avoid reading spte values while an
234 * update is in progress; see the comments in __get_spte_lockless().
235 */
228 int clear_spte_count; 236 int clear_spte_count;
229#endif 237#endif
230 238
239 /* Number of writes since the last time traversal visited this page. */
231 int write_flooding_count; 240 int write_flooding_count;
232 bool mmio_cached;
233}; 241};
234 242
235struct kvm_pio_request { 243struct kvm_pio_request {
@@ -529,11 +537,14 @@ struct kvm_arch {
529 unsigned int n_requested_mmu_pages; 537 unsigned int n_requested_mmu_pages;
530 unsigned int n_max_mmu_pages; 538 unsigned int n_max_mmu_pages;
531 unsigned int indirect_shadow_pages; 539 unsigned int indirect_shadow_pages;
540 unsigned long mmu_valid_gen;
532 struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; 541 struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
533 /* 542 /*
534 * Hash table of struct kvm_mmu_page. 543 * Hash table of struct kvm_mmu_page.
535 */ 544 */
536 struct list_head active_mmu_pages; 545 struct list_head active_mmu_pages;
546 struct list_head zapped_obsolete_pages;
547
537 struct list_head assigned_dev_head; 548 struct list_head assigned_dev_head;
538 struct iommu_domain *iommu_domain; 549 struct iommu_domain *iommu_domain;
539 int iommu_flags; 550 int iommu_flags;
@@ -769,7 +780,7 @@ void kvm_mmu_write_protect_pt_masked(struct kvm *kvm,
769 struct kvm_memory_slot *slot, 780 struct kvm_memory_slot *slot,
770 gfn_t gfn_offset, unsigned long mask); 781 gfn_t gfn_offset, unsigned long mask);
771void kvm_mmu_zap_all(struct kvm *kvm); 782void kvm_mmu_zap_all(struct kvm *kvm);
772void kvm_mmu_zap_mmio_sptes(struct kvm *kvm); 783void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm);
773unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm); 784unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm);
774void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); 785void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages);
775 786
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index fa5f71e021d5..6b52980c29c1 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -61,7 +61,7 @@
61#define MCJ_CTX_IRQ 0x2 /* inject context: IRQ */ 61#define MCJ_CTX_IRQ 0x2 /* inject context: IRQ */
62#define MCJ_NMI_BROADCAST 0x4 /* do NMI broadcasting */ 62#define MCJ_NMI_BROADCAST 0x4 /* do NMI broadcasting */
63#define MCJ_EXCEPTION 0x8 /* raise as exception */ 63#define MCJ_EXCEPTION 0x8 /* raise as exception */
64#define MCJ_IRQ_BRAODCAST 0x10 /* do IRQ broadcasting */ 64#define MCJ_IRQ_BROADCAST 0x10 /* do IRQ broadcasting */
65 65
66#define MCE_OVERFLOW 0 /* bit 0 in flags means overflow */ 66#define MCE_OVERFLOW 0 /* bit 0 in flags means overflow */
67 67
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 6825e2efd1b4..6bc3985ee473 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
60#ifdef CONFIG_MICROCODE_EARLY 60#ifdef CONFIG_MICROCODE_EARLY
61#define MAX_UCODE_COUNT 128 61#define MAX_UCODE_COUNT 128
62extern void __init load_ucode_bsp(void); 62extern void __init load_ucode_bsp(void);
63extern __init void load_ucode_ap(void); 63extern void __cpuinit load_ucode_ap(void);
64extern int __init save_microcode_in_initrd(void); 64extern int __init save_microcode_in_initrd(void);
65#else 65#else
66static inline void __init load_ucode_bsp(void) {} 66static inline void __init load_ucode_bsp(void) {}
67static inline __init void load_ucode_ap(void) {} 67static inline void __cpuinit load_ucode_ap(void) {}
68static inline int __init save_microcode_in_initrd(void) 68static inline int __init save_microcode_in_initrd(void)
69{ 69{
70 return 0; 70 return 0;
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
new file mode 100644
index 000000000000..c6b043f40271
--- /dev/null
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -0,0 +1,78 @@
1#ifndef _ASM_X86_MICROCODE_AMD_H
2#define _ASM_X86_MICROCODE_AMD_H
3
4#include <asm/microcode.h>
5
6#define UCODE_MAGIC 0x00414d44
7#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
8#define UCODE_UCODE_TYPE 0x00000001
9
10#define SECTION_HDR_SIZE 8
11#define CONTAINER_HDR_SZ 12
12
13struct equiv_cpu_entry {
14 u32 installed_cpu;
15 u32 fixed_errata_mask;
16 u32 fixed_errata_compare;
17 u16 equiv_cpu;
18 u16 res;
19} __attribute__((packed));
20
21struct microcode_header_amd {
22 u32 data_code;
23 u32 patch_id;
24 u16 mc_patch_data_id;
25 u8 mc_patch_data_len;
26 u8 init_flag;
27 u32 mc_patch_data_checksum;
28 u32 nb_dev_id;
29 u32 sb_dev_id;
30 u16 processor_rev_id;
31 u8 nb_rev_id;
32 u8 sb_rev_id;
33 u8 bios_api_rev;
34 u8 reserved1[3];
35 u32 match_reg[8];
36} __attribute__((packed));
37
38struct microcode_amd {
39 struct microcode_header_amd hdr;
40 unsigned int mpb[0];
41};
42
43static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table,
44 unsigned int sig)
45{
46 int i = 0;
47
48 if (!equiv_cpu_table)
49 return 0;
50
51 while (equiv_cpu_table[i].installed_cpu != 0) {
52 if (sig == equiv_cpu_table[i].installed_cpu)
53 return equiv_cpu_table[i].equiv_cpu;
54
55 i++;
56 }
57 return 0;
58}
59
60extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
61extern int apply_microcode_amd(int cpu);
62extern enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size);
63
64#ifdef CONFIG_MICROCODE_AMD_EARLY
65#ifdef CONFIG_X86_32
66#define MPB_MAX_SIZE PAGE_SIZE
67extern u8 amd_bsp_mpb[MPB_MAX_SIZE];
68#endif
69extern void __init load_ucode_amd_bsp(void);
70extern void __cpuinit load_ucode_amd_ap(void);
71extern int __init save_microcode_in_initrd_amd(void);
72#else
73static inline void __init load_ucode_amd_bsp(void) {}
74static inline void __cpuinit load_ucode_amd_ap(void) {}
75static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; }
76#endif
77
78#endif /* _ASM_X86_MICROCODE_AMD_H */
diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h
index 5356f927d411..87a085333cbf 100644
--- a/arch/x86/include/asm/microcode_intel.h
+++ b/arch/x86/include/asm/microcode_intel.h
@@ -67,10 +67,12 @@ update_match_revision(struct microcode_header_intel *mc_header, int rev);
67extern void __init load_ucode_intel_bsp(void); 67extern void __init load_ucode_intel_bsp(void);
68extern void __cpuinit load_ucode_intel_ap(void); 68extern void __cpuinit load_ucode_intel_ap(void);
69extern void show_ucode_info_early(void); 69extern void show_ucode_info_early(void);
70extern int __init save_microcode_in_initrd_intel(void);
70#else 71#else
71static inline __init void load_ucode_intel_bsp(void) {} 72static inline __init void load_ucode_intel_bsp(void) {}
72static inline __cpuinit void load_ucode_intel_ap(void) {} 73static inline __cpuinit void load_ucode_intel_ap(void) {}
73static inline void show_ucode_info_early(void) {} 74static inline void show_ucode_info_early(void) {}
75static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; }
74#endif 76#endif
75 77
76#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU) 78#if defined(CONFIG_MICROCODE_INTEL_EARLY) && defined(CONFIG_HOTPLUG_CPU)
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index c2934be2446a..cd9c41938b8a 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -12,6 +12,9 @@ struct ms_hyperv_info {
12extern struct ms_hyperv_info ms_hyperv; 12extern struct ms_hyperv_info ms_hyperv;
13 13
14void hyperv_callback_vector(void); 14void hyperv_callback_vector(void);
15#ifdef CONFIG_TRACING
16#define trace_hyperv_callback_vector hyperv_callback_vector
17#endif
15void hyperv_vector_handler(struct pt_regs *regs); 18void hyperv_vector_handler(struct pt_regs *regs);
16void hv_register_vmbus_handler(int irq, irq_handler_t handler); 19void hv_register_vmbus_handler(int irq, irq_handler_t handler);
17 20
diff --git a/arch/x86/include/asm/mutex_32.h b/arch/x86/include/asm/mutex_32.h
index 03f90c8a5a7c..0208c3c2cbc6 100644
--- a/arch/x86/include/asm/mutex_32.h
+++ b/arch/x86/include/asm/mutex_32.h
@@ -42,17 +42,14 @@ do { \
42 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 42 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
43 * from 1 to a 0 value 43 * from 1 to a 0 value
44 * @count: pointer of type atomic_t 44 * @count: pointer of type atomic_t
45 * @fail_fn: function to call if the original value was not 1
46 * 45 *
47 * Change the count from 1 to a value lower than 1, and call <fail_fn> if it 46 * Change the count from 1 to a value lower than 1. This function returns 0
48 * wasn't 1 originally. This function returns 0 if the fastpath succeeds, 47 * if the fastpath succeeds, or -1 otherwise.
49 * or anything the slow path function returns
50 */ 48 */
51static inline int __mutex_fastpath_lock_retval(atomic_t *count, 49static inline int __mutex_fastpath_lock_retval(atomic_t *count)
52 int (*fail_fn)(atomic_t *))
53{ 50{
54 if (unlikely(atomic_dec_return(count) < 0)) 51 if (unlikely(atomic_dec_return(count) < 0))
55 return fail_fn(count); 52 return -1;
56 else 53 else
57 return 0; 54 return 0;
58} 55}
diff --git a/arch/x86/include/asm/mutex_64.h b/arch/x86/include/asm/mutex_64.h
index 68a87b0f8e29..2c543fff241b 100644
--- a/arch/x86/include/asm/mutex_64.h
+++ b/arch/x86/include/asm/mutex_64.h
@@ -37,17 +37,14 @@ do { \
37 * __mutex_fastpath_lock_retval - try to take the lock by moving the count 37 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
38 * from 1 to a 0 value 38 * from 1 to a 0 value
39 * @count: pointer of type atomic_t 39 * @count: pointer of type atomic_t
40 * @fail_fn: function to call if the original value was not 1
41 * 40 *
42 * Change the count from 1 to a value lower than 1, and call <fail_fn> if 41 * Change the count from 1 to a value lower than 1. This function returns 0
43 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds, 42 * if the fastpath succeeds, or -1 otherwise.
44 * or anything the slow path function returns
45 */ 43 */
46static inline int __mutex_fastpath_lock_retval(atomic_t *count, 44static inline int __mutex_fastpath_lock_retval(atomic_t *count)
47 int (*fail_fn)(atomic_t *))
48{ 45{
49 if (unlikely(atomic_dec_return(count) < 0)) 46 if (unlikely(atomic_dec_return(count) < 0))
50 return fail_fn(count); 47 return -1;
51 else 48 else
52 return 0; 49 return 0;
53} 50}
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index c0fa356e90de..86f9301903c8 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -18,9 +18,7 @@ extern int proc_nmi_enabled(struct ctl_table *, int ,
18 void __user *, size_t *, loff_t *); 18 void __user *, size_t *, loff_t *);
19extern int unknown_nmi_panic; 19extern int unknown_nmi_panic;
20 20
21void arch_trigger_all_cpu_backtrace(void); 21#endif /* CONFIG_X86_LOCAL_APIC */
22#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
23#endif
24 22
25#define NMI_FLAG_FIRST 1 23#define NMI_FLAG_FIRST 1
26 24
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 57cb63402213..8249df45d2f2 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -29,6 +29,9 @@
29#define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23) 29#define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23)
30#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL 30#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL
31 31
32#define HSW_IN_TX (1ULL << 32)
33#define HSW_IN_TX_CHECKPOINTED (1ULL << 33)
34
32#define AMD64_EVENTSEL_INT_CORE_ENABLE (1ULL << 36) 35#define AMD64_EVENTSEL_INT_CORE_ENABLE (1ULL << 36)
33#define AMD64_EVENTSEL_GUESTONLY (1ULL << 40) 36#define AMD64_EVENTSEL_GUESTONLY (1ULL << 40)
34#define AMD64_EVENTSEL_HOSTONLY (1ULL << 41) 37#define AMD64_EVENTSEL_HOSTONLY (1ULL << 41)
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 1e672234c4ff..7dc305a46058 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -207,7 +207,7 @@ static inline pte_t pte_mkexec(pte_t pte)
207 207
208static inline pte_t pte_mkdirty(pte_t pte) 208static inline pte_t pte_mkdirty(pte_t pte)
209{ 209{
210 return pte_set_flags(pte, _PAGE_DIRTY); 210 return pte_set_flags(pte, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
211} 211}
212 212
213static inline pte_t pte_mkyoung(pte_t pte) 213static inline pte_t pte_mkyoung(pte_t pte)
@@ -271,7 +271,7 @@ static inline pmd_t pmd_wrprotect(pmd_t pmd)
271 271
272static inline pmd_t pmd_mkdirty(pmd_t pmd) 272static inline pmd_t pmd_mkdirty(pmd_t pmd)
273{ 273{
274 return pmd_set_flags(pmd, _PAGE_DIRTY); 274 return pmd_set_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
275} 275}
276 276
277static inline pmd_t pmd_mkhuge(pmd_t pmd) 277static inline pmd_t pmd_mkhuge(pmd_t pmd)
@@ -294,6 +294,26 @@ static inline pmd_t pmd_mknotpresent(pmd_t pmd)
294 return pmd_clear_flags(pmd, _PAGE_PRESENT); 294 return pmd_clear_flags(pmd, _PAGE_PRESENT);
295} 295}
296 296
297static inline int pte_soft_dirty(pte_t pte)
298{
299 return pte_flags(pte) & _PAGE_SOFT_DIRTY;
300}
301
302static inline int pmd_soft_dirty(pmd_t pmd)
303{
304 return pmd_flags(pmd) & _PAGE_SOFT_DIRTY;
305}
306
307static inline pte_t pte_mksoft_dirty(pte_t pte)
308{
309 return pte_set_flags(pte, _PAGE_SOFT_DIRTY);
310}
311
312static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
313{
314 return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
315}
316
297/* 317/*
298 * Mask out unsupported bits in a present pgprot. Non-present pgprots 318 * Mask out unsupported bits in a present pgprot. Non-present pgprots
299 * can use those bits for other purposes, so leave them be. 319 * can use those bits for other purposes, so leave them be.
@@ -506,9 +526,6 @@ static inline unsigned long pages_to_mb(unsigned long npg)
506 return npg >> (20 - PAGE_SHIFT); 526 return npg >> (20 - PAGE_SHIFT);
507} 527}
508 528
509#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
510 remap_pfn_range(vma, vaddr, pfn, size, prot)
511
512#if PAGETABLE_LEVELS > 2 529#if PAGETABLE_LEVELS > 2
513static inline int pud_none(pud_t pud) 530static inline int pud_none(pud_t pud)
514{ 531{
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index e6423002c10b..c98ac63aae48 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -55,6 +55,18 @@
55#define _PAGE_HIDDEN (_AT(pteval_t, 0)) 55#define _PAGE_HIDDEN (_AT(pteval_t, 0))
56#endif 56#endif
57 57
58/*
59 * The same hidden bit is used by kmemcheck, but since kmemcheck
60 * works on kernel pages while soft-dirty engine on user space,
61 * they do not conflict with each other.
62 */
63
64#ifdef CONFIG_MEM_SOFT_DIRTY
65#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN)
66#else
67#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 0))
68#endif
69
58#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 70#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
59#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) 71#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
60#else 72#else
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 22224b3b43bb..29937c4f6ff8 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -89,9 +89,9 @@ struct cpuinfo_x86 {
89 char wp_works_ok; /* It doesn't on 386's */ 89 char wp_works_ok; /* It doesn't on 386's */
90 90
91 /* Problems on some 486Dx4's and old 386's: */ 91 /* Problems on some 486Dx4's and old 386's: */
92 char hard_math;
93 char rfu; 92 char rfu;
94 char pad0; 93 char pad0;
94 char pad1;
95#else 95#else
96 /* Number of 4K pages in DTLB/ITLB combined(in pages): */ 96 /* Number of 4K pages in DTLB/ITLB combined(in pages): */
97 int x86_tlbsize; 97 int x86_tlbsize;
@@ -164,6 +164,7 @@ extern const struct seq_operations cpuinfo_op;
164#define cache_line_size() (boot_cpu_data.x86_cache_alignment) 164#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
165 165
166extern void cpu_detect(struct cpuinfo_x86 *c); 166extern void cpu_detect(struct cpuinfo_x86 *c);
167extern void __cpuinit fpu_detect(struct cpuinfo_x86 *c);
167 168
168extern void early_cpu_init(void); 169extern void early_cpu_init(void);
169extern void identify_boot_cpu(void); 170extern void identify_boot_cpu(void);
@@ -981,5 +982,5 @@ bool xen_set_default_idle(void);
981#endif 982#endif
982 983
983void stop_this_cpu(void *dummy); 984void stop_this_cpu(void *dummy);
984 985void df_debug(struct pt_regs *regs, long error_code);
985#endif /* _ASM_X86_PROCESSOR_H */ 986#endif /* _ASM_X86_PROCESSOR_H */
diff --git a/arch/x86/include/asm/sighandling.h b/arch/x86/include/asm/sighandling.h
index beff97f7df37..7a958164088c 100644
--- a/arch/x86/include/asm/sighandling.h
+++ b/arch/x86/include/asm/sighandling.h
@@ -7,10 +7,10 @@
7 7
8#include <asm/processor-flags.h> 8#include <asm/processor-flags.h>
9 9
10#define __FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \ 10#define FIX_EFLAGS (X86_EFLAGS_AC | X86_EFLAGS_OF | \
11 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \ 11 X86_EFLAGS_DF | X86_EFLAGS_TF | X86_EFLAGS_SF | \
12 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \ 12 X86_EFLAGS_ZF | X86_EFLAGS_AF | X86_EFLAGS_PF | \
13 X86_EFLAGS_CF) 13 X86_EFLAGS_CF | X86_EFLAGS_RF)
14 14
15void signal_fault(struct pt_regs *regs, void __user *frame, char *where); 15void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
16 16
diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index 41fc93a2e225..2f4d924fe6c9 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -16,7 +16,7 @@ static inline void native_clts(void)
16 * all loads stores around it, which can hurt performance. Solution is to 16 * all loads stores around it, which can hurt performance. Solution is to
17 * use a variable and mimic reads and writes to it to enforce serialization 17 * use a variable and mimic reads and writes to it to enforce serialization
18 */ 18 */
19static unsigned long __force_order; 19extern unsigned long __force_order;
20 20
21static inline unsigned long native_read_cr0(void) 21static inline unsigned long native_read_cr0(void)
22{ 22{
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index a1df6e84691f..27811190cbd7 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -89,7 +89,6 @@ struct thread_info {
89#define TIF_FORK 18 /* ret_from_fork */ 89#define TIF_FORK 18 /* ret_from_fork */
90#define TIF_NOHZ 19 /* in adaptive nohz mode */ 90#define TIF_NOHZ 19 /* in adaptive nohz mode */
91#define TIF_MEMDIE 20 /* is terminating due to OOM killer */ 91#define TIF_MEMDIE 20 /* is terminating due to OOM killer */
92#define TIF_DEBUG 21 /* uses debug registers */
93#define TIF_IO_BITMAP 22 /* uses I/O bitmap */ 92#define TIF_IO_BITMAP 22 /* uses I/O bitmap */
94#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */ 93#define TIF_FORCED_TF 24 /* true if TF in eflags artificially */
95#define TIF_BLOCKSTEP 25 /* set when we want DEBUGCTLMSR_BTF */ 94#define TIF_BLOCKSTEP 25 /* set when we want DEBUGCTLMSR_BTF */
@@ -113,7 +112,6 @@ struct thread_info {
113#define _TIF_IA32 (1 << TIF_IA32) 112#define _TIF_IA32 (1 << TIF_IA32)
114#define _TIF_FORK (1 << TIF_FORK) 113#define _TIF_FORK (1 << TIF_FORK)
115#define _TIF_NOHZ (1 << TIF_NOHZ) 114#define _TIF_NOHZ (1 << TIF_NOHZ)
116#define _TIF_DEBUG (1 << TIF_DEBUG)
117#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) 115#define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
118#define _TIF_FORCED_TF (1 << TIF_FORCED_TF) 116#define _TIF_FORCED_TF (1 << TIF_FORCED_TF)
119#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) 117#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
@@ -154,7 +152,7 @@ struct thread_info {
154 (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP) 152 (_TIF_IO_BITMAP|_TIF_NOTSC|_TIF_BLOCKSTEP)
155 153
156#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) 154#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
157#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW|_TIF_DEBUG) 155#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)
158 156
159#define PREEMPT_ACTIVE 0x10000000 157#define PREEMPT_ACTIVE 0x10000000
160 158
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 50a7fc0f824a..cf512003e663 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -62,7 +62,7 @@ static inline void __flush_tlb_all(void)
62 62
63static inline void __flush_tlb_one(unsigned long addr) 63static inline void __flush_tlb_one(unsigned long addr)
64{ 64{
65 __flush_tlb_single(addr); 65 __flush_tlb_single(addr);
66} 66}
67 67
68#define TLB_FLUSH_ALL -1UL 68#define TLB_FLUSH_ALL -1UL
diff --git a/arch/x86/include/asm/trace/irq_vectors.h b/arch/x86/include/asm/trace/irq_vectors.h
new file mode 100644
index 000000000000..2874df24e7a4
--- /dev/null
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -0,0 +1,104 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM irq_vectors
3
4#if !defined(_TRACE_IRQ_VECTORS_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_IRQ_VECTORS_H
6
7#include <linux/tracepoint.h>
8
9extern void trace_irq_vector_regfunc(void);
10extern void trace_irq_vector_unregfunc(void);
11
12DECLARE_EVENT_CLASS(x86_irq_vector,
13
14 TP_PROTO(int vector),
15
16 TP_ARGS(vector),
17
18 TP_STRUCT__entry(
19 __field( int, vector )
20 ),
21
22 TP_fast_assign(
23 __entry->vector = vector;
24 ),
25
26 TP_printk("vector=%d", __entry->vector) );
27
28#define DEFINE_IRQ_VECTOR_EVENT(name) \
29DEFINE_EVENT_FN(x86_irq_vector, name##_entry, \
30 TP_PROTO(int vector), \
31 TP_ARGS(vector), \
32 trace_irq_vector_regfunc, \
33 trace_irq_vector_unregfunc); \
34DEFINE_EVENT_FN(x86_irq_vector, name##_exit, \
35 TP_PROTO(int vector), \
36 TP_ARGS(vector), \
37 trace_irq_vector_regfunc, \
38 trace_irq_vector_unregfunc);
39
40
41/*
42 * local_timer - called when entering/exiting a local timer interrupt
43 * vector handler
44 */
45DEFINE_IRQ_VECTOR_EVENT(local_timer);
46
47/*
48 * reschedule - called when entering/exiting a reschedule vector handler
49 */
50DEFINE_IRQ_VECTOR_EVENT(reschedule);
51
52/*
53 * spurious_apic - called when entering/exiting a spurious apic vector handler
54 */
55DEFINE_IRQ_VECTOR_EVENT(spurious_apic);
56
57/*
58 * error_apic - called when entering/exiting an error apic vector handler
59 */
60DEFINE_IRQ_VECTOR_EVENT(error_apic);
61
62/*
63 * x86_platform_ipi - called when entering/exiting a x86 platform ipi interrupt
64 * vector handler
65 */
66DEFINE_IRQ_VECTOR_EVENT(x86_platform_ipi);
67
68/*
69 * irq_work - called when entering/exiting a irq work interrupt
70 * vector handler
71 */
72DEFINE_IRQ_VECTOR_EVENT(irq_work);
73
74/*
75 * call_function - called when entering/exiting a call function interrupt
76 * vector handler
77 */
78DEFINE_IRQ_VECTOR_EVENT(call_function);
79
80/*
81 * call_function_single - called when entering/exiting a call function
82 * single interrupt vector handler
83 */
84DEFINE_IRQ_VECTOR_EVENT(call_function_single);
85
86/*
87 * threshold_apic - called when entering/exiting a threshold apic interrupt
88 * vector handler
89 */
90DEFINE_IRQ_VECTOR_EVENT(threshold_apic);
91
92/*
93 * thermal_apic - called when entering/exiting a thermal apic interrupt
94 * vector handler
95 */
96DEFINE_IRQ_VECTOR_EVENT(thermal_apic);
97
98#undef TRACE_INCLUDE_PATH
99#define TRACE_INCLUDE_PATH .
100#define TRACE_INCLUDE_FILE irq_vectors
101#endif /* _TRACE_IRQ_VECTORS_H */
102
103/* This part must be outside protection */
104#include <trace/define_trace.h>
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 142810c457dc..4f7923dd0007 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -235,7 +235,7 @@ extern long __copy_user_nocache(void *dst, const void __user *src,
235static inline int 235static inline int
236__copy_from_user_nocache(void *dst, const void __user *src, unsigned size) 236__copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
237{ 237{
238 might_sleep(); 238 might_fault();
239 return __copy_user_nocache(dst, src, size, 1); 239 return __copy_user_nocache(dst, src, size, 1);
240} 240}
241 241
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index a06983cdc125..0b46ef261c77 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -731,6 +731,9 @@ static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits)
731} 731}
732 732
733extern void uv_bau_message_intr1(void); 733extern void uv_bau_message_intr1(void);
734#ifdef CONFIG_TRACING
735#define trace_uv_bau_message_intr1 uv_bau_message_intr1
736#endif
734extern void uv_bau_timeout_intr1(void); 737extern void uv_bau_timeout_intr1(void);
735 738
736struct atomic_short { 739struct atomic_short {
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
index 08744242b8d2..c15ddaf90710 100644
--- a/arch/x86/include/uapi/asm/bootparam.h
+++ b/arch/x86/include/uapi/asm/bootparam.h
@@ -6,7 +6,6 @@
6#define SETUP_E820_EXT 1 6#define SETUP_E820_EXT 1
7#define SETUP_DTB 2 7#define SETUP_DTB 2
8#define SETUP_PCI 3 8#define SETUP_PCI 3
9#define SETUP_EFI_VARS 4
10 9
11/* ram_size flags */ 10/* ram_size flags */
12#define RAMDISK_IMAGE_START_MASK 0x07FF 11#define RAMDISK_IMAGE_START_MASK 0x07FF
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index 2af848dfa754..bb0465090ae5 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -170,6 +170,9 @@
170#define MSR_KNC_EVNTSEL0 0x00000028 170#define MSR_KNC_EVNTSEL0 0x00000028
171#define MSR_KNC_EVNTSEL1 0x00000029 171#define MSR_KNC_EVNTSEL1 0x00000029
172 172
173/* Alternative perfctr range with full access. */
174#define MSR_IA32_PMC0 0x000004c1
175
173/* AMD64 MSRs. Not complete. See the architecture manual for a more 176/* AMD64 MSRs. Not complete. See the architecture manual for a more
174 complete list. */ 177 complete list. */
175 178
diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h
index 54991a746043..180a0c3c224d 100644
--- a/arch/x86/include/uapi/asm/processor-flags.h
+++ b/arch/x86/include/uapi/asm/processor-flags.h
@@ -2,75 +2,129 @@
2#define _UAPI_ASM_X86_PROCESSOR_FLAGS_H 2#define _UAPI_ASM_X86_PROCESSOR_FLAGS_H
3/* Various flags defined: can be included from assembler. */ 3/* Various flags defined: can be included from assembler. */
4 4
5#include <linux/const.h>
6
5/* 7/*
6 * EFLAGS bits 8 * EFLAGS bits
7 */ 9 */
8#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ 10#define X86_EFLAGS_CF_BIT 0 /* Carry Flag */
9#define X86_EFLAGS_BIT1 0x00000002 /* Bit 1 - always on */ 11#define X86_EFLAGS_CF _BITUL(X86_EFLAGS_CF_BIT)
10#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ 12#define X86_EFLAGS_FIXED_BIT 1 /* Bit 1 - always on */
11#define X86_EFLAGS_AF 0x00000010 /* Auxiliary carry Flag */ 13#define X86_EFLAGS_FIXED _BITUL(X86_EFLAGS_FIXED_BIT)
12#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ 14#define X86_EFLAGS_PF_BIT 2 /* Parity Flag */
13#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ 15#define X86_EFLAGS_PF _BITUL(X86_EFLAGS_PF_BIT)
14#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ 16#define X86_EFLAGS_AF_BIT 4 /* Auxiliary carry Flag */
15#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ 17#define X86_EFLAGS_AF _BITUL(X86_EFLAGS_AF_BIT)
16#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ 18#define X86_EFLAGS_ZF_BIT 6 /* Zero Flag */
17#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ 19#define X86_EFLAGS_ZF _BITUL(X86_EFLAGS_ZF_BIT)
18#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ 20#define X86_EFLAGS_SF_BIT 7 /* Sign Flag */
19#define X86_EFLAGS_NT 0x00004000 /* Nested Task */ 21#define X86_EFLAGS_SF _BITUL(X86_EFLAGS_SF_BIT)
20#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ 22#define X86_EFLAGS_TF_BIT 8 /* Trap Flag */
21#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ 23#define X86_EFLAGS_TF _BITUL(X86_EFLAGS_TF_BIT)
22#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ 24#define X86_EFLAGS_IF_BIT 9 /* Interrupt Flag */
23#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ 25#define X86_EFLAGS_IF _BITUL(X86_EFLAGS_IF_BIT)
24#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ 26#define X86_EFLAGS_DF_BIT 10 /* Direction Flag */
25#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ 27#define X86_EFLAGS_DF _BITUL(X86_EFLAGS_DF_BIT)
28#define X86_EFLAGS_OF_BIT 11 /* Overflow Flag */
29#define X86_EFLAGS_OF _BITUL(X86_EFLAGS_OF_BIT)
30#define X86_EFLAGS_IOPL_BIT 12 /* I/O Privilege Level (2 bits) */
31#define X86_EFLAGS_IOPL (_AC(3,UL) << X86_EFLAGS_IOPL_BIT)
32#define X86_EFLAGS_NT_BIT 14 /* Nested Task */
33#define X86_EFLAGS_NT _BITUL(X86_EFLAGS_NT_BIT)
34#define X86_EFLAGS_RF_BIT 16 /* Resume Flag */
35#define X86_EFLAGS_RF _BITUL(X86_EFLAGS_RF_BIT)
36#define X86_EFLAGS_VM_BIT 17 /* Virtual Mode */
37#define X86_EFLAGS_VM _BITUL(X86_EFLAGS_VM_BIT)
38#define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */
39#define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT)
40#define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */
41#define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT)
42#define X86_EFLAGS_VIF_BIT 19 /* Virtual Interrupt Flag */
43#define X86_EFLAGS_VIF _BITUL(X86_EFLAGS_VIF_BIT)
44#define X86_EFLAGS_VIP_BIT 20 /* Virtual Interrupt Pending */
45#define X86_EFLAGS_VIP _BITUL(X86_EFLAGS_VIP_BIT)
46#define X86_EFLAGS_ID_BIT 21 /* CPUID detection */
47#define X86_EFLAGS_ID _BITUL(X86_EFLAGS_ID_BIT)
26 48
27/* 49/*
28 * Basic CPU control in CR0 50 * Basic CPU control in CR0
29 */ 51 */
30#define X86_CR0_PE 0x00000001 /* Protection Enable */ 52#define X86_CR0_PE_BIT 0 /* Protection Enable */
31#define X86_CR0_MP 0x00000002 /* Monitor Coprocessor */ 53#define X86_CR0_PE _BITUL(X86_CR0_PE_BIT)
32#define X86_CR0_EM 0x00000004 /* Emulation */ 54#define X86_CR0_MP_BIT 1 /* Monitor Coprocessor */
33#define X86_CR0_TS 0x00000008 /* Task Switched */ 55#define X86_CR0_MP _BITUL(X86_CR0_MP_BIT)
34#define X86_CR0_ET 0x00000010 /* Extension Type */ 56#define X86_CR0_EM_BIT 2 /* Emulation */
35#define X86_CR0_NE 0x00000020 /* Numeric Error */ 57#define X86_CR0_EM _BITUL(X86_CR0_EM_BIT)
36#define X86_CR0_WP 0x00010000 /* Write Protect */ 58#define X86_CR0_TS_BIT 3 /* Task Switched */
37#define X86_CR0_AM 0x00040000 /* Alignment Mask */ 59#define X86_CR0_TS _BITUL(X86_CR0_TS_BIT)
38#define X86_CR0_NW 0x20000000 /* Not Write-through */ 60#define X86_CR0_ET_BIT 4 /* Extension Type */
39#define X86_CR0_CD 0x40000000 /* Cache Disable */ 61#define X86_CR0_ET _BITUL(X86_CR0_ET_BIT)
40#define X86_CR0_PG 0x80000000 /* Paging */ 62#define X86_CR0_NE_BIT 5 /* Numeric Error */
63#define X86_CR0_NE _BITUL(X86_CR0_NE_BIT)
64#define X86_CR0_WP_BIT 16 /* Write Protect */
65#define X86_CR0_WP _BITUL(X86_CR0_WP_BIT)
66#define X86_CR0_AM_BIT 18 /* Alignment Mask */
67#define X86_CR0_AM _BITUL(X86_CR0_AM_BIT)
68#define X86_CR0_NW_BIT 29 /* Not Write-through */
69#define X86_CR0_NW _BITUL(X86_CR0_NW_BIT)
70#define X86_CR0_CD_BIT 30 /* Cache Disable */
71#define X86_CR0_CD _BITUL(X86_CR0_CD_BIT)
72#define X86_CR0_PG_BIT 31 /* Paging */
73#define X86_CR0_PG _BITUL(X86_CR0_PG_BIT)
41 74
42/* 75/*
43 * Paging options in CR3 76 * Paging options in CR3
44 */ 77 */
45#define X86_CR3_PWT 0x00000008 /* Page Write Through */ 78#define X86_CR3_PWT_BIT 3 /* Page Write Through */
46#define X86_CR3_PCD 0x00000010 /* Page Cache Disable */ 79#define X86_CR3_PWT _BITUL(X86_CR3_PWT_BIT)
47#define X86_CR3_PCID_MASK 0x00000fff /* PCID Mask */ 80#define X86_CR3_PCD_BIT 4 /* Page Cache Disable */
81#define X86_CR3_PCD _BITUL(X86_CR3_PCD_BIT)
82#define X86_CR3_PCID_MASK _AC(0x00000fff,UL) /* PCID Mask */
48 83
49/* 84/*
50 * Intel CPU features in CR4 85 * Intel CPU features in CR4
51 */ 86 */
52#define X86_CR4_VME 0x00000001 /* enable vm86 extensions */ 87#define X86_CR4_VME_BIT 0 /* enable vm86 extensions */
53#define X86_CR4_PVI 0x00000002 /* virtual interrupts flag enable */ 88#define X86_CR4_VME _BITUL(X86_CR4_VME_BIT)
54#define X86_CR4_TSD 0x00000004 /* disable time stamp at ipl 3 */ 89#define X86_CR4_PVI_BIT 1 /* virtual interrupts flag enable */
55#define X86_CR4_DE 0x00000008 /* enable debugging extensions */ 90#define X86_CR4_PVI _BITUL(X86_CR4_PVI_BIT)
56#define X86_CR4_PSE 0x00000010 /* enable page size extensions */ 91#define X86_CR4_TSD_BIT 2 /* disable time stamp at ipl 3 */
57#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */ 92#define X86_CR4_TSD _BITUL(X86_CR4_TSD_BIT)
58#define X86_CR4_MCE 0x00000040 /* Machine check enable */ 93#define X86_CR4_DE_BIT 3 /* enable debugging extensions */
59#define X86_CR4_PGE 0x00000080 /* enable global pages */ 94#define X86_CR4_DE _BITUL(X86_CR4_DE_BIT)
60#define X86_CR4_PCE 0x00000100 /* enable performance counters at ipl 3 */ 95#define X86_CR4_PSE_BIT 4 /* enable page size extensions */
61#define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */ 96#define X86_CR4_PSE _BITUL(X86_CR4_PSE_BIT)
62#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */ 97#define X86_CR4_PAE_BIT 5 /* enable physical address extensions */
63#define X86_CR4_VMXE 0x00002000 /* enable VMX virtualization */ 98#define X86_CR4_PAE _BITUL(X86_CR4_PAE_BIT)
64#define X86_CR4_RDWRGSFS 0x00010000 /* enable RDWRGSFS support */ 99#define X86_CR4_MCE_BIT 6 /* Machine check enable */
65#define X86_CR4_PCIDE 0x00020000 /* enable PCID support */ 100#define X86_CR4_MCE _BITUL(X86_CR4_MCE_BIT)
66#define X86_CR4_OSXSAVE 0x00040000 /* enable xsave and xrestore */ 101#define X86_CR4_PGE_BIT 7 /* enable global pages */
67#define X86_CR4_SMEP 0x00100000 /* enable SMEP support */ 102#define X86_CR4_PGE _BITUL(X86_CR4_PGE_BIT)
68#define X86_CR4_SMAP 0x00200000 /* enable SMAP support */ 103#define X86_CR4_PCE_BIT 8 /* enable performance counters at ipl 3 */
104#define X86_CR4_PCE _BITUL(X86_CR4_PCE_BIT)
105#define X86_CR4_OSFXSR_BIT 9 /* enable fast FPU save and restore */
106#define X86_CR4_OSFXSR _BITUL(X86_CR4_OSFXSR_BIT)
107#define X86_CR4_OSXMMEXCPT_BIT 10 /* enable unmasked SSE exceptions */
108#define X86_CR4_OSXMMEXCPT _BITUL(X86_CR4_OSXMMEXCPT_BIT)
109#define X86_CR4_VMXE_BIT 13 /* enable VMX virtualization */
110#define X86_CR4_VMXE _BITUL(X86_CR4_VMXE_BIT)
111#define X86_CR4_SMXE_BIT 14 /* enable safer mode (TXT) */
112#define X86_CR4_SMXE _BITUL(X86_CR4_SMXE_BIT)
113#define X86_CR4_FSGSBASE_BIT 16 /* enable RDWRFSGS support */
114#define X86_CR4_FSGSBASE _BITUL(X86_CR4_FSGSBASE_BIT)
115#define X86_CR4_PCIDE_BIT 17 /* enable PCID support */
116#define X86_CR4_PCIDE _BITUL(X86_CR4_PCIDE_BIT)
117#define X86_CR4_OSXSAVE_BIT 18 /* enable xsave and xrestore */
118#define X86_CR4_OSXSAVE _BITUL(X86_CR4_OSXSAVE_BIT)
119#define X86_CR4_SMEP_BIT 20 /* enable SMEP support */
120#define X86_CR4_SMEP _BITUL(X86_CR4_SMEP_BIT)
121#define X86_CR4_SMAP_BIT 21 /* enable SMAP support */
122#define X86_CR4_SMAP _BITUL(X86_CR4_SMAP_BIT)
69 123
70/* 124/*
71 * x86-64 Task Priority Register, CR8 125 * x86-64 Task Priority Register, CR8
72 */ 126 */
73#define X86_CR8_TPR 0x0000000F /* task priority register */ 127#define X86_CR8_TPR _AC(0x0000000f,UL) /* task priority register */
74 128
75/* 129/*
76 * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h> 130 * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h>
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 7bd3bd310106..88d99ea77723 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -16,6 +16,8 @@ CFLAGS_REMOVE_ftrace.o = -pg
16CFLAGS_REMOVE_early_printk.o = -pg 16CFLAGS_REMOVE_early_printk.o = -pg
17endif 17endif
18 18
19CFLAGS_irq.o := -I$(src)/../include/asm/trace
20
19obj-y := process_$(BITS).o signal.o entry_$(BITS).o 21obj-y := process_$(BITS).o signal.o entry_$(BITS).o
20obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 22obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
21obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o 23obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o
@@ -67,7 +69,7 @@ obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
67obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 69obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
68obj-y += kprobes/ 70obj-y += kprobes/
69obj-$(CONFIG_MODULES) += module.o 71obj-$(CONFIG_MODULES) += module.o
70obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o 72obj-$(CONFIG_DOUBLEFAULT) += doublefault.o
71obj-$(CONFIG_KGDB) += kgdb.o 73obj-$(CONFIG_KGDB) += kgdb.o
72obj-$(CONFIG_VM86) += vm86_32.o 74obj-$(CONFIG_VM86) += vm86_32.o
73obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 75obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
@@ -93,6 +95,7 @@ obj-$(CONFIG_MICROCODE_INTEL_LIB) += microcode_intel_lib.o
93microcode-y := microcode_core.o 95microcode-y := microcode_core.o
94microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o 96microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o
95microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o 97microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o
98obj-$(CONFIG_MICROCODE_AMD_EARLY) += microcode_amd_early.o
96obj-$(CONFIG_MICROCODE) += microcode.o 99obj-$(CONFIG_MICROCODE) += microcode.o
97 100
98obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o 101obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
@@ -102,6 +105,7 @@ obj-$(CONFIG_OF) += devicetree.o
102obj-$(CONFIG_UPROBES) += uprobes.o 105obj-$(CONFIG_UPROBES) += uprobes.o
103 106
104obj-$(CONFIG_PERF_EVENTS) += perf_regs.o 107obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
108obj-$(CONFIG_TRACING) += tracepoint.o
105 109
106### 110###
107# 64 bit specific files 111# 64 bit specific files
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 230c8ea878e5..d81a972dd506 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -44,6 +44,7 @@
44#include <asm/mpspec.h> 44#include <asm/mpspec.h>
45#include <asm/smp.h> 45#include <asm/smp.h>
46 46
47#include "sleep.h" /* To include x86_acpi_suspend_lowlevel */
47static int __initdata acpi_force = 0; 48static int __initdata acpi_force = 0;
48u32 acpi_rsdt_forced; 49u32 acpi_rsdt_forced;
49int acpi_disabled; 50int acpi_disabled;
@@ -559,6 +560,12 @@ static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
559int (*__acpi_register_gsi)(struct device *dev, u32 gsi, 560int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
560 int trigger, int polarity) = acpi_register_gsi_pic; 561 int trigger, int polarity) = acpi_register_gsi_pic;
561 562
563#ifdef CONFIG_ACPI_SLEEP
564int (*acpi_suspend_lowlevel)(void) = x86_acpi_suspend_lowlevel;
565#else
566int (*acpi_suspend_lowlevel)(void);
567#endif
568
562/* 569/*
563 * success: return IRQ number (>=0) 570 * success: return IRQ number (>=0)
564 * failure: return < 0 571 * failure: return < 0
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index b44577bc9744..2a34aaf3c8f1 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -26,12 +26,12 @@ static char temp_stack[4096];
26#endif 26#endif
27 27
28/** 28/**
29 * acpi_suspend_lowlevel - save kernel state 29 * x86_acpi_suspend_lowlevel - save kernel state
30 * 30 *
31 * Create an identity mapped page table and copy the wakeup routine to 31 * Create an identity mapped page table and copy the wakeup routine to
32 * low memory. 32 * low memory.
33 */ 33 */
34int acpi_suspend_lowlevel(void) 34int x86_acpi_suspend_lowlevel(void)
35{ 35{
36 struct wakeup_header *header = 36 struct wakeup_header *header =
37 (struct wakeup_header *) __va(real_mode_header->wakeup_header); 37 (struct wakeup_header *) __va(real_mode_header->wakeup_header);
diff --git a/arch/x86/kernel/acpi/sleep.h b/arch/x86/kernel/acpi/sleep.h
index 67f59f8c6956..c9c2c982d5e4 100644
--- a/arch/x86/kernel/acpi/sleep.h
+++ b/arch/x86/kernel/acpi/sleep.h
@@ -15,3 +15,5 @@ extern unsigned long acpi_copy_wakeup_routine(unsigned long);
15extern void wakeup_long64(void); 15extern void wakeup_long64(void);
16 16
17extern void do_suspend_lowlevel(void); 17extern void do_suspend_lowlevel(void);
18
19extern int x86_acpi_suspend_lowlevel(void);
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 904611bf0e5a..99663b59123a 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -35,6 +35,7 @@
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/mm.h> 36#include <linux/mm.h>
37 37
38#include <asm/trace/irq_vectors.h>
38#include <asm/irq_remapping.h> 39#include <asm/irq_remapping.h>
39#include <asm/perf_event.h> 40#include <asm/perf_event.h>
40#include <asm/x86_init.h> 41#include <asm/x86_init.h>
@@ -919,17 +920,35 @@ void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
919 /* 920 /*
920 * NOTE! We'd better ACK the irq immediately, 921 * NOTE! We'd better ACK the irq immediately,
921 * because timer handling can be slow. 922 * because timer handling can be slow.
923 *
924 * update_process_times() expects us to have done irq_enter().
925 * Besides, if we don't timer interrupts ignore the global
926 * interrupt lock, which is the WrongThing (tm) to do.
922 */ 927 */
923 ack_APIC_irq(); 928 entering_ack_irq();
929 local_apic_timer_interrupt();
930 exiting_irq();
931
932 set_irq_regs(old_regs);
933}
934
935void __irq_entry smp_trace_apic_timer_interrupt(struct pt_regs *regs)
936{
937 struct pt_regs *old_regs = set_irq_regs(regs);
938
924 /* 939 /*
940 * NOTE! We'd better ACK the irq immediately,
941 * because timer handling can be slow.
942 *
925 * update_process_times() expects us to have done irq_enter(). 943 * update_process_times() expects us to have done irq_enter().
926 * Besides, if we don't timer interrupts ignore the global 944 * Besides, if we don't timer interrupts ignore the global
927 * interrupt lock, which is the WrongThing (tm) to do. 945 * interrupt lock, which is the WrongThing (tm) to do.
928 */ 946 */
929 irq_enter(); 947 entering_ack_irq();
930 exit_idle(); 948 trace_local_timer_entry(LOCAL_TIMER_VECTOR);
931 local_apic_timer_interrupt(); 949 local_apic_timer_interrupt();
932 irq_exit(); 950 trace_local_timer_exit(LOCAL_TIMER_VECTOR);
951 exiting_irq();
933 952
934 set_irq_regs(old_regs); 953 set_irq_regs(old_regs);
935} 954}
@@ -1907,12 +1926,10 @@ int __init APIC_init_uniprocessor(void)
1907/* 1926/*
1908 * This interrupt should _never_ happen with our APIC/SMP architecture 1927 * This interrupt should _never_ happen with our APIC/SMP architecture
1909 */ 1928 */
1910void smp_spurious_interrupt(struct pt_regs *regs) 1929static inline void __smp_spurious_interrupt(void)
1911{ 1930{
1912 u32 v; 1931 u32 v;
1913 1932
1914 irq_enter();
1915 exit_idle();
1916 /* 1933 /*
1917 * Check if this really is a spurious interrupt and ACK it 1934 * Check if this really is a spurious interrupt and ACK it
1918 * if it is a vectored one. Just in case... 1935 * if it is a vectored one. Just in case...
@@ -1927,13 +1944,28 @@ void smp_spurious_interrupt(struct pt_regs *regs)
1927 /* see sw-dev-man vol 3, chapter 7.4.13.5 */ 1944 /* see sw-dev-man vol 3, chapter 7.4.13.5 */
1928 pr_info("spurious APIC interrupt on CPU#%d, " 1945 pr_info("spurious APIC interrupt on CPU#%d, "
1929 "should never happen.\n", smp_processor_id()); 1946 "should never happen.\n", smp_processor_id());
1930 irq_exit(); 1947}
1948
1949void smp_spurious_interrupt(struct pt_regs *regs)
1950{
1951 entering_irq();
1952 __smp_spurious_interrupt();
1953 exiting_irq();
1954}
1955
1956void smp_trace_spurious_interrupt(struct pt_regs *regs)
1957{
1958 entering_irq();
1959 trace_spurious_apic_entry(SPURIOUS_APIC_VECTOR);
1960 __smp_spurious_interrupt();
1961 trace_spurious_apic_exit(SPURIOUS_APIC_VECTOR);
1962 exiting_irq();
1931} 1963}
1932 1964
1933/* 1965/*
1934 * This interrupt should never happen with our APIC/SMP architecture 1966 * This interrupt should never happen with our APIC/SMP architecture
1935 */ 1967 */
1936void smp_error_interrupt(struct pt_regs *regs) 1968static inline void __smp_error_interrupt(struct pt_regs *regs)
1937{ 1969{
1938 u32 v0, v1; 1970 u32 v0, v1;
1939 u32 i = 0; 1971 u32 i = 0;
@@ -1948,8 +1980,6 @@ void smp_error_interrupt(struct pt_regs *regs)
1948 "Illegal register address", /* APIC Error Bit 7 */ 1980 "Illegal register address", /* APIC Error Bit 7 */
1949 }; 1981 };
1950 1982
1951 irq_enter();
1952 exit_idle();
1953 /* First tickle the hardware, only then report what went on. -- REW */ 1983 /* First tickle the hardware, only then report what went on. -- REW */
1954 v0 = apic_read(APIC_ESR); 1984 v0 = apic_read(APIC_ESR);
1955 apic_write(APIC_ESR, 0); 1985 apic_write(APIC_ESR, 0);
@@ -1970,7 +2000,22 @@ void smp_error_interrupt(struct pt_regs *regs)
1970 2000
1971 apic_printk(APIC_DEBUG, KERN_CONT "\n"); 2001 apic_printk(APIC_DEBUG, KERN_CONT "\n");
1972 2002
1973 irq_exit(); 2003}
2004
2005void smp_error_interrupt(struct pt_regs *regs)
2006{
2007 entering_irq();
2008 __smp_error_interrupt(regs);
2009 exiting_irq();
2010}
2011
2012void smp_trace_error_interrupt(struct pt_regs *regs)
2013{
2014 entering_irq();
2015 trace_error_apic_entry(ERROR_APIC_VECTOR);
2016 __smp_error_interrupt(regs);
2017 trace_error_apic_exit(ERROR_APIC_VECTOR);
2018 exiting_irq();
1974} 2019}
1975 2020
1976/** 2021/**
@@ -2302,7 +2347,7 @@ static void lapic_resume(void)
2302 apic_write(APIC_SPIV, apic_pm_state.apic_spiv); 2347 apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
2303 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0); 2348 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
2304 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1); 2349 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
2305#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL) 2350#if defined(CONFIG_X86_MCE_INTEL)
2306 if (maxlvt >= 5) 2351 if (maxlvt >= 5)
2307 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr); 2352 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
2308#endif 2353#endif
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index 31cb9ae992b7..a698d7165c96 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -9,6 +9,7 @@
9 * 9 *
10 */ 10 */
11#include <asm/apic.h> 11#include <asm/apic.h>
12#include <asm/nmi.h>
12 13
13#include <linux/cpumask.h> 14#include <linux/cpumask.h>
14#include <linux/kdebug.h> 15#include <linux/kdebug.h>
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 794f6eb54cd3..39cc7f7acab3 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -51,6 +51,8 @@ DEFINE_PER_CPU(int, x2apic_extra_bits);
51 51
52static enum uv_system_type uv_system_type; 52static enum uv_system_type uv_system_type;
53static u64 gru_start_paddr, gru_end_paddr; 53static u64 gru_start_paddr, gru_end_paddr;
54static u64 gru_dist_base, gru_first_node_paddr = -1LL, gru_last_node_paddr;
55static u64 gru_dist_lmask, gru_dist_umask;
54static union uvh_apicid uvh_apicid; 56static union uvh_apicid uvh_apicid;
55int uv_min_hub_revision_id; 57int uv_min_hub_revision_id;
56EXPORT_SYMBOL_GPL(uv_min_hub_revision_id); 58EXPORT_SYMBOL_GPL(uv_min_hub_revision_id);
@@ -72,7 +74,20 @@ static unsigned long __init uv_early_read_mmr(unsigned long addr)
72 74
73static inline bool is_GRU_range(u64 start, u64 end) 75static inline bool is_GRU_range(u64 start, u64 end)
74{ 76{
75 return start >= gru_start_paddr && end <= gru_end_paddr; 77 if (gru_dist_base) {
78 u64 su = start & gru_dist_umask; /* upper (incl pnode) bits */
79 u64 sl = start & gru_dist_lmask; /* base offset bits */
80 u64 eu = end & gru_dist_umask;
81 u64 el = end & gru_dist_lmask;
82
83 /* Must reside completely within a single GRU range */
84 return (sl == gru_dist_base && el == gru_dist_base &&
85 su >= gru_first_node_paddr &&
86 su <= gru_last_node_paddr &&
87 eu == su);
88 } else {
89 return start >= gru_start_paddr && end <= gru_end_paddr;
90 }
76} 91}
77 92
78static bool uv_is_untracked_pat_range(u64 start, u64 end) 93static bool uv_is_untracked_pat_range(u64 start, u64 end)
@@ -463,26 +478,63 @@ static __init void map_high(char *id, unsigned long base, int pshift,
463 pr_info("UV: Map %s_HI base address NULL\n", id); 478 pr_info("UV: Map %s_HI base address NULL\n", id);
464 return; 479 return;
465 } 480 }
466 pr_info("UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr, paddr + bytes); 481 pr_debug("UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr, paddr + bytes);
467 if (map_type == map_uc) 482 if (map_type == map_uc)
468 init_extra_mapping_uc(paddr, bytes); 483 init_extra_mapping_uc(paddr, bytes);
469 else 484 else
470 init_extra_mapping_wb(paddr, bytes); 485 init_extra_mapping_wb(paddr, bytes);
471} 486}
472 487
488static __init void map_gru_distributed(unsigned long c)
489{
490 union uvh_rh_gam_gru_overlay_config_mmr_u gru;
491 u64 paddr;
492 unsigned long bytes;
493 int nid;
494
495 gru.v = c;
496 /* only base bits 42:28 relevant in dist mode */
497 gru_dist_base = gru.v & 0x000007fff0000000UL;
498 if (!gru_dist_base) {
499 pr_info("UV: Map GRU_DIST base address NULL\n");
500 return;
501 }
502 bytes = 1UL << UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT;
503 gru_dist_lmask = ((1UL << uv_hub_info->m_val) - 1) & ~(bytes - 1);
504 gru_dist_umask = ~((1UL << uv_hub_info->m_val) - 1);
505 gru_dist_base &= gru_dist_lmask; /* Clear bits above M */
506 for_each_online_node(nid) {
507 paddr = ((u64)uv_node_to_pnode(nid) << uv_hub_info->m_val) |
508 gru_dist_base;
509 init_extra_mapping_wb(paddr, bytes);
510 gru_first_node_paddr = min(paddr, gru_first_node_paddr);
511 gru_last_node_paddr = max(paddr, gru_last_node_paddr);
512 }
513 /* Save upper (63:M) bits of address only for is_GRU_range */
514 gru_first_node_paddr &= gru_dist_umask;
515 gru_last_node_paddr &= gru_dist_umask;
516 pr_debug("UV: Map GRU_DIST base 0x%016llx 0x%016llx - 0x%016llx\n",
517 gru_dist_base, gru_first_node_paddr, gru_last_node_paddr);
518}
519
473static __init void map_gru_high(int max_pnode) 520static __init void map_gru_high(int max_pnode)
474{ 521{
475 union uvh_rh_gam_gru_overlay_config_mmr_u gru; 522 union uvh_rh_gam_gru_overlay_config_mmr_u gru;
476 int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT; 523 int shift = UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR_BASE_SHFT;
477 524
478 gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR); 525 gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
479 if (gru.s.enable) { 526 if (!gru.s.enable) {
480 map_high("GRU", gru.s.base, shift, shift, max_pnode, map_wb);
481 gru_start_paddr = ((u64)gru.s.base << shift);
482 gru_end_paddr = gru_start_paddr + (1UL << shift) * (max_pnode + 1);
483 } else {
484 pr_info("UV: GRU disabled\n"); 527 pr_info("UV: GRU disabled\n");
528 return;
529 }
530
531 if (is_uv3_hub() && gru.s3.mode) {
532 map_gru_distributed(gru.v);
533 return;
485 } 534 }
535 map_high("GRU", gru.s.base, shift, shift, max_pnode, map_wb);
536 gru_start_paddr = ((u64)gru.s.base << shift);
537 gru_end_paddr = gru_start_paddr + (1UL << shift) * (max_pnode + 1);
486} 538}
487 539
488static __init void map_mmr_high(int max_pnode) 540static __init void map_mmr_high(int max_pnode)
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index 0ef4bba2acb7..d67c4be3e8b1 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -28,7 +28,6 @@ void foo(void)
28 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor); 28 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
29 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model); 29 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
30 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask); 30 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
31 OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
32 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level); 31 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
33 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability); 32 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
34 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id); 33 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index b0684e4a73aa..47b56a7e99cb 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -31,11 +31,15 @@ obj-$(CONFIG_PERF_EVENTS) += perf_event.o
31 31
32ifdef CONFIG_PERF_EVENTS 32ifdef CONFIG_PERF_EVENTS
33obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o perf_event_amd_uncore.o 33obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o perf_event_amd_uncore.o
34ifdef CONFIG_AMD_IOMMU
35obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd_iommu.o
36endif
34obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o 37obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o
35obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o 38obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
36obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o 39obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o
37endif 40endif
38 41
42
39obj-$(CONFIG_X86_MCE) += mcheck/ 43obj-$(CONFIG_X86_MCE) += mcheck/
40obj-$(CONFIG_MTRR) += mtrr/ 44obj-$(CONFIG_MTRR) += mtrr/
41 45
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 5013a48d1aff..c587a8757227 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -90,7 +90,7 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
90static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) 90static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
91{ 91{
92 u32 l, h; 92 u32 l, h;
93 int mbytes = num_physpages >> (20-PAGE_SHIFT); 93 int mbytes = get_num_physpages() >> (20-PAGE_SHIFT);
94 94
95 if (c->x86_model < 6) { 95 if (c->x86_model < 6) {
96 /* Based on AMD doc 20734R - June 2000 */ 96 /* Based on AMD doc 20734R - June 2000 */
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 4112be9a4659..03445346ee0a 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -17,15 +17,6 @@
17#include <asm/paravirt.h> 17#include <asm/paravirt.h>
18#include <asm/alternative.h> 18#include <asm/alternative.h>
19 19
20static int __init no_387(char *s)
21{
22 boot_cpu_data.hard_math = 0;
23 write_cr0(X86_CR0_TS | X86_CR0_EM | X86_CR0_MP | read_cr0());
24 return 1;
25}
26
27__setup("no387", no_387);
28
29static double __initdata x = 4195835.0; 20static double __initdata x = 4195835.0;
30static double __initdata y = 3145727.0; 21static double __initdata y = 3145727.0;
31 22
@@ -44,15 +35,6 @@ static void __init check_fpu(void)
44{ 35{
45 s32 fdiv_bug; 36 s32 fdiv_bug;
46 37
47 if (!boot_cpu_data.hard_math) {
48#ifndef CONFIG_MATH_EMULATION
49 pr_emerg("No coprocessor found and no math emulation present\n");
50 pr_emerg("Giving up\n");
51 for (;;) ;
52#endif
53 return;
54 }
55
56 kernel_fpu_begin(); 38 kernel_fpu_begin();
57 39
58 /* 40 /*
@@ -107,5 +89,6 @@ void __init check_bugs(void)
107 * kernel_fpu_begin/end() in check_fpu() relies on the patched 89 * kernel_fpu_begin/end() in check_fpu() relies on the patched
108 * alternative instructions. 90 * alternative instructions.
109 */ 91 */
110 check_fpu(); 92 if (cpu_has_fpu)
93 check_fpu();
111} 94}
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 22018f70a671..548bd039784e 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -711,10 +711,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
711 return; 711 return;
712 712
713 cpu_detect(c); 713 cpu_detect(c);
714
715 get_cpu_vendor(c); 714 get_cpu_vendor(c);
716
717 get_cpu_cap(c); 715 get_cpu_cap(c);
716 fpu_detect(c);
718 717
719 if (this_cpu->c_early_init) 718 if (this_cpu->c_early_init)
720 this_cpu->c_early_init(c); 719 this_cpu->c_early_init(c);
@@ -724,6 +723,8 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
724 723
725 if (this_cpu->c_bsp_init) 724 if (this_cpu->c_bsp_init)
726 this_cpu->c_bsp_init(c); 725 this_cpu->c_bsp_init(c);
726
727 setup_force_cpu_cap(X86_FEATURE_ALWAYS);
727} 728}
728 729
729void __init early_cpu_init(void) 730void __init early_cpu_init(void)
@@ -1071,8 +1072,8 @@ __setup("clearcpuid=", setup_disablecpuid);
1071 1072
1072#ifdef CONFIG_X86_64 1073#ifdef CONFIG_X86_64
1073struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table }; 1074struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
1074struct desc_ptr nmi_idt_descr = { NR_VECTORS * 16 - 1, 1075struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1,
1075 (unsigned long) nmi_idt_table }; 1076 (unsigned long) debug_idt_table };
1076 1077
1077DEFINE_PER_CPU_FIRST(union irq_stack_union, 1078DEFINE_PER_CPU_FIRST(union irq_stack_union,
1078 irq_stack_union) __aligned(PAGE_SIZE); 1079 irq_stack_union) __aligned(PAGE_SIZE);
@@ -1148,20 +1149,20 @@ int is_debug_stack(unsigned long addr)
1148 addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ)); 1149 addr > (__get_cpu_var(debug_stack_addr) - DEBUG_STKSZ));
1149} 1150}
1150 1151
1151static DEFINE_PER_CPU(u32, debug_stack_use_ctr); 1152DEFINE_PER_CPU(u32, debug_idt_ctr);
1152 1153
1153void debug_stack_set_zero(void) 1154void debug_stack_set_zero(void)
1154{ 1155{
1155 this_cpu_inc(debug_stack_use_ctr); 1156 this_cpu_inc(debug_idt_ctr);
1156 load_idt((const struct desc_ptr *)&nmi_idt_descr); 1157 load_current_idt();
1157} 1158}
1158 1159
1159void debug_stack_reset(void) 1160void debug_stack_reset(void)
1160{ 1161{
1161 if (WARN_ON(!this_cpu_read(debug_stack_use_ctr))) 1162 if (WARN_ON(!this_cpu_read(debug_idt_ctr)))
1162 return; 1163 return;
1163 if (this_cpu_dec_return(debug_stack_use_ctr) == 0) 1164 if (this_cpu_dec_return(debug_idt_ctr) == 0)
1164 load_idt((const struct desc_ptr *)&idt_descr); 1165 load_current_idt();
1165} 1166}
1166 1167
1167#else /* CONFIG_X86_64 */ 1168#else /* CONFIG_X86_64 */
@@ -1257,7 +1258,7 @@ void __cpuinit cpu_init(void)
1257 switch_to_new_gdt(cpu); 1258 switch_to_new_gdt(cpu);
1258 loadsegment(fs, 0); 1259 loadsegment(fs, 0);
1259 1260
1260 load_idt((const struct desc_ptr *)&idt_descr); 1261 load_current_idt();
1261 1262
1262 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); 1263 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
1263 syscall_init(); 1264 syscall_init();
@@ -1334,7 +1335,7 @@ void __cpuinit cpu_init(void)
1334 if (cpu_has_vme || cpu_has_tsc || cpu_has_de) 1335 if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
1335 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 1336 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
1336 1337
1337 load_idt(&idt_descr); 1338 load_current_idt();
1338 switch_to_new_gdt(cpu); 1339 switch_to_new_gdt(cpu);
1339 1340
1340 /* 1341 /*
@@ -1363,3 +1364,17 @@ void __cpuinit cpu_init(void)
1363 fpu_init(); 1364 fpu_init();
1364} 1365}
1365#endif 1366#endif
1367
1368#ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS
1369void warn_pre_alternatives(void)
1370{
1371 WARN(1, "You're using static_cpu_has before alternatives have run!\n");
1372}
1373EXPORT_SYMBOL_GPL(warn_pre_alternatives);
1374#endif
1375
1376inline bool __static_cpu_has_safe(u16 bit)
1377{
1378 return boot_cpu_has(bit);
1379}
1380EXPORT_SYMBOL_GPL(__static_cpu_has_safe);
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index d048d5ca43c1..7582f475b163 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -333,7 +333,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
333 switch (dir0_lsn) { 333 switch (dir0_lsn) {
334 case 0xd: /* either a 486SLC or DLC w/o DEVID */ 334 case 0xd: /* either a 486SLC or DLC w/o DEVID */
335 dir0_msn = 0; 335 dir0_msn = 0;
336 p = Cx486_name[(c->hard_math) ? 1 : 0]; 336 p = Cx486_name[(cpu_has_fpu ? 1 : 0)];
337 break; 337 break;
338 338
339 case 0xe: /* a 486S A step */ 339 case 0xe: /* a 486S A step */
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 7c6f7d548c0f..8dc72dda66fe 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -618,36 +618,34 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
618 * parameters cpuid leaf to find the cache details 618 * parameters cpuid leaf to find the cache details
619 */ 619 */
620 for (i = 0; i < num_cache_leaves; i++) { 620 for (i = 0; i < num_cache_leaves; i++) {
621 struct _cpuid4_info_regs this_leaf; 621 struct _cpuid4_info_regs this_leaf = {};
622 int retval; 622 int retval;
623 623
624 retval = cpuid4_cache_lookup_regs(i, &this_leaf); 624 retval = cpuid4_cache_lookup_regs(i, &this_leaf);
625 if (retval >= 0) { 625 if (retval < 0)
626 switch (this_leaf.eax.split.level) { 626 continue;
627 case 1: 627
628 if (this_leaf.eax.split.type == 628 switch (this_leaf.eax.split.level) {
629 CACHE_TYPE_DATA) 629 case 1:
630 new_l1d = this_leaf.size/1024; 630 if (this_leaf.eax.split.type == CACHE_TYPE_DATA)
631 else if (this_leaf.eax.split.type == 631 new_l1d = this_leaf.size/1024;
632 CACHE_TYPE_INST) 632 else if (this_leaf.eax.split.type == CACHE_TYPE_INST)
633 new_l1i = this_leaf.size/1024; 633 new_l1i = this_leaf.size/1024;
634 break; 634 break;
635 case 2: 635 case 2:
636 new_l2 = this_leaf.size/1024; 636 new_l2 = this_leaf.size/1024;
637 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; 637 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
638 index_msb = get_count_order(num_threads_sharing); 638 index_msb = get_count_order(num_threads_sharing);
639 l2_id = c->apicid & ~((1 << index_msb) - 1); 639 l2_id = c->apicid & ~((1 << index_msb) - 1);
640 break; 640 break;
641 case 3: 641 case 3:
642 new_l3 = this_leaf.size/1024; 642 new_l3 = this_leaf.size/1024;
643 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing; 643 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
644 index_msb = get_count_order( 644 index_msb = get_count_order(num_threads_sharing);
645 num_threads_sharing); 645 l3_id = c->apicid & ~((1 << index_msb) - 1);
646 l3_id = c->apicid & ~((1 << index_msb) - 1); 646 break;
647 break; 647 default:
648 default: 648 break;
649 break;
650 }
651 } 649 }
652 } 650 }
653 } 651 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index ddc72f839332..5ac2d1fb28bc 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -153,7 +153,7 @@ static void raise_mce(struct mce *m)
153 return; 153 return;
154 154
155#ifdef CONFIG_X86_LOCAL_APIC 155#ifdef CONFIG_X86_LOCAL_APIC
156 if (m->inject_flags & (MCJ_IRQ_BRAODCAST | MCJ_NMI_BROADCAST)) { 156 if (m->inject_flags & (MCJ_IRQ_BROADCAST | MCJ_NMI_BROADCAST)) {
157 unsigned long start; 157 unsigned long start;
158 int cpu; 158 int cpu;
159 159
@@ -167,7 +167,7 @@ static void raise_mce(struct mce *m)
167 cpumask_clear_cpu(cpu, mce_inject_cpumask); 167 cpumask_clear_cpu(cpu, mce_inject_cpumask);
168 } 168 }
169 if (!cpumask_empty(mce_inject_cpumask)) { 169 if (!cpumask_empty(mce_inject_cpumask)) {
170 if (m->inject_flags & MCJ_IRQ_BRAODCAST) { 170 if (m->inject_flags & MCJ_IRQ_BROADCAST) {
171 /* 171 /*
172 * don't wait because mce_irq_ipi is necessary 172 * don't wait because mce_irq_ipi is necessary
173 * to be sync with following raise_local 173 * to be sync with following raise_local
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index beb1f1689e52..e2703520d120 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -110,22 +110,17 @@ static struct severity {
110 /* known AR MCACODs: */ 110 /* known AR MCACODs: */
111#ifdef CONFIG_MEMORY_FAILURE 111#ifdef CONFIG_MEMORY_FAILURE
112 MCESEV( 112 MCESEV(
113 KEEP, "HT thread notices Action required: data load error", 113 KEEP, "Action required but unaffected thread is continuable",
114 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA), 114 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR),
115 MCGMASK(MCG_STATUS_EIPV, 0) 115 MCGMASK(MCG_STATUS_RIPV, MCG_STATUS_RIPV)
116 ), 116 ),
117 MCESEV( 117 MCESEV(
118 AR, "Action required: data load error", 118 AR, "Action required: data load error in a user process",
119 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA), 119 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_DATA),
120 USER 120 USER
121 ), 121 ),
122 MCESEV( 122 MCESEV(
123 KEEP, "HT thread notices Action required: instruction fetch error", 123 AR, "Action required: instruction fetch error in a user process",
124 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR),
125 MCGMASK(MCG_STATUS_EIPV, 0)
126 ),
127 MCESEV(
128 AR, "Action required: instruction fetch error",
129 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR), 124 SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR|MCI_ADDR|MCACOD, MCI_UC_SAR|MCI_ADDR|MCACOD_INSTR),
130 USER 125 USER
131 ), 126 ),
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 9239504b41cb..bf49cdbb010f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -89,7 +89,10 @@ static DECLARE_WAIT_QUEUE_HEAD(mce_chrdev_wait);
89static DEFINE_PER_CPU(struct mce, mces_seen); 89static DEFINE_PER_CPU(struct mce, mces_seen);
90static int cpu_missing; 90static int cpu_missing;
91 91
92/* MCA banks polled by the period polling timer for corrected events */ 92/*
93 * MCA banks polled by the period polling timer for corrected events.
94 * With Intel CMCI, this only has MCA banks which do not support CMCI (if any).
95 */
93DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = { 96DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = {
94 [0 ... BITS_TO_LONGS(MAX_NR_BANKS)-1] = ~0UL 97 [0 ... BITS_TO_LONGS(MAX_NR_BANKS)-1] = ~0UL
95}; 98};
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index ae1697c2afe3..d56405309dc1 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -24,6 +24,18 @@
24 * Also supports reliable discovery of shared banks. 24 * Also supports reliable discovery of shared banks.
25 */ 25 */
26 26
27/*
28 * CMCI can be delivered to multiple cpus that share a machine check bank
29 * so we need to designate a single cpu to process errors logged in each bank
30 * in the interrupt handler (otherwise we would have many races and potential
31 * double reporting of the same error).
32 * Note that this can change when a cpu is offlined or brought online since
33 * some MCA banks are shared across cpus. When a cpu is offlined, cmci_clear()
34 * disables CMCI on all banks owned by the cpu and clears this bitfield. At
35 * this point, cmci_rediscover() kicks in and a different cpu may end up
36 * taking ownership of some of the shared MCA banks that were previously
37 * owned by the offlined cpu.
38 */
27static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned); 39static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned);
28 40
29/* 41/*
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 47a1870279aa..98f2083832eb 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -29,6 +29,7 @@
29#include <asm/idle.h> 29#include <asm/idle.h>
30#include <asm/mce.h> 30#include <asm/mce.h>
31#include <asm/msr.h> 31#include <asm/msr.h>
32#include <asm/trace/irq_vectors.h>
32 33
33/* How long to wait between reporting thermal events */ 34/* How long to wait between reporting thermal events */
34#define CHECK_INTERVAL (300 * HZ) 35#define CHECK_INTERVAL (300 * HZ)
@@ -181,11 +182,6 @@ static int therm_throt_process(bool new_event, int event, int level)
181 this_cpu, 182 this_cpu,
182 level == CORE_LEVEL ? "Core" : "Package", 183 level == CORE_LEVEL ? "Core" : "Package",
183 state->count); 184 state->count);
184 else
185 printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu)\n",
186 this_cpu,
187 level == CORE_LEVEL ? "Core" : "Package",
188 state->count);
189 return 1; 185 return 1;
190 } 186 }
191 if (old_event) { 187 if (old_event) {
@@ -193,10 +189,6 @@ static int therm_throt_process(bool new_event, int event, int level)
193 printk(KERN_INFO "CPU%d: %s temperature/speed normal\n", 189 printk(KERN_INFO "CPU%d: %s temperature/speed normal\n",
194 this_cpu, 190 this_cpu,
195 level == CORE_LEVEL ? "Core" : "Package"); 191 level == CORE_LEVEL ? "Core" : "Package");
196 else
197 printk(KERN_INFO "CPU%d: %s power limit normal\n",
198 this_cpu,
199 level == CORE_LEVEL ? "Core" : "Package");
200 return 1; 192 return 1;
201 } 193 }
202 194
@@ -219,6 +211,15 @@ static int thresh_event_valid(int event)
219 return 1; 211 return 1;
220} 212}
221 213
214static bool int_pln_enable;
215static int __init int_pln_enable_setup(char *s)
216{
217 int_pln_enable = true;
218
219 return 1;
220}
221__setup("int_pln_enable", int_pln_enable_setup);
222
222#ifdef CONFIG_SYSFS 223#ifdef CONFIG_SYSFS
223/* Add/Remove thermal_throttle interface for CPU device: */ 224/* Add/Remove thermal_throttle interface for CPU device: */
224static __cpuinit int thermal_throttle_add_dev(struct device *dev, 225static __cpuinit int thermal_throttle_add_dev(struct device *dev,
@@ -231,7 +232,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev,
231 if (err) 232 if (err)
232 return err; 233 return err;
233 234
234 if (cpu_has(c, X86_FEATURE_PLN)) 235 if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
235 err = sysfs_add_file_to_group(&dev->kobj, 236 err = sysfs_add_file_to_group(&dev->kobj,
236 &dev_attr_core_power_limit_count.attr, 237 &dev_attr_core_power_limit_count.attr,
237 thermal_attr_group.name); 238 thermal_attr_group.name);
@@ -239,7 +240,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev,
239 err = sysfs_add_file_to_group(&dev->kobj, 240 err = sysfs_add_file_to_group(&dev->kobj,
240 &dev_attr_package_throttle_count.attr, 241 &dev_attr_package_throttle_count.attr,
241 thermal_attr_group.name); 242 thermal_attr_group.name);
242 if (cpu_has(c, X86_FEATURE_PLN)) 243 if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
243 err = sysfs_add_file_to_group(&dev->kobj, 244 err = sysfs_add_file_to_group(&dev->kobj,
244 &dev_attr_package_power_limit_count.attr, 245 &dev_attr_package_power_limit_count.attr,
245 thermal_attr_group.name); 246 thermal_attr_group.name);
@@ -352,7 +353,7 @@ static void intel_thermal_interrupt(void)
352 CORE_LEVEL) != 0) 353 CORE_LEVEL) != 0)
353 mce_log_therm_throt_event(msr_val); 354 mce_log_therm_throt_event(msr_val);
354 355
355 if (this_cpu_has(X86_FEATURE_PLN)) 356 if (this_cpu_has(X86_FEATURE_PLN) && int_pln_enable)
356 therm_throt_process(msr_val & THERM_STATUS_POWER_LIMIT, 357 therm_throt_process(msr_val & THERM_STATUS_POWER_LIMIT,
357 POWER_LIMIT_EVENT, 358 POWER_LIMIT_EVENT,
358 CORE_LEVEL); 359 CORE_LEVEL);
@@ -362,7 +363,7 @@ static void intel_thermal_interrupt(void)
362 therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT, 363 therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT,
363 THERMAL_THROTTLING_EVENT, 364 THERMAL_THROTTLING_EVENT,
364 PACKAGE_LEVEL); 365 PACKAGE_LEVEL);
365 if (this_cpu_has(X86_FEATURE_PLN)) 366 if (this_cpu_has(X86_FEATURE_PLN) && int_pln_enable)
366 therm_throt_process(msr_val & 367 therm_throt_process(msr_val &
367 PACKAGE_THERM_STATUS_POWER_LIMIT, 368 PACKAGE_THERM_STATUS_POWER_LIMIT,
368 POWER_LIMIT_EVENT, 369 POWER_LIMIT_EVENT,
@@ -378,15 +379,26 @@ static void unexpected_thermal_interrupt(void)
378 379
379static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt; 380static void (*smp_thermal_vector)(void) = unexpected_thermal_interrupt;
380 381
381asmlinkage void smp_thermal_interrupt(struct pt_regs *regs) 382static inline void __smp_thermal_interrupt(void)
382{ 383{
383 irq_enter();
384 exit_idle();
385 inc_irq_stat(irq_thermal_count); 384 inc_irq_stat(irq_thermal_count);
386 smp_thermal_vector(); 385 smp_thermal_vector();
387 irq_exit(); 386}
388 /* Ack only at the end to avoid potential reentry */ 387
389 ack_APIC_irq(); 388asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
389{
390 entering_irq();
391 __smp_thermal_interrupt();
392 exiting_ack_irq();
393}
394
395asmlinkage void smp_trace_thermal_interrupt(struct pt_regs *regs)
396{
397 entering_irq();
398 trace_thermal_apic_entry(THERMAL_APIC_VECTOR);
399 __smp_thermal_interrupt();
400 trace_thermal_apic_exit(THERMAL_APIC_VECTOR);
401 exiting_ack_irq();
390} 402}
391 403
392/* Thermal monitoring depends on APIC, ACPI and clock modulation */ 404/* Thermal monitoring depends on APIC, ACPI and clock modulation */
@@ -470,9 +482,13 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
470 apic_write(APIC_LVTTHMR, h); 482 apic_write(APIC_LVTTHMR, h);
471 483
472 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); 484 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
473 if (cpu_has(c, X86_FEATURE_PLN)) 485 if (cpu_has(c, X86_FEATURE_PLN) && !int_pln_enable)
486 wrmsr(MSR_IA32_THERM_INTERRUPT,
487 (l | (THERM_INT_LOW_ENABLE
488 | THERM_INT_HIGH_ENABLE)) & ~THERM_INT_PLN_ENABLE, h);
489 else if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
474 wrmsr(MSR_IA32_THERM_INTERRUPT, 490 wrmsr(MSR_IA32_THERM_INTERRUPT,
475 l | (THERM_INT_LOW_ENABLE 491 l | (THERM_INT_LOW_ENABLE
476 | THERM_INT_HIGH_ENABLE | THERM_INT_PLN_ENABLE), h); 492 | THERM_INT_HIGH_ENABLE | THERM_INT_PLN_ENABLE), h);
477 else 493 else
478 wrmsr(MSR_IA32_THERM_INTERRUPT, 494 wrmsr(MSR_IA32_THERM_INTERRUPT,
@@ -480,9 +496,14 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
480 496
481 if (cpu_has(c, X86_FEATURE_PTS)) { 497 if (cpu_has(c, X86_FEATURE_PTS)) {
482 rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h); 498 rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h);
483 if (cpu_has(c, X86_FEATURE_PLN)) 499 if (cpu_has(c, X86_FEATURE_PLN) && !int_pln_enable)
484 wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, 500 wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
485 l | (PACKAGE_THERM_INT_LOW_ENABLE 501 (l | (PACKAGE_THERM_INT_LOW_ENABLE
502 | PACKAGE_THERM_INT_HIGH_ENABLE))
503 & ~PACKAGE_THERM_INT_PLN_ENABLE, h);
504 else if (cpu_has(c, X86_FEATURE_PLN) && int_pln_enable)
505 wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
506 l | (PACKAGE_THERM_INT_LOW_ENABLE
486 | PACKAGE_THERM_INT_HIGH_ENABLE 507 | PACKAGE_THERM_INT_HIGH_ENABLE
487 | PACKAGE_THERM_INT_PLN_ENABLE), h); 508 | PACKAGE_THERM_INT_PLN_ENABLE), h);
488 else 509 else
diff --git a/arch/x86/kernel/cpu/mcheck/threshold.c b/arch/x86/kernel/cpu/mcheck/threshold.c
index aa578cadb940..fe6b1c86645b 100644
--- a/arch/x86/kernel/cpu/mcheck/threshold.c
+++ b/arch/x86/kernel/cpu/mcheck/threshold.c
@@ -8,6 +8,7 @@
8#include <asm/apic.h> 8#include <asm/apic.h>
9#include <asm/idle.h> 9#include <asm/idle.h>
10#include <asm/mce.h> 10#include <asm/mce.h>
11#include <asm/trace/irq_vectors.h>
11 12
12static void default_threshold_interrupt(void) 13static void default_threshold_interrupt(void)
13{ 14{
@@ -17,13 +18,24 @@ static void default_threshold_interrupt(void)
17 18
18void (*mce_threshold_vector)(void) = default_threshold_interrupt; 19void (*mce_threshold_vector)(void) = default_threshold_interrupt;
19 20
20asmlinkage void smp_threshold_interrupt(void) 21static inline void __smp_threshold_interrupt(void)
21{ 22{
22 irq_enter();
23 exit_idle();
24 inc_irq_stat(irq_threshold_count); 23 inc_irq_stat(irq_threshold_count);
25 mce_threshold_vector(); 24 mce_threshold_vector();
26 irq_exit(); 25}
27 /* Ack only at the end to avoid potential reentry */ 26
28 ack_APIC_irq(); 27asmlinkage void smp_threshold_interrupt(void)
28{
29 entering_irq();
30 __smp_threshold_interrupt();
31 exiting_ack_irq();
32}
33
34asmlinkage void smp_trace_threshold_interrupt(void)
35{
36 entering_irq();
37 trace_threshold_apic_entry(THRESHOLD_APIC_VECTOR);
38 __smp_threshold_interrupt();
39 trace_threshold_apic_exit(THRESHOLD_APIC_VECTOR);
40 exiting_ack_irq();
29} 41}
diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index 35ffda5d0727..5f90b85ff22e 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -714,15 +714,15 @@ int __init mtrr_cleanup(unsigned address_bits)
714 if (mtrr_tom2) 714 if (mtrr_tom2)
715 x_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - x_remove_base; 715 x_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - x_remove_base;
716 716
717 nr_range = x86_get_mtrr_mem_range(range, 0, x_remove_base, x_remove_size);
718 /* 717 /*
719 * [0, 1M) should always be covered by var mtrr with WB 718 * [0, 1M) should always be covered by var mtrr with WB
720 * and fixed mtrrs should take effect before var mtrr for it: 719 * and fixed mtrrs should take effect before var mtrr for it:
721 */ 720 */
722 nr_range = add_range_with_merge(range, RANGE_NUM, nr_range, 0, 721 nr_range = add_range_with_merge(range, RANGE_NUM, 0, 0,
723 1ULL<<(20 - PAGE_SHIFT)); 722 1ULL<<(20 - PAGE_SHIFT));
724 /* Sort the ranges: */ 723 /* add from var mtrr at last */
725 sort_range(range, nr_range); 724 nr_range = x86_get_mtrr_mem_range(range, nr_range,
725 x_remove_base, x_remove_size);
726 726
727 range_sums = sum_ranges(range, nr_range); 727 range_sums = sum_ranges(range, nr_range);
728 printk(KERN_INFO "total RAM covered: %ldM\n", 728 printk(KERN_INFO "total RAM covered: %ldM\n",
diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c b/arch/x86/kernel/cpu/mtrr/cyrix.c
index 68a3343e5798..9e451b0876b5 100644
--- a/arch/x86/kernel/cpu/mtrr/cyrix.c
+++ b/arch/x86/kernel/cpu/mtrr/cyrix.c
@@ -167,7 +167,7 @@ static void post_set(void)
167 setCx86(CX86_CCR3, ccr3); 167 setCx86(CX86_CCR3, ccr3);
168 168
169 /* Enable caches */ 169 /* Enable caches */
170 write_cr0(read_cr0() & 0xbfffffff); 170 write_cr0(read_cr0() & ~X86_CR0_CD);
171 171
172 /* Restore value of CR4 */ 172 /* Restore value of CR4 */
173 if (cpu_has_pge) 173 if (cpu_has_pge)
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index fa72a39e5d46..d4cdfa67509e 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -510,8 +510,9 @@ generic_get_free_region(unsigned long base, unsigned long size, int replace_reg)
510static void generic_get_mtrr(unsigned int reg, unsigned long *base, 510static void generic_get_mtrr(unsigned int reg, unsigned long *base,
511 unsigned long *size, mtrr_type *type) 511 unsigned long *size, mtrr_type *type)
512{ 512{
513 unsigned int mask_lo, mask_hi, base_lo, base_hi; 513 u32 mask_lo, mask_hi, base_lo, base_hi;
514 unsigned int tmp, hi; 514 unsigned int hi;
515 u64 tmp, mask;
515 516
516 /* 517 /*
517 * get_mtrr doesn't need to update mtrr_state, also it could be called 518 * get_mtrr doesn't need to update mtrr_state, also it could be called
@@ -532,18 +533,18 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
532 rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi); 533 rdmsr(MTRRphysBase_MSR(reg), base_lo, base_hi);
533 534
534 /* Work out the shifted address mask: */ 535 /* Work out the shifted address mask: */
535 tmp = mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT; 536 tmp = (u64)mask_hi << (32 - PAGE_SHIFT) | mask_lo >> PAGE_SHIFT;
536 mask_lo = size_or_mask | tmp; 537 mask = size_or_mask | tmp;
537 538
538 /* Expand tmp with high bits to all 1s: */ 539 /* Expand tmp with high bits to all 1s: */
539 hi = fls(tmp); 540 hi = fls64(tmp);
540 if (hi > 0) { 541 if (hi > 0) {
541 tmp |= ~((1<<(hi - 1)) - 1); 542 tmp |= ~((1ULL<<(hi - 1)) - 1);
542 543
543 if (tmp != mask_lo) { 544 if (tmp != mask) {
544 printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); 545 printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n");
545 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 546 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
546 mask_lo = tmp; 547 mask = tmp;
547 } 548 }
548 } 549 }
549 550
@@ -551,8 +552,8 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
551 * This works correctly if size is a power of two, i.e. a 552 * This works correctly if size is a power of two, i.e. a
552 * contiguous range: 553 * contiguous range:
553 */ 554 */
554 *size = -mask_lo; 555 *size = -mask;
555 *base = base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT; 556 *base = (u64)base_hi << (32 - PAGE_SHIFT) | base_lo >> PAGE_SHIFT;
556 *type = base_lo & 0xff; 557 *type = base_lo & 0xff;
557 558
558out_put_cpu: 559out_put_cpu:
@@ -701,7 +702,7 @@ static void post_set(void) __releases(set_atomicity_lock)
701 mtrr_wrmsr(MSR_MTRRdefType, deftype_lo, deftype_hi); 702 mtrr_wrmsr(MSR_MTRRdefType, deftype_lo, deftype_hi);
702 703
703 /* Enable caches */ 704 /* Enable caches */
704 write_cr0(read_cr0() & 0xbfffffff); 705 write_cr0(read_cr0() & ~X86_CR0_CD);
705 706
706 /* Restore value of CR4 */ 707 /* Restore value of CR4 */
707 if (cpu_has_pge) 708 if (cpu_has_pge)
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 726bf963c227..ca22b73aaa25 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -305,7 +305,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,
305 return -EINVAL; 305 return -EINVAL;
306 } 306 }
307 307
308 if (base & size_or_mask || size & size_or_mask) { 308 if ((base | (base + size - 1)) >>
309 (boot_cpu_data.x86_phys_bits - PAGE_SHIFT)) {
309 pr_warning("mtrr: base or size exceeds the MTRR width\n"); 310 pr_warning("mtrr: base or size exceeds the MTRR width\n");
310 return -EINVAL; 311 return -EINVAL;
311 } 312 }
@@ -583,6 +584,7 @@ static struct syscore_ops mtrr_syscore_ops = {
583 584
584int __initdata changed_by_mtrr_cleanup; 585int __initdata changed_by_mtrr_cleanup;
585 586
587#define SIZE_OR_MASK_BITS(n) (~((1ULL << ((n) - PAGE_SHIFT)) - 1))
586/** 588/**
587 * mtrr_bp_init - initialize mtrrs on the boot CPU 589 * mtrr_bp_init - initialize mtrrs on the boot CPU
588 * 590 *
@@ -600,7 +602,7 @@ void __init mtrr_bp_init(void)
600 602
601 if (cpu_has_mtrr) { 603 if (cpu_has_mtrr) {
602 mtrr_if = &generic_mtrr_ops; 604 mtrr_if = &generic_mtrr_ops;
603 size_or_mask = 0xff000000; /* 36 bits */ 605 size_or_mask = SIZE_OR_MASK_BITS(36);
604 size_and_mask = 0x00f00000; 606 size_and_mask = 0x00f00000;
605 phys_addr = 36; 607 phys_addr = 36;
606 608
@@ -619,7 +621,7 @@ void __init mtrr_bp_init(void)
619 boot_cpu_data.x86_mask == 0x4)) 621 boot_cpu_data.x86_mask == 0x4))
620 phys_addr = 36; 622 phys_addr = 36;
621 623
622 size_or_mask = ~((1ULL << (phys_addr - PAGE_SHIFT)) - 1); 624 size_or_mask = SIZE_OR_MASK_BITS(phys_addr);
623 size_and_mask = ~size_or_mask & 0xfffff00000ULL; 625 size_and_mask = ~size_or_mask & 0xfffff00000ULL;
624 } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR && 626 } else if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR &&
625 boot_cpu_data.x86 == 6) { 627 boot_cpu_data.x86 == 6) {
@@ -627,7 +629,7 @@ void __init mtrr_bp_init(void)
627 * VIA C* family have Intel style MTRRs, 629 * VIA C* family have Intel style MTRRs,
628 * but don't support PAE 630 * but don't support PAE
629 */ 631 */
630 size_or_mask = 0xfff00000; /* 32 bits */ 632 size_or_mask = SIZE_OR_MASK_BITS(32);
631 size_and_mask = 0; 633 size_and_mask = 0;
632 phys_addr = 32; 634 phys_addr = 32;
633 } 635 }
@@ -637,21 +639,21 @@ void __init mtrr_bp_init(void)
637 if (cpu_has_k6_mtrr) { 639 if (cpu_has_k6_mtrr) {
638 /* Pre-Athlon (K6) AMD CPU MTRRs */ 640 /* Pre-Athlon (K6) AMD CPU MTRRs */
639 mtrr_if = mtrr_ops[X86_VENDOR_AMD]; 641 mtrr_if = mtrr_ops[X86_VENDOR_AMD];
640 size_or_mask = 0xfff00000; /* 32 bits */ 642 size_or_mask = SIZE_OR_MASK_BITS(32);
641 size_and_mask = 0; 643 size_and_mask = 0;
642 } 644 }
643 break; 645 break;
644 case X86_VENDOR_CENTAUR: 646 case X86_VENDOR_CENTAUR:
645 if (cpu_has_centaur_mcr) { 647 if (cpu_has_centaur_mcr) {
646 mtrr_if = mtrr_ops[X86_VENDOR_CENTAUR]; 648 mtrr_if = mtrr_ops[X86_VENDOR_CENTAUR];
647 size_or_mask = 0xfff00000; /* 32 bits */ 649 size_or_mask = SIZE_OR_MASK_BITS(32);
648 size_and_mask = 0; 650 size_and_mask = 0;
649 } 651 }
650 break; 652 break;
651 case X86_VENDOR_CYRIX: 653 case X86_VENDOR_CYRIX:
652 if (cpu_has_cyrix_arr) { 654 if (cpu_has_cyrix_arr) {
653 mtrr_if = mtrr_ops[X86_VENDOR_CYRIX]; 655 mtrr_if = mtrr_ops[X86_VENDOR_CYRIX];
654 size_or_mask = 0xfff00000; /* 32 bits */ 656 size_or_mask = SIZE_OR_MASK_BITS(32);
655 size_and_mask = 0; 657 size_and_mask = 0;
656 } 658 }
657 break; 659 break;
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 1025f3c99d20..9e581c5cf6d0 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -403,7 +403,8 @@ int x86_pmu_hw_config(struct perf_event *event)
403 * check that PEBS LBR correction does not conflict with 403 * check that PEBS LBR correction does not conflict with
404 * whatever the user is asking with attr->branch_sample_type 404 * whatever the user is asking with attr->branch_sample_type
405 */ 405 */
406 if (event->attr.precise_ip > 1) { 406 if (event->attr.precise_ip > 1 &&
407 x86_pmu.intel_cap.pebs_format < 2) {
407 u64 *br_type = &event->attr.branch_sample_type; 408 u64 *br_type = &event->attr.branch_sample_type;
408 409
409 if (has_branch_stack(event)) { 410 if (has_branch_stack(event)) {
@@ -568,7 +569,7 @@ struct sched_state {
568struct perf_sched { 569struct perf_sched {
569 int max_weight; 570 int max_weight;
570 int max_events; 571 int max_events;
571 struct event_constraint **constraints; 572 struct perf_event **events;
572 struct sched_state state; 573 struct sched_state state;
573 int saved_states; 574 int saved_states;
574 struct sched_state saved[SCHED_STATES_MAX]; 575 struct sched_state saved[SCHED_STATES_MAX];
@@ -577,7 +578,7 @@ struct perf_sched {
577/* 578/*
578 * Initialize interator that runs through all events and counters. 579 * Initialize interator that runs through all events and counters.
579 */ 580 */
580static void perf_sched_init(struct perf_sched *sched, struct event_constraint **c, 581static void perf_sched_init(struct perf_sched *sched, struct perf_event **events,
581 int num, int wmin, int wmax) 582 int num, int wmin, int wmax)
582{ 583{
583 int idx; 584 int idx;
@@ -585,10 +586,10 @@ static void perf_sched_init(struct perf_sched *sched, struct event_constraint **
585 memset(sched, 0, sizeof(*sched)); 586 memset(sched, 0, sizeof(*sched));
586 sched->max_events = num; 587 sched->max_events = num;
587 sched->max_weight = wmax; 588 sched->max_weight = wmax;
588 sched->constraints = c; 589 sched->events = events;
589 590
590 for (idx = 0; idx < num; idx++) { 591 for (idx = 0; idx < num; idx++) {
591 if (c[idx]->weight == wmin) 592 if (events[idx]->hw.constraint->weight == wmin)
592 break; 593 break;
593 } 594 }
594 595
@@ -635,8 +636,7 @@ static bool __perf_sched_find_counter(struct perf_sched *sched)
635 if (sched->state.event >= sched->max_events) 636 if (sched->state.event >= sched->max_events)
636 return false; 637 return false;
637 638
638 c = sched->constraints[sched->state.event]; 639 c = sched->events[sched->state.event]->hw.constraint;
639
640 /* Prefer fixed purpose counters */ 640 /* Prefer fixed purpose counters */
641 if (c->idxmsk64 & (~0ULL << INTEL_PMC_IDX_FIXED)) { 641 if (c->idxmsk64 & (~0ULL << INTEL_PMC_IDX_FIXED)) {
642 idx = INTEL_PMC_IDX_FIXED; 642 idx = INTEL_PMC_IDX_FIXED;
@@ -694,7 +694,7 @@ static bool perf_sched_next_event(struct perf_sched *sched)
694 if (sched->state.weight > sched->max_weight) 694 if (sched->state.weight > sched->max_weight)
695 return false; 695 return false;
696 } 696 }
697 c = sched->constraints[sched->state.event]; 697 c = sched->events[sched->state.event]->hw.constraint;
698 } while (c->weight != sched->state.weight); 698 } while (c->weight != sched->state.weight);
699 699
700 sched->state.counter = 0; /* start with first counter */ 700 sched->state.counter = 0; /* start with first counter */
@@ -705,12 +705,12 @@ static bool perf_sched_next_event(struct perf_sched *sched)
705/* 705/*
706 * Assign a counter for each event. 706 * Assign a counter for each event.
707 */ 707 */
708int perf_assign_events(struct event_constraint **constraints, int n, 708int perf_assign_events(struct perf_event **events, int n,
709 int wmin, int wmax, int *assign) 709 int wmin, int wmax, int *assign)
710{ 710{
711 struct perf_sched sched; 711 struct perf_sched sched;
712 712
713 perf_sched_init(&sched, constraints, n, wmin, wmax); 713 perf_sched_init(&sched, events, n, wmin, wmax);
714 714
715 do { 715 do {
716 if (!perf_sched_find_counter(&sched)) 716 if (!perf_sched_find_counter(&sched))
@@ -724,16 +724,19 @@ int perf_assign_events(struct event_constraint **constraints, int n,
724 724
725int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) 725int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
726{ 726{
727 struct event_constraint *c, *constraints[X86_PMC_IDX_MAX]; 727 struct event_constraint *c;
728 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 728 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
729 struct perf_event *e;
729 int i, wmin, wmax, num = 0; 730 int i, wmin, wmax, num = 0;
730 struct hw_perf_event *hwc; 731 struct hw_perf_event *hwc;
731 732
732 bitmap_zero(used_mask, X86_PMC_IDX_MAX); 733 bitmap_zero(used_mask, X86_PMC_IDX_MAX);
733 734
734 for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) { 735 for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) {
736 hwc = &cpuc->event_list[i]->hw;
735 c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]); 737 c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
736 constraints[i] = c; 738 hwc->constraint = c;
739
737 wmin = min(wmin, c->weight); 740 wmin = min(wmin, c->weight);
738 wmax = max(wmax, c->weight); 741 wmax = max(wmax, c->weight);
739 } 742 }
@@ -743,7 +746,7 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
743 */ 746 */
744 for (i = 0; i < n; i++) { 747 for (i = 0; i < n; i++) {
745 hwc = &cpuc->event_list[i]->hw; 748 hwc = &cpuc->event_list[i]->hw;
746 c = constraints[i]; 749 c = hwc->constraint;
747 750
748 /* never assigned */ 751 /* never assigned */
749 if (hwc->idx == -1) 752 if (hwc->idx == -1)
@@ -764,16 +767,35 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
764 767
765 /* slow path */ 768 /* slow path */
766 if (i != n) 769 if (i != n)
767 num = perf_assign_events(constraints, n, wmin, wmax, assign); 770 num = perf_assign_events(cpuc->event_list, n, wmin,
771 wmax, assign);
768 772
769 /* 773 /*
774 * Mark the event as committed, so we do not put_constraint()
775 * in case new events are added and fail scheduling.
776 */
777 if (!num && assign) {
778 for (i = 0; i < n; i++) {
779 e = cpuc->event_list[i];
780 e->hw.flags |= PERF_X86_EVENT_COMMITTED;
781 }
782 }
783 /*
770 * scheduling failed or is just a simulation, 784 * scheduling failed or is just a simulation,
771 * free resources if necessary 785 * free resources if necessary
772 */ 786 */
773 if (!assign || num) { 787 if (!assign || num) {
774 for (i = 0; i < n; i++) { 788 for (i = 0; i < n; i++) {
789 e = cpuc->event_list[i];
790 /*
791 * do not put_constraint() on comitted events,
792 * because they are good to go
793 */
794 if ((e->hw.flags & PERF_X86_EVENT_COMMITTED))
795 continue;
796
775 if (x86_pmu.put_event_constraints) 797 if (x86_pmu.put_event_constraints)
776 x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); 798 x86_pmu.put_event_constraints(cpuc, e);
777 } 799 }
778 } 800 }
779 return num ? -EINVAL : 0; 801 return num ? -EINVAL : 0;
@@ -1153,6 +1175,11 @@ static void x86_pmu_del(struct perf_event *event, int flags)
1153 int i; 1175 int i;
1154 1176
1155 /* 1177 /*
1178 * event is descheduled
1179 */
1180 event->hw.flags &= ~PERF_X86_EVENT_COMMITTED;
1181
1182 /*
1156 * If we're called during a txn, we don't need to do anything. 1183 * If we're called during a txn, we don't need to do anything.
1157 * The events never got scheduled and ->cancel_txn will truncate 1184 * The events never got scheduled and ->cancel_txn will truncate
1158 * the event_list. 1185 * the event_list.
@@ -1249,10 +1276,20 @@ void perf_events_lapic_init(void)
1249static int __kprobes 1276static int __kprobes
1250perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs) 1277perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
1251{ 1278{
1279 int ret;
1280 u64 start_clock;
1281 u64 finish_clock;
1282
1252 if (!atomic_read(&active_events)) 1283 if (!atomic_read(&active_events))
1253 return NMI_DONE; 1284 return NMI_DONE;
1254 1285
1255 return x86_pmu.handle_irq(regs); 1286 start_clock = local_clock();
1287 ret = x86_pmu.handle_irq(regs);
1288 finish_clock = local_clock();
1289
1290 perf_sample_event_took(finish_clock - start_clock);
1291
1292 return ret;
1256} 1293}
1257 1294
1258struct event_constraint emptyconstraint; 1295struct event_constraint emptyconstraint;
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index ba9aadfa683b..97e557bc4c91 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -63,10 +63,12 @@ struct event_constraint {
63 int flags; 63 int flags;
64}; 64};
65/* 65/*
66 * struct event_constraint flags 66 * struct hw_perf_event.flags flags
67 */ 67 */
68#define PERF_X86_EVENT_PEBS_LDLAT 0x1 /* ld+ldlat data address sampling */ 68#define PERF_X86_EVENT_PEBS_LDLAT 0x1 /* ld+ldlat data address sampling */
69#define PERF_X86_EVENT_PEBS_ST 0x2 /* st data address sampling */ 69#define PERF_X86_EVENT_PEBS_ST 0x2 /* st data address sampling */
70#define PERF_X86_EVENT_PEBS_ST_HSW 0x4 /* haswell style st data sampling */
71#define PERF_X86_EVENT_COMMITTED 0x8 /* event passed commit_txn */
70 72
71struct amd_nb { 73struct amd_nb {
72 int nb_id; /* NorthBridge id */ 74 int nb_id; /* NorthBridge id */
@@ -227,11 +229,14 @@ struct cpu_hw_events {
227 * - inv 229 * - inv
228 * - edge 230 * - edge
229 * - cnt-mask 231 * - cnt-mask
232 * - in_tx
233 * - in_tx_checkpointed
230 * The other filters are supported by fixed counters. 234 * The other filters are supported by fixed counters.
231 * The any-thread option is supported starting with v3. 235 * The any-thread option is supported starting with v3.
232 */ 236 */
237#define FIXED_EVENT_FLAGS (X86_RAW_EVENT_MASK|HSW_IN_TX|HSW_IN_TX_CHECKPOINTED)
233#define FIXED_EVENT_CONSTRAINT(c, n) \ 238#define FIXED_EVENT_CONSTRAINT(c, n) \
234 EVENT_CONSTRAINT(c, (1ULL << (32+n)), X86_RAW_EVENT_MASK) 239 EVENT_CONSTRAINT(c, (1ULL << (32+n)), FIXED_EVENT_FLAGS)
235 240
236/* 241/*
237 * Constraint on the Event code + UMask 242 * Constraint on the Event code + UMask
@@ -247,6 +252,11 @@ struct cpu_hw_events {
247 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \ 252 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
248 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST) 253 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST)
249 254
255/* DataLA version of store sampling without extra enable bit. */
256#define INTEL_PST_HSW_CONSTRAINT(c, n) \
257 __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
258 HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST_HSW)
259
250#define EVENT_CONSTRAINT_END \ 260#define EVENT_CONSTRAINT_END \
251 EVENT_CONSTRAINT(0, 0, 0) 261 EVENT_CONSTRAINT(0, 0, 0)
252 262
@@ -301,6 +311,11 @@ union perf_capabilities {
301 u64 pebs_arch_reg:1; 311 u64 pebs_arch_reg:1;
302 u64 pebs_format:4; 312 u64 pebs_format:4;
303 u64 smm_freeze:1; 313 u64 smm_freeze:1;
314 /*
315 * PMU supports separate counter range for writing
316 * values > 32bit.
317 */
318 u64 full_width_write:1;
304 }; 319 };
305 u64 capabilities; 320 u64 capabilities;
306}; 321};
@@ -375,6 +390,7 @@ struct x86_pmu {
375 struct event_constraint *event_constraints; 390 struct event_constraint *event_constraints;
376 struct x86_pmu_quirk *quirks; 391 struct x86_pmu_quirk *quirks;
377 int perfctr_second_write; 392 int perfctr_second_write;
393 bool late_ack;
378 394
379 /* 395 /*
380 * sysfs attrs 396 * sysfs attrs
@@ -528,7 +544,7 @@ static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
528 544
529void x86_pmu_enable_all(int added); 545void x86_pmu_enable_all(int added);
530 546
531int perf_assign_events(struct event_constraint **constraints, int n, 547int perf_assign_events(struct perf_event **events, int n,
532 int wmin, int wmax, int *assign); 548 int wmin, int wmax, int *assign);
533int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign); 549int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign);
534 550
@@ -633,6 +649,8 @@ extern struct event_constraint intel_snb_pebs_event_constraints[];
633 649
634extern struct event_constraint intel_ivb_pebs_event_constraints[]; 650extern struct event_constraint intel_ivb_pebs_event_constraints[];
635 651
652extern struct event_constraint intel_hsw_pebs_event_constraints[];
653
636struct event_constraint *intel_pebs_constraints(struct perf_event *event); 654struct event_constraint *intel_pebs_constraints(struct perf_event *event);
637 655
638void intel_pmu_pebs_enable(struct perf_event *event); 656void intel_pmu_pebs_enable(struct perf_event *event);
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 7e28d9467bb4..4cbe03287b08 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -648,48 +648,48 @@ static __initconst const struct x86_pmu amd_pmu = {
648 .cpu_dead = amd_pmu_cpu_dead, 648 .cpu_dead = amd_pmu_cpu_dead,
649}; 649};
650 650
651static int setup_event_constraints(void) 651static int __init amd_core_pmu_init(void)
652{ 652{
653 if (boot_cpu_data.x86 == 0x15) 653 if (!cpu_has_perfctr_core)
654 return 0;
655
656 switch (boot_cpu_data.x86) {
657 case 0x15:
658 pr_cont("Fam15h ");
654 x86_pmu.get_event_constraints = amd_get_event_constraints_f15h; 659 x86_pmu.get_event_constraints = amd_get_event_constraints_f15h;
655 return 0; 660 break;
656}
657 661
658static int setup_perfctr_core(void) 662 default:
659{ 663 pr_err("core perfctr but no constraints; unknown hardware!\n");
660 if (!cpu_has_perfctr_core) {
661 WARN(x86_pmu.get_event_constraints == amd_get_event_constraints_f15h,
662 KERN_ERR "Odd, counter constraints enabled but no core perfctrs detected!");
663 return -ENODEV; 664 return -ENODEV;
664 } 665 }
665 666
666 WARN(x86_pmu.get_event_constraints == amd_get_event_constraints,
667 KERN_ERR "hw perf events core counters need constraints handler!");
668
669 /* 667 /*
670 * If core performance counter extensions exists, we must use 668 * If core performance counter extensions exists, we must use
671 * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also 669 * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also
672 * x86_pmu_addr_offset(). 670 * amd_pmu_addr_offset().
673 */ 671 */
674 x86_pmu.eventsel = MSR_F15H_PERF_CTL; 672 x86_pmu.eventsel = MSR_F15H_PERF_CTL;
675 x86_pmu.perfctr = MSR_F15H_PERF_CTR; 673 x86_pmu.perfctr = MSR_F15H_PERF_CTR;
676 x86_pmu.num_counters = AMD64_NUM_COUNTERS_CORE; 674 x86_pmu.num_counters = AMD64_NUM_COUNTERS_CORE;
677 675
678 printk(KERN_INFO "perf: AMD core performance counters detected\n"); 676 pr_cont("core perfctr, ");
679
680 return 0; 677 return 0;
681} 678}
682 679
683__init int amd_pmu_init(void) 680__init int amd_pmu_init(void)
684{ 681{
682 int ret;
683
685 /* Performance-monitoring supported from K7 and later: */ 684 /* Performance-monitoring supported from K7 and later: */
686 if (boot_cpu_data.x86 < 6) 685 if (boot_cpu_data.x86 < 6)
687 return -ENODEV; 686 return -ENODEV;
688 687
689 x86_pmu = amd_pmu; 688 x86_pmu = amd_pmu;
690 689
691 setup_event_constraints(); 690 ret = amd_core_pmu_init();
692 setup_perfctr_core(); 691 if (ret)
692 return ret;
693 693
694 /* Events are common for all AMDs */ 694 /* Events are common for all AMDs */
695 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, 695 memcpy(hw_cache_event_ids, amd_hw_cache_event_ids,
diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
new file mode 100644
index 000000000000..0db655ef3918
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -0,0 +1,504 @@
1/*
2 * Copyright (C) 2013 Advanced Micro Devices, Inc.
3 *
4 * Author: Steven Kinney <Steven.Kinney@amd.com>
5 * Author: Suravee Suthikulpanit <Suraveee.Suthikulpanit@amd.com>
6 *
7 * Perf: amd_iommu - AMD IOMMU Performance Counter PMU implementation
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/perf_event.h>
15#include <linux/module.h>
16#include <linux/cpumask.h>
17#include <linux/slab.h>
18
19#include "perf_event.h"
20#include "perf_event_amd_iommu.h"
21
22#define COUNTER_SHIFT 16
23
24#define _GET_BANK(ev) ((u8)(ev->hw.extra_reg.reg >> 8))
25#define _GET_CNTR(ev) ((u8)(ev->hw.extra_reg.reg))
26
27/* iommu pmu config masks */
28#define _GET_CSOURCE(ev) ((ev->hw.config & 0xFFULL))
29#define _GET_DEVID(ev) ((ev->hw.config >> 8) & 0xFFFFULL)
30#define _GET_PASID(ev) ((ev->hw.config >> 24) & 0xFFFFULL)
31#define _GET_DOMID(ev) ((ev->hw.config >> 40) & 0xFFFFULL)
32#define _GET_DEVID_MASK(ev) ((ev->hw.extra_reg.config) & 0xFFFFULL)
33#define _GET_PASID_MASK(ev) ((ev->hw.extra_reg.config >> 16) & 0xFFFFULL)
34#define _GET_DOMID_MASK(ev) ((ev->hw.extra_reg.config >> 32) & 0xFFFFULL)
35
36static struct perf_amd_iommu __perf_iommu;
37
38struct perf_amd_iommu {
39 struct pmu pmu;
40 u8 max_banks;
41 u8 max_counters;
42 u64 cntr_assign_mask;
43 raw_spinlock_t lock;
44 const struct attribute_group *attr_groups[4];
45};
46
47#define format_group attr_groups[0]
48#define cpumask_group attr_groups[1]
49#define events_group attr_groups[2]
50#define null_group attr_groups[3]
51
52/*---------------------------------------------
53 * sysfs format attributes
54 *---------------------------------------------*/
55PMU_FORMAT_ATTR(csource, "config:0-7");
56PMU_FORMAT_ATTR(devid, "config:8-23");
57PMU_FORMAT_ATTR(pasid, "config:24-39");
58PMU_FORMAT_ATTR(domid, "config:40-55");
59PMU_FORMAT_ATTR(devid_mask, "config1:0-15");
60PMU_FORMAT_ATTR(pasid_mask, "config1:16-31");
61PMU_FORMAT_ATTR(domid_mask, "config1:32-47");
62
63static struct attribute *iommu_format_attrs[] = {
64 &format_attr_csource.attr,
65 &format_attr_devid.attr,
66 &format_attr_pasid.attr,
67 &format_attr_domid.attr,
68 &format_attr_devid_mask.attr,
69 &format_attr_pasid_mask.attr,
70 &format_attr_domid_mask.attr,
71 NULL,
72};
73
74static struct attribute_group amd_iommu_format_group = {
75 .name = "format",
76 .attrs = iommu_format_attrs,
77};
78
79/*---------------------------------------------
80 * sysfs events attributes
81 *---------------------------------------------*/
82struct amd_iommu_event_desc {
83 struct kobj_attribute attr;
84 const char *event;
85};
86
87static ssize_t _iommu_event_show(struct kobject *kobj,
88 struct kobj_attribute *attr, char *buf)
89{
90 struct amd_iommu_event_desc *event =
91 container_of(attr, struct amd_iommu_event_desc, attr);
92 return sprintf(buf, "%s\n", event->event);
93}
94
95#define AMD_IOMMU_EVENT_DESC(_name, _event) \
96{ \
97 .attr = __ATTR(_name, 0444, _iommu_event_show, NULL), \
98 .event = _event, \
99}
100
101static struct amd_iommu_event_desc amd_iommu_v2_event_descs[] = {
102 AMD_IOMMU_EVENT_DESC(mem_pass_untrans, "csource=0x01"),
103 AMD_IOMMU_EVENT_DESC(mem_pass_pretrans, "csource=0x02"),
104 AMD_IOMMU_EVENT_DESC(mem_pass_excl, "csource=0x03"),
105 AMD_IOMMU_EVENT_DESC(mem_target_abort, "csource=0x04"),
106 AMD_IOMMU_EVENT_DESC(mem_trans_total, "csource=0x05"),
107 AMD_IOMMU_EVENT_DESC(mem_iommu_tlb_pte_hit, "csource=0x06"),
108 AMD_IOMMU_EVENT_DESC(mem_iommu_tlb_pte_mis, "csource=0x07"),
109 AMD_IOMMU_EVENT_DESC(mem_iommu_tlb_pde_hit, "csource=0x08"),
110 AMD_IOMMU_EVENT_DESC(mem_iommu_tlb_pde_mis, "csource=0x09"),
111 AMD_IOMMU_EVENT_DESC(mem_dte_hit, "csource=0x0a"),
112 AMD_IOMMU_EVENT_DESC(mem_dte_mis, "csource=0x0b"),
113 AMD_IOMMU_EVENT_DESC(page_tbl_read_tot, "csource=0x0c"),
114 AMD_IOMMU_EVENT_DESC(page_tbl_read_nst, "csource=0x0d"),
115 AMD_IOMMU_EVENT_DESC(page_tbl_read_gst, "csource=0x0e"),
116 AMD_IOMMU_EVENT_DESC(int_dte_hit, "csource=0x0f"),
117 AMD_IOMMU_EVENT_DESC(int_dte_mis, "csource=0x10"),
118 AMD_IOMMU_EVENT_DESC(cmd_processed, "csource=0x11"),
119 AMD_IOMMU_EVENT_DESC(cmd_processed_inv, "csource=0x12"),
120 AMD_IOMMU_EVENT_DESC(tlb_inv, "csource=0x13"),
121 { /* end: all zeroes */ },
122};
123
124/*---------------------------------------------
125 * sysfs cpumask attributes
126 *---------------------------------------------*/
127static cpumask_t iommu_cpumask;
128
129static ssize_t _iommu_cpumask_show(struct device *dev,
130 struct device_attribute *attr,
131 char *buf)
132{
133 int n = cpulist_scnprintf(buf, PAGE_SIZE - 2, &iommu_cpumask);
134 buf[n++] = '\n';
135 buf[n] = '\0';
136 return n;
137}
138static DEVICE_ATTR(cpumask, S_IRUGO, _iommu_cpumask_show, NULL);
139
140static struct attribute *iommu_cpumask_attrs[] = {
141 &dev_attr_cpumask.attr,
142 NULL,
143};
144
145static struct attribute_group amd_iommu_cpumask_group = {
146 .attrs = iommu_cpumask_attrs,
147};
148
149/*---------------------------------------------*/
150
151static int get_next_avail_iommu_bnk_cntr(struct perf_amd_iommu *perf_iommu)
152{
153 unsigned long flags;
154 int shift, bank, cntr, retval;
155 int max_banks = perf_iommu->max_banks;
156 int max_cntrs = perf_iommu->max_counters;
157
158 raw_spin_lock_irqsave(&perf_iommu->lock, flags);
159
160 for (bank = 0, shift = 0; bank < max_banks; bank++) {
161 for (cntr = 0; cntr < max_cntrs; cntr++) {
162 shift = bank + (bank*3) + cntr;
163 if (perf_iommu->cntr_assign_mask & (1ULL<<shift)) {
164 continue;
165 } else {
166 perf_iommu->cntr_assign_mask |= (1ULL<<shift);
167 retval = ((u16)((u16)bank<<8) | (u8)(cntr));
168 goto out;
169 }
170 }
171 }
172 retval = -ENOSPC;
173out:
174 raw_spin_unlock_irqrestore(&perf_iommu->lock, flags);
175 return retval;
176}
177
178static int clear_avail_iommu_bnk_cntr(struct perf_amd_iommu *perf_iommu,
179 u8 bank, u8 cntr)
180{
181 unsigned long flags;
182 int max_banks, max_cntrs;
183 int shift = 0;
184
185 max_banks = perf_iommu->max_banks;
186 max_cntrs = perf_iommu->max_counters;
187
188 if ((bank > max_banks) || (cntr > max_cntrs))
189 return -EINVAL;
190
191 shift = bank + cntr + (bank*3);
192
193 raw_spin_lock_irqsave(&perf_iommu->lock, flags);
194 perf_iommu->cntr_assign_mask &= ~(1ULL<<shift);
195 raw_spin_unlock_irqrestore(&perf_iommu->lock, flags);
196
197 return 0;
198}
199
200static int perf_iommu_event_init(struct perf_event *event)
201{
202 struct hw_perf_event *hwc = &event->hw;
203 struct perf_amd_iommu *perf_iommu;
204 u64 config, config1;
205
206 /* test the event attr type check for PMU enumeration */
207 if (event->attr.type != event->pmu->type)
208 return -ENOENT;
209
210 /*
211 * IOMMU counters are shared across all cores.
212 * Therefore, it does not support per-process mode.
213 * Also, it does not support event sampling mode.
214 */
215 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
216 return -EINVAL;
217
218 /* IOMMU counters do not have usr/os/guest/host bits */
219 if (event->attr.exclude_user || event->attr.exclude_kernel ||
220 event->attr.exclude_host || event->attr.exclude_guest)
221 return -EINVAL;
222
223 if (event->cpu < 0)
224 return -EINVAL;
225
226 perf_iommu = &__perf_iommu;
227
228 if (event->pmu != &perf_iommu->pmu)
229 return -ENOENT;
230
231 if (perf_iommu) {
232 config = event->attr.config;
233 config1 = event->attr.config1;
234 } else {
235 return -EINVAL;
236 }
237
238 /* integrate with iommu base devid (0000), assume one iommu */
239 perf_iommu->max_banks =
240 amd_iommu_pc_get_max_banks(IOMMU_BASE_DEVID);
241 perf_iommu->max_counters =
242 amd_iommu_pc_get_max_counters(IOMMU_BASE_DEVID);
243 if ((perf_iommu->max_banks == 0) || (perf_iommu->max_counters == 0))
244 return -EINVAL;
245
246 /* update the hw_perf_event struct with the iommu config data */
247 hwc->config = config;
248 hwc->extra_reg.config = config1;
249
250 return 0;
251}
252
253static void perf_iommu_enable_event(struct perf_event *ev)
254{
255 u8 csource = _GET_CSOURCE(ev);
256 u16 devid = _GET_DEVID(ev);
257 u64 reg = 0ULL;
258
259 reg = csource;
260 amd_iommu_pc_get_set_reg_val(devid,
261 _GET_BANK(ev), _GET_CNTR(ev) ,
262 IOMMU_PC_COUNTER_SRC_REG, &reg, true);
263
264 reg = 0ULL | devid | (_GET_DEVID_MASK(ev) << 32);
265 if (reg)
266 reg |= (1UL << 31);
267 amd_iommu_pc_get_set_reg_val(devid,
268 _GET_BANK(ev), _GET_CNTR(ev) ,
269 IOMMU_PC_DEVID_MATCH_REG, &reg, true);
270
271 reg = 0ULL | _GET_PASID(ev) | (_GET_PASID_MASK(ev) << 32);
272 if (reg)
273 reg |= (1UL << 31);
274 amd_iommu_pc_get_set_reg_val(devid,
275 _GET_BANK(ev), _GET_CNTR(ev) ,
276 IOMMU_PC_PASID_MATCH_REG, &reg, true);
277
278 reg = 0ULL | _GET_DOMID(ev) | (_GET_DOMID_MASK(ev) << 32);
279 if (reg)
280 reg |= (1UL << 31);
281 amd_iommu_pc_get_set_reg_val(devid,
282 _GET_BANK(ev), _GET_CNTR(ev) ,
283 IOMMU_PC_DOMID_MATCH_REG, &reg, true);
284}
285
286static void perf_iommu_disable_event(struct perf_event *event)
287{
288 u64 reg = 0ULL;
289
290 amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
291 _GET_BANK(event), _GET_CNTR(event),
292 IOMMU_PC_COUNTER_SRC_REG, &reg, true);
293}
294
295static void perf_iommu_start(struct perf_event *event, int flags)
296{
297 struct hw_perf_event *hwc = &event->hw;
298
299 pr_debug("perf: amd_iommu:perf_iommu_start\n");
300 if (WARN_ON_ONCE(!(hwc->state & PERF_HES_STOPPED)))
301 return;
302
303 WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE));
304 hwc->state = 0;
305
306 if (flags & PERF_EF_RELOAD) {
307 u64 prev_raw_count = local64_read(&hwc->prev_count);
308 amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
309 _GET_BANK(event), _GET_CNTR(event),
310 IOMMU_PC_COUNTER_REG, &prev_raw_count, true);
311 }
312
313 perf_iommu_enable_event(event);
314 perf_event_update_userpage(event);
315
316}
317
318static void perf_iommu_read(struct perf_event *event)
319{
320 u64 count = 0ULL;
321 u64 prev_raw_count = 0ULL;
322 u64 delta = 0ULL;
323 struct hw_perf_event *hwc = &event->hw;
324 pr_debug("perf: amd_iommu:perf_iommu_read\n");
325
326 amd_iommu_pc_get_set_reg_val(_GET_DEVID(event),
327 _GET_BANK(event), _GET_CNTR(event),
328 IOMMU_PC_COUNTER_REG, &count, false);
329
330 /* IOMMU pc counter register is only 48 bits */
331 count &= 0xFFFFFFFFFFFFULL;
332
333 prev_raw_count = local64_read(&hwc->prev_count);
334 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
335 count) != prev_raw_count)
336 return;
337
338 /* Handling 48-bit counter overflowing */
339 delta = (count << COUNTER_SHIFT) - (prev_raw_count << COUNTER_SHIFT);
340 delta >>= COUNTER_SHIFT;
341 local64_add(delta, &event->count);
342
343}
344
345static void perf_iommu_stop(struct perf_event *event, int flags)
346{
347 struct hw_perf_event *hwc = &event->hw;
348 u64 config;
349
350 pr_debug("perf: amd_iommu:perf_iommu_stop\n");
351
352 if (hwc->state & PERF_HES_UPTODATE)
353 return;
354
355 perf_iommu_disable_event(event);
356 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
357 hwc->state |= PERF_HES_STOPPED;
358
359 if (hwc->state & PERF_HES_UPTODATE)
360 return;
361
362 config = hwc->config;
363 perf_iommu_read(event);
364 hwc->state |= PERF_HES_UPTODATE;
365}
366
367static int perf_iommu_add(struct perf_event *event, int flags)
368{
369 int retval;
370 struct perf_amd_iommu *perf_iommu =
371 container_of(event->pmu, struct perf_amd_iommu, pmu);
372
373 pr_debug("perf: amd_iommu:perf_iommu_add\n");
374 event->hw.state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
375
376 /* request an iommu bank/counter */
377 retval = get_next_avail_iommu_bnk_cntr(perf_iommu);
378 if (retval != -ENOSPC)
379 event->hw.extra_reg.reg = (u16)retval;
380 else
381 return retval;
382
383 if (flags & PERF_EF_START)
384 perf_iommu_start(event, PERF_EF_RELOAD);
385
386 return 0;
387}
388
389static void perf_iommu_del(struct perf_event *event, int flags)
390{
391 struct perf_amd_iommu *perf_iommu =
392 container_of(event->pmu, struct perf_amd_iommu, pmu);
393
394 pr_debug("perf: amd_iommu:perf_iommu_del\n");
395 perf_iommu_stop(event, PERF_EF_UPDATE);
396
397 /* clear the assigned iommu bank/counter */
398 clear_avail_iommu_bnk_cntr(perf_iommu,
399 _GET_BANK(event),
400 _GET_CNTR(event));
401
402 perf_event_update_userpage(event);
403}
404
405static __init int _init_events_attrs(struct perf_amd_iommu *perf_iommu)
406{
407 struct attribute **attrs;
408 struct attribute_group *attr_group;
409 int i = 0, j;
410
411 while (amd_iommu_v2_event_descs[i].attr.attr.name)
412 i++;
413
414 attr_group = kzalloc(sizeof(struct attribute *)
415 * (i + 1) + sizeof(*attr_group), GFP_KERNEL);
416 if (!attr_group)
417 return -ENOMEM;
418
419 attrs = (struct attribute **)(attr_group + 1);
420 for (j = 0; j < i; j++)
421 attrs[j] = &amd_iommu_v2_event_descs[j].attr.attr;
422
423 attr_group->name = "events";
424 attr_group->attrs = attrs;
425 perf_iommu->events_group = attr_group;
426
427 return 0;
428}
429
430static __init void amd_iommu_pc_exit(void)
431{
432 if (__perf_iommu.events_group != NULL) {
433 kfree(__perf_iommu.events_group);
434 __perf_iommu.events_group = NULL;
435 }
436}
437
438static __init int _init_perf_amd_iommu(
439 struct perf_amd_iommu *perf_iommu, char *name)
440{
441 int ret;
442
443 raw_spin_lock_init(&perf_iommu->lock);
444
445 /* Init format attributes */
446 perf_iommu->format_group = &amd_iommu_format_group;
447
448 /* Init cpumask attributes to only core 0 */
449 cpumask_set_cpu(0, &iommu_cpumask);
450 perf_iommu->cpumask_group = &amd_iommu_cpumask_group;
451
452 /* Init events attributes */
453 if (_init_events_attrs(perf_iommu) != 0)
454 pr_err("perf: amd_iommu: Only support raw events.\n");
455
456 /* Init null attributes */
457 perf_iommu->null_group = NULL;
458 perf_iommu->pmu.attr_groups = perf_iommu->attr_groups;
459
460 ret = perf_pmu_register(&perf_iommu->pmu, name, -1);
461 if (ret) {
462 pr_err("perf: amd_iommu: Failed to initialized.\n");
463 amd_iommu_pc_exit();
464 } else {
465 pr_info("perf: amd_iommu: Detected. (%d banks, %d counters/bank)\n",
466 amd_iommu_pc_get_max_banks(IOMMU_BASE_DEVID),
467 amd_iommu_pc_get_max_counters(IOMMU_BASE_DEVID));
468 }
469
470 return ret;
471}
472
473static struct perf_amd_iommu __perf_iommu = {
474 .pmu = {
475 .event_init = perf_iommu_event_init,
476 .add = perf_iommu_add,
477 .del = perf_iommu_del,
478 .start = perf_iommu_start,
479 .stop = perf_iommu_stop,
480 .read = perf_iommu_read,
481 },
482 .max_banks = 0x00,
483 .max_counters = 0x00,
484 .cntr_assign_mask = 0ULL,
485 .format_group = NULL,
486 .cpumask_group = NULL,
487 .events_group = NULL,
488 .null_group = NULL,
489};
490
491static __init int amd_iommu_pc_init(void)
492{
493 /* Make sure the IOMMU PC resource is available */
494 if (!amd_iommu_pc_supported()) {
495 pr_err("perf: amd_iommu PMU not installed. No support!\n");
496 return -ENODEV;
497 }
498
499 _init_perf_amd_iommu(&__perf_iommu, "amd_iommu");
500
501 return 0;
502}
503
504device_initcall(amd_iommu_pc_init);
diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.h b/arch/x86/kernel/cpu/perf_event_amd_iommu.h
new file mode 100644
index 000000000000..845d173278e3
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.h
@@ -0,0 +1,40 @@
1/*
2 * Copyright (C) 2013 Advanced Micro Devices, Inc.
3 *
4 * Author: Steven Kinney <Steven.Kinney@amd.com>
5 * Author: Suravee Suthikulpanit <Suraveee.Suthikulpanit@amd.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _PERF_EVENT_AMD_IOMMU_H_
13#define _PERF_EVENT_AMD_IOMMU_H_
14
15/* iommu pc mmio region register indexes */
16#define IOMMU_PC_COUNTER_REG 0x00
17#define IOMMU_PC_COUNTER_SRC_REG 0x08
18#define IOMMU_PC_PASID_MATCH_REG 0x10
19#define IOMMU_PC_DOMID_MATCH_REG 0x18
20#define IOMMU_PC_DEVID_MATCH_REG 0x20
21#define IOMMU_PC_COUNTER_REPORT_REG 0x28
22
23/* maximun specified bank/counters */
24#define PC_MAX_SPEC_BNKS 64
25#define PC_MAX_SPEC_CNTRS 16
26
27/* iommu pc reg masks*/
28#define IOMMU_BASE_DEVID 0x0000
29
30/* amd_iommu_init.c external support functions */
31extern bool amd_iommu_pc_supported(void);
32
33extern u8 amd_iommu_pc_get_max_banks(u16 devid);
34
35extern u8 amd_iommu_pc_get_max_counters(u16 devid);
36
37extern int amd_iommu_pc_get_set_reg_val(u16 devid, u8 bank, u8 cntr,
38 u8 fxn, u64 *value, bool is_write);
39
40#endif /*_PERF_EVENT_AMD_IOMMU_H_*/
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index f60d41ff9a97..fbc9210b45bc 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -13,6 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/export.h> 14#include <linux/export.h>
15 15
16#include <asm/cpufeature.h>
16#include <asm/hardirq.h> 17#include <asm/hardirq.h>
17#include <asm/apic.h> 18#include <asm/apic.h>
18 19
@@ -165,13 +166,13 @@ static struct extra_reg intel_snb_extra_regs[] __read_mostly = {
165 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0), 166 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3f807f8fffull, RSP_0),
166 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1), 167 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3f807f8fffull, RSP_1),
167 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), 168 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
168 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
169 EVENT_EXTRA_END 169 EVENT_EXTRA_END
170}; 170};
171 171
172static struct extra_reg intel_snbep_extra_regs[] __read_mostly = { 172static struct extra_reg intel_snbep_extra_regs[] __read_mostly = {
173 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0), 173 INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0x3fffff8fffull, RSP_0),
174 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1), 174 INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0x3fffff8fffull, RSP_1),
175 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
175 EVENT_EXTRA_END 176 EVENT_EXTRA_END
176}; 177};
177 178
@@ -190,6 +191,22 @@ struct attribute *snb_events_attrs[] = {
190 NULL, 191 NULL,
191}; 192};
192 193
194static struct event_constraint intel_hsw_event_constraints[] = {
195 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
196 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
197 FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */
198 INTEL_EVENT_CONSTRAINT(0x48, 0x4), /* L1D_PEND_MISS.* */
199 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */
200 INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */
201 /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */
202 INTEL_EVENT_CONSTRAINT(0x08a3, 0x4),
203 /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */
204 INTEL_EVENT_CONSTRAINT(0x0ca3, 0x4),
205 /* CYCLE_ACTIVITY.CYCLES_NO_EXECUTE */
206 INTEL_EVENT_CONSTRAINT(0x04a3, 0xf),
207 EVENT_CONSTRAINT_END
208};
209
193static u64 intel_pmu_event_map(int hw_event) 210static u64 intel_pmu_event_map(int hw_event)
194{ 211{
195 return intel_perfmon_event_map[hw_event]; 212 return intel_perfmon_event_map[hw_event];
@@ -872,7 +889,8 @@ static inline bool intel_pmu_needs_lbr_smpl(struct perf_event *event)
872 return true; 889 return true;
873 890
874 /* implicit branch sampling to correct PEBS skid */ 891 /* implicit branch sampling to correct PEBS skid */
875 if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1) 892 if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1 &&
893 x86_pmu.intel_cap.pebs_format < 2)
876 return true; 894 return true;
877 895
878 return false; 896 return false;
@@ -1167,15 +1185,11 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
1167 cpuc = &__get_cpu_var(cpu_hw_events); 1185 cpuc = &__get_cpu_var(cpu_hw_events);
1168 1186
1169 /* 1187 /*
1170 * Some chipsets need to unmask the LVTPC in a particular spot 1188 * No known reason to not always do late ACK,
1171 * inside the nmi handler. As a result, the unmasking was pushed 1189 * but just in case do it opt-in.
1172 * into all the nmi handlers.
1173 *
1174 * This handler doesn't seem to have any issues with the unmasking
1175 * so it was left at the top.
1176 */ 1190 */
1177 apic_write(APIC_LVTPC, APIC_DM_NMI); 1191 if (!x86_pmu.late_ack)
1178 1192 apic_write(APIC_LVTPC, APIC_DM_NMI);
1179 intel_pmu_disable_all(); 1193 intel_pmu_disable_all();
1180 handled = intel_pmu_drain_bts_buffer(); 1194 handled = intel_pmu_drain_bts_buffer();
1181 status = intel_pmu_get_status(); 1195 status = intel_pmu_get_status();
@@ -1188,8 +1202,12 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
1188again: 1202again:
1189 intel_pmu_ack_status(status); 1203 intel_pmu_ack_status(status);
1190 if (++loops > 100) { 1204 if (++loops > 100) {
1191 WARN_ONCE(1, "perfevents: irq loop stuck!\n"); 1205 static bool warned = false;
1192 perf_event_print_debug(); 1206 if (!warned) {
1207 WARN(1, "perfevents: irq loop stuck!\n");
1208 perf_event_print_debug();
1209 warned = true;
1210 }
1193 intel_pmu_reset(); 1211 intel_pmu_reset();
1194 goto done; 1212 goto done;
1195 } 1213 }
@@ -1235,6 +1253,13 @@ again:
1235 1253
1236done: 1254done:
1237 intel_pmu_enable_all(0); 1255 intel_pmu_enable_all(0);
1256 /*
1257 * Only unmask the NMI after the overflow counters
1258 * have been reset. This avoids spurious NMIs on
1259 * Haswell CPUs.
1260 */
1261 if (x86_pmu.late_ack)
1262 apic_write(APIC_LVTPC, APIC_DM_NMI);
1238 return handled; 1263 return handled;
1239} 1264}
1240 1265
@@ -1425,7 +1450,6 @@ x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1425 if (x86_pmu.event_constraints) { 1450 if (x86_pmu.event_constraints) {
1426 for_each_event_constraint(c, x86_pmu.event_constraints) { 1451 for_each_event_constraint(c, x86_pmu.event_constraints) {
1427 if ((event->hw.config & c->cmask) == c->code) { 1452 if ((event->hw.config & c->cmask) == c->code) {
1428 /* hw.flags zeroed at initialization */
1429 event->hw.flags |= c->flags; 1453 event->hw.flags |= c->flags;
1430 return c; 1454 return c;
1431 } 1455 }
@@ -1473,7 +1497,6 @@ intel_put_shared_regs_event_constraints(struct cpu_hw_events *cpuc,
1473static void intel_put_event_constraints(struct cpu_hw_events *cpuc, 1497static void intel_put_event_constraints(struct cpu_hw_events *cpuc,
1474 struct perf_event *event) 1498 struct perf_event *event)
1475{ 1499{
1476 event->hw.flags = 0;
1477 intel_put_shared_regs_event_constraints(cpuc, event); 1500 intel_put_shared_regs_event_constraints(cpuc, event);
1478} 1501}
1479 1502
@@ -1646,6 +1669,47 @@ static void core_pmu_enable_all(int added)
1646 } 1669 }
1647} 1670}
1648 1671
1672static int hsw_hw_config(struct perf_event *event)
1673{
1674 int ret = intel_pmu_hw_config(event);
1675
1676 if (ret)
1677 return ret;
1678 if (!boot_cpu_has(X86_FEATURE_RTM) && !boot_cpu_has(X86_FEATURE_HLE))
1679 return 0;
1680 event->hw.config |= event->attr.config & (HSW_IN_TX|HSW_IN_TX_CHECKPOINTED);
1681
1682 /*
1683 * IN_TX/IN_TX-CP filters are not supported by the Haswell PMU with
1684 * PEBS or in ANY thread mode. Since the results are non-sensical forbid
1685 * this combination.
1686 */
1687 if ((event->hw.config & (HSW_IN_TX|HSW_IN_TX_CHECKPOINTED)) &&
1688 ((event->hw.config & ARCH_PERFMON_EVENTSEL_ANY) ||
1689 event->attr.precise_ip > 0))
1690 return -EOPNOTSUPP;
1691
1692 return 0;
1693}
1694
1695static struct event_constraint counter2_constraint =
1696 EVENT_CONSTRAINT(0, 0x4, 0);
1697
1698static struct event_constraint *
1699hsw_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1700{
1701 struct event_constraint *c = intel_get_event_constraints(cpuc, event);
1702
1703 /* Handle special quirk on in_tx_checkpointed only in counter 2 */
1704 if (event->hw.config & HSW_IN_TX_CHECKPOINTED) {
1705 if (c->idxmsk64 & (1U << 2))
1706 return &counter2_constraint;
1707 return &emptyconstraint;
1708 }
1709
1710 return c;
1711}
1712
1649PMU_FORMAT_ATTR(event, "config:0-7" ); 1713PMU_FORMAT_ATTR(event, "config:0-7" );
1650PMU_FORMAT_ATTR(umask, "config:8-15" ); 1714PMU_FORMAT_ATTR(umask, "config:8-15" );
1651PMU_FORMAT_ATTR(edge, "config:18" ); 1715PMU_FORMAT_ATTR(edge, "config:18" );
@@ -1653,6 +1717,8 @@ PMU_FORMAT_ATTR(pc, "config:19" );
1653PMU_FORMAT_ATTR(any, "config:21" ); /* v3 + */ 1717PMU_FORMAT_ATTR(any, "config:21" ); /* v3 + */
1654PMU_FORMAT_ATTR(inv, "config:23" ); 1718PMU_FORMAT_ATTR(inv, "config:23" );
1655PMU_FORMAT_ATTR(cmask, "config:24-31" ); 1719PMU_FORMAT_ATTR(cmask, "config:24-31" );
1720PMU_FORMAT_ATTR(in_tx, "config:32");
1721PMU_FORMAT_ATTR(in_tx_cp, "config:33");
1656 1722
1657static struct attribute *intel_arch_formats_attr[] = { 1723static struct attribute *intel_arch_formats_attr[] = {
1658 &format_attr_event.attr, 1724 &format_attr_event.attr,
@@ -1807,6 +1873,8 @@ static struct attribute *intel_arch3_formats_attr[] = {
1807 &format_attr_any.attr, 1873 &format_attr_any.attr,
1808 &format_attr_inv.attr, 1874 &format_attr_inv.attr,
1809 &format_attr_cmask.attr, 1875 &format_attr_cmask.attr,
1876 &format_attr_in_tx.attr,
1877 &format_attr_in_tx_cp.attr,
1810 1878
1811 &format_attr_offcore_rsp.attr, /* XXX do NHM/WSM + SNB breakout */ 1879 &format_attr_offcore_rsp.attr, /* XXX do NHM/WSM + SNB breakout */
1812 &format_attr_ldlat.attr, /* PEBS load latency */ 1880 &format_attr_ldlat.attr, /* PEBS load latency */
@@ -1966,6 +2034,15 @@ static __init void intel_nehalem_quirk(void)
1966 } 2034 }
1967} 2035}
1968 2036
2037EVENT_ATTR_STR(mem-loads, mem_ld_hsw, "event=0xcd,umask=0x1,ldlat=3");
2038EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82")
2039
2040static struct attribute *hsw_events_attrs[] = {
2041 EVENT_PTR(mem_ld_hsw),
2042 EVENT_PTR(mem_st_hsw),
2043 NULL
2044};
2045
1969__init int intel_pmu_init(void) 2046__init int intel_pmu_init(void)
1970{ 2047{
1971 union cpuid10_edx edx; 2048 union cpuid10_edx edx;
@@ -2189,6 +2266,30 @@ __init int intel_pmu_init(void)
2189 break; 2266 break;
2190 2267
2191 2268
2269 case 60: /* Haswell Client */
2270 case 70:
2271 case 71:
2272 case 63:
2273 x86_pmu.late_ack = true;
2274 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids));
2275 memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
2276
2277 intel_pmu_lbr_init_snb();
2278
2279 x86_pmu.event_constraints = intel_hsw_event_constraints;
2280 x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints;
2281 x86_pmu.extra_regs = intel_snb_extra_regs;
2282 x86_pmu.pebs_aliases = intel_pebs_aliases_snb;
2283 /* all extra regs are per-cpu when HT is on */
2284 x86_pmu.er_flags |= ERF_HAS_RSP_1;
2285 x86_pmu.er_flags |= ERF_NO_HT_SHARING;
2286
2287 x86_pmu.hw_config = hsw_hw_config;
2288 x86_pmu.get_event_constraints = hsw_get_event_constraints;
2289 x86_pmu.cpu_events = hsw_events_attrs;
2290 pr_cont("Haswell events, ");
2291 break;
2292
2192 default: 2293 default:
2193 switch (x86_pmu.version) { 2294 switch (x86_pmu.version) {
2194 case 1: 2295 case 1:
@@ -2227,7 +2328,7 @@ __init int intel_pmu_init(void)
2227 * counter, so do not extend mask to generic counters 2328 * counter, so do not extend mask to generic counters
2228 */ 2329 */
2229 for_each_event_constraint(c, x86_pmu.event_constraints) { 2330 for_each_event_constraint(c, x86_pmu.event_constraints) {
2230 if (c->cmask != X86_RAW_EVENT_MASK 2331 if (c->cmask != FIXED_EVENT_FLAGS
2231 || c->idxmsk64 == INTEL_PMC_MSK_FIXED_REF_CYCLES) { 2332 || c->idxmsk64 == INTEL_PMC_MSK_FIXED_REF_CYCLES) {
2232 continue; 2333 continue;
2233 } 2334 }
@@ -2237,5 +2338,12 @@ __init int intel_pmu_init(void)
2237 } 2338 }
2238 } 2339 }
2239 2340
2341 /* Support full width counters using alternative MSR range */
2342 if (x86_pmu.intel_cap.full_width_write) {
2343 x86_pmu.max_period = x86_pmu.cntval_mask;
2344 x86_pmu.perfctr = MSR_IA32_PMC0;
2345 pr_cont("full-width counters, ");
2346 }
2347
2240 return 0; 2348 return 0;
2241} 2349}
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 60250f687052..3065c57a63c1 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -107,6 +107,19 @@ static u64 precise_store_data(u64 status)
107 return val; 107 return val;
108} 108}
109 109
110static u64 precise_store_data_hsw(u64 status)
111{
112 union perf_mem_data_src dse;
113
114 dse.val = 0;
115 dse.mem_op = PERF_MEM_OP_STORE;
116 dse.mem_lvl = PERF_MEM_LVL_NA;
117 if (status & 1)
118 dse.mem_lvl = PERF_MEM_LVL_L1;
119 /* Nothing else supported. Sorry. */
120 return dse.val;
121}
122
110static u64 load_latency_data(u64 status) 123static u64 load_latency_data(u64 status)
111{ 124{
112 union intel_x86_pebs_dse dse; 125 union intel_x86_pebs_dse dse;
@@ -165,6 +178,22 @@ struct pebs_record_nhm {
165 u64 status, dla, dse, lat; 178 u64 status, dla, dse, lat;
166}; 179};
167 180
181/*
182 * Same as pebs_record_nhm, with two additional fields.
183 */
184struct pebs_record_hsw {
185 struct pebs_record_nhm nhm;
186 /*
187 * Real IP of the event. In the Intel documentation this
188 * is called eventingrip.
189 */
190 u64 real_ip;
191 /*
192 * TSX tuning information field: abort cycles and abort flags.
193 */
194 u64 tsx_tuning;
195};
196
168void init_debug_store_on_cpu(int cpu) 197void init_debug_store_on_cpu(int cpu)
169{ 198{
170 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds; 199 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
@@ -548,6 +577,42 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = {
548 EVENT_CONSTRAINT_END 577 EVENT_CONSTRAINT_END
549}; 578};
550 579
580struct event_constraint intel_hsw_pebs_event_constraints[] = {
581 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
582 INTEL_PST_HSW_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */
583 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */
584 INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */
585 INTEL_UEVENT_CONSTRAINT(0x01c5, 0xf), /* BR_MISP_RETIRED.CONDITIONAL */
586 INTEL_UEVENT_CONSTRAINT(0x04c5, 0xf), /* BR_MISP_RETIRED.ALL_BRANCHES */
587 INTEL_UEVENT_CONSTRAINT(0x20c5, 0xf), /* BR_MISP_RETIRED.NEAR_TAKEN */
588 INTEL_PLD_CONSTRAINT(0x01cd, 0x8), /* MEM_TRANS_RETIRED.* */
589 /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */
590 INTEL_UEVENT_CONSTRAINT(0x11d0, 0xf),
591 /* MEM_UOPS_RETIRED.STLB_MISS_STORES */
592 INTEL_UEVENT_CONSTRAINT(0x12d0, 0xf),
593 INTEL_UEVENT_CONSTRAINT(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */
594 INTEL_UEVENT_CONSTRAINT(0x41d0, 0xf), /* MEM_UOPS_RETIRED.SPLIT_LOADS */
595 /* MEM_UOPS_RETIRED.SPLIT_STORES */
596 INTEL_UEVENT_CONSTRAINT(0x42d0, 0xf),
597 INTEL_UEVENT_CONSTRAINT(0x81d0, 0xf), /* MEM_UOPS_RETIRED.ALL_LOADS */
598 INTEL_PST_HSW_CONSTRAINT(0x82d0, 0xf), /* MEM_UOPS_RETIRED.ALL_STORES */
599 INTEL_UEVENT_CONSTRAINT(0x01d1, 0xf), /* MEM_LOAD_UOPS_RETIRED.L1_HIT */
600 INTEL_UEVENT_CONSTRAINT(0x02d1, 0xf), /* MEM_LOAD_UOPS_RETIRED.L2_HIT */
601 INTEL_UEVENT_CONSTRAINT(0x04d1, 0xf), /* MEM_LOAD_UOPS_RETIRED.L3_HIT */
602 /* MEM_LOAD_UOPS_RETIRED.HIT_LFB */
603 INTEL_UEVENT_CONSTRAINT(0x40d1, 0xf),
604 /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS */
605 INTEL_UEVENT_CONSTRAINT(0x01d2, 0xf),
606 /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT */
607 INTEL_UEVENT_CONSTRAINT(0x02d2, 0xf),
608 /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM */
609 INTEL_UEVENT_CONSTRAINT(0x01d3, 0xf),
610 INTEL_UEVENT_CONSTRAINT(0x04c8, 0xf), /* HLE_RETIRED.Abort */
611 INTEL_UEVENT_CONSTRAINT(0x04c9, 0xf), /* RTM_RETIRED.Abort */
612
613 EVENT_CONSTRAINT_END
614};
615
551struct event_constraint *intel_pebs_constraints(struct perf_event *event) 616struct event_constraint *intel_pebs_constraints(struct perf_event *event)
552{ 617{
553 struct event_constraint *c; 618 struct event_constraint *c;
@@ -588,6 +653,12 @@ void intel_pmu_pebs_disable(struct perf_event *event)
588 struct hw_perf_event *hwc = &event->hw; 653 struct hw_perf_event *hwc = &event->hw;
589 654
590 cpuc->pebs_enabled &= ~(1ULL << hwc->idx); 655 cpuc->pebs_enabled &= ~(1ULL << hwc->idx);
656
657 if (event->hw.constraint->flags & PERF_X86_EVENT_PEBS_LDLAT)
658 cpuc->pebs_enabled &= ~(1ULL << (hwc->idx + 32));
659 else if (event->hw.constraint->flags & PERF_X86_EVENT_PEBS_ST)
660 cpuc->pebs_enabled &= ~(1ULL << 63);
661
591 if (cpuc->enabled) 662 if (cpuc->enabled)
592 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled); 663 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
593 664
@@ -697,6 +768,7 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
697 */ 768 */
698 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 769 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
699 struct pebs_record_nhm *pebs = __pebs; 770 struct pebs_record_nhm *pebs = __pebs;
771 struct pebs_record_hsw *pebs_hsw = __pebs;
700 struct perf_sample_data data; 772 struct perf_sample_data data;
701 struct pt_regs regs; 773 struct pt_regs regs;
702 u64 sample_type; 774 u64 sample_type;
@@ -706,7 +778,8 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
706 return; 778 return;
707 779
708 fll = event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT; 780 fll = event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT;
709 fst = event->hw.flags & PERF_X86_EVENT_PEBS_ST; 781 fst = event->hw.flags & (PERF_X86_EVENT_PEBS_ST |
782 PERF_X86_EVENT_PEBS_ST_HSW);
710 783
711 perf_sample_data_init(&data, 0, event->hw.last_period); 784 perf_sample_data_init(&data, 0, event->hw.last_period);
712 785
@@ -717,9 +790,6 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
717 * if PEBS-LL or PreciseStore 790 * if PEBS-LL or PreciseStore
718 */ 791 */
719 if (fll || fst) { 792 if (fll || fst) {
720 if (sample_type & PERF_SAMPLE_ADDR)
721 data.addr = pebs->dla;
722
723 /* 793 /*
724 * Use latency for weight (only avail with PEBS-LL) 794 * Use latency for weight (only avail with PEBS-LL)
725 */ 795 */
@@ -732,6 +802,9 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
732 if (sample_type & PERF_SAMPLE_DATA_SRC) { 802 if (sample_type & PERF_SAMPLE_DATA_SRC) {
733 if (fll) 803 if (fll)
734 data.data_src.val = load_latency_data(pebs->dse); 804 data.data_src.val = load_latency_data(pebs->dse);
805 else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW)
806 data.data_src.val =
807 precise_store_data_hsw(pebs->dse);
735 else 808 else
736 data.data_src.val = precise_store_data(pebs->dse); 809 data.data_src.val = precise_store_data(pebs->dse);
737 } 810 }
@@ -753,11 +826,18 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
753 regs.bp = pebs->bp; 826 regs.bp = pebs->bp;
754 regs.sp = pebs->sp; 827 regs.sp = pebs->sp;
755 828
756 if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(&regs)) 829 if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) {
830 regs.ip = pebs_hsw->real_ip;
831 regs.flags |= PERF_EFLAGS_EXACT;
832 } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(&regs))
757 regs.flags |= PERF_EFLAGS_EXACT; 833 regs.flags |= PERF_EFLAGS_EXACT;
758 else 834 else
759 regs.flags &= ~PERF_EFLAGS_EXACT; 835 regs.flags &= ~PERF_EFLAGS_EXACT;
760 836
837 if ((event->attr.sample_type & PERF_SAMPLE_ADDR) &&
838 x86_pmu.intel_cap.pebs_format >= 1)
839 data.addr = pebs->dla;
840
761 if (has_branch_stack(event)) 841 if (has_branch_stack(event))
762 data.br_stack = &cpuc->lbr_stack; 842 data.br_stack = &cpuc->lbr_stack;
763 843
@@ -806,35 +886,22 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs)
806 __intel_pmu_pebs_event(event, iregs, at); 886 __intel_pmu_pebs_event(event, iregs, at);
807} 887}
808 888
809static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) 889static void __intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, void *at,
890 void *top)
810{ 891{
811 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 892 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
812 struct debug_store *ds = cpuc->ds; 893 struct debug_store *ds = cpuc->ds;
813 struct pebs_record_nhm *at, *top;
814 struct perf_event *event = NULL; 894 struct perf_event *event = NULL;
815 u64 status = 0; 895 u64 status = 0;
816 int bit, n; 896 int bit;
817
818 if (!x86_pmu.pebs_active)
819 return;
820
821 at = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
822 top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
823 897
824 ds->pebs_index = ds->pebs_buffer_base; 898 ds->pebs_index = ds->pebs_buffer_base;
825 899
826 n = top - at; 900 for (; at < top; at += x86_pmu.pebs_record_size) {
827 if (n <= 0) 901 struct pebs_record_nhm *p = at;
828 return;
829
830 /*
831 * Should not happen, we program the threshold at 1 and do not
832 * set a reset value.
833 */
834 WARN_ONCE(n > x86_pmu.max_pebs_events, "Unexpected number of pebs records %d\n", n);
835 902
836 for ( ; at < top; at++) { 903 for_each_set_bit(bit, (unsigned long *)&p->status,
837 for_each_set_bit(bit, (unsigned long *)&at->status, x86_pmu.max_pebs_events) { 904 x86_pmu.max_pebs_events) {
838 event = cpuc->events[bit]; 905 event = cpuc->events[bit];
839 if (!test_bit(bit, cpuc->active_mask)) 906 if (!test_bit(bit, cpuc->active_mask))
840 continue; 907 continue;
@@ -857,6 +924,61 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
857 } 924 }
858} 925}
859 926
927static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
928{
929 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
930 struct debug_store *ds = cpuc->ds;
931 struct pebs_record_nhm *at, *top;
932 int n;
933
934 if (!x86_pmu.pebs_active)
935 return;
936
937 at = (struct pebs_record_nhm *)(unsigned long)ds->pebs_buffer_base;
938 top = (struct pebs_record_nhm *)(unsigned long)ds->pebs_index;
939
940 ds->pebs_index = ds->pebs_buffer_base;
941
942 n = top - at;
943 if (n <= 0)
944 return;
945
946 /*
947 * Should not happen, we program the threshold at 1 and do not
948 * set a reset value.
949 */
950 WARN_ONCE(n > x86_pmu.max_pebs_events,
951 "Unexpected number of pebs records %d\n", n);
952
953 return __intel_pmu_drain_pebs_nhm(iregs, at, top);
954}
955
956static void intel_pmu_drain_pebs_hsw(struct pt_regs *iregs)
957{
958 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
959 struct debug_store *ds = cpuc->ds;
960 struct pebs_record_hsw *at, *top;
961 int n;
962
963 if (!x86_pmu.pebs_active)
964 return;
965
966 at = (struct pebs_record_hsw *)(unsigned long)ds->pebs_buffer_base;
967 top = (struct pebs_record_hsw *)(unsigned long)ds->pebs_index;
968
969 n = top - at;
970 if (n <= 0)
971 return;
972 /*
973 * Should not happen, we program the threshold at 1 and do not
974 * set a reset value.
975 */
976 WARN_ONCE(n > x86_pmu.max_pebs_events,
977 "Unexpected number of pebs records %d\n", n);
978
979 return __intel_pmu_drain_pebs_nhm(iregs, at, top);
980}
981
860/* 982/*
861 * BTS, PEBS probe and setup 983 * BTS, PEBS probe and setup
862 */ 984 */
@@ -888,6 +1010,12 @@ void intel_ds_init(void)
888 x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm; 1010 x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm;
889 break; 1011 break;
890 1012
1013 case 2:
1014 pr_cont("PEBS fmt2%c, ", pebs_type);
1015 x86_pmu.pebs_record_size = sizeof(struct pebs_record_hsw);
1016 x86_pmu.drain_pebs = intel_pmu_drain_pebs_hsw;
1017 break;
1018
891 default: 1019 default:
892 printk(KERN_CONT "no PEBS fmt%d%c, ", format, pebs_type); 1020 printk(KERN_CONT "no PEBS fmt%d%c, ", format, pebs_type);
893 x86_pmu.pebs = 0; 1021 x86_pmu.pebs = 0;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index d978353c939b..d5be06a5005e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -12,6 +12,16 @@ enum {
12 LBR_FORMAT_LIP = 0x01, 12 LBR_FORMAT_LIP = 0x01,
13 LBR_FORMAT_EIP = 0x02, 13 LBR_FORMAT_EIP = 0x02,
14 LBR_FORMAT_EIP_FLAGS = 0x03, 14 LBR_FORMAT_EIP_FLAGS = 0x03,
15 LBR_FORMAT_EIP_FLAGS2 = 0x04,
16 LBR_FORMAT_MAX_KNOWN = LBR_FORMAT_EIP_FLAGS2,
17};
18
19static enum {
20 LBR_EIP_FLAGS = 1,
21 LBR_TSX = 2,
22} lbr_desc[LBR_FORMAT_MAX_KNOWN + 1] = {
23 [LBR_FORMAT_EIP_FLAGS] = LBR_EIP_FLAGS,
24 [LBR_FORMAT_EIP_FLAGS2] = LBR_EIP_FLAGS | LBR_TSX,
15}; 25};
16 26
17/* 27/*
@@ -56,6 +66,8 @@ enum {
56 LBR_FAR) 66 LBR_FAR)
57 67
58#define LBR_FROM_FLAG_MISPRED (1ULL << 63) 68#define LBR_FROM_FLAG_MISPRED (1ULL << 63)
69#define LBR_FROM_FLAG_IN_TX (1ULL << 62)
70#define LBR_FROM_FLAG_ABORT (1ULL << 61)
59 71
60#define for_each_branch_sample_type(x) \ 72#define for_each_branch_sample_type(x) \
61 for ((x) = PERF_SAMPLE_BRANCH_USER; \ 73 for ((x) = PERF_SAMPLE_BRANCH_USER; \
@@ -81,9 +93,13 @@ enum {
81 X86_BR_JMP = 1 << 9, /* jump */ 93 X86_BR_JMP = 1 << 9, /* jump */
82 X86_BR_IRQ = 1 << 10,/* hw interrupt or trap or fault */ 94 X86_BR_IRQ = 1 << 10,/* hw interrupt or trap or fault */
83 X86_BR_IND_CALL = 1 << 11,/* indirect calls */ 95 X86_BR_IND_CALL = 1 << 11,/* indirect calls */
96 X86_BR_ABORT = 1 << 12,/* transaction abort */
97 X86_BR_IN_TX = 1 << 13,/* in transaction */
98 X86_BR_NO_TX = 1 << 14,/* not in transaction */
84}; 99};
85 100
86#define X86_BR_PLM (X86_BR_USER | X86_BR_KERNEL) 101#define X86_BR_PLM (X86_BR_USER | X86_BR_KERNEL)
102#define X86_BR_ANYTX (X86_BR_NO_TX | X86_BR_IN_TX)
87 103
88#define X86_BR_ANY \ 104#define X86_BR_ANY \
89 (X86_BR_CALL |\ 105 (X86_BR_CALL |\
@@ -95,6 +111,7 @@ enum {
95 X86_BR_JCC |\ 111 X86_BR_JCC |\
96 X86_BR_JMP |\ 112 X86_BR_JMP |\
97 X86_BR_IRQ |\ 113 X86_BR_IRQ |\
114 X86_BR_ABORT |\
98 X86_BR_IND_CALL) 115 X86_BR_IND_CALL)
99 116
100#define X86_BR_ALL (X86_BR_PLM | X86_BR_ANY) 117#define X86_BR_ALL (X86_BR_PLM | X86_BR_ANY)
@@ -270,21 +287,31 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
270 287
271 for (i = 0; i < x86_pmu.lbr_nr; i++) { 288 for (i = 0; i < x86_pmu.lbr_nr; i++) {
272 unsigned long lbr_idx = (tos - i) & mask; 289 unsigned long lbr_idx = (tos - i) & mask;
273 u64 from, to, mis = 0, pred = 0; 290 u64 from, to, mis = 0, pred = 0, in_tx = 0, abort = 0;
291 int skip = 0;
292 int lbr_flags = lbr_desc[lbr_format];
274 293
275 rdmsrl(x86_pmu.lbr_from + lbr_idx, from); 294 rdmsrl(x86_pmu.lbr_from + lbr_idx, from);
276 rdmsrl(x86_pmu.lbr_to + lbr_idx, to); 295 rdmsrl(x86_pmu.lbr_to + lbr_idx, to);
277 296
278 if (lbr_format == LBR_FORMAT_EIP_FLAGS) { 297 if (lbr_flags & LBR_EIP_FLAGS) {
279 mis = !!(from & LBR_FROM_FLAG_MISPRED); 298 mis = !!(from & LBR_FROM_FLAG_MISPRED);
280 pred = !mis; 299 pred = !mis;
281 from = (u64)((((s64)from) << 1) >> 1); 300 skip = 1;
301 }
302 if (lbr_flags & LBR_TSX) {
303 in_tx = !!(from & LBR_FROM_FLAG_IN_TX);
304 abort = !!(from & LBR_FROM_FLAG_ABORT);
305 skip = 3;
282 } 306 }
307 from = (u64)((((s64)from) << skip) >> skip);
283 308
284 cpuc->lbr_entries[i].from = from; 309 cpuc->lbr_entries[i].from = from;
285 cpuc->lbr_entries[i].to = to; 310 cpuc->lbr_entries[i].to = to;
286 cpuc->lbr_entries[i].mispred = mis; 311 cpuc->lbr_entries[i].mispred = mis;
287 cpuc->lbr_entries[i].predicted = pred; 312 cpuc->lbr_entries[i].predicted = pred;
313 cpuc->lbr_entries[i].in_tx = in_tx;
314 cpuc->lbr_entries[i].abort = abort;
288 cpuc->lbr_entries[i].reserved = 0; 315 cpuc->lbr_entries[i].reserved = 0;
289 } 316 }
290 cpuc->lbr_stack.nr = i; 317 cpuc->lbr_stack.nr = i;
@@ -310,7 +337,7 @@ void intel_pmu_lbr_read(void)
310 * - in case there is no HW filter 337 * - in case there is no HW filter
311 * - in case the HW filter has errata or limitations 338 * - in case the HW filter has errata or limitations
312 */ 339 */
313static int intel_pmu_setup_sw_lbr_filter(struct perf_event *event) 340static void intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
314{ 341{
315 u64 br_type = event->attr.branch_sample_type; 342 u64 br_type = event->attr.branch_sample_type;
316 int mask = 0; 343 int mask = 0;
@@ -318,11 +345,8 @@ static int intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
318 if (br_type & PERF_SAMPLE_BRANCH_USER) 345 if (br_type & PERF_SAMPLE_BRANCH_USER)
319 mask |= X86_BR_USER; 346 mask |= X86_BR_USER;
320 347
321 if (br_type & PERF_SAMPLE_BRANCH_KERNEL) { 348 if (br_type & PERF_SAMPLE_BRANCH_KERNEL)
322 if (perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN))
323 return -EACCES;
324 mask |= X86_BR_KERNEL; 349 mask |= X86_BR_KERNEL;
325 }
326 350
327 /* we ignore BRANCH_HV here */ 351 /* we ignore BRANCH_HV here */
328 352
@@ -337,13 +361,21 @@ static int intel_pmu_setup_sw_lbr_filter(struct perf_event *event)
337 361
338 if (br_type & PERF_SAMPLE_BRANCH_IND_CALL) 362 if (br_type & PERF_SAMPLE_BRANCH_IND_CALL)
339 mask |= X86_BR_IND_CALL; 363 mask |= X86_BR_IND_CALL;
364
365 if (br_type & PERF_SAMPLE_BRANCH_ABORT_TX)
366 mask |= X86_BR_ABORT;
367
368 if (br_type & PERF_SAMPLE_BRANCH_IN_TX)
369 mask |= X86_BR_IN_TX;
370
371 if (br_type & PERF_SAMPLE_BRANCH_NO_TX)
372 mask |= X86_BR_NO_TX;
373
340 /* 374 /*
341 * stash actual user request into reg, it may 375 * stash actual user request into reg, it may
342 * be used by fixup code for some CPU 376 * be used by fixup code for some CPU
343 */ 377 */
344 event->hw.branch_reg.reg = mask; 378 event->hw.branch_reg.reg = mask;
345
346 return 0;
347} 379}
348 380
349/* 381/*
@@ -391,9 +423,7 @@ int intel_pmu_setup_lbr_filter(struct perf_event *event)
391 /* 423 /*
392 * setup SW LBR filter 424 * setup SW LBR filter
393 */ 425 */
394 ret = intel_pmu_setup_sw_lbr_filter(event); 426 intel_pmu_setup_sw_lbr_filter(event);
395 if (ret)
396 return ret;
397 427
398 /* 428 /*
399 * setup HW LBR filter, if any 429 * setup HW LBR filter, if any
@@ -415,7 +445,7 @@ int intel_pmu_setup_lbr_filter(struct perf_event *event)
415 * decoded (e.g., text page not present), then X86_BR_NONE is 445 * decoded (e.g., text page not present), then X86_BR_NONE is
416 * returned. 446 * returned.
417 */ 447 */
418static int branch_type(unsigned long from, unsigned long to) 448static int branch_type(unsigned long from, unsigned long to, int abort)
419{ 449{
420 struct insn insn; 450 struct insn insn;
421 void *addr; 451 void *addr;
@@ -435,6 +465,9 @@ static int branch_type(unsigned long from, unsigned long to)
435 if (from == 0 || to == 0) 465 if (from == 0 || to == 0)
436 return X86_BR_NONE; 466 return X86_BR_NONE;
437 467
468 if (abort)
469 return X86_BR_ABORT | to_plm;
470
438 if (from_plm == X86_BR_USER) { 471 if (from_plm == X86_BR_USER) {
439 /* 472 /*
440 * can happen if measuring at the user level only 473 * can happen if measuring at the user level only
@@ -581,7 +614,13 @@ intel_pmu_lbr_filter(struct cpu_hw_events *cpuc)
581 from = cpuc->lbr_entries[i].from; 614 from = cpuc->lbr_entries[i].from;
582 to = cpuc->lbr_entries[i].to; 615 to = cpuc->lbr_entries[i].to;
583 616
584 type = branch_type(from, to); 617 type = branch_type(from, to, cpuc->lbr_entries[i].abort);
618 if (type != X86_BR_NONE && (br_sel & X86_BR_ANYTX)) {
619 if (cpuc->lbr_entries[i].in_tx)
620 type |= X86_BR_IN_TX;
621 else
622 type |= X86_BR_NO_TX;
623 }
585 624
586 /* if type does not correspond, then discard */ 625 /* if type does not correspond, then discard */
587 if (type == X86_BR_NONE || (br_sel & type) != type) { 626 if (type == X86_BR_NONE || (br_sel & type) != type) {
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 52441a2af538..9dd99751ccf9 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -536,7 +536,7 @@ __snbep_cbox_get_constraint(struct intel_uncore_box *box, struct perf_event *eve
536 if (!uncore_box_is_fake(box)) 536 if (!uncore_box_is_fake(box))
537 reg1->alloc |= alloc; 537 reg1->alloc |= alloc;
538 538
539 return 0; 539 return NULL;
540fail: 540fail:
541 for (; i >= 0; i--) { 541 for (; i >= 0; i--) {
542 if (alloc & (0x1 << i)) 542 if (alloc & (0x1 << i))
@@ -644,7 +644,7 @@ snbep_pcu_get_constraint(struct intel_uncore_box *box, struct perf_event *event)
644 (!uncore_box_is_fake(box) && reg1->alloc)) 644 (!uncore_box_is_fake(box) && reg1->alloc))
645 return NULL; 645 return NULL;
646again: 646again:
647 mask = 0xff << (idx * 8); 647 mask = 0xffULL << (idx * 8);
648 raw_spin_lock_irqsave(&er->lock, flags); 648 raw_spin_lock_irqsave(&er->lock, flags);
649 if (!__BITS_VALUE(atomic_read(&er->ref), idx, 8) || 649 if (!__BITS_VALUE(atomic_read(&er->ref), idx, 8) ||
650 !((config1 ^ er->config) & mask)) { 650 !((config1 ^ er->config) & mask)) {
@@ -1923,7 +1923,7 @@ static u64 nhmex_mbox_alter_er(struct perf_event *event, int new_idx, bool modif
1923{ 1923{
1924 struct hw_perf_event *hwc = &event->hw; 1924 struct hw_perf_event *hwc = &event->hw;
1925 struct hw_perf_event_extra *reg1 = &hwc->extra_reg; 1925 struct hw_perf_event_extra *reg1 = &hwc->extra_reg;
1926 int idx, orig_idx = __BITS_VALUE(reg1->idx, 0, 8); 1926 u64 idx, orig_idx = __BITS_VALUE(reg1->idx, 0, 8);
1927 u64 config = reg1->config; 1927 u64 config = reg1->config;
1928 1928
1929 /* get the non-shared control bits and shift them */ 1929 /* get the non-shared control bits and shift them */
@@ -2723,15 +2723,16 @@ static void uncore_put_event_constraint(struct intel_uncore_box *box, struct per
2723static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int n) 2723static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int n)
2724{ 2724{
2725 unsigned long used_mask[BITS_TO_LONGS(UNCORE_PMC_IDX_MAX)]; 2725 unsigned long used_mask[BITS_TO_LONGS(UNCORE_PMC_IDX_MAX)];
2726 struct event_constraint *c, *constraints[UNCORE_PMC_IDX_MAX]; 2726 struct event_constraint *c;
2727 int i, wmin, wmax, ret = 0; 2727 int i, wmin, wmax, ret = 0;
2728 struct hw_perf_event *hwc; 2728 struct hw_perf_event *hwc;
2729 2729
2730 bitmap_zero(used_mask, UNCORE_PMC_IDX_MAX); 2730 bitmap_zero(used_mask, UNCORE_PMC_IDX_MAX);
2731 2731
2732 for (i = 0, wmin = UNCORE_PMC_IDX_MAX, wmax = 0; i < n; i++) { 2732 for (i = 0, wmin = UNCORE_PMC_IDX_MAX, wmax = 0; i < n; i++) {
2733 hwc = &box->event_list[i]->hw;
2733 c = uncore_get_event_constraint(box, box->event_list[i]); 2734 c = uncore_get_event_constraint(box, box->event_list[i]);
2734 constraints[i] = c; 2735 hwc->constraint = c;
2735 wmin = min(wmin, c->weight); 2736 wmin = min(wmin, c->weight);
2736 wmax = max(wmax, c->weight); 2737 wmax = max(wmax, c->weight);
2737 } 2738 }
@@ -2739,7 +2740,7 @@ static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int
2739 /* fastpath, try to reuse previous register */ 2740 /* fastpath, try to reuse previous register */
2740 for (i = 0; i < n; i++) { 2741 for (i = 0; i < n; i++) {
2741 hwc = &box->event_list[i]->hw; 2742 hwc = &box->event_list[i]->hw;
2742 c = constraints[i]; 2743 c = hwc->constraint;
2743 2744
2744 /* never assigned */ 2745 /* never assigned */
2745 if (hwc->idx == -1) 2746 if (hwc->idx == -1)
@@ -2759,7 +2760,8 @@ static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int
2759 } 2760 }
2760 /* slow path */ 2761 /* slow path */
2761 if (i != n) 2762 if (i != n)
2762 ret = perf_assign_events(constraints, n, wmin, wmax, assign); 2763 ret = perf_assign_events(box->event_list, n,
2764 wmin, wmax, assign);
2763 2765
2764 if (!assign || ret) { 2766 if (!assign || ret) {
2765 for (i = 0; i < n; i++) 2767 for (i = 0; i < n; i++)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index f9528917f6e8..47b3d00c9d89 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -337,10 +337,10 @@
337 NHMEX_M_PMON_CTL_SET_FLAG_SEL_MASK) 337 NHMEX_M_PMON_CTL_SET_FLAG_SEL_MASK)
338 338
339#define NHMEX_M_PMON_ZDP_CTL_FVC_MASK (((1 << 11) - 1) | (1 << 23)) 339#define NHMEX_M_PMON_ZDP_CTL_FVC_MASK (((1 << 11) - 1) | (1 << 23))
340#define NHMEX_M_PMON_ZDP_CTL_FVC_EVENT_MASK(n) (0x7 << (11 + 3 * (n))) 340#define NHMEX_M_PMON_ZDP_CTL_FVC_EVENT_MASK(n) (0x7ULL << (11 + 3 * (n)))
341 341
342#define WSMEX_M_PMON_ZDP_CTL_FVC_MASK (((1 << 12) - 1) | (1 << 24)) 342#define WSMEX_M_PMON_ZDP_CTL_FVC_MASK (((1 << 12) - 1) | (1 << 24))
343#define WSMEX_M_PMON_ZDP_CTL_FVC_EVENT_MASK(n) (0x7 << (12 + 3 * (n))) 343#define WSMEX_M_PMON_ZDP_CTL_FVC_EVENT_MASK(n) (0x7ULL << (12 + 3 * (n)))
344 344
345/* 345/*
346 * use the 9~13 bits to select event If the 7th bit is not set, 346 * use the 9~13 bits to select event If the 7th bit is not set,
diff --git a/arch/x86/kernel/cpu/powerflags.c b/arch/x86/kernel/cpu/powerflags.c
index 7b3fe56b1c21..31f0f335ed22 100644
--- a/arch/x86/kernel/cpu/powerflags.c
+++ b/arch/x86/kernel/cpu/powerflags.c
@@ -11,10 +11,10 @@ const char *const x86_power_flags[32] = {
11 "fid", /* frequency id control */ 11 "fid", /* frequency id control */
12 "vid", /* voltage id control */ 12 "vid", /* voltage id control */
13 "ttp", /* thermal trip */ 13 "ttp", /* thermal trip */
14 "tm", 14 "tm", /* hardware thermal control */
15 "stc", 15 "stc", /* software thermal control */
16 "100mhzsteps", 16 "100mhzsteps", /* 100 MHz multiplier control */
17 "hwpstate", 17 "hwpstate", /* hardware P-state control */
18 "", /* tsc invariant mapped to constant_tsc */ 18 "", /* tsc invariant mapped to constant_tsc */
19 "cpb", /* core performance boost */ 19 "cpb", /* core performance boost */
20 "eff_freq_ro", /* Readonly aperf/mperf */ 20 "eff_freq_ro", /* Readonly aperf/mperf */
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 37a198bd48c8..aee6317b902f 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -37,8 +37,8 @@ static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c)
37 static_cpu_has_bug(X86_BUG_FDIV) ? "yes" : "no", 37 static_cpu_has_bug(X86_BUG_FDIV) ? "yes" : "no",
38 static_cpu_has_bug(X86_BUG_F00F) ? "yes" : "no", 38 static_cpu_has_bug(X86_BUG_F00F) ? "yes" : "no",
39 static_cpu_has_bug(X86_BUG_COMA) ? "yes" : "no", 39 static_cpu_has_bug(X86_BUG_COMA) ? "yes" : "no",
40 c->hard_math ? "yes" : "no", 40 static_cpu_has(X86_FEATURE_FPU) ? "yes" : "no",
41 c->hard_math ? "yes" : "no", 41 static_cpu_has(X86_FEATURE_FPU) ? "yes" : "no",
42 c->cpuid_level, 42 c->cpuid_level,
43 c->wp_works_ok ? "yes" : "no"); 43 c->wp_works_ok ? "yes" : "no");
44} 44}
diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault.c
index 155a13f33ed8..5d3fe8d36e4a 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault.c
@@ -9,6 +9,8 @@
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/desc.h> 10#include <asm/desc.h>
11 11
12#ifdef CONFIG_X86_32
13
12#define DOUBLEFAULT_STACKSIZE (1024) 14#define DOUBLEFAULT_STACKSIZE (1024)
13static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE]; 15static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE];
14#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE) 16#define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE)
@@ -67,3 +69,16 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
67 .__cr3 = __pa_nodebug(swapper_pg_dir), 69 .__cr3 = __pa_nodebug(swapper_pg_dir),
68 } 70 }
69}; 71};
72
73/* dummy for do_double_fault() call */
74void df_debug(struct pt_regs *regs, long error_code) {}
75
76#else /* !CONFIG_X86_32 */
77
78void df_debug(struct pt_regs *regs, long error_code)
79{
80 pr_emerg("PANIC: double fault, error_code: 0x%lx\n", error_code);
81 show_regs(regs);
82 panic("Machine halted.");
83}
84#endif
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 8f3e2dec1df3..2cfbc3a3a2dd 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -801,7 +801,17 @@ ENTRY(name) \
801 CFI_ENDPROC; \ 801 CFI_ENDPROC; \
802ENDPROC(name) 802ENDPROC(name)
803 803
804#define BUILD_INTERRUPT(name, nr) BUILD_INTERRUPT3(name, nr, smp_##name) 804
805#ifdef CONFIG_TRACING
806#define TRACE_BUILD_INTERRUPT(name, nr) \
807 BUILD_INTERRUPT3(trace_##name, nr, smp_trace_##name)
808#else
809#define TRACE_BUILD_INTERRUPT(name, nr)
810#endif
811
812#define BUILD_INTERRUPT(name, nr) \
813 BUILD_INTERRUPT3(name, nr, smp_##name); \
814 TRACE_BUILD_INTERRUPT(name, nr)
805 815
806/* The include is where all of the SMP etc. interrupts come from */ 816/* The include is where all of the SMP etc. interrupts come from */
807#include <asm/entry_arch.h> 817#include <asm/entry_arch.h>
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 727208941030..1b69951a81e2 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -365,7 +365,7 @@ ENDPROC(native_usergs_sysret64)
365 /*CFI_REL_OFFSET ss,0*/ 365 /*CFI_REL_OFFSET ss,0*/
366 pushq_cfi %rax /* rsp */ 366 pushq_cfi %rax /* rsp */
367 CFI_REL_OFFSET rsp,0 367 CFI_REL_OFFSET rsp,0
368 pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_BIT1) /* eflags - interrupts on */ 368 pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED) /* eflags - interrupts on */
369 /*CFI_REL_OFFSET rflags,0*/ 369 /*CFI_REL_OFFSET rflags,0*/
370 pushq_cfi $__KERNEL_CS /* cs */ 370 pushq_cfi $__KERNEL_CS /* cs */
371 /*CFI_REL_OFFSET cs,0*/ 371 /*CFI_REL_OFFSET cs,0*/
@@ -1138,7 +1138,7 @@ END(common_interrupt)
1138/* 1138/*
1139 * APIC interrupts. 1139 * APIC interrupts.
1140 */ 1140 */
1141.macro apicinterrupt num sym do_sym 1141.macro apicinterrupt3 num sym do_sym
1142ENTRY(\sym) 1142ENTRY(\sym)
1143 INTR_FRAME 1143 INTR_FRAME
1144 ASM_CLAC 1144 ASM_CLAC
@@ -1150,15 +1150,32 @@ ENTRY(\sym)
1150END(\sym) 1150END(\sym)
1151.endm 1151.endm
1152 1152
1153#ifdef CONFIG_TRACING
1154#define trace(sym) trace_##sym
1155#define smp_trace(sym) smp_trace_##sym
1156
1157.macro trace_apicinterrupt num sym
1158apicinterrupt3 \num trace(\sym) smp_trace(\sym)
1159.endm
1160#else
1161.macro trace_apicinterrupt num sym do_sym
1162.endm
1163#endif
1164
1165.macro apicinterrupt num sym do_sym
1166apicinterrupt3 \num \sym \do_sym
1167trace_apicinterrupt \num \sym
1168.endm
1169
1153#ifdef CONFIG_SMP 1170#ifdef CONFIG_SMP
1154apicinterrupt IRQ_MOVE_CLEANUP_VECTOR \ 1171apicinterrupt3 IRQ_MOVE_CLEANUP_VECTOR \
1155 irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt 1172 irq_move_cleanup_interrupt smp_irq_move_cleanup_interrupt
1156apicinterrupt REBOOT_VECTOR \ 1173apicinterrupt3 REBOOT_VECTOR \
1157 reboot_interrupt smp_reboot_interrupt 1174 reboot_interrupt smp_reboot_interrupt
1158#endif 1175#endif
1159 1176
1160#ifdef CONFIG_X86_UV 1177#ifdef CONFIG_X86_UV
1161apicinterrupt UV_BAU_MESSAGE \ 1178apicinterrupt3 UV_BAU_MESSAGE \
1162 uv_bau_message_intr1 uv_bau_message_interrupt 1179 uv_bau_message_intr1 uv_bau_message_interrupt
1163#endif 1180#endif
1164apicinterrupt LOCAL_TIMER_VECTOR \ 1181apicinterrupt LOCAL_TIMER_VECTOR \
@@ -1167,14 +1184,19 @@ apicinterrupt X86_PLATFORM_IPI_VECTOR \
1167 x86_platform_ipi smp_x86_platform_ipi 1184 x86_platform_ipi smp_x86_platform_ipi
1168 1185
1169#ifdef CONFIG_HAVE_KVM 1186#ifdef CONFIG_HAVE_KVM
1170apicinterrupt POSTED_INTR_VECTOR \ 1187apicinterrupt3 POSTED_INTR_VECTOR \
1171 kvm_posted_intr_ipi smp_kvm_posted_intr_ipi 1188 kvm_posted_intr_ipi smp_kvm_posted_intr_ipi
1172#endif 1189#endif
1173 1190
1191#ifdef CONFIG_X86_MCE_THRESHOLD
1174apicinterrupt THRESHOLD_APIC_VECTOR \ 1192apicinterrupt THRESHOLD_APIC_VECTOR \
1175 threshold_interrupt smp_threshold_interrupt 1193 threshold_interrupt smp_threshold_interrupt
1194#endif
1195
1196#ifdef CONFIG_X86_THERMAL_VECTOR
1176apicinterrupt THERMAL_APIC_VECTOR \ 1197apicinterrupt THERMAL_APIC_VECTOR \
1177 thermal_interrupt smp_thermal_interrupt 1198 thermal_interrupt smp_thermal_interrupt
1199#endif
1178 1200
1179#ifdef CONFIG_SMP 1201#ifdef CONFIG_SMP
1180apicinterrupt CALL_FUNCTION_SINGLE_VECTOR \ 1202apicinterrupt CALL_FUNCTION_SINGLE_VECTOR \
@@ -1451,13 +1473,13 @@ ENTRY(xen_failsafe_callback)
1451 CFI_ENDPROC 1473 CFI_ENDPROC
1452END(xen_failsafe_callback) 1474END(xen_failsafe_callback)
1453 1475
1454apicinterrupt HYPERVISOR_CALLBACK_VECTOR \ 1476apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1455 xen_hvm_callback_vector xen_evtchn_do_upcall 1477 xen_hvm_callback_vector xen_evtchn_do_upcall
1456 1478
1457#endif /* CONFIG_XEN */ 1479#endif /* CONFIG_XEN */
1458 1480
1459#if IS_ENABLED(CONFIG_HYPERV) 1481#if IS_ENABLED(CONFIG_HYPERV)
1460apicinterrupt HYPERVISOR_CALLBACK_VECTOR \ 1482apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1461 hyperv_callback_vector hyperv_vector_handler 1483 hyperv_callback_vector hyperv_vector_handler
1462#endif /* CONFIG_HYPERV */ 1484#endif /* CONFIG_HYPERV */
1463 1485
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index 73afd11799ca..e65ddc62e113 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -444,7 +444,6 @@ is486:
444 orl %ecx,%eax 444 orl %ecx,%eax
445 movl %eax,%cr0 445 movl %eax,%cr0
446 446
447 call check_x87
448 lgdt early_gdt_descr 447 lgdt early_gdt_descr
449 lidt idt_descr 448 lidt idt_descr
450 ljmp $(__KERNEL_CS),$1f 449 ljmp $(__KERNEL_CS),$1f
@@ -467,26 +466,6 @@ is486:
467 pushl $0 # fake return address for unwinder 466 pushl $0 # fake return address for unwinder
468 jmp *(initial_code) 467 jmp *(initial_code)
469 468
470/*
471 * We depend on ET to be correct. This checks for 287/387.
472 */
473check_x87:
474 movb $0,X86_HARD_MATH
475 clts
476 fninit
477 fstsw %ax
478 cmpb $0,%al
479 je 1f
480 movl %cr0,%eax /* no coprocessor: have to set bits */
481 xorl $4,%eax /* set EM */
482 movl %eax,%cr0
483 ret
484 ALIGN
4851: movb $1,X86_HARD_MATH
486 .byte 0xDB,0xE4 /* fsetpm for 287, ignored by 387 */
487 ret
488
489
490#include "verify_cpu.S" 469#include "verify_cpu.S"
491 470
492/* 471/*
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 321d65ebaffe..5e4d8a8a5c40 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -518,9 +518,15 @@ ENTRY(idt_table)
518 .skip IDT_ENTRIES * 16 518 .skip IDT_ENTRIES * 16
519 519
520 .align L1_CACHE_BYTES 520 .align L1_CACHE_BYTES
521ENTRY(nmi_idt_table) 521ENTRY(debug_idt_table)
522 .skip IDT_ENTRIES * 16 522 .skip IDT_ENTRIES * 16
523 523
524#ifdef CONFIG_TRACING
525 .align L1_CACHE_BYTES
526ENTRY(trace_idt_table)
527 .skip IDT_ENTRIES * 16
528#endif
529
524 __PAGE_ALIGNED_BSS 530 __PAGE_ALIGNED_BSS
525NEXT_PAGE(empty_zero_page) 531NEXT_PAGE(empty_zero_page)
526 .skip PAGE_SIZE 532 .skip PAGE_SIZE
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index cb339097b9ea..b627746f6b1a 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -131,7 +131,7 @@ static void __cpuinit init_thread_xstate(void)
131 * xsave_init(). 131 * xsave_init().
132 */ 132 */
133 133
134 if (!HAVE_HWFP) { 134 if (!cpu_has_fpu) {
135 /* 135 /*
136 * Disable xsave as we do not support it if i387 136 * Disable xsave as we do not support it if i387
137 * emulation is enabled. 137 * emulation is enabled.
@@ -158,6 +158,14 @@ void __cpuinit fpu_init(void)
158 unsigned long cr0; 158 unsigned long cr0;
159 unsigned long cr4_mask = 0; 159 unsigned long cr4_mask = 0;
160 160
161#ifndef CONFIG_MATH_EMULATION
162 if (!cpu_has_fpu) {
163 pr_emerg("No FPU found and no math emulation present\n");
164 pr_emerg("Giving up\n");
165 for (;;)
166 asm volatile("hlt");
167 }
168#endif
161 if (cpu_has_fxsr) 169 if (cpu_has_fxsr)
162 cr4_mask |= X86_CR4_OSFXSR; 170 cr4_mask |= X86_CR4_OSFXSR;
163 if (cpu_has_xmm) 171 if (cpu_has_xmm)
@@ -167,7 +175,7 @@ void __cpuinit fpu_init(void)
167 175
168 cr0 = read_cr0(); 176 cr0 = read_cr0();
169 cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */ 177 cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */
170 if (!HAVE_HWFP) 178 if (!cpu_has_fpu)
171 cr0 |= X86_CR0_EM; 179 cr0 |= X86_CR0_EM;
172 write_cr0(cr0); 180 write_cr0(cr0);
173 181
@@ -185,7 +193,7 @@ void __cpuinit fpu_init(void)
185 193
186void fpu_finit(struct fpu *fpu) 194void fpu_finit(struct fpu *fpu)
187{ 195{
188 if (!HAVE_HWFP) { 196 if (!cpu_has_fpu) {
189 finit_soft_fpu(&fpu->state->soft); 197 finit_soft_fpu(&fpu->state->soft);
190 return; 198 return;
191 } 199 }
@@ -214,7 +222,7 @@ int init_fpu(struct task_struct *tsk)
214 int ret; 222 int ret;
215 223
216 if (tsk_used_math(tsk)) { 224 if (tsk_used_math(tsk)) {
217 if (HAVE_HWFP && tsk == current) 225 if (cpu_has_fpu && tsk == current)
218 unlazy_fpu(tsk); 226 unlazy_fpu(tsk);
219 tsk->thread.fpu.last_cpu = ~0; 227 tsk->thread.fpu.last_cpu = ~0;
220 return 0; 228 return 0;
@@ -511,14 +519,13 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,
511 if (ret) 519 if (ret)
512 return ret; 520 return ret;
513 521
514 if (!HAVE_HWFP) 522 if (!static_cpu_has(X86_FEATURE_FPU))
515 return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf); 523 return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
516 524
517 if (!cpu_has_fxsr) { 525 if (!cpu_has_fxsr)
518 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, 526 return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
519 &target->thread.fpu.state->fsave, 0, 527 &target->thread.fpu.state->fsave, 0,
520 -1); 528 -1);
521 }
522 529
523 sanitize_i387_state(target); 530 sanitize_i387_state(target);
524 531
@@ -545,13 +552,13 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
545 552
546 sanitize_i387_state(target); 553 sanitize_i387_state(target);
547 554
548 if (!HAVE_HWFP) 555 if (!static_cpu_has(X86_FEATURE_FPU))
549 return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf); 556 return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
550 557
551 if (!cpu_has_fxsr) { 558 if (!cpu_has_fxsr)
552 return user_regset_copyin(&pos, &count, &kbuf, &ubuf, 559 return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
553 &target->thread.fpu.state->fsave, 0, -1); 560 &target->thread.fpu.state->fsave, 0,
554 } 561 -1);
555 562
556 if (pos > 0 || count < sizeof(env)) 563 if (pos > 0 || count < sizeof(env))
557 convert_from_fxsr(&env, target); 564 convert_from_fxsr(&env, target);
@@ -592,3 +599,33 @@ int dump_fpu(struct pt_regs *regs, struct user_i387_struct *fpu)
592EXPORT_SYMBOL(dump_fpu); 599EXPORT_SYMBOL(dump_fpu);
593 600
594#endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */ 601#endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */
602
603static int __init no_387(char *s)
604{
605 setup_clear_cpu_cap(X86_FEATURE_FPU);
606 return 1;
607}
608
609__setup("no387", no_387);
610
611void __cpuinit fpu_detect(struct cpuinfo_x86 *c)
612{
613 unsigned long cr0;
614 u16 fsw, fcw;
615
616 fsw = fcw = 0xffff;
617
618 cr0 = read_cr0();
619 cr0 &= ~(X86_CR0_TS | X86_CR0_EM);
620 write_cr0(cr0);
621
622 asm volatile("fninit ; fnstsw %0 ; fnstcw %1"
623 : "+m" (fsw), "+m" (fcw));
624
625 if (fsw == 0 && (fcw & 0x103f) == 0x003f)
626 set_cpu_cap(c, X86_FEATURE_FPU);
627 else
628 clear_cpu_cap(c, X86_FEATURE_FPU);
629
630 /* The final cr0 value is set in fpu_init() */
631}
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index ac0631d8996f..3a8185c042a2 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -18,6 +18,9 @@
18#include <asm/mce.h> 18#include <asm/mce.h>
19#include <asm/hw_irq.h> 19#include <asm/hw_irq.h>
20 20
21#define CREATE_TRACE_POINTS
22#include <asm/trace/irq_vectors.h>
23
21atomic_t irq_err_count; 24atomic_t irq_err_count;
22 25
23/* Function pointer for generic interrupt vector handling */ 26/* Function pointer for generic interrupt vector handling */
@@ -204,23 +207,21 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
204/* 207/*
205 * Handler for X86_PLATFORM_IPI_VECTOR. 208 * Handler for X86_PLATFORM_IPI_VECTOR.
206 */ 209 */
207void smp_x86_platform_ipi(struct pt_regs *regs) 210void __smp_x86_platform_ipi(void)
208{ 211{
209 struct pt_regs *old_regs = set_irq_regs(regs);
210
211 ack_APIC_irq();
212
213 irq_enter();
214
215 exit_idle();
216
217 inc_irq_stat(x86_platform_ipis); 212 inc_irq_stat(x86_platform_ipis);
218 213
219 if (x86_platform_ipi_callback) 214 if (x86_platform_ipi_callback)
220 x86_platform_ipi_callback(); 215 x86_platform_ipi_callback();
216}
221 217
222 irq_exit(); 218void smp_x86_platform_ipi(struct pt_regs *regs)
219{
220 struct pt_regs *old_regs = set_irq_regs(regs);
223 221
222 entering_ack_irq();
223 __smp_x86_platform_ipi();
224 exiting_irq();
224 set_irq_regs(old_regs); 225 set_irq_regs(old_regs);
225} 226}
226 227
@@ -246,6 +247,18 @@ void smp_kvm_posted_intr_ipi(struct pt_regs *regs)
246} 247}
247#endif 248#endif
248 249
250void smp_trace_x86_platform_ipi(struct pt_regs *regs)
251{
252 struct pt_regs *old_regs = set_irq_regs(regs);
253
254 entering_ack_irq();
255 trace_x86_platform_ipi_entry(X86_PLATFORM_IPI_VECTOR);
256 __smp_x86_platform_ipi();
257 trace_x86_platform_ipi_exit(X86_PLATFORM_IPI_VECTOR);
258 exiting_irq();
259 set_irq_regs(old_regs);
260}
261
249EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq); 262EXPORT_SYMBOL_GPL(vector_used_by_percpu_irq);
250 263
251#ifdef CONFIG_HOTPLUG_CPU 264#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/irq_work.c b/arch/x86/kernel/irq_work.c
index ca8f703a1e70..636a55e4a13c 100644
--- a/arch/x86/kernel/irq_work.c
+++ b/arch/x86/kernel/irq_work.c
@@ -8,14 +8,34 @@
8#include <linux/irq_work.h> 8#include <linux/irq_work.h>
9#include <linux/hardirq.h> 9#include <linux/hardirq.h>
10#include <asm/apic.h> 10#include <asm/apic.h>
11#include <asm/trace/irq_vectors.h>
11 12
12void smp_irq_work_interrupt(struct pt_regs *regs) 13static inline void irq_work_entering_irq(void)
13{ 14{
14 irq_enter(); 15 irq_enter();
15 ack_APIC_irq(); 16 ack_APIC_irq();
17}
18
19static inline void __smp_irq_work_interrupt(void)
20{
16 inc_irq_stat(apic_irq_work_irqs); 21 inc_irq_stat(apic_irq_work_irqs);
17 irq_work_run(); 22 irq_work_run();
18 irq_exit(); 23}
24
25void smp_irq_work_interrupt(struct pt_regs *regs)
26{
27 irq_work_entering_irq();
28 __smp_irq_work_interrupt();
29 exiting_irq();
30}
31
32void smp_trace_irq_work_interrupt(struct pt_regs *regs)
33{
34 irq_work_entering_irq();
35 trace_irq_work_entry(IRQ_WORK_VECTOR);
36 __smp_irq_work_interrupt();
37 trace_irq_work_exit(IRQ_WORK_VECTOR);
38 exiting_irq();
19} 39}
20 40
21void arch_irq_work_raise(void) 41void arch_irq_work_raise(void)
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 9895a9a41380..211bce445522 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -365,10 +365,14 @@ int __kprobes __copy_instruction(u8 *dest, u8 *src)
365 return insn.length; 365 return insn.length;
366} 366}
367 367
368static void __kprobes arch_copy_kprobe(struct kprobe *p) 368static int __kprobes arch_copy_kprobe(struct kprobe *p)
369{ 369{
370 int ret;
371
370 /* Copy an instruction with recovering if other optprobe modifies it.*/ 372 /* Copy an instruction with recovering if other optprobe modifies it.*/
371 __copy_instruction(p->ainsn.insn, p->addr); 373 ret = __copy_instruction(p->ainsn.insn, p->addr);
374 if (!ret)
375 return -EINVAL;
372 376
373 /* 377 /*
374 * __copy_instruction can modify the displacement of the instruction, 378 * __copy_instruction can modify the displacement of the instruction,
@@ -384,6 +388,8 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
384 388
385 /* Also, displacement change doesn't affect the first byte */ 389 /* Also, displacement change doesn't affect the first byte */
386 p->opcode = p->ainsn.insn[0]; 390 p->opcode = p->ainsn.insn[0];
391
392 return 0;
387} 393}
388 394
389int __kprobes arch_prepare_kprobe(struct kprobe *p) 395int __kprobes arch_prepare_kprobe(struct kprobe *p)
@@ -397,8 +403,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
397 p->ainsn.insn = get_insn_slot(); 403 p->ainsn.insn = get_insn_slot();
398 if (!p->ainsn.insn) 404 if (!p->ainsn.insn)
399 return -ENOMEM; 405 return -ENOMEM;
400 arch_copy_kprobe(p); 406
401 return 0; 407 return arch_copy_kprobe(p);
402} 408}
403 409
404void __kprobes arch_arm_kprobe(struct kprobe *p) 410void __kprobes arch_arm_kprobe(struct kprobe *p)
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index d2c381280e3c..3dd37ebd591b 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -242,6 +242,7 @@ void __init kvmclock_init(void)
242 if (!mem) 242 if (!mem)
243 return; 243 return;
244 hv_clock = __va(mem); 244 hv_clock = __va(mem);
245 memset(hv_clock, 0, size);
245 246
246 if (kvm_register_clock("boot clock")) { 247 if (kvm_register_clock("boot clock")) {
247 hv_clock = NULL; 248 hv_clock = NULL;
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index efdec7cd8e01..47ebb1dbfbcb 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -31,48 +31,12 @@
31#include <asm/microcode.h> 31#include <asm/microcode.h>
32#include <asm/processor.h> 32#include <asm/processor.h>
33#include <asm/msr.h> 33#include <asm/msr.h>
34#include <asm/microcode_amd.h>
34 35
35MODULE_DESCRIPTION("AMD Microcode Update Driver"); 36MODULE_DESCRIPTION("AMD Microcode Update Driver");
36MODULE_AUTHOR("Peter Oruba"); 37MODULE_AUTHOR("Peter Oruba");
37MODULE_LICENSE("GPL v2"); 38MODULE_LICENSE("GPL v2");
38 39
39#define UCODE_MAGIC 0x00414d44
40#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
41#define UCODE_UCODE_TYPE 0x00000001
42
43struct equiv_cpu_entry {
44 u32 installed_cpu;
45 u32 fixed_errata_mask;
46 u32 fixed_errata_compare;
47 u16 equiv_cpu;
48 u16 res;
49} __attribute__((packed));
50
51struct microcode_header_amd {
52 u32 data_code;
53 u32 patch_id;
54 u16 mc_patch_data_id;
55 u8 mc_patch_data_len;
56 u8 init_flag;
57 u32 mc_patch_data_checksum;
58 u32 nb_dev_id;
59 u32 sb_dev_id;
60 u16 processor_rev_id;
61 u8 nb_rev_id;
62 u8 sb_rev_id;
63 u8 bios_api_rev;
64 u8 reserved1[3];
65 u32 match_reg[8];
66} __attribute__((packed));
67
68struct microcode_amd {
69 struct microcode_header_amd hdr;
70 unsigned int mpb[0];
71};
72
73#define SECTION_HDR_SIZE 8
74#define CONTAINER_HDR_SZ 12
75
76static struct equiv_cpu_entry *equiv_cpu_table; 40static struct equiv_cpu_entry *equiv_cpu_table;
77 41
78struct ucode_patch { 42struct ucode_patch {
@@ -84,21 +48,10 @@ struct ucode_patch {
84 48
85static LIST_HEAD(pcache); 49static LIST_HEAD(pcache);
86 50
87static u16 find_equiv_id(unsigned int cpu) 51static u16 __find_equiv_id(unsigned int cpu)
88{ 52{
89 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 53 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
90 int i = 0; 54 return find_equiv_id(equiv_cpu_table, uci->cpu_sig.sig);
91
92 if (!equiv_cpu_table)
93 return 0;
94
95 while (equiv_cpu_table[i].installed_cpu != 0) {
96 if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu)
97 return equiv_cpu_table[i].equiv_cpu;
98
99 i++;
100 }
101 return 0;
102} 55}
103 56
104static u32 find_cpu_family_by_equiv_cpu(u16 equiv_cpu) 57static u32 find_cpu_family_by_equiv_cpu(u16 equiv_cpu)
@@ -163,7 +116,7 @@ static struct ucode_patch *find_patch(unsigned int cpu)
163{ 116{
164 u16 equiv_id; 117 u16 equiv_id;
165 118
166 equiv_id = find_equiv_id(cpu); 119 equiv_id = __find_equiv_id(cpu);
167 if (!equiv_id) 120 if (!equiv_id)
168 return NULL; 121 return NULL;
169 122
@@ -173,9 +126,20 @@ static struct ucode_patch *find_patch(unsigned int cpu)
173static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) 126static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
174{ 127{
175 struct cpuinfo_x86 *c = &cpu_data(cpu); 128 struct cpuinfo_x86 *c = &cpu_data(cpu);
129 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
130 struct ucode_patch *p;
176 131
177 csig->sig = cpuid_eax(0x00000001); 132 csig->sig = cpuid_eax(0x00000001);
178 csig->rev = c->microcode; 133 csig->rev = c->microcode;
134
135 /*
136 * a patch could have been loaded early, set uci->mc so that
137 * mc_bp_resume() can call apply_microcode()
138 */
139 p = find_patch(cpu);
140 if (p && (p->patch_id == csig->rev))
141 uci->mc = p->data;
142
179 pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); 143 pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev);
180 144
181 return 0; 145 return 0;
@@ -215,7 +179,21 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size,
215 return patch_size; 179 return patch_size;
216} 180}
217 181
218static int apply_microcode_amd(int cpu) 182int __apply_microcode_amd(struct microcode_amd *mc_amd)
183{
184 u32 rev, dummy;
185
186 wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc_amd->hdr.data_code);
187
188 /* verify patch application was successful */
189 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
190 if (rev != mc_amd->hdr.patch_id)
191 return -1;
192
193 return 0;
194}
195
196int apply_microcode_amd(int cpu)
219{ 197{
220 struct cpuinfo_x86 *c = &cpu_data(cpu); 198 struct cpuinfo_x86 *c = &cpu_data(cpu);
221 struct microcode_amd *mc_amd; 199 struct microcode_amd *mc_amd;
@@ -242,19 +220,15 @@ static int apply_microcode_amd(int cpu)
242 return 0; 220 return 0;
243 } 221 }
244 222
245 wrmsrl(MSR_AMD64_PATCH_LOADER, (u64)(long)&mc_amd->hdr.data_code); 223 if (__apply_microcode_amd(mc_amd))
246
247 /* verify patch application was successful */
248 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
249 if (rev != mc_amd->hdr.patch_id) {
250 pr_err("CPU%d: update failed for patch_level=0x%08x\n", 224 pr_err("CPU%d: update failed for patch_level=0x%08x\n",
251 cpu, mc_amd->hdr.patch_id); 225 cpu, mc_amd->hdr.patch_id);
252 return -1; 226 else
253 } 227 pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
228 mc_amd->hdr.patch_id);
254 229
255 pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev); 230 uci->cpu_sig.rev = mc_amd->hdr.patch_id;
256 uci->cpu_sig.rev = rev; 231 c->microcode = mc_amd->hdr.patch_id;
257 c->microcode = rev;
258 232
259 return 0; 233 return 0;
260} 234}
@@ -364,7 +338,7 @@ static int verify_and_add_patch(unsigned int cpu, u8 *fw, unsigned int leftover)
364 return crnt_size; 338 return crnt_size;
365} 339}
366 340
367static enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size) 341static enum ucode_state __load_microcode_amd(int cpu, const u8 *data, size_t size)
368{ 342{
369 enum ucode_state ret = UCODE_ERROR; 343 enum ucode_state ret = UCODE_ERROR;
370 unsigned int leftover; 344 unsigned int leftover;
@@ -398,6 +372,32 @@ static enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size)
398 return UCODE_OK; 372 return UCODE_OK;
399} 373}
400 374
375enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size)
376{
377 enum ucode_state ret;
378
379 /* free old equiv table */
380 free_equiv_cpu_table();
381
382 ret = __load_microcode_amd(cpu, data, size);
383
384 if (ret != UCODE_OK)
385 cleanup();
386
387#if defined(CONFIG_MICROCODE_AMD_EARLY) && defined(CONFIG_X86_32)
388 /* save BSP's matching patch for early load */
389 if (cpu_data(cpu).cpu_index == boot_cpu_data.cpu_index) {
390 struct ucode_patch *p = find_patch(cpu);
391 if (p) {
392 memset(amd_bsp_mpb, 0, MPB_MAX_SIZE);
393 memcpy(amd_bsp_mpb, p->data, min_t(u32, ksize(p->data),
394 MPB_MAX_SIZE));
395 }
396 }
397#endif
398 return ret;
399}
400
401/* 401/*
402 * AMD microcode firmware naming convention, up to family 15h they are in 402 * AMD microcode firmware naming convention, up to family 15h they are in
403 * the legacy file: 403 * the legacy file:
@@ -440,12 +440,7 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device,
440 goto fw_release; 440 goto fw_release;
441 } 441 }
442 442
443 /* free old equiv table */
444 free_equiv_cpu_table();
445
446 ret = load_microcode_amd(cpu, fw->data, fw->size); 443 ret = load_microcode_amd(cpu, fw->data, fw->size);
447 if (ret != UCODE_OK)
448 cleanup();
449 444
450 fw_release: 445 fw_release:
451 release_firmware(fw); 446 release_firmware(fw);
diff --git a/arch/x86/kernel/microcode_amd_early.c b/arch/x86/kernel/microcode_amd_early.c
new file mode 100644
index 000000000000..1ac6e9aee766
--- /dev/null
+++ b/arch/x86/kernel/microcode_amd_early.c
@@ -0,0 +1,302 @@
1/*
2 * Copyright (C) 2013 Advanced Micro Devices, Inc.
3 *
4 * Author: Jacob Shin <jacob.shin@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/earlycpio.h>
12#include <linux/initrd.h>
13
14#include <asm/cpu.h>
15#include <asm/setup.h>
16#include <asm/microcode_amd.h>
17
18static bool ucode_loaded;
19static u32 ucode_new_rev;
20static unsigned long ucode_offset;
21static size_t ucode_size;
22
23/*
24 * Microcode patch container file is prepended to the initrd in cpio format.
25 * See Documentation/x86/early-microcode.txt
26 */
27static __initdata char ucode_path[] = "kernel/x86/microcode/AuthenticAMD.bin";
28
29static struct cpio_data __init find_ucode_in_initrd(void)
30{
31 long offset = 0;
32 char *path;
33 void *start;
34 size_t size;
35 unsigned long *uoffset;
36 size_t *usize;
37 struct cpio_data cd;
38
39#ifdef CONFIG_X86_32
40 struct boot_params *p;
41
42 /*
43 * On 32-bit, early load occurs before paging is turned on so we need
44 * to use physical addresses.
45 */
46 p = (struct boot_params *)__pa_nodebug(&boot_params);
47 path = (char *)__pa_nodebug(ucode_path);
48 start = (void *)p->hdr.ramdisk_image;
49 size = p->hdr.ramdisk_size;
50 uoffset = (unsigned long *)__pa_nodebug(&ucode_offset);
51 usize = (size_t *)__pa_nodebug(&ucode_size);
52#else
53 path = ucode_path;
54 start = (void *)(boot_params.hdr.ramdisk_image + PAGE_OFFSET);
55 size = boot_params.hdr.ramdisk_size;
56 uoffset = &ucode_offset;
57 usize = &ucode_size;
58#endif
59
60 cd = find_cpio_data(path, start, size, &offset);
61 if (!cd.data)
62 return cd;
63
64 if (*(u32 *)cd.data != UCODE_MAGIC) {
65 cd.data = NULL;
66 cd.size = 0;
67 return cd;
68 }
69
70 *uoffset = (u8 *)cd.data - (u8 *)start;
71 *usize = cd.size;
72
73 return cd;
74}
75
76/*
77 * Early load occurs before we can vmalloc(). So we look for the microcode
78 * patch container file in initrd, traverse equivalent cpu table, look for a
79 * matching microcode patch, and update, all in initrd memory in place.
80 * When vmalloc() is available for use later -- on 64-bit during first AP load,
81 * and on 32-bit during save_microcode_in_initrd_amd() -- we can call
82 * load_microcode_amd() to save equivalent cpu table and microcode patches in
83 * kernel heap memory.
84 */
85static void __cpuinit apply_ucode_in_initrd(void *ucode, size_t size)
86{
87 struct equiv_cpu_entry *eq;
88 u32 *header;
89 u8 *data;
90 u16 eq_id = 0;
91 int offset, left;
92 u32 rev, eax;
93 u32 *new_rev;
94 unsigned long *uoffset;
95 size_t *usize;
96
97#ifdef CONFIG_X86_32
98 new_rev = (u32 *)__pa_nodebug(&ucode_new_rev);
99 uoffset = (unsigned long *)__pa_nodebug(&ucode_offset);
100 usize = (size_t *)__pa_nodebug(&ucode_size);
101#else
102 new_rev = &ucode_new_rev;
103 uoffset = &ucode_offset;
104 usize = &ucode_size;
105#endif
106
107 data = ucode;
108 left = size;
109 header = (u32 *)data;
110
111 /* find equiv cpu table */
112
113 if (header[1] != UCODE_EQUIV_CPU_TABLE_TYPE || /* type */
114 header[2] == 0) /* size */
115 return;
116
117 eax = cpuid_eax(0x00000001);
118
119 while (left > 0) {
120 eq = (struct equiv_cpu_entry *)(data + CONTAINER_HDR_SZ);
121
122 offset = header[2] + CONTAINER_HDR_SZ;
123 data += offset;
124 left -= offset;
125
126 eq_id = find_equiv_id(eq, eax);
127 if (eq_id)
128 break;
129
130 /*
131 * support multiple container files appended together. if this
132 * one does not have a matching equivalent cpu entry, we fast
133 * forward to the next container file.
134 */
135 while (left > 0) {
136 header = (u32 *)data;
137 if (header[0] == UCODE_MAGIC &&
138 header[1] == UCODE_EQUIV_CPU_TABLE_TYPE)
139 break;
140
141 offset = header[1] + SECTION_HDR_SIZE;
142 data += offset;
143 left -= offset;
144 }
145
146 /* mark where the next microcode container file starts */
147 offset = data - (u8 *)ucode;
148 *uoffset += offset;
149 *usize -= offset;
150 ucode = data;
151 }
152
153 if (!eq_id) {
154 *usize = 0;
155 return;
156 }
157
158 /* find ucode and update if needed */
159
160 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, eax);
161
162 while (left > 0) {
163 struct microcode_amd *mc;
164
165 header = (u32 *)data;
166 if (header[0] != UCODE_UCODE_TYPE || /* type */
167 header[1] == 0) /* size */
168 break;
169
170 mc = (struct microcode_amd *)(data + SECTION_HDR_SIZE);
171 if (eq_id == mc->hdr.processor_rev_id && rev < mc->hdr.patch_id)
172 if (__apply_microcode_amd(mc) == 0) {
173 rev = mc->hdr.patch_id;
174 *new_rev = rev;
175 }
176
177 offset = header[1] + SECTION_HDR_SIZE;
178 data += offset;
179 left -= offset;
180 }
181
182 /* mark where this microcode container file ends */
183 offset = *usize - (data - (u8 *)ucode);
184 *usize -= offset;
185
186 if (!(*new_rev))
187 *usize = 0;
188}
189
190void __init load_ucode_amd_bsp(void)
191{
192 struct cpio_data cd = find_ucode_in_initrd();
193 if (!cd.data)
194 return;
195
196 apply_ucode_in_initrd(cd.data, cd.size);
197}
198
199#ifdef CONFIG_X86_32
200u8 amd_bsp_mpb[MPB_MAX_SIZE];
201
202/*
203 * On 32-bit, since AP's early load occurs before paging is turned on, we
204 * cannot traverse cpu_equiv_table and pcache in kernel heap memory. So during
205 * cold boot, AP will apply_ucode_in_initrd() just like the BSP. During
206 * save_microcode_in_initrd_amd() BSP's patch is copied to amd_bsp_mpb, which
207 * is used upon resume from suspend.
208 */
209void __cpuinit load_ucode_amd_ap(void)
210{
211 struct microcode_amd *mc;
212 unsigned long *initrd;
213 unsigned long *uoffset;
214 size_t *usize;
215 void *ucode;
216
217 mc = (struct microcode_amd *)__pa(amd_bsp_mpb);
218 if (mc->hdr.patch_id && mc->hdr.processor_rev_id) {
219 __apply_microcode_amd(mc);
220 return;
221 }
222
223 initrd = (unsigned long *)__pa(&initrd_start);
224 uoffset = (unsigned long *)__pa(&ucode_offset);
225 usize = (size_t *)__pa(&ucode_size);
226
227 if (!*usize || !*initrd)
228 return;
229
230 ucode = (void *)((unsigned long)__pa(*initrd) + *uoffset);
231 apply_ucode_in_initrd(ucode, *usize);
232}
233
234static void __init collect_cpu_sig_on_bsp(void *arg)
235{
236 unsigned int cpu = smp_processor_id();
237 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
238 uci->cpu_sig.sig = cpuid_eax(0x00000001);
239}
240#else
241static void __cpuinit collect_cpu_info_amd_early(struct cpuinfo_x86 *c,
242 struct ucode_cpu_info *uci)
243{
244 u32 rev, eax;
245
246 rdmsr(MSR_AMD64_PATCH_LEVEL, rev, eax);
247 eax = cpuid_eax(0x00000001);
248
249 uci->cpu_sig.sig = eax;
250 uci->cpu_sig.rev = rev;
251 c->microcode = rev;
252 c->x86 = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
253}
254
255void __cpuinit load_ucode_amd_ap(void)
256{
257 unsigned int cpu = smp_processor_id();
258
259 collect_cpu_info_amd_early(&cpu_data(cpu), ucode_cpu_info + cpu);
260
261 if (cpu && !ucode_loaded) {
262 void *ucode;
263
264 if (!ucode_size || !initrd_start)
265 return;
266
267 ucode = (void *)(initrd_start + ucode_offset);
268 if (load_microcode_amd(0, ucode, ucode_size) != UCODE_OK)
269 return;
270 ucode_loaded = true;
271 }
272
273 apply_microcode_amd(cpu);
274}
275#endif
276
277int __init save_microcode_in_initrd_amd(void)
278{
279 enum ucode_state ret;
280 void *ucode;
281#ifdef CONFIG_X86_32
282 unsigned int bsp = boot_cpu_data.cpu_index;
283 struct ucode_cpu_info *uci = ucode_cpu_info + bsp;
284
285 if (!uci->cpu_sig.sig)
286 smp_call_function_single(bsp, collect_cpu_sig_on_bsp, NULL, 1);
287#endif
288 if (ucode_new_rev)
289 pr_info("microcode: updated early to new patch_level=0x%08x\n",
290 ucode_new_rev);
291
292 if (ucode_loaded || !ucode_size || !initrd_start)
293 return 0;
294
295 ucode = (void *)(initrd_start + ucode_offset);
296 ret = load_microcode_amd(0, ucode, ucode_size);
297 if (ret != UCODE_OK)
298 return -EINVAL;
299
300 ucode_loaded = true;
301 return 0;
302}
diff --git a/arch/x86/kernel/microcode_core_early.c b/arch/x86/kernel/microcode_core_early.c
index 833d51d6ee06..86119f63db0c 100644
--- a/arch/x86/kernel/microcode_core_early.c
+++ b/arch/x86/kernel/microcode_core_early.c
@@ -18,6 +18,7 @@
18 */ 18 */
19#include <linux/module.h> 19#include <linux/module.h>
20#include <asm/microcode_intel.h> 20#include <asm/microcode_intel.h>
21#include <asm/microcode_amd.h>
21#include <asm/processor.h> 22#include <asm/processor.h>
22 23
23#define QCHAR(a, b, c, d) ((a) + ((b) << 8) + ((c) << 16) + ((d) << 24)) 24#define QCHAR(a, b, c, d) ((a) + ((b) << 8) + ((c) << 16) + ((d) << 24))
@@ -81,8 +82,18 @@ void __init load_ucode_bsp(void)
81 vendor = x86_vendor(); 82 vendor = x86_vendor();
82 x86 = x86_family(); 83 x86 = x86_family();
83 84
84 if (vendor == X86_VENDOR_INTEL && x86 >= 6) 85 switch (vendor) {
85 load_ucode_intel_bsp(); 86 case X86_VENDOR_INTEL:
87 if (x86 >= 6)
88 load_ucode_intel_bsp();
89 break;
90 case X86_VENDOR_AMD:
91 if (x86 >= 0x10)
92 load_ucode_amd_bsp();
93 break;
94 default:
95 break;
96 }
86} 97}
87 98
88void __cpuinit load_ucode_ap(void) 99void __cpuinit load_ucode_ap(void)
@@ -95,6 +106,36 @@ void __cpuinit load_ucode_ap(void)
95 vendor = x86_vendor(); 106 vendor = x86_vendor();
96 x86 = x86_family(); 107 x86 = x86_family();
97 108
98 if (vendor == X86_VENDOR_INTEL && x86 >= 6) 109 switch (vendor) {
99 load_ucode_intel_ap(); 110 case X86_VENDOR_INTEL:
111 if (x86 >= 6)
112 load_ucode_intel_ap();
113 break;
114 case X86_VENDOR_AMD:
115 if (x86 >= 0x10)
116 load_ucode_amd_ap();
117 break;
118 default:
119 break;
120 }
121}
122
123int __init save_microcode_in_initrd(void)
124{
125 struct cpuinfo_x86 *c = &boot_cpu_data;
126
127 switch (c->x86_vendor) {
128 case X86_VENDOR_INTEL:
129 if (c->x86 >= 6)
130 save_microcode_in_initrd_intel();
131 break;
132 case X86_VENDOR_AMD:
133 if (c->x86 >= 0x10)
134 save_microcode_in_initrd_amd();
135 break;
136 default:
137 break;
138 }
139
140 return 0;
100} 141}
diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c
index 2e9e12871c2b..dabef95506f3 100644
--- a/arch/x86/kernel/microcode_intel_early.c
+++ b/arch/x86/kernel/microcode_intel_early.c
@@ -529,7 +529,7 @@ int save_mc_for_early(u8 *mc)
529 */ 529 */
530 ret = save_microcode(&mc_saved_data, mc_saved_tmp, mc_saved_count); 530 ret = save_microcode(&mc_saved_data, mc_saved_tmp, mc_saved_count);
531 if (ret) { 531 if (ret) {
532 pr_err("Can not save microcode patch.\n"); 532 pr_err("Cannot save microcode patch.\n");
533 goto out; 533 goto out;
534 } 534 }
535 535
@@ -699,7 +699,7 @@ static int __cpuinit apply_microcode_early(struct mc_saved_data *mc_saved_data,
699 * This function converts microcode patch offsets previously stored in 699 * This function converts microcode patch offsets previously stored in
700 * mc_saved_in_initrd to pointers and stores the pointers in mc_saved_data. 700 * mc_saved_in_initrd to pointers and stores the pointers in mc_saved_data.
701 */ 701 */
702int __init save_microcode_in_initrd(void) 702int __init save_microcode_in_initrd_intel(void)
703{ 703{
704 unsigned int count = mc_saved_data.mc_saved_count; 704 unsigned int count = mc_saved_data.mc_saved_count;
705 struct microcode_intel *mc_saved[MAX_UCODE_COUNT]; 705 struct microcode_intel *mc_saved[MAX_UCODE_COUNT];
@@ -711,7 +711,7 @@ int __init save_microcode_in_initrd(void)
711 microcode_pointer(mc_saved, mc_saved_in_initrd, initrd_start, count); 711 microcode_pointer(mc_saved, mc_saved_in_initrd, initrd_start, count);
712 ret = save_microcode(&mc_saved_data, mc_saved, count); 712 ret = save_microcode(&mc_saved_data, mc_saved, count);
713 if (ret) 713 if (ret)
714 pr_err("Can not save microcod patches from initrd"); 714 pr_err("Cannot save microcode patches from initrd.\n");
715 715
716 show_saved_mc(); 716 show_saved_mc();
717 717
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 60308053fdb2..0920212e6159 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -14,6 +14,7 @@
14#include <linux/kprobes.h> 14#include <linux/kprobes.h>
15#include <linux/kdebug.h> 15#include <linux/kdebug.h>
16#include <linux/nmi.h> 16#include <linux/nmi.h>
17#include <linux/debugfs.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/hardirq.h> 19#include <linux/hardirq.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
@@ -29,6 +30,9 @@
29#include <asm/nmi.h> 30#include <asm/nmi.h>
30#include <asm/x86_init.h> 31#include <asm/x86_init.h>
31 32
33#define CREATE_TRACE_POINTS
34#include <trace/events/nmi.h>
35
32struct nmi_desc { 36struct nmi_desc {
33 spinlock_t lock; 37 spinlock_t lock;
34 struct list_head head; 38 struct list_head head;
@@ -82,6 +86,15 @@ __setup("unknown_nmi_panic", setup_unknown_nmi_panic);
82 86
83#define nmi_to_desc(type) (&nmi_desc[type]) 87#define nmi_to_desc(type) (&nmi_desc[type])
84 88
89static u64 nmi_longest_ns = 1 * NSEC_PER_MSEC;
90static int __init nmi_warning_debugfs(void)
91{
92 debugfs_create_u64("nmi_longest_ns", 0644,
93 arch_debugfs_dir, &nmi_longest_ns);
94 return 0;
95}
96fs_initcall(nmi_warning_debugfs);
97
85static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b) 98static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
86{ 99{
87 struct nmi_desc *desc = nmi_to_desc(type); 100 struct nmi_desc *desc = nmi_to_desc(type);
@@ -96,8 +109,27 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
96 * can be latched at any given time. Walk the whole list 109 * can be latched at any given time. Walk the whole list
97 * to handle those situations. 110 * to handle those situations.
98 */ 111 */
99 list_for_each_entry_rcu(a, &desc->head, list) 112 list_for_each_entry_rcu(a, &desc->head, list) {
100 handled += a->handler(type, regs); 113 u64 before, delta, whole_msecs;
114 int decimal_msecs, thishandled;
115
116 before = local_clock();
117 thishandled = a->handler(type, regs);
118 handled += thishandled;
119 delta = local_clock() - before;
120 trace_nmi_handler(a->handler, (int)delta, thishandled);
121
122 if (delta < nmi_longest_ns)
123 continue;
124
125 nmi_longest_ns = delta;
126 whole_msecs = do_div(delta, (1000 * 1000));
127 decimal_msecs = do_div(delta, 1000) % 1000;
128 printk_ratelimited(KERN_INFO
129 "INFO: NMI handler (%ps) took too long to run: "
130 "%lld.%03d msecs\n", a->handler, whole_msecs,
131 decimal_msecs);
132 }
101 133
102 rcu_read_unlock(); 134 rcu_read_unlock();
103 135
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 4e7a37ff03ab..81a5f5e8f142 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -277,18 +277,6 @@ void exit_idle(void)
277} 277}
278#endif 278#endif
279 279
280void arch_cpu_idle_prepare(void)
281{
282 /*
283 * If we're the non-boot CPU, nothing set the stack canary up
284 * for us. CPU0 already has it initialized but no harm in
285 * doing it again. This is a good place for updating it, as
286 * we wont ever return from this function (so the invalid
287 * canaries already on the stack wont ever trigger).
288 */
289 boot_init_stack_canary();
290}
291
292void arch_cpu_idle_enter(void) 280void arch_cpu_idle_enter(void)
293{ 281{
294 local_touch_nmi(); 282 local_touch_nmi();
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 7305f7dfc7ab..f8adefca71dc 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -110,11 +110,16 @@ void __show_regs(struct pt_regs *regs, int all)
110 get_debugreg(d1, 1); 110 get_debugreg(d1, 1);
111 get_debugreg(d2, 2); 111 get_debugreg(d2, 2);
112 get_debugreg(d3, 3); 112 get_debugreg(d3, 3);
113 printk(KERN_DEFAULT "DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
114 d0, d1, d2, d3);
115
116 get_debugreg(d6, 6); 113 get_debugreg(d6, 6);
117 get_debugreg(d7, 7); 114 get_debugreg(d7, 7);
115
116 /* Only print out debug registers if they are in their non-default state. */
117 if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
118 (d6 == DR6_RESERVED) && (d7 == 0x400))
119 return;
120
121 printk(KERN_DEFAULT "DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
122 d0, d1, d2, d3);
118 printk(KERN_DEFAULT "DR6: %08lx DR7: %08lx\n", 123 printk(KERN_DEFAULT "DR6: %08lx DR7: %08lx\n",
119 d6, d7); 124 d6, d7);
120} 125}
@@ -147,7 +152,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
147 childregs->bp = arg; 152 childregs->bp = arg;
148 childregs->orig_ax = -1; 153 childregs->orig_ax = -1;
149 childregs->cs = __KERNEL_CS | get_kernel_rpl(); 154 childregs->cs = __KERNEL_CS | get_kernel_rpl();
150 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_BIT1; 155 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
151 p->fpu_counter = 0; 156 p->fpu_counter = 0;
152 p->thread.io_bitmap_ptr = NULL; 157 p->thread.io_bitmap_ptr = NULL;
153 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps)); 158 memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 355ae06dbf94..05646bab4ca6 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -105,11 +105,18 @@ void __show_regs(struct pt_regs *regs, int all)
105 get_debugreg(d0, 0); 105 get_debugreg(d0, 0);
106 get_debugreg(d1, 1); 106 get_debugreg(d1, 1);
107 get_debugreg(d2, 2); 107 get_debugreg(d2, 2);
108 printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
109 get_debugreg(d3, 3); 108 get_debugreg(d3, 3);
110 get_debugreg(d6, 6); 109 get_debugreg(d6, 6);
111 get_debugreg(d7, 7); 110 get_debugreg(d7, 7);
111
112 /* Only print out debug registers if they are in their non-default state. */
113 if ((d0 == 0) && (d1 == 0) && (d2 == 0) && (d3 == 0) &&
114 (d6 == DR6_RESERVED) && (d7 == 0x400))
115 return;
116
117 printk(KERN_DEFAULT "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
112 printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); 118 printk(KERN_DEFAULT "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
119
113} 120}
114 121
115void release_thread(struct task_struct *dead_task) 122void release_thread(struct task_struct *dead_task)
@@ -176,7 +183,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
176 childregs->bp = arg; 183 childregs->bp = arg;
177 childregs->orig_ax = -1; 184 childregs->orig_ax = -1;
178 childregs->cs = __KERNEL_CS | get_kernel_rpl(); 185 childregs->cs = __KERNEL_CS | get_kernel_rpl();
179 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_BIT1; 186 childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
180 return 0; 187 return 0;
181 } 188 }
182 *childregs = *current_pt_regs(); 189 *childregs = *current_pt_regs();
diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S
index 36818f8ec2be..e13f8e7c22a6 100644
--- a/arch/x86/kernel/relocate_kernel_32.S
+++ b/arch/x86/kernel/relocate_kernel_32.S
@@ -186,7 +186,7 @@ identity_mapped:
186 movl CP_PA_PGD(%ebx), %eax 186 movl CP_PA_PGD(%ebx), %eax
187 movl %eax, %cr3 187 movl %eax, %cr3
188 movl %cr0, %eax 188 movl %cr0, %eax
189 orl $(1<<31), %eax 189 orl $X86_CR0_PG, %eax
190 movl %eax, %cr0 190 movl %eax, %cr0
191 lea PAGE_SIZE(%edi), %esp 191 lea PAGE_SIZE(%edi), %esp
192 movl %edi, %eax 192 movl %edi, %eax
diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
index 7a6f3b3be3cf..3fd2c693e475 100644
--- a/arch/x86/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
@@ -151,21 +151,21 @@ identity_mapped:
151 151
152 testq %r11, %r11 152 testq %r11, %r11
153 jnz 1f 153 jnz 1f
154 xorq %rax, %rax 154 xorl %eax, %eax
155 xorq %rbx, %rbx 155 xorl %ebx, %ebx
156 xorq %rcx, %rcx 156 xorl %ecx, %ecx
157 xorq %rdx, %rdx 157 xorl %edx, %edx
158 xorq %rsi, %rsi 158 xorl %esi, %esi
159 xorq %rdi, %rdi 159 xorl %edi, %edi
160 xorq %rbp, %rbp 160 xorl %ebp, %ebp
161 xorq %r8, %r8 161 xorl %r8d, %r8d
162 xorq %r9, %r9 162 xorl %r9d, %r9d
163 xorq %r10, %r9 163 xorl %r10d, %r10d
164 xorq %r11, %r11 164 xorl %r11d, %r11d
165 xorq %r12, %r12 165 xorl %r12d, %r12d
166 xorq %r13, %r13 166 xorl %r13d, %r13d
167 xorq %r14, %r14 167 xorl %r14d, %r14d
168 xorq %r15, %r15 168 xorl %r15d, %r15d
169 169
170 ret 170 ret
171 171
@@ -212,8 +212,8 @@ virtual_mapped:
212 /* Do the copies */ 212 /* Do the copies */
213swap_pages: 213swap_pages:
214 movq %rdi, %rcx /* Put the page_list in %rcx */ 214 movq %rdi, %rcx /* Put the page_list in %rcx */
215 xorq %rdi, %rdi 215 xorl %edi, %edi
216 xorq %rsi, %rsi 216 xorl %esi, %esi
217 jmp 1f 217 jmp 1f
218 218
2190: /* top, read another word for the indirection page */ 2190: /* top, read another word for the indirection page */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 56f7fcfe7fa2..e68709da8251 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1040,8 +1040,6 @@ void __init setup_arch(char **cmdline_p)
1040 /* max_low_pfn get updated here */ 1040 /* max_low_pfn get updated here */
1041 find_low_pfn_range(); 1041 find_low_pfn_range();
1042#else 1042#else
1043 num_physpages = max_pfn;
1044
1045 check_x2apic(); 1043 check_x2apic();
1046 1044
1047 /* How many end-of-memory variables you have, grandma! */ 1045 /* How many end-of-memory variables you have, grandma! */
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 69562992e457..cf913587d4dd 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -43,12 +43,6 @@
43 43
44#include <asm/sigframe.h> 44#include <asm/sigframe.h>
45 45
46#ifdef CONFIG_X86_32
47# define FIX_EFLAGS (__FIX_EFLAGS | X86_EFLAGS_RF)
48#else
49# define FIX_EFLAGS __FIX_EFLAGS
50#endif
51
52#define COPY(x) do { \ 46#define COPY(x) do { \
53 get_user_ex(regs->x, &sc->x); \ 47 get_user_ex(regs->x, &sc->x); \
54} while (0) 48} while (0)
@@ -668,15 +662,17 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
668 if (!failed) { 662 if (!failed) {
669 /* 663 /*
670 * Clear the direction flag as per the ABI for function entry. 664 * Clear the direction flag as per the ABI for function entry.
671 */ 665 *
672 regs->flags &= ~X86_EFLAGS_DF; 666 * Clear RF when entering the signal handler, because
673 /* 667 * it might disable possible debug exception from the
668 * signal handler.
669 *
674 * Clear TF when entering the signal handler, but 670 * Clear TF when entering the signal handler, but
675 * notify any tracer that was single-stepping it. 671 * notify any tracer that was single-stepping it.
676 * The tracer may want to single-step inside the 672 * The tracer may want to single-step inside the
677 * handler too. 673 * handler too.
678 */ 674 */
679 regs->flags &= ~X86_EFLAGS_TF; 675 regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF);
680 } 676 }
681 signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP)); 677 signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
682} 678}
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 48d2b7ded422..f4fe0b8879e0 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -30,6 +30,7 @@
30#include <asm/proto.h> 30#include <asm/proto.h>
31#include <asm/apic.h> 31#include <asm/apic.h>
32#include <asm/nmi.h> 32#include <asm/nmi.h>
33#include <asm/trace/irq_vectors.h>
33/* 34/*
34 * Some notes on x86 processor bugs affecting SMP operation: 35 * Some notes on x86 processor bugs affecting SMP operation:
35 * 36 *
@@ -249,32 +250,80 @@ finish:
249/* 250/*
250 * Reschedule call back. 251 * Reschedule call back.
251 */ 252 */
252void smp_reschedule_interrupt(struct pt_regs *regs) 253static inline void __smp_reschedule_interrupt(void)
253{ 254{
254 ack_APIC_irq();
255 inc_irq_stat(irq_resched_count); 255 inc_irq_stat(irq_resched_count);
256 scheduler_ipi(); 256 scheduler_ipi();
257}
258
259void smp_reschedule_interrupt(struct pt_regs *regs)
260{
261 ack_APIC_irq();
262 __smp_reschedule_interrupt();
257 /* 263 /*
258 * KVM uses this interrupt to force a cpu out of guest mode 264 * KVM uses this interrupt to force a cpu out of guest mode
259 */ 265 */
260} 266}
261 267
262void smp_call_function_interrupt(struct pt_regs *regs) 268void smp_trace_reschedule_interrupt(struct pt_regs *regs)
269{
270 ack_APIC_irq();
271 trace_reschedule_entry(RESCHEDULE_VECTOR);
272 __smp_reschedule_interrupt();
273 trace_reschedule_exit(RESCHEDULE_VECTOR);
274 /*
275 * KVM uses this interrupt to force a cpu out of guest mode
276 */
277}
278
279static inline void call_function_entering_irq(void)
263{ 280{
264 ack_APIC_irq(); 281 ack_APIC_irq();
265 irq_enter(); 282 irq_enter();
283}
284
285static inline void __smp_call_function_interrupt(void)
286{
266 generic_smp_call_function_interrupt(); 287 generic_smp_call_function_interrupt();
267 inc_irq_stat(irq_call_count); 288 inc_irq_stat(irq_call_count);
268 irq_exit();
269} 289}
270 290
271void smp_call_function_single_interrupt(struct pt_regs *regs) 291void smp_call_function_interrupt(struct pt_regs *regs)
292{
293 call_function_entering_irq();
294 __smp_call_function_interrupt();
295 exiting_irq();
296}
297
298void smp_trace_call_function_interrupt(struct pt_regs *regs)
299{
300 call_function_entering_irq();
301 trace_call_function_entry(CALL_FUNCTION_VECTOR);
302 __smp_call_function_interrupt();
303 trace_call_function_exit(CALL_FUNCTION_VECTOR);
304 exiting_irq();
305}
306
307static inline void __smp_call_function_single_interrupt(void)
272{ 308{
273 ack_APIC_irq();
274 irq_enter();
275 generic_smp_call_function_single_interrupt(); 309 generic_smp_call_function_single_interrupt();
276 inc_irq_stat(irq_call_count); 310 inc_irq_stat(irq_call_count);
277 irq_exit(); 311}
312
313void smp_call_function_single_interrupt(struct pt_regs *regs)
314{
315 call_function_entering_irq();
316 __smp_call_function_single_interrupt();
317 exiting_irq();
318}
319
320void smp_trace_call_function_single_interrupt(struct pt_regs *regs)
321{
322 call_function_entering_irq();
323 trace_call_function_single_entry(CALL_FUNCTION_SINGLE_VECTOR);
324 __smp_call_function_single_interrupt();
325 trace_call_function_single_exit(CALL_FUNCTION_SINGLE_VECTOR);
326 exiting_irq();
278} 327}
279 328
280static int __init nonmi_ipi_setup(char *str) 329static int __init nonmi_ipi_setup(char *str)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 9c73b51817e4..bfd348e99369 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -372,15 +372,15 @@ static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
372 372
373void __cpuinit set_cpu_sibling_map(int cpu) 373void __cpuinit set_cpu_sibling_map(int cpu)
374{ 374{
375 bool has_mc = boot_cpu_data.x86_max_cores > 1;
376 bool has_smt = smp_num_siblings > 1; 375 bool has_smt = smp_num_siblings > 1;
376 bool has_mp = has_smt || boot_cpu_data.x86_max_cores > 1;
377 struct cpuinfo_x86 *c = &cpu_data(cpu); 377 struct cpuinfo_x86 *c = &cpu_data(cpu);
378 struct cpuinfo_x86 *o; 378 struct cpuinfo_x86 *o;
379 int i; 379 int i;
380 380
381 cpumask_set_cpu(cpu, cpu_sibling_setup_mask); 381 cpumask_set_cpu(cpu, cpu_sibling_setup_mask);
382 382
383 if (!has_smt && !has_mc) { 383 if (!has_mp) {
384 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu)); 384 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
385 cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu)); 385 cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu));
386 cpumask_set_cpu(cpu, cpu_core_mask(cpu)); 386 cpumask_set_cpu(cpu, cpu_core_mask(cpu));
@@ -394,7 +394,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
394 if ((i == cpu) || (has_smt && match_smt(c, o))) 394 if ((i == cpu) || (has_smt && match_smt(c, o)))
395 link_mask(sibling, cpu, i); 395 link_mask(sibling, cpu, i);
396 396
397 if ((i == cpu) || (has_mc && match_llc(c, o))) 397 if ((i == cpu) || (has_mp && match_llc(c, o)))
398 link_mask(llc_shared, cpu, i); 398 link_mask(llc_shared, cpu, i);
399 399
400 } 400 }
@@ -406,7 +406,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
406 for_each_cpu(i, cpu_sibling_setup_mask) { 406 for_each_cpu(i, cpu_sibling_setup_mask) {
407 o = &cpu_data(i); 407 o = &cpu_data(i);
408 408
409 if ((i == cpu) || (has_mc && match_mc(c, o))) { 409 if ((i == cpu) || (has_mp && match_mc(c, o))) {
410 link_mask(core, cpu, i); 410 link_mask(core, cpu, i);
411 411
412 /* 412 /*
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00fad48..3ff42d2f046d 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -31,6 +31,7 @@
31#include <linux/pfn.h> 31#include <linux/pfn.h>
32#include <linux/mm.h> 32#include <linux/mm.h>
33#include <linux/tboot.h> 33#include <linux/tboot.h>
34#include <linux/debugfs.h>
34 35
35#include <asm/realmode.h> 36#include <asm/realmode.h>
36#include <asm/processor.h> 37#include <asm/processor.h>
@@ -338,6 +339,73 @@ static struct notifier_block tboot_cpu_notifier __cpuinitdata =
338 .notifier_call = tboot_cpu_callback, 339 .notifier_call = tboot_cpu_callback,
339}; 340};
340 341
342#ifdef CONFIG_DEBUG_FS
343
344#define TBOOT_LOG_UUID { 0x26, 0x25, 0x19, 0xc0, 0x30, 0x6b, 0xb4, 0x4d, \
345 0x4c, 0x84, 0xa3, 0xe9, 0x53, 0xb8, 0x81, 0x74 }
346
347#define TBOOT_SERIAL_LOG_ADDR 0x60000
348#define TBOOT_SERIAL_LOG_SIZE 0x08000
349#define LOG_MAX_SIZE_OFF 16
350#define LOG_BUF_OFF 24
351
352static uint8_t tboot_log_uuid[16] = TBOOT_LOG_UUID;
353
354static ssize_t tboot_log_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos)
355{
356 void __iomem *log_base;
357 u8 log_uuid[16];
358 u32 max_size;
359 void *kbuf;
360 int ret = -EFAULT;
361
362 log_base = ioremap_nocache(TBOOT_SERIAL_LOG_ADDR, TBOOT_SERIAL_LOG_SIZE);
363 if (!log_base)
364 return ret;
365
366 memcpy_fromio(log_uuid, log_base, sizeof(log_uuid));
367 if (memcmp(&tboot_log_uuid, log_uuid, sizeof(log_uuid)))
368 goto err_iounmap;
369
370 max_size = readl(log_base + LOG_MAX_SIZE_OFF);
371 if (*ppos >= max_size) {
372 ret = 0;
373 goto err_iounmap;
374 }
375
376 if (*ppos + count > max_size)
377 count = max_size - *ppos;
378
379 kbuf = kmalloc(count, GFP_KERNEL);
380 if (!kbuf) {
381 ret = -ENOMEM;
382 goto err_iounmap;
383 }
384
385 memcpy_fromio(kbuf, log_base + LOG_BUF_OFF + *ppos, count);
386 if (copy_to_user(user_buf, kbuf, count))
387 goto err_kfree;
388
389 *ppos += count;
390
391 ret = count;
392
393err_kfree:
394 kfree(kbuf);
395
396err_iounmap:
397 iounmap(log_base);
398
399 return ret;
400}
401
402static const struct file_operations tboot_log_fops = {
403 .read = tboot_log_read,
404 .llseek = default_llseek,
405};
406
407#endif /* CONFIG_DEBUG_FS */
408
341static __init int tboot_late_init(void) 409static __init int tboot_late_init(void)
342{ 410{
343 if (!tboot_enabled()) 411 if (!tboot_enabled())
@@ -348,6 +416,11 @@ static __init int tboot_late_init(void)
348 atomic_set(&ap_wfs_count, 0); 416 atomic_set(&ap_wfs_count, 0);
349 register_hotcpu_notifier(&tboot_cpu_notifier); 417 register_hotcpu_notifier(&tboot_cpu_notifier);
350 418
419#ifdef CONFIG_DEBUG_FS
420 debugfs_create_file("tboot_log", S_IRUSR,
421 arch_debugfs_dir, NULL, &tboot_log_fops);
422#endif
423
351 acpi_os_set_prepare_sleep(&tboot_sleep); 424 acpi_os_set_prepare_sleep(&tboot_sleep);
352 return 0; 425 return 0;
353} 426}
diff --git a/arch/x86/kernel/tracepoint.c b/arch/x86/kernel/tracepoint.c
new file mode 100644
index 000000000000..4e584a8d6edd
--- /dev/null
+++ b/arch/x86/kernel/tracepoint.c
@@ -0,0 +1,61 @@
1/*
2 * Code for supporting irq vector tracepoints.
3 *
4 * Copyright (C) 2013 Seiji Aguchi <seiji.aguchi@hds.com>
5 *
6 */
7#include <asm/hw_irq.h>
8#include <asm/desc.h>
9#include <linux/atomic.h>
10
11atomic_t trace_idt_ctr = ATOMIC_INIT(0);
12struct desc_ptr trace_idt_descr = { NR_VECTORS * 16 - 1,
13 (unsigned long) trace_idt_table };
14
15#ifndef CONFIG_X86_64
16gate_desc trace_idt_table[NR_VECTORS] __page_aligned_data
17 = { { { { 0, 0 } } }, };
18#endif
19
20static int trace_irq_vector_refcount;
21static DEFINE_MUTEX(irq_vector_mutex);
22
23static void set_trace_idt_ctr(int val)
24{
25 atomic_set(&trace_idt_ctr, val);
26 /* Ensure the trace_idt_ctr is set before sending IPI */
27 wmb();
28}
29
30static void switch_idt(void *arg)
31{
32 unsigned long flags;
33
34 local_irq_save(flags);
35 load_current_idt();
36 local_irq_restore(flags);
37}
38
39void trace_irq_vector_regfunc(void)
40{
41 mutex_lock(&irq_vector_mutex);
42 if (!trace_irq_vector_refcount) {
43 set_trace_idt_ctr(1);
44 smp_call_function(switch_idt, NULL, 0);
45 switch_idt(NULL);
46 }
47 trace_irq_vector_refcount++;
48 mutex_unlock(&irq_vector_mutex);
49}
50
51void trace_irq_vector_unregfunc(void)
52{
53 mutex_lock(&irq_vector_mutex);
54 trace_irq_vector_refcount--;
55 if (!trace_irq_vector_refcount) {
56 set_trace_idt_ctr(0);
57 smp_call_function(switch_idt, NULL, 0);
58 switch_idt(NULL);
59 }
60 mutex_unlock(&irq_vector_mutex);
61}
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 772e2a846dec..b0865e88d3cc 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -254,6 +254,9 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
254 tsk->thread.error_code = error_code; 254 tsk->thread.error_code = error_code;
255 tsk->thread.trap_nr = X86_TRAP_DF; 255 tsk->thread.trap_nr = X86_TRAP_DF;
256 256
257#ifdef CONFIG_DOUBLEFAULT
258 df_debug(regs, error_code);
259#endif
257 /* 260 /*
258 * This is always a kernel trap and never fixable (and thus must 261 * This is always a kernel trap and never fixable (and thus must
259 * never return). 262 * never return).
@@ -437,7 +440,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
437 /* Store the virtualized DR6 value */ 440 /* Store the virtualized DR6 value */
438 tsk->thread.debugreg6 = dr6; 441 tsk->thread.debugreg6 = dr6;
439 442
440 if (notify_die(DIE_DEBUG, "debug", regs, PTR_ERR(&dr6), error_code, 443 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code,
441 SIGTRAP) == NOTIFY_STOP) 444 SIGTRAP) == NOTIFY_STOP)
442 goto exit; 445 goto exit;
443 446
@@ -785,7 +788,7 @@ void __init trap_init(void)
785 x86_init.irqs.trap_init(); 788 x86_init.irqs.trap_init();
786 789
787#ifdef CONFIG_X86_64 790#ifdef CONFIG_X86_64
788 memcpy(&nmi_idt_table, &idt_table, IDT_ENTRIES * 16); 791 memcpy(&debug_idt_table, &idt_table, IDT_ENTRIES * 16);
789 set_nmi_gate(X86_TRAP_DB, &debug); 792 set_nmi_gate(X86_TRAP_DB, &debug);
790 set_nmi_gate(X86_TRAP_BP, &int3); 793 set_nmi_gate(X86_TRAP_BP, &int3);
791#endif 794#endif
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index ada87a329edc..d6c28acdf99c 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -243,7 +243,7 @@ int save_xstate_sig(void __user *buf, void __user *buf_fx, int size)
243 if (!access_ok(VERIFY_WRITE, buf, size)) 243 if (!access_ok(VERIFY_WRITE, buf, size))
244 return -EACCES; 244 return -EACCES;
245 245
246 if (!HAVE_HWFP) 246 if (!static_cpu_has(X86_FEATURE_FPU))
247 return fpregs_soft_get(current, NULL, 0, 247 return fpregs_soft_get(current, NULL, 0,
248 sizeof(struct user_i387_ia32_struct), NULL, 248 sizeof(struct user_i387_ia32_struct), NULL,
249 (struct _fpstate_ia32 __user *) buf) ? -1 : 1; 249 (struct _fpstate_ia32 __user *) buf) ? -1 : 1;
@@ -350,11 +350,10 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size)
350 if (!used_math() && init_fpu(tsk)) 350 if (!used_math() && init_fpu(tsk))
351 return -1; 351 return -1;
352 352
353 if (!HAVE_HWFP) { 353 if (!static_cpu_has(X86_FEATURE_FPU))
354 return fpregs_soft_set(current, NULL, 354 return fpregs_soft_set(current, NULL,
355 0, sizeof(struct user_i387_ia32_struct), 355 0, sizeof(struct user_i387_ia32_struct),
356 NULL, buf) != 0; 356 NULL, buf) != 0;
357 }
358 357
359 if (use_xsave()) { 358 if (use_xsave()) {
360 struct _fpx_sw_bytes fx_sw_user; 359 struct _fpx_sw_bytes fx_sw_user;
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile
index d609e1d84048..bf4fb04d0112 100644
--- a/arch/x86/kvm/Makefile
+++ b/arch/x86/kvm/Makefile
@@ -5,12 +5,13 @@ CFLAGS_x86.o := -I.
5CFLAGS_svm.o := -I. 5CFLAGS_svm.o := -I.
6CFLAGS_vmx.o := -I. 6CFLAGS_vmx.o := -I.
7 7
8kvm-y += $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \ 8KVM := ../../../virt/kvm
9 coalesced_mmio.o irq_comm.o eventfd.o \ 9
10 irqchip.o) 10kvm-y += $(KVM)/kvm_main.o $(KVM)/ioapic.o \
11kvm-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += $(addprefix ../../../virt/kvm/, \ 11 $(KVM)/coalesced_mmio.o $(KVM)/irq_comm.o \
12 assigned-dev.o iommu.o) 12 $(KVM)/eventfd.o $(KVM)/irqchip.o
13kvm-$(CONFIG_KVM_ASYNC_PF) += $(addprefix ../../../virt/kvm/, async_pf.o) 13kvm-$(CONFIG_KVM_DEVICE_ASSIGNMENT) += $(KVM)/assigned-dev.o $(KVM)/iommu.o
14kvm-$(CONFIG_KVM_ASYNC_PF) += $(KVM)/async_pf.o
14 15
15kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o \ 16kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o \
16 i8254.o cpuid.o pmu.o 17 i8254.o cpuid.o pmu.o
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 5953dcea752d..2bc1e81045b0 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -61,6 +61,8 @@
61#define OpMem8 26ull /* 8-bit zero extended memory operand */ 61#define OpMem8 26ull /* 8-bit zero extended memory operand */
62#define OpImm64 27ull /* Sign extended 16/32/64-bit immediate */ 62#define OpImm64 27ull /* Sign extended 16/32/64-bit immediate */
63#define OpXLat 28ull /* memory at BX/EBX/RBX + zero-extended AL */ 63#define OpXLat 28ull /* memory at BX/EBX/RBX + zero-extended AL */
64#define OpAccLo 29ull /* Low part of extended acc (AX/AX/EAX/RAX) */
65#define OpAccHi 30ull /* High part of extended acc (-/DX/EDX/RDX) */
64 66
65#define OpBits 5 /* Width of operand field */ 67#define OpBits 5 /* Width of operand field */
66#define OpMask ((1ull << OpBits) - 1) 68#define OpMask ((1ull << OpBits) - 1)
@@ -86,6 +88,7 @@
86#define DstMem64 (OpMem64 << DstShift) 88#define DstMem64 (OpMem64 << DstShift)
87#define DstImmUByte (OpImmUByte << DstShift) 89#define DstImmUByte (OpImmUByte << DstShift)
88#define DstDX (OpDX << DstShift) 90#define DstDX (OpDX << DstShift)
91#define DstAccLo (OpAccLo << DstShift)
89#define DstMask (OpMask << DstShift) 92#define DstMask (OpMask << DstShift)
90/* Source operand type. */ 93/* Source operand type. */
91#define SrcShift 6 94#define SrcShift 6
@@ -108,6 +111,7 @@
108#define SrcImm64 (OpImm64 << SrcShift) 111#define SrcImm64 (OpImm64 << SrcShift)
109#define SrcDX (OpDX << SrcShift) 112#define SrcDX (OpDX << SrcShift)
110#define SrcMem8 (OpMem8 << SrcShift) 113#define SrcMem8 (OpMem8 << SrcShift)
114#define SrcAccHi (OpAccHi << SrcShift)
111#define SrcMask (OpMask << SrcShift) 115#define SrcMask (OpMask << SrcShift)
112#define BitOp (1<<11) 116#define BitOp (1<<11)
113#define MemAbs (1<<12) /* Memory operand is absolute displacement */ 117#define MemAbs (1<<12) /* Memory operand is absolute displacement */
@@ -138,6 +142,7 @@
138/* Source 2 operand type */ 142/* Source 2 operand type */
139#define Src2Shift (31) 143#define Src2Shift (31)
140#define Src2None (OpNone << Src2Shift) 144#define Src2None (OpNone << Src2Shift)
145#define Src2Mem (OpMem << Src2Shift)
141#define Src2CL (OpCL << Src2Shift) 146#define Src2CL (OpCL << Src2Shift)
142#define Src2ImmByte (OpImmByte << Src2Shift) 147#define Src2ImmByte (OpImmByte << Src2Shift)
143#define Src2One (OpOne << Src2Shift) 148#define Src2One (OpOne << Src2Shift)
@@ -155,6 +160,9 @@
155#define Avx ((u64)1 << 43) /* Advanced Vector Extensions */ 160#define Avx ((u64)1 << 43) /* Advanced Vector Extensions */
156#define Fastop ((u64)1 << 44) /* Use opcode::u.fastop */ 161#define Fastop ((u64)1 << 44) /* Use opcode::u.fastop */
157#define NoWrite ((u64)1 << 45) /* No writeback */ 162#define NoWrite ((u64)1 << 45) /* No writeback */
163#define SrcWrite ((u64)1 << 46) /* Write back src operand */
164
165#define DstXacc (DstAccLo | SrcAccHi | SrcWrite)
158 166
159#define X2(x...) x, x 167#define X2(x...) x, x
160#define X3(x...) X2(x), x 168#define X3(x...) X2(x), x
@@ -171,10 +179,11 @@
171/* 179/*
172 * fastop functions have a special calling convention: 180 * fastop functions have a special calling convention:
173 * 181 *
174 * dst: [rdx]:rax (in/out) 182 * dst: rax (in/out)
175 * src: rbx (in/out) 183 * src: rdx (in/out)
176 * src2: rcx (in) 184 * src2: rcx (in)
177 * flags: rflags (in/out) 185 * flags: rflags (in/out)
186 * ex: rsi (in:fastop pointer, out:zero if exception)
178 * 187 *
179 * Moreover, they are all exactly FASTOP_SIZE bytes long, so functions for 188 * Moreover, they are all exactly FASTOP_SIZE bytes long, so functions for
180 * different operand sizes can be reached by calculation, rather than a jump 189 * different operand sizes can be reached by calculation, rather than a jump
@@ -276,174 +285,17 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
276} 285}
277 286
278/* 287/*
279 * Instruction emulation:
280 * Most instructions are emulated directly via a fragment of inline assembly
281 * code. This allows us to save/restore EFLAGS and thus very easily pick up
282 * any modified flags.
283 */
284
285#if defined(CONFIG_X86_64)
286#define _LO32 "k" /* force 32-bit operand */
287#define _STK "%%rsp" /* stack pointer */
288#elif defined(__i386__)
289#define _LO32 "" /* force 32-bit operand */
290#define _STK "%%esp" /* stack pointer */
291#endif
292
293/*
294 * These EFLAGS bits are restored from saved value during emulation, and 288 * These EFLAGS bits are restored from saved value during emulation, and
295 * any changes are written back to the saved value after emulation. 289 * any changes are written back to the saved value after emulation.
296 */ 290 */
297#define EFLAGS_MASK (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF) 291#define EFLAGS_MASK (EFLG_OF|EFLG_SF|EFLG_ZF|EFLG_AF|EFLG_PF|EFLG_CF)
298 292
299/* Before executing instruction: restore necessary bits in EFLAGS. */
300#define _PRE_EFLAGS(_sav, _msk, _tmp) \
301 /* EFLAGS = (_sav & _msk) | (EFLAGS & ~_msk); _sav &= ~_msk; */ \
302 "movl %"_sav",%"_LO32 _tmp"; " \
303 "push %"_tmp"; " \
304 "push %"_tmp"; " \
305 "movl %"_msk",%"_LO32 _tmp"; " \
306 "andl %"_LO32 _tmp",("_STK"); " \
307 "pushf; " \
308 "notl %"_LO32 _tmp"; " \
309 "andl %"_LO32 _tmp",("_STK"); " \
310 "andl %"_LO32 _tmp","__stringify(BITS_PER_LONG/4)"("_STK"); " \
311 "pop %"_tmp"; " \
312 "orl %"_LO32 _tmp",("_STK"); " \
313 "popf; " \
314 "pop %"_sav"; "
315
316/* After executing instruction: write-back necessary bits in EFLAGS. */
317#define _POST_EFLAGS(_sav, _msk, _tmp) \
318 /* _sav |= EFLAGS & _msk; */ \
319 "pushf; " \
320 "pop %"_tmp"; " \
321 "andl %"_msk",%"_LO32 _tmp"; " \
322 "orl %"_LO32 _tmp",%"_sav"; "
323
324#ifdef CONFIG_X86_64 293#ifdef CONFIG_X86_64
325#define ON64(x) x 294#define ON64(x) x
326#else 295#else
327#define ON64(x) 296#define ON64(x)
328#endif 297#endif
329 298
330#define ____emulate_2op(ctxt, _op, _x, _y, _suffix, _dsttype) \
331 do { \
332 __asm__ __volatile__ ( \
333 _PRE_EFLAGS("0", "4", "2") \
334 _op _suffix " %"_x"3,%1; " \
335 _POST_EFLAGS("0", "4", "2") \
336 : "=m" ((ctxt)->eflags), \
337 "+q" (*(_dsttype*)&(ctxt)->dst.val), \
338 "=&r" (_tmp) \
339 : _y ((ctxt)->src.val), "i" (EFLAGS_MASK)); \
340 } while (0)
341
342
343/* Raw emulation: instruction has two explicit operands. */
344#define __emulate_2op_nobyte(ctxt,_op,_wx,_wy,_lx,_ly,_qx,_qy) \
345 do { \
346 unsigned long _tmp; \
347 \
348 switch ((ctxt)->dst.bytes) { \
349 case 2: \
350 ____emulate_2op(ctxt,_op,_wx,_wy,"w",u16); \
351 break; \
352 case 4: \
353 ____emulate_2op(ctxt,_op,_lx,_ly,"l",u32); \
354 break; \
355 case 8: \
356 ON64(____emulate_2op(ctxt,_op,_qx,_qy,"q",u64)); \
357 break; \
358 } \
359 } while (0)
360
361#define __emulate_2op(ctxt,_op,_bx,_by,_wx,_wy,_lx,_ly,_qx,_qy) \
362 do { \
363 unsigned long _tmp; \
364 switch ((ctxt)->dst.bytes) { \
365 case 1: \
366 ____emulate_2op(ctxt,_op,_bx,_by,"b",u8); \
367 break; \
368 default: \
369 __emulate_2op_nobyte(ctxt, _op, \
370 _wx, _wy, _lx, _ly, _qx, _qy); \
371 break; \
372 } \
373 } while (0)
374
375/* Source operand is byte-sized and may be restricted to just %cl. */
376#define emulate_2op_SrcB(ctxt, _op) \
377 __emulate_2op(ctxt, _op, "b", "c", "b", "c", "b", "c", "b", "c")
378
379/* Source operand is byte, word, long or quad sized. */
380#define emulate_2op_SrcV(ctxt, _op) \
381 __emulate_2op(ctxt, _op, "b", "q", "w", "r", _LO32, "r", "", "r")
382
383/* Source operand is word, long or quad sized. */
384#define emulate_2op_SrcV_nobyte(ctxt, _op) \
385 __emulate_2op_nobyte(ctxt, _op, "w", "r", _LO32, "r", "", "r")
386
387/* Instruction has three operands and one operand is stored in ECX register */
388#define __emulate_2op_cl(ctxt, _op, _suffix, _type) \
389 do { \
390 unsigned long _tmp; \
391 _type _clv = (ctxt)->src2.val; \
392 _type _srcv = (ctxt)->src.val; \
393 _type _dstv = (ctxt)->dst.val; \
394 \
395 __asm__ __volatile__ ( \
396 _PRE_EFLAGS("0", "5", "2") \
397 _op _suffix " %4,%1 \n" \
398 _POST_EFLAGS("0", "5", "2") \
399 : "=m" ((ctxt)->eflags), "+r" (_dstv), "=&r" (_tmp) \
400 : "c" (_clv) , "r" (_srcv), "i" (EFLAGS_MASK) \
401 ); \
402 \
403 (ctxt)->src2.val = (unsigned long) _clv; \
404 (ctxt)->src2.val = (unsigned long) _srcv; \
405 (ctxt)->dst.val = (unsigned long) _dstv; \
406 } while (0)
407
408#define emulate_2op_cl(ctxt, _op) \
409 do { \
410 switch ((ctxt)->dst.bytes) { \
411 case 2: \
412 __emulate_2op_cl(ctxt, _op, "w", u16); \
413 break; \
414 case 4: \
415 __emulate_2op_cl(ctxt, _op, "l", u32); \
416 break; \
417 case 8: \
418 ON64(__emulate_2op_cl(ctxt, _op, "q", ulong)); \
419 break; \
420 } \
421 } while (0)
422
423#define __emulate_1op(ctxt, _op, _suffix) \
424 do { \
425 unsigned long _tmp; \
426 \
427 __asm__ __volatile__ ( \
428 _PRE_EFLAGS("0", "3", "2") \
429 _op _suffix " %1; " \
430 _POST_EFLAGS("0", "3", "2") \
431 : "=m" ((ctxt)->eflags), "+m" ((ctxt)->dst.val), \
432 "=&r" (_tmp) \
433 : "i" (EFLAGS_MASK)); \
434 } while (0)
435
436/* Instruction has only one explicit operand (no source operand). */
437#define emulate_1op(ctxt, _op) \
438 do { \
439 switch ((ctxt)->dst.bytes) { \
440 case 1: __emulate_1op(ctxt, _op, "b"); break; \
441 case 2: __emulate_1op(ctxt, _op, "w"); break; \
442 case 4: __emulate_1op(ctxt, _op, "l"); break; \
443 case 8: ON64(__emulate_1op(ctxt, _op, "q")); break; \
444 } \
445 } while (0)
446
447static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)); 299static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
448 300
449#define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t" 301#define FOP_ALIGN ".align " __stringify(FASTOP_SIZE) " \n\t"
@@ -462,7 +314,10 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
462#define FOPNOP() FOP_ALIGN FOP_RET 314#define FOPNOP() FOP_ALIGN FOP_RET
463 315
464#define FOP1E(op, dst) \ 316#define FOP1E(op, dst) \
465 FOP_ALIGN #op " %" #dst " \n\t" FOP_RET 317 FOP_ALIGN "10: " #op " %" #dst " \n\t" FOP_RET
318
319#define FOP1EEX(op, dst) \
320 FOP1E(op, dst) _ASM_EXTABLE(10b, kvm_fastop_exception)
466 321
467#define FASTOP1(op) \ 322#define FASTOP1(op) \
468 FOP_START(op) \ 323 FOP_START(op) \
@@ -472,24 +327,42 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
472 ON64(FOP1E(op##q, rax)) \ 327 ON64(FOP1E(op##q, rax)) \
473 FOP_END 328 FOP_END
474 329
330/* 1-operand, using src2 (for MUL/DIV r/m) */
331#define FASTOP1SRC2(op, name) \
332 FOP_START(name) \
333 FOP1E(op, cl) \
334 FOP1E(op, cx) \
335 FOP1E(op, ecx) \
336 ON64(FOP1E(op, rcx)) \
337 FOP_END
338
339/* 1-operand, using src2 (for MUL/DIV r/m), with exceptions */
340#define FASTOP1SRC2EX(op, name) \
341 FOP_START(name) \
342 FOP1EEX(op, cl) \
343 FOP1EEX(op, cx) \
344 FOP1EEX(op, ecx) \
345 ON64(FOP1EEX(op, rcx)) \
346 FOP_END
347
475#define FOP2E(op, dst, src) \ 348#define FOP2E(op, dst, src) \
476 FOP_ALIGN #op " %" #src ", %" #dst " \n\t" FOP_RET 349 FOP_ALIGN #op " %" #src ", %" #dst " \n\t" FOP_RET
477 350
478#define FASTOP2(op) \ 351#define FASTOP2(op) \
479 FOP_START(op) \ 352 FOP_START(op) \
480 FOP2E(op##b, al, bl) \ 353 FOP2E(op##b, al, dl) \
481 FOP2E(op##w, ax, bx) \ 354 FOP2E(op##w, ax, dx) \
482 FOP2E(op##l, eax, ebx) \ 355 FOP2E(op##l, eax, edx) \
483 ON64(FOP2E(op##q, rax, rbx)) \ 356 ON64(FOP2E(op##q, rax, rdx)) \
484 FOP_END 357 FOP_END
485 358
486/* 2 operand, word only */ 359/* 2 operand, word only */
487#define FASTOP2W(op) \ 360#define FASTOP2W(op) \
488 FOP_START(op) \ 361 FOP_START(op) \
489 FOPNOP() \ 362 FOPNOP() \
490 FOP2E(op##w, ax, bx) \ 363 FOP2E(op##w, ax, dx) \
491 FOP2E(op##l, eax, ebx) \ 364 FOP2E(op##l, eax, edx) \
492 ON64(FOP2E(op##q, rax, rbx)) \ 365 ON64(FOP2E(op##q, rax, rdx)) \
493 FOP_END 366 FOP_END
494 367
495/* 2 operand, src is CL */ 368/* 2 operand, src is CL */
@@ -508,14 +381,17 @@ static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *));
508#define FASTOP3WCL(op) \ 381#define FASTOP3WCL(op) \
509 FOP_START(op) \ 382 FOP_START(op) \
510 FOPNOP() \ 383 FOPNOP() \
511 FOP3E(op##w, ax, bx, cl) \ 384 FOP3E(op##w, ax, dx, cl) \
512 FOP3E(op##l, eax, ebx, cl) \ 385 FOP3E(op##l, eax, edx, cl) \
513 ON64(FOP3E(op##q, rax, rbx, cl)) \ 386 ON64(FOP3E(op##q, rax, rdx, cl)) \
514 FOP_END 387 FOP_END
515 388
516/* Special case for SETcc - 1 instruction per cc */ 389/* Special case for SETcc - 1 instruction per cc */
517#define FOP_SETCC(op) ".align 4; " #op " %al; ret \n\t" 390#define FOP_SETCC(op) ".align 4; " #op " %al; ret \n\t"
518 391
392asm(".global kvm_fastop_exception \n"
393 "kvm_fastop_exception: xor %esi, %esi; ret");
394
519FOP_START(setcc) 395FOP_START(setcc)
520FOP_SETCC(seto) 396FOP_SETCC(seto)
521FOP_SETCC(setno) 397FOP_SETCC(setno)
@@ -538,47 +414,6 @@ FOP_END;
538FOP_START(salc) "pushf; sbb %al, %al; popf \n\t" FOP_RET 414FOP_START(salc) "pushf; sbb %al, %al; popf \n\t" FOP_RET
539FOP_END; 415FOP_END;
540 416
541#define __emulate_1op_rax_rdx(ctxt, _op, _suffix, _ex) \
542 do { \
543 unsigned long _tmp; \
544 ulong *rax = reg_rmw((ctxt), VCPU_REGS_RAX); \
545 ulong *rdx = reg_rmw((ctxt), VCPU_REGS_RDX); \
546 \
547 __asm__ __volatile__ ( \
548 _PRE_EFLAGS("0", "5", "1") \
549 "1: \n\t" \
550 _op _suffix " %6; " \
551 "2: \n\t" \
552 _POST_EFLAGS("0", "5", "1") \
553 ".pushsection .fixup,\"ax\" \n\t" \
554 "3: movb $1, %4 \n\t" \
555 "jmp 2b \n\t" \
556 ".popsection \n\t" \
557 _ASM_EXTABLE(1b, 3b) \
558 : "=m" ((ctxt)->eflags), "=&r" (_tmp), \
559 "+a" (*rax), "+d" (*rdx), "+qm"(_ex) \
560 : "i" (EFLAGS_MASK), "m" ((ctxt)->src.val)); \
561 } while (0)
562
563/* instruction has only one source operand, destination is implicit (e.g. mul, div, imul, idiv) */
564#define emulate_1op_rax_rdx(ctxt, _op, _ex) \
565 do { \
566 switch((ctxt)->src.bytes) { \
567 case 1: \
568 __emulate_1op_rax_rdx(ctxt, _op, "b", _ex); \
569 break; \
570 case 2: \
571 __emulate_1op_rax_rdx(ctxt, _op, "w", _ex); \
572 break; \
573 case 4: \
574 __emulate_1op_rax_rdx(ctxt, _op, "l", _ex); \
575 break; \
576 case 8: ON64( \
577 __emulate_1op_rax_rdx(ctxt, _op, "q", _ex)); \
578 break; \
579 } \
580 } while (0)
581
582static int emulator_check_intercept(struct x86_emulate_ctxt *ctxt, 417static int emulator_check_intercept(struct x86_emulate_ctxt *ctxt,
583 enum x86_intercept intercept, 418 enum x86_intercept intercept,
584 enum x86_intercept_stage stage) 419 enum x86_intercept_stage stage)
@@ -988,6 +823,11 @@ FASTOP2(xor);
988FASTOP2(cmp); 823FASTOP2(cmp);
989FASTOP2(test); 824FASTOP2(test);
990 825
826FASTOP1SRC2(mul, mul_ex);
827FASTOP1SRC2(imul, imul_ex);
828FASTOP1SRC2EX(div, div_ex);
829FASTOP1SRC2EX(idiv, idiv_ex);
830
991FASTOP3WCL(shld); 831FASTOP3WCL(shld);
992FASTOP3WCL(shrd); 832FASTOP3WCL(shrd);
993 833
@@ -1013,6 +853,8 @@ FASTOP2W(bts);
1013FASTOP2W(btr); 853FASTOP2W(btr);
1014FASTOP2W(btc); 854FASTOP2W(btc);
1015 855
856FASTOP2(xadd);
857
1016static u8 test_cc(unsigned int condition, unsigned long flags) 858static u8 test_cc(unsigned int condition, unsigned long flags)
1017{ 859{
1018 u8 rc; 860 u8 rc;
@@ -1726,45 +1568,42 @@ static void write_register_operand(struct operand *op)
1726 } 1568 }
1727} 1569}
1728 1570
1729static int writeback(struct x86_emulate_ctxt *ctxt) 1571static int writeback(struct x86_emulate_ctxt *ctxt, struct operand *op)
1730{ 1572{
1731 int rc; 1573 int rc;
1732 1574
1733 if (ctxt->d & NoWrite) 1575 switch (op->type) {
1734 return X86EMUL_CONTINUE;
1735
1736 switch (ctxt->dst.type) {
1737 case OP_REG: 1576 case OP_REG:
1738 write_register_operand(&ctxt->dst); 1577 write_register_operand(op);
1739 break; 1578 break;
1740 case OP_MEM: 1579 case OP_MEM:
1741 if (ctxt->lock_prefix) 1580 if (ctxt->lock_prefix)
1742 rc = segmented_cmpxchg(ctxt, 1581 rc = segmented_cmpxchg(ctxt,
1743 ctxt->dst.addr.mem, 1582 op->addr.mem,
1744 &ctxt->dst.orig_val, 1583 &op->orig_val,
1745 &ctxt->dst.val, 1584 &op->val,
1746 ctxt->dst.bytes); 1585 op->bytes);
1747 else 1586 else
1748 rc = segmented_write(ctxt, 1587 rc = segmented_write(ctxt,
1749 ctxt->dst.addr.mem, 1588 op->addr.mem,
1750 &ctxt->dst.val, 1589 &op->val,
1751 ctxt->dst.bytes); 1590 op->bytes);
1752 if (rc != X86EMUL_CONTINUE) 1591 if (rc != X86EMUL_CONTINUE)
1753 return rc; 1592 return rc;
1754 break; 1593 break;
1755 case OP_MEM_STR: 1594 case OP_MEM_STR:
1756 rc = segmented_write(ctxt, 1595 rc = segmented_write(ctxt,
1757 ctxt->dst.addr.mem, 1596 op->addr.mem,
1758 ctxt->dst.data, 1597 op->data,
1759 ctxt->dst.bytes * ctxt->dst.count); 1598 op->bytes * op->count);
1760 if (rc != X86EMUL_CONTINUE) 1599 if (rc != X86EMUL_CONTINUE)
1761 return rc; 1600 return rc;
1762 break; 1601 break;
1763 case OP_XMM: 1602 case OP_XMM:
1764 write_sse_reg(ctxt, &ctxt->dst.vec_val, ctxt->dst.addr.xmm); 1603 write_sse_reg(ctxt, &op->vec_val, op->addr.xmm);
1765 break; 1604 break;
1766 case OP_MM: 1605 case OP_MM:
1767 write_mmx_reg(ctxt, &ctxt->dst.mm_val, ctxt->dst.addr.mm); 1606 write_mmx_reg(ctxt, &op->mm_val, op->addr.mm);
1768 break; 1607 break;
1769 case OP_NONE: 1608 case OP_NONE:
1770 /* no writeback */ 1609 /* no writeback */
@@ -2117,42 +1956,6 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
2117 return X86EMUL_CONTINUE; 1956 return X86EMUL_CONTINUE;
2118} 1957}
2119 1958
2120static int em_mul_ex(struct x86_emulate_ctxt *ctxt)
2121{
2122 u8 ex = 0;
2123
2124 emulate_1op_rax_rdx(ctxt, "mul", ex);
2125 return X86EMUL_CONTINUE;
2126}
2127
2128static int em_imul_ex(struct x86_emulate_ctxt *ctxt)
2129{
2130 u8 ex = 0;
2131
2132 emulate_1op_rax_rdx(ctxt, "imul", ex);
2133 return X86EMUL_CONTINUE;
2134}
2135
2136static int em_div_ex(struct x86_emulate_ctxt *ctxt)
2137{
2138 u8 de = 0;
2139
2140 emulate_1op_rax_rdx(ctxt, "div", de);
2141 if (de)
2142 return emulate_de(ctxt);
2143 return X86EMUL_CONTINUE;
2144}
2145
2146static int em_idiv_ex(struct x86_emulate_ctxt *ctxt)
2147{
2148 u8 de = 0;
2149
2150 emulate_1op_rax_rdx(ctxt, "idiv", de);
2151 if (de)
2152 return emulate_de(ctxt);
2153 return X86EMUL_CONTINUE;
2154}
2155
2156static int em_grp45(struct x86_emulate_ctxt *ctxt) 1959static int em_grp45(struct x86_emulate_ctxt *ctxt)
2157{ 1960{
2158 int rc = X86EMUL_CONTINUE; 1961 int rc = X86EMUL_CONTINUE;
@@ -3734,10 +3537,10 @@ static const struct opcode group3[] = {
3734 F(DstMem | SrcImm | NoWrite, em_test), 3537 F(DstMem | SrcImm | NoWrite, em_test),
3735 F(DstMem | SrcNone | Lock, em_not), 3538 F(DstMem | SrcNone | Lock, em_not),
3736 F(DstMem | SrcNone | Lock, em_neg), 3539 F(DstMem | SrcNone | Lock, em_neg),
3737 I(SrcMem, em_mul_ex), 3540 F(DstXacc | Src2Mem, em_mul_ex),
3738 I(SrcMem, em_imul_ex), 3541 F(DstXacc | Src2Mem, em_imul_ex),
3739 I(SrcMem, em_div_ex), 3542 F(DstXacc | Src2Mem, em_div_ex),
3740 I(SrcMem, em_idiv_ex), 3543 F(DstXacc | Src2Mem, em_idiv_ex),
3741}; 3544};
3742 3545
3743static const struct opcode group4[] = { 3546static const struct opcode group4[] = {
@@ -4064,7 +3867,7 @@ static const struct opcode twobyte_table[256] = {
4064 F(DstReg | SrcMem | ModRM, em_bsf), F(DstReg | SrcMem | ModRM, em_bsr), 3867 F(DstReg | SrcMem | ModRM, em_bsf), F(DstReg | SrcMem | ModRM, em_bsr),
4065 D(DstReg | SrcMem8 | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov), 3868 D(DstReg | SrcMem8 | ModRM | Mov), D(DstReg | SrcMem16 | ModRM | Mov),
4066 /* 0xC0 - 0xC7 */ 3869 /* 0xC0 - 0xC7 */
4067 D2bv(DstMem | SrcReg | ModRM | Lock), 3870 F2bv(DstMem | SrcReg | ModRM | SrcWrite | Lock, em_xadd),
4068 N, D(DstMem | SrcReg | ModRM | Mov), 3871 N, D(DstMem | SrcReg | ModRM | Mov),
4069 N, N, N, GD(0, &group9), 3872 N, N, N, GD(0, &group9),
4070 /* 0xC8 - 0xCF */ 3873 /* 0xC8 - 0xCF */
@@ -4172,6 +3975,24 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
4172 fetch_register_operand(op); 3975 fetch_register_operand(op);
4173 op->orig_val = op->val; 3976 op->orig_val = op->val;
4174 break; 3977 break;
3978 case OpAccLo:
3979 op->type = OP_REG;
3980 op->bytes = (ctxt->d & ByteOp) ? 2 : ctxt->op_bytes;
3981 op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RAX);
3982 fetch_register_operand(op);
3983 op->orig_val = op->val;
3984 break;
3985 case OpAccHi:
3986 if (ctxt->d & ByteOp) {
3987 op->type = OP_NONE;
3988 break;
3989 }
3990 op->type = OP_REG;
3991 op->bytes = ctxt->op_bytes;
3992 op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RDX);
3993 fetch_register_operand(op);
3994 op->orig_val = op->val;
3995 break;
4175 case OpDI: 3996 case OpDI:
4176 op->type = OP_MEM; 3997 op->type = OP_MEM;
4177 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; 3998 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
@@ -4553,11 +4374,15 @@ static void fetch_possible_mmx_operand(struct x86_emulate_ctxt *ctxt,
4553static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *)) 4374static int fastop(struct x86_emulate_ctxt *ctxt, void (*fop)(struct fastop *))
4554{ 4375{
4555 ulong flags = (ctxt->eflags & EFLAGS_MASK) | X86_EFLAGS_IF; 4376 ulong flags = (ctxt->eflags & EFLAGS_MASK) | X86_EFLAGS_IF;
4556 fop += __ffs(ctxt->dst.bytes) * FASTOP_SIZE; 4377 if (!(ctxt->d & ByteOp))
4378 fop += __ffs(ctxt->dst.bytes) * FASTOP_SIZE;
4557 asm("push %[flags]; popf; call *%[fastop]; pushf; pop %[flags]\n" 4379 asm("push %[flags]; popf; call *%[fastop]; pushf; pop %[flags]\n"
4558 : "+a"(ctxt->dst.val), "+b"(ctxt->src.val), [flags]"+D"(flags) 4380 : "+a"(ctxt->dst.val), "+d"(ctxt->src.val), [flags]"+D"(flags),
4559 : "c"(ctxt->src2.val), [fastop]"S"(fop)); 4381 [fastop]"+S"(fop)
4382 : "c"(ctxt->src2.val));
4560 ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK); 4383 ctxt->eflags = (ctxt->eflags & ~EFLAGS_MASK) | (flags & EFLAGS_MASK);
4384 if (!fop) /* exception is returned in fop variable */
4385 return emulate_de(ctxt);
4561 return X86EMUL_CONTINUE; 4386 return X86EMUL_CONTINUE;
4562} 4387}
4563 4388
@@ -4773,9 +4598,17 @@ special_insn:
4773 goto done; 4598 goto done;
4774 4599
4775writeback: 4600writeback:
4776 rc = writeback(ctxt); 4601 if (!(ctxt->d & NoWrite)) {
4777 if (rc != X86EMUL_CONTINUE) 4602 rc = writeback(ctxt, &ctxt->dst);
4778 goto done; 4603 if (rc != X86EMUL_CONTINUE)
4604 goto done;
4605 }
4606 if (ctxt->d & SrcWrite) {
4607 BUG_ON(ctxt->src.type == OP_MEM || ctxt->src.type == OP_MEM_STR);
4608 rc = writeback(ctxt, &ctxt->src);
4609 if (rc != X86EMUL_CONTINUE)
4610 goto done;
4611 }
4779 4612
4780 /* 4613 /*
4781 * restore dst type in case the decoding will be reused 4614 * restore dst type in case the decoding will be reused
@@ -4872,12 +4705,6 @@ twobyte_insn:
4872 ctxt->dst.val = (ctxt->src.bytes == 1) ? (s8) ctxt->src.val : 4705 ctxt->dst.val = (ctxt->src.bytes == 1) ? (s8) ctxt->src.val :
4873 (s16) ctxt->src.val; 4706 (s16) ctxt->src.val;
4874 break; 4707 break;
4875 case 0xc0 ... 0xc1: /* xadd */
4876 fastop(ctxt, em_add);
4877 /* Write back the register source. */
4878 ctxt->src.val = ctxt->dst.orig_val;
4879 write_register_operand(&ctxt->src);
4880 break;
4881 case 0xc3: /* movnti */ 4708 case 0xc3: /* movnti */
4882 ctxt->dst.bytes = ctxt->op_bytes; 4709 ctxt->dst.bytes = ctxt->op_bytes;
4883 ctxt->dst.val = (ctxt->op_bytes == 4) ? (u32) ctxt->src.val : 4710 ctxt->dst.val = (ctxt->op_bytes == 4) ? (u32) ctxt->src.val :
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 0eee2c8b64d1..afc11245827c 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1608,8 +1608,8 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
1608 return; 1608 return;
1609 1609
1610 if (atomic_read(&apic->lapic_timer.pending) > 0) { 1610 if (atomic_read(&apic->lapic_timer.pending) > 0) {
1611 if (kvm_apic_local_deliver(apic, APIC_LVTT)) 1611 kvm_apic_local_deliver(apic, APIC_LVTT);
1612 atomic_dec(&apic->lapic_timer.pending); 1612 atomic_set(&apic->lapic_timer.pending, 0);
1613 } 1613 }
1614} 1614}
1615 1615
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 004cc87b781c..0d094da49541 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -197,15 +197,63 @@ void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask)
197} 197}
198EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask); 198EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask);
199 199
200static void mark_mmio_spte(u64 *sptep, u64 gfn, unsigned access) 200/*
201 * spte bits of bit 3 ~ bit 11 are used as low 9 bits of generation number,
202 * the bits of bits 52 ~ bit 61 are used as high 10 bits of generation
203 * number.
204 */
205#define MMIO_SPTE_GEN_LOW_SHIFT 3
206#define MMIO_SPTE_GEN_HIGH_SHIFT 52
207
208#define MMIO_GEN_SHIFT 19
209#define MMIO_GEN_LOW_SHIFT 9
210#define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 1)
211#define MMIO_GEN_MASK ((1 << MMIO_GEN_SHIFT) - 1)
212#define MMIO_MAX_GEN ((1 << MMIO_GEN_SHIFT) - 1)
213
214static u64 generation_mmio_spte_mask(unsigned int gen)
201{ 215{
202 struct kvm_mmu_page *sp = page_header(__pa(sptep)); 216 u64 mask;
217
218 WARN_ON(gen > MMIO_MAX_GEN);
219
220 mask = (gen & MMIO_GEN_LOW_MASK) << MMIO_SPTE_GEN_LOW_SHIFT;
221 mask |= ((u64)gen >> MMIO_GEN_LOW_SHIFT) << MMIO_SPTE_GEN_HIGH_SHIFT;
222 return mask;
223}
224
225static unsigned int get_mmio_spte_generation(u64 spte)
226{
227 unsigned int gen;
228
229 spte &= ~shadow_mmio_mask;
230
231 gen = (spte >> MMIO_SPTE_GEN_LOW_SHIFT) & MMIO_GEN_LOW_MASK;
232 gen |= (spte >> MMIO_SPTE_GEN_HIGH_SHIFT) << MMIO_GEN_LOW_SHIFT;
233 return gen;
234}
235
236static unsigned int kvm_current_mmio_generation(struct kvm *kvm)
237{
238 /*
239 * Init kvm generation close to MMIO_MAX_GEN to easily test the
240 * code of handling generation number wrap-around.
241 */
242 return (kvm_memslots(kvm)->generation +
243 MMIO_MAX_GEN - 150) & MMIO_GEN_MASK;
244}
245
246static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn,
247 unsigned access)
248{
249 unsigned int gen = kvm_current_mmio_generation(kvm);
250 u64 mask = generation_mmio_spte_mask(gen);
203 251
204 access &= ACC_WRITE_MASK | ACC_USER_MASK; 252 access &= ACC_WRITE_MASK | ACC_USER_MASK;
253 mask |= shadow_mmio_mask | access | gfn << PAGE_SHIFT;
205 254
206 sp->mmio_cached = true; 255 trace_mark_mmio_spte(sptep, gfn, access, gen);
207 trace_mark_mmio_spte(sptep, gfn, access); 256 mmu_spte_set(sptep, mask);
208 mmu_spte_set(sptep, shadow_mmio_mask | access | gfn << PAGE_SHIFT);
209} 257}
210 258
211static bool is_mmio_spte(u64 spte) 259static bool is_mmio_spte(u64 spte)
@@ -215,24 +263,38 @@ static bool is_mmio_spte(u64 spte)
215 263
216static gfn_t get_mmio_spte_gfn(u64 spte) 264static gfn_t get_mmio_spte_gfn(u64 spte)
217{ 265{
218 return (spte & ~shadow_mmio_mask) >> PAGE_SHIFT; 266 u64 mask = generation_mmio_spte_mask(MMIO_MAX_GEN) | shadow_mmio_mask;
267 return (spte & ~mask) >> PAGE_SHIFT;
219} 268}
220 269
221static unsigned get_mmio_spte_access(u64 spte) 270static unsigned get_mmio_spte_access(u64 spte)
222{ 271{
223 return (spte & ~shadow_mmio_mask) & ~PAGE_MASK; 272 u64 mask = generation_mmio_spte_mask(MMIO_MAX_GEN) | shadow_mmio_mask;
273 return (spte & ~mask) & ~PAGE_MASK;
224} 274}
225 275
226static bool set_mmio_spte(u64 *sptep, gfn_t gfn, pfn_t pfn, unsigned access) 276static bool set_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn,
277 pfn_t pfn, unsigned access)
227{ 278{
228 if (unlikely(is_noslot_pfn(pfn))) { 279 if (unlikely(is_noslot_pfn(pfn))) {
229 mark_mmio_spte(sptep, gfn, access); 280 mark_mmio_spte(kvm, sptep, gfn, access);
230 return true; 281 return true;
231 } 282 }
232 283
233 return false; 284 return false;
234} 285}
235 286
287static bool check_mmio_spte(struct kvm *kvm, u64 spte)
288{
289 unsigned int kvm_gen, spte_gen;
290
291 kvm_gen = kvm_current_mmio_generation(kvm);
292 spte_gen = get_mmio_spte_generation(spte);
293
294 trace_check_mmio_spte(spte, kvm_gen, spte_gen);
295 return likely(kvm_gen == spte_gen);
296}
297
236static inline u64 rsvd_bits(int s, int e) 298static inline u64 rsvd_bits(int s, int e)
237{ 299{
238 return ((1ULL << (e - s + 1)) - 1) << s; 300 return ((1ULL << (e - s + 1)) - 1) << s;
@@ -404,9 +466,20 @@ static u64 __update_clear_spte_slow(u64 *sptep, u64 spte)
404/* 466/*
405 * The idea using the light way get the spte on x86_32 guest is from 467 * The idea using the light way get the spte on x86_32 guest is from
406 * gup_get_pte(arch/x86/mm/gup.c). 468 * gup_get_pte(arch/x86/mm/gup.c).
407 * The difference is we can not catch the spte tlb flush if we leave 469 *
408 * guest mode, so we emulate it by increase clear_spte_count when spte 470 * An spte tlb flush may be pending, because kvm_set_pte_rmapp
409 * is cleared. 471 * coalesces them and we are running out of the MMU lock. Therefore
472 * we need to protect against in-progress updates of the spte.
473 *
474 * Reading the spte while an update is in progress may get the old value
475 * for the high part of the spte. The race is fine for a present->non-present
476 * change (because the high part of the spte is ignored for non-present spte),
477 * but for a present->present change we must reread the spte.
478 *
479 * All such changes are done in two steps (present->non-present and
480 * non-present->present), hence it is enough to count the number of
481 * present->non-present updates: if it changed while reading the spte,
482 * we might have hit the race. This is done using clear_spte_count.
410 */ 483 */
411static u64 __get_spte_lockless(u64 *sptep) 484static u64 __get_spte_lockless(u64 *sptep)
412{ 485{
@@ -1511,6 +1584,12 @@ static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu,
1511 if (!direct) 1584 if (!direct)
1512 sp->gfns = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache); 1585 sp->gfns = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache);
1513 set_page_private(virt_to_page(sp->spt), (unsigned long)sp); 1586 set_page_private(virt_to_page(sp->spt), (unsigned long)sp);
1587
1588 /*
1589 * The active_mmu_pages list is the FIFO list, do not move the
1590 * page until it is zapped. kvm_zap_obsolete_pages depends on
1591 * this feature. See the comments in kvm_zap_obsolete_pages().
1592 */
1514 list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages); 1593 list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages);
1515 sp->parent_ptes = 0; 1594 sp->parent_ptes = 0;
1516 mmu_page_add_parent_pte(vcpu, sp, parent_pte); 1595 mmu_page_add_parent_pte(vcpu, sp, parent_pte);
@@ -1648,6 +1727,16 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
1648static void kvm_mmu_commit_zap_page(struct kvm *kvm, 1727static void kvm_mmu_commit_zap_page(struct kvm *kvm,
1649 struct list_head *invalid_list); 1728 struct list_head *invalid_list);
1650 1729
1730/*
1731 * NOTE: we should pay more attention on the zapped-obsolete page
1732 * (is_obsolete_sp(sp) && sp->role.invalid) when you do hash list walk
1733 * since it has been deleted from active_mmu_pages but still can be found
1734 * at hast list.
1735 *
1736 * for_each_gfn_indirect_valid_sp has skipped that kind of page and
1737 * kvm_mmu_get_page(), the only user of for_each_gfn_sp(), has skipped
1738 * all the obsolete pages.
1739 */
1651#define for_each_gfn_sp(_kvm, _sp, _gfn) \ 1740#define for_each_gfn_sp(_kvm, _sp, _gfn) \
1652 hlist_for_each_entry(_sp, \ 1741 hlist_for_each_entry(_sp, \
1653 &(_kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(_gfn)], hash_link) \ 1742 &(_kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(_gfn)], hash_link) \
@@ -1838,6 +1927,11 @@ static void clear_sp_write_flooding_count(u64 *spte)
1838 __clear_sp_write_flooding_count(sp); 1927 __clear_sp_write_flooding_count(sp);
1839} 1928}
1840 1929
1930static bool is_obsolete_sp(struct kvm *kvm, struct kvm_mmu_page *sp)
1931{
1932 return unlikely(sp->mmu_valid_gen != kvm->arch.mmu_valid_gen);
1933}
1934
1841static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, 1935static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1842 gfn_t gfn, 1936 gfn_t gfn,
1843 gva_t gaddr, 1937 gva_t gaddr,
@@ -1864,6 +1958,9 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1864 role.quadrant = quadrant; 1958 role.quadrant = quadrant;
1865 } 1959 }
1866 for_each_gfn_sp(vcpu->kvm, sp, gfn) { 1960 for_each_gfn_sp(vcpu->kvm, sp, gfn) {
1961 if (is_obsolete_sp(vcpu->kvm, sp))
1962 continue;
1963
1867 if (!need_sync && sp->unsync) 1964 if (!need_sync && sp->unsync)
1868 need_sync = true; 1965 need_sync = true;
1869 1966
@@ -1900,6 +1997,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1900 1997
1901 account_shadowed(vcpu->kvm, gfn); 1998 account_shadowed(vcpu->kvm, gfn);
1902 } 1999 }
2000 sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen;
1903 init_shadow_page_table(sp); 2001 init_shadow_page_table(sp);
1904 trace_kvm_mmu_get_page(sp, true); 2002 trace_kvm_mmu_get_page(sp, true);
1905 return sp; 2003 return sp;
@@ -2070,8 +2168,10 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
2070 ret = mmu_zap_unsync_children(kvm, sp, invalid_list); 2168 ret = mmu_zap_unsync_children(kvm, sp, invalid_list);
2071 kvm_mmu_page_unlink_children(kvm, sp); 2169 kvm_mmu_page_unlink_children(kvm, sp);
2072 kvm_mmu_unlink_parents(kvm, sp); 2170 kvm_mmu_unlink_parents(kvm, sp);
2171
2073 if (!sp->role.invalid && !sp->role.direct) 2172 if (!sp->role.invalid && !sp->role.direct)
2074 unaccount_shadowed(kvm, sp->gfn); 2173 unaccount_shadowed(kvm, sp->gfn);
2174
2075 if (sp->unsync) 2175 if (sp->unsync)
2076 kvm_unlink_unsync_page(kvm, sp); 2176 kvm_unlink_unsync_page(kvm, sp);
2077 if (!sp->root_count) { 2177 if (!sp->root_count) {
@@ -2081,7 +2181,13 @@ static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
2081 kvm_mod_used_mmu_pages(kvm, -1); 2181 kvm_mod_used_mmu_pages(kvm, -1);
2082 } else { 2182 } else {
2083 list_move(&sp->link, &kvm->arch.active_mmu_pages); 2183 list_move(&sp->link, &kvm->arch.active_mmu_pages);
2084 kvm_reload_remote_mmus(kvm); 2184
2185 /*
2186 * The obsolete pages can not be used on any vcpus.
2187 * See the comments in kvm_mmu_invalidate_zap_all_pages().
2188 */
2189 if (!sp->role.invalid && !is_obsolete_sp(kvm, sp))
2190 kvm_reload_remote_mmus(kvm);
2085 } 2191 }
2086 2192
2087 sp->role.invalid = 1; 2193 sp->role.invalid = 1;
@@ -2331,7 +2437,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2331 u64 spte; 2437 u64 spte;
2332 int ret = 0; 2438 int ret = 0;
2333 2439
2334 if (set_mmio_spte(sptep, gfn, pfn, pte_access)) 2440 if (set_mmio_spte(vcpu->kvm, sptep, gfn, pfn, pte_access))
2335 return 0; 2441 return 0;
2336 2442
2337 spte = PT_PRESENT_MASK; 2443 spte = PT_PRESENT_MASK;
@@ -2869,22 +2975,25 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
2869 2975
2870 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) 2976 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
2871 return; 2977 return;
2872 spin_lock(&vcpu->kvm->mmu_lock); 2978
2873 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL && 2979 if (vcpu->arch.mmu.shadow_root_level == PT64_ROOT_LEVEL &&
2874 (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL || 2980 (vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL ||
2875 vcpu->arch.mmu.direct_map)) { 2981 vcpu->arch.mmu.direct_map)) {
2876 hpa_t root = vcpu->arch.mmu.root_hpa; 2982 hpa_t root = vcpu->arch.mmu.root_hpa;
2877 2983
2984 spin_lock(&vcpu->kvm->mmu_lock);
2878 sp = page_header(root); 2985 sp = page_header(root);
2879 --sp->root_count; 2986 --sp->root_count;
2880 if (!sp->root_count && sp->role.invalid) { 2987 if (!sp->root_count && sp->role.invalid) {
2881 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, &invalid_list); 2988 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, &invalid_list);
2882 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list); 2989 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
2883 } 2990 }
2884 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
2885 spin_unlock(&vcpu->kvm->mmu_lock); 2991 spin_unlock(&vcpu->kvm->mmu_lock);
2992 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
2886 return; 2993 return;
2887 } 2994 }
2995
2996 spin_lock(&vcpu->kvm->mmu_lock);
2888 for (i = 0; i < 4; ++i) { 2997 for (i = 0; i < 4; ++i) {
2889 hpa_t root = vcpu->arch.mmu.pae_root[i]; 2998 hpa_t root = vcpu->arch.mmu.pae_root[i];
2890 2999
@@ -3148,17 +3257,12 @@ static u64 walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr)
3148 return spte; 3257 return spte;
3149} 3258}
3150 3259
3151/*
3152 * If it is a real mmio page fault, return 1 and emulat the instruction
3153 * directly, return 0 to let CPU fault again on the address, -1 is
3154 * returned if bug is detected.
3155 */
3156int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct) 3260int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct)
3157{ 3261{
3158 u64 spte; 3262 u64 spte;
3159 3263
3160 if (quickly_check_mmio_pf(vcpu, addr, direct)) 3264 if (quickly_check_mmio_pf(vcpu, addr, direct))
3161 return 1; 3265 return RET_MMIO_PF_EMULATE;
3162 3266
3163 spte = walk_shadow_page_get_mmio_spte(vcpu, addr); 3267 spte = walk_shadow_page_get_mmio_spte(vcpu, addr);
3164 3268
@@ -3166,12 +3270,15 @@ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct)
3166 gfn_t gfn = get_mmio_spte_gfn(spte); 3270 gfn_t gfn = get_mmio_spte_gfn(spte);
3167 unsigned access = get_mmio_spte_access(spte); 3271 unsigned access = get_mmio_spte_access(spte);
3168 3272
3273 if (!check_mmio_spte(vcpu->kvm, spte))
3274 return RET_MMIO_PF_INVALID;
3275
3169 if (direct) 3276 if (direct)
3170 addr = 0; 3277 addr = 0;
3171 3278
3172 trace_handle_mmio_page_fault(addr, gfn, access); 3279 trace_handle_mmio_page_fault(addr, gfn, access);
3173 vcpu_cache_mmio_info(vcpu, addr, gfn, access); 3280 vcpu_cache_mmio_info(vcpu, addr, gfn, access);
3174 return 1; 3281 return RET_MMIO_PF_EMULATE;
3175 } 3282 }
3176 3283
3177 /* 3284 /*
@@ -3179,13 +3286,13 @@ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct)
3179 * it's a BUG if the gfn is not a mmio page. 3286 * it's a BUG if the gfn is not a mmio page.
3180 */ 3287 */
3181 if (direct && !check_direct_spte_mmio_pf(spte)) 3288 if (direct && !check_direct_spte_mmio_pf(spte))
3182 return -1; 3289 return RET_MMIO_PF_BUG;
3183 3290
3184 /* 3291 /*
3185 * If the page table is zapped by other cpus, let CPU fault again on 3292 * If the page table is zapped by other cpus, let CPU fault again on
3186 * the address. 3293 * the address.
3187 */ 3294 */
3188 return 0; 3295 return RET_MMIO_PF_RETRY;
3189} 3296}
3190EXPORT_SYMBOL_GPL(handle_mmio_page_fault_common); 3297EXPORT_SYMBOL_GPL(handle_mmio_page_fault_common);
3191 3298
@@ -3195,7 +3302,7 @@ static int handle_mmio_page_fault(struct kvm_vcpu *vcpu, u64 addr,
3195 int ret; 3302 int ret;
3196 3303
3197 ret = handle_mmio_page_fault_common(vcpu, addr, direct); 3304 ret = handle_mmio_page_fault_common(vcpu, addr, direct);
3198 WARN_ON(ret < 0); 3305 WARN_ON(ret == RET_MMIO_PF_BUG);
3199 return ret; 3306 return ret;
3200} 3307}
3201 3308
@@ -3207,8 +3314,12 @@ static int nonpaging_page_fault(struct kvm_vcpu *vcpu, gva_t gva,
3207 3314
3208 pgprintk("%s: gva %lx error %x\n", __func__, gva, error_code); 3315 pgprintk("%s: gva %lx error %x\n", __func__, gva, error_code);
3209 3316
3210 if (unlikely(error_code & PFERR_RSVD_MASK)) 3317 if (unlikely(error_code & PFERR_RSVD_MASK)) {
3211 return handle_mmio_page_fault(vcpu, gva, error_code, true); 3318 r = handle_mmio_page_fault(vcpu, gva, error_code, true);
3319
3320 if (likely(r != RET_MMIO_PF_INVALID))
3321 return r;
3322 }
3212 3323
3213 r = mmu_topup_memory_caches(vcpu); 3324 r = mmu_topup_memory_caches(vcpu);
3214 if (r) 3325 if (r)
@@ -3284,8 +3395,12 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa, u32 error_code,
3284 ASSERT(vcpu); 3395 ASSERT(vcpu);
3285 ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa)); 3396 ASSERT(VALID_PAGE(vcpu->arch.mmu.root_hpa));
3286 3397
3287 if (unlikely(error_code & PFERR_RSVD_MASK)) 3398 if (unlikely(error_code & PFERR_RSVD_MASK)) {
3288 return handle_mmio_page_fault(vcpu, gpa, error_code, true); 3399 r = handle_mmio_page_fault(vcpu, gpa, error_code, true);
3400
3401 if (likely(r != RET_MMIO_PF_INVALID))
3402 return r;
3403 }
3289 3404
3290 r = mmu_topup_memory_caches(vcpu); 3405 r = mmu_topup_memory_caches(vcpu);
3291 if (r) 3406 if (r)
@@ -3391,8 +3506,8 @@ static inline void protect_clean_gpte(unsigned *access, unsigned gpte)
3391 *access &= mask; 3506 *access &= mask;
3392} 3507}
3393 3508
3394static bool sync_mmio_spte(u64 *sptep, gfn_t gfn, unsigned access, 3509static bool sync_mmio_spte(struct kvm *kvm, u64 *sptep, gfn_t gfn,
3395 int *nr_present) 3510 unsigned access, int *nr_present)
3396{ 3511{
3397 if (unlikely(is_mmio_spte(*sptep))) { 3512 if (unlikely(is_mmio_spte(*sptep))) {
3398 if (gfn != get_mmio_spte_gfn(*sptep)) { 3513 if (gfn != get_mmio_spte_gfn(*sptep)) {
@@ -3401,7 +3516,7 @@ static bool sync_mmio_spte(u64 *sptep, gfn_t gfn, unsigned access,
3401 } 3516 }
3402 3517
3403 (*nr_present)++; 3518 (*nr_present)++;
3404 mark_mmio_spte(sptep, gfn, access); 3519 mark_mmio_spte(kvm, sptep, gfn, access);
3405 return true; 3520 return true;
3406 } 3521 }
3407 3522
@@ -3764,9 +3879,7 @@ int kvm_mmu_load(struct kvm_vcpu *vcpu)
3764 if (r) 3879 if (r)
3765 goto out; 3880 goto out;
3766 r = mmu_alloc_roots(vcpu); 3881 r = mmu_alloc_roots(vcpu);
3767 spin_lock(&vcpu->kvm->mmu_lock); 3882 kvm_mmu_sync_roots(vcpu);
3768 mmu_sync_roots(vcpu);
3769 spin_unlock(&vcpu->kvm->mmu_lock);
3770 if (r) 3883 if (r)
3771 goto out; 3884 goto out;
3772 /* set_cr3() should ensure TLB has been flushed */ 3885 /* set_cr3() should ensure TLB has been flushed */
@@ -4179,39 +4292,107 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
4179 spin_unlock(&kvm->mmu_lock); 4292 spin_unlock(&kvm->mmu_lock);
4180} 4293}
4181 4294
4182void kvm_mmu_zap_all(struct kvm *kvm) 4295#define BATCH_ZAP_PAGES 10
4296static void kvm_zap_obsolete_pages(struct kvm *kvm)
4183{ 4297{
4184 struct kvm_mmu_page *sp, *node; 4298 struct kvm_mmu_page *sp, *node;
4185 LIST_HEAD(invalid_list); 4299 int batch = 0;
4186 4300
4187 spin_lock(&kvm->mmu_lock);
4188restart: 4301restart:
4189 list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link) 4302 list_for_each_entry_safe_reverse(sp, node,
4190 if (kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list)) 4303 &kvm->arch.active_mmu_pages, link) {
4304 int ret;
4305
4306 /*
4307 * No obsolete page exists before new created page since
4308 * active_mmu_pages is the FIFO list.
4309 */
4310 if (!is_obsolete_sp(kvm, sp))
4311 break;
4312
4313 /*
4314 * Since we are reversely walking the list and the invalid
4315 * list will be moved to the head, skip the invalid page
4316 * can help us to avoid the infinity list walking.
4317 */
4318 if (sp->role.invalid)
4319 continue;
4320
4321 /*
4322 * Need not flush tlb since we only zap the sp with invalid
4323 * generation number.
4324 */
4325 if (batch >= BATCH_ZAP_PAGES &&
4326 cond_resched_lock(&kvm->mmu_lock)) {
4327 batch = 0;
4328 goto restart;
4329 }
4330
4331 ret = kvm_mmu_prepare_zap_page(kvm, sp,
4332 &kvm->arch.zapped_obsolete_pages);
4333 batch += ret;
4334
4335 if (ret)
4191 goto restart; 4336 goto restart;
4337 }
4192 4338
4193 kvm_mmu_commit_zap_page(kvm, &invalid_list); 4339 /*
4194 spin_unlock(&kvm->mmu_lock); 4340 * Should flush tlb before free page tables since lockless-walking
4341 * may use the pages.
4342 */
4343 kvm_mmu_commit_zap_page(kvm, &kvm->arch.zapped_obsolete_pages);
4195} 4344}
4196 4345
4197void kvm_mmu_zap_mmio_sptes(struct kvm *kvm) 4346/*
4347 * Fast invalidate all shadow pages and use lock-break technique
4348 * to zap obsolete pages.
4349 *
4350 * It's required when memslot is being deleted or VM is being
4351 * destroyed, in these cases, we should ensure that KVM MMU does
4352 * not use any resource of the being-deleted slot or all slots
4353 * after calling the function.
4354 */
4355void kvm_mmu_invalidate_zap_all_pages(struct kvm *kvm)
4198{ 4356{
4199 struct kvm_mmu_page *sp, *node;
4200 LIST_HEAD(invalid_list);
4201
4202 spin_lock(&kvm->mmu_lock); 4357 spin_lock(&kvm->mmu_lock);
4203restart: 4358 trace_kvm_mmu_invalidate_zap_all_pages(kvm);
4204 list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link) { 4359 kvm->arch.mmu_valid_gen++;
4205 if (!sp->mmio_cached)
4206 continue;
4207 if (kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list))
4208 goto restart;
4209 }
4210 4360
4211 kvm_mmu_commit_zap_page(kvm, &invalid_list); 4361 /*
4362 * Notify all vcpus to reload its shadow page table
4363 * and flush TLB. Then all vcpus will switch to new
4364 * shadow page table with the new mmu_valid_gen.
4365 *
4366 * Note: we should do this under the protection of
4367 * mmu-lock, otherwise, vcpu would purge shadow page
4368 * but miss tlb flush.
4369 */
4370 kvm_reload_remote_mmus(kvm);
4371
4372 kvm_zap_obsolete_pages(kvm);
4212 spin_unlock(&kvm->mmu_lock); 4373 spin_unlock(&kvm->mmu_lock);
4213} 4374}
4214 4375
4376static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm)
4377{
4378 return unlikely(!list_empty_careful(&kvm->arch.zapped_obsolete_pages));
4379}
4380
4381void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm)
4382{
4383 /*
4384 * The very rare case: if the generation-number is round,
4385 * zap all shadow pages.
4386 *
4387 * The max value is MMIO_MAX_GEN - 1 since it is not called
4388 * when mark memslot invalid.
4389 */
4390 if (unlikely(kvm_current_mmio_generation(kvm) >= (MMIO_MAX_GEN - 1))) {
4391 printk_ratelimited(KERN_INFO "kvm: zapping shadow pages for mmio generation wraparound\n");
4392 kvm_mmu_invalidate_zap_all_pages(kvm);
4393 }
4394}
4395
4215static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc) 4396static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)
4216{ 4397{
4217 struct kvm *kvm; 4398 struct kvm *kvm;
@@ -4240,15 +4421,23 @@ static int mmu_shrink(struct shrinker *shrink, struct shrink_control *sc)
4240 * want to shrink a VM that only started to populate its MMU 4421 * want to shrink a VM that only started to populate its MMU
4241 * anyway. 4422 * anyway.
4242 */ 4423 */
4243 if (!kvm->arch.n_used_mmu_pages) 4424 if (!kvm->arch.n_used_mmu_pages &&
4425 !kvm_has_zapped_obsolete_pages(kvm))
4244 continue; 4426 continue;
4245 4427
4246 idx = srcu_read_lock(&kvm->srcu); 4428 idx = srcu_read_lock(&kvm->srcu);
4247 spin_lock(&kvm->mmu_lock); 4429 spin_lock(&kvm->mmu_lock);
4248 4430
4431 if (kvm_has_zapped_obsolete_pages(kvm)) {
4432 kvm_mmu_commit_zap_page(kvm,
4433 &kvm->arch.zapped_obsolete_pages);
4434 goto unlock;
4435 }
4436
4249 prepare_zap_oldest_mmu_page(kvm, &invalid_list); 4437 prepare_zap_oldest_mmu_page(kvm, &invalid_list);
4250 kvm_mmu_commit_zap_page(kvm, &invalid_list); 4438 kvm_mmu_commit_zap_page(kvm, &invalid_list);
4251 4439
4440unlock:
4252 spin_unlock(&kvm->mmu_lock); 4441 spin_unlock(&kvm->mmu_lock);
4253 srcu_read_unlock(&kvm->srcu, idx); 4442 srcu_read_unlock(&kvm->srcu, idx);
4254 4443
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 2adcbc2cac6d..5b59c573aba7 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -52,6 +52,23 @@
52 52
53int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]); 53int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]);
54void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask); 54void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask);
55
56/*
57 * Return values of handle_mmio_page_fault_common:
58 * RET_MMIO_PF_EMULATE: it is a real mmio page fault, emulate the instruction
59 * directly.
60 * RET_MMIO_PF_INVALID: invalid spte is detected then let the real page
61 * fault path update the mmio spte.
62 * RET_MMIO_PF_RETRY: let CPU fault again on the address.
63 * RET_MMIO_PF_BUG: bug is detected.
64 */
65enum {
66 RET_MMIO_PF_EMULATE = 1,
67 RET_MMIO_PF_INVALID = 2,
68 RET_MMIO_PF_RETRY = 0,
69 RET_MMIO_PF_BUG = -1
70};
71
55int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); 72int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct);
56int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context); 73int kvm_init_shadow_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *context);
57 74
@@ -97,4 +114,5 @@ static inline bool permission_fault(struct kvm_mmu *mmu, unsigned pte_access,
97 return (mmu->permissions[pfec >> 1] >> pte_access) & 1; 114 return (mmu->permissions[pfec >> 1] >> pte_access) & 1;
98} 115}
99 116
117void kvm_mmu_invalidate_zap_all_pages(struct kvm *kvm);
100#endif 118#endif
diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h
index b8f6172f4174..9d2e0ffcb190 100644
--- a/arch/x86/kvm/mmutrace.h
+++ b/arch/x86/kvm/mmutrace.h
@@ -7,16 +7,18 @@
7#undef TRACE_SYSTEM 7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kvmmmu 8#define TRACE_SYSTEM kvmmmu
9 9
10#define KVM_MMU_PAGE_FIELDS \ 10#define KVM_MMU_PAGE_FIELDS \
11 __field(__u64, gfn) \ 11 __field(unsigned long, mmu_valid_gen) \
12 __field(__u32, role) \ 12 __field(__u64, gfn) \
13 __field(__u32, root_count) \ 13 __field(__u32, role) \
14 __field(__u32, root_count) \
14 __field(bool, unsync) 15 __field(bool, unsync)
15 16
16#define KVM_MMU_PAGE_ASSIGN(sp) \ 17#define KVM_MMU_PAGE_ASSIGN(sp) \
17 __entry->gfn = sp->gfn; \ 18 __entry->mmu_valid_gen = sp->mmu_valid_gen; \
18 __entry->role = sp->role.word; \ 19 __entry->gfn = sp->gfn; \
19 __entry->root_count = sp->root_count; \ 20 __entry->role = sp->role.word; \
21 __entry->root_count = sp->root_count; \
20 __entry->unsync = sp->unsync; 22 __entry->unsync = sp->unsync;
21 23
22#define KVM_MMU_PAGE_PRINTK() ({ \ 24#define KVM_MMU_PAGE_PRINTK() ({ \
@@ -28,8 +30,8 @@
28 \ 30 \
29 role.word = __entry->role; \ 31 role.word = __entry->role; \
30 \ 32 \
31 trace_seq_printf(p, "sp gfn %llx %u%s q%u%s %s%s" \ 33 trace_seq_printf(p, "sp gen %lx gfn %llx %u%s q%u%s %s%s" \
32 " %snxe root %u %s%c", \ 34 " %snxe root %u %s%c", __entry->mmu_valid_gen, \
33 __entry->gfn, role.level, \ 35 __entry->gfn, role.level, \
34 role.cr4_pae ? " pae" : "", \ 36 role.cr4_pae ? " pae" : "", \
35 role.quadrant, \ 37 role.quadrant, \
@@ -197,23 +199,25 @@ DEFINE_EVENT(kvm_mmu_page_class, kvm_mmu_prepare_zap_page,
197 199
198TRACE_EVENT( 200TRACE_EVENT(
199 mark_mmio_spte, 201 mark_mmio_spte,
200 TP_PROTO(u64 *sptep, gfn_t gfn, unsigned access), 202 TP_PROTO(u64 *sptep, gfn_t gfn, unsigned access, unsigned int gen),
201 TP_ARGS(sptep, gfn, access), 203 TP_ARGS(sptep, gfn, access, gen),
202 204
203 TP_STRUCT__entry( 205 TP_STRUCT__entry(
204 __field(void *, sptep) 206 __field(void *, sptep)
205 __field(gfn_t, gfn) 207 __field(gfn_t, gfn)
206 __field(unsigned, access) 208 __field(unsigned, access)
209 __field(unsigned int, gen)
207 ), 210 ),
208 211
209 TP_fast_assign( 212 TP_fast_assign(
210 __entry->sptep = sptep; 213 __entry->sptep = sptep;
211 __entry->gfn = gfn; 214 __entry->gfn = gfn;
212 __entry->access = access; 215 __entry->access = access;
216 __entry->gen = gen;
213 ), 217 ),
214 218
215 TP_printk("sptep:%p gfn %llx access %x", __entry->sptep, __entry->gfn, 219 TP_printk("sptep:%p gfn %llx access %x gen %x", __entry->sptep,
216 __entry->access) 220 __entry->gfn, __entry->access, __entry->gen)
217); 221);
218 222
219TRACE_EVENT( 223TRACE_EVENT(
@@ -274,6 +278,50 @@ TRACE_EVENT(
274 __spte_satisfied(old_spte), __spte_satisfied(new_spte) 278 __spte_satisfied(old_spte), __spte_satisfied(new_spte)
275 ) 279 )
276); 280);
281
282TRACE_EVENT(
283 kvm_mmu_invalidate_zap_all_pages,
284 TP_PROTO(struct kvm *kvm),
285 TP_ARGS(kvm),
286
287 TP_STRUCT__entry(
288 __field(unsigned long, mmu_valid_gen)
289 __field(unsigned int, mmu_used_pages)
290 ),
291
292 TP_fast_assign(
293 __entry->mmu_valid_gen = kvm->arch.mmu_valid_gen;
294 __entry->mmu_used_pages = kvm->arch.n_used_mmu_pages;
295 ),
296
297 TP_printk("kvm-mmu-valid-gen %lx used_pages %x",
298 __entry->mmu_valid_gen, __entry->mmu_used_pages
299 )
300);
301
302
303TRACE_EVENT(
304 check_mmio_spte,
305 TP_PROTO(u64 spte, unsigned int kvm_gen, unsigned int spte_gen),
306 TP_ARGS(spte, kvm_gen, spte_gen),
307
308 TP_STRUCT__entry(
309 __field(unsigned int, kvm_gen)
310 __field(unsigned int, spte_gen)
311 __field(u64, spte)
312 ),
313
314 TP_fast_assign(
315 __entry->kvm_gen = kvm_gen;
316 __entry->spte_gen = spte_gen;
317 __entry->spte = spte;
318 ),
319
320 TP_printk("spte %llx kvm_gen %x spte-gen %x valid %d", __entry->spte,
321 __entry->kvm_gen, __entry->spte_gen,
322 __entry->kvm_gen == __entry->spte_gen
323 )
324);
277#endif /* _TRACE_KVMMMU_H */ 325#endif /* _TRACE_KVMMMU_H */
278 326
279#undef TRACE_INCLUDE_PATH 327#undef TRACE_INCLUDE_PATH
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index da20860b457a..7769699d48a8 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -552,9 +552,12 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
552 552
553 pgprintk("%s: addr %lx err %x\n", __func__, addr, error_code); 553 pgprintk("%s: addr %lx err %x\n", __func__, addr, error_code);
554 554
555 if (unlikely(error_code & PFERR_RSVD_MASK)) 555 if (unlikely(error_code & PFERR_RSVD_MASK)) {
556 return handle_mmio_page_fault(vcpu, addr, error_code, 556 r = handle_mmio_page_fault(vcpu, addr, error_code,
557 mmu_is_nested(vcpu)); 557 mmu_is_nested(vcpu));
558 if (likely(r != RET_MMIO_PF_INVALID))
559 return r;
560 };
558 561
559 r = mmu_topup_memory_caches(vcpu); 562 r = mmu_topup_memory_caches(vcpu);
560 if (r) 563 if (r)
@@ -792,7 +795,8 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
792 pte_access &= gpte_access(vcpu, gpte); 795 pte_access &= gpte_access(vcpu, gpte);
793 protect_clean_gpte(&pte_access, gpte); 796 protect_clean_gpte(&pte_access, gpte);
794 797
795 if (sync_mmio_spte(&sp->spt[i], gfn, pte_access, &nr_present)) 798 if (sync_mmio_spte(vcpu->kvm, &sp->spt[i], gfn, pte_access,
799 &nr_present))
796 continue; 800 continue;
797 801
798 if (gfn != sp->gfns[i]) { 802 if (gfn != sp->gfns[i]) {
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index a14a6eaf871d..c0bc80391e40 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1026,7 +1026,10 @@ static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
1026 g_tsc_offset = svm->vmcb->control.tsc_offset - 1026 g_tsc_offset = svm->vmcb->control.tsc_offset -
1027 svm->nested.hsave->control.tsc_offset; 1027 svm->nested.hsave->control.tsc_offset;
1028 svm->nested.hsave->control.tsc_offset = offset; 1028 svm->nested.hsave->control.tsc_offset = offset;
1029 } 1029 } else
1030 trace_kvm_write_tsc_offset(vcpu->vcpu_id,
1031 svm->vmcb->control.tsc_offset,
1032 offset);
1030 1033
1031 svm->vmcb->control.tsc_offset = offset + g_tsc_offset; 1034 svm->vmcb->control.tsc_offset = offset + g_tsc_offset;
1032 1035
@@ -1044,6 +1047,11 @@ static void svm_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment, bool ho
1044 svm->vmcb->control.tsc_offset += adjustment; 1047 svm->vmcb->control.tsc_offset += adjustment;
1045 if (is_guest_mode(vcpu)) 1048 if (is_guest_mode(vcpu))
1046 svm->nested.hsave->control.tsc_offset += adjustment; 1049 svm->nested.hsave->control.tsc_offset += adjustment;
1050 else
1051 trace_kvm_write_tsc_offset(vcpu->vcpu_id,
1052 svm->vmcb->control.tsc_offset - adjustment,
1053 svm->vmcb->control.tsc_offset);
1054
1047 mark_dirty(svm->vmcb, VMCB_INTERCEPTS); 1055 mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
1048} 1056}
1049 1057
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
index fe5e00ed7036..545245d7cc63 100644
--- a/arch/x86/kvm/trace.h
+++ b/arch/x86/kvm/trace.h
@@ -756,6 +756,27 @@ TRACE_EVENT(
756 __entry->gpa_match ? "GPA" : "GVA") 756 __entry->gpa_match ? "GPA" : "GVA")
757); 757);
758 758
759TRACE_EVENT(kvm_write_tsc_offset,
760 TP_PROTO(unsigned int vcpu_id, __u64 previous_tsc_offset,
761 __u64 next_tsc_offset),
762 TP_ARGS(vcpu_id, previous_tsc_offset, next_tsc_offset),
763
764 TP_STRUCT__entry(
765 __field( unsigned int, vcpu_id )
766 __field( __u64, previous_tsc_offset )
767 __field( __u64, next_tsc_offset )
768 ),
769
770 TP_fast_assign(
771 __entry->vcpu_id = vcpu_id;
772 __entry->previous_tsc_offset = previous_tsc_offset;
773 __entry->next_tsc_offset = next_tsc_offset;
774 ),
775
776 TP_printk("vcpu=%u prev=%llu next=%llu", __entry->vcpu_id,
777 __entry->previous_tsc_offset, __entry->next_tsc_offset)
778);
779
759#ifdef CONFIG_X86_64 780#ifdef CONFIG_X86_64
760 781
761#define host_clocks \ 782#define host_clocks \
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 260a91939555..a7e18551c968 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2096,6 +2096,8 @@ static void vmx_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
2096 (nested_cpu_has(vmcs12, CPU_BASED_USE_TSC_OFFSETING) ? 2096 (nested_cpu_has(vmcs12, CPU_BASED_USE_TSC_OFFSETING) ?
2097 vmcs12->tsc_offset : 0)); 2097 vmcs12->tsc_offset : 0));
2098 } else { 2098 } else {
2099 trace_kvm_write_tsc_offset(vcpu->vcpu_id,
2100 vmcs_read64(TSC_OFFSET), offset);
2099 vmcs_write64(TSC_OFFSET, offset); 2101 vmcs_write64(TSC_OFFSET, offset);
2100 } 2102 }
2101} 2103}
@@ -2103,11 +2105,14 @@ static void vmx_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
2103static void vmx_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment, bool host) 2105static void vmx_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment, bool host)
2104{ 2106{
2105 u64 offset = vmcs_read64(TSC_OFFSET); 2107 u64 offset = vmcs_read64(TSC_OFFSET);
2108
2106 vmcs_write64(TSC_OFFSET, offset + adjustment); 2109 vmcs_write64(TSC_OFFSET, offset + adjustment);
2107 if (is_guest_mode(vcpu)) { 2110 if (is_guest_mode(vcpu)) {
2108 /* Even when running L2, the adjustment needs to apply to L1 */ 2111 /* Even when running L2, the adjustment needs to apply to L1 */
2109 to_vmx(vcpu)->nested.vmcs01_tsc_offset += adjustment; 2112 to_vmx(vcpu)->nested.vmcs01_tsc_offset += adjustment;
2110 } 2113 } else
2114 trace_kvm_write_tsc_offset(vcpu->vcpu_id, offset,
2115 offset + adjustment);
2111} 2116}
2112 2117
2113static u64 vmx_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc) 2118static u64 vmx_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc)
@@ -4176,10 +4181,10 @@ static void ept_set_mmio_spte_mask(void)
4176 /* 4181 /*
4177 * EPT Misconfigurations can be generated if the value of bits 2:0 4182 * EPT Misconfigurations can be generated if the value of bits 2:0
4178 * of an EPT paging-structure entry is 110b (write/execute). 4183 * of an EPT paging-structure entry is 110b (write/execute).
4179 * Also, magic bits (0xffull << 49) is set to quickly identify mmio 4184 * Also, magic bits (0x3ull << 62) is set to quickly identify mmio
4180 * spte. 4185 * spte.
4181 */ 4186 */
4182 kvm_mmu_set_mmio_spte_mask(0xffull << 49 | 0x6ull); 4187 kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull);
4183} 4188}
4184 4189
4185/* 4190/*
@@ -5366,10 +5371,14 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
5366 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); 5371 gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
5367 5372
5368 ret = handle_mmio_page_fault_common(vcpu, gpa, true); 5373 ret = handle_mmio_page_fault_common(vcpu, gpa, true);
5369 if (likely(ret == 1)) 5374 if (likely(ret == RET_MMIO_PF_EMULATE))
5370 return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) == 5375 return x86_emulate_instruction(vcpu, gpa, 0, NULL, 0) ==
5371 EMULATE_DONE; 5376 EMULATE_DONE;
5372 if (unlikely(!ret)) 5377
5378 if (unlikely(ret == RET_MMIO_PF_INVALID))
5379 return kvm_mmu_page_fault(vcpu, gpa, 0, NULL, 0);
5380
5381 if (unlikely(ret == RET_MMIO_PF_RETRY))
5373 return 1; 5382 return 1;
5374 5383
5375 /* It is the real ept misconfig */ 5384 /* It is the real ept misconfig */
@@ -7942,7 +7951,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
7942 7951
7943 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp); 7952 kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->host_rsp);
7944 kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip); 7953 kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->host_rip);
7945 vmx_set_rflags(vcpu, X86_EFLAGS_BIT1); 7954 vmx_set_rflags(vcpu, X86_EFLAGS_FIXED);
7946 /* 7955 /*
7947 * Note that calling vmx_set_cr0 is important, even if cr0 hasn't 7956 * Note that calling vmx_set_cr0 is important, even if cr0 hasn't
7948 * actually changed, because it depends on the current state of 7957 * actually changed, because it depends on the current state of
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 094b5d96ab14..d21bce505315 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -582,8 +582,6 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
582 if (index != XCR_XFEATURE_ENABLED_MASK) 582 if (index != XCR_XFEATURE_ENABLED_MASK)
583 return 1; 583 return 1;
584 xcr0 = xcr; 584 xcr0 = xcr;
585 if (kvm_x86_ops->get_cpl(vcpu) != 0)
586 return 1;
587 if (!(xcr0 & XSTATE_FP)) 585 if (!(xcr0 & XSTATE_FP))
588 return 1; 586 return 1;
589 if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE)) 587 if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE))
@@ -597,7 +595,8 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
597 595
598int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) 596int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
599{ 597{
600 if (__kvm_set_xcr(vcpu, index, xcr)) { 598 if (kvm_x86_ops->get_cpl(vcpu) != 0 ||
599 __kvm_set_xcr(vcpu, index, xcr)) {
601 kvm_inject_gp(vcpu, 0); 600 kvm_inject_gp(vcpu, 0);
602 return 1; 601 return 1;
603 } 602 }
@@ -619,7 +618,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
619 if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP)) 618 if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP))
620 return 1; 619 return 1;
621 620
622 if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_RDWRGSFS)) 621 if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_FSGSBASE))
623 return 1; 622 return 1;
624 623
625 if (is_long_mode(vcpu)) { 624 if (is_long_mode(vcpu)) {
@@ -1194,20 +1193,37 @@ void kvm_write_tsc(struct kvm_vcpu *vcpu, struct msr_data *msr)
1194 elapsed = ns - kvm->arch.last_tsc_nsec; 1193 elapsed = ns - kvm->arch.last_tsc_nsec;
1195 1194
1196 if (vcpu->arch.virtual_tsc_khz) { 1195 if (vcpu->arch.virtual_tsc_khz) {
1196 int faulted = 0;
1197
1197 /* n.b - signed multiplication and division required */ 1198 /* n.b - signed multiplication and division required */
1198 usdiff = data - kvm->arch.last_tsc_write; 1199 usdiff = data - kvm->arch.last_tsc_write;
1199#ifdef CONFIG_X86_64 1200#ifdef CONFIG_X86_64
1200 usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz; 1201 usdiff = (usdiff * 1000) / vcpu->arch.virtual_tsc_khz;
1201#else 1202#else
1202 /* do_div() only does unsigned */ 1203 /* do_div() only does unsigned */
1203 asm("idivl %2; xor %%edx, %%edx" 1204 asm("1: idivl %[divisor]\n"
1204 : "=A"(usdiff) 1205 "2: xor %%edx, %%edx\n"
1205 : "A"(usdiff * 1000), "rm"(vcpu->arch.virtual_tsc_khz)); 1206 " movl $0, %[faulted]\n"
1207 "3:\n"
1208 ".section .fixup,\"ax\"\n"
1209 "4: movl $1, %[faulted]\n"
1210 " jmp 3b\n"
1211 ".previous\n"
1212
1213 _ASM_EXTABLE(1b, 4b)
1214
1215 : "=A"(usdiff), [faulted] "=r" (faulted)
1216 : "A"(usdiff * 1000), [divisor] "rm"(vcpu->arch.virtual_tsc_khz));
1217
1206#endif 1218#endif
1207 do_div(elapsed, 1000); 1219 do_div(elapsed, 1000);
1208 usdiff -= elapsed; 1220 usdiff -= elapsed;
1209 if (usdiff < 0) 1221 if (usdiff < 0)
1210 usdiff = -usdiff; 1222 usdiff = -usdiff;
1223
1224 /* idivl overflow => difference is larger than USEC_PER_SEC */
1225 if (faulted)
1226 usdiff = USEC_PER_SEC;
1211 } else 1227 } else
1212 usdiff = USEC_PER_SEC; /* disable TSC match window below */ 1228 usdiff = USEC_PER_SEC; /* disable TSC match window below */
1213 1229
@@ -1588,6 +1604,30 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
1588 return 0; 1604 return 0;
1589} 1605}
1590 1606
1607/*
1608 * kvmclock updates which are isolated to a given vcpu, such as
1609 * vcpu->cpu migration, should not allow system_timestamp from
1610 * the rest of the vcpus to remain static. Otherwise ntp frequency
1611 * correction applies to one vcpu's system_timestamp but not
1612 * the others.
1613 *
1614 * So in those cases, request a kvmclock update for all vcpus.
1615 * The worst case for a remote vcpu to update its kvmclock
1616 * is then bounded by maximum nohz sleep latency.
1617 */
1618
1619static void kvm_gen_kvmclock_update(struct kvm_vcpu *v)
1620{
1621 int i;
1622 struct kvm *kvm = v->kvm;
1623 struct kvm_vcpu *vcpu;
1624
1625 kvm_for_each_vcpu(i, vcpu, kvm) {
1626 set_bit(KVM_REQ_CLOCK_UPDATE, &vcpu->requests);
1627 kvm_vcpu_kick(vcpu);
1628 }
1629}
1630
1591static bool msr_mtrr_valid(unsigned msr) 1631static bool msr_mtrr_valid(unsigned msr)
1592{ 1632{
1593 switch (msr) { 1633 switch (msr) {
@@ -1985,7 +2025,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
1985 kvmclock_reset(vcpu); 2025 kvmclock_reset(vcpu);
1986 2026
1987 vcpu->arch.time = data; 2027 vcpu->arch.time = data;
1988 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); 2028 kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
1989 2029
1990 /* we verify if the enable bit is set... */ 2030 /* we verify if the enable bit is set... */
1991 if (!(data & 1)) 2031 if (!(data & 1))
@@ -2702,7 +2742,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
2702 * kvmclock on vcpu->cpu migration 2742 * kvmclock on vcpu->cpu migration
2703 */ 2743 */
2704 if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1) 2744 if (!vcpu->kvm->arch.use_master_clock || vcpu->cpu == -1)
2705 kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); 2745 kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
2706 if (vcpu->cpu != cpu) 2746 if (vcpu->cpu != cpu)
2707 kvm_migrate_timers(vcpu); 2747 kvm_migrate_timers(vcpu);
2708 vcpu->cpu = cpu; 2748 vcpu->cpu = cpu;
@@ -5239,7 +5279,13 @@ static void kvm_set_mmio_spte_mask(void)
5239 * Set the reserved bits and the present bit of an paging-structure 5279 * Set the reserved bits and the present bit of an paging-structure
5240 * entry to generate page fault with PFER.RSV = 1. 5280 * entry to generate page fault with PFER.RSV = 1.
5241 */ 5281 */
5242 mask = ((1ull << (62 - maxphyaddr + 1)) - 1) << maxphyaddr; 5282 /* Mask the reserved physical address bits. */
5283 mask = ((1ull << (51 - maxphyaddr + 1)) - 1) << maxphyaddr;
5284
5285 /* Bit 62 is always reserved for 32bit host. */
5286 mask |= 0x3ull << 62;
5287
5288 /* Set the present bit. */
5243 mask |= 1ull; 5289 mask |= 1ull;
5244 5290
5245#ifdef CONFIG_X86_64 5291#ifdef CONFIG_X86_64
@@ -5499,13 +5545,6 @@ static int emulator_fix_hypercall(struct x86_emulate_ctxt *ctxt)
5499 char instruction[3]; 5545 char instruction[3];
5500 unsigned long rip = kvm_rip_read(vcpu); 5546 unsigned long rip = kvm_rip_read(vcpu);
5501 5547
5502 /*
5503 * Blow out the MMU to ensure that no other VCPU has an active mapping
5504 * to ensure that the updated hypercall appears atomically across all
5505 * VCPUs.
5506 */
5507 kvm_mmu_zap_all(vcpu->kvm);
5508
5509 kvm_x86_ops->patch_hypercall(vcpu, instruction); 5548 kvm_x86_ops->patch_hypercall(vcpu, instruction);
5510 5549
5511 return emulator_write_emulated(ctxt, rip, instruction, 3, NULL); 5550 return emulator_write_emulated(ctxt, rip, instruction, 3, NULL);
@@ -5703,6 +5742,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
5703 __kvm_migrate_timers(vcpu); 5742 __kvm_migrate_timers(vcpu);
5704 if (kvm_check_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu)) 5743 if (kvm_check_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu))
5705 kvm_gen_update_masterclock(vcpu->kvm); 5744 kvm_gen_update_masterclock(vcpu->kvm);
5745 if (kvm_check_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu))
5746 kvm_gen_kvmclock_update(vcpu);
5706 if (kvm_check_request(KVM_REQ_CLOCK_UPDATE, vcpu)) { 5747 if (kvm_check_request(KVM_REQ_CLOCK_UPDATE, vcpu)) {
5707 r = kvm_guest_time_update(vcpu); 5748 r = kvm_guest_time_update(vcpu);
5708 if (unlikely(r)) 5749 if (unlikely(r))
@@ -6813,6 +6854,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
6813 return -EINVAL; 6854 return -EINVAL;
6814 6855
6815 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); 6856 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
6857 INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages);
6816 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 6858 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
6817 6859
6818 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ 6860 /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */
@@ -7041,22 +7083,18 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
7041 * If memory slot is created, or moved, we need to clear all 7083 * If memory slot is created, or moved, we need to clear all
7042 * mmio sptes. 7084 * mmio sptes.
7043 */ 7085 */
7044 if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { 7086 kvm_mmu_invalidate_mmio_sptes(kvm);
7045 kvm_mmu_zap_mmio_sptes(kvm);
7046 kvm_reload_remote_mmus(kvm);
7047 }
7048} 7087}
7049 7088
7050void kvm_arch_flush_shadow_all(struct kvm *kvm) 7089void kvm_arch_flush_shadow_all(struct kvm *kvm)
7051{ 7090{
7052 kvm_mmu_zap_all(kvm); 7091 kvm_mmu_invalidate_zap_all_pages(kvm);
7053 kvm_reload_remote_mmus(kvm);
7054} 7092}
7055 7093
7056void kvm_arch_flush_shadow_memslot(struct kvm *kvm, 7094void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
7057 struct kvm_memory_slot *slot) 7095 struct kvm_memory_slot *slot)
7058{ 7096{
7059 kvm_arch_flush_shadow_all(kvm); 7097 kvm_mmu_invalidate_zap_all_pages(kvm);
7060} 7098}
7061 7099
7062int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 7100int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
@@ -7264,3 +7302,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intr_vmexit);
7264EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga); 7302EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_invlpga);
7265EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit); 7303EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_skinit);
7266EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts); 7304EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_nested_intercepts);
7305EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_write_tsc_offset);
diff --git a/arch/x86/lguest/Makefile b/arch/x86/lguest/Makefile
index 94e0e54056a9..8f38d577a2fa 100644
--- a/arch/x86/lguest/Makefile
+++ b/arch/x86/lguest/Makefile
@@ -1,2 +1,2 @@
1obj-y := i386_head.o boot.o 1obj-y := head_32.o boot.o
2CFLAGS_boot.o := $(call cc-option, -fno-stack-protector) 2CFLAGS_boot.o := $(call cc-option, -fno-stack-protector)
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 7114c63f047d..d482bcaf61c1 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1410,7 +1410,7 @@ __init void lguest_init(void)
1410 new_cpu_data.x86_capability[0] = cpuid_edx(1); 1410 new_cpu_data.x86_capability[0] = cpuid_edx(1);
1411 1411
1412 /* Math is always hard! */ 1412 /* Math is always hard! */
1413 new_cpu_data.hard_math = 1; 1413 set_cpu_cap(&new_cpu_data, X86_FEATURE_FPU);
1414 1414
1415 /* We don't have features. We have puppies! Puppies! */ 1415 /* We don't have features. We have puppies! Puppies! */
1416#ifdef CONFIG_X86_MCE 1416#ifdef CONFIG_X86_MCE
diff --git a/arch/x86/lguest/i386_head.S b/arch/x86/lguest/head_32.S
index 6ddfe4fc23c3..6ddfe4fc23c3 100644
--- a/arch/x86/lguest/i386_head.S
+++ b/arch/x86/lguest/head_32.S
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 252b8f5489ba..4500142bc4aa 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -1,6 +1,7 @@
1#include <linux/highmem.h> 1#include <linux/highmem.h>
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/swap.h> /* for totalram_pages */ 3#include <linux/swap.h> /* for totalram_pages */
4#include <linux/bootmem.h>
4 5
5void *kmap(struct page *page) 6void *kmap(struct page *page)
6{ 7{
@@ -121,6 +122,11 @@ void __init set_highmem_pages_init(void)
121 struct zone *zone; 122 struct zone *zone;
122 int nid; 123 int nid;
123 124
125 /*
126 * Explicitly reset zone->managed_pages because set_highmem_pages_init()
127 * is invoked before free_all_bootmem()
128 */
129 reset_all_zones_managed_pages();
124 for_each_zone(zone) { 130 for_each_zone(zone) {
125 unsigned long zone_start_pfn, zone_end_pfn; 131 unsigned long zone_start_pfn, zone_end_pfn;
126 132
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
index ae1aa71d0115..7e73e8c69096 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
@@ -16,169 +16,6 @@
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18 18
19static unsigned long page_table_shareable(struct vm_area_struct *svma,
20 struct vm_area_struct *vma,
21 unsigned long addr, pgoff_t idx)
22{
23 unsigned long saddr = ((idx - svma->vm_pgoff) << PAGE_SHIFT) +
24 svma->vm_start;
25 unsigned long sbase = saddr & PUD_MASK;
26 unsigned long s_end = sbase + PUD_SIZE;
27
28 /* Allow segments to share if only one is marked locked */
29 unsigned long vm_flags = vma->vm_flags & ~VM_LOCKED;
30 unsigned long svm_flags = svma->vm_flags & ~VM_LOCKED;
31
32 /*
33 * match the virtual addresses, permission and the alignment of the
34 * page table page.
35 */
36 if (pmd_index(addr) != pmd_index(saddr) ||
37 vm_flags != svm_flags ||
38 sbase < svma->vm_start || svma->vm_end < s_end)
39 return 0;
40
41 return saddr;
42}
43
44static int vma_shareable(struct vm_area_struct *vma, unsigned long addr)
45{
46 unsigned long base = addr & PUD_MASK;
47 unsigned long end = base + PUD_SIZE;
48
49 /*
50 * check on proper vm_flags and page table alignment
51 */
52 if (vma->vm_flags & VM_MAYSHARE &&
53 vma->vm_start <= base && end <= vma->vm_end)
54 return 1;
55 return 0;
56}
57
58/*
59 * Search for a shareable pmd page for hugetlb. In any case calls pmd_alloc()
60 * and returns the corresponding pte. While this is not necessary for the
61 * !shared pmd case because we can allocate the pmd later as well, it makes the
62 * code much cleaner. pmd allocation is essential for the shared case because
63 * pud has to be populated inside the same i_mmap_mutex section - otherwise
64 * racing tasks could either miss the sharing (see huge_pte_offset) or select a
65 * bad pmd for sharing.
66 */
67static pte_t *
68huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
69{
70 struct vm_area_struct *vma = find_vma(mm, addr);
71 struct address_space *mapping = vma->vm_file->f_mapping;
72 pgoff_t idx = ((addr - vma->vm_start) >> PAGE_SHIFT) +
73 vma->vm_pgoff;
74 struct vm_area_struct *svma;
75 unsigned long saddr;
76 pte_t *spte = NULL;
77 pte_t *pte;
78
79 if (!vma_shareable(vma, addr))
80 return (pte_t *)pmd_alloc(mm, pud, addr);
81
82 mutex_lock(&mapping->i_mmap_mutex);
83 vma_interval_tree_foreach(svma, &mapping->i_mmap, idx, idx) {
84 if (svma == vma)
85 continue;
86
87 saddr = page_table_shareable(svma, vma, addr, idx);
88 if (saddr) {
89 spte = huge_pte_offset(svma->vm_mm, saddr);
90 if (spte) {
91 get_page(virt_to_page(spte));
92 break;
93 }
94 }
95 }
96
97 if (!spte)
98 goto out;
99
100 spin_lock(&mm->page_table_lock);
101 if (pud_none(*pud))
102 pud_populate(mm, pud, (pmd_t *)((unsigned long)spte & PAGE_MASK));
103 else
104 put_page(virt_to_page(spte));
105 spin_unlock(&mm->page_table_lock);
106out:
107 pte = (pte_t *)pmd_alloc(mm, pud, addr);
108 mutex_unlock(&mapping->i_mmap_mutex);
109 return pte;
110}
111
112/*
113 * unmap huge page backed by shared pte.
114 *
115 * Hugetlb pte page is ref counted at the time of mapping. If pte is shared
116 * indicated by page_count > 1, unmap is achieved by clearing pud and
117 * decrementing the ref count. If count == 1, the pte page is not shared.
118 *
119 * called with vma->vm_mm->page_table_lock held.
120 *
121 * returns: 1 successfully unmapped a shared pte page
122 * 0 the underlying pte page is not shared, or it is the last user
123 */
124int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
125{
126 pgd_t *pgd = pgd_offset(mm, *addr);
127 pud_t *pud = pud_offset(pgd, *addr);
128
129 BUG_ON(page_count(virt_to_page(ptep)) == 0);
130 if (page_count(virt_to_page(ptep)) == 1)
131 return 0;
132
133 pud_clear(pud);
134 put_page(virt_to_page(ptep));
135 *addr = ALIGN(*addr, HPAGE_SIZE * PTRS_PER_PTE) - HPAGE_SIZE;
136 return 1;
137}
138
139pte_t *huge_pte_alloc(struct mm_struct *mm,
140 unsigned long addr, unsigned long sz)
141{
142 pgd_t *pgd;
143 pud_t *pud;
144 pte_t *pte = NULL;
145
146 pgd = pgd_offset(mm, addr);
147 pud = pud_alloc(mm, pgd, addr);
148 if (pud) {
149 if (sz == PUD_SIZE) {
150 pte = (pte_t *)pud;
151 } else {
152 BUG_ON(sz != PMD_SIZE);
153 if (pud_none(*pud))
154 pte = huge_pmd_share(mm, addr, pud);
155 else
156 pte = (pte_t *)pmd_alloc(mm, pud, addr);
157 }
158 }
159 BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte));
160
161 return pte;
162}
163
164pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
165{
166 pgd_t *pgd;
167 pud_t *pud;
168 pmd_t *pmd = NULL;
169
170 pgd = pgd_offset(mm, addr);
171 if (pgd_present(*pgd)) {
172 pud = pud_offset(pgd, addr);
173 if (pud_present(*pud)) {
174 if (pud_large(*pud))
175 return (pte_t *)pud;
176 pmd = pmd_offset(pud, addr);
177 }
178 }
179 return (pte_t *) pmd;
180}
181
182#if 0 /* This is just for testing */ 19#if 0 /* This is just for testing */
183struct page * 20struct page *
184follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) 21follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
@@ -240,30 +77,6 @@ int pud_huge(pud_t pud)
240 return !!(pud_val(pud) & _PAGE_PSE); 77 return !!(pud_val(pud) & _PAGE_PSE);
241} 78}
242 79
243struct page *
244follow_huge_pmd(struct mm_struct *mm, unsigned long address,
245 pmd_t *pmd, int write)
246{
247 struct page *page;
248
249 page = pte_page(*(pte_t *)pmd);
250 if (page)
251 page += ((address & ~PMD_MASK) >> PAGE_SHIFT);
252 return page;
253}
254
255struct page *
256follow_huge_pud(struct mm_struct *mm, unsigned long address,
257 pud_t *pud, int write)
258{
259 struct page *page;
260
261 page = pte_page(*(pte_t *)pud);
262 if (page)
263 page += ((address & ~PUD_MASK) >> PAGE_SHIFT);
264 return page;
265}
266
267#endif 80#endif
268 81
269/* x86_64 also uses this file */ 82/* x86_64 also uses this file */
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index eaac1743def7..2ec29ac78ae6 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -277,6 +277,9 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
277 end_pfn = limit_pfn; 277 end_pfn = limit_pfn;
278 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0); 278 nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
279 279
280 if (!after_bootmem)
281 adjust_range_page_size_mask(mr, nr_range);
282
280 /* try to merge same page size and continuous */ 283 /* try to merge same page size and continuous */
281 for (i = 0; nr_range > 1 && i < nr_range - 1; i++) { 284 for (i = 0; nr_range > 1 && i < nr_range - 1; i++) {
282 unsigned long old_start; 285 unsigned long old_start;
@@ -291,9 +294,6 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
291 nr_range--; 294 nr_range--;
292 } 295 }
293 296
294 if (!after_bootmem)
295 adjust_range_page_size_mask(mr, nr_range);
296
297 for (i = 0; i < nr_range; i++) 297 for (i = 0; i < nr_range; i++)
298 printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n", 298 printk(KERN_DEBUG " [mem %#010lx-%#010lx] page %s\n",
299 mr[i].start, mr[i].end - 1, 299 mr[i].start, mr[i].end - 1,
@@ -494,7 +494,6 @@ int devmem_is_allowed(unsigned long pagenr)
494 494
495void free_init_pages(char *what, unsigned long begin, unsigned long end) 495void free_init_pages(char *what, unsigned long begin, unsigned long end)
496{ 496{
497 unsigned long addr;
498 unsigned long begin_aligned, end_aligned; 497 unsigned long begin_aligned, end_aligned;
499 498
500 /* Make sure boundaries are page aligned */ 499 /* Make sure boundaries are page aligned */
@@ -509,8 +508,6 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
509 if (begin >= end) 508 if (begin >= end)
510 return; 509 return;
511 510
512 addr = begin;
513
514 /* 511 /*
515 * If debugging page accesses then do not free this memory but 512 * If debugging page accesses then do not free this memory but
516 * mark them not present - any buggy init-section access will 513 * mark them not present - any buggy init-section access will
@@ -529,18 +526,13 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
529 set_memory_nx(begin, (end - begin) >> PAGE_SHIFT); 526 set_memory_nx(begin, (end - begin) >> PAGE_SHIFT);
530 set_memory_rw(begin, (end - begin) >> PAGE_SHIFT); 527 set_memory_rw(begin, (end - begin) >> PAGE_SHIFT);
531 528
532 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); 529 free_reserved_area((void *)begin, (void *)end, POISON_FREE_INITMEM, what);
533
534 for (; addr < end; addr += PAGE_SIZE) {
535 memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
536 free_reserved_page(virt_to_page(addr));
537 }
538#endif 530#endif
539} 531}
540 532
541void free_initmem(void) 533void free_initmem(void)
542{ 534{
543 free_init_pages("unused kernel memory", 535 free_init_pages("unused kernel",
544 (unsigned long)(&__init_begin), 536 (unsigned long)(&__init_begin),
545 (unsigned long)(&__init_end)); 537 (unsigned long)(&__init_end));
546} 538}
@@ -566,7 +558,7 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
566 * - relocate_initrd() 558 * - relocate_initrd()
567 * So here We can do PAGE_ALIGN() safely to get partial page to be freed 559 * So here We can do PAGE_ALIGN() safely to get partial page to be freed
568 */ 560 */
569 free_init_pages("initrd memory", start, PAGE_ALIGN(end)); 561 free_init_pages("initrd", start, PAGE_ALIGN(end));
570} 562}
571#endif 563#endif
572 564
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 3ac7e319918d..4287f1ffba7e 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -660,10 +660,8 @@ void __init initmem_init(void)
660 highstart_pfn = max_low_pfn; 660 highstart_pfn = max_low_pfn;
661 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 661 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
662 pages_to_mb(highend_pfn - highstart_pfn)); 662 pages_to_mb(highend_pfn - highstart_pfn));
663 num_physpages = highend_pfn;
664 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 663 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
665#else 664#else
666 num_physpages = max_low_pfn;
667 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 665 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
668#endif 666#endif
669 667
@@ -671,7 +669,7 @@ void __init initmem_init(void)
671 sparse_memory_present_with_active_regions(0); 669 sparse_memory_present_with_active_regions(0);
672 670
673#ifdef CONFIG_FLATMEM 671#ifdef CONFIG_FLATMEM
674 max_mapnr = num_physpages; 672 max_mapnr = IS_ENABLED(CONFIG_HIGHMEM) ? highend_pfn : max_low_pfn;
675#endif 673#endif
676 __vmalloc_start_set = true; 674 __vmalloc_start_set = true;
677 675
@@ -739,9 +737,6 @@ static void __init test_wp_bit(void)
739 737
740void __init mem_init(void) 738void __init mem_init(void)
741{ 739{
742 int codesize, reservedpages, datasize, initsize;
743 int tmp;
744
745 pci_iommu_alloc(); 740 pci_iommu_alloc();
746 741
747#ifdef CONFIG_FLATMEM 742#ifdef CONFIG_FLATMEM
@@ -759,32 +754,11 @@ void __init mem_init(void)
759 set_highmem_pages_init(); 754 set_highmem_pages_init();
760 755
761 /* this will put all low memory onto the freelists */ 756 /* this will put all low memory onto the freelists */
762 totalram_pages += free_all_bootmem(); 757 free_all_bootmem();
763
764 reservedpages = 0;
765 for (tmp = 0; tmp < max_low_pfn; tmp++)
766 /*
767 * Only count reserved RAM pages:
768 */
769 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
770 reservedpages++;
771 758
772 after_bootmem = 1; 759 after_bootmem = 1;
773 760
774 codesize = (unsigned long) &_etext - (unsigned long) &_text; 761 mem_init_print_info(NULL);
775 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
776 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
777
778 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
779 "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
780 nr_free_pages() << (PAGE_SHIFT-10),
781 num_physpages << (PAGE_SHIFT-10),
782 codesize >> 10,
783 reservedpages << (PAGE_SHIFT-10),
784 datasize >> 10,
785 initsize >> 10,
786 totalhigh_pages << (PAGE_SHIFT-10));
787
788 printk(KERN_INFO "virtual kernel memory layout:\n" 762 printk(KERN_INFO "virtual kernel memory layout:\n"
789 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 763 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
790#ifdef CONFIG_HIGHMEM 764#ifdef CONFIG_HIGHMEM
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index bb00c4672ad6..104d56a9245f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -368,7 +368,7 @@ void __init init_extra_mapping_uc(unsigned long phys, unsigned long size)
368 * 368 *
369 * from __START_KERNEL_map to __START_KERNEL_map + size (== _end-_text) 369 * from __START_KERNEL_map to __START_KERNEL_map + size (== _end-_text)
370 * 370 *
371 * phys_addr holds the negative offset to the kernel, which is added 371 * phys_base holds the negative offset to the kernel, which is added
372 * to the compile time generated pmds. This results in invalid pmds up 372 * to the compile time generated pmds. This results in invalid pmds up
373 * to the point where we hit the physaddr 0 mapping. 373 * to the point where we hit the physaddr 0 mapping.
374 * 374 *
@@ -712,36 +712,22 @@ EXPORT_SYMBOL_GPL(arch_add_memory);
712 712
713static void __meminit free_pagetable(struct page *page, int order) 713static void __meminit free_pagetable(struct page *page, int order)
714{ 714{
715 struct zone *zone;
716 bool bootmem = false;
717 unsigned long magic; 715 unsigned long magic;
718 unsigned int nr_pages = 1 << order; 716 unsigned int nr_pages = 1 << order;
719 717
720 /* bootmem page has reserved flag */ 718 /* bootmem page has reserved flag */
721 if (PageReserved(page)) { 719 if (PageReserved(page)) {
722 __ClearPageReserved(page); 720 __ClearPageReserved(page);
723 bootmem = true;
724 721
725 magic = (unsigned long)page->lru.next; 722 magic = (unsigned long)page->lru.next;
726 if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) { 723 if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
727 while (nr_pages--) 724 while (nr_pages--)
728 put_page_bootmem(page++); 725 put_page_bootmem(page++);
729 } else 726 } else
730 __free_pages_bootmem(page, order); 727 while (nr_pages--)
728 free_reserved_page(page++);
731 } else 729 } else
732 free_pages((unsigned long)page_address(page), order); 730 free_pages((unsigned long)page_address(page), order);
733
734 /*
735 * SECTION_INFO pages and MIX_SECTION_INFO pages
736 * are all allocated by bootmem.
737 */
738 if (bootmem) {
739 zone = page_zone(page);
740 zone_span_writelock(zone);
741 zone->present_pages += nr_pages;
742 zone_span_writeunlock(zone);
743 totalram_pages += nr_pages;
744 }
745} 731}
746 732
747static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd) 733static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd)
@@ -1058,9 +1044,6 @@ static void __init register_page_bootmem_info(void)
1058 1044
1059void __init mem_init(void) 1045void __init mem_init(void)
1060{ 1046{
1061 long codesize, reservedpages, datasize, initsize;
1062 unsigned long absent_pages;
1063
1064 pci_iommu_alloc(); 1047 pci_iommu_alloc();
1065 1048
1066 /* clear_bss() already clear the empty_zero_page */ 1049 /* clear_bss() already clear the empty_zero_page */
@@ -1068,29 +1051,14 @@ void __init mem_init(void)
1068 register_page_bootmem_info(); 1051 register_page_bootmem_info();
1069 1052
1070 /* this will put all memory onto the freelists */ 1053 /* this will put all memory onto the freelists */
1071 totalram_pages = free_all_bootmem(); 1054 free_all_bootmem();
1072
1073 absent_pages = absent_pages_in_range(0, max_pfn);
1074 reservedpages = max_pfn - totalram_pages - absent_pages;
1075 after_bootmem = 1; 1055 after_bootmem = 1;
1076 1056
1077 codesize = (unsigned long) &_etext - (unsigned long) &_text;
1078 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
1079 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
1080
1081 /* Register memory areas for /proc/kcore */ 1057 /* Register memory areas for /proc/kcore */
1082 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 1058 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
1083 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER); 1059 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
1084 1060
1085 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 1061 mem_init_print_info(NULL);
1086 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
1087 nr_free_pages() << (PAGE_SHIFT-10),
1088 max_pfn << (PAGE_SHIFT-10),
1089 codesize >> 10,
1090 absent_pages << (PAGE_SHIFT-10),
1091 reservedpages << (PAGE_SHIFT-10),
1092 datasize >> 10,
1093 initsize >> 10);
1094} 1062}
1095 1063
1096#ifdef CONFIG_DEBUG_RODATA 1064#ifdef CONFIG_DEBUG_RODATA
@@ -1166,11 +1134,10 @@ void mark_rodata_ro(void)
1166 set_memory_ro(start, (end-start) >> PAGE_SHIFT); 1134 set_memory_ro(start, (end-start) >> PAGE_SHIFT);
1167#endif 1135#endif
1168 1136
1169 free_init_pages("unused kernel memory", 1137 free_init_pages("unused kernel",
1170 (unsigned long) __va(__pa_symbol(text_end)), 1138 (unsigned long) __va(__pa_symbol(text_end)),
1171 (unsigned long) __va(__pa_symbol(rodata_start))); 1139 (unsigned long) __va(__pa_symbol(rodata_start)));
1172 1140 free_init_pages("unused kernel",
1173 free_init_pages("unused kernel memory",
1174 (unsigned long) __va(__pa_symbol(rodata_end)), 1141 (unsigned long) __va(__pa_symbol(rodata_end)),
1175 (unsigned long) __va(__pa_symbol(_sdata))); 1142 (unsigned long) __va(__pa_symbol(_sdata)));
1176} 1143}
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 9a1e6583910c..0215e2c563ef 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -501,15 +501,15 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
501 } 501 }
502 502
503 if (slot < 0) { 503 if (slot < 0) {
504 printk(KERN_INFO "early_iomap(%08llx, %08lx) not found slot\n", 504 printk(KERN_INFO "%s(%08llx, %08lx) not found slot\n",
505 (u64)phys_addr, size); 505 __func__, (u64)phys_addr, size);
506 WARN_ON(1); 506 WARN_ON(1);
507 return NULL; 507 return NULL;
508 } 508 }
509 509
510 if (early_ioremap_debug) { 510 if (early_ioremap_debug) {
511 printk(KERN_INFO "early_ioremap(%08llx, %08lx) [%d] => ", 511 printk(KERN_INFO "%s(%08llx, %08lx) [%d] => ",
512 (u64)phys_addr, size, slot); 512 __func__, (u64)phys_addr, size, slot);
513 dump_stack(); 513 dump_stack();
514 } 514 }
515 515
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 73a6d7395bd3..0342d27ca798 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -83,10 +83,8 @@ void __init initmem_init(void)
83 highstart_pfn = max_low_pfn; 83 highstart_pfn = max_low_pfn;
84 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 84 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
85 pages_to_mb(highend_pfn - highstart_pfn)); 85 pages_to_mb(highend_pfn - highstart_pfn));
86 num_physpages = highend_pfn;
87 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 86 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
88#else 87#else
89 num_physpages = max_low_pfn;
90 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 88 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
91#endif 89#endif
92 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 90 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 3e724256dbee..d641897a1f4e 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -324,14 +324,11 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
324 res->start = start; 324 res->start = start;
325 res->end = end; 325 res->end = end;
326 info->res_offset[info->res_num] = addr.translation_offset; 326 info->res_offset[info->res_num] = addr.translation_offset;
327 info->res_num++;
327 328
328 if (!pci_use_crs) { 329 if (!pci_use_crs)
329 dev_printk(KERN_DEBUG, &info->bridge->dev, 330 dev_printk(KERN_DEBUG, &info->bridge->dev,
330 "host bridge window %pR (ignored)\n", res); 331 "host bridge window %pR (ignored)\n", res);
331 return AE_OK;
332 }
333
334 info->res_num++;
335 332
336 return AE_OK; 333 return AE_OK;
337} 334}
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 82089d8b1954..b410b71bdcf7 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -42,7 +42,6 @@
42#include <linux/io.h> 42#include <linux/io.h>
43#include <linux/reboot.h> 43#include <linux/reboot.h>
44#include <linux/bcd.h> 44#include <linux/bcd.h>
45#include <linux/ucs2_string.h>
46 45
47#include <asm/setup.h> 46#include <asm/setup.h>
48#include <asm/efi.h> 47#include <asm/efi.h>
@@ -54,12 +53,12 @@
54 53
55#define EFI_DEBUG 1 54#define EFI_DEBUG 1
56 55
57/* 56#define EFI_MIN_RESERVE 5120
58 * There's some additional metadata associated with each 57
59 * variable. Intel's reference implementation is 60 bytes - bump that 58#define EFI_DUMMY_GUID \
60 * to account for potential alignment constraints 59 EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9)
61 */ 60
62#define VAR_METADATA_SIZE 64 61static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
63 62
64struct efi __read_mostly efi = { 63struct efi __read_mostly efi = {
65 .mps = EFI_INVALID_TABLE_ADDR, 64 .mps = EFI_INVALID_TABLE_ADDR,
@@ -79,13 +78,6 @@ struct efi_memory_map memmap;
79static struct efi efi_phys __initdata; 78static struct efi efi_phys __initdata;
80static efi_system_table_t efi_systab __initdata; 79static efi_system_table_t efi_systab __initdata;
81 80
82static u64 efi_var_store_size;
83static u64 efi_var_remaining_size;
84static u64 efi_var_max_var_size;
85static u64 boot_used_size;
86static u64 boot_var_size;
87static u64 active_size;
88
89unsigned long x86_efi_facility; 81unsigned long x86_efi_facility;
90 82
91/* 83/*
@@ -188,53 +180,8 @@ static efi_status_t virt_efi_get_next_variable(unsigned long *name_size,
188 efi_char16_t *name, 180 efi_char16_t *name,
189 efi_guid_t *vendor) 181 efi_guid_t *vendor)
190{ 182{
191 efi_status_t status; 183 return efi_call_virt3(get_next_variable,
192 static bool finished = false; 184 name_size, name, vendor);
193 static u64 var_size;
194
195 status = efi_call_virt3(get_next_variable,
196 name_size, name, vendor);
197
198 if (status == EFI_NOT_FOUND) {
199 finished = true;
200 if (var_size < boot_used_size) {
201 boot_var_size = boot_used_size - var_size;
202 active_size += boot_var_size;
203 } else {
204 printk(KERN_WARNING FW_BUG "efi: Inconsistent initial sizes\n");
205 }
206 }
207
208 if (boot_used_size && !finished) {
209 unsigned long size = 0;
210 u32 attr;
211 efi_status_t s;
212 void *tmp;
213
214 s = virt_efi_get_variable(name, vendor, &attr, &size, NULL);
215
216 if (s != EFI_BUFFER_TOO_SMALL || !size)
217 return status;
218
219 tmp = kmalloc(size, GFP_ATOMIC);
220
221 if (!tmp)
222 return status;
223
224 s = virt_efi_get_variable(name, vendor, &attr, &size, tmp);
225
226 if (s == EFI_SUCCESS && (attr & EFI_VARIABLE_NON_VOLATILE)) {
227 var_size += size;
228 var_size += ucs2_strsize(name, 1024);
229 active_size += size;
230 active_size += VAR_METADATA_SIZE;
231 active_size += ucs2_strsize(name, 1024);
232 }
233
234 kfree(tmp);
235 }
236
237 return status;
238} 185}
239 186
240static efi_status_t virt_efi_set_variable(efi_char16_t *name, 187static efi_status_t virt_efi_set_variable(efi_char16_t *name,
@@ -243,34 +190,9 @@ static efi_status_t virt_efi_set_variable(efi_char16_t *name,
243 unsigned long data_size, 190 unsigned long data_size,
244 void *data) 191 void *data)
245{ 192{
246 efi_status_t status; 193 return efi_call_virt5(set_variable,
247 u32 orig_attr = 0; 194 name, vendor, attr,
248 unsigned long orig_size = 0; 195 data_size, data);
249
250 status = virt_efi_get_variable(name, vendor, &orig_attr, &orig_size,
251 NULL);
252
253 if (status != EFI_BUFFER_TOO_SMALL)
254 orig_size = 0;
255
256 status = efi_call_virt5(set_variable,
257 name, vendor, attr,
258 data_size, data);
259
260 if (status == EFI_SUCCESS) {
261 if (orig_size) {
262 active_size -= orig_size;
263 active_size -= ucs2_strsize(name, 1024);
264 active_size -= VAR_METADATA_SIZE;
265 }
266 if (data_size) {
267 active_size += data_size;
268 active_size += ucs2_strsize(name, 1024);
269 active_size += VAR_METADATA_SIZE;
270 }
271 }
272
273 return status;
274} 196}
275 197
276static efi_status_t virt_efi_query_variable_info(u32 attr, 198static efi_status_t virt_efi_query_variable_info(u32 attr,
@@ -786,9 +708,6 @@ void __init efi_init(void)
786 char vendor[100] = "unknown"; 708 char vendor[100] = "unknown";
787 int i = 0; 709 int i = 0;
788 void *tmp; 710 void *tmp;
789 struct setup_data *data;
790 struct efi_var_bootdata *efi_var_data;
791 u64 pa_data;
792 711
793#ifdef CONFIG_X86_32 712#ifdef CONFIG_X86_32
794 if (boot_params.efi_info.efi_systab_hi || 713 if (boot_params.efi_info.efi_systab_hi ||
@@ -806,22 +725,6 @@ void __init efi_init(void)
806 if (efi_systab_init(efi_phys.systab)) 725 if (efi_systab_init(efi_phys.systab))
807 return; 726 return;
808 727
809 pa_data = boot_params.hdr.setup_data;
810 while (pa_data) {
811 data = early_ioremap(pa_data, sizeof(*efi_var_data));
812 if (data->type == SETUP_EFI_VARS) {
813 efi_var_data = (struct efi_var_bootdata *)data;
814
815 efi_var_store_size = efi_var_data->store_size;
816 efi_var_remaining_size = efi_var_data->remaining_size;
817 efi_var_max_var_size = efi_var_data->max_var_size;
818 }
819 pa_data = data->next;
820 early_iounmap(data, sizeof(*efi_var_data));
821 }
822
823 boot_used_size = efi_var_store_size - efi_var_remaining_size;
824
825 set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); 728 set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);
826 729
827 /* 730 /*
@@ -1026,6 +929,13 @@ void __init efi_enter_virtual_mode(void)
1026 va = efi_ioremap(md->phys_addr, size, 929 va = efi_ioremap(md->phys_addr, size,
1027 md->type, md->attribute); 930 md->type, md->attribute);
1028 931
932 if (!(md->attribute & EFI_MEMORY_RUNTIME)) {
933 if (!va)
934 pr_err("ioremap of 0x%llX failed!\n",
935 (unsigned long long)md->phys_addr);
936 continue;
937 }
938
1029 md->virt_addr = (u64) (unsigned long) va; 939 md->virt_addr = (u64) (unsigned long) va;
1030 940
1031 if (!va) { 941 if (!va) {
@@ -1085,6 +995,13 @@ void __init efi_enter_virtual_mode(void)
1085 runtime_code_page_mkexec(); 995 runtime_code_page_mkexec();
1086 996
1087 kfree(new_memmap); 997 kfree(new_memmap);
998
999 /* clean DUMMY object */
1000 efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
1001 EFI_VARIABLE_NON_VOLATILE |
1002 EFI_VARIABLE_BOOTSERVICE_ACCESS |
1003 EFI_VARIABLE_RUNTIME_ACCESS,
1004 0, NULL);
1088} 1005}
1089 1006
1090/* 1007/*
@@ -1136,33 +1053,70 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
1136 efi_status_t status; 1053 efi_status_t status;
1137 u64 storage_size, remaining_size, max_size; 1054 u64 storage_size, remaining_size, max_size;
1138 1055
1056 if (!(attributes & EFI_VARIABLE_NON_VOLATILE))
1057 return 0;
1058
1139 status = efi.query_variable_info(attributes, &storage_size, 1059 status = efi.query_variable_info(attributes, &storage_size,
1140 &remaining_size, &max_size); 1060 &remaining_size, &max_size);
1141 if (status != EFI_SUCCESS) 1061 if (status != EFI_SUCCESS)
1142 return status; 1062 return status;
1143 1063
1144 if (!max_size && remaining_size > size)
1145 printk_once(KERN_ERR FW_BUG "Broken EFI implementation"
1146 " is returning MaxVariableSize=0\n");
1147 /* 1064 /*
1148 * Some firmware implementations refuse to boot if there's insufficient 1065 * Some firmware implementations refuse to boot if there's insufficient
1149 * space in the variable store. We account for that by refusing the 1066 * space in the variable store. We account for that by refusing the
1150 * write if permitting it would reduce the available space to under 1067 * write if permitting it would reduce the available space to under
1151 * 50%. However, some firmware won't reclaim variable space until 1068 * 5KB. This figure was provided by Samsung, so should be safe.
1152 * after the used (not merely the actively used) space drops below
1153 * a threshold. We can approximate that case with the value calculated
1154 * above. If both the firmware and our calculations indicate that the
1155 * available space would drop below 50%, refuse the write.
1156 */ 1069 */
1070 if ((remaining_size - size < EFI_MIN_RESERVE) &&
1071 !efi_no_storage_paranoia) {
1072
1073 /*
1074 * Triggering garbage collection may require that the firmware
1075 * generate a real EFI_OUT_OF_RESOURCES error. We can force
1076 * that by attempting to use more space than is available.
1077 */
1078 unsigned long dummy_size = remaining_size + 1024;
1079 void *dummy = kzalloc(dummy_size, GFP_ATOMIC);
1080
1081 if (!dummy)
1082 return EFI_OUT_OF_RESOURCES;
1083
1084 status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
1085 EFI_VARIABLE_NON_VOLATILE |
1086 EFI_VARIABLE_BOOTSERVICE_ACCESS |
1087 EFI_VARIABLE_RUNTIME_ACCESS,
1088 dummy_size, dummy);
1089
1090 if (status == EFI_SUCCESS) {
1091 /*
1092 * This should have failed, so if it didn't make sure
1093 * that we delete it...
1094 */
1095 efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
1096 EFI_VARIABLE_NON_VOLATILE |
1097 EFI_VARIABLE_BOOTSERVICE_ACCESS |
1098 EFI_VARIABLE_RUNTIME_ACCESS,
1099 0, dummy);
1100 }
1101
1102 kfree(dummy);
1157 1103
1158 if (!storage_size || size > remaining_size || 1104 /*
1159 (max_size && size > max_size)) 1105 * The runtime code may now have triggered a garbage collection
1160 return EFI_OUT_OF_RESOURCES; 1106 * run, so check the variable info again
1107 */
1108 status = efi.query_variable_info(attributes, &storage_size,
1109 &remaining_size, &max_size);
1161 1110
1162 if (!efi_no_storage_paranoia && 1111 if (status != EFI_SUCCESS)
1163 ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) && 1112 return status;
1164 (remaining_size - size < storage_size / 2))) 1113
1165 return EFI_OUT_OF_RESOURCES; 1114 /*
1115 * There still isn't enough room, so return an error
1116 */
1117 if (remaining_size - size < EFI_MIN_RESERVE)
1118 return EFI_OUT_OF_RESOURCES;
1119 }
1166 1120
1167 return EFI_SUCCESS; 1121 return EFI_SUCCESS;
1168} 1122}
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 590be1090892..f7bab68a4b83 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -42,9 +42,6 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
42 "^(xen_irq_disable_direct_reloc$|" 42 "^(xen_irq_disable_direct_reloc$|"
43 "xen_save_fl_direct_reloc$|" 43 "xen_save_fl_direct_reloc$|"
44 "VDSO|" 44 "VDSO|"
45#if ELF_BITS == 64
46 "__vvar_page|"
47#endif
48 "__crc_)", 45 "__crc_)",
49 46
50/* 47/*
@@ -72,6 +69,7 @@ static const char * const sym_regex_kernel[S_NSYMTYPES] = {
72 "__per_cpu_load|" 69 "__per_cpu_load|"
73 "init_per_cpu__.*|" 70 "init_per_cpu__.*|"
74 "__end_rodata_hpage_align|" 71 "__end_rodata_hpage_align|"
72 "__vvar_page|"
75#endif 73#endif
76 "_end)$" 74 "_end)$"
77}; 75};
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 0faad646f5fd..d6bfb876cfb0 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -372,7 +372,7 @@ subsys_initcall(sysenter_setup);
372/* Register vsyscall32 into the ABI table */ 372/* Register vsyscall32 into the ABI table */
373#include <linux/sysctl.h> 373#include <linux/sysctl.h>
374 374
375static ctl_table abi_table2[] = { 375static struct ctl_table abi_table2[] = {
376 { 376 {
377 .procname = "vsyscall32", 377 .procname = "vsyscall32",
378 .data = &sysctl_vsyscall32, 378 .data = &sysctl_vsyscall32,
@@ -383,7 +383,7 @@ static ctl_table abi_table2[] = {
383 {} 383 {}
384}; 384};
385 385
386static ctl_table abi_root_table2[] = { 386static struct ctl_table abi_root_table2[] = {
387 { 387 {
388 .procname = "abi", 388 .procname = "abi",
389 .mode = 0555, 389 .mode = 0555,
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index a492be2635ac..2fa02bc50034 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1557,7 +1557,7 @@ asmlinkage void __init xen_start_kernel(void)
1557#ifdef CONFIG_X86_32 1557#ifdef CONFIG_X86_32
1558 /* set up basic CPUID stuff */ 1558 /* set up basic CPUID stuff */
1559 cpu_detect(&new_cpu_data); 1559 cpu_detect(&new_cpu_data);
1560 new_cpu_data.hard_math = 1; 1560 set_cpu_cap(&new_cpu_data, X86_FEATURE_FPU);
1561 new_cpu_data.wp_works_ok = 1; 1561 new_cpu_data.wp_works_ok = 1;
1562 new_cpu_data.x86_capability[0] = cpuid_edx(1); 1562 new_cpu_data.x86_capability[0] = cpuid_edx(1);
1563#endif 1563#endif
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index fb44426fe931..c1367b29c3b1 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -17,6 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/irq_work.h> 19#include <linux/irq_work.h>
20#include <linux/tick.h>
20 21
21#include <asm/paravirt.h> 22#include <asm/paravirt.h>
22#include <asm/desc.h> 23#include <asm/desc.h>
@@ -39,11 +40,15 @@
39 40
40cpumask_var_t xen_cpu_initialized_map; 41cpumask_var_t xen_cpu_initialized_map;
41 42
42static DEFINE_PER_CPU(int, xen_resched_irq); 43struct xen_common_irq {
43static DEFINE_PER_CPU(int, xen_callfunc_irq); 44 int irq;
44static DEFINE_PER_CPU(int, xen_callfuncsingle_irq); 45 char *name;
45static DEFINE_PER_CPU(int, xen_irq_work); 46};
46static DEFINE_PER_CPU(int, xen_debug_irq) = -1; 47static DEFINE_PER_CPU(struct xen_common_irq, xen_resched_irq) = { .irq = -1 };
48static DEFINE_PER_CPU(struct xen_common_irq, xen_callfunc_irq) = { .irq = -1 };
49static DEFINE_PER_CPU(struct xen_common_irq, xen_callfuncsingle_irq) = { .irq = -1 };
50static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 };
51static DEFINE_PER_CPU(struct xen_common_irq, xen_debug_irq) = { .irq = -1 };
47 52
48static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); 53static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
49static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); 54static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
@@ -98,10 +103,47 @@ static void __cpuinit cpu_bringup_and_idle(void)
98 cpu_startup_entry(CPUHP_ONLINE); 103 cpu_startup_entry(CPUHP_ONLINE);
99} 104}
100 105
106static void xen_smp_intr_free(unsigned int cpu)
107{
108 if (per_cpu(xen_resched_irq, cpu).irq >= 0) {
109 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu).irq, NULL);
110 per_cpu(xen_resched_irq, cpu).irq = -1;
111 kfree(per_cpu(xen_resched_irq, cpu).name);
112 per_cpu(xen_resched_irq, cpu).name = NULL;
113 }
114 if (per_cpu(xen_callfunc_irq, cpu).irq >= 0) {
115 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu).irq, NULL);
116 per_cpu(xen_callfunc_irq, cpu).irq = -1;
117 kfree(per_cpu(xen_callfunc_irq, cpu).name);
118 per_cpu(xen_callfunc_irq, cpu).name = NULL;
119 }
120 if (per_cpu(xen_debug_irq, cpu).irq >= 0) {
121 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu).irq, NULL);
122 per_cpu(xen_debug_irq, cpu).irq = -1;
123 kfree(per_cpu(xen_debug_irq, cpu).name);
124 per_cpu(xen_debug_irq, cpu).name = NULL;
125 }
126 if (per_cpu(xen_callfuncsingle_irq, cpu).irq >= 0) {
127 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu).irq,
128 NULL);
129 per_cpu(xen_callfuncsingle_irq, cpu).irq = -1;
130 kfree(per_cpu(xen_callfuncsingle_irq, cpu).name);
131 per_cpu(xen_callfuncsingle_irq, cpu).name = NULL;
132 }
133 if (xen_hvm_domain())
134 return;
135
136 if (per_cpu(xen_irq_work, cpu).irq >= 0) {
137 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu).irq, NULL);
138 per_cpu(xen_irq_work, cpu).irq = -1;
139 kfree(per_cpu(xen_irq_work, cpu).name);
140 per_cpu(xen_irq_work, cpu).name = NULL;
141 }
142};
101static int xen_smp_intr_init(unsigned int cpu) 143static int xen_smp_intr_init(unsigned int cpu)
102{ 144{
103 int rc; 145 int rc;
104 const char *resched_name, *callfunc_name, *debug_name; 146 char *resched_name, *callfunc_name, *debug_name;
105 147
106 resched_name = kasprintf(GFP_KERNEL, "resched%d", cpu); 148 resched_name = kasprintf(GFP_KERNEL, "resched%d", cpu);
107 rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, 149 rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR,
@@ -112,7 +154,8 @@ static int xen_smp_intr_init(unsigned int cpu)
112 NULL); 154 NULL);
113 if (rc < 0) 155 if (rc < 0)
114 goto fail; 156 goto fail;
115 per_cpu(xen_resched_irq, cpu) = rc; 157 per_cpu(xen_resched_irq, cpu).irq = rc;
158 per_cpu(xen_resched_irq, cpu).name = resched_name;
116 159
117 callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu); 160 callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu);
118 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, 161 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR,
@@ -123,7 +166,8 @@ static int xen_smp_intr_init(unsigned int cpu)
123 NULL); 166 NULL);
124 if (rc < 0) 167 if (rc < 0)
125 goto fail; 168 goto fail;
126 per_cpu(xen_callfunc_irq, cpu) = rc; 169 per_cpu(xen_callfunc_irq, cpu).irq = rc;
170 per_cpu(xen_callfunc_irq, cpu).name = callfunc_name;
127 171
128 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); 172 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
129 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, 173 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
@@ -131,7 +175,8 @@ static int xen_smp_intr_init(unsigned int cpu)
131 debug_name, NULL); 175 debug_name, NULL);
132 if (rc < 0) 176 if (rc < 0)
133 goto fail; 177 goto fail;
134 per_cpu(xen_debug_irq, cpu) = rc; 178 per_cpu(xen_debug_irq, cpu).irq = rc;
179 per_cpu(xen_debug_irq, cpu).name = debug_name;
135 180
136 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); 181 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
137 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, 182 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
@@ -142,7 +187,8 @@ static int xen_smp_intr_init(unsigned int cpu)
142 NULL); 187 NULL);
143 if (rc < 0) 188 if (rc < 0)
144 goto fail; 189 goto fail;
145 per_cpu(xen_callfuncsingle_irq, cpu) = rc; 190 per_cpu(xen_callfuncsingle_irq, cpu).irq = rc;
191 per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
146 192
147 /* 193 /*
148 * The IRQ worker on PVHVM goes through the native path and uses the 194 * The IRQ worker on PVHVM goes through the native path and uses the
@@ -160,26 +206,13 @@ static int xen_smp_intr_init(unsigned int cpu)
160 NULL); 206 NULL);
161 if (rc < 0) 207 if (rc < 0)
162 goto fail; 208 goto fail;
163 per_cpu(xen_irq_work, cpu) = rc; 209 per_cpu(xen_irq_work, cpu).irq = rc;
210 per_cpu(xen_irq_work, cpu).name = callfunc_name;
164 211
165 return 0; 212 return 0;
166 213
167 fail: 214 fail:
168 if (per_cpu(xen_resched_irq, cpu) >= 0) 215 xen_smp_intr_free(cpu);
169 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
170 if (per_cpu(xen_callfunc_irq, cpu) >= 0)
171 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
172 if (per_cpu(xen_debug_irq, cpu) >= 0)
173 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
174 if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
175 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
176 NULL);
177 if (xen_hvm_domain())
178 return rc;
179
180 if (per_cpu(xen_irq_work, cpu) >= 0)
181 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
182
183 return rc; 216 return rc;
184} 217}
185 218
@@ -432,12 +465,7 @@ static void xen_cpu_die(unsigned int cpu)
432 current->state = TASK_UNINTERRUPTIBLE; 465 current->state = TASK_UNINTERRUPTIBLE;
433 schedule_timeout(HZ/10); 466 schedule_timeout(HZ/10);
434 } 467 }
435 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); 468 xen_smp_intr_free(cpu);
436 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
437 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
438 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
439 if (!xen_hvm_domain())
440 unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
441 xen_uninit_lock_cpu(cpu); 469 xen_uninit_lock_cpu(cpu);
442 xen_teardown_timer(cpu); 470 xen_teardown_timer(cpu);
443} 471}
@@ -447,6 +475,13 @@ static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */
447 play_dead_common(); 475 play_dead_common();
448 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); 476 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
449 cpu_bringup(); 477 cpu_bringup();
478 /*
479 * commit 4b0c0f294 (tick: Cleanup NOHZ per cpu data on cpu down)
480 * clears certain data that the cpu_idle loop (which called us
481 * and that we return from) expects. The only way to get that
482 * data back is to call:
483 */
484 tick_nohz_idle_enter();
450} 485}
451 486
452#else /* !CONFIG_HOTPLUG_CPU */ 487#else /* !CONFIG_HOTPLUG_CPU */
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 3002ec1bb71a..a40f8508e760 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -7,6 +7,7 @@
7#include <linux/debugfs.h> 7#include <linux/debugfs.h>
8#include <linux/log2.h> 8#include <linux/log2.h>
9#include <linux/gfp.h> 9#include <linux/gfp.h>
10#include <linux/slab.h>
10 11
11#include <asm/paravirt.h> 12#include <asm/paravirt.h>
12 13
@@ -165,6 +166,7 @@ static int xen_spin_trylock(struct arch_spinlock *lock)
165 return old == 0; 166 return old == 0;
166} 167}
167 168
169static DEFINE_PER_CPU(char *, irq_name);
168static DEFINE_PER_CPU(int, lock_kicker_irq) = -1; 170static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
169static DEFINE_PER_CPU(struct xen_spinlock *, lock_spinners); 171static DEFINE_PER_CPU(struct xen_spinlock *, lock_spinners);
170 172
@@ -362,7 +364,7 @@ static irqreturn_t dummy_handler(int irq, void *dev_id)
362void __cpuinit xen_init_lock_cpu(int cpu) 364void __cpuinit xen_init_lock_cpu(int cpu)
363{ 365{
364 int irq; 366 int irq;
365 const char *name; 367 char *name;
366 368
367 WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n", 369 WARN(per_cpu(lock_kicker_irq, cpu) >= 0, "spinlock on CPU%d exists on IRQ%d!\n",
368 cpu, per_cpu(lock_kicker_irq, cpu)); 370 cpu, per_cpu(lock_kicker_irq, cpu));
@@ -385,6 +387,7 @@ void __cpuinit xen_init_lock_cpu(int cpu)
385 if (irq >= 0) { 387 if (irq >= 0) {
386 disable_irq(irq); /* make sure it's never delivered */ 388 disable_irq(irq); /* make sure it's never delivered */
387 per_cpu(lock_kicker_irq, cpu) = irq; 389 per_cpu(lock_kicker_irq, cpu) = irq;
390 per_cpu(irq_name, cpu) = name;
388 } 391 }
389 392
390 printk("cpu %d spinlock event irq %d\n", cpu, irq); 393 printk("cpu %d spinlock event irq %d\n", cpu, irq);
@@ -401,6 +404,8 @@ void xen_uninit_lock_cpu(int cpu)
401 404
402 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL); 405 unbind_from_irqhandler(per_cpu(lock_kicker_irq, cpu), NULL);
403 per_cpu(lock_kicker_irq, cpu) = -1; 406 per_cpu(lock_kicker_irq, cpu) = -1;
407 kfree(per_cpu(irq_name, cpu));
408 per_cpu(irq_name, cpu) = NULL;
404} 409}
405 410
406void __init xen_init_spinlocks(void) 411void __init xen_init_spinlocks(void)
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 3d88bfdf9e1c..a690868be837 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -14,6 +14,7 @@
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/math64.h> 15#include <linux/math64.h>
16#include <linux/gfp.h> 16#include <linux/gfp.h>
17#include <linux/slab.h>
17 18
18#include <asm/pvclock.h> 19#include <asm/pvclock.h>
19#include <asm/xen/hypervisor.h> 20#include <asm/xen/hypervisor.h>
@@ -36,9 +37,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
36/* snapshots of runstate info */ 37/* snapshots of runstate info */
37static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); 38static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
38 39
39/* unused ns of stolen and blocked time */ 40/* unused ns of stolen time */
40static DEFINE_PER_CPU(u64, xen_residual_stolen); 41static DEFINE_PER_CPU(u64, xen_residual_stolen);
41static DEFINE_PER_CPU(u64, xen_residual_blocked);
42 42
43/* return an consistent snapshot of 64-bit time/counter value */ 43/* return an consistent snapshot of 64-bit time/counter value */
44static u64 get64(const u64 *p) 44static u64 get64(const u64 *p)
@@ -115,7 +115,7 @@ static void do_stolen_accounting(void)
115{ 115{
116 struct vcpu_runstate_info state; 116 struct vcpu_runstate_info state;
117 struct vcpu_runstate_info *snap; 117 struct vcpu_runstate_info *snap;
118 s64 blocked, runnable, offline, stolen; 118 s64 runnable, offline, stolen;
119 cputime_t ticks; 119 cputime_t ticks;
120 120
121 get_runstate_snapshot(&state); 121 get_runstate_snapshot(&state);
@@ -125,7 +125,6 @@ static void do_stolen_accounting(void)
125 snap = &__get_cpu_var(xen_runstate_snapshot); 125 snap = &__get_cpu_var(xen_runstate_snapshot);
126 126
127 /* work out how much time the VCPU has not been runn*ing* */ 127 /* work out how much time the VCPU has not been runn*ing* */
128 blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
129 runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; 128 runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
130 offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline]; 129 offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
131 130
@@ -141,17 +140,6 @@ static void do_stolen_accounting(void)
141 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); 140 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
142 __this_cpu_write(xen_residual_stolen, stolen); 141 __this_cpu_write(xen_residual_stolen, stolen);
143 account_steal_ticks(ticks); 142 account_steal_ticks(ticks);
144
145 /* Add the appropriate number of ticks of blocked time,
146 including any left-overs from last time. */
147 blocked += __this_cpu_read(xen_residual_blocked);
148
149 if (blocked < 0)
150 blocked = 0;
151
152 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
153 __this_cpu_write(xen_residual_blocked, blocked);
154 account_idle_ticks(ticks);
155} 143}
156 144
157/* Get the TSC speed from Xen */ 145/* Get the TSC speed from Xen */
@@ -377,11 +365,16 @@ static const struct clock_event_device xen_vcpuop_clockevent = {
377 365
378static const struct clock_event_device *xen_clockevent = 366static const struct clock_event_device *xen_clockevent =
379 &xen_timerop_clockevent; 367 &xen_timerop_clockevent;
380static DEFINE_PER_CPU(struct clock_event_device, xen_clock_events) = { .irq = -1 }; 368
369struct xen_clock_event_device {
370 struct clock_event_device evt;
371 char *name;
372};
373static DEFINE_PER_CPU(struct xen_clock_event_device, xen_clock_events) = { .evt.irq = -1 };
381 374
382static irqreturn_t xen_timer_interrupt(int irq, void *dev_id) 375static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
383{ 376{
384 struct clock_event_device *evt = &__get_cpu_var(xen_clock_events); 377 struct clock_event_device *evt = &__get_cpu_var(xen_clock_events).evt;
385 irqreturn_t ret; 378 irqreturn_t ret;
386 379
387 ret = IRQ_NONE; 380 ret = IRQ_NONE;
@@ -395,14 +388,30 @@ static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
395 return ret; 388 return ret;
396} 389}
397 390
391void xen_teardown_timer(int cpu)
392{
393 struct clock_event_device *evt;
394 BUG_ON(cpu == 0);
395 evt = &per_cpu(xen_clock_events, cpu).evt;
396
397 if (evt->irq >= 0) {
398 unbind_from_irqhandler(evt->irq, NULL);
399 evt->irq = -1;
400 kfree(per_cpu(xen_clock_events, cpu).name);
401 per_cpu(xen_clock_events, cpu).name = NULL;
402 }
403}
404
398void xen_setup_timer(int cpu) 405void xen_setup_timer(int cpu)
399{ 406{
400 const char *name; 407 char *name;
401 struct clock_event_device *evt; 408 struct clock_event_device *evt;
402 int irq; 409 int irq;
403 410
404 evt = &per_cpu(xen_clock_events, cpu); 411 evt = &per_cpu(xen_clock_events, cpu).evt;
405 WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu); 412 WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu);
413 if (evt->irq >= 0)
414 xen_teardown_timer(cpu);
406 415
407 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu); 416 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu);
408 417
@@ -420,22 +429,15 @@ void xen_setup_timer(int cpu)
420 429
421 evt->cpumask = cpumask_of(cpu); 430 evt->cpumask = cpumask_of(cpu);
422 evt->irq = irq; 431 evt->irq = irq;
432 per_cpu(xen_clock_events, cpu).name = name;
423} 433}
424 434
425void xen_teardown_timer(int cpu)
426{
427 struct clock_event_device *evt;
428 BUG_ON(cpu == 0);
429 evt = &per_cpu(xen_clock_events, cpu);
430 unbind_from_irqhandler(evt->irq, NULL);
431 evt->irq = -1;
432}
433 435
434void xen_setup_cpu_clockevents(void) 436void xen_setup_cpu_clockevents(void)
435{ 437{
436 BUG_ON(preemptible()); 438 BUG_ON(preemptible());
437 439
438 clockevents_register_device(&__get_cpu_var(xen_clock_events)); 440 clockevents_register_device(&__get_cpu_var(xen_clock_events).evt);
439} 441}
440 442
441void xen_timer_resume(void) 443void xen_timer_resume(void)
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index d7546c94da52..8f017eb309bd 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -393,14 +393,6 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
393extern void update_mmu_cache(struct vm_area_struct * vma, 393extern void update_mmu_cache(struct vm_area_struct * vma,
394 unsigned long address, pte_t *ptep); 394 unsigned long address, pte_t *ptep);
395 395
396/*
397 * remap a physical page `pfn' of size `size' with page protection `prot'
398 * into virtual address `from'
399 */
400
401#define io_remap_pfn_range(vma,from,pfn,size,prot) \
402 remap_pfn_range(vma, from, pfn, size, prot)
403
404typedef pte_t *pte_addr_t; 396typedef pte_t *pte_addr_t;
405 397
406#endif /* !defined (__ASSEMBLY__) */ 398#endif /* !defined (__ASSEMBLY__) */
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index bba125b4bb06..479d7537a32a 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -173,39 +173,16 @@ void __init zones_init(void)
173 173
174void __init mem_init(void) 174void __init mem_init(void)
175{ 175{
176 unsigned long codesize, reservedpages, datasize, initsize; 176 max_mapnr = max_low_pfn - ARCH_PFN_OFFSET;
177 unsigned long highmemsize, tmp, ram;
178
179 max_mapnr = num_physpages = max_low_pfn - ARCH_PFN_OFFSET;
180 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT); 177 high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
181 highmemsize = 0;
182 178
183#ifdef CONFIG_HIGHMEM 179#ifdef CONFIG_HIGHMEM
184#error HIGHGMEM not implemented in init.c 180#error HIGHGMEM not implemented in init.c
185#endif 181#endif
186 182
187 totalram_pages += free_all_bootmem(); 183 free_all_bootmem();
188
189 reservedpages = ram = 0;
190 for (tmp = 0; tmp < max_mapnr; tmp++) {
191 ram++;
192 if (PageReserved(mem_map+tmp))
193 reservedpages++;
194 }
195 184
196 codesize = (unsigned long) _etext - (unsigned long) _stext; 185 mem_init_print_info(NULL);
197 datasize = (unsigned long) _edata - (unsigned long) _sdata;
198 initsize = (unsigned long) __init_end - (unsigned long) __init_begin;
199
200 printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, "
201 "%ldk data, %ldk init %ldk highmem)\n",
202 nr_free_pages() << (PAGE_SHIFT-10),
203 ram << (PAGE_SHIFT-10),
204 codesize >> 10,
205 reservedpages << (PAGE_SHIFT-10),
206 datasize >> 10,
207 initsize >> 10,
208 highmemsize >> 10);
209} 186}
210 187
211#ifdef CONFIG_BLK_DEV_INITRD 188#ifdef CONFIG_BLK_DEV_INITRD
@@ -214,11 +191,11 @@ extern int initrd_is_mapped;
214void free_initrd_mem(unsigned long start, unsigned long end) 191void free_initrd_mem(unsigned long start, unsigned long end)
215{ 192{
216 if (initrd_is_mapped) 193 if (initrd_is_mapped)
217 free_reserved_area(start, end, 0, "initrd"); 194 free_reserved_area((void *)start, (void *)end, -1, "initrd");
218} 195}
219#endif 196#endif
220 197
221void free_initmem(void) 198void free_initmem(void)
222{ 199{
223 free_initmem_default(0); 200 free_initmem_default(-1);
224} 201}